Version Description
= 0.9.19 = In this version, we have changed a little bit about LearnPress Plugin directory structure and moved all add-ons to become independent plugins. If you face any problems related to add-ons, please completely remove old version and re-install LearnPress. It does not affect your current data. Thank you.
Download this release
Release Info
Developer | ThimPress |
Plugin | LearnPress – WordPress LMS Plugin |
Version | 4.0.0-beta-1 |
Comparing to | |
See all releases |
Code changes from version 4.0.0-beta-2 to 4.0.0-beta-1
- assets/js/admin/admin.min.js +1 -1
- assets/js/dist/utils.js +2 -3
- assets/js/dist/utils.min.js +1 -1
- assets/js/vendor/chart.js +9 -9
- assets/js/vendor/plugins.all.js +357 -357
- assets/js/vendor/vue/vue_libs.js +12786 -12948
assets/js/admin/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){const t=function(){e.ajax({url:"",data:{"lp-ajax":"toggle_item_preview",item_id:this.value,previewable:this.checked?"yes":"no",nonce:e(this).attr("data-nonce")},dataType:"text",success:function(e){e=LP.parseJSON(e)}})},a=function(t){const a=e(this).addClass("disabled");t.preventDefault(),e.post({url:a.attr("href"),data:{"lp-ajax":"create-pages"},dataType:"text",success:function(e){const t=a.closest(".lp-notice").html("<p>"+e+"</p>");setTimeout((function(){t.fadeOut()}),2e3)}})},n=function(t){t.preventDefault();e(this).closest(".lp-upgrade-notice").fadeOut(),e.post({url:"",data:{"lp-hide-upgrade-message":"yes"},success:function(e){}})},o=function(t){if(e(t.target).hasClass("buy-now"))return;t.preventDefault();const a=e(this).closest(".plugin-card");e(this).hasClass("updating-message")||(e(this).addClass("updating-message button-working disabled"),e.ajax({url:e(this).attr("href"),data:{},success:function(t){e.ajax({url:window.location.href,success:function(t){const n=e(t).find("#"+a.attr("id"));n.length
|
1 |
+
!function(e){const t=function(){e.ajax({url:"",data:{"lp-ajax":"toggle_item_preview",item_id:this.value,previewable:this.checked?"yes":"no",nonce:e(this).attr("data-nonce")},dataType:"text",success:function(e){e=LP.parseJSON(e)}})},a=function(t){const a=e(this).addClass("disabled");t.preventDefault(),e.post({url:a.attr("href"),data:{"lp-ajax":"create-pages"},dataType:"text",success:function(e){const t=a.closest(".lp-notice").html("<p>"+e+"</p>");setTimeout((function(){t.fadeOut()}),2e3)}})},n=function(t){t.preventDefault();e(this).closest(".lp-upgrade-notice").fadeOut(),e.post({url:"",data:{"lp-hide-upgrade-message":"yes"},success:function(e){}})},o=function(t){if(e(t.target).hasClass("buy-now"))return;t.preventDefault();const a=e(this).closest(".plugin-card");e(this).hasClass("updating-message")||(e(this).addClass("updating-message button-working disabled"),e.ajax({url:e(this).attr("href"),data:{},success:function(t){e.ajax({url:window.location.href,success:function(t){const n=e(t).find("#"+a.attr("id"));if(n.length)a.replaceWith(n);else{if(null==learn_press_admin_localize)return;a.find(".plugin-action-buttons a").removeClass("updating-message button-working").html(learn_press_admin_localize.plugin_installed)}}})}}))},l=function(e){return e.preventDefault(),!1};e.fn._filter_post_by_author=function(){const t=e("#post-search-input");if(!t.length)return;const a=e(t[0].form),n=e('<select name="author" id="author"></select>').insertAfter(t).select2({ajax:{url:window.location.href+"&lp-ajax=search-authors",dataType:"json",s:""},placeholder:"Search by user",minimumInputLength:3,allowClear:!0}).on("select2:select",(function(){e('input[name="author"]').val(n.val())}));a.on("submit",(function(){window.location.href.removeQueryVar("author").addQueryVar("author",n.val())}))};const s=()=>{e(".lp-button-upgrade").each((function(){e(this).on("click",(function(t){t.preventDefault(),e("#lp-update-db-modal").removeClass("lp-update-db-modal__hidden")}))})),e(".lp-update-db-modal__button").on("click",(function(t){t.preventDefault();const a=e(this),n=a.text(),o=a.data("loading"),l=e(".lp-update-db-modal__content-text").data("text");a.addClass("loading"),a.text(o);const s=()=>{e.ajax({url:lpGlobalSettings.ajax+"?action=lp_update_database",method:"GET",success(t){if("success"===t.status)return a.text(n),e(".lp-update-db-modal__content").addClass("lp-update-db-modal__success"),e(".lp-update-db-modal__content-text > h3").text(l),a.removeClass("loading"),!1;s()}})};s()}));e(".lp-update-db-modal__cancel").on("click",(function(t){t.preventDefault(),e("#lp-update-db-modal").addClass("lp-update-db-modal__hidden")}))},i=()=>{e(".lp-meta-box__file").each((t,a)=>{let n;const o=e(a).find(".lp-meta-box__file_input"),l=e(a).find(".lp-meta-box__file_list"),s=e(a).find(".btn-upload"),i=!!e(a).data("multil");e(s).on("click",e=>{e.preventDefault(),n||(n=wp.media({states:[new wp.media.controller.Library({filterable:"all",multiple:i})]}),n.on("select",(function(){const e=n.state().get("selection");let t=o.val();e.forEach((function(e){if((e=e.toJSON()).id)if(i?t=t?t+","+e.id:e.id:(t=e.id,l.empty()),"image"===e.type){const t=e.sizes&&e.sizes.thumbnail?e.sizes.thumbnail.url:e.url;l.append('<li class="lp-meta-box__file_list-item image" data-attachment_id="'+e.id+'"><img src="'+t+'" /><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>')}else l.append('<li class="lp-meta-box__file_list-item image" data-attachment_id="'+e.id+'"><img class="is_file" src="'+e.icon+'" /><span>'+e.filename+'</span><ul class="actions"><li><a href="#" class="delete"></a></li></ul></li>')})),c(),o.val(t)}))),n.open()}),i&&l.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,placeholder:"lp-metabox-sortable-placeholder",start(e,t){t.item.css("background-color","#f6f6f6")},stop(e,t){t.item.removeAttr("style")},update(){let t="";l.find("li.image").css("cursor","default").each((function(){const a=e(this).attr("data-attachment_id");t=t+a+","})),c(),o.val(t)}});const c=()=>{e(l).find("li.image").each((t,a)=>{e(a).find("a.delete").on("click",(function(){if(e(a).remove(),i){let t="";e(l).find("li.image").css("cursor","default").each((function(){const a=e(this).attr("data-attachment_id");t=t+a+","})),o.val(t)}else o.val("");return!1}))})};c()})};e(document).ready((function(){if(i(),s(),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-advertisement-slider").LP("Advertisement","a","s").appendTo(e("#wpbody-content")),e(".learn-press-toggle-item-preview").on("change",t),e(".learn-press-tip").LP("QuickTip"),e(document).on("click","#learn-press-create-pages",a).on("click",".lp-upgrade-notice .close-notice",n).on("click",".plugin-action-buttons a",o).on("click","[data-remove-confirm]",l).on("mousedown",".lp-sortable-handle",(function(t){e("html, body").addClass("lp-item-moving"),e(t.target).closest(".lp-sortable-handle").css("cursor","inherit")})).on("mouseup",(function(t){e("html, body").removeClass("lp-item-moving"),e(".lp-sortable-handle").css("cursor","")})),e("#order-export__section").length){document.querySelectorAll(".tabs");const t=document.querySelectorAll(".tab"),a=document.querySelectorAll(".panel");function c(e){for(let e=0;e<t.length;e++)t[e].classList.remove("active");for(let e=0;e<a.length;e++)a[e].classList.remove("active");e.target.classList.add("active");const n=e.target.getAttribute("data-target");document.getElementById("panels").getElementsByClassName(n)[0].classList.add("active")}for(let e=0;e<t.length;e++)t[e].addEventListener("click",c,!1);const n=document.getElementById("myModal"),o=document.getElementById("order-export__button"),l=document.getElementsByClassName("close")[0];o.onclick=function(){n.style.display="block"},l.onclick=function(){n.style.display="none"},window.onclick=function(e){e.target==n&&(n.style.display="none")},e("#lp-invoice__content").length&&e("#lp-invoice__export").click((function(){const t=new jsPDF("p","pt","letter"),a={"#bypassme":(e,t)=>!0},n={top:80,bottom:60,left:40,width:522};t.fromHTML(e("#lp-invoice__content")[0],n.left,n.top,{width:n.width,elementHandlers:a},(function(e){const a=t.output("blob");window.open(URL.createObjectURL(a))}),n)})),e("#lp-invoice__update").click((function(){let t=e(this).data("id"),a=e('input[name="site_title"]'),n=e('input[name="order_date"]'),o=e('input[name="invoice_no"]'),l=e('input[name="order_customer"]'),s=e('input[name="order_email"]'),i=e('input[name="order_payment"]');a=a.is(":checked")?"check":"uncheck",n=n.is(":checked")?"check":"uncheck",o=o.is(":checked")?"check":"uncheck",l=l.is(":checked")?"check":"uncheck",s=s.is(":checked")?"check":"uncheck",i=i.is(":checked")?"check":"uncheck",e.ajax({type:"post",dataType:"html",url:"admin-ajax.php",data:{site_title:a,order_date:n,invoice_no:o,order_customer:l,order_email:s,order_id:t,order_payment:i,action:"learnpress_update_order_exports"},beforeSend(){e(".export-options__loading").addClass("active")},success(t){e("#lp-invoice__content").html(""),e("#lp-invoice__content").append(t),e(".export-options__loading").removeClass("active"),e(".options-tab").removeClass("active"),e(".preview-tab").addClass("active"),e("#panels .export-options").removeClass("active"),e("#panels .pdf-preview").addClass("active")},error(e,t,a){console.log("The following error occured: "+t,a)}})}))}if(e.fn._filter_post_by_author(),window.location.hash){const t=window.location.hash;if("#_lp_passing_grade"==t){const a=document.querySelector(t);e("html, body").animate({scrollTop:e(t).offset().top},900,"swing"),a.parentNode.style.border="2px solid orangered"}}}))}(jQuery);
|
assets/js/dist/utils.js
CHANGED
@@ -1384,10 +1384,9 @@ var _localStorage = {
|
|
1384 |
return !name ? data : value !== undefined ? value : def;
|
1385 |
},
|
1386 |
exists: function exists(name) {
|
1387 |
-
var data = _localStorage.get();
|
1388 |
-
|
1389 |
|
1390 |
-
return name
|
1391 |
},
|
1392 |
remove: function remove(name) {
|
1393 |
var data = _localStorage.get();
|
1384 |
return !name ? data : value !== undefined ? value : def;
|
1385 |
},
|
1386 |
exists: function exists(name) {
|
1387 |
+
var data = _localStorage.get();
|
|
|
1388 |
|
1389 |
+
return data.hasOwnProperty(name);
|
1390 |
},
|
1391 |
remove: function remove(name) {
|
1392 |
var data = _localStorage.get();
|
assets/js/dist/utils.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([,,,function(t,e){!function(t){function e(e,n){var o=t(e),i=o.attr("data-id")||LP.uniqueId();n=t.extend({event:"hover",autoClose:!0,single:!0,closeInterval:1e3,arrowOffset:null,tipClass:""},n,o.data()),o.attr("data-id",i);var r=o.attr("data-content-tip")||o.html(),a=t('<div class="learn-press-tip-floating">'+r+"</div>"),s=null,c=0,l=!1,u="el"===n.arrowOffset?o.outerWidth()/2:8,f=t("#__"+i);function p(){if(s)clearTimeout(s);else{n.single&&t(".learn-press-tip").not(o).LP("QuickTip","close"),a.appendTo(document.body);var e=o.offset();a.css({top:e.top-a.outerHeight()-8,left:e.left-a.outerWidth()/2+u})}}function d(){s&&clearTimeout(s),s=setTimeout((function(){a.detach(),s=null}),c)}function h(){c=0,d(),c=n.closeInterval}return 0===f.length&&t(document.body).append(t("<div />").attr("id","__"+i).html(r).css("display","none")),r=f.html(),a.addClass(n.tipClass),o.data("content-tip",r),o.attr("data-content-tip")&&(l=!0),c=n.closeInterval,!1===n.autoClose&&(a.append('<a class="close"></a>'),a.on("click",".close",(function(){h()}))),l||o.html(""),"click"===n.event&&o.on("click",(function(t){t.stopPropagation(),p()})),t(document).on("learn-press/close-all-quick-tip",(function(){h()})),o.hover((function(t){t.stopPropagation(),"click"!==n.event&&p()}),(function(t){t.stopPropagation(),n.autoClose&&d()})).addClass("ready"),{close:h,open:function(){p()}}}t.fn.LP("QuickTip",(function(n){return t.each(this,(function(){var o=t(this).data("quick-tip");o||(o=new e(this,n),t(this).data("quick-tip",o)),"string"==typeof n&&o[n]&&o[n].apply(o)}))}))}(jQuery)},function(t,e){var n=jQuery;n((function(){n('.form-field input[type="password"]').wrap('<span class="lp-password-input"></span>'),n(".lp-password-input").append('<span class="lp-show-password-input"></span>'),n(".lp-show-password-input").on("click",(function(){n(this).toggleClass("display-password"),n(this).hasClass("display-password")?n(this).siblings(['input[type="password"]']).prop("type","text"):n(this).siblings('input[type="text"]').prop("type","password")}))}))},,function(module,__webpack_exports__,__webpack_require__){"use strict";var _this=void 0;function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var $=window.jQuery||jQuery,serializeJSON=function serializeJSON(path){var isInput=$(this).is("input")||$(this).is("select")||$(this).is("textarea"),unIndexed=isInput?$(this).serializeArray():$(this).find("input, select, textarea").serializeArray(),indexed={},validate=/(\[([a-zA-Z0-9_-]+)?\]?)/g,arrayKeys={},end=!1;if($.each(unIndexed,(function(){var that=this,match=this.name.match(/^([0-9a-zA-Z_-]+)/);if(match){var keys=this.name.match(validate),objPath="indexed['"+match[0]+"']";keys?("object"!=_typeof(indexed[match[0]])&&(indexed[match[0]]={}),$.each(keys,(function(i,prop){prop=prop.replace(/\]|\[/g,"");var rawPath=objPath.replace(/'|\[|\]/g,""),objExp="",preObjPath=objPath;""==prop?(null==arrayKeys[rawPath]?arrayKeys[rawPath]=0:arrayKeys[rawPath]++,objPath+="['"+arrayKeys[rawPath]+"']"):(isNaN(prop)||(arrayKeys[rawPath]=prop),objPath+="['"+prop+"']");try{i==keys.length-1?(objExp=objPath+"=that.value;",end=!0):(objExp=objPath+"={}",end=!1);var evalString="if( typeof "+objPath+" == 'undefined'){"+objExp+";}else{if(end){if(typeof "+preObjPath+"!='object'){"+preObjPath+"={};}"+objExp+"}}";eval(evalString)}catch(t){console.log("Error:"+t+"\n"+objExp)}}))):indexed[match[0]]=this.value}})),path){path="['"+path.replace(".","']['")+"']";var c="try{indexed = indexed"+path+"}catch(ex){console.log(c, ex);}";eval(c)}return indexed},LP_Tooltip=function(t){return t=$.extend({},{offset:[0,0]},t||{}),$.each(_this,(function(){var e=$(this),n=e.data("content");if(n&&void 0===e.data("LP_Tooltip")){var o=null;e.on("mouseenter",(function(i){o=$('<div class="learn-press-tooltip-bubble"/>').html(n).appendTo($("body")).hide();var r=e.offset();if(Array.isArray(t.offset)){var a=t.offset[1],s=t.offset[0];$.isNumeric(s)&&(r.left+=s),$.isNumeric(a)&&(r.top+=a)}o.css({top:r.top,left:r.left}),o.fadeIn()})),e.on("mouseleave",(function(t){o&&o.remove()})),e.data("tooltip",!0)}}))},hasEvent=function(t){var e=$(this).data("events");if(void 0===e.LP)return!1;for(i=0;i<e.LP.length;i++)if(e.LP[i].namespace==t)return!0;return!1},dataToJSON=function(){var t={};return $.each(this[0].attributes,(function(){var e=this.name.match(/^data-(.*)/);e&&(t[e[1]]=this.value)})),t},rows=function(){var t=$(this).height(),e=$(this).css("line-height").replace("px","");return $(this).attr({height:t,"line-height":e}),Math.floor(t/parseInt(e))},checkLines=function(t){return this.each((function(){var e=$(this).rows();t.call(this,e)}))},findNext=function(t){var e=$(t),n=this.first(),o=e.index(n),i=e.eq(o+1);return!!i.length&&i},findPrev=function(t){var e=$(t),n=this.first(),o=e.index(n),i=e.eq(o-1);return!!i.length&&i},progress=function(t){return this.each((function(){var e=parseInt(t/100*360),n=$(this);e<180?n.find(".progress-circle").removeClass("gt-50"):n.find(".progress-circle").addClass("gt-50"),n.find(".fill").css({transform:"rotate("+e+"deg)"})}))};$.fn.serializeJSON=serializeJSON,$.fn.LP_Tooltip=LP_Tooltip,$.fn.hasEvent=hasEvent,$.fn.dataToJSON=dataToJSON,$.fn.rows=rows,$.fn.checkLines=checkLines,$.fn.findNext=findNext,$.fn.findPrev=findPrev,$.fn.progress=progress;var _unused_webpack_default_export={serializeJSON:serializeJSON,LP_Tooltip:LP_Tooltip,hasEvent:hasEvent,dataToJSON:dataToJSON,rows:rows,checkLines:checkLines,findNext:findNext,findPrev:findPrev,progress:progress}},,,function(t,e,n){"use strict";n.r(e);var o,i=window.jQuery;void 0!==i&&(i.fn.LP=o=function(t,e){if("function"==typeof e)i.fn["LP_"+t]=e;else if(t){var n=[];if(arguments.length>1)for(var o=1;o<arguments.length;o++)n.push(arguments[o]);return"function"==typeof i(this)["LP_"+t]?i(this)["LP_"+t].apply(this,n):this}return this});var r=o,a=n(3),s=n.n(a),c=window.jQuery,l={$block:null,$window:null,events:{},instances:[],instance:null,quickConfirm:function(t,e){var n=c(t);c("[learn-press-quick-confirm]").each((function(){var t;(t=c(this).data("quick-confirm"))&&(console.log(t),t.destroy())})),!n.attr("learn-press-quick-confirm")&&n.attr("learn-press-quick-confirm","true").data("quick-confirm",new function(t,e){var n=c(t),o=c('<span class="learn-press-quick-confirm"></span>').insertAfter(n),i=c(t).position()||{left:0,top:0},r=null,a=null,s=3,l=function(){o.fadeOut("fast",(function(){c(this).remove(),o.parent().css("position","")})),n.removeAttr("learn-press-quick-confirm").data("quick-confirm",void 0),u()},u=function(){a&&clearInterval(a),r&&clearInterval(r)},f=function(){r=setInterval((function(){0==--s&&(l.call(o[0]),"function"==typeof e.onCancel&&e.onCancel(e.data),u()),o.find("span").html(" ("+s+")")}),1e3),a=setInterval((function(){n.is(":visible")&&"hidden"!=n.css("visibility")||(u(),o.remove(),o.parent().css("position",""),"function"==typeof e.onCancel&&e.onCancel(e.data))}),350)};e=c.extend({message:"",data:null,onOk:null,onCancel:null,offset:{top:0,left:0}},e||{}),o.html(e.message||n.attr("data-confirm-remove")||"Are you sure?").append("<span> ("+s+")</span>").css({}),o.click((function(){"function"==typeof e.onOk&&e.onOk(e.data),l()})).hover((function(){u()}),(function(){f()})),o.css({left:i.left+n.outerWidth()-o.outerWidth()+e.offset.left,top:i.top+n.outerHeight()+e.offset.top+5}).hide().fadeIn("fast"),f(),this.destroy=function(){o.remove(),n.removeAttr("learn-press-quick-confirm").data("quick-confirm",void 0),u()}}(t,e))},show:function(t,e){c.proxy((function(){e=c.extend({title:"",buttons:"",events:!1,autohide:!1,message:t,data:!1,id:LP.uniqueId(),onHide:null},e||{}),this.instances.push(e),this.instance=e;c(document);var n=c(document.body);this.$block||(this.$block=c('<div id="learn-press-message-box-block"></div>').appendTo(n)),this.$window||(this.$window=c('<div id="learn-press-message-box-window"><div id="message-box-wrap"></div> </div>').insertAfter(this.$block),this.$window.click((function(){}))),this._createWindow(t,e.title,e.buttons),this.$block.show(),this.$window.show().attr("instance",e.id),c(window).bind("resize.message-box",c.proxy(this.update,this)).bind("scroll.message-box",c.proxy(this.update,this)),this.update(!0),e.autohide&&setTimeout((function(){LP.MessageBox.hide(),"function"==typeof e.onHide&&e.onHide.call(LP.MessageBox,e)}),e.autohide)}),this)()},blockUI:function(t){t=(!1!==t?t||"Wait a moment":"")+'<div class="message-box-animation"></div>',this.show(t)},hide:function(t,e){e?this._removeInstance(e.id):this.instance&&this._removeInstance(this.instance.id),0===this.instances.length?(this.$block&&this.$block.hide(),this.$window&&this.$window.hide(),c(window).unbind("resize.message-box",this.update).unbind("scroll.message-box",this.update)):this.instance&&this._createWindow(this.instance.message,this.instance.title,this.instance.buttons)},update:function(t){var e=this,n=this.$window.find("#message-box-wrap"),o=n.data("timer"),i=function(){LP.Hook.doAction("learn_press_message_box_before_resize",e);var t=n.find(".message-box-content").css("height","").css("overflow","hidden"),o=(n.outerWidth(),n.outerHeight()),i=t.height(),r=c(window).height();n.offset().top;i>r-50?(t.css({height:r-25}),o=n.outerHeight()):t.css("height","").css("overflow",""),n.css({marginTop:(c(window).height()-o)/2}),LP.Hook.doAction("learn_press_message_box_resize",o,e)};t&&i(),o&&clearTimeout(o),o=setTimeout(i,250)},_removeInstance:function(t){for(var e=0;e<this.instances.length;e++)if(this.instances[e].id===t){this.instances.splice(e,1);var n=this.instances.length;n?(this.instance=this.instances[n-1],this.$window.attr("instance",this.instance.id)):(this.instance=!1,this.$window.removeAttr("instance"));break}},_getInstance:function(t){for(var e=0;e<this.instances.length;e++)if(this.instances[e].id===t)return this.instances[e]},_createWindow:function(t,e,n){var o=this.$window.find("#message-box-wrap").html("");if(e&&o.append('<h3 class="message-box-title">'+e+"</h3>"),o.append(c('<div class="message-box-content"></div>').html(t)),n){var i=c('<div class="message-box-buttons"></div>');switch(n){case"yesNo":i.append(this._createButton(LP_Settings.localize.button_yes,"yes")),i.append(this._createButton(LP_Settings.localize.button_no,"no"));break;case"okCancel":i.append(this._createButton(LP_Settings.localize.button_ok,"ok")),i.append(this._createButton(LP_Settings.localize.button_cancel,"cancel"));break;default:i.append(this._createButton(LP_Settings.localize.button_ok,"ok"))}o.append(i)}},_createButton:function(t,e){var n=c('<button type="button" class="button message-box-button message-box-button-'+e+'">'+t+"</button>"),o="on"+(e.substr(0,1).toUpperCase()+e.substr(1));return n.data("callback",o).click((function(){var t=c(this).data("instance"),e=t.events[c(this).data("callback")];"function"===c.type(e)&&!1===e.apply(LP.MessageBox,[t])||LP.MessageBox.hide(null,t)})).data("instance",this.instance),n}},u=function(t){var e={};window.jQuery;this.on=function(n,o){var i=n.split("."),r="";return i.length>1&&(n=i[0],r=i[1]),e[n]||(e[n]=[[],{}]),r?(e[n][1][r]||(e[n][1][r]=[]),e[n][1][r].push(o)):e[n][0].push(o),t},this.off=function(n,o){var i=n.split("."),r="";if(i.length>1&&(n=i[0],r=i[1]),!e[n])return t;var a=-1;if(r){if(!e[n][1][r])return t;if("function"==typeof o){if((a=e[n][1][r].indexOf(o))<0)return t;e[n][1][r].splice(a,1)}else e[n][1][r]=[]}else if("function"==typeof o){if((a=e[n][0].indexOf(o))<0)return t;e[n][0].splice(a,1)}else e[n][0]=[];return t},this.callEvent=function(n,o){if(e[n]){if(e[n][0])for(var i=0;i<e[n][0].length;i++)"function"==typeof e[n][0][i]&&e[n][i][0].apply(t,o);if(e[n][1])for(var i in e[n][1])for(var r=0;r<e[n][1][i].length;r++)"function"==typeof e[n][1][i][r]&&e[n][1][i][r].apply(t,o)}}},f={hooks:{action:{},filter:{}},addAction:function(t,e,n,o){return this.addHook("action",t,e,n,o),this},addFilter:function(t,e,n,o){return this.addHook("filter",t,e,n,o),this},doAction:function(t){return this.doHook("action",t,arguments)},applyFilters:function(t){return this.doHook("filter",t,arguments)},removeAction:function(t,e){return this.removeHook("action",t,e),this},removeFilter:function(t,e,n){return this.removeHook("filter",t,e,n),this},addHook:function(t,e,n,o,i){void 0===this.hooks[t][e]&&(this.hooks[t][e]=[]);var r=this.hooks[t][e];return void 0===i&&(i=e+"_"+r.length),this.hooks[t][e].push({tag:i,callable:n,priority:o}),this},doHook:function(t,e,n){if(n=Array.prototype.slice.call(n,1),void 0!==this.hooks[t][e]){var o,i=this.hooks[t][e];i.sort((function(t,e){return t.priority-e.priority}));for(var r=0;r<i.length;r++)"function"!=typeof(o=i[r].callable)&&(o=window[o]),"action"===t?n[r]=o.apply(null,n):n[0]=o.apply(null,n)}return"filter"===t?n[0]:n},removeHook:function(t,e,n,o){if(void 0!==this.hooks[t][e])for(var i=this.hooks[t][e],r=i.length-1;r>=0;r--)void 0!==o&&o!==i[r].tag||void 0!==n&&n!==i[r].priority||i.splice(r,1);return this}},p={get:function(t,e,n){var o;if(n)o=wpCookies.get(t);else{var i=wpCookies.get("LP");i&&(i=JSON.parse(i),o=t?i[t]:i)}return o||o===e||(o=e),o},set:function(t,e,n,o,i,r){if(arguments.length>2)wpCookies.set(t,e,n,o,i,r);else if(2==arguments.length){var a=wpCookies.get("LP");(a=a?JSON.parse(a):{})[t]=e,wpCookies.set("LP",JSON.stringify(a),"","/")}else wpCookies.set("LP",JSON.stringify(t),"","/")},remove:function(t){var e=p.get(),n=new RegExp(t,"g"),o={},i=t.match(/\*/);for(var r in e)i?r.match(n)||(o[r]=e[r]):t!=r&&(o[r]=e[r]);p.set(o)}},d=p,h={__key:"LP",set:function(t,e){var n=h.get(),o=lodash.set;o(n,t,e),localStorage.setItem(h.__key,JSON.stringify(n))},get:function(t,e){var n=JSON.parse(localStorage.getItem(h.__key)||"{}"),o=lodash.get,i=o(n,t);return t?void 0!==i?i:e:n},exists:function(t){return t in h.get()},remove:function(t){var e=h.get(),n=lodash.omit(e,t);h.__set(n)},__get:function(){return localStorage.getItem(h.__key)},__set:function(t){localStorage.setItem(h.__key,JSON.stringify(t||"{}"))}},v=h,g=(n(6),1),y=window.jQuery||jQuery,m=function(t){var e="ajax-iframe-"+g,n=y('form[name="'+e+'"]');n.length||(n=y("<iframe />").appendTo(document.body).attr({name:e,src:"#"})),y(t).on("submit",(function(){var n=y(t).clone().appendTo(document.body);return n.attr("target",e),n.find("#submit").remove(),!1})),g++},b=n(4),w=n.n(b);function k(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function x(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var P=jQuery;String.prototype.getQueryVar=function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(this);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},String.prototype.addQueryVar=function(t,e){var n=this,o=n.split("#");return n=o[0],t.match(/\[/)?(n+=n.match(/\?/)?"&":"?",n+=t+"="+e):-1!=n.indexOf("&"+t+"=")||-1!=n.indexOf("?"+t+"=")?n=n.replace(new RegExp(t+"=([^&#]*)","g"),t+"="+e):(n+=n.match(/\?/)?"&":"?",n+=t+"="+e),n+(o[1]?"#"+o[1]:"")},String.prototype.removeQueryVar=function(t){var e=this,n=e.split("#");e=n[0],t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var o=new RegExp("[\\?&]"+t+"([[][^=]*)?=([^&#]*)","g");return(e=e.replace(o,""))+(n[1]?"#"+n[1]:"")};var S={Hook:f,setUrl:function(t,e,n){t&&(history.pushState({},n,t),LP.Hook.doAction("learn_press_set_location_url",t))},toggleGroupSection:function(t,e){var n=P(t);n.hasClass("hide-if-js")&&n.hide().removeClass("hide-if-js"),n.removeClass("hide-if-js").slideToggle((function(){P(this).is(":visible")?P(e).addClass("toggle-on").removeClass("toggle-off"):P(e).addClass("toggle-off").removeClass("toggle-on")}))},overflow:function(t,e){var n=P(t),o=n.css("overflow");e?n.css("overflow",e).data("overflow",o):n.css("overflow",n.data("overflow"))},getUrl:function(){return window.location.href},addQueryVar:function(t,e,n){return(void 0===n?window.location.href:n).addQueryVar(t,e)},removeQueryVar:function(t,e){return(void 0===e?window.location.href:e).removeQueryVar(t)},reload:function(t){t||(t=window.location.href),window.location.href=t},parseResponse:function(t,e){var n=t.match(/<\x2D\x2D LP_AJAX_START \x2D\x2D>([\s\S]*)<\x2D\x2D LP_AJAX_END \x2D\x2D>/);return n&&(t=n[1]),"json"===(e||"json")?this.parseJSON(t):t},parseJSON:function(t){if("string"!=typeof t)return t;var e=String.raw({raw:t}).match(/<\x2D\x2D LP_AJAX_START \x2D\x2D>([\s\S]*)<\x2D\x2D LP_AJAX_END \x2D\x2D>/);try{t=e?JSON.parse(e[1].replace(/(?:\r\n|\r|\n)/g,"")):JSON.parse(t)}catch(e){t={}}return t},ajax:function(t){var e=t.type||"post",n=t.dataType||"json",o=t.action?P.extend(t.data,{"lp-ajax":t.action}):t.data,i=t.beforeSend||function(){},r=t.url||window.location.href;P.ajax({data:o,url:r,type:e,dataType:"html",beforeSend:i.apply(null,t),success:function(e){var o=LP.parseResponse(e,n);"function"==typeof t.success&&t.success(o,e)},error:function(){"function"==typeof t.error&&t.error.apply(null,LP.funcArgs2Array())}})},doAjax:function(t){var e=t.type||"post",n=t.dataType||"json",o=(void 0===t.prefix||"learnpress_")+t.action,i=t.action?P.extend(t.data,{action:o}):t.data;P.ajax({data:i,url:t.url||window.location.href,type:e,dataType:"html",success:function(e){var o=LP.parseResponse(e,n);"function"==typeof t.success&&t.success(o,e)},error:function(){"function"==typeof t.error&&t.error.apply(null,LP.funcArgs2Array())}})},funcArgs2Array:function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e},addFilter:function(t,e){var n=P(document),o="LP."+t;return n.on(o,e),LP.log(n.data("events")),this},applyFilters:function(){var t=P(document),e=arguments[0],n=this.funcArgs2Array(arguments);return t.hasEvent(e)?(n[0]="LP."+e,t.triggerHandler.apply(t,n)):n[1]},addAction:function(t,e){return this.addFilter(t,e)},doAction:function(){var t=P(document),e=arguments[0],n=this.funcArgs2Array(arguments);t.hasEvent(e)&&(n[0]="LP."+e,t.trigger.apply(t,n))},toElement:function(t,e){if(0!==P(t).length){e=P.extend({delay:300,duration:"slow",offset:50,container:null,callback:null,invisible:!1},e||{});var n,o=P(e.container);0===o.length&&(o=P("body, html")),n=o.offset().top;var i=P(t).offset().top+o.scrollTop()-n-e.offset;e.invisible&&function(t,e){var n=o.scrollTop(),i=n+o.height(),r=P(t).offset().top-o.offset().top,a=r+P(t).height();return!0===e?n<r&&i>a:r<=i&&a>=n}(t,!0)||o.fadeIn(10).delay(e.delay).animate({scrollTop:i},e.duration,e.callback)}},uniqueId:function(t,e){var n;void 0===t&&(t="");var o=function(t,e){return e<(t=parseInt(t,10).toString(16)).length?t.slice(t.length-e):e>t.length?new Array(e-t.length+1).join("0")+t:t};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,n=t,n+=o(parseInt((new Date).getTime()/1e3,10),8),n+=o(this.php_js.uniqidSeed,5),e&&(n+=(10*Math.random()).toFixed(8).toString()),n},log:function(){for(var t=0,e=arguments.length;t<e;t++)console.log(arguments[t])},blockContent:function(){0===P("#learn-press-block-content").length&&P(LP.template("learn-press-template-block-content",{})).appendTo(P("body")),LP.hideMainScrollbar().addClass("block-content"),P(document).trigger("learn_press_block_content")},unblockContent:function(){setTimeout((function(){LP.showMainScrollbar().removeClass("block-content"),P(document).trigger("learn_press_unblock_content")}),350)},hideMainScrollbar:function(t){t||(t="html, body");var e=P(t);return e.each((function(){var t=P(this),e=t.css("overflow");t.css("overflow","hidden").attr("overflow",e)})),e},showMainScrollbar:function(t){t||(t="html, body");var e=P(t);return e.each((function(){var t=P(this),e=t.attr("overflow");t.css("overflow",e).removeAttr("overflow")})),e},template:"undefined"!=typeof _?_.memoize((function(t,e){var n,o={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"},i=function(e){return(n=n||_.template(P("#"+t).html(),null,o))(e)};return e?i(e):i}),(function(t,e){return t+"-"+JSON.stringify(e)})):function(){return""},alert:function(t,e){var n="",o="";"string"==typeof t?o=t:(void 0!==t.title&&(n=t.title),void 0!==t.message&&(o=t.message)),P.alerts.alert(o,n,(function(t){LP._on_alert_hide(),e&&e(t)})),this._on_alert_show()},confirm:function(t,e){var n="",o="";"string"==typeof t?o=t:(void 0!==t.title&&(n=t.title),void 0!==t.message&&(o=t.message)),P.alerts.confirm(o,n,(function(t){LP._on_alert_hide(),e&&e(t)})),this._on_alert_show()},_on_alert_show:function(){var t=P("#popup_container");P('<span id="popup_container_placeholder" />').insertAfter(t).data("xxx",t);t.stop().css("top","-=50").css("opacity","0").animate({top:"+=50",opacity:1},250)},_on_alert_hide:function(){var t=P("#popup_container_placeholder"),e=t.data("xxx");e&&e.replaceWith(t),e.appendTo(P(document.body)),e.stop().animate({top:"+=50",opacity:0},250,(function(){P(this).remove()}))},sendMessage:function(t,e,n,o){P.isPlainObject(t)&&(t=JSON.stringify(t)),n=n||"*",(e=e||window).postMessage(t,n,o)},receiveMessage:function(t,e){var n=t.origin||t.originalEvent.origin,o=t.data||t.originalEvent.data||"";("string"==typeof o||o instanceof String)&&0===o.indexOf("{")&&(o=LP.parseJSON(o)),LP.Hook.doAction("learn_press_receive_message",o,n)},camelCaseDashObjectKeys:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=LP,o=function(t){return Array.isArray(t)},i=function(t){return t===Object(t)&&!o(t)&&"function"!=typeof t},r=function(t){return t.replace(/([-_][a-z])/gi,(function(t){return t.toUpperCase().replace("-","").replace("_","")}))};if(i(t)){var a={};return Object.keys(t).forEach((function(o){a[r(o)]=e?n.camelCaseDashObjectKeys(t[o]):t[o]})),a}return o(t)?t.map((function(t){return n.camelCaseDashObjectKeys(t)})):t},IframeSubmit:m};P(document).ready((function(){var t,e;void 0!==P.alerts&&(P.alerts.overlayColor="#000",P.alerts.overlayOpacity=.5,P.alerts.okButton=lpGlobalSettings.localize.button_ok,P.alerts.cancelButton=lpGlobalSettings.localize.button_cancel),P(".learn-press-message.fixed").each((function(){var t=P(this),e=t.data();!function(t,e){e.delayIn&&setTimeout((function(){t.show().hide().fadeIn()}),e.delayIn),e.delayOut&&setTimeout((function(){t.fadeOut()}),e.delayOut+(e.delayIn||0))}(t,e)})),setTimeout((function(){P(".learn-press-nav-tabs li.active:not(.default) a").trigger("click")}),300),P("body.course-item-popup").parent().css("overflow","hidden"),t=null,e=function(){P(".auto-check-lines").checkLines((function(t){t>1?P(this).removeClass("single-lines"):P(this).addClass("single-lines"),P(this).attr("rows",t)}))},P(window).on("resize.check-lines",(function(){t?(t&&clearTimeout(t),t=setTimeout(e,300)):e()})),P(".learn-press-tooltip, .lp-passing-conditional").LP_Tooltip({offset:[24,24]}),P(".learn-press-icon").LP_Tooltip({offset:[30,30]}),P(".learn-press-message[data-autoclose]").each((function(){var t=P(this),e=parseInt(t.data("autoclose"));e&&setTimeout((function(t){t.fadeOut()}),e,t)})),P(document).on("click",(function(){P(document).trigger("learn-press/close-all-quick-tip")}))})),function(){window.LP=window.LP||{},"string"==typeof arguments[0]?(LP[arguments[0]]=LP[arguments[0]]||{},LP[arguments[0]]=jQuery.extend(LP[arguments[0]],arguments[1])):LP=jQuery.extend(LP,arguments[0])}(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?k(Object(n),!0).forEach((function(e){x(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({Event_Callback:u,MessageBox:l,Cookies:d,localStorage:v},S));e.default={fn:r,QuickTip:s.a,Cookies:d,localStorage:v,showPass:w.a}}]);
|
1 |
+
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([,,,function(t,e){!function(t){function e(e,n){var o=t(e),i=o.attr("data-id")||LP.uniqueId();n=t.extend({event:"hover",autoClose:!0,single:!0,closeInterval:1e3,arrowOffset:null,tipClass:""},n,o.data()),o.attr("data-id",i);var r=o.attr("data-content-tip")||o.html(),a=t('<div class="learn-press-tip-floating">'+r+"</div>"),s=null,c=0,l=!1,u="el"===n.arrowOffset?o.outerWidth()/2:8,f=t("#__"+i);function p(){if(s)clearTimeout(s);else{n.single&&t(".learn-press-tip").not(o).LP("QuickTip","close"),a.appendTo(document.body);var e=o.offset();a.css({top:e.top-a.outerHeight()-8,left:e.left-a.outerWidth()/2+u})}}function d(){s&&clearTimeout(s),s=setTimeout((function(){a.detach(),s=null}),c)}function h(){c=0,d(),c=n.closeInterval}return 0===f.length&&t(document.body).append(t("<div />").attr("id","__"+i).html(r).css("display","none")),r=f.html(),a.addClass(n.tipClass),o.data("content-tip",r),o.attr("data-content-tip")&&(l=!0),c=n.closeInterval,!1===n.autoClose&&(a.append('<a class="close"></a>'),a.on("click",".close",(function(){h()}))),l||o.html(""),"click"===n.event&&o.on("click",(function(t){t.stopPropagation(),p()})),t(document).on("learn-press/close-all-quick-tip",(function(){h()})),o.hover((function(t){t.stopPropagation(),"click"!==n.event&&p()}),(function(t){t.stopPropagation(),n.autoClose&&d()})).addClass("ready"),{close:h,open:function(){p()}}}t.fn.LP("QuickTip",(function(n){return t.each(this,(function(){var o=t(this).data("quick-tip");o||(o=new e(this,n),t(this).data("quick-tip",o)),"string"==typeof n&&o[n]&&o[n].apply(o)}))}))}(jQuery)},function(t,e){var n=jQuery;n((function(){n('.form-field input[type="password"]').wrap('<span class="lp-password-input"></span>'),n(".lp-password-input").append('<span class="lp-show-password-input"></span>'),n(".lp-show-password-input").on("click",(function(){n(this).toggleClass("display-password"),n(this).hasClass("display-password")?n(this).siblings(['input[type="password"]']).prop("type","text"):n(this).siblings('input[type="text"]').prop("type","password")}))}))},,function(module,__webpack_exports__,__webpack_require__){"use strict";var _this=void 0;function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var $=window.jQuery||jQuery,serializeJSON=function serializeJSON(path){var isInput=$(this).is("input")||$(this).is("select")||$(this).is("textarea"),unIndexed=isInput?$(this).serializeArray():$(this).find("input, select, textarea").serializeArray(),indexed={},validate=/(\[([a-zA-Z0-9_-]+)?\]?)/g,arrayKeys={},end=!1;if($.each(unIndexed,(function(){var that=this,match=this.name.match(/^([0-9a-zA-Z_-]+)/);if(match){var keys=this.name.match(validate),objPath="indexed['"+match[0]+"']";keys?("object"!=_typeof(indexed[match[0]])&&(indexed[match[0]]={}),$.each(keys,(function(i,prop){prop=prop.replace(/\]|\[/g,"");var rawPath=objPath.replace(/'|\[|\]/g,""),objExp="",preObjPath=objPath;""==prop?(null==arrayKeys[rawPath]?arrayKeys[rawPath]=0:arrayKeys[rawPath]++,objPath+="['"+arrayKeys[rawPath]+"']"):(isNaN(prop)||(arrayKeys[rawPath]=prop),objPath+="['"+prop+"']");try{i==keys.length-1?(objExp=objPath+"=that.value;",end=!0):(objExp=objPath+"={}",end=!1);var evalString="if( typeof "+objPath+" == 'undefined'){"+objExp+";}else{if(end){if(typeof "+preObjPath+"!='object'){"+preObjPath+"={};}"+objExp+"}}";eval(evalString)}catch(t){console.log("Error:"+t+"\n"+objExp)}}))):indexed[match[0]]=this.value}})),path){path="['"+path.replace(".","']['")+"']";var c="try{indexed = indexed"+path+"}catch(ex){console.log(c, ex);}";eval(c)}return indexed},LP_Tooltip=function(t){return t=$.extend({},{offset:[0,0]},t||{}),$.each(_this,(function(){var e=$(this),n=e.data("content");if(n&&void 0===e.data("LP_Tooltip")){var o=null;e.on("mouseenter",(function(i){o=$('<div class="learn-press-tooltip-bubble"/>').html(n).appendTo($("body")).hide();var r=e.offset();if(Array.isArray(t.offset)){var a=t.offset[1],s=t.offset[0];$.isNumeric(s)&&(r.left+=s),$.isNumeric(a)&&(r.top+=a)}o.css({top:r.top,left:r.left}),o.fadeIn()})),e.on("mouseleave",(function(t){o&&o.remove()})),e.data("tooltip",!0)}}))},hasEvent=function(t){var e=$(this).data("events");if(void 0===e.LP)return!1;for(i=0;i<e.LP.length;i++)if(e.LP[i].namespace==t)return!0;return!1},dataToJSON=function(){var t={};return $.each(this[0].attributes,(function(){var e=this.name.match(/^data-(.*)/);e&&(t[e[1]]=this.value)})),t},rows=function(){var t=$(this).height(),e=$(this).css("line-height").replace("px","");return $(this).attr({height:t,"line-height":e}),Math.floor(t/parseInt(e))},checkLines=function(t){return this.each((function(){var e=$(this).rows();t.call(this,e)}))},findNext=function(t){var e=$(t),n=this.first(),o=e.index(n),i=e.eq(o+1);return!!i.length&&i},findPrev=function(t){var e=$(t),n=this.first(),o=e.index(n),i=e.eq(o-1);return!!i.length&&i},progress=function(t){return this.each((function(){var e=parseInt(t/100*360),n=$(this);e<180?n.find(".progress-circle").removeClass("gt-50"):n.find(".progress-circle").addClass("gt-50"),n.find(".fill").css({transform:"rotate("+e+"deg)"})}))};$.fn.serializeJSON=serializeJSON,$.fn.LP_Tooltip=LP_Tooltip,$.fn.hasEvent=hasEvent,$.fn.dataToJSON=dataToJSON,$.fn.rows=rows,$.fn.checkLines=checkLines,$.fn.findNext=findNext,$.fn.findPrev=findPrev,$.fn.progress=progress;var _unused_webpack_default_export={serializeJSON:serializeJSON,LP_Tooltip:LP_Tooltip,hasEvent:hasEvent,dataToJSON:dataToJSON,rows:rows,checkLines:checkLines,findNext:findNext,findPrev:findPrev,progress:progress}},,,function(t,e,n){"use strict";n.r(e);var o,i=window.jQuery;void 0!==i&&(i.fn.LP=o=function(t,e){if("function"==typeof e)i.fn["LP_"+t]=e;else if(t){var n=[];if(arguments.length>1)for(var o=1;o<arguments.length;o++)n.push(arguments[o]);return"function"==typeof i(this)["LP_"+t]?i(this)["LP_"+t].apply(this,n):this}return this});var r=o,a=n(3),s=n.n(a),c=window.jQuery,l={$block:null,$window:null,events:{},instances:[],instance:null,quickConfirm:function(t,e){var n=c(t);c("[learn-press-quick-confirm]").each((function(){var t;(t=c(this).data("quick-confirm"))&&(console.log(t),t.destroy())})),!n.attr("learn-press-quick-confirm")&&n.attr("learn-press-quick-confirm","true").data("quick-confirm",new function(t,e){var n=c(t),o=c('<span class="learn-press-quick-confirm"></span>').insertAfter(n),i=c(t).position()||{left:0,top:0},r=null,a=null,s=3,l=function(){o.fadeOut("fast",(function(){c(this).remove(),o.parent().css("position","")})),n.removeAttr("learn-press-quick-confirm").data("quick-confirm",void 0),u()},u=function(){a&&clearInterval(a),r&&clearInterval(r)},f=function(){r=setInterval((function(){0==--s&&(l.call(o[0]),"function"==typeof e.onCancel&&e.onCancel(e.data),u()),o.find("span").html(" ("+s+")")}),1e3),a=setInterval((function(){n.is(":visible")&&"hidden"!=n.css("visibility")||(u(),o.remove(),o.parent().css("position",""),"function"==typeof e.onCancel&&e.onCancel(e.data))}),350)};e=c.extend({message:"",data:null,onOk:null,onCancel:null,offset:{top:0,left:0}},e||{}),o.html(e.message||n.attr("data-confirm-remove")||"Are you sure?").append("<span> ("+s+")</span>").css({}),o.click((function(){"function"==typeof e.onOk&&e.onOk(e.data),l()})).hover((function(){u()}),(function(){f()})),o.css({left:i.left+n.outerWidth()-o.outerWidth()+e.offset.left,top:i.top+n.outerHeight()+e.offset.top+5}).hide().fadeIn("fast"),f(),this.destroy=function(){o.remove(),n.removeAttr("learn-press-quick-confirm").data("quick-confirm",void 0),u()}}(t,e))},show:function(t,e){c.proxy((function(){e=c.extend({title:"",buttons:"",events:!1,autohide:!1,message:t,data:!1,id:LP.uniqueId(),onHide:null},e||{}),this.instances.push(e),this.instance=e;c(document);var n=c(document.body);this.$block||(this.$block=c('<div id="learn-press-message-box-block"></div>').appendTo(n)),this.$window||(this.$window=c('<div id="learn-press-message-box-window"><div id="message-box-wrap"></div> </div>').insertAfter(this.$block),this.$window.click((function(){}))),this._createWindow(t,e.title,e.buttons),this.$block.show(),this.$window.show().attr("instance",e.id),c(window).bind("resize.message-box",c.proxy(this.update,this)).bind("scroll.message-box",c.proxy(this.update,this)),this.update(!0),e.autohide&&setTimeout((function(){LP.MessageBox.hide(),"function"==typeof e.onHide&&e.onHide.call(LP.MessageBox,e)}),e.autohide)}),this)()},blockUI:function(t){t=(!1!==t?t||"Wait a moment":"")+'<div class="message-box-animation"></div>',this.show(t)},hide:function(t,e){e?this._removeInstance(e.id):this.instance&&this._removeInstance(this.instance.id),0===this.instances.length?(this.$block&&this.$block.hide(),this.$window&&this.$window.hide(),c(window).unbind("resize.message-box",this.update).unbind("scroll.message-box",this.update)):this.instance&&this._createWindow(this.instance.message,this.instance.title,this.instance.buttons)},update:function(t){var e=this,n=this.$window.find("#message-box-wrap"),o=n.data("timer"),i=function(){LP.Hook.doAction("learn_press_message_box_before_resize",e);var t=n.find(".message-box-content").css("height","").css("overflow","hidden"),o=(n.outerWidth(),n.outerHeight()),i=t.height(),r=c(window).height();n.offset().top;i>r-50?(t.css({height:r-25}),o=n.outerHeight()):t.css("height","").css("overflow",""),n.css({marginTop:(c(window).height()-o)/2}),LP.Hook.doAction("learn_press_message_box_resize",o,e)};t&&i(),o&&clearTimeout(o),o=setTimeout(i,250)},_removeInstance:function(t){for(var e=0;e<this.instances.length;e++)if(this.instances[e].id===t){this.instances.splice(e,1);var n=this.instances.length;n?(this.instance=this.instances[n-1],this.$window.attr("instance",this.instance.id)):(this.instance=!1,this.$window.removeAttr("instance"));break}},_getInstance:function(t){for(var e=0;e<this.instances.length;e++)if(this.instances[e].id===t)return this.instances[e]},_createWindow:function(t,e,n){var o=this.$window.find("#message-box-wrap").html("");if(e&&o.append('<h3 class="message-box-title">'+e+"</h3>"),o.append(c('<div class="message-box-content"></div>').html(t)),n){var i=c('<div class="message-box-buttons"></div>');switch(n){case"yesNo":i.append(this._createButton(LP_Settings.localize.button_yes,"yes")),i.append(this._createButton(LP_Settings.localize.button_no,"no"));break;case"okCancel":i.append(this._createButton(LP_Settings.localize.button_ok,"ok")),i.append(this._createButton(LP_Settings.localize.button_cancel,"cancel"));break;default:i.append(this._createButton(LP_Settings.localize.button_ok,"ok"))}o.append(i)}},_createButton:function(t,e){var n=c('<button type="button" class="button message-box-button message-box-button-'+e+'">'+t+"</button>"),o="on"+(e.substr(0,1).toUpperCase()+e.substr(1));return n.data("callback",o).click((function(){var t=c(this).data("instance"),e=t.events[c(this).data("callback")];"function"===c.type(e)&&!1===e.apply(LP.MessageBox,[t])||LP.MessageBox.hide(null,t)})).data("instance",this.instance),n}},u=function(t){var e={};window.jQuery;this.on=function(n,o){var i=n.split("."),r="";return i.length>1&&(n=i[0],r=i[1]),e[n]||(e[n]=[[],{}]),r?(e[n][1][r]||(e[n][1][r]=[]),e[n][1][r].push(o)):e[n][0].push(o),t},this.off=function(n,o){var i=n.split("."),r="";if(i.length>1&&(n=i[0],r=i[1]),!e[n])return t;var a=-1;if(r){if(!e[n][1][r])return t;if("function"==typeof o){if((a=e[n][1][r].indexOf(o))<0)return t;e[n][1][r].splice(a,1)}else e[n][1][r]=[]}else if("function"==typeof o){if((a=e[n][0].indexOf(o))<0)return t;e[n][0].splice(a,1)}else e[n][0]=[];return t},this.callEvent=function(n,o){if(e[n]){if(e[n][0])for(var i=0;i<e[n][0].length;i++)"function"==typeof e[n][0][i]&&e[n][i][0].apply(t,o);if(e[n][1])for(var i in e[n][1])for(var r=0;r<e[n][1][i].length;r++)"function"==typeof e[n][1][i][r]&&e[n][1][i][r].apply(t,o)}}},f={hooks:{action:{},filter:{}},addAction:function(t,e,n,o){return this.addHook("action",t,e,n,o),this},addFilter:function(t,e,n,o){return this.addHook("filter",t,e,n,o),this},doAction:function(t){return this.doHook("action",t,arguments)},applyFilters:function(t){return this.doHook("filter",t,arguments)},removeAction:function(t,e){return this.removeHook("action",t,e),this},removeFilter:function(t,e,n){return this.removeHook("filter",t,e,n),this},addHook:function(t,e,n,o,i){void 0===this.hooks[t][e]&&(this.hooks[t][e]=[]);var r=this.hooks[t][e];return void 0===i&&(i=e+"_"+r.length),this.hooks[t][e].push({tag:i,callable:n,priority:o}),this},doHook:function(t,e,n){if(n=Array.prototype.slice.call(n,1),void 0!==this.hooks[t][e]){var o,i=this.hooks[t][e];i.sort((function(t,e){return t.priority-e.priority}));for(var r=0;r<i.length;r++)"function"!=typeof(o=i[r].callable)&&(o=window[o]),"action"===t?n[r]=o.apply(null,n):n[0]=o.apply(null,n)}return"filter"===t?n[0]:n},removeHook:function(t,e,n,o){if(void 0!==this.hooks[t][e])for(var i=this.hooks[t][e],r=i.length-1;r>=0;r--)void 0!==o&&o!==i[r].tag||void 0!==n&&n!==i[r].priority||i.splice(r,1);return this}},p={get:function(t,e,n){var o;if(n)o=wpCookies.get(t);else{var i=wpCookies.get("LP");i&&(i=JSON.parse(i),o=t?i[t]:i)}return o||o===e||(o=e),o},set:function(t,e,n,o,i,r){if(arguments.length>2)wpCookies.set(t,e,n,o,i,r);else if(2==arguments.length){var a=wpCookies.get("LP");(a=a?JSON.parse(a):{})[t]=e,wpCookies.set("LP",JSON.stringify(a),"","/")}else wpCookies.set("LP",JSON.stringify(t),"","/")},remove:function(t){var e=p.get(),n=new RegExp(t,"g"),o={},i=t.match(/\*/);for(var r in e)i?r.match(n)||(o[r]=e[r]):t!=r&&(o[r]=e[r]);p.set(o)}},d=p,h={__key:"LP",set:function(t,e){var n=h.get(),o=lodash.set;o(n,t,e),localStorage.setItem(h.__key,JSON.stringify(n))},get:function(t,e){var n=JSON.parse(localStorage.getItem(h.__key)||"{}"),o=lodash.get,i=o(n,t);return t?void 0!==i?i:e:n},exists:function(t){return h.get().hasOwnProperty(t)},remove:function(t){var e=h.get(),n=lodash.omit(e,t);h.__set(n)},__get:function(){return localStorage.getItem(h.__key)},__set:function(t){localStorage.setItem(h.__key,JSON.stringify(t||"{}"))}},v=h,g=(n(6),1),y=window.jQuery||jQuery,m=function(t){var e="ajax-iframe-"+g,n=y('form[name="'+e+'"]');n.length||(n=y("<iframe />").appendTo(document.body).attr({name:e,src:"#"})),y(t).on("submit",(function(){var n=y(t).clone().appendTo(document.body);return n.attr("target",e),n.find("#submit").remove(),!1})),g++},b=n(4),w=n.n(b);function k(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function x(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var P=jQuery;String.prototype.getQueryVar=function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(this);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},String.prototype.addQueryVar=function(t,e){var n=this,o=n.split("#");return n=o[0],t.match(/\[/)?(n+=n.match(/\?/)?"&":"?",n+=t+"="+e):-1!=n.indexOf("&"+t+"=")||-1!=n.indexOf("?"+t+"=")?n=n.replace(new RegExp(t+"=([^&#]*)","g"),t+"="+e):(n+=n.match(/\?/)?"&":"?",n+=t+"="+e),n+(o[1]?"#"+o[1]:"")},String.prototype.removeQueryVar=function(t){var e=this,n=e.split("#");e=n[0],t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var o=new RegExp("[\\?&]"+t+"([[][^=]*)?=([^&#]*)","g");return(e=e.replace(o,""))+(n[1]?"#"+n[1]:"")};var S={Hook:f,setUrl:function(t,e,n){t&&(history.pushState({},n,t),LP.Hook.doAction("learn_press_set_location_url",t))},toggleGroupSection:function(t,e){var n=P(t);n.hasClass("hide-if-js")&&n.hide().removeClass("hide-if-js"),n.removeClass("hide-if-js").slideToggle((function(){P(this).is(":visible")?P(e).addClass("toggle-on").removeClass("toggle-off"):P(e).addClass("toggle-off").removeClass("toggle-on")}))},overflow:function(t,e){var n=P(t),o=n.css("overflow");e?n.css("overflow",e).data("overflow",o):n.css("overflow",n.data("overflow"))},getUrl:function(){return window.location.href},addQueryVar:function(t,e,n){return(void 0===n?window.location.href:n).addQueryVar(t,e)},removeQueryVar:function(t,e){return(void 0===e?window.location.href:e).removeQueryVar(t)},reload:function(t){t||(t=window.location.href),window.location.href=t},parseResponse:function(t,e){var n=t.match(/<\x2D\x2D LP_AJAX_START \x2D\x2D>([\s\S]*)<\x2D\x2D LP_AJAX_END \x2D\x2D>/);return n&&(t=n[1]),"json"===(e||"json")?this.parseJSON(t):t},parseJSON:function(t){if("string"!=typeof t)return t;var e=String.raw({raw:t}).match(/<\x2D\x2D LP_AJAX_START \x2D\x2D>([\s\S]*)<\x2D\x2D LP_AJAX_END \x2D\x2D>/);try{t=e?JSON.parse(e[1].replace(/(?:\r\n|\r|\n)/g,"")):JSON.parse(t)}catch(e){t={}}return t},ajax:function(t){var e=t.type||"post",n=t.dataType||"json",o=t.action?P.extend(t.data,{"lp-ajax":t.action}):t.data,i=t.beforeSend||function(){},r=t.url||window.location.href;P.ajax({data:o,url:r,type:e,dataType:"html",beforeSend:i.apply(null,t),success:function(e){var o=LP.parseResponse(e,n);"function"==typeof t.success&&t.success(o,e)},error:function(){"function"==typeof t.error&&t.error.apply(null,LP.funcArgs2Array())}})},doAjax:function(t){var e=t.type||"post",n=t.dataType||"json",o=(void 0===t.prefix||"learnpress_")+t.action,i=t.action?P.extend(t.data,{action:o}):t.data;P.ajax({data:i,url:t.url||window.location.href,type:e,dataType:"html",success:function(e){var o=LP.parseResponse(e,n);"function"==typeof t.success&&t.success(o,e)},error:function(){"function"==typeof t.error&&t.error.apply(null,LP.funcArgs2Array())}})},funcArgs2Array:function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e},addFilter:function(t,e){var n=P(document),o="LP."+t;return n.on(o,e),LP.log(n.data("events")),this},applyFilters:function(){var t=P(document),e=arguments[0],n=this.funcArgs2Array(arguments);return t.hasEvent(e)?(n[0]="LP."+e,t.triggerHandler.apply(t,n)):n[1]},addAction:function(t,e){return this.addFilter(t,e)},doAction:function(){var t=P(document),e=arguments[0],n=this.funcArgs2Array(arguments);t.hasEvent(e)&&(n[0]="LP."+e,t.trigger.apply(t,n))},toElement:function(t,e){if(0!==P(t).length){e=P.extend({delay:300,duration:"slow",offset:50,container:null,callback:null,invisible:!1},e||{});var n,o=P(e.container);0===o.length&&(o=P("body, html")),n=o.offset().top;var i=P(t).offset().top+o.scrollTop()-n-e.offset;e.invisible&&function(t,e){var n=o.scrollTop(),i=n+o.height(),r=P(t).offset().top-o.offset().top,a=r+P(t).height();return!0===e?n<r&&i>a:r<=i&&a>=n}(t,!0)||o.fadeIn(10).delay(e.delay).animate({scrollTop:i},e.duration,e.callback)}},uniqueId:function(t,e){var n;void 0===t&&(t="");var o=function(t,e){return e<(t=parseInt(t,10).toString(16)).length?t.slice(t.length-e):e>t.length?new Array(e-t.length+1).join("0")+t:t};return this.php_js||(this.php_js={}),this.php_js.uniqidSeed||(this.php_js.uniqidSeed=Math.floor(123456789*Math.random())),this.php_js.uniqidSeed++,n=t,n+=o(parseInt((new Date).getTime()/1e3,10),8),n+=o(this.php_js.uniqidSeed,5),e&&(n+=(10*Math.random()).toFixed(8).toString()),n},log:function(){for(var t=0,e=arguments.length;t<e;t++)console.log(arguments[t])},blockContent:function(){0===P("#learn-press-block-content").length&&P(LP.template("learn-press-template-block-content",{})).appendTo(P("body")),LP.hideMainScrollbar().addClass("block-content"),P(document).trigger("learn_press_block_content")},unblockContent:function(){setTimeout((function(){LP.showMainScrollbar().removeClass("block-content"),P(document).trigger("learn_press_unblock_content")}),350)},hideMainScrollbar:function(t){t||(t="html, body");var e=P(t);return e.each((function(){var t=P(this),e=t.css("overflow");t.css("overflow","hidden").attr("overflow",e)})),e},showMainScrollbar:function(t){t||(t="html, body");var e=P(t);return e.each((function(){var t=P(this),e=t.attr("overflow");t.css("overflow",e).removeAttr("overflow")})),e},template:"undefined"!=typeof _?_.memoize((function(t,e){var n,o={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"},i=function(e){return(n=n||_.template(P("#"+t).html(),null,o))(e)};return e?i(e):i}),(function(t,e){return t+"-"+JSON.stringify(e)})):function(){return""},alert:function(t,e){var n="",o="";"string"==typeof t?o=t:(void 0!==t.title&&(n=t.title),void 0!==t.message&&(o=t.message)),P.alerts.alert(o,n,(function(t){LP._on_alert_hide(),e&&e(t)})),this._on_alert_show()},confirm:function(t,e){var n="",o="";"string"==typeof t?o=t:(void 0!==t.title&&(n=t.title),void 0!==t.message&&(o=t.message)),P.alerts.confirm(o,n,(function(t){LP._on_alert_hide(),e&&e(t)})),this._on_alert_show()},_on_alert_show:function(){var t=P("#popup_container");P('<span id="popup_container_placeholder" />').insertAfter(t).data("xxx",t);t.stop().css("top","-=50").css("opacity","0").animate({top:"+=50",opacity:1},250)},_on_alert_hide:function(){var t=P("#popup_container_placeholder"),e=t.data("xxx");e&&e.replaceWith(t),e.appendTo(P(document.body)),e.stop().animate({top:"+=50",opacity:0},250,(function(){P(this).remove()}))},sendMessage:function(t,e,n,o){P.isPlainObject(t)&&(t=JSON.stringify(t)),n=n||"*",(e=e||window).postMessage(t,n,o)},receiveMessage:function(t,e){var n=t.origin||t.originalEvent.origin,o=t.data||t.originalEvent.data||"";("string"==typeof o||o instanceof String)&&0===o.indexOf("{")&&(o=LP.parseJSON(o)),LP.Hook.doAction("learn_press_receive_message",o,n)},camelCaseDashObjectKeys:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=LP,o=function(t){return Array.isArray(t)},i=function(t){return t===Object(t)&&!o(t)&&"function"!=typeof t},r=function(t){return t.replace(/([-_][a-z])/gi,(function(t){return t.toUpperCase().replace("-","").replace("_","")}))};if(i(t)){var a={};return Object.keys(t).forEach((function(o){a[r(o)]=e?n.camelCaseDashObjectKeys(t[o]):t[o]})),a}return o(t)?t.map((function(t){return n.camelCaseDashObjectKeys(t)})):t},IframeSubmit:m};P(document).ready((function(){var t,e;void 0!==P.alerts&&(P.alerts.overlayColor="#000",P.alerts.overlayOpacity=.5,P.alerts.okButton=lpGlobalSettings.localize.button_ok,P.alerts.cancelButton=lpGlobalSettings.localize.button_cancel),P(".learn-press-message.fixed").each((function(){var t=P(this),e=t.data();!function(t,e){e.delayIn&&setTimeout((function(){t.show().hide().fadeIn()}),e.delayIn),e.delayOut&&setTimeout((function(){t.fadeOut()}),e.delayOut+(e.delayIn||0))}(t,e)})),setTimeout((function(){P(".learn-press-nav-tabs li.active:not(.default) a").trigger("click")}),300),P("body.course-item-popup").parent().css("overflow","hidden"),t=null,e=function(){P(".auto-check-lines").checkLines((function(t){t>1?P(this).removeClass("single-lines"):P(this).addClass("single-lines"),P(this).attr("rows",t)}))},P(window).on("resize.check-lines",(function(){t?(t&&clearTimeout(t),t=setTimeout(e,300)):e()})),P(".learn-press-tooltip, .lp-passing-conditional").LP_Tooltip({offset:[24,24]}),P(".learn-press-icon").LP_Tooltip({offset:[30,30]}),P(".learn-press-message[data-autoclose]").each((function(){var t=P(this),e=parseInt(t.data("autoclose"));e&&setTimeout((function(t){t.fadeOut()}),e,t)})),P(document).on("click",(function(){P(document).trigger("learn-press/close-all-quick-tip")}))})),function(){window.LP=window.LP||{},"string"==typeof arguments[0]?(LP[arguments[0]]=LP[arguments[0]]||{},LP[arguments[0]]=jQuery.extend(LP[arguments[0]],arguments[1])):LP=jQuery.extend(LP,arguments[0])}(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?k(Object(n),!0).forEach((function(e){x(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({Event_Callback:u,MessageBox:l,Cookies:d,localStorage:v},S));e.default={fn:r,QuickTip:s.a,Cookies:d,localStorage:v,showPass:w.a}}]);
|
assets/js/vendor/chart.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
/*!
|
2 |
-
* Chart.js
|
3 |
-
* http://chartjs.org/
|
4 |
-
* Version: 1.0.2
|
5 |
-
*
|
6 |
-
* Copyright 2015 Nick Downie
|
7 |
-
* Released under the MIT license
|
8 |
-
* https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
|
9 |
-
*/
|
10 |
(function(){"use strict";var t=this,i=t.Chart,e=function(t){this.canvas=t.canvas,this.ctx=t;var i=function(t,i){return t["offset"+i]?t["offset"+i]:document.defaultView.getComputedStyle(t).getPropertyValue(i)},e=this.width=i(t.canvas,"Width"),n=this.height=i(t.canvas,"Height");t.canvas.width=e,t.canvas.height=n;var e=this.width=t.canvas.width,n=this.height=t.canvas.height;return this.aspectRatio=this.width/this.height,s.retinaScale(this),this};e.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,customTooltips:!1,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",onAnimationProgress:function(){},onAnimationComplete:function(){}}},e.types={};var s=e.helpers={},n=s.each=function(t,i,e){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var n;for(n=0;n<t.length;n++)i.apply(e,[t[n],n].concat(s))}else for(var o in t)i.apply(e,[t[o],o].concat(s))},o=s.clone=function(t){var i={};return n(t,function(e,s){t.hasOwnProperty(s)&&(i[s]=e)}),i},a=s.extend=function(t){return n(Array.prototype.slice.call(arguments,1),function(i){n(i,function(e,s){i.hasOwnProperty(s)&&(t[s]=e)})}),t},h=s.merge=function(){var t=Array.prototype.slice.call(arguments,0);return t.unshift({}),a.apply(null,t)},l=s.indexOf=function(t,i){if(Array.prototype.indexOf)return t.indexOf(i);for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1},r=(s.where=function(t,i){var e=[];return s.each(t,function(t){i(t)&&e.push(t)}),e},s.findNextWhere=function(t,i,e){e||(e=-1);for(var s=e+1;s<t.length;s++){var n=t[s];if(i(n))return n}},s.findPreviousWhere=function(t,i,e){e||(e=t.length);for(var s=e-1;s>=0;s--){var n=t[s];if(i(n))return n}},s.inherits=function(t){var i=this,e=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},s=function(){this.constructor=e};return s.prototype=i.prototype,e.prototype=new s,e.extend=r,t&&a(e.prototype,t),e.__super__=i.prototype,e}),c=s.noop=function(){},u=s.uid=function(){var t=0;return function(){return"chart-"+t++}}(),d=s.warn=function(t){window.console&&"function"==typeof window.console.warn&&console.warn(t)},p=s.amd="function"==typeof define&&define.amd,f=s.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},g=s.max=function(t){return Math.max.apply(Math,t)},m=s.min=function(t){return Math.min.apply(Math,t)},v=(s.cap=function(t,i,e){if(f(i)){if(t>i)return i}else if(f(e)&&e>t)return e;return t},s.getDecimalPlaces=function(t){return t%1!==0&&f(t)?t.toString().split(".")[1].length:0}),S=s.radians=function(t){return t*(Math.PI/180)},x=(s.getAngleFromPoint=function(t,i){var e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s),o=2*Math.PI+Math.atan2(s,e);return 0>e&&0>s&&(o+=2*Math.PI),{angle:o,distance:n}},s.aliasPixel=function(t){return t%2===0?0:.5}),y=(s.splineCurve=function(t,i,e,s){var n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=s*n/(n+o),h=s*o/(n+o);return{inner:{x:i.x-a*(e.x-t.x),y:i.y-a*(e.y-t.y)},outer:{x:i.x+h*(e.x-t.x),y:i.y+h*(e.y-t.y)}}},s.calculateOrderOfMagnitude=function(t){return Math.floor(Math.log(t)/Math.LN10)}),C=(s.calculateScaleRange=function(t,i,e,s,n){var o=2,a=Math.floor(i/(1.5*e)),h=o>=a,l=g(t),r=m(t);l===r&&(l+=.5,r>=.5&&!s?r-=.5:l+=.5);for(var c=Math.abs(l-r),u=y(c),d=Math.ceil(l/(1*Math.pow(10,u)))*Math.pow(10,u),p=s?0:Math.floor(r/(1*Math.pow(10,u)))*Math.pow(10,u),f=d-p,v=Math.pow(10,u),S=Math.round(f/v);(S>a||a>2*S)&&!h;)if(S>a)v*=2,S=Math.round(f/v),S%1!==0&&(h=!0);else if(n&&u>=0){if(v/2%1!==0)break;v/=2,S=Math.round(f/v)}else v/=2,S=Math.round(f/v);return h&&(S=o,v=f/S),{steps:S,stepValue:v,min:p,max:p+S*v}},s.template=function(t,i){function e(t,i){var e=/\W/.test(t)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+t.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):s[t]=s[t];return i?e(i):e}if(t instanceof Function)return t(i);var s={};return e(t,i)}),w=(s.generateLabels=function(t,i,e,s){var o=new Array(i);return labelTemplateString&&n(o,function(i,n){o[n]=C(t,{value:e+s*(n+1)})}),o},s.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-0.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-0.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),-(s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)))},easeOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),s*Math.pow(2,-10*t)*Math.sin(2*(1*t-i)*Math.PI/e)+1)},easeInOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:2==(t/=.5)?1:(e||(e=.3*1.5),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),1>t?-.5*s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e):s*Math.pow(2,-10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)*.5+1)},easeInBack:function(t){var i=1.70158;return 1*(t/=1)*t*((i+1)*t-i)},easeOutBack:function(t){var i=1.70158;return 1*((t=t/1-1)*t*((i+1)*t+i)+1)},easeInOutBack:function(t){var i=1.70158;return(t/=.5)<1?.5*t*t*(((i*=1.525)+1)*t-i):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},easeInBounce:function(t){return 1-w.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?7.5625*t*t:2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*w.easeInBounce(2*t):.5*w.easeOutBounce(2*t-1)+.5}}),b=s.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),P=s.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),L=(s.animationLoop=function(t,i,e,s,n,o){var a=0,h=w[e]||w.linear,l=function(){a++;var e=a/i,r=h(e);t.call(o,r,e,a),s.call(o,r,e),i>a?o.animationFrame=b(l):n.apply(o)};b(l)},s.getRelativePosition=function(t){var i,e,s=t.originalEvent||t,n=t.currentTarget||t.srcElement,o=n.getBoundingClientRect();return s.touches?(i=s.touches[0].clientX-o.left,e=s.touches[0].clientY-o.top):(i=s.clientX-o.left,e=s.clientY-o.top),{x:i,y:e}},s.addEvent=function(t,i,e){t.addEventListener?t.addEventListener(i,e):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e}),k=s.removeEvent=function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=c},F=(s.bindEvents=function(t,i,e){t.events||(t.events={}),n(i,function(i){t.events[i]=function(){e.apply(t,arguments)},L(t.chart.canvas,i,t.events[i])})},s.unbindEvents=function(t,i){n(i,function(i,e){k(t.chart.canvas,e,i)})}),R=s.getMaximumWidth=function(t){var i=t.parentNode;return i.clientWidth},T=s.getMaximumHeight=function(t){var i=t.parentNode;return i.clientHeight},A=(s.getMaximumSize=s.getMaximumWidth,s.retinaScale=function(t){var i=t.ctx,e=t.canvas.width,s=t.canvas.height;window.devicePixelRatio&&(i.canvas.style.width=e+"px",i.canvas.style.height=s+"px",i.canvas.height=s*window.devicePixelRatio,i.canvas.width=e*window.devicePixelRatio,i.scale(window.devicePixelRatio,window.devicePixelRatio))}),M=s.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},W=s.fontString=function(t,i,e){return i+" "+t+"px "+e},z=s.longestText=function(t,i,e){t.font=i;var s=0;return n(e,function(i){var e=t.measureText(i).width;s=e>s?e:s}),s},B=s.drawRoundedRectangle=function(t,i,e,s,n,o){t.beginPath(),t.moveTo(i+o,e),t.lineTo(i+s-o,e),t.quadraticCurveTo(i+s,e,i+s,e+o),t.lineTo(i+s,e+n-o),t.quadraticCurveTo(i+s,e+n,i+s-o,e+n),t.lineTo(i+o,e+n),t.quadraticCurveTo(i,e+n,i,e+n-o),t.lineTo(i,e+o),t.quadraticCurveTo(i,e,i+o,e),t.closePath()};e.instances={},e.Type=function(t,i,s){this.options=i,this.chart=s,this.id=u(),e.instances[this.id]=this,i.responsive&&this.resize(),this.initialize.call(this,t)},a(e.Type.prototype,{initialize:function(){return this},clear:function(){return M(this.chart),this},stop:function(){return P(this.animationFrame),this},resize:function(t){this.stop();var i=this.chart.canvas,e=R(this.chart.canvas),s=this.options.maintainAspectRatio?e/this.chart.aspectRatio:T(this.chart.canvas);return i.width=this.chart.width=e,i.height=this.chart.height=s,A(this.chart),"function"==typeof t&&t.apply(this,Array.prototype.slice.call(arguments,1)),this},reflow:c,render:function(t){return t&&this.reflow(),this.options.animation&&!t?s.animationLoop(this.draw,this.options.animationSteps,this.options.animationEasing,this.options.onAnimationProgress,this.options.onAnimationComplete,this):(this.draw(),this.options.onAnimationComplete.call(this)),this},generateLegend:function(){return C(this.options.legendTemplate,this)},destroy:function(){this.clear(),F(this,this.events);var t=this.chart.canvas;t.width=this.chart.width,t.height=this.chart.height,t.style.removeProperty?(t.style.removeProperty("width"),t.style.removeProperty("height")):(t.style.removeAttribute("width"),t.style.removeAttribute("height")),delete e.instances[this.id]},showTooltip:function(t,i){"undefined"==typeof this.activeElements&&(this.activeElements=[]);var o=function(t){var i=!1;return t.length!==this.activeElements.length?i=!0:(n(t,function(t,e){t!==this.activeElements[e]&&(i=!0)},this),i)}.call(this,t);if(o||i){if(this.activeElements=t,this.draw(),this.options.customTooltips&&this.options.customTooltips(!1),t.length>0)if(this.datasets&&this.datasets.length>1){for(var a,h,r=this.datasets.length-1;r>=0&&(a=this.datasets[r].points||this.datasets[r].bars||this.datasets[r].segments,h=l(a,t[0]),-1===h);r--);var c=[],u=[],d=function(){var t,i,e,n,o,a=[],l=[],r=[];return s.each(this.datasets,function(i){t=i.points||i.bars||i.segments,t[h]&&t[h].hasValue()&&a.push(t[h])}),s.each(a,function(t){l.push(t.x),r.push(t.y),c.push(s.template(this.options.multiTooltipTemplate,t)),u.push({fill:t._saved.fillColor||t.fillColor,stroke:t._saved.strokeColor||t.strokeColor})},this),o=m(r),e=g(r),n=m(l),i=g(l),{x:n>this.chart.width/2?n:i,y:(o+e)/2}}.call(this,h);new e.MultiTooltip({x:d.x,y:d.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:c,legendColors:u,legendColorBackground:this.options.multiTooltipKeyBackground,title:t[0].label,chart:this.chart,ctx:this.chart.ctx,custom:this.options.customTooltips}).draw()}else n(t,function(t){var i=t.tooltipPosition();new e.Tooltip({x:Math.round(i.x),y:Math.round(i.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,text:C(this.options.tooltipTemplate,t),chart:this.chart,custom:this.options.customTooltips}).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}}),e.Type.extend=function(t){var i=this,s=function(){return i.apply(this,arguments)};if(s.prototype=o(i.prototype),a(s.prototype,t),s.extend=e.Type.extend,t.name||i.prototype.name){var n=t.name||i.prototype.name,l=e.defaults[i.prototype.name]?o(e.defaults[i.prototype.name]):{};e.defaults[n]=a(l,t.defaults),e.types[n]=s,e.prototype[n]=function(t,i){var o=h(e.defaults.global,e.defaults[n],i||{});return new s(t,o,this)}}else d("Name not provided for this chart, so it hasn't been registered");return i},e.Element=function(t){a(this,t),this.initialize.apply(this,arguments),this.save()},a(e.Element.prototype,{initialize:function(){},restore:function(t){return t?n(t,function(t){this[t]=this._saved[t]},this):a(this,this._saved),this},save:function(){return this._saved=o(this),delete this._saved._saved,this},update:function(t){return n(t,function(t,i){this._saved[i]=this[i],this[i]=t},this),this},transition:function(t,i){return n(t,function(t,e){this[e]=(t-this._saved[e])*i+this._saved[e]},this),this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return f(this.value)}}),e.Element.extend=r,e.Point=e.Element.extend({display:!0,inRange:function(t,i){var e=this.hitDetectionRadius+this.radius;return Math.pow(t-this.x,2)+Math.pow(i-this.y,2)<Math.pow(e,2)},draw:function(){if(this.display){var t=this.ctx;t.beginPath(),t.arc(this.x,this.y,this.radius,0,2*Math.PI),t.closePath(),t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.fillStyle=this.fillColor,t.fill(),t.stroke()}}}),e.Arc=e.Element.extend({inRange:function(t,i){var e=s.getAngleFromPoint(this,{x:t,y:i}),n=e.angle>=this.startAngle&&e.angle<=this.endAngle,o=e.distance>=this.innerRadius&&e.distance<=this.outerRadius;return n&&o},tooltipPosition:function(){var t=this.startAngle+(this.endAngle-this.startAngle)/2,i=(this.outerRadius-this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(t)*i,y:this.y+Math.sin(t)*i}},draw:function(t){var i=this.ctx;i.beginPath(),i.arc(this.x,this.y,this.outerRadius,this.startAngle,this.endAngle),i.arc(this.x,this.y,this.innerRadius,this.endAngle,this.startAngle,!0),i.closePath(),i.strokeStyle=this.strokeColor,i.lineWidth=this.strokeWidth,i.fillStyle=this.fillColor,i.fill(),i.lineJoin="bevel",this.showStroke&&i.stroke()}}),e.Rectangle=e.Element.extend({draw:function(){var t=this.ctx,i=this.width/2,e=this.x-i,s=this.x+i,n=this.base-(this.base-this.y),o=this.strokeWidth/2;this.showStroke&&(e+=o,s-=o,n+=o),t.beginPath(),t.fillStyle=this.fillColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.moveTo(e,this.base),t.lineTo(e,n),t.lineTo(s,n),t.lineTo(s,this.base),t.fill(),this.showStroke&&t.stroke()},height:function(){return this.base-this.y},inRange:function(t,i){return t>=this.x-this.width/2&&t<=this.x+this.width/2&&i>=this.y&&i<=this.base}}),e.Tooltip=e.Element.extend({draw:function(){var t=this.chart.ctx;t.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.xAlign="center",this.yAlign="above";var i=this.caretPadding=2,e=t.measureText(this.text).width+2*this.xPadding,s=this.fontSize+2*this.yPadding,n=s+this.caretHeight+i;this.x+e/2>this.chart.width?this.xAlign="left":this.x-e/2<0&&(this.xAlign="right"),this.y-n<0&&(this.yAlign="below");var o=this.x-e/2,a=this.y-n;if(t.fillStyle=this.fillColor,this.custom)this.custom(this);else{switch(this.yAlign){case"above":t.beginPath(),t.moveTo(this.x,this.y-i),t.lineTo(this.x+this.caretHeight,this.y-(i+this.caretHeight)),t.lineTo(this.x-this.caretHeight,this.y-(i+this.caretHeight)),t.closePath(),t.fill();break;case"below":a=this.y+i+this.caretHeight,t.beginPath(),t.moveTo(this.x,this.y+i),t.lineTo(this.x+this.caretHeight,this.y+i+this.caretHeight),t.lineTo(this.x-this.caretHeight,this.y+i+this.caretHeight),t.closePath(),t.fill()}switch(this.xAlign){case"left":o=this.x-e+(this.cornerRadius+this.caretHeight);break;case"right":o=this.x-(this.cornerRadius+this.caretHeight)}B(t,o,a,e,s,this.cornerRadius),t.fill(),t.fillStyle=this.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,o+e/2,a+s/2)}}}),e.MultiTooltip=e.Element.extend({initialize:function(){this.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.titleFont=W(this.titleFontSize,this.titleFontStyle,this.titleFontFamily),this.height=this.labels.length*this.fontSize+(this.labels.length-1)*(this.fontSize/2)+2*this.yPadding+1.5*this.titleFontSize,this.ctx.font=this.titleFont;var t=this.ctx.measureText(this.title).width,i=z(this.ctx,this.font,this.labels)+this.fontSize+3,e=g([i,t]);this.width=e+2*this.xPadding;var s=this.height/2;this.y-s<0?this.y=s:this.y+s>this.chart.height&&(this.y=this.chart.height-s),this.x>this.chart.width/2?this.x-=this.xOffset+this.width:this.x+=this.xOffset},getLineHeight:function(t){var i=this.y-this.height/2+this.yPadding,e=t-1;return 0===t?i+this.titleFontSize/2:i+(1.5*this.fontSize*e+this.fontSize/2)+1.5*this.titleFontSize},draw:function(){if(this.custom)this.custom(this);else{B(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius);var t=this.ctx;t.fillStyle=this.fillColor,t.fill(),t.closePath(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=this.titleTextColor,t.font=this.titleFont,t.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0)),t.font=this.font,s.each(this.labels,function(i,e){t.fillStyle=this.textColor,t.fillText(i,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(e+1)),t.fillStyle=this.legendColorBackground,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize),t.fillStyle=this.legendColors[e].fill,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize)},this)}}}),e.Scale=e.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}));this.yLabelWidth=this.display&&this.showLabels?z(this.ctx,this.font,this.yLabels):0},addXLabel:function(t){this.xLabels.push(t),this.valuesCount++,this.fit()},removeXLabel:function(){this.xLabels.shift(),this.valuesCount--,this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var t,i=this.endPoint-this.startPoint;for(this.calculateYRange(i),this.buildYLabels(),this.calculateXLabelRotation();i>this.endPoint-this.startPoint;)i=this.endPoint-this.startPoint,t=this.yLabelWidth,this.calculateYRange(i),this.buildYLabels(),t<this.yLabelWidth&&this.calculateXLabelRotation()},calculateXLabelRotation:function(){this.ctx.font=this.font;var t,i,e=this.ctx.measureText(this.xLabels[0]).width,s=this.ctx.measureText(this.xLabels[this.xLabels.length-1]).width;if(this.xScalePaddingRight=s/2+3,this.xScalePaddingLeft=e/2>this.yLabelWidth+10?e/2:this.yLabelWidth+10,this.xLabelRotation=0,this.display){var n,o=z(this.ctx,this.font,this.xLabels);this.xLabelWidth=o;for(var a=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>a&&0===this.xLabelRotation||this.xLabelWidth>a&&this.xLabelRotation<=90&&this.xLabelRotation>0;)n=Math.cos(S(this.xLabelRotation)),t=n*e,i=n*s,t+this.fontSize/2>this.yLabelWidth+8&&(this.xScalePaddingLeft=t+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=n*o;this.xLabelRotation>0&&(this.endPoint-=Math.sin(S(this.xLabelRotation))*o+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding},calculateYRange:c,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(t){var i=this.drawingArea()/(this.min-this.max);return this.endPoint-i*(t-this.min)},calculateX:function(t){var i=(this.xLabelRotation>0,this.width-(this.xScalePaddingLeft+this.xScalePaddingRight)),e=i/Math.max(this.valuesCount-(this.offsetGridLines?0:1),1),s=e*t+this.xScalePaddingLeft;return this.offsetGridLines&&(s+=e/2),Math.round(s)},update:function(t){s.extend(this,t),this.fit()},draw:function(){var t=this.ctx,i=(this.endPoint-this.startPoint)/this.steps,e=Math.round(this.xScalePaddingLeft);this.display&&(t.fillStyle=this.textColor,t.font=this.font,n(this.yLabels,function(n,o){var a=this.endPoint-i*o,h=Math.round(a),l=this.showHorizontalLines;t.textAlign="right",t.textBaseline="middle",this.showLabels&&t.fillText(n,e-10,a),0!==o||l||(l=!0),l&&t.beginPath(),o>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),h+=s.aliasPixel(t.lineWidth),l&&(t.moveTo(e,h),t.lineTo(this.width,h),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(e-5,h),t.lineTo(e,h),t.stroke(),t.closePath()},this),n(this.xLabels,function(i,e){var s=this.calculateX(e)+x(this.lineWidth),n=this.calculateX(e-(this.offsetGridLines?.5:0))+x(this.lineWidth),o=this.xLabelRotation>0,a=this.showVerticalLines;0!==e||a||(a=!0),a&&t.beginPath(),e>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),a&&(t.moveTo(n,this.endPoint),t.lineTo(n,this.startPoint-3),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(n,this.endPoint),t.lineTo(n,this.endPoint+5),t.stroke(),t.closePath(),t.save(),t.translate(s,o?this.endPoint+12:this.endPoint+8),t.rotate(-1*S(this.xLabelRotation)),t.font=this.font,t.textAlign=o?"right":"center",t.textBaseline=o?"middle":"top",t.fillText(i,0,0),t.restore()},this))}}),e.RadialScale=e.Element.extend({initialize:function(){this.size=m([this.height,this.width]),this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(t){var i=this.drawingArea/(this.max-this.min);return(t-this.min)*i},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize(),this.buildYLabels()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var t,i,e,s,n,o,a,h,l,r,c,u,d=m([this.height/2-this.pointLabelFontSize-5,this.width/2]),p=this.width,g=0;for(this.ctx.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),i=0;i<this.valuesCount;i++)t=this.getPointPosition(i,d),e=this.ctx.measureText(C(this.templateString,{value:this.labels[i]})).width+5,0===i||i===this.valuesCount/2?(s=e/2,t.x+s>p&&(p=t.x+s,n=i),t.x-s<g&&(g=t.x-s,a=i)):i<this.valuesCount/2?t.x+e>p&&(p=t.x+e,n=i):i>this.valuesCount/2&&t.x-e<g&&(g=t.x-e,a=i);l=g,r=Math.ceil(p-this.width),o=this.getIndexAngle(n),h=this.getIndexAngle(a),c=r/Math.sin(o+Math.PI/2),u=l/Math.sin(h+Math.PI/2),c=f(c)?c:0,u=f(u)?u:0,this.drawingArea=d-(u+c)/2,this.setCenterPoint(u,c)},setCenterPoint:function(t,i){var e=this.width-i-this.drawingArea,s=t+this.drawingArea;this.xCenter=(s+e)/2,this.yCenter=this.height/2},getIndexAngle:function(t){var i=2*Math.PI/this.valuesCount;return t*i-Math.PI/2},getPointPosition:function(t,i){var e=this.getIndexAngle(t);return{x:Math.cos(e)*i+this.xCenter,y:Math.sin(e)*i+this.yCenter}},draw:function(){if(this.display){var t=this.ctx;if(n(this.yLabels,function(i,e){if(e>0){var s,n=e*(this.drawingArea/this.steps),o=this.yCenter-n;if(this.lineWidth>0)if(t.strokeStyle=this.lineColor,t.lineWidth=this.lineWidth,this.lineArc)t.beginPath(),t.arc(this.xCenter,this.yCenter,n,0,2*Math.PI),t.closePath(),t.stroke();else{t.beginPath();for(var a=0;a<this.valuesCount;a++)s=this.getPointPosition(a,this.calculateCenterOffset(this.min+e*this.stepValue)),0===a?t.moveTo(s.x,s.y):t.lineTo(s.x,s.y);t.closePath(),t.stroke()}if(this.showLabels){if(t.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.showLabelBackdrop){var h=t.measureText(i).width;t.fillStyle=this.backdropColor,t.fillRect(this.xCenter-h/2-this.backdropPaddingX,o-this.fontSize/2-this.backdropPaddingY,h+2*this.backdropPaddingX,this.fontSize+2*this.backdropPaddingY)}t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.fontColor,t.fillText(i,this.xCenter,o)}}},this),!this.lineArc){t.lineWidth=this.angleLineWidth,t.strokeStyle=this.angleLineColor;for(var i=this.valuesCount-1;i>=0;i--){if(this.angleLineWidth>0){var e=this.getPointPosition(i,this.calculateCenterOffset(this.max));t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(e.x,e.y),t.stroke(),t.closePath()}var s=this.getPointPosition(i,this.calculateCenterOffset(this.max)+5);t.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),t.fillStyle=this.pointLabelFontColor;var o=this.labels.length,a=this.labels.length/2,h=a/2,l=h>i||i>o-h,r=i===h||i===o-h;t.textAlign=0===i?"center":i===a?"center":a>i?"left":"right",t.textBaseline=r?"middle":l?"bottom":"top",t.fillText(this.labels[i],s.x,s.y)}}}}}),s.addEvent(window,"resize",function(){var t;return function(){clearTimeout(t),t=setTimeout(function(){n(e.instances,function(t){t.options.responsive&&t.resize(t.render,!0)})},50)}}()),p?define(function(){return e}):"object"==typeof module&&module.exports&&(module.exports=e),t.Chart=e,e.noConflict=function(){return t.Chart=i,e}}).call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Bar",defaults:s,initialize:function(t){var s=this.options;this.ScaleClass=i.Scale.extend({offsetGridLines:!0,calculateBarX:function(t,i,e){var n=this.calculateBaseWidth(),o=this.calculateX(e)-n/2,a=this.calculateBarWidth(t);return o+a*i+i*s.barDatasetSpacing+a/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*s.barValueSpacing},calculateBarWidth:function(t){var i=this.calculateBaseWidth()-(t-1)*s.barDatasetSpacing;return i/t}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getBarsAtEvent(t):[];this.eachBars(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),this.BarClass=i.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,bars:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.bars.push(new this.BarClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.strokeColor,fillColor:i.fillColor,highlightFill:i.highlightFill||i.fillColor,highlightStroke:i.highlightStroke||i.strokeColor}))},this)},this),this.buildScale(t.labels),this.BarClass.prototype.base=this.scale.endPoint,this.eachBars(function(t,i,s){e.extend(t,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,s,i),y:this.scale.endPoint}),t.save()},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachBars(function(t){t.save()}),this.render()},eachBars:function(t){e.each(this.datasets,function(i,s){e.each(i.bars,t,this,s)},this)},getBarsAtEvent:function(t){for(var i,s=[],n=e.getRelativePosition(t),o=function(t){s.push(t.bars[i])},a=0;a<this.datasets.length;a++)for(i=0;i<this.datasets[a].bars.length;i++)if(this.datasets[a].bars[i].inRange(n.x,n.y))return e.each(this.datasets,o),s;return s},buildScale:function(t){var i=this,s=function(){var t=[];return i.eachBars(function(i){t.push(i.value)}),t},n={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(s(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(n,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new this.ScaleClass(n)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].bars.push(new this.BarClass({value:t,label:i,x:this.scale.calculateBarX(this.datasets.length,e,this.scale.valuesCount+1),y:this.scale.endPoint,width:this.scale.calculateBarWidth(this.datasets.length),base:this.scale.endPoint,strokeColor:this.datasets[e].strokeColor,fillColor:this.datasets[e].fillColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.bars.shift()},this),this.update()},reflow:function(){e.extend(this.BarClass.prototype,{y:this.scale.endPoint,base:this.scale.endPoint});var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();this.chart.ctx;this.scale.draw(i),e.each(this.datasets,function(t,s){e.each(t.bars,function(t,e){t.hasValue()&&(t.base=this.scale.endPoint,t.transition({x:this.scale.calculateBarX(this.datasets.length,s,e),y:this.scale.calculateY(t.value),width:this.scale.calculateBarWidth(this.datasets.length)},i).draw())},this)},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Doughnut",defaults:s,initialize:function(t){this.segments=[],this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=i.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.calculateTotal(t),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({value:t.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:t.color,highlightColor:t.highlight||t.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(t.value),label:t.label})),e||(this.reflow(),this.update())},calculateCircumference:function(t){return 2*Math.PI*(Math.abs(t)/this.total)},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=Math.abs(t.value)},this)},update:function(){this.calculateTotal(this.segments),e.each(this.activeElements,function(t){t.restore(["fillColor"])}),e.each(this.segments,function(t){t.save()}),this.render()},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,e.each(this.segments,function(t){t.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(t){var i=t?t:1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.calculateCircumference(t.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},i),t.endAngle=t.startAngle+t.circumference,t.draw(),0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle)},this)}}),i.types.Doughnut.extend({name:"Pie",defaults:e.merge(s,{percentageInnerCutout:0})})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,bezierCurve:!0,bezierCurveTension:.4,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Line",defaults:s,initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(t){return Math.pow(t-this.x,2)<Math.pow(this.radius+this.hitDetectionRadius,2)}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this),this.buildScale(t.labels),this.eachPoints(function(t,i){e.extend(t,{x:this.scale.calculateX(i),y:this.scale.endPoint}),t.save()},this)},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachPoints(function(t){t.save()}),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.datasets,function(t){e.each(t.points,function(t){t.inRange(s.x,s.y)&&i.push(t)})},this),i},buildScale:function(t){var s=this,n=function(){var t=[];return s.eachPoints(function(i){t.push(i.value)}),t},o={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(n(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.pointDotRadius+this.options.pointDotStrokeWidth,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(o,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new i.Scale(o)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:this.scale.calculateX(this.scale.valuesCount+1),y:this.scale.endPoint,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.points.shift()},this),this.update()},reflow:function(){var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();var s=this.chart.ctx,n=function(t){return null!==t.value},o=function(t,i,s){return e.findNextWhere(i,n,s)||t},a=function(t,i,s){return e.findPreviousWhere(i,n,s)||t};this.scale.draw(i),e.each(this.datasets,function(t){var h=e.where(t.points,n);e.each(t.points,function(t,e){t.hasValue()&&t.transition({y:this.scale.calculateY(t.value),x:this.scale.calculateX(e)},i)},this),this.options.bezierCurve&&e.each(h,function(t,i){var s=i>0&&i<h.length-1?this.options.bezierCurveTension:0;t.controlPoints=e.splineCurve(a(t,h,i),t,o(t,h,i),s),t.controlPoints.outer.y>this.scale.endPoint?t.controlPoints.outer.y=this.scale.endPoint:t.controlPoints.outer.y<this.scale.startPoint&&(t.controlPoints.outer.y=this.scale.startPoint),t.controlPoints.inner.y>this.scale.endPoint?t.controlPoints.inner.y=this.scale.endPoint:t.controlPoints.inner.y<this.scale.startPoint&&(t.controlPoints.inner.y=this.scale.startPoint)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(h,function(t,i){if(0===i)s.moveTo(t.x,t.y);else if(this.options.bezierCurve){var e=a(t,h,i);s.bezierCurveTo(e.controlPoints.outer.x,e.controlPoints.outer.y,t.controlPoints.inner.x,t.controlPoints.inner.y,t.x,t.y)}else s.lineTo(t.x,t.y)},this),s.stroke(),this.options.datasetFill&&h.length>0&&(s.lineTo(h[h.length-1].x,this.scale.endPoint),s.lineTo(h[0].x,this.scale.endPoint),s.fillStyle=t.fillColor,s.closePath(),s.fill()),e.each(h,function(t){t.draw()})},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"PolarArea",defaults:s,initialize:function(t){this.segments=[],this.SegmentArc=i.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:t.length}),this.updateScaleRange(t),this.scale.update(),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({fillColor:t.color,highlightColor:t.highlight||t.color,label:t.label,value:t.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(t.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),e||(this.reflow(),this.update())},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(t){var i=[];e.each(t,function(t){i.push(t.value)});var s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s,{size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),e.each(this.segments,function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),e.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),e.each(this.segments,function(t){t.update({outerRadius:this.scale.calculateCenterOffset(t.value)})},this)},draw:function(t){var i=t||1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(t.value)},i),t.endAngle=t.startAngle+t.circumference,0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle),t.draw()},this),this.scale.draw()}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers;i.Type.extend({name:"Radar",defaults:{scaleShowLine:!0,angleShowLineOut:!0,scaleShowLabels:!1,scaleBeginAtZero:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:10,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(t),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){var o;this.scale.animation||(o=this.scale.getPointPosition(n,this.scale.calculateCenterOffset(e))),s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,x:this.options.animation?this.scale.xCenter:o.x,y:this.options.animation?this.scale.yCenter:o.y,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=e.getRelativePosition(t),s=e.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),n=2*Math.PI/this.scale.valuesCount,o=Math.round((s.angle-1.5*Math.PI)/n),a=[];return(o>=this.scale.valuesCount||0>o)&&(o=0),s.distance<=this.scale.drawingArea&&e.each(this.datasets,function(t){a.push(t.points[o])}),a},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i=function(){var i=[];return e.each(t,function(t){t.data?i=i.concat(t.data):e.each(t.points,function(t){i.push(t.value)})}),i}(),s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s)},addData:function(t,i){this.scale.valuesCount++,e.each(t,function(t,e){var s=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:s.x,y:s.y,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.labels.push(i),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),e.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var i=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),e.each(this.datasets,function(t){e.each(t.points,function(t,e){t.hasValue()&&t.transition(this.scale.getPointPosition(e,this.scale.calculateCenterOffset(t.value)),i)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,s.fill(),e.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this);
|
1 |
+
/*!
|
2 |
+
* Chart.js
|
3 |
+
* http://chartjs.org/
|
4 |
+
* Version: 1.0.2
|
5 |
+
*
|
6 |
+
* Copyright 2015 Nick Downie
|
7 |
+
* Released under the MIT license
|
8 |
+
* https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
|
9 |
+
*/
|
10 |
(function(){"use strict";var t=this,i=t.Chart,e=function(t){this.canvas=t.canvas,this.ctx=t;var i=function(t,i){return t["offset"+i]?t["offset"+i]:document.defaultView.getComputedStyle(t).getPropertyValue(i)},e=this.width=i(t.canvas,"Width"),n=this.height=i(t.canvas,"Height");t.canvas.width=e,t.canvas.height=n;var e=this.width=t.canvas.width,n=this.height=t.canvas.height;return this.aspectRatio=this.width/this.height,s.retinaScale(this),this};e.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,customTooltips:!1,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",onAnimationProgress:function(){},onAnimationComplete:function(){}}},e.types={};var s=e.helpers={},n=s.each=function(t,i,e){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var n;for(n=0;n<t.length;n++)i.apply(e,[t[n],n].concat(s))}else for(var o in t)i.apply(e,[t[o],o].concat(s))},o=s.clone=function(t){var i={};return n(t,function(e,s){t.hasOwnProperty(s)&&(i[s]=e)}),i},a=s.extend=function(t){return n(Array.prototype.slice.call(arguments,1),function(i){n(i,function(e,s){i.hasOwnProperty(s)&&(t[s]=e)})}),t},h=s.merge=function(){var t=Array.prototype.slice.call(arguments,0);return t.unshift({}),a.apply(null,t)},l=s.indexOf=function(t,i){if(Array.prototype.indexOf)return t.indexOf(i);for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1},r=(s.where=function(t,i){var e=[];return s.each(t,function(t){i(t)&&e.push(t)}),e},s.findNextWhere=function(t,i,e){e||(e=-1);for(var s=e+1;s<t.length;s++){var n=t[s];if(i(n))return n}},s.findPreviousWhere=function(t,i,e){e||(e=t.length);for(var s=e-1;s>=0;s--){var n=t[s];if(i(n))return n}},s.inherits=function(t){var i=this,e=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},s=function(){this.constructor=e};return s.prototype=i.prototype,e.prototype=new s,e.extend=r,t&&a(e.prototype,t),e.__super__=i.prototype,e}),c=s.noop=function(){},u=s.uid=function(){var t=0;return function(){return"chart-"+t++}}(),d=s.warn=function(t){window.console&&"function"==typeof window.console.warn&&console.warn(t)},p=s.amd="function"==typeof define&&define.amd,f=s.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},g=s.max=function(t){return Math.max.apply(Math,t)},m=s.min=function(t){return Math.min.apply(Math,t)},v=(s.cap=function(t,i,e){if(f(i)){if(t>i)return i}else if(f(e)&&e>t)return e;return t},s.getDecimalPlaces=function(t){return t%1!==0&&f(t)?t.toString().split(".")[1].length:0}),S=s.radians=function(t){return t*(Math.PI/180)},x=(s.getAngleFromPoint=function(t,i){var e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s),o=2*Math.PI+Math.atan2(s,e);return 0>e&&0>s&&(o+=2*Math.PI),{angle:o,distance:n}},s.aliasPixel=function(t){return t%2===0?0:.5}),y=(s.splineCurve=function(t,i,e,s){var n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=s*n/(n+o),h=s*o/(n+o);return{inner:{x:i.x-a*(e.x-t.x),y:i.y-a*(e.y-t.y)},outer:{x:i.x+h*(e.x-t.x),y:i.y+h*(e.y-t.y)}}},s.calculateOrderOfMagnitude=function(t){return Math.floor(Math.log(t)/Math.LN10)}),C=(s.calculateScaleRange=function(t,i,e,s,n){var o=2,a=Math.floor(i/(1.5*e)),h=o>=a,l=g(t),r=m(t);l===r&&(l+=.5,r>=.5&&!s?r-=.5:l+=.5);for(var c=Math.abs(l-r),u=y(c),d=Math.ceil(l/(1*Math.pow(10,u)))*Math.pow(10,u),p=s?0:Math.floor(r/(1*Math.pow(10,u)))*Math.pow(10,u),f=d-p,v=Math.pow(10,u),S=Math.round(f/v);(S>a||a>2*S)&&!h;)if(S>a)v*=2,S=Math.round(f/v),S%1!==0&&(h=!0);else if(n&&u>=0){if(v/2%1!==0)break;v/=2,S=Math.round(f/v)}else v/=2,S=Math.round(f/v);return h&&(S=o,v=f/S),{steps:S,stepValue:v,min:p,max:p+S*v}},s.template=function(t,i){function e(t,i){var e=/\W/.test(t)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+t.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):s[t]=s[t];return i?e(i):e}if(t instanceof Function)return t(i);var s={};return e(t,i)}),w=(s.generateLabels=function(t,i,e,s){var o=new Array(i);return labelTemplateString&&n(o,function(i,n){o[n]=C(t,{value:e+s*(n+1)})}),o},s.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-0.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-0.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),-(s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)))},easeOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),s*Math.pow(2,-10*t)*Math.sin(2*(1*t-i)*Math.PI/e)+1)},easeInOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:2==(t/=.5)?1:(e||(e=.3*1.5),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),1>t?-.5*s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e):s*Math.pow(2,-10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)*.5+1)},easeInBack:function(t){var i=1.70158;return 1*(t/=1)*t*((i+1)*t-i)},easeOutBack:function(t){var i=1.70158;return 1*((t=t/1-1)*t*((i+1)*t+i)+1)},easeInOutBack:function(t){var i=1.70158;return(t/=.5)<1?.5*t*t*(((i*=1.525)+1)*t-i):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},easeInBounce:function(t){return 1-w.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?7.5625*t*t:2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*w.easeInBounce(2*t):.5*w.easeOutBounce(2*t-1)+.5}}),b=s.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),P=s.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),L=(s.animationLoop=function(t,i,e,s,n,o){var a=0,h=w[e]||w.linear,l=function(){a++;var e=a/i,r=h(e);t.call(o,r,e,a),s.call(o,r,e),i>a?o.animationFrame=b(l):n.apply(o)};b(l)},s.getRelativePosition=function(t){var i,e,s=t.originalEvent||t,n=t.currentTarget||t.srcElement,o=n.getBoundingClientRect();return s.touches?(i=s.touches[0].clientX-o.left,e=s.touches[0].clientY-o.top):(i=s.clientX-o.left,e=s.clientY-o.top),{x:i,y:e}},s.addEvent=function(t,i,e){t.addEventListener?t.addEventListener(i,e):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e}),k=s.removeEvent=function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=c},F=(s.bindEvents=function(t,i,e){t.events||(t.events={}),n(i,function(i){t.events[i]=function(){e.apply(t,arguments)},L(t.chart.canvas,i,t.events[i])})},s.unbindEvents=function(t,i){n(i,function(i,e){k(t.chart.canvas,e,i)})}),R=s.getMaximumWidth=function(t){var i=t.parentNode;return i.clientWidth},T=s.getMaximumHeight=function(t){var i=t.parentNode;return i.clientHeight},A=(s.getMaximumSize=s.getMaximumWidth,s.retinaScale=function(t){var i=t.ctx,e=t.canvas.width,s=t.canvas.height;window.devicePixelRatio&&(i.canvas.style.width=e+"px",i.canvas.style.height=s+"px",i.canvas.height=s*window.devicePixelRatio,i.canvas.width=e*window.devicePixelRatio,i.scale(window.devicePixelRatio,window.devicePixelRatio))}),M=s.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},W=s.fontString=function(t,i,e){return i+" "+t+"px "+e},z=s.longestText=function(t,i,e){t.font=i;var s=0;return n(e,function(i){var e=t.measureText(i).width;s=e>s?e:s}),s},B=s.drawRoundedRectangle=function(t,i,e,s,n,o){t.beginPath(),t.moveTo(i+o,e),t.lineTo(i+s-o,e),t.quadraticCurveTo(i+s,e,i+s,e+o),t.lineTo(i+s,e+n-o),t.quadraticCurveTo(i+s,e+n,i+s-o,e+n),t.lineTo(i+o,e+n),t.quadraticCurveTo(i,e+n,i,e+n-o),t.lineTo(i,e+o),t.quadraticCurveTo(i,e,i+o,e),t.closePath()};e.instances={},e.Type=function(t,i,s){this.options=i,this.chart=s,this.id=u(),e.instances[this.id]=this,i.responsive&&this.resize(),this.initialize.call(this,t)},a(e.Type.prototype,{initialize:function(){return this},clear:function(){return M(this.chart),this},stop:function(){return P(this.animationFrame),this},resize:function(t){this.stop();var i=this.chart.canvas,e=R(this.chart.canvas),s=this.options.maintainAspectRatio?e/this.chart.aspectRatio:T(this.chart.canvas);return i.width=this.chart.width=e,i.height=this.chart.height=s,A(this.chart),"function"==typeof t&&t.apply(this,Array.prototype.slice.call(arguments,1)),this},reflow:c,render:function(t){return t&&this.reflow(),this.options.animation&&!t?s.animationLoop(this.draw,this.options.animationSteps,this.options.animationEasing,this.options.onAnimationProgress,this.options.onAnimationComplete,this):(this.draw(),this.options.onAnimationComplete.call(this)),this},generateLegend:function(){return C(this.options.legendTemplate,this)},destroy:function(){this.clear(),F(this,this.events);var t=this.chart.canvas;t.width=this.chart.width,t.height=this.chart.height,t.style.removeProperty?(t.style.removeProperty("width"),t.style.removeProperty("height")):(t.style.removeAttribute("width"),t.style.removeAttribute("height")),delete e.instances[this.id]},showTooltip:function(t,i){"undefined"==typeof this.activeElements&&(this.activeElements=[]);var o=function(t){var i=!1;return t.length!==this.activeElements.length?i=!0:(n(t,function(t,e){t!==this.activeElements[e]&&(i=!0)},this),i)}.call(this,t);if(o||i){if(this.activeElements=t,this.draw(),this.options.customTooltips&&this.options.customTooltips(!1),t.length>0)if(this.datasets&&this.datasets.length>1){for(var a,h,r=this.datasets.length-1;r>=0&&(a=this.datasets[r].points||this.datasets[r].bars||this.datasets[r].segments,h=l(a,t[0]),-1===h);r--);var c=[],u=[],d=function(){var t,i,e,n,o,a=[],l=[],r=[];return s.each(this.datasets,function(i){t=i.points||i.bars||i.segments,t[h]&&t[h].hasValue()&&a.push(t[h])}),s.each(a,function(t){l.push(t.x),r.push(t.y),c.push(s.template(this.options.multiTooltipTemplate,t)),u.push({fill:t._saved.fillColor||t.fillColor,stroke:t._saved.strokeColor||t.strokeColor})},this),o=m(r),e=g(r),n=m(l),i=g(l),{x:n>this.chart.width/2?n:i,y:(o+e)/2}}.call(this,h);new e.MultiTooltip({x:d.x,y:d.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:c,legendColors:u,legendColorBackground:this.options.multiTooltipKeyBackground,title:t[0].label,chart:this.chart,ctx:this.chart.ctx,custom:this.options.customTooltips}).draw()}else n(t,function(t){var i=t.tooltipPosition();new e.Tooltip({x:Math.round(i.x),y:Math.round(i.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,text:C(this.options.tooltipTemplate,t),chart:this.chart,custom:this.options.customTooltips}).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}}),e.Type.extend=function(t){var i=this,s=function(){return i.apply(this,arguments)};if(s.prototype=o(i.prototype),a(s.prototype,t),s.extend=e.Type.extend,t.name||i.prototype.name){var n=t.name||i.prototype.name,l=e.defaults[i.prototype.name]?o(e.defaults[i.prototype.name]):{};e.defaults[n]=a(l,t.defaults),e.types[n]=s,e.prototype[n]=function(t,i){var o=h(e.defaults.global,e.defaults[n],i||{});return new s(t,o,this)}}else d("Name not provided for this chart, so it hasn't been registered");return i},e.Element=function(t){a(this,t),this.initialize.apply(this,arguments),this.save()},a(e.Element.prototype,{initialize:function(){},restore:function(t){return t?n(t,function(t){this[t]=this._saved[t]},this):a(this,this._saved),this},save:function(){return this._saved=o(this),delete this._saved._saved,this},update:function(t){return n(t,function(t,i){this._saved[i]=this[i],this[i]=t},this),this},transition:function(t,i){return n(t,function(t,e){this[e]=(t-this._saved[e])*i+this._saved[e]},this),this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return f(this.value)}}),e.Element.extend=r,e.Point=e.Element.extend({display:!0,inRange:function(t,i){var e=this.hitDetectionRadius+this.radius;return Math.pow(t-this.x,2)+Math.pow(i-this.y,2)<Math.pow(e,2)},draw:function(){if(this.display){var t=this.ctx;t.beginPath(),t.arc(this.x,this.y,this.radius,0,2*Math.PI),t.closePath(),t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.fillStyle=this.fillColor,t.fill(),t.stroke()}}}),e.Arc=e.Element.extend({inRange:function(t,i){var e=s.getAngleFromPoint(this,{x:t,y:i}),n=e.angle>=this.startAngle&&e.angle<=this.endAngle,o=e.distance>=this.innerRadius&&e.distance<=this.outerRadius;return n&&o},tooltipPosition:function(){var t=this.startAngle+(this.endAngle-this.startAngle)/2,i=(this.outerRadius-this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(t)*i,y:this.y+Math.sin(t)*i}},draw:function(t){var i=this.ctx;i.beginPath(),i.arc(this.x,this.y,this.outerRadius,this.startAngle,this.endAngle),i.arc(this.x,this.y,this.innerRadius,this.endAngle,this.startAngle,!0),i.closePath(),i.strokeStyle=this.strokeColor,i.lineWidth=this.strokeWidth,i.fillStyle=this.fillColor,i.fill(),i.lineJoin="bevel",this.showStroke&&i.stroke()}}),e.Rectangle=e.Element.extend({draw:function(){var t=this.ctx,i=this.width/2,e=this.x-i,s=this.x+i,n=this.base-(this.base-this.y),o=this.strokeWidth/2;this.showStroke&&(e+=o,s-=o,n+=o),t.beginPath(),t.fillStyle=this.fillColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.moveTo(e,this.base),t.lineTo(e,n),t.lineTo(s,n),t.lineTo(s,this.base),t.fill(),this.showStroke&&t.stroke()},height:function(){return this.base-this.y},inRange:function(t,i){return t>=this.x-this.width/2&&t<=this.x+this.width/2&&i>=this.y&&i<=this.base}}),e.Tooltip=e.Element.extend({draw:function(){var t=this.chart.ctx;t.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.xAlign="center",this.yAlign="above";var i=this.caretPadding=2,e=t.measureText(this.text).width+2*this.xPadding,s=this.fontSize+2*this.yPadding,n=s+this.caretHeight+i;this.x+e/2>this.chart.width?this.xAlign="left":this.x-e/2<0&&(this.xAlign="right"),this.y-n<0&&(this.yAlign="below");var o=this.x-e/2,a=this.y-n;if(t.fillStyle=this.fillColor,this.custom)this.custom(this);else{switch(this.yAlign){case"above":t.beginPath(),t.moveTo(this.x,this.y-i),t.lineTo(this.x+this.caretHeight,this.y-(i+this.caretHeight)),t.lineTo(this.x-this.caretHeight,this.y-(i+this.caretHeight)),t.closePath(),t.fill();break;case"below":a=this.y+i+this.caretHeight,t.beginPath(),t.moveTo(this.x,this.y+i),t.lineTo(this.x+this.caretHeight,this.y+i+this.caretHeight),t.lineTo(this.x-this.caretHeight,this.y+i+this.caretHeight),t.closePath(),t.fill()}switch(this.xAlign){case"left":o=this.x-e+(this.cornerRadius+this.caretHeight);break;case"right":o=this.x-(this.cornerRadius+this.caretHeight)}B(t,o,a,e,s,this.cornerRadius),t.fill(),t.fillStyle=this.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,o+e/2,a+s/2)}}}),e.MultiTooltip=e.Element.extend({initialize:function(){this.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.titleFont=W(this.titleFontSize,this.titleFontStyle,this.titleFontFamily),this.height=this.labels.length*this.fontSize+(this.labels.length-1)*(this.fontSize/2)+2*this.yPadding+1.5*this.titleFontSize,this.ctx.font=this.titleFont;var t=this.ctx.measureText(this.title).width,i=z(this.ctx,this.font,this.labels)+this.fontSize+3,e=g([i,t]);this.width=e+2*this.xPadding;var s=this.height/2;this.y-s<0?this.y=s:this.y+s>this.chart.height&&(this.y=this.chart.height-s),this.x>this.chart.width/2?this.x-=this.xOffset+this.width:this.x+=this.xOffset},getLineHeight:function(t){var i=this.y-this.height/2+this.yPadding,e=t-1;return 0===t?i+this.titleFontSize/2:i+(1.5*this.fontSize*e+this.fontSize/2)+1.5*this.titleFontSize},draw:function(){if(this.custom)this.custom(this);else{B(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius);var t=this.ctx;t.fillStyle=this.fillColor,t.fill(),t.closePath(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=this.titleTextColor,t.font=this.titleFont,t.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0)),t.font=this.font,s.each(this.labels,function(i,e){t.fillStyle=this.textColor,t.fillText(i,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(e+1)),t.fillStyle=this.legendColorBackground,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize),t.fillStyle=this.legendColors[e].fill,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize)},this)}}}),e.Scale=e.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}));this.yLabelWidth=this.display&&this.showLabels?z(this.ctx,this.font,this.yLabels):0},addXLabel:function(t){this.xLabels.push(t),this.valuesCount++,this.fit()},removeXLabel:function(){this.xLabels.shift(),this.valuesCount--,this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var t,i=this.endPoint-this.startPoint;for(this.calculateYRange(i),this.buildYLabels(),this.calculateXLabelRotation();i>this.endPoint-this.startPoint;)i=this.endPoint-this.startPoint,t=this.yLabelWidth,this.calculateYRange(i),this.buildYLabels(),t<this.yLabelWidth&&this.calculateXLabelRotation()},calculateXLabelRotation:function(){this.ctx.font=this.font;var t,i,e=this.ctx.measureText(this.xLabels[0]).width,s=this.ctx.measureText(this.xLabels[this.xLabels.length-1]).width;if(this.xScalePaddingRight=s/2+3,this.xScalePaddingLeft=e/2>this.yLabelWidth+10?e/2:this.yLabelWidth+10,this.xLabelRotation=0,this.display){var n,o=z(this.ctx,this.font,this.xLabels);this.xLabelWidth=o;for(var a=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>a&&0===this.xLabelRotation||this.xLabelWidth>a&&this.xLabelRotation<=90&&this.xLabelRotation>0;)n=Math.cos(S(this.xLabelRotation)),t=n*e,i=n*s,t+this.fontSize/2>this.yLabelWidth+8&&(this.xScalePaddingLeft=t+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=n*o;this.xLabelRotation>0&&(this.endPoint-=Math.sin(S(this.xLabelRotation))*o+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding},calculateYRange:c,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(t){var i=this.drawingArea()/(this.min-this.max);return this.endPoint-i*(t-this.min)},calculateX:function(t){var i=(this.xLabelRotation>0,this.width-(this.xScalePaddingLeft+this.xScalePaddingRight)),e=i/Math.max(this.valuesCount-(this.offsetGridLines?0:1),1),s=e*t+this.xScalePaddingLeft;return this.offsetGridLines&&(s+=e/2),Math.round(s)},update:function(t){s.extend(this,t),this.fit()},draw:function(){var t=this.ctx,i=(this.endPoint-this.startPoint)/this.steps,e=Math.round(this.xScalePaddingLeft);this.display&&(t.fillStyle=this.textColor,t.font=this.font,n(this.yLabels,function(n,o){var a=this.endPoint-i*o,h=Math.round(a),l=this.showHorizontalLines;t.textAlign="right",t.textBaseline="middle",this.showLabels&&t.fillText(n,e-10,a),0!==o||l||(l=!0),l&&t.beginPath(),o>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),h+=s.aliasPixel(t.lineWidth),l&&(t.moveTo(e,h),t.lineTo(this.width,h),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(e-5,h),t.lineTo(e,h),t.stroke(),t.closePath()},this),n(this.xLabels,function(i,e){var s=this.calculateX(e)+x(this.lineWidth),n=this.calculateX(e-(this.offsetGridLines?.5:0))+x(this.lineWidth),o=this.xLabelRotation>0,a=this.showVerticalLines;0!==e||a||(a=!0),a&&t.beginPath(),e>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),a&&(t.moveTo(n,this.endPoint),t.lineTo(n,this.startPoint-3),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(n,this.endPoint),t.lineTo(n,this.endPoint+5),t.stroke(),t.closePath(),t.save(),t.translate(s,o?this.endPoint+12:this.endPoint+8),t.rotate(-1*S(this.xLabelRotation)),t.font=this.font,t.textAlign=o?"right":"center",t.textBaseline=o?"middle":"top",t.fillText(i,0,0),t.restore()},this))}}),e.RadialScale=e.Element.extend({initialize:function(){this.size=m([this.height,this.width]),this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(t){var i=this.drawingArea/(this.max-this.min);return(t-this.min)*i},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize(),this.buildYLabels()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var t,i,e,s,n,o,a,h,l,r,c,u,d=m([this.height/2-this.pointLabelFontSize-5,this.width/2]),p=this.width,g=0;for(this.ctx.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),i=0;i<this.valuesCount;i++)t=this.getPointPosition(i,d),e=this.ctx.measureText(C(this.templateString,{value:this.labels[i]})).width+5,0===i||i===this.valuesCount/2?(s=e/2,t.x+s>p&&(p=t.x+s,n=i),t.x-s<g&&(g=t.x-s,a=i)):i<this.valuesCount/2?t.x+e>p&&(p=t.x+e,n=i):i>this.valuesCount/2&&t.x-e<g&&(g=t.x-e,a=i);l=g,r=Math.ceil(p-this.width),o=this.getIndexAngle(n),h=this.getIndexAngle(a),c=r/Math.sin(o+Math.PI/2),u=l/Math.sin(h+Math.PI/2),c=f(c)?c:0,u=f(u)?u:0,this.drawingArea=d-(u+c)/2,this.setCenterPoint(u,c)},setCenterPoint:function(t,i){var e=this.width-i-this.drawingArea,s=t+this.drawingArea;this.xCenter=(s+e)/2,this.yCenter=this.height/2},getIndexAngle:function(t){var i=2*Math.PI/this.valuesCount;return t*i-Math.PI/2},getPointPosition:function(t,i){var e=this.getIndexAngle(t);return{x:Math.cos(e)*i+this.xCenter,y:Math.sin(e)*i+this.yCenter}},draw:function(){if(this.display){var t=this.ctx;if(n(this.yLabels,function(i,e){if(e>0){var s,n=e*(this.drawingArea/this.steps),o=this.yCenter-n;if(this.lineWidth>0)if(t.strokeStyle=this.lineColor,t.lineWidth=this.lineWidth,this.lineArc)t.beginPath(),t.arc(this.xCenter,this.yCenter,n,0,2*Math.PI),t.closePath(),t.stroke();else{t.beginPath();for(var a=0;a<this.valuesCount;a++)s=this.getPointPosition(a,this.calculateCenterOffset(this.min+e*this.stepValue)),0===a?t.moveTo(s.x,s.y):t.lineTo(s.x,s.y);t.closePath(),t.stroke()}if(this.showLabels){if(t.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.showLabelBackdrop){var h=t.measureText(i).width;t.fillStyle=this.backdropColor,t.fillRect(this.xCenter-h/2-this.backdropPaddingX,o-this.fontSize/2-this.backdropPaddingY,h+2*this.backdropPaddingX,this.fontSize+2*this.backdropPaddingY)}t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.fontColor,t.fillText(i,this.xCenter,o)}}},this),!this.lineArc){t.lineWidth=this.angleLineWidth,t.strokeStyle=this.angleLineColor;for(var i=this.valuesCount-1;i>=0;i--){if(this.angleLineWidth>0){var e=this.getPointPosition(i,this.calculateCenterOffset(this.max));t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(e.x,e.y),t.stroke(),t.closePath()}var s=this.getPointPosition(i,this.calculateCenterOffset(this.max)+5);t.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),t.fillStyle=this.pointLabelFontColor;var o=this.labels.length,a=this.labels.length/2,h=a/2,l=h>i||i>o-h,r=i===h||i===o-h;t.textAlign=0===i?"center":i===a?"center":a>i?"left":"right",t.textBaseline=r?"middle":l?"bottom":"top",t.fillText(this.labels[i],s.x,s.y)}}}}}),s.addEvent(window,"resize",function(){var t;return function(){clearTimeout(t),t=setTimeout(function(){n(e.instances,function(t){t.options.responsive&&t.resize(t.render,!0)})},50)}}()),p?define(function(){return e}):"object"==typeof module&&module.exports&&(module.exports=e),t.Chart=e,e.noConflict=function(){return t.Chart=i,e}}).call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Bar",defaults:s,initialize:function(t){var s=this.options;this.ScaleClass=i.Scale.extend({offsetGridLines:!0,calculateBarX:function(t,i,e){var n=this.calculateBaseWidth(),o=this.calculateX(e)-n/2,a=this.calculateBarWidth(t);return o+a*i+i*s.barDatasetSpacing+a/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*s.barValueSpacing},calculateBarWidth:function(t){var i=this.calculateBaseWidth()-(t-1)*s.barDatasetSpacing;return i/t}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getBarsAtEvent(t):[];this.eachBars(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),this.BarClass=i.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,bars:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.bars.push(new this.BarClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.strokeColor,fillColor:i.fillColor,highlightFill:i.highlightFill||i.fillColor,highlightStroke:i.highlightStroke||i.strokeColor}))},this)},this),this.buildScale(t.labels),this.BarClass.prototype.base=this.scale.endPoint,this.eachBars(function(t,i,s){e.extend(t,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,s,i),y:this.scale.endPoint}),t.save()},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachBars(function(t){t.save()}),this.render()},eachBars:function(t){e.each(this.datasets,function(i,s){e.each(i.bars,t,this,s)},this)},getBarsAtEvent:function(t){for(var i,s=[],n=e.getRelativePosition(t),o=function(t){s.push(t.bars[i])},a=0;a<this.datasets.length;a++)for(i=0;i<this.datasets[a].bars.length;i++)if(this.datasets[a].bars[i].inRange(n.x,n.y))return e.each(this.datasets,o),s;return s},buildScale:function(t){var i=this,s=function(){var t=[];return i.eachBars(function(i){t.push(i.value)}),t},n={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(s(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(n,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new this.ScaleClass(n)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].bars.push(new this.BarClass({value:t,label:i,x:this.scale.calculateBarX(this.datasets.length,e,this.scale.valuesCount+1),y:this.scale.endPoint,width:this.scale.calculateBarWidth(this.datasets.length),base:this.scale.endPoint,strokeColor:this.datasets[e].strokeColor,fillColor:this.datasets[e].fillColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.bars.shift()},this),this.update()},reflow:function(){e.extend(this.BarClass.prototype,{y:this.scale.endPoint,base:this.scale.endPoint});var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();this.chart.ctx;this.scale.draw(i),e.each(this.datasets,function(t,s){e.each(t.bars,function(t,e){t.hasValue()&&(t.base=this.scale.endPoint,t.transition({x:this.scale.calculateBarX(this.datasets.length,s,e),y:this.scale.calculateY(t.value),width:this.scale.calculateBarWidth(this.datasets.length)},i).draw())},this)},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Doughnut",defaults:s,initialize:function(t){this.segments=[],this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=i.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.calculateTotal(t),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({value:t.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:t.color,highlightColor:t.highlight||t.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(t.value),label:t.label})),e||(this.reflow(),this.update())},calculateCircumference:function(t){return 2*Math.PI*(Math.abs(t)/this.total)},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=Math.abs(t.value)},this)},update:function(){this.calculateTotal(this.segments),e.each(this.activeElements,function(t){t.restore(["fillColor"])}),e.each(this.segments,function(t){t.save()}),this.render()},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,e.each(this.segments,function(t){t.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(t){var i=t?t:1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.calculateCircumference(t.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},i),t.endAngle=t.startAngle+t.circumference,t.draw(),0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle)},this)}}),i.types.Doughnut.extend({name:"Pie",defaults:e.merge(s,{percentageInnerCutout:0})})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,bezierCurve:!0,bezierCurveTension:.4,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Line",defaults:s,initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(t){return Math.pow(t-this.x,2)<Math.pow(this.radius+this.hitDetectionRadius,2)}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this),this.buildScale(t.labels),this.eachPoints(function(t,i){e.extend(t,{x:this.scale.calculateX(i),y:this.scale.endPoint}),t.save()},this)},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachPoints(function(t){t.save()}),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.datasets,function(t){e.each(t.points,function(t){t.inRange(s.x,s.y)&&i.push(t)})},this),i},buildScale:function(t){var s=this,n=function(){var t=[];return s.eachPoints(function(i){t.push(i.value)}),t},o={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(n(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.pointDotRadius+this.options.pointDotStrokeWidth,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(o,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new i.Scale(o)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:this.scale.calculateX(this.scale.valuesCount+1),y:this.scale.endPoint,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.points.shift()},this),this.update()},reflow:function(){var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();var s=this.chart.ctx,n=function(t){return null!==t.value},o=function(t,i,s){return e.findNextWhere(i,n,s)||t},a=function(t,i,s){return e.findPreviousWhere(i,n,s)||t};this.scale.draw(i),e.each(this.datasets,function(t){var h=e.where(t.points,n);e.each(t.points,function(t,e){t.hasValue()&&t.transition({y:this.scale.calculateY(t.value),x:this.scale.calculateX(e)},i)},this),this.options.bezierCurve&&e.each(h,function(t,i){var s=i>0&&i<h.length-1?this.options.bezierCurveTension:0;t.controlPoints=e.splineCurve(a(t,h,i),t,o(t,h,i),s),t.controlPoints.outer.y>this.scale.endPoint?t.controlPoints.outer.y=this.scale.endPoint:t.controlPoints.outer.y<this.scale.startPoint&&(t.controlPoints.outer.y=this.scale.startPoint),t.controlPoints.inner.y>this.scale.endPoint?t.controlPoints.inner.y=this.scale.endPoint:t.controlPoints.inner.y<this.scale.startPoint&&(t.controlPoints.inner.y=this.scale.startPoint)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(h,function(t,i){if(0===i)s.moveTo(t.x,t.y);else if(this.options.bezierCurve){var e=a(t,h,i);s.bezierCurveTo(e.controlPoints.outer.x,e.controlPoints.outer.y,t.controlPoints.inner.x,t.controlPoints.inner.y,t.x,t.y)}else s.lineTo(t.x,t.y)},this),s.stroke(),this.options.datasetFill&&h.length>0&&(s.lineTo(h[h.length-1].x,this.scale.endPoint),s.lineTo(h[0].x,this.scale.endPoint),s.fillStyle=t.fillColor,s.closePath(),s.fill()),e.each(h,function(t){t.draw()})},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"PolarArea",defaults:s,initialize:function(t){this.segments=[],this.SegmentArc=i.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:t.length}),this.updateScaleRange(t),this.scale.update(),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({fillColor:t.color,highlightColor:t.highlight||t.color,label:t.label,value:t.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(t.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),e||(this.reflow(),this.update())},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(t){var i=[];e.each(t,function(t){i.push(t.value)});var s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s,{size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),e.each(this.segments,function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),e.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),e.each(this.segments,function(t){t.update({outerRadius:this.scale.calculateCenterOffset(t.value)})},this)},draw:function(t){var i=t||1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(t.value)},i),t.endAngle=t.startAngle+t.circumference,0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle),t.draw()},this),this.scale.draw()}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers;i.Type.extend({name:"Radar",defaults:{scaleShowLine:!0,angleShowLineOut:!0,scaleShowLabels:!1,scaleBeginAtZero:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:10,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(t),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){var o;this.scale.animation||(o=this.scale.getPointPosition(n,this.scale.calculateCenterOffset(e))),s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,x:this.options.animation?this.scale.xCenter:o.x,y:this.options.animation?this.scale.yCenter:o.y,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=e.getRelativePosition(t),s=e.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),n=2*Math.PI/this.scale.valuesCount,o=Math.round((s.angle-1.5*Math.PI)/n),a=[];return(o>=this.scale.valuesCount||0>o)&&(o=0),s.distance<=this.scale.drawingArea&&e.each(this.datasets,function(t){a.push(t.points[o])}),a},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i=function(){var i=[];return e.each(t,function(t){t.data?i=i.concat(t.data):e.each(t.points,function(t){i.push(t.value)})}),i}(),s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s)},addData:function(t,i){this.scale.valuesCount++,e.each(t,function(t,e){var s=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:s.x,y:s.y,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.labels.push(i),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),e.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var i=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),e.each(this.datasets,function(t){e.each(t.points,function(t,e){t.hasValue()&&t.transition(this.scale.getPointPosition(e,this.scale.calculateCenterOffset(t.value)),i)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,s.fill(),e.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this);
|
assets/js/vendor/plugins.all.js
CHANGED
@@ -1,359 +1,359 @@
|
|
1 |
-
if (!Object.prototype.watchChange) {
|
2 |
-
var isFunction = function (fn) {
|
3 |
-
return fn && {}.toString.call(fn) === '[object Function]';
|
4 |
-
};
|
5 |
-
Object.defineProperty(
|
6 |
-
Object.prototype,
|
7 |
-
'watchChange',
|
8 |
-
{
|
9 |
-
enumerable: false,
|
10 |
-
configurable: true,
|
11 |
-
writable: false,
|
12 |
-
value: function (prop, handler) {
|
13 |
-
var obj = this;
|
14 |
-
|
15 |
-
function x(prop, handler) {
|
16 |
-
var oldval = obj[prop],
|
17 |
-
newval = oldval,
|
18 |
-
getter = function () {
|
19 |
-
return newval;
|
20 |
-
},
|
21 |
-
setter = function (val) {
|
22 |
-
return newval = handler.call(obj, prop, oldval, val);
|
23 |
-
};
|
24 |
-
|
25 |
-
if (delete obj[prop]) {
|
26 |
-
Object.defineProperty(
|
27 |
-
obj,
|
28 |
-
prop,
|
29 |
-
{
|
30 |
-
get: getter,
|
31 |
-
set: setter,
|
32 |
-
enumerable: true,
|
33 |
-
configurable: true
|
34 |
-
}
|
35 |
-
);
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
if (isFunction(prop)) {
|
40 |
-
for (var k in this) {
|
41 |
-
new x(k, prop);
|
42 |
-
}
|
43 |
-
} else {
|
44 |
-
new x(prop, handler)
|
45 |
-
}
|
46 |
-
}
|
47 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
;
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
target
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
attr[key] =
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
attr[key]
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
};
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
var curr = this.get(t);
|
259 |
-
// If interrupt is true and user scrolled, stop animating
|
260 |
-
if (t.options.interrupt && t._last && t._last !== curr) {
|
261 |
-
return $(t.elem).stop();
|
262 |
-
}
|
263 |
-
var next = Math.round(t.now);
|
264 |
-
// Don't waste CPU
|
265 |
-
// Browsers don't render floating point scroll
|
266 |
-
if (curr !== next) {
|
267 |
-
$(t.elem)[t.prop](next);
|
268 |
-
t._last = this.get(t);
|
269 |
-
}
|
270 |
-
}
|
271 |
-
};
|
272 |
-
|
273 |
-
// AMD requirement
|
274 |
-
return $scrollTo;
|
275 |
});
|
276 |
-
(function (e) {
|
277 |
-
e.backward_timer = function (t) {
|
278 |
-
var n = {seconds: 5, step: 1, format: "h%:m%:s%", value_setter: undefined, on_exhausted: function (e) {
|
279 |
-
}, on_tick : function (e) {
|
280 |
-
}}, r = this;
|
281 |
-
r.seconds_left = 0;
|
282 |
-
r.target = e(t);
|
283 |
-
r.timeout = undefined;
|
284 |
-
r.settings = {};
|
285 |
-
r.methods = {init : function (t) {
|
286 |
-
r.settings = e.extend({}, n, t);
|
287 |
-
if (r.settings.value_setter == undefined) {
|
288 |
-
if (r.target.is("input")) {
|
289 |
-
r.settings.value_setter = "val"
|
290 |
-
} else {
|
291 |
-
r.settings.value_setter = "text"
|
292 |
-
}
|
293 |
-
}
|
294 |
-
r.methods.reset()
|
295 |
-
}, start : function () {
|
296 |
-
if (r.timeout == undefined) {
|
297 |
-
var e = r.seconds_left == r.settings.seconds ? 0 : r.settings.step * 1e3;
|
298 |
-
setTimeout(r.methods._on_tick, e, e)
|
299 |
-
}
|
300 |
-
}, cancel : function () {
|
301 |
-
if (r.timeout != undefined) {
|
302 |
-
clearTimeout(r.timeout);
|
303 |
-
r.timeout = undefined
|
304 |
-
}
|
305 |
-
}, reset : function () {
|
306 |
-
r.seconds_left = r.settings.seconds;
|
307 |
-
r.methods._render_seconds()
|
308 |
-
}, _on_tick : function (e) {
|
309 |
-
if (e != 0) {
|
310 |
-
r.settings.on_tick(r)
|
311 |
-
}
|
312 |
-
r.methods._render_seconds();
|
313 |
-
if (r.seconds_left > 0) {
|
314 |
-
if (r.seconds_left < r.settings.step) {
|
315 |
-
var t = r.seconds_left
|
316 |
-
} else {
|
317 |
-
var t = r.settings.step
|
318 |
-
}
|
319 |
-
r.seconds_left -= t;
|
320 |
-
var n = t * 1e3;
|
321 |
-
r.timeout = setTimeout(r.methods._on_tick, n, n)
|
322 |
-
} else {
|
323 |
-
r.timeout = undefined;
|
324 |
-
r.settings.on_exhausted(r)
|
325 |
-
}
|
326 |
-
}, _render_seconds : function () {
|
327 |
-
var e = r.methods._seconds_to_dhms(r.seconds_left), t = r.settings.format;
|
328 |
-
if (t.indexOf("d%") !== -1) {
|
329 |
-
t = t.replace("d%", e.d).replace("h%", r.methods._check_leading_zero(e.h))
|
330 |
-
} else {
|
331 |
-
t = t.replace("h%", e.d * 24 + e.h)
|
332 |
-
}
|
333 |
-
t = t.replace("m%", r.methods._check_leading_zero(e.m)).replace("s%", r.methods._check_leading_zero(e.s));
|
334 |
-
r.target[r.settings.value_setter](t)
|
335 |
-
}, _seconds_to_dhms : function (e) {
|
336 |
-
var t = Math.floor(e / (24 * 3600)), e = e - t * 24 * 3600, n = Math.floor(e / 3600), e = e - n * 3600, r = Math.floor(e / 60), i = Math.floor(e - r * 60);
|
337 |
-
return{d: t, h: n, m: r, s: i}
|
338 |
-
}, _check_leading_zero: function (e) {
|
339 |
-
return e < 10 ? "0" + e : "" + e
|
340 |
-
}}
|
341 |
-
};
|
342 |
-
e.fn.backward_timer = function (t) {
|
343 |
-
var n = arguments;
|
344 |
-
return this.each(function () {
|
345 |
-
var r = e(this).data("backward_timer");
|
346 |
-
if (r == undefined) {
|
347 |
-
r = new e.backward_timer(this);
|
348 |
-
e(this).data("backward_timer", r)
|
349 |
-
}
|
350 |
-
if (r.methods[t]) {
|
351 |
-
return r.methods[t].apply(this, Array.prototype.slice.call(n, 1))
|
352 |
-
} else if (typeof t === "object" || !t) {
|
353 |
-
return r.methods.init.apply(this, n)
|
354 |
-
} else {
|
355 |
-
e.error("Method " + t + " does not exist on jQuery.backward_timer")
|
356 |
-
}
|
357 |
-
})
|
358 |
-
}
|
359 |
-
})(jQuery);
|
1 |
+
if (!Object.prototype.watchChange) {
|
2 |
+
var isFunction = function (fn) {
|
3 |
+
return fn && {}.toString.call(fn) === '[object Function]';
|
4 |
+
};
|
5 |
+
Object.defineProperty(
|
6 |
+
Object.prototype,
|
7 |
+
'watchChange',
|
8 |
+
{
|
9 |
+
enumerable: false,
|
10 |
+
configurable: true,
|
11 |
+
writable: false,
|
12 |
+
value: function (prop, handler) {
|
13 |
+
var obj = this;
|
14 |
+
|
15 |
+
function x(prop, handler) {
|
16 |
+
var oldval = obj[prop],
|
17 |
+
newval = oldval,
|
18 |
+
getter = function () {
|
19 |
+
return newval;
|
20 |
+
},
|
21 |
+
setter = function (val) {
|
22 |
+
return newval = handler.call(obj, prop, oldval, val);
|
23 |
+
};
|
24 |
+
|
25 |
+
if (delete obj[prop]) {
|
26 |
+
Object.defineProperty(
|
27 |
+
obj,
|
28 |
+
prop,
|
29 |
+
{
|
30 |
+
get: getter,
|
31 |
+
set: setter,
|
32 |
+
enumerable: true,
|
33 |
+
configurable: true
|
34 |
+
}
|
35 |
+
);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
if (isFunction(prop)) {
|
40 |
+
for (var k in this) {
|
41 |
+
new x(k, prop);
|
42 |
+
}
|
43 |
+
} else {
|
44 |
+
new x(prop, handler)
|
45 |
+
}
|
46 |
+
}
|
47 |
+
});
|
48 |
+
}
|
49 |
+
|
50 |
+
if (!Object.prototype.unwatchChange) {
|
51 |
+
Object.defineProperty(
|
52 |
+
Object.prototype,
|
53 |
+
'unwatchChange',
|
54 |
+
{
|
55 |
+
enumerable: false,
|
56 |
+
configurable: true,
|
57 |
+
writable: false,
|
58 |
+
value: function (prop) {
|
59 |
+
var val = this[prop];
|
60 |
+
delete this[prop];
|
61 |
+
this[prop] = val;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
);
|
65 |
}
|
66 |
+
/*!
|
67 |
+
* jQuery.scrollTo
|
68 |
+
* Copyright (c) 2007-2015 Ariel Flesler - aflesler ○ gmail • com | http://flesler.blogspot.com
|
69 |
+
* Licensed under MIT
|
70 |
+
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
71 |
+
* @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery
|
72 |
+
* @author Ariel Flesler
|
73 |
+
* @version 2.1.2
|
74 |
+
*/
|
75 |
+
;(function(factory) {
|
76 |
+
'use strict';
|
77 |
+
if (typeof define === 'function' && define.amd) {
|
78 |
+
// AMD
|
79 |
+
define(['jquery'], factory);
|
80 |
+
} else if (typeof module !== 'undefined' && module.exports) {
|
81 |
+
// CommonJS
|
82 |
+
module.exports = factory(require('jquery'));
|
83 |
+
} else {
|
84 |
+
// Global
|
85 |
+
factory(jQuery);
|
86 |
+
}
|
87 |
+
})(function($) {
|
88 |
+
'use strict';
|
89 |
+
|
90 |
+
var $scrollTo = $.scrollTo = function(target, duration, settings) {
|
91 |
+
return $(window).scrollTo(target, duration, settings);
|
92 |
+
};
|
93 |
+
|
94 |
+
$scrollTo.defaults = {
|
95 |
+
axis:'xy',
|
96 |
+
duration: 0,
|
97 |
+
limit:true
|
98 |
+
};
|
99 |
+
|
100 |
+
function isWin(elem) {
|
101 |
+
return !elem.nodeName ||
|
102 |
+
$.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1;
|
103 |
+
}
|
104 |
+
|
105 |
+
$.fn.scrollTo = function(target, duration, settings) {
|
106 |
+
if (typeof duration === 'object') {
|
107 |
+
settings = duration;
|
108 |
+
duration = 0;
|
109 |
+
}
|
110 |
+
if (typeof settings === 'function') {
|
111 |
+
settings = { onAfter:settings };
|
112 |
+
}
|
113 |
+
if (target === 'max') {
|
114 |
+
target = 9e9;
|
115 |
+
}
|
116 |
+
|
117 |
+
settings = $.extend({}, $scrollTo.defaults, settings);
|
118 |
+
// Speed is still recognized for backwards compatibility
|
119 |
+
duration = duration || settings.duration;
|
120 |
+
// Make sure the settings are given right
|
121 |
+
var queue = settings.queue && settings.axis.length > 1;
|
122 |
+
if (queue) {
|
123 |
+
// Let's keep the overall duration
|
124 |
+
duration /= 2;
|
125 |
+
}
|
126 |
+
settings.offset = both(settings.offset);
|
127 |
+
settings.over = both(settings.over);
|
128 |
+
|
129 |
+
return this.each(function() {
|
130 |
+
// Null target yields nothing, just like jQuery does
|
131 |
+
if (target === null) return;
|
132 |
+
|
133 |
+
var win = isWin(this),
|
134 |
+
elem = win ? this.contentWindow || window : this,
|
135 |
+
$elem = $(elem),
|
136 |
+
targ = target,
|
137 |
+
attr = {},
|
138 |
+
toff;
|
139 |
+
|
140 |
+
switch (typeof targ) {
|
141 |
+
// A number will pass the regex
|
142 |
+
case 'number':
|
143 |
+
case 'string':
|
144 |
+
if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
|
145 |
+
targ = both(targ);
|
146 |
+
// We are done
|
147 |
+
break;
|
148 |
+
}
|
149 |
+
// Relative/Absolute selector
|
150 |
+
targ = win ? $(targ) : $(targ, elem);
|
151 |
+
/* falls through */
|
152 |
+
case 'object':
|
153 |
+
if (targ.length === 0) return;
|
154 |
+
// DOMElement / jQuery
|
155 |
+
if (targ.is || targ.style) {
|
156 |
+
// Get the real position of the target
|
157 |
+
toff = (targ = $(targ)).offset();
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset;
|
162 |
+
|
163 |
+
$.each(settings.axis.split(''), function(i, axis) {
|
164 |
+
var Pos = axis === 'x' ? 'Left' : 'Top',
|
165 |
+
pos = Pos.toLowerCase(),
|
166 |
+
key = 'scroll' + Pos,
|
167 |
+
prev = $elem[key](),
|
168 |
+
max = $scrollTo.max(elem, axis);
|
169 |
+
|
170 |
+
if (toff) {// jQuery / DOMElement
|
171 |
+
attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]);
|
172 |
+
|
173 |
+
// If it's a dom element, reduce the margin
|
174 |
+
if (settings.margin) {
|
175 |
+
attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0;
|
176 |
+
attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0;
|
177 |
+
}
|
178 |
+
|
179 |
+
attr[key] += offset[pos] || 0;
|
180 |
+
|
181 |
+
if (settings.over[pos]) {
|
182 |
+
// Scroll to a fraction of its width/height
|
183 |
+
attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos];
|
184 |
+
}
|
185 |
+
} else {
|
186 |
+
var val = targ[pos];
|
187 |
+
// Handle percentage values
|
188 |
+
attr[key] = val.slice && val.slice(-1) === '%' ?
|
189 |
+
parseFloat(val) / 100 * max
|
190 |
+
: val;
|
191 |
+
}
|
192 |
+
|
193 |
+
// Number or 'number'
|
194 |
+
if (settings.limit && /^\d+$/.test(attr[key])) {
|
195 |
+
// Check the limits
|
196 |
+
attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
|
197 |
+
}
|
198 |
+
|
199 |
+
// Don't waste time animating, if there's no need.
|
200 |
+
if (!i && settings.axis.length > 1) {
|
201 |
+
if (prev === attr[key]) {
|
202 |
+
// No animation needed
|
203 |
+
attr = {};
|
204 |
+
} else if (queue) {
|
205 |
+
// Intermediate animation
|
206 |
+
animate(settings.onAfterFirst);
|
207 |
+
// Don't animate this axis again in the next iteration.
|
208 |
+
attr = {};
|
209 |
+
}
|
210 |
+
}
|
211 |
+
});
|
212 |
+
|
213 |
+
animate(settings.onAfter);
|
214 |
+
|
215 |
+
function animate(callback) {
|
216 |
+
var opts = $.extend({}, settings, {
|
217 |
+
// The queue setting conflicts with animate()
|
218 |
+
// Force it to always be true
|
219 |
+
queue: true,
|
220 |
+
duration: duration,
|
221 |
+
complete: callback && function() {
|
222 |
+
callback.call(elem, targ, settings);
|
223 |
+
}
|
224 |
+
});
|
225 |
+
$elem.animate(attr, opts);
|
226 |
+
}
|
227 |
+
});
|
228 |
+
};
|
229 |
+
|
230 |
+
// Max scrolling position, works on quirks mode
|
231 |
+
// It only fails (not too badly) on IE, quirks mode.
|
232 |
+
$scrollTo.max = function(elem, axis) {
|
233 |
+
var Dim = axis === 'x' ? 'Width' : 'Height',
|
234 |
+
scroll = 'scroll'+Dim;
|
235 |
+
|
236 |
+
if (!isWin(elem))
|
237 |
+
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
|
238 |
+
|
239 |
+
var size = 'client' + Dim,
|
240 |
+
doc = elem.ownerDocument || elem.document,
|
241 |
+
html = doc.documentElement,
|
242 |
+
body = doc.body;
|
243 |
+
|
244 |
+
return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]);
|
245 |
+
};
|
246 |
+
|
247 |
+
function both(val) {
|
248 |
+
return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val };
|
249 |
+
}
|
250 |
+
|
251 |
+
// Add special hooks so that window scroll properties can be animated
|
252 |
+
$.Tween.propHooks.scrollLeft =
|
253 |
+
$.Tween.propHooks.scrollTop = {
|
254 |
+
get: function(t) {
|
255 |
+
return $(t.elem)[t.prop]();
|
256 |
+
},
|
257 |
+
set: function(t) {
|
258 |
+
var curr = this.get(t);
|
259 |
+
// If interrupt is true and user scrolled, stop animating
|
260 |
+
if (t.options.interrupt && t._last && t._last !== curr) {
|
261 |
+
return $(t.elem).stop();
|
262 |
+
}
|
263 |
+
var next = Math.round(t.now);
|
264 |
+
// Don't waste CPU
|
265 |
+
// Browsers don't render floating point scroll
|
266 |
+
if (curr !== next) {
|
267 |
+
$(t.elem)[t.prop](next);
|
268 |
+
t._last = this.get(t);
|
269 |
+
}
|
270 |
+
}
|
271 |
+
};
|
272 |
+
|
273 |
+
// AMD requirement
|
274 |
+
return $scrollTo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
});
|
276 |
+
(function (e) {
|
277 |
+
e.backward_timer = function (t) {
|
278 |
+
var n = {seconds: 5, step: 1, format: "h%:m%:s%", value_setter: undefined, on_exhausted: function (e) {
|
279 |
+
}, on_tick : function (e) {
|
280 |
+
}}, r = this;
|
281 |
+
r.seconds_left = 0;
|
282 |
+
r.target = e(t);
|
283 |
+
r.timeout = undefined;
|
284 |
+
r.settings = {};
|
285 |
+
r.methods = {init : function (t) {
|
286 |
+
r.settings = e.extend({}, n, t);
|
287 |
+
if (r.settings.value_setter == undefined) {
|
288 |
+
if (r.target.is("input")) {
|
289 |
+
r.settings.value_setter = "val"
|
290 |
+
} else {
|
291 |
+
r.settings.value_setter = "text"
|
292 |
+
}
|
293 |
+
}
|
294 |
+
r.methods.reset()
|
295 |
+
}, start : function () {
|
296 |
+
if (r.timeout == undefined) {
|
297 |
+
var e = r.seconds_left == r.settings.seconds ? 0 : r.settings.step * 1e3;
|
298 |
+
setTimeout(r.methods._on_tick, e, e)
|
299 |
+
}
|
300 |
+
}, cancel : function () {
|
301 |
+
if (r.timeout != undefined) {
|
302 |
+
clearTimeout(r.timeout);
|
303 |
+
r.timeout = undefined
|
304 |
+
}
|
305 |
+
}, reset : function () {
|
306 |
+
r.seconds_left = r.settings.seconds;
|
307 |
+
r.methods._render_seconds()
|
308 |
+
}, _on_tick : function (e) {
|
309 |
+
if (e != 0) {
|
310 |
+
r.settings.on_tick(r)
|
311 |
+
}
|
312 |
+
r.methods._render_seconds();
|
313 |
+
if (r.seconds_left > 0) {
|
314 |
+
if (r.seconds_left < r.settings.step) {
|
315 |
+
var t = r.seconds_left
|
316 |
+
} else {
|
317 |
+
var t = r.settings.step
|
318 |
+
}
|
319 |
+
r.seconds_left -= t;
|
320 |
+
var n = t * 1e3;
|
321 |
+
r.timeout = setTimeout(r.methods._on_tick, n, n)
|
322 |
+
} else {
|
323 |
+
r.timeout = undefined;
|
324 |
+
r.settings.on_exhausted(r)
|
325 |
+
}
|
326 |
+
}, _render_seconds : function () {
|
327 |
+
var e = r.methods._seconds_to_dhms(r.seconds_left), t = r.settings.format;
|
328 |
+
if (t.indexOf("d%") !== -1) {
|
329 |
+
t = t.replace("d%", e.d).replace("h%", r.methods._check_leading_zero(e.h))
|
330 |
+
} else {
|
331 |
+
t = t.replace("h%", e.d * 24 + e.h)
|
332 |
+
}
|
333 |
+
t = t.replace("m%", r.methods._check_leading_zero(e.m)).replace("s%", r.methods._check_leading_zero(e.s));
|
334 |
+
r.target[r.settings.value_setter](t)
|
335 |
+
}, _seconds_to_dhms : function (e) {
|
336 |
+
var t = Math.floor(e / (24 * 3600)), e = e - t * 24 * 3600, n = Math.floor(e / 3600), e = e - n * 3600, r = Math.floor(e / 60), i = Math.floor(e - r * 60);
|
337 |
+
return{d: t, h: n, m: r, s: i}
|
338 |
+
}, _check_leading_zero: function (e) {
|
339 |
+
return e < 10 ? "0" + e : "" + e
|
340 |
+
}}
|
341 |
+
};
|
342 |
+
e.fn.backward_timer = function (t) {
|
343 |
+
var n = arguments;
|
344 |
+
return this.each(function () {
|
345 |
+
var r = e(this).data("backward_timer");
|
346 |
+
if (r == undefined) {
|
347 |
+
r = new e.backward_timer(this);
|
348 |
+
e(this).data("backward_timer", r)
|
349 |
+
}
|
350 |
+
if (r.methods[t]) {
|
351 |
+
return r.methods[t].apply(this, Array.prototype.slice.call(n, 1))
|
352 |
+
} else if (typeof t === "object" || !t) {
|
353 |
+
return r.methods.init.apply(this, n)
|
354 |
+
} else {
|
355 |
+
e.error("Method " + t + " does not exist on jQuery.backward_timer")
|
356 |
+
}
|
357 |
+
})
|
358 |
+
}
|
359 |
+
})(jQuery);
|
assets/js/vendor/vue/vue_libs.js
CHANGED
@@ -1,14524 +1,14524 @@
|
|
1 |
-
/*!
|
2 |
-
* Vue.js v2.6.10
|
3 |
-
* (c) 2014-2019 Evan You
|
4 |
-
* Released under the MIT License.
|
5 |
-
*/
|
6 |
-
|
7 |
-
(function (global, factory) {
|
8 |
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
9 |
-
typeof define === 'function' && define.amd ? define(factory) :
|
10 |
-
(global = global || self, global.Vue = factory());
|
11 |
-
}(this, function () { 'use strict';
|
12 |
-
|
13 |
-
/* */
|
14 |
-
|
15 |
-
var emptyObject = Object.freeze({});
|
16 |
-
|
17 |
-
// These helpers produce better VM code in JS engines due to their
|
18 |
-
// explicitness and function inlining.
|
19 |
-
function isUndef (v) {
|
20 |
-
return v === undefined || v === null
|
21 |
-
}
|
22 |
-
|
23 |
-
function isDef (v) {
|
24 |
-
return v !== undefined && v !== null
|
25 |
-
}
|
26 |
-
|
27 |
-
function isTrue (v) {
|
28 |
-
return v === true
|
29 |
-
}
|
30 |
-
|
31 |
-
function isFalse (v) {
|
32 |
-
return v === false
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Check if value is primitive.
|
37 |
-
*/
|
38 |
-
function isPrimitive (value) {
|
39 |
-
return (
|
40 |
-
typeof value === 'string' ||
|
41 |
-
typeof value === 'number' ||
|
42 |
-
// $flow-disable-line
|
43 |
-
typeof value === 'symbol' ||
|
44 |
-
typeof value === 'boolean'
|
45 |
-
)
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Quick object check - this is primarily used to tell
|
50 |
-
* Objects from primitive values when we know the value
|
51 |
-
* is a JSON-compliant type.
|
52 |
-
*/
|
53 |
-
function isObject (obj) {
|
54 |
-
return obj !== null && typeof obj === 'object'
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Get the raw type string of a value, e.g., [object Object].
|
59 |
-
*/
|
60 |
-
var _toString = Object.prototype.toString;
|
61 |
-
|
62 |
-
function toRawType (value) {
|
63 |
-
return _toString.call(value).slice(8, -1)
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Strict object type check. Only returns true
|
68 |
-
* for plain JavaScript objects.
|
69 |
-
*/
|
70 |
-
function isPlainObject (obj) {
|
71 |
-
return _toString.call(obj) === '[object Object]'
|
72 |
-
}
|
73 |
-
|
74 |
-
function isRegExp (v) {
|
75 |
-
return _toString.call(v) === '[object RegExp]'
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Check if val is a valid array index.
|
80 |
-
*/
|
81 |
-
function isValidArrayIndex (val) {
|
82 |
-
var n = parseFloat(String(val));
|
83 |
-
return n >= 0 && Math.floor(n) === n && isFinite(val)
|
84 |
-
}
|
85 |
-
|
86 |
-
function isPromise (val) {
|
87 |
-
return (
|
88 |
-
isDef(val) &&
|
89 |
-
typeof val.then === 'function' &&
|
90 |
-
typeof val.catch === 'function'
|
91 |
-
)
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Convert a value to a string that is actually rendered.
|
96 |
-
*/
|
97 |
-
function toString (val) {
|
98 |
-
return val == null
|
99 |
-
? ''
|
100 |
-
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
101 |
-
? JSON.stringify(val, null, 2)
|
102 |
-
: String(val)
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Convert an input value to a number for persistence.
|
107 |
-
* If the conversion fails, return original string.
|
108 |
-
*/
|
109 |
-
function toNumber (val) {
|
110 |
-
var n = parseFloat(val);
|
111 |
-
return isNaN(n) ? val : n
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Make a map and return a function for checking if a key
|
116 |
-
* is in that map.
|
117 |
-
*/
|
118 |
-
function makeMap (
|
119 |
-
str,
|
120 |
-
expectsLowerCase
|
121 |
-
) {
|
122 |
-
var map = Object.create(null);
|
123 |
-
var list = str.split(',');
|
124 |
-
for (var i = 0; i < list.length; i++) {
|
125 |
-
map[list[i]] = true;
|
126 |
-
}
|
127 |
-
return expectsLowerCase
|
128 |
-
? function (val) { return map[val.toLowerCase()]; }
|
129 |
-
: function (val) { return map[val]; }
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Check if a tag is a built-in tag.
|
134 |
-
*/
|
135 |
-
var isBuiltInTag = makeMap('slot,component', true);
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Check if an attribute is a reserved attribute.
|
139 |
-
*/
|
140 |
-
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Remove an item from an array.
|
144 |
-
*/
|
145 |
-
function remove (arr, item) {
|
146 |
-
if (arr.length) {
|
147 |
-
var index = arr.indexOf(item);
|
148 |
-
if (index > -1) {
|
149 |
-
return arr.splice(index, 1)
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Check whether an object has the property.
|
156 |
-
*/
|
157 |
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
158 |
-
function hasOwn (obj, key) {
|
159 |
-
return hasOwnProperty.call(obj, key)
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Create a cached version of a pure function.
|
164 |
-
*/
|
165 |
-
function cached (fn) {
|
166 |
-
var cache = Object.create(null);
|
167 |
-
return (function cachedFn (str) {
|
168 |
-
var hit = cache[str];
|
169 |
-
return hit || (cache[str] = fn(str))
|
170 |
-
})
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Camelize a hyphen-delimited string.
|
175 |
-
*/
|
176 |
-
var camelizeRE = /-(\w)/g;
|
177 |
-
var camelize = cached(function (str) {
|
178 |
-
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
179 |
-
});
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Capitalize a string.
|
183 |
-
*/
|
184 |
-
var capitalize = cached(function (str) {
|
185 |
-
return str.charAt(0).toUpperCase() + str.slice(1)
|
186 |
-
});
|
187 |
-
|
188 |
-
/**
|
189 |
-
* Hyphenate a camelCase string.
|
190 |
-
*/
|
191 |
-
var hyphenateRE = /\B([A-Z])/g;
|
192 |
-
var hyphenate = cached(function (str) {
|
193 |
-
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
194 |
-
});
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Simple bind polyfill for environments that do not support it,
|
198 |
-
* e.g., PhantomJS 1.x. Technically, we don't need this anymore
|
199 |
-
* since native bind is now performant enough in most browsers.
|
200 |
-
* But removing it would mean breaking code that was able to run in
|
201 |
-
* PhantomJS 1.x, so this must be kept for backward compatibility.
|
202 |
-
*/
|
203 |
-
|
204 |
-
/* istanbul ignore next */
|
205 |
-
function polyfillBind (fn, ctx) {
|
206 |
-
function boundFn (a) {
|
207 |
-
var l = arguments.length;
|
208 |
-
return l
|
209 |
-
? l > 1
|
210 |
-
? fn.apply(ctx, arguments)
|
211 |
-
: fn.call(ctx, a)
|
212 |
-
: fn.call(ctx)
|
213 |
-
}
|
214 |
-
|
215 |
-
boundFn._length = fn.length;
|
216 |
-
return boundFn
|
217 |
-
}
|
218 |
-
|
219 |
-
function nativeBind (fn, ctx) {
|
220 |
-
return fn.bind(ctx)
|
221 |
-
}
|
222 |
-
|
223 |
-
var bind = Function.prototype.bind
|
224 |
-
? nativeBind
|
225 |
-
: polyfillBind;
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Convert an Array-like object to a real Array.
|
229 |
-
*/
|
230 |
-
function toArray (list, start) {
|
231 |
-
start = start || 0;
|
232 |
-
var i = list.length - start;
|
233 |
-
var ret = new Array(i);
|
234 |
-
while (i--) {
|
235 |
-
ret[i] = list[i + start];
|
236 |
-
}
|
237 |
-
return ret
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Mix properties into target object.
|
242 |
-
*/
|
243 |
-
function extend (to, _from) {
|
244 |
-
for (var key in _from) {
|
245 |
-
to[key] = _from[key];
|
246 |
-
}
|
247 |
-
return to
|
248 |
-
}
|
249 |
-
|
250 |
-
/**
|
251 |
-
* Merge an Array of Objects into a single Object.
|
252 |
-
*/
|
253 |
-
function toObject (arr) {
|
254 |
-
var res = {};
|
255 |
-
for (var i = 0; i < arr.length; i++) {
|
256 |
-
if (arr[i]) {
|
257 |
-
extend(res, arr[i]);
|
258 |
-
}
|
259 |
-
}
|
260 |
-
return res
|
261 |
-
}
|
262 |
-
|
263 |
-
/* eslint-disable no-unused-vars */
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Perform no operation.
|
267 |
-
* Stubbing args to make Flow happy without leaving useless transpiled code
|
268 |
-
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
|
269 |
-
*/
|
270 |
-
function noop (a, b, c) {}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* Always return false.
|
274 |
-
*/
|
275 |
-
var no = function (a, b, c) { return false; };
|
276 |
-
|
277 |
-
/* eslint-enable no-unused-vars */
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Return the same value.
|
281 |
-
*/
|
282 |
-
var identity = function (_) { return _; };
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Generate a string containing static keys from compiler modules.
|
286 |
-
*/
|
287 |
-
function genStaticKeys (modules) {
|
288 |
-
return modules.reduce(function (keys, m) {
|
289 |
-
return keys.concat(m.staticKeys || [])
|
290 |
-
}, []).join(',')
|
291 |
-
}
|
292 |
-
|
293 |
-
/**
|
294 |
-
* Check if two values are loosely equal - that is,
|
295 |
-
* if they are plain objects, do they have the same shape?
|
296 |
-
*/
|
297 |
-
function looseEqual (a, b) {
|
298 |
-
if (a === b) { return true }
|
299 |
-
var isObjectA = isObject(a);
|
300 |
-
var isObjectB = isObject(b);
|
301 |
-
if (isObjectA && isObjectB) {
|
302 |
-
try {
|
303 |
-
var isArrayA = Array.isArray(a);
|
304 |
-
var isArrayB = Array.isArray(b);
|
305 |
-
if (isArrayA && isArrayB) {
|
306 |
-
return a.length === b.length && a.every(function (e, i) {
|
307 |
-
return looseEqual(e, b[i])
|
308 |
-
})
|
309 |
-
} else if (a instanceof Date && b instanceof Date) {
|
310 |
-
return a.getTime() === b.getTime()
|
311 |
-
} else if (!isArrayA && !isArrayB) {
|
312 |
-
var keysA = Object.keys(a);
|
313 |
-
var keysB = Object.keys(b);
|
314 |
-
return keysA.length === keysB.length && keysA.every(function (key) {
|
315 |
-
return looseEqual(a[key], b[key])
|
316 |
-
})
|
317 |
-
} else {
|
318 |
-
/* istanbul ignore next */
|
319 |
-
return false
|
320 |
-
}
|
321 |
-
} catch (e) {
|
322 |
-
/* istanbul ignore next */
|
323 |
-
return false
|
324 |
-
}
|
325 |
-
} else if (!isObjectA && !isObjectB) {
|
326 |
-
return String(a) === String(b)
|
327 |
-
} else {
|
328 |
-
return false
|
329 |
-
}
|
330 |
-
}
|
331 |
-
|
332 |
-
/**
|
333 |
-
* Return the first index at which a loosely equal value can be
|
334 |
-
* found in the array (if value is a plain object, the array must
|
335 |
-
* contain an object of the same shape), or -1 if it is not present.
|
336 |
-
*/
|
337 |
-
function looseIndexOf (arr, val) {
|
338 |
-
for (var i = 0; i < arr.length; i++) {
|
339 |
-
if (looseEqual(arr[i], val)) { return i }
|
340 |
-
}
|
341 |
-
return -1
|
342 |
-
}
|
343 |
-
|
344 |
-
/**
|
345 |
-
* Ensure a function is called only once.
|
346 |
-
*/
|
347 |
-
function once (fn) {
|
348 |
-
var called = false;
|
349 |
-
return function () {
|
350 |
-
if (!called) {
|
351 |
-
called = true;
|
352 |
-
fn.apply(this, arguments);
|
353 |
-
}
|
354 |
-
}
|
355 |
-
}
|
356 |
-
|
357 |
-
var SSR_ATTR = 'data-server-rendered';
|
358 |
-
|
359 |
-
var ASSET_TYPES = [
|
360 |
-
'component',
|
361 |
-
'directive',
|
362 |
-
'filter'
|
363 |
-
];
|
364 |
-
|
365 |
-
var LIFECYCLE_HOOKS = [
|
366 |
-
'beforeCreate',
|
367 |
-
'created',
|
368 |
-
'beforeMount',
|
369 |
-
'mounted',
|
370 |
-
'beforeUpdate',
|
371 |
-
'updated',
|
372 |
-
'beforeDestroy',
|
373 |
-
'destroyed',
|
374 |
-
'activated',
|
375 |
-
'deactivated',
|
376 |
-
'errorCaptured',
|
377 |
-
'serverPrefetch'
|
378 |
-
];
|
379 |
-
|
380 |
-
/* */
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
var config = ({
|
385 |
-
/**
|
386 |
-
* Option merge strategies (used in core/util/options)
|
387 |
-
*/
|
388 |
-
// $flow-disable-line
|
389 |
-
optionMergeStrategies: Object.create(null),
|
390 |
-
|
391 |
-
/**
|
392 |
-
* Whether to suppress warnings.
|
393 |
-
*/
|
394 |
-
silent: false,
|
395 |
-
|
396 |
-
/**
|
397 |
-
* Show production mode tip message on boot?
|
398 |
-
*/
|
399 |
-
productionTip: "development" !== 'production',
|
400 |
-
|
401 |
-
/**
|
402 |
-
* Whether to enable devtools
|
403 |
-
*/
|
404 |
-
devtools: "development" !== 'production',
|
405 |
-
|
406 |
-
/**
|
407 |
-
* Whether to record perf
|
408 |
-
*/
|
409 |
-
performance: false,
|
410 |
-
|
411 |
-
/**
|
412 |
-
* Error handler for watcher errors
|
413 |
-
*/
|
414 |
-
errorHandler: null,
|
415 |
-
|
416 |
-
/**
|
417 |
-
* Warn handler for watcher warns
|
418 |
-
*/
|
419 |
-
warnHandler: null,
|
420 |
-
|
421 |
-
/**
|
422 |
-
* Ignore certain custom elements
|
423 |
-
*/
|
424 |
-
ignoredElements: [],
|
425 |
-
|
426 |
-
/**
|
427 |
-
* Custom user key aliases for v-on
|
428 |
-
*/
|
429 |
-
// $flow-disable-line
|
430 |
-
keyCodes: Object.create(null),
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Check if a tag is reserved so that it cannot be registered as a
|
434 |
-
* component. This is platform-dependent and may be overwritten.
|
435 |
-
*/
|
436 |
-
isReservedTag: no,
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Check if an attribute is reserved so that it cannot be used as a component
|
440 |
-
* prop. This is platform-dependent and may be overwritten.
|
441 |
-
*/
|
442 |
-
isReservedAttr: no,
|
443 |
-
|
444 |
-
/**
|
445 |
-
* Check if a tag is an unknown element.
|
446 |
-
* Platform-dependent.
|
447 |
-
*/
|
448 |
-
isUnknownElement: no,
|
449 |
-
|
450 |
-
/**
|
451 |
-
* Get the namespace of an element
|
452 |
-
*/
|
453 |
-
getTagNamespace: noop,
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Parse the real tag name for the specific platform.
|
457 |
-
*/
|
458 |
-
parsePlatformTagName: identity,
|
459 |
-
|
460 |
-
/**
|
461 |
-
* Check if an attribute must be bound using property, e.g. value
|
462 |
-
* Platform-dependent.
|
463 |
-
*/
|
464 |
-
mustUseProp: no,
|
465 |
-
|
466 |
-
/**
|
467 |
-
* Perform updates asynchronously. Intended to be used by Vue Test Utils
|
468 |
-
* This will significantly reduce performance if set to false.
|
469 |
-
*/
|
470 |
-
async: true,
|
471 |
-
|
472 |
-
/**
|
473 |
-
* Exposed for legacy reasons
|
474 |
-
*/
|
475 |
-
_lifecycleHooks: LIFECYCLE_HOOKS
|
476 |
-
});
|
477 |
-
|
478 |
-
/* */
|
479 |
-
|
480 |
-
/**
|
481 |
-
* unicode letters used for parsing html tags, component names and property paths.
|
482 |
-
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
483 |
-
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
484 |
-
*/
|
485 |
-
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
|
486 |
-
|
487 |
-
/**
|
488 |
-
* Check if a string starts with $ or _
|
489 |
-
*/
|
490 |
-
function isReserved (str) {
|
491 |
-
var c = (str + '').charCodeAt(0);
|
492 |
-
return c === 0x24 || c === 0x5F
|
493 |
-
}
|
494 |
-
|
495 |
-
/**
|
496 |
-
* Define a property.
|
497 |
-
*/
|
498 |
-
function def (obj, key, val, enumerable) {
|
499 |
-
Object.defineProperty(obj, key, {
|
500 |
-
value: val,
|
501 |
-
enumerable: !!enumerable,
|
502 |
-
writable: true,
|
503 |
-
configurable: true
|
504 |
-
});
|
505 |
-
}
|
506 |
-
|
507 |
-
/**
|
508 |
-
* Parse simple path.
|
509 |
-
*/
|
510 |
-
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
|
511 |
-
function parsePath (path) {
|
512 |
-
if (bailRE.test(path)) {
|
513 |
-
return
|
514 |
-
}
|
515 |
-
var segments = path.split('.');
|
516 |
-
return function (obj) {
|
517 |
-
for (var i = 0; i < segments.length; i++) {
|
518 |
-
if (!obj) { return }
|
519 |
-
obj = obj[segments[i]];
|
520 |
-
}
|
521 |
-
return obj
|
522 |
-
}
|
523 |
-
}
|
524 |
-
|
525 |
-
/* */
|
526 |
-
|
527 |
-
// can we use __proto__?
|
528 |
-
var hasProto = '__proto__' in {};
|
529 |
-
|
530 |
-
// Browser environment sniffing
|
531 |
-
var inBrowser = typeof window !== 'undefined';
|
532 |
-
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
533 |
-
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
534 |
-
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
535 |
-
var isIE = UA && /msie|trident/.test(UA);
|
536 |
-
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
537 |
-
var isEdge = UA && UA.indexOf('edge/') > 0;
|
538 |
-
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
539 |
-
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
540 |
-
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
541 |
-
var isPhantomJS = UA && /phantomjs/.test(UA);
|
542 |
-
var isFF = UA && UA.match(/firefox\/(\d+)/);
|
543 |
-
|
544 |
-
// Firefox has a "watch" function on Object.prototype...
|
545 |
-
var nativeWatch = ({}).watch;
|
546 |
-
|
547 |
-
var supportsPassive = false;
|
548 |
-
if (inBrowser) {
|
549 |
-
try {
|
550 |
-
var opts = {};
|
551 |
-
Object.defineProperty(opts, 'passive', ({
|
552 |
-
get: function get () {
|
553 |
-
/* istanbul ignore next */
|
554 |
-
supportsPassive = true;
|
555 |
-
}
|
556 |
-
})); // https://github.com/facebook/flow/issues/285
|
557 |
-
window.addEventListener('test-passive', null, opts);
|
558 |
-
} catch (e) {}
|
559 |
-
}
|
560 |
-
|
561 |
-
// this needs to be lazy-evaled because vue may be required before
|
562 |
-
// vue-server-renderer can set VUE_ENV
|
563 |
-
var _isServer;
|
564 |
-
var isServerRendering = function () {
|
565 |
-
if (_isServer === undefined) {
|
566 |
-
/* istanbul ignore if */
|
567 |
-
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
568 |
-
// detect presence of vue-server-renderer and avoid
|
569 |
-
// Webpack shimming the process
|
570 |
-
_isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
571 |
-
} else {
|
572 |
-
_isServer = false;
|
573 |
-
}
|
574 |
-
}
|
575 |
-
return _isServer
|
576 |
-
};
|
577 |
-
|
578 |
-
// detect devtools
|
579 |
-
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
580 |
-
|
581 |
-
/* istanbul ignore next */
|
582 |
-
function isNative (Ctor) {
|
583 |
-
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
584 |
-
}
|
585 |
-
|
586 |
-
var hasSymbol =
|
587 |
-
typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
588 |
-
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
589 |
-
|
590 |
-
var _Set;
|
591 |
-
/* istanbul ignore if */ // $flow-disable-line
|
592 |
-
if (typeof Set !== 'undefined' && isNative(Set)) {
|
593 |
-
// use native Set when available.
|
594 |
-
_Set = Set;
|
595 |
-
} else {
|
596 |
-
// a non-standard Set polyfill that only works with primitive keys.
|
597 |
-
_Set = /*@__PURE__*/(function () {
|
598 |
-
function Set () {
|
599 |
-
this.set = Object.create(null);
|
600 |
-
}
|
601 |
-
Set.prototype.has = function has (key) {
|
602 |
-
return this.set[key] === true
|
603 |
-
};
|
604 |
-
Set.prototype.add = function add (key) {
|
605 |
-
this.set[key] = true;
|
606 |
-
};
|
607 |
-
Set.prototype.clear = function clear () {
|
608 |
-
this.set = Object.create(null);
|
609 |
-
};
|
610 |
-
|
611 |
-
return Set;
|
612 |
-
}());
|
613 |
-
}
|
614 |
-
|
615 |
-
/* */
|
616 |
-
|
617 |
-
var warn = noop;
|
618 |
-
var tip = noop;
|
619 |
-
var generateComponentTrace = (noop); // work around flow check
|
620 |
-
var formatComponentName = (noop);
|
621 |
-
|
622 |
-
{
|
623 |
-
var hasConsole = typeof console !== 'undefined';
|
624 |
-
var classifyRE = /(?:^|[-_])(\w)/g;
|
625 |
-
var classify = function (str) { return str
|
626 |
-
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
627 |
-
.replace(/[-_]/g, ''); };
|
628 |
-
|
629 |
-
warn = function (msg, vm) {
|
630 |
-
var trace = vm ? generateComponentTrace(vm) : '';
|
631 |
-
|
632 |
-
if (config.warnHandler) {
|
633 |
-
config.warnHandler.call(null, msg, vm, trace);
|
634 |
-
} else if (hasConsole && (!config.silent)) {
|
635 |
-
console.error(("[Vue warn]: " + msg + trace));
|
636 |
-
}
|
637 |
-
};
|
638 |
-
|
639 |
-
tip = function (msg, vm) {
|
640 |
-
if (hasConsole && (!config.silent)) {
|
641 |
-
console.warn("[Vue tip]: " + msg + (
|
642 |
-
vm ? generateComponentTrace(vm) : ''
|
643 |
-
));
|
644 |
-
}
|
645 |
-
};
|
646 |
-
|
647 |
-
formatComponentName = function (vm, includeFile) {
|
648 |
-
if (vm.$root === vm) {
|
649 |
-
return '<Root>'
|
650 |
-
}
|
651 |
-
var options = typeof vm === 'function' && vm.cid != null
|
652 |
-
? vm.options
|
653 |
-
: vm._isVue
|
654 |
-
? vm.$options || vm.constructor.options
|
655 |
-
: vm;
|
656 |
-
var name = options.name || options._componentTag;
|
657 |
-
var file = options.__file;
|
658 |
-
if (!name && file) {
|
659 |
-
var match = file.match(/([^/\\]+)\.vue$/);
|
660 |
-
name = match && match[1];
|
661 |
-
}
|
662 |
-
|
663 |
-
return (
|
664 |
-
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
665 |
-
(file && includeFile !== false ? (" at " + file) : '')
|
666 |
-
)
|
667 |
-
};
|
668 |
-
|
669 |
-
var repeat = function (str, n) {
|
670 |
-
var res = '';
|
671 |
-
while (n) {
|
672 |
-
if (n % 2 === 1) { res += str; }
|
673 |
-
if (n > 1) { str += str; }
|
674 |
-
n >>= 1;
|
675 |
-
}
|
676 |
-
return res
|
677 |
-
};
|
678 |
-
|
679 |
-
generateComponentTrace = function (vm) {
|
680 |
-
if (vm._isVue && vm.$parent) {
|
681 |
-
var tree = [];
|
682 |
-
var currentRecursiveSequence = 0;
|
683 |
-
while (vm) {
|
684 |
-
if (tree.length > 0) {
|
685 |
-
var last = tree[tree.length - 1];
|
686 |
-
if (last.constructor === vm.constructor) {
|
687 |
-
currentRecursiveSequence++;
|
688 |
-
vm = vm.$parent;
|
689 |
-
continue
|
690 |
-
} else if (currentRecursiveSequence > 0) {
|
691 |
-
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
692 |
-
currentRecursiveSequence = 0;
|
693 |
-
}
|
694 |
-
}
|
695 |
-
tree.push(vm);
|
696 |
-
vm = vm.$parent;
|
697 |
-
}
|
698 |
-
return '\n\nfound in\n\n' + tree
|
699 |
-
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
700 |
-
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
701 |
-
: formatComponentName(vm))); })
|
702 |
-
.join('\n')
|
703 |
-
} else {
|
704 |
-
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
705 |
-
}
|
706 |
-
};
|
707 |
-
}
|
708 |
-
|
709 |
-
/* */
|
710 |
-
|
711 |
-
var uid = 0;
|
712 |
-
|
713 |
-
/**
|
714 |
-
* A dep is an observable that can have multiple
|
715 |
-
* directives subscribing to it.
|
716 |
-
*/
|
717 |
-
var Dep = function Dep () {
|
718 |
-
this.id = uid++;
|
719 |
-
this.subs = [];
|
720 |
-
};
|
721 |
-
|
722 |
-
Dep.prototype.addSub = function addSub (sub) {
|
723 |
-
this.subs.push(sub);
|
724 |
-
};
|
725 |
-
|
726 |
-
Dep.prototype.removeSub = function removeSub (sub) {
|
727 |
-
remove(this.subs, sub);
|
728 |
-
};
|
729 |
-
|
730 |
-
Dep.prototype.depend = function depend () {
|
731 |
-
if (Dep.target) {
|
732 |
-
Dep.target.addDep(this);
|
733 |
-
}
|
734 |
-
};
|
735 |
-
|
736 |
-
Dep.prototype.notify = function notify () {
|
737 |
-
// stabilize the subscriber list first
|
738 |
-
var subs = this.subs.slice();
|
739 |
-
if (!config.async) {
|
740 |
-
// subs aren't sorted in scheduler if not running async
|
741 |
-
// we need to sort them now to make sure they fire in correct
|
742 |
-
// order
|
743 |
-
subs.sort(function (a, b) { return a.id - b.id; });
|
744 |
-
}
|
745 |
-
for (var i = 0, l = subs.length; i < l; i++) {
|
746 |
-
subs[i].update();
|
747 |
-
}
|
748 |
-
};
|
749 |
-
|
750 |
-
// The current target watcher being evaluated.
|
751 |
-
// This is globally unique because only one watcher
|
752 |
-
// can be evaluated at a time.
|
753 |
-
Dep.target = null;
|
754 |
-
var targetStack = [];
|
755 |
-
|
756 |
-
function pushTarget (target) {
|
757 |
-
targetStack.push(target);
|
758 |
-
Dep.target = target;
|
759 |
-
}
|
760 |
-
|
761 |
-
function popTarget () {
|
762 |
-
targetStack.pop();
|
763 |
-
Dep.target = targetStack[targetStack.length - 1];
|
764 |
-
}
|
765 |
-
|
766 |
-
/* */
|
767 |
-
|
768 |
-
var VNode = function VNode (
|
769 |
-
tag,
|
770 |
-
data,
|
771 |
-
children,
|
772 |
-
text,
|
773 |
-
elm,
|
774 |
-
context,
|
775 |
-
componentOptions,
|
776 |
-
asyncFactory
|
777 |
-
) {
|
778 |
-
this.tag = tag;
|
779 |
-
this.data = data;
|
780 |
-
this.children = children;
|
781 |
-
this.text = text;
|
782 |
-
this.elm = elm;
|
783 |
-
this.ns = undefined;
|
784 |
-
this.context = context;
|
785 |
-
this.fnContext = undefined;
|
786 |
-
this.fnOptions = undefined;
|
787 |
-
this.fnScopeId = undefined;
|
788 |
-
this.key = data && data.key;
|
789 |
-
this.componentOptions = componentOptions;
|
790 |
-
this.componentInstance = undefined;
|
791 |
-
this.parent = undefined;
|
792 |
-
this.raw = false;
|
793 |
-
this.isStatic = false;
|
794 |
-
this.isRootInsert = true;
|
795 |
-
this.isComment = false;
|
796 |
-
this.isCloned = false;
|
797 |
-
this.isOnce = false;
|
798 |
-
this.asyncFactory = asyncFactory;
|
799 |
-
this.asyncMeta = undefined;
|
800 |
-
this.isAsyncPlaceholder = false;
|
801 |
-
};
|
802 |
-
|
803 |
-
var prototypeAccessors = { child: { configurable: true } };
|
804 |
-
|
805 |
-
// DEPRECATED: alias for componentInstance for backwards compat.
|
806 |
-
/* istanbul ignore next */
|
807 |
-
prototypeAccessors.child.get = function () {
|
808 |
-
return this.componentInstance
|
809 |
-
};
|
810 |
-
|
811 |
-
Object.defineProperties( VNode.prototype, prototypeAccessors );
|
812 |
-
|
813 |
-
var createEmptyVNode = function (text) {
|
814 |
-
if ( text === void 0 ) text = '';
|
815 |
-
|
816 |
-
var node = new VNode();
|
817 |
-
node.text = text;
|
818 |
-
node.isComment = true;
|
819 |
-
return node
|
820 |
-
};
|
821 |
-
|
822 |
-
function createTextVNode (val) {
|
823 |
-
return new VNode(undefined, undefined, undefined, String(val))
|
824 |
-
}
|
825 |
-
|
826 |
-
// optimized shallow clone
|
827 |
-
// used for static nodes and slot nodes because they may be reused across
|
828 |
-
// multiple renders, cloning them avoids errors when DOM manipulations rely
|
829 |
-
// on their elm reference.
|
830 |
-
function cloneVNode (vnode) {
|
831 |
-
var cloned = new VNode(
|
832 |
-
vnode.tag,
|
833 |
-
vnode.data,
|
834 |
-
// #7975
|
835 |
-
// clone children array to avoid mutating original in case of cloning
|
836 |
-
// a child.
|
837 |
-
vnode.children && vnode.children.slice(),
|
838 |
-
vnode.text,
|
839 |
-
vnode.elm,
|
840 |
-
vnode.context,
|
841 |
-
vnode.componentOptions,
|
842 |
-
vnode.asyncFactory
|
843 |
-
);
|
844 |
-
cloned.ns = vnode.ns;
|
845 |
-
cloned.isStatic = vnode.isStatic;
|
846 |
-
cloned.key = vnode.key;
|
847 |
-
cloned.isComment = vnode.isComment;
|
848 |
-
cloned.fnContext = vnode.fnContext;
|
849 |
-
cloned.fnOptions = vnode.fnOptions;
|
850 |
-
cloned.fnScopeId = vnode.fnScopeId;
|
851 |
-
cloned.asyncMeta = vnode.asyncMeta;
|
852 |
-
cloned.isCloned = true;
|
853 |
-
return cloned
|
854 |
-
}
|
855 |
-
|
856 |
-
/*
|
857 |
-
* not type checking this file because flow doesn't play well with
|
858 |
-
* dynamically accessing methods on Array prototype
|
859 |
-
*/
|
860 |
-
|
861 |
-
var arrayProto = Array.prototype;
|
862 |
-
var arrayMethods = Object.create(arrayProto);
|
863 |
-
|
864 |
-
var methodsToPatch = [
|
865 |
-
'push',
|
866 |
-
'pop',
|
867 |
-
'shift',
|
868 |
-
'unshift',
|
869 |
-
'splice',
|
870 |
-
'sort',
|
871 |
-
'reverse'
|
872 |
-
];
|
873 |
-
|
874 |
-
/**
|
875 |
-
* Intercept mutating methods and emit events
|
876 |
-
*/
|
877 |
-
methodsToPatch.forEach(function (method) {
|
878 |
-
// cache original method
|
879 |
-
var original = arrayProto[method];
|
880 |
-
def(arrayMethods, method, function mutator () {
|
881 |
-
var args = [], len = arguments.length;
|
882 |
-
while ( len-- ) args[ len ] = arguments[ len ];
|
883 |
-
|
884 |
-
var result = original.apply(this, args);
|
885 |
-
var ob = this.__ob__;
|
886 |
-
var inserted;
|
887 |
-
switch (method) {
|
888 |
-
case 'push':
|
889 |
-
case 'unshift':
|
890 |
-
inserted = args;
|
891 |
-
break
|
892 |
-
case 'splice':
|
893 |
-
inserted = args.slice(2);
|
894 |
-
break
|
895 |
-
}
|
896 |
-
if (inserted) { ob.observeArray(inserted); }
|
897 |
-
// notify change
|
898 |
-
ob.dep.notify();
|
899 |
-
return result
|
900 |
-
});
|
901 |
-
});
|
902 |
-
|
903 |
-
/* */
|
904 |
-
|
905 |
-
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
906 |
-
|
907 |
-
/**
|
908 |
-
* In some cases we may want to disable observation inside a component's
|
909 |
-
* update computation.
|
910 |
-
*/
|
911 |
-
var shouldObserve = true;
|
912 |
-
|
913 |
-
function toggleObserving (value) {
|
914 |
-
shouldObserve = value;
|
915 |
-
}
|
916 |
-
|
917 |
-
/**
|
918 |
-
* Observer class that is attached to each observed
|
919 |
-
* object. Once attached, the observer converts the target
|
920 |
-
* object's property keys into getter/setters that
|
921 |
-
* collect dependencies and dispatch updates.
|
922 |
-
*/
|
923 |
-
var Observer = function Observer (value) {
|
924 |
-
this.value = value;
|
925 |
-
this.dep = new Dep();
|
926 |
-
this.vmCount = 0;
|
927 |
-
def(value, '__ob__', this);
|
928 |
-
if (Array.isArray(value)) {
|
929 |
-
if (hasProto) {
|
930 |
-
protoAugment(value, arrayMethods);
|
931 |
-
} else {
|
932 |
-
copyAugment(value, arrayMethods, arrayKeys);
|
933 |
-
}
|
934 |
-
this.observeArray(value);
|
935 |
-
} else {
|
936 |
-
this.walk(value);
|
937 |
-
}
|
938 |
-
};
|
939 |
-
|
940 |
-
/**
|
941 |
-
* Walk through all properties and convert them into
|
942 |
-
* getter/setters. This method should only be called when
|
943 |
-
* value type is Object.
|
944 |
-
*/
|
945 |
-
Observer.prototype.walk = function walk (obj) {
|
946 |
-
var keys = Object.keys(obj);
|
947 |
-
for (var i = 0; i < keys.length; i++) {
|
948 |
-
defineReactive$$1(obj, keys[i]);
|
949 |
-
}
|
950 |
-
};
|
951 |
-
|
952 |
-
/**
|
953 |
-
* Observe a list of Array items.
|
954 |
-
*/
|
955 |
-
Observer.prototype.observeArray = function observeArray (items) {
|
956 |
-
for (var i = 0, l = items.length; i < l; i++) {
|
957 |
-
observe(items[i]);
|
958 |
-
}
|
959 |
-
};
|
960 |
-
|
961 |
-
// helpers
|
962 |
-
|
963 |
-
/**
|
964 |
-
* Augment a target Object or Array by intercepting
|
965 |
-
* the prototype chain using __proto__
|
966 |
-
*/
|
967 |
-
function protoAugment (target, src) {
|
968 |
-
/* eslint-disable no-proto */
|
969 |
-
target.__proto__ = src;
|
970 |
-
/* eslint-enable no-proto */
|
971 |
-
}
|
972 |
-
|
973 |
-
/**
|
974 |
-
* Augment a target Object or Array by defining
|
975 |
-
* hidden properties.
|
976 |
-
*/
|
977 |
-
/* istanbul ignore next */
|
978 |
-
function copyAugment (target, src, keys) {
|
979 |
-
for (var i = 0, l = keys.length; i < l; i++) {
|
980 |
-
var key = keys[i];
|
981 |
-
def(target, key, src[key]);
|
982 |
-
}
|
983 |
-
}
|
984 |
-
|
985 |
-
/**
|
986 |
-
* Attempt to create an observer instance for a value,
|
987 |
-
* returns the new observer if successfully observed,
|
988 |
-
* or the existing observer if the value already has one.
|
989 |
-
*/
|
990 |
-
function observe (value, asRootData) {
|
991 |
-
if (!isObject(value) || value instanceof VNode) {
|
992 |
-
return
|
993 |
-
}
|
994 |
-
var ob;
|
995 |
-
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
996 |
-
ob = value.__ob__;
|
997 |
-
} else if (
|
998 |
-
shouldObserve &&
|
999 |
-
!isServerRendering() &&
|
1000 |
-
(Array.isArray(value) || isPlainObject(value)) &&
|
1001 |
-
Object.isExtensible(value) &&
|
1002 |
-
!value._isVue
|
1003 |
-
) {
|
1004 |
-
ob = new Observer(value);
|
1005 |
-
}
|
1006 |
-
if (asRootData && ob) {
|
1007 |
-
ob.vmCount++;
|
1008 |
-
}
|
1009 |
-
return ob
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
/**
|
1013 |
-
* Define a reactive property on an Object.
|
1014 |
-
*/
|
1015 |
-
function defineReactive$$1 (
|
1016 |
-
obj,
|
1017 |
-
key,
|
1018 |
-
val,
|
1019 |
-
customSetter,
|
1020 |
-
shallow
|
1021 |
-
) {
|
1022 |
-
var dep = new Dep();
|
1023 |
-
|
1024 |
-
var property = Object.getOwnPropertyDescriptor(obj, key);
|
1025 |
-
if (property && property.configurable === false) {
|
1026 |
-
return
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
// cater for pre-defined getter/setters
|
1030 |
-
var getter = property && property.get;
|
1031 |
-
var setter = property && property.set;
|
1032 |
-
if ((!getter || setter) && arguments.length === 2) {
|
1033 |
-
val = obj[key];
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
var childOb = !shallow && observe(val);
|
1037 |
-
Object.defineProperty(obj, key, {
|
1038 |
-
enumerable: true,
|
1039 |
-
configurable: true,
|
1040 |
-
get: function reactiveGetter () {
|
1041 |
-
var value = getter ? getter.call(obj) : val;
|
1042 |
-
if (Dep.target) {
|
1043 |
-
dep.depend();
|
1044 |
-
if (childOb) {
|
1045 |
-
childOb.dep.depend();
|
1046 |
-
if (Array.isArray(value)) {
|
1047 |
-
dependArray(value);
|
1048 |
-
}
|
1049 |
-
}
|
1050 |
-
}
|
1051 |
-
return value
|
1052 |
-
},
|
1053 |
-
set: function reactiveSetter (newVal) {
|
1054 |
-
var value = getter ? getter.call(obj) : val;
|
1055 |
-
/* eslint-disable no-self-compare */
|
1056 |
-
if (newVal === value || (newVal !== newVal && value !== value)) {
|
1057 |
-
return
|
1058 |
-
}
|
1059 |
-
/* eslint-enable no-self-compare */
|
1060 |
-
if (customSetter) {
|
1061 |
-
customSetter();
|
1062 |
-
}
|
1063 |
-
// #7981: for accessor properties without setter
|
1064 |
-
if (getter && !setter) { return }
|
1065 |
-
if (setter) {
|
1066 |
-
setter.call(obj, newVal);
|
1067 |
-
} else {
|
1068 |
-
val = newVal;
|
1069 |
-
}
|
1070 |
-
childOb = !shallow && observe(newVal);
|
1071 |
-
dep.notify();
|
1072 |
-
}
|
1073 |
-
});
|
1074 |
-
}
|
1075 |
-
|
1076 |
-
/**
|
1077 |
-
* Set a property on an object. Adds the new property and
|
1078 |
-
* triggers change notification if the property doesn't
|
1079 |
-
* already exist.
|
1080 |
-
*/
|
1081 |
-
function set (target, key, val) {
|
1082 |
-
if (isUndef(target) || isPrimitive(target)
|
1083 |
-
) {
|
1084 |
-
warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1085 |
-
}
|
1086 |
-
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1087 |
-
target.length = Math.max(target.length, key);
|
1088 |
-
target.splice(key, 1, val);
|
1089 |
-
return val
|
1090 |
-
}
|
1091 |
-
if (key in target && !(key in Object.prototype)) {
|
1092 |
-
target[key] = val;
|
1093 |
-
return val
|
1094 |
-
}
|
1095 |
-
var ob = (target).__ob__;
|
1096 |
-
if (target._isVue || (ob && ob.vmCount)) {
|
1097 |
-
warn(
|
1098 |
-
'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1099 |
-
'at runtime - declare it upfront in the data option.'
|
1100 |
-
);
|
1101 |
-
return val
|
1102 |
-
}
|
1103 |
-
if (!ob) {
|
1104 |
-
target[key] = val;
|
1105 |
-
return val
|
1106 |
-
}
|
1107 |
-
defineReactive$$1(ob.value, key, val);
|
1108 |
-
ob.dep.notify();
|
1109 |
-
return val
|
1110 |
-
}
|
1111 |
-
|
1112 |
-
/**
|
1113 |
-
* Delete a property and trigger change if necessary.
|
1114 |
-
*/
|
1115 |
-
function del (target, key) {
|
1116 |
-
if (isUndef(target) || isPrimitive(target)
|
1117 |
-
) {
|
1118 |
-
warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
1119 |
-
}
|
1120 |
-
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1121 |
-
target.splice(key, 1);
|
1122 |
-
return
|
1123 |
-
}
|
1124 |
-
var ob = (target).__ob__;
|
1125 |
-
if (target._isVue || (ob && ob.vmCount)) {
|
1126 |
-
warn(
|
1127 |
-
'Avoid deleting properties on a Vue instance or its root $data ' +
|
1128 |
-
'- just set it to null.'
|
1129 |
-
);
|
1130 |
-
return
|
1131 |
-
}
|
1132 |
-
if (!hasOwn(target, key)) {
|
1133 |
-
return
|
1134 |
-
}
|
1135 |
-
delete target[key];
|
1136 |
-
if (!ob) {
|
1137 |
-
return
|
1138 |
-
}
|
1139 |
-
ob.dep.notify();
|
1140 |
-
}
|
1141 |
-
|
1142 |
-
/**
|
1143 |
-
* Collect dependencies on array elements when the array is touched, since
|
1144 |
-
* we cannot intercept array element access like property getters.
|
1145 |
-
*/
|
1146 |
-
function dependArray (value) {
|
1147 |
-
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1148 |
-
e = value[i];
|
1149 |
-
e && e.__ob__ && e.__ob__.dep.depend();
|
1150 |
-
if (Array.isArray(e)) {
|
1151 |
-
dependArray(e);
|
1152 |
-
}
|
1153 |
-
}
|
1154 |
-
}
|
1155 |
-
|
1156 |
-
/* */
|
1157 |
-
|
1158 |
-
/**
|
1159 |
-
* Option overwriting strategies are functions that handle
|
1160 |
-
* how to merge a parent option value and a child option
|
1161 |
-
* value into the final value.
|
1162 |
-
*/
|
1163 |
-
var strats = config.optionMergeStrategies;
|
1164 |
-
|
1165 |
-
/**
|
1166 |
-
* Options with restrictions
|
1167 |
-
*/
|
1168 |
-
{
|
1169 |
-
strats.el = strats.propsData = function (parent, child, vm, key) {
|
1170 |
-
if (!vm) {
|
1171 |
-
warn(
|
1172 |
-
"option \"" + key + "\" can only be used during instance " +
|
1173 |
-
'creation with the `new` keyword.'
|
1174 |
-
);
|
1175 |
-
}
|
1176 |
-
return defaultStrat(parent, child)
|
1177 |
-
};
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
/**
|
1181 |
-
* Helper that recursively merges two data objects together.
|
1182 |
-
*/
|
1183 |
-
function mergeData (to, from) {
|
1184 |
-
if (!from) { return to }
|
1185 |
-
var key, toVal, fromVal;
|
1186 |
-
|
1187 |
-
var keys = hasSymbol
|
1188 |
-
? Reflect.ownKeys(from)
|
1189 |
-
: Object.keys(from);
|
1190 |
-
|
1191 |
-
for (var i = 0; i < keys.length; i++) {
|
1192 |
-
key = keys[i];
|
1193 |
-
// in case the object is already observed...
|
1194 |
-
if (key === '__ob__') { continue }
|
1195 |
-
toVal = to[key];
|
1196 |
-
fromVal = from[key];
|
1197 |
-
if (!hasOwn(to, key)) {
|
1198 |
-
set(to, key, fromVal);
|
1199 |
-
} else if (
|
1200 |
-
toVal !== fromVal &&
|
1201 |
-
isPlainObject(toVal) &&
|
1202 |
-
isPlainObject(fromVal)
|
1203 |
-
) {
|
1204 |
-
mergeData(toVal, fromVal);
|
1205 |
-
}
|
1206 |
-
}
|
1207 |
-
return to
|
1208 |
-
}
|
1209 |
-
|
1210 |
-
/**
|
1211 |
-
* Data
|
1212 |
-
*/
|
1213 |
-
function mergeDataOrFn (
|
1214 |
-
parentVal,
|
1215 |
-
childVal,
|
1216 |
-
vm
|
1217 |
-
) {
|
1218 |
-
if (!vm) {
|
1219 |
-
// in a Vue.extend merge, both should be functions
|
1220 |
-
if (!childVal) {
|
1221 |
-
return parentVal
|
1222 |
-
}
|
1223 |
-
if (!parentVal) {
|
1224 |
-
return childVal
|
1225 |
-
}
|
1226 |
-
// when parentVal & childVal are both present,
|
1227 |
-
// we need to return a function that returns the
|
1228 |
-
// merged result of both functions... no need to
|
1229 |
-
// check if parentVal is a function here because
|
1230 |
-
// it has to be a function to pass previous merges.
|
1231 |
-
return function mergedDataFn () {
|
1232 |
-
return mergeData(
|
1233 |
-
typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1234 |
-
typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1235 |
-
)
|
1236 |
-
}
|
1237 |
-
} else {
|
1238 |
-
return function mergedInstanceDataFn () {
|
1239 |
-
// instance merge
|
1240 |
-
var instanceData = typeof childVal === 'function'
|
1241 |
-
? childVal.call(vm, vm)
|
1242 |
-
: childVal;
|
1243 |
-
var defaultData = typeof parentVal === 'function'
|
1244 |
-
? parentVal.call(vm, vm)
|
1245 |
-
: parentVal;
|
1246 |
-
if (instanceData) {
|
1247 |
-
return mergeData(instanceData, defaultData)
|
1248 |
-
} else {
|
1249 |
-
return defaultData
|
1250 |
-
}
|
1251 |
-
}
|
1252 |
-
}
|
1253 |
-
}
|
1254 |
-
|
1255 |
-
strats.data = function (
|
1256 |
-
parentVal,
|
1257 |
-
childVal,
|
1258 |
-
vm
|
1259 |
-
) {
|
1260 |
-
if (!vm) {
|
1261 |
-
if (childVal && typeof childVal !== 'function') {
|
1262 |
-
warn(
|
1263 |
-
'The "data" option should be a function ' +
|
1264 |
-
'that returns a per-instance value in component ' +
|
1265 |
-
'definitions.',
|
1266 |
-
vm
|
1267 |
-
);
|
1268 |
-
|
1269 |
-
return parentVal
|
1270 |
-
}
|
1271 |
-
return mergeDataOrFn(parentVal, childVal)
|
1272 |
-
}
|
1273 |
-
|
1274 |
-
return mergeDataOrFn(parentVal, childVal, vm)
|
1275 |
-
};
|
1276 |
-
|
1277 |
-
/**
|
1278 |
-
* Hooks and props are merged as arrays.
|
1279 |
-
*/
|
1280 |
-
function mergeHook (
|
1281 |
-
parentVal,
|
1282 |
-
childVal
|
1283 |
-
) {
|
1284 |
-
var res = childVal
|
1285 |
-
? parentVal
|
1286 |
-
? parentVal.concat(childVal)
|
1287 |
-
: Array.isArray(childVal)
|
1288 |
-
? childVal
|
1289 |
-
: [childVal]
|
1290 |
-
: parentVal;
|
1291 |
-
return res
|
1292 |
-
? dedupeHooks(res)
|
1293 |
-
: res
|
1294 |
-
}
|
1295 |
-
|
1296 |
-
function dedupeHooks (hooks) {
|
1297 |
-
var res = [];
|
1298 |
-
for (var i = 0; i < hooks.length; i++) {
|
1299 |
-
if (res.indexOf(hooks[i]) === -1) {
|
1300 |
-
res.push(hooks[i]);
|
1301 |
-
}
|
1302 |
-
}
|
1303 |
-
return res
|
1304 |
-
}
|
1305 |
-
|
1306 |
-
LIFECYCLE_HOOKS.forEach(function (hook) {
|
1307 |
-
strats[hook] = mergeHook;
|
1308 |
-
});
|
1309 |
-
|
1310 |
-
/**
|
1311 |
-
* Assets
|
1312 |
-
*
|
1313 |
-
* When a vm is present (instance creation), we need to do
|
1314 |
-
* a three-way merge between constructor options, instance
|
1315 |
-
* options and parent options.
|
1316 |
-
*/
|
1317 |
-
function mergeAssets (
|
1318 |
-
parentVal,
|
1319 |
-
childVal,
|
1320 |
-
vm,
|
1321 |
-
key
|
1322 |
-
) {
|
1323 |
-
var res = Object.create(parentVal || null);
|
1324 |
-
if (childVal) {
|
1325 |
-
assertObjectType(key, childVal, vm);
|
1326 |
-
return extend(res, childVal)
|
1327 |
-
} else {
|
1328 |
-
return res
|
1329 |
-
}
|
1330 |
-
}
|
1331 |
-
|
1332 |
-
ASSET_TYPES.forEach(function (type) {
|
1333 |
-
strats[type + 's'] = mergeAssets;
|
1334 |
-
});
|
1335 |
-
|
1336 |
-
/**
|
1337 |
-
* Watchers.
|
1338 |
-
*
|
1339 |
-
* Watchers hashes should not overwrite one
|
1340 |
-
* another, so we merge them as arrays.
|
1341 |
-
*/
|
1342 |
-
strats.watch = function (
|
1343 |
-
parentVal,
|
1344 |
-
childVal,
|
1345 |
-
vm,
|
1346 |
-
key
|
1347 |
-
) {
|
1348 |
-
// work around Firefox's Object.prototype.watch...
|
1349 |
-
if (parentVal === nativeWatch) { parentVal = undefined; }
|
1350 |
-
if (childVal === nativeWatch) { childVal = undefined; }
|
1351 |
-
/* istanbul ignore if */
|
1352 |
-
if (!childVal) { return Object.create(parentVal || null) }
|
1353 |
-
{
|
1354 |
-
assertObjectType(key, childVal, vm);
|
1355 |
-
}
|
1356 |
-
if (!parentVal) { return childVal }
|
1357 |
-
var ret = {};
|
1358 |
-
extend(ret, parentVal);
|
1359 |
-
for (var key$1 in childVal) {
|
1360 |
-
var parent = ret[key$1];
|
1361 |
-
var child = childVal[key$1];
|
1362 |
-
if (parent && !Array.isArray(parent)) {
|
1363 |
-
parent = [parent];
|
1364 |
-
}
|
1365 |
-
ret[key$1] = parent
|
1366 |
-
? parent.concat(child)
|
1367 |
-
: Array.isArray(child) ? child : [child];
|
1368 |
-
}
|
1369 |
-
return ret
|
1370 |
-
};
|
1371 |
-
|
1372 |
-
/**
|
1373 |
-
* Other object hashes.
|
1374 |
-
*/
|
1375 |
-
strats.props =
|
1376 |
-
strats.methods =
|
1377 |
-
strats.inject =
|
1378 |
-
strats.computed = function (
|
1379 |
-
parentVal,
|
1380 |
-
childVal,
|
1381 |
-
vm,
|
1382 |
-
key
|
1383 |
-
) {
|
1384 |
-
if (childVal && "development" !== 'production') {
|
1385 |
-
assertObjectType(key, childVal, vm);
|
1386 |
-
}
|
1387 |
-
if (!parentVal) { return childVal }
|
1388 |
-
var ret = Object.create(null);
|
1389 |
-
extend(ret, parentVal);
|
1390 |
-
if (childVal) { extend(ret, childVal); }
|
1391 |
-
return ret
|
1392 |
-
};
|
1393 |
-
strats.provide = mergeDataOrFn;
|
1394 |
-
|
1395 |
-
/**
|
1396 |
-
* Default strategy.
|
1397 |
-
*/
|
1398 |
-
var defaultStrat = function (parentVal, childVal) {
|
1399 |
-
return childVal === undefined
|
1400 |
-
? parentVal
|
1401 |
-
: childVal
|
1402 |
-
};
|
1403 |
-
|
1404 |
-
/**
|
1405 |
-
* Validate component names
|
1406 |
-
*/
|
1407 |
-
function checkComponents (options) {
|
1408 |
-
for (var key in options.components) {
|
1409 |
-
validateComponentName(key);
|
1410 |
-
}
|
1411 |
-
}
|
1412 |
-
|
1413 |
-
function validateComponentName (name) {
|
1414 |
-
if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
|
1415 |
-
warn(
|
1416 |
-
'Invalid component name: "' + name + '". Component names ' +
|
1417 |
-
'should conform to valid custom element name in html5 specification.'
|
1418 |
-
);
|
1419 |
-
}
|
1420 |
-
if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
1421 |
-
warn(
|
1422 |
-
'Do not use built-in or reserved HTML elements as component ' +
|
1423 |
-
'id: ' + name
|
1424 |
-
);
|
1425 |
-
}
|
1426 |
-
}
|
1427 |
-
|
1428 |
-
/**
|
1429 |
-
* Ensure all props option syntax are normalized into the
|
1430 |
-
* Object-based format.
|
1431 |
-
*/
|
1432 |
-
function normalizeProps (options, vm) {
|
1433 |
-
var props = options.props;
|
1434 |
-
if (!props) { return }
|
1435 |
-
var res = {};
|
1436 |
-
var i, val, name;
|
1437 |
-
if (Array.isArray(props)) {
|
1438 |
-
i = props.length;
|
1439 |
-
while (i--) {
|
1440 |
-
val = props[i];
|
1441 |
-
if (typeof val === 'string') {
|
1442 |
-
name = camelize(val);
|
1443 |
-
res[name] = { type: null };
|
1444 |
-
} else {
|
1445 |
-
warn('props must be strings when using array syntax.');
|
1446 |
-
}
|
1447 |
-
}
|
1448 |
-
} else if (isPlainObject(props)) {
|
1449 |
-
for (var key in props) {
|
1450 |
-
val = props[key];
|
1451 |
-
name = camelize(key);
|
1452 |
-
res[name] = isPlainObject(val)
|
1453 |
-
? val
|
1454 |
-
: { type: val };
|
1455 |
-
}
|
1456 |
-
} else {
|
1457 |
-
warn(
|
1458 |
-
"Invalid value for option \"props\": expected an Array or an Object, " +
|
1459 |
-
"but got " + (toRawType(props)) + ".",
|
1460 |
-
vm
|
1461 |
-
);
|
1462 |
-
}
|
1463 |
-
options.props = res;
|
1464 |
-
}
|
1465 |
-
|
1466 |
-
/**
|
1467 |
-
* Normalize all injections into Object-based format
|
1468 |
-
*/
|
1469 |
-
function normalizeInject (options, vm) {
|
1470 |
-
var inject = options.inject;
|
1471 |
-
if (!inject) { return }
|
1472 |
-
var normalized = options.inject = {};
|
1473 |
-
if (Array.isArray(inject)) {
|
1474 |
-
for (var i = 0; i < inject.length; i++) {
|
1475 |
-
normalized[inject[i]] = { from: inject[i] };
|
1476 |
-
}
|
1477 |
-
} else if (isPlainObject(inject)) {
|
1478 |
-
for (var key in inject) {
|
1479 |
-
var val = inject[key];
|
1480 |
-
normalized[key] = isPlainObject(val)
|
1481 |
-
? extend({ from: key }, val)
|
1482 |
-
: { from: val };
|
1483 |
-
}
|
1484 |
-
} else {
|
1485 |
-
warn(
|
1486 |
-
"Invalid value for option \"inject\": expected an Array or an Object, " +
|
1487 |
-
"but got " + (toRawType(inject)) + ".",
|
1488 |
-
vm
|
1489 |
-
);
|
1490 |
-
}
|
1491 |
-
}
|
1492 |
-
|
1493 |
-
/**
|
1494 |
-
* Normalize raw function directives into object format.
|
1495 |
-
*/
|
1496 |
-
function normalizeDirectives (options) {
|
1497 |
-
var dirs = options.directives;
|
1498 |
-
if (dirs) {
|
1499 |
-
for (var key in dirs) {
|
1500 |
-
var def$$1 = dirs[key];
|
1501 |
-
if (typeof def$$1 === 'function') {
|
1502 |
-
dirs[key] = { bind: def$$1, update: def$$1 };
|
1503 |
-
}
|
1504 |
-
}
|
1505 |
-
}
|
1506 |
-
}
|
1507 |
-
|
1508 |
-
function assertObjectType (name, value, vm) {
|
1509 |
-
if (!isPlainObject(value)) {
|
1510 |
-
warn(
|
1511 |
-
"Invalid value for option \"" + name + "\": expected an Object, " +
|
1512 |
-
"but got " + (toRawType(value)) + ".",
|
1513 |
-
vm
|
1514 |
-
);
|
1515 |
-
}
|
1516 |
-
}
|
1517 |
-
|
1518 |
-
/**
|
1519 |
-
* Merge two option objects into a new one.
|
1520 |
-
* Core utility used in both instantiation and inheritance.
|
1521 |
-
*/
|
1522 |
-
function mergeOptions (
|
1523 |
-
parent,
|
1524 |
-
child,
|
1525 |
-
vm
|
1526 |
-
) {
|
1527 |
-
{
|
1528 |
-
checkComponents(child);
|
1529 |
-
}
|
1530 |
-
|
1531 |
-
if (typeof child === 'function') {
|
1532 |
-
child = child.options;
|
1533 |
-
}
|
1534 |
-
|
1535 |
-
normalizeProps(child, vm);
|
1536 |
-
normalizeInject(child, vm);
|
1537 |
-
normalizeDirectives(child);
|
1538 |
-
|
1539 |
-
// Apply extends and mixins on the child options,
|
1540 |
-
// but only if it is a raw options object that isn't
|
1541 |
-
// the result of another mergeOptions call.
|
1542 |
-
// Only merged options has the _base property.
|
1543 |
-
if (!child._base) {
|
1544 |
-
if (child.extends) {
|
1545 |
-
parent = mergeOptions(parent, child.extends, vm);
|
1546 |
-
}
|
1547 |
-
if (child.mixins) {
|
1548 |
-
for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1549 |
-
parent = mergeOptions(parent, child.mixins[i], vm);
|
1550 |
-
}
|
1551 |
-
}
|
1552 |
-
}
|
1553 |
-
|
1554 |
-
var options = {};
|
1555 |
-
var key;
|
1556 |
-
for (key in parent) {
|
1557 |
-
mergeField(key);
|
1558 |
-
}
|
1559 |
-
for (key in child) {
|
1560 |
-
if (!hasOwn(parent, key)) {
|
1561 |
-
mergeField(key);
|
1562 |
-
}
|
1563 |
-
}
|
1564 |
-
function mergeField (key) {
|
1565 |
-
var strat = strats[key] || defaultStrat;
|
1566 |
-
options[key] = strat(parent[key], child[key], vm, key);
|
1567 |
-
}
|
1568 |
-
return options
|
1569 |
-
}
|
1570 |
-
|
1571 |
-
/**
|
1572 |
-
* Resolve an asset.
|
1573 |
-
* This function is used because child instances need access
|
1574 |
-
* to assets defined in its ancestor chain.
|
1575 |
-
*/
|
1576 |
-
function resolveAsset (
|
1577 |
-
options,
|
1578 |
-
type,
|
1579 |
-
id,
|
1580 |
-
warnMissing
|
1581 |
-
) {
|
1582 |
-
/* istanbul ignore if */
|
1583 |
-
if (typeof id !== 'string') {
|
1584 |
-
return
|
1585 |
-
}
|
1586 |
-
var assets = options[type];
|
1587 |
-
// check local registration variations first
|
1588 |
-
if (hasOwn(assets, id)) { return assets[id] }
|
1589 |
-
var camelizedId = camelize(id);
|
1590 |
-
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1591 |
-
var PascalCaseId = capitalize(camelizedId);
|
1592 |
-
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1593 |
-
// fallback to prototype chain
|
1594 |
-
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1595 |
-
if (warnMissing && !res) {
|
1596 |
-
warn(
|
1597 |
-
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
1598 |
-
options
|
1599 |
-
);
|
1600 |
-
}
|
1601 |
-
return res
|
1602 |
-
}
|
1603 |
-
|
1604 |
-
/* */
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
function validateProp (
|
1609 |
-
key,
|
1610 |
-
propOptions,
|
1611 |
-
propsData,
|
1612 |
-
vm
|
1613 |
-
) {
|
1614 |
-
var prop = propOptions[key];
|
1615 |
-
var absent = !hasOwn(propsData, key);
|
1616 |
-
var value = propsData[key];
|
1617 |
-
// boolean casting
|
1618 |
-
var booleanIndex = getTypeIndex(Boolean, prop.type);
|
1619 |
-
if (booleanIndex > -1) {
|
1620 |
-
if (absent && !hasOwn(prop, 'default')) {
|
1621 |
-
value = false;
|
1622 |
-
} else if (value === '' || value === hyphenate(key)) {
|
1623 |
-
// only cast empty string / same name to boolean if
|
1624 |
-
// boolean has higher priority
|
1625 |
-
var stringIndex = getTypeIndex(String, prop.type);
|
1626 |
-
if (stringIndex < 0 || booleanIndex < stringIndex) {
|
1627 |
-
value = true;
|
1628 |
-
}
|
1629 |
-
}
|
1630 |
-
}
|
1631 |
-
// check default value
|
1632 |
-
if (value === undefined) {
|
1633 |
-
value = getPropDefaultValue(vm, prop, key);
|
1634 |
-
// since the default value is a fresh copy,
|
1635 |
-
// make sure to observe it.
|
1636 |
-
var prevShouldObserve = shouldObserve;
|
1637 |
-
toggleObserving(true);
|
1638 |
-
observe(value);
|
1639 |
-
toggleObserving(prevShouldObserve);
|
1640 |
-
}
|
1641 |
-
{
|
1642 |
-
assertProp(prop, key, value, vm, absent);
|
1643 |
-
}
|
1644 |
-
return value
|
1645 |
-
}
|
1646 |
-
|
1647 |
-
/**
|
1648 |
-
* Get the default value of a prop.
|
1649 |
-
*/
|
1650 |
-
function getPropDefaultValue (vm, prop, key) {
|
1651 |
-
// no default, return undefined
|
1652 |
-
if (!hasOwn(prop, 'default')) {
|
1653 |
-
return undefined
|
1654 |
-
}
|
1655 |
-
var def = prop.default;
|
1656 |
-
// warn against non-factory defaults for Object & Array
|
1657 |
-
if (isObject(def)) {
|
1658 |
-
warn(
|
1659 |
-
'Invalid default value for prop "' + key + '": ' +
|
1660 |
-
'Props with type Object/Array must use a factory function ' +
|
1661 |
-
'to return the default value.',
|
1662 |
-
vm
|
1663 |
-
);
|
1664 |
-
}
|
1665 |
-
// the raw prop value was also undefined from previous render,
|
1666 |
-
// return previous default value to avoid unnecessary watcher trigger
|
1667 |
-
if (vm && vm.$options.propsData &&
|
1668 |
-
vm.$options.propsData[key] === undefined &&
|
1669 |
-
vm._props[key] !== undefined
|
1670 |
-
) {
|
1671 |
-
return vm._props[key]
|
1672 |
-
}
|
1673 |
-
// call factory function for non-Function types
|
1674 |
-
// a value is Function if its prototype is function even across different execution context
|
1675 |
-
return typeof def === 'function' && getType(prop.type) !== 'Function'
|
1676 |
-
? def.call(vm)
|
1677 |
-
: def
|
1678 |
-
}
|
1679 |
-
|
1680 |
-
/**
|
1681 |
-
* Assert whether a prop is valid.
|
1682 |
-
*/
|
1683 |
-
function assertProp (
|
1684 |
-
prop,
|
1685 |
-
name,
|
1686 |
-
value,
|
1687 |
-
vm,
|
1688 |
-
absent
|
1689 |
-
) {
|
1690 |
-
if (prop.required && absent) {
|
1691 |
-
warn(
|
1692 |
-
'Missing required prop: "' + name + '"',
|
1693 |
-
vm
|
1694 |
-
);
|
1695 |
-
return
|
1696 |
-
}
|
1697 |
-
if (value == null && !prop.required) {
|
1698 |
-
return
|
1699 |
-
}
|
1700 |
-
var type = prop.type;
|
1701 |
-
var valid = !type || type === true;
|
1702 |
-
var expectedTypes = [];
|
1703 |
-
if (type) {
|
1704 |
-
if (!Array.isArray(type)) {
|
1705 |
-
type = [type];
|
1706 |
-
}
|
1707 |
-
for (var i = 0; i < type.length && !valid; i++) {
|
1708 |
-
var assertedType = assertType(value, type[i]);
|
1709 |
-
expectedTypes.push(assertedType.expectedType || '');
|
1710 |
-
valid = assertedType.valid;
|
1711 |
-
}
|
1712 |
-
}
|
1713 |
-
|
1714 |
-
if (!valid) {
|
1715 |
-
warn(
|
1716 |
-
getInvalidTypeMessage(name, value, expectedTypes),
|
1717 |
-
vm
|
1718 |
-
);
|
1719 |
-
return
|
1720 |
-
}
|
1721 |
-
var validator = prop.validator;
|
1722 |
-
if (validator) {
|
1723 |
-
if (!validator(value)) {
|
1724 |
-
warn(
|
1725 |
-
'Invalid prop: custom validator check failed for prop "' + name + '".',
|
1726 |
-
vm
|
1727 |
-
);
|
1728 |
-
}
|
1729 |
-
}
|
1730 |
-
}
|
1731 |
-
|
1732 |
-
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
1733 |
-
|
1734 |
-
function assertType (value, type) {
|
1735 |
-
var valid;
|
1736 |
-
var expectedType = getType(type);
|
1737 |
-
if (simpleCheckRE.test(expectedType)) {
|
1738 |
-
var t = typeof value;
|
1739 |
-
valid = t === expectedType.toLowerCase();
|
1740 |
-
// for primitive wrapper objects
|
1741 |
-
if (!valid && t === 'object') {
|
1742 |
-
valid = value instanceof type;
|
1743 |
-
}
|
1744 |
-
} else if (expectedType === 'Object') {
|
1745 |
-
valid = isPlainObject(value);
|
1746 |
-
} else if (expectedType === 'Array') {
|
1747 |
-
valid = Array.isArray(value);
|
1748 |
-
} else {
|
1749 |
-
valid = value instanceof type;
|
1750 |
-
}
|
1751 |
-
return {
|
1752 |
-
valid: valid,
|
1753 |
-
expectedType: expectedType
|
1754 |
-
}
|
1755 |
-
}
|
1756 |
-
|
1757 |
-
/**
|
1758 |
-
* Use function string name to check built-in types,
|
1759 |
-
* because a simple equality check will fail when running
|
1760 |
-
* across different vms / iframes.
|
1761 |
-
*/
|
1762 |
-
function getType (fn) {
|
1763 |
-
var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
1764 |
-
return match ? match[1] : ''
|
1765 |
-
}
|
1766 |
-
|
1767 |
-
function isSameType (a, b) {
|
1768 |
-
return getType(a) === getType(b)
|
1769 |
-
}
|
1770 |
-
|
1771 |
-
function getTypeIndex (type, expectedTypes) {
|
1772 |
-
if (!Array.isArray(expectedTypes)) {
|
1773 |
-
return isSameType(expectedTypes, type) ? 0 : -1
|
1774 |
-
}
|
1775 |
-
for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
1776 |
-
if (isSameType(expectedTypes[i], type)) {
|
1777 |
-
return i
|
1778 |
-
}
|
1779 |
-
}
|
1780 |
-
return -1
|
1781 |
-
}
|
1782 |
-
|
1783 |
-
function getInvalidTypeMessage (name, value, expectedTypes) {
|
1784 |
-
var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
1785 |
-
" Expected " + (expectedTypes.map(capitalize).join(', '));
|
1786 |
-
var expectedType = expectedTypes[0];
|
1787 |
-
var receivedType = toRawType(value);
|
1788 |
-
var expectedValue = styleValue(value, expectedType);
|
1789 |
-
var receivedValue = styleValue(value, receivedType);
|
1790 |
-
// check if we need to specify expected value
|
1791 |
-
if (expectedTypes.length === 1 &&
|
1792 |
-
isExplicable(expectedType) &&
|
1793 |
-
!isBoolean(expectedType, receivedType)) {
|
1794 |
-
message += " with value " + expectedValue;
|
1795 |
-
}
|
1796 |
-
message += ", got " + receivedType + " ";
|
1797 |
-
// check if we need to specify received value
|
1798 |
-
if (isExplicable(receivedType)) {
|
1799 |
-
message += "with value " + receivedValue + ".";
|
1800 |
-
}
|
1801 |
-
return message
|
1802 |
-
}
|
1803 |
-
|
1804 |
-
function styleValue (value, type) {
|
1805 |
-
if (type === 'String') {
|
1806 |
-
return ("\"" + value + "\"")
|
1807 |
-
} else if (type === 'Number') {
|
1808 |
-
return ("" + (Number(value)))
|
1809 |
-
} else {
|
1810 |
-
return ("" + value)
|
1811 |
-
}
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
function isExplicable (value) {
|
1815 |
-
var explicitTypes = ['string', 'number', 'boolean'];
|
1816 |
-
return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
1817 |
-
}
|
1818 |
-
|
1819 |
-
function isBoolean () {
|
1820 |
-
var args = [], len = arguments.length;
|
1821 |
-
while ( len-- ) args[ len ] = arguments[ len ];
|
1822 |
-
|
1823 |
-
return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
1824 |
-
}
|
1825 |
-
|
1826 |
-
/* */
|
1827 |
-
|
1828 |
-
function handleError (err, vm, info) {
|
1829 |
-
// Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
|
1830 |
-
// See: https://github.com/vuejs/vuex/issues/1505
|
1831 |
-
pushTarget();
|
1832 |
-
try {
|
1833 |
-
if (vm) {
|
1834 |
-
var cur = vm;
|
1835 |
-
while ((cur = cur.$parent)) {
|
1836 |
-
var hooks = cur.$options.errorCaptured;
|
1837 |
-
if (hooks) {
|
1838 |
-
for (var i = 0; i < hooks.length; i++) {
|
1839 |
-
try {
|
1840 |
-
var capture = hooks[i].call(cur, err, vm, info) === false;
|
1841 |
-
if (capture) { return }
|
1842 |
-
} catch (e) {
|
1843 |
-
globalHandleError(e, cur, 'errorCaptured hook');
|
1844 |
-
}
|
1845 |
-
}
|
1846 |
-
}
|
1847 |
-
}
|
1848 |
-
}
|
1849 |
-
globalHandleError(err, vm, info);
|
1850 |
-
} finally {
|
1851 |
-
popTarget();
|
1852 |
-
}
|
1853 |
-
}
|
1854 |
-
|
1855 |
-
function invokeWithErrorHandling (
|
1856 |
-
handler,
|
1857 |
-
context,
|
1858 |
-
args,
|
1859 |
-
vm,
|
1860 |
-
info
|
1861 |
-
) {
|
1862 |
-
var res;
|
1863 |
-
try {
|
1864 |
-
res = args ? handler.apply(context, args) : handler.call(context);
|
1865 |
-
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
1866 |
-
res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
1867 |
-
// issue #9511
|
1868 |
-
// avoid catch triggering multiple times when nested calls
|
1869 |
-
res._handled = true;
|
1870 |
-
}
|
1871 |
-
} catch (e) {
|
1872 |
-
handleError(e, vm, info);
|
1873 |
-
}
|
1874 |
-
return res
|
1875 |
-
}
|
1876 |
-
|
1877 |
-
function globalHandleError (err, vm, info) {
|
1878 |
-
if (config.errorHandler) {
|
1879 |
-
try {
|
1880 |
-
return config.errorHandler.call(null, err, vm, info)
|
1881 |
-
} catch (e) {
|
1882 |
-
// if the user intentionally throws the original error in the handler,
|
1883 |
-
// do not log it twice
|
1884 |
-
if (e !== err) {
|
1885 |
-
logError(e, null, 'config.errorHandler');
|
1886 |
-
}
|
1887 |
-
}
|
1888 |
-
}
|
1889 |
-
logError(err, vm, info);
|
1890 |
-
}
|
1891 |
-
|
1892 |
-
function logError (err, vm, info) {
|
1893 |
-
{
|
1894 |
-
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
1895 |
-
}
|
1896 |
-
/* istanbul ignore else */
|
1897 |
-
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
1898 |
-
console.error(err);
|
1899 |
-
} else {
|
1900 |
-
throw err
|
1901 |
-
}
|
1902 |
-
}
|
1903 |
-
|
1904 |
-
/* */
|
1905 |
-
|
1906 |
-
var isUsingMicroTask = false;
|
1907 |
-
|
1908 |
-
var callbacks = [];
|
1909 |
-
var pending = false;
|
1910 |
-
|
1911 |
-
function flushCallbacks () {
|
1912 |
-
pending = false;
|
1913 |
-
var copies = callbacks.slice(0);
|
1914 |
-
callbacks.length = 0;
|
1915 |
-
for (var i = 0; i < copies.length; i++) {
|
1916 |
-
copies[i]();
|
1917 |
-
}
|
1918 |
-
}
|
1919 |
-
|
1920 |
-
// Here we have async deferring wrappers using microtasks.
|
1921 |
-
// In 2.5 we used (macro) tasks (in combination with microtasks).
|
1922 |
-
// However, it has subtle problems when state is changed right before repaint
|
1923 |
-
// (e.g. #6813, out-in transitions).
|
1924 |
-
// Also, using (macro) tasks in event handler would cause some weird behaviors
|
1925 |
-
// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
|
1926 |
-
// So we now use microtasks everywhere, again.
|
1927 |
-
// A major drawback of this tradeoff is that there are some scenarios
|
1928 |
-
// where microtasks have too high a priority and fire in between supposedly
|
1929 |
-
// sequential events (e.g. #4521, #6690, which have workarounds)
|
1930 |
-
// or even between bubbling of the same event (#6566).
|
1931 |
-
var timerFunc;
|
1932 |
-
|
1933 |
-
// The nextTick behavior leverages the microtask queue, which can be accessed
|
1934 |
-
// via either native Promise.then or MutationObserver.
|
1935 |
-
// MutationObserver has wider support, however it is seriously bugged in
|
1936 |
-
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
|
1937 |
-
// completely stops working after triggering a few times... so, if native
|
1938 |
-
// Promise is available, we will use it:
|
1939 |
-
/* istanbul ignore next, $flow-disable-line */
|
1940 |
-
if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
1941 |
-
var p = Promise.resolve();
|
1942 |
-
timerFunc = function () {
|
1943 |
-
p.then(flushCallbacks);
|
1944 |
-
// In problematic UIWebViews, Promise.then doesn't completely break, but
|
1945 |
-
// it can get stuck in a weird state where callbacks are pushed into the
|
1946 |
-
// microtask queue but the queue isn't being flushed, until the browser
|
1947 |
-
// needs to do some other work, e.g. handle a timer. Therefore we can
|
1948 |
-
// "force" the microtask queue to be flushed by adding an empty timer.
|
1949 |
-
if (isIOS) { setTimeout(noop); }
|
1950 |
-
};
|
1951 |
-
isUsingMicroTask = true;
|
1952 |
-
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1953 |
-
isNative(MutationObserver) ||
|
1954 |
-
// PhantomJS and iOS 7.x
|
1955 |
-
MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1956 |
-
)) {
|
1957 |
-
// Use MutationObserver where native Promise is not available,
|
1958 |
-
// e.g. PhantomJS, iOS7, Android 4.4
|
1959 |
-
// (#6466 MutationObserver is unreliable in IE11)
|
1960 |
-
var counter = 1;
|
1961 |
-
var observer = new MutationObserver(flushCallbacks);
|
1962 |
-
var textNode = document.createTextNode(String(counter));
|
1963 |
-
observer.observe(textNode, {
|
1964 |
-
characterData: true
|
1965 |
-
});
|
1966 |
-
timerFunc = function () {
|
1967 |
-
counter = (counter + 1) % 2;
|
1968 |
-
textNode.data = String(counter);
|
1969 |
-
};
|
1970 |
-
isUsingMicroTask = true;
|
1971 |
-
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
1972 |
-
// Fallback to setImmediate.
|
1973 |
-
// Techinically it leverages the (macro) task queue,
|
1974 |
-
// but it is still a better choice than setTimeout.
|
1975 |
-
timerFunc = function () {
|
1976 |
-
setImmediate(flushCallbacks);
|
1977 |
-
};
|
1978 |
-
} else {
|
1979 |
-
// Fallback to setTimeout.
|
1980 |
-
timerFunc = function () {
|
1981 |
-
setTimeout(flushCallbacks, 0);
|
1982 |
-
};
|
1983 |
-
}
|
1984 |
-
|
1985 |
-
function nextTick (cb, ctx) {
|
1986 |
-
var _resolve;
|
1987 |
-
callbacks.push(function () {
|
1988 |
-
if (cb) {
|
1989 |
-
try {
|
1990 |
-
cb.call(ctx);
|
1991 |
-
} catch (e) {
|
1992 |
-
handleError(e, ctx, 'nextTick');
|
1993 |
-
}
|
1994 |
-
} else if (_resolve) {
|
1995 |
-
_resolve(ctx);
|
1996 |
-
}
|
1997 |
-
});
|
1998 |
-
if (!pending) {
|
1999 |
-
pending = true;
|
2000 |
-
timerFunc();
|
2001 |
-
}
|
2002 |
-
// $flow-disable-line
|
2003 |
-
if (!cb && typeof Promise !== 'undefined') {
|
2004 |
-
return new Promise(function (resolve) {
|
2005 |
-
_resolve = resolve;
|
2006 |
-
})
|
2007 |
-
}
|
2008 |
-
}
|
2009 |
-
|
2010 |
-
/* */
|
2011 |
-
|
2012 |
-
var mark;
|
2013 |
-
var measure;
|
2014 |
-
|
2015 |
-
{
|
2016 |
-
var perf = inBrowser && window.performance;
|
2017 |
-
/* istanbul ignore if */
|
2018 |
-
if (
|
2019 |
-
perf &&
|
2020 |
-
perf.mark &&
|
2021 |
-
perf.measure &&
|
2022 |
-
perf.clearMarks &&
|
2023 |
-
perf.clearMeasures
|
2024 |
-
) {
|
2025 |
-
mark = function (tag) { return perf.mark(tag); };
|
2026 |
-
measure = function (name, startTag, endTag) {
|
2027 |
-
perf.measure(name, startTag, endTag);
|
2028 |
-
perf.clearMarks(startTag);
|
2029 |
-
perf.clearMarks(endTag);
|
2030 |
-
// perf.clearMeasures(name)
|
2031 |
-
};
|
2032 |
-
}
|
2033 |
-
}
|
2034 |
-
|
2035 |
-
/* not type checking this file because flow doesn't play well with Proxy */
|
2036 |
-
|
2037 |
-
var initProxy;
|
2038 |
-
|
2039 |
-
{
|
2040 |
-
var allowedGlobals = makeMap(
|
2041 |
-
'Infinity,undefined,NaN,isFinite,isNaN,' +
|
2042 |
-
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
2043 |
-
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
2044 |
-
'require' // for Webpack/Browserify
|
2045 |
-
);
|
2046 |
-
|
2047 |
-
var warnNonPresent = function (target, key) {
|
2048 |
-
warn(
|
2049 |
-
"Property or method \"" + key + "\" is not defined on the instance but " +
|
2050 |
-
'referenced during render. Make sure that this property is reactive, ' +
|
2051 |
-
'either in the data option, or for class-based components, by ' +
|
2052 |
-
'initializing the property. ' +
|
2053 |
-
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
2054 |
-
target
|
2055 |
-
);
|
2056 |
-
};
|
2057 |
-
|
2058 |
-
var warnReservedPrefix = function (target, key) {
|
2059 |
-
warn(
|
2060 |
-
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
2061 |
-
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
2062 |
-
'prevent conflicts with Vue internals' +
|
2063 |
-
'See: https://vuejs.org/v2/api/#data',
|
2064 |
-
target
|
2065 |
-
);
|
2066 |
-
};
|
2067 |
-
|
2068 |
-
var hasProxy =
|
2069 |
-
typeof Proxy !== 'undefined' && isNative(Proxy);
|
2070 |
-
|
2071 |
-
if (hasProxy) {
|
2072 |
-
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
2073 |
-
config.keyCodes = new Proxy(config.keyCodes, {
|
2074 |
-
set: function set (target, key, value) {
|
2075 |
-
if (isBuiltInModifier(key)) {
|
2076 |
-
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
2077 |
-
return false
|
2078 |
-
} else {
|
2079 |
-
target[key] = value;
|
2080 |
-
return true
|
2081 |
-
}
|
2082 |
-
}
|
2083 |
-
});
|
2084 |
-
}
|
2085 |
-
|
2086 |
-
var hasHandler = {
|
2087 |
-
has: function has (target, key) {
|
2088 |
-
var has = key in target;
|
2089 |
-
var isAllowed = allowedGlobals(key) ||
|
2090 |
-
(typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
2091 |
-
if (!has && !isAllowed) {
|
2092 |
-
if (key in target.$data) { warnReservedPrefix(target, key); }
|
2093 |
-
else { warnNonPresent(target, key); }
|
2094 |
-
}
|
2095 |
-
return has || !isAllowed
|
2096 |
-
}
|
2097 |
-
};
|
2098 |
-
|
2099 |
-
var getHandler = {
|
2100 |
-
get: function get (target, key) {
|
2101 |
-
if (typeof key === 'string' && !(key in target)) {
|
2102 |
-
if (key in target.$data) { warnReservedPrefix(target, key); }
|
2103 |
-
else { warnNonPresent(target, key); }
|
2104 |
-
}
|
2105 |
-
return target[key]
|
2106 |
-
}
|
2107 |
-
};
|
2108 |
-
|
2109 |
-
initProxy = function initProxy (vm) {
|
2110 |
-
if (hasProxy) {
|
2111 |
-
// determine which proxy handler to use
|
2112 |
-
var options = vm.$options;
|
2113 |
-
var handlers = options.render && options.render._withStripped
|
2114 |
-
? getHandler
|
2115 |
-
: hasHandler;
|
2116 |
-
vm._renderProxy = new Proxy(vm, handlers);
|
2117 |
-
} else {
|
2118 |
-
vm._renderProxy = vm;
|
2119 |
-
}
|
2120 |
-
};
|
2121 |
-
}
|
2122 |
-
|
2123 |
-
/* */
|
2124 |
-
|
2125 |
-
var seenObjects = new _Set();
|
2126 |
-
|
2127 |
-
/**
|
2128 |
-
* Recursively traverse an object to evoke all converted
|
2129 |
-
* getters, so that every nested property inside the object
|
2130 |
-
* is collected as a "deep" dependency.
|
2131 |
-
*/
|
2132 |
-
function traverse (val) {
|
2133 |
-
_traverse(val, seenObjects);
|
2134 |
-
seenObjects.clear();
|
2135 |
-
}
|
2136 |
-
|
2137 |
-
function _traverse (val, seen) {
|
2138 |
-
var i, keys;
|
2139 |
-
var isA = Array.isArray(val);
|
2140 |
-
if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
2141 |
-
return
|
2142 |
-
}
|
2143 |
-
if (val.__ob__) {
|
2144 |
-
var depId = val.__ob__.dep.id;
|
2145 |
-
if (seen.has(depId)) {
|
2146 |
-
return
|
2147 |
-
}
|
2148 |
-
seen.add(depId);
|
2149 |
-
}
|
2150 |
-
if (isA) {
|
2151 |
-
i = val.length;
|
2152 |
-
while (i--) { _traverse(val[i], seen); }
|
2153 |
-
} else {
|
2154 |
-
keys = Object.keys(val);
|
2155 |
-
i = keys.length;
|
2156 |
-
while (i--) { _traverse(val[keys[i]], seen); }
|
2157 |
-
}
|
2158 |
-
}
|
2159 |
-
|
2160 |
-
/* */
|
2161 |
-
|
2162 |
-
var normalizeEvent = cached(function (name) {
|
2163 |
-
var passive = name.charAt(0) === '&';
|
2164 |
-
name = passive ? name.slice(1) : name;
|
2165 |
-
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
|
2166 |
-
name = once$$1 ? name.slice(1) : name;
|
2167 |
-
var capture = name.charAt(0) === '!';
|
2168 |
-
name = capture ? name.slice(1) : name;
|
2169 |
-
return {
|
2170 |
-
name: name,
|
2171 |
-
once: once$$1,
|
2172 |
-
capture: capture,
|
2173 |
-
passive: passive
|
2174 |
-
}
|
2175 |
-
});
|
2176 |
-
|
2177 |
-
function createFnInvoker (fns, vm) {
|
2178 |
-
function invoker () {
|
2179 |
-
var arguments$1 = arguments;
|
2180 |
-
|
2181 |
-
var fns = invoker.fns;
|
2182 |
-
if (Array.isArray(fns)) {
|
2183 |
-
var cloned = fns.slice();
|
2184 |
-
for (var i = 0; i < cloned.length; i++) {
|
2185 |
-
invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
2186 |
-
}
|
2187 |
-
} else {
|
2188 |
-
// return handler return value for single handlers
|
2189 |
-
return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
2190 |
-
}
|
2191 |
-
}
|
2192 |
-
invoker.fns = fns;
|
2193 |
-
return invoker
|
2194 |
-
}
|
2195 |
-
|
2196 |
-
function updateListeners (
|
2197 |
-
on,
|
2198 |
-
oldOn,
|
2199 |
-
add,
|
2200 |
-
remove$$1,
|
2201 |
-
createOnceHandler,
|
2202 |
-
vm
|
2203 |
-
) {
|
2204 |
-
var name, def$$1, cur, old, event;
|
2205 |
-
for (name in on) {
|
2206 |
-
def$$1 = cur = on[name];
|
2207 |
-
old = oldOn[name];
|
2208 |
-
event = normalizeEvent(name);
|
2209 |
-
if (isUndef(cur)) {
|
2210 |
-
warn(
|
2211 |
-
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
2212 |
-
vm
|
2213 |
-
);
|
2214 |
-
} else if (isUndef(old)) {
|
2215 |
-
if (isUndef(cur.fns)) {
|
2216 |
-
cur = on[name] = createFnInvoker(cur, vm);
|
2217 |
-
}
|
2218 |
-
if (isTrue(event.once)) {
|
2219 |
-
cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
2220 |
-
}
|
2221 |
-
add(event.name, cur, event.capture, event.passive, event.params);
|
2222 |
-
} else if (cur !== old) {
|
2223 |
-
old.fns = cur;
|
2224 |
-
on[name] = old;
|
2225 |
-
}
|
2226 |
-
}
|
2227 |
-
for (name in oldOn) {
|
2228 |
-
if (isUndef(on[name])) {
|
2229 |
-
event = normalizeEvent(name);
|
2230 |
-
remove$$1(event.name, oldOn[name], event.capture);
|
2231 |
-
}
|
2232 |
-
}
|
2233 |
-
}
|
2234 |
-
|
2235 |
-
/* */
|
2236 |
-
|
2237 |
-
function mergeVNodeHook (def, hookKey, hook) {
|
2238 |
-
if (def instanceof VNode) {
|
2239 |
-
def = def.data.hook || (def.data.hook = {});
|
2240 |
-
}
|
2241 |
-
var invoker;
|
2242 |
-
var oldHook = def[hookKey];
|
2243 |
-
|
2244 |
-
function wrappedHook () {
|
2245 |
-
hook.apply(this, arguments);
|
2246 |
-
// important: remove merged hook to ensure it's called only once
|
2247 |
-
// and prevent memory leak
|
2248 |
-
remove(invoker.fns, wrappedHook);
|
2249 |
-
}
|
2250 |
-
|
2251 |
-
if (isUndef(oldHook)) {
|
2252 |
-
// no existing hook
|
2253 |
-
invoker = createFnInvoker([wrappedHook]);
|
2254 |
-
} else {
|
2255 |
-
/* istanbul ignore if */
|
2256 |
-
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
2257 |
-
// already a merged invoker
|
2258 |
-
invoker = oldHook;
|
2259 |
-
invoker.fns.push(wrappedHook);
|
2260 |
-
} else {
|
2261 |
-
// existing plain hook
|
2262 |
-
invoker = createFnInvoker([oldHook, wrappedHook]);
|
2263 |
-
}
|
2264 |
-
}
|
2265 |
-
|
2266 |
-
invoker.merged = true;
|
2267 |
-
def[hookKey] = invoker;
|
2268 |
-
}
|
2269 |
-
|
2270 |
-
/* */
|
2271 |
-
|
2272 |
-
function extractPropsFromVNodeData (
|
2273 |
-
data,
|
2274 |
-
Ctor,
|
2275 |
-
tag
|
2276 |
-
) {
|
2277 |
-
// we are only extracting raw values here.
|
2278 |
-
// validation and default values are handled in the child
|
2279 |
-
// component itself.
|
2280 |
-
var propOptions = Ctor.options.props;
|
2281 |
-
if (isUndef(propOptions)) {
|
2282 |
-
return
|
2283 |
-
}
|
2284 |
-
var res = {};
|
2285 |
-
var attrs = data.attrs;
|
2286 |
-
var props = data.props;
|
2287 |
-
if (isDef(attrs) || isDef(props)) {
|
2288 |
-
for (var key in propOptions) {
|
2289 |
-
var altKey = hyphenate(key);
|
2290 |
-
{
|
2291 |
-
var keyInLowerCase = key.toLowerCase();
|
2292 |
-
if (
|
2293 |
-
key !== keyInLowerCase &&
|
2294 |
-
attrs && hasOwn(attrs, keyInLowerCase)
|
2295 |
-
) {
|
2296 |
-
tip(
|
2297 |
-
"Prop \"" + keyInLowerCase + "\" is passed to component " +
|
2298 |
-
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
2299 |
-
" \"" + key + "\". " +
|
2300 |
-
"Note that HTML attributes are case-insensitive and camelCased " +
|
2301 |
-
"props need to use their kebab-case equivalents when using in-DOM " +
|
2302 |
-
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
2303 |
-
);
|
2304 |
-
}
|
2305 |
-
}
|
2306 |
-
checkProp(res, props, key, altKey, true) ||
|
2307 |
-
checkProp(res, attrs, key, altKey, false);
|
2308 |
-
}
|
2309 |
-
}
|
2310 |
-
return res
|
2311 |
-
}
|
2312 |
-
|
2313 |
-
function checkProp (
|
2314 |
-
res,
|
2315 |
-
hash,
|
2316 |
-
key,
|
2317 |
-
altKey,
|
2318 |
-
preserve
|
2319 |
-
) {
|
2320 |
-
if (isDef(hash)) {
|
2321 |
-
if (hasOwn(hash, key)) {
|
2322 |
-
res[key] = hash[key];
|
2323 |
-
if (!preserve) {
|
2324 |
-
delete hash[key];
|
2325 |
-
}
|
2326 |
-
return true
|
2327 |
-
} else if (hasOwn(hash, altKey)) {
|
2328 |
-
res[key] = hash[altKey];
|
2329 |
-
if (!preserve) {
|
2330 |
-
delete hash[altKey];
|
2331 |
-
}
|
2332 |
-
return true
|
2333 |
-
}
|
2334 |
-
}
|
2335 |
-
return false
|
2336 |
-
}
|
2337 |
-
|
2338 |
-
/* */
|
2339 |
-
|
2340 |
-
// The template compiler attempts to minimize the need for normalization by
|
2341 |
-
// statically analyzing the template at compile time.
|
2342 |
-
//
|
2343 |
-
// For plain HTML markup, normalization can be completely skipped because the
|
2344 |
-
// generated render function is guaranteed to return Array<VNode>. There are
|
2345 |
-
// two cases where extra normalization is needed:
|
2346 |
-
|
2347 |
-
// 1. When the children contains components - because a functional component
|
2348 |
-
// may return an Array instead of a single root. In this case, just a simple
|
2349 |
-
// normalization is needed - if any child is an Array, we flatten the whole
|
2350 |
-
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
|
2351 |
-
// because functional components already normalize their own children.
|
2352 |
-
function simpleNormalizeChildren (children) {
|
2353 |
-
for (var i = 0; i < children.length; i++) {
|
2354 |
-
if (Array.isArray(children[i])) {
|
2355 |
-
return Array.prototype.concat.apply([], children)
|
2356 |
-
}
|
2357 |
-
}
|
2358 |
-
return children
|
2359 |
-
}
|
2360 |
-
|
2361 |
-
// 2. When the children contains constructs that always generated nested Arrays,
|
2362 |
-
// e.g. <template>, <slot>, v-for, or when the children is provided by user
|
2363 |
-
// with hand-written render functions / JSX. In such cases a full normalization
|
2364 |
-
// is needed to cater to all possible types of children values.
|
2365 |
-
function normalizeChildren (children) {
|
2366 |
-
return isPrimitive(children)
|
2367 |
-
? [createTextVNode(children)]
|
2368 |
-
: Array.isArray(children)
|
2369 |
-
? normalizeArrayChildren(children)
|
2370 |
-
: undefined
|
2371 |
-
}
|
2372 |
-
|
2373 |
-
function isTextNode (node) {
|
2374 |
-
return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
2375 |
-
}
|
2376 |
-
|
2377 |
-
function normalizeArrayChildren (children, nestedIndex) {
|
2378 |
-
var res = [];
|
2379 |
-
var i, c, lastIndex, last;
|
2380 |
-
for (i = 0; i < children.length; i++) {
|
2381 |
-
c = children[i];
|
2382 |
-
if (isUndef(c) || typeof c === 'boolean') { continue }
|
2383 |
-
lastIndex = res.length - 1;
|
2384 |
-
last = res[lastIndex];
|
2385 |
-
// nested
|
2386 |
-
if (Array.isArray(c)) {
|
2387 |
-
if (c.length > 0) {
|
2388 |
-
c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
2389 |
-
// merge adjacent text nodes
|
2390 |
-
if (isTextNode(c[0]) && isTextNode(last)) {
|
2391 |
-
res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
2392 |
-
c.shift();
|
2393 |
-
}
|
2394 |
-
res.push.apply(res, c);
|
2395 |
-
}
|
2396 |
-
} else if (isPrimitive(c)) {
|
2397 |
-
if (isTextNode(last)) {
|
2398 |
-
// merge adjacent text nodes
|
2399 |
-
// this is necessary for SSR hydration because text nodes are
|
2400 |
-
// essentially merged when rendered to HTML strings
|
2401 |
-
res[lastIndex] = createTextVNode(last.text + c);
|
2402 |
-
} else if (c !== '') {
|
2403 |
-
// convert primitive to vnode
|
2404 |
-
res.push(createTextVNode(c));
|
2405 |
-
}
|
2406 |
-
} else {
|
2407 |
-
if (isTextNode(c) && isTextNode(last)) {
|
2408 |
-
// merge adjacent text nodes
|
2409 |
-
res[lastIndex] = createTextVNode(last.text + c.text);
|
2410 |
-
} else {
|
2411 |
-
// default key for nested array children (likely generated by v-for)
|
2412 |
-
if (isTrue(children._isVList) &&
|
2413 |
-
isDef(c.tag) &&
|
2414 |
-
isUndef(c.key) &&
|
2415 |
-
isDef(nestedIndex)) {
|
2416 |
-
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2417 |
-
}
|
2418 |
-
res.push(c);
|
2419 |
-
}
|
2420 |
-
}
|
2421 |
-
}
|
2422 |
-
return res
|
2423 |
-
}
|
2424 |
-
|
2425 |
-
/* */
|
2426 |
-
|
2427 |
-
function initProvide (vm) {
|
2428 |
-
var provide = vm.$options.provide;
|
2429 |
-
if (provide) {
|
2430 |
-
vm._provided = typeof provide === 'function'
|
2431 |
-
? provide.call(vm)
|
2432 |
-
: provide;
|
2433 |
-
}
|
2434 |
-
}
|
2435 |
-
|
2436 |
-
function initInjections (vm) {
|
2437 |
-
var result = resolveInject(vm.$options.inject, vm);
|
2438 |
-
if (result) {
|
2439 |
-
toggleObserving(false);
|
2440 |
-
Object.keys(result).forEach(function (key) {
|
2441 |
-
/* istanbul ignore else */
|
2442 |
-
{
|
2443 |
-
defineReactive$$1(vm, key, result[key], function () {
|
2444 |
-
warn(
|
2445 |
-
"Avoid mutating an injected value directly since the changes will be " +
|
2446 |
-
"overwritten whenever the provided component re-renders. " +
|
2447 |
-
"injection being mutated: \"" + key + "\"",
|
2448 |
-
vm
|
2449 |
-
);
|
2450 |
-
});
|
2451 |
-
}
|
2452 |
-
});
|
2453 |
-
toggleObserving(true);
|
2454 |
-
}
|
2455 |
-
}
|
2456 |
-
|
2457 |
-
function resolveInject (inject, vm) {
|
2458 |
-
if (inject) {
|
2459 |
-
// inject is :any because flow is not smart enough to figure out cached
|
2460 |
-
var result = Object.create(null);
|
2461 |
-
var keys = hasSymbol
|
2462 |
-
? Reflect.ownKeys(inject)
|
2463 |
-
: Object.keys(inject);
|
2464 |
-
|
2465 |
-
for (var i = 0; i < keys.length; i++) {
|
2466 |
-
var key = keys[i];
|
2467 |
-
// #6574 in case the inject object is observed...
|
2468 |
-
if (key === '__ob__') { continue }
|
2469 |
-
var provideKey = inject[key].from;
|
2470 |
-
var source = vm;
|
2471 |
-
while (source) {
|
2472 |
-
if (source._provided && hasOwn(source._provided, provideKey)) {
|
2473 |
-
result[key] = source._provided[provideKey];
|
2474 |
-
break
|
2475 |
-
}
|
2476 |
-
source = source.$parent;
|
2477 |
-
}
|
2478 |
-
if (!source) {
|
2479 |
-
if ('default' in inject[key]) {
|
2480 |
-
var provideDefault = inject[key].default;
|
2481 |
-
result[key] = typeof provideDefault === 'function'
|
2482 |
-
? provideDefault.call(vm)
|
2483 |
-
: provideDefault;
|
2484 |
-
} else {
|
2485 |
-
warn(("Injection \"" + key + "\" not found"), vm);
|
2486 |
-
}
|
2487 |
-
}
|
2488 |
-
}
|
2489 |
-
return result
|
2490 |
-
}
|
2491 |
-
}
|
2492 |
-
|
2493 |
-
/* */
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
/**
|
2498 |
-
* Runtime helper for resolving raw children VNodes into a slot object.
|
2499 |
-
*/
|
2500 |
-
function resolveSlots (
|
2501 |
-
children,
|
2502 |
-
context
|
2503 |
-
) {
|
2504 |
-
if (!children || !children.length) {
|
2505 |
-
return {}
|
2506 |
-
}
|
2507 |
-
var slots = {};
|
2508 |
-
for (var i = 0, l = children.length; i < l; i++) {
|
2509 |
-
var child = children[i];
|
2510 |
-
var data = child.data;
|
2511 |
-
// remove slot attribute if the node is resolved as a Vue slot node
|
2512 |
-
if (data && data.attrs && data.attrs.slot) {
|
2513 |
-
delete data.attrs.slot;
|
2514 |
-
}
|
2515 |
-
// named slots should only be respected if the vnode was rendered in the
|
2516 |
-
// same context.
|
2517 |
-
if ((child.context === context || child.fnContext === context) &&
|
2518 |
-
data && data.slot != null
|
2519 |
-
) {
|
2520 |
-
var name = data.slot;
|
2521 |
-
var slot = (slots[name] || (slots[name] = []));
|
2522 |
-
if (child.tag === 'template') {
|
2523 |
-
slot.push.apply(slot, child.children || []);
|
2524 |
-
} else {
|
2525 |
-
slot.push(child);
|
2526 |
-
}
|
2527 |
-
} else {
|
2528 |
-
(slots.default || (slots.default = [])).push(child);
|
2529 |
-
}
|
2530 |
-
}
|
2531 |
-
// ignore slots that contains only whitespace
|
2532 |
-
for (var name$1 in slots) {
|
2533 |
-
if (slots[name$1].every(isWhitespace)) {
|
2534 |
-
delete slots[name$1];
|
2535 |
-
}
|
2536 |
-
}
|
2537 |
-
return slots
|
2538 |
-
}
|
2539 |
-
|
2540 |
-
function isWhitespace (node) {
|
2541 |
-
return (node.isComment && !node.asyncFactory) || node.text === ' '
|
2542 |
-
}
|
2543 |
-
|
2544 |
-
/* */
|
2545 |
-
|
2546 |
-
function normalizeScopedSlots (
|
2547 |
-
slots,
|
2548 |
-
normalSlots,
|
2549 |
-
prevSlots
|
2550 |
-
) {
|
2551 |
-
var res;
|
2552 |
-
var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
2553 |
-
var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
2554 |
-
var key = slots && slots.$key;
|
2555 |
-
if (!slots) {
|
2556 |
-
res = {};
|
2557 |
-
} else if (slots._normalized) {
|
2558 |
-
// fast path 1: child component re-render only, parent did not change
|
2559 |
-
return slots._normalized
|
2560 |
-
} else if (
|
2561 |
-
isStable &&
|
2562 |
-
prevSlots &&
|
2563 |
-
prevSlots !== emptyObject &&
|
2564 |
-
key === prevSlots.$key &&
|
2565 |
-
!hasNormalSlots &&
|
2566 |
-
!prevSlots.$hasNormal
|
2567 |
-
) {
|
2568 |
-
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
2569 |
-
// only need to normalize once
|
2570 |
-
return prevSlots
|
2571 |
-
} else {
|
2572 |
-
res = {};
|
2573 |
-
for (var key$1 in slots) {
|
2574 |
-
if (slots[key$1] && key$1[0] !== '$') {
|
2575 |
-
res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
|
2576 |
-
}
|
2577 |
-
}
|
2578 |
-
}
|
2579 |
-
// expose normal slots on scopedSlots
|
2580 |
-
for (var key$2 in normalSlots) {
|
2581 |
-
if (!(key$2 in res)) {
|
2582 |
-
res[key$2] = proxyNormalSlot(normalSlots, key$2);
|
2583 |
-
}
|
2584 |
-
}
|
2585 |
-
// avoriaz seems to mock a non-extensible $scopedSlots object
|
2586 |
-
// and when that is passed down this would cause an error
|
2587 |
-
if (slots && Object.isExtensible(slots)) {
|
2588 |
-
(slots)._normalized = res;
|
2589 |
-
}
|
2590 |
-
def(res, '$stable', isStable);
|
2591 |
-
def(res, '$key', key);
|
2592 |
-
def(res, '$hasNormal', hasNormalSlots);
|
2593 |
-
return res
|
2594 |
-
}
|
2595 |
-
|
2596 |
-
function normalizeScopedSlot(normalSlots, key, fn) {
|
2597 |
-
var normalized = function () {
|
2598 |
-
var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
2599 |
-
res = res && typeof res === 'object' && !Array.isArray(res)
|
2600 |
-
? [res] // single vnode
|
2601 |
-
: normalizeChildren(res);
|
2602 |
-
return res && (
|
2603 |
-
res.length === 0 ||
|
2604 |
-
(res.length === 1 && res[0].isComment) // #9658
|
2605 |
-
) ? undefined
|
2606 |
-
: res
|
2607 |
-
};
|
2608 |
-
// this is a slot using the new v-slot syntax without scope. although it is
|
2609 |
-
// compiled as a scoped slot, render fn users would expect it to be present
|
2610 |
-
// on this.$slots because the usage is semantically a normal slot.
|
2611 |
-
if (fn.proxy) {
|
2612 |
-
Object.defineProperty(normalSlots, key, {
|
2613 |
-
get: normalized,
|
2614 |
-
enumerable: true,
|
2615 |
-
configurable: true
|
2616 |
-
});
|
2617 |
-
}
|
2618 |
-
return normalized
|
2619 |
-
}
|
2620 |
-
|
2621 |
-
function proxyNormalSlot(slots, key) {
|
2622 |
-
return function () { return slots[key]; }
|
2623 |
-
}
|
2624 |
-
|
2625 |
-
/* */
|
2626 |
-
|
2627 |
-
/**
|
2628 |
-
* Runtime helper for rendering v-for lists.
|
2629 |
-
*/
|
2630 |
-
function renderList (
|
2631 |
-
val,
|
2632 |
-
render
|
2633 |
-
) {
|
2634 |
-
var ret, i, l, keys, key;
|
2635 |
-
if (Array.isArray(val) || typeof val === 'string') {
|
2636 |
-
ret = new Array(val.length);
|
2637 |
-
for (i = 0, l = val.length; i < l; i++) {
|
2638 |
-
ret[i] = render(val[i], i);
|
2639 |
-
}
|
2640 |
-
} else if (typeof val === 'number') {
|
2641 |
-
ret = new Array(val);
|
2642 |
-
for (i = 0; i < val; i++) {
|
2643 |
-
ret[i] = render(i + 1, i);
|
2644 |
-
}
|
2645 |
-
} else if (isObject(val)) {
|
2646 |
-
if (hasSymbol && val[Symbol.iterator]) {
|
2647 |
-
ret = [];
|
2648 |
-
var iterator = val[Symbol.iterator]();
|
2649 |
-
var result = iterator.next();
|
2650 |
-
while (!result.done) {
|
2651 |
-
ret.push(render(result.value, ret.length));
|
2652 |
-
result = iterator.next();
|
2653 |
-
}
|
2654 |
-
} else {
|
2655 |
-
keys = Object.keys(val);
|
2656 |
-
ret = new Array(keys.length);
|
2657 |
-
for (i = 0, l = keys.length; i < l; i++) {
|
2658 |
-
key = keys[i];
|
2659 |
-
ret[i] = render(val[key], key, i);
|
2660 |
-
}
|
2661 |
-
}
|
2662 |
-
}
|
2663 |
-
if (!isDef(ret)) {
|
2664 |
-
ret = [];
|
2665 |
-
}
|
2666 |
-
(ret)._isVList = true;
|
2667 |
-
return ret
|
2668 |
-
}
|
2669 |
-
|
2670 |
-
/* */
|
2671 |
-
|
2672 |
-
/**
|
2673 |
-
* Runtime helper for rendering <slot>
|
2674 |
-
*/
|
2675 |
-
function renderSlot (
|
2676 |
-
name,
|
2677 |
-
fallback,
|
2678 |
-
props,
|
2679 |
-
bindObject
|
2680 |
-
) {
|
2681 |
-
var scopedSlotFn = this.$scopedSlots[name];
|
2682 |
-
var nodes;
|
2683 |
-
if (scopedSlotFn) { // scoped slot
|
2684 |
-
props = props || {};
|
2685 |
-
if (bindObject) {
|
2686 |
-
if (!isObject(bindObject)) {
|
2687 |
-
warn(
|
2688 |
-
'slot v-bind without argument expects an Object',
|
2689 |
-
this
|
2690 |
-
);
|
2691 |
-
}
|
2692 |
-
props = extend(extend({}, bindObject), props);
|
2693 |
-
}
|
2694 |
-
nodes = scopedSlotFn(props) || fallback;
|
2695 |
-
} else {
|
2696 |
-
nodes = this.$slots[name] || fallback;
|
2697 |
-
}
|
2698 |
-
|
2699 |
-
var target = props && props.slot;
|
2700 |
-
if (target) {
|
2701 |
-
return this.$createElement('template', { slot: target }, nodes)
|
2702 |
-
} else {
|
2703 |
-
return nodes
|
2704 |
-
}
|
2705 |
-
}
|
2706 |
-
|
2707 |
-
/* */
|
2708 |
-
|
2709 |
-
/**
|
2710 |
-
* Runtime helper for resolving filters
|
2711 |
-
*/
|
2712 |
-
function resolveFilter (id) {
|
2713 |
-
return resolveAsset(this.$options, 'filters', id, true) || identity
|
2714 |
-
}
|
2715 |
-
|
2716 |
-
/* */
|
2717 |
-
|
2718 |
-
function isKeyNotMatch (expect, actual) {
|
2719 |
-
if (Array.isArray(expect)) {
|
2720 |
-
return expect.indexOf(actual) === -1
|
2721 |
-
} else {
|
2722 |
-
return expect !== actual
|
2723 |
-
}
|
2724 |
-
}
|
2725 |
-
|
2726 |
-
/**
|
2727 |
-
* Runtime helper for checking keyCodes from config.
|
2728 |
-
* exposed as Vue.prototype._k
|
2729 |
-
* passing in eventKeyName as last argument separately for backwards compat
|
2730 |
-
*/
|
2731 |
-
function checkKeyCodes (
|
2732 |
-
eventKeyCode,
|
2733 |
-
key,
|
2734 |
-
builtInKeyCode,
|
2735 |
-
eventKeyName,
|
2736 |
-
builtInKeyName
|
2737 |
-
) {
|
2738 |
-
var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
2739 |
-
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
2740 |
-
return isKeyNotMatch(builtInKeyName, eventKeyName)
|
2741 |
-
} else if (mappedKeyCode) {
|
2742 |
-
return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
2743 |
-
} else if (eventKeyName) {
|
2744 |
-
return hyphenate(eventKeyName) !== key
|
2745 |
-
}
|
2746 |
-
}
|
2747 |
-
|
2748 |
-
/* */
|
2749 |
-
|
2750 |
-
/**
|
2751 |
-
* Runtime helper for merging v-bind="object" into a VNode's data.
|
2752 |
-
*/
|
2753 |
-
function bindObjectProps (
|
2754 |
-
data,
|
2755 |
-
tag,
|
2756 |
-
value,
|
2757 |
-
asProp,
|
2758 |
-
isSync
|
2759 |
-
) {
|
2760 |
-
if (value) {
|
2761 |
-
if (!isObject(value)) {
|
2762 |
-
warn(
|
2763 |
-
'v-bind without argument expects an Object or Array value',
|
2764 |
-
this
|
2765 |
-
);
|
2766 |
-
} else {
|
2767 |
-
if (Array.isArray(value)) {
|
2768 |
-
value = toObject(value);
|
2769 |
-
}
|
2770 |
-
var hash;
|
2771 |
-
var loop = function ( key ) {
|
2772 |
-
if (
|
2773 |
-
key === 'class' ||
|
2774 |
-
key === 'style' ||
|
2775 |
-
isReservedAttribute(key)
|
2776 |
-
) {
|
2777 |
-
hash = data;
|
2778 |
-
} else {
|
2779 |
-
var type = data.attrs && data.attrs.type;
|
2780 |
-
hash = asProp || config.mustUseProp(tag, type, key)
|
2781 |
-
? data.domProps || (data.domProps = {})
|
2782 |
-
: data.attrs || (data.attrs = {});
|
2783 |
-
}
|
2784 |
-
var camelizedKey = camelize(key);
|
2785 |
-
var hyphenatedKey = hyphenate(key);
|
2786 |
-
if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
2787 |
-
hash[key] = value[key];
|
2788 |
-
|
2789 |
-
if (isSync) {
|
2790 |
-
var on = data.on || (data.on = {});
|
2791 |
-
on[("update:" + key)] = function ($event) {
|
2792 |
-
value[key] = $event;
|
2793 |
-
};
|
2794 |
-
}
|
2795 |
-
}
|
2796 |
-
};
|
2797 |
-
|
2798 |
-
for (var key in value) loop( key );
|
2799 |
-
}
|
2800 |
-
}
|
2801 |
-
return data
|
2802 |
-
}
|
2803 |
-
|
2804 |
-
/* */
|
2805 |
-
|
2806 |
-
/**
|
2807 |
-
* Runtime helper for rendering static trees.
|
2808 |
-
*/
|
2809 |
-
function renderStatic (
|
2810 |
-
index,
|
2811 |
-
isInFor
|
2812 |
-
) {
|
2813 |
-
var cached = this._staticTrees || (this._staticTrees = []);
|
2814 |
-
var tree = cached[index];
|
2815 |
-
// if has already-rendered static tree and not inside v-for,
|
2816 |
-
// we can reuse the same tree.
|
2817 |
-
if (tree && !isInFor) {
|
2818 |
-
return tree
|
2819 |
-
}
|
2820 |
-
// otherwise, render a fresh tree.
|
2821 |
-
tree = cached[index] = this.$options.staticRenderFns[index].call(
|
2822 |
-
this._renderProxy,
|
2823 |
-
null,
|
2824 |
-
this // for render fns generated for functional component templates
|
2825 |
-
);
|
2826 |
-
markStatic(tree, ("__static__" + index), false);
|
2827 |
-
return tree
|
2828 |
-
}
|
2829 |
-
|
2830 |
-
/**
|
2831 |
-
* Runtime helper for v-once.
|
2832 |
-
* Effectively it means marking the node as static with a unique key.
|
2833 |
-
*/
|
2834 |
-
function markOnce (
|
2835 |
-
tree,
|
2836 |
-
index,
|
2837 |
-
key
|
2838 |
-
) {
|
2839 |
-
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
2840 |
-
return tree
|
2841 |
-
}
|
2842 |
-
|
2843 |
-
function markStatic (
|
2844 |
-
tree,
|
2845 |
-
key,
|
2846 |
-
isOnce
|
2847 |
-
) {
|
2848 |
-
if (Array.isArray(tree)) {
|
2849 |
-
for (var i = 0; i < tree.length; i++) {
|
2850 |
-
if (tree[i] && typeof tree[i] !== 'string') {
|
2851 |
-
markStaticNode(tree[i], (key + "_" + i), isOnce);
|
2852 |
-
}
|
2853 |
-
}
|
2854 |
-
} else {
|
2855 |
-
markStaticNode(tree, key, isOnce);
|
2856 |
-
}
|
2857 |
-
}
|
2858 |
-
|
2859 |
-
function markStaticNode (node, key, isOnce) {
|
2860 |
-
node.isStatic = true;
|
2861 |
-
node.key = key;
|
2862 |
-
node.isOnce = isOnce;
|
2863 |
-
}
|
2864 |
-
|
2865 |
-
/* */
|
2866 |
-
|
2867 |
-
function bindObjectListeners (data, value) {
|
2868 |
-
if (value) {
|
2869 |
-
if (!isPlainObject(value)) {
|
2870 |
-
warn(
|
2871 |
-
'v-on without argument expects an Object value',
|
2872 |
-
this
|
2873 |
-
);
|
2874 |
-
} else {
|
2875 |
-
var on = data.on = data.on ? extend({}, data.on) : {};
|
2876 |
-
for (var key in value) {
|
2877 |
-
var existing = on[key];
|
2878 |
-
var ours = value[key];
|
2879 |
-
on[key] = existing ? [].concat(existing, ours) : ours;
|
2880 |
-
}
|
2881 |
-
}
|
2882 |
-
}
|
2883 |
-
return data
|
2884 |
-
}
|
2885 |
-
|
2886 |
-
/* */
|
2887 |
-
|
2888 |
-
function resolveScopedSlots (
|
2889 |
-
fns, // see flow/vnode
|
2890 |
-
res,
|
2891 |
-
// the following are added in 2.6
|
2892 |
-
hasDynamicKeys,
|
2893 |
-
contentHashKey
|
2894 |
-
) {
|
2895 |
-
res = res || { $stable: !hasDynamicKeys };
|
2896 |
-
for (var i = 0; i < fns.length; i++) {
|
2897 |
-
var slot = fns[i];
|
2898 |
-
if (Array.isArray(slot)) {
|
2899 |
-
resolveScopedSlots(slot, res, hasDynamicKeys);
|
2900 |
-
} else if (slot) {
|
2901 |
-
// marker for reverse proxying v-slot without scope on this.$slots
|
2902 |
-
if (slot.proxy) {
|
2903 |
-
slot.fn.proxy = true;
|
2904 |
-
}
|
2905 |
-
res[slot.key] = slot.fn;
|
2906 |
-
}
|
2907 |
-
}
|
2908 |
-
if (contentHashKey) {
|
2909 |
-
(res).$key = contentHashKey;
|
2910 |
-
}
|
2911 |
-
return res
|
2912 |
-
}
|
2913 |
-
|
2914 |
-
/* */
|
2915 |
-
|
2916 |
-
function bindDynamicKeys (baseObj, values) {
|
2917 |
-
for (var i = 0; i < values.length; i += 2) {
|
2918 |
-
var key = values[i];
|
2919 |
-
if (typeof key === 'string' && key) {
|
2920 |
-
baseObj[values[i]] = values[i + 1];
|
2921 |
-
} else if (key !== '' && key !== null) {
|
2922 |
-
// null is a speical value for explicitly removing a binding
|
2923 |
-
warn(
|
2924 |
-
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
2925 |
-
this
|
2926 |
-
);
|
2927 |
-
}
|
2928 |
-
}
|
2929 |
-
return baseObj
|
2930 |
-
}
|
2931 |
-
|
2932 |
-
// helper to dynamically append modifier runtime markers to event names.
|
2933 |
-
// ensure only append when value is already string, otherwise it will be cast
|
2934 |
-
// to string and cause the type check to miss.
|
2935 |
-
function prependModifier (value, symbol) {
|
2936 |
-
return typeof value === 'string' ? symbol + value : value
|
2937 |
-
}
|
2938 |
-
|
2939 |
-
/* */
|
2940 |
-
|
2941 |
-
function installRenderHelpers (target) {
|
2942 |
-
target._o = markOnce;
|
2943 |
-
target._n = toNumber;
|
2944 |
-
target._s = toString;
|
2945 |
-
target._l = renderList;
|
2946 |
-
target._t = renderSlot;
|
2947 |
-
target._q = looseEqual;
|
2948 |
-
target._i = looseIndexOf;
|
2949 |
-
target._m = renderStatic;
|
2950 |
-
target._f = resolveFilter;
|
2951 |
-
target._k = checkKeyCodes;
|
2952 |
-
target._b = bindObjectProps;
|
2953 |
-
target._v = createTextVNode;
|
2954 |
-
target._e = createEmptyVNode;
|
2955 |
-
target._u = resolveScopedSlots;
|
2956 |
-
target._g = bindObjectListeners;
|
2957 |
-
target._d = bindDynamicKeys;
|
2958 |
-
target._p = prependModifier;
|
2959 |
-
}
|
2960 |
-
|
2961 |
-
/* */
|
2962 |
-
|
2963 |
-
function FunctionalRenderContext (
|
2964 |
-
data,
|
2965 |
-
props,
|
2966 |
-
children,
|
2967 |
-
parent,
|
2968 |
-
Ctor
|
2969 |
-
) {
|
2970 |
-
var this$1 = this;
|
2971 |
-
|
2972 |
-
var options = Ctor.options;
|
2973 |
-
// ensure the createElement function in functional components
|
2974 |
-
// gets a unique context - this is necessary for correct named slot check
|
2975 |
-
var contextVm;
|
2976 |
-
if (hasOwn(parent, '_uid')) {
|
2977 |
-
contextVm = Object.create(parent);
|
2978 |
-
// $flow-disable-line
|
2979 |
-
contextVm._original = parent;
|
2980 |
-
} else {
|
2981 |
-
// the context vm passed in is a functional context as well.
|
2982 |
-
// in this case we want to make sure we are able to get a hold to the
|
2983 |
-
// real context instance.
|
2984 |
-
contextVm = parent;
|
2985 |
-
// $flow-disable-line
|
2986 |
-
parent = parent._original;
|
2987 |
-
}
|
2988 |
-
var isCompiled = isTrue(options._compiled);
|
2989 |
-
var needNormalization = !isCompiled;
|
2990 |
-
|
2991 |
-
this.data = data;
|
2992 |
-
this.props = props;
|
2993 |
-
this.children = children;
|
2994 |
-
this.parent = parent;
|
2995 |
-
this.listeners = data.on || emptyObject;
|
2996 |
-
this.injections = resolveInject(options.inject, parent);
|
2997 |
-
this.slots = function () {
|
2998 |
-
if (!this$1.$slots) {
|
2999 |
-
normalizeScopedSlots(
|
3000 |
-
data.scopedSlots,
|
3001 |
-
this$1.$slots = resolveSlots(children, parent)
|
3002 |
-
);
|
3003 |
-
}
|
3004 |
-
return this$1.$slots
|
3005 |
-
};
|
3006 |
-
|
3007 |
-
Object.defineProperty(this, 'scopedSlots', ({
|
3008 |
-
enumerable: true,
|
3009 |
-
get: function get () {
|
3010 |
-
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
3011 |
-
}
|
3012 |
-
}));
|
3013 |
-
|
3014 |
-
// support for compiled functional template
|
3015 |
-
if (isCompiled) {
|
3016 |
-
// exposing $options for renderStatic()
|
3017 |
-
this.$options = options;
|
3018 |
-
// pre-resolve slots for renderSlot()
|
3019 |
-
this.$slots = this.slots();
|
3020 |
-
this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
3021 |
-
}
|
3022 |
-
|
3023 |
-
if (options._scopeId) {
|
3024 |
-
this._c = function (a, b, c, d) {
|
3025 |
-
var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
3026 |
-
if (vnode && !Array.isArray(vnode)) {
|
3027 |
-
vnode.fnScopeId = options._scopeId;
|
3028 |
-
vnode.fnContext = parent;
|
3029 |
-
}
|
3030 |
-
return vnode
|
3031 |
-
};
|
3032 |
-
} else {
|
3033 |
-
this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
3034 |
-
}
|
3035 |
-
}
|
3036 |
-
|
3037 |
-
installRenderHelpers(FunctionalRenderContext.prototype);
|
3038 |
-
|
3039 |
-
function createFunctionalComponent (
|
3040 |
-
Ctor,
|
3041 |
-
propsData,
|
3042 |
-
data,
|
3043 |
-
contextVm,
|
3044 |
-
children
|
3045 |
-
) {
|
3046 |
-
var options = Ctor.options;
|
3047 |
-
var props = {};
|
3048 |
-
var propOptions = options.props;
|
3049 |
-
if (isDef(propOptions)) {
|
3050 |
-
for (var key in propOptions) {
|
3051 |
-
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
3052 |
-
}
|
3053 |
-
} else {
|
3054 |
-
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
3055 |
-
if (isDef(data.props)) { mergeProps(props, data.props); }
|
3056 |
-
}
|
3057 |
-
|
3058 |
-
var renderContext = new FunctionalRenderContext(
|
3059 |
-
data,
|
3060 |
-
props,
|
3061 |
-
children,
|
3062 |
-
contextVm,
|
3063 |
-
Ctor
|
3064 |
-
);
|
3065 |
-
|
3066 |
-
var vnode = options.render.call(null, renderContext._c, renderContext);
|
3067 |
-
|
3068 |
-
if (vnode instanceof VNode) {
|
3069 |
-
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
3070 |
-
} else if (Array.isArray(vnode)) {
|
3071 |
-
var vnodes = normalizeChildren(vnode) || [];
|
3072 |
-
var res = new Array(vnodes.length);
|
3073 |
-
for (var i = 0; i < vnodes.length; i++) {
|
3074 |
-
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
3075 |
-
}
|
3076 |
-
return res
|
3077 |
-
}
|
3078 |
-
}
|
3079 |
-
|
3080 |
-
function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
3081 |
-
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
3082 |
-
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
3083 |
-
// that should not be matched to match.
|
3084 |
-
var clone = cloneVNode(vnode);
|
3085 |
-
clone.fnContext = contextVm;
|
3086 |
-
clone.fnOptions = options;
|
3087 |
-
{
|
3088 |
-
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
3089 |
-
}
|
3090 |
-
if (data.slot) {
|
3091 |
-
(clone.data || (clone.data = {})).slot = data.slot;
|
3092 |
-
}
|
3093 |
-
return clone
|
3094 |
-
}
|
3095 |
-
|
3096 |
-
function mergeProps (to, from) {
|
3097 |
-
for (var key in from) {
|
3098 |
-
to[camelize(key)] = from[key];
|
3099 |
-
}
|
3100 |
-
}
|
3101 |
-
|
3102 |
-
/* */
|
3103 |
-
|
3104 |
-
/* */
|
3105 |
-
|
3106 |
-
/* */
|
3107 |
-
|
3108 |
-
/* */
|
3109 |
-
|
3110 |
-
// inline hooks to be invoked on component VNodes during patch
|
3111 |
-
var componentVNodeHooks = {
|
3112 |
-
init: function init (vnode, hydrating) {
|
3113 |
-
if (
|
3114 |
-
vnode.componentInstance &&
|
3115 |
-
!vnode.componentInstance._isDestroyed &&
|
3116 |
-
vnode.data.keepAlive
|
3117 |
-
) {
|
3118 |
-
// kept-alive components, treat as a patch
|
3119 |
-
var mountedNode = vnode; // work around flow
|
3120 |
-
componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
3121 |
-
} else {
|
3122 |
-
var child = vnode.componentInstance = createComponentInstanceForVnode(
|
3123 |
-
vnode,
|
3124 |
-
activeInstance
|
3125 |
-
);
|
3126 |
-
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
3127 |
-
}
|
3128 |
-
},
|
3129 |
-
|
3130 |
-
prepatch: function prepatch (oldVnode, vnode) {
|
3131 |
-
var options = vnode.componentOptions;
|
3132 |
-
var child = vnode.componentInstance = oldVnode.componentInstance;
|
3133 |
-
updateChildComponent(
|
3134 |
-
child,
|
3135 |
-
options.propsData, // updated props
|
3136 |
-
options.listeners, // updated listeners
|
3137 |
-
vnode, // new parent vnode
|
3138 |
-
options.children // new children
|
3139 |
-
);
|
3140 |
-
},
|
3141 |
-
|
3142 |
-
insert: function insert (vnode) {
|
3143 |
-
var context = vnode.context;
|
3144 |
-
var componentInstance = vnode.componentInstance;
|
3145 |
-
if (!componentInstance._isMounted) {
|
3146 |
-
componentInstance._isMounted = true;
|
3147 |
-
callHook(componentInstance, 'mounted');
|
3148 |
-
}
|
3149 |
-
if (vnode.data.keepAlive) {
|
3150 |
-
if (context._isMounted) {
|
3151 |
-
// vue-router#1212
|
3152 |
-
// During updates, a kept-alive component's child components may
|
3153 |
-
// change, so directly walking the tree here may call activated hooks
|
3154 |
-
// on incorrect children. Instead we push them into a queue which will
|
3155 |
-
// be processed after the whole patch process ended.
|
3156 |
-
queueActivatedComponent(componentInstance);
|
3157 |
-
} else {
|
3158 |
-
activateChildComponent(componentInstance, true /* direct */);
|
3159 |
-
}
|
3160 |
-
}
|
3161 |
-
},
|
3162 |
-
|
3163 |
-
destroy: function destroy (vnode) {
|
3164 |
-
var componentInstance = vnode.componentInstance;
|
3165 |
-
if (!componentInstance._isDestroyed) {
|
3166 |
-
if (!vnode.data.keepAlive) {
|
3167 |
-
componentInstance.$destroy();
|
3168 |
-
} else {
|
3169 |
-
deactivateChildComponent(componentInstance, true /* direct */);
|
3170 |
-
}
|
3171 |
-
}
|
3172 |
-
}
|
3173 |
-
};
|
3174 |
-
|
3175 |
-
var hooksToMerge = Object.keys(componentVNodeHooks);
|
3176 |
-
|
3177 |
-
function createComponent (
|
3178 |
-
Ctor,
|
3179 |
-
data,
|
3180 |
-
context,
|
3181 |
-
children,
|
3182 |
-
tag
|
3183 |
-
) {
|
3184 |
-
if (isUndef(Ctor)) {
|
3185 |
-
return
|
3186 |
-
}
|
3187 |
-
|
3188 |
-
var baseCtor = context.$options._base;
|
3189 |
-
|
3190 |
-
// plain options object: turn it into a constructor
|
3191 |
-
if (isObject(Ctor)) {
|
3192 |
-
Ctor = baseCtor.extend(Ctor);
|
3193 |
-
}
|
3194 |
-
|
3195 |
-
// if at this stage it's not a constructor or an async component factory,
|
3196 |
-
// reject.
|
3197 |
-
if (typeof Ctor !== 'function') {
|
3198 |
-
{
|
3199 |
-
warn(("Invalid Component definition: " + (String(Ctor))), context);
|
3200 |
-
}
|
3201 |
-
return
|
3202 |
-
}
|
3203 |
-
|
3204 |
-
// async component
|
3205 |
-
var asyncFactory;
|
3206 |
-
if (isUndef(Ctor.cid)) {
|
3207 |
-
asyncFactory = Ctor;
|
3208 |
-
Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
3209 |
-
if (Ctor === undefined) {
|
3210 |
-
// return a placeholder node for async component, which is rendered
|
3211 |
-
// as a comment node but preserves all the raw information for the node.
|
3212 |
-
// the information will be used for async server-rendering and hydration.
|
3213 |
-
return createAsyncPlaceholder(
|
3214 |
-
asyncFactory,
|
3215 |
-
data,
|
3216 |
-
context,
|
3217 |
-
children,
|
3218 |
-
tag
|
3219 |
-
)
|
3220 |
-
}
|
3221 |
-
}
|
3222 |
-
|
3223 |
-
data = data || {};
|
3224 |
-
|
3225 |
-
// resolve constructor options in case global mixins are applied after
|
3226 |
-
// component constructor creation
|
3227 |
-
resolveConstructorOptions(Ctor);
|
3228 |
-
|
3229 |
-
// transform component v-model data into props & events
|
3230 |
-
if (isDef(data.model)) {
|
3231 |
-
transformModel(Ctor.options, data);
|
3232 |
-
}
|
3233 |
-
|
3234 |
-
// extract props
|
3235 |
-
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
3236 |
-
|
3237 |
-
// functional component
|
3238 |
-
if (isTrue(Ctor.options.functional)) {
|
3239 |
-
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
3240 |
-
}
|
3241 |
-
|
3242 |
-
// extract listeners, since these needs to be treated as
|
3243 |
-
// child component listeners instead of DOM listeners
|
3244 |
-
var listeners = data.on;
|
3245 |
-
// replace with listeners with .native modifier
|
3246 |
-
// so it gets processed during parent component patch.
|
3247 |
-
data.on = data.nativeOn;
|
3248 |
-
|
3249 |
-
if (isTrue(Ctor.options.abstract)) {
|
3250 |
-
// abstract components do not keep anything
|
3251 |
-
// other than props & listeners & slot
|
3252 |
-
|
3253 |
-
// work around flow
|
3254 |
-
var slot = data.slot;
|
3255 |
-
data = {};
|
3256 |
-
if (slot) {
|
3257 |
-
data.slot = slot;
|
3258 |
-
}
|
3259 |
-
}
|
3260 |
-
|
3261 |
-
// install component management hooks onto the placeholder node
|
3262 |
-
installComponentHooks(data);
|
3263 |
-
|
3264 |
-
// return a placeholder vnode
|
3265 |
-
var name = Ctor.options.name || tag;
|
3266 |
-
var vnode = new VNode(
|
3267 |
-
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
3268 |
-
data, undefined, undefined, undefined, context,
|
3269 |
-
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
3270 |
-
asyncFactory
|
3271 |
-
);
|
3272 |
-
|
3273 |
-
return vnode
|
3274 |
-
}
|
3275 |
-
|
3276 |
-
function createComponentInstanceForVnode (
|
3277 |
-
vnode, // we know it's MountedComponentVNode but flow doesn't
|
3278 |
-
parent // activeInstance in lifecycle state
|
3279 |
-
) {
|
3280 |
-
var options = {
|
3281 |
-
_isComponent: true,
|
3282 |
-
_parentVnode: vnode,
|
3283 |
-
parent: parent
|
3284 |
-
};
|
3285 |
-
// check inline-template render functions
|
3286 |
-
var inlineTemplate = vnode.data.inlineTemplate;
|
3287 |
-
if (isDef(inlineTemplate)) {
|
3288 |
-
options.render = inlineTemplate.render;
|
3289 |
-
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
3290 |
-
}
|
3291 |
-
return new vnode.componentOptions.Ctor(options)
|
3292 |
-
}
|
3293 |
-
|
3294 |
-
function installComponentHooks (data) {
|
3295 |
-
var hooks = data.hook || (data.hook = {});
|
3296 |
-
for (var i = 0; i < hooksToMerge.length; i++) {
|
3297 |
-
var key = hooksToMerge[i];
|
3298 |
-
var existing = hooks[key];
|
3299 |
-
var toMerge = componentVNodeHooks[key];
|
3300 |
-
if (existing !== toMerge && !(existing && existing._merged)) {
|
3301 |
-
hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
3302 |
-
}
|
3303 |
-
}
|
3304 |
-
}
|
3305 |
-
|
3306 |
-
function mergeHook$1 (f1, f2) {
|
3307 |
-
var merged = function (a, b) {
|
3308 |
-
// flow complains about extra args which is why we use any
|
3309 |
-
f1(a, b);
|
3310 |
-
f2(a, b);
|
3311 |
-
};
|
3312 |
-
merged._merged = true;
|
3313 |
-
return merged
|
3314 |
-
}
|
3315 |
-
|
3316 |
-
// transform component v-model info (value and callback) into
|
3317 |
-
// prop and event handler respectively.
|
3318 |
-
function transformModel (options, data) {
|
3319 |
-
var prop = (options.model && options.model.prop) || 'value';
|
3320 |
-
var event = (options.model && options.model.event) || 'input'
|
3321 |
-
;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
3322 |
-
var on = data.on || (data.on = {});
|
3323 |
-
var existing = on[event];
|
3324 |
-
var callback = data.model.callback;
|
3325 |
-
if (isDef(existing)) {
|
3326 |
-
if (
|
3327 |
-
Array.isArray(existing)
|
3328 |
-
? existing.indexOf(callback) === -1
|
3329 |
-
: existing !== callback
|
3330 |
-
) {
|
3331 |
-
on[event] = [callback].concat(existing);
|
3332 |
-
}
|
3333 |
-
} else {
|
3334 |
-
on[event] = callback;
|
3335 |
-
}
|
3336 |
-
}
|
3337 |
-
|
3338 |
-
/* */
|
3339 |
-
|
3340 |
-
var SIMPLE_NORMALIZE = 1;
|
3341 |
-
var ALWAYS_NORMALIZE = 2;
|
3342 |
-
|
3343 |
-
// wrapper function for providing a more flexible interface
|
3344 |
-
// without getting yelled at by flow
|
3345 |
-
function createElement (
|
3346 |
-
context,
|
3347 |
-
tag,
|
3348 |
-
data,
|
3349 |
-
children,
|
3350 |
-
normalizationType,
|
3351 |
-
alwaysNormalize
|
3352 |
-
) {
|
3353 |
-
if (Array.isArray(data) || isPrimitive(data)) {
|
3354 |
-
normalizationType = children;
|
3355 |
-
children = data;
|
3356 |
-
data = undefined;
|
3357 |
-
}
|
3358 |
-
if (isTrue(alwaysNormalize)) {
|
3359 |
-
normalizationType = ALWAYS_NORMALIZE;
|
3360 |
-
}
|
3361 |
-
return _createElement(context, tag, data, children, normalizationType)
|
3362 |
-
}
|
3363 |
-
|
3364 |
-
function _createElement (
|
3365 |
-
context,
|
3366 |
-
tag,
|
3367 |
-
data,
|
3368 |
-
children,
|
3369 |
-
normalizationType
|
3370 |
-
) {
|
3371 |
-
if (isDef(data) && isDef((data).__ob__)) {
|
3372 |
-
warn(
|
3373 |
-
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
3374 |
-
'Always create fresh vnode data objects in each render!',
|
3375 |
-
context
|
3376 |
-
);
|
3377 |
-
return createEmptyVNode()
|
3378 |
-
}
|
3379 |
-
// object syntax in v-bind
|
3380 |
-
if (isDef(data) && isDef(data.is)) {
|
3381 |
-
tag = data.is;
|
3382 |
-
}
|
3383 |
-
if (!tag) {
|
3384 |
-
// in case of component :is set to falsy value
|
3385 |
-
return createEmptyVNode()
|
3386 |
-
}
|
3387 |
-
// warn against non-primitive key
|
3388 |
-
if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
3389 |
-
) {
|
3390 |
-
{
|
3391 |
-
warn(
|
3392 |
-
'Avoid using non-primitive value as key, ' +
|
3393 |
-
'use string/number value instead.',
|
3394 |
-
context
|
3395 |
-
);
|
3396 |
-
}
|
3397 |
-
}
|
3398 |
-
// support single function children as default scoped slot
|
3399 |
-
if (Array.isArray(children) &&
|
3400 |
-
typeof children[0] === 'function'
|
3401 |
-
) {
|
3402 |
-
data = data || {};
|
3403 |
-
data.scopedSlots = { default: children[0] };
|
3404 |
-
children.length = 0;
|
3405 |
-
}
|
3406 |
-
if (normalizationType === ALWAYS_NORMALIZE) {
|
3407 |
-
children = normalizeChildren(children);
|
3408 |
-
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
3409 |
-
children = simpleNormalizeChildren(children);
|
3410 |
-
}
|
3411 |
-
var vnode, ns;
|
3412 |
-
if (typeof tag === 'string') {
|
3413 |
-
var Ctor;
|
3414 |
-
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
3415 |
-
if (config.isReservedTag(tag)) {
|
3416 |
-
// platform built-in elements
|
3417 |
-
vnode = new VNode(
|
3418 |
-
config.parsePlatformTagName(tag), data, children,
|
3419 |
-
undefined, undefined, context
|
3420 |
-
);
|
3421 |
-
} else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
3422 |
-
// component
|
3423 |
-
vnode = createComponent(Ctor, data, context, children, tag);
|
3424 |
-
} else {
|
3425 |
-
// unknown or unlisted namespaced elements
|
3426 |
-
// check at runtime because it may get assigned a namespace when its
|
3427 |
-
// parent normalizes children
|
3428 |
-
vnode = new VNode(
|
3429 |
-
tag, data, children,
|
3430 |
-
undefined, undefined, context
|
3431 |
-
);
|
3432 |
-
}
|
3433 |
-
} else {
|
3434 |
-
// direct component options / constructor
|
3435 |
-
vnode = createComponent(tag, data, context, children);
|
3436 |
-
}
|
3437 |
-
if (Array.isArray(vnode)) {
|
3438 |
-
return vnode
|
3439 |
-
} else if (isDef(vnode)) {
|
3440 |
-
if (isDef(ns)) { applyNS(vnode, ns); }
|
3441 |
-
if (isDef(data)) { registerDeepBindings(data); }
|
3442 |
-
return vnode
|
3443 |
-
} else {
|
3444 |
-
return createEmptyVNode()
|
3445 |
-
}
|
3446 |
-
}
|
3447 |
-
|
3448 |
-
function applyNS (vnode, ns, force) {
|
3449 |
-
vnode.ns = ns;
|
3450 |
-
if (vnode.tag === 'foreignObject') {
|
3451 |
-
// use default namespace inside foreignObject
|
3452 |
-
ns = undefined;
|
3453 |
-
force = true;
|
3454 |
-
}
|
3455 |
-
if (isDef(vnode.children)) {
|
3456 |
-
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
3457 |
-
var child = vnode.children[i];
|
3458 |
-
if (isDef(child.tag) && (
|
3459 |
-
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
3460 |
-
applyNS(child, ns, force);
|
3461 |
-
}
|
3462 |
-
}
|
3463 |
-
}
|
3464 |
-
}
|
3465 |
-
|
3466 |
-
// ref #5318
|
3467 |
-
// necessary to ensure parent re-render when deep bindings like :style and
|
3468 |
-
// :class are used on slot nodes
|
3469 |
-
function registerDeepBindings (data) {
|
3470 |
-
if (isObject(data.style)) {
|
3471 |
-
traverse(data.style);
|
3472 |
-
}
|
3473 |
-
if (isObject(data.class)) {
|
3474 |
-
traverse(data.class);
|
3475 |
-
}
|
3476 |
-
}
|
3477 |
-
|
3478 |
-
/* */
|
3479 |
-
|
3480 |
-
function initRender (vm) {
|
3481 |
-
vm._vnode = null; // the root of the child tree
|
3482 |
-
vm._staticTrees = null; // v-once cached trees
|
3483 |
-
var options = vm.$options;
|
3484 |
-
var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
|
3485 |
-
var renderContext = parentVnode && parentVnode.context;
|
3486 |
-
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
3487 |
-
vm.$scopedSlots = emptyObject;
|
3488 |
-
// bind the createElement fn to this instance
|
3489 |
-
// so that we get proper render context inside it.
|
3490 |
-
// args order: tag, data, children, normalizationType, alwaysNormalize
|
3491 |
-
// internal version is used by render functions compiled from templates
|
3492 |
-
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
3493 |
-
// normalization is always applied for the public version, used in
|
3494 |
-
// user-written render functions.
|
3495 |
-
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
3496 |
-
|
3497 |
-
// $attrs & $listeners are exposed for easier HOC creation.
|
3498 |
-
// they need to be reactive so that HOCs using them are always updated
|
3499 |
-
var parentData = parentVnode && parentVnode.data;
|
3500 |
-
|
3501 |
-
/* istanbul ignore else */
|
3502 |
-
{
|
3503 |
-
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
3504 |
-
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
3505 |
-
}, true);
|
3506 |
-
defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
3507 |
-
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
3508 |
-
}, true);
|
3509 |
-
}
|
3510 |
-
}
|
3511 |
-
|
3512 |
-
var currentRenderingInstance = null;
|
3513 |
-
|
3514 |
-
function renderMixin (Vue) {
|
3515 |
-
// install runtime convenience helpers
|
3516 |
-
installRenderHelpers(Vue.prototype);
|
3517 |
-
|
3518 |
-
Vue.prototype.$nextTick = function (fn) {
|
3519 |
-
return nextTick(fn, this)
|
3520 |
-
};
|
3521 |
-
|
3522 |
-
Vue.prototype._render = function () {
|
3523 |
-
var vm = this;
|
3524 |
-
var ref = vm.$options;
|
3525 |
-
var render = ref.render;
|
3526 |
-
var _parentVnode = ref._parentVnode;
|
3527 |
-
|
3528 |
-
if (_parentVnode) {
|
3529 |
-
vm.$scopedSlots = normalizeScopedSlots(
|
3530 |
-
_parentVnode.data.scopedSlots,
|
3531 |
-
vm.$slots,
|
3532 |
-
vm.$scopedSlots
|
3533 |
-
);
|
3534 |
-
}
|
3535 |
-
|
3536 |
-
// set parent vnode. this allows render functions to have access
|
3537 |
-
// to the data on the placeholder node.
|
3538 |
-
vm.$vnode = _parentVnode;
|
3539 |
-
// render self
|
3540 |
-
var vnode;
|
3541 |
-
try {
|
3542 |
-
// There's no need to maintain a stack becaues all render fns are called
|
3543 |
-
// separately from one another. Nested component's render fns are called
|
3544 |
-
// when parent component is patched.
|
3545 |
-
currentRenderingInstance = vm;
|
3546 |
-
vnode = render.call(vm._renderProxy, vm.$createElement);
|
3547 |
-
} catch (e) {
|
3548 |
-
handleError(e, vm, "render");
|
3549 |
-
// return error render result,
|
3550 |
-
// or previous vnode to prevent render error causing blank component
|
3551 |
-
/* istanbul ignore else */
|
3552 |
-
if (vm.$options.renderError) {
|
3553 |
-
try {
|
3554 |
-
vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
3555 |
-
} catch (e) {
|
3556 |
-
handleError(e, vm, "renderError");
|
3557 |
-
vnode = vm._vnode;
|
3558 |
-
}
|
3559 |
-
} else {
|
3560 |
-
vnode = vm._vnode;
|
3561 |
-
}
|
3562 |
-
} finally {
|
3563 |
-
currentRenderingInstance = null;
|
3564 |
-
}
|
3565 |
-
// if the returned array contains only a single node, allow it
|
3566 |
-
if (Array.isArray(vnode) && vnode.length === 1) {
|
3567 |
-
vnode = vnode[0];
|
3568 |
-
}
|
3569 |
-
// return empty vnode in case the render function errored out
|
3570 |
-
if (!(vnode instanceof VNode)) {
|
3571 |
-
if (Array.isArray(vnode)) {
|
3572 |
-
warn(
|
3573 |
-
'Multiple root nodes returned from render function. Render function ' +
|
3574 |
-
'should return a single root node.',
|
3575 |
-
vm
|
3576 |
-
);
|
3577 |
-
}
|
3578 |
-
vnode = createEmptyVNode();
|
3579 |
-
}
|
3580 |
-
// set parent
|
3581 |
-
vnode.parent = _parentVnode;
|
3582 |
-
return vnode
|
3583 |
-
};
|
3584 |
-
}
|
3585 |
-
|
3586 |
-
/* */
|
3587 |
-
|
3588 |
-
function ensureCtor (comp, base) {
|
3589 |
-
if (
|
3590 |
-
comp.__esModule ||
|
3591 |
-
(hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
3592 |
-
) {
|
3593 |
-
comp = comp.default;
|
3594 |
-
}
|
3595 |
-
return isObject(comp)
|
3596 |
-
? base.extend(comp)
|
3597 |
-
: comp
|
3598 |
-
}
|
3599 |
-
|
3600 |
-
function createAsyncPlaceholder (
|
3601 |
-
factory,
|
3602 |
-
data,
|
3603 |
-
context,
|
3604 |
-
children,
|
3605 |
-
tag
|
3606 |
-
) {
|
3607 |
-
var node = createEmptyVNode();
|
3608 |
-
node.asyncFactory = factory;
|
3609 |
-
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
3610 |
-
return node
|
3611 |
-
}
|
3612 |
-
|
3613 |
-
function resolveAsyncComponent (
|
3614 |
-
factory,
|
3615 |
-
baseCtor
|
3616 |
-
) {
|
3617 |
-
if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
3618 |
-
return factory.errorComp
|
3619 |
-
}
|
3620 |
-
|
3621 |
-
if (isDef(factory.resolved)) {
|
3622 |
-
return factory.resolved
|
3623 |
-
}
|
3624 |
-
|
3625 |
-
var owner = currentRenderingInstance;
|
3626 |
-
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
3627 |
-
// already pending
|
3628 |
-
factory.owners.push(owner);
|
3629 |
-
}
|
3630 |
-
|
3631 |
-
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
3632 |
-
return factory.loadingComp
|
3633 |
-
}
|
3634 |
-
|
3635 |
-
if (owner && !isDef(factory.owners)) {
|
3636 |
-
var owners = factory.owners = [owner];
|
3637 |
-
var sync = true;
|
3638 |
-
var timerLoading = null;
|
3639 |
-
var timerTimeout = null
|
3640 |
-
|
3641 |
-
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
3642 |
-
|
3643 |
-
var forceRender = function (renderCompleted) {
|
3644 |
-
for (var i = 0, l = owners.length; i < l; i++) {
|
3645 |
-
(owners[i]).$forceUpdate();
|
3646 |
-
}
|
3647 |
-
|
3648 |
-
if (renderCompleted) {
|
3649 |
-
owners.length = 0;
|
3650 |
-
if (timerLoading !== null) {
|
3651 |
-
clearTimeout(timerLoading);
|
3652 |
-
timerLoading = null;
|
3653 |
-
}
|
3654 |
-
if (timerTimeout !== null) {
|
3655 |
-
clearTimeout(timerTimeout);
|
3656 |
-
timerTimeout = null;
|
3657 |
-
}
|
3658 |
-
}
|
3659 |
-
};
|
3660 |
-
|
3661 |
-
var resolve = once(function (res) {
|
3662 |
-
// cache resolved
|
3663 |
-
factory.resolved = ensureCtor(res, baseCtor);
|
3664 |
-
// invoke callbacks only if this is not a synchronous resolve
|
3665 |
-
// (async resolves are shimmed as synchronous during SSR)
|
3666 |
-
if (!sync) {
|
3667 |
-
forceRender(true);
|
3668 |
-
} else {
|
3669 |
-
owners.length = 0;
|
3670 |
-
}
|
3671 |
-
});
|
3672 |
-
|
3673 |
-
var reject = once(function (reason) {
|
3674 |
-
warn(
|
3675 |
-
"Failed to resolve async component: " + (String(factory)) +
|
3676 |
-
(reason ? ("\nReason: " + reason) : '')
|
3677 |
-
);
|
3678 |
-
if (isDef(factory.errorComp)) {
|
3679 |
-
factory.error = true;
|
3680 |
-
forceRender(true);
|
3681 |
-
}
|
3682 |
-
});
|
3683 |
-
|
3684 |
-
var res = factory(resolve, reject);
|
3685 |
-
|
3686 |
-
if (isObject(res)) {
|
3687 |
-
if (isPromise(res)) {
|
3688 |
-
// () => Promise
|
3689 |
-
if (isUndef(factory.resolved)) {
|
3690 |
-
res.then(resolve, reject);
|
3691 |
-
}
|
3692 |
-
} else if (isPromise(res.component)) {
|
3693 |
-
res.component.then(resolve, reject);
|
3694 |
-
|
3695 |
-
if (isDef(res.error)) {
|
3696 |
-
factory.errorComp = ensureCtor(res.error, baseCtor);
|
3697 |
-
}
|
3698 |
-
|
3699 |
-
if (isDef(res.loading)) {
|
3700 |
-
factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
3701 |
-
if (res.delay === 0) {
|
3702 |
-
factory.loading = true;
|
3703 |
-
} else {
|
3704 |
-
timerLoading = setTimeout(function () {
|
3705 |
-
timerLoading = null;
|
3706 |
-
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
3707 |
-
factory.loading = true;
|
3708 |
-
forceRender(false);
|
3709 |
-
}
|
3710 |
-
}, res.delay || 200);
|
3711 |
-
}
|
3712 |
-
}
|
3713 |
-
|
3714 |
-
if (isDef(res.timeout)) {
|
3715 |
-
timerTimeout = setTimeout(function () {
|
3716 |
-
timerTimeout = null;
|
3717 |
-
if (isUndef(factory.resolved)) {
|
3718 |
-
reject(
|
3719 |
-
"timeout (" + (res.timeout) + "ms)"
|
3720 |
-
);
|
3721 |
-
}
|
3722 |
-
}, res.timeout);
|
3723 |
-
}
|
3724 |
-
}
|
3725 |
-
}
|
3726 |
-
|
3727 |
-
sync = false;
|
3728 |
-
// return in case resolved synchronously
|
3729 |
-
return factory.loading
|
3730 |
-
? factory.loadingComp
|
3731 |
-
: factory.resolved
|
3732 |
-
}
|
3733 |
-
}
|
3734 |
-
|
3735 |
-
/* */
|
3736 |
-
|
3737 |
-
function isAsyncPlaceholder (node) {
|
3738 |
-
return node.isComment && node.asyncFactory
|
3739 |
-
}
|
3740 |
-
|
3741 |
-
/* */
|
3742 |
-
|
3743 |
-
function getFirstComponentChild (children) {
|
3744 |
-
if (Array.isArray(children)) {
|
3745 |
-
for (var i = 0; i < children.length; i++) {
|
3746 |
-
var c = children[i];
|
3747 |
-
if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
3748 |
-
return c
|
3749 |
-
}
|
3750 |
-
}
|
3751 |
-
}
|
3752 |
-
}
|
3753 |
-
|
3754 |
-
/* */
|
3755 |
-
|
3756 |
-
/* */
|
3757 |
-
|
3758 |
-
function initEvents (vm) {
|
3759 |
-
vm._events = Object.create(null);
|
3760 |
-
vm._hasHookEvent = false;
|
3761 |
-
// init parent attached events
|
3762 |
-
var listeners = vm.$options._parentListeners;
|
3763 |
-
if (listeners) {
|
3764 |
-
updateComponentListeners(vm, listeners);
|
3765 |
-
}
|
3766 |
-
}
|
3767 |
-
|
3768 |
-
var target;
|
3769 |
-
|
3770 |
-
function add (event, fn) {
|
3771 |
-
target.$on(event, fn);
|
3772 |
-
}
|
3773 |
-
|
3774 |
-
function remove$1 (event, fn) {
|
3775 |
-
target.$off(event, fn);
|
3776 |
-
}
|
3777 |
-
|
3778 |
-
function createOnceHandler (event, fn) {
|
3779 |
-
var _target = target;
|
3780 |
-
return function onceHandler () {
|
3781 |
-
var res = fn.apply(null, arguments);
|
3782 |
-
if (res !== null) {
|
3783 |
-
_target.$off(event, onceHandler);
|
3784 |
-
}
|
3785 |
-
}
|
3786 |
-
}
|
3787 |
-
|
3788 |
-
function updateComponentListeners (
|
3789 |
-
vm,
|
3790 |
-
listeners,
|
3791 |
-
oldListeners
|
3792 |
-
) {
|
3793 |
-
target = vm;
|
3794 |
-
updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
3795 |
-
target = undefined;
|
3796 |
-
}
|
3797 |
-
|
3798 |
-
function eventsMixin (Vue) {
|
3799 |
-
var hookRE = /^hook:/;
|
3800 |
-
Vue.prototype.$on = function (event, fn) {
|
3801 |
-
var vm = this;
|
3802 |
-
if (Array.isArray(event)) {
|
3803 |
-
for (var i = 0, l = event.length; i < l; i++) {
|
3804 |
-
vm.$on(event[i], fn);
|
3805 |
-
}
|
3806 |
-
} else {
|
3807 |
-
(vm._events[event] || (vm._events[event] = [])).push(fn);
|
3808 |
-
// optimize hook:event cost by using a boolean flag marked at registration
|
3809 |
-
// instead of a hash lookup
|
3810 |
-
if (hookRE.test(event)) {
|
3811 |
-
vm._hasHookEvent = true;
|
3812 |
-
}
|
3813 |
-
}
|
3814 |
-
return vm
|
3815 |
-
};
|
3816 |
-
|
3817 |
-
Vue.prototype.$once = function (event, fn) {
|
3818 |
-
var vm = this;
|
3819 |
-
function on () {
|
3820 |
-
vm.$off(event, on);
|
3821 |
-
fn.apply(vm, arguments);
|
3822 |
-
}
|
3823 |
-
on.fn = fn;
|
3824 |
-
vm.$on(event, on);
|
3825 |
-
return vm
|
3826 |
-
};
|
3827 |
-
|
3828 |
-
Vue.prototype.$off = function (event, fn) {
|
3829 |
-
var vm = this;
|
3830 |
-
// all
|
3831 |
-
if (!arguments.length) {
|
3832 |
-
vm._events = Object.create(null);
|
3833 |
-
return vm
|
3834 |
-
}
|
3835 |
-
// array of events
|
3836 |
-
if (Array.isArray(event)) {
|
3837 |
-
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
3838 |
-
vm.$off(event[i$1], fn);
|
3839 |
-
}
|
3840 |
-
return vm
|
3841 |
-
}
|
3842 |
-
// specific event
|
3843 |
-
var cbs = vm._events[event];
|
3844 |
-
if (!cbs) {
|
3845 |
-
return vm
|
3846 |
-
}
|
3847 |
-
if (!fn) {
|
3848 |
-
vm._events[event] = null;
|
3849 |
-
return vm
|
3850 |
-
}
|
3851 |
-
// specific handler
|
3852 |
-
var cb;
|
3853 |
-
var i = cbs.length;
|
3854 |
-
while (i--) {
|
3855 |
-
cb = cbs[i];
|
3856 |
-
if (cb === fn || cb.fn === fn) {
|
3857 |
-
cbs.splice(i, 1);
|
3858 |
-
break
|
3859 |
-
}
|
3860 |
-
}
|
3861 |
-
return vm
|
3862 |
-
};
|
3863 |
-
|
3864 |
-
Vue.prototype.$emit = function (event) {
|
3865 |
-
var vm = this;
|
3866 |
-
{
|
3867 |
-
var lowerCaseEvent = event.toLowerCase();
|
3868 |
-
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
3869 |
-
tip(
|
3870 |
-
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
3871 |
-
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
3872 |
-
"Note that HTML attributes are case-insensitive and you cannot use " +
|
3873 |
-
"v-on to listen to camelCase events when using in-DOM templates. " +
|
3874 |
-
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
3875 |
-
);
|
3876 |
-
}
|
3877 |
-
}
|
3878 |
-
var cbs = vm._events[event];
|
3879 |
-
if (cbs) {
|
3880 |
-
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
3881 |
-
var args = toArray(arguments, 1);
|
3882 |
-
var info = "event handler for \"" + event + "\"";
|
3883 |
-
for (var i = 0, l = cbs.length; i < l; i++) {
|
3884 |
-
invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
3885 |
-
}
|
3886 |
-
}
|
3887 |
-
return vm
|
3888 |
-
};
|
3889 |
-
}
|
3890 |
-
|
3891 |
-
/* */
|
3892 |
-
|
3893 |
-
var activeInstance = null;
|
3894 |
-
var isUpdatingChildComponent = false;
|
3895 |
-
|
3896 |
-
function setActiveInstance(vm) {
|
3897 |
-
var prevActiveInstance = activeInstance;
|
3898 |
-
activeInstance = vm;
|
3899 |
-
return function () {
|
3900 |
-
activeInstance = prevActiveInstance;
|
3901 |
-
}
|
3902 |
-
}
|
3903 |
-
|
3904 |
-
function initLifecycle (vm) {
|
3905 |
-
var options = vm.$options;
|
3906 |
-
|
3907 |
-
// locate first non-abstract parent
|
3908 |
-
var parent = options.parent;
|
3909 |
-
if (parent && !options.abstract) {
|
3910 |
-
while (parent.$options.abstract && parent.$parent) {
|
3911 |
-
parent = parent.$parent;
|
3912 |
-
}
|
3913 |
-
parent.$children.push(vm);
|
3914 |
-
}
|
3915 |
-
|
3916 |
-
vm.$parent = parent;
|
3917 |
-
vm.$root = parent ? parent.$root : vm;
|
3918 |
-
|
3919 |
-
vm.$children = [];
|
3920 |
-
vm.$refs = {};
|
3921 |
-
|
3922 |
-
vm._watcher = null;
|
3923 |
-
vm._inactive = null;
|
3924 |
-
vm._directInactive = false;
|
3925 |
-
vm._isMounted = false;
|
3926 |
-
vm._isDestroyed = false;
|
3927 |
-
vm._isBeingDestroyed = false;
|
3928 |
-
}
|
3929 |
-
|
3930 |
-
function lifecycleMixin (Vue) {
|
3931 |
-
Vue.prototype._update = function (vnode, hydrating) {
|
3932 |
-
var vm = this;
|
3933 |
-
var prevEl = vm.$el;
|
3934 |
-
var prevVnode = vm._vnode;
|
3935 |
-
var restoreActiveInstance = setActiveInstance(vm);
|
3936 |
-
vm._vnode = vnode;
|
3937 |
-
// Vue.prototype.__patch__ is injected in entry points
|
3938 |
-
// based on the rendering backend used.
|
3939 |
-
if (!prevVnode) {
|
3940 |
-
// initial render
|
3941 |
-
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
3942 |
-
} else {
|
3943 |
-
// updates
|
3944 |
-
vm.$el = vm.__patch__(prevVnode, vnode);
|
3945 |
-
}
|
3946 |
-
restoreActiveInstance();
|
3947 |
-
// update __vue__ reference
|
3948 |
-
if (prevEl) {
|
3949 |
-
prevEl.__vue__ = null;
|
3950 |
-
}
|
3951 |
-
if (vm.$el) {
|
3952 |
-
vm.$el.__vue__ = vm;
|
3953 |
-
}
|
3954 |
-
// if parent is an HOC, update its $el as well
|
3955 |
-
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
3956 |
-
vm.$parent.$el = vm.$el;
|
3957 |
-
}
|
3958 |
-
// updated hook is called by the scheduler to ensure that children are
|
3959 |
-
// updated in a parent's updated hook.
|
3960 |
-
};
|
3961 |
-
|
3962 |
-
Vue.prototype.$forceUpdate = function () {
|
3963 |
-
var vm = this;
|
3964 |
-
if (vm._watcher) {
|
3965 |
-
vm._watcher.update();
|
3966 |
-
}
|
3967 |
-
};
|
3968 |
-
|
3969 |
-
Vue.prototype.$destroy = function () {
|
3970 |
-
var vm = this;
|
3971 |
-
if (vm._isBeingDestroyed) {
|
3972 |
-
return
|
3973 |
-
}
|
3974 |
-
callHook(vm, 'beforeDestroy');
|
3975 |
-
vm._isBeingDestroyed = true;
|
3976 |
-
// remove self from parent
|
3977 |
-
var parent = vm.$parent;
|
3978 |
-
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
3979 |
-
remove(parent.$children, vm);
|
3980 |
-
}
|
3981 |
-
// teardown watchers
|
3982 |
-
if (vm._watcher) {
|
3983 |
-
vm._watcher.teardown();
|
3984 |
-
}
|
3985 |
-
var i = vm._watchers.length;
|
3986 |
-
while (i--) {
|
3987 |
-
vm._watchers[i].teardown();
|
3988 |
-
}
|
3989 |
-
// remove reference from data ob
|
3990 |
-
// frozen object may not have observer.
|
3991 |
-
if (vm._data.__ob__) {
|
3992 |
-
vm._data.__ob__.vmCount--;
|
3993 |
-
}
|
3994 |
-
// call the last hook...
|
3995 |
-
vm._isDestroyed = true;
|
3996 |
-
// invoke destroy hooks on current rendered tree
|
3997 |
-
vm.__patch__(vm._vnode, null);
|
3998 |
-
// fire destroyed hook
|
3999 |
-
callHook(vm, 'destroyed');
|
4000 |
-
// turn off all instance listeners.
|
4001 |
-
vm.$off();
|
4002 |
-
// remove __vue__ reference
|
4003 |
-
if (vm.$el) {
|
4004 |
-
vm.$el.__vue__ = null;
|
4005 |
-
}
|
4006 |
-
// release circular reference (#6759)
|
4007 |
-
if (vm.$vnode) {
|
4008 |
-
vm.$vnode.parent = null;
|
4009 |
-
}
|
4010 |
-
};
|
4011 |
-
}
|
4012 |
-
|
4013 |
-
function mountComponent (
|
4014 |
-
vm,
|
4015 |
-
el,
|
4016 |
-
hydrating
|
4017 |
-
) {
|
4018 |
-
vm.$el = el;
|
4019 |
-
if (!vm.$options.render) {
|
4020 |
-
vm.$options.render = createEmptyVNode;
|
4021 |
-
{
|
4022 |
-
/* istanbul ignore if */
|
4023 |
-
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
4024 |
-
vm.$options.el || el) {
|
4025 |
-
warn(
|
4026 |
-
'You are using the runtime-only build of Vue where the template ' +
|
4027 |
-
'compiler is not available. Either pre-compile the templates into ' +
|
4028 |
-
'render functions, or use the compiler-included build.',
|
4029 |
-
vm
|
4030 |
-
);
|
4031 |
-
} else {
|
4032 |
-
warn(
|
4033 |
-
'Failed to mount component: template or render function not defined.',
|
4034 |
-
vm
|
4035 |
-
);
|
4036 |
-
}
|
4037 |
-
}
|
4038 |
-
}
|
4039 |
-
callHook(vm, 'beforeMount');
|
4040 |
-
|
4041 |
-
var updateComponent;
|
4042 |
-
/* istanbul ignore if */
|
4043 |
-
if (config.performance && mark) {
|
4044 |
-
updateComponent = function () {
|
4045 |
-
var name = vm._name;
|
4046 |
-
var id = vm._uid;
|
4047 |
-
var startTag = "vue-perf-start:" + id;
|
4048 |
-
var endTag = "vue-perf-end:" + id;
|
4049 |
-
|
4050 |
-
mark(startTag);
|
4051 |
-
var vnode = vm._render();
|
4052 |
-
mark(endTag);
|
4053 |
-
measure(("vue " + name + " render"), startTag, endTag);
|
4054 |
-
|
4055 |
-
mark(startTag);
|
4056 |
-
vm._update(vnode, hydrating);
|
4057 |
-
mark(endTag);
|
4058 |
-
measure(("vue " + name + " patch"), startTag, endTag);
|
4059 |
-
};
|
4060 |
-
} else {
|
4061 |
-
updateComponent = function () {
|
4062 |
-
vm._update(vm._render(), hydrating);
|
4063 |
-
};
|
4064 |
-
}
|
4065 |
-
|
4066 |
-
// we set this to vm._watcher inside the watcher's constructor
|
4067 |
-
// since the watcher's initial patch may call $forceUpdate (e.g. inside child
|
4068 |
-
// component's mounted hook), which relies on vm._watcher being already defined
|
4069 |
-
new Watcher(vm, updateComponent, noop, {
|
4070 |
-
before: function before () {
|
4071 |
-
if (vm._isMounted && !vm._isDestroyed) {
|
4072 |
-
callHook(vm, 'beforeUpdate');
|
4073 |
-
}
|
4074 |
-
}
|
4075 |
-
}, true /* isRenderWatcher */);
|
4076 |
-
hydrating = false;
|
4077 |
-
|
4078 |
-
// manually mounted instance, call mounted on self
|
4079 |
-
// mounted is called for render-created child components in its inserted hook
|
4080 |
-
if (vm.$vnode == null) {
|
4081 |
-
vm._isMounted = true;
|
4082 |
-
callHook(vm, 'mounted');
|
4083 |
-
}
|
4084 |
-
return vm
|
4085 |
-
}
|
4086 |
-
|
4087 |
-
function updateChildComponent (
|
4088 |
-
vm,
|
4089 |
-
propsData,
|
4090 |
-
listeners,
|
4091 |
-
parentVnode,
|
4092 |
-
renderChildren
|
4093 |
-
) {
|
4094 |
-
{
|
4095 |
-
isUpdatingChildComponent = true;
|
4096 |
-
}
|
4097 |
-
|
4098 |
-
// determine whether component has slot children
|
4099 |
-
// we need to do this before overwriting $options._renderChildren.
|
4100 |
-
|
4101 |
-
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
4102 |
-
// dynamic slot names). Static scoped slots compiled from template has the
|
4103 |
-
// "$stable" marker.
|
4104 |
-
var newScopedSlots = parentVnode.data.scopedSlots;
|
4105 |
-
var oldScopedSlots = vm.$scopedSlots;
|
4106 |
-
var hasDynamicScopedSlot = !!(
|
4107 |
-
(newScopedSlots && !newScopedSlots.$stable) ||
|
4108 |
-
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
4109 |
-
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
4110 |
-
);
|
4111 |
-
|
4112 |
-
// Any static slot children from the parent may have changed during parent's
|
4113 |
-
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
4114 |
-
// update is necessary to ensure correctness.
|
4115 |
-
var needsForceUpdate = !!(
|
4116 |
-
renderChildren || // has new static slots
|
4117 |
-
vm.$options._renderChildren || // has old static slots
|
4118 |
-
hasDynamicScopedSlot
|
4119 |
-
);
|
4120 |
-
|
4121 |
-
vm.$options._parentVnode = parentVnode;
|
4122 |
-
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
4123 |
-
|
4124 |
-
if (vm._vnode) { // update child tree's parent
|
4125 |
-
vm._vnode.parent = parentVnode;
|
4126 |
-
}
|
4127 |
-
vm.$options._renderChildren = renderChildren;
|
4128 |
-
|
4129 |
-
// update $attrs and $listeners hash
|
4130 |
-
// these are also reactive so they may trigger child update if the child
|
4131 |
-
// used them during render
|
4132 |
-
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
4133 |
-
vm.$listeners = listeners || emptyObject;
|
4134 |
-
|
4135 |
-
// update props
|
4136 |
-
if (propsData && vm.$options.props) {
|
4137 |
-
toggleObserving(false);
|
4138 |
-
var props = vm._props;
|
4139 |
-
var propKeys = vm.$options._propKeys || [];
|
4140 |
-
for (var i = 0; i < propKeys.length; i++) {
|
4141 |
-
var key = propKeys[i];
|
4142 |
-
var propOptions = vm.$options.props; // wtf flow?
|
4143 |
-
props[key] = validateProp(key, propOptions, propsData, vm);
|
4144 |
-
}
|
4145 |
-
toggleObserving(true);
|
4146 |
-
// keep a copy of raw propsData
|
4147 |
-
vm.$options.propsData = propsData;
|
4148 |
-
}
|
4149 |
-
|
4150 |
-
// update listeners
|
4151 |
-
listeners = listeners || emptyObject;
|
4152 |
-
var oldListeners = vm.$options._parentListeners;
|
4153 |
-
vm.$options._parentListeners = listeners;
|
4154 |
-
updateComponentListeners(vm, listeners, oldListeners);
|
4155 |
-
|
4156 |
-
// resolve slots + force update if has children
|
4157 |
-
if (needsForceUpdate) {
|
4158 |
-
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
4159 |
-
vm.$forceUpdate();
|
4160 |
-
}
|
4161 |
-
|
4162 |
-
{
|
4163 |
-
isUpdatingChildComponent = false;
|
4164 |
-
}
|
4165 |
-
}
|
4166 |
-
|
4167 |
-
function isInInactiveTree (vm) {
|
4168 |
-
while (vm && (vm = vm.$parent)) {
|
4169 |
-
if (vm._inactive) { return true }
|
4170 |
-
}
|
4171 |
-
return false
|
4172 |
-
}
|
4173 |
-
|
4174 |
-
function activateChildComponent (vm, direct) {
|
4175 |
-
if (direct) {
|
4176 |
-
vm._directInactive = false;
|
4177 |
-
if (isInInactiveTree(vm)) {
|
4178 |
-
return
|
4179 |
-
}
|
4180 |
-
} else if (vm._directInactive) {
|
4181 |
-
return
|
4182 |
-
}
|
4183 |
-
if (vm._inactive || vm._inactive === null) {
|
4184 |
-
vm._inactive = false;
|
4185 |
-
for (var i = 0; i < vm.$children.length; i++) {
|
4186 |
-
activateChildComponent(vm.$children[i]);
|
4187 |
-
}
|
4188 |
-
callHook(vm, 'activated');
|
4189 |
-
}
|
4190 |
-
}
|
4191 |
-
|
4192 |
-
function deactivateChildComponent (vm, direct) {
|
4193 |
-
if (direct) {
|
4194 |
-
vm._directInactive = true;
|
4195 |
-
if (isInInactiveTree(vm)) {
|
4196 |
-
return
|
4197 |
-
}
|
4198 |
-
}
|
4199 |
-
if (!vm._inactive) {
|
4200 |
-
vm._inactive = true;
|
4201 |
-
for (var i = 0; i < vm.$children.length; i++) {
|
4202 |
-
deactivateChildComponent(vm.$children[i]);
|
4203 |
-
}
|
4204 |
-
callHook(vm, 'deactivated');
|
4205 |
-
}
|
4206 |
-
}
|
4207 |
-
|
4208 |
-
function callHook (vm, hook) {
|
4209 |
-
// #7573 disable dep collection when invoking lifecycle hooks
|
4210 |
-
pushTarget();
|
4211 |
-
var handlers = vm.$options[hook];
|
4212 |
-
var info = hook + " hook";
|
4213 |
-
if (handlers) {
|
4214 |
-
for (var i = 0, j = handlers.length; i < j; i++) {
|
4215 |
-
invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
4216 |
-
}
|
4217 |
-
}
|
4218 |
-
if (vm._hasHookEvent) {
|
4219 |
-
vm.$emit('hook:' + hook);
|
4220 |
-
}
|
4221 |
-
popTarget();
|
4222 |
-
}
|
4223 |
-
|
4224 |
-
/* */
|
4225 |
-
|
4226 |
-
var MAX_UPDATE_COUNT = 100;
|
4227 |
-
|
4228 |
-
var queue = [];
|
4229 |
-
var activatedChildren = [];
|
4230 |
-
var has = {};
|
4231 |
-
var circular = {};
|
4232 |
-
var waiting = false;
|
4233 |
-
var flushing = false;
|
4234 |
-
var index = 0;
|
4235 |
-
|
4236 |
-
/**
|
4237 |
-
* Reset the scheduler's state.
|
4238 |
-
*/
|
4239 |
-
function resetSchedulerState () {
|
4240 |
-
index = queue.length = activatedChildren.length = 0;
|
4241 |
-
has = {};
|
4242 |
-
{
|
4243 |
-
circular = {};
|
4244 |
-
}
|
4245 |
-
waiting = flushing = false;
|
4246 |
-
}
|
4247 |
-
|
4248 |
-
// Async edge case #6566 requires saving the timestamp when event listeners are
|
4249 |
-
// attached. However, calling performance.now() has a perf overhead especially
|
4250 |
-
// if the page has thousands of event listeners. Instead, we take a timestamp
|
4251 |
-
// every time the scheduler flushes and use that for all event listeners
|
4252 |
-
// attached during that flush.
|
4253 |
-
var currentFlushTimestamp = 0;
|
4254 |
-
|
4255 |
-
// Async edge case fix requires storing an event listener's attach timestamp.
|
4256 |
-
var getNow = Date.now;
|
4257 |
-
|
4258 |
-
// Determine what event timestamp the browser is using. Annoyingly, the
|
4259 |
-
// timestamp can either be hi-res (relative to page load) or low-res
|
4260 |
-
// (relative to UNIX epoch), so in order to compare time we have to use the
|
4261 |
-
// same timestamp type when saving the flush timestamp.
|
4262 |
-
// All IE versions use low-res event timestamps, and have problematic clock
|
4263 |
-
// implementations (#9632)
|
4264 |
-
if (inBrowser && !isIE) {
|
4265 |
-
var performance = window.performance;
|
4266 |
-
if (
|
4267 |
-
performance &&
|
4268 |
-
typeof performance.now === 'function' &&
|
4269 |
-
getNow() > document.createEvent('Event').timeStamp
|
4270 |
-
) {
|
4271 |
-
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
4272 |
-
// smaller than it, it means the event is using a hi-res timestamp,
|
4273 |
-
// and we need to use the hi-res version for event listener timestamps as
|
4274 |
-
// well.
|
4275 |
-
getNow = function () { return performance.now(); };
|
4276 |
-
}
|
4277 |
-
}
|
4278 |
-
|
4279 |
-
/**
|
4280 |
-
* Flush both queues and run the watchers.
|
4281 |
-
*/
|
4282 |
-
function flushSchedulerQueue () {
|
4283 |
-
currentFlushTimestamp = getNow();
|
4284 |
-
flushing = true;
|
4285 |
-
var watcher, id;
|
4286 |
-
|
4287 |
-
// Sort queue before flush.
|
4288 |
-
// This ensures that:
|
4289 |
-
// 1. Components are updated from parent to child. (because parent is always
|
4290 |
-
// created before the child)
|
4291 |
-
// 2. A component's user watchers are run before its render watcher (because
|
4292 |
-
// user watchers are created before the render watcher)
|
4293 |
-
// 3. If a component is destroyed during a parent component's watcher run,
|
4294 |
-
// its watchers can be skipped.
|
4295 |
-
queue.sort(function (a, b) { return a.id - b.id; });
|
4296 |
-
|
4297 |
-
// do not cache length because more watchers might be pushed
|
4298 |
-
// as we run existing watchers
|
4299 |
-
for (index = 0; index < queue.length; index++) {
|
4300 |
-
watcher = queue[index];
|
4301 |
-
if (watcher.before) {
|
4302 |
-
watcher.before();
|
4303 |
-
}
|
4304 |
-
id = watcher.id;
|
4305 |
-
has[id] = null;
|
4306 |
-
watcher.run();
|
4307 |
-
// in dev build, check and stop circular updates.
|
4308 |
-
if (has[id] != null) {
|
4309 |
-
circular[id] = (circular[id] || 0) + 1;
|
4310 |
-
if (circular[id] > MAX_UPDATE_COUNT) {
|
4311 |
-
warn(
|
4312 |
-
'You may have an infinite update loop ' + (
|
4313 |
-
watcher.user
|
4314 |
-
? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
4315 |
-
: "in a component render function."
|
4316 |
-
),
|
4317 |
-
watcher.vm
|
4318 |
-
);
|
4319 |
-
break
|
4320 |
-
}
|
4321 |
-
}
|
4322 |
-
}
|
4323 |
-
|
4324 |
-
// keep copies of post queues before resetting state
|
4325 |
-
var activatedQueue = activatedChildren.slice();
|
4326 |
-
var updatedQueue = queue.slice();
|
4327 |
-
|
4328 |
-
resetSchedulerState();
|
4329 |
-
|
4330 |
-
// call component updated and activated hooks
|
4331 |
-
callActivatedHooks(activatedQueue);
|
4332 |
-
callUpdatedHooks(updatedQueue);
|
4333 |
-
|
4334 |
-
// devtool hook
|
4335 |
-
/* istanbul ignore if */
|
4336 |
-
if (devtools && config.devtools) {
|
4337 |
-
devtools.emit('flush');
|
4338 |
-
}
|
4339 |
-
}
|
4340 |
-
|
4341 |
-
function callUpdatedHooks (queue) {
|
4342 |
-
var i = queue.length;
|
4343 |
-
while (i--) {
|
4344 |
-
var watcher = queue[i];
|
4345 |
-
var vm = watcher.vm;
|
4346 |
-
if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
4347 |
-
callHook(vm, 'updated');
|
4348 |
-
}
|
4349 |
-
}
|
4350 |
-
}
|
4351 |
-
|
4352 |
-
/**
|
4353 |
-
* Queue a kept-alive component that was activated during patch.
|
4354 |
-
* The queue will be processed after the entire tree has been patched.
|
4355 |
-
*/
|
4356 |
-
function queueActivatedComponent (vm) {
|
4357 |
-
// setting _inactive to false here so that a render function can
|
4358 |
-
// rely on checking whether it's in an inactive tree (e.g. router-view)
|
4359 |
-
vm._inactive = false;
|
4360 |
-
activatedChildren.push(vm);
|
4361 |
-
}
|
4362 |
-
|
4363 |
-
function callActivatedHooks (queue) {
|
4364 |
-
for (var i = 0; i < queue.length; i++) {
|
4365 |
-
queue[i]._inactive = true;
|
4366 |
-
activateChildComponent(queue[i], true /* true */);
|
4367 |
-
}
|
4368 |
-
}
|
4369 |
-
|
4370 |
-
/**
|
4371 |
-
* Push a watcher into the watcher queue.
|
4372 |
-
* Jobs with duplicate IDs will be skipped unless it's
|
4373 |
-
* pushed when the queue is being flushed.
|
4374 |
-
*/
|
4375 |
-
function queueWatcher (watcher) {
|
4376 |
-
var id = watcher.id;
|
4377 |
-
if (has[id] == null) {
|
4378 |
-
has[id] = true;
|
4379 |
-
if (!flushing) {
|
4380 |
-
queue.push(watcher);
|
4381 |
-
} else {
|
4382 |
-
// if already flushing, splice the watcher based on its id
|
4383 |
-
// if already past its id, it will be run next immediately.
|
4384 |
-
var i = queue.length - 1;
|
4385 |
-
while (i > index && queue[i].id > watcher.id) {
|
4386 |
-
i--;
|
4387 |
-
}
|
4388 |
-
queue.splice(i + 1, 0, watcher);
|
4389 |
-
}
|
4390 |
-
// queue the flush
|
4391 |
-
if (!waiting) {
|
4392 |
-
waiting = true;
|
4393 |
-
|
4394 |
-
if (!config.async) {
|
4395 |
-
flushSchedulerQueue();
|
4396 |
-
return
|
4397 |
-
}
|
4398 |
-
nextTick(flushSchedulerQueue);
|
4399 |
-
}
|
4400 |
-
}
|
4401 |
-
}
|
4402 |
-
|
4403 |
-
/* */
|
4404 |
-
|
4405 |
-
|
4406 |
-
|
4407 |
-
var uid$2 = 0;
|
4408 |
-
|
4409 |
-
/**
|
4410 |
-
* A watcher parses an expression, collects dependencies,
|
4411 |
-
* and fires callback when the expression value changes.
|
4412 |
-
* This is used for both the $watch() api and directives.
|
4413 |
-
*/
|
4414 |
-
var Watcher = function Watcher (
|
4415 |
-
vm,
|
4416 |
-
expOrFn,
|
4417 |
-
cb,
|
4418 |
-
options,
|
4419 |
-
isRenderWatcher
|
4420 |
-
) {
|
4421 |
-
this.vm = vm;
|
4422 |
-
if (isRenderWatcher) {
|
4423 |
-
vm._watcher = this;
|
4424 |
-
}
|
4425 |
-
vm._watchers.push(this);
|
4426 |
-
// options
|
4427 |
-
if (options) {
|
4428 |
-
this.deep = !!options.deep;
|
4429 |
-
this.user = !!options.user;
|
4430 |
-
this.lazy = !!options.lazy;
|
4431 |
-
this.sync = !!options.sync;
|
4432 |
-
this.before = options.before;
|
4433 |
-
} else {
|
4434 |
-
this.deep = this.user = this.lazy = this.sync = false;
|
4435 |
-
}
|
4436 |
-
this.cb = cb;
|
4437 |
-
this.id = ++uid$2; // uid for batching
|
4438 |
-
this.active = true;
|
4439 |
-
this.dirty = this.lazy; // for lazy watchers
|
4440 |
-
this.deps = [];
|
4441 |
-
this.newDeps = [];
|
4442 |
-
this.depIds = new _Set();
|
4443 |
-
this.newDepIds = new _Set();
|
4444 |
-
this.expression = expOrFn.toString();
|
4445 |
-
// parse expression for getter
|
4446 |
-
if (typeof expOrFn === 'function') {
|
4447 |
-
this.getter = expOrFn;
|
4448 |
-
} else {
|
4449 |
-
this.getter = parsePath(expOrFn);
|
4450 |
-
if (!this.getter) {
|
4451 |
-
this.getter = noop;
|
4452 |
-
warn(
|
4453 |
-
"Failed watching path: \"" + expOrFn + "\" " +
|
4454 |
-
'Watcher only accepts simple dot-delimited paths. ' +
|
4455 |
-
'For full control, use a function instead.',
|
4456 |
-
vm
|
4457 |
-
);
|
4458 |
-
}
|
4459 |
-
}
|
4460 |
-
this.value = this.lazy
|
4461 |
-
? undefined
|
4462 |
-
: this.get();
|
4463 |
-
};
|
4464 |
-
|
4465 |
-
/**
|
4466 |
-
* Evaluate the getter, and re-collect dependencies.
|
4467 |
-
*/
|
4468 |
-
Watcher.prototype.get = function get () {
|
4469 |
-
pushTarget(this);
|
4470 |
-
var value;
|
4471 |
-
var vm = this.vm;
|
4472 |
-
try {
|
4473 |
-
value = this.getter.call(vm, vm);
|
4474 |
-
} catch (e) {
|
4475 |
-
if (this.user) {
|
4476 |
-
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
4477 |
-
} else {
|
4478 |
-
throw e
|
4479 |
-
}
|
4480 |
-
} finally {
|
4481 |
-
// "touch" every property so they are all tracked as
|
4482 |
-
// dependencies for deep watching
|
4483 |
-
if (this.deep) {
|
4484 |
-
traverse(value);
|
4485 |
-
}
|
4486 |
-
popTarget();
|
4487 |
-
this.cleanupDeps();
|
4488 |
-
}
|
4489 |
-
return value
|
4490 |
-
};
|
4491 |
-
|
4492 |
-
/**
|
4493 |
-
* Add a dependency to this directive.
|
4494 |
-
*/
|
4495 |
-
Watcher.prototype.addDep = function addDep (dep) {
|
4496 |
-
var id = dep.id;
|
4497 |
-
if (!this.newDepIds.has(id)) {
|
4498 |
-
this.newDepIds.add(id);
|
4499 |
-
this.newDeps.push(dep);
|
4500 |
-
if (!this.depIds.has(id)) {
|
4501 |
-
dep.addSub(this);
|
4502 |
-
}
|
4503 |
-
}
|
4504 |
-
};
|
4505 |
-
|
4506 |
-
/**
|
4507 |
-
* Clean up for dependency collection.
|
4508 |
-
*/
|
4509 |
-
Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
4510 |
-
var i = this.deps.length;
|
4511 |
-
while (i--) {
|
4512 |
-
var dep = this.deps[i];
|
4513 |
-
if (!this.newDepIds.has(dep.id)) {
|
4514 |
-
dep.removeSub(this);
|
4515 |
-
}
|
4516 |
-
}
|
4517 |
-
var tmp = this.depIds;
|
4518 |
-
this.depIds = this.newDepIds;
|
4519 |
-
this.newDepIds = tmp;
|
4520 |
-
this.newDepIds.clear();
|
4521 |
-
tmp = this.deps;
|
4522 |
-
this.deps = this.newDeps;
|
4523 |
-
this.newDeps = tmp;
|
4524 |
-
this.newDeps.length = 0;
|
4525 |
-
};
|
4526 |
-
|
4527 |
-
/**
|
4528 |
-
* Subscriber interface.
|
4529 |
-
* Will be called when a dependency changes.
|
4530 |
-
*/
|
4531 |
-
Watcher.prototype.update = function update () {
|
4532 |
-
/* istanbul ignore else */
|
4533 |
-
if (this.lazy) {
|
4534 |
-
this.dirty = true;
|
4535 |
-
} else if (this.sync) {
|
4536 |
-
this.run();
|
4537 |
-
} else {
|
4538 |
-
queueWatcher(this);
|
4539 |
-
}
|
4540 |
-
};
|
4541 |
-
|
4542 |
-
/**
|
4543 |
-
* Scheduler job interface.
|
4544 |
-
* Will be called by the scheduler.
|
4545 |
-
*/
|
4546 |
-
Watcher.prototype.run = function run () {
|
4547 |
-
if (this.active) {
|
4548 |
-
var value = this.get();
|
4549 |
-
if (
|
4550 |
-
value !== this.value ||
|
4551 |
-
// Deep watchers and watchers on Object/Arrays should fire even
|
4552 |
-
// when the value is the same, because the value may
|
4553 |
-
// have mutated.
|
4554 |
-
isObject(value) ||
|
4555 |
-
this.deep
|
4556 |
-
) {
|
4557 |
-
// set new value
|
4558 |
-
var oldValue = this.value;
|
4559 |
-
this.value = value;
|
4560 |
-
if (this.user) {
|
4561 |
-
try {
|
4562 |
-
this.cb.call(this.vm, value, oldValue);
|
4563 |
-
} catch (e) {
|
4564 |
-
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
4565 |
-
}
|
4566 |
-
} else {
|
4567 |
-
this.cb.call(this.vm, value, oldValue);
|
4568 |
-
}
|
4569 |
-
}
|
4570 |
-
}
|
4571 |
-
};
|
4572 |
-
|
4573 |
-
/**
|
4574 |
-
* Evaluate the value of the watcher.
|
4575 |
-
* This only gets called for lazy watchers.
|
4576 |
-
*/
|
4577 |
-
Watcher.prototype.evaluate = function evaluate () {
|
4578 |
-
this.value = this.get();
|
4579 |
-
this.dirty = false;
|
4580 |
-
};
|
4581 |
-
|
4582 |
-
/**
|
4583 |
-
* Depend on all deps collected by this watcher.
|
4584 |
-
*/
|
4585 |
-
Watcher.prototype.depend = function depend () {
|
4586 |
-
var i = this.deps.length;
|
4587 |
-
while (i--) {
|
4588 |
-
this.deps[i].depend();
|
4589 |
-
}
|
4590 |
-
};
|
4591 |
-
|
4592 |
-
/**
|
4593 |
-
* Remove self from all dependencies' subscriber list.
|
4594 |
-
*/
|
4595 |
-
Watcher.prototype.teardown = function teardown () {
|
4596 |
-
if (this.active) {
|
4597 |
-
// remove self from vm's watcher list
|
4598 |
-
// this is a somewhat expensive operation so we skip it
|
4599 |
-
// if the vm is being destroyed.
|
4600 |
-
if (!this.vm._isBeingDestroyed) {
|
4601 |
-
remove(this.vm._watchers, this);
|
4602 |
-
}
|
4603 |
-
var i = this.deps.length;
|
4604 |
-
while (i--) {
|
4605 |
-
this.deps[i].removeSub(this);
|
4606 |
-
}
|
4607 |
-
this.active = false;
|
4608 |
-
}
|
4609 |
-
};
|
4610 |
-
|
4611 |
-
/* */
|
4612 |
-
|
4613 |
-
var sharedPropertyDefinition = {
|
4614 |
-
enumerable: true,
|
4615 |
-
configurable: true,
|
4616 |
-
get: noop,
|
4617 |
-
set: noop
|
4618 |
-
};
|
4619 |
-
|
4620 |
-
function proxy (target, sourceKey, key) {
|
4621 |
-
sharedPropertyDefinition.get = function proxyGetter () {
|
4622 |
-
return this[sourceKey][key]
|
4623 |
-
};
|
4624 |
-
sharedPropertyDefinition.set = function proxySetter (val) {
|
4625 |
-
this[sourceKey][key] = val;
|
4626 |
-
};
|
4627 |
-
Object.defineProperty(target, key, sharedPropertyDefinition);
|
4628 |
-
}
|
4629 |
-
|
4630 |
-
function initState (vm) {
|
4631 |
-
vm._watchers = [];
|
4632 |
-
var opts = vm.$options;
|
4633 |
-
if (opts.props) { initProps(vm, opts.props); }
|
4634 |
-
if (opts.methods) { initMethods(vm, opts.methods); }
|
4635 |
-
if (opts.data) {
|
4636 |
-
initData(vm);
|
4637 |
-
} else {
|
4638 |
-
observe(vm._data = {}, true /* asRootData */);
|
4639 |
-
}
|
4640 |
-
if (opts.computed) { initComputed(vm, opts.computed); }
|
4641 |
-
if (opts.watch && opts.watch !== nativeWatch) {
|
4642 |
-
initWatch(vm, opts.watch);
|
4643 |
-
}
|
4644 |
-
}
|
4645 |
-
|
4646 |
-
function initProps (vm, propsOptions) {
|
4647 |
-
var propsData = vm.$options.propsData || {};
|
4648 |
-
var props = vm._props = {};
|
4649 |
-
// cache prop keys so that future props updates can iterate using Array
|
4650 |
-
// instead of dynamic object key enumeration.
|
4651 |
-
var keys = vm.$options._propKeys = [];
|
4652 |
-
var isRoot = !vm.$parent;
|
4653 |
-
// root instance props should be converted
|
4654 |
-
if (!isRoot) {
|
4655 |
-
toggleObserving(false);
|
4656 |
-
}
|
4657 |
-
var loop = function ( key ) {
|
4658 |
-
keys.push(key);
|
4659 |
-
var value = validateProp(key, propsOptions, propsData, vm);
|
4660 |
-
/* istanbul ignore else */
|
4661 |
-
{
|
4662 |
-
var hyphenatedKey = hyphenate(key);
|
4663 |
-
if (isReservedAttribute(hyphenatedKey) ||
|
4664 |
-
config.isReservedAttr(hyphenatedKey)) {
|
4665 |
-
warn(
|
4666 |
-
("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
4667 |
-
vm
|
4668 |
-
);
|
4669 |
-
}
|
4670 |
-
defineReactive$$1(props, key, value, function () {
|
4671 |
-
if (!isRoot && !isUpdatingChildComponent) {
|
4672 |
-
warn(
|
4673 |
-
"Avoid mutating a prop directly since the value will be " +
|
4674 |
-
"overwritten whenever the parent component re-renders. " +
|
4675 |
-
"Instead, use a data or computed property based on the prop's " +
|
4676 |
-
"value. Prop being mutated: \"" + key + "\"",
|
4677 |
-
vm
|
4678 |
-
);
|
4679 |
-
}
|
4680 |
-
});
|
4681 |
-
}
|
4682 |
-
// static props are already proxied on the component's prototype
|
4683 |
-
// during Vue.extend(). We only need to proxy props defined at
|
4684 |
-
// instantiation here.
|
4685 |
-
if (!(key in vm)) {
|
4686 |
-
proxy(vm, "_props", key);
|
4687 |
-
}
|
4688 |
-
};
|
4689 |
-
|
4690 |
-
for (var key in propsOptions) loop( key );
|
4691 |
-
toggleObserving(true);
|
4692 |
-
}
|
4693 |
-
|
4694 |
-
function initData (vm) {
|
4695 |
-
var data = vm.$options.data;
|
4696 |
-
data = vm._data = typeof data === 'function'
|
4697 |
-
? getData(data, vm)
|
4698 |
-
: data || {};
|
4699 |
-
if (!isPlainObject(data)) {
|
4700 |
-
data = {};
|
4701 |
-
warn(
|
4702 |
-
'data functions should return an object:\n' +
|
4703 |
-
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
4704 |
-
vm
|
4705 |
-
);
|
4706 |
-
}
|
4707 |
-
// proxy data on instance
|
4708 |
-
var keys = Object.keys(data);
|
4709 |
-
var props = vm.$options.props;
|
4710 |
-
var methods = vm.$options.methods;
|
4711 |
-
var i = keys.length;
|
4712 |
-
while (i--) {
|
4713 |
-
var key = keys[i];
|
4714 |
-
{
|
4715 |
-
if (methods && hasOwn(methods, key)) {
|
4716 |
-
warn(
|
4717 |
-
("Method \"" + key + "\" has already been defined as a data property."),
|
4718 |
-
vm
|
4719 |
-
);
|
4720 |
-
}
|
4721 |
-
}
|
4722 |
-
if (props && hasOwn(props, key)) {
|
4723 |
-
warn(
|
4724 |
-
"The data property \"" + key + "\" is already declared as a prop. " +
|
4725 |
-
"Use prop default value instead.",
|
4726 |
-
vm
|
4727 |
-
);
|
4728 |
-
} else if (!isReserved(key)) {
|
4729 |
-
proxy(vm, "_data", key);
|
4730 |
-
}
|
4731 |
-
}
|
4732 |
-
// observe data
|
4733 |
-
observe(data, true /* asRootData */);
|
4734 |
-
}
|
4735 |
-
|
4736 |
-
function getData (data, vm) {
|
4737 |
-
// #7573 disable dep collection when invoking data getters
|
4738 |
-
pushTarget();
|
4739 |
-
try {
|
4740 |
-
return data.call(vm, vm)
|
4741 |
-
} catch (e) {
|
4742 |
-
handleError(e, vm, "data()");
|
4743 |
-
return {}
|
4744 |
-
} finally {
|
4745 |
-
popTarget();
|
4746 |
-
}
|
4747 |
-
}
|
4748 |
-
|
4749 |
-
var computedWatcherOptions = { lazy: true };
|
4750 |
-
|
4751 |
-
function initComputed (vm, computed) {
|
4752 |
-
// $flow-disable-line
|
4753 |
-
var watchers = vm._computedWatchers = Object.create(null);
|
4754 |
-
// computed properties are just getters during SSR
|
4755 |
-
var isSSR = isServerRendering();
|
4756 |
-
|
4757 |
-
for (var key in computed) {
|
4758 |
-
var userDef = computed[key];
|
4759 |
-
var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
4760 |
-
if (getter == null) {
|
4761 |
-
warn(
|
4762 |
-
("Getter is missing for computed property \"" + key + "\"."),
|
4763 |
-
vm
|
4764 |
-
);
|
4765 |
-
}
|
4766 |
-
|
4767 |
-
if (!isSSR) {
|
4768 |
-
// create internal watcher for the computed property.
|
4769 |
-
watchers[key] = new Watcher(
|
4770 |
-
vm,
|
4771 |
-
getter || noop,
|
4772 |
-
noop,
|
4773 |
-
computedWatcherOptions
|
4774 |
-
);
|
4775 |
-
}
|
4776 |
-
|
4777 |
-
// component-defined computed properties are already defined on the
|
4778 |
-
// component prototype. We only need to define computed properties defined
|
4779 |
-
// at instantiation here.
|
4780 |
-
if (!(key in vm)) {
|
4781 |
-
defineComputed(vm, key, userDef);
|
4782 |
-
} else {
|
4783 |
-
if (key in vm.$data) {
|
4784 |
-
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
4785 |
-
} else if (vm.$options.props && key in vm.$options.props) {
|
4786 |
-
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
4787 |
-
}
|
4788 |
-
}
|
4789 |
-
}
|
4790 |
-
}
|
4791 |
-
|
4792 |
-
function defineComputed (
|
4793 |
-
target,
|
4794 |
-
key,
|
4795 |
-
userDef
|
4796 |
-
) {
|
4797 |
-
var shouldCache = !isServerRendering();
|
4798 |
-
if (typeof userDef === 'function') {
|
4799 |
-
sharedPropertyDefinition.get = shouldCache
|
4800 |
-
? createComputedGetter(key)
|
4801 |
-
: createGetterInvoker(userDef);
|
4802 |
-
sharedPropertyDefinition.set = noop;
|
4803 |
-
} else {
|
4804 |
-
sharedPropertyDefinition.get = userDef.get
|
4805 |
-
? shouldCache && userDef.cache !== false
|
4806 |
-
? createComputedGetter(key)
|
4807 |
-
: createGetterInvoker(userDef.get)
|
4808 |
-
: noop;
|
4809 |
-
sharedPropertyDefinition.set = userDef.set || noop;
|
4810 |
-
}
|
4811 |
-
if (sharedPropertyDefinition.set === noop) {
|
4812 |
-
sharedPropertyDefinition.set = function () {
|
4813 |
-
warn(
|
4814 |
-
("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
4815 |
-
this
|
4816 |
-
);
|
4817 |
-
};
|
4818 |
-
}
|
4819 |
-
Object.defineProperty(target, key, sharedPropertyDefinition);
|
4820 |
-
}
|
4821 |
-
|
4822 |
-
function createComputedGetter (key) {
|
4823 |
-
return function computedGetter () {
|
4824 |
-
var watcher = this._computedWatchers && this._computedWatchers[key];
|
4825 |
-
if (watcher) {
|
4826 |
-
if (watcher.dirty) {
|
4827 |
-
watcher.evaluate();
|
4828 |
-
}
|
4829 |
-
if (Dep.target) {
|
4830 |
-
watcher.depend();
|
4831 |
-
}
|
4832 |
-
return watcher.value
|
4833 |
-
}
|
4834 |
-
}
|
4835 |
-
}
|
4836 |
-
|
4837 |
-
function createGetterInvoker(fn) {
|
4838 |
-
return function computedGetter () {
|
4839 |
-
return fn.call(this, this)
|
4840 |
-
}
|
4841 |
-
}
|
4842 |
-
|
4843 |
-
function initMethods (vm, methods) {
|
4844 |
-
var props = vm.$options.props;
|
4845 |
-
for (var key in methods) {
|
4846 |
-
{
|
4847 |
-
if (typeof methods[key] !== 'function') {
|
4848 |
-
warn(
|
4849 |
-
"Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
4850 |
-
"Did you reference the function correctly?",
|
4851 |
-
vm
|
4852 |
-
);
|
4853 |
-
}
|
4854 |
-
if (props && hasOwn(props, key)) {
|
4855 |
-
warn(
|
4856 |
-
("Method \"" + key + "\" has already been defined as a prop."),
|
4857 |
-
vm
|
4858 |
-
);
|
4859 |
-
}
|
4860 |
-
if ((key in vm) && isReserved(key)) {
|
4861 |
-
warn(
|
4862 |
-
"Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
4863 |
-
"Avoid defining component methods that start with _ or $."
|
4864 |
-
);
|
4865 |
-
}
|
4866 |
-
}
|
4867 |
-
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
4868 |
-
}
|
4869 |
-
}
|
4870 |
-
|
4871 |
-
function initWatch (vm, watch) {
|
4872 |
-
for (var key in watch) {
|
4873 |
-
var handler = watch[key];
|
4874 |
-
if (Array.isArray(handler)) {
|
4875 |
-
for (var i = 0; i < handler.length; i++) {
|
4876 |
-
createWatcher(vm, key, handler[i]);
|
4877 |
-
}
|
4878 |
-
} else {
|
4879 |
-
createWatcher(vm, key, handler);
|
4880 |
-
}
|
4881 |
-
}
|
4882 |
-
}
|
4883 |
-
|
4884 |
-
function createWatcher (
|
4885 |
-
vm,
|
4886 |
-
expOrFn,
|
4887 |
-
handler,
|
4888 |
-
options
|
4889 |
-
) {
|
4890 |
-
if (isPlainObject(handler)) {
|
4891 |
-
options = handler;
|
4892 |
-
handler = handler.handler;
|
4893 |
-
}
|
4894 |
-
if (typeof handler === 'string') {
|
4895 |
-
handler = vm[handler];
|
4896 |
-
}
|
4897 |
-
return vm.$watch(expOrFn, handler, options)
|
4898 |
-
}
|
4899 |
-
|
4900 |
-
function stateMixin (Vue) {
|
4901 |
-
// flow somehow has problems with directly declared definition object
|
4902 |
-
// when using Object.defineProperty, so we have to procedurally build up
|
4903 |
-
// the object here.
|
4904 |
-
var dataDef = {};
|
4905 |
-
dataDef.get = function () { return this._data };
|
4906 |
-
var propsDef = {};
|
4907 |
-
propsDef.get = function () { return this._props };
|
4908 |
-
{
|
4909 |
-
dataDef.set = function () {
|
4910 |
-
warn(
|
4911 |
-
'Avoid replacing instance root $data. ' +
|
4912 |
-
'Use nested data properties instead.',
|
4913 |
-
this
|
4914 |
-
);
|
4915 |
-
};
|
4916 |
-
propsDef.set = function () {
|
4917 |
-
warn("$props is readonly.", this);
|
4918 |
-
};
|
4919 |
-
}
|
4920 |
-
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
4921 |
-
Object.defineProperty(Vue.prototype, '$props', propsDef);
|
4922 |
-
|
4923 |
-
Vue.prototype.$set = set;
|
4924 |
-
Vue.prototype.$delete = del;
|
4925 |
-
|
4926 |
-
Vue.prototype.$watch = function (
|
4927 |
-
expOrFn,
|
4928 |
-
cb,
|
4929 |
-
options
|
4930 |
-
) {
|
4931 |
-
var vm = this;
|
4932 |
-
if (isPlainObject(cb)) {
|
4933 |
-
return createWatcher(vm, expOrFn, cb, options)
|
4934 |
-
}
|
4935 |
-
options = options || {};
|
4936 |
-
options.user = true;
|
4937 |
-
var watcher = new Watcher(vm, expOrFn, cb, options);
|
4938 |
-
if (options.immediate) {
|
4939 |
-
try {
|
4940 |
-
cb.call(vm, watcher.value);
|
4941 |
-
} catch (error) {
|
4942 |
-
handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
4943 |
-
}
|
4944 |
-
}
|
4945 |
-
return function unwatchFn () {
|
4946 |
-
watcher.teardown();
|
4947 |
-
}
|
4948 |
-
};
|
4949 |
-
}
|
4950 |
-
|
4951 |
-
/* */
|
4952 |
-
|
4953 |
-
var uid$3 = 0;
|
4954 |
-
|
4955 |
-
function initMixin (Vue) {
|
4956 |
-
Vue.prototype._init = function (options) {
|
4957 |
-
var vm = this;
|
4958 |
-
// a uid
|
4959 |
-
vm._uid = uid$3++;
|
4960 |
-
|
4961 |
-
var startTag, endTag;
|
4962 |
-
/* istanbul ignore if */
|
4963 |
-
if (config.performance && mark) {
|
4964 |
-
startTag = "vue-perf-start:" + (vm._uid);
|
4965 |
-
endTag = "vue-perf-end:" + (vm._uid);
|
4966 |
-
mark(startTag);
|
4967 |
-
}
|
4968 |
-
|
4969 |
-
// a flag to avoid this being observed
|
4970 |
-
vm._isVue = true;
|
4971 |
-
// merge options
|
4972 |
-
if (options && options._isComponent) {
|
4973 |
-
// optimize internal component instantiation
|
4974 |
-
// since dynamic options merging is pretty slow, and none of the
|
4975 |
-
// internal component options needs special treatment.
|
4976 |
-
initInternalComponent(vm, options);
|
4977 |
-
} else {
|
4978 |
-
vm.$options = mergeOptions(
|
4979 |
-
resolveConstructorOptions(vm.constructor),
|
4980 |
-
options || {},
|
4981 |
-
vm
|
4982 |
-
);
|
4983 |
-
}
|
4984 |
-
/* istanbul ignore else */
|
4985 |
-
{
|
4986 |
-
initProxy(vm);
|
4987 |
-
}
|
4988 |
-
// expose real self
|
4989 |
-
vm._self = vm;
|
4990 |
-
initLifecycle(vm);
|
4991 |
-
initEvents(vm);
|
4992 |
-
initRender(vm);
|
4993 |
-
callHook(vm, 'beforeCreate');
|
4994 |
-
initInjections(vm); // resolve injections before data/props
|
4995 |
-
initState(vm);
|
4996 |
-
initProvide(vm); // resolve provide after data/props
|
4997 |
-
callHook(vm, 'created');
|
4998 |
-
|
4999 |
-
/* istanbul ignore if */
|
5000 |
-
if (config.performance && mark) {
|
5001 |
-
vm._name = formatComponentName(vm, false);
|
5002 |
-
mark(endTag);
|
5003 |
-
measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
5004 |
-
}
|
5005 |
-
|
5006 |
-
if (vm.$options.el) {
|
5007 |
-
vm.$mount(vm.$options.el);
|
5008 |
-
}
|
5009 |
-
};
|
5010 |
-
}
|
5011 |
-
|
5012 |
-
function initInternalComponent (vm, options) {
|
5013 |
-
var opts = vm.$options = Object.create(vm.constructor.options);
|
5014 |
-
// doing this because it's faster than dynamic enumeration.
|
5015 |
-
var parentVnode = options._parentVnode;
|
5016 |
-
opts.parent = options.parent;
|
5017 |
-
opts._parentVnode = parentVnode;
|
5018 |
-
|
5019 |
-
var vnodeComponentOptions = parentVnode.componentOptions;
|
5020 |
-
opts.propsData = vnodeComponentOptions.propsData;
|
5021 |
-
opts._parentListeners = vnodeComponentOptions.listeners;
|
5022 |
-
opts._renderChildren = vnodeComponentOptions.children;
|
5023 |
-
opts._componentTag = vnodeComponentOptions.tag;
|
5024 |
-
|
5025 |
-
if (options.render) {
|
5026 |
-
opts.render = options.render;
|
5027 |
-
opts.staticRenderFns = options.staticRenderFns;
|
5028 |
-
}
|
5029 |
-
}
|
5030 |
-
|
5031 |
-
function resolveConstructorOptions (Ctor) {
|
5032 |
-
var options = Ctor.options;
|
5033 |
-
if (Ctor.super) {
|
5034 |
-
var superOptions = resolveConstructorOptions(Ctor.super);
|
5035 |
-
var cachedSuperOptions = Ctor.superOptions;
|
5036 |
-
if (superOptions !== cachedSuperOptions) {
|
5037 |
-
// super option changed,
|
5038 |
-
// need to resolve new options.
|
5039 |
-
Ctor.superOptions = superOptions;
|
5040 |
-
// check if there are any late-modified/attached options (#4976)
|
5041 |
-
var modifiedOptions = resolveModifiedOptions(Ctor);
|
5042 |
-
// update base extend options
|
5043 |
-
if (modifiedOptions) {
|
5044 |
-
extend(Ctor.extendOptions, modifiedOptions);
|
5045 |
-
}
|
5046 |
-
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
5047 |
-
if (options.name) {
|
5048 |
-
options.components[options.name] = Ctor;
|
5049 |
-
}
|
5050 |
-
}
|
5051 |
-
}
|
5052 |
-
return options
|
5053 |
-
}
|
5054 |
-
|
5055 |
-
function resolveModifiedOptions (Ctor) {
|
5056 |
-
var modified;
|
5057 |
-
var latest = Ctor.options;
|
5058 |
-
var sealed = Ctor.sealedOptions;
|
5059 |
-
for (var key in latest) {
|
5060 |
-
if (latest[key] !== sealed[key]) {
|
5061 |
-
if (!modified) { modified = {}; }
|
5062 |
-
modified[key] = latest[key];
|
5063 |
-
}
|
5064 |
-
}
|
5065 |
-
return modified
|
5066 |
-
}
|
5067 |
-
|
5068 |
-
function Vue (options) {
|
5069 |
-
if (!(this instanceof Vue)
|
5070 |
-
) {
|
5071 |
-
warn('Vue is a constructor and should be called with the `new` keyword');
|
5072 |
-
}
|
5073 |
-
this._init(options);
|
5074 |
-
}
|
5075 |
-
|
5076 |
-
initMixin(Vue);
|
5077 |
-
stateMixin(Vue);
|
5078 |
-
eventsMixin(Vue);
|
5079 |
-
lifecycleMixin(Vue);
|
5080 |
-
renderMixin(Vue);
|
5081 |
-
|
5082 |
-
/* */
|
5083 |
-
|
5084 |
-
function initUse (Vue) {
|
5085 |
-
Vue.use = function (plugin) {
|
5086 |
-
var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
5087 |
-
if (installedPlugins.indexOf(plugin) > -1) {
|
5088 |
-
return this
|
5089 |
-
}
|
5090 |
-
|
5091 |
-
// additional parameters
|
5092 |
-
var args = toArray(arguments, 1);
|
5093 |
-
args.unshift(this);
|
5094 |
-
if (typeof plugin.install === 'function') {
|
5095 |
-
plugin.install.apply(plugin, args);
|
5096 |
-
} else if (typeof plugin === 'function') {
|
5097 |
-
plugin.apply(null, args);
|
5098 |
-
}
|
5099 |
-
installedPlugins.push(plugin);
|
5100 |
-
return this
|
5101 |
-
};
|
5102 |
-
}
|
5103 |
-
|
5104 |
-
/* */
|
5105 |
-
|
5106 |
-
function initMixin$1 (Vue) {
|
5107 |
-
Vue.mixin = function (mixin) {
|
5108 |
-
this.options = mergeOptions(this.options, mixin);
|
5109 |
-
return this
|
5110 |
-
};
|
5111 |
-
}
|
5112 |
-
|
5113 |
-
/* */
|
5114 |
-
|
5115 |
-
function initExtend (Vue) {
|
5116 |
-
/**
|
5117 |
-
* Each instance constructor, including Vue, has a unique
|
5118 |
-
* cid. This enables us to create wrapped "child
|
5119 |
-
* constructors" for prototypal inheritance and cache them.
|
5120 |
-
*/
|
5121 |
-
Vue.cid = 0;
|
5122 |
-
var cid = 1;
|
5123 |
-
|
5124 |
-
/**
|
5125 |
-
* Class inheritance
|
5126 |
-
*/
|
5127 |
-
Vue.extend = function (extendOptions) {
|
5128 |
-
extendOptions = extendOptions || {};
|
5129 |
-
var Super = this;
|
5130 |
-
var SuperId = Super.cid;
|
5131 |
-
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5132 |
-
if (cachedCtors[SuperId]) {
|
5133 |
-
return cachedCtors[SuperId]
|
5134 |
-
}
|
5135 |
-
|
5136 |
-
var name = extendOptions.name || Super.options.name;
|
5137 |
-
if (name) {
|
5138 |
-
validateComponentName(name);
|
5139 |
-
}
|
5140 |
-
|
5141 |
-
var Sub = function VueComponent (options) {
|
5142 |
-
this._init(options);
|
5143 |
-
};
|
5144 |
-
Sub.prototype = Object.create(Super.prototype);
|
5145 |
-
Sub.prototype.constructor = Sub;
|
5146 |
-
Sub.cid = cid++;
|
5147 |
-
Sub.options = mergeOptions(
|
5148 |
-
Super.options,
|
5149 |
-
extendOptions
|
5150 |
-
);
|
5151 |
-
Sub['super'] = Super;
|
5152 |
-
|
5153 |
-
// For props and computed properties, we define the proxy getters on
|
5154 |
-
// the Vue instances at extension time, on the extended prototype. This
|
5155 |
-
// avoids Object.defineProperty calls for each instance created.
|
5156 |
-
if (Sub.options.props) {
|
5157 |
-
initProps$1(Sub);
|
5158 |
-
}
|
5159 |
-
if (Sub.options.computed) {
|
5160 |
-
initComputed$1(Sub);
|
5161 |
-
}
|
5162 |
-
|
5163 |
-
// allow further extension/mixin/plugin usage
|
5164 |
-
Sub.extend = Super.extend;
|
5165 |
-
Sub.mixin = Super.mixin;
|
5166 |
-
Sub.use = Super.use;
|
5167 |
-
|
5168 |
-
// create asset registers, so extended classes
|
5169 |
-
// can have their private assets too.
|
5170 |
-
ASSET_TYPES.forEach(function (type) {
|
5171 |
-
Sub[type] = Super[type];
|
5172 |
-
});
|
5173 |
-
// enable recursive self-lookup
|
5174 |
-
if (name) {
|
5175 |
-
Sub.options.components[name] = Sub;
|
5176 |
-
}
|
5177 |
-
|
5178 |
-
// keep a reference to the super options at extension time.
|
5179 |
-
// later at instantiation we can check if Super's options have
|
5180 |
-
// been updated.
|
5181 |
-
Sub.superOptions = Super.options;
|
5182 |
-
Sub.extendOptions = extendOptions;
|
5183 |
-
Sub.sealedOptions = extend({}, Sub.options);
|
5184 |
-
|
5185 |
-
// cache constructor
|
5186 |
-
cachedCtors[SuperId] = Sub;
|
5187 |
-
return Sub
|
5188 |
-
};
|
5189 |
-
}
|
5190 |
-
|
5191 |
-
function initProps$1 (Comp) {
|
5192 |
-
var props = Comp.options.props;
|
5193 |
-
for (var key in props) {
|
5194 |
-
proxy(Comp.prototype, "_props", key);
|
5195 |
-
}
|
5196 |
-
}
|
5197 |
-
|
5198 |
-
function initComputed$1 (Comp) {
|
5199 |
-
var computed = Comp.options.computed;
|
5200 |
-
for (var key in computed) {
|
5201 |
-
defineComputed(Comp.prototype, key, computed[key]);
|
5202 |
-
}
|
5203 |
-
}
|
5204 |
-
|
5205 |
-
/* */
|
5206 |
-
|
5207 |
-
function initAssetRegisters (Vue) {
|
5208 |
-
/**
|
5209 |
-
* Create asset registration methods.
|
5210 |
-
*/
|
5211 |
-
ASSET_TYPES.forEach(function (type) {
|
5212 |
-
Vue[type] = function (
|
5213 |
-
id,
|
5214 |
-
definition
|
5215 |
-
) {
|
5216 |
-
if (!definition) {
|
5217 |
-
return this.options[type + 's'][id]
|
5218 |
-
} else {
|
5219 |
-
/* istanbul ignore if */
|
5220 |
-
if (type === 'component') {
|
5221 |
-
validateComponentName(id);
|
5222 |
-
}
|
5223 |
-
if (type === 'component' && isPlainObject(definition)) {
|
5224 |
-
definition.name = definition.name || id;
|
5225 |
-
definition = this.options._base.extend(definition);
|
5226 |
-
}
|
5227 |
-
if (type === 'directive' && typeof definition === 'function') {
|
5228 |
-
definition = { bind: definition, update: definition };
|
5229 |
-
}
|
5230 |
-
this.options[type + 's'][id] = definition;
|
5231 |
-
return definition
|
5232 |
-
}
|
5233 |
-
};
|
5234 |
-
});
|
5235 |
-
}
|
5236 |
-
|
5237 |
-
/* */
|
5238 |
-
|
5239 |
-
|
5240 |
-
|
5241 |
-
function getComponentName (opts) {
|
5242 |
-
return opts && (opts.Ctor.options.name || opts.tag)
|
5243 |
-
}
|
5244 |
-
|
5245 |
-
function matches (pattern, name) {
|
5246 |
-
if (Array.isArray(pattern)) {
|
5247 |
-
return pattern.indexOf(name) > -1
|
5248 |
-
} else if (typeof pattern === 'string') {
|
5249 |
-
return pattern.split(',').indexOf(name) > -1
|
5250 |
-
} else if (isRegExp(pattern)) {
|
5251 |
-
return pattern.test(name)
|
5252 |
-
}
|
5253 |
-
/* istanbul ignore next */
|
5254 |
-
return false
|
5255 |
-
}
|
5256 |
-
|
5257 |
-
function pruneCache (keepAliveInstance, filter) {
|
5258 |
-
var cache = keepAliveInstance.cache;
|
5259 |
-
var keys = keepAliveInstance.keys;
|
5260 |
-
var _vnode = keepAliveInstance._vnode;
|
5261 |
-
for (var key in cache) {
|
5262 |
-
var cachedNode = cache[key];
|
5263 |
-
if (cachedNode) {
|
5264 |
-
var name = getComponentName(cachedNode.componentOptions);
|
5265 |
-
if (name && !filter(name)) {
|
5266 |
-
pruneCacheEntry(cache, key, keys, _vnode);
|
5267 |
-
}
|
5268 |
-
}
|
5269 |
-
}
|
5270 |
-
}
|
5271 |
-
|
5272 |
-
function pruneCacheEntry (
|
5273 |
-
cache,
|
5274 |
-
key,
|
5275 |
-
keys,
|
5276 |
-
current
|
5277 |
-
) {
|
5278 |
-
var cached$$1 = cache[key];
|
5279 |
-
if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
5280 |
-
cached$$1.componentInstance.$destroy();
|
5281 |
-
}
|
5282 |
-
cache[key] = null;
|
5283 |
-
remove(keys, key);
|
5284 |
-
}
|
5285 |
-
|
5286 |
-
var patternTypes = [String, RegExp, Array];
|
5287 |
-
|
5288 |
-
var KeepAlive = {
|
5289 |
-
name: 'keep-alive',
|
5290 |
-
abstract: true,
|
5291 |
-
|
5292 |
-
props: {
|
5293 |
-
include: patternTypes,
|
5294 |
-
exclude: patternTypes,
|
5295 |
-
max: [String, Number]
|
5296 |
-
},
|
5297 |
-
|
5298 |
-
created: function created () {
|
5299 |
-
this.cache = Object.create(null);
|
5300 |
-
this.keys = [];
|
5301 |
-
},
|
5302 |
-
|
5303 |
-
destroyed: function destroyed () {
|
5304 |
-
for (var key in this.cache) {
|
5305 |
-
pruneCacheEntry(this.cache, key, this.keys);
|
5306 |
-
}
|
5307 |
-
},
|
5308 |
-
|
5309 |
-
mounted: function mounted () {
|
5310 |
-
var this$1 = this;
|
5311 |
-
|
5312 |
-
this.$watch('include', function (val) {
|
5313 |
-
pruneCache(this$1, function (name) { return matches(val, name); });
|
5314 |
-
});
|
5315 |
-
this.$watch('exclude', function (val) {
|
5316 |
-
pruneCache(this$1, function (name) { return !matches(val, name); });
|
5317 |
-
});
|
5318 |
-
},
|
5319 |
-
|
5320 |
-
render: function render () {
|
5321 |
-
var slot = this.$slots.default;
|
5322 |
-
var vnode = getFirstComponentChild(slot);
|
5323 |
-
var componentOptions = vnode && vnode.componentOptions;
|
5324 |
-
if (componentOptions) {
|
5325 |
-
// check pattern
|
5326 |
-
var name = getComponentName(componentOptions);
|
5327 |
-
var ref = this;
|
5328 |
-
var include = ref.include;
|
5329 |
-
var exclude = ref.exclude;
|
5330 |
-
if (
|
5331 |
-
// not included
|
5332 |
-
(include && (!name || !matches(include, name))) ||
|
5333 |
-
// excluded
|
5334 |
-
(exclude && name && matches(exclude, name))
|
5335 |
-
) {
|
5336 |
-
return vnode
|
5337 |
-
}
|
5338 |
-
|
5339 |
-
var ref$1 = this;
|
5340 |
-
var cache = ref$1.cache;
|
5341 |
-
var keys = ref$1.keys;
|
5342 |
-
var key = vnode.key == null
|
5343 |
-
// same constructor may get registered as different local components
|
5344 |
-
// so cid alone is not enough (#3269)
|
5345 |
-
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
5346 |
-
: vnode.key;
|
5347 |
-
if (cache[key]) {
|
5348 |
-
vnode.componentInstance = cache[key].componentInstance;
|
5349 |
-
// make current key freshest
|
5350 |
-
remove(keys, key);
|
5351 |
-
keys.push(key);
|
5352 |
-
} else {
|
5353 |
-
cache[key] = vnode;
|
5354 |
-
keys.push(key);
|
5355 |
-
// prune oldest entry
|
5356 |
-
if (this.max && keys.length > parseInt(this.max)) {
|
5357 |
-
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5358 |
-
}
|
5359 |
-
}
|
5360 |
-
|
5361 |
-
vnode.data.keepAlive = true;
|
5362 |
-
}
|
5363 |
-
return vnode || (slot && slot[0])
|
5364 |
-
}
|
5365 |
-
};
|
5366 |
-
|
5367 |
-
var builtInComponents = {
|
5368 |
-
KeepAlive: KeepAlive
|
5369 |
-
};
|
5370 |
-
|
5371 |
-
/* */
|
5372 |
-
|
5373 |
-
function initGlobalAPI (Vue) {
|
5374 |
-
// config
|
5375 |
-
var configDef = {};
|
5376 |
-
configDef.get = function () { return config; };
|
5377 |
-
{
|
5378 |
-
configDef.set = function () {
|
5379 |
-
warn(
|
5380 |
-
'Do not replace the Vue.config object, set individual fields instead.'
|
5381 |
-
);
|
5382 |
-
};
|
5383 |
-
}
|
5384 |
-
Object.defineProperty(Vue, 'config', configDef);
|
5385 |
-
|
5386 |
-
// exposed util methods.
|
5387 |
-
// NOTE: these are not considered part of the public API - avoid relying on
|
5388 |
-
// them unless you are aware of the risk.
|
5389 |
-
Vue.util = {
|
5390 |
-
warn: warn,
|
5391 |
-
extend: extend,
|
5392 |
-
mergeOptions: mergeOptions,
|
5393 |
-
defineReactive: defineReactive$$1
|
5394 |
-
};
|
5395 |
-
|
5396 |
-
Vue.set = set;
|
5397 |
-
Vue.delete = del;
|
5398 |
-
Vue.nextTick = nextTick;
|
5399 |
-
|
5400 |
-
// 2.6 explicit observable API
|
5401 |
-
Vue.observable = function (obj) {
|
5402 |
-
observe(obj);
|
5403 |
-
return obj
|
5404 |
-
};
|
5405 |
-
|
5406 |
-
Vue.options = Object.create(null);
|
5407 |
-
ASSET_TYPES.forEach(function (type) {
|
5408 |
-
Vue.options[type + 's'] = Object.create(null);
|
5409 |
-
});
|
5410 |
-
|
5411 |
-
// this is used to identify the "base" constructor to extend all plain-object
|
5412 |
-
// components with in Weex's multi-instance scenarios.
|
5413 |
-
Vue.options._base = Vue;
|
5414 |
-
|
5415 |
-
extend(Vue.options.components, builtInComponents);
|
5416 |
-
|
5417 |
-
initUse(Vue);
|
5418 |
-
initMixin$1(Vue);
|
5419 |
-
initExtend(Vue);
|
5420 |
-
initAssetRegisters(Vue);
|
5421 |
-
}
|
5422 |
-
|
5423 |
-
initGlobalAPI(Vue);
|
5424 |
-
|
5425 |
-
Object.defineProperty(Vue.prototype, '$isServer', {
|
5426 |
-
get: isServerRendering
|
5427 |
-
});
|
5428 |
-
|
5429 |
-
Object.defineProperty(Vue.prototype, '$ssrContext', {
|
5430 |
-
get: function get () {
|
5431 |
-
/* istanbul ignore next */
|
5432 |
-
return this.$vnode && this.$vnode.ssrContext
|
5433 |
-
}
|
5434 |
-
});
|
5435 |
-
|
5436 |
-
// expose FunctionalRenderContext for ssr runtime helper installation
|
5437 |
-
Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
5438 |
-
value: FunctionalRenderContext
|
5439 |
-
});
|
5440 |
-
|
5441 |
-
Vue.version = '2.6.10';
|
5442 |
-
|
5443 |
-
/* */
|
5444 |
-
|
5445 |
-
// these are reserved for web because they are directly compiled away
|
5446 |
-
// during template compilation
|
5447 |
-
var isReservedAttr = makeMap('style,class');
|
5448 |
-
|
5449 |
-
// attributes that should be using props for binding
|
5450 |
-
var acceptValue = makeMap('input,textarea,option,select,progress');
|
5451 |
-
var mustUseProp = function (tag, type, attr) {
|
5452 |
-
return (
|
5453 |
-
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
5454 |
-
(attr === 'selected' && tag === 'option') ||
|
5455 |
-
(attr === 'checked' && tag === 'input') ||
|
5456 |
-
(attr === 'muted' && tag === 'video')
|
5457 |
-
)
|
5458 |
-
};
|
5459 |
-
|
5460 |
-
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
5461 |
-
|
5462 |
-
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
5463 |
-
|
5464 |
-
var convertEnumeratedValue = function (key, value) {
|
5465 |
-
return isFalsyAttrValue(value) || value === 'false'
|
5466 |
-
? 'false'
|
5467 |
-
// allow arbitrary string value for contenteditable
|
5468 |
-
: key === 'contenteditable' && isValidContentEditableValue(value)
|
5469 |
-
? value
|
5470 |
-
: 'true'
|
5471 |
-
};
|
5472 |
-
|
5473 |
-
var isBooleanAttr = makeMap(
|
5474 |
-
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
5475 |
-
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
5476 |
-
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
5477 |
-
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
5478 |
-
'required,reversed,scoped,seamless,selected,sortable,translate,' +
|
5479 |
-
'truespeed,typemustmatch,visible'
|
5480 |
-
);
|
5481 |
-
|
5482 |
-
var xlinkNS = 'http://www.w3.org/1999/xlink';
|
5483 |
-
|
5484 |
-
var isXlink = function (name) {
|
5485 |
-
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
5486 |
-
};
|
5487 |
-
|
5488 |
-
var getXlinkProp = function (name) {
|
5489 |
-
return isXlink(name) ? name.slice(6, name.length) : ''
|
5490 |
-
};
|
5491 |
-
|
5492 |
-
var isFalsyAttrValue = function (val) {
|
5493 |
-
return val == null || val === false
|
5494 |
-
};
|
5495 |
-
|
5496 |
-
/* */
|
5497 |
-
|
5498 |
-
function genClassForVnode (vnode) {
|
5499 |
-
var data = vnode.data;
|
5500 |
-
var parentNode = vnode;
|
5501 |
-
var childNode = vnode;
|
5502 |
-
while (isDef(childNode.componentInstance)) {
|
5503 |
-
childNode = childNode.componentInstance._vnode;
|
5504 |
-
if (childNode && childNode.data) {
|
5505 |
-
data = mergeClassData(childNode.data, data);
|
5506 |
-
}
|
5507 |
-
}
|
5508 |
-
while (isDef(parentNode = parentNode.parent)) {
|
5509 |
-
if (parentNode && parentNode.data) {
|
5510 |
-
data = mergeClassData(data, parentNode.data);
|
5511 |
-
}
|
5512 |
-
}
|
5513 |
-
return renderClass(data.staticClass, data.class)
|
5514 |
-
}
|
5515 |
-
|
5516 |
-
function mergeClassData (child, parent) {
|
5517 |
-
return {
|
5518 |
-
staticClass: concat(child.staticClass, parent.staticClass),
|
5519 |
-
class: isDef(child.class)
|
5520 |
-
? [child.class, parent.class]
|
5521 |
-
: parent.class
|
5522 |
-
}
|
5523 |
-
}
|
5524 |
-
|
5525 |
-
function renderClass (
|
5526 |
-
staticClass,
|
5527 |
-
dynamicClass
|
5528 |
-
) {
|
5529 |
-
if (isDef(staticClass) || isDef(dynamicClass)) {
|
5530 |
-
return concat(staticClass, stringifyClass(dynamicClass))
|
5531 |
-
}
|
5532 |
-
/* istanbul ignore next */
|
5533 |
-
return ''
|
5534 |
-
}
|
5535 |
-
|
5536 |
-
function concat (a, b) {
|
5537 |
-
return a ? b ? (a + ' ' + b) : a : (b || '')
|
5538 |
-
}
|
5539 |
-
|
5540 |
-
function stringifyClass (value) {
|
5541 |
-
if (Array.isArray(value)) {
|
5542 |
-
return stringifyArray(value)
|
5543 |
-
}
|
5544 |
-
if (isObject(value)) {
|
5545 |
-
return stringifyObject(value)
|
5546 |
-
}
|
5547 |
-
if (typeof value === 'string') {
|
5548 |
-
return value
|
5549 |
-
}
|
5550 |
-
/* istanbul ignore next */
|
5551 |
-
return ''
|
5552 |
-
}
|
5553 |
-
|
5554 |
-
function stringifyArray (value) {
|
5555 |
-
var res = '';
|
5556 |
-
var stringified;
|
5557 |
-
for (var i = 0, l = value.length; i < l; i++) {
|
5558 |
-
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
5559 |
-
if (res) { res += ' '; }
|
5560 |
-
res += stringified;
|
5561 |
-
}
|
5562 |
-
}
|
5563 |
-
return res
|
5564 |
-
}
|
5565 |
-
|
5566 |
-
function stringifyObject (value) {
|
5567 |
-
var res = '';
|
5568 |
-
for (var key in value) {
|
5569 |
-
if (value[key]) {
|
5570 |
-
if (res) { res += ' '; }
|
5571 |
-
res += key;
|
5572 |
-
}
|
5573 |
-
}
|
5574 |
-
return res
|
5575 |
-
}
|
5576 |
-
|
5577 |
-
/* */
|
5578 |
-
|
5579 |
-
var namespaceMap = {
|
5580 |
-
svg: 'http://www.w3.org/2000/svg',
|
5581 |
-
math: 'http://www.w3.org/1998/Math/MathML'
|
5582 |
-
};
|
5583 |
-
|
5584 |
-
var isHTMLTag = makeMap(
|
5585 |
-
'html,body,base,head,link,meta,style,title,' +
|
5586 |
-
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
5587 |
-
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
5588 |
-
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
5589 |
-
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
5590 |
-
'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
5591 |
-
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
5592 |
-
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
5593 |
-
'output,progress,select,textarea,' +
|
5594 |
-
'details,dialog,menu,menuitem,summary,' +
|
5595 |
-
'content,element,shadow,template,blockquote,iframe,tfoot'
|
5596 |
-
);
|
5597 |
-
|
5598 |
-
// this map is intentionally selective, only covering SVG elements that may
|
5599 |
-
// contain child elements.
|
5600 |
-
var isSVG = makeMap(
|
5601 |
-
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
5602 |
-
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
5603 |
-
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
5604 |
-
true
|
5605 |
-
);
|
5606 |
-
|
5607 |
-
var isPreTag = function (tag) { return tag === 'pre'; };
|
5608 |
-
|
5609 |
-
var isReservedTag = function (tag) {
|
5610 |
-
return isHTMLTag(tag) || isSVG(tag)
|
5611 |
-
};
|
5612 |
-
|
5613 |
-
function getTagNamespace (tag) {
|
5614 |
-
if (isSVG(tag)) {
|
5615 |
-
return 'svg'
|
5616 |
-
}
|
5617 |
-
// basic support for MathML
|
5618 |
-
// note it doesn't support other MathML elements being component roots
|
5619 |
-
if (tag === 'math') {
|
5620 |
-
return 'math'
|
5621 |
-
}
|
5622 |
-
}
|
5623 |
-
|
5624 |
-
var unknownElementCache = Object.create(null);
|
5625 |
-
function isUnknownElement (tag) {
|
5626 |
-
/* istanbul ignore if */
|
5627 |
-
if (!inBrowser) {
|
5628 |
-
return true
|
5629 |
-
}
|
5630 |
-
if (isReservedTag(tag)) {
|
5631 |
-
return false
|
5632 |
-
}
|
5633 |
-
tag = tag.toLowerCase();
|
5634 |
-
/* istanbul ignore if */
|
5635 |
-
if (unknownElementCache[tag] != null) {
|
5636 |
-
return unknownElementCache[tag]
|
5637 |
-
}
|
5638 |
-
var el = document.createElement(tag);
|
5639 |
-
if (tag.indexOf('-') > -1) {
|
5640 |
-
// http://stackoverflow.com/a/28210364/1070244
|
5641 |
-
return (unknownElementCache[tag] = (
|
5642 |
-
el.constructor === window.HTMLUnknownElement ||
|
5643 |
-
el.constructor === window.HTMLElement
|
5644 |
-
))
|
5645 |
-
} else {
|
5646 |
-
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
5647 |
-
}
|
5648 |
-
}
|
5649 |
-
|
5650 |
-
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
5651 |
-
|
5652 |
-
/* */
|
5653 |
-
|
5654 |
-
/**
|
5655 |
-
* Query an element selector if it's not an element already.
|
5656 |
-
*/
|
5657 |
-
function query (el) {
|
5658 |
-
if (typeof el === 'string') {
|
5659 |
-
var selected = document.querySelector(el);
|
5660 |
-
if (!selected) {
|
5661 |
-
warn(
|
5662 |
-
'Cannot find element: ' + el
|
5663 |
-
);
|
5664 |
-
return document.createElement('div')
|
5665 |
-
}
|
5666 |
-
return selected
|
5667 |
-
} else {
|
5668 |
-
return el
|
5669 |
-
}
|
5670 |
-
}
|
5671 |
-
|
5672 |
-
/* */
|
5673 |
-
|
5674 |
-
function createElement$1 (tagName, vnode) {
|
5675 |
-
var elm = document.createElement(tagName);
|
5676 |
-
if (tagName !== 'select') {
|
5677 |
-
return elm
|
5678 |
-
}
|
5679 |
-
// false or null will remove the attribute but undefined will not
|
5680 |
-
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
5681 |
-
elm.setAttribute('multiple', 'multiple');
|
5682 |
-
}
|
5683 |
-
return elm
|
5684 |
-
}
|
5685 |
-
|
5686 |
-
function createElementNS (namespace, tagName) {
|
5687 |
-
return document.createElementNS(namespaceMap[namespace], tagName)
|
5688 |
-
}
|
5689 |
-
|
5690 |
-
function createTextNode (text) {
|
5691 |
-
return document.createTextNode(text)
|
5692 |
-
}
|
5693 |
-
|
5694 |
-
function createComment (text) {
|
5695 |
-
return document.createComment(text)
|
5696 |
-
}
|
5697 |
-
|
5698 |
-
function insertBefore (parentNode, newNode, referenceNode) {
|
5699 |
-
parentNode.insertBefore(newNode, referenceNode);
|
5700 |
-
}
|
5701 |
-
|
5702 |
-
function removeChild (node, child) {
|
5703 |
-
node.removeChild(child);
|
5704 |
-
}
|
5705 |
-
|
5706 |
-
function appendChild (node, child) {
|
5707 |
-
node.appendChild(child);
|
5708 |
-
}
|
5709 |
-
|
5710 |
-
function parentNode (node) {
|
5711 |
-
return node.parentNode
|
5712 |
-
}
|
5713 |
-
|
5714 |
-
function nextSibling (node) {
|
5715 |
-
return node.nextSibling
|
5716 |
-
}
|
5717 |
-
|
5718 |
-
function tagName (node) {
|
5719 |
-
return node.tagName
|
5720 |
-
}
|
5721 |
-
|
5722 |
-
function setTextContent (node, text) {
|
5723 |
-
node.textContent = text;
|
5724 |
-
}
|
5725 |
-
|
5726 |
-
function setStyleScope (node, scopeId) {
|
5727 |
-
node.setAttribute(scopeId, '');
|
5728 |
-
}
|
5729 |
-
|
5730 |
-
var nodeOps = /*#__PURE__*/Object.freeze({
|
5731 |
-
createElement: createElement$1,
|
5732 |
-
createElementNS: createElementNS,
|
5733 |
-
createTextNode: createTextNode,
|
5734 |
-
createComment: createComment,
|
5735 |
-
insertBefore: insertBefore,
|
5736 |
-
removeChild: removeChild,
|
5737 |
-
appendChild: appendChild,
|
5738 |
-
parentNode: parentNode,
|
5739 |
-
nextSibling: nextSibling,
|
5740 |
-
tagName: tagName,
|
5741 |
-
setTextContent: setTextContent,
|
5742 |
-
setStyleScope: setStyleScope
|
5743 |
-
});
|
5744 |
-
|
5745 |
-
/* */
|
5746 |
-
|
5747 |
-
var ref = {
|
5748 |
-
create: function create (_, vnode) {
|
5749 |
-
registerRef(vnode);
|
5750 |
-
},
|
5751 |
-
update: function update (oldVnode, vnode) {
|
5752 |
-
if (oldVnode.data.ref !== vnode.data.ref) {
|
5753 |
-
registerRef(oldVnode, true);
|
5754 |
-
registerRef(vnode);
|
5755 |
-
}
|
5756 |
-
},
|
5757 |
-
destroy: function destroy (vnode) {
|
5758 |
-
registerRef(vnode, true);
|
5759 |
-
}
|
5760 |
-
};
|
5761 |
-
|
5762 |
-
function registerRef (vnode, isRemoval) {
|
5763 |
-
var key = vnode.data.ref;
|
5764 |
-
if (!isDef(key)) { return }
|
5765 |
-
|
5766 |
-
var vm = vnode.context;
|
5767 |
-
var ref = vnode.componentInstance || vnode.elm;
|
5768 |
-
var refs = vm.$refs;
|
5769 |
-
if (isRemoval) {
|
5770 |
-
if (Array.isArray(refs[key])) {
|
5771 |
-
remove(refs[key], ref);
|
5772 |
-
} else if (refs[key] === ref) {
|
5773 |
-
refs[key] = undefined;
|
5774 |
-
}
|
5775 |
-
} else {
|
5776 |
-
if (vnode.data.refInFor) {
|
5777 |
-
if (!Array.isArray(refs[key])) {
|
5778 |
-
refs[key] = [ref];
|
5779 |
-
} else if (refs[key].indexOf(ref) < 0) {
|
5780 |
-
// $flow-disable-line
|
5781 |
-
refs[key].push(ref);
|
5782 |
-
}
|
5783 |
-
} else {
|
5784 |
-
refs[key] = ref;
|
5785 |
-
}
|
5786 |
-
}
|
5787 |
-
}
|
5788 |
-
|
5789 |
-
/**
|
5790 |
-
* Virtual DOM patching algorithm based on Snabbdom by
|
5791 |
-
* Simon Friis Vindum (@paldepind)
|
5792 |
-
* Licensed under the MIT License
|
5793 |
-
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
|
5794 |
-
*
|
5795 |
-
* modified by Evan You (@yyx990803)
|
5796 |
-
*
|
5797 |
-
* Not type-checking this because this file is perf-critical and the cost
|
5798 |
-
* of making flow understand it is not worth it.
|
5799 |
-
*/
|
5800 |
-
|
5801 |
-
var emptyNode = new VNode('', {}, []);
|
5802 |
-
|
5803 |
-
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
5804 |
-
|
5805 |
-
function sameVnode (a, b) {
|
5806 |
-
return (
|
5807 |
-
a.key === b.key && (
|
5808 |
-
(
|
5809 |
-
a.tag === b.tag &&
|
5810 |
-
a.isComment === b.isComment &&
|
5811 |
-
isDef(a.data) === isDef(b.data) &&
|
5812 |
-
sameInputType(a, b)
|
5813 |
-
) || (
|
5814 |
-
isTrue(a.isAsyncPlaceholder) &&
|
5815 |
-
a.asyncFactory === b.asyncFactory &&
|
5816 |
-
isUndef(b.asyncFactory.error)
|
5817 |
-
)
|
5818 |
-
)
|
5819 |
-
)
|
5820 |
-
}
|
5821 |
-
|
5822 |
-
function sameInputType (a, b) {
|
5823 |
-
if (a.tag !== 'input') { return true }
|
5824 |
-
var i;
|
5825 |
-
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
5826 |
-
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
5827 |
-
return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
5828 |
-
}
|
5829 |
-
|
5830 |
-
function createKeyToOldIdx (children, beginIdx, endIdx) {
|
5831 |
-
var i, key;
|
5832 |
-
var map = {};
|
5833 |
-
for (i = beginIdx; i <= endIdx; ++i) {
|
5834 |
-
key = children[i].key;
|
5835 |
-
if (isDef(key)) { map[key] = i; }
|
5836 |
-
}
|
5837 |
-
return map
|
5838 |
-
}
|
5839 |
-
|
5840 |
-
function createPatchFunction (backend) {
|
5841 |
-
var i, j;
|
5842 |
-
var cbs = {};
|
5843 |
-
|
5844 |
-
var modules = backend.modules;
|
5845 |
-
var nodeOps = backend.nodeOps;
|
5846 |
-
|
5847 |
-
for (i = 0; i < hooks.length; ++i) {
|
5848 |
-
cbs[hooks[i]] = [];
|
5849 |
-
for (j = 0; j < modules.length; ++j) {
|
5850 |
-
if (isDef(modules[j][hooks[i]])) {
|
5851 |
-
cbs[hooks[i]].push(modules[j][hooks[i]]);
|
5852 |
-
}
|
5853 |
-
}
|
5854 |
-
}
|
5855 |
-
|
5856 |
-
function emptyNodeAt (elm) {
|
5857 |
-
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
5858 |
-
}
|
5859 |
-
|
5860 |
-
function createRmCb (childElm, listeners) {
|
5861 |
-
function remove$$1 () {
|
5862 |
-
if (--remove$$1.listeners === 0) {
|
5863 |
-
removeNode(childElm);
|
5864 |
-
}
|
5865 |
-
}
|
5866 |
-
remove$$1.listeners = listeners;
|
5867 |
-
return remove$$1
|
5868 |
-
}
|
5869 |
-
|
5870 |
-
function removeNode (el) {
|
5871 |
-
var parent = nodeOps.parentNode(el);
|
5872 |
-
// element may have already been removed due to v-html / v-text
|
5873 |
-
if (isDef(parent)) {
|
5874 |
-
nodeOps.removeChild(parent, el);
|
5875 |
-
}
|
5876 |
-
}
|
5877 |
-
|
5878 |
-
function isUnknownElement$$1 (vnode, inVPre) {
|
5879 |
-
return (
|
5880 |
-
!inVPre &&
|
5881 |
-
!vnode.ns &&
|
5882 |
-
!(
|
5883 |
-
config.ignoredElements.length &&
|
5884 |
-
config.ignoredElements.some(function (ignore) {
|
5885 |
-
return isRegExp(ignore)
|
5886 |
-
? ignore.test(vnode.tag)
|
5887 |
-
: ignore === vnode.tag
|
5888 |
-
})
|
5889 |
-
) &&
|
5890 |
-
config.isUnknownElement(vnode.tag)
|
5891 |
-
)
|
5892 |
-
}
|
5893 |
-
|
5894 |
-
var creatingElmInVPre = 0;
|
5895 |
-
|
5896 |
-
function createElm (
|
5897 |
-
vnode,
|
5898 |
-
insertedVnodeQueue,
|
5899 |
-
parentElm,
|
5900 |
-
refElm,
|
5901 |
-
nested,
|
5902 |
-
ownerArray,
|
5903 |
-
index
|
5904 |
-
) {
|
5905 |
-
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
5906 |
-
// This vnode was used in a previous render!
|
5907 |
-
// now it's used as a new node, overwriting its elm would cause
|
5908 |
-
// potential patch errors down the road when it's used as an insertion
|
5909 |
-
// reference node. Instead, we clone the node on-demand before creating
|
5910 |
-
// associated DOM element for it.
|
5911 |
-
vnode = ownerArray[index] = cloneVNode(vnode);
|
5912 |
-
}
|
5913 |
-
|
5914 |
-
vnode.isRootInsert = !nested; // for transition enter check
|
5915 |
-
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
5916 |
-
return
|
5917 |
-
}
|
5918 |
-
|
5919 |
-
var data = vnode.data;
|
5920 |
-
var children = vnode.children;
|
5921 |
-
var tag = vnode.tag;
|
5922 |
-
if (isDef(tag)) {
|
5923 |
-
{
|
5924 |
-
if (data && data.pre) {
|
5925 |
-
creatingElmInVPre++;
|
5926 |
-
}
|
5927 |
-
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
5928 |
-
warn(
|
5929 |
-
'Unknown custom element: <' + tag + '> - did you ' +
|
5930 |
-
'register the component correctly? For recursive components, ' +
|
5931 |
-
'make sure to provide the "name" option.',
|
5932 |
-
vnode.context
|
5933 |
-
);
|
5934 |
-
}
|
5935 |
-
}
|
5936 |
-
|
5937 |
-
vnode.elm = vnode.ns
|
5938 |
-
? nodeOps.createElementNS(vnode.ns, tag)
|
5939 |
-
: nodeOps.createElement(tag, vnode);
|
5940 |
-
setScope(vnode);
|
5941 |
-
|
5942 |
-
/* istanbul ignore if */
|
5943 |
-
{
|
5944 |
-
createChildren(vnode, children, insertedVnodeQueue);
|
5945 |
-
if (isDef(data)) {
|
5946 |
-
invokeCreateHooks(vnode, insertedVnodeQueue);
|
5947 |
-
}
|
5948 |
-
insert(parentElm, vnode.elm, refElm);
|
5949 |
-
}
|
5950 |
-
|
5951 |
-
if (data && data.pre) {
|
5952 |
-
creatingElmInVPre--;
|
5953 |
-
}
|
5954 |
-
} else if (isTrue(vnode.isComment)) {
|
5955 |
-
vnode.elm = nodeOps.createComment(vnode.text);
|
5956 |
-
insert(parentElm, vnode.elm, refElm);
|
5957 |
-
} else {
|
5958 |
-
vnode.elm = nodeOps.createTextNode(vnode.text);
|
5959 |
-
insert(parentElm, vnode.elm, refElm);
|
5960 |
-
}
|
5961 |
-
}
|
5962 |
-
|
5963 |
-
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5964 |
-
var i = vnode.data;
|
5965 |
-
if (isDef(i)) {
|
5966 |
-
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
5967 |
-
if (isDef(i = i.hook) && isDef(i = i.init)) {
|
5968 |
-
i(vnode, false /* hydrating */);
|
5969 |
-
}
|
5970 |
-
// after calling the init hook, if the vnode is a child component
|
5971 |
-
// it should've created a child instance and mounted it. the child
|
5972 |
-
// component also has set the placeholder vnode's elm.
|
5973 |
-
// in that case we can just return the element and be done.
|
5974 |
-
if (isDef(vnode.componentInstance)) {
|
5975 |
-
initComponent(vnode, insertedVnodeQueue);
|
5976 |
-
insert(parentElm, vnode.elm, refElm);
|
5977 |
-
if (isTrue(isReactivated)) {
|
5978 |
-
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
5979 |
-
}
|
5980 |
-
return true
|
5981 |
-
}
|
5982 |
-
}
|
5983 |
-
}
|
5984 |
-
|
5985 |
-
function initComponent (vnode, insertedVnodeQueue) {
|
5986 |
-
if (isDef(vnode.data.pendingInsert)) {
|
5987 |
-
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
5988 |
-
vnode.data.pendingInsert = null;
|
5989 |
-
}
|
5990 |
-
vnode.elm = vnode.componentInstance.$el;
|
5991 |
-
if (isPatchable(vnode)) {
|
5992 |
-
invokeCreateHooks(vnode, insertedVnodeQueue);
|
5993 |
-
setScope(vnode);
|
5994 |
-
} else {
|
5995 |
-
// empty component root.
|
5996 |
-
// skip all element-related modules except for ref (#3455)
|
5997 |
-
registerRef(vnode);
|
5998 |
-
// make sure to invoke the insert hook
|
5999 |
-
insertedVnodeQueue.push(vnode);
|
6000 |
-
}
|
6001 |
-
}
|
6002 |
-
|
6003 |
-
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
6004 |
-
var i;
|
6005 |
-
// hack for #4339: a reactivated component with inner transition
|
6006 |
-
// does not trigger because the inner node's created hooks are not called
|
6007 |
-
// again. It's not ideal to involve module-specific logic in here but
|
6008 |
-
// there doesn't seem to be a better way to do it.
|
6009 |
-
var innerNode = vnode;
|
6010 |
-
while (innerNode.componentInstance) {
|
6011 |
-
innerNode = innerNode.componentInstance._vnode;
|
6012 |
-
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
6013 |
-
for (i = 0; i < cbs.activate.length; ++i) {
|
6014 |
-
cbs.activate[i](emptyNode, innerNode);
|
6015 |
-
}
|
6016 |
-
insertedVnodeQueue.push(innerNode);
|
6017 |
-
break
|
6018 |
-
}
|
6019 |
-
}
|
6020 |
-
// unlike a newly created component,
|
6021 |
-
// a reactivated keep-alive component doesn't insert itself
|
6022 |
-
insert(parentElm, vnode.elm, refElm);
|
6023 |
-
}
|
6024 |
-
|
6025 |
-
function insert (parent, elm, ref$$1) {
|
6026 |
-
if (isDef(parent)) {
|
6027 |
-
if (isDef(ref$$1)) {
|
6028 |
-
if (nodeOps.parentNode(ref$$1) === parent) {
|
6029 |
-
nodeOps.insertBefore(parent, elm, ref$$1);
|
6030 |
-
}
|
6031 |
-
} else {
|
6032 |
-
nodeOps.appendChild(parent, elm);
|
6033 |
-
}
|
6034 |
-
}
|
6035 |
-
}
|
6036 |
-
|
6037 |
-
function createChildren (vnode, children, insertedVnodeQueue) {
|
6038 |
-
if (Array.isArray(children)) {
|
6039 |
-
{
|
6040 |
-
checkDuplicateKeys(children);
|
6041 |
-
}
|
6042 |
-
for (var i = 0; i < children.length; ++i) {
|
6043 |
-
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
6044 |
-
}
|
6045 |
-
} else if (isPrimitive(vnode.text)) {
|
6046 |
-
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
6047 |
-
}
|
6048 |
-
}
|
6049 |
-
|
6050 |
-
function isPatchable (vnode) {
|
6051 |
-
while (vnode.componentInstance) {
|
6052 |
-
vnode = vnode.componentInstance._vnode;
|
6053 |
-
}
|
6054 |
-
return isDef(vnode.tag)
|
6055 |
-
}
|
6056 |
-
|
6057 |
-
function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
6058 |
-
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6059 |
-
cbs.create[i$1](emptyNode, vnode);
|
6060 |
-
}
|
6061 |
-
i = vnode.data.hook; // Reuse variable
|
6062 |
-
if (isDef(i)) {
|
6063 |
-
if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
6064 |
-
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
6065 |
-
}
|
6066 |
-
}
|
6067 |
-
|
6068 |
-
// set scope id attribute for scoped CSS.
|
6069 |
-
// this is implemented as a special case to avoid the overhead
|
6070 |
-
// of going through the normal attribute patching process.
|
6071 |
-
function setScope (vnode) {
|
6072 |
-
var i;
|
6073 |
-
if (isDef(i = vnode.fnScopeId)) {
|
6074 |
-
nodeOps.setStyleScope(vnode.elm, i);
|
6075 |
-
} else {
|
6076 |
-
var ancestor = vnode;
|
6077 |
-
while (ancestor) {
|
6078 |
-
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
6079 |
-
nodeOps.setStyleScope(vnode.elm, i);
|
6080 |
-
}
|
6081 |
-
ancestor = ancestor.parent;
|
6082 |
-
}
|
6083 |
-
}
|
6084 |
-
// for slot content they should also get the scopeId from the host instance.
|
6085 |
-
if (isDef(i = activeInstance) &&
|
6086 |
-
i !== vnode.context &&
|
6087 |
-
i !== vnode.fnContext &&
|
6088 |
-
isDef(i = i.$options._scopeId)
|
6089 |
-
) {
|
6090 |
-
nodeOps.setStyleScope(vnode.elm, i);
|
6091 |
-
}
|
6092 |
-
}
|
6093 |
-
|
6094 |
-
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
6095 |
-
for (; startIdx <= endIdx; ++startIdx) {
|
6096 |
-
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
6097 |
-
}
|
6098 |
-
}
|
6099 |
-
|
6100 |
-
function invokeDestroyHook (vnode) {
|
6101 |
-
var i, j;
|
6102 |
-
var data = vnode.data;
|
6103 |
-
if (isDef(data)) {
|
6104 |
-
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
6105 |
-
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
6106 |
-
}
|
6107 |
-
if (isDef(i = vnode.children)) {
|
6108 |
-
for (j = 0; j < vnode.children.length; ++j) {
|
6109 |
-
invokeDestroyHook(vnode.children[j]);
|
6110 |
-
}
|
6111 |
-
}
|
6112 |
-
}
|
6113 |
-
|
6114 |
-
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
|
6115 |
-
for (; startIdx <= endIdx; ++startIdx) {
|
6116 |
-
var ch = vnodes[startIdx];
|
6117 |
-
if (isDef(ch)) {
|
6118 |
-
if (isDef(ch.tag)) {
|
6119 |
-
removeAndInvokeRemoveHook(ch);
|
6120 |
-
invokeDestroyHook(ch);
|
6121 |
-
} else { // Text node
|
6122 |
-
removeNode(ch.elm);
|
6123 |
-
}
|
6124 |
-
}
|
6125 |
-
}
|
6126 |
-
}
|
6127 |
-
|
6128 |
-
function removeAndInvokeRemoveHook (vnode, rm) {
|
6129 |
-
if (isDef(rm) || isDef(vnode.data)) {
|
6130 |
-
var i;
|
6131 |
-
var listeners = cbs.remove.length + 1;
|
6132 |
-
if (isDef(rm)) {
|
6133 |
-
// we have a recursively passed down rm callback
|
6134 |
-
// increase the listeners count
|
6135 |
-
rm.listeners += listeners;
|
6136 |
-
} else {
|
6137 |
-
// directly removing
|
6138 |
-
rm = createRmCb(vnode.elm, listeners);
|
6139 |
-
}
|
6140 |
-
// recursively invoke hooks on child component root node
|
6141 |
-
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
6142 |
-
removeAndInvokeRemoveHook(i, rm);
|
6143 |
-
}
|
6144 |
-
for (i = 0; i < cbs.remove.length; ++i) {
|
6145 |
-
cbs.remove[i](vnode, rm);
|
6146 |
-
}
|
6147 |
-
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
6148 |
-
i(vnode, rm);
|
6149 |
-
} else {
|
6150 |
-
rm();
|
6151 |
-
}
|
6152 |
-
} else {
|
6153 |
-
removeNode(vnode.elm);
|
6154 |
-
}
|
6155 |
-
}
|
6156 |
-
|
6157 |
-
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6158 |
-
var oldStartIdx = 0;
|
6159 |
-
var newStartIdx = 0;
|
6160 |
-
var oldEndIdx = oldCh.length - 1;
|
6161 |
-
var oldStartVnode = oldCh[0];
|
6162 |
-
var oldEndVnode = oldCh[oldEndIdx];
|
6163 |
-
var newEndIdx = newCh.length - 1;
|
6164 |
-
var newStartVnode = newCh[0];
|
6165 |
-
var newEndVnode = newCh[newEndIdx];
|
6166 |
-
var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6167 |
-
|
6168 |
-
// removeOnly is a special flag used only by <transition-group>
|
6169 |
-
// to ensure removed elements stay in correct relative positions
|
6170 |
-
// during leaving transitions
|
6171 |
-
var canMove = !removeOnly;
|
6172 |
-
|
6173 |
-
{
|
6174 |
-
checkDuplicateKeys(newCh);
|
6175 |
-
}
|
6176 |
-
|
6177 |
-
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6178 |
-
if (isUndef(oldStartVnode)) {
|
6179 |
-
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
|
6180 |
-
} else if (isUndef(oldEndVnode)) {
|
6181 |
-
oldEndVnode = oldCh[--oldEndIdx];
|
6182 |
-
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6183 |
-
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6184 |
-
oldStartVnode = oldCh[++oldStartIdx];
|
6185 |
-
newStartVnode = newCh[++newStartIdx];
|
6186 |
-
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6187 |
-
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6188 |
-
oldEndVnode = oldCh[--oldEndIdx];
|
6189 |
-
newEndVnode = newCh[--newEndIdx];
|
6190 |
-
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
|
6191 |
-
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6192 |
-
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6193 |
-
oldStartVnode = oldCh[++oldStartIdx];
|
6194 |
-
newEndVnode = newCh[--newEndIdx];
|
6195 |
-
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
|
6196 |
-
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6197 |
-
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6198 |
-
oldEndVnode = oldCh[--oldEndIdx];
|
6199 |
-
newStartVnode = newCh[++newStartIdx];
|
6200 |
-
} else {
|
6201 |
-
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
6202 |
-
idxInOld = isDef(newStartVnode.key)
|
6203 |
-
? oldKeyToIdx[newStartVnode.key]
|
6204 |
-
: findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6205 |
-
if (isUndef(idxInOld)) { // New element
|
6206 |
-
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6207 |
-
} else {
|
6208 |
-
vnodeToMove = oldCh[idxInOld];
|
6209 |
-
if (sameVnode(vnodeToMove, newStartVnode)) {
|
6210 |
-
patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6211 |
-
oldCh[idxInOld] = undefined;
|
6212 |
-
canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6213 |
-
} else {
|
6214 |
-
// same key but different element. treat as new element
|
6215 |
-
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6216 |
-
}
|
6217 |
-
}
|
6218 |
-
newStartVnode = newCh[++newStartIdx];
|
6219 |
-
}
|
6220 |
-
}
|
6221 |
-
if (oldStartIdx > oldEndIdx) {
|
6222 |
-
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6223 |
-
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6224 |
-
} else if (newStartIdx > newEndIdx) {
|
6225 |
-
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
6226 |
-
}
|
6227 |
-
}
|
6228 |
-
|
6229 |
-
function checkDuplicateKeys (children) {
|
6230 |
-
var seenKeys = {};
|
6231 |
-
for (var i = 0; i < children.length; i++) {
|
6232 |
-
var vnode = children[i];
|
6233 |
-
var key = vnode.key;
|
6234 |
-
if (isDef(key)) {
|
6235 |
-
if (seenKeys[key]) {
|
6236 |
-
warn(
|
6237 |
-
("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
6238 |
-
vnode.context
|
6239 |
-
);
|
6240 |
-
} else {
|
6241 |
-
seenKeys[key] = true;
|
6242 |
-
}
|
6243 |
-
}
|
6244 |
-
}
|
6245 |
-
}
|
6246 |
-
|
6247 |
-
function findIdxInOld (node, oldCh, start, end) {
|
6248 |
-
for (var i = start; i < end; i++) {
|
6249 |
-
var c = oldCh[i];
|
6250 |
-
if (isDef(c) && sameVnode(node, c)) { return i }
|
6251 |
-
}
|
6252 |
-
}
|
6253 |
-
|
6254 |
-
function patchVnode (
|
6255 |
-
oldVnode,
|
6256 |
-
vnode,
|
6257 |
-
insertedVnodeQueue,
|
6258 |
-
ownerArray,
|
6259 |
-
index,
|
6260 |
-
removeOnly
|
6261 |
-
) {
|
6262 |
-
if (oldVnode === vnode) {
|
6263 |
-
return
|
6264 |
-
}
|
6265 |
-
|
6266 |
-
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6267 |
-
// clone reused vnode
|
6268 |
-
vnode = ownerArray[index] = cloneVNode(vnode);
|
6269 |
-
}
|
6270 |
-
|
6271 |
-
var elm = vnode.elm = oldVnode.elm;
|
6272 |
-
|
6273 |
-
if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6274 |
-
if (isDef(vnode.asyncFactory.resolved)) {
|
6275 |
-
hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6276 |
-
} else {
|
6277 |
-
vnode.isAsyncPlaceholder = true;
|
6278 |
-
}
|
6279 |
-
return
|
6280 |
-
}
|
6281 |
-
|
6282 |
-
// reuse element for static trees.
|
6283 |
-
// note we only do this if the vnode is cloned -
|
6284 |
-
// if the new node is not cloned it means the render functions have been
|
6285 |
-
// reset by the hot-reload-api and we need to do a proper re-render.
|
6286 |
-
if (isTrue(vnode.isStatic) &&
|
6287 |
-
isTrue(oldVnode.isStatic) &&
|
6288 |
-
vnode.key === oldVnode.key &&
|
6289 |
-
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
6290 |
-
) {
|
6291 |
-
vnode.componentInstance = oldVnode.componentInstance;
|
6292 |
-
return
|
6293 |
-
}
|
6294 |
-
|
6295 |
-
var i;
|
6296 |
-
var data = vnode.data;
|
6297 |
-
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
6298 |
-
i(oldVnode, vnode);
|
6299 |
-
}
|
6300 |
-
|
6301 |
-
var oldCh = oldVnode.children;
|
6302 |
-
var ch = vnode.children;
|
6303 |
-
if (isDef(data) && isPatchable(vnode)) {
|
6304 |
-
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
6305 |
-
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
6306 |
-
}
|
6307 |
-
if (isUndef(vnode.text)) {
|
6308 |
-
if (isDef(oldCh) && isDef(ch)) {
|
6309 |
-
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
6310 |
-
} else if (isDef(ch)) {
|
6311 |
-
{
|
6312 |
-
checkDuplicateKeys(ch);
|
6313 |
-
}
|
6314 |
-
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
6315 |
-
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6316 |
-
} else if (isDef(oldCh)) {
|
6317 |
-
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
|
6318 |
-
} else if (isDef(oldVnode.text)) {
|
6319 |
-
nodeOps.setTextContent(elm, '');
|
6320 |
-
}
|
6321 |
-
} else if (oldVnode.text !== vnode.text) {
|
6322 |
-
nodeOps.setTextContent(elm, vnode.text);
|
6323 |
-
}
|
6324 |
-
if (isDef(data)) {
|
6325 |
-
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
6326 |
-
}
|
6327 |
-
}
|
6328 |
-
|
6329 |
-
function invokeInsertHook (vnode, queue, initial) {
|
6330 |
-
// delay insert hooks for component root nodes, invoke them after the
|
6331 |
-
// element is really inserted
|
6332 |
-
if (isTrue(initial) && isDef(vnode.parent)) {
|
6333 |
-
vnode.parent.data.pendingInsert = queue;
|
6334 |
-
} else {
|
6335 |
-
for (var i = 0; i < queue.length; ++i) {
|
6336 |
-
queue[i].data.hook.insert(queue[i]);
|
6337 |
-
}
|
6338 |
-
}
|
6339 |
-
}
|
6340 |
-
|
6341 |
-
var hydrationBailed = false;
|
6342 |
-
// list of modules that can skip create hook during hydration because they
|
6343 |
-
// are already rendered on the client or has no need for initialization
|
6344 |
-
// Note: style is excluded because it relies on initial clone for future
|
6345 |
-
// deep updates (#7063).
|
6346 |
-
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6347 |
-
|
6348 |
-
// Note: this is a browser-only function so we can assume elms are DOM nodes.
|
6349 |
-
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
6350 |
-
var i;
|
6351 |
-
var tag = vnode.tag;
|
6352 |
-
var data = vnode.data;
|
6353 |
-
var children = vnode.children;
|
6354 |
-
inVPre = inVPre || (data && data.pre);
|
6355 |
-
vnode.elm = elm;
|
6356 |
-
|
6357 |
-
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6358 |
-
vnode.isAsyncPlaceholder = true;
|
6359 |
-
return true
|
6360 |
-
}
|
6361 |
-
// assert node match
|
6362 |
-
{
|
6363 |
-
if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6364 |
-
return false
|
6365 |
-
}
|
6366 |
-
}
|
6367 |
-
if (isDef(data)) {
|
6368 |
-
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
|
6369 |
-
if (isDef(i = vnode.componentInstance)) {
|
6370 |
-
// child component. it should have hydrated its own tree.
|
6371 |
-
initComponent(vnode, insertedVnodeQueue);
|
6372 |
-
return true
|
6373 |
-
}
|
6374 |
-
}
|
6375 |
-
if (isDef(tag)) {
|
6376 |
-
if (isDef(children)) {
|
6377 |
-
// empty element, allow client to pick up and populate children
|
6378 |
-
if (!elm.hasChildNodes()) {
|
6379 |
-
createChildren(vnode, children, insertedVnodeQueue);
|
6380 |
-
} else {
|
6381 |
-
// v-html and domProps: innerHTML
|
6382 |
-
if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
6383 |
-
if (i !== elm.innerHTML) {
|
6384 |
-
/* istanbul ignore if */
|
6385 |
-
if (typeof console !== 'undefined' &&
|
6386 |
-
!hydrationBailed
|
6387 |
-
) {
|
6388 |
-
hydrationBailed = true;
|
6389 |
-
console.warn('Parent: ', elm);
|
6390 |
-
console.warn('server innerHTML: ', i);
|
6391 |
-
console.warn('client innerHTML: ', elm.innerHTML);
|
6392 |
-
}
|
6393 |
-
return false
|
6394 |
-
}
|
6395 |
-
} else {
|
6396 |
-
// iterate and compare children lists
|
6397 |
-
var childrenMatch = true;
|
6398 |
-
var childNode = elm.firstChild;
|
6399 |
-
for (var i$1 = 0; i$1 < children.length; i$1++) {
|
6400 |
-
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
6401 |
-
childrenMatch = false;
|
6402 |
-
break
|
6403 |
-
}
|
6404 |
-
childNode = childNode.nextSibling;
|
6405 |
-
}
|
6406 |
-
// if childNode is not null, it means the actual childNodes list is
|
6407 |
-
// longer than the virtual children list.
|
6408 |
-
if (!childrenMatch || childNode) {
|
6409 |
-
/* istanbul ignore if */
|
6410 |
-
if (typeof console !== 'undefined' &&
|
6411 |
-
!hydrationBailed
|
6412 |
-
) {
|
6413 |
-
hydrationBailed = true;
|
6414 |
-
console.warn('Parent: ', elm);
|
6415 |
-
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
6416 |
-
}
|
6417 |
-
return false
|
6418 |
-
}
|
6419 |
-
}
|
6420 |
-
}
|
6421 |
-
}
|
6422 |
-
if (isDef(data)) {
|
6423 |
-
var fullInvoke = false;
|
6424 |
-
for (var key in data) {
|
6425 |
-
if (!isRenderedModule(key)) {
|
6426 |
-
fullInvoke = true;
|
6427 |
-
invokeCreateHooks(vnode, insertedVnodeQueue);
|
6428 |
-
break
|
6429 |
-
}
|
6430 |
-
}
|
6431 |
-
if (!fullInvoke && data['class']) {
|
6432 |
-
// ensure collecting deps for deep class bindings for future updates
|
6433 |
-
traverse(data['class']);
|
6434 |
-
}
|
6435 |
-
}
|
6436 |
-
} else if (elm.data !== vnode.text) {
|
6437 |
-
elm.data = vnode.text;
|
6438 |
-
}
|
6439 |
-
return true
|
6440 |
-
}
|
6441 |
-
|
6442 |
-
function assertNodeMatch (node, vnode, inVPre) {
|
6443 |
-
if (isDef(vnode.tag)) {
|
6444 |
-
return vnode.tag.indexOf('vue-component') === 0 || (
|
6445 |
-
!isUnknownElement$$1(vnode, inVPre) &&
|
6446 |
-
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
6447 |
-
)
|
6448 |
-
} else {
|
6449 |
-
return node.nodeType === (vnode.isComment ? 8 : 3)
|
6450 |
-
}
|
6451 |
-
}
|
6452 |
-
|
6453 |
-
return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
6454 |
-
if (isUndef(vnode)) {
|
6455 |
-
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
6456 |
-
return
|
6457 |
-
}
|
6458 |
-
|
6459 |
-
var isInitialPatch = false;
|
6460 |
-
var insertedVnodeQueue = [];
|
6461 |
-
|
6462 |
-
if (isUndef(oldVnode)) {
|
6463 |
-
// empty mount (likely as component), create new root element
|
6464 |
-
isInitialPatch = true;
|
6465 |
-
createElm(vnode, insertedVnodeQueue);
|
6466 |
-
} else {
|
6467 |
-
var isRealElement = isDef(oldVnode.nodeType);
|
6468 |
-
if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
6469 |
-
// patch existing root node
|
6470 |
-
patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
6471 |
-
} else {
|
6472 |
-
if (isRealElement) {
|
6473 |
-
// mounting to a real element
|
6474 |
-
// check if this is server-rendered content and if we can perform
|
6475 |
-
// a successful hydration.
|
6476 |
-
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
6477 |
-
oldVnode.removeAttribute(SSR_ATTR);
|
6478 |
-
hydrating = true;
|
6479 |
-
}
|
6480 |
-
if (isTrue(hydrating)) {
|
6481 |
-
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
6482 |
-
invokeInsertHook(vnode, insertedVnodeQueue, true);
|
6483 |
-
return oldVnode
|
6484 |
-
} else {
|
6485 |
-
warn(
|
6486 |
-
'The client-side rendered virtual DOM tree is not matching ' +
|
6487 |
-
'server-rendered content. This is likely caused by incorrect ' +
|
6488 |
-
'HTML markup, for example nesting block-level elements inside ' +
|
6489 |
-
'<p>, or missing <tbody>. Bailing hydration and performing ' +
|
6490 |
-
'full client-side render.'
|
6491 |
-
);
|
6492 |
-
}
|
6493 |
-
}
|
6494 |
-
// either not server-rendered, or hydration failed.
|
6495 |
-
// create an empty node and replace it
|
6496 |
-
oldVnode = emptyNodeAt(oldVnode);
|
6497 |
-
}
|
6498 |
-
|
6499 |
-
// replacing existing element
|
6500 |
-
var oldElm = oldVnode.elm;
|
6501 |
-
var parentElm = nodeOps.parentNode(oldElm);
|
6502 |
-
|
6503 |
-
// create new node
|
6504 |
-
createElm(
|
6505 |
-
vnode,
|
6506 |
-
insertedVnodeQueue,
|
6507 |
-
// extremely rare edge case: do not insert if old element is in a
|
6508 |
-
// leaving transition. Only happens when combining transition +
|
6509 |
-
// keep-alive + HOCs. (#4590)
|
6510 |
-
oldElm._leaveCb ? null : parentElm,
|
6511 |
-
nodeOps.nextSibling(oldElm)
|
6512 |
-
);
|
6513 |
-
|
6514 |
-
// update parent placeholder node element, recursively
|
6515 |
-
if (isDef(vnode.parent)) {
|
6516 |
-
var ancestor = vnode.parent;
|
6517 |
-
var patchable = isPatchable(vnode);
|
6518 |
-
while (ancestor) {
|
6519 |
-
for (var i = 0; i < cbs.destroy.length; ++i) {
|
6520 |
-
cbs.destroy[i](ancestor);
|
6521 |
-
}
|
6522 |
-
ancestor.elm = vnode.elm;
|
6523 |
-
if (patchable) {
|
6524 |
-
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6525 |
-
cbs.create[i$1](emptyNode, ancestor);
|
6526 |
-
}
|
6527 |
-
// #6513
|
6528 |
-
// invoke insert hooks that may have been merged by create hooks.
|
6529 |
-
// e.g. for directives that uses the "inserted" hook.
|
6530 |
-
var insert = ancestor.data.hook.insert;
|
6531 |
-
if (insert.merged) {
|
6532 |
-
// start at index 1 to avoid re-invoking component mounted hook
|
6533 |
-
for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
6534 |
-
insert.fns[i$2]();
|
6535 |
-
}
|
6536 |
-
}
|
6537 |
-
} else {
|
6538 |
-
registerRef(ancestor);
|
6539 |
-
}
|
6540 |
-
ancestor = ancestor.parent;
|
6541 |
-
}
|
6542 |
-
}
|
6543 |
-
|
6544 |
-
// destroy old node
|
6545 |
-
if (isDef(parentElm)) {
|
6546 |
-
removeVnodes(parentElm, [oldVnode], 0, 0);
|
6547 |
-
} else if (isDef(oldVnode.tag)) {
|
6548 |
-
invokeDestroyHook(oldVnode);
|
6549 |
-
}
|
6550 |
-
}
|
6551 |
-
}
|
6552 |
-
|
6553 |
-
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
6554 |
-
return vnode.elm
|
6555 |
-
}
|
6556 |
-
}
|
6557 |
-
|
6558 |
-
/* */
|
6559 |
-
|
6560 |
-
var directives = {
|
6561 |
-
create: updateDirectives,
|
6562 |
-
update: updateDirectives,
|
6563 |
-
destroy: function unbindDirectives (vnode) {
|
6564 |
-
updateDirectives(vnode, emptyNode);
|
6565 |
-
}
|
6566 |
-
};
|
6567 |
-
|
6568 |
-
function updateDirectives (oldVnode, vnode) {
|
6569 |
-
if (oldVnode.data.directives || vnode.data.directives) {
|
6570 |
-
_update(oldVnode, vnode);
|
6571 |
-
}
|
6572 |
-
}
|
6573 |
-
|
6574 |
-
function _update (oldVnode, vnode) {
|
6575 |
-
var isCreate = oldVnode === emptyNode;
|
6576 |
-
var isDestroy = vnode === emptyNode;
|
6577 |
-
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
6578 |
-
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
6579 |
-
|
6580 |
-
var dirsWithInsert = [];
|
6581 |
-
var dirsWithPostpatch = [];
|
6582 |
-
|
6583 |
-
var key, oldDir, dir;
|
6584 |
-
for (key in newDirs) {
|
6585 |
-
oldDir = oldDirs[key];
|
6586 |
-
dir = newDirs[key];
|
6587 |
-
if (!oldDir) {
|
6588 |
-
// new directive, bind
|
6589 |
-
callHook$1(dir, 'bind', vnode, oldVnode);
|
6590 |
-
if (dir.def && dir.def.inserted) {
|
6591 |
-
dirsWithInsert.push(dir);
|
6592 |
-
}
|
6593 |
-
} else {
|
6594 |
-
// existing directive, update
|
6595 |
-
dir.oldValue = oldDir.value;
|
6596 |
-
dir.oldArg = oldDir.arg;
|
6597 |
-
callHook$1(dir, 'update', vnode, oldVnode);
|
6598 |
-
if (dir.def && dir.def.componentUpdated) {
|
6599 |
-
dirsWithPostpatch.push(dir);
|
6600 |
-
}
|
6601 |
-
}
|
6602 |
-
}
|
6603 |
-
|
6604 |
-
if (dirsWithInsert.length) {
|
6605 |
-
var callInsert = function () {
|
6606 |
-
for (var i = 0; i < dirsWithInsert.length; i++) {
|
6607 |
-
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
6608 |
-
}
|
6609 |
-
};
|
6610 |
-
if (isCreate) {
|
6611 |
-
mergeVNodeHook(vnode, 'insert', callInsert);
|
6612 |
-
} else {
|
6613 |
-
callInsert();
|
6614 |
-
}
|
6615 |
-
}
|
6616 |
-
|
6617 |
-
if (dirsWithPostpatch.length) {
|
6618 |
-
mergeVNodeHook(vnode, 'postpatch', function () {
|
6619 |
-
for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
6620 |
-
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
6621 |
-
}
|
6622 |
-
});
|
6623 |
-
}
|
6624 |
-
|
6625 |
-
if (!isCreate) {
|
6626 |
-
for (key in oldDirs) {
|
6627 |
-
if (!newDirs[key]) {
|
6628 |
-
// no longer present, unbind
|
6629 |
-
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
6630 |
-
}
|
6631 |
-
}
|
6632 |
-
}
|
6633 |
-
}
|
6634 |
-
|
6635 |
-
var emptyModifiers = Object.create(null);
|
6636 |
-
|
6637 |
-
function normalizeDirectives$1 (
|
6638 |
-
dirs,
|
6639 |
-
vm
|
6640 |
-
) {
|
6641 |
-
var res = Object.create(null);
|
6642 |
-
if (!dirs) {
|
6643 |
-
// $flow-disable-line
|
6644 |
-
return res
|
6645 |
-
}
|
6646 |
-
var i, dir;
|
6647 |
-
for (i = 0; i < dirs.length; i++) {
|
6648 |
-
dir = dirs[i];
|
6649 |
-
if (!dir.modifiers) {
|
6650 |
-
// $flow-disable-line
|
6651 |
-
dir.modifiers = emptyModifiers;
|
6652 |
-
}
|
6653 |
-
res[getRawDirName(dir)] = dir;
|
6654 |
-
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
6655 |
-
}
|
6656 |
-
// $flow-disable-line
|
6657 |
-
return res
|
6658 |
-
}
|
6659 |
-
|
6660 |
-
function getRawDirName (dir) {
|
6661 |
-
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
6662 |
-
}
|
6663 |
-
|
6664 |
-
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
6665 |
-
var fn = dir.def && dir.def[hook];
|
6666 |
-
if (fn) {
|
6667 |
-
try {
|
6668 |
-
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
6669 |
-
} catch (e) {
|
6670 |
-
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
6671 |
-
}
|
6672 |
-
}
|
6673 |
-
}
|
6674 |
-
|
6675 |
-
var baseModules = [
|
6676 |
-
ref,
|
6677 |
-
directives
|
6678 |
-
];
|
6679 |
-
|
6680 |
-
/* */
|
6681 |
-
|
6682 |
-
function updateAttrs (oldVnode, vnode) {
|
6683 |
-
var opts = vnode.componentOptions;
|
6684 |
-
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
6685 |
-
return
|
6686 |
-
}
|
6687 |
-
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
6688 |
-
return
|
6689 |
-
}
|
6690 |
-
var key, cur, old;
|
6691 |
-
var elm = vnode.elm;
|
6692 |
-
var oldAttrs = oldVnode.data.attrs || {};
|
6693 |
-
var attrs = vnode.data.attrs || {};
|
6694 |
-
// clone observed objects, as the user probably wants to mutate it
|
6695 |
-
if (isDef(attrs.__ob__)) {
|
6696 |
-
attrs = vnode.data.attrs = extend({}, attrs);
|
6697 |
-
}
|
6698 |
-
|
6699 |
-
for (key in attrs) {
|
6700 |
-
cur = attrs[key];
|
6701 |
-
old = oldAttrs[key];
|
6702 |
-
if (old !== cur) {
|
6703 |
-
setAttr(elm, key, cur);
|
6704 |
-
}
|
6705 |
-
}
|
6706 |
-
// #4391: in IE9, setting type can reset value for input[type=radio]
|
6707 |
-
// #6666: IE/Edge forces progress value down to 1 before setting a max
|
6708 |
-
/* istanbul ignore if */
|
6709 |
-
if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
6710 |
-
setAttr(elm, 'value', attrs.value);
|
6711 |
-
}
|
6712 |
-
for (key in oldAttrs) {
|
6713 |
-
if (isUndef(attrs[key])) {
|
6714 |
-
if (isXlink(key)) {
|
6715 |
-
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6716 |
-
} else if (!isEnumeratedAttr(key)) {
|
6717 |
-
elm.removeAttribute(key);
|
6718 |
-
}
|
6719 |
-
}
|
6720 |
-
}
|
6721 |
-
}
|
6722 |
-
|
6723 |
-
function setAttr (el, key, value) {
|
6724 |
-
if (el.tagName.indexOf('-') > -1) {
|
6725 |
-
baseSetAttr(el, key, value);
|
6726 |
-
} else if (isBooleanAttr(key)) {
|
6727 |
-
// set attribute for blank value
|
6728 |
-
// e.g. <option disabled>Select one</option>
|
6729 |
-
if (isFalsyAttrValue(value)) {
|
6730 |
-
el.removeAttribute(key);
|
6731 |
-
} else {
|
6732 |
-
// technically allowfullscreen is a boolean attribute for <iframe>,
|
6733 |
-
// but Flash expects a value of "true" when used on <embed> tag
|
6734 |
-
value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
6735 |
-
? 'true'
|
6736 |
-
: key;
|
6737 |
-
el.setAttribute(key, value);
|
6738 |
-
}
|
6739 |
-
} else if (isEnumeratedAttr(key)) {
|
6740 |
-
el.setAttribute(key, convertEnumeratedValue(key, value));
|
6741 |
-
} else if (isXlink(key)) {
|
6742 |
-
if (isFalsyAttrValue(value)) {
|
6743 |
-
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6744 |
-
} else {
|
6745 |
-
el.setAttributeNS(xlinkNS, key, value);
|
6746 |
-
}
|
6747 |
-
} else {
|
6748 |
-
baseSetAttr(el, key, value);
|
6749 |
-
}
|
6750 |
-
}
|
6751 |
-
|
6752 |
-
function baseSetAttr (el, key, value) {
|
6753 |
-
if (isFalsyAttrValue(value)) {
|
6754 |
-
el.removeAttribute(key);
|
6755 |
-
} else {
|
6756 |
-
// #7138: IE10 & 11 fires input event when setting placeholder on
|
6757 |
-
// <textarea>... block the first input event and remove the blocker
|
6758 |
-
// immediately.
|
6759 |
-
/* istanbul ignore if */
|
6760 |
-
if (
|
6761 |
-
isIE && !isIE9 &&
|
6762 |
-
el.tagName === 'TEXTAREA' &&
|
6763 |
-
key === 'placeholder' && value !== '' && !el.__ieph
|
6764 |
-
) {
|
6765 |
-
var blocker = function (e) {
|
6766 |
-
e.stopImmediatePropagation();
|
6767 |
-
el.removeEventListener('input', blocker);
|
6768 |
-
};
|
6769 |
-
el.addEventListener('input', blocker);
|
6770 |
-
// $flow-disable-line
|
6771 |
-
el.__ieph = true; /* IE placeholder patched */
|
6772 |
-
}
|
6773 |
-
el.setAttribute(key, value);
|
6774 |
-
}
|
6775 |
-
}
|
6776 |
-
|
6777 |
-
var attrs = {
|
6778 |
-
create: updateAttrs,
|
6779 |
-
update: updateAttrs
|
6780 |
-
};
|
6781 |
-
|
6782 |
-
/* */
|
6783 |
-
|
6784 |
-
function updateClass (oldVnode, vnode) {
|
6785 |
-
var el = vnode.elm;
|
6786 |
-
var data = vnode.data;
|
6787 |
-
var oldData = oldVnode.data;
|
6788 |
-
if (
|
6789 |
-
isUndef(data.staticClass) &&
|
6790 |
-
isUndef(data.class) && (
|
6791 |
-
isUndef(oldData) || (
|
6792 |
-
isUndef(oldData.staticClass) &&
|
6793 |
-
isUndef(oldData.class)
|
6794 |
-
)
|
6795 |
-
)
|
6796 |
-
) {
|
6797 |
-
return
|
6798 |
-
}
|
6799 |
-
|
6800 |
-
var cls = genClassForVnode(vnode);
|
6801 |
-
|
6802 |
-
// handle transition classes
|
6803 |
-
var transitionClass = el._transitionClasses;
|
6804 |
-
if (isDef(transitionClass)) {
|
6805 |
-
cls = concat(cls, stringifyClass(transitionClass));
|
6806 |
-
}
|
6807 |
-
|
6808 |
-
// set the class
|
6809 |
-
if (cls !== el._prevClass) {
|
6810 |
-
el.setAttribute('class', cls);
|
6811 |
-
el._prevClass = cls;
|
6812 |
-
}
|
6813 |
-
}
|
6814 |
-
|
6815 |
-
var klass = {
|
6816 |
-
create: updateClass,
|
6817 |
-
update: updateClass
|
6818 |
-
};
|
6819 |
-
|
6820 |
-
/* */
|
6821 |
-
|
6822 |
-
var validDivisionCharRE = /[\w).+\-_$\]]/;
|
6823 |
-
|
6824 |
-
function parseFilters (exp) {
|
6825 |
-
var inSingle = false;
|
6826 |
-
var inDouble = false;
|
6827 |
-
var inTemplateString = false;
|
6828 |
-
var inRegex = false;
|
6829 |
-
var curly = 0;
|
6830 |
-
var square = 0;
|
6831 |
-
var paren = 0;
|
6832 |
-
var lastFilterIndex = 0;
|
6833 |
-
var c, prev, i, expression, filters;
|
6834 |
-
|
6835 |
-
for (i = 0; i < exp.length; i++) {
|
6836 |
-
prev = c;
|
6837 |
-
c = exp.charCodeAt(i);
|
6838 |
-
if (inSingle) {
|
6839 |
-
if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
|
6840 |
-
} else if (inDouble) {
|
6841 |
-
if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
|
6842 |
-
} else if (inTemplateString) {
|
6843 |
-
if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
|
6844 |
-
} else if (inRegex) {
|
6845 |
-
if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
|
6846 |
-
} else if (
|
6847 |
-
c === 0x7C && // pipe
|
6848 |
-
exp.charCodeAt(i + 1) !== 0x7C &&
|
6849 |
-
exp.charCodeAt(i - 1) !== 0x7C &&
|
6850 |
-
!curly && !square && !paren
|
6851 |
-
) {
|
6852 |
-
if (expression === undefined) {
|
6853 |
-
// first filter, end of expression
|
6854 |
-
lastFilterIndex = i + 1;
|
6855 |
-
expression = exp.slice(0, i).trim();
|
6856 |
-
} else {
|
6857 |
-
pushFilter();
|
6858 |
-
}
|
6859 |
-
} else {
|
6860 |
-
switch (c) {
|
6861 |
-
case 0x22: inDouble = true; break // "
|
6862 |
-
case 0x27: inSingle = true; break // '
|
6863 |
-
case 0x60: inTemplateString = true; break // `
|
6864 |
-
case 0x28: paren++; break // (
|
6865 |
-
case 0x29: paren--; break // )
|
6866 |
-
case 0x5B: square++; break // [
|
6867 |
-
case 0x5D: square--; break // ]
|
6868 |
-
case 0x7B: curly++; break // {
|
6869 |
-
case 0x7D: curly--; break // }
|
6870 |
-
}
|
6871 |
-
if (c === 0x2f) { // /
|
6872 |
-
var j = i - 1;
|
6873 |
-
var p = (void 0);
|
6874 |
-
// find first non-whitespace prev char
|
6875 |
-
for (; j >= 0; j--) {
|
6876 |
-
p = exp.charAt(j);
|
6877 |
-
if (p !== ' ') { break }
|
6878 |
-
}
|
6879 |
-
if (!p || !validDivisionCharRE.test(p)) {
|
6880 |
-
inRegex = true;
|
6881 |
-
}
|
6882 |
-
}
|
6883 |
-
}
|
6884 |
-
}
|
6885 |
-
|
6886 |
-
if (expression === undefined) {
|
6887 |
-
expression = exp.slice(0, i).trim();
|
6888 |
-
} else if (lastFilterIndex !== 0) {
|
6889 |
-
pushFilter();
|
6890 |
-
}
|
6891 |
-
|
6892 |
-
function pushFilter () {
|
6893 |
-
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
6894 |
-
lastFilterIndex = i + 1;
|
6895 |
-
}
|
6896 |
-
|
6897 |
-
if (filters) {
|
6898 |
-
for (i = 0; i < filters.length; i++) {
|
6899 |
-
expression = wrapFilter(expression, filters[i]);
|
6900 |
-
}
|
6901 |
-
}
|
6902 |
-
|
6903 |
-
return expression
|
6904 |
-
}
|
6905 |
-
|
6906 |
-
function wrapFilter (exp, filter) {
|
6907 |
-
var i = filter.indexOf('(');
|
6908 |
-
if (i < 0) {
|
6909 |
-
// _f: resolveFilter
|
6910 |
-
return ("_f(\"" + filter + "\")(" + exp + ")")
|
6911 |
-
} else {
|
6912 |
-
var name = filter.slice(0, i);
|
6913 |
-
var args = filter.slice(i + 1);
|
6914 |
-
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
|
6915 |
-
}
|
6916 |
-
}
|
6917 |
-
|
6918 |
-
/* */
|
6919 |
-
|
6920 |
-
|
6921 |
-
|
6922 |
-
/* eslint-disable no-unused-vars */
|
6923 |
-
function baseWarn (msg, range) {
|
6924 |
-
console.error(("[Vue compiler]: " + msg));
|
6925 |
-
}
|
6926 |
-
/* eslint-enable no-unused-vars */
|
6927 |
-
|
6928 |
-
function pluckModuleFunction (
|
6929 |
-
modules,
|
6930 |
-
key
|
6931 |
-
) {
|
6932 |
-
return modules
|
6933 |
-
? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
|
6934 |
-
: []
|
6935 |
-
}
|
6936 |
-
|
6937 |
-
function addProp (el, name, value, range, dynamic) {
|
6938 |
-
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6939 |
-
el.plain = false;
|
6940 |
-
}
|
6941 |
-
|
6942 |
-
function addAttr (el, name, value, range, dynamic) {
|
6943 |
-
var attrs = dynamic
|
6944 |
-
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
6945 |
-
: (el.attrs || (el.attrs = []));
|
6946 |
-
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6947 |
-
el.plain = false;
|
6948 |
-
}
|
6949 |
-
|
6950 |
-
// add a raw attr (use this in preTransforms)
|
6951 |
-
function addRawAttr (el, name, value, range) {
|
6952 |
-
el.attrsMap[name] = value;
|
6953 |
-
el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
|
6954 |
-
}
|
6955 |
-
|
6956 |
-
function addDirective (
|
6957 |
-
el,
|
6958 |
-
name,
|
6959 |
-
rawName,
|
6960 |
-
value,
|
6961 |
-
arg,
|
6962 |
-
isDynamicArg,
|
6963 |
-
modifiers,
|
6964 |
-
range
|
6965 |
-
) {
|
6966 |
-
(el.directives || (el.directives = [])).push(rangeSetItem({
|
6967 |
-
name: name,
|
6968 |
-
rawName: rawName,
|
6969 |
-
value: value,
|
6970 |
-
arg: arg,
|
6971 |
-
isDynamicArg: isDynamicArg,
|
6972 |
-
modifiers: modifiers
|
6973 |
-
}, range));
|
6974 |
-
el.plain = false;
|
6975 |
-
}
|
6976 |
-
|
6977 |
-
function prependModifierMarker (symbol, name, dynamic) {
|
6978 |
-
return dynamic
|
6979 |
-
? ("_p(" + name + ",\"" + symbol + "\")")
|
6980 |
-
: symbol + name // mark the event as captured
|
6981 |
-
}
|
6982 |
-
|
6983 |
-
function addHandler (
|
6984 |
-
el,
|
6985 |
-
name,
|
6986 |
-
value,
|
6987 |
-
modifiers,
|
6988 |
-
important,
|
6989 |
-
warn,
|
6990 |
-
range,
|
6991 |
-
dynamic
|
6992 |
-
) {
|
6993 |
-
modifiers = modifiers || emptyObject;
|
6994 |
-
// warn prevent and passive modifier
|
6995 |
-
/* istanbul ignore if */
|
6996 |
-
if (
|
6997 |
-
warn &&
|
6998 |
-
modifiers.prevent && modifiers.passive
|
6999 |
-
) {
|
7000 |
-
warn(
|
7001 |
-
'passive and prevent can\'t be used together. ' +
|
7002 |
-
'Passive handler can\'t prevent default event.',
|
7003 |
-
range
|
7004 |
-
);
|
7005 |
-
}
|
7006 |
-
|
7007 |
-
// normalize click.right and click.middle since they don't actually fire
|
7008 |
-
// this is technically browser-specific, but at least for now browsers are
|
7009 |
-
// the only target envs that have right/middle clicks.
|
7010 |
-
if (modifiers.right) {
|
7011 |
-
if (dynamic) {
|
7012 |
-
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
7013 |
-
} else if (name === 'click') {
|
7014 |
-
name = 'contextmenu';
|
7015 |
-
delete modifiers.right;
|
7016 |
-
}
|
7017 |
-
} else if (modifiers.middle) {
|
7018 |
-
if (dynamic) {
|
7019 |
-
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
7020 |
-
} else if (name === 'click') {
|
7021 |
-
name = 'mouseup';
|
7022 |
-
}
|
7023 |
-
}
|
7024 |
-
|
7025 |
-
// check capture modifier
|
7026 |
-
if (modifiers.capture) {
|
7027 |
-
delete modifiers.capture;
|
7028 |
-
name = prependModifierMarker('!', name, dynamic);
|
7029 |
-
}
|
7030 |
-
if (modifiers.once) {
|
7031 |
-
delete modifiers.once;
|
7032 |
-
name = prependModifierMarker('~', name, dynamic);
|
7033 |
-
}
|
7034 |
-
/* istanbul ignore if */
|
7035 |
-
if (modifiers.passive) {
|
7036 |
-
delete modifiers.passive;
|
7037 |
-
name = prependModifierMarker('&', name, dynamic);
|
7038 |
-
}
|
7039 |
-
|
7040 |
-
var events;
|
7041 |
-
if (modifiers.native) {
|
7042 |
-
delete modifiers.native;
|
7043 |
-
events = el.nativeEvents || (el.nativeEvents = {});
|
7044 |
-
} else {
|
7045 |
-
events = el.events || (el.events = {});
|
7046 |
-
}
|
7047 |
-
|
7048 |
-
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
7049 |
-
if (modifiers !== emptyObject) {
|
7050 |
-
newHandler.modifiers = modifiers;
|
7051 |
-
}
|
7052 |
-
|
7053 |
-
var handlers = events[name];
|
7054 |
-
/* istanbul ignore if */
|
7055 |
-
if (Array.isArray(handlers)) {
|
7056 |
-
important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
7057 |
-
} else if (handlers) {
|
7058 |
-
events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
7059 |
-
} else {
|
7060 |
-
events[name] = newHandler;
|
7061 |
-
}
|
7062 |
-
|
7063 |
-
el.plain = false;
|
7064 |
-
}
|
7065 |
-
|
7066 |
-
function getRawBindingAttr (
|
7067 |
-
el,
|
7068 |
-
name
|
7069 |
-
) {
|
7070 |
-
return el.rawAttrsMap[':' + name] ||
|
7071 |
-
el.rawAttrsMap['v-bind:' + name] ||
|
7072 |
-
el.rawAttrsMap[name]
|
7073 |
-
}
|
7074 |
-
|
7075 |
-
function getBindingAttr (
|
7076 |
-
el,
|
7077 |
-
name,
|
7078 |
-
getStatic
|
7079 |
-
) {
|
7080 |
-
var dynamicValue =
|
7081 |
-
getAndRemoveAttr(el, ':' + name) ||
|
7082 |
-
getAndRemoveAttr(el, 'v-bind:' + name);
|
7083 |
-
if (dynamicValue != null) {
|
7084 |
-
return parseFilters(dynamicValue)
|
7085 |
-
} else if (getStatic !== false) {
|
7086 |
-
var staticValue = getAndRemoveAttr(el, name);
|
7087 |
-
if (staticValue != null) {
|
7088 |
-
return JSON.stringify(staticValue)
|
7089 |
-
}
|
7090 |
-
}
|
7091 |
-
}
|
7092 |
-
|
7093 |
-
// note: this only removes the attr from the Array (attrsList) so that it
|
7094 |
-
// doesn't get processed by processAttrs.
|
7095 |
-
// By default it does NOT remove it from the map (attrsMap) because the map is
|
7096 |
-
// needed during codegen.
|
7097 |
-
function getAndRemoveAttr (
|
7098 |
-
el,
|
7099 |
-
name,
|
7100 |
-
removeFromMap
|
7101 |
-
) {
|
7102 |
-
var val;
|
7103 |
-
if ((val = el.attrsMap[name]) != null) {
|
7104 |
-
var list = el.attrsList;
|
7105 |
-
for (var i = 0, l = list.length; i < l; i++) {
|
7106 |
-
if (list[i].name === name) {
|
7107 |
-
list.splice(i, 1);
|
7108 |
-
break
|
7109 |
-
}
|
7110 |
-
}
|
7111 |
-
}
|
7112 |
-
if (removeFromMap) {
|
7113 |
-
delete el.attrsMap[name];
|
7114 |
-
}
|
7115 |
-
return val
|
7116 |
-
}
|
7117 |
-
|
7118 |
-
function getAndRemoveAttrByRegex (
|
7119 |
-
el,
|
7120 |
-
name
|
7121 |
-
) {
|
7122 |
-
var list = el.attrsList;
|
7123 |
-
for (var i = 0, l = list.length; i < l; i++) {
|
7124 |
-
var attr = list[i];
|
7125 |
-
if (name.test(attr.name)) {
|
7126 |
-
list.splice(i, 1);
|
7127 |
-
return attr
|
7128 |
-
}
|
7129 |
-
}
|
7130 |
-
}
|
7131 |
-
|
7132 |
-
function rangeSetItem (
|
7133 |
-
item,
|
7134 |
-
range
|
7135 |
-
) {
|
7136 |
-
if (range) {
|
7137 |
-
if (range.start != null) {
|
7138 |
-
item.start = range.start;
|
7139 |
-
}
|
7140 |
-
if (range.end != null) {
|
7141 |
-
item.end = range.end;
|
7142 |
-
}
|
7143 |
-
}
|
7144 |
-
return item
|
7145 |
-
}
|
7146 |
-
|
7147 |
-
/* */
|
7148 |
-
|
7149 |
-
/**
|
7150 |
-
* Cross-platform code generation for component v-model
|
7151 |
-
*/
|
7152 |
-
function genComponentModel (
|
7153 |
-
el,
|
7154 |
-
value,
|
7155 |
-
modifiers
|
7156 |
-
) {
|
7157 |
-
var ref = modifiers || {};
|
7158 |
-
var number = ref.number;
|
7159 |
-
var trim = ref.trim;
|
7160 |
-
|
7161 |
-
var baseValueExpression = '$$v';
|
7162 |
-
var valueExpression = baseValueExpression;
|
7163 |
-
if (trim) {
|
7164 |
-
valueExpression =
|
7165 |
-
"(typeof " + baseValueExpression + " === 'string'" +
|
7166 |
-
"? " + baseValueExpression + ".trim()" +
|
7167 |
-
": " + baseValueExpression + ")";
|
7168 |
-
}
|
7169 |
-
if (number) {
|
7170 |
-
valueExpression = "_n(" + valueExpression + ")";
|
7171 |
-
}
|
7172 |
-
var assignment = genAssignmentCode(value, valueExpression);
|
7173 |
-
|
7174 |
-
el.model = {
|
7175 |
-
value: ("(" + value + ")"),
|
7176 |
-
expression: JSON.stringify(value),
|
7177 |
-
callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
7178 |
-
};
|
7179 |
-
}
|
7180 |
-
|
7181 |
-
/**
|
7182 |
-
* Cross-platform codegen helper for generating v-model value assignment code.
|
7183 |
-
*/
|
7184 |
-
function genAssignmentCode (
|
7185 |
-
value,
|
7186 |
-
assignment
|
7187 |
-
) {
|
7188 |
-
var res = parseModel(value);
|
7189 |
-
if (res.key === null) {
|
7190 |
-
return (value + "=" + assignment)
|
7191 |
-
} else {
|
7192 |
-
return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
|
7193 |
-
}
|
7194 |
-
}
|
7195 |
-
|
7196 |
-
/**
|
7197 |
-
* Parse a v-model expression into a base path and a final key segment.
|
7198 |
-
* Handles both dot-path and possible square brackets.
|
7199 |
-
*
|
7200 |
-
* Possible cases:
|
7201 |
-
*
|
7202 |
-
* - test
|
7203 |
-
* - test[key]
|
7204 |
-
* - test[test1[key]]
|
7205 |
-
* - test["a"][key]
|
7206 |
-
* - xxx.test[a[a].test1[key]]
|
7207 |
-
* - test.xxx.a["asa"][test1[key]]
|
7208 |
-
*
|
7209 |
-
*/
|
7210 |
-
|
7211 |
-
var len, str, chr, index$1, expressionPos, expressionEndPos;
|
7212 |
-
|
7213 |
-
|
7214 |
-
|
7215 |
-
function parseModel (val) {
|
7216 |
-
// Fix https://github.com/vuejs/vue/pull/7730
|
7217 |
-
// allow v-model="obj.val " (trailing whitespace)
|
7218 |
-
val = val.trim();
|
7219 |
-
len = val.length;
|
7220 |
-
|
7221 |
-
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
7222 |
-
index$1 = val.lastIndexOf('.');
|
7223 |
-
if (index$1 > -1) {
|
7224 |
-
return {
|
7225 |
-
exp: val.slice(0, index$1),
|
7226 |
-
key: '"' + val.slice(index$1 + 1) + '"'
|
7227 |
-
}
|
7228 |
-
} else {
|
7229 |
-
return {
|
7230 |
-
exp: val,
|
7231 |
-
key: null
|
7232 |
-
}
|
7233 |
-
}
|
7234 |
-
}
|
7235 |
-
|
7236 |
-
str = val;
|
7237 |
-
index$1 = expressionPos = expressionEndPos = 0;
|
7238 |
-
|
7239 |
-
while (!eof()) {
|
7240 |
-
chr = next();
|
7241 |
-
/* istanbul ignore if */
|
7242 |
-
if (isStringStart(chr)) {
|
7243 |
-
parseString(chr);
|
7244 |
-
} else if (chr === 0x5B) {
|
7245 |
-
parseBracket(chr);
|
7246 |
-
}
|
7247 |
-
}
|
7248 |
-
|
7249 |
-
return {
|
7250 |
-
exp: val.slice(0, expressionPos),
|
7251 |
-
key: val.slice(expressionPos + 1, expressionEndPos)
|
7252 |
-
}
|
7253 |
-
}
|
7254 |
-
|
7255 |
-
function next () {
|
7256 |
-
return str.charCodeAt(++index$1)
|
7257 |
-
}
|
7258 |
-
|
7259 |
-
function eof () {
|
7260 |
-
return index$1 >= len
|
7261 |
-
}
|
7262 |
-
|
7263 |
-
function isStringStart (chr) {
|
7264 |
-
return chr === 0x22 || chr === 0x27
|
7265 |
-
}
|
7266 |
-
|
7267 |
-
function parseBracket (chr) {
|
7268 |
-
var inBracket = 1;
|
7269 |
-
expressionPos = index$1;
|
7270 |
-
while (!eof()) {
|
7271 |
-
chr = next();
|
7272 |
-
if (isStringStart(chr)) {
|
7273 |
-
parseString(chr);
|
7274 |
-
continue
|
7275 |
-
}
|
7276 |
-
if (chr === 0x5B) { inBracket++; }
|
7277 |
-
if (chr === 0x5D) { inBracket--; }
|
7278 |
-
if (inBracket === 0) {
|
7279 |
-
expressionEndPos = index$1;
|
7280 |
-
break
|
7281 |
-
}
|
7282 |
-
}
|
7283 |
-
}
|
7284 |
-
|
7285 |
-
function parseString (chr) {
|
7286 |
-
var stringQuote = chr;
|
7287 |
-
while (!eof()) {
|
7288 |
-
chr = next();
|
7289 |
-
if (chr === stringQuote) {
|
7290 |
-
break
|
7291 |
-
}
|
7292 |
-
}
|
7293 |
-
}
|
7294 |
-
|
7295 |
-
/* */
|
7296 |
-
|
7297 |
-
var warn$1;
|
7298 |
-
|
7299 |
-
// in some cases, the event used has to be determined at runtime
|
7300 |
-
// so we used some reserved tokens during compile.
|
7301 |
-
var RANGE_TOKEN = '__r';
|
7302 |
-
var CHECKBOX_RADIO_TOKEN = '__c';
|
7303 |
-
|
7304 |
-
function model (
|
7305 |
-
el,
|
7306 |
-
dir,
|
7307 |
-
_warn
|
7308 |
-
) {
|
7309 |
-
warn$1 = _warn;
|
7310 |
-
var value = dir.value;
|
7311 |
-
var modifiers = dir.modifiers;
|
7312 |
-
var tag = el.tag;
|
7313 |
-
var type = el.attrsMap.type;
|
7314 |
-
|
7315 |
-
{
|
7316 |
-
// inputs with type="file" are read only and setting the input's
|
7317 |
-
// value will throw an error.
|
7318 |
-
if (tag === 'input' && type === 'file') {
|
7319 |
-
warn$1(
|
7320 |
-
"<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
|
7321 |
-
"File inputs are read only. Use a v-on:change listener instead.",
|
7322 |
-
el.rawAttrsMap['v-model']
|
7323 |
-
);
|
7324 |
-
}
|
7325 |
-
}
|
7326 |
-
|
7327 |
-
if (el.component) {
|
7328 |
-
genComponentModel(el, value, modifiers);
|
7329 |
-
// component v-model doesn't need extra runtime
|
7330 |
-
return false
|
7331 |
-
} else if (tag === 'select') {
|
7332 |
-
genSelect(el, value, modifiers);
|
7333 |
-
} else if (tag === 'input' && type === 'checkbox') {
|
7334 |
-
genCheckboxModel(el, value, modifiers);
|
7335 |
-
} else if (tag === 'input' && type === 'radio') {
|
7336 |
-
genRadioModel(el, value, modifiers);
|
7337 |
-
} else if (tag === 'input' || tag === 'textarea') {
|
7338 |
-
genDefaultModel(el, value, modifiers);
|
7339 |
-
} else if (!config.isReservedTag(tag)) {
|
7340 |
-
genComponentModel(el, value, modifiers);
|
7341 |
-
// component v-model doesn't need extra runtime
|
7342 |
-
return false
|
7343 |
-
} else {
|
7344 |
-
warn$1(
|
7345 |
-
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
7346 |
-
"v-model is not supported on this element type. " +
|
7347 |
-
'If you are working with contenteditable, it\'s recommended to ' +
|
7348 |
-
'wrap a library dedicated for that purpose inside a custom component.',
|
7349 |
-
el.rawAttrsMap['v-model']
|
7350 |
-
);
|
7351 |
-
}
|
7352 |
-
|
7353 |
-
// ensure runtime directive metadata
|
7354 |
-
return true
|
7355 |
-
}
|
7356 |
-
|
7357 |
-
function genCheckboxModel (
|
7358 |
-
el,
|
7359 |
-
value,
|
7360 |
-
modifiers
|
7361 |
-
) {
|
7362 |
-
var number = modifiers && modifiers.number;
|
7363 |
-
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7364 |
-
var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
7365 |
-
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
7366 |
-
addProp(el, 'checked',
|
7367 |
-
"Array.isArray(" + value + ")" +
|
7368 |
-
"?_i(" + value + "," + valueBinding + ")>-1" + (
|
7369 |
-
trueValueBinding === 'true'
|
7370 |
-
? (":(" + value + ")")
|
7371 |
-
: (":_q(" + value + "," + trueValueBinding + ")")
|
7372 |
-
)
|
7373 |
-
);
|
7374 |
-
addHandler(el, 'change',
|
7375 |
-
"var $$a=" + value + "," +
|
7376 |
-
'$$el=$event.target,' +
|
7377 |
-
"$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
|
7378 |
-
'if(Array.isArray($$a)){' +
|
7379 |
-
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
|
7380 |
-
'$$i=_i($$a,$$v);' +
|
7381 |
-
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
|
7382 |
-
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
|
7383 |
-
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
|
7384 |
-
null, true
|
7385 |
-
);
|
7386 |
-
}
|
7387 |
-
|
7388 |
-
function genRadioModel (
|
7389 |
-
el,
|
7390 |
-
value,
|
7391 |
-
modifiers
|
7392 |
-
) {
|
7393 |
-
var number = modifiers && modifiers.number;
|
7394 |
-
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7395 |
-
valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
7396 |
-
addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
|
7397 |
-
addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
|
7398 |
-
}
|
7399 |
-
|
7400 |
-
function genSelect (
|
7401 |
-
el,
|
7402 |
-
value,
|
7403 |
-
modifiers
|
7404 |
-
) {
|
7405 |
-
var number = modifiers && modifiers.number;
|
7406 |
-
var selectedVal = "Array.prototype.filter" +
|
7407 |
-
".call($event.target.options,function(o){return o.selected})" +
|
7408 |
-
".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
|
7409 |
-
"return " + (number ? '_n(val)' : 'val') + "})";
|
7410 |
-
|
7411 |
-
var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
|
7412 |
-
var code = "var $$selectedVal = " + selectedVal + ";";
|
7413 |
-
code = code + " " + (genAssignmentCode(value, assignment));
|
7414 |
-
addHandler(el, 'change', code, null, true);
|
7415 |
-
}
|
7416 |
-
|
7417 |
-
function genDefaultModel (
|
7418 |
-
el,
|
7419 |
-
value,
|
7420 |
-
modifiers
|
7421 |
-
) {
|
7422 |
-
var type = el.attrsMap.type;
|
7423 |
-
|
7424 |
-
// warn if v-bind:value conflicts with v-model
|
7425 |
-
// except for inputs with v-bind:type
|
7426 |
-
{
|
7427 |
-
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
7428 |
-
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
7429 |
-
if (value$1 && !typeBinding) {
|
7430 |
-
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
7431 |
-
warn$1(
|
7432 |
-
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
|
7433 |
-
'because the latter already expands to a value binding internally',
|
7434 |
-
el.rawAttrsMap[binding]
|
7435 |
-
);
|
7436 |
-
}
|
7437 |
-
}
|
7438 |
-
|
7439 |
-
var ref = modifiers || {};
|
7440 |
-
var lazy = ref.lazy;
|
7441 |
-
var number = ref.number;
|
7442 |
-
var trim = ref.trim;
|
7443 |
-
var needCompositionGuard = !lazy && type !== 'range';
|
7444 |
-
var event = lazy
|
7445 |
-
? 'change'
|
7446 |
-
: type === 'range'
|
7447 |
-
? RANGE_TOKEN
|
7448 |
-
: 'input';
|
7449 |
-
|
7450 |
-
var valueExpression = '$event.target.value';
|
7451 |
-
if (trim) {
|
7452 |
-
valueExpression = "$event.target.value.trim()";
|
7453 |
-
}
|
7454 |
-
if (number) {
|
7455 |
-
valueExpression = "_n(" + valueExpression + ")";
|
7456 |
-
}
|
7457 |
-
|
7458 |
-
var code = genAssignmentCode(value, valueExpression);
|
7459 |
-
if (needCompositionGuard) {
|
7460 |
-
code = "if($event.target.composing)return;" + code;
|
7461 |
-
}
|
7462 |
-
|
7463 |
-
addProp(el, 'value', ("(" + value + ")"));
|
7464 |
-
addHandler(el, event, code, null, true);
|
7465 |
-
if (trim || number) {
|
7466 |
-
addHandler(el, 'blur', '$forceUpdate()');
|
7467 |
-
}
|
7468 |
-
}
|
7469 |
-
|
7470 |
-
/* */
|
7471 |
-
|
7472 |
-
// normalize v-model event tokens that can only be determined at runtime.
|
7473 |
-
// it's important to place the event as the first in the array because
|
7474 |
-
// the whole point is ensuring the v-model callback gets called before
|
7475 |
-
// user-attached handlers.
|
7476 |
-
function normalizeEvents (on) {
|
7477 |
-
/* istanbul ignore if */
|
7478 |
-
if (isDef(on[RANGE_TOKEN])) {
|
7479 |
-
// IE input[type=range] only supports `change` event
|
7480 |
-
var event = isIE ? 'change' : 'input';
|
7481 |
-
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
7482 |
-
delete on[RANGE_TOKEN];
|
7483 |
-
}
|
7484 |
-
// This was originally intended to fix #4521 but no longer necessary
|
7485 |
-
// after 2.5. Keeping it for backwards compat with generated code from < 2.4
|
7486 |
-
/* istanbul ignore if */
|
7487 |
-
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
7488 |
-
on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
7489 |
-
delete on[CHECKBOX_RADIO_TOKEN];
|
7490 |
-
}
|
7491 |
-
}
|
7492 |
-
|
7493 |
-
var target$1;
|
7494 |
-
|
7495 |
-
function createOnceHandler$1 (event, handler, capture) {
|
7496 |
-
var _target = target$1; // save current target element in closure
|
7497 |
-
return function onceHandler () {
|
7498 |
-
var res = handler.apply(null, arguments);
|
7499 |
-
if (res !== null) {
|
7500 |
-
remove$2(event, onceHandler, capture, _target);
|
7501 |
-
}
|
7502 |
-
}
|
7503 |
-
}
|
7504 |
-
|
7505 |
-
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
|
7506 |
-
// implementation and does not fire microtasks in between event propagation, so
|
7507 |
-
// safe to exclude.
|
7508 |
-
var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
7509 |
-
|
7510 |
-
function add$1 (
|
7511 |
-
name,
|
7512 |
-
handler,
|
7513 |
-
capture,
|
7514 |
-
passive
|
7515 |
-
) {
|
7516 |
-
// async edge case #6566: inner click event triggers patch, event handler
|
7517 |
-
// attached to outer element during patch, and triggered again. This
|
7518 |
-
// happens because browsers fire microtask ticks between event propagation.
|
7519 |
-
// the solution is simple: we save the timestamp when a handler is attached,
|
7520 |
-
// and the handler would only fire if the event passed to it was fired
|
7521 |
-
// AFTER it was attached.
|
7522 |
-
if (useMicrotaskFix) {
|
7523 |
-
var attachedTimestamp = currentFlushTimestamp;
|
7524 |
-
var original = handler;
|
7525 |
-
handler = original._wrapper = function (e) {
|
7526 |
-
if (
|
7527 |
-
// no bubbling, should always fire.
|
7528 |
-
// this is just a safety net in case event.timeStamp is unreliable in
|
7529 |
-
// certain weird environments...
|
7530 |
-
e.target === e.currentTarget ||
|
7531 |
-
// event is fired after handler attachment
|
7532 |
-
e.timeStamp >= attachedTimestamp ||
|
7533 |
-
// bail for environments that have buggy event.timeStamp implementations
|
7534 |
-
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
|
7535 |
-
// #9681 QtWebEngine event.timeStamp is negative value
|
7536 |
-
e.timeStamp <= 0 ||
|
7537 |
-
// #9448 bail if event is fired in another document in a multi-page
|
7538 |
-
// electron/nw.js app, since event.timeStamp will be using a different
|
7539 |
-
// starting reference
|
7540 |
-
e.target.ownerDocument !== document
|
7541 |
-
) {
|
7542 |
-
return original.apply(this, arguments)
|
7543 |
-
}
|
7544 |
-
};
|
7545 |
-
}
|
7546 |
-
target$1.addEventListener(
|
7547 |
-
name,
|
7548 |
-
handler,
|
7549 |
-
supportsPassive
|
7550 |
-
? { capture: capture, passive: passive }
|
7551 |
-
: capture
|
7552 |
-
);
|
7553 |
-
}
|
7554 |
-
|
7555 |
-
function remove$2 (
|
7556 |
-
name,
|
7557 |
-
handler,
|
7558 |
-
capture,
|
7559 |
-
_target
|
7560 |
-
) {
|
7561 |
-
(_target || target$1).removeEventListener(
|
7562 |
-
name,
|
7563 |
-
handler._wrapper || handler,
|
7564 |
-
capture
|
7565 |
-
);
|
7566 |
-
}
|
7567 |
-
|
7568 |
-
function updateDOMListeners (oldVnode, vnode) {
|
7569 |
-
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
7570 |
-
return
|
7571 |
-
}
|
7572 |
-
var on = vnode.data.on || {};
|
7573 |
-
var oldOn = oldVnode.data.on || {};
|
7574 |
-
target$1 = vnode.elm;
|
7575 |
-
normalizeEvents(on);
|
7576 |
-
updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
7577 |
-
target$1 = undefined;
|
7578 |
-
}
|
7579 |
-
|
7580 |
-
var events = {
|
7581 |
-
create: updateDOMListeners,
|
7582 |
-
update: updateDOMListeners
|
7583 |
-
};
|
7584 |
-
|
7585 |
-
/* */
|
7586 |
-
|
7587 |
-
var svgContainer;
|
7588 |
-
|
7589 |
-
function updateDOMProps (oldVnode, vnode) {
|
7590 |
-
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
7591 |
-
return
|
7592 |
-
}
|
7593 |
-
var key, cur;
|
7594 |
-
var elm = vnode.elm;
|
7595 |
-
var oldProps = oldVnode.data.domProps || {};
|
7596 |
-
var props = vnode.data.domProps || {};
|
7597 |
-
// clone observed objects, as the user probably wants to mutate it
|
7598 |
-
if (isDef(props.__ob__)) {
|
7599 |
-
props = vnode.data.domProps = extend({}, props);
|
7600 |
-
}
|
7601 |
-
|
7602 |
-
for (key in oldProps) {
|
7603 |
-
if (!(key in props)) {
|
7604 |
-
elm[key] = '';
|
7605 |
-
}
|
7606 |
-
}
|
7607 |
-
|
7608 |
-
for (key in props) {
|
7609 |
-
cur = props[key];
|
7610 |
-
// ignore children if the node has textContent or innerHTML,
|
7611 |
-
// as these will throw away existing DOM nodes and cause removal errors
|
7612 |
-
// on subsequent patches (#3360)
|
7613 |
-
if (key === 'textContent' || key === 'innerHTML') {
|
7614 |
-
if (vnode.children) { vnode.children.length = 0; }
|
7615 |
-
if (cur === oldProps[key]) { continue }
|
7616 |
-
// #6601 work around Chrome version <= 55 bug where single textNode
|
7617 |
-
// replaced by innerHTML/textContent retains its parentNode property
|
7618 |
-
if (elm.childNodes.length === 1) {
|
7619 |
-
elm.removeChild(elm.childNodes[0]);
|
7620 |
-
}
|
7621 |
-
}
|
7622 |
-
|
7623 |
-
if (key === 'value' && elm.tagName !== 'PROGRESS') {
|
7624 |
-
// store value as _value as well since
|
7625 |
-
// non-string values will be stringified
|
7626 |
-
elm._value = cur;
|
7627 |
-
// avoid resetting cursor position when value is the same
|
7628 |
-
var strCur = isUndef(cur) ? '' : String(cur);
|
7629 |
-
if (shouldUpdateValue(elm, strCur)) {
|
7630 |
-
elm.value = strCur;
|
7631 |
-
}
|
7632 |
-
} else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
7633 |
-
// IE doesn't support innerHTML for SVG elements
|
7634 |
-
svgContainer = svgContainer || document.createElement('div');
|
7635 |
-
svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
7636 |
-
var svg = svgContainer.firstChild;
|
7637 |
-
while (elm.firstChild) {
|
7638 |
-
elm.removeChild(elm.firstChild);
|
7639 |
-
}
|
7640 |
-
while (svg.firstChild) {
|
7641 |
-
elm.appendChild(svg.firstChild);
|
7642 |
-
}
|
7643 |
-
} else if (
|
7644 |
-
// skip the update if old and new VDOM state is the same.
|
7645 |
-
// `value` is handled separately because the DOM value may be temporarily
|
7646 |
-
// out of sync with VDOM state due to focus, composition and modifiers.
|
7647 |
-
// This #4521 by skipping the unnecesarry `checked` update.
|
7648 |
-
cur !== oldProps[key]
|
7649 |
-
) {
|
7650 |
-
// some property updates can throw
|
7651 |
-
// e.g. `value` on <progress> w/ non-finite value
|
7652 |
-
try {
|
7653 |
-
elm[key] = cur;
|
7654 |
-
} catch (e) {}
|
7655 |
-
}
|
7656 |
-
}
|
7657 |
-
}
|
7658 |
-
|
7659 |
-
// check platforms/web/util/attrs.js acceptValue
|
7660 |
-
|
7661 |
-
|
7662 |
-
function shouldUpdateValue (elm, checkVal) {
|
7663 |
-
return (!elm.composing && (
|
7664 |
-
elm.tagName === 'OPTION' ||
|
7665 |
-
isNotInFocusAndDirty(elm, checkVal) ||
|
7666 |
-
isDirtyWithModifiers(elm, checkVal)
|
7667 |
-
))
|
7668 |
-
}
|
7669 |
-
|
7670 |
-
function isNotInFocusAndDirty (elm, checkVal) {
|
7671 |
-
// return true when textbox (.number and .trim) loses focus and its value is
|
7672 |
-
// not equal to the updated value
|
7673 |
-
var notInFocus = true;
|
7674 |
-
// #6157
|
7675 |
-
// work around IE bug when accessing document.activeElement in an iframe
|
7676 |
-
try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
7677 |
-
return notInFocus && elm.value !== checkVal
|
7678 |
-
}
|
7679 |
-
|
7680 |
-
function isDirtyWithModifiers (elm, newVal) {
|
7681 |
-
var value = elm.value;
|
7682 |
-
var modifiers = elm._vModifiers; // injected by v-model runtime
|
7683 |
-
if (isDef(modifiers)) {
|
7684 |
-
if (modifiers.number) {
|
7685 |
-
return toNumber(value) !== toNumber(newVal)
|
7686 |
-
}
|
7687 |
-
if (modifiers.trim) {
|
7688 |
-
return value.trim() !== newVal.trim()
|
7689 |
-
}
|
7690 |
-
}
|
7691 |
-
return value !== newVal
|
7692 |
-
}
|
7693 |
-
|
7694 |
-
var domProps = {
|
7695 |
-
create: updateDOMProps,
|
7696 |
-
update: updateDOMProps
|
7697 |
-
};
|
7698 |
-
|
7699 |
-
/* */
|
7700 |
-
|
7701 |
-
var parseStyleText = cached(function (cssText) {
|
7702 |
-
var res = {};
|
7703 |
-
var listDelimiter = /;(?![^(]*\))/g;
|
7704 |
-
var propertyDelimiter = /:(.+)/;
|
7705 |
-
cssText.split(listDelimiter).forEach(function (item) {
|
7706 |
-
if (item) {
|
7707 |
-
var tmp = item.split(propertyDelimiter);
|
7708 |
-
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
7709 |
-
}
|
7710 |
-
});
|
7711 |
-
return res
|
7712 |
-
});
|
7713 |
-
|
7714 |
-
// merge static and dynamic style data on the same vnode
|
7715 |
-
function normalizeStyleData (data) {
|
7716 |
-
var style = normalizeStyleBinding(data.style);
|
7717 |
-
// static style is pre-processed into an object during compilation
|
7718 |
-
// and is always a fresh object, so it's safe to merge into it
|
7719 |
-
return data.staticStyle
|
7720 |
-
? extend(data.staticStyle, style)
|
7721 |
-
: style
|
7722 |
-
}
|
7723 |
-
|
7724 |
-
// normalize possible array / string values into Object
|
7725 |
-
function normalizeStyleBinding (bindingStyle) {
|
7726 |
-
if (Array.isArray(bindingStyle)) {
|
7727 |
-
return toObject(bindingStyle)
|
7728 |
-
}
|
7729 |
-
if (typeof bindingStyle === 'string') {
|
7730 |
-
return parseStyleText(bindingStyle)
|
7731 |
-
}
|
7732 |
-
return bindingStyle
|
7733 |
-
}
|
7734 |
-
|
7735 |
-
/**
|
7736 |
-
* parent component style should be after child's
|
7737 |
-
* so that parent component's style could override it
|
7738 |
-
*/
|
7739 |
-
function getStyle (vnode, checkChild) {
|
7740 |
-
var res = {};
|
7741 |
-
var styleData;
|
7742 |
-
|
7743 |
-
if (checkChild) {
|
7744 |
-
var childNode = vnode;
|
7745 |
-
while (childNode.componentInstance) {
|
7746 |
-
childNode = childNode.componentInstance._vnode;
|
7747 |
-
if (
|
7748 |
-
childNode && childNode.data &&
|
7749 |
-
(styleData = normalizeStyleData(childNode.data))
|
7750 |
-
) {
|
7751 |
-
extend(res, styleData);
|
7752 |
-
}
|
7753 |
-
}
|
7754 |
-
}
|
7755 |
-
|
7756 |
-
if ((styleData = normalizeStyleData(vnode.data))) {
|
7757 |
-
extend(res, styleData);
|
7758 |
-
}
|
7759 |
-
|
7760 |
-
var parentNode = vnode;
|
7761 |
-
while ((parentNode = parentNode.parent)) {
|
7762 |
-
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
7763 |
-
extend(res, styleData);
|
7764 |
-
}
|
7765 |
-
}
|
7766 |
-
return res
|
7767 |
-
}
|
7768 |
-
|
7769 |
-
/* */
|
7770 |
-
|
7771 |
-
var cssVarRE = /^--/;
|
7772 |
-
var importantRE = /\s*!important$/;
|
7773 |
-
var setProp = function (el, name, val) {
|
7774 |
-
/* istanbul ignore if */
|
7775 |
-
if (cssVarRE.test(name)) {
|
7776 |
-
el.style.setProperty(name, val);
|
7777 |
-
} else if (importantRE.test(val)) {
|
7778 |
-
el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
7779 |
-
} else {
|
7780 |
-
var normalizedName = normalize(name);
|
7781 |
-
if (Array.isArray(val)) {
|
7782 |
-
// Support values array created by autoprefixer, e.g.
|
7783 |
-
// {display: ["-webkit-box", "-ms-flexbox", "flex"]}
|
7784 |
-
// Set them one by one, and the browser will only set those it can recognize
|
7785 |
-
for (var i = 0, len = val.length; i < len; i++) {
|
7786 |
-
el.style[normalizedName] = val[i];
|
7787 |
-
}
|
7788 |
-
} else {
|
7789 |
-
el.style[normalizedName] = val;
|
7790 |
-
}
|
7791 |
-
}
|
7792 |
-
};
|
7793 |
-
|
7794 |
-
var vendorNames = ['Webkit', 'Moz', 'ms'];
|
7795 |
-
|
7796 |
-
var emptyStyle;
|
7797 |
-
var normalize = cached(function (prop) {
|
7798 |
-
emptyStyle = emptyStyle || document.createElement('div').style;
|
7799 |
-
prop = camelize(prop);
|
7800 |
-
if (prop !== 'filter' && (prop in emptyStyle)) {
|
7801 |
-
return prop
|
7802 |
-
}
|
7803 |
-
var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
7804 |
-
for (var i = 0; i < vendorNames.length; i++) {
|
7805 |
-
var name = vendorNames[i] + capName;
|
7806 |
-
if (name in emptyStyle) {
|
7807 |
-
return name
|
7808 |
-
}
|
7809 |
-
}
|
7810 |
-
});
|
7811 |
-
|
7812 |
-
function updateStyle (oldVnode, vnode) {
|
7813 |
-
var data = vnode.data;
|
7814 |
-
var oldData = oldVnode.data;
|
7815 |
-
|
7816 |
-
if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
7817 |
-
isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
7818 |
-
) {
|
7819 |
-
return
|
7820 |
-
}
|
7821 |
-
|
7822 |
-
var cur, name;
|
7823 |
-
var el = vnode.elm;
|
7824 |
-
var oldStaticStyle = oldData.staticStyle;
|
7825 |
-
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
7826 |
-
|
7827 |
-
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
|
7828 |
-
var oldStyle = oldStaticStyle || oldStyleBinding;
|
7829 |
-
|
7830 |
-
var style = normalizeStyleBinding(vnode.data.style) || {};
|
7831 |
-
|
7832 |
-
// store normalized style under a different key for next diff
|
7833 |
-
// make sure to clone it if it's reactive, since the user likely wants
|
7834 |
-
// to mutate it.
|
7835 |
-
vnode.data.normalizedStyle = isDef(style.__ob__)
|
7836 |
-
? extend({}, style)
|
7837 |
-
: style;
|
7838 |
-
|
7839 |
-
var newStyle = getStyle(vnode, true);
|
7840 |
-
|
7841 |
-
for (name in oldStyle) {
|
7842 |
-
if (isUndef(newStyle[name])) {
|
7843 |
-
setProp(el, name, '');
|
7844 |
-
}
|
7845 |
-
}
|
7846 |
-
for (name in newStyle) {
|
7847 |
-
cur = newStyle[name];
|
7848 |
-
if (cur !== oldStyle[name]) {
|
7849 |
-
// ie9 setting to null has no effect, must use empty string
|
7850 |
-
setProp(el, name, cur == null ? '' : cur);
|
7851 |
-
}
|
7852 |
-
}
|
7853 |
-
}
|
7854 |
-
|
7855 |
-
var style = {
|
7856 |
-
create: updateStyle,
|
7857 |
-
update: updateStyle
|
7858 |
-
};
|
7859 |
-
|
7860 |
-
/* */
|
7861 |
-
|
7862 |
-
var whitespaceRE = /\s+/;
|
7863 |
-
|
7864 |
-
/**
|
7865 |
-
* Add class with compatibility for SVG since classList is not supported on
|
7866 |
-
* SVG elements in IE
|
7867 |
-
*/
|
7868 |
-
function addClass (el, cls) {
|
7869 |
-
/* istanbul ignore if */
|
7870 |
-
if (!cls || !(cls = cls.trim())) {
|
7871 |
-
return
|
7872 |
-
}
|
7873 |
-
|
7874 |
-
/* istanbul ignore else */
|
7875 |
-
if (el.classList) {
|
7876 |
-
if (cls.indexOf(' ') > -1) {
|
7877 |
-
cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
7878 |
-
} else {
|
7879 |
-
el.classList.add(cls);
|
7880 |
-
}
|
7881 |
-
} else {
|
7882 |
-
var cur = " " + (el.getAttribute('class') || '') + " ";
|
7883 |
-
if (cur.indexOf(' ' + cls + ' ') < 0) {
|
7884 |
-
el.setAttribute('class', (cur + cls).trim());
|
7885 |
-
}
|
7886 |
-
}
|
7887 |
-
}
|
7888 |
-
|
7889 |
-
/**
|
7890 |
-
* Remove class with compatibility for SVG since classList is not supported on
|
7891 |
-
* SVG elements in IE
|
7892 |
-
*/
|
7893 |
-
function removeClass (el, cls) {
|
7894 |
-
/* istanbul ignore if */
|
7895 |
-
if (!cls || !(cls = cls.trim())) {
|
7896 |
-
return
|
7897 |
-
}
|
7898 |
-
|
7899 |
-
/* istanbul ignore else */
|
7900 |
-
if (el.classList) {
|
7901 |
-
if (cls.indexOf(' ') > -1) {
|
7902 |
-
cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
7903 |
-
} else {
|
7904 |
-
el.classList.remove(cls);
|
7905 |
-
}
|
7906 |
-
if (!el.classList.length) {
|
7907 |
-
el.removeAttribute('class');
|
7908 |
-
}
|
7909 |
-
} else {
|
7910 |
-
var cur = " " + (el.getAttribute('class') || '') + " ";
|
7911 |
-
var tar = ' ' + cls + ' ';
|
7912 |
-
while (cur.indexOf(tar) >= 0) {
|
7913 |
-
cur = cur.replace(tar, ' ');
|
7914 |
-
}
|
7915 |
-
cur = cur.trim();
|
7916 |
-
if (cur) {
|
7917 |
-
el.setAttribute('class', cur);
|
7918 |
-
} else {
|
7919 |
-
el.removeAttribute('class');
|
7920 |
-
}
|
7921 |
-
}
|
7922 |
-
}
|
7923 |
-
|
7924 |
-
/* */
|
7925 |
-
|
7926 |
-
function resolveTransition (def$$1) {
|
7927 |
-
if (!def$$1) {
|
7928 |
-
return
|
7929 |
-
}
|
7930 |
-
/* istanbul ignore else */
|
7931 |
-
if (typeof def$$1 === 'object') {
|
7932 |
-
var res = {};
|
7933 |
-
if (def$$1.css !== false) {
|
7934 |
-
extend(res, autoCssTransition(def$$1.name || 'v'));
|
7935 |
-
}
|
7936 |
-
extend(res, def$$1);
|
7937 |
-
return res
|
7938 |
-
} else if (typeof def$$1 === 'string') {
|
7939 |
-
return autoCssTransition(def$$1)
|
7940 |
-
}
|
7941 |
-
}
|
7942 |
-
|
7943 |
-
var autoCssTransition = cached(function (name) {
|
7944 |
-
return {
|
7945 |
-
enterClass: (name + "-enter"),
|
7946 |
-
enterToClass: (name + "-enter-to"),
|
7947 |
-
enterActiveClass: (name + "-enter-active"),
|
7948 |
-
leaveClass: (name + "-leave"),
|
7949 |
-
leaveToClass: (name + "-leave-to"),
|
7950 |
-
leaveActiveClass: (name + "-leave-active")
|
7951 |
-
}
|
7952 |
-
});
|
7953 |
-
|
7954 |
-
var hasTransition = inBrowser && !isIE9;
|
7955 |
-
var TRANSITION = 'transition';
|
7956 |
-
var ANIMATION = 'animation';
|
7957 |
-
|
7958 |
-
// Transition property/event sniffing
|
7959 |
-
var transitionProp = 'transition';
|
7960 |
-
var transitionEndEvent = 'transitionend';
|
7961 |
-
var animationProp = 'animation';
|
7962 |
-
var animationEndEvent = 'animationend';
|
7963 |
-
if (hasTransition) {
|
7964 |
-
/* istanbul ignore if */
|
7965 |
-
if (window.ontransitionend === undefined &&
|
7966 |
-
window.onwebkittransitionend !== undefined
|
7967 |
-
) {
|
7968 |
-
transitionProp = 'WebkitTransition';
|
7969 |
-
transitionEndEvent = 'webkitTransitionEnd';
|
7970 |
-
}
|
7971 |
-
if (window.onanimationend === undefined &&
|
7972 |
-
window.onwebkitanimationend !== undefined
|
7973 |
-
) {
|
7974 |
-
animationProp = 'WebkitAnimation';
|
7975 |
-
animationEndEvent = 'webkitAnimationEnd';
|
7976 |
-
}
|
7977 |
-
}
|
7978 |
-
|
7979 |
-
// binding to window is necessary to make hot reload work in IE in strict mode
|
7980 |
-
var raf = inBrowser
|
7981 |
-
? window.requestAnimationFrame
|
7982 |
-
? window.requestAnimationFrame.bind(window)
|
7983 |
-
: setTimeout
|
7984 |
-
: /* istanbul ignore next */ function (fn) { return fn(); };
|
7985 |
-
|
7986 |
-
function nextFrame (fn) {
|
7987 |
-
raf(function () {
|
7988 |
-
raf(fn);
|
7989 |
-
});
|
7990 |
-
}
|
7991 |
-
|
7992 |
-
function addTransitionClass (el, cls) {
|
7993 |
-
var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
7994 |
-
if (transitionClasses.indexOf(cls) < 0) {
|
7995 |
-
transitionClasses.push(cls);
|
7996 |
-
addClass(el, cls);
|
7997 |
-
}
|
7998 |
-
}
|
7999 |
-
|
8000 |
-
function removeTransitionClass (el, cls) {
|
8001 |
-
if (el._transitionClasses) {
|
8002 |
-
remove(el._transitionClasses, cls);
|
8003 |
-
}
|
8004 |
-
removeClass(el, cls);
|
8005 |
-
}
|
8006 |
-
|
8007 |
-
function whenTransitionEnds (
|
8008 |
-
el,
|
8009 |
-
expectedType,
|
8010 |
-
cb
|
8011 |
-
) {
|
8012 |
-
var ref = getTransitionInfo(el, expectedType);
|
8013 |
-
var type = ref.type;
|
8014 |
-
var timeout = ref.timeout;
|
8015 |
-
var propCount = ref.propCount;
|
8016 |
-
if (!type) { return cb() }
|
8017 |
-
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
8018 |
-
var ended = 0;
|
8019 |
-
var end = function () {
|
8020 |
-
el.removeEventListener(event, onEnd);
|
8021 |
-
cb();
|
8022 |
-
};
|
8023 |
-
var onEnd = function (e) {
|
8024 |
-
if (e.target === el) {
|
8025 |
-
if (++ended >= propCount) {
|
8026 |
-
end();
|
8027 |
-
}
|
8028 |
-
}
|
8029 |
-
};
|
8030 |
-
setTimeout(function () {
|
8031 |
-
if (ended < propCount) {
|
8032 |
-
end();
|
8033 |
-
}
|
8034 |
-
}, timeout + 1);
|
8035 |
-
el.addEventListener(event, onEnd);
|
8036 |
-
}
|
8037 |
-
|
8038 |
-
var transformRE = /\b(transform|all)(,|$)/;
|
8039 |
-
|
8040 |
-
function getTransitionInfo (el, expectedType) {
|
8041 |
-
var styles = window.getComputedStyle(el);
|
8042 |
-
// JSDOM may return undefined for transition properties
|
8043 |
-
var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
8044 |
-
var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
8045 |
-
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
8046 |
-
var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
8047 |
-
var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
8048 |
-
var animationTimeout = getTimeout(animationDelays, animationDurations);
|
8049 |
-
|
8050 |
-
var type;
|
8051 |
-
var timeout = 0;
|
8052 |
-
var propCount = 0;
|
8053 |
-
/* istanbul ignore if */
|
8054 |
-
if (expectedType === TRANSITION) {
|
8055 |
-
if (transitionTimeout > 0) {
|
8056 |
-
type = TRANSITION;
|
8057 |
-
timeout = transitionTimeout;
|
8058 |
-
propCount = transitionDurations.length;
|
8059 |
-
}
|
8060 |
-
} else if (expectedType === ANIMATION) {
|
8061 |
-
if (animationTimeout > 0) {
|
8062 |
-
type = ANIMATION;
|
8063 |
-
timeout = animationTimeout;
|
8064 |
-
propCount = animationDurations.length;
|
8065 |
-
}
|
8066 |
-
} else {
|
8067 |
-
timeout = Math.max(transitionTimeout, animationTimeout);
|
8068 |
-
type = timeout > 0
|
8069 |
-
? transitionTimeout > animationTimeout
|
8070 |
-
? TRANSITION
|
8071 |
-
: ANIMATION
|
8072 |
-
: null;
|
8073 |
-
propCount = type
|
8074 |
-
? type === TRANSITION
|
8075 |
-
? transitionDurations.length
|
8076 |
-
: animationDurations.length
|
8077 |
-
: 0;
|
8078 |
-
}
|
8079 |
-
var hasTransform =
|
8080 |
-
type === TRANSITION &&
|
8081 |
-
transformRE.test(styles[transitionProp + 'Property']);
|
8082 |
-
return {
|
8083 |
-
type: type,
|
8084 |
-
timeout: timeout,
|
8085 |
-
propCount: propCount,
|
8086 |
-
hasTransform: hasTransform
|
8087 |
-
}
|
8088 |
-
}
|
8089 |
-
|
8090 |
-
function getTimeout (delays, durations) {
|
8091 |
-
/* istanbul ignore next */
|
8092 |
-
while (delays.length < durations.length) {
|
8093 |
-
delays = delays.concat(delays);
|
8094 |
-
}
|
8095 |
-
|
8096 |
-
return Math.max.apply(null, durations.map(function (d, i) {
|
8097 |
-
return toMs(d) + toMs(delays[i])
|
8098 |
-
}))
|
8099 |
-
}
|
8100 |
-
|
8101 |
-
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
|
8102 |
-
// in a locale-dependent way, using a comma instead of a dot.
|
8103 |
-
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
|
8104 |
-
// as a floor function) causing unexpected behaviors
|
8105 |
-
function toMs (s) {
|
8106 |
-
return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
8107 |
-
}
|
8108 |
-
|
8109 |
-
/* */
|
8110 |
-
|
8111 |
-
function enter (vnode, toggleDisplay) {
|
8112 |
-
var el = vnode.elm;
|
8113 |
-
|
8114 |
-
// call leave callback now
|
8115 |
-
if (isDef(el._leaveCb)) {
|
8116 |
-
el._leaveCb.cancelled = true;
|
8117 |
-
el._leaveCb();
|
8118 |
-
}
|
8119 |
-
|
8120 |
-
var data = resolveTransition(vnode.data.transition);
|
8121 |
-
if (isUndef(data)) {
|
8122 |
-
return
|
8123 |
-
}
|
8124 |
-
|
8125 |
-
/* istanbul ignore if */
|
8126 |
-
if (isDef(el._enterCb) || el.nodeType !== 1) {
|
8127 |
-
return
|
8128 |
-
}
|
8129 |
-
|
8130 |
-
var css = data.css;
|
8131 |
-
var type = data.type;
|
8132 |
-
var enterClass = data.enterClass;
|
8133 |
-
var enterToClass = data.enterToClass;
|
8134 |
-
var enterActiveClass = data.enterActiveClass;
|
8135 |
-
var appearClass = data.appearClass;
|
8136 |
-
var appearToClass = data.appearToClass;
|
8137 |
-
var appearActiveClass = data.appearActiveClass;
|
8138 |
-
var beforeEnter = data.beforeEnter;
|
8139 |
-
var enter = data.enter;
|
8140 |
-
var afterEnter = data.afterEnter;
|
8141 |
-
var enterCancelled = data.enterCancelled;
|
8142 |
-
var beforeAppear = data.beforeAppear;
|
8143 |
-
var appear = data.appear;
|
8144 |
-
var afterAppear = data.afterAppear;
|
8145 |
-
var appearCancelled = data.appearCancelled;
|
8146 |
-
var duration = data.duration;
|
8147 |
-
|
8148 |
-
// activeInstance will always be the <transition> component managing this
|
8149 |
-
// transition. One edge case to check is when the <transition> is placed
|
8150 |
-
// as the root node of a child component. In that case we need to check
|
8151 |
-
// <transition>'s parent for appear check.
|
8152 |
-
var context = activeInstance;
|
8153 |
-
var transitionNode = activeInstance.$vnode;
|
8154 |
-
while (transitionNode && transitionNode.parent) {
|
8155 |
-
context = transitionNode.context;
|
8156 |
-
transitionNode = transitionNode.parent;
|
8157 |
-
}
|
8158 |
-
|
8159 |
-
var isAppear = !context._isMounted || !vnode.isRootInsert;
|
8160 |
-
|
8161 |
-
if (isAppear && !appear && appear !== '') {
|
8162 |
-
return
|
8163 |
-
}
|
8164 |
-
|
8165 |
-
var startClass = isAppear && appearClass
|
8166 |
-
? appearClass
|
8167 |
-
: enterClass;
|
8168 |
-
var activeClass = isAppear && appearActiveClass
|
8169 |
-
? appearActiveClass
|
8170 |
-
: enterActiveClass;
|
8171 |
-
var toClass = isAppear && appearToClass
|
8172 |
-
? appearToClass
|
8173 |
-
: enterToClass;
|
8174 |
-
|
8175 |
-
var beforeEnterHook = isAppear
|
8176 |
-
? (beforeAppear || beforeEnter)
|
8177 |
-
: beforeEnter;
|
8178 |
-
var enterHook = isAppear
|
8179 |
-
? (typeof appear === 'function' ? appear : enter)
|
8180 |
-
: enter;
|
8181 |
-
var afterEnterHook = isAppear
|
8182 |
-
? (afterAppear || afterEnter)
|
8183 |
-
: afterEnter;
|
8184 |
-
var enterCancelledHook = isAppear
|
8185 |
-
? (appearCancelled || enterCancelled)
|
8186 |
-
: enterCancelled;
|
8187 |
-
|
8188 |
-
var explicitEnterDuration = toNumber(
|
8189 |
-
isObject(duration)
|
8190 |
-
? duration.enter
|
8191 |
-
: duration
|
8192 |
-
);
|
8193 |
-
|
8194 |
-
if (explicitEnterDuration != null) {
|
8195 |
-
checkDuration(explicitEnterDuration, 'enter', vnode);
|
8196 |
-
}
|
8197 |
-
|
8198 |
-
var expectsCSS = css !== false && !isIE9;
|
8199 |
-
var userWantsControl = getHookArgumentsLength(enterHook);
|
8200 |
-
|
8201 |
-
var cb = el._enterCb = once(function () {
|
8202 |
-
if (expectsCSS) {
|
8203 |
-
removeTransitionClass(el, toClass);
|
8204 |
-
removeTransitionClass(el, activeClass);
|
8205 |
-
}
|
8206 |
-
if (cb.cancelled) {
|
8207 |
-
if (expectsCSS) {
|
8208 |
-
removeTransitionClass(el, startClass);
|
8209 |
-
}
|
8210 |
-
enterCancelledHook && enterCancelledHook(el);
|
8211 |
-
} else {
|
8212 |
-
afterEnterHook && afterEnterHook(el);
|
8213 |
-
}
|
8214 |
-
el._enterCb = null;
|
8215 |
-
});
|
8216 |
-
|
8217 |
-
if (!vnode.data.show) {
|
8218 |
-
// remove pending leave element on enter by injecting an insert hook
|
8219 |
-
mergeVNodeHook(vnode, 'insert', function () {
|
8220 |
-
var parent = el.parentNode;
|
8221 |
-
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
8222 |
-
if (pendingNode &&
|
8223 |
-
pendingNode.tag === vnode.tag &&
|
8224 |
-
pendingNode.elm._leaveCb
|
8225 |
-
) {
|
8226 |
-
pendingNode.elm._leaveCb();
|
8227 |
-
}
|
8228 |
-
enterHook && enterHook(el, cb);
|
8229 |
-
});
|
8230 |
-
}
|
8231 |
-
|
8232 |
-
// start enter transition
|
8233 |
-
beforeEnterHook && beforeEnterHook(el);
|
8234 |
-
if (expectsCSS) {
|
8235 |
-
addTransitionClass(el, startClass);
|
8236 |
-
addTransitionClass(el, activeClass);
|
8237 |
-
nextFrame(function () {
|
8238 |
-
removeTransitionClass(el, startClass);
|
8239 |
-
if (!cb.cancelled) {
|
8240 |
-
addTransitionClass(el, toClass);
|
8241 |
-
if (!userWantsControl) {
|
8242 |
-
if (isValidDuration(explicitEnterDuration)) {
|
8243 |
-
setTimeout(cb, explicitEnterDuration);
|
8244 |
-
} else {
|
8245 |
-
whenTransitionEnds(el, type, cb);
|
8246 |
-
}
|
8247 |
-
}
|
8248 |
-
}
|
8249 |
-
});
|
8250 |
-
}
|
8251 |
-
|
8252 |
-
if (vnode.data.show) {
|
8253 |
-
toggleDisplay && toggleDisplay();
|
8254 |
-
enterHook && enterHook(el, cb);
|
8255 |
-
}
|
8256 |
-
|
8257 |
-
if (!expectsCSS && !userWantsControl) {
|
8258 |
-
cb();
|
8259 |
-
}
|
8260 |
-
}
|
8261 |
-
|
8262 |
-
function leave (vnode, rm) {
|
8263 |
-
var el = vnode.elm;
|
8264 |
-
|
8265 |
-
// call enter callback now
|
8266 |
-
if (isDef(el._enterCb)) {
|
8267 |
-
el._enterCb.cancelled = true;
|
8268 |
-
el._enterCb();
|
8269 |
-
}
|
8270 |
-
|
8271 |
-
var data = resolveTransition(vnode.data.transition);
|
8272 |
-
if (isUndef(data) || el.nodeType !== 1) {
|
8273 |
-
return rm()
|
8274 |
-
}
|
8275 |
-
|
8276 |
-
/* istanbul ignore if */
|
8277 |
-
if (isDef(el._leaveCb)) {
|
8278 |
-
return
|
8279 |
-
}
|
8280 |
-
|
8281 |
-
var css = data.css;
|
8282 |
-
var type = data.type;
|
8283 |
-
var leaveClass = data.leaveClass;
|
8284 |
-
var leaveToClass = data.leaveToClass;
|
8285 |
-
var leaveActiveClass = data.leaveActiveClass;
|
8286 |
-
var beforeLeave = data.beforeLeave;
|
8287 |
-
var leave = data.leave;
|
8288 |
-
var afterLeave = data.afterLeave;
|
8289 |
-
var leaveCancelled = data.leaveCancelled;
|
8290 |
-
var delayLeave = data.delayLeave;
|
8291 |
-
var duration = data.duration;
|
8292 |
-
|
8293 |
-
var expectsCSS = css !== false && !isIE9;
|
8294 |
-
var userWantsControl = getHookArgumentsLength(leave);
|
8295 |
-
|
8296 |
-
var explicitLeaveDuration = toNumber(
|
8297 |
-
isObject(duration)
|
8298 |
-
? duration.leave
|
8299 |
-
: duration
|
8300 |
-
);
|
8301 |
-
|
8302 |
-
if (isDef(explicitLeaveDuration)) {
|
8303 |
-
checkDuration(explicitLeaveDuration, 'leave', vnode);
|
8304 |
-
}
|
8305 |
-
|
8306 |
-
var cb = el._leaveCb = once(function () {
|
8307 |
-
if (el.parentNode && el.parentNode._pending) {
|
8308 |
-
el.parentNode._pending[vnode.key] = null;
|
8309 |
-
}
|
8310 |
-
if (expectsCSS) {
|
8311 |
-
removeTransitionClass(el, leaveToClass);
|
8312 |
-
removeTransitionClass(el, leaveActiveClass);
|
8313 |
-
}
|
8314 |
-
if (cb.cancelled) {
|
8315 |
-
if (expectsCSS) {
|
8316 |
-
removeTransitionClass(el, leaveClass);
|
8317 |
-
}
|
8318 |
-
leaveCancelled && leaveCancelled(el);
|
8319 |
-
} else {
|
8320 |
-
rm();
|
8321 |
-
afterLeave && afterLeave(el);
|
8322 |
-
}
|
8323 |
-
el._leaveCb = null;
|
8324 |
-
});
|
8325 |
-
|
8326 |
-
if (delayLeave) {
|
8327 |
-
delayLeave(performLeave);
|
8328 |
-
} else {
|
8329 |
-
performLeave();
|
8330 |
-
}
|
8331 |
-
|
8332 |
-
function performLeave () {
|
8333 |
-
// the delayed leave may have already been cancelled
|
8334 |
-
if (cb.cancelled) {
|
8335 |
-
return
|
8336 |
-
}
|
8337 |
-
// record leaving element
|
8338 |
-
if (!vnode.data.show && el.parentNode) {
|
8339 |
-
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
8340 |
-
}
|
8341 |
-
beforeLeave && beforeLeave(el);
|
8342 |
-
if (expectsCSS) {
|
8343 |
-
addTransitionClass(el, leaveClass);
|
8344 |
-
addTransitionClass(el, leaveActiveClass);
|
8345 |
-
nextFrame(function () {
|
8346 |
-
removeTransitionClass(el, leaveClass);
|
8347 |
-
if (!cb.cancelled) {
|
8348 |
-
addTransitionClass(el, leaveToClass);
|
8349 |
-
if (!userWantsControl) {
|
8350 |
-
if (isValidDuration(explicitLeaveDuration)) {
|
8351 |
-
setTimeout(cb, explicitLeaveDuration);
|
8352 |
-
} else {
|
8353 |
-
whenTransitionEnds(el, type, cb);
|
8354 |
-
}
|
8355 |
-
}
|
8356 |
-
}
|
8357 |
-
});
|
8358 |
-
}
|
8359 |
-
leave && leave(el, cb);
|
8360 |
-
if (!expectsCSS && !userWantsControl) {
|
8361 |
-
cb();
|
8362 |
-
}
|
8363 |
-
}
|
8364 |
-
}
|
8365 |
-
|
8366 |
-
// only used in dev mode
|
8367 |
-
function checkDuration (val, name, vnode) {
|
8368 |
-
if (typeof val !== 'number') {
|
8369 |
-
warn(
|
8370 |
-
"<transition> explicit " + name + " duration is not a valid number - " +
|
8371 |
-
"got " + (JSON.stringify(val)) + ".",
|
8372 |
-
vnode.context
|
8373 |
-
);
|
8374 |
-
} else if (isNaN(val)) {
|
8375 |
-
warn(
|
8376 |
-
"<transition> explicit " + name + " duration is NaN - " +
|
8377 |
-
'the duration expression might be incorrect.',
|
8378 |
-
vnode.context
|
8379 |
-
);
|
8380 |
-
}
|
8381 |
-
}
|
8382 |
-
|
8383 |
-
function isValidDuration (val) {
|
8384 |
-
return typeof val === 'number' && !isNaN(val)
|
8385 |
-
}
|
8386 |
-
|
8387 |
-
/**
|
8388 |
-
* Normalize a transition hook's argument length. The hook may be:
|
8389 |
-
* - a merged hook (invoker) with the original in .fns
|
8390 |
-
* - a wrapped component method (check ._length)
|
8391 |
-
* - a plain function (.length)
|
8392 |
-
*/
|
8393 |
-
function getHookArgumentsLength (fn) {
|
8394 |
-
if (isUndef(fn)) {
|
8395 |
-
return false
|
8396 |
-
}
|
8397 |
-
var invokerFns = fn.fns;
|
8398 |
-
if (isDef(invokerFns)) {
|
8399 |
-
// invoker
|
8400 |
-
return getHookArgumentsLength(
|
8401 |
-
Array.isArray(invokerFns)
|
8402 |
-
? invokerFns[0]
|
8403 |
-
: invokerFns
|
8404 |
-
)
|
8405 |
-
} else {
|
8406 |
-
return (fn._length || fn.length) > 1
|
8407 |
-
}
|
8408 |
-
}
|
8409 |
-
|
8410 |
-
function _enter (_, vnode) {
|
8411 |
-
if (vnode.data.show !== true) {
|
8412 |
-
enter(vnode);
|
8413 |
-
}
|
8414 |
-
}
|
8415 |
-
|
8416 |
-
var transition = inBrowser ? {
|
8417 |
-
create: _enter,
|
8418 |
-
activate: _enter,
|
8419 |
-
remove: function remove$$1 (vnode, rm) {
|
8420 |
-
/* istanbul ignore else */
|
8421 |
-
if (vnode.data.show !== true) {
|
8422 |
-
leave(vnode, rm);
|
8423 |
-
} else {
|
8424 |
-
rm();
|
8425 |
-
}
|
8426 |
-
}
|
8427 |
-
} : {};
|
8428 |
-
|
8429 |
-
var platformModules = [
|
8430 |
-
attrs,
|
8431 |
-
klass,
|
8432 |
-
events,
|
8433 |
-
domProps,
|
8434 |
-
style,
|
8435 |
-
transition
|
8436 |
-
];
|
8437 |
-
|
8438 |
-
/* */
|
8439 |
-
|
8440 |
-
// the directive module should be applied last, after all
|
8441 |
-
// built-in modules have been applied.
|
8442 |
-
var modules = platformModules.concat(baseModules);
|
8443 |
-
|
8444 |
-
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
8445 |
-
|
8446 |
-
/**
|
8447 |
-
* Not type checking this file because flow doesn't like attaching
|
8448 |
-
* properties to Elements.
|
8449 |
-
*/
|
8450 |
-
|
8451 |
-
/* istanbul ignore if */
|
8452 |
-
if (isIE9) {
|
8453 |
-
// http://www.matts411.com/post/internet-explorer-9-oninput/
|
8454 |
-
document.addEventListener('selectionchange', function () {
|
8455 |
-
var el = document.activeElement;
|
8456 |
-
if (el && el.vmodel) {
|
8457 |
-
trigger(el, 'input');
|
8458 |
-
}
|
8459 |
-
});
|
8460 |
-
}
|
8461 |
-
|
8462 |
-
var directive = {
|
8463 |
-
inserted: function inserted (el, binding, vnode, oldVnode) {
|
8464 |
-
if (vnode.tag === 'select') {
|
8465 |
-
// #6903
|
8466 |
-
if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
8467 |
-
mergeVNodeHook(vnode, 'postpatch', function () {
|
8468 |
-
directive.componentUpdated(el, binding, vnode);
|
8469 |
-
});
|
8470 |
-
} else {
|
8471 |
-
setSelected(el, binding, vnode.context);
|
8472 |
-
}
|
8473 |
-
el._vOptions = [].map.call(el.options, getValue);
|
8474 |
-
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
8475 |
-
el._vModifiers = binding.modifiers;
|
8476 |
-
if (!binding.modifiers.lazy) {
|
8477 |
-
el.addEventListener('compositionstart', onCompositionStart);
|
8478 |
-
el.addEventListener('compositionend', onCompositionEnd);
|
8479 |
-
// Safari < 10.2 & UIWebView doesn't fire compositionend when
|
8480 |
-
// switching focus before confirming composition choice
|
8481 |
-
// this also fixes the issue where some browsers e.g. iOS Chrome
|
8482 |
-
// fires "change" instead of "input" on autocomplete.
|
8483 |
-
el.addEventListener('change', onCompositionEnd);
|
8484 |
-
/* istanbul ignore if */
|
8485 |
-
if (isIE9) {
|
8486 |
-
el.vmodel = true;
|
8487 |
-
}
|
8488 |
-
}
|
8489 |
-
}
|
8490 |
-
},
|
8491 |
-
|
8492 |
-
componentUpdated: function componentUpdated (el, binding, vnode) {
|
8493 |
-
if (vnode.tag === 'select') {
|
8494 |
-
setSelected(el, binding, vnode.context);
|
8495 |
-
// in case the options rendered by v-for have changed,
|
8496 |
-
// it's possible that the value is out-of-sync with the rendered options.
|
8497 |
-
// detect such cases and filter out values that no longer has a matching
|
8498 |
-
// option in the DOM.
|
8499 |
-
var prevOptions = el._vOptions;
|
8500 |
-
var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
8501 |
-
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
8502 |
-
// trigger change event if
|
8503 |
-
// no matching option found for at least one value
|
8504 |
-
var needReset = el.multiple
|
8505 |
-
? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
8506 |
-
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
8507 |
-
if (needReset) {
|
8508 |
-
trigger(el, 'change');
|
8509 |
-
}
|
8510 |
-
}
|
8511 |
-
}
|
8512 |
-
}
|
8513 |
-
};
|
8514 |
-
|
8515 |
-
function setSelected (el, binding, vm) {
|
8516 |
-
actuallySetSelected(el, binding, vm);
|
8517 |
-
/* istanbul ignore if */
|
8518 |
-
if (isIE || isEdge) {
|
8519 |
-
setTimeout(function () {
|
8520 |
-
actuallySetSelected(el, binding, vm);
|
8521 |
-
}, 0);
|
8522 |
-
}
|
8523 |
-
}
|
8524 |
-
|
8525 |
-
function actuallySetSelected (el, binding, vm) {
|
8526 |
-
var value = binding.value;
|
8527 |
-
var isMultiple = el.multiple;
|
8528 |
-
if (isMultiple && !Array.isArray(value)) {
|
8529 |
-
warn(
|
8530 |
-
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
8531 |
-
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
8532 |
-
vm
|
8533 |
-
);
|
8534 |
-
return
|
8535 |
-
}
|
8536 |
-
var selected, option;
|
8537 |
-
for (var i = 0, l = el.options.length; i < l; i++) {
|
8538 |
-
option = el.options[i];
|
8539 |
-
if (isMultiple) {
|
8540 |
-
selected = looseIndexOf(value, getValue(option)) > -1;
|
8541 |
-
if (option.selected !== selected) {
|
8542 |
-
option.selected = selected;
|
8543 |
-
}
|
8544 |
-
} else {
|
8545 |
-
if (looseEqual(getValue(option), value)) {
|
8546 |
-
if (el.selectedIndex !== i) {
|
8547 |
-
el.selectedIndex = i;
|
8548 |
-
}
|
8549 |
-
return
|
8550 |
-
}
|
8551 |
-
}
|
8552 |
-
}
|
8553 |
-
if (!isMultiple) {
|
8554 |
-
el.selectedIndex = -1;
|
8555 |
-
}
|
8556 |
-
}
|
8557 |
-
|
8558 |
-
function hasNoMatchingOption (value, options) {
|
8559 |
-
return options.every(function (o) { return !looseEqual(o, value); })
|
8560 |
-
}
|
8561 |
-
|
8562 |
-
function getValue (option) {
|
8563 |
-
return '_value' in option
|
8564 |
-
? option._value
|
8565 |
-
: option.value
|
8566 |
-
}
|
8567 |
-
|
8568 |
-
function onCompositionStart (e) {
|
8569 |
-
e.target.composing = true;
|
8570 |
-
}
|
8571 |
-
|
8572 |
-
function onCompositionEnd (e) {
|
8573 |
-
// prevent triggering an input event for no reason
|
8574 |
-
if (!e.target.composing) { return }
|
8575 |
-
e.target.composing = false;
|
8576 |
-
trigger(e.target, 'input');
|
8577 |
-
}
|
8578 |
-
|
8579 |
-
function trigger (el, type) {
|
8580 |
-
var e = document.createEvent('HTMLEvents');
|
8581 |
-
e.initEvent(type, true, true);
|
8582 |
-
el.dispatchEvent(e);
|
8583 |
-
}
|
8584 |
-
|
8585 |
-
/* */
|
8586 |
-
|
8587 |
-
// recursively search for possible transition defined inside the component root
|
8588 |
-
function locateNode (vnode) {
|
8589 |
-
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
8590 |
-
? locateNode(vnode.componentInstance._vnode)
|
8591 |
-
: vnode
|
8592 |
-
}
|
8593 |
-
|
8594 |
-
var show = {
|
8595 |
-
bind: function bind (el, ref, vnode) {
|
8596 |
-
var value = ref.value;
|
8597 |
-
|
8598 |
-
vnode = locateNode(vnode);
|
8599 |
-
var transition$$1 = vnode.data && vnode.data.transition;
|
8600 |
-
var originalDisplay = el.__vOriginalDisplay =
|
8601 |
-
el.style.display === 'none' ? '' : el.style.display;
|
8602 |
-
if (value && transition$$1) {
|
8603 |
-
vnode.data.show = true;
|
8604 |
-
enter(vnode, function () {
|
8605 |
-
el.style.display = originalDisplay;
|
8606 |
-
});
|
8607 |
-
} else {
|
8608 |
-
el.style.display = value ? originalDisplay : 'none';
|
8609 |
-
}
|
8610 |
-
},
|
8611 |
-
|
8612 |
-
update: function update (el, ref, vnode) {
|
8613 |
-
var value = ref.value;
|
8614 |
-
var oldValue = ref.oldValue;
|
8615 |
-
|
8616 |
-
/* istanbul ignore if */
|
8617 |
-
if (!value === !oldValue) { return }
|
8618 |
-
vnode = locateNode(vnode);
|
8619 |
-
var transition$$1 = vnode.data && vnode.data.transition;
|
8620 |
-
if (transition$$1) {
|
8621 |
-
vnode.data.show = true;
|
8622 |
-
if (value) {
|
8623 |
-
enter(vnode, function () {
|
8624 |
-
el.style.display = el.__vOriginalDisplay;
|
8625 |
-
});
|
8626 |
-
} else {
|
8627 |
-
leave(vnode, function () {
|
8628 |
-
el.style.display = 'none';
|
8629 |
-
});
|
8630 |
-
}
|
8631 |
-
} else {
|
8632 |
-
el.style.display = value ? el.__vOriginalDisplay : 'none';
|
8633 |
-
}
|
8634 |
-
},
|
8635 |
-
|
8636 |
-
unbind: function unbind (
|
8637 |
-
el,
|
8638 |
-
binding,
|
8639 |
-
vnode,
|
8640 |
-
oldVnode,
|
8641 |
-
isDestroy
|
8642 |
-
) {
|
8643 |
-
if (!isDestroy) {
|
8644 |
-
el.style.display = el.__vOriginalDisplay;
|
8645 |
-
}
|
8646 |
-
}
|
8647 |
-
};
|
8648 |
-
|
8649 |
-
var platformDirectives = {
|
8650 |
-
model: directive,
|
8651 |
-
show: show
|
8652 |
-
};
|
8653 |
-
|
8654 |
-
/* */
|
8655 |
-
|
8656 |
-
var transitionProps = {
|
8657 |
-
name: String,
|
8658 |
-
appear: Boolean,
|
8659 |
-
css: Boolean,
|
8660 |
-
mode: String,
|
8661 |
-
type: String,
|
8662 |
-
enterClass: String,
|
8663 |
-
leaveClass: String,
|
8664 |
-
enterToClass: String,
|
8665 |
-
leaveToClass: String,
|
8666 |
-
enterActiveClass: String,
|
8667 |
-
leaveActiveClass: String,
|
8668 |
-
appearClass: String,
|
8669 |
-
appearActiveClass: String,
|
8670 |
-
appearToClass: String,
|
8671 |
-
duration: [Number, String, Object]
|
8672 |
-
};
|
8673 |
-
|
8674 |
-
// in case the child is also an abstract component, e.g. <keep-alive>
|
8675 |
-
// we want to recursively retrieve the real component to be rendered
|
8676 |
-
function getRealChild (vnode) {
|
8677 |
-
var compOptions = vnode && vnode.componentOptions;
|
8678 |
-
if (compOptions && compOptions.Ctor.options.abstract) {
|
8679 |
-
return getRealChild(getFirstComponentChild(compOptions.children))
|
8680 |
-
} else {
|
8681 |
-
return vnode
|
8682 |
-
}
|
8683 |
-
}
|
8684 |
-
|
8685 |
-
function extractTransitionData (comp) {
|
8686 |
-
var data = {};
|
8687 |
-
var options = comp.$options;
|
8688 |
-
// props
|
8689 |
-
for (var key in options.propsData) {
|
8690 |
-
data[key] = comp[key];
|
8691 |
-
}
|
8692 |
-
// events.
|
8693 |
-
// extract listeners and pass them directly to the transition methods
|
8694 |
-
var listeners = options._parentListeners;
|
8695 |
-
for (var key$1 in listeners) {
|
8696 |
-
data[camelize(key$1)] = listeners[key$1];
|
8697 |
-
}
|
8698 |
-
return data
|
8699 |
-
}
|
8700 |
-
|
8701 |
-
function placeholder (h, rawChild) {
|
8702 |
-
if (/\d-keep-alive$/.test(rawChild.tag)) {
|
8703 |
-
return h('keep-alive', {
|
8704 |
-
props: rawChild.componentOptions.propsData
|
8705 |
-
})
|
8706 |
-
}
|
8707 |
-
}
|
8708 |
-
|
8709 |
-
function hasParentTransition (vnode) {
|
8710 |
-
while ((vnode = vnode.parent)) {
|
8711 |
-
if (vnode.data.transition) {
|
8712 |
-
return true
|
8713 |
-
}
|
8714 |
-
}
|
8715 |
-
}
|
8716 |
-
|
8717 |
-
function isSameChild (child, oldChild) {
|
8718 |
-
return oldChild.key === child.key && oldChild.tag === child.tag
|
8719 |
-
}
|
8720 |
-
|
8721 |
-
var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
8722 |
-
|
8723 |
-
var isVShowDirective = function (d) { return d.name === 'show'; };
|
8724 |
-
|
8725 |
-
var Transition = {
|
8726 |
-
name: 'transition',
|
8727 |
-
props: transitionProps,
|
8728 |
-
abstract: true,
|
8729 |
-
|
8730 |
-
render: function render (h) {
|
8731 |
-
var this$1 = this;
|
8732 |
-
|
8733 |
-
var children = this.$slots.default;
|
8734 |
-
if (!children) {
|
8735 |
-
return
|
8736 |
-
}
|
8737 |
-
|
8738 |
-
// filter out text nodes (possible whitespaces)
|
8739 |
-
children = children.filter(isNotTextNode);
|
8740 |
-
/* istanbul ignore if */
|
8741 |
-
if (!children.length) {
|
8742 |
-
return
|
8743 |
-
}
|
8744 |
-
|
8745 |
-
// warn multiple elements
|
8746 |
-
if (children.length > 1) {
|
8747 |
-
warn(
|
8748 |
-
'<transition> can only be used on a single element. Use ' +
|
8749 |
-
'<transition-group> for lists.',
|
8750 |
-
this.$parent
|
8751 |
-
);
|
8752 |
-
}
|
8753 |
-
|
8754 |
-
var mode = this.mode;
|
8755 |
-
|
8756 |
-
// warn invalid mode
|
8757 |
-
if (mode && mode !== 'in-out' && mode !== 'out-in'
|
8758 |
-
) {
|
8759 |
-
warn(
|
8760 |
-
'invalid <transition> mode: ' + mode,
|
8761 |
-
this.$parent
|
8762 |
-
);
|
8763 |
-
}
|
8764 |
-
|
8765 |
-
var rawChild = children[0];
|
8766 |
-
|
8767 |
-
// if this is a component root node and the component's
|
8768 |
-
// parent container node also has transition, skip.
|
8769 |
-
if (hasParentTransition(this.$vnode)) {
|
8770 |
-
return rawChild
|
8771 |
-
}
|
8772 |
-
|
8773 |
-
// apply transition data to child
|
8774 |
-
// use getRealChild() to ignore abstract components e.g. keep-alive
|
8775 |
-
var child = getRealChild(rawChild);
|
8776 |
-
/* istanbul ignore if */
|
8777 |
-
if (!child) {
|
8778 |
-
return rawChild
|
8779 |
-
}
|
8780 |
-
|
8781 |
-
if (this._leaving) {
|
8782 |
-
return placeholder(h, rawChild)
|
8783 |
-
}
|
8784 |
-
|
8785 |
-
// ensure a key that is unique to the vnode type and to this transition
|
8786 |
-
// component instance. This key will be used to remove pending leaving nodes
|
8787 |
-
// during entering.
|
8788 |
-
var id = "__transition-" + (this._uid) + "-";
|
8789 |
-
child.key = child.key == null
|
8790 |
-
? child.isComment
|
8791 |
-
? id + 'comment'
|
8792 |
-
: id + child.tag
|
8793 |
-
: isPrimitive(child.key)
|
8794 |
-
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
8795 |
-
: child.key;
|
8796 |
-
|
8797 |
-
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
8798 |
-
var oldRawChild = this._vnode;
|
8799 |
-
var oldChild = getRealChild(oldRawChild);
|
8800 |
-
|
8801 |
-
// mark v-show
|
8802 |
-
// so that the transition module can hand over the control to the directive
|
8803 |
-
if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
8804 |
-
child.data.show = true;
|
8805 |
-
}
|
8806 |
-
|
8807 |
-
if (
|
8808 |
-
oldChild &&
|
8809 |
-
oldChild.data &&
|
8810 |
-
!isSameChild(child, oldChild) &&
|
8811 |
-
!isAsyncPlaceholder(oldChild) &&
|
8812 |
-
// #6687 component root is a comment node
|
8813 |
-
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
8814 |
-
) {
|
8815 |
-
// replace old child transition data with fresh one
|
8816 |
-
// important for dynamic transitions!
|
8817 |
-
var oldData = oldChild.data.transition = extend({}, data);
|
8818 |
-
// handle transition mode
|
8819 |
-
if (mode === 'out-in') {
|
8820 |
-
// return placeholder node and queue update when leave finishes
|
8821 |
-
this._leaving = true;
|
8822 |
-
mergeVNodeHook(oldData, 'afterLeave', function () {
|
8823 |
-
this$1._leaving = false;
|
8824 |
-
this$1.$forceUpdate();
|
8825 |
-
});
|
8826 |
-
return placeholder(h, rawChild)
|
8827 |
-
} else if (mode === 'in-out') {
|
8828 |
-
if (isAsyncPlaceholder(child)) {
|
8829 |
-
return oldRawChild
|
8830 |
-
}
|
8831 |
-
var delayedLeave;
|
8832 |
-
var performLeave = function () { delayedLeave(); };
|
8833 |
-
mergeVNodeHook(data, 'afterEnter', performLeave);
|
8834 |
-
mergeVNodeHook(data, 'enterCancelled', performLeave);
|
8835 |
-
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
8836 |
-
}
|
8837 |
-
}
|
8838 |
-
|
8839 |
-
return rawChild
|
8840 |
-
}
|
8841 |
-
};
|
8842 |
-
|
8843 |
-
/* */
|
8844 |
-
|
8845 |
-
var props = extend({
|
8846 |
-
tag: String,
|
8847 |
-
moveClass: String
|
8848 |
-
}, transitionProps);
|
8849 |
-
|
8850 |
-
delete props.mode;
|
8851 |
-
|
8852 |
-
var TransitionGroup = {
|
8853 |
-
props: props,
|
8854 |
-
|
8855 |
-
beforeMount: function beforeMount () {
|
8856 |
-
var this$1 = this;
|
8857 |
-
|
8858 |
-
var update = this._update;
|
8859 |
-
this._update = function (vnode, hydrating) {
|
8860 |
-
var restoreActiveInstance = setActiveInstance(this$1);
|
8861 |
-
// force removing pass
|
8862 |
-
this$1.__patch__(
|
8863 |
-
this$1._vnode,
|
8864 |
-
this$1.kept,
|
8865 |
-
false, // hydrating
|
8866 |
-
true // removeOnly (!important, avoids unnecessary moves)
|
8867 |
-
);
|
8868 |
-
this$1._vnode = this$1.kept;
|
8869 |
-
restoreActiveInstance();
|
8870 |
-
update.call(this$1, vnode, hydrating);
|
8871 |
-
};
|
8872 |
-
},
|
8873 |
-
|
8874 |
-
render: function render (h) {
|
8875 |
-
var tag = this.tag || this.$vnode.data.tag || 'span';
|
8876 |
-
var map = Object.create(null);
|
8877 |
-
var prevChildren = this.prevChildren = this.children;
|
8878 |
-
var rawChildren = this.$slots.default || [];
|
8879 |
-
var children = this.children = [];
|
8880 |
-
var transitionData = extractTransitionData(this);
|
8881 |
-
|
8882 |
-
for (var i = 0; i < rawChildren.length; i++) {
|
8883 |
-
var c = rawChildren[i];
|
8884 |
-
if (c.tag) {
|
8885 |
-
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
8886 |
-
children.push(c);
|
8887 |
-
map[c.key] = c
|
8888 |
-
;(c.data || (c.data = {})).transition = transitionData;
|
8889 |
-
} else {
|
8890 |
-
var opts = c.componentOptions;
|
8891 |
-
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
8892 |
-
warn(("<transition-group> children must be keyed: <" + name + ">"));
|
8893 |
-
}
|
8894 |
-
}
|
8895 |
-
}
|
8896 |
-
|
8897 |
-
if (prevChildren) {
|
8898 |
-
var kept = [];
|
8899 |
-
var removed = [];
|
8900 |
-
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
8901 |
-
var c$1 = prevChildren[i$1];
|
8902 |
-
c$1.data.transition = transitionData;
|
8903 |
-
c$1.data.pos = c$1.elm.getBoundingClientRect();
|
8904 |
-
if (map[c$1.key]) {
|
8905 |
-
kept.push(c$1);
|
8906 |
-
} else {
|
8907 |
-
removed.push(c$1);
|
8908 |
-
}
|
8909 |
-
}
|
8910 |
-
this.kept = h(tag, null, kept);
|
8911 |
-
this.removed = removed;
|
8912 |
-
}
|
8913 |
-
|
8914 |
-
return h(tag, null, children)
|
8915 |
-
},
|
8916 |
-
|
8917 |
-
updated: function updated () {
|
8918 |
-
var children = this.prevChildren;
|
8919 |
-
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
8920 |
-
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
8921 |
-
return
|
8922 |
-
}
|
8923 |
-
|
8924 |
-
// we divide the work into three loops to avoid mixing DOM reads and writes
|
8925 |
-
// in each iteration - which helps prevent layout thrashing.
|
8926 |
-
children.forEach(callPendingCbs);
|
8927 |
-
children.forEach(recordPosition);
|
8928 |
-
children.forEach(applyTranslation);
|
8929 |
-
|
8930 |
-
// force reflow to put everything in position
|
8931 |
-
// assign to this to avoid being removed in tree-shaking
|
8932 |
-
// $flow-disable-line
|
8933 |
-
this._reflow = document.body.offsetHeight;
|
8934 |
-
|
8935 |
-
children.forEach(function (c) {
|
8936 |
-
if (c.data.moved) {
|
8937 |
-
var el = c.elm;
|
8938 |
-
var s = el.style;
|
8939 |
-
addTransitionClass(el, moveClass);
|
8940 |
-
s.transform = s.WebkitTransform = s.transitionDuration = '';
|
8941 |
-
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
8942 |
-
if (e && e.target !== el) {
|
8943 |
-
return
|
8944 |
-
}
|
8945 |
-
if (!e || /transform$/.test(e.propertyName)) {
|
8946 |
-
el.removeEventListener(transitionEndEvent, cb);
|
8947 |
-
el._moveCb = null;
|
8948 |
-
removeTransitionClass(el, moveClass);
|
8949 |
-
}
|
8950 |
-
});
|
8951 |
-
}
|
8952 |
-
});
|
8953 |
-
},
|
8954 |
-
|
8955 |
-
methods: {
|
8956 |
-
hasMove: function hasMove (el, moveClass) {
|
8957 |
-
/* istanbul ignore if */
|
8958 |
-
if (!hasTransition) {
|
8959 |
-
return false
|
8960 |
-
}
|
8961 |
-
/* istanbul ignore if */
|
8962 |
-
if (this._hasMove) {
|
8963 |
-
return this._hasMove
|
8964 |
-
}
|
8965 |
-
// Detect whether an element with the move class applied has
|
8966 |
-
// CSS transitions. Since the element may be inside an entering
|
8967 |
-
// transition at this very moment, we make a clone of it and remove
|
8968 |
-
// all other transition classes applied to ensure only the move class
|
8969 |
-
// is applied.
|
8970 |
-
var clone = el.cloneNode();
|
8971 |
-
if (el._transitionClasses) {
|
8972 |
-
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
8973 |
-
}
|
8974 |
-
addClass(clone, moveClass);
|
8975 |
-
clone.style.display = 'none';
|
8976 |
-
this.$el.appendChild(clone);
|
8977 |
-
var info = getTransitionInfo(clone);
|
8978 |
-
this.$el.removeChild(clone);
|
8979 |
-
return (this._hasMove = info.hasTransform)
|
8980 |
-
}
|
8981 |
-
}
|
8982 |
-
};
|
8983 |
-
|
8984 |
-
function callPendingCbs (c) {
|
8985 |
-
/* istanbul ignore if */
|
8986 |
-
if (c.elm._moveCb) {
|
8987 |
-
c.elm._moveCb();
|
8988 |
-
}
|
8989 |
-
/* istanbul ignore if */
|
8990 |
-
if (c.elm._enterCb) {
|
8991 |
-
c.elm._enterCb();
|
8992 |
-
}
|
8993 |
-
}
|
8994 |
-
|
8995 |
-
function recordPosition (c) {
|
8996 |
-
c.data.newPos = c.elm.getBoundingClientRect();
|
8997 |
-
}
|
8998 |
-
|
8999 |
-
function applyTranslation (c) {
|
9000 |
-
var oldPos = c.data.pos;
|
9001 |
-
var newPos = c.data.newPos;
|
9002 |
-
var dx = oldPos.left - newPos.left;
|
9003 |
-
var dy = oldPos.top - newPos.top;
|
9004 |
-
if (dx || dy) {
|
9005 |
-
c.data.moved = true;
|
9006 |
-
var s = c.elm.style;
|
9007 |
-
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
9008 |
-
s.transitionDuration = '0s';
|
9009 |
-
}
|
9010 |
-
}
|
9011 |
-
|
9012 |
-
var platformComponents = {
|
9013 |
-
Transition: Transition,
|
9014 |
-
TransitionGroup: TransitionGroup
|
9015 |
-
};
|
9016 |
-
|
9017 |
-
/* */
|
9018 |
-
|
9019 |
-
// install platform specific utils
|
9020 |
-
Vue.config.mustUseProp = mustUseProp;
|
9021 |
-
Vue.config.isReservedTag = isReservedTag;
|
9022 |
-
Vue.config.isReservedAttr = isReservedAttr;
|
9023 |
-
Vue.config.getTagNamespace = getTagNamespace;
|
9024 |
-
Vue.config.isUnknownElement = isUnknownElement;
|
9025 |
-
|
9026 |
-
// install platform runtime directives & components
|
9027 |
-
extend(Vue.options.directives, platformDirectives);
|
9028 |
-
extend(Vue.options.components, platformComponents);
|
9029 |
-
|
9030 |
-
// install platform patch function
|
9031 |
-
Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
9032 |
-
|
9033 |
-
// public mount method
|
9034 |
-
Vue.prototype.$mount = function (
|
9035 |
-
el,
|
9036 |
-
hydrating
|
9037 |
-
) {
|
9038 |
-
el = el && inBrowser ? query(el) : undefined;
|
9039 |
-
return mountComponent(this, el, hydrating)
|
9040 |
-
};
|
9041 |
-
|
9042 |
-
// devtools global hook
|
9043 |
-
/* istanbul ignore next */
|
9044 |
-
if (inBrowser) {
|
9045 |
-
setTimeout(function () {
|
9046 |
-
if (config.devtools) {
|
9047 |
-
if (devtools) {
|
9048 |
-
devtools.emit('init', Vue);
|
9049 |
-
} else {
|
9050 |
-
console[console.info ? 'info' : 'log'](
|
9051 |
-
'Download the Vue Devtools extension for a better development experience:\n' +
|
9052 |
-
'https://github.com/vuejs/vue-devtools'
|
9053 |
-
);
|
9054 |
-
}
|
9055 |
-
}
|
9056 |
-
if (config.productionTip !== false &&
|
9057 |
-
typeof console !== 'undefined'
|
9058 |
-
) {
|
9059 |
-
console[console.info ? 'info' : 'log'](
|
9060 |
-
"You are running Vue in development mode.\n" +
|
9061 |
-
"Make sure to turn on production mode when deploying for production.\n" +
|
9062 |
-
"See more tips at https://vuejs.org/guide/deployment.html"
|
9063 |
-
);
|
9064 |
-
}
|
9065 |
-
}, 0);
|
9066 |
-
}
|
9067 |
-
|
9068 |
-
/* */
|
9069 |
-
|
9070 |
-
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
9071 |
-
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
9072 |
-
|
9073 |
-
var buildRegex = cached(function (delimiters) {
|
9074 |
-
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
9075 |
-
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
9076 |
-
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
9077 |
-
});
|
9078 |
-
|
9079 |
-
|
9080 |
-
|
9081 |
-
function parseText (
|
9082 |
-
text,
|
9083 |
-
delimiters
|
9084 |
-
) {
|
9085 |
-
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
9086 |
-
if (!tagRE.test(text)) {
|
9087 |
-
return
|
9088 |
-
}
|
9089 |
-
var tokens = [];
|
9090 |
-
var rawTokens = [];
|
9091 |
-
var lastIndex = tagRE.lastIndex = 0;
|
9092 |
-
var match, index, tokenValue;
|
9093 |
-
while ((match = tagRE.exec(text))) {
|
9094 |
-
index = match.index;
|
9095 |
-
// push text token
|
9096 |
-
if (index > lastIndex) {
|
9097 |
-
rawTokens.push(tokenValue = text.slice(lastIndex, index));
|
9098 |
-
tokens.push(JSON.stringify(tokenValue));
|
9099 |
-
}
|
9100 |
-
// tag token
|
9101 |
-
var exp = parseFilters(match[1].trim());
|
9102 |
-
tokens.push(("_s(" + exp + ")"));
|
9103 |
-
rawTokens.push({ '@binding': exp });
|
9104 |
-
lastIndex = index + match[0].length;
|
9105 |
-
}
|
9106 |
-
if (lastIndex < text.length) {
|
9107 |
-
rawTokens.push(tokenValue = text.slice(lastIndex));
|
9108 |
-
tokens.push(JSON.stringify(tokenValue));
|
9109 |
-
}
|
9110 |
-
return {
|
9111 |
-
expression: tokens.join('+'),
|
9112 |
-
tokens: rawTokens
|
9113 |
-
}
|
9114 |
-
}
|
9115 |
-
|
9116 |
-
/* */
|
9117 |
-
|
9118 |
-
function transformNode (el, options) {
|
9119 |
-
var warn = options.warn || baseWarn;
|
9120 |
-
var staticClass = getAndRemoveAttr(el, 'class');
|
9121 |
-
if (staticClass) {
|
9122 |
-
var res = parseText(staticClass, options.delimiters);
|
9123 |
-
if (res) {
|
9124 |
-
warn(
|
9125 |
-
"class=\"" + staticClass + "\": " +
|
9126 |
-
'Interpolation inside attributes has been removed. ' +
|
9127 |
-
'Use v-bind or the colon shorthand instead. For example, ' +
|
9128 |
-
'instead of <div class="{{ val }}">, use <div :class="val">.',
|
9129 |
-
el.rawAttrsMap['class']
|
9130 |
-
);
|
9131 |
-
}
|
9132 |
-
}
|
9133 |
-
if (staticClass) {
|
9134 |
-
el.staticClass = JSON.stringify(staticClass);
|
9135 |
-
}
|
9136 |
-
var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
|
9137 |
-
if (classBinding) {
|
9138 |
-
el.classBinding = classBinding;
|
9139 |
-
}
|
9140 |
-
}
|
9141 |
-
|
9142 |
-
function genData (el) {
|
9143 |
-
var data = '';
|
9144 |
-
if (el.staticClass) {
|
9145 |
-
data += "staticClass:" + (el.staticClass) + ",";
|
9146 |
-
}
|
9147 |
-
if (el.classBinding) {
|
9148 |
-
data += "class:" + (el.classBinding) + ",";
|
9149 |
-
}
|
9150 |
-
return data
|
9151 |
-
}
|
9152 |
-
|
9153 |
-
var klass$1 = {
|
9154 |
-
staticKeys: ['staticClass'],
|
9155 |
-
transformNode: transformNode,
|
9156 |
-
genData: genData
|
9157 |
-
};
|
9158 |
-
|
9159 |
-
/* */
|
9160 |
-
|
9161 |
-
function transformNode$1 (el, options) {
|
9162 |
-
var warn = options.warn || baseWarn;
|
9163 |
-
var staticStyle = getAndRemoveAttr(el, 'style');
|
9164 |
-
if (staticStyle) {
|
9165 |
-
/* istanbul ignore if */
|
9166 |
-
{
|
9167 |
-
var res = parseText(staticStyle, options.delimiters);
|
9168 |
-
if (res) {
|
9169 |
-
warn(
|
9170 |
-
"style=\"" + staticStyle + "\": " +
|
9171 |
-
'Interpolation inside attributes has been removed. ' +
|
9172 |
-
'Use v-bind or the colon shorthand instead. For example, ' +
|
9173 |
-
'instead of <div style="{{ val }}">, use <div :style="val">.',
|
9174 |
-
el.rawAttrsMap['style']
|
9175 |
-
);
|
9176 |
-
}
|
9177 |
-
}
|
9178 |
-
el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
9179 |
-
}
|
9180 |
-
|
9181 |
-
var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
|
9182 |
-
if (styleBinding) {
|
9183 |
-
el.styleBinding = styleBinding;
|
9184 |
-
}
|
9185 |
-
}
|
9186 |
-
|
9187 |
-
function genData$1 (el) {
|
9188 |
-
var data = '';
|
9189 |
-
if (el.staticStyle) {
|
9190 |
-
data += "staticStyle:" + (el.staticStyle) + ",";
|
9191 |
-
}
|
9192 |
-
if (el.styleBinding) {
|
9193 |
-
data += "style:(" + (el.styleBinding) + "),";
|
9194 |
-
}
|
9195 |
-
return data
|
9196 |
-
}
|
9197 |
-
|
9198 |
-
var style$1 = {
|
9199 |
-
staticKeys: ['staticStyle'],
|
9200 |
-
transformNode: transformNode$1,
|
9201 |
-
genData: genData$1
|
9202 |
-
};
|
9203 |
-
|
9204 |
-
/* */
|
9205 |
-
|
9206 |
-
var decoder;
|
9207 |
-
|
9208 |
-
var he = {
|
9209 |
-
decode: function decode (html) {
|
9210 |
-
decoder = decoder || document.createElement('div');
|
9211 |
-
decoder.innerHTML = html;
|
9212 |
-
return decoder.textContent
|
9213 |
-
}
|
9214 |
-
};
|
9215 |
-
|
9216 |
-
/* */
|
9217 |
-
|
9218 |
-
var isUnaryTag = makeMap(
|
9219 |
-
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
9220 |
-
'link,meta,param,source,track,wbr'
|
9221 |
-
);
|
9222 |
-
|
9223 |
-
// Elements that you can, intentionally, leave open
|
9224 |
-
// (and which close themselves)
|
9225 |
-
var canBeLeftOpenTag = makeMap(
|
9226 |
-
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
9227 |
-
);
|
9228 |
-
|
9229 |
-
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
9230 |
-
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
9231 |
-
var isNonPhrasingTag = makeMap(
|
9232 |
-
'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
9233 |
-
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
9234 |
-
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
9235 |
-
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
9236 |
-
'title,tr,track'
|
9237 |
-
);
|
9238 |
-
|
9239 |
-
/**
|
9240 |
-
* Not type-checking this file because it's mostly vendor code.
|
9241 |
-
*/
|
9242 |
-
|
9243 |
-
// Regular Expressions for parsing tags and attributes
|
9244 |
-
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9245 |
-
var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9246 |
-
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
|
9247 |
-
var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
9248 |
-
var startTagOpen = new RegExp(("^<" + qnameCapture));
|
9249 |
-
var startTagClose = /^\s*(\/?)>/;
|
9250 |
-
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
9251 |
-
var doctype = /^<!DOCTYPE [^>]+>/i;
|
9252 |
-
// #7298: escape - to avoid being pased as HTML comment when inlined in page
|
9253 |
-
var comment = /^<!\--/;
|
9254 |
-
var conditionalComment = /^<!\[/;
|
9255 |
-
|
9256 |
-
// Special Elements (can contain anything)
|
9257 |
-
var isPlainTextElement = makeMap('script,style,textarea', true);
|
9258 |
-
var reCache = {};
|
9259 |
-
|
9260 |
-
var decodingMap = {
|
9261 |
-
'<': '<',
|
9262 |
-
'>': '>',
|
9263 |
-
'"': '"',
|
9264 |
-
'&': '&',
|
9265 |
-
' ': '\n',
|
9266 |
-
'	': '\t',
|
9267 |
-
''': "'"
|
9268 |
-
};
|
9269 |
-
var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
|
9270 |
-
var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
|
9271 |
-
|
9272 |
-
// #5992
|
9273 |
-
var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
9274 |
-
var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
|
9275 |
-
|
9276 |
-
function decodeAttr (value, shouldDecodeNewlines) {
|
9277 |
-
var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
9278 |
-
return value.replace(re, function (match) { return decodingMap[match]; })
|
9279 |
-
}
|
9280 |
-
|
9281 |
-
function parseHTML (html, options) {
|
9282 |
-
var stack = [];
|
9283 |
-
var expectHTML = options.expectHTML;
|
9284 |
-
var isUnaryTag$$1 = options.isUnaryTag || no;
|
9285 |
-
var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
9286 |
-
var index = 0;
|
9287 |
-
var last, lastTag;
|
9288 |
-
while (html) {
|
9289 |
-
last = html;
|
9290 |
-
// Make sure we're not in a plaintext content element like script/style
|
9291 |
-
if (!lastTag || !isPlainTextElement(lastTag)) {
|
9292 |
-
var textEnd = html.indexOf('<');
|
9293 |
-
if (textEnd === 0) {
|
9294 |
-
// Comment:
|
9295 |
-
if (comment.test(html)) {
|
9296 |
-
var commentEnd = html.indexOf('-->');
|
9297 |
-
|
9298 |
-
if (commentEnd >= 0) {
|
9299 |
-
if (options.shouldKeepComment) {
|
9300 |
-
options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
9301 |
-
}
|
9302 |
-
advance(commentEnd + 3);
|
9303 |
-
continue
|
9304 |
-
}
|
9305 |
-
}
|
9306 |
-
|
9307 |
-
// http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
|
9308 |
-
if (conditionalComment.test(html)) {
|
9309 |
-
var conditionalEnd = html.indexOf(']>');
|
9310 |
-
|
9311 |
-
if (conditionalEnd >= 0) {
|
9312 |
-
advance(conditionalEnd + 2);
|
9313 |
-
continue
|
9314 |
-
}
|
9315 |
-
}
|
9316 |
-
|
9317 |
-
// Doctype:
|
9318 |
-
var doctypeMatch = html.match(doctype);
|
9319 |
-
if (doctypeMatch) {
|
9320 |
-
advance(doctypeMatch[0].length);
|
9321 |
-
continue
|
9322 |
-
}
|
9323 |
-
|
9324 |
-
// End tag:
|
9325 |
-
var endTagMatch = html.match(endTag);
|
9326 |
-
if (endTagMatch) {
|
9327 |
-
var curIndex = index;
|
9328 |
-
advance(endTagMatch[0].length);
|
9329 |
-
parseEndTag(endTagMatch[1], curIndex, index);
|
9330 |
-
continue
|
9331 |
-
}
|
9332 |
-
|
9333 |
-
// Start tag:
|
9334 |
-
var startTagMatch = parseStartTag();
|
9335 |
-
if (startTagMatch) {
|
9336 |
-
handleStartTag(startTagMatch);
|
9337 |
-
if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
9338 |
-
advance(1);
|
9339 |
-
}
|
9340 |
-
continue
|
9341 |
-
}
|
9342 |
-
}
|
9343 |
-
|
9344 |
-
var text = (void 0), rest = (void 0), next = (void 0);
|
9345 |
-
if (textEnd >= 0) {
|
9346 |
-
rest = html.slice(textEnd);
|
9347 |
-
while (
|
9348 |
-
!endTag.test(rest) &&
|
9349 |
-
!startTagOpen.test(rest) &&
|
9350 |
-
!comment.test(rest) &&
|
9351 |
-
!conditionalComment.test(rest)
|
9352 |
-
) {
|
9353 |
-
// < in plain text, be forgiving and treat it as text
|
9354 |
-
next = rest.indexOf('<', 1);
|
9355 |
-
if (next < 0) { break }
|
9356 |
-
textEnd += next;
|
9357 |
-
rest = html.slice(textEnd);
|
9358 |
-
}
|
9359 |
-
text = html.substring(0, textEnd);
|
9360 |
-
}
|
9361 |
-
|
9362 |
-
if (textEnd < 0) {
|
9363 |
-
text = html;
|
9364 |
-
}
|
9365 |
-
|
9366 |
-
if (text) {
|
9367 |
-
advance(text.length);
|
9368 |
-
}
|
9369 |
-
|
9370 |
-
if (options.chars && text) {
|
9371 |
-
options.chars(text, index - text.length, index);
|
9372 |
-
}
|
9373 |
-
} else {
|
9374 |
-
var endTagLength = 0;
|
9375 |
-
var stackedTag = lastTag.toLowerCase();
|
9376 |
-
var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
|
9377 |
-
var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
|
9378 |
-
endTagLength = endTag.length;
|
9379 |
-
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
9380 |
-
text = text
|
9381 |
-
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
|
9382 |
-
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
9383 |
-
}
|
9384 |
-
if (shouldIgnoreFirstNewline(stackedTag, text)) {
|
9385 |
-
text = text.slice(1);
|
9386 |
-
}
|
9387 |
-
if (options.chars) {
|
9388 |
-
options.chars(text);
|
9389 |
-
}
|
9390 |
-
return ''
|
9391 |
-
});
|
9392 |
-
index += html.length - rest$1.length;
|
9393 |
-
html = rest$1;
|
9394 |
-
parseEndTag(stackedTag, index - endTagLength, index);
|
9395 |
-
}
|
9396 |
-
|
9397 |
-
if (html === last) {
|
9398 |
-
options.chars && options.chars(html);
|
9399 |
-
if (!stack.length && options.warn) {
|
9400 |
-
options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
|
9401 |
-
}
|
9402 |
-
break
|
9403 |
-
}
|
9404 |
-
}
|
9405 |
-
|
9406 |
-
// Clean up any remaining tags
|
9407 |
-
parseEndTag();
|
9408 |
-
|
9409 |
-
function advance (n) {
|
9410 |
-
index += n;
|
9411 |
-
html = html.substring(n);
|
9412 |
-
}
|
9413 |
-
|
9414 |
-
function parseStartTag () {
|
9415 |
-
var start = html.match(startTagOpen);
|
9416 |
-
if (start) {
|
9417 |
-
var match = {
|
9418 |
-
tagName: start[1],
|
9419 |
-
attrs: [],
|
9420 |
-
start: index
|
9421 |
-
};
|
9422 |
-
advance(start[0].length);
|
9423 |
-
var end, attr;
|
9424 |
-
while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
9425 |
-
attr.start = index;
|
9426 |
-
advance(attr[0].length);
|
9427 |
-
attr.end = index;
|
9428 |
-
match.attrs.push(attr);
|
9429 |
-
}
|
9430 |
-
if (end) {
|
9431 |
-
match.unarySlash = end[1];
|
9432 |
-
advance(end[0].length);
|
9433 |
-
match.end = index;
|
9434 |
-
return match
|
9435 |
-
}
|
9436 |
-
}
|
9437 |
-
}
|
9438 |
-
|
9439 |
-
function handleStartTag (match) {
|
9440 |
-
var tagName = match.tagName;
|
9441 |
-
var unarySlash = match.unarySlash;
|
9442 |
-
|
9443 |
-
if (expectHTML) {
|
9444 |
-
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
9445 |
-
parseEndTag(lastTag);
|
9446 |
-
}
|
9447 |
-
if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
9448 |
-
parseEndTag(tagName);
|
9449 |
-
}
|
9450 |
-
}
|
9451 |
-
|
9452 |
-
var unary = isUnaryTag$$1(tagName) || !!unarySlash;
|
9453 |
-
|
9454 |
-
var l = match.attrs.length;
|
9455 |
-
var attrs = new Array(l);
|
9456 |
-
for (var i = 0; i < l; i++) {
|
9457 |
-
var args = match.attrs[i];
|
9458 |
-
var value = args[3] || args[4] || args[5] || '';
|
9459 |
-
var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
9460 |
-
? options.shouldDecodeNewlinesForHref
|
9461 |
-
: options.shouldDecodeNewlines;
|
9462 |
-
attrs[i] = {
|
9463 |
-
name: args[1],
|
9464 |
-
value: decodeAttr(value, shouldDecodeNewlines)
|
9465 |
-
};
|
9466 |
-
if (options.outputSourceRange) {
|
9467 |
-
attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
9468 |
-
attrs[i].end = args.end;
|
9469 |
-
}
|
9470 |
-
}
|
9471 |
-
|
9472 |
-
if (!unary) {
|
9473 |
-
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
|
9474 |
-
lastTag = tagName;
|
9475 |
-
}
|
9476 |
-
|
9477 |
-
if (options.start) {
|
9478 |
-
options.start(tagName, attrs, unary, match.start, match.end);
|
9479 |
-
}
|
9480 |
-
}
|
9481 |
-
|
9482 |
-
function parseEndTag (tagName, start, end) {
|
9483 |
-
var pos, lowerCasedTagName;
|
9484 |
-
if (start == null) { start = index; }
|
9485 |
-
if (end == null) { end = index; }
|
9486 |
-
|
9487 |
-
// Find the closest opened tag of the same type
|
9488 |
-
if (tagName) {
|
9489 |
-
lowerCasedTagName = tagName.toLowerCase();
|
9490 |
-
for (pos = stack.length - 1; pos >= 0; pos--) {
|
9491 |
-
if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
9492 |
-
break
|
9493 |
-
}
|
9494 |
-
}
|
9495 |
-
} else {
|
9496 |
-
// If no tag name is provided, clean shop
|
9497 |
-
pos = 0;
|
9498 |
-
}
|
9499 |
-
|
9500 |
-
if (pos >= 0) {
|
9501 |
-
// Close all the open elements, up the stack
|
9502 |
-
for (var i = stack.length - 1; i >= pos; i--) {
|
9503 |
-
if (i > pos || !tagName &&
|
9504 |
-
options.warn
|
9505 |
-
) {
|
9506 |
-
options.warn(
|
9507 |
-
("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
9508 |
-
{ start: stack[i].start, end: stack[i].end }
|
9509 |
-
);
|
9510 |
-
}
|
9511 |
-
if (options.end) {
|
9512 |
-
options.end(stack[i].tag, start, end);
|
9513 |
-
}
|
9514 |
-
}
|
9515 |
-
|
9516 |
-
// Remove the open elements from the stack
|
9517 |
-
stack.length = pos;
|
9518 |
-
lastTag = pos && stack[pos - 1].tag;
|
9519 |
-
} else if (lowerCasedTagName === 'br') {
|
9520 |
-
if (options.start) {
|
9521 |
-
options.start(tagName, [], true, start, end);
|
9522 |
-
}
|
9523 |
-
} else if (lowerCasedTagName === 'p') {
|
9524 |
-
if (options.start) {
|
9525 |
-
options.start(tagName, [], false, start, end);
|
9526 |
-
}
|
9527 |
-
if (options.end) {
|
9528 |
-
options.end(tagName, start, end);
|
9529 |
-
}
|
9530 |
-
}
|
9531 |
-
}
|
9532 |
-
}
|
9533 |
-
|
9534 |
-
/* */
|
9535 |
-
|
9536 |
-
var onRE = /^@|^v-on:/;
|
9537 |
-
var dirRE = /^v-|^@|^:/;
|
9538 |
-
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
9539 |
-
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
9540 |
-
var stripParensRE = /^\(|\)$/g;
|
9541 |
-
var dynamicArgRE = /^\[.*\]$/;
|
9542 |
-
|
9543 |
-
var argRE = /:(.*)$/;
|
9544 |
-
var bindRE = /^:|^\.|^v-bind:/;
|
9545 |
-
var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
|
9546 |
-
|
9547 |
-
var slotRE = /^v-slot(:|$)|^#/;
|
9548 |
-
|
9549 |
-
var lineBreakRE = /[\r\n]/;
|
9550 |
-
var whitespaceRE$1 = /\s+/g;
|
9551 |
-
|
9552 |
-
var invalidAttributeRE = /[\s"'<>\/=]/;
|
9553 |
-
|
9554 |
-
var decodeHTMLCached = cached(he.decode);
|
9555 |
-
|
9556 |
-
var emptySlotScopeToken = "_empty_";
|
9557 |
-
|
9558 |
-
// configurable state
|
9559 |
-
var warn$2;
|
9560 |
-
var delimiters;
|
9561 |
-
var transforms;
|
9562 |
-
var preTransforms;
|
9563 |
-
var postTransforms;
|
9564 |
-
var platformIsPreTag;
|
9565 |
-
var platformMustUseProp;
|
9566 |
-
var platformGetTagNamespace;
|
9567 |
-
var maybeComponent;
|
9568 |
-
|
9569 |
-
function createASTElement (
|
9570 |
-
tag,
|
9571 |
-
attrs,
|
9572 |
-
parent
|
9573 |
-
) {
|
9574 |
-
return {
|
9575 |
-
type: 1,
|
9576 |
-
tag: tag,
|
9577 |
-
attrsList: attrs,
|
9578 |
-
attrsMap: makeAttrsMap(attrs),
|
9579 |
-
rawAttrsMap: {},
|
9580 |
-
parent: parent,
|
9581 |
-
children: []
|
9582 |
-
}
|
9583 |
-
}
|
9584 |
-
|
9585 |
-
/**
|
9586 |
-
* Convert HTML string to AST.
|
9587 |
-
*/
|
9588 |
-
function parse (
|
9589 |
-
template,
|
9590 |
-
options
|
9591 |
-
) {
|
9592 |
-
warn$2 = options.warn || baseWarn;
|
9593 |
-
|
9594 |
-
platformIsPreTag = options.isPreTag || no;
|
9595 |
-
platformMustUseProp = options.mustUseProp || no;
|
9596 |
-
platformGetTagNamespace = options.getTagNamespace || no;
|
9597 |
-
var isReservedTag = options.isReservedTag || no;
|
9598 |
-
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
9599 |
-
|
9600 |
-
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
9601 |
-
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
9602 |
-
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
9603 |
-
|
9604 |
-
delimiters = options.delimiters;
|
9605 |
-
|
9606 |
-
var stack = [];
|
9607 |
-
var preserveWhitespace = options.preserveWhitespace !== false;
|
9608 |
-
var whitespaceOption = options.whitespace;
|
9609 |
-
var root;
|
9610 |
-
var currentParent;
|
9611 |
-
var inVPre = false;
|
9612 |
-
var inPre = false;
|
9613 |
-
var warned = false;
|
9614 |
-
|
9615 |
-
function warnOnce (msg, range) {
|
9616 |
-
if (!warned) {
|
9617 |
-
warned = true;
|
9618 |
-
warn$2(msg, range);
|
9619 |
-
}
|
9620 |
-
}
|
9621 |
-
|
9622 |
-
function closeElement (element) {
|
9623 |
-
trimEndingWhitespace(element);
|
9624 |
-
if (!inVPre && !element.processed) {
|
9625 |
-
element = processElement(element, options);
|
9626 |
-
}
|
9627 |
-
// tree management
|
9628 |
-
if (!stack.length && element !== root) {
|
9629 |
-
// allow root elements with v-if, v-else-if and v-else
|
9630 |
-
if (root.if && (element.elseif || element.else)) {
|
9631 |
-
{
|
9632 |
-
checkRootConstraints(element);
|
9633 |
-
}
|
9634 |
-
addIfCondition(root, {
|
9635 |
-
exp: element.elseif,
|
9636 |
-
block: element
|
9637 |
-
});
|
9638 |
-
} else {
|
9639 |
-
warnOnce(
|
9640 |
-
"Component template should contain exactly one root element. " +
|
9641 |
-
"If you are using v-if on multiple elements, " +
|
9642 |
-
"use v-else-if to chain them instead.",
|
9643 |
-
{ start: element.start }
|
9644 |
-
);
|
9645 |
-
}
|
9646 |
-
}
|
9647 |
-
if (currentParent && !element.forbidden) {
|
9648 |
-
if (element.elseif || element.else) {
|
9649 |
-
processIfConditions(element, currentParent);
|
9650 |
-
} else {
|
9651 |
-
if (element.slotScope) {
|
9652 |
-
// scoped slot
|
9653 |
-
// keep it in the children list so that v-else(-if) conditions can
|
9654 |
-
// find it as the prev node.
|
9655 |
-
var name = element.slotTarget || '"default"'
|
9656 |
-
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
|
9657 |
-
}
|
9658 |
-
currentParent.children.push(element);
|
9659 |
-
element.parent = currentParent;
|
9660 |
-
}
|
9661 |
-
}
|
9662 |
-
|
9663 |
-
// final children cleanup
|
9664 |
-
// filter out scoped slots
|
9665 |
-
element.children = element.children.filter(function (c) { return !(c).slotScope; });
|
9666 |
-
// remove trailing whitespace node again
|
9667 |
-
trimEndingWhitespace(element);
|
9668 |
-
|
9669 |
-
// check pre state
|
9670 |
-
if (element.pre) {
|
9671 |
-
inVPre = false;
|
9672 |
-
}
|
9673 |
-
if (platformIsPreTag(element.tag)) {
|
9674 |
-
inPre = false;
|
9675 |
-
}
|
9676 |
-
// apply post-transforms
|
9677 |
-
for (var i = 0; i < postTransforms.length; i++) {
|
9678 |
-
postTransforms[i](element, options);
|
9679 |
-
}
|
9680 |
-
}
|
9681 |
-
|
9682 |
-
function trimEndingWhitespace (el) {
|
9683 |
-
// remove trailing whitespace node
|
9684 |
-
if (!inPre) {
|
9685 |
-
var lastNode;
|
9686 |
-
while (
|
9687 |
-
(lastNode = el.children[el.children.length - 1]) &&
|
9688 |
-
lastNode.type === 3 &&
|
9689 |
-
lastNode.text === ' '
|
9690 |
-
) {
|
9691 |
-
el.children.pop();
|
9692 |
-
}
|
9693 |
-
}
|
9694 |
-
}
|
9695 |
-
|
9696 |
-
function checkRootConstraints (el) {
|
9697 |
-
if (el.tag === 'slot' || el.tag === 'template') {
|
9698 |
-
warnOnce(
|
9699 |
-
"Cannot use <" + (el.tag) + "> as component root element because it may " +
|
9700 |
-
'contain multiple nodes.',
|
9701 |
-
{ start: el.start }
|
9702 |
-
);
|
9703 |
-
}
|
9704 |
-
if (el.attrsMap.hasOwnProperty('v-for')) {
|
9705 |
-
warnOnce(
|
9706 |
-
'Cannot use v-for on stateful component root element because ' +
|
9707 |
-
'it renders multiple elements.',
|
9708 |
-
el.rawAttrsMap['v-for']
|
9709 |
-
);
|
9710 |
-
}
|
9711 |
-
}
|
9712 |
-
|
9713 |
-
parseHTML(template, {
|
9714 |
-
warn: warn$2,
|
9715 |
-
expectHTML: options.expectHTML,
|
9716 |
-
isUnaryTag: options.isUnaryTag,
|
9717 |
-
canBeLeftOpenTag: options.canBeLeftOpenTag,
|
9718 |
-
shouldDecodeNewlines: options.shouldDecodeNewlines,
|
9719 |
-
shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
9720 |
-
shouldKeepComment: options.comments,
|
9721 |
-
outputSourceRange: options.outputSourceRange,
|
9722 |
-
start: function start (tag, attrs, unary, start$1, end) {
|
9723 |
-
// check namespace.
|
9724 |
-
// inherit parent ns if there is one
|
9725 |
-
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
9726 |
-
|
9727 |
-
// handle IE svg bug
|
9728 |
-
/* istanbul ignore if */
|
9729 |
-
if (isIE && ns === 'svg') {
|
9730 |
-
attrs = guardIESVGBug(attrs);
|
9731 |
-
}
|
9732 |
-
|
9733 |
-
var element = createASTElement(tag, attrs, currentParent);
|
9734 |
-
if (ns) {
|
9735 |
-
element.ns = ns;
|
9736 |
-
}
|
9737 |
-
|
9738 |
-
{
|
9739 |
-
if (options.outputSourceRange) {
|
9740 |
-
element.start = start$1;
|
9741 |
-
element.end = end;
|
9742 |
-
element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
9743 |
-
cumulated[attr.name] = attr;
|
9744 |
-
return cumulated
|
9745 |
-
}, {});
|
9746 |
-
}
|
9747 |
-
attrs.forEach(function (attr) {
|
9748 |
-
if (invalidAttributeRE.test(attr.name)) {
|
9749 |
-
warn$2(
|
9750 |
-
"Invalid dynamic argument expression: attribute names cannot contain " +
|
9751 |
-
"spaces, quotes, <, >, / or =.",
|
9752 |
-
{
|
9753 |
-
start: attr.start + attr.name.indexOf("["),
|
9754 |
-
end: attr.start + attr.name.length
|
9755 |
-
}
|
9756 |
-
);
|
9757 |
-
}
|
9758 |
-
});
|
9759 |
-
}
|
9760 |
-
|
9761 |
-
if (isForbiddenTag(element) && !isServerRendering()) {
|
9762 |
-
element.forbidden = true;
|
9763 |
-
warn$2(
|
9764 |
-
'Templates should only be responsible for mapping the state to the ' +
|
9765 |
-
'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
9766 |
-
"<" + tag + ">" + ', as they will not be parsed.',
|
9767 |
-
{ start: element.start }
|
9768 |
-
);
|
9769 |
-
}
|
9770 |
-
|
9771 |
-
// apply pre-transforms
|
9772 |
-
for (var i = 0; i < preTransforms.length; i++) {
|
9773 |
-
element = preTransforms[i](element, options) || element;
|
9774 |
-
}
|
9775 |
-
|
9776 |
-
if (!inVPre) {
|
9777 |
-
processPre(element);
|
9778 |
-
if (element.pre) {
|
9779 |
-
inVPre = true;
|
9780 |
-
}
|
9781 |
-
}
|
9782 |
-
if (platformIsPreTag(element.tag)) {
|
9783 |
-
inPre = true;
|
9784 |
-
}
|
9785 |
-
if (inVPre) {
|
9786 |
-
processRawAttrs(element);
|
9787 |
-
} else if (!element.processed) {
|
9788 |
-
// structural directives
|
9789 |
-
processFor(element);
|
9790 |
-
processIf(element);
|
9791 |
-
processOnce(element);
|
9792 |
-
}
|
9793 |
-
|
9794 |
-
if (!root) {
|
9795 |
-
root = element;
|
9796 |
-
{
|
9797 |
-
checkRootConstraints(root);
|
9798 |
-
}
|
9799 |
-
}
|
9800 |
-
|
9801 |
-
if (!unary) {
|
9802 |
-
currentParent = element;
|
9803 |
-
stack.push(element);
|
9804 |
-
} else {
|
9805 |
-
closeElement(element);
|
9806 |
-
}
|
9807 |
-
},
|
9808 |
-
|
9809 |
-
end: function end (tag, start, end$1) {
|
9810 |
-
var element = stack[stack.length - 1];
|
9811 |
-
// pop stack
|
9812 |
-
stack.length -= 1;
|
9813 |
-
currentParent = stack[stack.length - 1];
|
9814 |
-
if (options.outputSourceRange) {
|
9815 |
-
element.end = end$1;
|
9816 |
-
}
|
9817 |
-
closeElement(element);
|
9818 |
-
},
|
9819 |
-
|
9820 |
-
chars: function chars (text, start, end) {
|
9821 |
-
if (!currentParent) {
|
9822 |
-
{
|
9823 |
-
if (text === template) {
|
9824 |
-
warnOnce(
|
9825 |
-
'Component template requires a root element, rather than just text.',
|
9826 |
-
{ start: start }
|
9827 |
-
);
|
9828 |
-
} else if ((text = text.trim())) {
|
9829 |
-
warnOnce(
|
9830 |
-
("text \"" + text + "\" outside root element will be ignored."),
|
9831 |
-
{ start: start }
|
9832 |
-
);
|
9833 |
-
}
|
9834 |
-
}
|
9835 |
-
return
|
9836 |
-
}
|
9837 |
-
// IE textarea placeholder bug
|
9838 |
-
/* istanbul ignore if */
|
9839 |
-
if (isIE &&
|
9840 |
-
currentParent.tag === 'textarea' &&
|
9841 |
-
currentParent.attrsMap.placeholder === text
|
9842 |
-
) {
|
9843 |
-
return
|
9844 |
-
}
|
9845 |
-
var children = currentParent.children;
|
9846 |
-
if (inPre || text.trim()) {
|
9847 |
-
text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
|
9848 |
-
} else if (!children.length) {
|
9849 |
-
// remove the whitespace-only node right after an opening tag
|
9850 |
-
text = '';
|
9851 |
-
} else if (whitespaceOption) {
|
9852 |
-
if (whitespaceOption === 'condense') {
|
9853 |
-
// in condense mode, remove the whitespace node if it contains
|
9854 |
-
// line break, otherwise condense to a single space
|
9855 |
-
text = lineBreakRE.test(text) ? '' : ' ';
|
9856 |
-
} else {
|
9857 |
-
text = ' ';
|
9858 |
-
}
|
9859 |
-
} else {
|
9860 |
-
text = preserveWhitespace ? ' ' : '';
|
9861 |
-
}
|
9862 |
-
if (text) {
|
9863 |
-
if (!inPre && whitespaceOption === 'condense') {
|
9864 |
-
// condense consecutive whitespaces into single space
|
9865 |
-
text = text.replace(whitespaceRE$1, ' ');
|
9866 |
-
}
|
9867 |
-
var res;
|
9868 |
-
var child;
|
9869 |
-
if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
9870 |
-
child = {
|
9871 |
-
type: 2,
|
9872 |
-
expression: res.expression,
|
9873 |
-
tokens: res.tokens,
|
9874 |
-
text: text
|
9875 |
-
};
|
9876 |
-
} else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
|
9877 |
-
child = {
|
9878 |
-
type: 3,
|
9879 |
-
text: text
|
9880 |
-
};
|
9881 |
-
}
|
9882 |
-
if (child) {
|
9883 |
-
if (options.outputSourceRange) {
|
9884 |
-
child.start = start;
|
9885 |
-
child.end = end;
|
9886 |
-
}
|
9887 |
-
children.push(child);
|
9888 |
-
}
|
9889 |
-
}
|
9890 |
-
},
|
9891 |
-
comment: function comment (text, start, end) {
|
9892 |
-
// adding anyting as a sibling to the root node is forbidden
|
9893 |
-
// comments should still be allowed, but ignored
|
9894 |
-
if (currentParent) {
|
9895 |
-
var child = {
|
9896 |
-
type: 3,
|
9897 |
-
text: text,
|
9898 |
-
isComment: true
|
9899 |
-
};
|
9900 |
-
if (options.outputSourceRange) {
|
9901 |
-
child.start = start;
|
9902 |
-
child.end = end;
|
9903 |
-
}
|
9904 |
-
currentParent.children.push(child);
|
9905 |
-
}
|
9906 |
-
}
|
9907 |
-
});
|
9908 |
-
return root
|
9909 |
-
}
|
9910 |
-
|
9911 |
-
function processPre (el) {
|
9912 |
-
if (getAndRemoveAttr(el, 'v-pre') != null) {
|
9913 |
-
el.pre = true;
|
9914 |
-
}
|
9915 |
-
}
|
9916 |
-
|
9917 |
-
function processRawAttrs (el) {
|
9918 |
-
var list = el.attrsList;
|
9919 |
-
var len = list.length;
|
9920 |
-
if (len) {
|
9921 |
-
var attrs = el.attrs = new Array(len);
|
9922 |
-
for (var i = 0; i < len; i++) {
|
9923 |
-
attrs[i] = {
|
9924 |
-
name: list[i].name,
|
9925 |
-
value: JSON.stringify(list[i].value)
|
9926 |
-
};
|
9927 |
-
if (list[i].start != null) {
|
9928 |
-
attrs[i].start = list[i].start;
|
9929 |
-
attrs[i].end = list[i].end;
|
9930 |
-
}
|
9931 |
-
}
|
9932 |
-
} else if (!el.pre) {
|
9933 |
-
// non root node in pre blocks with no attributes
|
9934 |
-
el.plain = true;
|
9935 |
-
}
|
9936 |
-
}
|
9937 |
-
|
9938 |
-
function processElement (
|
9939 |
-
element,
|
9940 |
-
options
|
9941 |
-
) {
|
9942 |
-
processKey(element);
|
9943 |
-
|
9944 |
-
// determine whether this is a plain element after
|
9945 |
-
// removing structural attributes
|
9946 |
-
element.plain = (
|
9947 |
-
!element.key &&
|
9948 |
-
!element.scopedSlots &&
|
9949 |
-
!element.attrsList.length
|
9950 |
-
);
|
9951 |
-
|
9952 |
-
processRef(element);
|
9953 |
-
processSlotContent(element);
|
9954 |
-
processSlotOutlet(element);
|
9955 |
-
processComponent(element);
|
9956 |
-
for (var i = 0; i < transforms.length; i++) {
|
9957 |
-
element = transforms[i](element, options) || element;
|
9958 |
-
}
|
9959 |
-
processAttrs(element);
|
9960 |
-
return element
|
9961 |
-
}
|
9962 |
-
|
9963 |
-
function processKey (el) {
|
9964 |
-
var exp = getBindingAttr(el, 'key');
|
9965 |
-
if (exp) {
|
9966 |
-
{
|
9967 |
-
if (el.tag === 'template') {
|
9968 |
-
warn$2(
|
9969 |
-
"<template> cannot be keyed. Place the key on real elements instead.",
|
9970 |
-
getRawBindingAttr(el, 'key')
|
9971 |
-
);
|
9972 |
-
}
|
9973 |
-
if (el.for) {
|
9974 |
-
var iterator = el.iterator2 || el.iterator1;
|
9975 |
-
var parent = el.parent;
|
9976 |
-
if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
9977 |
-
warn$2(
|
9978 |
-
"Do not use v-for index as key on <transition-group> children, " +
|
9979 |
-
"this is the same as not using keys.",
|
9980 |
-
getRawBindingAttr(el, 'key'),
|
9981 |
-
true /* tip */
|
9982 |
-
);
|
9983 |
-
}
|
9984 |
-
}
|
9985 |
-
}
|
9986 |
-
el.key = exp;
|
9987 |
-
}
|
9988 |
-
}
|
9989 |
-
|
9990 |
-
function processRef (el) {
|
9991 |
-
var ref = getBindingAttr(el, 'ref');
|
9992 |
-
if (ref) {
|
9993 |
-
el.ref = ref;
|
9994 |
-
el.refInFor = checkInFor(el);
|
9995 |
-
}
|
9996 |
-
}
|
9997 |
-
|
9998 |
-
function processFor (el) {
|
9999 |
-
var exp;
|
10000 |
-
if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
10001 |
-
var res = parseFor(exp);
|
10002 |
-
if (res) {
|
10003 |
-
extend(el, res);
|
10004 |
-
} else {
|
10005 |
-
warn$2(
|
10006 |
-
("Invalid v-for expression: " + exp),
|
10007 |
-
el.rawAttrsMap['v-for']
|
10008 |
-
);
|
10009 |
-
}
|
10010 |
-
}
|
10011 |
-
}
|
10012 |
-
|
10013 |
-
|
10014 |
-
|
10015 |
-
function parseFor (exp) {
|
10016 |
-
var inMatch = exp.match(forAliasRE);
|
10017 |
-
if (!inMatch) { return }
|
10018 |
-
var res = {};
|
10019 |
-
res.for = inMatch[2].trim();
|
10020 |
-
var alias = inMatch[1].trim().replace(stripParensRE, '');
|
10021 |
-
var iteratorMatch = alias.match(forIteratorRE);
|
10022 |
-
if (iteratorMatch) {
|
10023 |
-
res.alias = alias.replace(forIteratorRE, '').trim();
|
10024 |
-
res.iterator1 = iteratorMatch[1].trim();
|
10025 |
-
if (iteratorMatch[2]) {
|
10026 |
-
res.iterator2 = iteratorMatch[2].trim();
|
10027 |
-
}
|
10028 |
-
} else {
|
10029 |
-
res.alias = alias;
|
10030 |
-
}
|
10031 |
-
return res
|
10032 |
-
}
|
10033 |
-
|
10034 |
-
function processIf (el) {
|
10035 |
-
var exp = getAndRemoveAttr(el, 'v-if');
|
10036 |
-
if (exp) {
|
10037 |
-
el.if = exp;
|
10038 |
-
addIfCondition(el, {
|
10039 |
-
exp: exp,
|
10040 |
-
block: el
|
10041 |
-
});
|
10042 |
-
} else {
|
10043 |
-
if (getAndRemoveAttr(el, 'v-else') != null) {
|
10044 |
-
el.else = true;
|
10045 |
-
}
|
10046 |
-
var elseif = getAndRemoveAttr(el, 'v-else-if');
|
10047 |
-
if (elseif) {
|
10048 |
-
el.elseif = elseif;
|
10049 |
-
}
|
10050 |
-
}
|
10051 |
-
}
|
10052 |
-
|
10053 |
-
function processIfConditions (el, parent) {
|
10054 |
-
var prev = findPrevElement(parent.children);
|
10055 |
-
if (prev && prev.if) {
|
10056 |
-
addIfCondition(prev, {
|
10057 |
-
exp: el.elseif,
|
10058 |
-
block: el
|
10059 |
-
});
|
10060 |
-
} else {
|
10061 |
-
warn$2(
|
10062 |
-
"v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
|
10063 |
-
"used on element <" + (el.tag) + "> without corresponding v-if.",
|
10064 |
-
el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
|
10065 |
-
);
|
10066 |
-
}
|
10067 |
-
}
|
10068 |
-
|
10069 |
-
function findPrevElement (children) {
|
10070 |
-
var i = children.length;
|
10071 |
-
while (i--) {
|
10072 |
-
if (children[i].type === 1) {
|
10073 |
-
return children[i]
|
10074 |
-
} else {
|
10075 |
-
if (children[i].text !== ' ') {
|
10076 |
-
warn$2(
|
10077 |
-
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
10078 |
-
"will be ignored.",
|
10079 |
-
children[i]
|
10080 |
-
);
|
10081 |
-
}
|
10082 |
-
children.pop();
|
10083 |
-
}
|
10084 |
-
}
|
10085 |
-
}
|
10086 |
-
|
10087 |
-
function addIfCondition (el, condition) {
|
10088 |
-
if (!el.ifConditions) {
|
10089 |
-
el.ifConditions = [];
|
10090 |
-
}
|
10091 |
-
el.ifConditions.push(condition);
|
10092 |
-
}
|
10093 |
-
|
10094 |
-
function processOnce (el) {
|
10095 |
-
var once$$1 = getAndRemoveAttr(el, 'v-once');
|
10096 |
-
if (once$$1 != null) {
|
10097 |
-
el.once = true;
|
10098 |
-
}
|
10099 |
-
}
|
10100 |
-
|
10101 |
-
// handle content being passed to a component as slot,
|
10102 |
-
// e.g. <template slot="xxx">, <div slot-scope="xxx">
|
10103 |
-
function processSlotContent (el) {
|
10104 |
-
var slotScope;
|
10105 |
-
if (el.tag === 'template') {
|
10106 |
-
slotScope = getAndRemoveAttr(el, 'scope');
|
10107 |
-
/* istanbul ignore if */
|
10108 |
-
if (slotScope) {
|
10109 |
-
warn$2(
|
10110 |
-
"the \"scope\" attribute for scoped slots have been deprecated and " +
|
10111 |
-
"replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
10112 |
-
"can also be used on plain elements in addition to <template> to " +
|
10113 |
-
"denote scoped slots.",
|
10114 |
-
el.rawAttrsMap['scope'],
|
10115 |
-
true
|
10116 |
-
);
|
10117 |
-
}
|
10118 |
-
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
10119 |
-
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
10120 |
-
/* istanbul ignore if */
|
10121 |
-
if (el.attrsMap['v-for']) {
|
10122 |
-
warn$2(
|
10123 |
-
"Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
10124 |
-
"(v-for takes higher priority). Use a wrapper <template> for the " +
|
10125 |
-
"scoped slot to make it clearer.",
|
10126 |
-
el.rawAttrsMap['slot-scope'],
|
10127 |
-
true
|
10128 |
-
);
|
10129 |
-
}
|
10130 |
-
el.slotScope = slotScope;
|
10131 |
-
}
|
10132 |
-
|
10133 |
-
// slot="xxx"
|
10134 |
-
var slotTarget = getBindingAttr(el, 'slot');
|
10135 |
-
if (slotTarget) {
|
10136 |
-
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
10137 |
-
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
10138 |
-
// preserve slot as an attribute for native shadow DOM compat
|
10139 |
-
// only for non-scoped slots.
|
10140 |
-
if (el.tag !== 'template' && !el.slotScope) {
|
10141 |
-
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
10142 |
-
}
|
10143 |
-
}
|
10144 |
-
|
10145 |
-
// 2.6 v-slot syntax
|
10146 |
-
{
|
10147 |
-
if (el.tag === 'template') {
|
10148 |
-
// v-slot on <template>
|
10149 |
-
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
10150 |
-
if (slotBinding) {
|
10151 |
-
{
|
10152 |
-
if (el.slotTarget || el.slotScope) {
|
10153 |
-
warn$2(
|
10154 |
-
"Unexpected mixed usage of different slot syntaxes.",
|
10155 |
-
el
|
10156 |
-
);
|
10157 |
-
}
|
10158 |
-
if (el.parent && !maybeComponent(el.parent)) {
|
10159 |
-
warn$2(
|
10160 |
-
"<template v-slot> can only appear at the root level inside " +
|
10161 |
-
"the receiving the component",
|
10162 |
-
el
|
10163 |
-
);
|
10164 |
-
}
|
10165 |
-
}
|
10166 |
-
var ref = getSlotName(slotBinding);
|
10167 |
-
var name = ref.name;
|
10168 |
-
var dynamic = ref.dynamic;
|
10169 |
-
el.slotTarget = name;
|
10170 |
-
el.slotTargetDynamic = dynamic;
|
10171 |
-
el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
|
10172 |
-
}
|
10173 |
-
} else {
|
10174 |
-
// v-slot on component, denotes default slot
|
10175 |
-
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
10176 |
-
if (slotBinding$1) {
|
10177 |
-
{
|
10178 |
-
if (!maybeComponent(el)) {
|
10179 |
-
warn$2(
|
10180 |
-
"v-slot can only be used on components or <template>.",
|
10181 |
-
slotBinding$1
|
10182 |
-
);
|
10183 |
-
}
|
10184 |
-
if (el.slotScope || el.slotTarget) {
|
10185 |
-
warn$2(
|
10186 |
-
"Unexpected mixed usage of different slot syntaxes.",
|
10187 |
-
el
|
10188 |
-
);
|
10189 |
-
}
|
10190 |
-
if (el.scopedSlots) {
|
10191 |
-
warn$2(
|
10192 |
-
"To avoid scope ambiguity, the default slot should also use " +
|
10193 |
-
"<template> syntax when there are other named slots.",
|
10194 |
-
slotBinding$1
|
10195 |
-
);
|
10196 |
-
}
|
10197 |
-
}
|
10198 |
-
// add the component's children to its default slot
|
10199 |
-
var slots = el.scopedSlots || (el.scopedSlots = {});
|
10200 |
-
var ref$1 = getSlotName(slotBinding$1);
|
10201 |
-
var name$1 = ref$1.name;
|
10202 |
-
var dynamic$1 = ref$1.dynamic;
|
10203 |
-
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
10204 |
-
slotContainer.slotTarget = name$1;
|
10205 |
-
slotContainer.slotTargetDynamic = dynamic$1;
|
10206 |
-
slotContainer.children = el.children.filter(function (c) {
|
10207 |
-
if (!c.slotScope) {
|
10208 |
-
c.parent = slotContainer;
|
10209 |
-
return true
|
10210 |
-
}
|
10211 |
-
});
|
10212 |
-
slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
|
10213 |
-
// remove children as they are returned from scopedSlots now
|
10214 |
-
el.children = [];
|
10215 |
-
// mark el non-plain so data gets generated
|
10216 |
-
el.plain = false;
|
10217 |
-
}
|
10218 |
-
}
|
10219 |
-
}
|
10220 |
-
}
|
10221 |
-
|
10222 |
-
function getSlotName (binding) {
|
10223 |
-
var name = binding.name.replace(slotRE, '');
|
10224 |
-
if (!name) {
|
10225 |
-
if (binding.name[0] !== '#') {
|
10226 |
-
name = 'default';
|
10227 |
-
} else {
|
10228 |
-
warn$2(
|
10229 |
-
"v-slot shorthand syntax requires a slot name.",
|
10230 |
-
binding
|
10231 |
-
);
|
10232 |
-
}
|
10233 |
-
}
|
10234 |
-
return dynamicArgRE.test(name)
|
10235 |
-
// dynamic [name]
|
10236 |
-
? { name: name.slice(1, -1), dynamic: true }
|
10237 |
-
// static name
|
10238 |
-
: { name: ("\"" + name + "\""), dynamic: false }
|
10239 |
-
}
|
10240 |
-
|
10241 |
-
// handle <slot/> outlets
|
10242 |
-
function processSlotOutlet (el) {
|
10243 |
-
if (el.tag === 'slot') {
|
10244 |
-
el.slotName = getBindingAttr(el, 'name');
|
10245 |
-
if (el.key) {
|
10246 |
-
warn$2(
|
10247 |
-
"`key` does not work on <slot> because slots are abstract outlets " +
|
10248 |
-
"and can possibly expand into multiple elements. " +
|
10249 |
-
"Use the key on a wrapping element instead.",
|
10250 |
-
getRawBindingAttr(el, 'key')
|
10251 |
-
);
|
10252 |
-
}
|
10253 |
-
}
|
10254 |
-
}
|
10255 |
-
|
10256 |
-
function processComponent (el) {
|
10257 |
-
var binding;
|
10258 |
-
if ((binding = getBindingAttr(el, 'is'))) {
|
10259 |
-
el.component = binding;
|
10260 |
-
}
|
10261 |
-
if (getAndRemoveAttr(el, 'inline-template') != null) {
|
10262 |
-
el.inlineTemplate = true;
|
10263 |
-
}
|
10264 |
-
}
|
10265 |
-
|
10266 |
-
function processAttrs (el) {
|
10267 |
-
var list = el.attrsList;
|
10268 |
-
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
10269 |
-
for (i = 0, l = list.length; i < l; i++) {
|
10270 |
-
name = rawName = list[i].name;
|
10271 |
-
value = list[i].value;
|
10272 |
-
if (dirRE.test(name)) {
|
10273 |
-
// mark element as dynamic
|
10274 |
-
el.hasBindings = true;
|
10275 |
-
// modifiers
|
10276 |
-
modifiers = parseModifiers(name.replace(dirRE, ''));
|
10277 |
-
// support .foo shorthand syntax for the .prop modifier
|
10278 |
-
if (modifiers) {
|
10279 |
-
name = name.replace(modifierRE, '');
|
10280 |
-
}
|
10281 |
-
if (bindRE.test(name)) { // v-bind
|
10282 |
-
name = name.replace(bindRE, '');
|
10283 |
-
value = parseFilters(value);
|
10284 |
-
isDynamic = dynamicArgRE.test(name);
|
10285 |
-
if (isDynamic) {
|
10286 |
-
name = name.slice(1, -1);
|
10287 |
-
}
|
10288 |
-
if (
|
10289 |
-
value.trim().length === 0
|
10290 |
-
) {
|
10291 |
-
warn$2(
|
10292 |
-
("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
|
10293 |
-
);
|
10294 |
-
}
|
10295 |
-
if (modifiers) {
|
10296 |
-
if (modifiers.prop && !isDynamic) {
|
10297 |
-
name = camelize(name);
|
10298 |
-
if (name === 'innerHtml') { name = 'innerHTML'; }
|
10299 |
-
}
|
10300 |
-
if (modifiers.camel && !isDynamic) {
|
10301 |
-
name = camelize(name);
|
10302 |
-
}
|
10303 |
-
if (modifiers.sync) {
|
10304 |
-
syncGen = genAssignmentCode(value, "$event");
|
10305 |
-
if (!isDynamic) {
|
10306 |
-
addHandler(
|
10307 |
-
el,
|
10308 |
-
("update:" + (camelize(name))),
|
10309 |
-
syncGen,
|
10310 |
-
null,
|
10311 |
-
false,
|
10312 |
-
warn$2,
|
10313 |
-
list[i]
|
10314 |
-
);
|
10315 |
-
if (hyphenate(name) !== camelize(name)) {
|
10316 |
-
addHandler(
|
10317 |
-
el,
|
10318 |
-
("update:" + (hyphenate(name))),
|
10319 |
-
syncGen,
|
10320 |
-
null,
|
10321 |
-
false,
|
10322 |
-
warn$2,
|
10323 |
-
list[i]
|
10324 |
-
);
|
10325 |
-
}
|
10326 |
-
} else {
|
10327 |
-
// handler w/ dynamic event name
|
10328 |
-
addHandler(
|
10329 |
-
el,
|
10330 |
-
("\"update:\"+(" + name + ")"),
|
10331 |
-
syncGen,
|
10332 |
-
null,
|
10333 |
-
false,
|
10334 |
-
warn$2,
|
10335 |
-
list[i],
|
10336 |
-
true // dynamic
|
10337 |
-
);
|
10338 |
-
}
|
10339 |
-
}
|
10340 |
-
}
|
10341 |
-
if ((modifiers && modifiers.prop) || (
|
10342 |
-
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
10343 |
-
)) {
|
10344 |
-
addProp(el, name, value, list[i], isDynamic);
|
10345 |
-
} else {
|
10346 |
-
addAttr(el, name, value, list[i], isDynamic);
|
10347 |
-
}
|
10348 |
-
} else if (onRE.test(name)) { // v-on
|
10349 |
-
name = name.replace(onRE, '');
|
10350 |
-
isDynamic = dynamicArgRE.test(name);
|
10351 |
-
if (isDynamic) {
|
10352 |
-
name = name.slice(1, -1);
|
10353 |
-
}
|
10354 |
-
addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
10355 |
-
} else { // normal directives
|
10356 |
-
name = name.replace(dirRE, '');
|
10357 |
-
// parse arg
|
10358 |
-
var argMatch = name.match(argRE);
|
10359 |
-
var arg = argMatch && argMatch[1];
|
10360 |
-
isDynamic = false;
|
10361 |
-
if (arg) {
|
10362 |
-
name = name.slice(0, -(arg.length + 1));
|
10363 |
-
if (dynamicArgRE.test(arg)) {
|
10364 |
-
arg = arg.slice(1, -1);
|
10365 |
-
isDynamic = true;
|
10366 |
-
}
|
10367 |
-
}
|
10368 |
-
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
10369 |
-
if (name === 'model') {
|
10370 |
-
checkForAliasModel(el, value);
|
10371 |
-
}
|
10372 |
-
}
|
10373 |
-
} else {
|
10374 |
-
// literal attribute
|
10375 |
-
{
|
10376 |
-
var res = parseText(value, delimiters);
|
10377 |
-
if (res) {
|
10378 |
-
warn$2(
|
10379 |
-
name + "=\"" + value + "\": " +
|
10380 |
-
'Interpolation inside attributes has been removed. ' +
|
10381 |
-
'Use v-bind or the colon shorthand instead. For example, ' +
|
10382 |
-
'instead of <div id="{{ val }}">, use <div :id="val">.',
|
10383 |
-
list[i]
|
10384 |
-
);
|
10385 |
-
}
|
10386 |
-
}
|
10387 |
-
addAttr(el, name, JSON.stringify(value), list[i]);
|
10388 |
-
// #6887 firefox doesn't update muted state if set via attribute
|
10389 |
-
// even immediately after element creation
|
10390 |
-
if (!el.component &&
|
10391 |
-
name === 'muted' &&
|
10392 |
-
platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
10393 |
-
addProp(el, name, 'true', list[i]);
|
10394 |
-
}
|
10395 |
-
}
|
10396 |
-
}
|
10397 |
-
}
|
10398 |
-
|
10399 |
-
function checkInFor (el) {
|
10400 |
-
var parent = el;
|
10401 |
-
while (parent) {
|
10402 |
-
if (parent.for !== undefined) {
|
10403 |
-
return true
|
10404 |
-
}
|
10405 |
-
parent = parent.parent;
|
10406 |
-
}
|
10407 |
-
return false
|
10408 |
-
}
|
10409 |
-
|
10410 |
-
function parseModifiers (name) {
|
10411 |
-
var match = name.match(modifierRE);
|
10412 |
-
if (match) {
|
10413 |
-
var ret = {};
|
10414 |
-
match.forEach(function (m) { ret[m.slice(1)] = true; });
|
10415 |
-
return ret
|
10416 |
-
}
|
10417 |
-
}
|
10418 |
-
|
10419 |
-
function makeAttrsMap (attrs) {
|
10420 |
-
var map = {};
|
10421 |
-
for (var i = 0, l = attrs.length; i < l; i++) {
|
10422 |
-
if (
|
10423 |
-
map[attrs[i].name] && !isIE && !isEdge
|
10424 |
-
) {
|
10425 |
-
warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
10426 |
-
}
|
10427 |
-
map[attrs[i].name] = attrs[i].value;
|
10428 |
-
}
|
10429 |
-
return map
|
10430 |
-
}
|
10431 |
-
|
10432 |
-
// for script (e.g. type="x/template") or style, do not decode content
|
10433 |
-
function isTextTag (el) {
|
10434 |
-
return el.tag === 'script' || el.tag === 'style'
|
10435 |
-
}
|
10436 |
-
|
10437 |
-
function isForbiddenTag (el) {
|
10438 |
-
return (
|
10439 |
-
el.tag === 'style' ||
|
10440 |
-
(el.tag === 'script' && (
|
10441 |
-
!el.attrsMap.type ||
|
10442 |
-
el.attrsMap.type === 'text/javascript'
|
10443 |
-
))
|
10444 |
-
)
|
10445 |
-
}
|
10446 |
-
|
10447 |
-
var ieNSBug = /^xmlns:NS\d+/;
|
10448 |
-
var ieNSPrefix = /^NS\d+:/;
|
10449 |
-
|
10450 |
-
/* istanbul ignore next */
|
10451 |
-
function guardIESVGBug (attrs) {
|
10452 |
-
var res = [];
|
10453 |
-
for (var i = 0; i < attrs.length; i++) {
|
10454 |
-
var attr = attrs[i];
|
10455 |
-
if (!ieNSBug.test(attr.name)) {
|
10456 |
-
attr.name = attr.name.replace(ieNSPrefix, '');
|
10457 |
-
res.push(attr);
|
10458 |
-
}
|
10459 |
-
}
|
10460 |
-
return res
|
10461 |
-
}
|
10462 |
-
|
10463 |
-
function checkForAliasModel (el, value) {
|
10464 |
-
var _el = el;
|
10465 |
-
while (_el) {
|
10466 |
-
if (_el.for && _el.alias === value) {
|
10467 |
-
warn$2(
|
10468 |
-
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
10469 |
-
"You are binding v-model directly to a v-for iteration alias. " +
|
10470 |
-
"This will not be able to modify the v-for source array because " +
|
10471 |
-
"writing to the alias is like modifying a function local variable. " +
|
10472 |
-
"Consider using an array of objects and use v-model on an object property instead.",
|
10473 |
-
el.rawAttrsMap['v-model']
|
10474 |
-
);
|
10475 |
-
}
|
10476 |
-
_el = _el.parent;
|
10477 |
-
}
|
10478 |
-
}
|
10479 |
-
|
10480 |
-
/* */
|
10481 |
-
|
10482 |
-
function preTransformNode (el, options) {
|
10483 |
-
if (el.tag === 'input') {
|
10484 |
-
var map = el.attrsMap;
|
10485 |
-
if (!map['v-model']) {
|
10486 |
-
return
|
10487 |
-
}
|
10488 |
-
|
10489 |
-
var typeBinding;
|
10490 |
-
if (map[':type'] || map['v-bind:type']) {
|
10491 |
-
typeBinding = getBindingAttr(el, 'type');
|
10492 |
-
}
|
10493 |
-
if (!map.type && !typeBinding && map['v-bind']) {
|
10494 |
-
typeBinding = "(" + (map['v-bind']) + ").type";
|
10495 |
-
}
|
10496 |
-
|
10497 |
-
if (typeBinding) {
|
10498 |
-
var ifCondition = getAndRemoveAttr(el, 'v-if', true);
|
10499 |
-
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
|
10500 |
-
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
|
10501 |
-
var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
|
10502 |
-
// 1. checkbox
|
10503 |
-
var branch0 = cloneASTElement(el);
|
10504 |
-
// process for on the main node
|
10505 |
-
processFor(branch0);
|
10506 |
-
addRawAttr(branch0, 'type', 'checkbox');
|
10507 |
-
processElement(branch0, options);
|
10508 |
-
branch0.processed = true; // prevent it from double-processed
|
10509 |
-
branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
|
10510 |
-
addIfCondition(branch0, {
|
10511 |
-
exp: branch0.if,
|
10512 |
-
block: branch0
|
10513 |
-
});
|
10514 |
-
// 2. add radio else-if condition
|
10515 |
-
var branch1 = cloneASTElement(el);
|
10516 |
-
getAndRemoveAttr(branch1, 'v-for', true);
|
10517 |
-
addRawAttr(branch1, 'type', 'radio');
|
10518 |
-
processElement(branch1, options);
|
10519 |
-
addIfCondition(branch0, {
|
10520 |
-
exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
|
10521 |
-
block: branch1
|
10522 |
-
});
|
10523 |
-
// 3. other
|
10524 |
-
var branch2 = cloneASTElement(el);
|
10525 |
-
getAndRemoveAttr(branch2, 'v-for', true);
|
10526 |
-
addRawAttr(branch2, ':type', typeBinding);
|
10527 |
-
processElement(branch2, options);
|
10528 |
-
addIfCondition(branch0, {
|
10529 |
-
exp: ifCondition,
|
10530 |
-
block: branch2
|
10531 |
-
});
|
10532 |
-
|
10533 |
-
if (hasElse) {
|
10534 |
-
branch0.else = true;
|
10535 |
-
} else if (elseIfCondition) {
|
10536 |
-
branch0.elseif = elseIfCondition;
|
10537 |
-
}
|
10538 |
-
|
10539 |
-
return branch0
|
10540 |
-
}
|
10541 |
-
}
|
10542 |
-
}
|
10543 |
-
|
10544 |
-
function cloneASTElement (el) {
|
10545 |
-
return createASTElement(el.tag, el.attrsList.slice(), el.parent)
|
10546 |
-
}
|
10547 |
-
|
10548 |
-
var model$1 = {
|
10549 |
-
preTransformNode: preTransformNode
|
10550 |
-
};
|
10551 |
-
|
10552 |
-
var modules$1 = [
|
10553 |
-
klass$1,
|
10554 |
-
style$1,
|
10555 |
-
model$1
|
10556 |
-
];
|
10557 |
-
|
10558 |
-
/* */
|
10559 |
-
|
10560 |
-
function text (el, dir) {
|
10561 |
-
if (dir.value) {
|
10562 |
-
addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
|
10563 |
-
}
|
10564 |
-
}
|
10565 |
-
|
10566 |
-
/* */
|
10567 |
-
|
10568 |
-
function html (el, dir) {
|
10569 |
-
if (dir.value) {
|
10570 |
-
addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
|
10571 |
-
}
|
10572 |
-
}
|
10573 |
-
|
10574 |
-
var directives$1 = {
|
10575 |
-
model: model,
|
10576 |
-
text: text,
|
10577 |
-
html: html
|
10578 |
-
};
|
10579 |
-
|
10580 |
-
/* */
|
10581 |
-
|
10582 |
-
var baseOptions = {
|
10583 |
-
expectHTML: true,
|
10584 |
-
modules: modules$1,
|
10585 |
-
directives: directives$1,
|
10586 |
-
isPreTag: isPreTag,
|
10587 |
-
isUnaryTag: isUnaryTag,
|
10588 |
-
mustUseProp: mustUseProp,
|
10589 |
-
canBeLeftOpenTag: canBeLeftOpenTag,
|
10590 |
-
isReservedTag: isReservedTag,
|
10591 |
-
getTagNamespace: getTagNamespace,
|
10592 |
-
staticKeys: genStaticKeys(modules$1)
|
10593 |
-
};
|
10594 |
-
|
10595 |
-
/* */
|
10596 |
-
|
10597 |
-
var isStaticKey;
|
10598 |
-
var isPlatformReservedTag;
|
10599 |
-
|
10600 |
-
var genStaticKeysCached = cached(genStaticKeys$1);
|
10601 |
-
|
10602 |
-
/**
|
10603 |
-
* Goal of the optimizer: walk the generated template AST tree
|
10604 |
-
* and detect sub-trees that are purely static, i.e. parts of
|
10605 |
-
* the DOM that never needs to change.
|
10606 |
-
*
|
10607 |
-
* Once we detect these sub-trees, we can:
|
10608 |
-
*
|
10609 |
-
* 1. Hoist them into constants, so that we no longer need to
|
10610 |
-
* create fresh nodes for them on each re-render;
|
10611 |
-
* 2. Completely skip them in the patching process.
|
10612 |
-
*/
|
10613 |
-
function optimize (root, options) {
|
10614 |
-
if (!root) { return }
|
10615 |
-
isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
10616 |
-
isPlatformReservedTag = options.isReservedTag || no;
|
10617 |
-
// first pass: mark all non-static nodes.
|
10618 |
-
markStatic$1(root);
|
10619 |
-
// second pass: mark static roots.
|
10620 |
-
markStaticRoots(root, false);
|
10621 |
-
}
|
10622 |
-
|
10623 |
-
function genStaticKeys$1 (keys) {
|
10624 |
-
return makeMap(
|
10625 |
-
'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
10626 |
-
(keys ? ',' + keys : '')
|
10627 |
-
)
|
10628 |
-
}
|
10629 |
-
|
10630 |
-
function markStatic$1 (node) {
|
10631 |
-
node.static = isStatic(node);
|
10632 |
-
if (node.type === 1) {
|
10633 |
-
// do not make component slot content static. this avoids
|
10634 |
-
// 1. components not able to mutate slot nodes
|
10635 |
-
// 2. static slot content fails for hot-reloading
|
10636 |
-
if (
|
10637 |
-
!isPlatformReservedTag(node.tag) &&
|
10638 |
-
node.tag !== 'slot' &&
|
10639 |
-
node.attrsMap['inline-template'] == null
|
10640 |
-
) {
|
10641 |
-
return
|
10642 |
-
}
|
10643 |
-
for (var i = 0, l = node.children.length; i < l; i++) {
|
10644 |
-
var child = node.children[i];
|
10645 |
-
markStatic$1(child);
|
10646 |
-
if (!child.static) {
|
10647 |
-
node.static = false;
|
10648 |
-
}
|
10649 |
-
}
|
10650 |
-
if (node.ifConditions) {
|
10651 |
-
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10652 |
-
var block = node.ifConditions[i$1].block;
|
10653 |
-
markStatic$1(block);
|
10654 |
-
if (!block.static) {
|
10655 |
-
node.static = false;
|
10656 |
-
}
|
10657 |
-
}
|
10658 |
-
}
|
10659 |
-
}
|
10660 |
-
}
|
10661 |
-
|
10662 |
-
function markStaticRoots (node, isInFor) {
|
10663 |
-
if (node.type === 1) {
|
10664 |
-
if (node.static || node.once) {
|
10665 |
-
node.staticInFor = isInFor;
|
10666 |
-
}
|
10667 |
-
// For a node to qualify as a static root, it should have children that
|
10668 |
-
// are not just static text. Otherwise the cost of hoisting out will
|
10669 |
-
// outweigh the benefits and it's better off to just always render it fresh.
|
10670 |
-
if (node.static && node.children.length && !(
|
10671 |
-
node.children.length === 1 &&
|
10672 |
-
node.children[0].type === 3
|
10673 |
-
)) {
|
10674 |
-
node.staticRoot = true;
|
10675 |
-
return
|
10676 |
-
} else {
|
10677 |
-
node.staticRoot = false;
|
10678 |
-
}
|
10679 |
-
if (node.children) {
|
10680 |
-
for (var i = 0, l = node.children.length; i < l; i++) {
|
10681 |
-
markStaticRoots(node.children[i], isInFor || !!node.for);
|
10682 |
-
}
|
10683 |
-
}
|
10684 |
-
if (node.ifConditions) {
|
10685 |
-
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10686 |
-
markStaticRoots(node.ifConditions[i$1].block, isInFor);
|
10687 |
-
}
|
10688 |
-
}
|
10689 |
-
}
|
10690 |
-
}
|
10691 |
-
|
10692 |
-
function isStatic (node) {
|
10693 |
-
if (node.type === 2) { // expression
|
10694 |
-
return false
|
10695 |
-
}
|
10696 |
-
if (node.type === 3) { // text
|
10697 |
-
return true
|
10698 |
-
}
|
10699 |
-
return !!(node.pre || (
|
10700 |
-
!node.hasBindings && // no dynamic bindings
|
10701 |
-
!node.if && !node.for && // not v-if or v-for or v-else
|
10702 |
-
!isBuiltInTag(node.tag) && // not a built-in
|
10703 |
-
isPlatformReservedTag(node.tag) && // not a component
|
10704 |
-
!isDirectChildOfTemplateFor(node) &&
|
10705 |
-
Object.keys(node).every(isStaticKey)
|
10706 |
-
))
|
10707 |
-
}
|
10708 |
-
|
10709 |
-
function isDirectChildOfTemplateFor (node) {
|
10710 |
-
while (node.parent) {
|
10711 |
-
node = node.parent;
|
10712 |
-
if (node.tag !== 'template') {
|
10713 |
-
return false
|
10714 |
-
}
|
10715 |
-
if (node.for) {
|
10716 |
-
return true
|
10717 |
-
}
|
10718 |
-
}
|
10719 |
-
return false
|
10720 |
-
}
|
10721 |
-
|
10722 |
-
/* */
|
10723 |
-
|
10724 |
-
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
|
10725 |
-
var fnInvokeRE = /\([^)]*?\);*$/;
|
10726 |
-
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
10727 |
-
|
10728 |
-
// KeyboardEvent.keyCode aliases
|
10729 |
-
var keyCodes = {
|
10730 |
-
esc: 27,
|
10731 |
-
tab: 9,
|
10732 |
-
enter: 13,
|
10733 |
-
space: 32,
|
10734 |
-
up: 38,
|
10735 |
-
left: 37,
|
10736 |
-
right: 39,
|
10737 |
-
down: 40,
|
10738 |
-
'delete': [8, 46]
|
10739 |
-
};
|
10740 |
-
|
10741 |
-
// KeyboardEvent.key aliases
|
10742 |
-
var keyNames = {
|
10743 |
-
// #7880: IE11 and Edge use `Esc` for Escape key name.
|
10744 |
-
esc: ['Esc', 'Escape'],
|
10745 |
-
tab: 'Tab',
|
10746 |
-
enter: 'Enter',
|
10747 |
-
// #9112: IE11 uses `Spacebar` for Space key name.
|
10748 |
-
space: [' ', 'Spacebar'],
|
10749 |
-
// #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
|
10750 |
-
up: ['Up', 'ArrowUp'],
|
10751 |
-
left: ['Left', 'ArrowLeft'],
|
10752 |
-
right: ['Right', 'ArrowRight'],
|
10753 |
-
down: ['Down', 'ArrowDown'],
|
10754 |
-
// #9112: IE11 uses `Del` for Delete key name.
|
10755 |
-
'delete': ['Backspace', 'Delete', 'Del']
|
10756 |
-
};
|
10757 |
-
|
10758 |
-
// #4868: modifiers that prevent the execution of the listener
|
10759 |
-
// need to explicitly return null so that we can determine whether to remove
|
10760 |
-
// the listener for .once
|
10761 |
-
var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
|
10762 |
-
|
10763 |
-
var modifierCode = {
|
10764 |
-
stop: '$event.stopPropagation();',
|
10765 |
-
prevent: '$event.preventDefault();',
|
10766 |
-
self: genGuard("$event.target !== $event.currentTarget"),
|
10767 |
-
ctrl: genGuard("!$event.ctrlKey"),
|
10768 |
-
shift: genGuard("!$event.shiftKey"),
|
10769 |
-
alt: genGuard("!$event.altKey"),
|
10770 |
-
meta: genGuard("!$event.metaKey"),
|
10771 |
-
left: genGuard("'button' in $event && $event.button !== 0"),
|
10772 |
-
middle: genGuard("'button' in $event && $event.button !== 1"),
|
10773 |
-
right: genGuard("'button' in $event && $event.button !== 2")
|
10774 |
-
};
|
10775 |
-
|
10776 |
-
function genHandlers (
|
10777 |
-
events,
|
10778 |
-
isNative
|
10779 |
-
) {
|
10780 |
-
var prefix = isNative ? 'nativeOn:' : 'on:';
|
10781 |
-
var staticHandlers = "";
|
10782 |
-
var dynamicHandlers = "";
|
10783 |
-
for (var name in events) {
|
10784 |
-
var handlerCode = genHandler(events[name]);
|
10785 |
-
if (events[name] && events[name].dynamic) {
|
10786 |
-
dynamicHandlers += name + "," + handlerCode + ",";
|
10787 |
-
} else {
|
10788 |
-
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
10789 |
-
}
|
10790 |
-
}
|
10791 |
-
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
10792 |
-
if (dynamicHandlers) {
|
10793 |
-
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
10794 |
-
} else {
|
10795 |
-
return prefix + staticHandlers
|
10796 |
-
}
|
10797 |
-
}
|
10798 |
-
|
10799 |
-
function genHandler (handler) {
|
10800 |
-
if (!handler) {
|
10801 |
-
return 'function(){}'
|
10802 |
-
}
|
10803 |
-
|
10804 |
-
if (Array.isArray(handler)) {
|
10805 |
-
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
10806 |
-
}
|
10807 |
-
|
10808 |
-
var isMethodPath = simplePathRE.test(handler.value);
|
10809 |
-
var isFunctionExpression = fnExpRE.test(handler.value);
|
10810 |
-
var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
|
10811 |
-
|
10812 |
-
if (!handler.modifiers) {
|
10813 |
-
if (isMethodPath || isFunctionExpression) {
|
10814 |
-
return handler.value
|
10815 |
-
}
|
10816 |
-
return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
|
10817 |
-
} else {
|
10818 |
-
var code = '';
|
10819 |
-
var genModifierCode = '';
|
10820 |
-
var keys = [];
|
10821 |
-
for (var key in handler.modifiers) {
|
10822 |
-
if (modifierCode[key]) {
|
10823 |
-
genModifierCode += modifierCode[key];
|
10824 |
-
// left/right
|
10825 |
-
if (keyCodes[key]) {
|
10826 |
-
keys.push(key);
|
10827 |
-
}
|
10828 |
-
} else if (key === 'exact') {
|
10829 |
-
var modifiers = (handler.modifiers);
|
10830 |
-
genModifierCode += genGuard(
|
10831 |
-
['ctrl', 'shift', 'alt', 'meta']
|
10832 |
-
.filter(function (keyModifier) { return !modifiers[keyModifier]; })
|
10833 |
-
.map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
|
10834 |
-
.join('||')
|
10835 |
-
);
|
10836 |
-
} else {
|
10837 |
-
keys.push(key);
|
10838 |
-
}
|
10839 |
-
}
|
10840 |
-
if (keys.length) {
|
10841 |
-
code += genKeyFilter(keys);
|
10842 |
-
}
|
10843 |
-
// Make sure modifiers like prevent and stop get executed after key filtering
|
10844 |
-
if (genModifierCode) {
|
10845 |
-
code += genModifierCode;
|
10846 |
-
}
|
10847 |
-
var handlerCode = isMethodPath
|
10848 |
-
? ("return " + (handler.value) + "($event)")
|
10849 |
-
: isFunctionExpression
|
10850 |
-
? ("return (" + (handler.value) + ")($event)")
|
10851 |
-
: isFunctionInvocation
|
10852 |
-
? ("return " + (handler.value))
|
10853 |
-
: handler.value;
|
10854 |
-
return ("function($event){" + code + handlerCode + "}")
|
10855 |
-
}
|
10856 |
-
}
|
10857 |
-
|
10858 |
-
function genKeyFilter (keys) {
|
10859 |
-
return (
|
10860 |
-
// make sure the key filters only apply to KeyboardEvents
|
10861 |
-
// #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
|
10862 |
-
// key events that do not have keyCode property...
|
10863 |
-
"if(!$event.type.indexOf('key')&&" +
|
10864 |
-
(keys.map(genFilterCode).join('&&')) + ")return null;"
|
10865 |
-
)
|
10866 |
-
}
|
10867 |
-
|
10868 |
-
function genFilterCode (key) {
|
10869 |
-
var keyVal = parseInt(key, 10);
|
10870 |
-
if (keyVal) {
|
10871 |
-
return ("$event.keyCode!==" + keyVal)
|
10872 |
-
}
|
10873 |
-
var keyCode = keyCodes[key];
|
10874 |
-
var keyName = keyNames[key];
|
10875 |
-
return (
|
10876 |
-
"_k($event.keyCode," +
|
10877 |
-
(JSON.stringify(key)) + "," +
|
10878 |
-
(JSON.stringify(keyCode)) + "," +
|
10879 |
-
"$event.key," +
|
10880 |
-
"" + (JSON.stringify(keyName)) +
|
10881 |
-
")"
|
10882 |
-
)
|
10883 |
-
}
|
10884 |
-
|
10885 |
-
/* */
|
10886 |
-
|
10887 |
-
function on (el, dir) {
|
10888 |
-
if (dir.modifiers) {
|
10889 |
-
warn("v-on without argument does not support modifiers.");
|
10890 |
-
}
|
10891 |
-
el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
|
10892 |
-
}
|
10893 |
-
|
10894 |
-
/* */
|
10895 |
-
|
10896 |
-
function bind$1 (el, dir) {
|
10897 |
-
el.wrapData = function (code) {
|
10898 |
-
return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
|
10899 |
-
};
|
10900 |
-
}
|
10901 |
-
|
10902 |
-
/* */
|
10903 |
-
|
10904 |
-
var baseDirectives = {
|
10905 |
-
on: on,
|
10906 |
-
bind: bind$1,
|
10907 |
-
cloak: noop
|
10908 |
-
};
|
10909 |
-
|
10910 |
-
/* */
|
10911 |
-
|
10912 |
-
|
10913 |
-
|
10914 |
-
|
10915 |
-
|
10916 |
-
var CodegenState = function CodegenState (options) {
|
10917 |
-
this.options = options;
|
10918 |
-
this.warn = options.warn || baseWarn;
|
10919 |
-
this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
10920 |
-
this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
10921 |
-
this.directives = extend(extend({}, baseDirectives), options.directives);
|
10922 |
-
var isReservedTag = options.isReservedTag || no;
|
10923 |
-
this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
10924 |
-
this.onceId = 0;
|
10925 |
-
this.staticRenderFns = [];
|
10926 |
-
this.pre = false;
|
10927 |
-
};
|
10928 |
-
|
10929 |
-
|
10930 |
-
|
10931 |
-
function generate (
|
10932 |
-
ast,
|
10933 |
-
options
|
10934 |
-
) {
|
10935 |
-
var state = new CodegenState(options);
|
10936 |
-
var code = ast ? genElement(ast, state) : '_c("div")';
|
10937 |
-
return {
|
10938 |
-
render: ("with(this){return " + code + "}"),
|
10939 |
-
staticRenderFns: state.staticRenderFns
|
10940 |
-
}
|
10941 |
-
}
|
10942 |
-
|
10943 |
-
function genElement (el, state) {
|
10944 |
-
if (el.parent) {
|
10945 |
-
el.pre = el.pre || el.parent.pre;
|
10946 |
-
}
|
10947 |
-
|
10948 |
-
if (el.staticRoot && !el.staticProcessed) {
|
10949 |
-
return genStatic(el, state)
|
10950 |
-
} else if (el.once && !el.onceProcessed) {
|
10951 |
-
return genOnce(el, state)
|
10952 |
-
} else if (el.for && !el.forProcessed) {
|
10953 |
-
return genFor(el, state)
|
10954 |
-
} else if (el.if && !el.ifProcessed) {
|
10955 |
-
return genIf(el, state)
|
10956 |
-
} else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
10957 |
-
return genChildren(el, state) || 'void 0'
|
10958 |
-
} else if (el.tag === 'slot') {
|
10959 |
-
return genSlot(el, state)
|
10960 |
-
} else {
|
10961 |
-
// component or element
|
10962 |
-
var code;
|
10963 |
-
if (el.component) {
|
10964 |
-
code = genComponent(el.component, el, state);
|
10965 |
-
} else {
|
10966 |
-
var data;
|
10967 |
-
if (!el.plain || (el.pre && state.maybeComponent(el))) {
|
10968 |
-
data = genData$2(el, state);
|
10969 |
-
}
|
10970 |
-
|
10971 |
-
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
10972 |
-
code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
10973 |
-
}
|
10974 |
-
// module transforms
|
10975 |
-
for (var i = 0; i < state.transforms.length; i++) {
|
10976 |
-
code = state.transforms[i](el, code);
|
10977 |
-
}
|
10978 |
-
return code
|
10979 |
-
}
|
10980 |
-
}
|
10981 |
-
|
10982 |
-
// hoist static sub-trees out
|
10983 |
-
function genStatic (el, state) {
|
10984 |
-
el.staticProcessed = true;
|
10985 |
-
// Some elements (templates) need to behave differently inside of a v-pre
|
10986 |
-
// node. All pre nodes are static roots, so we can use this as a location to
|
10987 |
-
// wrap a state change and reset it upon exiting the pre node.
|
10988 |
-
var originalPreState = state.pre;
|
10989 |
-
if (el.pre) {
|
10990 |
-
state.pre = el.pre;
|
10991 |
-
}
|
10992 |
-
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
10993 |
-
state.pre = originalPreState;
|
10994 |
-
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
10995 |
-
}
|
10996 |
-
|
10997 |
-
// v-once
|
10998 |
-
function genOnce (el, state) {
|
10999 |
-
el.onceProcessed = true;
|
11000 |
-
if (el.if && !el.ifProcessed) {
|
11001 |
-
return genIf(el, state)
|
11002 |
-
} else if (el.staticInFor) {
|
11003 |
-
var key = '';
|
11004 |
-
var parent = el.parent;
|
11005 |
-
while (parent) {
|
11006 |
-
if (parent.for) {
|
11007 |
-
key = parent.key;
|
11008 |
-
break
|
11009 |
-
}
|
11010 |
-
parent = parent.parent;
|
11011 |
-
}
|
11012 |
-
if (!key) {
|
11013 |
-
state.warn(
|
11014 |
-
"v-once can only be used inside v-for that is keyed. ",
|
11015 |
-
el.rawAttrsMap['v-once']
|
11016 |
-
);
|
11017 |
-
return genElement(el, state)
|
11018 |
-
}
|
11019 |
-
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
11020 |
-
} else {
|
11021 |
-
return genStatic(el, state)
|
11022 |
-
}
|
11023 |
-
}
|
11024 |
-
|
11025 |
-
function genIf (
|
11026 |
-
el,
|
11027 |
-
state,
|
11028 |
-
altGen,
|
11029 |
-
altEmpty
|
11030 |
-
) {
|
11031 |
-
el.ifProcessed = true; // avoid recursion
|
11032 |
-
return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
|
11033 |
-
}
|
11034 |
-
|
11035 |
-
function genIfConditions (
|
11036 |
-
conditions,
|
11037 |
-
state,
|
11038 |
-
altGen,
|
11039 |
-
altEmpty
|
11040 |
-
) {
|
11041 |
-
if (!conditions.length) {
|
11042 |
-
return altEmpty || '_e()'
|
11043 |
-
}
|
11044 |
-
|
11045 |
-
var condition = conditions.shift();
|
11046 |
-
if (condition.exp) {
|
11047 |
-
return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
|
11048 |
-
} else {
|
11049 |
-
return ("" + (genTernaryExp(condition.block)))
|
11050 |
-
}
|
11051 |
-
|
11052 |
-
// v-if with v-once should generate code like (a)?_m(0):_m(1)
|
11053 |
-
function genTernaryExp (el) {
|
11054 |
-
return altGen
|
11055 |
-
? altGen(el, state)
|
11056 |
-
: el.once
|
11057 |
-
? genOnce(el, state)
|
11058 |
-
: genElement(el, state)
|
11059 |
-
}
|
11060 |
-
}
|
11061 |
-
|
11062 |
-
function genFor (
|
11063 |
-
el,
|
11064 |
-
state,
|
11065 |
-
altGen,
|
11066 |
-
altHelper
|
11067 |
-
) {
|
11068 |
-
var exp = el.for;
|
11069 |
-
var alias = el.alias;
|
11070 |
-
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
|
11071 |
-
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
|
11072 |
-
|
11073 |
-
if (state.maybeComponent(el) &&
|
11074 |
-
el.tag !== 'slot' &&
|
11075 |
-
el.tag !== 'template' &&
|
11076 |
-
!el.key
|
11077 |
-
) {
|
11078 |
-
state.warn(
|
11079 |
-
"<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
|
11080 |
-
"v-for should have explicit keys. " +
|
11081 |
-
"See https://vuejs.org/guide/list.html#key for more info.",
|
11082 |
-
el.rawAttrsMap['v-for'],
|
11083 |
-
true /* tip */
|
11084 |
-
);
|
11085 |
-
}
|
11086 |
-
|
11087 |
-
el.forProcessed = true; // avoid recursion
|
11088 |
-
return (altHelper || '_l') + "((" + exp + ")," +
|
11089 |
-
"function(" + alias + iterator1 + iterator2 + "){" +
|
11090 |
-
"return " + ((altGen || genElement)(el, state)) +
|
11091 |
-
'})'
|
11092 |
-
}
|
11093 |
-
|
11094 |
-
function genData$2 (el, state) {
|
11095 |
-
var data = '{';
|
11096 |
-
|
11097 |
-
// directives first.
|
11098 |
-
// directives may mutate the el's other properties before they are generated.
|
11099 |
-
var dirs = genDirectives(el, state);
|
11100 |
-
if (dirs) { data += dirs + ','; }
|
11101 |
-
|
11102 |
-
// key
|
11103 |
-
if (el.key) {
|
11104 |
-
data += "key:" + (el.key) + ",";
|
11105 |
-
}
|
11106 |
-
// ref
|
11107 |
-
if (el.ref) {
|
11108 |
-
data += "ref:" + (el.ref) + ",";
|
11109 |
-
}
|
11110 |
-
if (el.refInFor) {
|
11111 |
-
data += "refInFor:true,";
|
11112 |
-
}
|
11113 |
-
// pre
|
11114 |
-
if (el.pre) {
|
11115 |
-
data += "pre:true,";
|
11116 |
-
}
|
11117 |
-
// record original tag name for components using "is" attribute
|
11118 |
-
if (el.component) {
|
11119 |
-
data += "tag:\"" + (el.tag) + "\",";
|
11120 |
-
}
|
11121 |
-
// module data generation functions
|
11122 |
-
for (var i = 0; i < state.dataGenFns.length; i++) {
|
11123 |
-
data += state.dataGenFns[i](el);
|
11124 |
-
}
|
11125 |
-
// attributes
|
11126 |
-
if (el.attrs) {
|
11127 |
-
data += "attrs:" + (genProps(el.attrs)) + ",";
|
11128 |
-
}
|
11129 |
-
// DOM props
|
11130 |
-
if (el.props) {
|
11131 |
-
data += "domProps:" + (genProps(el.props)) + ",";
|
11132 |
-
}
|
11133 |
-
// event handlers
|
11134 |
-
if (el.events) {
|
11135 |
-
data += (genHandlers(el.events, false)) + ",";
|
11136 |
-
}
|
11137 |
-
if (el.nativeEvents) {
|
11138 |
-
data += (genHandlers(el.nativeEvents, true)) + ",";
|
11139 |
-
}
|
11140 |
-
// slot target
|
11141 |
-
// only for non-scoped slots
|
11142 |
-
if (el.slotTarget && !el.slotScope) {
|
11143 |
-
data += "slot:" + (el.slotTarget) + ",";
|
11144 |
-
}
|
11145 |
-
// scoped slots
|
11146 |
-
if (el.scopedSlots) {
|
11147 |
-
data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
|
11148 |
-
}
|
11149 |
-
// component v-model
|
11150 |
-
if (el.model) {
|
11151 |
-
data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
11152 |
-
}
|
11153 |
-
// inline-template
|
11154 |
-
if (el.inlineTemplate) {
|
11155 |
-
var inlineTemplate = genInlineTemplate(el, state);
|
11156 |
-
if (inlineTemplate) {
|
11157 |
-
data += inlineTemplate + ",";
|
11158 |
-
}
|
11159 |
-
}
|
11160 |
-
data = data.replace(/,$/, '') + '}';
|
11161 |
-
// v-bind dynamic argument wrap
|
11162 |
-
// v-bind with dynamic arguments must be applied using the same v-bind object
|
11163 |
-
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
11164 |
-
if (el.dynamicAttrs) {
|
11165 |
-
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
11166 |
-
}
|
11167 |
-
// v-bind data wrap
|
11168 |
-
if (el.wrapData) {
|
11169 |
-
data = el.wrapData(data);
|
11170 |
-
}
|
11171 |
-
// v-on data wrap
|
11172 |
-
if (el.wrapListeners) {
|
11173 |
-
data = el.wrapListeners(data);
|
11174 |
-
}
|
11175 |
-
return data
|
11176 |
-
}
|
11177 |
-
|
11178 |
-
function genDirectives (el, state) {
|
11179 |
-
var dirs = el.directives;
|
11180 |
-
if (!dirs) { return }
|
11181 |
-
var res = 'directives:[';
|
11182 |
-
var hasRuntime = false;
|
11183 |
-
var i, l, dir, needRuntime;
|
11184 |
-
for (i = 0, l = dirs.length; i < l; i++) {
|
11185 |
-
dir = dirs[i];
|
11186 |
-
needRuntime = true;
|
11187 |
-
var gen = state.directives[dir.name];
|
11188 |
-
if (gen) {
|
11189 |
-
// compile-time directive that manipulates AST.
|
11190 |
-
// returns true if it also needs a runtime counterpart.
|
11191 |
-
needRuntime = !!gen(el, dir, state.warn);
|
11192 |
-
}
|
11193 |
-
if (needRuntime) {
|
11194 |
-
hasRuntime = true;
|
11195 |
-
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
11196 |
-
}
|
11197 |
-
}
|
11198 |
-
if (hasRuntime) {
|
11199 |
-
return res.slice(0, -1) + ']'
|
11200 |
-
}
|
11201 |
-
}
|
11202 |
-
|
11203 |
-
function genInlineTemplate (el, state) {
|
11204 |
-
var ast = el.children[0];
|
11205 |
-
if (el.children.length !== 1 || ast.type !== 1) {
|
11206 |
-
state.warn(
|
11207 |
-
'Inline-template components must have exactly one child element.',
|
11208 |
-
{ start: el.start }
|
11209 |
-
);
|
11210 |
-
}
|
11211 |
-
if (ast && ast.type === 1) {
|
11212 |
-
var inlineRenderFns = generate(ast, state.options);
|
11213 |
-
return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
|
11214 |
-
}
|
11215 |
-
}
|
11216 |
-
|
11217 |
-
function genScopedSlots (
|
11218 |
-
el,
|
11219 |
-
slots,
|
11220 |
-
state
|
11221 |
-
) {
|
11222 |
-
// by default scoped slots are considered "stable", this allows child
|
11223 |
-
// components with only scoped slots to skip forced updates from parent.
|
11224 |
-
// but in some cases we have to bail-out of this optimization
|
11225 |
-
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
11226 |
-
var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
|
11227 |
-
var slot = slots[key];
|
11228 |
-
return (
|
11229 |
-
slot.slotTargetDynamic ||
|
11230 |
-
slot.if ||
|
11231 |
-
slot.for ||
|
11232 |
-
containsSlotChild(slot) // is passing down slot from parent which may be dynamic
|
11233 |
-
)
|
11234 |
-
});
|
11235 |
-
|
11236 |
-
// #9534: if a component with scoped slots is inside a conditional branch,
|
11237 |
-
// it's possible for the same component to be reused but with different
|
11238 |
-
// compiled slot content. To avoid that, we generate a unique key based on
|
11239 |
-
// the generated code of all the slot contents.
|
11240 |
-
var needsKey = !!el.if;
|
11241 |
-
|
11242 |
-
// OR when it is inside another scoped slot or v-for (the reactivity may be
|
11243 |
-
// disconnected due to the intermediate scope variable)
|
11244 |
-
// #9438, #9506
|
11245 |
-
// TODO: this can be further optimized by properly analyzing in-scope bindings
|
11246 |
-
// and skip force updating ones that do not actually use scope variables.
|
11247 |
-
if (!needsForceUpdate) {
|
11248 |
-
var parent = el.parent;
|
11249 |
-
while (parent) {
|
11250 |
-
if (
|
11251 |
-
(parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
|
11252 |
-
parent.for
|
11253 |
-
) {
|
11254 |
-
needsForceUpdate = true;
|
11255 |
-
break
|
11256 |
-
}
|
11257 |
-
if (parent.if) {
|
11258 |
-
needsKey = true;
|
11259 |
-
}
|
11260 |
-
parent = parent.parent;
|
11261 |
-
}
|
11262 |
-
}
|
11263 |
-
|
11264 |
-
var generatedSlots = Object.keys(slots)
|
11265 |
-
.map(function (key) { return genScopedSlot(slots[key], state); })
|
11266 |
-
.join(',');
|
11267 |
-
|
11268 |
-
return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
|
11269 |
-
}
|
11270 |
-
|
11271 |
-
function hash(str) {
|
11272 |
-
var hash = 5381;
|
11273 |
-
var i = str.length;
|
11274 |
-
while(i) {
|
11275 |
-
hash = (hash * 33) ^ str.charCodeAt(--i);
|
11276 |
-
}
|
11277 |
-
return hash >>> 0
|
11278 |
-
}
|
11279 |
-
|
11280 |
-
function containsSlotChild (el) {
|
11281 |
-
if (el.type === 1) {
|
11282 |
-
if (el.tag === 'slot') {
|
11283 |
-
return true
|
11284 |
-
}
|
11285 |
-
return el.children.some(containsSlotChild)
|
11286 |
-
}
|
11287 |
-
return false
|
11288 |
-
}
|
11289 |
-
|
11290 |
-
function genScopedSlot (
|
11291 |
-
el,
|
11292 |
-
state
|
11293 |
-
) {
|
11294 |
-
var isLegacySyntax = el.attrsMap['slot-scope'];
|
11295 |
-
if (el.if && !el.ifProcessed && !isLegacySyntax) {
|
11296 |
-
return genIf(el, state, genScopedSlot, "null")
|
11297 |
-
}
|
11298 |
-
if (el.for && !el.forProcessed) {
|
11299 |
-
return genFor(el, state, genScopedSlot)
|
11300 |
-
}
|
11301 |
-
var slotScope = el.slotScope === emptySlotScopeToken
|
11302 |
-
? ""
|
11303 |
-
: String(el.slotScope);
|
11304 |
-
var fn = "function(" + slotScope + "){" +
|
11305 |
-
"return " + (el.tag === 'template'
|
11306 |
-
? el.if && isLegacySyntax
|
11307 |
-
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
|
11308 |
-
: genChildren(el, state) || 'undefined'
|
11309 |
-
: genElement(el, state)) + "}";
|
11310 |
-
// reverse proxy v-slot without scope on this.$slots
|
11311 |
-
var reverseProxy = slotScope ? "" : ",proxy:true";
|
11312 |
-
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
|
11313 |
-
}
|
11314 |
-
|
11315 |
-
function genChildren (
|
11316 |
-
el,
|
11317 |
-
state,
|
11318 |
-
checkSkip,
|
11319 |
-
altGenElement,
|
11320 |
-
altGenNode
|
11321 |
-
) {
|
11322 |
-
var children = el.children;
|
11323 |
-
if (children.length) {
|
11324 |
-
var el$1 = children[0];
|
11325 |
-
// optimize single v-for
|
11326 |
-
if (children.length === 1 &&
|
11327 |
-
el$1.for &&
|
11328 |
-
el$1.tag !== 'template' &&
|
11329 |
-
el$1.tag !== 'slot'
|
11330 |
-
) {
|
11331 |
-
var normalizationType = checkSkip
|
11332 |
-
? state.maybeComponent(el$1) ? ",1" : ",0"
|
11333 |
-
: "";
|
11334 |
-
return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
|
11335 |
-
}
|
11336 |
-
var normalizationType$1 = checkSkip
|
11337 |
-
? getNormalizationType(children, state.maybeComponent)
|
11338 |
-
: 0;
|
11339 |
-
var gen = altGenNode || genNode;
|
11340 |
-
return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
|
11341 |
-
}
|
11342 |
-
}
|
11343 |
-
|
11344 |
-
// determine the normalization needed for the children array.
|
11345 |
-
// 0: no normalization needed
|
11346 |
-
// 1: simple normalization needed (possible 1-level deep nested array)
|
11347 |
-
// 2: full normalization needed
|
11348 |
-
function getNormalizationType (
|
11349 |
-
children,
|
11350 |
-
maybeComponent
|
11351 |
-
) {
|
11352 |
-
var res = 0;
|
11353 |
-
for (var i = 0; i < children.length; i++) {
|
11354 |
-
var el = children[i];
|
11355 |
-
if (el.type !== 1) {
|
11356 |
-
continue
|
11357 |
-
}
|
11358 |
-
if (needsNormalization(el) ||
|
11359 |
-
(el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
11360 |
-
res = 2;
|
11361 |
-
break
|
11362 |
-
}
|
11363 |
-
if (maybeComponent(el) ||
|
11364 |
-
(el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
11365 |
-
res = 1;
|
11366 |
-
}
|
11367 |
-
}
|
11368 |
-
return res
|
11369 |
-
}
|
11370 |
-
|
11371 |
-
function needsNormalization (el) {
|
11372 |
-
return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
11373 |
-
}
|
11374 |
-
|
11375 |
-
function genNode (node, state) {
|
11376 |
-
if (node.type === 1) {
|
11377 |
-
return genElement(node, state)
|
11378 |
-
} else if (node.type === 3 && node.isComment) {
|
11379 |
-
return genComment(node)
|
11380 |
-
} else {
|
11381 |
-
return genText(node)
|
11382 |
-
}
|
11383 |
-
}
|
11384 |
-
|
11385 |
-
function genText (text) {
|
11386 |
-
return ("_v(" + (text.type === 2
|
11387 |
-
? text.expression // no need for () because already wrapped in _s()
|
11388 |
-
: transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
11389 |
-
}
|
11390 |
-
|
11391 |
-
function genComment (comment) {
|
11392 |
-
return ("_e(" + (JSON.stringify(comment.text)) + ")")
|
11393 |
-
}
|
11394 |
-
|
11395 |
-
function genSlot (el, state) {
|
11396 |
-
var slotName = el.slotName || '"default"';
|
11397 |
-
var children = genChildren(el, state);
|
11398 |
-
var res = "_t(" + slotName + (children ? ("," + children) : '');
|
11399 |
-
var attrs = el.attrs || el.dynamicAttrs
|
11400 |
-
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
11401 |
-
// slot props are camelized
|
11402 |
-
name: camelize(attr.name),
|
11403 |
-
value: attr.value,
|
11404 |
-
dynamic: attr.dynamic
|
11405 |
-
}); }))
|
11406 |
-
: null;
|
11407 |
-
var bind$$1 = el.attrsMap['v-bind'];
|
11408 |
-
if ((attrs || bind$$1) && !children) {
|
11409 |
-
res += ",null";
|
11410 |
-
}
|
11411 |
-
if (attrs) {
|
11412 |
-
res += "," + attrs;
|
11413 |
-
}
|
11414 |
-
if (bind$$1) {
|
11415 |
-
res += (attrs ? '' : ',null') + "," + bind$$1;
|
11416 |
-
}
|
11417 |
-
return res + ')'
|
11418 |
-
}
|
11419 |
-
|
11420 |
-
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
|
11421 |
-
function genComponent (
|
11422 |
-
componentName,
|
11423 |
-
el,
|
11424 |
-
state
|
11425 |
-
) {
|
11426 |
-
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
11427 |
-
return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
|
11428 |
-
}
|
11429 |
-
|
11430 |
-
function genProps (props) {
|
11431 |
-
var staticProps = "";
|
11432 |
-
var dynamicProps = "";
|
11433 |
-
for (var i = 0; i < props.length; i++) {
|
11434 |
-
var prop = props[i];
|
11435 |
-
var value = transformSpecialNewlines(prop.value);
|
11436 |
-
if (prop.dynamic) {
|
11437 |
-
dynamicProps += (prop.name) + "," + value + ",";
|
11438 |
-
} else {
|
11439 |
-
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
11440 |
-
}
|
11441 |
-
}
|
11442 |
-
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
11443 |
-
if (dynamicProps) {
|
11444 |
-
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
11445 |
-
} else {
|
11446 |
-
return staticProps
|
11447 |
-
}
|
11448 |
-
}
|
11449 |
-
|
11450 |
-
// #3895, #4268
|
11451 |
-
function transformSpecialNewlines (text) {
|
11452 |
-
return text
|
11453 |
-
.replace(/\u2028/g, '\\u2028')
|
11454 |
-
.replace(/\u2029/g, '\\u2029')
|
11455 |
-
}
|
11456 |
-
|
11457 |
-
/* */
|
11458 |
-
|
11459 |
-
|
11460 |
-
|
11461 |
-
// these keywords should not appear inside expressions, but operators like
|
11462 |
-
// typeof, instanceof and in are allowed
|
11463 |
-
var prohibitedKeywordRE = new RegExp('\\b' + (
|
11464 |
-
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
11465 |
-
'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
11466 |
-
'extends,finally,continue,debugger,function,arguments'
|
11467 |
-
).split(',').join('\\b|\\b') + '\\b');
|
11468 |
-
|
11469 |
-
// these unary operators should not be used as property/method names
|
11470 |
-
var unaryOperatorsRE = new RegExp('\\b' + (
|
11471 |
-
'delete,typeof,void'
|
11472 |
-
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
11473 |
-
|
11474 |
-
// strip strings in expressions
|
11475 |
-
var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
11476 |
-
|
11477 |
-
// detect problematic expressions in a template
|
11478 |
-
function detectErrors (ast, warn) {
|
11479 |
-
if (ast) {
|
11480 |
-
checkNode(ast, warn);
|
11481 |
-
}
|
11482 |
-
}
|
11483 |
-
|
11484 |
-
function checkNode (node, warn) {
|
11485 |
-
if (node.type === 1) {
|
11486 |
-
for (var name in node.attrsMap) {
|
11487 |
-
if (dirRE.test(name)) {
|
11488 |
-
var value = node.attrsMap[name];
|
11489 |
-
if (value) {
|
11490 |
-
var range = node.rawAttrsMap[name];
|
11491 |
-
if (name === 'v-for') {
|
11492 |
-
checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
11493 |
-
} else if (onRE.test(name)) {
|
11494 |
-
checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
11495 |
-
} else {
|
11496 |
-
checkExpression(value, (name + "=\"" + value + "\""), warn, range);
|
11497 |
-
}
|
11498 |
-
}
|
11499 |
-
}
|
11500 |
-
}
|
11501 |
-
if (node.children) {
|
11502 |
-
for (var i = 0; i < node.children.length; i++) {
|
11503 |
-
checkNode(node.children[i], warn);
|
11504 |
-
}
|
11505 |
-
}
|
11506 |
-
} else if (node.type === 2) {
|
11507 |
-
checkExpression(node.expression, node.text, warn, node);
|
11508 |
-
}
|
11509 |
-
}
|
11510 |
-
|
11511 |
-
function checkEvent (exp, text, warn, range) {
|
11512 |
-
var stipped = exp.replace(stripStringRE, '');
|
11513 |
-
var keywordMatch = stipped.match(unaryOperatorsRE);
|
11514 |
-
if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
11515 |
-
warn(
|
11516 |
-
"avoid using JavaScript unary operator as property name: " +
|
11517 |
-
"\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
11518 |
-
range
|
11519 |
-
);
|
11520 |
-
}
|
11521 |
-
checkExpression(exp, text, warn, range);
|
11522 |
-
}
|
11523 |
-
|
11524 |
-
function checkFor (node, text, warn, range) {
|
11525 |
-
checkExpression(node.for || '', text, warn, range);
|
11526 |
-
checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
11527 |
-
checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
11528 |
-
checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
11529 |
-
}
|
11530 |
-
|
11531 |
-
function checkIdentifier (
|
11532 |
-
ident,
|
11533 |
-
type,
|
11534 |
-
text,
|
11535 |
-
warn,
|
11536 |
-
range
|
11537 |
-
) {
|
11538 |
-
if (typeof ident === 'string') {
|
11539 |
-
try {
|
11540 |
-
new Function(("var " + ident + "=_"));
|
11541 |
-
} catch (e) {
|
11542 |
-
warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
|
11543 |
-
}
|
11544 |
-
}
|
11545 |
-
}
|
11546 |
-
|
11547 |
-
function checkExpression (exp, text, warn, range) {
|
11548 |
-
try {
|
11549 |
-
new Function(("return " + exp));
|
11550 |
-
} catch (e) {
|
11551 |
-
var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
|
11552 |
-
if (keywordMatch) {
|
11553 |
-
warn(
|
11554 |
-
"avoid using JavaScript keyword as property name: " +
|
11555 |
-
"\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
|
11556 |
-
range
|
11557 |
-
);
|
11558 |
-
} else {
|
11559 |
-
warn(
|
11560 |
-
"invalid expression: " + (e.message) + " in\n\n" +
|
11561 |
-
" " + exp + "\n\n" +
|
11562 |
-
" Raw expression: " + (text.trim()) + "\n",
|
11563 |
-
range
|
11564 |
-
);
|
11565 |
-
}
|
11566 |
-
}
|
11567 |
-
}
|
11568 |
-
|
11569 |
-
/* */
|
11570 |
-
|
11571 |
-
var range = 2;
|
11572 |
-
|
11573 |
-
function generateCodeFrame (
|
11574 |
-
source,
|
11575 |
-
start,
|
11576 |
-
end
|
11577 |
-
) {
|
11578 |
-
if ( start === void 0 ) start = 0;
|
11579 |
-
if ( end === void 0 ) end = source.length;
|
11580 |
-
|
11581 |
-
var lines = source.split(/\r?\n/);
|
11582 |
-
var count = 0;
|
11583 |
-
var res = [];
|
11584 |
-
for (var i = 0; i < lines.length; i++) {
|
11585 |
-
count += lines[i].length + 1;
|
11586 |
-
if (count >= start) {
|
11587 |
-
for (var j = i - range; j <= i + range || end > count; j++) {
|
11588 |
-
if (j < 0 || j >= lines.length) { continue }
|
11589 |
-
res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
|
11590 |
-
var lineLength = lines[j].length;
|
11591 |
-
if (j === i) {
|
11592 |
-
// push underline
|
11593 |
-
var pad = start - (count - lineLength) + 1;
|
11594 |
-
var length = end > count ? lineLength - pad : end - start;
|
11595 |
-
res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
|
11596 |
-
} else if (j > i) {
|
11597 |
-
if (end > count) {
|
11598 |
-
var length$1 = Math.min(end - count, lineLength);
|
11599 |
-
res.push(" | " + repeat$1("^", length$1));
|
11600 |
-
}
|
11601 |
-
count += lineLength + 1;
|
11602 |
-
}
|
11603 |
-
}
|
11604 |
-
break
|
11605 |
-
}
|
11606 |
-
}
|
11607 |
-
return res.join('\n')
|
11608 |
-
}
|
11609 |
-
|
11610 |
-
function repeat$1 (str, n) {
|
11611 |
-
var result = '';
|
11612 |
-
if (n > 0) {
|
11613 |
-
while (true) { // eslint-disable-line
|
11614 |
-
if (n & 1) { result += str; }
|
11615 |
-
n >>>= 1;
|
11616 |
-
if (n <= 0) { break }
|
11617 |
-
str += str;
|
11618 |
-
}
|
11619 |
-
}
|
11620 |
-
return result
|
11621 |
-
}
|
11622 |
-
|
11623 |
-
/* */
|
11624 |
-
|
11625 |
-
|
11626 |
-
|
11627 |
-
function createFunction (code, errors) {
|
11628 |
-
try {
|
11629 |
-
return new Function(code)
|
11630 |
-
} catch (err) {
|
11631 |
-
errors.push({ err: err, code: code });
|
11632 |
-
return noop
|
11633 |
-
}
|
11634 |
-
}
|
11635 |
-
|
11636 |
-
function createCompileToFunctionFn (compile) {
|
11637 |
-
var cache = Object.create(null);
|
11638 |
-
|
11639 |
-
return function compileToFunctions (
|
11640 |
-
template,
|
11641 |
-
options,
|
11642 |
-
vm
|
11643 |
-
) {
|
11644 |
-
options = extend({}, options);
|
11645 |
-
var warn$$1 = options.warn || warn;
|
11646 |
-
delete options.warn;
|
11647 |
-
|
11648 |
-
/* istanbul ignore if */
|
11649 |
-
{
|
11650 |
-
// detect possible CSP restriction
|
11651 |
-
try {
|
11652 |
-
new Function('return 1');
|
11653 |
-
} catch (e) {
|
11654 |
-
if (e.toString().match(/unsafe-eval|CSP/)) {
|
11655 |
-
warn$$1(
|
11656 |
-
'It seems you are using the standalone build of Vue.js in an ' +
|
11657 |
-
'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
11658 |
-
'The template compiler cannot work in this environment. Consider ' +
|
11659 |
-
'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
11660 |
-
'templates into render functions.'
|
11661 |
-
);
|
11662 |
-
}
|
11663 |
-
}
|
11664 |
-
}
|
11665 |
-
|
11666 |
-
// check cache
|
11667 |
-
var key = options.delimiters
|
11668 |
-
? String(options.delimiters) + template
|
11669 |
-
: template;
|
11670 |
-
if (cache[key]) {
|
11671 |
-
return cache[key]
|
11672 |
-
}
|
11673 |
-
|
11674 |
-
// compile
|
11675 |
-
var compiled = compile(template, options);
|
11676 |
-
|
11677 |
-
// check compilation errors/tips
|
11678 |
-
{
|
11679 |
-
if (compiled.errors && compiled.errors.length) {
|
11680 |
-
if (options.outputSourceRange) {
|
11681 |
-
compiled.errors.forEach(function (e) {
|
11682 |
-
warn$$1(
|
11683 |
-
"Error compiling template:\n\n" + (e.msg) + "\n\n" +
|
11684 |
-
generateCodeFrame(template, e.start, e.end),
|
11685 |
-
vm
|
11686 |
-
);
|
11687 |
-
});
|
11688 |
-
} else {
|
11689 |
-
warn$$1(
|
11690 |
-
"Error compiling template:\n\n" + template + "\n\n" +
|
11691 |
-
compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
|
11692 |
-
vm
|
11693 |
-
);
|
11694 |
-
}
|
11695 |
-
}
|
11696 |
-
if (compiled.tips && compiled.tips.length) {
|
11697 |
-
if (options.outputSourceRange) {
|
11698 |
-
compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
11699 |
-
} else {
|
11700 |
-
compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
11701 |
-
}
|
11702 |
-
}
|
11703 |
-
}
|
11704 |
-
|
11705 |
-
// turn code into functions
|
11706 |
-
var res = {};
|
11707 |
-
var fnGenErrors = [];
|
11708 |
-
res.render = createFunction(compiled.render, fnGenErrors);
|
11709 |
-
res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
11710 |
-
return createFunction(code, fnGenErrors)
|
11711 |
-
});
|
11712 |
-
|
11713 |
-
// check function generation errors.
|
11714 |
-
// this should only happen if there is a bug in the compiler itself.
|
11715 |
-
// mostly for codegen development use
|
11716 |
-
/* istanbul ignore if */
|
11717 |
-
{
|
11718 |
-
if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
11719 |
-
warn$$1(
|
11720 |
-
"Failed to generate render function:\n\n" +
|
11721 |
-
fnGenErrors.map(function (ref) {
|
11722 |
-
var err = ref.err;
|
11723 |
-
var code = ref.code;
|
11724 |
-
|
11725 |
-
return ((err.toString()) + " in\n\n" + code + "\n");
|
11726 |
-
}).join('\n'),
|
11727 |
-
vm
|
11728 |
-
);
|
11729 |
-
}
|
11730 |
-
}
|
11731 |
-
|
11732 |
-
return (cache[key] = res)
|
11733 |
-
}
|
11734 |
-
}
|
11735 |
-
|
11736 |
-
/* */
|
11737 |
-
|
11738 |
-
function createCompilerCreator (baseCompile) {
|
11739 |
-
return function createCompiler (baseOptions) {
|
11740 |
-
function compile (
|
11741 |
-
template,
|
11742 |
-
options
|
11743 |
-
) {
|
11744 |
-
var finalOptions = Object.create(baseOptions);
|
11745 |
-
var errors = [];
|
11746 |
-
var tips = [];
|
11747 |
-
|
11748 |
-
var warn = function (msg, range, tip) {
|
11749 |
-
(tip ? tips : errors).push(msg);
|
11750 |
-
};
|
11751 |
-
|
11752 |
-
if (options) {
|
11753 |
-
if (options.outputSourceRange) {
|
11754 |
-
// $flow-disable-line
|
11755 |
-
var leadingSpaceLength = template.match(/^\s*/)[0].length;
|
11756 |
-
|
11757 |
-
warn = function (msg, range, tip) {
|
11758 |
-
var data = { msg: msg };
|
11759 |
-
if (range) {
|
11760 |
-
if (range.start != null) {
|
11761 |
-
data.start = range.start + leadingSpaceLength;
|
11762 |
-
}
|
11763 |
-
if (range.end != null) {
|
11764 |
-
data.end = range.end + leadingSpaceLength;
|
11765 |
-
}
|
11766 |
-
}
|
11767 |
-
(tip ? tips : errors).push(data);
|
11768 |
-
};
|
11769 |
-
}
|
11770 |
-
// merge custom modules
|
11771 |
-
if (options.modules) {
|
11772 |
-
finalOptions.modules =
|
11773 |
-
(baseOptions.modules || []).concat(options.modules);
|
11774 |
-
}
|
11775 |
-
// merge custom directives
|
11776 |
-
if (options.directives) {
|
11777 |
-
finalOptions.directives = extend(
|
11778 |
-
Object.create(baseOptions.directives || null),
|
11779 |
-
options.directives
|
11780 |
-
);
|
11781 |
-
}
|
11782 |
-
// copy other options
|
11783 |
-
for (var key in options) {
|
11784 |
-
if (key !== 'modules' && key !== 'directives') {
|
11785 |
-
finalOptions[key] = options[key];
|
11786 |
-
}
|
11787 |
-
}
|
11788 |
-
}
|
11789 |
-
|
11790 |
-
finalOptions.warn = warn;
|
11791 |
-
|
11792 |
-
var compiled = baseCompile(template.trim(), finalOptions);
|
11793 |
-
{
|
11794 |
-
detectErrors(compiled.ast, warn);
|
11795 |
-
}
|
11796 |
-
compiled.errors = errors;
|
11797 |
-
compiled.tips = tips;
|
11798 |
-
return compiled
|
11799 |
-
}
|
11800 |
-
|
11801 |
-
return {
|
11802 |
-
compile: compile,
|
11803 |
-
compileToFunctions: createCompileToFunctionFn(compile)
|
11804 |
-
}
|
11805 |
-
}
|
11806 |
-
}
|
11807 |
-
|
11808 |
-
/* */
|
11809 |
-
|
11810 |
-
// `createCompilerCreator` allows creating compilers that use alternative
|
11811 |
-
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
|
11812 |
-
// Here we just export a default compiler using the default parts.
|
11813 |
-
var createCompiler = createCompilerCreator(function baseCompile (
|
11814 |
-
template,
|
11815 |
-
options
|
11816 |
-
) {
|
11817 |
-
var ast = parse(template.trim(), options);
|
11818 |
-
if (options.optimize !== false) {
|
11819 |
-
optimize(ast, options);
|
11820 |
-
}
|
11821 |
-
var code = generate(ast, options);
|
11822 |
-
return {
|
11823 |
-
ast: ast,
|
11824 |
-
render: code.render,
|
11825 |
-
staticRenderFns: code.staticRenderFns
|
11826 |
-
}
|
11827 |
-
});
|
11828 |
-
|
11829 |
-
/* */
|
11830 |
-
|
11831 |
-
var ref$1 = createCompiler(baseOptions);
|
11832 |
-
var compile = ref$1.compile;
|
11833 |
-
var compileToFunctions = ref$1.compileToFunctions;
|
11834 |
-
|
11835 |
-
/* */
|
11836 |
-
|
11837 |
-
// check whether current browser encodes a char inside attribute values
|
11838 |
-
var div;
|
11839 |
-
function getShouldDecode (href) {
|
11840 |
-
div = div || document.createElement('div');
|
11841 |
-
div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
|
11842 |
-
return div.innerHTML.indexOf(' ') > 0
|
11843 |
-
}
|
11844 |
-
|
11845 |
-
// #3663: IE encodes newlines inside attribute values while other browsers don't
|
11846 |
-
var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
|
11847 |
-
// #6828: chrome encodes content in a[href]
|
11848 |
-
var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
|
11849 |
-
|
11850 |
-
/* */
|
11851 |
-
|
11852 |
-
var idToTemplate = cached(function (id) {
|
11853 |
-
var el = query(id);
|
11854 |
-
return el && el.innerHTML
|
11855 |
-
});
|
11856 |
-
|
11857 |
-
var mount = Vue.prototype.$mount;
|
11858 |
-
Vue.prototype.$mount = function (
|
11859 |
-
el,
|
11860 |
-
hydrating
|
11861 |
-
) {
|
11862 |
-
el = el && query(el);
|
11863 |
-
|
11864 |
-
/* istanbul ignore if */
|
11865 |
-
if (el === document.body || el === document.documentElement) {
|
11866 |
-
warn(
|
11867 |
-
"Do not mount Vue to <html> or <body> - mount to normal elements instead."
|
11868 |
-
);
|
11869 |
-
return this
|
11870 |
-
}
|
11871 |
-
|
11872 |
-
var options = this.$options;
|
11873 |
-
// resolve template/el and convert to render function
|
11874 |
-
if (!options.render) {
|
11875 |
-
var template = options.template;
|
11876 |
-
if (template) {
|
11877 |
-
if (typeof template === 'string') {
|
11878 |
-
if (template.charAt(0) === '#') {
|
11879 |
-
template = idToTemplate(template);
|
11880 |
-
/* istanbul ignore if */
|
11881 |
-
if (!template) {
|
11882 |
-
warn(
|
11883 |
-
("Template element not found or is empty: " + (options.template)),
|
11884 |
-
this
|
11885 |
-
);
|
11886 |
-
}
|
11887 |
-
}
|
11888 |
-
} else if (template.nodeType) {
|
11889 |
-
template = template.innerHTML;
|
11890 |
-
} else {
|
11891 |
-
{
|
11892 |
-
warn('invalid template option:' + template, this);
|
11893 |
-
}
|
11894 |
-
return this
|
11895 |
-
}
|
11896 |
-
} else if (el) {
|
11897 |
-
template = getOuterHTML(el);
|
11898 |
-
}
|
11899 |
-
if (template) {
|
11900 |
-
/* istanbul ignore if */
|
11901 |
-
if (config.performance && mark) {
|
11902 |
-
mark('compile');
|
11903 |
-
}
|
11904 |
-
|
11905 |
-
var ref = compileToFunctions(template, {
|
11906 |
-
outputSourceRange: "development" !== 'production',
|
11907 |
-
shouldDecodeNewlines: shouldDecodeNewlines,
|
11908 |
-
shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
|
11909 |
-
delimiters: options.delimiters,
|
11910 |
-
comments: options.comments
|
11911 |
-
}, this);
|
11912 |
-
var render = ref.render;
|
11913 |
-
var staticRenderFns = ref.staticRenderFns;
|
11914 |
-
options.render = render;
|
11915 |
-
options.staticRenderFns = staticRenderFns;
|
11916 |
-
|
11917 |
-
/* istanbul ignore if */
|
11918 |
-
if (config.performance && mark) {
|
11919 |
-
mark('compile end');
|
11920 |
-
measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
|
11921 |
-
}
|
11922 |
-
}
|
11923 |
-
}
|
11924 |
-
return mount.call(this, el, hydrating)
|
11925 |
-
};
|
11926 |
-
|
11927 |
-
/**
|
11928 |
-
* Get outerHTML of elements, taking care
|
11929 |
-
* of SVG elements in IE as well.
|
11930 |
-
*/
|
11931 |
-
function getOuterHTML (el) {
|
11932 |
-
if (el.outerHTML) {
|
11933 |
-
return el.outerHTML
|
11934 |
-
} else {
|
11935 |
-
var container = document.createElement('div');
|
11936 |
-
container.appendChild(el.cloneNode(true));
|
11937 |
-
return container.innerHTML
|
11938 |
-
}
|
11939 |
-
}
|
11940 |
-
|
11941 |
-
Vue.compile = compileToFunctions;
|
11942 |
-
|
11943 |
-
return Vue;
|
11944 |
-
|
11945 |
}));
|
11946 |
-
/**
|
11947 |
-
* vuex v3.1.0
|
11948 |
-
* (c) 2019 Evan You
|
11949 |
-
* @license MIT
|
11950 |
-
*/
|
11951 |
-
(function (global, factory) {
|
11952 |
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
11953 |
-
typeof define === 'function' && define.amd ? define(factory) :
|
11954 |
-
(global = global || self, global.Vuex = factory());
|
11955 |
-
}(this, function () { 'use strict';
|
11956 |
-
|
11957 |
-
function applyMixin (Vue) {
|
11958 |
-
var version = Number(Vue.version.split('.')[0]);
|
11959 |
-
|
11960 |
-
if (version >= 2) {
|
11961 |
-
Vue.mixin({ beforeCreate: vuexInit });
|
11962 |
-
} else {
|
11963 |
-
// override init and inject vuex init procedure
|
11964 |
-
// for 1.x backwards compatibility.
|
11965 |
-
var _init = Vue.prototype._init;
|
11966 |
-
Vue.prototype._init = function (options) {
|
11967 |
-
if ( options === void 0 ) options = {};
|
11968 |
-
|
11969 |
-
options.init = options.init
|
11970 |
-
? [vuexInit].concat(options.init)
|
11971 |
-
: vuexInit;
|
11972 |
-
_init.call(this, options);
|
11973 |
-
};
|
11974 |
-
}
|
11975 |
-
|
11976 |
-
/**
|
11977 |
-
* Vuex init hook, injected into each instances init hooks list.
|
11978 |
-
*/
|
11979 |
-
|
11980 |
-
function vuexInit () {
|
11981 |
-
var options = this.$options;
|
11982 |
-
// store injection
|
11983 |
-
if (options.store) {
|
11984 |
-
this.$store = typeof options.store === 'function'
|
11985 |
-
? options.store()
|
11986 |
-
: options.store;
|
11987 |
-
} else if (options.parent && options.parent.$store) {
|
11988 |
-
this.$store = options.parent.$store;
|
11989 |
-
}
|
11990 |
-
}
|
11991 |
-
}
|
11992 |
-
|
11993 |
-
var devtoolHook =
|
11994 |
-
typeof window !== 'undefined' &&
|
11995 |
-
window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
11996 |
-
|
11997 |
-
function devtoolPlugin (store) {
|
11998 |
-
if (!devtoolHook) { return }
|
11999 |
-
|
12000 |
-
store._devtoolHook = devtoolHook;
|
12001 |
-
|
12002 |
-
devtoolHook.emit('vuex:init', store);
|
12003 |
-
|
12004 |
-
devtoolHook.on('vuex:travel-to-state', function (targetState) {
|
12005 |
-
store.replaceState(targetState);
|
12006 |
-
});
|
12007 |
-
|
12008 |
-
store.subscribe(function (mutation, state) {
|
12009 |
-
devtoolHook.emit('vuex:mutation', mutation, state);
|
12010 |
-
});
|
12011 |
-
}
|
12012 |
-
|
12013 |
-
/**
|
12014 |
-
* Get the first item that pass the test
|
12015 |
-
* by second argument function
|
12016 |
-
*
|
12017 |
-
* @param {Array} list
|
12018 |
-
* @param {Function} f
|
12019 |
-
* @return {*}
|
12020 |
-
*/
|
12021 |
-
|
12022 |
-
/**
|
12023 |
-
* forEach for object
|
12024 |
-
*/
|
12025 |
-
function forEachValue (obj, fn) {
|
12026 |
-
Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
|
12027 |
-
}
|
12028 |
-
|
12029 |
-
function isObject (obj) {
|
12030 |
-
return obj !== null && typeof obj === 'object'
|
12031 |
-
}
|
12032 |
-
|
12033 |
-
function isPromise (val) {
|
12034 |
-
return val && typeof val.then === 'function'
|
12035 |
-
}
|
12036 |
-
|
12037 |
-
function assert (condition, msg) {
|
12038 |
-
if (!condition) { throw new Error(("[vuex] " + msg)) }
|
12039 |
-
}
|
12040 |
-
|
12041 |
-
// Base data struct for store's module, package with some attribute and method
|
12042 |
-
var Module = function Module (rawModule, runtime) {
|
12043 |
-
this.runtime = runtime;
|
12044 |
-
// Store some children item
|
12045 |
-
this._children = Object.create(null);
|
12046 |
-
// Store the origin module object which passed by programmer
|
12047 |
-
this._rawModule = rawModule;
|
12048 |
-
var rawState = rawModule.state;
|
12049 |
-
|
12050 |
-
// Store the origin module's state
|
12051 |
-
this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
|
12052 |
-
};
|
12053 |
-
|
12054 |
-
var prototypeAccessors = { namespaced: { configurable: true } };
|
12055 |
-
|
12056 |
-
prototypeAccessors.namespaced.get = function () {
|
12057 |
-
return !!this._rawModule.namespaced
|
12058 |
-
};
|
12059 |
-
|
12060 |
-
Module.prototype.addChild = function addChild (key, module) {
|
12061 |
-
this._children[key] = module;
|
12062 |
-
};
|
12063 |
-
|
12064 |
-
Module.prototype.removeChild = function removeChild (key) {
|
12065 |
-
delete this._children[key];
|
12066 |
-
};
|
12067 |
-
|
12068 |
-
Module.prototype.getChild = function getChild (key) {
|
12069 |
-
return this._children[key]
|
12070 |
-
};
|
12071 |
-
|
12072 |
-
Module.prototype.update = function update (rawModule) {
|
12073 |
-
this._rawModule.namespaced = rawModule.namespaced;
|
12074 |
-
if (rawModule.actions) {
|
12075 |
-
this._rawModule.actions = rawModule.actions;
|
12076 |
-
}
|
12077 |
-
if (rawModule.mutations) {
|
12078 |
-
this._rawModule.mutations = rawModule.mutations;
|
12079 |
-
}
|
12080 |
-
if (rawModule.getters) {
|
12081 |
-
this._rawModule.getters = rawModule.getters;
|
12082 |
-
}
|
12083 |
-
};
|
12084 |
-
|
12085 |
-
Module.prototype.forEachChild = function forEachChild (fn) {
|
12086 |
-
forEachValue(this._children, fn);
|
12087 |
-
};
|
12088 |
-
|
12089 |
-
Module.prototype.forEachGetter = function forEachGetter (fn) {
|
12090 |
-
if (this._rawModule.getters) {
|
12091 |
-
forEachValue(this._rawModule.getters, fn);
|
12092 |
-
}
|
12093 |
-
};
|
12094 |
-
|
12095 |
-
Module.prototype.forEachAction = function forEachAction (fn) {
|
12096 |
-
if (this._rawModule.actions) {
|
12097 |
-
forEachValue(this._rawModule.actions, fn);
|
12098 |
-
}
|
12099 |
-
};
|
12100 |
-
|
12101 |
-
Module.prototype.forEachMutation = function forEachMutation (fn) {
|
12102 |
-
if (this._rawModule.mutations) {
|
12103 |
-
forEachValue(this._rawModule.mutations, fn);
|
12104 |
-
}
|
12105 |
-
};
|
12106 |
-
|
12107 |
-
Object.defineProperties( Module.prototype, prototypeAccessors );
|
12108 |
-
|
12109 |
-
var ModuleCollection = function ModuleCollection (rawRootModule) {
|
12110 |
-
// register root module (Vuex.Store options)
|
12111 |
-
this.register([], rawRootModule, false);
|
12112 |
-
};
|
12113 |
-
|
12114 |
-
ModuleCollection.prototype.get = function get (path) {
|
12115 |
-
return path.reduce(function (module, key) {
|
12116 |
-
return module.getChild(key)
|
12117 |
-
}, this.root)
|
12118 |
-
};
|
12119 |
-
|
12120 |
-
ModuleCollection.prototype.getNamespace = function getNamespace (path) {
|
12121 |
-
var module = this.root;
|
12122 |
-
return path.reduce(function (namespace, key) {
|
12123 |
-
module = module.getChild(key);
|
12124 |
-
return namespace + (module.namespaced ? key + '/' : '')
|
12125 |
-
}, '')
|
12126 |
-
};
|
12127 |
-
|
12128 |
-
ModuleCollection.prototype.update = function update$1 (rawRootModule) {
|
12129 |
-
update([], this.root, rawRootModule);
|
12130 |
-
};
|
12131 |
-
|
12132 |
-
ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
|
12133 |
-
var this$1 = this;
|
12134 |
-
if ( runtime === void 0 ) runtime = true;
|
12135 |
-
|
12136 |
-
{
|
12137 |
-
assertRawModule(path, rawModule);
|
12138 |
-
}
|
12139 |
-
|
12140 |
-
var newModule = new Module(rawModule, runtime);
|
12141 |
-
if (path.length === 0) {
|
12142 |
-
this.root = newModule;
|
12143 |
-
} else {
|
12144 |
-
var parent = this.get(path.slice(0, -1));
|
12145 |
-
parent.addChild(path[path.length - 1], newModule);
|
12146 |
-
}
|
12147 |
-
|
12148 |
-
// register nested modules
|
12149 |
-
if (rawModule.modules) {
|
12150 |
-
forEachValue(rawModule.modules, function (rawChildModule, key) {
|
12151 |
-
this$1.register(path.concat(key), rawChildModule, runtime);
|
12152 |
-
});
|
12153 |
-
}
|
12154 |
-
};
|
12155 |
-
|
12156 |
-
ModuleCollection.prototype.unregister = function unregister (path) {
|
12157 |
-
var parent = this.get(path.slice(0, -1));
|
12158 |
-
var key = path[path.length - 1];
|
12159 |
-
if (!parent.getChild(key).runtime) { return }
|
12160 |
-
|
12161 |
-
parent.removeChild(key);
|
12162 |
-
};
|
12163 |
-
|
12164 |
-
function update (path, targetModule, newModule) {
|
12165 |
-
{
|
12166 |
-
assertRawModule(path, newModule);
|
12167 |
-
}
|
12168 |
-
|
12169 |
-
// update target module
|
12170 |
-
targetModule.update(newModule);
|
12171 |
-
|
12172 |
-
// update nested modules
|
12173 |
-
if (newModule.modules) {
|
12174 |
-
for (var key in newModule.modules) {
|
12175 |
-
if (!targetModule.getChild(key)) {
|
12176 |
-
{
|
12177 |
-
console.warn(
|
12178 |
-
"[vuex] trying to add a new module '" + key + "' on hot reloading, " +
|
12179 |
-
'manual reload is needed'
|
12180 |
-
);
|
12181 |
-
}
|
12182 |
-
return
|
12183 |
-
}
|
12184 |
-
update(
|
12185 |
-
path.concat(key),
|
12186 |
-
targetModule.getChild(key),
|
12187 |
-
newModule.modules[key]
|
12188 |
-
);
|
12189 |
-
}
|
12190 |
-
}
|
12191 |
-
}
|
12192 |
-
|
12193 |
-
var functionAssert = {
|
12194 |
-
assert: function (value) { return typeof value === 'function'; },
|
12195 |
-
expected: 'function'
|
12196 |
-
};
|
12197 |
-
|
12198 |
-
var objectAssert = {
|
12199 |
-
assert: function (value) { return typeof value === 'function' ||
|
12200 |
-
(typeof value === 'object' && typeof value.handler === 'function'); },
|
12201 |
-
expected: 'function or object with "handler" function'
|
12202 |
-
};
|
12203 |
-
|
12204 |
-
var assertTypes = {
|
12205 |
-
getters: functionAssert,
|
12206 |
-
mutations: functionAssert,
|
12207 |
-
actions: objectAssert
|
12208 |
-
};
|
12209 |
-
|
12210 |
-
function assertRawModule (path, rawModule) {
|
12211 |
-
Object.keys(assertTypes).forEach(function (key) {
|
12212 |
-
if (!rawModule[key]) { return }
|
12213 |
-
|
12214 |
-
var assertOptions = assertTypes[key];
|
12215 |
-
|
12216 |
-
forEachValue(rawModule[key], function (value, type) {
|
12217 |
-
assert(
|
12218 |
-
assertOptions.assert(value),
|
12219 |
-
makeAssertionMessage(path, key, type, value, assertOptions.expected)
|
12220 |
-
);
|
12221 |
-
});
|
12222 |
-
});
|
12223 |
-
}
|
12224 |
-
|
12225 |
-
function makeAssertionMessage (path, key, type, value, expected) {
|
12226 |
-
var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
|
12227 |
-
if (path.length > 0) {
|
12228 |
-
buf += " in module \"" + (path.join('.')) + "\"";
|
12229 |
-
}
|
12230 |
-
buf += " is " + (JSON.stringify(value)) + ".";
|
12231 |
-
return buf
|
12232 |
-
}
|
12233 |
-
|
12234 |
-
var Vue; // bind on install
|
12235 |
-
|
12236 |
-
var Store = function Store (options) {
|
12237 |
-
var this$1 = this;
|
12238 |
-
if ( options === void 0 ) options = {};
|
12239 |
-
|
12240 |
-
// Auto install if it is not done yet and `window` has `Vue`.
|
12241 |
-
// To allow users to avoid auto-installation in some cases,
|
12242 |
-
// this code should be placed here. See #731
|
12243 |
-
if (!Vue && typeof window !== 'undefined' && window.Vue) {
|
12244 |
-
install(window.Vue);
|
12245 |
-
}
|
12246 |
-
|
12247 |
-
{
|
12248 |
-
assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
|
12249 |
-
assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
|
12250 |
-
assert(this instanceof Store, "store must be called with the new operator.");
|
12251 |
-
}
|
12252 |
-
|
12253 |
-
var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
|
12254 |
-
var strict = options.strict; if ( strict === void 0 ) strict = false;
|
12255 |
-
|
12256 |
-
// store internal state
|
12257 |
-
this._committing = false;
|
12258 |
-
this._actions = Object.create(null);
|
12259 |
-
this._actionSubscribers = [];
|
12260 |
-
this._mutations = Object.create(null);
|
12261 |
-
this._wrappedGetters = Object.create(null);
|
12262 |
-
this._modules = new ModuleCollection(options);
|
12263 |
-
this._modulesNamespaceMap = Object.create(null);
|
12264 |
-
this._subscribers = [];
|
12265 |
-
this._watcherVM = new Vue();
|
12266 |
-
|
12267 |
-
// bind commit and dispatch to self
|
12268 |
-
var store = this;
|
12269 |
-
var ref = this;
|
12270 |
-
var dispatch = ref.dispatch;
|
12271 |
-
var commit = ref.commit;
|
12272 |
-
this.dispatch = function boundDispatch (type, payload) {
|
12273 |
-
return dispatch.call(store, type, payload)
|
12274 |
-
};
|
12275 |
-
this.commit = function boundCommit (type, payload, options) {
|
12276 |
-
return commit.call(store, type, payload, options)
|
12277 |
-
};
|
12278 |
-
|
12279 |
-
// strict mode
|
12280 |
-
this.strict = strict;
|
12281 |
-
|
12282 |
-
var state = this._modules.root.state;
|
12283 |
-
|
12284 |
-
// init root module.
|
12285 |
-
// this also recursively registers all sub-modules
|
12286 |
-
// and collects all module getters inside this._wrappedGetters
|
12287 |
-
installModule(this, state, [], this._modules.root);
|
12288 |
-
|
12289 |
-
// initialize the store vm, which is responsible for the reactivity
|
12290 |
-
// (also registers _wrappedGetters as computed properties)
|
12291 |
-
resetStoreVM(this, state);
|
12292 |
-
|
12293 |
-
// apply plugins
|
12294 |
-
plugins.forEach(function (plugin) { return plugin(this$1); });
|
12295 |
-
|
12296 |
-
var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
|
12297 |
-
if (useDevtools) {
|
12298 |
-
devtoolPlugin(this);
|
12299 |
-
}
|
12300 |
-
};
|
12301 |
-
|
12302 |
-
var prototypeAccessors$1 = { state: { configurable: true } };
|
12303 |
-
|
12304 |
-
prototypeAccessors$1.state.get = function () {
|
12305 |
-
return this._vm._data.$$state
|
12306 |
-
};
|
12307 |
-
|
12308 |
-
prototypeAccessors$1.state.set = function (v) {
|
12309 |
-
{
|
12310 |
-
assert(false, "use store.replaceState() to explicit replace store state.");
|
12311 |
-
}
|
12312 |
-
};
|
12313 |
-
|
12314 |
-
Store.prototype.commit = function commit (_type, _payload, _options) {
|
12315 |
-
var this$1 = this;
|
12316 |
-
|
12317 |
-
// check object-style commit
|
12318 |
-
var ref = unifyObjectStyle(_type, _payload, _options);
|
12319 |
-
var type = ref.type;
|
12320 |
-
var payload = ref.payload;
|
12321 |
-
var options = ref.options;
|
12322 |
-
|
12323 |
-
var mutation = { type: type, payload: payload };
|
12324 |
-
var entry = this._mutations[type];
|
12325 |
-
if (!entry) {
|
12326 |
-
{
|
12327 |
-
console.error(("[vuex] unknown mutation type: " + type));
|
12328 |
-
}
|
12329 |
-
return
|
12330 |
-
}
|
12331 |
-
this._withCommit(function () {
|
12332 |
-
entry.forEach(function commitIterator (handler) {
|
12333 |
-
handler(payload);
|
12334 |
-
});
|
12335 |
-
});
|
12336 |
-
this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); });
|
12337 |
-
|
12338 |
-
if (
|
12339 |
-
options && options.silent
|
12340 |
-
) {
|
12341 |
-
console.warn(
|
12342 |
-
"[vuex] mutation type: " + type + ". Silent option has been removed. " +
|
12343 |
-
'Use the filter functionality in the vue-devtools'
|
12344 |
-
);
|
12345 |
-
}
|
12346 |
-
};
|
12347 |
-
|
12348 |
-
Store.prototype.dispatch = function dispatch (_type, _payload) {
|
12349 |
-
var this$1 = this;
|
12350 |
-
|
12351 |
-
// check object-style dispatch
|
12352 |
-
var ref = unifyObjectStyle(_type, _payload);
|
12353 |
-
var type = ref.type;
|
12354 |
-
var payload = ref.payload;
|
12355 |
-
|
12356 |
-
var action = { type: type, payload: payload };
|
12357 |
-
var entry = this._actions[type];
|
12358 |
-
if (!entry) {
|
12359 |
-
{
|
12360 |
-
console.error(("[vuex] unknown action type: " + type));
|
12361 |
-
}
|
12362 |
-
return
|
12363 |
-
}
|
12364 |
-
|
12365 |
-
try {
|
12366 |
-
this._actionSubscribers
|
12367 |
-
.filter(function (sub) { return sub.before; })
|
12368 |
-
.forEach(function (sub) { return sub.before(action, this$1.state); });
|
12369 |
-
} catch (e) {
|
12370 |
-
{
|
12371 |
-
console.warn("[vuex] error in before action subscribers: ");
|
12372 |
-
console.error(e);
|
12373 |
-
}
|
12374 |
-
}
|
12375 |
-
|
12376 |
-
var result = entry.length > 1
|
12377 |
-
? Promise.all(entry.map(function (handler) { return handler(payload); }))
|
12378 |
-
: entry[0](payload);
|
12379 |
-
|
12380 |
-
return result.then(function (res) {
|
12381 |
-
try {
|
12382 |
-
this$1._actionSubscribers
|
12383 |
-
.filter(function (sub) { return sub.after; })
|
12384 |
-
.forEach(function (sub) { return sub.after(action, this$1.state); });
|
12385 |
-
} catch (e) {
|
12386 |
-
{
|
12387 |
-
console.warn("[vuex] error in after action subscribers: ");
|
12388 |
-
console.error(e);
|
12389 |
-
}
|
12390 |
-
}
|
12391 |
-
return res
|
12392 |
-
})
|
12393 |
-
};
|
12394 |
-
|
12395 |
-
Store.prototype.subscribe = function subscribe (fn) {
|
12396 |
-
return genericSubscribe(fn, this._subscribers)
|
12397 |
-
};
|
12398 |
-
|
12399 |
-
Store.prototype.subscribeAction = function subscribeAction (fn) {
|
12400 |
-
var subs = typeof fn === 'function' ? { before: fn } : fn;
|
12401 |
-
return genericSubscribe(subs, this._actionSubscribers)
|
12402 |
-
};
|
12403 |
-
|
12404 |
-
Store.prototype.watch = function watch (getter, cb, options) {
|
12405 |
-
var this$1 = this;
|
12406 |
-
|
12407 |
-
{
|
12408 |
-
assert(typeof getter === 'function', "store.watch only accepts a function.");
|
12409 |
-
}
|
12410 |
-
return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
|
12411 |
-
};
|
12412 |
-
|
12413 |
-
Store.prototype.replaceState = function replaceState (state) {
|
12414 |
-
var this$1 = this;
|
12415 |
-
|
12416 |
-
this._withCommit(function () {
|
12417 |
-
this$1._vm._data.$$state = state;
|
12418 |
-
});
|
12419 |
-
};
|
12420 |
-
|
12421 |
-
Store.prototype.registerModule = function registerModule (path, rawModule, options) {
|
12422 |
-
if ( options === void 0 ) options = {};
|
12423 |
-
|
12424 |
-
if (typeof path === 'string') { path = [path]; }
|
12425 |
-
|
12426 |
-
{
|
12427 |
-
assert(Array.isArray(path), "module path must be a string or an Array.");
|
12428 |
-
assert(path.length > 0, 'cannot register the root module by using registerModule.');
|
12429 |
-
}
|
12430 |
-
|
12431 |
-
this._modules.register(path, rawModule);
|
12432 |
-
installModule(this, this.state, path, this._modules.get(path), options.preserveState);
|
12433 |
-
// reset store to update getters...
|
12434 |
-
resetStoreVM(this, this.state);
|
12435 |
-
};
|
12436 |
-
|
12437 |
-
Store.prototype.unregisterModule = function unregisterModule (path) {
|
12438 |
-
var this$1 = this;
|
12439 |
-
|
12440 |
-
if (typeof path === 'string') { path = [path]; }
|
12441 |
-
|
12442 |
-
{
|
12443 |
-
assert(Array.isArray(path), "module path must be a string or an Array.");
|
12444 |
-
}
|
12445 |
-
|
12446 |
-
this._modules.unregister(path);
|
12447 |
-
this._withCommit(function () {
|
12448 |
-
var parentState = getNestedState(this$1.state, path.slice(0, -1));
|
12449 |
-
Vue.delete(parentState, path[path.length - 1]);
|
12450 |
-
});
|
12451 |
-
resetStore(this);
|
12452 |
-
};
|
12453 |
-
|
12454 |
-
Store.prototype.hotUpdate = function hotUpdate (newOptions) {
|
12455 |
-
this._modules.update(newOptions);
|
12456 |
-
resetStore(this, true);
|
12457 |
-
};
|
12458 |
-
|
12459 |
-
Store.prototype._withCommit = function _withCommit (fn) {
|
12460 |
-
var committing = this._committing;
|
12461 |
-
this._committing = true;
|
12462 |
-
fn();
|
12463 |
-
this._committing = committing;
|
12464 |
-
};
|
12465 |
-
|
12466 |
-
Object.defineProperties( Store.prototype, prototypeAccessors$1 );
|
12467 |
-
|
12468 |
-
function genericSubscribe (fn, subs) {
|
12469 |
-
if (subs.indexOf(fn) < 0) {
|
12470 |
-
subs.push(fn);
|
12471 |
-
}
|
12472 |
-
return function () {
|
12473 |
-
var i = subs.indexOf(fn);
|
12474 |
-
if (i > -1) {
|
12475 |
-
subs.splice(i, 1);
|
12476 |
-
}
|
12477 |
-
}
|
12478 |
-
}
|
12479 |
-
|
12480 |
-
function resetStore (store, hot) {
|
12481 |
-
store._actions = Object.create(null);
|
12482 |
-
store._mutations = Object.create(null);
|
12483 |
-
store._wrappedGetters = Object.create(null);
|
12484 |
-
store._modulesNamespaceMap = Object.create(null);
|
12485 |
-
var state = store.state;
|
12486 |
-
// init all modules
|
12487 |
-
installModule(store, state, [], store._modules.root, true);
|
12488 |
-
// reset vm
|
12489 |
-
resetStoreVM(store, state, hot);
|
12490 |
-
}
|
12491 |
-
|
12492 |
-
function resetStoreVM (store, state, hot) {
|
12493 |
-
var oldVm = store._vm;
|
12494 |
-
|
12495 |
-
// bind store public getters
|
12496 |
-
store.getters = {};
|
12497 |
-
var wrappedGetters = store._wrappedGetters;
|
12498 |
-
var computed = {};
|
12499 |
-
forEachValue(wrappedGetters, function (fn, key) {
|
12500 |
-
// use computed to leverage its lazy-caching mechanism
|
12501 |
-
computed[key] = function () { return fn(store); };
|
12502 |
-
Object.defineProperty(store.getters, key, {
|
12503 |
-
get: function () { return store._vm[key]; },
|
12504 |
-
enumerable: true // for local getters
|
12505 |
-
});
|
12506 |
-
});
|
12507 |
-
|
12508 |
-
// use a Vue instance to store the state tree
|
12509 |
-
// suppress warnings just in case the user has added
|
12510 |
-
// some funky global mixins
|
12511 |
-
var silent = Vue.config.silent;
|
12512 |
-
Vue.config.silent = true;
|
12513 |
-
store._vm = new Vue({
|
12514 |
-
data: {
|
12515 |
-
$$state: state
|
12516 |
-
},
|
12517 |
-
computed: computed
|
12518 |
-
});
|
12519 |
-
Vue.config.silent = silent;
|
12520 |
-
|
12521 |
-
// enable strict mode for new vm
|
12522 |
-
if (store.strict) {
|
12523 |
-
enableStrictMode(store);
|
12524 |
-
}
|
12525 |
-
|
12526 |
-
if (oldVm) {
|
12527 |
-
if (hot) {
|
12528 |
-
// dispatch changes in all subscribed watchers
|
12529 |
-
// to force getter re-evaluation for hot reloading.
|
12530 |
-
store._withCommit(function () {
|
12531 |
-
oldVm._data.$$state = null;
|
12532 |
-
});
|
12533 |
-
}
|
12534 |
-
Vue.nextTick(function () { return oldVm.$destroy(); });
|
12535 |
-
}
|
12536 |
-
}
|
12537 |
-
|
12538 |
-
function installModule (store, rootState, path, module, hot) {
|
12539 |
-
var isRoot = !path.length;
|
12540 |
-
var namespace = store._modules.getNamespace(path);
|
12541 |
-
|
12542 |
-
// register in namespace map
|
12543 |
-
if (module.namespaced) {
|
12544 |
-
store._modulesNamespaceMap[namespace] = module;
|
12545 |
-
}
|
12546 |
-
|
12547 |
-
// set state
|
12548 |
-
if (!isRoot && !hot) {
|
12549 |
-
var parentState = getNestedState(rootState, path.slice(0, -1));
|
12550 |
-
var moduleName = path[path.length - 1];
|
12551 |
-
store._withCommit(function () {
|
12552 |
-
Vue.set(parentState, moduleName, module.state);
|
12553 |
-
});
|
12554 |
-
}
|
12555 |
-
|
12556 |
-
var local = module.context = makeLocalContext(store, namespace, path);
|
12557 |
-
|
12558 |
-
module.forEachMutation(function (mutation, key) {
|
12559 |
-
var namespacedType = namespace + key;
|
12560 |
-
registerMutation(store, namespacedType, mutation, local);
|
12561 |
-
});
|
12562 |
-
|
12563 |
-
module.forEachAction(function (action, key) {
|
12564 |
-
var type = action.root ? key : namespace + key;
|
12565 |
-
var handler = action.handler || action;
|
12566 |
-
registerAction(store, type, handler, local);
|
12567 |
-
});
|
12568 |
-
|
12569 |
-
module.forEachGetter(function (getter, key) {
|
12570 |
-
var namespacedType = namespace + key;
|
12571 |
-
registerGetter(store, namespacedType, getter, local);
|
12572 |
-
});
|
12573 |
-
|
12574 |
-
module.forEachChild(function (child, key) {
|
12575 |
-
installModule(store, rootState, path.concat(key), child, hot);
|
12576 |
-
});
|
12577 |
-
}
|
12578 |
-
|
12579 |
-
/**
|
12580 |
-
* make localized dispatch, commit, getters and state
|
12581 |
-
* if there is no namespace, just use root ones
|
12582 |
-
*/
|
12583 |
-
function makeLocalContext (store, namespace, path) {
|
12584 |
-
var noNamespace = namespace === '';
|
12585 |
-
|
12586 |
-
var local = {
|
12587 |
-
dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
|
12588 |
-
var args = unifyObjectStyle(_type, _payload, _options);
|
12589 |
-
var payload = args.payload;
|
12590 |
-
var options = args.options;
|
12591 |
-
var type = args.type;
|
12592 |
-
|
12593 |
-
if (!options || !options.root) {
|
12594 |
-
type = namespace + type;
|
12595 |
-
if (!store._actions[type]) {
|
12596 |
-
console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
|
12597 |
-
return
|
12598 |
-
}
|
12599 |
-
}
|
12600 |
-
|
12601 |
-
return store.dispatch(type, payload)
|
12602 |
-
},
|
12603 |
-
|
12604 |
-
commit: noNamespace ? store.commit : function (_type, _payload, _options) {
|
12605 |
-
var args = unifyObjectStyle(_type, _payload, _options);
|
12606 |
-
var payload = args.payload;
|
12607 |
-
var options = args.options;
|
12608 |
-
var type = args.type;
|
12609 |
-
|
12610 |
-
if (!options || !options.root) {
|
12611 |
-
type = namespace + type;
|
12612 |
-
if (!store._mutations[type]) {
|
12613 |
-
console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
|
12614 |
-
return
|
12615 |
-
}
|
12616 |
-
}
|
12617 |
-
|
12618 |
-
store.commit(type, payload, options);
|
12619 |
-
}
|
12620 |
-
};
|
12621 |
-
|
12622 |
-
// getters and state object must be gotten lazily
|
12623 |
-
// because they will be changed by vm update
|
12624 |
-
Object.defineProperties(local, {
|
12625 |
-
getters: {
|
12626 |
-
get: noNamespace
|
12627 |
-
? function () { return store.getters; }
|
12628 |
-
: function () { return makeLocalGetters(store, namespace); }
|
12629 |
-
},
|
12630 |
-
state: {
|
12631 |
-
get: function () { return getNestedState(store.state, path); }
|
12632 |
-
}
|
12633 |
-
});
|
12634 |
-
|
12635 |
-
return local
|
12636 |
-
}
|
12637 |
-
|
12638 |
-
function makeLocalGetters (store, namespace) {
|
12639 |
-
var gettersProxy = {};
|
12640 |
-
|
12641 |
-
var splitPos = namespace.length;
|
12642 |
-
Object.keys(store.getters).forEach(function (type) {
|
12643 |
-
// skip if the target getter is not match this namespace
|
12644 |
-
if (type.slice(0, splitPos) !== namespace) { return }
|
12645 |
-
|
12646 |
-
// extract local getter type
|
12647 |
-
var localType = type.slice(splitPos);
|
12648 |
-
|
12649 |
-
// Add a port to the getters proxy.
|
12650 |
-
// Define as getter property because
|
12651 |
-
// we do not want to evaluate the getters in this time.
|
12652 |
-
Object.defineProperty(gettersProxy, localType, {
|
12653 |
-
get: function () { return store.getters[type]; },
|
12654 |
-
enumerable: true
|
12655 |
-
});
|
12656 |
-
});
|
12657 |
-
|
12658 |
-
return gettersProxy
|
12659 |
-
}
|
12660 |
-
|
12661 |
-
function registerMutation (store, type, handler, local) {
|
12662 |
-
var entry = store._mutations[type] || (store._mutations[type] = []);
|
12663 |
-
entry.push(function wrappedMutationHandler (payload) {
|
12664 |
-
handler.call(store, local.state, payload);
|
12665 |
-
});
|
12666 |
-
}
|
12667 |
-
|
12668 |
-
function registerAction (store, type, handler, local) {
|
12669 |
-
var entry = store._actions[type] || (store._actions[type] = []);
|
12670 |
-
entry.push(function wrappedActionHandler (payload, cb) {
|
12671 |
-
var res = handler.call(store, {
|
12672 |
-
dispatch: local.dispatch,
|
12673 |
-
commit: local.commit,
|
12674 |
-
getters: local.getters,
|
12675 |
-
state: local.state,
|
12676 |
-
rootGetters: store.getters,
|
12677 |
-
rootState: store.state
|
12678 |
-
}, payload, cb);
|
12679 |
-
if (!isPromise(res)) {
|
12680 |
-
res = Promise.resolve(res);
|
12681 |
-
}
|
12682 |
-
if (store._devtoolHook) {
|
12683 |
-
return res.catch(function (err) {
|
12684 |
-
store._devtoolHook.emit('vuex:error', err);
|
12685 |
-
throw err
|
12686 |
-
})
|
12687 |
-
} else {
|
12688 |
-
return res
|
12689 |
-
}
|
12690 |
-
});
|
12691 |
-
}
|
12692 |
-
|
12693 |
-
function registerGetter (store, type, rawGetter, local) {
|
12694 |
-
if (store._wrappedGetters[type]) {
|
12695 |
-
{
|
12696 |
-
console.error(("[vuex] duplicate getter key: " + type));
|
12697 |
-
}
|
12698 |
-
return
|
12699 |
-
}
|
12700 |
-
store._wrappedGetters[type] = function wrappedGetter (store) {
|
12701 |
-
return rawGetter(
|
12702 |
-
local.state, // local state
|
12703 |
-
local.getters, // local getters
|
12704 |
-
store.state, // root state
|
12705 |
-
store.getters // root getters
|
12706 |
-
)
|
12707 |
-
};
|
12708 |
-
}
|
12709 |
-
|
12710 |
-
function enableStrictMode (store) {
|
12711 |
-
store._vm.$watch(function () { return this._data.$$state }, function () {
|
12712 |
-
{
|
12713 |
-
assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
|
12714 |
-
}
|
12715 |
-
}, { deep: true, sync: true });
|
12716 |
-
}
|
12717 |
-
|
12718 |
-
function getNestedState (state, path) {
|
12719 |
-
return path.length
|
12720 |
-
? path.reduce(function (state, key) { return state[key]; }, state)
|
12721 |
-
: state
|
12722 |
-
}
|
12723 |
-
|
12724 |
-
function unifyObjectStyle (type, payload, options) {
|
12725 |
-
if (isObject(type) && type.type) {
|
12726 |
-
options = payload;
|
12727 |
-
payload = type;
|
12728 |
-
type = type.type;
|
12729 |
-
}
|
12730 |
-
|
12731 |
-
{
|
12732 |
-
assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + "."));
|
12733 |
-
}
|
12734 |
-
|
12735 |
-
return { type: type, payload: payload, options: options }
|
12736 |
-
}
|
12737 |
-
|
12738 |
-
function install (_Vue) {
|
12739 |
-
if (Vue && _Vue === Vue) {
|
12740 |
-
{
|
12741 |
-
console.error(
|
12742 |
-
'[vuex] already installed. Vue.use(Vuex) should be called only once.'
|
12743 |
-
);
|
12744 |
-
}
|
12745 |
-
return
|
12746 |
-
}
|
12747 |
-
Vue = _Vue;
|
12748 |
-
applyMixin(Vue);
|
12749 |
-
}
|
12750 |
-
|
12751 |
-
/**
|
12752 |
-
* Reduce the code which written in Vue.js for getting the state.
|
12753 |
-
* @param {String} [namespace] - Module's namespace
|
12754 |
-
* @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.
|
12755 |
-
* @param {Object}
|
12756 |
-
*/
|
12757 |
-
var mapState = normalizeNamespace(function (namespace, states) {
|
12758 |
-
var res = {};
|
12759 |
-
normalizeMap(states).forEach(function (ref) {
|
12760 |
-
var key = ref.key;
|
12761 |
-
var val = ref.val;
|
12762 |
-
|
12763 |
-
res[key] = function mappedState () {
|
12764 |
-
var state = this.$store.state;
|
12765 |
-
var getters = this.$store.getters;
|
12766 |
-
if (namespace) {
|
12767 |
-
var module = getModuleByNamespace(this.$store, 'mapState', namespace);
|
12768 |
-
if (!module) {
|
12769 |
-
return
|
12770 |
-
}
|
12771 |
-
state = module.context.state;
|
12772 |
-
getters = module.context.getters;
|
12773 |
-
}
|
12774 |
-
return typeof val === 'function'
|
12775 |
-
? val.call(this, state, getters)
|
12776 |
-
: state[val]
|
12777 |
-
};
|
12778 |
-
// mark vuex getter for devtools
|
12779 |
-
res[key].vuex = true;
|
12780 |
-
});
|
12781 |
-
return res
|
12782 |
-
});
|
12783 |
-
|
12784 |
-
/**
|
12785 |
-
* Reduce the code which written in Vue.js for committing the mutation
|
12786 |
-
* @param {String} [namespace] - Module's namespace
|
12787 |
-
* @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept anthor params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped
|
12788 |
-
* @return {Object}
|
12789 |
-
*/
|
12790 |
-
var mapMutations = normalizeNamespace(function (namespace, mutations) {
|
12791 |
-
var res = {};
|
12792 |
-
normalizeMap(mutations).forEach(function (ref) {
|
12793 |
-
var key = ref.key;
|
12794 |
-
var val = ref.val;
|
12795 |
-
|
12796 |
-
res[key] = function mappedMutation () {
|
12797 |
-
var args = [], len = arguments.length;
|
12798 |
-
while ( len-- ) args[ len ] = arguments[ len ];
|
12799 |
-
|
12800 |
-
// Get the commit method from store
|
12801 |
-
var commit = this.$store.commit;
|
12802 |
-
if (namespace) {
|
12803 |
-
var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
|
12804 |
-
if (!module) {
|
12805 |
-
return
|
12806 |
-
}
|
12807 |
-
commit = module.context.commit;
|
12808 |
-
}
|
12809 |
-
return typeof val === 'function'
|
12810 |
-
? val.apply(this, [commit].concat(args))
|
12811 |
-
: commit.apply(this.$store, [val].concat(args))
|
12812 |
-
};
|
12813 |
-
});
|
12814 |
-
return res
|
12815 |
-
});
|
12816 |
-
|
12817 |
-
/**
|
12818 |
-
* Reduce the code which written in Vue.js for getting the getters
|
12819 |
-
* @param {String} [namespace] - Module's namespace
|
12820 |
-
* @param {Object|Array} getters
|
12821 |
-
* @return {Object}
|
12822 |
-
*/
|
12823 |
-
var mapGetters = normalizeNamespace(function (namespace, getters) {
|
12824 |
-
var res = {};
|
12825 |
-
normalizeMap(getters).forEach(function (ref) {
|
12826 |
-
var key = ref.key;
|
12827 |
-
var val = ref.val;
|
12828 |
-
|
12829 |
-
// The namespace has been mutated by normalizeNamespace
|
12830 |
-
val = namespace + val;
|
12831 |
-
res[key] = function mappedGetter () {
|
12832 |
-
if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
|
12833 |
-
return
|
12834 |
-
}
|
12835 |
-
if (!(val in this.$store.getters)) {
|
12836 |
-
console.error(("[vuex] unknown getter: " + val));
|
12837 |
-
return
|
12838 |
-
}
|
12839 |
-
return this.$store.getters[val]
|
12840 |
-
};
|
12841 |
-
// mark vuex getter for devtools
|
12842 |
-
res[key].vuex = true;
|
12843 |
-
});
|
12844 |
-
return res
|
12845 |
-
});
|
12846 |
-
|
12847 |
-
/**
|
12848 |
-
* Reduce the code which written in Vue.js for dispatch the action
|
12849 |
-
* @param {String} [namespace] - Module's namespace
|
12850 |
-
* @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.
|
12851 |
-
* @return {Object}
|
12852 |
-
*/
|
12853 |
-
var mapActions = normalizeNamespace(function (namespace, actions) {
|
12854 |
-
var res = {};
|
12855 |
-
normalizeMap(actions).forEach(function (ref) {
|
12856 |
-
var key = ref.key;
|
12857 |
-
var val = ref.val;
|
12858 |
-
|
12859 |
-
res[key] = function mappedAction () {
|
12860 |
-
var args = [], len = arguments.length;
|
12861 |
-
while ( len-- ) args[ len ] = arguments[ len ];
|
12862 |
-
|
12863 |
-
// get dispatch function from store
|
12864 |
-
var dispatch = this.$store.dispatch;
|
12865 |
-
if (namespace) {
|
12866 |
-
var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
|
12867 |
-
if (!module) {
|
12868 |
-
return
|
12869 |
-
}
|
12870 |
-
dispatch = module.context.dispatch;
|
12871 |
-
}
|
12872 |
-
return typeof val === 'function'
|
12873 |
-
? val.apply(this, [dispatch].concat(args))
|
12874 |
-
: dispatch.apply(this.$store, [val].concat(args))
|
12875 |
-
};
|
12876 |
-
});
|
12877 |
-
return res
|
12878 |
-
});
|
12879 |
-
|
12880 |
-
/**
|
12881 |
-
* Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
|
12882 |
-
* @param {String} namespace
|
12883 |
-
* @return {Object}
|
12884 |
-
*/
|
12885 |
-
var createNamespacedHelpers = function (namespace) { return ({
|
12886 |
-
mapState: mapState.bind(null, namespace),
|
12887 |
-
mapGetters: mapGetters.bind(null, namespace),
|
12888 |
-
mapMutations: mapMutations.bind(null, namespace),
|
12889 |
-
mapActions: mapActions.bind(null, namespace)
|
12890 |
-
}); };
|
12891 |
-
|
12892 |
-
/**
|
12893 |
-
* Normalize the map
|
12894 |
-
* normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
|
12895 |
-
* normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
|
12896 |
-
* @param {Array|Object} map
|
12897 |
-
* @return {Object}
|
12898 |
-
*/
|
12899 |
-
function normalizeMap (map) {
|
12900 |
-
return Array.isArray(map)
|
12901 |
-
? map.map(function (key) { return ({ key: key, val: key }); })
|
12902 |
-
: Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
|
12903 |
-
}
|
12904 |
-
|
12905 |
-
/**
|
12906 |
-
* Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.
|
12907 |
-
* @param {Function} fn
|
12908 |
-
* @return {Function}
|
12909 |
-
*/
|
12910 |
-
function normalizeNamespace (fn) {
|
12911 |
-
return function (namespace, map) {
|
12912 |
-
if (typeof namespace !== 'string') {
|
12913 |
-
map = namespace;
|
12914 |
-
namespace = '';
|
12915 |
-
} else if (namespace.charAt(namespace.length - 1) !== '/') {
|
12916 |
-
namespace += '/';
|
12917 |
-
}
|
12918 |
-
return fn(namespace, map)
|
12919 |
-
}
|
12920 |
-
}
|
12921 |
-
|
12922 |
-
/**
|
12923 |
-
* Search a special module from store by namespace. if module not exist, print error message.
|
12924 |
-
* @param {Object} store
|
12925 |
-
* @param {String} helper
|
12926 |
-
* @param {String} namespace
|
12927 |
-
* @return {Object}
|
12928 |
-
*/
|
12929 |
-
function getModuleByNamespace (store, helper, namespace) {
|
12930 |
-
var module = store._modulesNamespaceMap[namespace];
|
12931 |
-
if (!module) {
|
12932 |
-
console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace));
|
12933 |
-
}
|
12934 |
-
return module
|
12935 |
-
}
|
12936 |
-
|
12937 |
-
var index = {
|
12938 |
-
Store: Store,
|
12939 |
-
install: install,
|
12940 |
-
version: '3.1.0',
|
12941 |
-
mapState: mapState,
|
12942 |
-
mapMutations: mapMutations,
|
12943 |
-
mapGetters: mapGetters,
|
12944 |
-
mapActions: mapActions,
|
12945 |
-
createNamespacedHelpers: createNamespacedHelpers
|
12946 |
-
};
|
12947 |
-
|
12948 |
-
return index;
|
12949 |
-
|
1 |
+
/*!
|
2 |
+
* Vue.js v2.6.10
|
3 |
+
* (c) 2014-2019 Evan You
|
4 |
+
* Released under the MIT License.
|
5 |
+
*/
|
6 |
+
|
7 |
+
(function (global, factory) {
|
8 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
9 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
10 |
+
(global = global || self, global.Vue = factory());
|
11 |
+
}(this, function () { 'use strict';
|
12 |
+
|
13 |
+
/* */
|
14 |
+
|
15 |
+
var emptyObject = Object.freeze({});
|
16 |
+
|
17 |
+
// These helpers produce better VM code in JS engines due to their
|
18 |
+
// explicitness and function inlining.
|
19 |
+
function isUndef (v) {
|
20 |
+
return v === undefined || v === null
|
21 |
+
}
|
22 |
+
|
23 |
+
function isDef (v) {
|
24 |
+
return v !== undefined && v !== null
|
25 |
+
}
|
26 |
+
|
27 |
+
function isTrue (v) {
|
28 |
+
return v === true
|
29 |
+
}
|
30 |
+
|
31 |
+
function isFalse (v) {
|
32 |
+
return v === false
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Check if value is primitive.
|
37 |
+
*/
|
38 |
+
function isPrimitive (value) {
|
39 |
+
return (
|
40 |
+
typeof value === 'string' ||
|
41 |
+
typeof value === 'number' ||
|
42 |
+
// $flow-disable-line
|
43 |
+
typeof value === 'symbol' ||
|
44 |
+
typeof value === 'boolean'
|
45 |
+
)
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Quick object check - this is primarily used to tell
|
50 |
+
* Objects from primitive values when we know the value
|
51 |
+
* is a JSON-compliant type.
|
52 |
+
*/
|
53 |
+
function isObject (obj) {
|
54 |
+
return obj !== null && typeof obj === 'object'
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get the raw type string of a value, e.g., [object Object].
|
59 |
+
*/
|
60 |
+
var _toString = Object.prototype.toString;
|
61 |
+
|
62 |
+
function toRawType (value) {
|
63 |
+
return _toString.call(value).slice(8, -1)
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Strict object type check. Only returns true
|
68 |
+
* for plain JavaScript objects.
|
69 |
+
*/
|
70 |
+
function isPlainObject (obj) {
|
71 |
+
return _toString.call(obj) === '[object Object]'
|
72 |
+
}
|
73 |
+
|
74 |
+
function isRegExp (v) {
|
75 |
+
return _toString.call(v) === '[object RegExp]'
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Check if val is a valid array index.
|
80 |
+
*/
|
81 |
+
function isValidArrayIndex (val) {
|
82 |
+
var n = parseFloat(String(val));
|
83 |
+
return n >= 0 && Math.floor(n) === n && isFinite(val)
|
84 |
+
}
|
85 |
+
|
86 |
+
function isPromise (val) {
|
87 |
+
return (
|
88 |
+
isDef(val) &&
|
89 |
+
typeof val.then === 'function' &&
|
90 |
+
typeof val.catch === 'function'
|
91 |
+
)
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Convert a value to a string that is actually rendered.
|
96 |
+
*/
|
97 |
+
function toString (val) {
|
98 |
+
return val == null
|
99 |
+
? ''
|
100 |
+
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
101 |
+
? JSON.stringify(val, null, 2)
|
102 |
+
: String(val)
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Convert an input value to a number for persistence.
|
107 |
+
* If the conversion fails, return original string.
|
108 |
+
*/
|
109 |
+
function toNumber (val) {
|
110 |
+
var n = parseFloat(val);
|
111 |
+
return isNaN(n) ? val : n
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Make a map and return a function for checking if a key
|
116 |
+
* is in that map.
|
117 |
+
*/
|
118 |
+
function makeMap (
|
119 |
+
str,
|
120 |
+
expectsLowerCase
|
121 |
+
) {
|
122 |
+
var map = Object.create(null);
|
123 |
+
var list = str.split(',');
|
124 |
+
for (var i = 0; i < list.length; i++) {
|
125 |
+
map[list[i]] = true;
|
126 |
+
}
|
127 |
+
return expectsLowerCase
|
128 |
+
? function (val) { return map[val.toLowerCase()]; }
|
129 |
+
: function (val) { return map[val]; }
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Check if a tag is a built-in tag.
|
134 |
+
*/
|
135 |
+
var isBuiltInTag = makeMap('slot,component', true);
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Check if an attribute is a reserved attribute.
|
139 |
+
*/
|
140 |
+
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Remove an item from an array.
|
144 |
+
*/
|
145 |
+
function remove (arr, item) {
|
146 |
+
if (arr.length) {
|
147 |
+
var index = arr.indexOf(item);
|
148 |
+
if (index > -1) {
|
149 |
+
return arr.splice(index, 1)
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Check whether an object has the property.
|
156 |
+
*/
|
157 |
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
158 |
+
function hasOwn (obj, key) {
|
159 |
+
return hasOwnProperty.call(obj, key)
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Create a cached version of a pure function.
|
164 |
+
*/
|
165 |
+
function cached (fn) {
|
166 |
+
var cache = Object.create(null);
|
167 |
+
return (function cachedFn (str) {
|
168 |
+
var hit = cache[str];
|
169 |
+
return hit || (cache[str] = fn(str))
|
170 |
+
})
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Camelize a hyphen-delimited string.
|
175 |
+
*/
|
176 |
+
var camelizeRE = /-(\w)/g;
|
177 |
+
var camelize = cached(function (str) {
|
178 |
+
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
179 |
+
});
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Capitalize a string.
|
183 |
+
*/
|
184 |
+
var capitalize = cached(function (str) {
|
185 |
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
186 |
+
});
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Hyphenate a camelCase string.
|
190 |
+
*/
|
191 |
+
var hyphenateRE = /\B([A-Z])/g;
|
192 |
+
var hyphenate = cached(function (str) {
|
193 |
+
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
194 |
+
});
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Simple bind polyfill for environments that do not support it,
|
198 |
+
* e.g., PhantomJS 1.x. Technically, we don't need this anymore
|
199 |
+
* since native bind is now performant enough in most browsers.
|
200 |
+
* But removing it would mean breaking code that was able to run in
|
201 |
+
* PhantomJS 1.x, so this must be kept for backward compatibility.
|
202 |
+
*/
|
203 |
+
|
204 |
+
/* istanbul ignore next */
|
205 |
+
function polyfillBind (fn, ctx) {
|
206 |
+
function boundFn (a) {
|
207 |
+
var l = arguments.length;
|
208 |
+
return l
|
209 |
+
? l > 1
|
210 |
+
? fn.apply(ctx, arguments)
|
211 |
+
: fn.call(ctx, a)
|
212 |
+
: fn.call(ctx)
|
213 |
+
}
|
214 |
+
|
215 |
+
boundFn._length = fn.length;
|
216 |
+
return boundFn
|
217 |
+
}
|
218 |
+
|
219 |
+
function nativeBind (fn, ctx) {
|
220 |
+
return fn.bind(ctx)
|
221 |
+
}
|
222 |
+
|
223 |
+
var bind = Function.prototype.bind
|
224 |
+
? nativeBind
|
225 |
+
: polyfillBind;
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Convert an Array-like object to a real Array.
|
229 |
+
*/
|
230 |
+
function toArray (list, start) {
|
231 |
+
start = start || 0;
|
232 |
+
var i = list.length - start;
|
233 |
+
var ret = new Array(i);
|
234 |
+
while (i--) {
|
235 |
+
ret[i] = list[i + start];
|
236 |
+
}
|
237 |
+
return ret
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Mix properties into target object.
|
242 |
+
*/
|
243 |
+
function extend (to, _from) {
|
244 |
+
for (var key in _from) {
|
245 |
+
to[key] = _from[key];
|
246 |
+
}
|
247 |
+
return to
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Merge an Array of Objects into a single Object.
|
252 |
+
*/
|
253 |
+
function toObject (arr) {
|
254 |
+
var res = {};
|
255 |
+
for (var i = 0; i < arr.length; i++) {
|
256 |
+
if (arr[i]) {
|
257 |
+
extend(res, arr[i]);
|
258 |
+
}
|
259 |
+
}
|
260 |
+
return res
|
261 |
+
}
|
262 |
+
|
263 |
+
/* eslint-disable no-unused-vars */
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Perform no operation.
|
267 |
+
* Stubbing args to make Flow happy without leaving useless transpiled code
|
268 |
+
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
|
269 |
+
*/
|
270 |
+
function noop (a, b, c) {}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Always return false.
|
274 |
+
*/
|
275 |
+
var no = function (a, b, c) { return false; };
|
276 |
+
|
277 |
+
/* eslint-enable no-unused-vars */
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Return the same value.
|
281 |
+
*/
|
282 |
+
var identity = function (_) { return _; };
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Generate a string containing static keys from compiler modules.
|
286 |
+
*/
|
287 |
+
function genStaticKeys (modules) {
|
288 |
+
return modules.reduce(function (keys, m) {
|
289 |
+
return keys.concat(m.staticKeys || [])
|
290 |
+
}, []).join(',')
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Check if two values are loosely equal - that is,
|
295 |
+
* if they are plain objects, do they have the same shape?
|
296 |
+
*/
|
297 |
+
function looseEqual (a, b) {
|
298 |
+
if (a === b) { return true }
|
299 |
+
var isObjectA = isObject(a);
|
300 |
+
var isObjectB = isObject(b);
|
301 |
+
if (isObjectA && isObjectB) {
|
302 |
+
try {
|
303 |
+
var isArrayA = Array.isArray(a);
|
304 |
+
var isArrayB = Array.isArray(b);
|
305 |
+
if (isArrayA && isArrayB) {
|
306 |
+
return a.length === b.length && a.every(function (e, i) {
|
307 |
+
return looseEqual(e, b[i])
|
308 |
+
})
|
309 |
+
} else if (a instanceof Date && b instanceof Date) {
|
310 |
+
return a.getTime() === b.getTime()
|
311 |
+
} else if (!isArrayA && !isArrayB) {
|
312 |
+
var keysA = Object.keys(a);
|
313 |
+
var keysB = Object.keys(b);
|
314 |
+
return keysA.length === keysB.length && keysA.every(function (key) {
|
315 |
+
return looseEqual(a[key], b[key])
|
316 |
+
})
|
317 |
+
} else {
|
318 |
+
/* istanbul ignore next */
|
319 |
+
return false
|
320 |
+
}
|
321 |
+
} catch (e) {
|
322 |
+
/* istanbul ignore next */
|
323 |
+
return false
|
324 |
+
}
|
325 |
+
} else if (!isObjectA && !isObjectB) {
|
326 |
+
return String(a) === String(b)
|
327 |
+
} else {
|
328 |
+
return false
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Return the first index at which a loosely equal value can be
|
334 |
+
* found in the array (if value is a plain object, the array must
|
335 |
+
* contain an object of the same shape), or -1 if it is not present.
|
336 |
+
*/
|
337 |
+
function looseIndexOf (arr, val) {
|
338 |
+
for (var i = 0; i < arr.length; i++) {
|
339 |
+
if (looseEqual(arr[i], val)) { return i }
|
340 |
+
}
|
341 |
+
return -1
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Ensure a function is called only once.
|
346 |
+
*/
|
347 |
+
function once (fn) {
|
348 |
+
var called = false;
|
349 |
+
return function () {
|
350 |
+
if (!called) {
|
351 |
+
called = true;
|
352 |
+
fn.apply(this, arguments);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
var SSR_ATTR = 'data-server-rendered';
|
358 |
+
|
359 |
+
var ASSET_TYPES = [
|
360 |
+
'component',
|
361 |
+
'directive',
|
362 |
+
'filter'
|
363 |
+
];
|
364 |
+
|
365 |
+
var LIFECYCLE_HOOKS = [
|
366 |
+
'beforeCreate',
|
367 |
+
'created',
|
368 |
+
'beforeMount',
|
369 |
+
'mounted',
|
370 |
+
'beforeUpdate',
|
371 |
+
'updated',
|
372 |
+
'beforeDestroy',
|
373 |
+
'destroyed',
|
374 |
+
'activated',
|
375 |
+
'deactivated',
|
376 |
+
'errorCaptured',
|
377 |
+
'serverPrefetch'
|
378 |
+
];
|
379 |
+
|
380 |
+
/* */
|
381 |
+
|
382 |
+
|
383 |
+
|
384 |
+
var config = ({
|
385 |
+
/**
|
386 |
+
* Option merge strategies (used in core/util/options)
|
387 |
+
*/
|
388 |
+
// $flow-disable-line
|
389 |
+
optionMergeStrategies: Object.create(null),
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Whether to suppress warnings.
|
393 |
+
*/
|
394 |
+
silent: false,
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Show production mode tip message on boot?
|
398 |
+
*/
|
399 |
+
productionTip: "development" !== 'production',
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Whether to enable devtools
|
403 |
+
*/
|
404 |
+
devtools: "development" !== 'production',
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Whether to record perf
|
408 |
+
*/
|
409 |
+
performance: false,
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Error handler for watcher errors
|
413 |
+
*/
|
414 |
+
errorHandler: null,
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Warn handler for watcher warns
|
418 |
+
*/
|
419 |
+
warnHandler: null,
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Ignore certain custom elements
|
423 |
+
*/
|
424 |
+
ignoredElements: [],
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Custom user key aliases for v-on
|
428 |
+
*/
|
429 |
+
// $flow-disable-line
|
430 |
+
keyCodes: Object.create(null),
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Check if a tag is reserved so that it cannot be registered as a
|
434 |
+
* component. This is platform-dependent and may be overwritten.
|
435 |
+
*/
|
436 |
+
isReservedTag: no,
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Check if an attribute is reserved so that it cannot be used as a component
|
440 |
+
* prop. This is platform-dependent and may be overwritten.
|
441 |
+
*/
|
442 |
+
isReservedAttr: no,
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Check if a tag is an unknown element.
|
446 |
+
* Platform-dependent.
|
447 |
+
*/
|
448 |
+
isUnknownElement: no,
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Get the namespace of an element
|
452 |
+
*/
|
453 |
+
getTagNamespace: noop,
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Parse the real tag name for the specific platform.
|
457 |
+
*/
|
458 |
+
parsePlatformTagName: identity,
|
459 |
+
|
460 |
+
/**
|
461 |
+
* Check if an attribute must be bound using property, e.g. value
|
462 |
+
* Platform-dependent.
|
463 |
+
*/
|
464 |
+
mustUseProp: no,
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Perform updates asynchronously. Intended to be used by Vue Test Utils
|
468 |
+
* This will significantly reduce performance if set to false.
|
469 |
+
*/
|
470 |
+
async: true,
|
471 |
+
|
472 |
+
/**
|
473 |
+
* Exposed for legacy reasons
|
474 |
+
*/
|
475 |
+
_lifecycleHooks: LIFECYCLE_HOOKS
|
476 |
+
});
|
477 |
+
|
478 |
+
/* */
|
479 |
+
|
480 |
+
/**
|
481 |
+
* unicode letters used for parsing html tags, component names and property paths.
|
482 |
+
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
483 |
+
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
484 |
+
*/
|
485 |
+
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Check if a string starts with $ or _
|
489 |
+
*/
|
490 |
+
function isReserved (str) {
|
491 |
+
var c = (str + '').charCodeAt(0);
|
492 |
+
return c === 0x24 || c === 0x5F
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* Define a property.
|
497 |
+
*/
|
498 |
+
function def (obj, key, val, enumerable) {
|
499 |
+
Object.defineProperty(obj, key, {
|
500 |
+
value: val,
|
501 |
+
enumerable: !!enumerable,
|
502 |
+
writable: true,
|
503 |
+
configurable: true
|
504 |
+
});
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Parse simple path.
|
509 |
+
*/
|
510 |
+
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
|
511 |
+
function parsePath (path) {
|
512 |
+
if (bailRE.test(path)) {
|
513 |
+
return
|
514 |
+
}
|
515 |
+
var segments = path.split('.');
|
516 |
+
return function (obj) {
|
517 |
+
for (var i = 0; i < segments.length; i++) {
|
518 |
+
if (!obj) { return }
|
519 |
+
obj = obj[segments[i]];
|
520 |
+
}
|
521 |
+
return obj
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
/* */
|
526 |
+
|
527 |
+
// can we use __proto__?
|
528 |
+
var hasProto = '__proto__' in {};
|
529 |
+
|
530 |
+
// Browser environment sniffing
|
531 |
+
var inBrowser = typeof window !== 'undefined';
|
532 |
+
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
533 |
+
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
534 |
+
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
535 |
+
var isIE = UA && /msie|trident/.test(UA);
|
536 |
+
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
537 |
+
var isEdge = UA && UA.indexOf('edge/') > 0;
|
538 |
+
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
539 |
+
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
540 |
+
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
541 |
+
var isPhantomJS = UA && /phantomjs/.test(UA);
|
542 |
+
var isFF = UA && UA.match(/firefox\/(\d+)/);
|
543 |
+
|
544 |
+
// Firefox has a "watch" function on Object.prototype...
|
545 |
+
var nativeWatch = ({}).watch;
|
546 |
+
|
547 |
+
var supportsPassive = false;
|
548 |
+
if (inBrowser) {
|
549 |
+
try {
|
550 |
+
var opts = {};
|
551 |
+
Object.defineProperty(opts, 'passive', ({
|
552 |
+
get: function get () {
|
553 |
+
/* istanbul ignore next */
|
554 |
+
supportsPassive = true;
|
555 |
+
}
|
556 |
+
})); // https://github.com/facebook/flow/issues/285
|
557 |
+
window.addEventListener('test-passive', null, opts);
|
558 |
+
} catch (e) {}
|
559 |
+
}
|
560 |
+
|
561 |
+
// this needs to be lazy-evaled because vue may be required before
|
562 |
+
// vue-server-renderer can set VUE_ENV
|
563 |
+
var _isServer;
|
564 |
+
var isServerRendering = function () {
|
565 |
+
if (_isServer === undefined) {
|
566 |
+
/* istanbul ignore if */
|
567 |
+
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
568 |
+
// detect presence of vue-server-renderer and avoid
|
569 |
+
// Webpack shimming the process
|
570 |
+
_isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
571 |
+
} else {
|
572 |
+
_isServer = false;
|
573 |
+
}
|
574 |
+
}
|
575 |
+
return _isServer
|
576 |
+
};
|
577 |
+
|
578 |
+
// detect devtools
|
579 |
+
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
580 |
+
|
581 |
+
/* istanbul ignore next */
|
582 |
+
function isNative (Ctor) {
|
583 |
+
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
584 |
+
}
|
585 |
+
|
586 |
+
var hasSymbol =
|
587 |
+
typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
588 |
+
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
589 |
+
|
590 |
+
var _Set;
|
591 |
+
/* istanbul ignore if */ // $flow-disable-line
|
592 |
+
if (typeof Set !== 'undefined' && isNative(Set)) {
|
593 |
+
// use native Set when available.
|
594 |
+
_Set = Set;
|
595 |
+
} else {
|
596 |
+
// a non-standard Set polyfill that only works with primitive keys.
|
597 |
+
_Set = /*@__PURE__*/(function () {
|
598 |
+
function Set () {
|
599 |
+
this.set = Object.create(null);
|
600 |
+
}
|
601 |
+
Set.prototype.has = function has (key) {
|
602 |
+
return this.set[key] === true
|
603 |
+
};
|
604 |
+
Set.prototype.add = function add (key) {
|
605 |
+
this.set[key] = true;
|
606 |
+
};
|
607 |
+
Set.prototype.clear = function clear () {
|
608 |
+
this.set = Object.create(null);
|
609 |
+
};
|
610 |
+
|
611 |
+
return Set;
|
612 |
+
}());
|
613 |
+
}
|
614 |
+
|
615 |
+
/* */
|
616 |
+
|
617 |
+
var warn = noop;
|
618 |
+
var tip = noop;
|
619 |
+
var generateComponentTrace = (noop); // work around flow check
|
620 |
+
var formatComponentName = (noop);
|
621 |
+
|
622 |
+
{
|
623 |
+
var hasConsole = typeof console !== 'undefined';
|
624 |
+
var classifyRE = /(?:^|[-_])(\w)/g;
|
625 |
+
var classify = function (str) { return str
|
626 |
+
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
627 |
+
.replace(/[-_]/g, ''); };
|
628 |
+
|
629 |
+
warn = function (msg, vm) {
|
630 |
+
var trace = vm ? generateComponentTrace(vm) : '';
|
631 |
+
|
632 |
+
if (config.warnHandler) {
|
633 |
+
config.warnHandler.call(null, msg, vm, trace);
|
634 |
+
} else if (hasConsole && (!config.silent)) {
|
635 |
+
console.error(("[Vue warn]: " + msg + trace));
|
636 |
+
}
|
637 |
+
};
|
638 |
+
|
639 |
+
tip = function (msg, vm) {
|
640 |
+
if (hasConsole && (!config.silent)) {
|
641 |
+
console.warn("[Vue tip]: " + msg + (
|
642 |
+
vm ? generateComponentTrace(vm) : ''
|
643 |
+
));
|
644 |
+
}
|
645 |
+
};
|
646 |
+
|
647 |
+
formatComponentName = function (vm, includeFile) {
|
648 |
+
if (vm.$root === vm) {
|
649 |
+
return '<Root>'
|
650 |
+
}
|
651 |
+
var options = typeof vm === 'function' && vm.cid != null
|
652 |
+
? vm.options
|
653 |
+
: vm._isVue
|
654 |
+
? vm.$options || vm.constructor.options
|
655 |
+
: vm;
|
656 |
+
var name = options.name || options._componentTag;
|
657 |
+
var file = options.__file;
|
658 |
+
if (!name && file) {
|
659 |
+
var match = file.match(/([^/\\]+)\.vue$/);
|
660 |
+
name = match && match[1];
|
661 |
+
}
|
662 |
+
|
663 |
+
return (
|
664 |
+
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
665 |
+
(file && includeFile !== false ? (" at " + file) : '')
|
666 |
+
)
|
667 |
+
};
|
668 |
+
|
669 |
+
var repeat = function (str, n) {
|
670 |
+
var res = '';
|
671 |
+
while (n) {
|
672 |
+
if (n % 2 === 1) { res += str; }
|
673 |
+
if (n > 1) { str += str; }
|
674 |
+
n >>= 1;
|
675 |
+
}
|
676 |
+
return res
|
677 |
+
};
|
678 |
+
|
679 |
+
generateComponentTrace = function (vm) {
|
680 |
+
if (vm._isVue && vm.$parent) {
|
681 |
+
var tree = [];
|
682 |
+
var currentRecursiveSequence = 0;
|
683 |
+
while (vm) {
|
684 |
+
if (tree.length > 0) {
|
685 |
+
var last = tree[tree.length - 1];
|
686 |
+
if (last.constructor === vm.constructor) {
|
687 |
+
currentRecursiveSequence++;
|
688 |
+
vm = vm.$parent;
|
689 |
+
continue
|
690 |
+
} else if (currentRecursiveSequence > 0) {
|
691 |
+
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
692 |
+
currentRecursiveSequence = 0;
|
693 |
+
}
|
694 |
+
}
|
695 |
+
tree.push(vm);
|
696 |
+
vm = vm.$parent;
|
697 |
+
}
|
698 |
+
return '\n\nfound in\n\n' + tree
|
699 |
+
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
700 |
+
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
701 |
+
: formatComponentName(vm))); })
|
702 |
+
.join('\n')
|
703 |
+
} else {
|
704 |
+
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
705 |
+
}
|
706 |
+
};
|
707 |
+
}
|
708 |
+
|
709 |
+
/* */
|
710 |
+
|
711 |
+
var uid = 0;
|
712 |
+
|
713 |
+
/**
|
714 |
+
* A dep is an observable that can have multiple
|
715 |
+
* directives subscribing to it.
|
716 |
+
*/
|
717 |
+
var Dep = function Dep () {
|
718 |
+
this.id = uid++;
|
719 |
+
this.subs = [];
|
720 |
+
};
|
721 |
+
|
722 |
+
Dep.prototype.addSub = function addSub (sub) {
|
723 |
+
this.subs.push(sub);
|
724 |
+
};
|
725 |
+
|
726 |
+
Dep.prototype.removeSub = function removeSub (sub) {
|
727 |
+
remove(this.subs, sub);
|
728 |
+
};
|
729 |
+
|
730 |
+
Dep.prototype.depend = function depend () {
|
731 |
+
if (Dep.target) {
|
732 |
+
Dep.target.addDep(this);
|
733 |
+
}
|
734 |
+
};
|
735 |
+
|
736 |
+
Dep.prototype.notify = function notify () {
|
737 |
+
// stabilize the subscriber list first
|
738 |
+
var subs = this.subs.slice();
|
739 |
+
if (!config.async) {
|
740 |
+
// subs aren't sorted in scheduler if not running async
|
741 |
+
// we need to sort them now to make sure they fire in correct
|
742 |
+
// order
|
743 |
+
subs.sort(function (a, b) { return a.id - b.id; });
|
744 |
+
}
|
745 |
+
for (var i = 0, l = subs.length; i < l; i++) {
|
746 |
+
subs[i].update();
|
747 |
+
}
|
748 |
+
};
|
749 |
+
|
750 |
+
// The current target watcher being evaluated.
|
751 |
+
// This is globally unique because only one watcher
|
752 |
+
// can be evaluated at a time.
|
753 |
+
Dep.target = null;
|
754 |
+
var targetStack = [];
|
755 |
+
|
756 |
+
function pushTarget (target) {
|
757 |
+
targetStack.push(target);
|
758 |
+
Dep.target = target;
|
759 |
+
}
|
760 |
+
|
761 |
+
function popTarget () {
|
762 |
+
targetStack.pop();
|
763 |
+
Dep.target = targetStack[targetStack.length - 1];
|
764 |
+
}
|
765 |
+
|
766 |
+
/* */
|
767 |
+
|
768 |
+
var VNode = function VNode (
|
769 |
+
tag,
|
770 |
+
data,
|
771 |
+
children,
|
772 |
+
text,
|
773 |
+
elm,
|
774 |
+
context,
|
775 |
+
componentOptions,
|
776 |
+
asyncFactory
|
777 |
+
) {
|
778 |
+
this.tag = tag;
|
779 |
+
this.data = data;
|
780 |
+
this.children = children;
|
781 |
+
this.text = text;
|
782 |
+
this.elm = elm;
|
783 |
+
this.ns = undefined;
|
784 |
+
this.context = context;
|
785 |
+
this.fnContext = undefined;
|
786 |
+
this.fnOptions = undefined;
|
787 |
+
this.fnScopeId = undefined;
|
788 |
+
this.key = data && data.key;
|
789 |
+
this.componentOptions = componentOptions;
|
790 |
+
this.componentInstance = undefined;
|
791 |
+
this.parent = undefined;
|
792 |
+
this.raw = false;
|
793 |
+
this.isStatic = false;
|
794 |
+
this.isRootInsert = true;
|
795 |
+
this.isComment = false;
|
796 |
+
this.isCloned = false;
|
797 |
+
this.isOnce = false;
|
798 |
+
this.asyncFactory = asyncFactory;
|
799 |
+
this.asyncMeta = undefined;
|
800 |
+
this.isAsyncPlaceholder = false;
|
801 |
+
};
|
802 |
+
|
803 |
+
var prototypeAccessors = { child: { configurable: true } };
|
804 |
+
|
805 |
+
// DEPRECATED: alias for componentInstance for backwards compat.
|
806 |
+
/* istanbul ignore next */
|
807 |
+
prototypeAccessors.child.get = function () {
|
808 |
+
return this.componentInstance
|
809 |
+
};
|
810 |
+
|
811 |
+
Object.defineProperties( VNode.prototype, prototypeAccessors );
|
812 |
+
|
813 |
+
var createEmptyVNode = function (text) {
|
814 |
+
if ( text === void 0 ) text = '';
|
815 |
+
|
816 |
+
var node = new VNode();
|
817 |
+
node.text = text;
|
818 |
+
node.isComment = true;
|
819 |
+
return node
|
820 |
+
};
|
821 |
+
|
822 |
+
function createTextVNode (val) {
|
823 |
+
return new VNode(undefined, undefined, undefined, String(val))
|
824 |
+
}
|
825 |
+
|
826 |
+
// optimized shallow clone
|
827 |
+
// used for static nodes and slot nodes because they may be reused across
|
828 |
+
// multiple renders, cloning them avoids errors when DOM manipulations rely
|
829 |
+
// on their elm reference.
|
830 |
+
function cloneVNode (vnode) {
|
831 |
+
var cloned = new VNode(
|
832 |
+
vnode.tag,
|
833 |
+
vnode.data,
|
834 |
+
// #7975
|
835 |
+
// clone children array to avoid mutating original in case of cloning
|
836 |
+
// a child.
|
837 |
+
vnode.children && vnode.children.slice(),
|
838 |
+
vnode.text,
|
839 |
+
vnode.elm,
|
840 |
+
vnode.context,
|
841 |
+
vnode.componentOptions,
|
842 |
+
vnode.asyncFactory
|
843 |
+
);
|
844 |
+
cloned.ns = vnode.ns;
|
845 |
+
cloned.isStatic = vnode.isStatic;
|
846 |
+
cloned.key = vnode.key;
|
847 |
+
cloned.isComment = vnode.isComment;
|
848 |
+
cloned.fnContext = vnode.fnContext;
|
849 |
+
cloned.fnOptions = vnode.fnOptions;
|
850 |
+
cloned.fnScopeId = vnode.fnScopeId;
|
851 |
+
cloned.asyncMeta = vnode.asyncMeta;
|
852 |
+
cloned.isCloned = true;
|
853 |
+
return cloned
|
854 |
+
}
|
855 |
+
|
856 |
+
/*
|
857 |
+
* not type checking this file because flow doesn't play well with
|
858 |
+
* dynamically accessing methods on Array prototype
|
859 |
+
*/
|
860 |
+
|
861 |
+
var arrayProto = Array.prototype;
|
862 |
+
var arrayMethods = Object.create(arrayProto);
|
863 |
+
|
864 |
+
var methodsToPatch = [
|
865 |
+
'push',
|
866 |
+
'pop',
|
867 |
+
'shift',
|
868 |
+
'unshift',
|
869 |
+
'splice',
|
870 |
+
'sort',
|
871 |
+
'reverse'
|
872 |
+
];
|
873 |
+
|
874 |
+
/**
|
875 |
+
* Intercept mutating methods and emit events
|
876 |
+
*/
|
877 |
+
methodsToPatch.forEach(function (method) {
|
878 |
+
// cache original method
|
879 |
+
var original = arrayProto[method];
|
880 |
+
def(arrayMethods, method, function mutator () {
|
881 |
+
var args = [], len = arguments.length;
|
882 |
+
while ( len-- ) args[ len ] = arguments[ len ];
|
883 |
+
|
884 |
+
var result = original.apply(this, args);
|
885 |
+
var ob = this.__ob__;
|
886 |
+
var inserted;
|
887 |
+
switch (method) {
|
888 |
+
case 'push':
|
889 |
+
case 'unshift':
|
890 |
+
inserted = args;
|
891 |
+
break
|
892 |
+
case 'splice':
|
893 |
+
inserted = args.slice(2);
|
894 |
+
break
|
895 |
+
}
|
896 |
+
if (inserted) { ob.observeArray(inserted); }
|
897 |
+
// notify change
|
898 |
+
ob.dep.notify();
|
899 |
+
return result
|
900 |
+
});
|
901 |
+
});
|
902 |
+
|
903 |
+
/* */
|
904 |
+
|
905 |
+
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
906 |
+
|
907 |
+
/**
|
908 |
+
* In some cases we may want to disable observation inside a component's
|
909 |
+
* update computation.
|
910 |
+
*/
|
911 |
+
var shouldObserve = true;
|
912 |
+
|
913 |
+
function toggleObserving (value) {
|
914 |
+
shouldObserve = value;
|
915 |
+
}
|
916 |
+
|
917 |
+
/**
|
918 |
+
* Observer class that is attached to each observed
|
919 |
+
* object. Once attached, the observer converts the target
|
920 |
+
* object's property keys into getter/setters that
|
921 |
+
* collect dependencies and dispatch updates.
|
922 |
+
*/
|
923 |
+
var Observer = function Observer (value) {
|
924 |
+
this.value = value;
|
925 |
+
this.dep = new Dep();
|
926 |
+
this.vmCount = 0;
|
927 |
+
def(value, '__ob__', this);
|
928 |
+
if (Array.isArray(value)) {
|
929 |
+
if (hasProto) {
|
930 |
+
protoAugment(value, arrayMethods);
|
931 |
+
} else {
|
932 |
+
copyAugment(value, arrayMethods, arrayKeys);
|
933 |
+
}
|
934 |
+
this.observeArray(value);
|
935 |
+
} else {
|
936 |
+
this.walk(value);
|
937 |
+
}
|
938 |
+
};
|
939 |
+
|
940 |
+
/**
|
941 |
+
* Walk through all properties and convert them into
|
942 |
+
* getter/setters. This method should only be called when
|
943 |
+
* value type is Object.
|
944 |
+
*/
|
945 |
+
Observer.prototype.walk = function walk (obj) {
|
946 |
+
var keys = Object.keys(obj);
|
947 |
+
for (var i = 0; i < keys.length; i++) {
|
948 |
+
defineReactive$$1(obj, keys[i]);
|
949 |
+
}
|
950 |
+
};
|
951 |
+
|
952 |
+
/**
|
953 |
+
* Observe a list of Array items.
|
954 |
+
*/
|
955 |
+
Observer.prototype.observeArray = function observeArray (items) {
|
956 |
+
for (var i = 0, l = items.length; i < l; i++) {
|
957 |
+
observe(items[i]);
|
958 |
+
}
|
959 |
+
};
|
960 |
+
|
961 |
+
// helpers
|
962 |
+
|
963 |
+
/**
|
964 |
+
* Augment a target Object or Array by intercepting
|
965 |
+
* the prototype chain using __proto__
|
966 |
+
*/
|
967 |
+
function protoAugment (target, src) {
|
968 |
+
/* eslint-disable no-proto */
|
969 |
+
target.__proto__ = src;
|
970 |
+
/* eslint-enable no-proto */
|
971 |
+
}
|
972 |
+
|
973 |
+
/**
|
974 |
+
* Augment a target Object or Array by defining
|
975 |
+
* hidden properties.
|
976 |
+
*/
|
977 |
+
/* istanbul ignore next */
|
978 |
+
function copyAugment (target, src, keys) {
|
979 |
+
for (var i = 0, l = keys.length; i < l; i++) {
|
980 |
+
var key = keys[i];
|
981 |
+
def(target, key, src[key]);
|
982 |
+
}
|
983 |
+
}
|
984 |
+
|
985 |
+
/**
|
986 |
+
* Attempt to create an observer instance for a value,
|
987 |
+
* returns the new observer if successfully observed,
|
988 |
+
* or the existing observer if the value already has one.
|
989 |
+
*/
|
990 |
+
function observe (value, asRootData) {
|
991 |
+
if (!isObject(value) || value instanceof VNode) {
|
992 |
+
return
|
993 |
+
}
|
994 |
+
var ob;
|
995 |
+
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
996 |
+
ob = value.__ob__;
|
997 |
+
} else if (
|
998 |
+
shouldObserve &&
|
999 |
+
!isServerRendering() &&
|
1000 |
+
(Array.isArray(value) || isPlainObject(value)) &&
|
1001 |
+
Object.isExtensible(value) &&
|
1002 |
+
!value._isVue
|
1003 |
+
) {
|
1004 |
+
ob = new Observer(value);
|
1005 |
+
}
|
1006 |
+
if (asRootData && ob) {
|
1007 |
+
ob.vmCount++;
|
1008 |
+
}
|
1009 |
+
return ob
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
/**
|
1013 |
+
* Define a reactive property on an Object.
|
1014 |
+
*/
|
1015 |
+
function defineReactive$$1 (
|
1016 |
+
obj,
|
1017 |
+
key,
|
1018 |
+
val,
|
1019 |
+
customSetter,
|
1020 |
+
shallow
|
1021 |
+
) {
|
1022 |
+
var dep = new Dep();
|
1023 |
+
|
1024 |
+
var property = Object.getOwnPropertyDescriptor(obj, key);
|
1025 |
+
if (property && property.configurable === false) {
|
1026 |
+
return
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
// cater for pre-defined getter/setters
|
1030 |
+
var getter = property && property.get;
|
1031 |
+
var setter = property && property.set;
|
1032 |
+
if ((!getter || setter) && arguments.length === 2) {
|
1033 |
+
val = obj[key];
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
var childOb = !shallow && observe(val);
|
1037 |
+
Object.defineProperty(obj, key, {
|
1038 |
+
enumerable: true,
|
1039 |
+
configurable: true,
|
1040 |
+
get: function reactiveGetter () {
|
1041 |
+
var value = getter ? getter.call(obj) : val;
|
1042 |
+
if (Dep.target) {
|
1043 |
+
dep.depend();
|
1044 |
+
if (childOb) {
|
1045 |
+
childOb.dep.depend();
|
1046 |
+
if (Array.isArray(value)) {
|
1047 |
+
dependArray(value);
|
1048 |
+
}
|
1049 |
+
}
|
1050 |
+
}
|
1051 |
+
return value
|
1052 |
+
},
|
1053 |
+
set: function reactiveSetter (newVal) {
|
1054 |
+
var value = getter ? getter.call(obj) : val;
|
1055 |
+
/* eslint-disable no-self-compare */
|
1056 |
+
if (newVal === value || (newVal !== newVal && value !== value)) {
|
1057 |
+
return
|
1058 |
+
}
|
1059 |
+
/* eslint-enable no-self-compare */
|
1060 |
+
if (customSetter) {
|
1061 |
+
customSetter();
|
1062 |
+
}
|
1063 |
+
// #7981: for accessor properties without setter
|
1064 |
+
if (getter && !setter) { return }
|
1065 |
+
if (setter) {
|
1066 |
+
setter.call(obj, newVal);
|
1067 |
+
} else {
|
1068 |
+
val = newVal;
|
1069 |
+
}
|
1070 |
+
childOb = !shallow && observe(newVal);
|
1071 |
+
dep.notify();
|
1072 |
+
}
|
1073 |
+
});
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
/**
|
1077 |
+
* Set a property on an object. Adds the new property and
|
1078 |
+
* triggers change notification if the property doesn't
|
1079 |
+
* already exist.
|
1080 |
+
*/
|
1081 |
+
function set (target, key, val) {
|
1082 |
+
if (isUndef(target) || isPrimitive(target)
|
1083 |
+
) {
|
1084 |
+
warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1085 |
+
}
|
1086 |
+
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1087 |
+
target.length = Math.max(target.length, key);
|
1088 |
+
target.splice(key, 1, val);
|
1089 |
+
return val
|
1090 |
+
}
|
1091 |
+
if (key in target && !(key in Object.prototype)) {
|
1092 |
+
target[key] = val;
|
1093 |
+
return val
|
1094 |
+
}
|
1095 |
+
var ob = (target).__ob__;
|
1096 |
+
if (target._isVue || (ob && ob.vmCount)) {
|
1097 |
+
warn(
|
1098 |
+
'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1099 |
+
'at runtime - declare it upfront in the data option.'
|
1100 |
+
);
|
1101 |
+
return val
|
1102 |
+
}
|
1103 |
+
if (!ob) {
|
1104 |
+
target[key] = val;
|
1105 |
+
return val
|
1106 |
+
}
|
1107 |
+
defineReactive$$1(ob.value, key, val);
|
1108 |
+
ob.dep.notify();
|
1109 |
+
return val
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
/**
|
1113 |
+
* Delete a property and trigger change if necessary.
|
1114 |
+
*/
|
1115 |
+
function del (target, key) {
|
1116 |
+
if (isUndef(target) || isPrimitive(target)
|
1117 |
+
) {
|
1118 |
+
warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
1119 |
+
}
|
1120 |
+
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1121 |
+
target.splice(key, 1);
|
1122 |
+
return
|
1123 |
+
}
|
1124 |
+
var ob = (target).__ob__;
|
1125 |
+
if (target._isVue || (ob && ob.vmCount)) {
|
1126 |
+
warn(
|
1127 |
+
'Avoid deleting properties on a Vue instance or its root $data ' +
|
1128 |
+
'- just set it to null.'
|
1129 |
+
);
|
1130 |
+
return
|
1131 |
+
}
|
1132 |
+
if (!hasOwn(target, key)) {
|
1133 |
+
return
|
1134 |
+
}
|
1135 |
+
delete target[key];
|
1136 |
+
if (!ob) {
|
1137 |
+
return
|
1138 |
+
}
|
1139 |
+
ob.dep.notify();
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
/**
|
1143 |
+
* Collect dependencies on array elements when the array is touched, since
|
1144 |
+
* we cannot intercept array element access like property getters.
|
1145 |
+
*/
|
1146 |
+
function dependArray (value) {
|
1147 |
+
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1148 |
+
e = value[i];
|
1149 |
+
e && e.__ob__ && e.__ob__.dep.depend();
|
1150 |
+
if (Array.isArray(e)) {
|
1151 |
+
dependArray(e);
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
/* */
|
1157 |
+
|
1158 |
+
/**
|
1159 |
+
* Option overwriting strategies are functions that handle
|
1160 |
+
* how to merge a parent option value and a child option
|
1161 |
+
* value into the final value.
|
1162 |
+
*/
|
1163 |
+
var strats = config.optionMergeStrategies;
|
1164 |
+
|
1165 |
+
/**
|
1166 |
+
* Options with restrictions
|
1167 |
+
*/
|
1168 |
+
{
|
1169 |
+
strats.el = strats.propsData = function (parent, child, vm, key) {
|
1170 |
+
if (!vm) {
|
1171 |
+
warn(
|
1172 |
+
"option \"" + key + "\" can only be used during instance " +
|
1173 |
+
'creation with the `new` keyword.'
|
1174 |
+
);
|
1175 |
+
}
|
1176 |
+
return defaultStrat(parent, child)
|
1177 |
+
};
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
/**
|
1181 |
+
* Helper that recursively merges two data objects together.
|
1182 |
+
*/
|
1183 |
+
function mergeData (to, from) {
|
1184 |
+
if (!from) { return to }
|
1185 |
+
var key, toVal, fromVal;
|
1186 |
+
|
1187 |
+
var keys = hasSymbol
|
1188 |
+
? Reflect.ownKeys(from)
|
1189 |
+
: Object.keys(from);
|
1190 |
+
|
1191 |
+
for (var i = 0; i < keys.length; i++) {
|
1192 |
+
key = keys[i];
|
1193 |
+
// in case the object is already observed...
|
1194 |
+
if (key === '__ob__') { continue }
|
1195 |
+
toVal = to[key];
|
1196 |
+
fromVal = from[key];
|
1197 |
+
if (!hasOwn(to, key)) {
|
1198 |
+
set(to, key, fromVal);
|
1199 |
+
} else if (
|
1200 |
+
toVal !== fromVal &&
|
1201 |
+
isPlainObject(toVal) &&
|
1202 |
+
isPlainObject(fromVal)
|
1203 |
+
) {
|
1204 |
+
mergeData(toVal, fromVal);
|
1205 |
+
}
|
1206 |
+
}
|
1207 |
+
return to
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* Data
|
1212 |
+
*/
|
1213 |
+
function mergeDataOrFn (
|
1214 |
+
parentVal,
|
1215 |
+
childVal,
|
1216 |
+
vm
|
1217 |
+
) {
|
1218 |
+
if (!vm) {
|
1219 |
+
// in a Vue.extend merge, both should be functions
|
1220 |
+
if (!childVal) {
|
1221 |
+
return parentVal
|
1222 |
+
}
|
1223 |
+
if (!parentVal) {
|
1224 |
+
return childVal
|
1225 |
+
}
|
1226 |
+
// when parentVal & childVal are both present,
|
1227 |
+
// we need to return a function that returns the
|
1228 |
+
// merged result of both functions... no need to
|
1229 |
+
// check if parentVal is a function here because
|
1230 |
+
// it has to be a function to pass previous merges.
|
1231 |
+
return function mergedDataFn () {
|
1232 |
+
return mergeData(
|
1233 |
+
typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1234 |
+
typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1235 |
+
)
|
1236 |
+
}
|
1237 |
+
} else {
|
1238 |
+
return function mergedInstanceDataFn () {
|
1239 |
+
// instance merge
|
1240 |
+
var instanceData = typeof childVal === 'function'
|
1241 |
+
? childVal.call(vm, vm)
|
1242 |
+
: childVal;
|
1243 |
+
var defaultData = typeof parentVal === 'function'
|
1244 |
+
? parentVal.call(vm, vm)
|
1245 |
+
: parentVal;
|
1246 |
+
if (instanceData) {
|
1247 |
+
return mergeData(instanceData, defaultData)
|
1248 |
+
} else {
|
1249 |
+
return defaultData
|
1250 |
+
}
|
1251 |
+
}
|
1252 |
+
}
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
strats.data = function (
|
1256 |
+
parentVal,
|
1257 |
+
childVal,
|
1258 |
+
vm
|
1259 |
+
) {
|
1260 |
+
if (!vm) {
|
1261 |
+
if (childVal && typeof childVal !== 'function') {
|
1262 |
+
warn(
|
1263 |
+
'The "data" option should be a function ' +
|
1264 |
+
'that returns a per-instance value in component ' +
|
1265 |
+
'definitions.',
|
1266 |
+
vm
|
1267 |
+
);
|
1268 |
+
|
1269 |
+
return parentVal
|
1270 |
+
}
|
1271 |
+
return mergeDataOrFn(parentVal, childVal)
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
return mergeDataOrFn(parentVal, childVal, vm)
|
1275 |
+
};
|
1276 |
+
|
1277 |
+
/**
|
1278 |
+
* Hooks and props are merged as arrays.
|
1279 |
+
*/
|
1280 |
+
function mergeHook (
|
1281 |
+
parentVal,
|
1282 |
+
childVal
|
1283 |
+
) {
|
1284 |
+
var res = childVal
|
1285 |
+
? parentVal
|
1286 |
+
? parentVal.concat(childVal)
|
1287 |
+
: Array.isArray(childVal)
|
1288 |
+
? childVal
|
1289 |
+
: [childVal]
|
1290 |
+
: parentVal;
|
1291 |
+
return res
|
1292 |
+
? dedupeHooks(res)
|
1293 |
+
: res
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
function dedupeHooks (hooks) {
|
1297 |
+
var res = [];
|
1298 |
+
for (var i = 0; i < hooks.length; i++) {
|
1299 |
+
if (res.indexOf(hooks[i]) === -1) {
|
1300 |
+
res.push(hooks[i]);
|
1301 |
+
}
|
1302 |
+
}
|
1303 |
+
return res
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
LIFECYCLE_HOOKS.forEach(function (hook) {
|
1307 |
+
strats[hook] = mergeHook;
|
1308 |
+
});
|
1309 |
+
|
1310 |
+
/**
|
1311 |
+
* Assets
|
1312 |
+
*
|
1313 |
+
* When a vm is present (instance creation), we need to do
|
1314 |
+
* a three-way merge between constructor options, instance
|
1315 |
+
* options and parent options.
|
1316 |
+
*/
|
1317 |
+
function mergeAssets (
|
1318 |
+
parentVal,
|
1319 |
+
childVal,
|
1320 |
+
vm,
|
1321 |
+
key
|
1322 |
+
) {
|
1323 |
+
var res = Object.create(parentVal || null);
|
1324 |
+
if (childVal) {
|
1325 |
+
assertObjectType(key, childVal, vm);
|
1326 |
+
return extend(res, childVal)
|
1327 |
+
} else {
|
1328 |
+
return res
|
1329 |
+
}
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
ASSET_TYPES.forEach(function (type) {
|
1333 |
+
strats[type + 's'] = mergeAssets;
|
1334 |
+
});
|
1335 |
+
|
1336 |
+
/**
|
1337 |
+
* Watchers.
|
1338 |
+
*
|
1339 |
+
* Watchers hashes should not overwrite one
|
1340 |
+
* another, so we merge them as arrays.
|
1341 |
+
*/
|
1342 |
+
strats.watch = function (
|
1343 |
+
parentVal,
|
1344 |
+
childVal,
|
1345 |
+
vm,
|
1346 |
+
key
|
1347 |
+
) {
|
1348 |
+
// work around Firefox's Object.prototype.watch...
|
1349 |
+
if (parentVal === nativeWatch) { parentVal = undefined; }
|
1350 |
+
if (childVal === nativeWatch) { childVal = undefined; }
|
1351 |
+
/* istanbul ignore if */
|
1352 |
+
if (!childVal) { return Object.create(parentVal || null) }
|
1353 |
+
{
|
1354 |
+
assertObjectType(key, childVal, vm);
|
1355 |
+
}
|
1356 |
+
if (!parentVal) { return childVal }
|
1357 |
+
var ret = {};
|
1358 |
+
extend(ret, parentVal);
|
1359 |
+
for (var key$1 in childVal) {
|
1360 |
+
var parent = ret[key$1];
|
1361 |
+
var child = childVal[key$1];
|
1362 |
+
if (parent && !Array.isArray(parent)) {
|
1363 |
+
parent = [parent];
|
1364 |
+
}
|
1365 |
+
ret[key$1] = parent
|
1366 |
+
? parent.concat(child)
|
1367 |
+
: Array.isArray(child) ? child : [child];
|
1368 |
+
}
|
1369 |
+
return ret
|
1370 |
+
};
|
1371 |
+
|
1372 |
+
/**
|
1373 |
+
* Other object hashes.
|
1374 |
+
*/
|
1375 |
+
strats.props =
|
1376 |
+
strats.methods =
|
1377 |
+
strats.inject =
|
1378 |
+
strats.computed = function (
|
1379 |
+
parentVal,
|
1380 |
+
childVal,
|
1381 |
+
vm,
|
1382 |
+
key
|
1383 |
+
) {
|
1384 |
+
if (childVal && "development" !== 'production') {
|
1385 |
+
assertObjectType(key, childVal, vm);
|
1386 |
+
}
|
1387 |
+
if (!parentVal) { return childVal }
|
1388 |
+
var ret = Object.create(null);
|
1389 |
+
extend(ret, parentVal);
|
1390 |
+
if (childVal) { extend(ret, childVal); }
|
1391 |
+
return ret
|
1392 |
+
};
|
1393 |
+
strats.provide = mergeDataOrFn;
|
1394 |
+
|
1395 |
+
/**
|
1396 |
+
* Default strategy.
|
1397 |
+
*/
|
1398 |
+
var defaultStrat = function (parentVal, childVal) {
|
1399 |
+
return childVal === undefined
|
1400 |
+
? parentVal
|
1401 |
+
: childVal
|
1402 |
+
};
|
1403 |
+
|
1404 |
+
/**
|
1405 |
+
* Validate component names
|
1406 |
+
*/
|
1407 |
+
function checkComponents (options) {
|
1408 |
+
for (var key in options.components) {
|
1409 |
+
validateComponentName(key);
|
1410 |
+
}
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
function validateComponentName (name) {
|
1414 |
+
if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
|
1415 |
+
warn(
|
1416 |
+
'Invalid component name: "' + name + '". Component names ' +
|
1417 |
+
'should conform to valid custom element name in html5 specification.'
|
1418 |
+
);
|
1419 |
+
}
|
1420 |
+
if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
1421 |
+
warn(
|
1422 |
+
'Do not use built-in or reserved HTML elements as component ' +
|
1423 |
+
'id: ' + name
|
1424 |
+
);
|
1425 |
+
}
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
/**
|
1429 |
+
* Ensure all props option syntax are normalized into the
|
1430 |
+
* Object-based format.
|
1431 |
+
*/
|
1432 |
+
function normalizeProps (options, vm) {
|
1433 |
+
var props = options.props;
|
1434 |
+
if (!props) { return }
|
1435 |
+
var res = {};
|
1436 |
+
var i, val, name;
|
1437 |
+
if (Array.isArray(props)) {
|
1438 |
+
i = props.length;
|
1439 |
+
while (i--) {
|
1440 |
+
val = props[i];
|
1441 |
+
if (typeof val === 'string') {
|
1442 |
+
name = camelize(val);
|
1443 |
+
res[name] = { type: null };
|
1444 |
+
} else {
|
1445 |
+
warn('props must be strings when using array syntax.');
|
1446 |
+
}
|
1447 |
+
}
|
1448 |
+
} else if (isPlainObject(props)) {
|
1449 |
+
for (var key in props) {
|
1450 |
+
val = props[key];
|
1451 |
+
name = camelize(key);
|
1452 |
+
res[name] = isPlainObject(val)
|
1453 |
+
? val
|
1454 |
+
: { type: val };
|
1455 |
+
}
|
1456 |
+
} else {
|
1457 |
+
warn(
|
1458 |
+
"Invalid value for option \"props\": expected an Array or an Object, " +
|
1459 |
+
"but got " + (toRawType(props)) + ".",
|
1460 |
+
vm
|
1461 |
+
);
|
1462 |
+
}
|
1463 |
+
options.props = res;
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
/**
|
1467 |
+
* Normalize all injections into Object-based format
|
1468 |
+
*/
|
1469 |
+
function normalizeInject (options, vm) {
|
1470 |
+
var inject = options.inject;
|
1471 |
+
if (!inject) { return }
|
1472 |
+
var normalized = options.inject = {};
|
1473 |
+
if (Array.isArray(inject)) {
|
1474 |
+
for (var i = 0; i < inject.length; i++) {
|
1475 |
+
normalized[inject[i]] = { from: inject[i] };
|
1476 |
+
}
|
1477 |
+
} else if (isPlainObject(inject)) {
|
1478 |
+
for (var key in inject) {
|
1479 |
+
var val = inject[key];
|
1480 |
+
normalized[key] = isPlainObject(val)
|
1481 |
+
? extend({ from: key }, val)
|
1482 |
+
: { from: val };
|
1483 |
+
}
|
1484 |
+
} else {
|
1485 |
+
warn(
|
1486 |
+
"Invalid value for option \"inject\": expected an Array or an Object, " +
|
1487 |
+
"but got " + (toRawType(inject)) + ".",
|
1488 |
+
vm
|
1489 |
+
);
|
1490 |
+
}
|
1491 |
+
}
|
1492 |
+
|
1493 |
+
/**
|
1494 |
+
* Normalize raw function directives into object format.
|
1495 |
+
*/
|
1496 |
+
function normalizeDirectives (options) {
|
1497 |
+
var dirs = options.directives;
|
1498 |
+
if (dirs) {
|
1499 |
+
for (var key in dirs) {
|
1500 |
+
var def$$1 = dirs[key];
|
1501 |
+
if (typeof def$$1 === 'function') {
|
1502 |
+
dirs[key] = { bind: def$$1, update: def$$1 };
|
1503 |
+
}
|
1504 |
+
}
|
1505 |
+
}
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
function assertObjectType (name, value, vm) {
|
1509 |
+
if (!isPlainObject(value)) {
|
1510 |
+
warn(
|
1511 |
+
"Invalid value for option \"" + name + "\": expected an Object, " +
|
1512 |
+
"but got " + (toRawType(value)) + ".",
|
1513 |
+
vm
|
1514 |
+
);
|
1515 |
+
}
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
/**
|
1519 |
+
* Merge two option objects into a new one.
|
1520 |
+
* Core utility used in both instantiation and inheritance.
|
1521 |
+
*/
|
1522 |
+
function mergeOptions (
|
1523 |
+
parent,
|
1524 |
+
child,
|
1525 |
+
vm
|
1526 |
+
) {
|
1527 |
+
{
|
1528 |
+
checkComponents(child);
|
1529 |
+
}
|
1530 |
+
|
1531 |
+
if (typeof child === 'function') {
|
1532 |
+
child = child.options;
|
1533 |
+
}
|
1534 |
+
|
1535 |
+
normalizeProps(child, vm);
|
1536 |
+
normalizeInject(child, vm);
|
1537 |
+
normalizeDirectives(child);
|
1538 |
+
|
1539 |
+
// Apply extends and mixins on the child options,
|
1540 |
+
// but only if it is a raw options object that isn't
|
1541 |
+
// the result of another mergeOptions call.
|
1542 |
+
// Only merged options has the _base property.
|
1543 |
+
if (!child._base) {
|
1544 |
+
if (child.extends) {
|
1545 |
+
parent = mergeOptions(parent, child.extends, vm);
|
1546 |
+
}
|
1547 |
+
if (child.mixins) {
|
1548 |
+
for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1549 |
+
parent = mergeOptions(parent, child.mixins[i], vm);
|
1550 |
+
}
|
1551 |
+
}
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
var options = {};
|
1555 |
+
var key;
|
1556 |
+
for (key in parent) {
|
1557 |
+
mergeField(key);
|
1558 |
+
}
|
1559 |
+
for (key in child) {
|
1560 |
+
if (!hasOwn(parent, key)) {
|
1561 |
+
mergeField(key);
|
1562 |
+
}
|
1563 |
+
}
|
1564 |
+
function mergeField (key) {
|
1565 |
+
var strat = strats[key] || defaultStrat;
|
1566 |
+
options[key] = strat(parent[key], child[key], vm, key);
|
1567 |
+
}
|
1568 |
+
return options
|
1569 |
+
}
|
1570 |
+
|
1571 |
+
/**
|
1572 |
+
* Resolve an asset.
|
1573 |
+
* This function is used because child instances need access
|
1574 |
+
* to assets defined in its ancestor chain.
|
1575 |
+
*/
|
1576 |
+
function resolveAsset (
|
1577 |
+
options,
|
1578 |
+
type,
|
1579 |
+
id,
|
1580 |
+
warnMissing
|
1581 |
+
) {
|
1582 |
+
/* istanbul ignore if */
|
1583 |
+
if (typeof id !== 'string') {
|
1584 |
+
return
|
1585 |
+
}
|
1586 |
+
var assets = options[type];
|
1587 |
+
// check local registration variations first
|
1588 |
+
if (hasOwn(assets, id)) { return assets[id] }
|
1589 |
+
var camelizedId = camelize(id);
|
1590 |
+
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1591 |
+
var PascalCaseId = capitalize(camelizedId);
|
1592 |
+
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1593 |
+
// fallback to prototype chain
|
1594 |
+
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1595 |
+
if (warnMissing && !res) {
|
1596 |
+
warn(
|
1597 |
+
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
1598 |
+
options
|
1599 |
+
);
|
1600 |
+
}
|
1601 |
+
return res
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
/* */
|
1605 |
+
|
1606 |
+
|
1607 |
+
|
1608 |
+
function validateProp (
|
1609 |
+
key,
|
1610 |
+
propOptions,
|
1611 |
+
propsData,
|
1612 |
+
vm
|
1613 |
+
) {
|
1614 |
+
var prop = propOptions[key];
|
1615 |
+
var absent = !hasOwn(propsData, key);
|
1616 |
+
var value = propsData[key];
|
1617 |
+
// boolean casting
|
1618 |
+
var booleanIndex = getTypeIndex(Boolean, prop.type);
|
1619 |
+
if (booleanIndex > -1) {
|
1620 |
+
if (absent && !hasOwn(prop, 'default')) {
|
1621 |
+
value = false;
|
1622 |
+
} else if (value === '' || value === hyphenate(key)) {
|
1623 |
+
// only cast empty string / same name to boolean if
|
1624 |
+
// boolean has higher priority
|
1625 |
+
var stringIndex = getTypeIndex(String, prop.type);
|
1626 |
+
if (stringIndex < 0 || booleanIndex < stringIndex) {
|
1627 |
+
value = true;
|
1628 |
+
}
|
1629 |
+
}
|
1630 |
+
}
|
1631 |
+
// check default value
|
1632 |
+
if (value === undefined) {
|
1633 |
+
value = getPropDefaultValue(vm, prop, key);
|
1634 |
+
// since the default value is a fresh copy,
|
1635 |
+
// make sure to observe it.
|
1636 |
+
var prevShouldObserve = shouldObserve;
|
1637 |
+
toggleObserving(true);
|
1638 |
+
observe(value);
|
1639 |
+
toggleObserving(prevShouldObserve);
|
1640 |
+
}
|
1641 |
+
{
|
1642 |
+
assertProp(prop, key, value, vm, absent);
|
1643 |
+
}
|
1644 |
+
return value
|
1645 |
+
}
|
1646 |
+
|
1647 |
+
/**
|
1648 |
+
* Get the default value of a prop.
|
1649 |
+
*/
|
1650 |
+
function getPropDefaultValue (vm, prop, key) {
|
1651 |
+
// no default, return undefined
|
1652 |
+
if (!hasOwn(prop, 'default')) {
|
1653 |
+
return undefined
|
1654 |
+
}
|
1655 |
+
var def = prop.default;
|
1656 |
+
// warn against non-factory defaults for Object & Array
|
1657 |
+
if (isObject(def)) {
|
1658 |
+
warn(
|
1659 |
+
'Invalid default value for prop "' + key + '": ' +
|
1660 |
+
'Props with type Object/Array must use a factory function ' +
|
1661 |
+
'to return the default value.',
|
1662 |
+
vm
|
1663 |
+
);
|
1664 |
+
}
|
1665 |
+
// the raw prop value was also undefined from previous render,
|
1666 |
+
// return previous default value to avoid unnecessary watcher trigger
|
1667 |
+
if (vm && vm.$options.propsData &&
|
1668 |
+
vm.$options.propsData[key] === undefined &&
|
1669 |
+
vm._props[key] !== undefined
|
1670 |
+
) {
|
1671 |
+
return vm._props[key]
|
1672 |
+
}
|
1673 |
+
// call factory function for non-Function types
|
1674 |
+
// a value is Function if its prototype is function even across different execution context
|
1675 |
+
return typeof def === 'function' && getType(prop.type) !== 'Function'
|
1676 |
+
? def.call(vm)
|
1677 |
+
: def
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
/**
|
1681 |
+
* Assert whether a prop is valid.
|
1682 |
+
*/
|
1683 |
+
function assertProp (
|
1684 |
+
prop,
|
1685 |
+
name,
|
1686 |
+
value,
|
1687 |
+
vm,
|
1688 |
+
absent
|
1689 |
+
) {
|
1690 |
+
if (prop.required && absent) {
|
1691 |
+
warn(
|
1692 |
+
'Missing required prop: "' + name + '"',
|
1693 |
+
vm
|
1694 |
+
);
|
1695 |
+
return
|
1696 |
+
}
|
1697 |
+
if (value == null && !prop.required) {
|
1698 |
+
return
|
1699 |
+
}
|
1700 |
+
var type = prop.type;
|
1701 |
+
var valid = !type || type === true;
|
1702 |
+
var expectedTypes = [];
|
1703 |
+
if (type) {
|
1704 |
+
if (!Array.isArray(type)) {
|
1705 |
+
type = [type];
|
1706 |
+
}
|
1707 |
+
for (var i = 0; i < type.length && !valid; i++) {
|
1708 |
+
var assertedType = assertType(value, type[i]);
|
1709 |
+
expectedTypes.push(assertedType.expectedType || '');
|
1710 |
+
valid = assertedType.valid;
|
1711 |
+
}
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
if (!valid) {
|
1715 |
+
warn(
|
1716 |
+
getInvalidTypeMessage(name, value, expectedTypes),
|
1717 |
+
vm
|
1718 |
+
);
|
1719 |
+
return
|
1720 |
+
}
|
1721 |
+
var validator = prop.validator;
|
1722 |
+
if (validator) {
|
1723 |
+
if (!validator(value)) {
|
1724 |
+
warn(
|
1725 |
+
'Invalid prop: custom validator check failed for prop "' + name + '".',
|
1726 |
+
vm
|
1727 |
+
);
|
1728 |
+
}
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
|
1732 |
+
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
1733 |
+
|
1734 |
+
function assertType (value, type) {
|
1735 |
+
var valid;
|
1736 |
+
var expectedType = getType(type);
|
1737 |
+
if (simpleCheckRE.test(expectedType)) {
|
1738 |
+
var t = typeof value;
|
1739 |
+
valid = t === expectedType.toLowerCase();
|
1740 |
+
// for primitive wrapper objects
|
1741 |
+
if (!valid && t === 'object') {
|
1742 |
+
valid = value instanceof type;
|
1743 |
+
}
|
1744 |
+
} else if (expectedType === 'Object') {
|
1745 |
+
valid = isPlainObject(value);
|
1746 |
+
} else if (expectedType === 'Array') {
|
1747 |
+
valid = Array.isArray(value);
|
1748 |
+
} else {
|
1749 |
+
valid = value instanceof type;
|
1750 |
+
}
|
1751 |
+
return {
|
1752 |
+
valid: valid,
|
1753 |
+
expectedType: expectedType
|
1754 |
+
}
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
/**
|
1758 |
+
* Use function string name to check built-in types,
|
1759 |
+
* because a simple equality check will fail when running
|
1760 |
+
* across different vms / iframes.
|
1761 |
+
*/
|
1762 |
+
function getType (fn) {
|
1763 |
+
var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
1764 |
+
return match ? match[1] : ''
|
1765 |
+
}
|
1766 |
+
|
1767 |
+
function isSameType (a, b) {
|
1768 |
+
return getType(a) === getType(b)
|
1769 |
+
}
|
1770 |
+
|
1771 |
+
function getTypeIndex (type, expectedTypes) {
|
1772 |
+
if (!Array.isArray(expectedTypes)) {
|
1773 |
+
return isSameType(expectedTypes, type) ? 0 : -1
|
1774 |
+
}
|
1775 |
+
for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
1776 |
+
if (isSameType(expectedTypes[i], type)) {
|
1777 |
+
return i
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
return -1
|
1781 |
+
}
|
1782 |
+
|
1783 |
+
function getInvalidTypeMessage (name, value, expectedTypes) {
|
1784 |
+
var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
1785 |
+
" Expected " + (expectedTypes.map(capitalize).join(', '));
|
1786 |
+
var expectedType = expectedTypes[0];
|
1787 |
+
var receivedType = toRawType(value);
|
1788 |
+
var expectedValue = styleValue(value, expectedType);
|
1789 |
+
var receivedValue = styleValue(value, receivedType);
|
1790 |
+
// check if we need to specify expected value
|
1791 |
+
if (expectedTypes.length === 1 &&
|
1792 |
+
isExplicable(expectedType) &&
|
1793 |
+
!isBoolean(expectedType, receivedType)) {
|
1794 |
+
message += " with value " + expectedValue;
|
1795 |
+
}
|
1796 |
+
message += ", got " + receivedType + " ";
|
1797 |
+
// check if we need to specify received value
|
1798 |
+
if (isExplicable(receivedType)) {
|
1799 |
+
message += "with value " + receivedValue + ".";
|
1800 |
+
}
|
1801 |
+
return message
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
function styleValue (value, type) {
|
1805 |
+
if (type === 'String') {
|
1806 |
+
return ("\"" + value + "\"")
|
1807 |
+
} else if (type === 'Number') {
|
1808 |
+
return ("" + (Number(value)))
|
1809 |
+
} else {
|
1810 |
+
return ("" + value)
|
1811 |
+
}
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
function isExplicable (value) {
|
1815 |
+
var explicitTypes = ['string', 'number', 'boolean'];
|
1816 |
+
return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
1817 |
+
}
|
1818 |
+
|
1819 |
+
function isBoolean () {
|
1820 |
+
var args = [], len = arguments.length;
|
1821 |
+
while ( len-- ) args[ len ] = arguments[ len ];
|
1822 |
+
|
1823 |
+
return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
/* */
|
1827 |
+
|
1828 |
+
function handleError (err, vm, info) {
|
1829 |
+
// Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
|
1830 |
+
// See: https://github.com/vuejs/vuex/issues/1505
|
1831 |
+
pushTarget();
|
1832 |
+
try {
|
1833 |
+
if (vm) {
|
1834 |
+
var cur = vm;
|
1835 |
+
while ((cur = cur.$parent)) {
|
1836 |
+
var hooks = cur.$options.errorCaptured;
|
1837 |
+
if (hooks) {
|
1838 |
+
for (var i = 0; i < hooks.length; i++) {
|
1839 |
+
try {
|
1840 |
+
var capture = hooks[i].call(cur, err, vm, info) === false;
|
1841 |
+
if (capture) { return }
|
1842 |
+
} catch (e) {
|
1843 |
+
globalHandleError(e, cur, 'errorCaptured hook');
|
1844 |
+
}
|
1845 |
+
}
|
1846 |
+
}
|
1847 |
+
}
|
1848 |
+
}
|
1849 |
+
globalHandleError(err, vm, info);
|
1850 |
+
} finally {
|
1851 |
+
popTarget();
|
1852 |
+
}
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
function invokeWithErrorHandling (
|
1856 |
+
handler,
|
1857 |
+
context,
|
1858 |
+
args,
|
1859 |
+
vm,
|
1860 |
+
info
|
1861 |
+
) {
|
1862 |
+
var res;
|
1863 |
+
try {
|
1864 |
+
res = args ? handler.apply(context, args) : handler.call(context);
|
1865 |
+
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
1866 |
+
res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
1867 |
+
// issue #9511
|
1868 |
+
// avoid catch triggering multiple times when nested calls
|
1869 |
+
res._handled = true;
|
1870 |
+
}
|
1871 |
+
} catch (e) {
|
1872 |
+
handleError(e, vm, info);
|
1873 |
+
}
|
1874 |
+
return res
|
1875 |
+
}
|
1876 |
+
|
1877 |
+
function globalHandleError (err, vm, info) {
|
1878 |
+
if (config.errorHandler) {
|
1879 |
+
try {
|
1880 |
+
return config.errorHandler.call(null, err, vm, info)
|
1881 |
+
} catch (e) {
|
1882 |
+
// if the user intentionally throws the original error in the handler,
|
1883 |
+
// do not log it twice
|
1884 |
+
if (e !== err) {
|
1885 |
+
logError(e, null, 'config.errorHandler');
|
1886 |
+
}
|
1887 |
+
}
|
1888 |
+
}
|
1889 |
+
logError(err, vm, info);
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
function logError (err, vm, info) {
|
1893 |
+
{
|
1894 |
+
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
1895 |
+
}
|
1896 |
+
/* istanbul ignore else */
|
1897 |
+
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
1898 |
+
console.error(err);
|
1899 |
+
} else {
|
1900 |
+
throw err
|
1901 |
+
}
|
1902 |
+
}
|
1903 |
+
|
1904 |
+
/* */
|
1905 |
+
|
1906 |
+
var isUsingMicroTask = false;
|
1907 |
+
|
1908 |
+
var callbacks = [];
|
1909 |
+
var pending = false;
|
1910 |
+
|
1911 |
+
function flushCallbacks () {
|
1912 |
+
pending = false;
|
1913 |
+
var copies = callbacks.slice(0);
|
1914 |
+
callbacks.length = 0;
|
1915 |
+
for (var i = 0; i < copies.length; i++) {
|
1916 |
+
copies[i]();
|
1917 |
+
}
|
1918 |
+
}
|
1919 |
+
|
1920 |
+
// Here we have async deferring wrappers using microtasks.
|
1921 |
+
// In 2.5 we used (macro) tasks (in combination with microtasks).
|
1922 |
+
// However, it has subtle problems when state is changed right before repaint
|
1923 |
+
// (e.g. #6813, out-in transitions).
|
1924 |
+
// Also, using (macro) tasks in event handler would cause some weird behaviors
|
1925 |
+
// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
|
1926 |
+
// So we now use microtasks everywhere, again.
|
1927 |
+
// A major drawback of this tradeoff is that there are some scenarios
|
1928 |
+
// where microtasks have too high a priority and fire in between supposedly
|
1929 |
+
// sequential events (e.g. #4521, #6690, which have workarounds)
|
1930 |
+
// or even between bubbling of the same event (#6566).
|
1931 |
+
var timerFunc;
|
1932 |
+
|
1933 |
+
// The nextTick behavior leverages the microtask queue, which can be accessed
|
1934 |
+
// via either native Promise.then or MutationObserver.
|
1935 |
+
// MutationObserver has wider support, however it is seriously bugged in
|
1936 |
+
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
|
1937 |
+
// completely stops working after triggering a few times... so, if native
|
1938 |
+
// Promise is available, we will use it:
|
1939 |
+
/* istanbul ignore next, $flow-disable-line */
|
1940 |
+
if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
1941 |
+
var p = Promise.resolve();
|
1942 |
+
timerFunc = function () {
|
1943 |
+
p.then(flushCallbacks);
|
1944 |
+
// In problematic UIWebViews, Promise.then doesn't completely break, but
|
1945 |
+
// it can get stuck in a weird state where callbacks are pushed into the
|
1946 |
+
// microtask queue but the queue isn't being flushed, until the browser
|
1947 |
+
// needs to do some other work, e.g. handle a timer. Therefore we can
|
1948 |
+
// "force" the microtask queue to be flushed by adding an empty timer.
|
1949 |
+
if (isIOS) { setTimeout(noop); }
|
1950 |
+
};
|
1951 |
+
isUsingMicroTask = true;
|
1952 |
+
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1953 |
+
isNative(MutationObserver) ||
|
1954 |
+
// PhantomJS and iOS 7.x
|
1955 |
+
MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1956 |
+
)) {
|
1957 |
+
// Use MutationObserver where native Promise is not available,
|
1958 |
+
// e.g. PhantomJS, iOS7, Android 4.4
|
1959 |
+
// (#6466 MutationObserver is unreliable in IE11)
|
1960 |
+
var counter = 1;
|
1961 |
+
var observer = new MutationObserver(flushCallbacks);
|
1962 |
+
var textNode = document.createTextNode(String(counter));
|
1963 |
+
observer.observe(textNode, {
|
1964 |
+
characterData: true
|
1965 |
+
});
|
1966 |
+
timerFunc = function () {
|
1967 |
+
counter = (counter + 1) % 2;
|
1968 |
+
textNode.data = String(counter);
|
1969 |
+
};
|
1970 |
+
isUsingMicroTask = true;
|
1971 |
+
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
1972 |
+
// Fallback to setImmediate.
|
1973 |
+
// Techinically it leverages the (macro) task queue,
|
1974 |
+
// but it is still a better choice than setTimeout.
|
1975 |
+
timerFunc = function () {
|
1976 |
+
setImmediate(flushCallbacks);
|
1977 |
+
};
|
1978 |
+
} else {
|
1979 |
+
// Fallback to setTimeout.
|
1980 |
+
timerFunc = function () {
|
1981 |
+
setTimeout(flushCallbacks, 0);
|
1982 |
+
};
|
1983 |
+
}
|
1984 |
+
|
1985 |
+
function nextTick (cb, ctx) {
|
1986 |
+
var _resolve;
|
1987 |
+
callbacks.push(function () {
|
1988 |
+
if (cb) {
|
1989 |
+
try {
|
1990 |
+
cb.call(ctx);
|
1991 |
+
} catch (e) {
|
1992 |
+
handleError(e, ctx, 'nextTick');
|
1993 |
+
}
|
1994 |
+
} else if (_resolve) {
|
1995 |
+
_resolve(ctx);
|
1996 |
+
}
|
1997 |
+
});
|
1998 |
+
if (!pending) {
|
1999 |
+
pending = true;
|
2000 |
+
timerFunc();
|
2001 |
+
}
|
2002 |
+
// $flow-disable-line
|
2003 |
+
if (!cb && typeof Promise !== 'undefined') {
|
2004 |
+
return new Promise(function (resolve) {
|
2005 |
+
_resolve = resolve;
|
2006 |
+
})
|
2007 |
+
}
|
2008 |
+
}
|
2009 |
+
|
2010 |
+
/* */
|
2011 |
+
|
2012 |
+
var mark;
|
2013 |
+
var measure;
|
2014 |
+
|
2015 |
+
{
|
2016 |
+
var perf = inBrowser && window.performance;
|
2017 |
+
/* istanbul ignore if */
|
2018 |
+
if (
|
2019 |
+
perf &&
|
2020 |
+
perf.mark &&
|
2021 |
+
perf.measure &&
|
2022 |
+
perf.clearMarks &&
|
2023 |
+
perf.clearMeasures
|
2024 |
+
) {
|
2025 |
+
mark = function (tag) { return perf.mark(tag); };
|
2026 |
+
measure = function (name, startTag, endTag) {
|
2027 |
+
perf.measure(name, startTag, endTag);
|
2028 |
+
perf.clearMarks(startTag);
|
2029 |
+
perf.clearMarks(endTag);
|
2030 |
+
// perf.clearMeasures(name)
|
2031 |
+
};
|
2032 |
+
}
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
/* not type checking this file because flow doesn't play well with Proxy */
|
2036 |
+
|
2037 |
+
var initProxy;
|
2038 |
+
|
2039 |
+
{
|
2040 |
+
var allowedGlobals = makeMap(
|
2041 |
+
'Infinity,undefined,NaN,isFinite,isNaN,' +
|
2042 |
+
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
2043 |
+
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
2044 |
+
'require' // for Webpack/Browserify
|
2045 |
+
);
|
2046 |
+
|
2047 |
+
var warnNonPresent = function (target, key) {
|
2048 |
+
warn(
|
2049 |
+
"Property or method \"" + key + "\" is not defined on the instance but " +
|
2050 |
+
'referenced during render. Make sure that this property is reactive, ' +
|
2051 |
+
'either in the data option, or for class-based components, by ' +
|
2052 |
+
'initializing the property. ' +
|
2053 |
+
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
2054 |
+
target
|
2055 |
+
);
|
2056 |
+
};
|
2057 |
+
|
2058 |
+
var warnReservedPrefix = function (target, key) {
|
2059 |
+
warn(
|
2060 |
+
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
2061 |
+
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
2062 |
+
'prevent conflicts with Vue internals' +
|
2063 |
+
'See: https://vuejs.org/v2/api/#data',
|
2064 |
+
target
|
2065 |
+
);
|
2066 |
+
};
|
2067 |
+
|
2068 |
+
var hasProxy =
|
2069 |
+
typeof Proxy !== 'undefined' && isNative(Proxy);
|
2070 |
+
|
2071 |
+
if (hasProxy) {
|
2072 |
+
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
2073 |
+
config.keyCodes = new Proxy(config.keyCodes, {
|
2074 |
+
set: function set (target, key, value) {
|
2075 |
+
if (isBuiltInModifier(key)) {
|
2076 |
+
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
2077 |
+
return false
|
2078 |
+
} else {
|
2079 |
+
target[key] = value;
|
2080 |
+
return true
|
2081 |
+
}
|
2082 |
+
}
|
2083 |
+
});
|
2084 |
+
}
|
2085 |
+
|
2086 |
+
var hasHandler = {
|
2087 |
+
has: function has (target, key) {
|
2088 |
+
var has = key in target;
|
2089 |
+
var isAllowed = allowedGlobals(key) ||
|
2090 |
+
(typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
2091 |
+
if (!has && !isAllowed) {
|
2092 |
+
if (key in target.$data) { warnReservedPrefix(target, key); }
|
2093 |
+
else { warnNonPresent(target, key); }
|
2094 |
+
}
|
2095 |
+
return has || !isAllowed
|
2096 |
+
}
|
2097 |
+
};
|
2098 |
+
|
2099 |
+
var getHandler = {
|
2100 |
+
get: function get (target, key) {
|
2101 |
+
if (typeof key === 'string' && !(key in target)) {
|
2102 |
+
if (key in target.$data) { warnReservedPrefix(target, key); }
|
2103 |
+
else { warnNonPresent(target, key); }
|
2104 |
+
}
|
2105 |
+
return target[key]
|
2106 |
+
}
|
2107 |
+
};
|
2108 |
+
|
2109 |
+
initProxy = function initProxy (vm) {
|
2110 |
+
if (hasProxy) {
|
2111 |
+
// determine which proxy handler to use
|
2112 |
+
var options = vm.$options;
|
2113 |
+
var handlers = options.render && options.render._withStripped
|
2114 |
+
? getHandler
|
2115 |
+
: hasHandler;
|
2116 |
+
vm._renderProxy = new Proxy(vm, handlers);
|
2117 |
+
} else {
|
2118 |
+
vm._renderProxy = vm;
|
2119 |
+
}
|
2120 |
+
};
|
2121 |
+
}
|
2122 |
+
|
2123 |
+
/* */
|
2124 |
+
|
2125 |
+
var seenObjects = new _Set();
|
2126 |
+
|
2127 |
+
/**
|
2128 |
+
* Recursively traverse an object to evoke all converted
|
2129 |
+
* getters, so that every nested property inside the object
|
2130 |
+
* is collected as a "deep" dependency.
|
2131 |
+
*/
|
2132 |
+
function traverse (val) {
|
2133 |
+
_traverse(val, seenObjects);
|
2134 |
+
seenObjects.clear();
|
2135 |
+
}
|
2136 |
+
|
2137 |
+
function _traverse (val, seen) {
|
2138 |
+
var i, keys;
|
2139 |
+
var isA = Array.isArray(val);
|
2140 |
+
if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
2141 |
+
return
|
2142 |
+
}
|
2143 |
+
if (val.__ob__) {
|
2144 |
+
var depId = val.__ob__.dep.id;
|
2145 |
+
if (seen.has(depId)) {
|
2146 |
+
return
|
2147 |
+
}
|
2148 |
+
seen.add(depId);
|
2149 |
+
}
|
2150 |
+
if (isA) {
|
2151 |
+
i = val.length;
|
2152 |
+
while (i--) { _traverse(val[i], seen); }
|
2153 |
+
} else {
|
2154 |
+
keys = Object.keys(val);
|
2155 |
+
i = keys.length;
|
2156 |
+
while (i--) { _traverse(val[keys[i]], seen); }
|
2157 |
+
}
|
2158 |
+
}
|
2159 |
+
|
2160 |
+
/* */
|
2161 |
+
|
2162 |
+
var normalizeEvent = cached(function (name) {
|
2163 |
+
var passive = name.charAt(0) === '&';
|
2164 |
+
name = passive ? name.slice(1) : name;
|
2165 |
+
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
|
2166 |
+
name = once$$1 ? name.slice(1) : name;
|
2167 |
+
var capture = name.charAt(0) === '!';
|
2168 |
+
name = capture ? name.slice(1) : name;
|
2169 |
+
return {
|
2170 |
+
name: name,
|
2171 |
+
once: once$$1,
|
2172 |
+
capture: capture,
|
2173 |
+
passive: passive
|
2174 |
+
}
|
2175 |
+
});
|
2176 |
+
|
2177 |
+
function createFnInvoker (fns, vm) {
|
2178 |
+
function invoker () {
|
2179 |
+
var arguments$1 = arguments;
|
2180 |
+
|
2181 |
+
var fns = invoker.fns;
|
2182 |
+
if (Array.isArray(fns)) {
|
2183 |
+
var cloned = fns.slice();
|
2184 |
+
for (var i = 0; i < cloned.length; i++) {
|
2185 |
+
invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
2186 |
+
}
|
2187 |
+
} else {
|
2188 |
+
// return handler return value for single handlers
|
2189 |
+
return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
2190 |
+
}
|
2191 |
+
}
|
2192 |
+
invoker.fns = fns;
|
2193 |
+
return invoker
|
2194 |
+
}
|
2195 |
+
|
2196 |
+
function updateListeners (
|
2197 |
+
on,
|
2198 |
+
oldOn,
|
2199 |
+
add,
|
2200 |
+
remove$$1,
|
2201 |
+
createOnceHandler,
|
2202 |
+
vm
|
2203 |
+
) {
|
2204 |
+
var name, def$$1, cur, old, event;
|
2205 |
+
for (name in on) {
|
2206 |
+
def$$1 = cur = on[name];
|
2207 |
+
old = oldOn[name];
|
2208 |
+
event = normalizeEvent(name);
|
2209 |
+
if (isUndef(cur)) {
|
2210 |
+
warn(
|
2211 |
+
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
2212 |
+
vm
|
2213 |
+
);
|
2214 |
+
} else if (isUndef(old)) {
|
2215 |
+
if (isUndef(cur.fns)) {
|
2216 |
+
cur = on[name] = createFnInvoker(cur, vm);
|
2217 |
+
}
|
2218 |
+
if (isTrue(event.once)) {
|
2219 |
+
cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
2220 |
+
}
|
2221 |
+
add(event.name, cur, event.capture, event.passive, event.params);
|
2222 |
+
} else if (cur !== old) {
|
2223 |
+
old.fns = cur;
|
2224 |
+
on[name] = old;
|
2225 |
+
}
|
2226 |
+
}
|
2227 |
+
for (name in oldOn) {
|
2228 |
+
if (isUndef(on[name])) {
|
2229 |
+
event = normalizeEvent(name);
|
2230 |
+
remove$$1(event.name, oldOn[name], event.capture);
|
2231 |
+
}
|
2232 |
+
}
|
2233 |
+
}
|
2234 |
+
|
2235 |
+
/* */
|
2236 |
+
|
2237 |
+
function mergeVNodeHook (def, hookKey, hook) {
|
2238 |
+
if (def instanceof VNode) {
|
2239 |
+
def = def.data.hook || (def.data.hook = {});
|
2240 |
+
}
|
2241 |
+
var invoker;
|
2242 |
+
var oldHook = def[hookKey];
|
2243 |
+
|
2244 |
+
function wrappedHook () {
|
2245 |
+
hook.apply(this, arguments);
|
2246 |
+
// important: remove merged hook to ensure it's called only once
|
2247 |
+
// and prevent memory leak
|
2248 |
+
remove(invoker.fns, wrappedHook);
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
if (isUndef(oldHook)) {
|
2252 |
+
// no existing hook
|
2253 |
+
invoker = createFnInvoker([wrappedHook]);
|
2254 |
+
} else {
|
2255 |
+
/* istanbul ignore if */
|
2256 |
+
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
2257 |
+
// already a merged invoker
|
2258 |
+
invoker = oldHook;
|
2259 |
+
invoker.fns.push(wrappedHook);
|
2260 |
+
} else {
|
2261 |
+
// existing plain hook
|
2262 |
+
invoker = createFnInvoker([oldHook, wrappedHook]);
|
2263 |
+
}
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
invoker.merged = true;
|
2267 |
+
def[hookKey] = invoker;
|
2268 |
+
}
|
2269 |
+
|
2270 |
+
/* */
|
2271 |
+
|
2272 |
+
function extractPropsFromVNodeData (
|
2273 |
+
data,
|
2274 |
+
Ctor,
|
2275 |
+
tag
|
2276 |
+
) {
|
2277 |
+
// we are only extracting raw values here.
|
2278 |
+
// validation and default values are handled in the child
|
2279 |
+
// component itself.
|
2280 |
+
var propOptions = Ctor.options.props;
|
2281 |
+
if (isUndef(propOptions)) {
|
2282 |
+
return
|
2283 |
+
}
|
2284 |
+
var res = {};
|
2285 |
+
var attrs = data.attrs;
|
2286 |
+
var props = data.props;
|
2287 |
+
if (isDef(attrs) || isDef(props)) {
|
2288 |
+
for (var key in propOptions) {
|
2289 |
+
var altKey = hyphenate(key);
|
2290 |
+
{
|
2291 |
+
var keyInLowerCase = key.toLowerCase();
|
2292 |
+
if (
|
2293 |
+
key !== keyInLowerCase &&
|
2294 |
+
attrs && hasOwn(attrs, keyInLowerCase)
|
2295 |
+
) {
|
2296 |
+
tip(
|
2297 |
+
"Prop \"" + keyInLowerCase + "\" is passed to component " +
|
2298 |
+
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
2299 |
+
" \"" + key + "\". " +
|
2300 |
+
"Note that HTML attributes are case-insensitive and camelCased " +
|
2301 |
+
"props need to use their kebab-case equivalents when using in-DOM " +
|
2302 |
+
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
2303 |
+
);
|
2304 |
+
}
|
2305 |
+
}
|
2306 |
+
checkProp(res, props, key, altKey, true) ||
|
2307 |
+
checkProp(res, attrs, key, altKey, false);
|
2308 |
+
}
|
2309 |
+
}
|
2310 |
+
return res
|
2311 |
+
}
|
2312 |
+
|
2313 |
+
function checkProp (
|
2314 |
+
res,
|
2315 |
+
hash,
|
2316 |
+
key,
|
2317 |
+
altKey,
|
2318 |
+
preserve
|
2319 |
+
) {
|
2320 |
+
if (isDef(hash)) {
|
2321 |
+
if (hasOwn(hash, key)) {
|
2322 |
+
res[key] = hash[key];
|
2323 |
+
if (!preserve) {
|
2324 |
+
delete hash[key];
|
2325 |
+
}
|
2326 |
+
return true
|
2327 |
+
} else if (hasOwn(hash, altKey)) {
|
2328 |
+
res[key] = hash[altKey];
|
2329 |
+
if (!preserve) {
|
2330 |
+
delete hash[altKey];
|
2331 |
+
}
|
2332 |
+
return true
|
2333 |
+
}
|
2334 |
+
}
|
2335 |
+
return false
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
/* */
|
2339 |
+
|
2340 |
+
// The template compiler attempts to minimize the need for normalization by
|
2341 |
+
// statically analyzing the template at compile time.
|
2342 |
+
//
|
2343 |
+
// For plain HTML markup, normalization can be completely skipped because the
|
2344 |
+
// generated render function is guaranteed to return Array<VNode>. There are
|
2345 |
+
// two cases where extra normalization is needed:
|
2346 |
+
|
2347 |
+
// 1. When the children contains components - because a functional component
|
2348 |
+
// may return an Array instead of a single root. In this case, just a simple
|
2349 |
+
// normalization is needed - if any child is an Array, we flatten the whole
|
2350 |
+
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
|
2351 |
+
// because functional components already normalize their own children.
|
2352 |
+
function simpleNormalizeChildren (children) {
|
2353 |
+
for (var i = 0; i < children.length; i++) {
|
2354 |
+
if (Array.isArray(children[i])) {
|
2355 |
+
return Array.prototype.concat.apply([], children)
|
2356 |
+
}
|
2357 |
+
}
|
2358 |
+
return children
|
2359 |
+
}
|
2360 |
+
|
2361 |
+
// 2. When the children contains constructs that always generated nested Arrays,
|
2362 |
+
// e.g. <template>, <slot>, v-for, or when the children is provided by user
|
2363 |
+
// with hand-written render functions / JSX. In such cases a full normalization
|
2364 |
+
// is needed to cater to all possible types of children values.
|
2365 |
+
function normalizeChildren (children) {
|
2366 |
+
return isPrimitive(children)
|
2367 |
+
? [createTextVNode(children)]
|
2368 |
+
: Array.isArray(children)
|
2369 |
+
? normalizeArrayChildren(children)
|
2370 |
+
: undefined
|
2371 |
+
}
|
2372 |
+
|
2373 |
+
function isTextNode (node) {
|
2374 |
+
return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
2375 |
+
}
|
2376 |
+
|
2377 |
+
function normalizeArrayChildren (children, nestedIndex) {
|
2378 |
+
var res = [];
|
2379 |
+
var i, c, lastIndex, last;
|
2380 |
+
for (i = 0; i < children.length; i++) {
|
2381 |
+
c = children[i];
|
2382 |
+
if (isUndef(c) || typeof c === 'boolean') { continue }
|
2383 |
+
lastIndex = res.length - 1;
|
2384 |
+
last = res[lastIndex];
|
2385 |
+
// nested
|
2386 |
+
if (Array.isArray(c)) {
|
2387 |
+
if (c.length > 0) {
|
2388 |
+
c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
2389 |
+
// merge adjacent text nodes
|
2390 |
+
if (isTextNode(c[0]) && isTextNode(last)) {
|
2391 |
+
res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
2392 |
+
c.shift();
|
2393 |
+
}
|
2394 |
+
res.push.apply(res, c);
|
2395 |
+
}
|
2396 |
+
} else if (isPrimitive(c)) {
|
2397 |
+
if (isTextNode(last)) {
|
2398 |
+
// merge adjacent text nodes
|
2399 |
+
// this is necessary for SSR hydration because text nodes are
|
2400 |
+
// essentially merged when rendered to HTML strings
|
2401 |
+
res[lastIndex] = createTextVNode(last.text + c);
|
2402 |
+
} else if (c !== '') {
|
2403 |
+
// convert primitive to vnode
|
2404 |
+
res.push(createTextVNode(c));
|
2405 |
+
}
|
2406 |
+
} else {
|
2407 |
+
if (isTextNode(c) && isTextNode(last)) {
|
2408 |
+
// merge adjacent text nodes
|
2409 |
+
res[lastIndex] = createTextVNode(last.text + c.text);
|
2410 |
+
} else {
|
2411 |
+
// default key for nested array children (likely generated by v-for)
|
2412 |
+
if (isTrue(children._isVList) &&
|
2413 |
+
isDef(c.tag) &&
|
2414 |
+
isUndef(c.key) &&
|
2415 |
+
isDef(nestedIndex)) {
|
2416 |
+
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2417 |
+
}
|
2418 |
+
res.push(c);
|
2419 |
+
}
|
2420 |
+
}
|
2421 |
+
}
|
2422 |
+
return res
|
2423 |
+
}
|
2424 |
+
|
2425 |
+
/* */
|
2426 |
+
|
2427 |
+
function initProvide (vm) {
|
2428 |
+
var provide = vm.$options.provide;
|
2429 |
+
if (provide) {
|
2430 |
+
vm._provided = typeof provide === 'function'
|
2431 |
+
? provide.call(vm)
|
2432 |
+
: provide;
|
2433 |
+
}
|
2434 |
+
}
|
2435 |
+
|
2436 |
+
function initInjections (vm) {
|
2437 |
+
var result = resolveInject(vm.$options.inject, vm);
|
2438 |
+
if (result) {
|
2439 |
+
toggleObserving(false);
|
2440 |
+
Object.keys(result).forEach(function (key) {
|
2441 |
+
/* istanbul ignore else */
|
2442 |
+
{
|
2443 |
+
defineReactive$$1(vm, key, result[key], function () {
|
2444 |
+
warn(
|
2445 |
+
"Avoid mutating an injected value directly since the changes will be " +
|
2446 |
+
"overwritten whenever the provided component re-renders. " +
|
2447 |
+
"injection being mutated: \"" + key + "\"",
|
2448 |
+
vm
|
2449 |
+
);
|
2450 |
+
});
|
2451 |
+
}
|
2452 |
+
});
|
2453 |
+
toggleObserving(true);
|
2454 |
+
}
|
2455 |
+
}
|
2456 |
+
|
2457 |
+
function resolveInject (inject, vm) {
|
2458 |
+
if (inject) {
|
2459 |
+
// inject is :any because flow is not smart enough to figure out cached
|
2460 |
+
var result = Object.create(null);
|
2461 |
+
var keys = hasSymbol
|
2462 |
+
? Reflect.ownKeys(inject)
|
2463 |
+
: Object.keys(inject);
|
2464 |
+
|
2465 |
+
for (var i = 0; i < keys.length; i++) {
|
2466 |
+
var key = keys[i];
|
2467 |
+
// #6574 in case the inject object is observed...
|
2468 |
+
if (key === '__ob__') { continue }
|
2469 |
+
var provideKey = inject[key].from;
|
2470 |
+
var source = vm;
|
2471 |
+
while (source) {
|
2472 |
+
if (source._provided && hasOwn(source._provided, provideKey)) {
|
2473 |
+
result[key] = source._provided[provideKey];
|
2474 |
+
break
|
2475 |
+
}
|
2476 |
+
source = source.$parent;
|
2477 |
+
}
|
2478 |
+
if (!source) {
|
2479 |
+
if ('default' in inject[key]) {
|
2480 |
+
var provideDefault = inject[key].default;
|
2481 |
+
result[key] = typeof provideDefault === 'function'
|
2482 |
+
? provideDefault.call(vm)
|
2483 |
+
: provideDefault;
|
2484 |
+
} else {
|
2485 |
+
warn(("Injection \"" + key + "\" not found"), vm);
|
2486 |
+
}
|
2487 |
+
}
|
2488 |
+
}
|
2489 |
+
return result
|
2490 |
+
}
|
2491 |
+
}
|
2492 |
+
|
2493 |
+
/* */
|
2494 |
+
|
2495 |
+
|
2496 |
+
|
2497 |
+
/**
|
2498 |
+
* Runtime helper for resolving raw children VNodes into a slot object.
|
2499 |
+
*/
|
2500 |
+
function resolveSlots (
|
2501 |
+
children,
|
2502 |
+
context
|
2503 |
+
) {
|
2504 |
+
if (!children || !children.length) {
|
2505 |
+
return {}
|
2506 |
+
}
|
2507 |
+
var slots = {};
|
2508 |
+
for (var i = 0, l = children.length; i < l; i++) {
|
2509 |
+
var child = children[i];
|
2510 |
+
var data = child.data;
|
2511 |
+
// remove slot attribute if the node is resolved as a Vue slot node
|
2512 |
+
if (data && data.attrs && data.attrs.slot) {
|
2513 |
+
delete data.attrs.slot;
|
2514 |
+
}
|
2515 |
+
// named slots should only be respected if the vnode was rendered in the
|
2516 |
+
// same context.
|
2517 |
+
if ((child.context === context || child.fnContext === context) &&
|
2518 |
+
data && data.slot != null
|
2519 |
+
) {
|
2520 |
+
var name = data.slot;
|
2521 |
+
var slot = (slots[name] || (slots[name] = []));
|
2522 |
+
if (child.tag === 'template') {
|
2523 |
+
slot.push.apply(slot, child.children || []);
|
2524 |
+
} else {
|
2525 |
+
slot.push(child);
|
2526 |
+
}
|
2527 |
+
} else {
|
2528 |
+
(slots.default || (slots.default = [])).push(child);
|
2529 |
+
}
|
2530 |
+
}
|
2531 |
+
// ignore slots that contains only whitespace
|
2532 |
+
for (var name$1 in slots) {
|
2533 |
+
if (slots[name$1].every(isWhitespace)) {
|
2534 |
+
delete slots[name$1];
|
2535 |
+
}
|
2536 |
+
}
|
2537 |
+
return slots
|
2538 |
+
}
|
2539 |
+
|
2540 |
+
function isWhitespace (node) {
|
2541 |
+
return (node.isComment && !node.asyncFactory) || node.text === ' '
|
2542 |
+
}
|
2543 |
+
|
2544 |
+
/* */
|
2545 |
+
|
2546 |
+
function normalizeScopedSlots (
|
2547 |
+
slots,
|
2548 |
+
normalSlots,
|
2549 |
+
prevSlots
|
2550 |
+
) {
|
2551 |
+
var res;
|
2552 |
+
var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
2553 |
+
var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
2554 |
+
var key = slots && slots.$key;
|
2555 |
+
if (!slots) {
|
2556 |
+
res = {};
|
2557 |
+
} else if (slots._normalized) {
|
2558 |
+
// fast path 1: child component re-render only, parent did not change
|
2559 |
+
return slots._normalized
|
2560 |
+
} else if (
|
2561 |
+
isStable &&
|
2562 |
+
prevSlots &&
|
2563 |
+
prevSlots !== emptyObject &&
|
2564 |
+
key === prevSlots.$key &&
|
2565 |
+
!hasNormalSlots &&
|
2566 |
+
!prevSlots.$hasNormal
|
2567 |
+
) {
|
2568 |
+
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
2569 |
+
// only need to normalize once
|
2570 |
+
return prevSlots
|
2571 |
+
} else {
|
2572 |
+
res = {};
|
2573 |
+
for (var key$1 in slots) {
|
2574 |
+
if (slots[key$1] && key$1[0] !== '$') {
|
2575 |
+
res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
|
2576 |
+
}
|
2577 |
+
}
|
2578 |
+
}
|
2579 |
+
// expose normal slots on scopedSlots
|
2580 |
+
for (var key$2 in normalSlots) {
|
2581 |
+
if (!(key$2 in res)) {
|
2582 |
+
res[key$2] = proxyNormalSlot(normalSlots, key$2);
|
2583 |
+
}
|
2584 |
+
}
|
2585 |
+
// avoriaz seems to mock a non-extensible $scopedSlots object
|
2586 |
+
// and when that is passed down this would cause an error
|
2587 |
+
if (slots && Object.isExtensible(slots)) {
|
2588 |
+
(slots)._normalized = res;
|
2589 |
+
}
|
2590 |
+
def(res, '$stable', isStable);
|
2591 |
+
def(res, '$key', key);
|
2592 |
+
def(res, '$hasNormal', hasNormalSlots);
|
2593 |
+
return res
|
2594 |
+
}
|
2595 |
+
|
2596 |
+
function normalizeScopedSlot(normalSlots, key, fn) {
|
2597 |
+
var normalized = function () {
|
2598 |
+
var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
2599 |
+
res = res && typeof res === 'object' && !Array.isArray(res)
|
2600 |
+
? [res] // single vnode
|
2601 |
+
: normalizeChildren(res);
|
2602 |
+
return res && (
|
2603 |
+
res.length === 0 ||
|
2604 |
+
(res.length === 1 && res[0].isComment) // #9658
|
2605 |
+
) ? undefined
|
2606 |
+
: res
|
2607 |
+
};
|
2608 |
+
// this is a slot using the new v-slot syntax without scope. although it is
|
2609 |
+
// compiled as a scoped slot, render fn users would expect it to be present
|
2610 |
+
// on this.$slots because the usage is semantically a normal slot.
|
2611 |
+
if (fn.proxy) {
|
2612 |
+
Object.defineProperty(normalSlots, key, {
|
2613 |
+
get: normalized,
|
2614 |
+
enumerable: true,
|
2615 |
+
configurable: true
|
2616 |
+
});
|
2617 |
+
}
|
2618 |
+
return normalized
|
2619 |
+
}
|
2620 |
+
|
2621 |
+
function proxyNormalSlot(slots, key) {
|
2622 |
+
return function () { return slots[key]; }
|
2623 |
+
}
|
2624 |
+
|
2625 |
+
/* */
|
2626 |
+
|
2627 |
+
/**
|
2628 |
+
* Runtime helper for rendering v-for lists.
|
2629 |
+
*/
|
2630 |
+
function renderList (
|
2631 |
+
val,
|
2632 |
+
render
|
2633 |
+
) {
|
2634 |
+
var ret, i, l, keys, key;
|
2635 |
+
if (Array.isArray(val) || typeof val === 'string') {
|
2636 |
+
ret = new Array(val.length);
|
2637 |
+
for (i = 0, l = val.length; i < l; i++) {
|
2638 |
+
ret[i] = render(val[i], i);
|
2639 |
+
}
|
2640 |
+
} else if (typeof val === 'number') {
|
2641 |
+
ret = new Array(val);
|
2642 |
+
for (i = 0; i < val; i++) {
|
2643 |
+
ret[i] = render(i + 1, i);
|
2644 |
+
}
|
2645 |
+
} else if (isObject(val)) {
|
2646 |
+
if (hasSymbol && val[Symbol.iterator]) {
|
2647 |
+
ret = [];
|
2648 |
+
var iterator = val[Symbol.iterator]();
|
2649 |
+
var result = iterator.next();
|
2650 |
+
while (!result.done) {
|
2651 |
+
ret.push(render(result.value, ret.length));
|
2652 |
+
result = iterator.next();
|
2653 |
+
}
|
2654 |
+
} else {
|
2655 |
+
keys = Object.keys(val);
|
2656 |
+
ret = new Array(keys.length);
|
2657 |
+
for (i = 0, l = keys.length; i < l; i++) {
|
2658 |
+
key = keys[i];
|
2659 |
+
ret[i] = render(val[key], key, i);
|
2660 |
+
}
|
2661 |
+
}
|
2662 |
+
}
|
2663 |
+
if (!isDef(ret)) {
|
2664 |
+
ret = [];
|
2665 |
+
}
|
2666 |
+
(ret)._isVList = true;
|
2667 |
+
return ret
|
2668 |
+
}
|
2669 |
+
|
2670 |
+
/* */
|
2671 |
+
|
2672 |
+
/**
|
2673 |
+
* Runtime helper for rendering <slot>
|
2674 |
+
*/
|
2675 |
+
function renderSlot (
|
2676 |
+
name,
|
2677 |
+
fallback,
|
2678 |
+
props,
|
2679 |
+
bindObject
|
2680 |
+
) {
|
2681 |
+
var scopedSlotFn = this.$scopedSlots[name];
|
2682 |
+
var nodes;
|
2683 |
+
if (scopedSlotFn) { // scoped slot
|
2684 |
+
props = props || {};
|
2685 |
+
if (bindObject) {
|
2686 |
+
if (!isObject(bindObject)) {
|
2687 |
+
warn(
|
2688 |
+
'slot v-bind without argument expects an Object',
|
2689 |
+
this
|
2690 |
+
);
|
2691 |
+
}
|
2692 |
+
props = extend(extend({}, bindObject), props);
|
2693 |
+
}
|
2694 |
+
nodes = scopedSlotFn(props) || fallback;
|
2695 |
+
} else {
|
2696 |
+
nodes = this.$slots[name] || fallback;
|
2697 |
+
}
|
2698 |
+
|
2699 |
+
var target = props && props.slot;
|
2700 |
+
if (target) {
|
2701 |
+
return this.$createElement('template', { slot: target }, nodes)
|
2702 |
+
} else {
|
2703 |
+
return nodes
|
2704 |
+
}
|
2705 |
+
}
|
2706 |
+
|
2707 |
+
/* */
|
2708 |
+
|
2709 |
+
/**
|
2710 |
+
* Runtime helper for resolving filters
|
2711 |
+
*/
|
2712 |
+
function resolveFilter (id) {
|
2713 |
+
return resolveAsset(this.$options, 'filters', id, true) || identity
|
2714 |
+
}
|
2715 |
+
|
2716 |
+
/* */
|
2717 |
+
|
2718 |
+
function isKeyNotMatch (expect, actual) {
|
2719 |
+
if (Array.isArray(expect)) {
|
2720 |
+
return expect.indexOf(actual) === -1
|
2721 |
+
} else {
|
2722 |
+
return expect !== actual
|
2723 |
+
}
|
2724 |
+
}
|
2725 |
+
|
2726 |
+
/**
|
2727 |
+
* Runtime helper for checking keyCodes from config.
|
2728 |
+
* exposed as Vue.prototype._k
|
2729 |
+
* passing in eventKeyName as last argument separately for backwards compat
|
2730 |
+
*/
|
2731 |
+
function checkKeyCodes (
|
2732 |
+
eventKeyCode,
|
2733 |
+
key,
|
2734 |
+
builtInKeyCode,
|
2735 |
+
eventKeyName,
|
2736 |
+
builtInKeyName
|
2737 |
+
) {
|
2738 |
+
var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
2739 |
+
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
2740 |
+
return isKeyNotMatch(builtInKeyName, eventKeyName)
|
2741 |
+
} else if (mappedKeyCode) {
|
2742 |
+
return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
2743 |
+
} else if (eventKeyName) {
|
2744 |
+
return hyphenate(eventKeyName) !== key
|
2745 |
+
}
|
2746 |
+
}
|
2747 |
+
|
2748 |
+
/* */
|
2749 |
+
|
2750 |
+
/**
|
2751 |
+
* Runtime helper for merging v-bind="object" into a VNode's data.
|
2752 |
+
*/
|
2753 |
+
function bindObjectProps (
|
2754 |
+
data,
|
2755 |
+
tag,
|
2756 |
+
value,
|
2757 |
+
asProp,
|
2758 |
+
isSync
|
2759 |
+
) {
|
2760 |
+
if (value) {
|
2761 |
+
if (!isObject(value)) {
|
2762 |
+
warn(
|
2763 |
+
'v-bind without argument expects an Object or Array value',
|
2764 |
+
this
|
2765 |
+
);
|
2766 |
+
} else {
|
2767 |
+
if (Array.isArray(value)) {
|
2768 |
+
value = toObject(value);
|
2769 |
+
}
|
2770 |
+
var hash;
|
2771 |
+
var loop = function ( key ) {
|
2772 |
+
if (
|
2773 |
+
key === 'class' ||
|
2774 |
+
key === 'style' ||
|
2775 |
+
isReservedAttribute(key)
|
2776 |
+
) {
|
2777 |
+
hash = data;
|
2778 |
+
} else {
|
2779 |
+
var type = data.attrs && data.attrs.type;
|
2780 |
+
hash = asProp || config.mustUseProp(tag, type, key)
|
2781 |
+
? data.domProps || (data.domProps = {})
|
2782 |
+
: data.attrs || (data.attrs = {});
|
2783 |
+
}
|
2784 |
+
var camelizedKey = camelize(key);
|
2785 |
+
var hyphenatedKey = hyphenate(key);
|
2786 |
+
if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
2787 |
+
hash[key] = value[key];
|
2788 |
+
|
2789 |
+
if (isSync) {
|
2790 |
+
var on = data.on || (data.on = {});
|
2791 |
+
on[("update:" + key)] = function ($event) {
|
2792 |
+
value[key] = $event;
|
2793 |
+
};
|
2794 |
+
}
|
2795 |
+
}
|
2796 |
+
};
|
2797 |
+
|
2798 |
+
for (var key in value) loop( key );
|
2799 |
+
}
|
2800 |
+
}
|
2801 |
+
return data
|
2802 |
+
}
|
2803 |
+
|
2804 |
+
/* */
|
2805 |
+
|
2806 |
+
/**
|
2807 |
+
* Runtime helper for rendering static trees.
|
2808 |
+
*/
|
2809 |
+
function renderStatic (
|
2810 |
+
index,
|
2811 |
+
isInFor
|
2812 |
+
) {
|
2813 |
+
var cached = this._staticTrees || (this._staticTrees = []);
|
2814 |
+
var tree = cached[index];
|
2815 |
+
// if has already-rendered static tree and not inside v-for,
|
2816 |
+
// we can reuse the same tree.
|
2817 |
+
if (tree && !isInFor) {
|
2818 |
+
return tree
|
2819 |
+
}
|
2820 |
+
// otherwise, render a fresh tree.
|
2821 |
+
tree = cached[index] = this.$options.staticRenderFns[index].call(
|
2822 |
+
this._renderProxy,
|
2823 |
+
null,
|
2824 |
+
this // for render fns generated for functional component templates
|
2825 |
+
);
|
2826 |
+
markStatic(tree, ("__static__" + index), false);
|
2827 |
+
return tree
|
2828 |
+
}
|
2829 |
+
|
2830 |
+
/**
|
2831 |
+
* Runtime helper for v-once.
|
2832 |
+
* Effectively it means marking the node as static with a unique key.
|
2833 |
+
*/
|
2834 |
+
function markOnce (
|
2835 |
+
tree,
|
2836 |
+
index,
|
2837 |
+
key
|
2838 |
+
) {
|
2839 |
+
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
2840 |
+
return tree
|
2841 |
+
}
|
2842 |
+
|
2843 |
+
function markStatic (
|
2844 |
+
tree,
|
2845 |
+
key,
|
2846 |
+
isOnce
|
2847 |
+
) {
|
2848 |
+
if (Array.isArray(tree)) {
|
2849 |
+
for (var i = 0; i < tree.length; i++) {
|
2850 |
+
if (tree[i] && typeof tree[i] !== 'string') {
|
2851 |
+
markStaticNode(tree[i], (key + "_" + i), isOnce);
|
2852 |
+
}
|
2853 |
+
}
|
2854 |
+
} else {
|
2855 |
+
markStaticNode(tree, key, isOnce);
|
2856 |
+
}
|
2857 |
+
}
|
2858 |
+
|
2859 |
+
function markStaticNode (node, key, isOnce) {
|
2860 |
+
node.isStatic = true;
|
2861 |
+
node.key = key;
|
2862 |
+
node.isOnce = isOnce;
|
2863 |
+
}
|
2864 |
+
|
2865 |
+
/* */
|
2866 |
+
|
2867 |
+
function bindObjectListeners (data, value) {
|
2868 |
+
if (value) {
|
2869 |
+
if (!isPlainObject(value)) {
|
2870 |
+
warn(
|
2871 |
+
'v-on without argument expects an Object value',
|
2872 |
+
this
|
2873 |
+
);
|
2874 |
+
} else {
|
2875 |
+
var on = data.on = data.on ? extend({}, data.on) : {};
|
2876 |
+
for (var key in value) {
|
2877 |
+
var existing = on[key];
|
2878 |
+
var ours = value[key];
|
2879 |
+
on[key] = existing ? [].concat(existing, ours) : ours;
|
2880 |
+
}
|
2881 |
+
}
|
2882 |
+
}
|
2883 |
+
return data
|
2884 |
+
}
|
2885 |
+
|
2886 |
+
/* */
|
2887 |
+
|
2888 |
+
function resolveScopedSlots (
|
2889 |
+
fns, // see flow/vnode
|
2890 |
+
res,
|
2891 |
+
// the following are added in 2.6
|
2892 |
+
hasDynamicKeys,
|
2893 |
+
contentHashKey
|
2894 |
+
) {
|
2895 |
+
res = res || { $stable: !hasDynamicKeys };
|
2896 |
+
for (var i = 0; i < fns.length; i++) {
|
2897 |
+
var slot = fns[i];
|
2898 |
+
if (Array.isArray(slot)) {
|
2899 |
+
resolveScopedSlots(slot, res, hasDynamicKeys);
|
2900 |
+
} else if (slot) {
|
2901 |
+
// marker for reverse proxying v-slot without scope on this.$slots
|
2902 |
+
if (slot.proxy) {
|
2903 |
+
slot.fn.proxy = true;
|
2904 |
+
}
|
2905 |
+
res[slot.key] = slot.fn;
|
2906 |
+
}
|
2907 |
+
}
|
2908 |
+
if (contentHashKey) {
|
2909 |
+
(res).$key = contentHashKey;
|
2910 |
+
}
|
2911 |
+
return res
|
2912 |
+
}
|
2913 |
+
|
2914 |
+
/* */
|
2915 |
+
|
2916 |
+
function bindDynamicKeys (baseObj, values) {
|
2917 |
+
for (var i = 0; i < values.length; i += 2) {
|
2918 |
+
var key = values[i];
|
2919 |
+
if (typeof key === 'string' && key) {
|
2920 |
+
baseObj[values[i]] = values[i + 1];
|
2921 |
+
} else if (key !== '' && key !== null) {
|
2922 |
+
// null is a speical value for explicitly removing a binding
|
2923 |
+
warn(
|
2924 |
+
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
2925 |
+
this
|
2926 |
+
);
|
2927 |
+
}
|
2928 |
+
}
|
2929 |
+
return baseObj
|
2930 |
+
}
|
2931 |
+
|
2932 |
+
// helper to dynamically append modifier runtime markers to event names.
|
2933 |
+
// ensure only append when value is already string, otherwise it will be cast
|
2934 |
+
// to string and cause the type check to miss.
|
2935 |
+
function prependModifier (value, symbol) {
|
2936 |
+
return typeof value === 'string' ? symbol + value : value
|
2937 |
+
}
|
2938 |
+
|
2939 |
+
/* */
|
2940 |
+
|
2941 |
+
function installRenderHelpers (target) {
|
2942 |
+
target._o = markOnce;
|
2943 |
+
target._n = toNumber;
|
2944 |
+
target._s = toString;
|
2945 |
+
target._l = renderList;
|
2946 |
+
target._t = renderSlot;
|
2947 |
+
target._q = looseEqual;
|
2948 |
+
target._i = looseIndexOf;
|
2949 |
+
target._m = renderStatic;
|
2950 |
+
target._f = resolveFilter;
|
2951 |
+
target._k = checkKeyCodes;
|
2952 |
+
target._b = bindObjectProps;
|
2953 |
+
target._v = createTextVNode;
|
2954 |
+
target._e = createEmptyVNode;
|
2955 |
+
target._u = resolveScopedSlots;
|
2956 |
+
target._g = bindObjectListeners;
|
2957 |
+
target._d = bindDynamicKeys;
|
2958 |
+
target._p = prependModifier;
|
2959 |
+
}
|
2960 |
+
|
2961 |
+
/* */
|
2962 |
+
|
2963 |
+
function FunctionalRenderContext (
|
2964 |
+
data,
|
2965 |
+
props,
|
2966 |
+
children,
|
2967 |
+
parent,
|
2968 |
+
Ctor
|
2969 |
+
) {
|
2970 |
+
var this$1 = this;
|
2971 |
+
|
2972 |
+
var options = Ctor.options;
|
2973 |
+
// ensure the createElement function in functional components
|
2974 |
+
// gets a unique context - this is necessary for correct named slot check
|
2975 |
+
var contextVm;
|
2976 |
+
if (hasOwn(parent, '_uid')) {
|
2977 |
+
contextVm = Object.create(parent);
|
2978 |
+
// $flow-disable-line
|
2979 |
+
contextVm._original = parent;
|
2980 |
+
} else {
|
2981 |
+
// the context vm passed in is a functional context as well.
|
2982 |
+
// in this case we want to make sure we are able to get a hold to the
|
2983 |
+
// real context instance.
|
2984 |
+
contextVm = parent;
|
2985 |
+
// $flow-disable-line
|
2986 |
+
parent = parent._original;
|
2987 |
+
}
|
2988 |
+
var isCompiled = isTrue(options._compiled);
|
2989 |
+
var needNormalization = !isCompiled;
|
2990 |
+
|
2991 |
+
this.data = data;
|
2992 |
+
this.props = props;
|
2993 |
+
this.children = children;
|
2994 |
+
this.parent = parent;
|
2995 |
+
this.listeners = data.on || emptyObject;
|
2996 |
+
this.injections = resolveInject(options.inject, parent);
|
2997 |
+
this.slots = function () {
|
2998 |
+
if (!this$1.$slots) {
|
2999 |
+
normalizeScopedSlots(
|
3000 |
+
data.scopedSlots,
|
3001 |
+
this$1.$slots = resolveSlots(children, parent)
|
3002 |
+
);
|
3003 |
+
}
|
3004 |
+
return this$1.$slots
|
3005 |
+
};
|
3006 |
+
|
3007 |
+
Object.defineProperty(this, 'scopedSlots', ({
|
3008 |
+
enumerable: true,
|
3009 |
+
get: function get () {
|
3010 |
+
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
3011 |
+
}
|
3012 |
+
}));
|
3013 |
+
|
3014 |
+
// support for compiled functional template
|
3015 |
+
if (isCompiled) {
|
3016 |
+
// exposing $options for renderStatic()
|
3017 |
+
this.$options = options;
|
3018 |
+
// pre-resolve slots for renderSlot()
|
3019 |
+
this.$slots = this.slots();
|
3020 |
+
this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
3021 |
+
}
|
3022 |
+
|
3023 |
+
if (options._scopeId) {
|
3024 |
+
this._c = function (a, b, c, d) {
|
3025 |
+
var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
3026 |
+
if (vnode && !Array.isArray(vnode)) {
|
3027 |
+
vnode.fnScopeId = options._scopeId;
|
3028 |
+
vnode.fnContext = parent;
|
3029 |
+
}
|
3030 |
+
return vnode
|
3031 |
+
};
|
3032 |
+
} else {
|
3033 |
+
this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
3034 |
+
}
|
3035 |
+
}
|
3036 |
+
|
3037 |
+
installRenderHelpers(FunctionalRenderContext.prototype);
|
3038 |
+
|
3039 |
+
function createFunctionalComponent (
|
3040 |
+
Ctor,
|
3041 |
+
propsData,
|
3042 |
+
data,
|
3043 |
+
contextVm,
|
3044 |
+
children
|
3045 |
+
) {
|
3046 |
+
var options = Ctor.options;
|
3047 |
+
var props = {};
|
3048 |
+
var propOptions = options.props;
|
3049 |
+
if (isDef(propOptions)) {
|
3050 |
+
for (var key in propOptions) {
|
3051 |
+
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
3052 |
+
}
|
3053 |
+
} else {
|
3054 |
+
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
3055 |
+
if (isDef(data.props)) { mergeProps(props, data.props); }
|
3056 |
+
}
|
3057 |
+
|
3058 |
+
var renderContext = new FunctionalRenderContext(
|
3059 |
+
data,
|
3060 |
+
props,
|
3061 |
+
children,
|
3062 |
+
contextVm,
|
3063 |
+
Ctor
|
3064 |
+
);
|
3065 |
+
|
3066 |
+
var vnode = options.render.call(null, renderContext._c, renderContext);
|
3067 |
+
|
3068 |
+
if (vnode instanceof VNode) {
|
3069 |
+
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
3070 |
+
} else if (Array.isArray(vnode)) {
|
3071 |
+
var vnodes = normalizeChildren(vnode) || [];
|
3072 |
+
var res = new Array(vnodes.length);
|
3073 |
+
for (var i = 0; i < vnodes.length; i++) {
|
3074 |
+
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
3075 |
+
}
|
3076 |
+
return res
|
3077 |
+
}
|
3078 |
+
}
|
3079 |
+
|
3080 |
+
function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
3081 |
+
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
3082 |
+
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
3083 |
+
// that should not be matched to match.
|
3084 |
+
var clone = cloneVNode(vnode);
|
3085 |
+
clone.fnContext = contextVm;
|
3086 |
+
clone.fnOptions = options;
|
3087 |
+
{
|
3088 |
+
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
3089 |
+
}
|
3090 |
+
if (data.slot) {
|
3091 |
+
(clone.data || (clone.data = {})).slot = data.slot;
|
3092 |
+
}
|
3093 |
+
return clone
|
3094 |
+
}
|
3095 |
+
|
3096 |
+
function mergeProps (to, from) {
|
3097 |
+
for (var key in from) {
|
3098 |
+
to[camelize(key)] = from[key];
|
3099 |
+
}
|
3100 |
+
}
|
3101 |
+
|
3102 |
+
/* */
|
3103 |
+
|
3104 |
+
/* */
|
3105 |
+
|
3106 |
+
/* */
|
3107 |
+
|
3108 |
+
/* */
|
3109 |
+
|
3110 |
+
// inline hooks to be invoked on component VNodes during patch
|
3111 |
+
var componentVNodeHooks = {
|
3112 |
+
init: function init (vnode, hydrating) {
|
3113 |
+
if (
|
3114 |
+
vnode.componentInstance &&
|
3115 |
+
!vnode.componentInstance._isDestroyed &&
|
3116 |
+
vnode.data.keepAlive
|
3117 |
+
) {
|
3118 |
+
// kept-alive components, treat as a patch
|
3119 |
+
var mountedNode = vnode; // work around flow
|
3120 |
+
componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
3121 |
+
} else {
|
3122 |
+
var child = vnode.componentInstance = createComponentInstanceForVnode(
|
3123 |
+
vnode,
|
3124 |
+
activeInstance
|
3125 |
+
);
|
3126 |
+
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
3127 |
+
}
|
3128 |
+
},
|
3129 |
+
|
3130 |
+
prepatch: function prepatch (oldVnode, vnode) {
|
3131 |
+
var options = vnode.componentOptions;
|
3132 |
+
var child = vnode.componentInstance = oldVnode.componentInstance;
|
3133 |
+
updateChildComponent(
|
3134 |
+
child,
|
3135 |
+
options.propsData, // updated props
|
3136 |
+
options.listeners, // updated listeners
|
3137 |
+
vnode, // new parent vnode
|
3138 |
+
options.children // new children
|
3139 |
+
);
|
3140 |
+
},
|
3141 |
+
|
3142 |
+
insert: function insert (vnode) {
|
3143 |
+
var context = vnode.context;
|
3144 |
+
var componentInstance = vnode.componentInstance;
|
3145 |
+
if (!componentInstance._isMounted) {
|
3146 |
+
componentInstance._isMounted = true;
|
3147 |
+
callHook(componentInstance, 'mounted');
|
3148 |
+
}
|
3149 |
+
if (vnode.data.keepAlive) {
|
3150 |
+
if (context._isMounted) {
|
3151 |
+
// vue-router#1212
|
3152 |
+
// During updates, a kept-alive component's child components may
|
3153 |
+
// change, so directly walking the tree here may call activated hooks
|
3154 |
+
// on incorrect children. Instead we push them into a queue which will
|
3155 |
+
// be processed after the whole patch process ended.
|
3156 |
+
queueActivatedComponent(componentInstance);
|
3157 |
+
} else {
|
3158 |
+
activateChildComponent(componentInstance, true /* direct */);
|
3159 |
+
}
|
3160 |
+
}
|
3161 |
+
},
|
3162 |
+
|
3163 |
+
destroy: function destroy (vnode) {
|
3164 |
+
var componentInstance = vnode.componentInstance;
|
3165 |
+
if (!componentInstance._isDestroyed) {
|
3166 |
+
if (!vnode.data.keepAlive) {
|
3167 |
+
componentInstance.$destroy();
|
3168 |
+
} else {
|
3169 |
+
deactivateChildComponent(componentInstance, true /* direct */);
|
3170 |
+
}
|
3171 |
+
}
|
3172 |
+
}
|
3173 |
+
};
|
3174 |
+
|
3175 |
+
var hooksToMerge = Object.keys(componentVNodeHooks);
|
3176 |
+
|
3177 |
+
function createComponent (
|
3178 |
+
Ctor,
|
3179 |
+
data,
|
3180 |
+
context,
|
3181 |
+
children,
|
3182 |
+
tag
|
3183 |
+
) {
|
3184 |
+
if (isUndef(Ctor)) {
|
3185 |
+
return
|
3186 |
+
}
|
3187 |
+
|
3188 |
+
var baseCtor = context.$options._base;
|
3189 |
+
|
3190 |
+
// plain options object: turn it into a constructor
|
3191 |
+
if (isObject(Ctor)) {
|
3192 |
+
Ctor = baseCtor.extend(Ctor);
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
// if at this stage it's not a constructor or an async component factory,
|
3196 |
+
// reject.
|
3197 |
+
if (typeof Ctor !== 'function') {
|
3198 |
+
{
|
3199 |
+
warn(("Invalid Component definition: " + (String(Ctor))), context);
|
3200 |
+
}
|
3201 |
+
return
|
3202 |
+
}
|
3203 |
+
|
3204 |
+
// async component
|
3205 |
+
var asyncFactory;
|
3206 |
+
if (isUndef(Ctor.cid)) {
|
3207 |
+
asyncFactory = Ctor;
|
3208 |
+
Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
3209 |
+
if (Ctor === undefined) {
|
3210 |
+
// return a placeholder node for async component, which is rendered
|
3211 |
+
// as a comment node but preserves all the raw information for the node.
|
3212 |
+
// the information will be used for async server-rendering and hydration.
|
3213 |
+
return createAsyncPlaceholder(
|
3214 |
+
asyncFactory,
|
3215 |
+
data,
|
3216 |
+
context,
|
3217 |
+
children,
|
3218 |
+
tag
|
3219 |
+
)
|
3220 |
+
}
|
3221 |
+
}
|
3222 |
+
|
3223 |
+
data = data || {};
|
3224 |
+
|
3225 |
+
// resolve constructor options in case global mixins are applied after
|
3226 |
+
// component constructor creation
|
3227 |
+
resolveConstructorOptions(Ctor);
|
3228 |
+
|
3229 |
+
// transform component v-model data into props & events
|
3230 |
+
if (isDef(data.model)) {
|
3231 |
+
transformModel(Ctor.options, data);
|
3232 |
+
}
|
3233 |
+
|
3234 |
+
// extract props
|
3235 |
+
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
3236 |
+
|
3237 |
+
// functional component
|
3238 |
+
if (isTrue(Ctor.options.functional)) {
|
3239 |
+
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
3240 |
+
}
|
3241 |
+
|
3242 |
+
// extract listeners, since these needs to be treated as
|
3243 |
+
// child component listeners instead of DOM listeners
|
3244 |
+
var listeners = data.on;
|
3245 |
+
// replace with listeners with .native modifier
|
3246 |
+
// so it gets processed during parent component patch.
|
3247 |
+
data.on = data.nativeOn;
|
3248 |
+
|
3249 |
+
if (isTrue(Ctor.options.abstract)) {
|
3250 |
+
// abstract components do not keep anything
|
3251 |
+
// other than props & listeners & slot
|
3252 |
+
|
3253 |
+
// work around flow
|
3254 |
+
var slot = data.slot;
|
3255 |
+
data = {};
|
3256 |
+
if (slot) {
|
3257 |
+
data.slot = slot;
|
3258 |
+
}
|
3259 |
+
}
|
3260 |
+
|
3261 |
+
// install component management hooks onto the placeholder node
|
3262 |
+
installComponentHooks(data);
|
3263 |
+
|
3264 |
+
// return a placeholder vnode
|
3265 |
+
var name = Ctor.options.name || tag;
|
3266 |
+
var vnode = new VNode(
|
3267 |
+
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
3268 |
+
data, undefined, undefined, undefined, context,
|
3269 |
+
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
3270 |
+
asyncFactory
|
3271 |
+
);
|
3272 |
+
|
3273 |
+
return vnode
|
3274 |
+
}
|
3275 |
+
|
3276 |
+
function createComponentInstanceForVnode (
|
3277 |
+
vnode, // we know it's MountedComponentVNode but flow doesn't
|
3278 |
+
parent // activeInstance in lifecycle state
|
3279 |
+
) {
|
3280 |
+
var options = {
|
3281 |
+
_isComponent: true,
|
3282 |
+
_parentVnode: vnode,
|
3283 |
+
parent: parent
|
3284 |
+
};
|
3285 |
+
// check inline-template render functions
|
3286 |
+
var inlineTemplate = vnode.data.inlineTemplate;
|
3287 |
+
if (isDef(inlineTemplate)) {
|
3288 |
+
options.render = inlineTemplate.render;
|
3289 |
+
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
3290 |
+
}
|
3291 |
+
return new vnode.componentOptions.Ctor(options)
|
3292 |
+
}
|
3293 |
+
|
3294 |
+
function installComponentHooks (data) {
|
3295 |
+
var hooks = data.hook || (data.hook = {});
|
3296 |
+
for (var i = 0; i < hooksToMerge.length; i++) {
|
3297 |
+
var key = hooksToMerge[i];
|
3298 |
+
var existing = hooks[key];
|
3299 |
+
var toMerge = componentVNodeHooks[key];
|
3300 |
+
if (existing !== toMerge && !(existing && existing._merged)) {
|
3301 |
+
hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
3302 |
+
}
|
3303 |
+
}
|
3304 |
+
}
|
3305 |
+
|
3306 |
+
function mergeHook$1 (f1, f2) {
|
3307 |
+
var merged = function (a, b) {
|
3308 |
+
// flow complains about extra args which is why we use any
|
3309 |
+
f1(a, b);
|
3310 |
+
f2(a, b);
|
3311 |
+
};
|
3312 |
+
merged._merged = true;
|
3313 |
+
return merged
|
3314 |
+
}
|
3315 |
+
|
3316 |
+
// transform component v-model info (value and callback) into
|
3317 |
+
// prop and event handler respectively.
|
3318 |
+
function transformModel (options, data) {
|
3319 |
+
var prop = (options.model && options.model.prop) || 'value';
|
3320 |
+
var event = (options.model && options.model.event) || 'input'
|
3321 |
+
;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
3322 |
+
var on = data.on || (data.on = {});
|
3323 |
+
var existing = on[event];
|
3324 |
+
var callback = data.model.callback;
|
3325 |
+
if (isDef(existing)) {
|
3326 |
+
if (
|
3327 |
+
Array.isArray(existing)
|
3328 |
+
? existing.indexOf(callback) === -1
|
3329 |
+
: existing !== callback
|
3330 |
+
) {
|
3331 |
+
on[event] = [callback].concat(existing);
|
3332 |
+
}
|
3333 |
+
} else {
|
3334 |
+
on[event] = callback;
|
3335 |
+
}
|
3336 |
+
}
|
3337 |
+
|
3338 |
+
/* */
|
3339 |
+
|
3340 |
+
var SIMPLE_NORMALIZE = 1;
|
3341 |
+
var ALWAYS_NORMALIZE = 2;
|
3342 |
+
|
3343 |
+
// wrapper function for providing a more flexible interface
|
3344 |
+
// without getting yelled at by flow
|
3345 |
+
function createElement (
|
3346 |
+
context,
|
3347 |
+
tag,
|
3348 |
+
data,
|
3349 |
+
children,
|
3350 |
+
normalizationType,
|
3351 |
+
alwaysNormalize
|
3352 |
+
) {
|
3353 |
+
if (Array.isArray(data) || isPrimitive(data)) {
|
3354 |
+
normalizationType = children;
|
3355 |
+
children = data;
|
3356 |
+
data = undefined;
|
3357 |
+
}
|
3358 |
+
if (isTrue(alwaysNormalize)) {
|
3359 |
+
normalizationType = ALWAYS_NORMALIZE;
|
3360 |
+
}
|
3361 |
+
return _createElement(context, tag, data, children, normalizationType)
|
3362 |
+
}
|
3363 |
+
|
3364 |
+
function _createElement (
|
3365 |
+
context,
|
3366 |
+
tag,
|
3367 |
+
data,
|
3368 |
+
children,
|
3369 |
+
normalizationType
|
3370 |
+
) {
|
3371 |
+
if (isDef(data) && isDef((data).__ob__)) {
|
3372 |
+
warn(
|
3373 |
+
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
3374 |
+
'Always create fresh vnode data objects in each render!',
|
3375 |
+
context
|
3376 |
+
);
|
3377 |
+
return createEmptyVNode()
|
3378 |
+
}
|
3379 |
+
// object syntax in v-bind
|
3380 |
+
if (isDef(data) && isDef(data.is)) {
|
3381 |
+
tag = data.is;
|
3382 |
+
}
|
3383 |
+
if (!tag) {
|
3384 |
+
// in case of component :is set to falsy value
|
3385 |
+
return createEmptyVNode()
|
3386 |
+
}
|
3387 |
+
// warn against non-primitive key
|
3388 |
+
if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
3389 |
+
) {
|
3390 |
+
{
|
3391 |
+
warn(
|
3392 |
+
'Avoid using non-primitive value as key, ' +
|
3393 |
+
'use string/number value instead.',
|
3394 |
+
context
|
3395 |
+
);
|
3396 |
+
}
|
3397 |
+
}
|
3398 |
+
// support single function children as default scoped slot
|
3399 |
+
if (Array.isArray(children) &&
|
3400 |
+
typeof children[0] === 'function'
|
3401 |
+
) {
|
3402 |
+
data = data || {};
|
3403 |
+
data.scopedSlots = { default: children[0] };
|
3404 |
+
children.length = 0;
|
3405 |
+
}
|
3406 |
+
if (normalizationType === ALWAYS_NORMALIZE) {
|
3407 |
+
children = normalizeChildren(children);
|
3408 |
+
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
3409 |
+
children = simpleNormalizeChildren(children);
|
3410 |
+
}
|
3411 |
+
var vnode, ns;
|
3412 |
+
if (typeof tag === 'string') {
|
3413 |
+
var Ctor;
|
3414 |
+
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
3415 |
+
if (config.isReservedTag(tag)) {
|
3416 |
+
// platform built-in elements
|
3417 |
+
vnode = new VNode(
|
3418 |
+
config.parsePlatformTagName(tag), data, children,
|
3419 |
+
undefined, undefined, context
|
3420 |
+
);
|
3421 |
+
} else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
3422 |
+
// component
|
3423 |
+
vnode = createComponent(Ctor, data, context, children, tag);
|
3424 |
+
} else {
|
3425 |
+
// unknown or unlisted namespaced elements
|
3426 |
+
// check at runtime because it may get assigned a namespace when its
|
3427 |
+
// parent normalizes children
|
3428 |
+
vnode = new VNode(
|
3429 |
+
tag, data, children,
|
3430 |
+
undefined, undefined, context
|
3431 |
+
);
|
3432 |
+
}
|
3433 |
+
} else {
|
3434 |
+
// direct component options / constructor
|
3435 |
+
vnode = createComponent(tag, data, context, children);
|
3436 |
+
}
|
3437 |
+
if (Array.isArray(vnode)) {
|
3438 |
+
return vnode
|
3439 |
+
} else if (isDef(vnode)) {
|
3440 |
+
if (isDef(ns)) { applyNS(vnode, ns); }
|
3441 |
+
if (isDef(data)) { registerDeepBindings(data); }
|
3442 |
+
return vnode
|
3443 |
+
} else {
|
3444 |
+
return createEmptyVNode()
|
3445 |
+
}
|
3446 |
+
}
|
3447 |
+
|
3448 |
+
function applyNS (vnode, ns, force) {
|
3449 |
+
vnode.ns = ns;
|
3450 |
+
if (vnode.tag === 'foreignObject') {
|
3451 |
+
// use default namespace inside foreignObject
|
3452 |
+
ns = undefined;
|
3453 |
+
force = true;
|
3454 |
+
}
|
3455 |
+
if (isDef(vnode.children)) {
|
3456 |
+
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
3457 |
+
var child = vnode.children[i];
|
3458 |
+
if (isDef(child.tag) && (
|
3459 |
+
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
3460 |
+
applyNS(child, ns, force);
|
3461 |
+
}
|
3462 |
+
}
|
3463 |
+
}
|
3464 |
+
}
|
3465 |
+
|
3466 |
+
// ref #5318
|
3467 |
+
// necessary to ensure parent re-render when deep bindings like :style and
|
3468 |
+
// :class are used on slot nodes
|
3469 |
+
function registerDeepBindings (data) {
|
3470 |
+
if (isObject(data.style)) {
|
3471 |
+
traverse(data.style);
|
3472 |
+
}
|
3473 |
+
if (isObject(data.class)) {
|
3474 |
+
traverse(data.class);
|
3475 |
+
}
|
3476 |
+
}
|
3477 |
+
|
3478 |
+
/* */
|
3479 |
+
|
3480 |
+
function initRender (vm) {
|
3481 |
+
vm._vnode = null; // the root of the child tree
|
3482 |
+
vm._staticTrees = null; // v-once cached trees
|
3483 |
+
var options = vm.$options;
|
3484 |
+
var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
|
3485 |
+
var renderContext = parentVnode && parentVnode.context;
|
3486 |
+
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
3487 |
+
vm.$scopedSlots = emptyObject;
|
3488 |
+
// bind the createElement fn to this instance
|
3489 |
+
// so that we get proper render context inside it.
|
3490 |
+
// args order: tag, data, children, normalizationType, alwaysNormalize
|
3491 |
+
// internal version is used by render functions compiled from templates
|
3492 |
+
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
3493 |
+
// normalization is always applied for the public version, used in
|
3494 |
+
// user-written render functions.
|
3495 |
+
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
3496 |
+
|
3497 |
+
// $attrs & $listeners are exposed for easier HOC creation.
|
3498 |
+
// they need to be reactive so that HOCs using them are always updated
|
3499 |
+
var parentData = parentVnode && parentVnode.data;
|
3500 |
+
|
3501 |
+
/* istanbul ignore else */
|
3502 |
+
{
|
3503 |
+
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
3504 |
+
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
3505 |
+
}, true);
|
3506 |
+
defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
3507 |
+
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
3508 |
+
}, true);
|
3509 |
+
}
|
3510 |
+
}
|
3511 |
+
|
3512 |
+
var currentRenderingInstance = null;
|
3513 |
+
|
3514 |
+
function renderMixin (Vue) {
|
3515 |
+
// install runtime convenience helpers
|
3516 |
+
installRenderHelpers(Vue.prototype);
|
3517 |
+
|
3518 |
+
Vue.prototype.$nextTick = function (fn) {
|
3519 |
+
return nextTick(fn, this)
|
3520 |
+
};
|
3521 |
+
|
3522 |
+
Vue.prototype._render = function () {
|
3523 |
+
var vm = this;
|
3524 |
+
var ref = vm.$options;
|
3525 |
+
var render = ref.render;
|
3526 |
+
var _parentVnode = ref._parentVnode;
|
3527 |
+
|
3528 |
+
if (_parentVnode) {
|
3529 |
+
vm.$scopedSlots = normalizeScopedSlots(
|
3530 |
+
_parentVnode.data.scopedSlots,
|
3531 |
+
vm.$slots,
|
3532 |
+
vm.$scopedSlots
|
3533 |
+
);
|
3534 |
+
}
|
3535 |
+
|
3536 |
+
// set parent vnode. this allows render functions to have access
|
3537 |
+
// to the data on the placeholder node.
|
3538 |
+
vm.$vnode = _parentVnode;
|
3539 |
+
// render self
|
3540 |
+
var vnode;
|
3541 |
+
try {
|
3542 |
+
// There's no need to maintain a stack becaues all render fns are called
|
3543 |
+
// separately from one another. Nested component's render fns are called
|
3544 |
+
// when parent component is patched.
|
3545 |
+
currentRenderingInstance = vm;
|
3546 |
+
vnode = render.call(vm._renderProxy, vm.$createElement);
|
3547 |
+
} catch (e) {
|
3548 |
+
handleError(e, vm, "render");
|
3549 |
+
// return error render result,
|
3550 |
+
// or previous vnode to prevent render error causing blank component
|
3551 |
+
/* istanbul ignore else */
|
3552 |
+
if (vm.$options.renderError) {
|
3553 |
+
try {
|
3554 |
+
vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
3555 |
+
} catch (e) {
|
3556 |
+
handleError(e, vm, "renderError");
|
3557 |
+
vnode = vm._vnode;
|
3558 |
+
}
|
3559 |
+
} else {
|
3560 |
+
vnode = vm._vnode;
|
3561 |
+
}
|
3562 |
+
} finally {
|
3563 |
+
currentRenderingInstance = null;
|
3564 |
+
}
|
3565 |
+
// if the returned array contains only a single node, allow it
|
3566 |
+
if (Array.isArray(vnode) && vnode.length === 1) {
|
3567 |
+
vnode = vnode[0];
|
3568 |
+
}
|
3569 |
+
// return empty vnode in case the render function errored out
|
3570 |
+
if (!(vnode instanceof VNode)) {
|
3571 |
+
if (Array.isArray(vnode)) {
|
3572 |
+
warn(
|
3573 |
+
'Multiple root nodes returned from render function. Render function ' +
|
3574 |
+
'should return a single root node.',
|
3575 |
+
vm
|
3576 |
+
);
|
3577 |
+
}
|
3578 |
+
vnode = createEmptyVNode();
|
3579 |
+
}
|
3580 |
+
// set parent
|
3581 |
+
vnode.parent = _parentVnode;
|
3582 |
+
return vnode
|
3583 |
+
};
|
3584 |
+
}
|
3585 |
+
|
3586 |
+
/* */
|
3587 |
+
|
3588 |
+
function ensureCtor (comp, base) {
|
3589 |
+
if (
|
3590 |
+
comp.__esModule ||
|
3591 |
+
(hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
3592 |
+
) {
|
3593 |
+
comp = comp.default;
|
3594 |
+
}
|
3595 |
+
return isObject(comp)
|
3596 |
+
? base.extend(comp)
|
3597 |
+
: comp
|
3598 |
+
}
|
3599 |
+
|
3600 |
+
function createAsyncPlaceholder (
|
3601 |
+
factory,
|
3602 |
+
data,
|
3603 |
+
context,
|
3604 |
+
children,
|
3605 |
+
tag
|
3606 |
+
) {
|
3607 |
+
var node = createEmptyVNode();
|
3608 |
+
node.asyncFactory = factory;
|
3609 |
+
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
3610 |
+
return node
|
3611 |
+
}
|
3612 |
+
|
3613 |
+
function resolveAsyncComponent (
|
3614 |
+
factory,
|
3615 |
+
baseCtor
|
3616 |
+
) {
|
3617 |
+
if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
3618 |
+
return factory.errorComp
|
3619 |
+
}
|
3620 |
+
|
3621 |
+
if (isDef(factory.resolved)) {
|
3622 |
+
return factory.resolved
|
3623 |
+
}
|
3624 |
+
|
3625 |
+
var owner = currentRenderingInstance;
|
3626 |
+
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
3627 |
+
// already pending
|
3628 |
+
factory.owners.push(owner);
|
3629 |
+
}
|
3630 |
+
|
3631 |
+
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
3632 |
+
return factory.loadingComp
|
3633 |
+
}
|
3634 |
+
|
3635 |
+
if (owner && !isDef(factory.owners)) {
|
3636 |
+
var owners = factory.owners = [owner];
|
3637 |
+
var sync = true;
|
3638 |
+
var timerLoading = null;
|
3639 |
+
var timerTimeout = null
|
3640 |
+
|
3641 |
+
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
3642 |
+
|
3643 |
+
var forceRender = function (renderCompleted) {
|
3644 |
+
for (var i = 0, l = owners.length; i < l; i++) {
|
3645 |
+
(owners[i]).$forceUpdate();
|
3646 |
+
}
|
3647 |
+
|
3648 |
+
if (renderCompleted) {
|
3649 |
+
owners.length = 0;
|
3650 |
+
if (timerLoading !== null) {
|
3651 |
+
clearTimeout(timerLoading);
|
3652 |
+
timerLoading = null;
|
3653 |
+
}
|
3654 |
+
if (timerTimeout !== null) {
|
3655 |
+
clearTimeout(timerTimeout);
|
3656 |
+
timerTimeout = null;
|
3657 |
+
}
|
3658 |
+
}
|
3659 |
+
};
|
3660 |
+
|
3661 |
+
var resolve = once(function (res) {
|
3662 |
+
// cache resolved
|
3663 |
+
factory.resolved = ensureCtor(res, baseCtor);
|
3664 |
+
// invoke callbacks only if this is not a synchronous resolve
|
3665 |
+
// (async resolves are shimmed as synchronous during SSR)
|
3666 |
+
if (!sync) {
|
3667 |
+
forceRender(true);
|
3668 |
+
} else {
|
3669 |
+
owners.length = 0;
|
3670 |
+
}
|
3671 |
+
});
|
3672 |
+
|
3673 |
+
var reject = once(function (reason) {
|
3674 |
+
warn(
|
3675 |
+
"Failed to resolve async component: " + (String(factory)) +
|
3676 |
+
(reason ? ("\nReason: " + reason) : '')
|
3677 |
+
);
|
3678 |
+
if (isDef(factory.errorComp)) {
|
3679 |
+
factory.error = true;
|
3680 |
+
forceRender(true);
|
3681 |
+
}
|
3682 |
+
});
|
3683 |
+
|
3684 |
+
var res = factory(resolve, reject);
|
3685 |
+
|
3686 |
+
if (isObject(res)) {
|
3687 |
+
if (isPromise(res)) {
|
3688 |
+
// () => Promise
|
3689 |
+
if (isUndef(factory.resolved)) {
|
3690 |
+
res.then(resolve, reject);
|
3691 |
+
}
|
3692 |
+
} else if (isPromise(res.component)) {
|
3693 |
+
res.component.then(resolve, reject);
|
3694 |
+
|
3695 |
+
if (isDef(res.error)) {
|
3696 |
+
factory.errorComp = ensureCtor(res.error, baseCtor);
|
3697 |
+
}
|
3698 |
+
|
3699 |
+
if (isDef(res.loading)) {
|
3700 |
+
factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
3701 |
+
if (res.delay === 0) {
|
3702 |
+
factory.loading = true;
|
3703 |
+
} else {
|
3704 |
+
timerLoading = setTimeout(function () {
|
3705 |
+
timerLoading = null;
|
3706 |
+
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
3707 |
+
factory.loading = true;
|
3708 |
+
forceRender(false);
|
3709 |
+
}
|
3710 |
+
}, res.delay || 200);
|
3711 |
+
}
|
3712 |
+
}
|
3713 |
+
|
3714 |
+
if (isDef(res.timeout)) {
|
3715 |
+
timerTimeout = setTimeout(function () {
|
3716 |
+
timerTimeout = null;
|
3717 |
+
if (isUndef(factory.resolved)) {
|
3718 |
+
reject(
|
3719 |
+
"timeout (" + (res.timeout) + "ms)"
|
3720 |
+
);
|
3721 |
+
}
|
3722 |
+
}, res.timeout);
|
3723 |
+
}
|
3724 |
+
}
|
3725 |
+
}
|
3726 |
+
|
3727 |
+
sync = false;
|
3728 |
+
// return in case resolved synchronously
|
3729 |
+
return factory.loading
|
3730 |
+
? factory.loadingComp
|
3731 |
+
: factory.resolved
|
3732 |
+
}
|
3733 |
+
}
|
3734 |
+
|
3735 |
+
/* */
|
3736 |
+
|
3737 |
+
function isAsyncPlaceholder (node) {
|
3738 |
+
return node.isComment && node.asyncFactory
|
3739 |
+
}
|
3740 |
+
|
3741 |
+
/* */
|
3742 |
+
|
3743 |
+
function getFirstComponentChild (children) {
|
3744 |
+
if (Array.isArray(children)) {
|
3745 |
+
for (var i = 0; i < children.length; i++) {
|
3746 |
+
var c = children[i];
|
3747 |
+
if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
3748 |
+
return c
|
3749 |
+
}
|
3750 |
+
}
|
3751 |
+
}
|
3752 |
+
}
|
3753 |
+
|
3754 |
+
/* */
|
3755 |
+
|
3756 |
+
/* */
|
3757 |
+
|
3758 |
+
function initEvents (vm) {
|
3759 |
+
vm._events = Object.create(null);
|
3760 |
+
vm._hasHookEvent = false;
|
3761 |
+
// init parent attached events
|
3762 |
+
var listeners = vm.$options._parentListeners;
|
3763 |
+
if (listeners) {
|
3764 |
+
updateComponentListeners(vm, listeners);
|
3765 |
+
}
|
3766 |
+
}
|
3767 |
+
|
3768 |
+
var target;
|
3769 |
+
|
3770 |
+
function add (event, fn) {
|
3771 |
+
target.$on(event, fn);
|
3772 |
+
}
|
3773 |
+
|
3774 |
+
function remove$1 (event, fn) {
|
3775 |
+
target.$off(event, fn);
|
3776 |
+
}
|
3777 |
+
|
3778 |
+
function createOnceHandler (event, fn) {
|
3779 |
+
var _target = target;
|
3780 |
+
return function onceHandler () {
|
3781 |
+
var res = fn.apply(null, arguments);
|
3782 |
+
if (res !== null) {
|
3783 |
+
_target.$off(event, onceHandler);
|
3784 |
+
}
|
3785 |
+
}
|
3786 |
+
}
|
3787 |
+
|
3788 |
+
function updateComponentListeners (
|
3789 |
+
vm,
|
3790 |
+
listeners,
|
3791 |
+
oldListeners
|
3792 |
+
) {
|
3793 |
+
target = vm;
|
3794 |
+
updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
3795 |
+
target = undefined;
|
3796 |
+
}
|
3797 |
+
|
3798 |
+
function eventsMixin (Vue) {
|
3799 |
+
var hookRE = /^hook:/;
|
3800 |
+
Vue.prototype.$on = function (event, fn) {
|
3801 |
+
var vm = this;
|
3802 |
+
if (Array.isArray(event)) {
|
3803 |
+
for (var i = 0, l = event.length; i < l; i++) {
|
3804 |
+
vm.$on(event[i], fn);
|
3805 |
+
}
|
3806 |
+
} else {
|
3807 |
+
(vm._events[event] || (vm._events[event] = [])).push(fn);
|
3808 |
+
// optimize hook:event cost by using a boolean flag marked at registration
|
3809 |
+
// instead of a hash lookup
|
3810 |
+
if (hookRE.test(event)) {
|
3811 |
+
vm._hasHookEvent = true;
|
3812 |
+
}
|
3813 |
+
}
|
3814 |
+
return vm
|
3815 |
+
};
|
3816 |
+
|
3817 |
+
Vue.prototype.$once = function (event, fn) {
|
3818 |
+
var vm = this;
|
3819 |
+
function on () {
|
3820 |
+
vm.$off(event, on);
|
3821 |
+
fn.apply(vm, arguments);
|
3822 |
+
}
|
3823 |
+
on.fn = fn;
|
3824 |
+
vm.$on(event, on);
|
3825 |
+
return vm
|
3826 |
+
};
|
3827 |
+
|
3828 |
+
Vue.prototype.$off = function (event, fn) {
|
3829 |
+
var vm = this;
|
3830 |
+
// all
|
3831 |
+
if (!arguments.length) {
|
3832 |
+
vm._events = Object.create(null);
|
3833 |
+
return vm
|
3834 |
+
}
|
3835 |
+
// array of events
|
3836 |
+
if (Array.isArray(event)) {
|
3837 |
+
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
3838 |
+
vm.$off(event[i$1], fn);
|
3839 |
+
}
|
3840 |
+
return vm
|
3841 |
+
}
|
3842 |
+
// specific event
|
3843 |
+
var cbs = vm._events[event];
|
3844 |
+
if (!cbs) {
|
3845 |
+
return vm
|
3846 |
+
}
|
3847 |
+
if (!fn) {
|
3848 |
+
vm._events[event] = null;
|
3849 |
+
return vm
|
3850 |
+
}
|
3851 |
+
// specific handler
|
3852 |
+
var cb;
|
3853 |
+
var i = cbs.length;
|
3854 |
+
while (i--) {
|
3855 |
+
cb = cbs[i];
|
3856 |
+
if (cb === fn || cb.fn === fn) {
|
3857 |
+
cbs.splice(i, 1);
|
3858 |
+
break
|
3859 |
+
}
|
3860 |
+
}
|
3861 |
+
return vm
|
3862 |
+
};
|
3863 |
+
|
3864 |
+
Vue.prototype.$emit = function (event) {
|
3865 |
+
var vm = this;
|
3866 |
+
{
|
3867 |
+
var lowerCaseEvent = event.toLowerCase();
|
3868 |
+
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
3869 |
+
tip(
|
3870 |
+
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
3871 |
+
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
3872 |
+
"Note that HTML attributes are case-insensitive and you cannot use " +
|
3873 |
+
"v-on to listen to camelCase events when using in-DOM templates. " +
|
3874 |
+
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
3875 |
+
);
|
3876 |
+
}
|
3877 |
+
}
|
3878 |
+
var cbs = vm._events[event];
|
3879 |
+
if (cbs) {
|
3880 |
+
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
3881 |
+
var args = toArray(arguments, 1);
|
3882 |
+
var info = "event handler for \"" + event + "\"";
|
3883 |
+
for (var i = 0, l = cbs.length; i < l; i++) {
|
3884 |
+
invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
3885 |
+
}
|
3886 |
+
}
|
3887 |
+
return vm
|
3888 |
+
};
|
3889 |
+
}
|
3890 |
+
|
3891 |
+
/* */
|
3892 |
+
|
3893 |
+
var activeInstance = null;
|
3894 |
+
var isUpdatingChildComponent = false;
|
3895 |
+
|
3896 |
+
function setActiveInstance(vm) {
|
3897 |
+
var prevActiveInstance = activeInstance;
|
3898 |
+
activeInstance = vm;
|
3899 |
+
return function () {
|
3900 |
+
activeInstance = prevActiveInstance;
|
3901 |
+
}
|
3902 |
+
}
|
3903 |
+
|
3904 |
+
function initLifecycle (vm) {
|
3905 |
+
var options = vm.$options;
|
3906 |
+
|
3907 |
+
// locate first non-abstract parent
|
3908 |
+
var parent = options.parent;
|
3909 |
+
if (parent && !options.abstract) {
|
3910 |
+
while (parent.$options.abstract && parent.$parent) {
|
3911 |
+
parent = parent.$parent;
|
3912 |
+
}
|
3913 |
+
parent.$children.push(vm);
|
3914 |
+
}
|
3915 |
+
|
3916 |
+
vm.$parent = parent;
|
3917 |
+
vm.$root = parent ? parent.$root : vm;
|
3918 |
+
|
3919 |
+
vm.$children = [];
|
3920 |
+
vm.$refs = {};
|
3921 |
+
|
3922 |
+
vm._watcher = null;
|
3923 |
+
vm._inactive = null;
|
3924 |
+
vm._directInactive = false;
|
3925 |
+
vm._isMounted = false;
|
3926 |
+
vm._isDestroyed = false;
|
3927 |
+
vm._isBeingDestroyed = false;
|
3928 |
+
}
|
3929 |
+
|
3930 |
+
function lifecycleMixin (Vue) {
|
3931 |
+
Vue.prototype._update = function (vnode, hydrating) {
|
3932 |
+
var vm = this;
|
3933 |
+
var prevEl = vm.$el;
|
3934 |
+
var prevVnode = vm._vnode;
|
3935 |
+
var restoreActiveInstance = setActiveInstance(vm);
|
3936 |
+
vm._vnode = vnode;
|
3937 |
+
// Vue.prototype.__patch__ is injected in entry points
|
3938 |
+
// based on the rendering backend used.
|
3939 |
+
if (!prevVnode) {
|
3940 |
+
// initial render
|
3941 |
+
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
3942 |
+
} else {
|
3943 |
+
// updates
|
3944 |
+
vm.$el = vm.__patch__(prevVnode, vnode);
|
3945 |
+
}
|
3946 |
+
restoreActiveInstance();
|
3947 |
+
// update __vue__ reference
|
3948 |
+
if (prevEl) {
|
3949 |
+
prevEl.__vue__ = null;
|
3950 |
+
}
|
3951 |
+
if (vm.$el) {
|
3952 |
+
vm.$el.__vue__ = vm;
|
3953 |
+
}
|
3954 |
+
// if parent is an HOC, update its $el as well
|
3955 |
+
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
3956 |
+
vm.$parent.$el = vm.$el;
|
3957 |
+
}
|
3958 |
+
// updated hook is called by the scheduler to ensure that children are
|
3959 |
+
// updated in a parent's updated hook.
|
3960 |
+
};
|
3961 |
+
|
3962 |
+
Vue.prototype.$forceUpdate = function () {
|
3963 |
+
var vm = this;
|
3964 |
+
if (vm._watcher) {
|
3965 |
+
vm._watcher.update();
|
3966 |
+
}
|
3967 |
+
};
|
3968 |
+
|
3969 |
+
Vue.prototype.$destroy = function () {
|
3970 |
+
var vm = this;
|
3971 |
+
if (vm._isBeingDestroyed) {
|
3972 |
+
return
|
3973 |
+
}
|
3974 |
+
callHook(vm, 'beforeDestroy');
|
3975 |
+
vm._isBeingDestroyed = true;
|
3976 |
+
// remove self from parent
|
3977 |
+
var parent = vm.$parent;
|
3978 |
+
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
3979 |
+
remove(parent.$children, vm);
|
3980 |
+
}
|
3981 |
+
// teardown watchers
|
3982 |
+
if (vm._watcher) {
|
3983 |
+
vm._watcher.teardown();
|
3984 |
+
}
|
3985 |
+
var i = vm._watchers.length;
|
3986 |
+
while (i--) {
|
3987 |
+
vm._watchers[i].teardown();
|
3988 |
+
}
|
3989 |
+
// remove reference from data ob
|
3990 |
+
// frozen object may not have observer.
|
3991 |
+
if (vm._data.__ob__) {
|
3992 |
+
vm._data.__ob__.vmCount--;
|
3993 |
+
}
|
3994 |
+
// call the last hook...
|
3995 |
+
vm._isDestroyed = true;
|
3996 |
+
// invoke destroy hooks on current rendered tree
|
3997 |
+
vm.__patch__(vm._vnode, null);
|
3998 |
+
// fire destroyed hook
|
3999 |
+
callHook(vm, 'destroyed');
|
4000 |
+
// turn off all instance listeners.
|
4001 |
+
vm.$off();
|
4002 |
+
// remove __vue__ reference
|
4003 |
+
if (vm.$el) {
|
4004 |
+
vm.$el.__vue__ = null;
|
4005 |
+
}
|
4006 |
+
// release circular reference (#6759)
|
4007 |
+
if (vm.$vnode) {
|
4008 |
+
vm.$vnode.parent = null;
|
4009 |
+
}
|
4010 |
+
};
|
4011 |
+
}
|
4012 |
+
|
4013 |
+
function mountComponent (
|
4014 |
+
vm,
|
4015 |
+
el,
|
4016 |
+
hydrating
|
4017 |
+
) {
|
4018 |
+
vm.$el = el;
|
4019 |
+
if (!vm.$options.render) {
|
4020 |
+
vm.$options.render = createEmptyVNode;
|
4021 |
+
{
|
4022 |
+
/* istanbul ignore if */
|
4023 |
+
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
4024 |
+
vm.$options.el || el) {
|
4025 |
+
warn(
|
4026 |
+
'You are using the runtime-only build of Vue where the template ' +
|
4027 |
+
'compiler is not available. Either pre-compile the templates into ' +
|
4028 |
+
'render functions, or use the compiler-included build.',
|
4029 |
+
vm
|
4030 |
+
);
|
4031 |
+
} else {
|
4032 |
+
warn(
|
4033 |
+
'Failed to mount component: template or render function not defined.',
|
4034 |
+
vm
|
4035 |
+
);
|
4036 |
+
}
|
4037 |
+
}
|
4038 |
+
}
|
4039 |
+
callHook(vm, 'beforeMount');
|
4040 |
+
|
4041 |
+
var updateComponent;
|
4042 |
+
/* istanbul ignore if */
|
4043 |
+
if (config.performance && mark) {
|
4044 |
+
updateComponent = function () {
|
4045 |
+
var name = vm._name;
|
4046 |
+
var id = vm._uid;
|
4047 |
+
var startTag = "vue-perf-start:" + id;
|
4048 |
+
var endTag = "vue-perf-end:" + id;
|
4049 |
+
|
4050 |
+
mark(startTag);
|
4051 |
+
var vnode = vm._render();
|
4052 |
+
mark(endTag);
|
4053 |
+
measure(("vue " + name + " render"), startTag, endTag);
|
4054 |
+
|
4055 |
+
mark(startTag);
|
4056 |
+
vm._update(vnode, hydrating);
|
4057 |
+
mark(endTag);
|
4058 |
+
measure(("vue " + name + " patch"), startTag, endTag);
|
4059 |
+
};
|
4060 |
+
} else {
|
4061 |
+
updateComponent = function () {
|
4062 |
+
vm._update(vm._render(), hydrating);
|
4063 |
+
};
|
4064 |
+
}
|
4065 |
+
|
4066 |
+
// we set this to vm._watcher inside the watcher's constructor
|
4067 |
+
// since the watcher's initial patch may call $forceUpdate (e.g. inside child
|
4068 |
+
// component's mounted hook), which relies on vm._watcher being already defined
|
4069 |
+
new Watcher(vm, updateComponent, noop, {
|
4070 |
+
before: function before () {
|
4071 |
+
if (vm._isMounted && !vm._isDestroyed) {
|
4072 |
+
callHook(vm, 'beforeUpdate');
|
4073 |
+
}
|
4074 |
+
}
|
4075 |
+
}, true /* isRenderWatcher */);
|
4076 |
+
hydrating = false;
|
4077 |
+
|
4078 |
+
// manually mounted instance, call mounted on self
|
4079 |
+
// mounted is called for render-created child components in its inserted hook
|
4080 |
+
if (vm.$vnode == null) {
|
4081 |
+
vm._isMounted = true;
|
4082 |
+
callHook(vm, 'mounted');
|
4083 |
+
}
|
4084 |
+
return vm
|
4085 |
+
}
|
4086 |
+
|
4087 |
+
function updateChildComponent (
|
4088 |
+
vm,
|
4089 |
+
propsData,
|
4090 |
+
listeners,
|
4091 |
+
parentVnode,
|
4092 |
+
renderChildren
|
4093 |
+
) {
|
4094 |
+
{
|
4095 |
+
isUpdatingChildComponent = true;
|
4096 |
+
}
|
4097 |
+
|
4098 |
+
// determine whether component has slot children
|
4099 |
+
// we need to do this before overwriting $options._renderChildren.
|
4100 |
+
|
4101 |
+
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
4102 |
+
// dynamic slot names). Static scoped slots compiled from template has the
|
4103 |
+
// "$stable" marker.
|
4104 |
+
var newScopedSlots = parentVnode.data.scopedSlots;
|
4105 |
+
var oldScopedSlots = vm.$scopedSlots;
|
4106 |
+
var hasDynamicScopedSlot = !!(
|
4107 |
+
(newScopedSlots && !newScopedSlots.$stable) ||
|
4108 |
+
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
4109 |
+
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
4110 |
+
);
|
4111 |
+
|
4112 |
+
// Any static slot children from the parent may have changed during parent's
|
4113 |
+
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
4114 |
+
// update is necessary to ensure correctness.
|
4115 |
+
var needsForceUpdate = !!(
|
4116 |
+
renderChildren || // has new static slots
|
4117 |
+
vm.$options._renderChildren || // has old static slots
|
4118 |
+
hasDynamicScopedSlot
|
4119 |
+
);
|
4120 |
+
|
4121 |
+
vm.$options._parentVnode = parentVnode;
|
4122 |
+
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
4123 |
+
|
4124 |
+
if (vm._vnode) { // update child tree's parent
|
4125 |
+
vm._vnode.parent = parentVnode;
|
4126 |
+
}
|
4127 |
+
vm.$options._renderChildren = renderChildren;
|
4128 |
+
|
4129 |
+
// update $attrs and $listeners hash
|
4130 |
+
// these are also reactive so they may trigger child update if the child
|
4131 |
+
// used them during render
|
4132 |
+
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
4133 |
+
vm.$listeners = listeners || emptyObject;
|
4134 |
+
|
4135 |
+
// update props
|
4136 |
+
if (propsData && vm.$options.props) {
|
4137 |
+
toggleObserving(false);
|
4138 |
+
var props = vm._props;
|
4139 |
+
var propKeys = vm.$options._propKeys || [];
|
4140 |
+
for (var i = 0; i < propKeys.length; i++) {
|
4141 |
+
var key = propKeys[i];
|
4142 |
+
var propOptions = vm.$options.props; // wtf flow?
|
4143 |
+
props[key] = validateProp(key, propOptions, propsData, vm);
|
4144 |
+
}
|
4145 |
+
toggleObserving(true);
|
4146 |
+
// keep a copy of raw propsData
|
4147 |
+
vm.$options.propsData = propsData;
|
4148 |
+
}
|
4149 |
+
|
4150 |
+
// update listeners
|
4151 |
+
listeners = listeners || emptyObject;
|
4152 |
+
var oldListeners = vm.$options._parentListeners;
|
4153 |
+
vm.$options._parentListeners = listeners;
|
4154 |
+
updateComponentListeners(vm, listeners, oldListeners);
|
4155 |
+
|
4156 |
+
// resolve slots + force update if has children
|
4157 |
+
if (needsForceUpdate) {
|
4158 |
+
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
4159 |
+
vm.$forceUpdate();
|
4160 |
+
}
|
4161 |
+
|
4162 |
+
{
|
4163 |
+
isUpdatingChildComponent = false;
|
4164 |
+
}
|
4165 |
+
}
|
4166 |
+
|
4167 |
+
function isInInactiveTree (vm) {
|
4168 |
+
while (vm && (vm = vm.$parent)) {
|
4169 |
+
if (vm._inactive) { return true }
|
4170 |
+
}
|
4171 |
+
return false
|
4172 |
+
}
|
4173 |
+
|
4174 |
+
function activateChildComponent (vm, direct) {
|
4175 |
+
if (direct) {
|
4176 |
+
vm._directInactive = false;
|
4177 |
+
if (isInInactiveTree(vm)) {
|
4178 |
+
return
|
4179 |
+
}
|
4180 |
+
} else if (vm._directInactive) {
|
4181 |
+
return
|
4182 |
+
}
|
4183 |
+
if (vm._inactive || vm._inactive === null) {
|
4184 |
+
vm._inactive = false;
|
4185 |
+
for (var i = 0; i < vm.$children.length; i++) {
|
4186 |
+
activateChildComponent(vm.$children[i]);
|
4187 |
+
}
|
4188 |
+
callHook(vm, 'activated');
|
4189 |
+
}
|
4190 |
+
}
|
4191 |
+
|
4192 |
+
function deactivateChildComponent (vm, direct) {
|
4193 |
+
if (direct) {
|
4194 |
+
vm._directInactive = true;
|
4195 |
+
if (isInInactiveTree(vm)) {
|
4196 |
+
return
|
4197 |
+
}
|
4198 |
+
}
|
4199 |
+
if (!vm._inactive) {
|
4200 |
+
vm._inactive = true;
|
4201 |
+
for (var i = 0; i < vm.$children.length; i++) {
|
4202 |
+
deactivateChildComponent(vm.$children[i]);
|
4203 |
+
}
|
4204 |
+
callHook(vm, 'deactivated');
|
4205 |
+
}
|
4206 |
+
}
|
4207 |
+
|
4208 |
+
function callHook (vm, hook) {
|
4209 |
+
// #7573 disable dep collection when invoking lifecycle hooks
|
4210 |
+
pushTarget();
|
4211 |
+
var handlers = vm.$options[hook];
|
4212 |
+
var info = hook + " hook";
|
4213 |
+
if (handlers) {
|
4214 |
+
for (var i = 0, j = handlers.length; i < j; i++) {
|
4215 |
+
invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
4216 |
+
}
|
4217 |
+
}
|
4218 |
+
if (vm._hasHookEvent) {
|
4219 |
+
vm.$emit('hook:' + hook);
|
4220 |
+
}
|
4221 |
+
popTarget();
|
4222 |
+
}
|
4223 |
+
|
4224 |
+
/* */
|
4225 |
+
|
4226 |
+
var MAX_UPDATE_COUNT = 100;
|
4227 |
+
|
4228 |
+
var queue = [];
|
4229 |
+
var activatedChildren = [];
|
4230 |
+
var has = {};
|
4231 |
+
var circular = {};
|
4232 |
+
var waiting = false;
|
4233 |
+
var flushing = false;
|
4234 |
+
var index = 0;
|
4235 |
+
|
4236 |
+
/**
|
4237 |
+
* Reset the scheduler's state.
|
4238 |
+
*/
|
4239 |
+
function resetSchedulerState () {
|
4240 |
+
index = queue.length = activatedChildren.length = 0;
|
4241 |
+
has = {};
|
4242 |
+
{
|
4243 |
+
circular = {};
|
4244 |
+
}
|
4245 |
+
waiting = flushing = false;
|
4246 |
+
}
|
4247 |
+
|
4248 |
+
// Async edge case #6566 requires saving the timestamp when event listeners are
|
4249 |
+
// attached. However, calling performance.now() has a perf overhead especially
|
4250 |
+
// if the page has thousands of event listeners. Instead, we take a timestamp
|
4251 |
+
// every time the scheduler flushes and use that for all event listeners
|
4252 |
+
// attached during that flush.
|
4253 |
+
var currentFlushTimestamp = 0;
|
4254 |
+
|
4255 |
+
// Async edge case fix requires storing an event listener's attach timestamp.
|
4256 |
+
var getNow = Date.now;
|
4257 |
+
|
4258 |
+
// Determine what event timestamp the browser is using. Annoyingly, the
|
4259 |
+
// timestamp can either be hi-res (relative to page load) or low-res
|
4260 |
+
// (relative to UNIX epoch), so in order to compare time we have to use the
|
4261 |
+
// same timestamp type when saving the flush timestamp.
|
4262 |
+
// All IE versions use low-res event timestamps, and have problematic clock
|
4263 |
+
// implementations (#9632)
|
4264 |
+
if (inBrowser && !isIE) {
|
4265 |
+
var performance = window.performance;
|
4266 |
+
if (
|
4267 |
+
performance &&
|
4268 |
+
typeof performance.now === 'function' &&
|
4269 |
+
getNow() > document.createEvent('Event').timeStamp
|
4270 |
+
) {
|
4271 |
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
4272 |
+
// smaller than it, it means the event is using a hi-res timestamp,
|
4273 |
+
// and we need to use the hi-res version for event listener timestamps as
|
4274 |
+
// well.
|
4275 |
+
getNow = function () { return performance.now(); };
|
4276 |
+
}
|
4277 |
+
}
|
4278 |
+
|
4279 |
+
/**
|
4280 |
+
* Flush both queues and run the watchers.
|
4281 |
+
*/
|
4282 |
+
function flushSchedulerQueue () {
|
4283 |
+
currentFlushTimestamp = getNow();
|
4284 |
+
flushing = true;
|
4285 |
+
var watcher, id;
|
4286 |
+
|
4287 |
+
// Sort queue before flush.
|
4288 |
+
// This ensures that:
|
4289 |
+
// 1. Components are updated from parent to child. (because parent is always
|
4290 |
+
// created before the child)
|
4291 |
+
// 2. A component's user watchers are run before its render watcher (because
|
4292 |
+
// user watchers are created before the render watcher)
|
4293 |
+
// 3. If a component is destroyed during a parent component's watcher run,
|
4294 |
+
// its watchers can be skipped.
|
4295 |
+
queue.sort(function (a, b) { return a.id - b.id; });
|
4296 |
+
|
4297 |
+
// do not cache length because more watchers might be pushed
|
4298 |
+
// as we run existing watchers
|
4299 |
+
for (index = 0; index < queue.length; index++) {
|
4300 |
+
watcher = queue[index];
|
4301 |
+
if (watcher.before) {
|
4302 |
+
watcher.before();
|
4303 |
+
}
|
4304 |
+
id = watcher.id;
|
4305 |
+
has[id] = null;
|
4306 |
+
watcher.run();
|
4307 |
+
// in dev build, check and stop circular updates.
|
4308 |
+
if (has[id] != null) {
|
4309 |
+
circular[id] = (circular[id] || 0) + 1;
|
4310 |
+
if (circular[id] > MAX_UPDATE_COUNT) {
|
4311 |
+
warn(
|
4312 |
+
'You may have an infinite update loop ' + (
|
4313 |
+
watcher.user
|
4314 |
+
? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
4315 |
+
: "in a component render function."
|
4316 |
+
),
|
4317 |
+
watcher.vm
|
4318 |
+
);
|
4319 |
+
break
|
4320 |
+
}
|
4321 |
+
}
|
4322 |
+
}
|
4323 |
+
|
4324 |
+
// keep copies of post queues before resetting state
|
4325 |
+
var activatedQueue = activatedChildren.slice();
|
4326 |
+
var updatedQueue = queue.slice();
|
4327 |
+
|
4328 |
+
resetSchedulerState();
|
4329 |
+
|
4330 |
+
// call component updated and activated hooks
|
4331 |
+
callActivatedHooks(activatedQueue);
|
4332 |
+
callUpdatedHooks(updatedQueue);
|
4333 |
+
|
4334 |
+
// devtool hook
|
4335 |
+
/* istanbul ignore if */
|
4336 |
+
if (devtools && config.devtools) {
|
4337 |
+
devtools.emit('flush');
|
4338 |
+
}
|
4339 |
+
}
|
4340 |
+
|
4341 |
+
function callUpdatedHooks (queue) {
|
4342 |
+
var i = queue.length;
|
4343 |
+
while (i--) {
|
4344 |
+
var watcher = queue[i];
|
4345 |
+
var vm = watcher.vm;
|
4346 |
+
if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
4347 |
+
callHook(vm, 'updated');
|
4348 |
+
}
|
4349 |
+
}
|
4350 |
+
}
|
4351 |
+
|
4352 |
+
/**
|
4353 |
+
* Queue a kept-alive component that was activated during patch.
|
4354 |
+
* The queue will be processed after the entire tree has been patched.
|
4355 |
+
*/
|
4356 |
+
function queueActivatedComponent (vm) {
|
4357 |
+
// setting _inactive to false here so that a render function can
|
4358 |
+
// rely on checking whether it's in an inactive tree (e.g. router-view)
|
4359 |
+
vm._inactive = false;
|
4360 |
+
activatedChildren.push(vm);
|
4361 |
+
}
|
4362 |
+
|
4363 |
+
function callActivatedHooks (queue) {
|
4364 |
+
for (var i = 0; i < queue.length; i++) {
|
4365 |
+
queue[i]._inactive = true;
|
4366 |
+
activateChildComponent(queue[i], true /* true */);
|
4367 |
+
}
|
4368 |
+
}
|
4369 |
+
|
4370 |
+
/**
|
4371 |
+
* Push a watcher into the watcher queue.
|
4372 |
+
* Jobs with duplicate IDs will be skipped unless it's
|
4373 |
+
* pushed when the queue is being flushed.
|
4374 |
+
*/
|
4375 |
+
function queueWatcher (watcher) {
|
4376 |
+
var id = watcher.id;
|
4377 |
+
if (has[id] == null) {
|
4378 |
+
has[id] = true;
|
4379 |
+
if (!flushing) {
|
4380 |
+
queue.push(watcher);
|
4381 |
+
} else {
|
4382 |
+
// if already flushing, splice the watcher based on its id
|
4383 |
+
// if already past its id, it will be run next immediately.
|
4384 |
+
var i = queue.length - 1;
|
4385 |
+
while (i > index && queue[i].id > watcher.id) {
|
4386 |
+
i--;
|
4387 |
+
}
|
4388 |
+
queue.splice(i + 1, 0, watcher);
|
4389 |
+
}
|
4390 |
+
// queue the flush
|
4391 |
+
if (!waiting) {
|
4392 |
+
waiting = true;
|
4393 |
+
|
4394 |
+
if (!config.async) {
|
4395 |
+
flushSchedulerQueue();
|
4396 |
+
return
|
4397 |
+
}
|
4398 |
+
nextTick(flushSchedulerQueue);
|
4399 |
+
}
|
4400 |
+
}
|
4401 |
+
}
|
4402 |
+
|
4403 |
+
/* */
|
4404 |
+
|
4405 |
+
|
4406 |
+
|
4407 |
+
var uid$2 = 0;
|
4408 |
+
|
4409 |
+
/**
|
4410 |
+
* A watcher parses an expression, collects dependencies,
|
4411 |
+
* and fires callback when the expression value changes.
|
4412 |
+
* This is used for both the $watch() api and directives.
|
4413 |
+
*/
|
4414 |
+
var Watcher = function Watcher (
|
4415 |
+
vm,
|
4416 |
+
expOrFn,
|
4417 |
+
cb,
|
4418 |
+
options,
|
4419 |
+
isRenderWatcher
|
4420 |
+
) {
|
4421 |
+
this.vm = vm;
|
4422 |
+
if (isRenderWatcher) {
|
4423 |
+
vm._watcher = this;
|
4424 |
+
}
|
4425 |
+
vm._watchers.push(this);
|
4426 |
+
// options
|
4427 |
+
if (options) {
|
4428 |
+
this.deep = !!options.deep;
|
4429 |
+
this.user = !!options.user;
|
4430 |
+
this.lazy = !!options.lazy;
|
4431 |
+
this.sync = !!options.sync;
|
4432 |
+
this.before = options.before;
|
4433 |
+
} else {
|
4434 |
+
this.deep = this.user = this.lazy = this.sync = false;
|
4435 |
+
}
|
4436 |
+
this.cb = cb;
|
4437 |
+
this.id = ++uid$2; // uid for batching
|
4438 |
+
this.active = true;
|
4439 |
+
this.dirty = this.lazy; // for lazy watchers
|
4440 |
+
this.deps = [];
|
4441 |
+
this.newDeps = [];
|
4442 |
+
this.depIds = new _Set();
|
4443 |
+
this.newDepIds = new _Set();
|
4444 |
+
this.expression = expOrFn.toString();
|
4445 |
+
// parse expression for getter
|
4446 |
+
if (typeof expOrFn === 'function') {
|
4447 |
+
this.getter = expOrFn;
|
4448 |
+
} else {
|
4449 |
+
this.getter = parsePath(expOrFn);
|
4450 |
+
if (!this.getter) {
|
4451 |
+
this.getter = noop;
|
4452 |
+
warn(
|
4453 |
+
"Failed watching path: \"" + expOrFn + "\" " +
|
4454 |
+
'Watcher only accepts simple dot-delimited paths. ' +
|
4455 |
+
'For full control, use a function instead.',
|
4456 |
+
vm
|
4457 |
+
);
|
4458 |
+
}
|
4459 |
+
}
|
4460 |
+
this.value = this.lazy
|
4461 |
+
? undefined
|
4462 |
+
: this.get();
|
4463 |
+
};
|
4464 |
+
|
4465 |
+
/**
|
4466 |
+
* Evaluate the getter, and re-collect dependencies.
|
4467 |
+
*/
|
4468 |
+
Watcher.prototype.get = function get () {
|
4469 |
+
pushTarget(this);
|
4470 |
+
var value;
|
4471 |
+
var vm = this.vm;
|
4472 |
+
try {
|
4473 |
+
value = this.getter.call(vm, vm);
|
4474 |
+
} catch (e) {
|
4475 |
+
if (this.user) {
|
4476 |
+
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
4477 |
+
} else {
|
4478 |
+
throw e
|
4479 |
+
}
|
4480 |
+
} finally {
|
4481 |
+
// "touch" every property so they are all tracked as
|
4482 |
+
// dependencies for deep watching
|
4483 |
+
if (this.deep) {
|
4484 |
+
traverse(value);
|
4485 |
+
}
|
4486 |
+
popTarget();
|
4487 |
+
this.cleanupDeps();
|
4488 |
+
}
|
4489 |
+
return value
|
4490 |
+
};
|
4491 |
+
|
4492 |
+
/**
|
4493 |
+
* Add a dependency to this directive.
|
4494 |
+
*/
|
4495 |
+
Watcher.prototype.addDep = function addDep (dep) {
|
4496 |
+
var id = dep.id;
|
4497 |
+
if (!this.newDepIds.has(id)) {
|
4498 |
+
this.newDepIds.add(id);
|
4499 |
+
this.newDeps.push(dep);
|
4500 |
+
if (!this.depIds.has(id)) {
|
4501 |
+
dep.addSub(this);
|
4502 |
+
}
|
4503 |
+
}
|
4504 |
+
};
|
4505 |
+
|
4506 |
+
/**
|
4507 |
+
* Clean up for dependency collection.
|
4508 |
+
*/
|
4509 |
+
Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
4510 |
+
var i = this.deps.length;
|
4511 |
+
while (i--) {
|
4512 |
+
var dep = this.deps[i];
|
4513 |
+
if (!this.newDepIds.has(dep.id)) {
|
4514 |
+
dep.removeSub(this);
|
4515 |
+
}
|
4516 |
+
}
|
4517 |
+
var tmp = this.depIds;
|
4518 |
+
this.depIds = this.newDepIds;
|
4519 |
+
this.newDepIds = tmp;
|
4520 |
+
this.newDepIds.clear();
|
4521 |
+
tmp = this.deps;
|
4522 |
+
this.deps = this.newDeps;
|
4523 |
+
this.newDeps = tmp;
|
4524 |
+
this.newDeps.length = 0;
|
4525 |
+
};
|
4526 |
+
|
4527 |
+
/**
|
4528 |
+
* Subscriber interface.
|
4529 |
+
* Will be called when a dependency changes.
|
4530 |
+
*/
|
4531 |
+
Watcher.prototype.update = function update () {
|
4532 |
+
/* istanbul ignore else */
|
4533 |
+
if (this.lazy) {
|
4534 |
+
this.dirty = true;
|
4535 |
+
} else if (this.sync) {
|
4536 |
+
this.run();
|
4537 |
+
} else {
|
4538 |
+
queueWatcher(this);
|
4539 |
+
}
|
4540 |
+
};
|
4541 |
+
|
4542 |
+
/**
|
4543 |
+
* Scheduler job interface.
|
4544 |
+
* Will be called by the scheduler.
|
4545 |
+
*/
|
4546 |
+
Watcher.prototype.run = function run () {
|
4547 |
+
if (this.active) {
|
4548 |
+
var value = this.get();
|
4549 |
+
if (
|
4550 |
+
value !== this.value ||
|
4551 |
+
// Deep watchers and watchers on Object/Arrays should fire even
|
4552 |
+
// when the value is the same, because the value may
|
4553 |
+
// have mutated.
|
4554 |
+
isObject(value) ||
|
4555 |
+
this.deep
|
4556 |
+
) {
|
4557 |
+
// set new value
|
4558 |
+
var oldValue = this.value;
|
4559 |
+
this.value = value;
|
4560 |
+
if (this.user) {
|
4561 |
+
try {
|
4562 |
+
this.cb.call(this.vm, value, oldValue);
|
4563 |
+
} catch (e) {
|
4564 |
+
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
4565 |
+
}
|
4566 |
+
} else {
|
4567 |
+
this.cb.call(this.vm, value, oldValue);
|
4568 |
+
}
|
4569 |
+
}
|
4570 |
+
}
|
4571 |
+
};
|
4572 |
+
|
4573 |
+
/**
|
4574 |
+
* Evaluate the value of the watcher.
|
4575 |
+
* This only gets called for lazy watchers.
|
4576 |
+
*/
|
4577 |
+
Watcher.prototype.evaluate = function evaluate () {
|
4578 |
+
this.value = this.get();
|
4579 |
+
this.dirty = false;
|
4580 |
+
};
|
4581 |
+
|
4582 |
+
/**
|
4583 |
+
* Depend on all deps collected by this watcher.
|
4584 |
+
*/
|
4585 |
+
Watcher.prototype.depend = function depend () {
|
4586 |
+
var i = this.deps.length;
|
4587 |
+
while (i--) {
|
4588 |
+
this.deps[i].depend();
|
4589 |
+
}
|
4590 |
+
};
|
4591 |
+
|
4592 |
+
/**
|
4593 |
+
* Remove self from all dependencies' subscriber list.
|
4594 |
+
*/
|
4595 |
+
Watcher.prototype.teardown = function teardown () {
|
4596 |
+
if (this.active) {
|
4597 |
+
// remove self from vm's watcher list
|
4598 |
+
// this is a somewhat expensive operation so we skip it
|
4599 |
+
// if the vm is being destroyed.
|
4600 |
+
if (!this.vm._isBeingDestroyed) {
|
4601 |
+
remove(this.vm._watchers, this);
|
4602 |
+
}
|
4603 |
+
var i = this.deps.length;
|
4604 |
+
while (i--) {
|
4605 |
+
this.deps[i].removeSub(this);
|
4606 |
+
}
|
4607 |
+
this.active = false;
|
4608 |
+
}
|
4609 |
+
};
|
4610 |
+
|
4611 |
+
/* */
|
4612 |
+
|
4613 |
+
var sharedPropertyDefinition = {
|
4614 |
+
enumerable: true,
|
4615 |
+
configurable: true,
|
4616 |
+
get: noop,
|
4617 |
+
set: noop
|
4618 |
+
};
|
4619 |
+
|
4620 |
+
function proxy (target, sourceKey, key) {
|
4621 |
+
sharedPropertyDefinition.get = function proxyGetter () {
|
4622 |
+
return this[sourceKey][key]
|
4623 |
+
};
|
4624 |
+
sharedPropertyDefinition.set = function proxySetter (val) {
|
4625 |
+
this[sourceKey][key] = val;
|
4626 |
+
};
|
4627 |
+
Object.defineProperty(target, key, sharedPropertyDefinition);
|
4628 |
+
}
|
4629 |
+
|
4630 |
+
function initState (vm) {
|
4631 |
+
vm._watchers = [];
|
4632 |
+
var opts = vm.$options;
|
4633 |
+
if (opts.props) { initProps(vm, opts.props); }
|
4634 |
+
if (opts.methods) { initMethods(vm, opts.methods); }
|
4635 |
+
if (opts.data) {
|
4636 |
+
initData(vm);
|
4637 |
+
} else {
|
4638 |
+
observe(vm._data = {}, true /* asRootData */);
|
4639 |
+
}
|
4640 |
+
if (opts.computed) { initComputed(vm, opts.computed); }
|
4641 |
+
if (opts.watch && opts.watch !== nativeWatch) {
|
4642 |
+
initWatch(vm, opts.watch);
|
4643 |
+
}
|
4644 |
+
}
|
4645 |
+
|
4646 |
+
function initProps (vm, propsOptions) {
|
4647 |
+
var propsData = vm.$options.propsData || {};
|
4648 |
+
var props = vm._props = {};
|
4649 |
+
// cache prop keys so that future props updates can iterate using Array
|
4650 |
+
// instead of dynamic object key enumeration.
|
4651 |
+
var keys = vm.$options._propKeys = [];
|
4652 |
+
var isRoot = !vm.$parent;
|
4653 |
+
// root instance props should be converted
|
4654 |
+
if (!isRoot) {
|
4655 |
+
toggleObserving(false);
|
4656 |
+
}
|
4657 |
+
var loop = function ( key ) {
|
4658 |
+
keys.push(key);
|
4659 |
+
var value = validateProp(key, propsOptions, propsData, vm);
|
4660 |
+
/* istanbul ignore else */
|
4661 |
+
{
|
4662 |
+
var hyphenatedKey = hyphenate(key);
|
4663 |
+
if (isReservedAttribute(hyphenatedKey) ||
|
4664 |
+
config.isReservedAttr(hyphenatedKey)) {
|
4665 |
+
warn(
|
4666 |
+
("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
4667 |
+
vm
|
4668 |
+
);
|
4669 |
+
}
|
4670 |
+
defineReactive$$1(props, key, value, function () {
|
4671 |
+
if (!isRoot && !isUpdatingChildComponent) {
|
4672 |
+
warn(
|
4673 |
+
"Avoid mutating a prop directly since the value will be " +
|
4674 |
+
"overwritten whenever the parent component re-renders. " +
|
4675 |
+
"Instead, use a data or computed property based on the prop's " +
|
4676 |
+
"value. Prop being mutated: \"" + key + "\"",
|
4677 |
+
vm
|
4678 |
+
);
|
4679 |
+
}
|
4680 |
+
});
|
4681 |
+
}
|
4682 |
+
// static props are already proxied on the component's prototype
|
4683 |
+
// during Vue.extend(). We only need to proxy props defined at
|
4684 |
+
// instantiation here.
|
4685 |
+
if (!(key in vm)) {
|
4686 |
+
proxy(vm, "_props", key);
|
4687 |
+
}
|
4688 |
+
};
|
4689 |
+
|
4690 |
+
for (var key in propsOptions) loop( key );
|
4691 |
+
toggleObserving(true);
|
4692 |
+
}
|
4693 |
+
|
4694 |
+
function initData (vm) {
|
4695 |
+
var data = vm.$options.data;
|
4696 |
+
data = vm._data = typeof data === 'function'
|
4697 |
+
? getData(data, vm)
|
4698 |
+
: data || {};
|
4699 |
+
if (!isPlainObject(data)) {
|
4700 |
+
data = {};
|
4701 |
+
warn(
|
4702 |
+
'data functions should return an object:\n' +
|
4703 |
+
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
4704 |
+
vm
|
4705 |
+
);
|
4706 |
+
}
|
4707 |
+
// proxy data on instance
|
4708 |
+
var keys = Object.keys(data);
|
4709 |
+
var props = vm.$options.props;
|
4710 |
+
var methods = vm.$options.methods;
|
4711 |
+
var i = keys.length;
|
4712 |
+
while (i--) {
|
4713 |
+
var key = keys[i];
|
4714 |
+
{
|
4715 |
+
if (methods && hasOwn(methods, key)) {
|
4716 |
+
warn(
|
4717 |
+
("Method \"" + key + "\" has already been defined as a data property."),
|
4718 |
+
vm
|
4719 |
+
);
|
4720 |
+
}
|
4721 |
+
}
|
4722 |
+
if (props && hasOwn(props, key)) {
|
4723 |
+
warn(
|
4724 |
+
"The data property \"" + key + "\" is already declared as a prop. " +
|
4725 |
+
"Use prop default value instead.",
|
4726 |
+
vm
|
4727 |
+
);
|
4728 |
+
} else if (!isReserved(key)) {
|
4729 |
+
proxy(vm, "_data", key);
|
4730 |
+
}
|
4731 |
+
}
|
4732 |
+
// observe data
|
4733 |
+
observe(data, true /* asRootData */);
|
4734 |
+
}
|
4735 |
+
|
4736 |
+
function getData (data, vm) {
|
4737 |
+
// #7573 disable dep collection when invoking data getters
|
4738 |
+
pushTarget();
|
4739 |
+
try {
|
4740 |
+
return data.call(vm, vm)
|
4741 |
+
} catch (e) {
|
4742 |
+
handleError(e, vm, "data()");
|
4743 |
+
return {}
|
4744 |
+
} finally {
|
4745 |
+
popTarget();
|
4746 |
+
}
|
4747 |
+
}
|
4748 |
+
|
4749 |
+
var computedWatcherOptions = { lazy: true };
|
4750 |
+
|
4751 |
+
function initComputed (vm, computed) {
|
4752 |
+
// $flow-disable-line
|
4753 |
+
var watchers = vm._computedWatchers = Object.create(null);
|
4754 |
+
// computed properties are just getters during SSR
|
4755 |
+
var isSSR = isServerRendering();
|
4756 |
+
|
4757 |
+
for (var key in computed) {
|
4758 |
+
var userDef = computed[key];
|
4759 |
+
var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
4760 |
+
if (getter == null) {
|
4761 |
+
warn(
|
4762 |
+
("Getter is missing for computed property \"" + key + "\"."),
|
4763 |
+
vm
|
4764 |
+
);
|
4765 |
+
}
|
4766 |
+
|
4767 |
+
if (!isSSR) {
|
4768 |
+
// create internal watcher for the computed property.
|
4769 |
+
watchers[key] = new Watcher(
|
4770 |
+
vm,
|
4771 |
+
getter || noop,
|
4772 |
+
noop,
|
4773 |
+
computedWatcherOptions
|
4774 |
+
);
|
4775 |
+
}
|
4776 |
+
|
4777 |
+
// component-defined computed properties are already defined on the
|
4778 |
+
// component prototype. We only need to define computed properties defined
|
4779 |
+
// at instantiation here.
|
4780 |
+
if (!(key in vm)) {
|
4781 |
+
defineComputed(vm, key, userDef);
|
4782 |
+
} else {
|
4783 |
+
if (key in vm.$data) {
|
4784 |
+
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
4785 |
+
} else if (vm.$options.props && key in vm.$options.props) {
|
4786 |
+
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
4787 |
+
}
|
4788 |
+
}
|
4789 |
+
}
|
4790 |
+
}
|
4791 |
+
|
4792 |
+
function defineComputed (
|
4793 |
+
target,
|
4794 |
+
key,
|
4795 |
+
userDef
|
4796 |
+
) {
|
4797 |
+
var shouldCache = !isServerRendering();
|
4798 |
+
if (typeof userDef === 'function') {
|
4799 |
+
sharedPropertyDefinition.get = shouldCache
|
4800 |
+
? createComputedGetter(key)
|
4801 |
+
: createGetterInvoker(userDef);
|
4802 |
+
sharedPropertyDefinition.set = noop;
|
4803 |
+
} else {
|
4804 |
+
sharedPropertyDefinition.get = userDef.get
|
4805 |
+
? shouldCache && userDef.cache !== false
|
4806 |
+
? createComputedGetter(key)
|
4807 |
+
: createGetterInvoker(userDef.get)
|
4808 |
+
: noop;
|
4809 |
+
sharedPropertyDefinition.set = userDef.set || noop;
|
4810 |
+
}
|
4811 |
+
if (sharedPropertyDefinition.set === noop) {
|
4812 |
+
sharedPropertyDefinition.set = function () {
|
4813 |
+
warn(
|
4814 |
+
("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
4815 |
+
this
|
4816 |
+
);
|
4817 |
+
};
|
4818 |
+
}
|
4819 |
+
Object.defineProperty(target, key, sharedPropertyDefinition);
|
4820 |
+
}
|
4821 |
+
|
4822 |
+
function createComputedGetter (key) {
|
4823 |
+
return function computedGetter () {
|
4824 |
+
var watcher = this._computedWatchers && this._computedWatchers[key];
|
4825 |
+
if (watcher) {
|
4826 |
+
if (watcher.dirty) {
|
4827 |
+
watcher.evaluate();
|
4828 |
+
}
|
4829 |
+
if (Dep.target) {
|
4830 |
+
watcher.depend();
|
4831 |
+
}
|
4832 |
+
return watcher.value
|
4833 |
+
}
|
4834 |
+
}
|
4835 |
+
}
|
4836 |
+
|
4837 |
+
function createGetterInvoker(fn) {
|
4838 |
+
return function computedGetter () {
|
4839 |
+
return fn.call(this, this)
|
4840 |
+
}
|
4841 |
+
}
|
4842 |
+
|
4843 |
+
function initMethods (vm, methods) {
|
4844 |
+
var props = vm.$options.props;
|
4845 |
+
for (var key in methods) {
|
4846 |
+
{
|
4847 |
+
if (typeof methods[key] !== 'function') {
|
4848 |
+
warn(
|
4849 |
+
"Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
4850 |
+
"Did you reference the function correctly?",
|
4851 |
+
vm
|
4852 |
+
);
|
4853 |
+
}
|
4854 |
+
if (props && hasOwn(props, key)) {
|
4855 |
+
warn(
|
4856 |
+
("Method \"" + key + "\" has already been defined as a prop."),
|
4857 |
+
vm
|
4858 |
+
);
|
4859 |
+
}
|
4860 |
+
if ((key in vm) && isReserved(key)) {
|
4861 |
+
warn(
|
4862 |
+
"Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
4863 |
+
"Avoid defining component methods that start with _ or $."
|
4864 |
+
);
|
4865 |
+
}
|
4866 |
+
}
|
4867 |
+
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
4868 |
+
}
|
4869 |
+
}
|
4870 |
+
|
4871 |
+
function initWatch (vm, watch) {
|
4872 |
+
for (var key in watch) {
|
4873 |
+
var handler = watch[key];
|
4874 |
+
if (Array.isArray(handler)) {
|
4875 |
+
for (var i = 0; i < handler.length; i++) {
|
4876 |
+
createWatcher(vm, key, handler[i]);
|
4877 |
+
}
|
4878 |
+
} else {
|
4879 |
+
createWatcher(vm, key, handler);
|
4880 |
+
}
|
4881 |
+
}
|
4882 |
+
}
|
4883 |
+
|
4884 |
+
function createWatcher (
|
4885 |
+
vm,
|
4886 |
+
expOrFn,
|
4887 |
+
handler,
|
4888 |
+
options
|
4889 |
+
) {
|
4890 |
+
if (isPlainObject(handler)) {
|
4891 |
+
options = handler;
|
4892 |
+
handler = handler.handler;
|
4893 |
+
}
|
4894 |
+
if (typeof handler === 'string') {
|
4895 |
+
handler = vm[handler];
|
4896 |
+
}
|
4897 |
+
return vm.$watch(expOrFn, handler, options)
|
4898 |
+
}
|
4899 |
+
|
4900 |
+
function stateMixin (Vue) {
|
4901 |
+
// flow somehow has problems with directly declared definition object
|
4902 |
+
// when using Object.defineProperty, so we have to procedurally build up
|
4903 |
+
// the object here.
|
4904 |
+
var dataDef = {};
|
4905 |
+
dataDef.get = function () { return this._data };
|
4906 |
+
var propsDef = {};
|
4907 |
+
propsDef.get = function () { return this._props };
|
4908 |
+
{
|
4909 |
+
dataDef.set = function () {
|
4910 |
+
warn(
|
4911 |
+
'Avoid replacing instance root $data. ' +
|
4912 |
+
'Use nested data properties instead.',
|
4913 |
+
this
|
4914 |
+
);
|
4915 |
+
};
|
4916 |
+
propsDef.set = function () {
|
4917 |
+
warn("$props is readonly.", this);
|
4918 |
+
};
|
4919 |
+
}
|
4920 |
+
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
4921 |
+
Object.defineProperty(Vue.prototype, '$props', propsDef);
|
4922 |
+
|
4923 |
+
Vue.prototype.$set = set;
|
4924 |
+
Vue.prototype.$delete = del;
|
4925 |
+
|
4926 |
+
Vue.prototype.$watch = function (
|
4927 |
+
expOrFn,
|
4928 |
+
cb,
|
4929 |
+
options
|
4930 |
+
) {
|
4931 |
+
var vm = this;
|
4932 |
+
if (isPlainObject(cb)) {
|
4933 |
+
return createWatcher(vm, expOrFn, cb, options)
|
4934 |
+
}
|
4935 |
+
options = options || {};
|
4936 |
+
options.user = true;
|
4937 |
+
var watcher = new Watcher(vm, expOrFn, cb, options);
|
4938 |
+
if (options.immediate) {
|
4939 |
+
try {
|
4940 |
+
cb.call(vm, watcher.value);
|
4941 |
+
} catch (error) {
|
4942 |
+
handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
4943 |
+
}
|
4944 |
+
}
|
4945 |
+
return function unwatchFn () {
|
4946 |
+
watcher.teardown();
|
4947 |
+
}
|
4948 |
+
};
|
4949 |
+
}
|
4950 |
+
|
4951 |
+
/* */
|
4952 |
+
|
4953 |
+
var uid$3 = 0;
|
4954 |
+
|
4955 |
+
function initMixin (Vue) {
|
4956 |
+
Vue.prototype._init = function (options) {
|
4957 |
+
var vm = this;
|
4958 |
+
// a uid
|
4959 |
+
vm._uid = uid$3++;
|
4960 |
+
|
4961 |
+
var startTag, endTag;
|
4962 |
+
/* istanbul ignore if */
|
4963 |
+
if (config.performance && mark) {
|
4964 |
+
startTag = "vue-perf-start:" + (vm._uid);
|
4965 |
+
endTag = "vue-perf-end:" + (vm._uid);
|
4966 |
+
mark(startTag);
|
4967 |
+
}
|
4968 |
+
|
4969 |
+
// a flag to avoid this being observed
|
4970 |
+
vm._isVue = true;
|
4971 |
+
// merge options
|
4972 |
+
if (options && options._isComponent) {
|
4973 |
+
// optimize internal component instantiation
|
4974 |
+
// since dynamic options merging is pretty slow, and none of the
|
4975 |
+
// internal component options needs special treatment.
|
4976 |
+
initInternalComponent(vm, options);
|
4977 |
+
} else {
|
4978 |
+
vm.$options = mergeOptions(
|
4979 |
+
resolveConstructorOptions(vm.constructor),
|
4980 |
+
options || {},
|
4981 |
+
vm
|
4982 |
+
);
|
4983 |
+
}
|
4984 |
+
/* istanbul ignore else */
|
4985 |
+
{
|
4986 |
+
initProxy(vm);
|
4987 |
+
}
|
4988 |
+
// expose real self
|
4989 |
+
vm._self = vm;
|
4990 |
+
initLifecycle(vm);
|
4991 |
+
initEvents(vm);
|
4992 |
+
initRender(vm);
|
4993 |
+
callHook(vm, 'beforeCreate');
|
4994 |
+
initInjections(vm); // resolve injections before data/props
|
4995 |
+
initState(vm);
|
4996 |
+
initProvide(vm); // resolve provide after data/props
|
4997 |
+
callHook(vm, 'created');
|
4998 |
+
|
4999 |
+
/* istanbul ignore if */
|
5000 |
+
if (config.performance && mark) {
|
5001 |
+
vm._name = formatComponentName(vm, false);
|
5002 |
+
mark(endTag);
|
5003 |
+
measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
5004 |
+
}
|
5005 |
+
|
5006 |
+
if (vm.$options.el) {
|
5007 |
+
vm.$mount(vm.$options.el);
|
5008 |
+
}
|
5009 |
+
};
|
5010 |
+
}
|
5011 |
+
|
5012 |
+
function initInternalComponent (vm, options) {
|
5013 |
+
var opts = vm.$options = Object.create(vm.constructor.options);
|
5014 |
+
// doing this because it's faster than dynamic enumeration.
|
5015 |
+
var parentVnode = options._parentVnode;
|
5016 |
+
opts.parent = options.parent;
|
5017 |
+
opts._parentVnode = parentVnode;
|
5018 |
+
|
5019 |
+
var vnodeComponentOptions = parentVnode.componentOptions;
|
5020 |
+
opts.propsData = vnodeComponentOptions.propsData;
|
5021 |
+
opts._parentListeners = vnodeComponentOptions.listeners;
|
5022 |
+
opts._renderChildren = vnodeComponentOptions.children;
|
5023 |
+
opts._componentTag = vnodeComponentOptions.tag;
|
5024 |
+
|
5025 |
+
if (options.render) {
|
5026 |
+
opts.render = options.render;
|
5027 |
+
opts.staticRenderFns = options.staticRenderFns;
|
5028 |
+
}
|
5029 |
+
}
|
5030 |
+
|
5031 |
+
function resolveConstructorOptions (Ctor) {
|
5032 |
+
var options = Ctor.options;
|
5033 |
+
if (Ctor.super) {
|
5034 |
+
var superOptions = resolveConstructorOptions(Ctor.super);
|
5035 |
+
var cachedSuperOptions = Ctor.superOptions;
|
5036 |
+
if (superOptions !== cachedSuperOptions) {
|
5037 |
+
// super option changed,
|
5038 |
+
// need to resolve new options.
|
5039 |
+
Ctor.superOptions = superOptions;
|
5040 |
+
// check if there are any late-modified/attached options (#4976)
|
5041 |
+
var modifiedOptions = resolveModifiedOptions(Ctor);
|
5042 |
+
// update base extend options
|
5043 |
+
if (modifiedOptions) {
|
5044 |
+
extend(Ctor.extendOptions, modifiedOptions);
|
5045 |
+
}
|
5046 |
+
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
5047 |
+
if (options.name) {
|
5048 |
+
options.components[options.name] = Ctor;
|
5049 |
+
}
|
5050 |
+
}
|
5051 |
+
}
|
5052 |
+
return options
|
5053 |
+
}
|
5054 |
+
|
5055 |
+
function resolveModifiedOptions (Ctor) {
|
5056 |
+
var modified;
|
5057 |
+
var latest = Ctor.options;
|
5058 |
+
var sealed = Ctor.sealedOptions;
|
5059 |
+
for (var key in latest) {
|
5060 |
+
if (latest[key] !== sealed[key]) {
|
5061 |
+
if (!modified) { modified = {}; }
|
5062 |
+
modified[key] = latest[key];
|
5063 |
+
}
|
5064 |
+
}
|
5065 |
+
return modified
|
5066 |
+
}
|
5067 |
+
|
5068 |
+
function Vue (options) {
|
5069 |
+
if (!(this instanceof Vue)
|
5070 |
+
) {
|
5071 |
+
warn('Vue is a constructor and should be called with the `new` keyword');
|
5072 |
+
}
|
5073 |
+
this._init(options);
|
5074 |
+
}
|
5075 |
+
|
5076 |
+
initMixin(Vue);
|
5077 |
+
stateMixin(Vue);
|
5078 |
+
eventsMixin(Vue);
|
5079 |
+
lifecycleMixin(Vue);
|
5080 |
+
renderMixin(Vue);
|
5081 |
+
|
5082 |
+
/* */
|
5083 |
+
|
5084 |
+
function initUse (Vue) {
|
5085 |
+
Vue.use = function (plugin) {
|
5086 |
+
var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
5087 |
+
if (installedPlugins.indexOf(plugin) > -1) {
|
5088 |
+
return this
|
5089 |
+
}
|
5090 |
+
|
5091 |
+
// additional parameters
|
5092 |
+
var args = toArray(arguments, 1);
|
5093 |
+
args.unshift(this);
|
5094 |
+
if (typeof plugin.install === 'function') {
|
5095 |
+
plugin.install.apply(plugin, args);
|
5096 |
+
} else if (typeof plugin === 'function') {
|
5097 |
+
plugin.apply(null, args);
|
5098 |
+
}
|
5099 |
+
installedPlugins.push(plugin);
|
5100 |
+
return this
|
5101 |
+
};
|
5102 |
+
}
|
5103 |
+
|
5104 |
+
/* */
|
5105 |
+
|
5106 |
+
function initMixin$1 (Vue) {
|
5107 |
+
Vue.mixin = function (mixin) {
|
5108 |
+
this.options = mergeOptions(this.options, mixin);
|
5109 |
+
return this
|
5110 |
+
};
|
5111 |
+
}
|
5112 |
+
|
5113 |
+
/* */
|
5114 |
+
|
5115 |
+
function initExtend (Vue) {
|
5116 |
+
/**
|
5117 |
+
* Each instance constructor, including Vue, has a unique
|
5118 |
+
* cid. This enables us to create wrapped "child
|
5119 |
+
* constructors" for prototypal inheritance and cache them.
|
5120 |
+
*/
|
5121 |
+
Vue.cid = 0;
|
5122 |
+
var cid = 1;
|
5123 |
+
|
5124 |
+
/**
|
5125 |
+
* Class inheritance
|
5126 |
+
*/
|
5127 |
+
Vue.extend = function (extendOptions) {
|
5128 |
+
extendOptions = extendOptions || {};
|
5129 |
+
var Super = this;
|
5130 |
+
var SuperId = Super.cid;
|
5131 |
+
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5132 |
+
if (cachedCtors[SuperId]) {
|
5133 |
+
return cachedCtors[SuperId]
|
5134 |
+
}
|
5135 |
+
|
5136 |
+
var name = extendOptions.name || Super.options.name;
|
5137 |
+
if (name) {
|
5138 |
+
validateComponentName(name);
|
5139 |
+
}
|
5140 |
+
|
5141 |
+
var Sub = function VueComponent (options) {
|
5142 |
+
this._init(options);
|
5143 |
+
};
|
5144 |
+
Sub.prototype = Object.create(Super.prototype);
|
5145 |
+
Sub.prototype.constructor = Sub;
|
5146 |
+
Sub.cid = cid++;
|
5147 |
+
Sub.options = mergeOptions(
|
5148 |
+
Super.options,
|
5149 |
+
extendOptions
|
5150 |
+
);
|
5151 |
+
Sub['super'] = Super;
|
5152 |
+
|
5153 |
+
// For props and computed properties, we define the proxy getters on
|
5154 |
+
// the Vue instances at extension time, on the extended prototype. This
|
5155 |
+
// avoids Object.defineProperty calls for each instance created.
|
5156 |
+
if (Sub.options.props) {
|
5157 |
+
initProps$1(Sub);
|
5158 |
+
}
|
5159 |
+
if (Sub.options.computed) {
|
5160 |
+
initComputed$1(Sub);
|
5161 |
+
}
|
5162 |
+
|
5163 |
+
// allow further extension/mixin/plugin usage
|
5164 |
+
Sub.extend = Super.extend;
|
5165 |
+
Sub.mixin = Super.mixin;
|
5166 |
+
Sub.use = Super.use;
|
5167 |
+
|
5168 |
+
// create asset registers, so extended classes
|
5169 |
+
// can have their private assets too.
|
5170 |
+
ASSET_TYPES.forEach(function (type) {
|
5171 |
+
Sub[type] = Super[type];
|
5172 |
+
});
|
5173 |
+
// enable recursive self-lookup
|
5174 |
+
if (name) {
|
5175 |
+
Sub.options.components[name] = Sub;
|
5176 |
+
}
|
5177 |
+
|
5178 |
+
// keep a reference to the super options at extension time.
|
5179 |
+
// later at instantiation we can check if Super's options have
|
5180 |
+
// been updated.
|
5181 |
+
Sub.superOptions = Super.options;
|
5182 |
+
Sub.extendOptions = extendOptions;
|
5183 |
+
Sub.sealedOptions = extend({}, Sub.options);
|
5184 |
+
|
5185 |
+
// cache constructor
|
5186 |
+
cachedCtors[SuperId] = Sub;
|
5187 |
+
return Sub
|
5188 |
+
};
|
5189 |
+
}
|
5190 |
+
|
5191 |
+
function initProps$1 (Comp) {
|
5192 |
+
var props = Comp.options.props;
|
5193 |
+
for (var key in props) {
|
5194 |
+
proxy(Comp.prototype, "_props", key);
|
5195 |
+
}
|
5196 |
+
}
|
5197 |
+
|
5198 |
+
function initComputed$1 (Comp) {
|
5199 |
+
var computed = Comp.options.computed;
|
5200 |
+
for (var key in computed) {
|
5201 |
+
defineComputed(Comp.prototype, key, computed[key]);
|
5202 |
+
}
|
5203 |
+
}
|
5204 |
+
|
5205 |
+
/* */
|
5206 |
+
|
5207 |
+
function initAssetRegisters (Vue) {
|
5208 |
+
/**
|
5209 |
+
* Create asset registration methods.
|
5210 |
+
*/
|
5211 |
+
ASSET_TYPES.forEach(function (type) {
|
5212 |
+
Vue[type] = function (
|
5213 |
+
id,
|
5214 |
+
definition
|
5215 |
+
) {
|
5216 |
+
if (!definition) {
|
5217 |
+
return this.options[type + 's'][id]
|
5218 |
+
} else {
|
5219 |
+
/* istanbul ignore if */
|
5220 |
+
if (type === 'component') {
|
5221 |
+
validateComponentName(id);
|
5222 |
+
}
|
5223 |
+
if (type === 'component' && isPlainObject(definition)) {
|
5224 |
+
definition.name = definition.name || id;
|
5225 |
+
definition = this.options._base.extend(definition);
|
5226 |
+
}
|
5227 |
+
if (type === 'directive' && typeof definition === 'function') {
|
5228 |
+
definition = { bind: definition, update: definition };
|
5229 |
+
}
|
5230 |
+
this.options[type + 's'][id] = definition;
|
5231 |
+
return definition
|
5232 |
+
}
|
5233 |
+
};
|
5234 |
+
});
|
5235 |
+
}
|
5236 |
+
|
5237 |
+
/* */
|
5238 |
+
|
5239 |
+
|
5240 |
+
|
5241 |
+
function getComponentName (opts) {
|
5242 |
+
return opts && (opts.Ctor.options.name || opts.tag)
|
5243 |
+
}
|
5244 |
+
|
5245 |
+
function matches (pattern, name) {
|
5246 |
+
if (Array.isArray(pattern)) {
|
5247 |
+
return pattern.indexOf(name) > -1
|
5248 |
+
} else if (typeof pattern === 'string') {
|
5249 |
+
return pattern.split(',').indexOf(name) > -1
|
5250 |
+
} else if (isRegExp(pattern)) {
|
5251 |
+
return pattern.test(name)
|
5252 |
+
}
|
5253 |
+
/* istanbul ignore next */
|
5254 |
+
return false
|
5255 |
+
}
|
5256 |
+
|
5257 |
+
function pruneCache (keepAliveInstance, filter) {
|
5258 |
+
var cache = keepAliveInstance.cache;
|
5259 |
+
var keys = keepAliveInstance.keys;
|
5260 |
+
var _vnode = keepAliveInstance._vnode;
|
5261 |
+
for (var key in cache) {
|
5262 |
+
var cachedNode = cache[key];
|
5263 |
+
if (cachedNode) {
|
5264 |
+
var name = getComponentName(cachedNode.componentOptions);
|
5265 |
+
if (name && !filter(name)) {
|
5266 |
+
pruneCacheEntry(cache, key, keys, _vnode);
|
5267 |
+
}
|
5268 |
+
}
|
5269 |
+
}
|
5270 |
+
}
|
5271 |
+
|
5272 |
+
function pruneCacheEntry (
|
5273 |
+
cache,
|
5274 |
+
key,
|
5275 |
+
keys,
|
5276 |
+
current
|
5277 |
+
) {
|
5278 |
+
var cached$$1 = cache[key];
|
5279 |
+
if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
5280 |
+
cached$$1.componentInstance.$destroy();
|
5281 |
+
}
|
5282 |
+
cache[key] = null;
|
5283 |
+
remove(keys, key);
|
5284 |
+
}
|
5285 |
+
|
5286 |
+
var patternTypes = [String, RegExp, Array];
|
5287 |
+
|
5288 |
+
var KeepAlive = {
|
5289 |
+
name: 'keep-alive',
|
5290 |
+
abstract: true,
|
5291 |
+
|
5292 |
+
props: {
|
5293 |
+
include: patternTypes,
|
5294 |
+
exclude: patternTypes,
|
5295 |
+
max: [String, Number]
|
5296 |
+
},
|
5297 |
+
|
5298 |
+
created: function created () {
|
5299 |
+
this.cache = Object.create(null);
|
5300 |
+
this.keys = [];
|
5301 |
+
},
|
5302 |
+
|
5303 |
+
destroyed: function destroyed () {
|
5304 |
+
for (var key in this.cache) {
|
5305 |
+
pruneCacheEntry(this.cache, key, this.keys);
|
5306 |
+
}
|
5307 |
+
},
|
5308 |
+
|
5309 |
+
mounted: function mounted () {
|
5310 |
+
var this$1 = this;
|
5311 |
+
|
5312 |
+
this.$watch('include', function (val) {
|
5313 |
+
pruneCache(this$1, function (name) { return matches(val, name); });
|
5314 |
+
});
|
5315 |
+
this.$watch('exclude', function (val) {
|
5316 |
+
pruneCache(this$1, function (name) { return !matches(val, name); });
|
5317 |
+
});
|
5318 |
+
},
|
5319 |
+
|
5320 |
+
render: function render () {
|
5321 |
+
var slot = this.$slots.default;
|
5322 |
+
var vnode = getFirstComponentChild(slot);
|
5323 |
+
var componentOptions = vnode && vnode.componentOptions;
|
5324 |
+
if (componentOptions) {
|
5325 |
+
// check pattern
|
5326 |
+
var name = getComponentName(componentOptions);
|
5327 |
+
var ref = this;
|
5328 |
+
var include = ref.include;
|
5329 |
+
var exclude = ref.exclude;
|
5330 |
+
if (
|
5331 |
+
// not included
|
5332 |
+
(include && (!name || !matches(include, name))) ||
|
5333 |
+
// excluded
|
5334 |
+
(exclude && name && matches(exclude, name))
|
5335 |
+
) {
|
5336 |
+
return vnode
|
5337 |
+
}
|
5338 |
+
|
5339 |
+
var ref$1 = this;
|
5340 |
+
var cache = ref$1.cache;
|
5341 |
+
var keys = ref$1.keys;
|
5342 |
+
var key = vnode.key == null
|
5343 |
+
// same constructor may get registered as different local components
|
5344 |
+
// so cid alone is not enough (#3269)
|
5345 |
+
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
5346 |
+
: vnode.key;
|
5347 |
+
if (cache[key]) {
|
5348 |
+
vnode.componentInstance = cache[key].componentInstance;
|
5349 |
+
// make current key freshest
|
5350 |
+
remove(keys, key);
|
5351 |
+
keys.push(key);
|
5352 |
+
} else {
|
5353 |
+
cache[key] = vnode;
|
5354 |
+
keys.push(key);
|
5355 |
+
// prune oldest entry
|
5356 |
+
if (this.max && keys.length > parseInt(this.max)) {
|
5357 |
+
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5358 |
+
}
|
5359 |
+
}
|
5360 |
+
|
5361 |
+
vnode.data.keepAlive = true;
|
5362 |
+
}
|
5363 |
+
return vnode || (slot && slot[0])
|
5364 |
+
}
|
5365 |
+
};
|
5366 |
+
|
5367 |
+
var builtInComponents = {
|
5368 |
+
KeepAlive: KeepAlive
|
5369 |
+
};
|
5370 |
+
|
5371 |
+
/* */
|
5372 |
+
|
5373 |
+
function initGlobalAPI (Vue) {
|
5374 |
+
// config
|
5375 |
+
var configDef = {};
|
5376 |
+
configDef.get = function () { return config; };
|
5377 |
+
{
|
5378 |
+
configDef.set = function () {
|
5379 |
+
warn(
|
5380 |
+
'Do not replace the Vue.config object, set individual fields instead.'
|
5381 |
+
);
|
5382 |
+
};
|
5383 |
+
}
|
5384 |
+
Object.defineProperty(Vue, 'config', configDef);
|
5385 |
+
|
5386 |
+
// exposed util methods.
|
5387 |
+
// NOTE: these are not considered part of the public API - avoid relying on
|
5388 |
+
// them unless you are aware of the risk.
|
5389 |
+
Vue.util = {
|
5390 |
+
warn: warn,
|
5391 |
+
extend: extend,
|
5392 |
+
mergeOptions: mergeOptions,
|
5393 |
+
defineReactive: defineReactive$$1
|
5394 |
+
};
|
5395 |
+
|
5396 |
+
Vue.set = set;
|
5397 |
+
Vue.delete = del;
|
5398 |
+
Vue.nextTick = nextTick;
|
5399 |
+
|
5400 |
+
// 2.6 explicit observable API
|
5401 |
+
Vue.observable = function (obj) {
|
5402 |
+
observe(obj);
|
5403 |
+
return obj
|
5404 |
+
};
|
5405 |
+
|
5406 |
+
Vue.options = Object.create(null);
|
5407 |
+
ASSET_TYPES.forEach(function (type) {
|
5408 |
+
Vue.options[type + 's'] = Object.create(null);
|
5409 |
+
});
|
5410 |
+
|
5411 |
+
// this is used to identify the "base" constructor to extend all plain-object
|
5412 |
+
// components with in Weex's multi-instance scenarios.
|
5413 |
+
Vue.options._base = Vue;
|
5414 |
+
|
5415 |
+
extend(Vue.options.components, builtInComponents);
|
5416 |
+
|
5417 |
+
initUse(Vue);
|
5418 |
+
initMixin$1(Vue);
|
5419 |
+
initExtend(Vue);
|
5420 |
+
initAssetRegisters(Vue);
|
5421 |
+
}
|
5422 |
+
|
5423 |
+
initGlobalAPI(Vue);
|
5424 |
+
|
5425 |
+
Object.defineProperty(Vue.prototype, '$isServer', {
|
5426 |
+
get: isServerRendering
|
5427 |
+
});
|
5428 |
+
|
5429 |
+
Object.defineProperty(Vue.prototype, '$ssrContext', {
|
5430 |
+
get: function get () {
|
5431 |
+
/* istanbul ignore next */
|
5432 |
+
return this.$vnode && this.$vnode.ssrContext
|
5433 |
+
}
|
5434 |
+
});
|
5435 |
+
|
5436 |
+
// expose FunctionalRenderContext for ssr runtime helper installation
|
5437 |
+
Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
5438 |
+
value: FunctionalRenderContext
|
5439 |
+
});
|
5440 |
+
|
5441 |
+
Vue.version = '2.6.10';
|
5442 |
+
|
5443 |
+
/* */
|
5444 |
+
|
5445 |
+
// these are reserved for web because they are directly compiled away
|
5446 |
+
// during template compilation
|
5447 |
+
var isReservedAttr = makeMap('style,class');
|
5448 |
+
|
5449 |
+
// attributes that should be using props for binding
|
5450 |
+
var acceptValue = makeMap('input,textarea,option,select,progress');
|
5451 |
+
var mustUseProp = function (tag, type, attr) {
|
5452 |
+
return (
|
5453 |
+
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
5454 |
+
(attr === 'selected' && tag === 'option') ||
|
5455 |
+
(attr === 'checked' && tag === 'input') ||
|
5456 |
+
(attr === 'muted' && tag === 'video')
|
5457 |
+
)
|
5458 |
+
};
|
5459 |
+
|
5460 |
+
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
5461 |
+
|
5462 |
+
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
5463 |
+
|
5464 |
+
var convertEnumeratedValue = function (key, value) {
|
5465 |
+
return isFalsyAttrValue(value) || value === 'false'
|
5466 |
+
? 'false'
|
5467 |
+
// allow arbitrary string value for contenteditable
|
5468 |
+
: key === 'contenteditable' && isValidContentEditableValue(value)
|
5469 |
+
? value
|
5470 |
+
: 'true'
|
5471 |
+
};
|
5472 |
+
|
5473 |
+
var isBooleanAttr = makeMap(
|
5474 |
+
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
5475 |
+
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
5476 |
+
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
5477 |
+
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
5478 |
+
'required,reversed,scoped,seamless,selected,sortable,translate,' +
|
5479 |
+
'truespeed,typemustmatch,visible'
|
5480 |
+
);
|
5481 |
+
|
5482 |
+
var xlinkNS = 'http://www.w3.org/1999/xlink';
|
5483 |
+
|
5484 |
+
var isXlink = function (name) {
|
5485 |
+
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
5486 |
+
};
|
5487 |
+
|
5488 |
+
var getXlinkProp = function (name) {
|
5489 |
+
return isXlink(name) ? name.slice(6, name.length) : ''
|
5490 |
+
};
|
5491 |
+
|
5492 |
+
var isFalsyAttrValue = function (val) {
|
5493 |
+
return val == null || val === false
|
5494 |
+
};
|
5495 |
+
|
5496 |
+
/* */
|
5497 |
+
|
5498 |
+
function genClassForVnode (vnode) {
|
5499 |
+
var data = vnode.data;
|
5500 |
+
var parentNode = vnode;
|
5501 |
+
var childNode = vnode;
|
5502 |
+
while (isDef(childNode.componentInstance)) {
|
5503 |
+
childNode = childNode.componentInstance._vnode;
|
5504 |
+
if (childNode && childNode.data) {
|
5505 |
+
data = mergeClassData(childNode.data, data);
|
5506 |
+
}
|
5507 |
+
}
|
5508 |
+
while (isDef(parentNode = parentNode.parent)) {
|
5509 |
+
if (parentNode && parentNode.data) {
|
5510 |
+
data = mergeClassData(data, parentNode.data);
|
5511 |
+
}
|
5512 |
+
}
|
5513 |
+
return renderClass(data.staticClass, data.class)
|
5514 |
+
}
|
5515 |
+
|
5516 |
+
function mergeClassData (child, parent) {
|
5517 |
+
return {
|
5518 |
+
staticClass: concat(child.staticClass, parent.staticClass),
|
5519 |
+
class: isDef(child.class)
|
5520 |
+
? [child.class, parent.class]
|
5521 |
+
: parent.class
|
5522 |
+
}
|
5523 |
+
}
|
5524 |
+
|
5525 |
+
function renderClass (
|
5526 |
+
staticClass,
|
5527 |
+
dynamicClass
|
5528 |
+
) {
|
5529 |
+
if (isDef(staticClass) || isDef(dynamicClass)) {
|
5530 |
+
return concat(staticClass, stringifyClass(dynamicClass))
|
5531 |
+
}
|
5532 |
+
/* istanbul ignore next */
|
5533 |
+
return ''
|
5534 |
+
}
|
5535 |
+
|
5536 |
+
function concat (a, b) {
|
5537 |
+
return a ? b ? (a + ' ' + b) : a : (b || '')
|
5538 |
+
}
|
5539 |
+
|
5540 |
+
function stringifyClass (value) {
|
5541 |
+
if (Array.isArray(value)) {
|
5542 |
+
return stringifyArray(value)
|
5543 |
+
}
|
5544 |
+
if (isObject(value)) {
|
5545 |
+
return stringifyObject(value)
|
5546 |
+
}
|
5547 |
+
if (typeof value === 'string') {
|
5548 |
+
return value
|
5549 |
+
}
|
5550 |
+
/* istanbul ignore next */
|
5551 |
+
return ''
|
5552 |
+
}
|
5553 |
+
|
5554 |
+
function stringifyArray (value) {
|
5555 |
+
var res = '';
|
5556 |
+
var stringified;
|
5557 |
+
for (var i = 0, l = value.length; i < l; i++) {
|
5558 |
+
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
5559 |
+
if (res) { res += ' '; }
|
5560 |
+
res += stringified;
|
5561 |
+
}
|
5562 |
+
}
|
5563 |
+
return res
|
5564 |
+
}
|
5565 |
+
|
5566 |
+
function stringifyObject (value) {
|
5567 |
+
var res = '';
|
5568 |
+
for (var key in value) {
|
5569 |
+
if (value[key]) {
|
5570 |
+
if (res) { res += ' '; }
|
5571 |
+
res += key;
|
5572 |
+
}
|
5573 |
+
}
|
5574 |
+
return res
|
5575 |
+
}
|
5576 |
+
|
5577 |
+
/* */
|
5578 |
+
|
5579 |
+
var namespaceMap = {
|
5580 |
+
svg: 'http://www.w3.org/2000/svg',
|
5581 |
+
math: 'http://www.w3.org/1998/Math/MathML'
|
5582 |
+
};
|
5583 |
+
|
5584 |
+
var isHTMLTag = makeMap(
|
5585 |
+
'html,body,base,head,link,meta,style,title,' +
|
5586 |
+
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
5587 |
+
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
5588 |
+
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
5589 |
+
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
5590 |
+
'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
5591 |
+
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
5592 |
+
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
5593 |
+
'output,progress,select,textarea,' +
|
5594 |
+
'details,dialog,menu,menuitem,summary,' +
|
5595 |
+
'content,element,shadow,template,blockquote,iframe,tfoot'
|
5596 |
+
);
|
5597 |
+
|
5598 |
+
// this map is intentionally selective, only covering SVG elements that may
|
5599 |
+
// contain child elements.
|
5600 |
+
var isSVG = makeMap(
|
5601 |
+
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
5602 |
+
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
5603 |
+
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
5604 |
+
true
|
5605 |
+
);
|
5606 |
+
|
5607 |
+
var isPreTag = function (tag) { return tag === 'pre'; };
|
5608 |
+
|
5609 |
+
var isReservedTag = function (tag) {
|
5610 |
+
return isHTMLTag(tag) || isSVG(tag)
|
5611 |
+
};
|
5612 |
+
|
5613 |
+
function getTagNamespace (tag) {
|
5614 |
+
if (isSVG(tag)) {
|
5615 |
+
return 'svg'
|
5616 |
+
}
|
5617 |
+
// basic support for MathML
|
5618 |
+
// note it doesn't support other MathML elements being component roots
|
5619 |
+
if (tag === 'math') {
|
5620 |
+
return 'math'
|
5621 |
+
}
|
5622 |
+
}
|
5623 |
+
|
5624 |
+
var unknownElementCache = Object.create(null);
|
5625 |
+
function isUnknownElement (tag) {
|
5626 |
+
/* istanbul ignore if */
|
5627 |
+
if (!inBrowser) {
|
5628 |
+
return true
|
5629 |
+
}
|
5630 |
+
if (isReservedTag(tag)) {
|
5631 |
+
return false
|
5632 |
+
}
|
5633 |
+
tag = tag.toLowerCase();
|
5634 |
+
/* istanbul ignore if */
|
5635 |
+
if (unknownElementCache[tag] != null) {
|
5636 |
+
return unknownElementCache[tag]
|
5637 |
+
}
|
5638 |
+
var el = document.createElement(tag);
|
5639 |
+
if (tag.indexOf('-') > -1) {
|
5640 |
+
// http://stackoverflow.com/a/28210364/1070244
|
5641 |
+
return (unknownElementCache[tag] = (
|
5642 |
+
el.constructor === window.HTMLUnknownElement ||
|
5643 |
+
el.constructor === window.HTMLElement
|
5644 |
+
))
|
5645 |
+
} else {
|
5646 |
+
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
5647 |
+
}
|
5648 |
+
}
|
5649 |
+
|
5650 |
+
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
5651 |
+
|
5652 |
+
/* */
|
5653 |
+
|
5654 |
+
/**
|
5655 |
+
* Query an element selector if it's not an element already.
|
5656 |
+
*/
|
5657 |
+
function query (el) {
|
5658 |
+
if (typeof el === 'string') {
|
5659 |
+
var selected = document.querySelector(el);
|
5660 |
+
if (!selected) {
|
5661 |
+
warn(
|
5662 |
+
'Cannot find element: ' + el
|
5663 |
+
);
|
5664 |
+
return document.createElement('div')
|
5665 |
+
}
|
5666 |
+
return selected
|
5667 |
+
} else {
|
5668 |
+
return el
|
5669 |
+
}
|
5670 |
+
}
|
5671 |
+
|
5672 |
+
/* */
|
5673 |
+
|
5674 |
+
function createElement$1 (tagName, vnode) {
|
5675 |
+
var elm = document.createElement(tagName);
|
5676 |
+
if (tagName !== 'select') {
|
5677 |
+
return elm
|
5678 |
+
}
|
5679 |
+
// false or null will remove the attribute but undefined will not
|
5680 |
+
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
5681 |
+
elm.setAttribute('multiple', 'multiple');
|
5682 |
+
}
|
5683 |
+
return elm
|
5684 |
+
}
|
5685 |
+
|
5686 |
+
function createElementNS (namespace, tagName) {
|
5687 |
+
return document.createElementNS(namespaceMap[namespace], tagName)
|
5688 |
+
}
|
5689 |
+
|
5690 |
+
function createTextNode (text) {
|
5691 |
+
return document.createTextNode(text)
|
5692 |
+
}
|
5693 |
+
|
5694 |
+
function createComment (text) {
|
5695 |
+
return document.createComment(text)
|
5696 |
+
}
|
5697 |
+
|
5698 |
+
function insertBefore (parentNode, newNode, referenceNode) {
|
5699 |
+
parentNode.insertBefore(newNode, referenceNode);
|
5700 |
+
}
|
5701 |
+
|
5702 |
+
function removeChild (node, child) {
|
5703 |
+
node.removeChild(child);
|
5704 |
+
}
|
5705 |
+
|
5706 |
+
function appendChild (node, child) {
|
5707 |
+
node.appendChild(child);
|
5708 |
+
}
|
5709 |
+
|
5710 |
+
function parentNode (node) {
|
5711 |
+
return node.parentNode
|
5712 |
+
}
|
5713 |
+
|
5714 |
+
function nextSibling (node) {
|
5715 |
+
return node.nextSibling
|
5716 |
+
}
|
5717 |
+
|
5718 |
+
function tagName (node) {
|
5719 |
+
return node.tagName
|
5720 |
+
}
|
5721 |
+
|
5722 |
+
function setTextContent (node, text) {
|
5723 |
+
node.textContent = text;
|
5724 |
+
}
|
5725 |
+
|
5726 |
+
function setStyleScope (node, scopeId) {
|
5727 |
+
node.setAttribute(scopeId, '');
|
5728 |
+
}
|
5729 |
+
|
5730 |
+
var nodeOps = /*#__PURE__*/Object.freeze({
|
5731 |
+
createElement: createElement$1,
|
5732 |
+
createElementNS: createElementNS,
|
5733 |
+
createTextNode: createTextNode,
|
5734 |
+
createComment: createComment,
|
5735 |
+
insertBefore: insertBefore,
|
5736 |
+
removeChild: removeChild,
|
5737 |
+
appendChild: appendChild,
|
5738 |
+
parentNode: parentNode,
|
5739 |
+
nextSibling: nextSibling,
|
5740 |
+
tagName: tagName,
|
5741 |
+
setTextContent: setTextContent,
|
5742 |
+
setStyleScope: setStyleScope
|
5743 |
+
});
|
5744 |
+
|
5745 |
+
/* */
|
5746 |
+
|
5747 |
+
var ref = {
|
5748 |
+
create: function create (_, vnode) {
|
5749 |
+
registerRef(vnode);
|
5750 |
+
},
|
5751 |
+
update: function update (oldVnode, vnode) {
|
5752 |
+
if (oldVnode.data.ref !== vnode.data.ref) {
|
5753 |
+
registerRef(oldVnode, true);
|
5754 |
+
registerRef(vnode);
|
5755 |
+
}
|
5756 |
+
},
|
5757 |
+
destroy: function destroy (vnode) {
|
5758 |
+
registerRef(vnode, true);
|
5759 |
+
}
|
5760 |
+
};
|
5761 |
+
|
5762 |
+
function registerRef (vnode, isRemoval) {
|
5763 |
+
var key = vnode.data.ref;
|
5764 |
+
if (!isDef(key)) { return }
|
5765 |
+
|
5766 |
+
var vm = vnode.context;
|
5767 |
+
var ref = vnode.componentInstance || vnode.elm;
|
5768 |
+
var refs = vm.$refs;
|
5769 |
+
if (isRemoval) {
|
5770 |
+
if (Array.isArray(refs[key])) {
|
5771 |
+
remove(refs[key], ref);
|
5772 |
+
} else if (refs[key] === ref) {
|
5773 |
+
refs[key] = undefined;
|
5774 |
+
}
|
5775 |
+
} else {
|
5776 |
+
if (vnode.data.refInFor) {
|
5777 |
+
if (!Array.isArray(refs[key])) {
|
5778 |
+
refs[key] = [ref];
|
5779 |
+
} else if (refs[key].indexOf(ref) < 0) {
|
5780 |
+
// $flow-disable-line
|
5781 |
+
refs[key].push(ref);
|
5782 |
+
}
|
5783 |
+
} else {
|
5784 |
+
refs[key] = ref;
|
5785 |
+
}
|
5786 |
+
}
|
5787 |
+
}
|
5788 |
+
|
5789 |
+
/**
|
5790 |
+
* Virtual DOM patching algorithm based on Snabbdom by
|
5791 |
+
* Simon Friis Vindum (@paldepind)
|
5792 |
+
* Licensed under the MIT License
|
5793 |
+
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
|
5794 |
+
*
|
5795 |
+
* modified by Evan You (@yyx990803)
|
5796 |
+
*
|
5797 |
+
* Not type-checking this because this file is perf-critical and the cost
|
5798 |
+
* of making flow understand it is not worth it.
|
5799 |
+
*/
|
5800 |
+
|
5801 |
+
var emptyNode = new VNode('', {}, []);
|
5802 |
+
|
5803 |
+
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
5804 |
+
|
5805 |
+
function sameVnode (a, b) {
|
5806 |
+
return (
|
5807 |
+
a.key === b.key && (
|
5808 |
+
(
|
5809 |
+
a.tag === b.tag &&
|
5810 |
+
a.isComment === b.isComment &&
|
5811 |
+
isDef(a.data) === isDef(b.data) &&
|
5812 |
+
sameInputType(a, b)
|
5813 |
+
) || (
|
5814 |
+
isTrue(a.isAsyncPlaceholder) &&
|
5815 |
+
a.asyncFactory === b.asyncFactory &&
|
5816 |
+
isUndef(b.asyncFactory.error)
|
5817 |
+
)
|
5818 |
+
)
|
5819 |
+
)
|
5820 |
+
}
|
5821 |
+
|
5822 |
+
function sameInputType (a, b) {
|
5823 |
+
if (a.tag !== 'input') { return true }
|
5824 |
+
var i;
|
5825 |
+
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
5826 |
+
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
5827 |
+
return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
5828 |
+
}
|
5829 |
+
|
5830 |
+
function createKeyToOldIdx (children, beginIdx, endIdx) {
|
5831 |
+
var i, key;
|
5832 |
+
var map = {};
|
5833 |
+
for (i = beginIdx; i <= endIdx; ++i) {
|
5834 |
+
key = children[i].key;
|
5835 |
+
if (isDef(key)) { map[key] = i; }
|
5836 |
+
}
|
5837 |
+
return map
|
5838 |
+
}
|
5839 |
+
|
5840 |
+
function createPatchFunction (backend) {
|
5841 |
+
var i, j;
|
5842 |
+
var cbs = {};
|
5843 |
+
|
5844 |
+
var modules = backend.modules;
|
5845 |
+
var nodeOps = backend.nodeOps;
|
5846 |
+
|
5847 |
+
for (i = 0; i < hooks.length; ++i) {
|
5848 |
+
cbs[hooks[i]] = [];
|
5849 |
+
for (j = 0; j < modules.length; ++j) {
|
5850 |
+
if (isDef(modules[j][hooks[i]])) {
|
5851 |
+
cbs[hooks[i]].push(modules[j][hooks[i]]);
|
5852 |
+
}
|
5853 |
+
}
|
5854 |
+
}
|
5855 |
+
|
5856 |
+
function emptyNodeAt (elm) {
|
5857 |
+
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
5858 |
+
}
|
5859 |
+
|
5860 |
+
function createRmCb (childElm, listeners) {
|
5861 |
+
function remove$$1 () {
|
5862 |
+
if (--remove$$1.listeners === 0) {
|
5863 |
+
removeNode(childElm);
|
5864 |
+
}
|
5865 |
+
}
|
5866 |
+
remove$$1.listeners = listeners;
|
5867 |
+
return remove$$1
|
5868 |
+
}
|
5869 |
+
|
5870 |
+
function removeNode (el) {
|
5871 |
+
var parent = nodeOps.parentNode(el);
|
5872 |
+
// element may have already been removed due to v-html / v-text
|
5873 |
+
if (isDef(parent)) {
|
5874 |
+
nodeOps.removeChild(parent, el);
|
5875 |
+
}
|
5876 |
+
}
|
5877 |
+
|
5878 |
+
function isUnknownElement$$1 (vnode, inVPre) {
|
5879 |
+
return (
|
5880 |
+
!inVPre &&
|
5881 |
+
!vnode.ns &&
|
5882 |
+
!(
|
5883 |
+
config.ignoredElements.length &&
|
5884 |
+
config.ignoredElements.some(function (ignore) {
|
5885 |
+
return isRegExp(ignore)
|
5886 |
+
? ignore.test(vnode.tag)
|
5887 |
+
: ignore === vnode.tag
|
5888 |
+
})
|
5889 |
+
) &&
|
5890 |
+
config.isUnknownElement(vnode.tag)
|
5891 |
+
)
|
5892 |
+
}
|
5893 |
+
|
5894 |
+
var creatingElmInVPre = 0;
|
5895 |
+
|
5896 |
+
function createElm (
|
5897 |
+
vnode,
|
5898 |
+
insertedVnodeQueue,
|
5899 |
+
parentElm,
|
5900 |
+
refElm,
|
5901 |
+
nested,
|
5902 |
+
ownerArray,
|
5903 |
+
index
|
5904 |
+
) {
|
5905 |
+
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
5906 |
+
// This vnode was used in a previous render!
|
5907 |
+
// now it's used as a new node, overwriting its elm would cause
|
5908 |
+
// potential patch errors down the road when it's used as an insertion
|
5909 |
+
// reference node. Instead, we clone the node on-demand before creating
|
5910 |
+
// associated DOM element for it.
|
5911 |
+
vnode = ownerArray[index] = cloneVNode(vnode);
|
5912 |
+
}
|
5913 |
+
|
5914 |
+
vnode.isRootInsert = !nested; // for transition enter check
|
5915 |
+
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
5916 |
+
return
|
5917 |
+
}
|
5918 |
+
|
5919 |
+
var data = vnode.data;
|
5920 |
+
var children = vnode.children;
|
5921 |
+
var tag = vnode.tag;
|
5922 |
+
if (isDef(tag)) {
|
5923 |
+
{
|
5924 |
+
if (data && data.pre) {
|
5925 |
+
creatingElmInVPre++;
|
5926 |
+
}
|
5927 |
+
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
5928 |
+
warn(
|
5929 |
+
'Unknown custom element: <' + tag + '> - did you ' +
|
5930 |
+
'register the component correctly? For recursive components, ' +
|
5931 |
+
'make sure to provide the "name" option.',
|
5932 |
+
vnode.context
|
5933 |
+
);
|
5934 |
+
}
|
5935 |
+
}
|
5936 |
+
|
5937 |
+
vnode.elm = vnode.ns
|
5938 |
+
? nodeOps.createElementNS(vnode.ns, tag)
|
5939 |
+
: nodeOps.createElement(tag, vnode);
|
5940 |
+
setScope(vnode);
|
5941 |
+
|
5942 |
+
/* istanbul ignore if */
|
5943 |
+
{
|
5944 |
+
createChildren(vnode, children, insertedVnodeQueue);
|
5945 |
+
if (isDef(data)) {
|
5946 |
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
5947 |
+
}
|
5948 |
+
insert(parentElm, vnode.elm, refElm);
|
5949 |
+
}
|
5950 |
+
|
5951 |
+
if (data && data.pre) {
|
5952 |
+
creatingElmInVPre--;
|
5953 |
+
}
|
5954 |
+
} else if (isTrue(vnode.isComment)) {
|
5955 |
+
vnode.elm = nodeOps.createComment(vnode.text);
|
5956 |
+
insert(parentElm, vnode.elm, refElm);
|
5957 |
+
} else {
|
5958 |
+
vnode.elm = nodeOps.createTextNode(vnode.text);
|
5959 |
+
insert(parentElm, vnode.elm, refElm);
|
5960 |
+
}
|
5961 |
+
}
|
5962 |
+
|
5963 |
+
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5964 |
+
var i = vnode.data;
|
5965 |
+
if (isDef(i)) {
|
5966 |
+
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
5967 |
+
if (isDef(i = i.hook) && isDef(i = i.init)) {
|
5968 |
+
i(vnode, false /* hydrating */);
|
5969 |
+
}
|
5970 |
+
// after calling the init hook, if the vnode is a child component
|
5971 |
+
// it should've created a child instance and mounted it. the child
|
5972 |
+
// component also has set the placeholder vnode's elm.
|
5973 |
+
// in that case we can just return the element and be done.
|
5974 |
+
if (isDef(vnode.componentInstance)) {
|
5975 |
+
initComponent(vnode, insertedVnodeQueue);
|
5976 |
+
insert(parentElm, vnode.elm, refElm);
|
5977 |
+
if (isTrue(isReactivated)) {
|
5978 |
+
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
5979 |
+
}
|
5980 |
+
return true
|
5981 |
+
}
|
5982 |
+
}
|
5983 |
+
}
|
5984 |
+
|
5985 |
+
function initComponent (vnode, insertedVnodeQueue) {
|
5986 |
+
if (isDef(vnode.data.pendingInsert)) {
|
5987 |
+
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
5988 |
+
vnode.data.pendingInsert = null;
|
5989 |
+
}
|
5990 |
+
vnode.elm = vnode.componentInstance.$el;
|
5991 |
+
if (isPatchable(vnode)) {
|
5992 |
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
5993 |
+
setScope(vnode);
|
5994 |
+
} else {
|
5995 |
+
// empty component root.
|
5996 |
+
// skip all element-related modules except for ref (#3455)
|
5997 |
+
registerRef(vnode);
|
5998 |
+
// make sure to invoke the insert hook
|
5999 |
+
insertedVnodeQueue.push(vnode);
|
6000 |
+
}
|
6001 |
+
}
|
6002 |
+
|
6003 |
+
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
6004 |
+
var i;
|
6005 |
+
// hack for #4339: a reactivated component with inner transition
|
6006 |
+
// does not trigger because the inner node's created hooks are not called
|
6007 |
+
// again. It's not ideal to involve module-specific logic in here but
|
6008 |
+
// there doesn't seem to be a better way to do it.
|
6009 |
+
var innerNode = vnode;
|
6010 |
+
while (innerNode.componentInstance) {
|
6011 |
+
innerNode = innerNode.componentInstance._vnode;
|
6012 |
+
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
6013 |
+
for (i = 0; i < cbs.activate.length; ++i) {
|
6014 |
+
cbs.activate[i](emptyNode, innerNode);
|
6015 |
+
}
|
6016 |
+
insertedVnodeQueue.push(innerNode);
|
6017 |
+
break
|
6018 |
+
}
|
6019 |
+
}
|
6020 |
+
// unlike a newly created component,
|
6021 |
+
// a reactivated keep-alive component doesn't insert itself
|
6022 |
+
insert(parentElm, vnode.elm, refElm);
|
6023 |
+
}
|
6024 |
+
|
6025 |
+
function insert (parent, elm, ref$$1) {
|
6026 |
+
if (isDef(parent)) {
|
6027 |
+
if (isDef(ref$$1)) {
|
6028 |
+
if (nodeOps.parentNode(ref$$1) === parent) {
|
6029 |
+
nodeOps.insertBefore(parent, elm, ref$$1);
|
6030 |
+
}
|
6031 |
+
} else {
|
6032 |
+
nodeOps.appendChild(parent, elm);
|
6033 |
+
}
|
6034 |
+
}
|
6035 |
+
}
|
6036 |
+
|
6037 |
+
function createChildren (vnode, children, insertedVnodeQueue) {
|
6038 |
+
if (Array.isArray(children)) {
|
6039 |
+
{
|
6040 |
+
checkDuplicateKeys(children);
|
6041 |
+
}
|
6042 |
+
for (var i = 0; i < children.length; ++i) {
|
6043 |
+
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
6044 |
+
}
|
6045 |
+
} else if (isPrimitive(vnode.text)) {
|
6046 |
+
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
6047 |
+
}
|
6048 |
+
}
|
6049 |
+
|
6050 |
+
function isPatchable (vnode) {
|
6051 |
+
while (vnode.componentInstance) {
|
6052 |
+
vnode = vnode.componentInstance._vnode;
|
6053 |
+
}
|
6054 |
+
return isDef(vnode.tag)
|
6055 |
+
}
|
6056 |
+
|
6057 |
+
function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
6058 |
+
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6059 |
+
cbs.create[i$1](emptyNode, vnode);
|
6060 |
+
}
|
6061 |
+
i = vnode.data.hook; // Reuse variable
|
6062 |
+
if (isDef(i)) {
|
6063 |
+
if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
6064 |
+
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
6065 |
+
}
|
6066 |
+
}
|
6067 |
+
|
6068 |
+
// set scope id attribute for scoped CSS.
|
6069 |
+
// this is implemented as a special case to avoid the overhead
|
6070 |
+
// of going through the normal attribute patching process.
|
6071 |
+
function setScope (vnode) {
|
6072 |
+
var i;
|
6073 |
+
if (isDef(i = vnode.fnScopeId)) {
|
6074 |
+
nodeOps.setStyleScope(vnode.elm, i);
|
6075 |
+
} else {
|
6076 |
+
var ancestor = vnode;
|
6077 |
+
while (ancestor) {
|
6078 |
+
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
6079 |
+
nodeOps.setStyleScope(vnode.elm, i);
|
6080 |
+
}
|
6081 |
+
ancestor = ancestor.parent;
|
6082 |
+
}
|
6083 |
+
}
|
6084 |
+
// for slot content they should also get the scopeId from the host instance.
|
6085 |
+
if (isDef(i = activeInstance) &&
|
6086 |
+
i !== vnode.context &&
|
6087 |
+
i !== vnode.fnContext &&
|
6088 |
+
isDef(i = i.$options._scopeId)
|
6089 |
+
) {
|
6090 |
+
nodeOps.setStyleScope(vnode.elm, i);
|
6091 |
+
}
|
6092 |
+
}
|
6093 |
+
|
6094 |
+
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
6095 |
+
for (; startIdx <= endIdx; ++startIdx) {
|
6096 |
+
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
6097 |
+
}
|
6098 |
+
}
|
6099 |
+
|
6100 |
+
function invokeDestroyHook (vnode) {
|
6101 |
+
var i, j;
|
6102 |
+
var data = vnode.data;
|
6103 |
+
if (isDef(data)) {
|
6104 |
+
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
6105 |
+
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
6106 |
+
}
|
6107 |
+
if (isDef(i = vnode.children)) {
|
6108 |
+
for (j = 0; j < vnode.children.length; ++j) {
|
6109 |
+
invokeDestroyHook(vnode.children[j]);
|
6110 |
+
}
|
6111 |
+
}
|
6112 |
+
}
|
6113 |
+
|
6114 |
+
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
|
6115 |
+
for (; startIdx <= endIdx; ++startIdx) {
|
6116 |
+
var ch = vnodes[startIdx];
|
6117 |
+
if (isDef(ch)) {
|
6118 |
+
if (isDef(ch.tag)) {
|
6119 |
+
removeAndInvokeRemoveHook(ch);
|
6120 |
+
invokeDestroyHook(ch);
|
6121 |
+
} else { // Text node
|
6122 |
+
removeNode(ch.elm);
|
6123 |
+
}
|
6124 |
+
}
|
6125 |
+
}
|
6126 |
+
}
|
6127 |
+
|
6128 |
+
function removeAndInvokeRemoveHook (vnode, rm) {
|
6129 |
+
if (isDef(rm) || isDef(vnode.data)) {
|
6130 |
+
var i;
|
6131 |
+
var listeners = cbs.remove.length + 1;
|
6132 |
+
if (isDef(rm)) {
|
6133 |
+
// we have a recursively passed down rm callback
|
6134 |
+
// increase the listeners count
|
6135 |
+
rm.listeners += listeners;
|
6136 |
+
} else {
|
6137 |
+
// directly removing
|
6138 |
+
rm = createRmCb(vnode.elm, listeners);
|
6139 |
+
}
|
6140 |
+
// recursively invoke hooks on child component root node
|
6141 |
+
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
6142 |
+
removeAndInvokeRemoveHook(i, rm);
|
6143 |
+
}
|
6144 |
+
for (i = 0; i < cbs.remove.length; ++i) {
|
6145 |
+
cbs.remove[i](vnode, rm);
|
6146 |
+
}
|
6147 |
+
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
6148 |
+
i(vnode, rm);
|
6149 |
+
} else {
|
6150 |
+
rm();
|
6151 |
+
}
|
6152 |
+
} else {
|
6153 |
+
removeNode(vnode.elm);
|
6154 |
+
}
|
6155 |
+
}
|
6156 |
+
|
6157 |
+
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6158 |
+
var oldStartIdx = 0;
|
6159 |
+
var newStartIdx = 0;
|
6160 |
+
var oldEndIdx = oldCh.length - 1;
|
6161 |
+
var oldStartVnode = oldCh[0];
|
6162 |
+
var oldEndVnode = oldCh[oldEndIdx];
|
6163 |
+
var newEndIdx = newCh.length - 1;
|
6164 |
+
var newStartVnode = newCh[0];
|
6165 |
+
var newEndVnode = newCh[newEndIdx];
|
6166 |
+
var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6167 |
+
|
6168 |
+
// removeOnly is a special flag used only by <transition-group>
|
6169 |
+
// to ensure removed elements stay in correct relative positions
|
6170 |
+
// during leaving transitions
|
6171 |
+
var canMove = !removeOnly;
|
6172 |
+
|
6173 |
+
{
|
6174 |
+
checkDuplicateKeys(newCh);
|
6175 |
+
}
|
6176 |
+
|
6177 |
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6178 |
+
if (isUndef(oldStartVnode)) {
|
6179 |
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
|
6180 |
+
} else if (isUndef(oldEndVnode)) {
|
6181 |
+
oldEndVnode = oldCh[--oldEndIdx];
|
6182 |
+
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6183 |
+
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6184 |
+
oldStartVnode = oldCh[++oldStartIdx];
|
6185 |
+
newStartVnode = newCh[++newStartIdx];
|
6186 |
+
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6187 |
+
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6188 |
+
oldEndVnode = oldCh[--oldEndIdx];
|
6189 |
+
newEndVnode = newCh[--newEndIdx];
|
6190 |
+
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
|
6191 |
+
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6192 |
+
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6193 |
+
oldStartVnode = oldCh[++oldStartIdx];
|
6194 |
+
newEndVnode = newCh[--newEndIdx];
|
6195 |
+
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
|
6196 |
+
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6197 |
+
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6198 |
+
oldEndVnode = oldCh[--oldEndIdx];
|
6199 |
+
newStartVnode = newCh[++newStartIdx];
|
6200 |
+
} else {
|
6201 |
+
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
6202 |
+
idxInOld = isDef(newStartVnode.key)
|
6203 |
+
? oldKeyToIdx[newStartVnode.key]
|
6204 |
+
: findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6205 |
+
if (isUndef(idxInOld)) { // New element
|
6206 |
+
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6207 |
+
} else {
|
6208 |
+
vnodeToMove = oldCh[idxInOld];
|
6209 |
+
if (sameVnode(vnodeToMove, newStartVnode)) {
|
6210 |
+
patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6211 |
+
oldCh[idxInOld] = undefined;
|
6212 |
+
canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6213 |
+
} else {
|
6214 |
+
// same key but different element. treat as new element
|
6215 |
+
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6216 |
+
}
|
6217 |
+
}
|
6218 |
+
newStartVnode = newCh[++newStartIdx];
|
6219 |
+
}
|
6220 |
+
}
|
6221 |
+
if (oldStartIdx > oldEndIdx) {
|
6222 |
+
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6223 |
+
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6224 |
+
} else if (newStartIdx > newEndIdx) {
|
6225 |
+
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
6226 |
+
}
|
6227 |
+
}
|
6228 |
+
|
6229 |
+
function checkDuplicateKeys (children) {
|
6230 |
+
var seenKeys = {};
|
6231 |
+
for (var i = 0; i < children.length; i++) {
|
6232 |
+
var vnode = children[i];
|
6233 |
+
var key = vnode.key;
|
6234 |
+
if (isDef(key)) {
|
6235 |
+
if (seenKeys[key]) {
|
6236 |
+
warn(
|
6237 |
+
("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
6238 |
+
vnode.context
|
6239 |
+
);
|
6240 |
+
} else {
|
6241 |
+
seenKeys[key] = true;
|
6242 |
+
}
|
6243 |
+
}
|
6244 |
+
}
|
6245 |
+
}
|
6246 |
+
|
6247 |
+
function findIdxInOld (node, oldCh, start, end) {
|
6248 |
+
for (var i = start; i < end; i++) {
|
6249 |
+
var c = oldCh[i];
|
6250 |
+
if (isDef(c) && sameVnode(node, c)) { return i }
|
6251 |
+
}
|
6252 |
+
}
|
6253 |
+
|
6254 |
+
function patchVnode (
|
6255 |
+
oldVnode,
|
6256 |
+
vnode,
|
6257 |
+
insertedVnodeQueue,
|
6258 |
+
ownerArray,
|
6259 |
+
index,
|
6260 |
+
removeOnly
|
6261 |
+
) {
|
6262 |
+
if (oldVnode === vnode) {
|
6263 |
+
return
|
6264 |
+
}
|
6265 |
+
|
6266 |
+
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6267 |
+
// clone reused vnode
|
6268 |
+
vnode = ownerArray[index] = cloneVNode(vnode);
|
6269 |
+
}
|
6270 |
+
|
6271 |
+
var elm = vnode.elm = oldVnode.elm;
|
6272 |
+
|
6273 |
+
if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6274 |
+
if (isDef(vnode.asyncFactory.resolved)) {
|
6275 |
+
hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6276 |
+
} else {
|
6277 |
+
vnode.isAsyncPlaceholder = true;
|
6278 |
+
}
|
6279 |
+
return
|
6280 |
+
}
|
6281 |
+
|
6282 |
+
// reuse element for static trees.
|
6283 |
+
// note we only do this if the vnode is cloned -
|
6284 |
+
// if the new node is not cloned it means the render functions have been
|
6285 |
+
// reset by the hot-reload-api and we need to do a proper re-render.
|
6286 |
+
if (isTrue(vnode.isStatic) &&
|
6287 |
+
isTrue(oldVnode.isStatic) &&
|
6288 |
+
vnode.key === oldVnode.key &&
|
6289 |
+
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
6290 |
+
) {
|
6291 |
+
vnode.componentInstance = oldVnode.componentInstance;
|
6292 |
+
return
|
6293 |
+
}
|
6294 |
+
|
6295 |
+
var i;
|
6296 |
+
var data = vnode.data;
|
6297 |
+
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
6298 |
+
i(oldVnode, vnode);
|
6299 |
+
}
|
6300 |
+
|
6301 |
+
var oldCh = oldVnode.children;
|
6302 |
+
var ch = vnode.children;
|
6303 |
+
if (isDef(data) && isPatchable(vnode)) {
|
6304 |
+
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
6305 |
+
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
6306 |
+
}
|
6307 |
+
if (isUndef(vnode.text)) {
|
6308 |
+
if (isDef(oldCh) && isDef(ch)) {
|
6309 |
+
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
6310 |
+
} else if (isDef(ch)) {
|
6311 |
+
{
|
6312 |
+
checkDuplicateKeys(ch);
|
6313 |
+
}
|
6314 |
+
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
6315 |
+
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6316 |
+
} else if (isDef(oldCh)) {
|
6317 |
+
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
|
6318 |
+
} else if (isDef(oldVnode.text)) {
|
6319 |
+
nodeOps.setTextContent(elm, '');
|
6320 |
+
}
|
6321 |
+
} else if (oldVnode.text !== vnode.text) {
|
6322 |
+
nodeOps.setTextContent(elm, vnode.text);
|
6323 |
+
}
|
6324 |
+
if (isDef(data)) {
|
6325 |
+
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
6326 |
+
}
|
6327 |
+
}
|
6328 |
+
|
6329 |
+
function invokeInsertHook (vnode, queue, initial) {
|
6330 |
+
// delay insert hooks for component root nodes, invoke them after the
|
6331 |
+
// element is really inserted
|
6332 |
+
if (isTrue(initial) && isDef(vnode.parent)) {
|
6333 |
+
vnode.parent.data.pendingInsert = queue;
|
6334 |
+
} else {
|
6335 |
+
for (var i = 0; i < queue.length; ++i) {
|
6336 |
+
queue[i].data.hook.insert(queue[i]);
|
6337 |
+
}
|
6338 |
+
}
|
6339 |
+
}
|
6340 |
+
|
6341 |
+
var hydrationBailed = false;
|
6342 |
+
// list of modules that can skip create hook during hydration because they
|
6343 |
+
// are already rendered on the client or has no need for initialization
|
6344 |
+
// Note: style is excluded because it relies on initial clone for future
|
6345 |
+
// deep updates (#7063).
|
6346 |
+
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6347 |
+
|
6348 |
+
// Note: this is a browser-only function so we can assume elms are DOM nodes.
|
6349 |
+
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
6350 |
+
var i;
|
6351 |
+
var tag = vnode.tag;
|
6352 |
+
var data = vnode.data;
|
6353 |
+
var children = vnode.children;
|
6354 |
+
inVPre = inVPre || (data && data.pre);
|
6355 |
+
vnode.elm = elm;
|
6356 |
+
|
6357 |
+
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6358 |
+
vnode.isAsyncPlaceholder = true;
|
6359 |
+
return true
|
6360 |
+
}
|
6361 |
+
// assert node match
|
6362 |
+
{
|
6363 |
+
if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6364 |
+
return false
|
6365 |
+
}
|
6366 |
+
}
|
6367 |
+
if (isDef(data)) {
|
6368 |
+
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
|
6369 |
+
if (isDef(i = vnode.componentInstance)) {
|
6370 |
+
// child component. it should have hydrated its own tree.
|
6371 |
+
initComponent(vnode, insertedVnodeQueue);
|
6372 |
+
return true
|
6373 |
+
}
|
6374 |
+
}
|
6375 |
+
if (isDef(tag)) {
|
6376 |
+
if (isDef(children)) {
|
6377 |
+
// empty element, allow client to pick up and populate children
|
6378 |
+
if (!elm.hasChildNodes()) {
|
6379 |
+
createChildren(vnode, children, insertedVnodeQueue);
|
6380 |
+
} else {
|
6381 |
+
// v-html and domProps: innerHTML
|
6382 |
+
if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
6383 |
+
if (i !== elm.innerHTML) {
|
6384 |
+
/* istanbul ignore if */
|
6385 |
+
if (typeof console !== 'undefined' &&
|
6386 |
+
!hydrationBailed
|
6387 |
+
) {
|
6388 |
+
hydrationBailed = true;
|
6389 |
+
console.warn('Parent: ', elm);
|
6390 |
+
console.warn('server innerHTML: ', i);
|
6391 |
+
console.warn('client innerHTML: ', elm.innerHTML);
|
6392 |
+
}
|
6393 |
+
return false
|
6394 |
+
}
|
6395 |
+
} else {
|
6396 |
+
// iterate and compare children lists
|
6397 |
+
var childrenMatch = true;
|
6398 |
+
var childNode = elm.firstChild;
|
6399 |
+
for (var i$1 = 0; i$1 < children.length; i$1++) {
|
6400 |
+
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
6401 |
+
childrenMatch = false;
|
6402 |
+
break
|
6403 |
+
}
|
6404 |
+
childNode = childNode.nextSibling;
|
6405 |
+
}
|
6406 |
+
// if childNode is not null, it means the actual childNodes list is
|
6407 |
+
// longer than the virtual children list.
|
6408 |
+
if (!childrenMatch || childNode) {
|
6409 |
+
/* istanbul ignore if */
|
6410 |
+
if (typeof console !== 'undefined' &&
|
6411 |
+
!hydrationBailed
|
6412 |
+
) {
|
6413 |
+
hydrationBailed = true;
|
6414 |
+
console.warn('Parent: ', elm);
|
6415 |
+
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
6416 |
+
}
|
6417 |
+
return false
|
6418 |
+
}
|
6419 |
+
}
|
6420 |
+
}
|
6421 |
+
}
|
6422 |
+
if (isDef(data)) {
|
6423 |
+
var fullInvoke = false;
|
6424 |
+
for (var key in data) {
|
6425 |
+
if (!isRenderedModule(key)) {
|
6426 |
+
fullInvoke = true;
|
6427 |
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
6428 |
+
break
|
6429 |
+
}
|
6430 |
+
}
|
6431 |
+
if (!fullInvoke && data['class']) {
|
6432 |
+
// ensure collecting deps for deep class bindings for future updates
|
6433 |
+
traverse(data['class']);
|
6434 |
+
}
|
6435 |
+
}
|
6436 |
+
} else if (elm.data !== vnode.text) {
|
6437 |
+
elm.data = vnode.text;
|
6438 |
+
}
|
6439 |
+
return true
|
6440 |
+
}
|
6441 |
+
|
6442 |
+
function assertNodeMatch (node, vnode, inVPre) {
|
6443 |
+
if (isDef(vnode.tag)) {
|
6444 |
+
return vnode.tag.indexOf('vue-component') === 0 || (
|
6445 |
+
!isUnknownElement$$1(vnode, inVPre) &&
|
6446 |
+
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
6447 |
+
)
|
6448 |
+
} else {
|
6449 |
+
return node.nodeType === (vnode.isComment ? 8 : 3)
|
6450 |
+
}
|
6451 |
+
}
|
6452 |
+
|
6453 |
+
return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
6454 |
+
if (isUndef(vnode)) {
|
6455 |
+
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
6456 |
+
return
|
6457 |
+
}
|
6458 |
+
|
6459 |
+
var isInitialPatch = false;
|
6460 |
+
var insertedVnodeQueue = [];
|
6461 |
+
|
6462 |
+
if (isUndef(oldVnode)) {
|
6463 |
+
// empty mount (likely as component), create new root element
|
6464 |
+
isInitialPatch = true;
|
6465 |
+
createElm(vnode, insertedVnodeQueue);
|
6466 |
+
} else {
|
6467 |
+
var isRealElement = isDef(oldVnode.nodeType);
|
6468 |
+
if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
6469 |
+
// patch existing root node
|
6470 |
+
patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
6471 |
+
} else {
|
6472 |
+
if (isRealElement) {
|
6473 |
+
// mounting to a real element
|
6474 |
+
// check if this is server-rendered content and if we can perform
|
6475 |
+
// a successful hydration.
|
6476 |
+
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
6477 |
+
oldVnode.removeAttribute(SSR_ATTR);
|
6478 |
+
hydrating = true;
|
6479 |
+
}
|
6480 |
+
if (isTrue(hydrating)) {
|
6481 |
+
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
6482 |
+
invokeInsertHook(vnode, insertedVnodeQueue, true);
|
6483 |
+
return oldVnode
|
6484 |
+
} else {
|
6485 |
+
warn(
|
6486 |
+
'The client-side rendered virtual DOM tree is not matching ' +
|
6487 |
+
'server-rendered content. This is likely caused by incorrect ' +
|
6488 |
+
'HTML markup, for example nesting block-level elements inside ' +
|
6489 |
+
'<p>, or missing <tbody>. Bailing hydration and performing ' +
|
6490 |
+
'full client-side render.'
|
6491 |
+
);
|
6492 |
+
}
|
6493 |
+
}
|
6494 |
+
// either not server-rendered, or hydration failed.
|
6495 |
+
// create an empty node and replace it
|
6496 |
+
oldVnode = emptyNodeAt(oldVnode);
|
6497 |
+
}
|
6498 |
+
|
6499 |
+
// replacing existing element
|
6500 |
+
var oldElm = oldVnode.elm;
|
6501 |
+
var parentElm = nodeOps.parentNode(oldElm);
|
6502 |
+
|
6503 |
+
// create new node
|
6504 |
+
createElm(
|
6505 |
+
vnode,
|
6506 |
+
insertedVnodeQueue,
|
6507 |
+
// extremely rare edge case: do not insert if old element is in a
|
6508 |
+
// leaving transition. Only happens when combining transition +
|
6509 |
+
// keep-alive + HOCs. (#4590)
|
6510 |
+
oldElm._leaveCb ? null : parentElm,
|
6511 |
+
nodeOps.nextSibling(oldElm)
|
6512 |
+
);
|
6513 |
+
|
6514 |
+
// update parent placeholder node element, recursively
|
6515 |
+
if (isDef(vnode.parent)) {
|
6516 |
+
var ancestor = vnode.parent;
|
6517 |
+
var patchable = isPatchable(vnode);
|
6518 |
+
while (ancestor) {
|
6519 |
+
for (var i = 0; i < cbs.destroy.length; ++i) {
|
6520 |
+
cbs.destroy[i](ancestor);
|
6521 |
+
}
|
6522 |
+
ancestor.elm = vnode.elm;
|
6523 |
+
if (patchable) {
|
6524 |
+
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6525 |
+
cbs.create[i$1](emptyNode, ancestor);
|
6526 |
+
}
|
6527 |
+
// #6513
|
6528 |
+
// invoke insert hooks that may have been merged by create hooks.
|
6529 |
+
// e.g. for directives that uses the "inserted" hook.
|
6530 |
+
var insert = ancestor.data.hook.insert;
|
6531 |
+
if (insert.merged) {
|
6532 |
+
// start at index 1 to avoid re-invoking component mounted hook
|
6533 |
+
for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
6534 |
+
insert.fns[i$2]();
|
6535 |
+
}
|
6536 |
+
}
|
6537 |
+
} else {
|
6538 |
+
registerRef(ancestor);
|
6539 |
+
}
|
6540 |
+
ancestor = ancestor.parent;
|
6541 |
+
}
|
6542 |
+
}
|
6543 |
+
|
6544 |
+
// destroy old node
|
6545 |
+
if (isDef(parentElm)) {
|
6546 |
+
removeVnodes(parentElm, [oldVnode], 0, 0);
|
6547 |
+
} else if (isDef(oldVnode.tag)) {
|
6548 |
+
invokeDestroyHook(oldVnode);
|
6549 |
+
}
|
6550 |
+
}
|
6551 |
+
}
|
6552 |
+
|
6553 |
+
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
6554 |
+
return vnode.elm
|
6555 |
+
}
|
6556 |
+
}
|
6557 |
+
|
6558 |
+
/* */
|
6559 |
+
|
6560 |
+
var directives = {
|
6561 |
+
create: updateDirectives,
|
6562 |
+
update: updateDirectives,
|
6563 |
+
destroy: function unbindDirectives (vnode) {
|
6564 |
+
updateDirectives(vnode, emptyNode);
|
6565 |
+
}
|
6566 |
+
};
|
6567 |
+
|
6568 |
+
function updateDirectives (oldVnode, vnode) {
|
6569 |
+
if (oldVnode.data.directives || vnode.data.directives) {
|
6570 |
+
_update(oldVnode, vnode);
|
6571 |
+
}
|
6572 |
+
}
|
6573 |
+
|
6574 |
+
function _update (oldVnode, vnode) {
|
6575 |
+
var isCreate = oldVnode === emptyNode;
|
6576 |
+
var isDestroy = vnode === emptyNode;
|
6577 |
+
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
6578 |
+
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
6579 |
+
|
6580 |
+
var dirsWithInsert = [];
|
6581 |
+
var dirsWithPostpatch = [];
|
6582 |
+
|
6583 |
+
var key, oldDir, dir;
|
6584 |
+
for (key in newDirs) {
|
6585 |
+
oldDir = oldDirs[key];
|
6586 |
+
dir = newDirs[key];
|
6587 |
+
if (!oldDir) {
|
6588 |
+
// new directive, bind
|
6589 |
+
callHook$1(dir, 'bind', vnode, oldVnode);
|
6590 |
+
if (dir.def && dir.def.inserted) {
|
6591 |
+
dirsWithInsert.push(dir);
|
6592 |
+
}
|
6593 |
+
} else {
|
6594 |
+
// existing directive, update
|
6595 |
+
dir.oldValue = oldDir.value;
|
6596 |
+
dir.oldArg = oldDir.arg;
|
6597 |
+
callHook$1(dir, 'update', vnode, oldVnode);
|
6598 |
+
if (dir.def && dir.def.componentUpdated) {
|
6599 |
+
dirsWithPostpatch.push(dir);
|
6600 |
+
}
|
6601 |
+
}
|
6602 |
+
}
|
6603 |
+
|
6604 |
+
if (dirsWithInsert.length) {
|
6605 |
+
var callInsert = function () {
|
6606 |
+
for (var i = 0; i < dirsWithInsert.length; i++) {
|
6607 |
+
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
6608 |
+
}
|
6609 |
+
};
|
6610 |
+
if (isCreate) {
|
6611 |
+
mergeVNodeHook(vnode, 'insert', callInsert);
|
6612 |
+
} else {
|
6613 |
+
callInsert();
|
6614 |
+
}
|
6615 |
+
}
|
6616 |
+
|
6617 |
+
if (dirsWithPostpatch.length) {
|
6618 |
+
mergeVNodeHook(vnode, 'postpatch', function () {
|
6619 |
+
for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
6620 |
+
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
6621 |
+
}
|
6622 |
+
});
|
6623 |
+
}
|
6624 |
+
|
6625 |
+
if (!isCreate) {
|
6626 |
+
for (key in oldDirs) {
|
6627 |
+
if (!newDirs[key]) {
|
6628 |
+
// no longer present, unbind
|
6629 |
+
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
6630 |
+
}
|
6631 |
+
}
|
6632 |
+
}
|
6633 |
+
}
|
6634 |
+
|
6635 |
+
var emptyModifiers = Object.create(null);
|
6636 |
+
|
6637 |
+
function normalizeDirectives$1 (
|
6638 |
+
dirs,
|
6639 |
+
vm
|
6640 |
+
) {
|
6641 |
+
var res = Object.create(null);
|
6642 |
+
if (!dirs) {
|
6643 |
+
// $flow-disable-line
|
6644 |
+
return res
|
6645 |
+
}
|
6646 |
+
var i, dir;
|
6647 |
+
for (i = 0; i < dirs.length; i++) {
|
6648 |
+
dir = dirs[i];
|
6649 |
+
if (!dir.modifiers) {
|
6650 |
+
// $flow-disable-line
|
6651 |
+
dir.modifiers = emptyModifiers;
|
6652 |
+
}
|
6653 |
+
res[getRawDirName(dir)] = dir;
|
6654 |
+
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
6655 |
+
}
|
6656 |
+
// $flow-disable-line
|
6657 |
+
return res
|
6658 |
+
}
|
6659 |
+
|
6660 |
+
function getRawDirName (dir) {
|
6661 |
+
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
6662 |
+
}
|
6663 |
+
|
6664 |
+
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
6665 |
+
var fn = dir.def && dir.def[hook];
|
6666 |
+
if (fn) {
|
6667 |
+
try {
|
6668 |
+
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
6669 |
+
} catch (e) {
|
6670 |
+
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
6671 |
+
}
|
6672 |
+
}
|
6673 |
+
}
|
6674 |
+
|
6675 |
+
var baseModules = [
|
6676 |
+
ref,
|
6677 |
+
directives
|
6678 |
+
];
|
6679 |
+
|
6680 |
+
/* */
|
6681 |
+
|
6682 |
+
function updateAttrs (oldVnode, vnode) {
|
6683 |
+
var opts = vnode.componentOptions;
|
6684 |
+
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
6685 |
+
return
|
6686 |
+
}
|
6687 |
+
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
6688 |
+
return
|
6689 |
+
}
|
6690 |
+
var key, cur, old;
|
6691 |
+
var elm = vnode.elm;
|
6692 |
+
var oldAttrs = oldVnode.data.attrs || {};
|
6693 |
+
var attrs = vnode.data.attrs || {};
|
6694 |
+
// clone observed objects, as the user probably wants to mutate it
|
6695 |
+
if (isDef(attrs.__ob__)) {
|
6696 |
+
attrs = vnode.data.attrs = extend({}, attrs);
|
6697 |
+
}
|
6698 |
+
|
6699 |
+
for (key in attrs) {
|
6700 |
+
cur = attrs[key];
|
6701 |
+
old = oldAttrs[key];
|
6702 |
+
if (old !== cur) {
|
6703 |
+
setAttr(elm, key, cur);
|
6704 |
+
}
|
6705 |
+
}
|
6706 |
+
// #4391: in IE9, setting type can reset value for input[type=radio]
|
6707 |
+
// #6666: IE/Edge forces progress value down to 1 before setting a max
|
6708 |
+
/* istanbul ignore if */
|
6709 |
+
if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
6710 |
+
setAttr(elm, 'value', attrs.value);
|
6711 |
+
}
|
6712 |
+
for (key in oldAttrs) {
|
6713 |
+
if (isUndef(attrs[key])) {
|
6714 |
+
if (isXlink(key)) {
|
6715 |
+
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6716 |
+
} else if (!isEnumeratedAttr(key)) {
|
6717 |
+
elm.removeAttribute(key);
|
6718 |
+
}
|
6719 |
+
}
|
6720 |
+
}
|
6721 |
+
}
|
6722 |
+
|
6723 |
+
function setAttr (el, key, value) {
|
6724 |
+
if (el.tagName.indexOf('-') > -1) {
|
6725 |
+
baseSetAttr(el, key, value);
|
6726 |
+
} else if (isBooleanAttr(key)) {
|
6727 |
+
// set attribute for blank value
|
6728 |
+
// e.g. <option disabled>Select one</option>
|
6729 |
+
if (isFalsyAttrValue(value)) {
|
6730 |
+
el.removeAttribute(key);
|
6731 |
+
} else {
|
6732 |
+
// technically allowfullscreen is a boolean attribute for <iframe>,
|
6733 |
+
// but Flash expects a value of "true" when used on <embed> tag
|
6734 |
+
value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
6735 |
+
? 'true'
|
6736 |
+
: key;
|
6737 |
+
el.setAttribute(key, value);
|
6738 |
+
}
|
6739 |
+
} else if (isEnumeratedAttr(key)) {
|
6740 |
+
el.setAttribute(key, convertEnumeratedValue(key, value));
|
6741 |
+
} else if (isXlink(key)) {
|
6742 |
+
if (isFalsyAttrValue(value)) {
|
6743 |
+
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6744 |
+
} else {
|
6745 |
+
el.setAttributeNS(xlinkNS, key, value);
|
6746 |
+
}
|
6747 |
+
} else {
|
6748 |
+
baseSetAttr(el, key, value);
|
6749 |
+
}
|
6750 |
+
}
|
6751 |
+
|
6752 |
+
function baseSetAttr (el, key, value) {
|
6753 |
+
if (isFalsyAttrValue(value)) {
|
6754 |
+
el.removeAttribute(key);
|
6755 |
+
} else {
|
6756 |
+
// #7138: IE10 & 11 fires input event when setting placeholder on
|
6757 |
+
// <textarea>... block the first input event and remove the blocker
|
6758 |
+
// immediately.
|
6759 |
+
/* istanbul ignore if */
|
6760 |
+
if (
|
6761 |
+
isIE && !isIE9 &&
|
6762 |
+
el.tagName === 'TEXTAREA' &&
|
6763 |
+
key === 'placeholder' && value !== '' && !el.__ieph
|
6764 |
+
) {
|
6765 |
+
var blocker = function (e) {
|
6766 |
+
e.stopImmediatePropagation();
|
6767 |
+
el.removeEventListener('input', blocker);
|
6768 |
+
};
|
6769 |
+
el.addEventListener('input', blocker);
|
6770 |
+
// $flow-disable-line
|
6771 |
+
el.__ieph = true; /* IE placeholder patched */
|
6772 |
+
}
|
6773 |
+
el.setAttribute(key, value);
|
6774 |
+
}
|
6775 |
+
}
|
6776 |
+
|
6777 |
+
var attrs = {
|
6778 |
+
create: updateAttrs,
|
6779 |
+
update: updateAttrs
|
6780 |
+
};
|
6781 |
+
|
6782 |
+
/* */
|
6783 |
+
|
6784 |
+
function updateClass (oldVnode, vnode) {
|
6785 |
+
var el = vnode.elm;
|
6786 |
+
var data = vnode.data;
|
6787 |
+
var oldData = oldVnode.data;
|
6788 |
+
if (
|
6789 |
+
isUndef(data.staticClass) &&
|
6790 |
+
isUndef(data.class) && (
|
6791 |
+
isUndef(oldData) || (
|
6792 |
+
isUndef(oldData.staticClass) &&
|
6793 |
+
isUndef(oldData.class)
|
6794 |
+
)
|
6795 |
+
)
|
6796 |
+
) {
|
6797 |
+
return
|
6798 |
+
}
|
6799 |
+
|
6800 |
+
var cls = genClassForVnode(vnode);
|
6801 |
+
|
6802 |
+
// handle transition classes
|
6803 |
+
var transitionClass = el._transitionClasses;
|
6804 |
+
if (isDef(transitionClass)) {
|
6805 |
+
cls = concat(cls, stringifyClass(transitionClass));
|
6806 |
+
}
|
6807 |
+
|
6808 |
+
// set the class
|
6809 |
+
if (cls !== el._prevClass) {
|
6810 |
+
el.setAttribute('class', cls);
|
6811 |
+
el._prevClass = cls;
|
6812 |
+
}
|
6813 |
+
}
|
6814 |
+
|
6815 |
+
var klass = {
|
6816 |
+
create: updateClass,
|
6817 |
+
update: updateClass
|
6818 |
+
};
|
6819 |
+
|
6820 |
+
/* */
|
6821 |
+
|
6822 |
+
var validDivisionCharRE = /[\w).+\-_$\]]/;
|
6823 |
+
|
6824 |
+
function parseFilters (exp) {
|
6825 |
+
var inSingle = false;
|
6826 |
+
var inDouble = false;
|
6827 |
+
var inTemplateString = false;
|
6828 |
+
var inRegex = false;
|
6829 |
+
var curly = 0;
|
6830 |
+
var square = 0;
|
6831 |
+
var paren = 0;
|
6832 |
+
var lastFilterIndex = 0;
|
6833 |
+
var c, prev, i, expression, filters;
|
6834 |
+
|
6835 |
+
for (i = 0; i < exp.length; i++) {
|
6836 |
+
prev = c;
|
6837 |
+
c = exp.charCodeAt(i);
|
6838 |
+
if (inSingle) {
|
6839 |
+
if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
|
6840 |
+
} else if (inDouble) {
|
6841 |
+
if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
|
6842 |
+
} else if (inTemplateString) {
|
6843 |
+
if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
|
6844 |
+
} else if (inRegex) {
|
6845 |
+
if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
|
6846 |
+
} else if (
|
6847 |
+
c === 0x7C && // pipe
|
6848 |
+
exp.charCodeAt(i + 1) !== 0x7C &&
|
6849 |
+
exp.charCodeAt(i - 1) !== 0x7C &&
|
6850 |
+
!curly && !square && !paren
|
6851 |
+
) {
|
6852 |
+
if (expression === undefined) {
|
6853 |
+
// first filter, end of expression
|
6854 |
+
lastFilterIndex = i + 1;
|
6855 |
+
expression = exp.slice(0, i).trim();
|
6856 |
+
} else {
|
6857 |
+
pushFilter();
|
6858 |
+
}
|
6859 |
+
} else {
|
6860 |
+
switch (c) {
|
6861 |
+
case 0x22: inDouble = true; break // "
|
6862 |
+
case 0x27: inSingle = true; break // '
|
6863 |
+
case 0x60: inTemplateString = true; break // `
|
6864 |
+
case 0x28: paren++; break // (
|
6865 |
+
case 0x29: paren--; break // )
|
6866 |
+
case 0x5B: square++; break // [
|
6867 |
+
case 0x5D: square--; break // ]
|
6868 |
+
case 0x7B: curly++; break // {
|
6869 |
+
case 0x7D: curly--; break // }
|
6870 |
+
}
|
6871 |
+
if (c === 0x2f) { // /
|
6872 |
+
var j = i - 1;
|
6873 |
+
var p = (void 0);
|
6874 |
+
// find first non-whitespace prev char
|
6875 |
+
for (; j >= 0; j--) {
|
6876 |
+
p = exp.charAt(j);
|
6877 |
+
if (p !== ' ') { break }
|
6878 |
+
}
|
6879 |
+
if (!p || !validDivisionCharRE.test(p)) {
|
6880 |
+
inRegex = true;
|
6881 |
+
}
|
6882 |
+
}
|
6883 |
+
}
|
6884 |
+
}
|
6885 |
+
|
6886 |
+
if (expression === undefined) {
|
6887 |
+
expression = exp.slice(0, i).trim();
|
6888 |
+
} else if (lastFilterIndex !== 0) {
|
6889 |
+
pushFilter();
|
6890 |
+
}
|
6891 |
+
|
6892 |
+
function pushFilter () {
|
6893 |
+
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
6894 |
+
lastFilterIndex = i + 1;
|
6895 |
+
}
|
6896 |
+
|
6897 |
+
if (filters) {
|
6898 |
+
for (i = 0; i < filters.length; i++) {
|
6899 |
+
expression = wrapFilter(expression, filters[i]);
|
6900 |
+
}
|
6901 |
+
}
|
6902 |
+
|
6903 |
+
return expression
|
6904 |
+
}
|
6905 |
+
|
6906 |
+
function wrapFilter (exp, filter) {
|
6907 |
+
var i = filter.indexOf('(');
|
6908 |
+
if (i < 0) {
|
6909 |
+
// _f: resolveFilter
|
6910 |
+
return ("_f(\"" + filter + "\")(" + exp + ")")
|
6911 |
+
} else {
|
6912 |
+
var name = filter.slice(0, i);
|
6913 |
+
var args = filter.slice(i + 1);
|
6914 |
+
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
|
6915 |
+
}
|
6916 |
+
}
|
6917 |
+
|
6918 |
+
/* */
|
6919 |
+
|
6920 |
+
|
6921 |
+
|
6922 |
+
/* eslint-disable no-unused-vars */
|
6923 |
+
function baseWarn (msg, range) {
|
6924 |
+
console.error(("[Vue compiler]: " + msg));
|
6925 |
+
}
|
6926 |
+
/* eslint-enable no-unused-vars */
|
6927 |
+
|
6928 |
+
function pluckModuleFunction (
|
6929 |
+
modules,
|
6930 |
+
key
|
6931 |
+
) {
|
6932 |
+
return modules
|
6933 |
+
? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
|
6934 |
+
: []
|
6935 |
+
}
|
6936 |
+
|
6937 |
+
function addProp (el, name, value, range, dynamic) {
|
6938 |
+
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6939 |
+
el.plain = false;
|
6940 |
+
}
|
6941 |
+
|
6942 |
+
function addAttr (el, name, value, range, dynamic) {
|
6943 |
+
var attrs = dynamic
|
6944 |
+
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
6945 |
+
: (el.attrs || (el.attrs = []));
|
6946 |
+
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6947 |
+
el.plain = false;
|
6948 |
+
}
|
6949 |
+
|
6950 |
+
// add a raw attr (use this in preTransforms)
|
6951 |
+
function addRawAttr (el, name, value, range) {
|
6952 |
+
el.attrsMap[name] = value;
|
6953 |
+
el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
|
6954 |
+
}
|
6955 |
+
|
6956 |
+
function addDirective (
|
6957 |
+
el,
|
6958 |
+
name,
|
6959 |
+
rawName,
|
6960 |
+
value,
|
6961 |
+
arg,
|
6962 |
+
isDynamicArg,
|
6963 |
+
modifiers,
|
6964 |
+
range
|
6965 |
+
) {
|
6966 |
+
(el.directives || (el.directives = [])).push(rangeSetItem({
|
6967 |
+
name: name,
|
6968 |
+
rawName: rawName,
|
6969 |
+
value: value,
|
6970 |
+
arg: arg,
|
6971 |
+
isDynamicArg: isDynamicArg,
|
6972 |
+
modifiers: modifiers
|
6973 |
+
}, range));
|
6974 |
+
el.plain = false;
|
6975 |
+
}
|
6976 |
+
|
6977 |
+
function prependModifierMarker (symbol, name, dynamic) {
|
6978 |
+
return dynamic
|
6979 |
+
? ("_p(" + name + ",\"" + symbol + "\")")
|
6980 |
+
: symbol + name // mark the event as captured
|
6981 |
+
}
|
6982 |
+
|
6983 |
+
function addHandler (
|
6984 |
+
el,
|
6985 |
+
name,
|
6986 |
+
value,
|
6987 |
+
modifiers,
|
6988 |
+
important,
|
6989 |
+
warn,
|
6990 |
+
range,
|
6991 |
+
dynamic
|
6992 |
+
) {
|
6993 |
+
modifiers = modifiers || emptyObject;
|
6994 |
+
// warn prevent and passive modifier
|
6995 |
+
/* istanbul ignore if */
|
6996 |
+
if (
|
6997 |
+
warn &&
|
6998 |
+
modifiers.prevent && modifiers.passive
|
6999 |
+
) {
|
7000 |
+
warn(
|
7001 |
+
'passive and prevent can\'t be used together. ' +
|
7002 |
+
'Passive handler can\'t prevent default event.',
|
7003 |
+
range
|
7004 |
+
);
|
7005 |
+
}
|
7006 |
+
|
7007 |
+
// normalize click.right and click.middle since they don't actually fire
|
7008 |
+
// this is technically browser-specific, but at least for now browsers are
|
7009 |
+
// the only target envs that have right/middle clicks.
|
7010 |
+
if (modifiers.right) {
|
7011 |
+
if (dynamic) {
|
7012 |
+
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
7013 |
+
} else if (name === 'click') {
|
7014 |
+
name = 'contextmenu';
|
7015 |
+
delete modifiers.right;
|
7016 |
+
}
|
7017 |
+
} else if (modifiers.middle) {
|
7018 |
+
if (dynamic) {
|
7019 |
+
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
7020 |
+
} else if (name === 'click') {
|
7021 |
+
name = 'mouseup';
|
7022 |
+
}
|
7023 |
+
}
|
7024 |
+
|
7025 |
+
// check capture modifier
|
7026 |
+
if (modifiers.capture) {
|
7027 |
+
delete modifiers.capture;
|
7028 |
+
name = prependModifierMarker('!', name, dynamic);
|
7029 |
+
}
|
7030 |
+
if (modifiers.once) {
|
7031 |
+
delete modifiers.once;
|
7032 |
+
name = prependModifierMarker('~', name, dynamic);
|
7033 |
+
}
|
7034 |
+
/* istanbul ignore if */
|
7035 |
+
if (modifiers.passive) {
|
7036 |
+
delete modifiers.passive;
|
7037 |
+
name = prependModifierMarker('&', name, dynamic);
|
7038 |
+
}
|
7039 |
+
|
7040 |
+
var events;
|
7041 |
+
if (modifiers.native) {
|
7042 |
+
delete modifiers.native;
|
7043 |
+
events = el.nativeEvents || (el.nativeEvents = {});
|
7044 |
+
} else {
|
7045 |
+
events = el.events || (el.events = {});
|
7046 |
+
}
|
7047 |
+
|
7048 |
+
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
7049 |
+
if (modifiers !== emptyObject) {
|
7050 |
+
newHandler.modifiers = modifiers;
|
7051 |
+
}
|
7052 |
+
|
7053 |
+
var handlers = events[name];
|
7054 |
+
/* istanbul ignore if */
|
7055 |
+
if (Array.isArray(handlers)) {
|
7056 |
+
important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
7057 |
+
} else if (handlers) {
|
7058 |
+
events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
7059 |
+
} else {
|
7060 |
+
events[name] = newHandler;
|
7061 |
+
}
|
7062 |
+
|
7063 |
+
el.plain = false;
|
7064 |
+
}
|
7065 |
+
|
7066 |
+
function getRawBindingAttr (
|
7067 |
+
el,
|
7068 |
+
name
|
7069 |
+
) {
|
7070 |
+
return el.rawAttrsMap[':' + name] ||
|
7071 |
+
el.rawAttrsMap['v-bind:' + name] ||
|
7072 |
+
el.rawAttrsMap[name]
|
7073 |
+
}
|
7074 |
+
|
7075 |
+
function getBindingAttr (
|
7076 |
+
el,
|
7077 |
+
name,
|
7078 |
+
getStatic
|
7079 |
+
) {
|
7080 |
+
var dynamicValue =
|
7081 |
+
getAndRemoveAttr(el, ':' + name) ||
|
7082 |
+
getAndRemoveAttr(el, 'v-bind:' + name);
|
7083 |
+
if (dynamicValue != null) {
|
7084 |
+
return parseFilters(dynamicValue)
|
7085 |
+
} else if (getStatic !== false) {
|
7086 |
+
var staticValue = getAndRemoveAttr(el, name);
|
7087 |
+
if (staticValue != null) {
|
7088 |
+
return JSON.stringify(staticValue)
|
7089 |
+
}
|
7090 |
+
}
|
7091 |
+
}
|
7092 |
+
|
7093 |
+
// note: this only removes the attr from the Array (attrsList) so that it
|
7094 |
+
// doesn't get processed by processAttrs.
|
7095 |
+
// By default it does NOT remove it from the map (attrsMap) because the map is
|
7096 |
+
// needed during codegen.
|
7097 |
+
function getAndRemoveAttr (
|
7098 |
+
el,
|
7099 |
+
name,
|
7100 |
+
removeFromMap
|
7101 |
+
) {
|
7102 |
+
var val;
|
7103 |
+
if ((val = el.attrsMap[name]) != null) {
|
7104 |
+
var list = el.attrsList;
|
7105 |
+
for (var i = 0, l = list.length; i < l; i++) {
|
7106 |
+
if (list[i].name === name) {
|
7107 |
+
list.splice(i, 1);
|
7108 |
+
break
|
7109 |
+
}
|
7110 |
+
}
|
7111 |
+
}
|
7112 |
+
if (removeFromMap) {
|
7113 |
+
delete el.attrsMap[name];
|
7114 |
+
}
|
7115 |
+
return val
|
7116 |
+
}
|
7117 |
+
|
7118 |
+
function getAndRemoveAttrByRegex (
|
7119 |
+
el,
|
7120 |
+
name
|
7121 |
+
) {
|
7122 |
+
var list = el.attrsList;
|
7123 |
+
for (var i = 0, l = list.length; i < l; i++) {
|
7124 |
+
var attr = list[i];
|
7125 |
+
if (name.test(attr.name)) {
|
7126 |
+
list.splice(i, 1);
|
7127 |
+
return attr
|
7128 |
+
}
|
7129 |
+
}
|
7130 |
+
}
|
7131 |
+
|
7132 |
+
function rangeSetItem (
|
7133 |
+
item,
|
7134 |
+
range
|
7135 |
+
) {
|
7136 |
+
if (range) {
|
7137 |
+
if (range.start != null) {
|
7138 |
+
item.start = range.start;
|
7139 |
+
}
|
7140 |
+
if (range.end != null) {
|
7141 |
+
item.end = range.end;
|
7142 |
+
}
|
7143 |
+
}
|
7144 |
+
return item
|
7145 |
+
}
|
7146 |
+
|
7147 |
+
/* */
|
7148 |
+
|
7149 |
+
/**
|
7150 |
+
* Cross-platform code generation for component v-model
|
7151 |
+
*/
|
7152 |
+
function genComponentModel (
|
7153 |
+
el,
|
7154 |
+
value,
|
7155 |
+
modifiers
|
7156 |
+
) {
|
7157 |
+
var ref = modifiers || {};
|
7158 |
+
var number = ref.number;
|
7159 |
+
var trim = ref.trim;
|
7160 |
+
|
7161 |
+
var baseValueExpression = '$$v';
|
7162 |
+
var valueExpression = baseValueExpression;
|
7163 |
+
if (trim) {
|
7164 |
+
valueExpression =
|
7165 |
+
"(typeof " + baseValueExpression + " === 'string'" +
|
7166 |
+
"? " + baseValueExpression + ".trim()" +
|
7167 |
+
": " + baseValueExpression + ")";
|
7168 |
+
}
|
7169 |
+
if (number) {
|
7170 |
+
valueExpression = "_n(" + valueExpression + ")";
|
7171 |
+
}
|
7172 |
+
var assignment = genAssignmentCode(value, valueExpression);
|
7173 |
+
|
7174 |
+
el.model = {
|
7175 |
+
value: ("(" + value + ")"),
|
7176 |
+
expression: JSON.stringify(value),
|
7177 |
+
callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
7178 |
+
};
|
7179 |
+
}
|
7180 |
+
|
7181 |
+
/**
|
7182 |
+
* Cross-platform codegen helper for generating v-model value assignment code.
|
7183 |
+
*/
|
7184 |
+
function genAssignmentCode (
|
7185 |
+
value,
|
7186 |
+
assignment
|
7187 |
+
) {
|
7188 |
+
var res = parseModel(value);
|
7189 |
+
if (res.key === null) {
|
7190 |
+
return (value + "=" + assignment)
|
7191 |
+
} else {
|
7192 |
+
return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
|
7193 |
+
}
|
7194 |
+
}
|
7195 |
+
|
7196 |
+
/**
|
7197 |
+
* Parse a v-model expression into a base path and a final key segment.
|
7198 |
+
* Handles both dot-path and possible square brackets.
|
7199 |
+
*
|
7200 |
+
* Possible cases:
|
7201 |
+
*
|
7202 |
+
* - test
|
7203 |
+
* - test[key]
|
7204 |
+
* - test[test1[key]]
|
7205 |
+
* - test["a"][key]
|
7206 |
+
* - xxx.test[a[a].test1[key]]
|
7207 |
+
* - test.xxx.a["asa"][test1[key]]
|
7208 |
+
*
|
7209 |
+
*/
|
7210 |
+
|
7211 |
+
var len, str, chr, index$1, expressionPos, expressionEndPos;
|
7212 |
+
|
7213 |
+
|
7214 |
+
|
7215 |
+
function parseModel (val) {
|
7216 |
+
// Fix https://github.com/vuejs/vue/pull/7730
|
7217 |
+
// allow v-model="obj.val " (trailing whitespace)
|
7218 |
+
val = val.trim();
|
7219 |
+
len = val.length;
|
7220 |
+
|
7221 |
+
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
7222 |
+
index$1 = val.lastIndexOf('.');
|
7223 |
+
if (index$1 > -1) {
|
7224 |
+
return {
|
7225 |
+
exp: val.slice(0, index$1),
|
7226 |
+
key: '"' + val.slice(index$1 + 1) + '"'
|
7227 |
+
}
|
7228 |
+
} else {
|
7229 |
+
return {
|
7230 |
+
exp: val,
|
7231 |
+
key: null
|
7232 |
+
}
|
7233 |
+
}
|
7234 |
+
}
|
7235 |
+
|
7236 |
+
str = val;
|
7237 |
+
index$1 = expressionPos = expressionEndPos = 0;
|
7238 |
+
|
7239 |
+
while (!eof()) {
|
7240 |
+
chr = next();
|
7241 |
+
/* istanbul ignore if */
|
7242 |
+
if (isStringStart(chr)) {
|
7243 |
+
parseString(chr);
|
7244 |
+
} else if (chr === 0x5B) {
|
7245 |
+
parseBracket(chr);
|
7246 |
+
}
|
7247 |
+
}
|
7248 |
+
|
7249 |
+
return {
|
7250 |
+
exp: val.slice(0, expressionPos),
|
7251 |
+
key: val.slice(expressionPos + 1, expressionEndPos)
|
7252 |
+
}
|
7253 |
+
}
|
7254 |
+
|
7255 |
+
function next () {
|
7256 |
+
return str.charCodeAt(++index$1)
|
7257 |
+
}
|
7258 |
+
|
7259 |
+
function eof () {
|
7260 |
+
return index$1 >= len
|
7261 |
+
}
|
7262 |
+
|
7263 |
+
function isStringStart (chr) {
|
7264 |
+
return chr === 0x22 || chr === 0x27
|
7265 |
+
}
|
7266 |
+
|
7267 |
+
function parseBracket (chr) {
|
7268 |
+
var inBracket = 1;
|
7269 |
+
expressionPos = index$1;
|
7270 |
+
while (!eof()) {
|
7271 |
+
chr = next();
|
7272 |
+
if (isStringStart(chr)) {
|
7273 |
+
parseString(chr);
|
7274 |
+
continue
|
7275 |
+
}
|
7276 |
+
if (chr === 0x5B) { inBracket++; }
|
7277 |
+
if (chr === 0x5D) { inBracket--; }
|
7278 |
+
if (inBracket === 0) {
|
7279 |
+
expressionEndPos = index$1;
|
7280 |
+
break
|
7281 |
+
}
|
7282 |
+
}
|
7283 |
+
}
|
7284 |
+
|
7285 |
+
function parseString (chr) {
|
7286 |
+
var stringQuote = chr;
|
7287 |
+
while (!eof()) {
|
7288 |
+
chr = next();
|
7289 |
+
if (chr === stringQuote) {
|
7290 |
+
break
|
7291 |
+
}
|
7292 |
+
}
|
7293 |
+
}
|
7294 |
+
|
7295 |
+
/* */
|
7296 |
+
|
7297 |
+
var warn$1;
|
7298 |
+
|
7299 |
+
// in some cases, the event used has to be determined at runtime
|
7300 |
+
// so we used some reserved tokens during compile.
|
7301 |
+
var RANGE_TOKEN = '__r';
|
7302 |
+
var CHECKBOX_RADIO_TOKEN = '__c';
|
7303 |
+
|
7304 |
+
function model (
|
7305 |
+
el,
|
7306 |
+
dir,
|
7307 |
+
_warn
|
7308 |
+
) {
|
7309 |
+
warn$1 = _warn;
|
7310 |
+
var value = dir.value;
|
7311 |
+
var modifiers = dir.modifiers;
|
7312 |
+
var tag = el.tag;
|
7313 |
+
var type = el.attrsMap.type;
|
7314 |
+
|
7315 |
+
{
|
7316 |
+
// inputs with type="file" are read only and setting the input's
|
7317 |
+
// value will throw an error.
|
7318 |
+
if (tag === 'input' && type === 'file') {
|
7319 |
+
warn$1(
|
7320 |
+
"<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
|
7321 |
+
"File inputs are read only. Use a v-on:change listener instead.",
|
7322 |
+
el.rawAttrsMap['v-model']
|
7323 |
+
);
|
7324 |
+
}
|
7325 |
+
}
|
7326 |
+
|
7327 |
+
if (el.component) {
|
7328 |
+
genComponentModel(el, value, modifiers);
|
7329 |
+
// component v-model doesn't need extra runtime
|
7330 |
+
return false
|
7331 |
+
} else if (tag === 'select') {
|
7332 |
+
genSelect(el, value, modifiers);
|
7333 |
+
} else if (tag === 'input' && type === 'checkbox') {
|
7334 |
+
genCheckboxModel(el, value, modifiers);
|
7335 |
+
} else if (tag === 'input' && type === 'radio') {
|
7336 |
+
genRadioModel(el, value, modifiers);
|
7337 |
+
} else if (tag === 'input' || tag === 'textarea') {
|
7338 |
+
genDefaultModel(el, value, modifiers);
|
7339 |
+
} else if (!config.isReservedTag(tag)) {
|
7340 |
+
genComponentModel(el, value, modifiers);
|
7341 |
+
// component v-model doesn't need extra runtime
|
7342 |
+
return false
|
7343 |
+
} else {
|
7344 |
+
warn$1(
|
7345 |
+
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
7346 |
+
"v-model is not supported on this element type. " +
|
7347 |
+
'If you are working with contenteditable, it\'s recommended to ' +
|
7348 |
+
'wrap a library dedicated for that purpose inside a custom component.',
|
7349 |
+
el.rawAttrsMap['v-model']
|
7350 |
+
);
|
7351 |
+
}
|
7352 |
+
|
7353 |
+
// ensure runtime directive metadata
|
7354 |
+
return true
|
7355 |
+
}
|
7356 |
+
|
7357 |
+
function genCheckboxModel (
|
7358 |
+
el,
|
7359 |
+
value,
|
7360 |
+
modifiers
|
7361 |
+
) {
|
7362 |
+
var number = modifiers && modifiers.number;
|
7363 |
+
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7364 |
+
var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
7365 |
+
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
7366 |
+
addProp(el, 'checked',
|
7367 |
+
"Array.isArray(" + value + ")" +
|
7368 |
+
"?_i(" + value + "," + valueBinding + ")>-1" + (
|
7369 |
+
trueValueBinding === 'true'
|
7370 |
+
? (":(" + value + ")")
|
7371 |
+
: (":_q(" + value + "," + trueValueBinding + ")")
|
7372 |
+
)
|
7373 |
+
);
|
7374 |
+
addHandler(el, 'change',
|
7375 |
+
"var $$a=" + value + "," +
|
7376 |
+
'$$el=$event.target,' +
|
7377 |
+
"$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
|
7378 |
+
'if(Array.isArray($$a)){' +
|
7379 |
+
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
|
7380 |
+
'$$i=_i($$a,$$v);' +
|
7381 |
+
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
|
7382 |
+
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
|
7383 |
+
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
|
7384 |
+
null, true
|
7385 |
+
);
|
7386 |
+
}
|
7387 |
+
|
7388 |
+
function genRadioModel (
|
7389 |
+
el,
|
7390 |
+
value,
|
7391 |
+
modifiers
|
7392 |
+
) {
|
7393 |
+
var number = modifiers && modifiers.number;
|
7394 |
+
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7395 |
+
valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
7396 |
+
addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
|
7397 |
+
addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
|
7398 |
+
}
|
7399 |
+
|
7400 |
+
function genSelect (
|
7401 |
+
el,
|
7402 |
+
value,
|
7403 |
+
modifiers
|
7404 |
+
) {
|
7405 |
+
var number = modifiers && modifiers.number;
|
7406 |
+
var selectedVal = "Array.prototype.filter" +
|
7407 |
+
".call($event.target.options,function(o){return o.selected})" +
|
7408 |
+
".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
|
7409 |
+
"return " + (number ? '_n(val)' : 'val') + "})";
|
7410 |
+
|
7411 |
+
var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
|
7412 |
+
var code = "var $$selectedVal = " + selectedVal + ";";
|
7413 |
+
code = code + " " + (genAssignmentCode(value, assignment));
|
7414 |
+
addHandler(el, 'change', code, null, true);
|
7415 |
+
}
|
7416 |
+
|
7417 |
+
function genDefaultModel (
|
7418 |
+
el,
|
7419 |
+
value,
|
7420 |
+
modifiers
|
7421 |
+
) {
|
7422 |
+
var type = el.attrsMap.type;
|
7423 |
+
|
7424 |
+
// warn if v-bind:value conflicts with v-model
|
7425 |
+
// except for inputs with v-bind:type
|
7426 |
+
{
|
7427 |
+
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
7428 |
+
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
7429 |
+
if (value$1 && !typeBinding) {
|
7430 |
+
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
7431 |
+
warn$1(
|
7432 |
+
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
|
7433 |
+
'because the latter already expands to a value binding internally',
|
7434 |
+
el.rawAttrsMap[binding]
|
7435 |
+
);
|
7436 |
+
}
|
7437 |
+
}
|
7438 |
+
|
7439 |
+
var ref = modifiers || {};
|
7440 |
+
var lazy = ref.lazy;
|
7441 |
+
var number = ref.number;
|
7442 |
+
var trim = ref.trim;
|
7443 |
+
var needCompositionGuard = !lazy && type !== 'range';
|
7444 |
+
var event = lazy
|
7445 |
+
? 'change'
|
7446 |
+
: type === 'range'
|
7447 |
+
? RANGE_TOKEN
|
7448 |
+
: 'input';
|
7449 |
+
|
7450 |
+
var valueExpression = '$event.target.value';
|
7451 |
+
if (trim) {
|
7452 |
+
valueExpression = "$event.target.value.trim()";
|
7453 |
+
}
|
7454 |
+
if (number) {
|
7455 |
+
valueExpression = "_n(" + valueExpression + ")";
|
7456 |
+
}
|
7457 |
+
|
7458 |
+
var code = genAssignmentCode(value, valueExpression);
|
7459 |
+
if (needCompositionGuard) {
|
7460 |
+
code = "if($event.target.composing)return;" + code;
|
7461 |
+
}
|
7462 |
+
|
7463 |
+
addProp(el, 'value', ("(" + value + ")"));
|
7464 |
+
addHandler(el, event, code, null, true);
|
7465 |
+
if (trim || number) {
|
7466 |
+
addHandler(el, 'blur', '$forceUpdate()');
|
7467 |
+
}
|
7468 |
+
}
|
7469 |
+
|
7470 |
+
/* */
|
7471 |
+
|
7472 |
+
// normalize v-model event tokens that can only be determined at runtime.
|
7473 |
+
// it's important to place the event as the first in the array because
|
7474 |
+
// the whole point is ensuring the v-model callback gets called before
|
7475 |
+
// user-attached handlers.
|
7476 |
+
function normalizeEvents (on) {
|
7477 |
+
/* istanbul ignore if */
|
7478 |
+
if (isDef(on[RANGE_TOKEN])) {
|
7479 |
+
// IE input[type=range] only supports `change` event
|
7480 |
+
var event = isIE ? 'change' : 'input';
|
7481 |
+
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
7482 |
+
delete on[RANGE_TOKEN];
|
7483 |
+
}
|
7484 |
+
// This was originally intended to fix #4521 but no longer necessary
|
7485 |
+
// after 2.5. Keeping it for backwards compat with generated code from < 2.4
|
7486 |
+
/* istanbul ignore if */
|
7487 |
+
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
7488 |
+
on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
7489 |
+
delete on[CHECKBOX_RADIO_TOKEN];
|
7490 |
+
}
|
7491 |
+
}
|
7492 |
+
|
7493 |
+
var target$1;
|
7494 |
+
|
7495 |
+
function createOnceHandler$1 (event, handler, capture) {
|
7496 |
+
var _target = target$1; // save current target element in closure
|
7497 |
+
return function onceHandler () {
|
7498 |
+
var res = handler.apply(null, arguments);
|
7499 |
+
if (res !== null) {
|
7500 |
+
remove$2(event, onceHandler, capture, _target);
|
7501 |
+
}
|
7502 |
+
}
|
7503 |
+
}
|
7504 |
+
|
7505 |
+
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
|
7506 |
+
// implementation and does not fire microtasks in between event propagation, so
|
7507 |
+
// safe to exclude.
|
7508 |
+
var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
7509 |
+
|
7510 |
+
function add$1 (
|
7511 |
+
name,
|
7512 |
+
handler,
|
7513 |
+
capture,
|
7514 |
+
passive
|
7515 |
+
) {
|
7516 |
+
// async edge case #6566: inner click event triggers patch, event handler
|
7517 |
+
// attached to outer element during patch, and triggered again. This
|
7518 |
+
// happens because browsers fire microtask ticks between event propagation.
|
7519 |
+
// the solution is simple: we save the timestamp when a handler is attached,
|
7520 |
+
// and the handler would only fire if the event passed to it was fired
|
7521 |
+
// AFTER it was attached.
|
7522 |
+
if (useMicrotaskFix) {
|
7523 |
+
var attachedTimestamp = currentFlushTimestamp;
|
7524 |
+
var original = handler;
|
7525 |
+
handler = original._wrapper = function (e) {
|
7526 |
+
if (
|
7527 |
+
// no bubbling, should always fire.
|
7528 |
+
// this is just a safety net in case event.timeStamp is unreliable in
|
7529 |
+
// certain weird environments...
|
7530 |
+
e.target === e.currentTarget ||
|
7531 |
+
// event is fired after handler attachment
|
7532 |
+
e.timeStamp >= attachedTimestamp ||
|
7533 |
+
// bail for environments that have buggy event.timeStamp implementations
|
7534 |
+
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
|
7535 |
+
// #9681 QtWebEngine event.timeStamp is negative value
|
7536 |
+
e.timeStamp <= 0 ||
|
7537 |
+
// #9448 bail if event is fired in another document in a multi-page
|
7538 |
+
// electron/nw.js app, since event.timeStamp will be using a different
|
7539 |
+
// starting reference
|
7540 |
+
e.target.ownerDocument !== document
|
7541 |
+
) {
|
7542 |
+
return original.apply(this, arguments)
|
7543 |
+
}
|
7544 |
+
};
|
7545 |
+
}
|
7546 |
+
target$1.addEventListener(
|
7547 |
+
name,
|
7548 |
+
handler,
|
7549 |
+
supportsPassive
|
7550 |
+
? { capture: capture, passive: passive }
|
7551 |
+
: capture
|
7552 |
+
);
|
7553 |
+
}
|
7554 |
+
|
7555 |
+
function remove$2 (
|
7556 |
+
name,
|
7557 |
+
handler,
|
7558 |
+
capture,
|
7559 |
+
_target
|
7560 |
+
) {
|
7561 |
+
(_target || target$1).removeEventListener(
|
7562 |
+
name,
|
7563 |
+
handler._wrapper || handler,
|
7564 |
+
capture
|
7565 |
+
);
|
7566 |
+
}
|
7567 |
+
|
7568 |
+
function updateDOMListeners (oldVnode, vnode) {
|
7569 |
+
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
7570 |
+
return
|
7571 |
+
}
|
7572 |
+
var on = vnode.data.on || {};
|
7573 |
+
var oldOn = oldVnode.data.on || {};
|
7574 |
+
target$1 = vnode.elm;
|
7575 |
+
normalizeEvents(on);
|
7576 |
+
updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
7577 |
+
target$1 = undefined;
|
7578 |
+
}
|
7579 |
+
|
7580 |
+
var events = {
|
7581 |
+
create: updateDOMListeners,
|
7582 |
+
update: updateDOMListeners
|
7583 |
+
};
|
7584 |
+
|
7585 |
+
/* */
|
7586 |
+
|
7587 |
+
var svgContainer;
|
7588 |
+
|
7589 |
+
function updateDOMProps (oldVnode, vnode) {
|
7590 |
+
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
7591 |
+
return
|
7592 |
+
}
|
7593 |
+
var key, cur;
|
7594 |
+
var elm = vnode.elm;
|
7595 |
+
var oldProps = oldVnode.data.domProps || {};
|
7596 |
+
var props = vnode.data.domProps || {};
|
7597 |
+
// clone observed objects, as the user probably wants to mutate it
|
7598 |
+
if (isDef(props.__ob__)) {
|
7599 |
+
props = vnode.data.domProps = extend({}, props);
|
7600 |
+
}
|
7601 |
+
|
7602 |
+
for (key in oldProps) {
|
7603 |
+
if (!(key in props)) {
|
7604 |
+
elm[key] = '';
|
7605 |
+
}
|
7606 |
+
}
|
7607 |
+
|
7608 |
+
for (key in props) {
|
7609 |
+
cur = props[key];
|
7610 |
+
// ignore children if the node has textContent or innerHTML,
|
7611 |
+
// as these will throw away existing DOM nodes and cause removal errors
|
7612 |
+
// on subsequent patches (#3360)
|
7613 |
+
if (key === 'textContent' || key === 'innerHTML') {
|
7614 |
+
if (vnode.children) { vnode.children.length = 0; }
|
7615 |
+
if (cur === oldProps[key]) { continue }
|
7616 |
+
// #6601 work around Chrome version <= 55 bug where single textNode
|
7617 |
+
// replaced by innerHTML/textContent retains its parentNode property
|
7618 |
+
if (elm.childNodes.length === 1) {
|
7619 |
+
elm.removeChild(elm.childNodes[0]);
|
7620 |
+
}
|
7621 |
+
}
|
7622 |
+
|
7623 |
+
if (key === 'value' && elm.tagName !== 'PROGRESS') {
|
7624 |
+
// store value as _value as well since
|
7625 |
+
// non-string values will be stringified
|
7626 |
+
elm._value = cur;
|
7627 |
+
// avoid resetting cursor position when value is the same
|
7628 |
+
var strCur = isUndef(cur) ? '' : String(cur);
|
7629 |
+
if (shouldUpdateValue(elm, strCur)) {
|
7630 |
+
elm.value = strCur;
|
7631 |
+
}
|
7632 |
+
} else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
7633 |
+
// IE doesn't support innerHTML for SVG elements
|
7634 |
+
svgContainer = svgContainer || document.createElement('div');
|
7635 |
+
svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
7636 |
+
var svg = svgContainer.firstChild;
|
7637 |
+
while (elm.firstChild) {
|
7638 |
+
elm.removeChild(elm.firstChild);
|
7639 |
+
}
|
7640 |
+
while (svg.firstChild) {
|
7641 |
+
elm.appendChild(svg.firstChild);
|
7642 |
+
}
|
7643 |
+
} else if (
|
7644 |
+
// skip the update if old and new VDOM state is the same.
|
7645 |
+
// `value` is handled separately because the DOM value may be temporarily
|
7646 |
+
// out of sync with VDOM state due to focus, composition and modifiers.
|
7647 |
+
// This #4521 by skipping the unnecesarry `checked` update.
|
7648 |
+
cur !== oldProps[key]
|
7649 |
+
) {
|
7650 |
+
// some property updates can throw
|
7651 |
+
// e.g. `value` on <progress> w/ non-finite value
|
7652 |
+
try {
|
7653 |
+
elm[key] = cur;
|
7654 |
+
} catch (e) {}
|
7655 |
+
}
|
7656 |
+
}
|
7657 |
+
}
|
7658 |
+
|
7659 |
+
// check platforms/web/util/attrs.js acceptValue
|
7660 |
+
|
7661 |
+
|
7662 |
+
function shouldUpdateValue (elm, checkVal) {
|
7663 |
+
return (!elm.composing && (
|
7664 |
+
elm.tagName === 'OPTION' ||
|
7665 |
+
isNotInFocusAndDirty(elm, checkVal) ||
|
7666 |
+
isDirtyWithModifiers(elm, checkVal)
|
7667 |
+
))
|
7668 |
+
}
|
7669 |
+
|
7670 |
+
function isNotInFocusAndDirty (elm, checkVal) {
|
7671 |
+
// return true when textbox (.number and .trim) loses focus and its value is
|
7672 |
+
// not equal to the updated value
|
7673 |
+
var notInFocus = true;
|
7674 |
+
// #6157
|
7675 |
+
// work around IE bug when accessing document.activeElement in an iframe
|
7676 |
+
try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
7677 |
+
return notInFocus && elm.value !== checkVal
|
7678 |
+
}
|
7679 |
+
|
7680 |
+
function isDirtyWithModifiers (elm, newVal) {
|
7681 |
+
var value = elm.value;
|
7682 |
+
var modifiers = elm._vModifiers; // injected by v-model runtime
|
7683 |
+
if (isDef(modifiers)) {
|
7684 |
+
if (modifiers.number) {
|
7685 |
+
return toNumber(value) !== toNumber(newVal)
|
7686 |
+
}
|
7687 |
+
if (modifiers.trim) {
|
7688 |
+
return value.trim() !== newVal.trim()
|
7689 |
+
}
|
7690 |
+
}
|
7691 |
+
return value !== newVal
|
7692 |
+
}
|
7693 |
+
|
7694 |
+
var domProps = {
|
7695 |
+
create: updateDOMProps,
|
7696 |
+
update: updateDOMProps
|
7697 |
+
};
|
7698 |
+
|
7699 |
+
/* */
|
7700 |
+
|
7701 |
+
var parseStyleText = cached(function (cssText) {
|
7702 |
+
var res = {};
|
7703 |
+
var listDelimiter = /;(?![^(]*\))/g;
|
7704 |
+
var propertyDelimiter = /:(.+)/;
|
7705 |
+
cssText.split(listDelimiter).forEach(function (item) {
|
7706 |
+
if (item) {
|
7707 |
+
var tmp = item.split(propertyDelimiter);
|
7708 |
+
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
7709 |
+
}
|
7710 |
+
});
|
7711 |
+
return res
|
7712 |
+
});
|
7713 |
+
|
7714 |
+
// merge static and dynamic style data on the same vnode
|
7715 |
+
function normalizeStyleData (data) {
|
7716 |
+
var style = normalizeStyleBinding(data.style);
|
7717 |
+
// static style is pre-processed into an object during compilation
|
7718 |
+
// and is always a fresh object, so it's safe to merge into it
|
7719 |
+
return data.staticStyle
|
7720 |
+
? extend(data.staticStyle, style)
|
7721 |
+
: style
|
7722 |
+
}
|
7723 |
+
|
7724 |
+
// normalize possible array / string values into Object
|
7725 |
+
function normalizeStyleBinding (bindingStyle) {
|
7726 |
+
if (Array.isArray(bindingStyle)) {
|
7727 |
+
return toObject(bindingStyle)
|
7728 |
+
}
|
7729 |
+
if (typeof bindingStyle === 'string') {
|
7730 |
+
return parseStyleText(bindingStyle)
|
7731 |
+
}
|
7732 |
+
return bindingStyle
|
7733 |
+
}
|
7734 |
+
|
7735 |
+
/**
|
7736 |
+
* parent component style should be after child's
|
7737 |
+
* so that parent component's style could override it
|
7738 |
+
*/
|
7739 |
+
function getStyle (vnode, checkChild) {
|
7740 |
+
var res = {};
|
7741 |
+
var styleData;
|
7742 |
+
|
7743 |
+
if (checkChild) {
|
7744 |
+
var childNode = vnode;
|
7745 |
+
while (childNode.componentInstance) {
|
7746 |
+
childNode = childNode.componentInstance._vnode;
|
7747 |
+
if (
|
7748 |
+
childNode && childNode.data &&
|
7749 |
+
(styleData = normalizeStyleData(childNode.data))
|
7750 |
+
) {
|
7751 |
+
extend(res, styleData);
|
7752 |
+
}
|
7753 |
+
}
|
7754 |
+
}
|
7755 |
+
|
7756 |
+
if ((styleData = normalizeStyleData(vnode.data))) {
|
7757 |
+
extend(res, styleData);
|
7758 |
+
}
|
7759 |
+
|
7760 |
+
var parentNode = vnode;
|
7761 |
+
while ((parentNode = parentNode.parent)) {
|
7762 |
+
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
7763 |
+
extend(res, styleData);
|
7764 |
+
}
|
7765 |
+
}
|
7766 |
+
return res
|
7767 |
+
}
|
7768 |
+
|
7769 |
+
/* */
|
7770 |
+
|
7771 |
+
var cssVarRE = /^--/;
|
7772 |
+
var importantRE = /\s*!important$/;
|
7773 |
+
var setProp = function (el, name, val) {
|
7774 |
+
/* istanbul ignore if */
|
7775 |
+
if (cssVarRE.test(name)) {
|
7776 |
+
el.style.setProperty(name, val);
|
7777 |
+
} else if (importantRE.test(val)) {
|
7778 |
+
el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
7779 |
+
} else {
|
7780 |
+
var normalizedName = normalize(name);
|
7781 |
+
if (Array.isArray(val)) {
|
7782 |
+
// Support values array created by autoprefixer, e.g.
|
7783 |
+
// {display: ["-webkit-box", "-ms-flexbox", "flex"]}
|
7784 |
+
// Set them one by one, and the browser will only set those it can recognize
|
7785 |
+
for (var i = 0, len = val.length; i < len; i++) {
|
7786 |
+
el.style[normalizedName] = val[i];
|
7787 |
+
}
|
7788 |
+
} else {
|
7789 |
+
el.style[normalizedName] = val;
|
7790 |
+
}
|
7791 |
+
}
|
7792 |
+
};
|
7793 |
+
|
7794 |
+
var vendorNames = ['Webkit', 'Moz', 'ms'];
|
7795 |
+
|
7796 |
+
var emptyStyle;
|
7797 |
+
var normalize = cached(function (prop) {
|
7798 |
+
emptyStyle = emptyStyle || document.createElement('div').style;
|
7799 |
+
prop = camelize(prop);
|
7800 |
+
if (prop !== 'filter' && (prop in emptyStyle)) {
|
7801 |
+
return prop
|
7802 |
+
}
|
7803 |
+
var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
7804 |
+
for (var i = 0; i < vendorNames.length; i++) {
|
7805 |
+
var name = vendorNames[i] + capName;
|
7806 |
+
if (name in emptyStyle) {
|
7807 |
+
return name
|
7808 |
+
}
|
7809 |
+
}
|
7810 |
+
});
|
7811 |
+
|
7812 |
+
function updateStyle (oldVnode, vnode) {
|
7813 |
+
var data = vnode.data;
|
7814 |
+
var oldData = oldVnode.data;
|
7815 |
+
|
7816 |
+
if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
7817 |
+
isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
7818 |
+
) {
|
7819 |
+
return
|
7820 |
+
}
|
7821 |
+
|
7822 |
+
var cur, name;
|
7823 |
+
var el = vnode.elm;
|
7824 |
+
var oldStaticStyle = oldData.staticStyle;
|
7825 |
+
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
7826 |
+
|
7827 |
+
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
|
7828 |
+
var oldStyle = oldStaticStyle || oldStyleBinding;
|
7829 |
+
|
7830 |
+
var style = normalizeStyleBinding(vnode.data.style) || {};
|
7831 |
+
|
7832 |
+
// store normalized style under a different key for next diff
|
7833 |
+
// make sure to clone it if it's reactive, since the user likely wants
|
7834 |
+
// to mutate it.
|
7835 |
+
vnode.data.normalizedStyle = isDef(style.__ob__)
|
7836 |
+
? extend({}, style)
|
7837 |
+
: style;
|
7838 |
+
|
7839 |
+
var newStyle = getStyle(vnode, true);
|
7840 |
+
|
7841 |
+
for (name in oldStyle) {
|
7842 |
+
if (isUndef(newStyle[name])) {
|
7843 |
+
setProp(el, name, '');
|
7844 |
+
}
|
7845 |
+
}
|
7846 |
+
for (name in newStyle) {
|
7847 |
+
cur = newStyle[name];
|
7848 |
+
if (cur !== oldStyle[name]) {
|
7849 |
+
// ie9 setting to null has no effect, must use empty string
|
7850 |
+
setProp(el, name, cur == null ? '' : cur);
|
7851 |
+
}
|
7852 |
+
}
|
7853 |
+
}
|
7854 |
+
|
7855 |
+
var style = {
|
7856 |
+
create: updateStyle,
|
7857 |
+
update: updateStyle
|
7858 |
+
};
|
7859 |
+
|
7860 |
+
/* */
|
7861 |
+
|
7862 |
+
var whitespaceRE = /\s+/;
|
7863 |
+
|
7864 |
+
/**
|
7865 |
+
* Add class with compatibility for SVG since classList is not supported on
|
7866 |
+
* SVG elements in IE
|
7867 |
+
*/
|
7868 |
+
function addClass (el, cls) {
|
7869 |
+
/* istanbul ignore if */
|
7870 |
+
if (!cls || !(cls = cls.trim())) {
|
7871 |
+
return
|
7872 |
+
}
|
7873 |
+
|
7874 |
+
/* istanbul ignore else */
|
7875 |
+
if (el.classList) {
|
7876 |
+
if (cls.indexOf(' ') > -1) {
|
7877 |
+
cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
7878 |
+
} else {
|
7879 |
+
el.classList.add(cls);
|
7880 |
+
}
|
7881 |
+
} else {
|
7882 |
+
var cur = " " + (el.getAttribute('class') || '') + " ";
|
7883 |
+
if (cur.indexOf(' ' + cls + ' ') < 0) {
|
7884 |
+
el.setAttribute('class', (cur + cls).trim());
|
7885 |
+
}
|
7886 |
+
}
|
7887 |
+
}
|
7888 |
+
|
7889 |
+
/**
|
7890 |
+
* Remove class with compatibility for SVG since classList is not supported on
|
7891 |
+
* SVG elements in IE
|
7892 |
+
*/
|
7893 |
+
function removeClass (el, cls) {
|
7894 |
+
/* istanbul ignore if */
|
7895 |
+
if (!cls || !(cls = cls.trim())) {
|
7896 |
+
return
|
7897 |
+
}
|
7898 |
+
|
7899 |
+
/* istanbul ignore else */
|
7900 |
+
if (el.classList) {
|
7901 |
+
if (cls.indexOf(' ') > -1) {
|
7902 |
+
cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
7903 |
+
} else {
|
7904 |
+
el.classList.remove(cls);
|
7905 |
+
}
|
7906 |
+
if (!el.classList.length) {
|
7907 |
+
el.removeAttribute('class');
|
7908 |
+
}
|
7909 |
+
} else {
|
7910 |
+
var cur = " " + (el.getAttribute('class') || '') + " ";
|
7911 |
+
var tar = ' ' + cls + ' ';
|
7912 |
+
while (cur.indexOf(tar) >= 0) {
|
7913 |
+
cur = cur.replace(tar, ' ');
|
7914 |
+
}
|
7915 |
+
cur = cur.trim();
|
7916 |
+
if (cur) {
|
7917 |
+
el.setAttribute('class', cur);
|
7918 |
+
} else {
|
7919 |
+
el.removeAttribute('class');
|
7920 |
+
}
|
7921 |
+
}
|
7922 |
+
}
|
7923 |
+
|
7924 |
+
/* */
|
7925 |
+
|
7926 |
+
function resolveTransition (def$$1) {
|
7927 |
+
if (!def$$1) {
|
7928 |
+
return
|
7929 |
+
}
|
7930 |
+
/* istanbul ignore else */
|
7931 |
+
if (typeof def$$1 === 'object') {
|
7932 |
+
var res = {};
|
7933 |
+
if (def$$1.css !== false) {
|
7934 |
+
extend(res, autoCssTransition(def$$1.name || 'v'));
|
7935 |
+
}
|
7936 |
+
extend(res, def$$1);
|
7937 |
+
return res
|
7938 |
+
} else if (typeof def$$1 === 'string') {
|
7939 |
+
return autoCssTransition(def$$1)
|
7940 |
+
}
|
7941 |
+
}
|
7942 |
+
|
7943 |
+
var autoCssTransition = cached(function (name) {
|
7944 |
+
return {
|
7945 |
+
enterClass: (name + "-enter"),
|
7946 |
+
enterToClass: (name + "-enter-to"),
|
7947 |
+
enterActiveClass: (name + "-enter-active"),
|
7948 |
+
leaveClass: (name + "-leave"),
|
7949 |
+
leaveToClass: (name + "-leave-to"),
|
7950 |
+
leaveActiveClass: (name + "-leave-active")
|
7951 |
+
}
|
7952 |
+
});
|
7953 |
+
|
7954 |
+
var hasTransition = inBrowser && !isIE9;
|
7955 |
+
var TRANSITION = 'transition';
|
7956 |
+
var ANIMATION = 'animation';
|
7957 |
+
|
7958 |
+
// Transition property/event sniffing
|
7959 |
+
var transitionProp = 'transition';
|
7960 |
+
var transitionEndEvent = 'transitionend';
|
7961 |
+
var animationProp = 'animation';
|
7962 |
+
var animationEndEvent = 'animationend';
|
7963 |
+
if (hasTransition) {
|
7964 |
+
/* istanbul ignore if */
|
7965 |
+
if (window.ontransitionend === undefined &&
|
7966 |
+
window.onwebkittransitionend !== undefined
|
7967 |
+
) {
|
7968 |
+
transitionProp = 'WebkitTransition';
|
7969 |
+
transitionEndEvent = 'webkitTransitionEnd';
|
7970 |
+
}
|
7971 |
+
if (window.onanimationend === undefined &&
|
7972 |
+
window.onwebkitanimationend !== undefined
|
7973 |
+
) {
|
7974 |
+
animationProp = 'WebkitAnimation';
|
7975 |
+
animationEndEvent = 'webkitAnimationEnd';
|
7976 |
+
}
|
7977 |
+
}
|
7978 |
+
|
7979 |
+
// binding to window is necessary to make hot reload work in IE in strict mode
|
7980 |
+
var raf = inBrowser
|
7981 |
+
? window.requestAnimationFrame
|
7982 |
+
? window.requestAnimationFrame.bind(window)
|
7983 |
+
: setTimeout
|
7984 |
+
: /* istanbul ignore next */ function (fn) { return fn(); };
|
7985 |
+
|
7986 |
+
function nextFrame (fn) {
|
7987 |
+
raf(function () {
|
7988 |
+
raf(fn);
|
7989 |
+
});
|
7990 |
+
}
|
7991 |
+
|
7992 |
+
function addTransitionClass (el, cls) {
|
7993 |
+
var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
7994 |
+
if (transitionClasses.indexOf(cls) < 0) {
|
7995 |
+
transitionClasses.push(cls);
|
7996 |
+
addClass(el, cls);
|
7997 |
+
}
|
7998 |
+
}
|
7999 |
+
|
8000 |
+
function removeTransitionClass (el, cls) {
|
8001 |
+
if (el._transitionClasses) {
|
8002 |
+
remove(el._transitionClasses, cls);
|
8003 |
+
}
|
8004 |
+
removeClass(el, cls);
|
8005 |
+
}
|
8006 |
+
|
8007 |
+
function whenTransitionEnds (
|
8008 |
+
el,
|
8009 |
+
expectedType,
|
8010 |
+
cb
|
8011 |
+
) {
|
8012 |
+
var ref = getTransitionInfo(el, expectedType);
|
8013 |
+
var type = ref.type;
|
8014 |
+
var timeout = ref.timeout;
|
8015 |
+
var propCount = ref.propCount;
|
8016 |
+
if (!type) { return cb() }
|
8017 |
+
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
8018 |
+
var ended = 0;
|
8019 |
+
var end = function () {
|
8020 |
+
el.removeEventListener(event, onEnd);
|
8021 |
+
cb();
|
8022 |
+
};
|
8023 |
+
var onEnd = function (e) {
|
8024 |
+
if (e.target === el) {
|
8025 |
+
if (++ended >= propCount) {
|
8026 |
+
end();
|
8027 |
+
}
|
8028 |
+
}
|
8029 |
+
};
|
8030 |
+
setTimeout(function () {
|
8031 |
+
if (ended < propCount) {
|
8032 |
+
end();
|
8033 |
+
}
|
8034 |
+
}, timeout + 1);
|
8035 |
+
el.addEventListener(event, onEnd);
|
8036 |
+
}
|
8037 |
+
|
8038 |
+
var transformRE = /\b(transform|all)(,|$)/;
|
8039 |
+
|
8040 |
+
function getTransitionInfo (el, expectedType) {
|
8041 |
+
var styles = window.getComputedStyle(el);
|
8042 |
+
// JSDOM may return undefined for transition properties
|
8043 |
+
var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
8044 |
+
var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
8045 |
+
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
8046 |
+
var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
8047 |
+
var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
8048 |
+
var animationTimeout = getTimeout(animationDelays, animationDurations);
|
8049 |
+
|
8050 |
+
var type;
|
8051 |
+
var timeout = 0;
|
8052 |
+
var propCount = 0;
|
8053 |
+
/* istanbul ignore if */
|
8054 |
+
if (expectedType === TRANSITION) {
|
8055 |
+
if (transitionTimeout > 0) {
|
8056 |
+
type = TRANSITION;
|
8057 |
+
timeout = transitionTimeout;
|
8058 |
+
propCount = transitionDurations.length;
|
8059 |
+
}
|
8060 |
+
} else if (expectedType === ANIMATION) {
|
8061 |
+
if (animationTimeout > 0) {
|
8062 |
+
type = ANIMATION;
|
8063 |
+
timeout = animationTimeout;
|
8064 |
+
propCount = animationDurations.length;
|
8065 |
+
}
|
8066 |
+
} else {
|
8067 |
+
timeout = Math.max(transitionTimeout, animationTimeout);
|
8068 |
+
type = timeout > 0
|
8069 |
+
? transitionTimeout > animationTimeout
|
8070 |
+
? TRANSITION
|
8071 |
+
: ANIMATION
|
8072 |
+
: null;
|
8073 |
+
propCount = type
|
8074 |
+
? type === TRANSITION
|
8075 |
+
? transitionDurations.length
|
8076 |
+
: animationDurations.length
|
8077 |
+
: 0;
|
8078 |
+
}
|
8079 |
+
var hasTransform =
|
8080 |
+
type === TRANSITION &&
|
8081 |
+
transformRE.test(styles[transitionProp + 'Property']);
|
8082 |
+
return {
|
8083 |
+
type: type,
|
8084 |
+
timeout: timeout,
|
8085 |
+
propCount: propCount,
|
8086 |
+
hasTransform: hasTransform
|
8087 |
+
}
|
8088 |
+
}
|
8089 |
+
|
8090 |
+
function getTimeout (delays, durations) {
|
8091 |
+
/* istanbul ignore next */
|
8092 |
+
while (delays.length < durations.length) {
|
8093 |
+
delays = delays.concat(delays);
|
8094 |
+
}
|
8095 |
+
|
8096 |
+
return Math.max.apply(null, durations.map(function (d, i) {
|
8097 |
+
return toMs(d) + toMs(delays[i])
|
8098 |
+
}))
|
8099 |
+
}
|
8100 |
+
|
8101 |
+
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
|
8102 |
+
// in a locale-dependent way, using a comma instead of a dot.
|
8103 |
+
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
|
8104 |
+
// as a floor function) causing unexpected behaviors
|
8105 |
+
function toMs (s) {
|
8106 |
+
return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
8107 |
+
}
|
8108 |
+
|
8109 |
+
/* */
|
8110 |
+
|
8111 |
+
function enter (vnode, toggleDisplay) {
|
8112 |
+
var el = vnode.elm;
|
8113 |
+
|
8114 |
+
// call leave callback now
|
8115 |
+
if (isDef(el._leaveCb)) {
|
8116 |
+
el._leaveCb.cancelled = true;
|
8117 |
+
el._leaveCb();
|
8118 |
+
}
|
8119 |
+
|
8120 |
+
var data = resolveTransition(vnode.data.transition);
|
8121 |
+
if (isUndef(data)) {
|
8122 |
+
return
|
8123 |
+
}
|
8124 |
+
|
8125 |
+
/* istanbul ignore if */
|
8126 |
+
if (isDef(el._enterCb) || el.nodeType !== 1) {
|
8127 |
+
return
|
8128 |
+
}
|
8129 |
+
|
8130 |
+
var css = data.css;
|
8131 |
+
var type = data.type;
|
8132 |
+
var enterClass = data.enterClass;
|
8133 |
+
var enterToClass = data.enterToClass;
|
8134 |
+
var enterActiveClass = data.enterActiveClass;
|
8135 |
+
var appearClass = data.appearClass;
|
8136 |
+
var appearToClass = data.appearToClass;
|
8137 |
+
var appearActiveClass = data.appearActiveClass;
|
8138 |
+
var beforeEnter = data.beforeEnter;
|
8139 |
+
var enter = data.enter;
|
8140 |
+
var afterEnter = data.afterEnter;
|
8141 |
+
var enterCancelled = data.enterCancelled;
|
8142 |
+
var beforeAppear = data.beforeAppear;
|
8143 |
+
var appear = data.appear;
|
8144 |
+
var afterAppear = data.afterAppear;
|
8145 |
+
var appearCancelled = data.appearCancelled;
|
8146 |
+
var duration = data.duration;
|
8147 |
+
|
8148 |
+
// activeInstance will always be the <transition> component managing this
|
8149 |
+
// transition. One edge case to check is when the <transition> is placed
|
8150 |
+
// as the root node of a child component. In that case we need to check
|
8151 |
+
// <transition>'s parent for appear check.
|
8152 |
+
var context = activeInstance;
|
8153 |
+
var transitionNode = activeInstance.$vnode;
|
8154 |
+
while (transitionNode && transitionNode.parent) {
|
8155 |
+
context = transitionNode.context;
|
8156 |
+
transitionNode = transitionNode.parent;
|
8157 |
+
}
|
8158 |
+
|
8159 |
+
var isAppear = !context._isMounted || !vnode.isRootInsert;
|
8160 |
+
|
8161 |
+
if (isAppear && !appear && appear !== '') {
|
8162 |
+
return
|
8163 |
+
}
|
8164 |
+
|
8165 |
+
var startClass = isAppear && appearClass
|
8166 |
+
? appearClass
|
8167 |
+
: enterClass;
|
8168 |
+
var activeClass = isAppear && appearActiveClass
|
8169 |
+
? appearActiveClass
|
8170 |
+
: enterActiveClass;
|
8171 |
+
var toClass = isAppear && appearToClass
|
8172 |
+
? appearToClass
|
8173 |
+
: enterToClass;
|
8174 |
+
|
8175 |
+
var beforeEnterHook = isAppear
|
8176 |
+
? (beforeAppear || beforeEnter)
|
8177 |
+
: beforeEnter;
|
8178 |
+
var enterHook = isAppear
|
8179 |
+
? (typeof appear === 'function' ? appear : enter)
|
8180 |
+
: enter;
|
8181 |
+
var afterEnterHook = isAppear
|
8182 |
+
? (afterAppear || afterEnter)
|
8183 |
+
: afterEnter;
|
8184 |
+
var enterCancelledHook = isAppear
|
8185 |
+
? (appearCancelled || enterCancelled)
|
8186 |
+
: enterCancelled;
|
8187 |
+
|
8188 |
+
var explicitEnterDuration = toNumber(
|
8189 |
+
isObject(duration)
|
8190 |
+
? duration.enter
|
8191 |
+
: duration
|
8192 |
+
);
|
8193 |
+
|
8194 |
+
if (explicitEnterDuration != null) {
|
8195 |
+
checkDuration(explicitEnterDuration, 'enter', vnode);
|
8196 |
+
}
|
8197 |
+
|
8198 |
+
var expectsCSS = css !== false && !isIE9;
|
8199 |
+
var userWantsControl = getHookArgumentsLength(enterHook);
|
8200 |
+
|
8201 |
+
var cb = el._enterCb = once(function () {
|
8202 |
+
if (expectsCSS) {
|
8203 |
+
removeTransitionClass(el, toClass);
|
8204 |
+
removeTransitionClass(el, activeClass);
|
8205 |
+
}
|
8206 |
+
if (cb.cancelled) {
|
8207 |
+
if (expectsCSS) {
|
8208 |
+
removeTransitionClass(el, startClass);
|
8209 |
+
}
|
8210 |
+
enterCancelledHook && enterCancelledHook(el);
|
8211 |
+
} else {
|
8212 |
+
afterEnterHook && afterEnterHook(el);
|
8213 |
+
}
|
8214 |
+
el._enterCb = null;
|
8215 |
+
});
|
8216 |
+
|
8217 |
+
if (!vnode.data.show) {
|
8218 |
+
// remove pending leave element on enter by injecting an insert hook
|
8219 |
+
mergeVNodeHook(vnode, 'insert', function () {
|
8220 |
+
var parent = el.parentNode;
|
8221 |
+
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
8222 |
+
if (pendingNode &&
|
8223 |
+
pendingNode.tag === vnode.tag &&
|
8224 |
+
pendingNode.elm._leaveCb
|
8225 |
+
) {
|
8226 |
+
pendingNode.elm._leaveCb();
|
8227 |
+
}
|
8228 |
+
enterHook && enterHook(el, cb);
|
8229 |
+
});
|
8230 |
+
}
|
8231 |
+
|
8232 |
+
// start enter transition
|
8233 |
+
beforeEnterHook && beforeEnterHook(el);
|
8234 |
+
if (expectsCSS) {
|
8235 |
+
addTransitionClass(el, startClass);
|
8236 |
+
addTransitionClass(el, activeClass);
|
8237 |
+
nextFrame(function () {
|
8238 |
+
removeTransitionClass(el, startClass);
|
8239 |
+
if (!cb.cancelled) {
|
8240 |
+
addTransitionClass(el, toClass);
|
8241 |
+
if (!userWantsControl) {
|
8242 |
+
if (isValidDuration(explicitEnterDuration)) {
|
8243 |
+
setTimeout(cb, explicitEnterDuration);
|
8244 |
+
} else {
|
8245 |
+
whenTransitionEnds(el, type, cb);
|
8246 |
+
}
|
8247 |
+
}
|
8248 |
+
}
|
8249 |
+
});
|
8250 |
+
}
|
8251 |
+
|
8252 |
+
if (vnode.data.show) {
|
8253 |
+
toggleDisplay && toggleDisplay();
|
8254 |
+
enterHook && enterHook(el, cb);
|
8255 |
+
}
|
8256 |
+
|
8257 |
+
if (!expectsCSS && !userWantsControl) {
|
8258 |
+
cb();
|
8259 |
+
}
|
8260 |
+
}
|
8261 |
+
|
8262 |
+
function leave (vnode, rm) {
|
8263 |
+
var el = vnode.elm;
|
8264 |
+
|
8265 |
+
// call enter callback now
|
8266 |
+
if (isDef(el._enterCb)) {
|
8267 |
+
el._enterCb.cancelled = true;
|
8268 |
+
el._enterCb();
|
8269 |
+
}
|
8270 |
+
|
8271 |
+
var data = resolveTransition(vnode.data.transition);
|
8272 |
+
if (isUndef(data) || el.nodeType !== 1) {
|
8273 |
+
return rm()
|
8274 |
+
}
|
8275 |
+
|
8276 |
+
/* istanbul ignore if */
|
8277 |
+
if (isDef(el._leaveCb)) {
|
8278 |
+
return
|
8279 |
+
}
|
8280 |
+
|
8281 |
+
var css = data.css;
|
8282 |
+
var type = data.type;
|
8283 |
+
var leaveClass = data.leaveClass;
|
8284 |
+
var leaveToClass = data.leaveToClass;
|
8285 |
+
var leaveActiveClass = data.leaveActiveClass;
|
8286 |
+
var beforeLeave = data.beforeLeave;
|
8287 |
+
var leave = data.leave;
|
8288 |
+
var afterLeave = data.afterLeave;
|
8289 |
+
var leaveCancelled = data.leaveCancelled;
|
8290 |
+
var delayLeave = data.delayLeave;
|
8291 |
+
var duration = data.duration;
|
8292 |
+
|
8293 |
+
var expectsCSS = css !== false && !isIE9;
|
8294 |
+
var userWantsControl = getHookArgumentsLength(leave);
|
8295 |
+
|
8296 |
+
var explicitLeaveDuration = toNumber(
|
8297 |
+
isObject(duration)
|
8298 |
+
? duration.leave
|
8299 |
+
: duration
|
8300 |
+
);
|
8301 |
+
|
8302 |
+
if (isDef(explicitLeaveDuration)) {
|
8303 |
+
checkDuration(explicitLeaveDuration, 'leave', vnode);
|
8304 |
+
}
|
8305 |
+
|
8306 |
+
var cb = el._leaveCb = once(function () {
|
8307 |
+
if (el.parentNode && el.parentNode._pending) {
|
8308 |
+
el.parentNode._pending[vnode.key] = null;
|
8309 |
+
}
|
8310 |
+
if (expectsCSS) {
|
8311 |
+
removeTransitionClass(el, leaveToClass);
|
8312 |
+
removeTransitionClass(el, leaveActiveClass);
|
8313 |
+
}
|
8314 |
+
if (cb.cancelled) {
|
8315 |
+
if (expectsCSS) {
|
8316 |
+
removeTransitionClass(el, leaveClass);
|
8317 |
+
}
|
8318 |
+
leaveCancelled && leaveCancelled(el);
|
8319 |
+
} else {
|
8320 |
+
rm();
|
8321 |
+
afterLeave && afterLeave(el);
|
8322 |
+
}
|
8323 |
+
el._leaveCb = null;
|
8324 |
+
});
|
8325 |
+
|
8326 |
+
if (delayLeave) {
|
8327 |
+
delayLeave(performLeave);
|
8328 |
+
} else {
|
8329 |
+
performLeave();
|
8330 |
+
}
|
8331 |
+
|
8332 |
+
function performLeave () {
|
8333 |
+
// the delayed leave may have already been cancelled
|
8334 |
+
if (cb.cancelled) {
|
8335 |
+
return
|
8336 |
+
}
|
8337 |
+
// record leaving element
|
8338 |
+
if (!vnode.data.show && el.parentNode) {
|
8339 |
+
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
8340 |
+
}
|
8341 |
+
beforeLeave && beforeLeave(el);
|
8342 |
+
if (expectsCSS) {
|
8343 |
+
addTransitionClass(el, leaveClass);
|
8344 |
+
addTransitionClass(el, leaveActiveClass);
|
8345 |
+
nextFrame(function () {
|
8346 |
+
removeTransitionClass(el, leaveClass);
|
8347 |
+
if (!cb.cancelled) {
|
8348 |
+
addTransitionClass(el, leaveToClass);
|
8349 |
+
if (!userWantsControl) {
|
8350 |
+
if (isValidDuration(explicitLeaveDuration)) {
|
8351 |
+
setTimeout(cb, explicitLeaveDuration);
|
8352 |
+
} else {
|
8353 |
+
whenTransitionEnds(el, type, cb);
|
8354 |
+
}
|
8355 |
+
}
|
8356 |
+
}
|
8357 |
+
});
|
8358 |
+
}
|
8359 |
+
leave && leave(el, cb);
|
8360 |
+
if (!expectsCSS && !userWantsControl) {
|
8361 |
+
cb();
|
8362 |
+
}
|
8363 |
+
}
|
8364 |
+
}
|
8365 |
+
|
8366 |
+
// only used in dev mode
|
8367 |
+
function checkDuration (val, name, vnode) {
|
8368 |
+
if (typeof val !== 'number') {
|
8369 |
+
warn(
|
8370 |
+
"<transition> explicit " + name + " duration is not a valid number - " +
|
8371 |
+
"got " + (JSON.stringify(val)) + ".",
|
8372 |
+
vnode.context
|
8373 |
+
);
|
8374 |
+
} else if (isNaN(val)) {
|
8375 |
+
warn(
|
8376 |
+
"<transition> explicit " + name + " duration is NaN - " +
|
8377 |
+
'the duration expression might be incorrect.',
|
8378 |
+
vnode.context
|
8379 |
+
);
|
8380 |
+
}
|
8381 |
+
}
|
8382 |
+
|
8383 |
+
function isValidDuration (val) {
|
8384 |
+
return typeof val === 'number' && !isNaN(val)
|
8385 |
+
}
|
8386 |
+
|
8387 |
+
/**
|
8388 |
+
* Normalize a transition hook's argument length. The hook may be:
|
8389 |
+
* - a merged hook (invoker) with the original in .fns
|
8390 |
+
* - a wrapped component method (check ._length)
|
8391 |
+
* - a plain function (.length)
|
8392 |
+
*/
|
8393 |
+
function getHookArgumentsLength (fn) {
|
8394 |
+
if (isUndef(fn)) {
|
8395 |
+
return false
|
8396 |
+
}
|
8397 |
+
var invokerFns = fn.fns;
|
8398 |
+
if (isDef(invokerFns)) {
|
8399 |
+
// invoker
|
8400 |
+
return getHookArgumentsLength(
|
8401 |
+
Array.isArray(invokerFns)
|
8402 |
+
? invokerFns[0]
|
8403 |
+
: invokerFns
|
8404 |
+
)
|
8405 |
+
} else {
|
8406 |
+
return (fn._length || fn.length) > 1
|
8407 |
+
}
|
8408 |
+
}
|
8409 |
+
|
8410 |
+
function _enter (_, vnode) {
|
8411 |
+
if (vnode.data.show !== true) {
|
8412 |
+
enter(vnode);
|
8413 |
+
}
|
8414 |
+
}
|
8415 |
+
|
8416 |
+
var transition = inBrowser ? {
|
8417 |
+
create: _enter,
|
8418 |
+
activate: _enter,
|
8419 |
+
remove: function remove$$1 (vnode, rm) {
|
8420 |
+
/* istanbul ignore else */
|
8421 |
+
if (vnode.data.show !== true) {
|
8422 |
+
leave(vnode, rm);
|
8423 |
+
} else {
|
8424 |
+
rm();
|
8425 |
+
}
|
8426 |
+
}
|
8427 |
+
} : {};
|
8428 |
+
|
8429 |
+
var platformModules = [
|
8430 |
+
attrs,
|
8431 |
+
klass,
|
8432 |
+
events,
|
8433 |
+
domProps,
|
8434 |
+
style,
|
8435 |
+
transition
|
8436 |
+
];
|
8437 |
+
|
8438 |
+
/* */
|
8439 |
+
|
8440 |
+
// the directive module should be applied last, after all
|
8441 |
+
// built-in modules have been applied.
|
8442 |
+
var modules = platformModules.concat(baseModules);
|
8443 |
+
|
8444 |
+
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
8445 |
+
|
8446 |
+
/**
|
8447 |
+
* Not type checking this file because flow doesn't like attaching
|
8448 |
+
* properties to Elements.
|
8449 |
+
*/
|
8450 |
+
|
8451 |
+
/* istanbul ignore if */
|
8452 |
+
if (isIE9) {
|
8453 |
+
// http://www.matts411.com/post/internet-explorer-9-oninput/
|
8454 |
+
document.addEventListener('selectionchange', function () {
|
8455 |
+
var el = document.activeElement;
|
8456 |
+
if (el && el.vmodel) {
|
8457 |
+
trigger(el, 'input');
|
8458 |
+
}
|
8459 |
+
});
|
8460 |
+
}
|
8461 |
+
|
8462 |
+
var directive = {
|
8463 |
+
inserted: function inserted (el, binding, vnode, oldVnode) {
|
8464 |
+
if (vnode.tag === 'select') {
|
8465 |
+
// #6903
|
8466 |
+
if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
8467 |
+
mergeVNodeHook(vnode, 'postpatch', function () {
|
8468 |
+
directive.componentUpdated(el, binding, vnode);
|
8469 |
+
});
|
8470 |
+
} else {
|
8471 |
+
setSelected(el, binding, vnode.context);
|
8472 |
+
}
|
8473 |
+
el._vOptions = [].map.call(el.options, getValue);
|
8474 |
+
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
8475 |
+
el._vModifiers = binding.modifiers;
|
8476 |
+
if (!binding.modifiers.lazy) {
|
8477 |
+
el.addEventListener('compositionstart', onCompositionStart);
|
8478 |
+
el.addEventListener('compositionend', onCompositionEnd);
|
8479 |
+
// Safari < 10.2 & UIWebView doesn't fire compositionend when
|
8480 |
+
// switching focus before confirming composition choice
|
8481 |
+
// this also fixes the issue where some browsers e.g. iOS Chrome
|
8482 |
+
// fires "change" instead of "input" on autocomplete.
|
8483 |
+
el.addEventListener('change', onCompositionEnd);
|
8484 |
+
/* istanbul ignore if */
|
8485 |
+
if (isIE9) {
|
8486 |
+
el.vmodel = true;
|
8487 |
+
}
|
8488 |
+
}
|
8489 |
+
}
|
8490 |
+
},
|
8491 |
+
|
8492 |
+
componentUpdated: function componentUpdated (el, binding, vnode) {
|
8493 |
+
if (vnode.tag === 'select') {
|
8494 |
+
setSelected(el, binding, vnode.context);
|
8495 |
+
// in case the options rendered by v-for have changed,
|
8496 |
+
// it's possible that the value is out-of-sync with the rendered options.
|
8497 |
+
// detect such cases and filter out values that no longer has a matching
|
8498 |
+
// option in the DOM.
|
8499 |
+
var prevOptions = el._vOptions;
|
8500 |
+
var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
8501 |
+
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
8502 |
+
// trigger change event if
|
8503 |
+
// no matching option found for at least one value
|
8504 |
+
var needReset = el.multiple
|
8505 |
+
? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
8506 |
+
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
8507 |
+
if (needReset) {
|
8508 |
+
trigger(el, 'change');
|
8509 |
+
}
|
8510 |
+
}
|
8511 |
+
}
|
8512 |
+
}
|
8513 |
+
};
|
8514 |
+
|
8515 |
+
function setSelected (el, binding, vm) {
|
8516 |
+
actuallySetSelected(el, binding, vm);
|
8517 |
+
/* istanbul ignore if */
|
8518 |
+
if (isIE || isEdge) {
|
8519 |
+
setTimeout(function () {
|
8520 |
+
actuallySetSelected(el, binding, vm);
|
8521 |
+
}, 0);
|
8522 |
+
}
|
8523 |
+
}
|
8524 |
+
|
8525 |
+
function actuallySetSelected (el, binding, vm) {
|
8526 |
+
var value = binding.value;
|
8527 |
+
var isMultiple = el.multiple;
|
8528 |
+
if (isMultiple && !Array.isArray(value)) {
|
8529 |
+
warn(
|
8530 |
+
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
8531 |
+
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
8532 |
+
vm
|
8533 |
+
);
|
8534 |
+
return
|
8535 |
+
}
|
8536 |
+
var selected, option;
|
8537 |
+
for (var i = 0, l = el.options.length; i < l; i++) {
|
8538 |
+
option = el.options[i];
|
8539 |
+
if (isMultiple) {
|
8540 |
+
selected = looseIndexOf(value, getValue(option)) > -1;
|
8541 |
+
if (option.selected !== selected) {
|
8542 |
+
option.selected = selected;
|
8543 |
+
}
|
8544 |
+
} else {
|
8545 |
+
if (looseEqual(getValue(option), value)) {
|
8546 |
+
if (el.selectedIndex !== i) {
|
8547 |
+
el.selectedIndex = i;
|
8548 |
+
}
|
8549 |
+
return
|
8550 |
+
}
|
8551 |
+
}
|
8552 |
+
}
|
8553 |
+
if (!isMultiple) {
|
8554 |
+
el.selectedIndex = -1;
|
8555 |
+
}
|
8556 |
+
}
|
8557 |
+
|
8558 |
+
function hasNoMatchingOption (value, options) {
|
8559 |
+
return options.every(function (o) { return !looseEqual(o, value); })
|
8560 |
+
}
|
8561 |
+
|
8562 |
+
function getValue (option) {
|
8563 |
+
return '_value' in option
|
8564 |
+
? option._value
|
8565 |
+
: option.value
|
8566 |
+
}
|
8567 |
+
|
8568 |
+
function onCompositionStart (e) {
|
8569 |
+
e.target.composing = true;
|
8570 |
+
}
|
8571 |
+
|
8572 |
+
function onCompositionEnd (e) {
|
8573 |
+
// prevent triggering an input event for no reason
|
8574 |
+
if (!e.target.composing) { return }
|
8575 |
+
e.target.composing = false;
|
8576 |
+
trigger(e.target, 'input');
|
8577 |
+
}
|
8578 |
+
|
8579 |
+
function trigger (el, type) {
|
8580 |
+
var e = document.createEvent('HTMLEvents');
|
8581 |
+
e.initEvent(type, true, true);
|
8582 |
+
el.dispatchEvent(e);
|
8583 |
+
}
|
8584 |
+
|
8585 |
+
/* */
|
8586 |
+
|
8587 |
+
// recursively search for possible transition defined inside the component root
|
8588 |
+
function locateNode (vnode) {
|
8589 |
+
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
8590 |
+
? locateNode(vnode.componentInstance._vnode)
|
8591 |
+
: vnode
|
8592 |
+
}
|
8593 |
+
|
8594 |
+
var show = {
|
8595 |
+
bind: function bind (el, ref, vnode) {
|
8596 |
+
var value = ref.value;
|
8597 |
+
|
8598 |
+
vnode = locateNode(vnode);
|
8599 |
+
var transition$$1 = vnode.data && vnode.data.transition;
|
8600 |
+
var originalDisplay = el.__vOriginalDisplay =
|
8601 |
+
el.style.display === 'none' ? '' : el.style.display;
|
8602 |
+
if (value && transition$$1) {
|
8603 |
+
vnode.data.show = true;
|
8604 |
+
enter(vnode, function () {
|
8605 |
+
el.style.display = originalDisplay;
|
8606 |
+
});
|
8607 |
+
} else {
|
8608 |
+
el.style.display = value ? originalDisplay : 'none';
|
8609 |
+
}
|
8610 |
+
},
|
8611 |
+
|
8612 |
+
update: function update (el, ref, vnode) {
|
8613 |
+
var value = ref.value;
|
8614 |
+
var oldValue = ref.oldValue;
|
8615 |
+
|
8616 |
+
/* istanbul ignore if */
|
8617 |
+
if (!value === !oldValue) { return }
|
8618 |
+
vnode = locateNode(vnode);
|
8619 |
+
var transition$$1 = vnode.data && vnode.data.transition;
|
8620 |
+
if (transition$$1) {
|
8621 |
+
vnode.data.show = true;
|
8622 |
+
if (value) {
|
8623 |
+
enter(vnode, function () {
|
8624 |
+
el.style.display = el.__vOriginalDisplay;
|
8625 |
+
});
|
8626 |
+
} else {
|
8627 |
+
leave(vnode, function () {
|
8628 |
+
el.style.display = 'none';
|
8629 |
+
});
|
8630 |
+
}
|
8631 |
+
} else {
|
8632 |
+
el.style.display = value ? el.__vOriginalDisplay : 'none';
|
8633 |
+
}
|
8634 |
+
},
|
8635 |
+
|
8636 |
+
unbind: function unbind (
|
8637 |
+
el,
|
8638 |
+
binding,
|
8639 |
+
vnode,
|
8640 |
+
oldVnode,
|
8641 |
+
isDestroy
|
8642 |
+
) {
|
8643 |
+
if (!isDestroy) {
|
8644 |
+
el.style.display = el.__vOriginalDisplay;
|
8645 |
+
}
|
8646 |
+
}
|
8647 |
+
};
|
8648 |
+
|
8649 |
+
var platformDirectives = {
|
8650 |
+
model: directive,
|
8651 |
+
show: show
|
8652 |
+
};
|
8653 |
+
|
8654 |
+
/* */
|
8655 |
+
|
8656 |
+
var transitionProps = {
|
8657 |
+
name: String,
|
8658 |
+
appear: Boolean,
|
8659 |
+
css: Boolean,
|
8660 |
+
mode: String,
|
8661 |
+
type: String,
|
8662 |
+
enterClass: String,
|
8663 |
+
leaveClass: String,
|
8664 |
+
enterToClass: String,
|
8665 |
+
leaveToClass: String,
|
8666 |
+
enterActiveClass: String,
|
8667 |
+
leaveActiveClass: String,
|
8668 |
+
appearClass: String,
|
8669 |
+
appearActiveClass: String,
|
8670 |
+
appearToClass: String,
|
8671 |
+
duration: [Number, String, Object]
|
8672 |
+
};
|
8673 |
+
|
8674 |
+
// in case the child is also an abstract component, e.g. <keep-alive>
|
8675 |
+
// we want to recursively retrieve the real component to be rendered
|
8676 |
+
function getRealChild (vnode) {
|
8677 |
+
var compOptions = vnode && vnode.componentOptions;
|
8678 |
+
if (compOptions && compOptions.Ctor.options.abstract) {
|
8679 |
+
return getRealChild(getFirstComponentChild(compOptions.children))
|
8680 |
+
} else {
|
8681 |
+
return vnode
|
8682 |
+
}
|
8683 |
+
}
|
8684 |
+
|
8685 |
+
function extractTransitionData (comp) {
|
8686 |
+
var data = {};
|
8687 |
+
var options = comp.$options;
|
8688 |
+
// props
|
8689 |
+
for (var key in options.propsData) {
|
8690 |
+
data[key] = comp[key];
|
8691 |
+
}
|
8692 |
+
// events.
|
8693 |
+
// extract listeners and pass them directly to the transition methods
|
8694 |
+
var listeners = options._parentListeners;
|
8695 |
+
for (var key$1 in listeners) {
|
8696 |
+
data[camelize(key$1)] = listeners[key$1];
|
8697 |
+
}
|
8698 |
+
return data
|
8699 |
+
}
|
8700 |
+
|
8701 |
+
function placeholder (h, rawChild) {
|
8702 |
+
if (/\d-keep-alive$/.test(rawChild.tag)) {
|
8703 |
+
return h('keep-alive', {
|
8704 |
+
props: rawChild.componentOptions.propsData
|
8705 |
+
})
|
8706 |
+
}
|
8707 |
+
}
|
8708 |
+
|
8709 |
+
function hasParentTransition (vnode) {
|
8710 |
+
while ((vnode = vnode.parent)) {
|
8711 |
+
if (vnode.data.transition) {
|
8712 |
+
return true
|
8713 |
+
}
|
8714 |
+
}
|
8715 |
+
}
|
8716 |
+
|
8717 |
+
function isSameChild (child, oldChild) {
|
8718 |
+
return oldChild.key === child.key && oldChild.tag === child.tag
|
8719 |
+
}
|
8720 |
+
|
8721 |
+
var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
8722 |
+
|
8723 |
+
var isVShowDirective = function (d) { return d.name === 'show'; };
|
8724 |
+
|
8725 |
+
var Transition = {
|
8726 |
+
name: 'transition',
|
8727 |
+
props: transitionProps,
|
8728 |
+
abstract: true,
|
8729 |
+
|
8730 |
+
render: function render (h) {
|
8731 |
+
var this$1 = this;
|
8732 |
+
|
8733 |
+
var children = this.$slots.default;
|
8734 |
+
if (!children) {
|
8735 |
+
return
|
8736 |
+
}
|
8737 |
+
|
8738 |
+
// filter out text nodes (possible whitespaces)
|
8739 |
+
children = children.filter(isNotTextNode);
|
8740 |
+
/* istanbul ignore if */
|
8741 |
+
if (!children.length) {
|
8742 |
+
return
|
8743 |
+
}
|
8744 |
+
|
8745 |
+
// warn multiple elements
|
8746 |
+
if (children.length > 1) {
|
8747 |
+
warn(
|
8748 |
+
'<transition> can only be used on a single element. Use ' +
|
8749 |
+
'<transition-group> for lists.',
|
8750 |
+
this.$parent
|
8751 |
+
);
|
8752 |
+
}
|
8753 |
+
|
8754 |
+
var mode = this.mode;
|
8755 |
+
|
8756 |
+
// warn invalid mode
|
8757 |
+
if (mode && mode !== 'in-out' && mode !== 'out-in'
|
8758 |
+
) {
|
8759 |
+
warn(
|
8760 |
+
'invalid <transition> mode: ' + mode,
|
8761 |
+
this.$parent
|
8762 |
+
);
|
8763 |
+
}
|
8764 |
+
|
8765 |
+
var rawChild = children[0];
|
8766 |
+
|
8767 |
+
// if this is a component root node and the component's
|
8768 |
+
// parent container node also has transition, skip.
|
8769 |
+
if (hasParentTransition(this.$vnode)) {
|
8770 |
+
return rawChild
|
8771 |
+
}
|
8772 |
+
|
8773 |
+
// apply transition data to child
|
8774 |
+
// use getRealChild() to ignore abstract components e.g. keep-alive
|
8775 |
+
var child = getRealChild(rawChild);
|
8776 |
+
/* istanbul ignore if */
|
8777 |
+
if (!child) {
|
8778 |
+
return rawChild
|
8779 |
+
}
|
8780 |
+
|
8781 |
+
if (this._leaving) {
|
8782 |
+
return placeholder(h, rawChild)
|
8783 |
+
}
|
8784 |
+
|
8785 |
+
// ensure a key that is unique to the vnode type and to this transition
|
8786 |
+
// component instance. This key will be used to remove pending leaving nodes
|
8787 |
+
// during entering.
|
8788 |
+
var id = "__transition-" + (this._uid) + "-";
|
8789 |
+
child.key = child.key == null
|
8790 |
+
? child.isComment
|
8791 |
+
? id + 'comment'
|
8792 |
+
: id + child.tag
|
8793 |
+
: isPrimitive(child.key)
|
8794 |
+
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
8795 |
+
: child.key;
|
8796 |
+
|
8797 |
+
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
8798 |
+
var oldRawChild = this._vnode;
|
8799 |
+
var oldChild = getRealChild(oldRawChild);
|
8800 |
+
|
8801 |
+
// mark v-show
|
8802 |
+
// so that the transition module can hand over the control to the directive
|
8803 |
+
if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
8804 |
+
child.data.show = true;
|
8805 |
+
}
|
8806 |
+
|
8807 |
+
if (
|
8808 |
+
oldChild &&
|
8809 |
+
oldChild.data &&
|
8810 |
+
!isSameChild(child, oldChild) &&
|
8811 |
+
!isAsyncPlaceholder(oldChild) &&
|
8812 |
+
// #6687 component root is a comment node
|
8813 |
+
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
8814 |
+
) {
|
8815 |
+
// replace old child transition data with fresh one
|
8816 |
+
// important for dynamic transitions!
|
8817 |
+
var oldData = oldChild.data.transition = extend({}, data);
|
8818 |
+
// handle transition mode
|
8819 |
+
if (mode === 'out-in') {
|
8820 |
+
// return placeholder node and queue update when leave finishes
|
8821 |
+
this._leaving = true;
|
8822 |
+
mergeVNodeHook(oldData, 'afterLeave', function () {
|
8823 |
+
this$1._leaving = false;
|
8824 |
+
this$1.$forceUpdate();
|
8825 |
+
});
|
8826 |
+
return placeholder(h, rawChild)
|
8827 |
+
} else if (mode === 'in-out') {
|
8828 |
+
if (isAsyncPlaceholder(child)) {
|
8829 |
+
return oldRawChild
|
8830 |
+
}
|
8831 |
+
var delayedLeave;
|
8832 |
+
var performLeave = function () { delayedLeave(); };
|
8833 |
+
mergeVNodeHook(data, 'afterEnter', performLeave);
|
8834 |
+
mergeVNodeHook(data, 'enterCancelled', performLeave);
|
8835 |
+
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
8836 |
+
}
|
8837 |
+
}
|
8838 |
+
|
8839 |
+
return rawChild
|
8840 |
+
}
|
8841 |
+
};
|
8842 |
+
|
8843 |
+
/* */
|
8844 |
+
|
8845 |
+
var props = extend({
|
8846 |
+
tag: String,
|
8847 |
+
moveClass: String
|
8848 |
+
}, transitionProps);
|
8849 |
+
|
8850 |
+
delete props.mode;
|
8851 |
+
|
8852 |
+
var TransitionGroup = {
|
8853 |
+
props: props,
|
8854 |
+
|
8855 |
+
beforeMount: function beforeMount () {
|
8856 |
+
var this$1 = this;
|
8857 |
+
|
8858 |
+
var update = this._update;
|
8859 |
+
this._update = function (vnode, hydrating) {
|
8860 |
+
var restoreActiveInstance = setActiveInstance(this$1);
|
8861 |
+
// force removing pass
|
8862 |
+
this$1.__patch__(
|
8863 |
+
this$1._vnode,
|
8864 |
+
this$1.kept,
|
8865 |
+
false, // hydrating
|
8866 |
+
true // removeOnly (!important, avoids unnecessary moves)
|
8867 |
+
);
|
8868 |
+
this$1._vnode = this$1.kept;
|
8869 |
+
restoreActiveInstance();
|
8870 |
+
update.call(this$1, vnode, hydrating);
|
8871 |
+
};
|
8872 |
+
},
|
8873 |
+
|
8874 |
+
render: function render (h) {
|
8875 |
+
var tag = this.tag || this.$vnode.data.tag || 'span';
|
8876 |
+
var map = Object.create(null);
|
8877 |
+
var prevChildren = this.prevChildren = this.children;
|
8878 |
+
var rawChildren = this.$slots.default || [];
|
8879 |
+
var children = this.children = [];
|
8880 |
+
var transitionData = extractTransitionData(this);
|
8881 |
+
|
8882 |
+
for (var i = 0; i < rawChildren.length; i++) {
|
8883 |
+
var c = rawChildren[i];
|
8884 |
+
if (c.tag) {
|
8885 |
+
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
8886 |
+
children.push(c);
|
8887 |
+
map[c.key] = c
|
8888 |
+
;(c.data || (c.data = {})).transition = transitionData;
|
8889 |
+
} else {
|
8890 |
+
var opts = c.componentOptions;
|
8891 |
+
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
8892 |
+
warn(("<transition-group> children must be keyed: <" + name + ">"));
|
8893 |
+
}
|
8894 |
+
}
|
8895 |
+
}
|
8896 |
+
|
8897 |
+
if (prevChildren) {
|
8898 |
+
var kept = [];
|
8899 |
+
var removed = [];
|
8900 |
+
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
8901 |
+
var c$1 = prevChildren[i$1];
|
8902 |
+
c$1.data.transition = transitionData;
|
8903 |
+
c$1.data.pos = c$1.elm.getBoundingClientRect();
|
8904 |
+
if (map[c$1.key]) {
|
8905 |
+
kept.push(c$1);
|
8906 |
+
} else {
|
8907 |
+
removed.push(c$1);
|
8908 |
+
}
|
8909 |
+
}
|
8910 |
+
this.kept = h(tag, null, kept);
|
8911 |
+
this.removed = removed;
|
8912 |
+
}
|
8913 |
+
|
8914 |
+
return h(tag, null, children)
|
8915 |
+
},
|
8916 |
+
|
8917 |
+
updated: function updated () {
|
8918 |
+
var children = this.prevChildren;
|
8919 |
+
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
8920 |
+
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
8921 |
+
return
|
8922 |
+
}
|
8923 |
+
|
8924 |
+
// we divide the work into three loops to avoid mixing DOM reads and writes
|
8925 |
+
// in each iteration - which helps prevent layout thrashing.
|
8926 |
+
children.forEach(callPendingCbs);
|
8927 |
+
children.forEach(recordPosition);
|
8928 |
+
children.forEach(applyTranslation);
|
8929 |
+
|
8930 |
+
// force reflow to put everything in position
|
8931 |
+
// assign to this to avoid being removed in tree-shaking
|
8932 |
+
// $flow-disable-line
|
8933 |
+
this._reflow = document.body.offsetHeight;
|
8934 |
+
|
8935 |
+
children.forEach(function (c) {
|
8936 |
+
if (c.data.moved) {
|
8937 |
+
var el = c.elm;
|
8938 |
+
var s = el.style;
|
8939 |
+
addTransitionClass(el, moveClass);
|
8940 |
+
s.transform = s.WebkitTransform = s.transitionDuration = '';
|
8941 |
+
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
8942 |
+
if (e && e.target !== el) {
|
8943 |
+
return
|
8944 |
+
}
|
8945 |
+
if (!e || /transform$/.test(e.propertyName)) {
|
8946 |
+
el.removeEventListener(transitionEndEvent, cb);
|
8947 |
+
el._moveCb = null;
|
8948 |
+
removeTransitionClass(el, moveClass);
|
8949 |
+
}
|
8950 |
+
});
|
8951 |
+
}
|
8952 |
+
});
|
8953 |
+
},
|
8954 |
+
|
8955 |
+
methods: {
|
8956 |
+
hasMove: function hasMove (el, moveClass) {
|
8957 |
+
/* istanbul ignore if */
|
8958 |
+
if (!hasTransition) {
|
8959 |
+
return false
|
8960 |
+
}
|
8961 |
+
/* istanbul ignore if */
|
8962 |
+
if (this._hasMove) {
|
8963 |
+
return this._hasMove
|
8964 |
+
}
|
8965 |
+
// Detect whether an element with the move class applied has
|
8966 |
+
// CSS transitions. Since the element may be inside an entering
|
8967 |
+
// transition at this very moment, we make a clone of it and remove
|
8968 |
+
// all other transition classes applied to ensure only the move class
|
8969 |
+
// is applied.
|
8970 |
+
var clone = el.cloneNode();
|
8971 |
+
if (el._transitionClasses) {
|
8972 |
+
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
8973 |
+
}
|
8974 |
+
addClass(clone, moveClass);
|
8975 |
+
clone.style.display = 'none';
|
8976 |
+
this.$el.appendChild(clone);
|
8977 |
+
var info = getTransitionInfo(clone);
|
8978 |
+
this.$el.removeChild(clone);
|
8979 |
+
return (this._hasMove = info.hasTransform)
|
8980 |
+
}
|
8981 |
+
}
|
8982 |
+
};
|
8983 |
+
|
8984 |
+
function callPendingCbs (c) {
|
8985 |
+
/* istanbul ignore if */
|
8986 |
+
if (c.elm._moveCb) {
|
8987 |
+
c.elm._moveCb();
|
8988 |
+
}
|
8989 |
+
/* istanbul ignore if */
|
8990 |
+
if (c.elm._enterCb) {
|
8991 |
+
c.elm._enterCb();
|
8992 |
+
}
|
8993 |
+
}
|
8994 |
+
|
8995 |
+
function recordPosition (c) {
|
8996 |
+
c.data.newPos = c.elm.getBoundingClientRect();
|
8997 |
+
}
|
8998 |
+
|
8999 |
+
function applyTranslation (c) {
|
9000 |
+
var oldPos = c.data.pos;
|
9001 |
+
var newPos = c.data.newPos;
|
9002 |
+
var dx = oldPos.left - newPos.left;
|
9003 |
+
var dy = oldPos.top - newPos.top;
|
9004 |
+
if (dx || dy) {
|
9005 |
+
c.data.moved = true;
|
9006 |
+
var s = c.elm.style;
|
9007 |
+
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
9008 |
+
s.transitionDuration = '0s';
|
9009 |
+
}
|
9010 |
+
}
|
9011 |
+
|
9012 |
+
var platformComponents = {
|
9013 |
+
Transition: Transition,
|
9014 |
+
TransitionGroup: TransitionGroup
|
9015 |
+
};
|
9016 |
+
|
9017 |
+
/* */
|
9018 |
+
|
9019 |
+
// install platform specific utils
|
9020 |
+
Vue.config.mustUseProp = mustUseProp;
|
9021 |
+
Vue.config.isReservedTag = isReservedTag;
|
9022 |
+
Vue.config.isReservedAttr = isReservedAttr;
|
9023 |
+
Vue.config.getTagNamespace = getTagNamespace;
|
9024 |
+
Vue.config.isUnknownElement = isUnknownElement;
|
9025 |
+
|
9026 |
+
// install platform runtime directives & components
|
9027 |
+
extend(Vue.options.directives, platformDirectives);
|
9028 |
+
extend(Vue.options.components, platformComponents);
|
9029 |
+
|
9030 |
+
// install platform patch function
|
9031 |
+
Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
9032 |
+
|
9033 |
+
// public mount method
|
9034 |
+
Vue.prototype.$mount = function (
|
9035 |
+
el,
|
9036 |
+
hydrating
|
9037 |
+
) {
|
9038 |
+
el = el && inBrowser ? query(el) : undefined;
|
9039 |
+
return mountComponent(this, el, hydrating)
|
9040 |
+
};
|
9041 |
+
|
9042 |
+
// devtools global hook
|
9043 |
+
/* istanbul ignore next */
|
9044 |
+
if (inBrowser) {
|
9045 |
+
setTimeout(function () {
|
9046 |
+
if (config.devtools) {
|
9047 |
+
if (devtools) {
|
9048 |
+
devtools.emit('init', Vue);
|
9049 |
+
} else {
|
9050 |
+
console[console.info ? 'info' : 'log'](
|
9051 |
+
'Download the Vue Devtools extension for a better development experience:\n' +
|
9052 |
+
'https://github.com/vuejs/vue-devtools'
|
9053 |
+
);
|
9054 |
+
}
|
9055 |
+
}
|
9056 |
+
if (config.productionTip !== false &&
|
9057 |
+
typeof console !== 'undefined'
|
9058 |
+
) {
|
9059 |
+
console[console.info ? 'info' : 'log'](
|
9060 |
+
"You are running Vue in development mode.\n" +
|
9061 |
+
"Make sure to turn on production mode when deploying for production.\n" +
|
9062 |
+
"See more tips at https://vuejs.org/guide/deployment.html"
|
9063 |
+
);
|
9064 |
+
}
|
9065 |
+
}, 0);
|
9066 |
+
}
|
9067 |
+
|
9068 |
+
/* */
|
9069 |
+
|
9070 |
+
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
9071 |
+
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
9072 |
+
|
9073 |
+
var buildRegex = cached(function (delimiters) {
|
9074 |
+
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
9075 |
+
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
9076 |
+
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
9077 |
+
});
|
9078 |
+
|
9079 |
+
|
9080 |
+
|
9081 |
+
function parseText (
|
9082 |
+
text,
|
9083 |
+
delimiters
|
9084 |
+
) {
|
9085 |
+
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
9086 |
+
if (!tagRE.test(text)) {
|
9087 |
+
return
|
9088 |
+
}
|
9089 |
+
var tokens = [];
|
9090 |
+
var rawTokens = [];
|
9091 |
+
var lastIndex = tagRE.lastIndex = 0;
|
9092 |
+
var match, index, tokenValue;
|
9093 |
+
while ((match = tagRE.exec(text))) {
|
9094 |
+
index = match.index;
|
9095 |
+
// push text token
|
9096 |
+
if (index > lastIndex) {
|
9097 |
+
rawTokens.push(tokenValue = text.slice(lastIndex, index));
|
9098 |
+
tokens.push(JSON.stringify(tokenValue));
|
9099 |
+
}
|
9100 |
+
// tag token
|
9101 |
+
var exp = parseFilters(match[1].trim());
|
9102 |
+
tokens.push(("_s(" + exp + ")"));
|
9103 |
+
rawTokens.push({ '@binding': exp });
|
9104 |
+
lastIndex = index + match[0].length;
|
9105 |
+
}
|
9106 |
+
if (lastIndex < text.length) {
|
9107 |
+
rawTokens.push(tokenValue = text.slice(lastIndex));
|
9108 |
+
tokens.push(JSON.stringify(tokenValue));
|
9109 |
+
}
|
9110 |
+
return {
|
9111 |
+
expression: tokens.join('+'),
|
9112 |
+
tokens: rawTokens
|
9113 |
+
}
|
9114 |
+
}
|
9115 |
+
|
9116 |
+
/* */
|
9117 |
+
|
9118 |
+
function transformNode (el, options) {
|
9119 |
+
var warn = options.warn || baseWarn;
|
9120 |
+
var staticClass = getAndRemoveAttr(el, 'class');
|
9121 |
+
if (staticClass) {
|
9122 |
+
var res = parseText(staticClass, options.delimiters);
|
9123 |
+
if (res) {
|
9124 |
+
warn(
|
9125 |
+
"class=\"" + staticClass + "\": " +
|
9126 |
+
'Interpolation inside attributes has been removed. ' +
|
9127 |
+
'Use v-bind or the colon shorthand instead. For example, ' +
|
9128 |
+
'instead of <div class="{{ val }}">, use <div :class="val">.',
|
9129 |
+
el.rawAttrsMap['class']
|
9130 |
+
);
|
9131 |
+
}
|
9132 |
+
}
|
9133 |
+
if (staticClass) {
|
9134 |
+
el.staticClass = JSON.stringify(staticClass);
|
9135 |
+
}
|
9136 |
+
var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
|
9137 |
+
if (classBinding) {
|
9138 |
+
el.classBinding = classBinding;
|
9139 |
+
}
|
9140 |
+
}
|
9141 |
+
|
9142 |
+
function genData (el) {
|
9143 |
+
var data = '';
|
9144 |
+
if (el.staticClass) {
|
9145 |
+
data += "staticClass:" + (el.staticClass) + ",";
|
9146 |
+
}
|
9147 |
+
if (el.classBinding) {
|
9148 |
+
data += "class:" + (el.classBinding) + ",";
|
9149 |
+
}
|
9150 |
+
return data
|
9151 |
+
}
|
9152 |
+
|
9153 |
+
var klass$1 = {
|
9154 |
+
staticKeys: ['staticClass'],
|
9155 |
+
transformNode: transformNode,
|
9156 |
+
genData: genData
|
9157 |
+
};
|
9158 |
+
|
9159 |
+
/* */
|
9160 |
+
|
9161 |
+
function transformNode$1 (el, options) {
|
9162 |
+
var warn = options.warn || baseWarn;
|
9163 |
+
var staticStyle = getAndRemoveAttr(el, 'style');
|
9164 |
+
if (staticStyle) {
|
9165 |
+
/* istanbul ignore if */
|
9166 |
+
{
|
9167 |
+
var res = parseText(staticStyle, options.delimiters);
|
9168 |
+
if (res) {
|
9169 |
+
warn(
|
9170 |
+
"style=\"" + staticStyle + "\": " +
|
9171 |
+
'Interpolation inside attributes has been removed. ' +
|
9172 |
+
'Use v-bind or the colon shorthand instead. For example, ' +
|
9173 |
+
'instead of <div style="{{ val }}">, use <div :style="val">.',
|
9174 |
+
el.rawAttrsMap['style']
|
9175 |
+
);
|
9176 |
+
}
|
9177 |
+
}
|
9178 |
+
el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
9179 |
+
}
|
9180 |
+
|
9181 |
+
var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
|
9182 |
+
if (styleBinding) {
|
9183 |
+
el.styleBinding = styleBinding;
|
9184 |
+
}
|
9185 |
+
}
|
9186 |
+
|
9187 |
+
function genData$1 (el) {
|
9188 |
+
var data = '';
|
9189 |
+
if (el.staticStyle) {
|
9190 |
+
data += "staticStyle:" + (el.staticStyle) + ",";
|
9191 |
+
}
|
9192 |
+
if (el.styleBinding) {
|
9193 |
+
data += "style:(" + (el.styleBinding) + "),";
|
9194 |
+
}
|
9195 |
+
return data
|
9196 |
+
}
|
9197 |
+
|
9198 |
+
var style$1 = {
|
9199 |
+
staticKeys: ['staticStyle'],
|
9200 |
+
transformNode: transformNode$1,
|
9201 |
+
genData: genData$1
|
9202 |
+
};
|
9203 |
+
|
9204 |
+
/* */
|
9205 |
+
|
9206 |
+
var decoder;
|
9207 |
+
|
9208 |
+
var he = {
|
9209 |
+
decode: function decode (html) {
|
9210 |
+
decoder = decoder || document.createElement('div');
|
9211 |
+
decoder.innerHTML = html;
|
9212 |
+
return decoder.textContent
|
9213 |
+
}
|
9214 |
+
};
|
9215 |
+
|
9216 |
+
/* */
|
9217 |
+
|
9218 |
+
var isUnaryTag = makeMap(
|
9219 |
+
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
9220 |
+
'link,meta,param,source,track,wbr'
|
9221 |
+
);
|
9222 |
+
|
9223 |
+
// Elements that you can, intentionally, leave open
|
9224 |
+
// (and which close themselves)
|
9225 |
+
var canBeLeftOpenTag = makeMap(
|
9226 |
+
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
9227 |
+
);
|
9228 |
+
|
9229 |
+
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
9230 |
+
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
9231 |
+
var isNonPhrasingTag = makeMap(
|
9232 |
+
'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
9233 |
+
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
9234 |
+
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
9235 |
+
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
9236 |
+
'title,tr,track'
|
9237 |
+
);
|
9238 |
+
|
9239 |
+
/**
|
9240 |
+
* Not type-checking this file because it's mostly vendor code.
|
9241 |
+
*/
|
9242 |
+
|
9243 |
+
// Regular Expressions for parsing tags and attributes
|
9244 |
+
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9245 |
+
var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9246 |
+
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
|
9247 |
+
var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
9248 |
+
var startTagOpen = new RegExp(("^<" + qnameCapture));
|
9249 |
+
var startTagClose = /^\s*(\/?)>/;
|
9250 |
+
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
9251 |
+
var doctype = /^<!DOCTYPE [^>]+>/i;
|
9252 |
+
// #7298: escape - to avoid being pased as HTML comment when inlined in page
|
9253 |
+
var comment = /^<!\--/;
|
9254 |
+
var conditionalComment = /^<!\[/;
|
9255 |
+
|
9256 |
+
// Special Elements (can contain anything)
|
9257 |
+
var isPlainTextElement = makeMap('script,style,textarea', true);
|
9258 |
+
var reCache = {};
|
9259 |
+
|
9260 |
+
var decodingMap = {
|
9261 |
+
'<': '<',
|
9262 |
+
'>': '>',
|
9263 |
+
'"': '"',
|
9264 |
+
'&': '&',
|
9265 |
+
' ': '\n',
|
9266 |
+
'	': '\t',
|
9267 |
+
''': "'"
|
9268 |
+
};
|
9269 |
+
var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
|
9270 |
+
var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
|
9271 |
+
|
9272 |
+
// #5992
|
9273 |
+
var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
9274 |
+
var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
|
9275 |
+
|
9276 |
+
function decodeAttr (value, shouldDecodeNewlines) {
|
9277 |
+
var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
9278 |
+
return value.replace(re, function (match) { return decodingMap[match]; })
|
9279 |
+
}
|
9280 |
+
|
9281 |
+
function parseHTML (html, options) {
|
9282 |
+
var stack = [];
|
9283 |
+
var expectHTML = options.expectHTML;
|
9284 |
+
var isUnaryTag$$1 = options.isUnaryTag || no;
|
9285 |
+
var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
9286 |
+
var index = 0;
|
9287 |
+
var last, lastTag;
|
9288 |
+
while (html) {
|
9289 |
+
last = html;
|
9290 |
+
// Make sure we're not in a plaintext content element like script/style
|
9291 |
+
if (!lastTag || !isPlainTextElement(lastTag)) {
|
9292 |
+
var textEnd = html.indexOf('<');
|
9293 |
+
if (textEnd === 0) {
|
9294 |
+
// Comment:
|
9295 |
+
if (comment.test(html)) {
|
9296 |
+
var commentEnd = html.indexOf('-->');
|
9297 |
+
|
9298 |
+
if (commentEnd >= 0) {
|
9299 |
+
if (options.shouldKeepComment) {
|
9300 |
+
options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
9301 |
+
}
|
9302 |
+
advance(commentEnd + 3);
|
9303 |
+
continue
|
9304 |
+
}
|
9305 |
+
}
|
9306 |
+
|
9307 |
+
// http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
|
9308 |
+
if (conditionalComment.test(html)) {
|
9309 |
+
var conditionalEnd = html.indexOf(']>');
|
9310 |
+
|
9311 |
+
if (conditionalEnd >= 0) {
|
9312 |
+
advance(conditionalEnd + 2);
|
9313 |
+
continue
|
9314 |
+
}
|
9315 |
+
}
|
9316 |
+
|
9317 |
+
// Doctype:
|
9318 |
+
var doctypeMatch = html.match(doctype);
|
9319 |
+
if (doctypeMatch) {
|
9320 |
+
advance(doctypeMatch[0].length);
|
9321 |
+
continue
|
9322 |
+
}
|
9323 |
+
|
9324 |
+
// End tag:
|
9325 |
+
var endTagMatch = html.match(endTag);
|
9326 |
+
if (endTagMatch) {
|
9327 |
+
var curIndex = index;
|
9328 |
+
advance(endTagMatch[0].length);
|
9329 |
+
parseEndTag(endTagMatch[1], curIndex, index);
|
9330 |
+
continue
|
9331 |
+
}
|
9332 |
+
|
9333 |
+
// Start tag:
|
9334 |
+
var startTagMatch = parseStartTag();
|
9335 |
+
if (startTagMatch) {
|
9336 |
+
handleStartTag(startTagMatch);
|
9337 |
+
if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
9338 |
+
advance(1);
|
9339 |
+
}
|
9340 |
+
continue
|
9341 |
+
}
|
9342 |
+
}
|
9343 |
+
|
9344 |
+
var text = (void 0), rest = (void 0), next = (void 0);
|
9345 |
+
if (textEnd >= 0) {
|
9346 |
+
rest = html.slice(textEnd);
|
9347 |
+
while (
|
9348 |
+
!endTag.test(rest) &&
|
9349 |
+
!startTagOpen.test(rest) &&
|
9350 |
+
!comment.test(rest) &&
|
9351 |
+
!conditionalComment.test(rest)
|
9352 |
+
) {
|
9353 |
+
// < in plain text, be forgiving and treat it as text
|
9354 |
+
next = rest.indexOf('<', 1);
|
9355 |
+
if (next < 0) { break }
|
9356 |
+
textEnd += next;
|
9357 |
+
rest = html.slice(textEnd);
|
9358 |
+
}
|
9359 |
+
text = html.substring(0, textEnd);
|
9360 |
+
}
|
9361 |
+
|
9362 |
+
if (textEnd < 0) {
|
9363 |
+
text = html;
|
9364 |
+
}
|
9365 |
+
|
9366 |
+
if (text) {
|
9367 |
+
advance(text.length);
|
9368 |
+
}
|
9369 |
+
|
9370 |
+
if (options.chars && text) {
|
9371 |
+
options.chars(text, index - text.length, index);
|
9372 |
+
}
|
9373 |
+
} else {
|
9374 |
+
var endTagLength = 0;
|
9375 |
+
var stackedTag = lastTag.toLowerCase();
|
9376 |
+
var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
|
9377 |
+
var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
|
9378 |
+
endTagLength = endTag.length;
|
9379 |
+
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
9380 |
+
text = text
|
9381 |
+
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
|
9382 |
+
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
9383 |
+
}
|
9384 |
+
if (shouldIgnoreFirstNewline(stackedTag, text)) {
|
9385 |
+
text = text.slice(1);
|
9386 |
+
}
|
9387 |
+
if (options.chars) {
|
9388 |
+
options.chars(text);
|
9389 |
+
}
|
9390 |
+
return ''
|
9391 |
+
});
|
9392 |
+
index += html.length - rest$1.length;
|
9393 |
+
html = rest$1;
|
9394 |
+
parseEndTag(stackedTag, index - endTagLength, index);
|
9395 |
+
}
|
9396 |
+
|
9397 |
+
if (html === last) {
|
9398 |
+
options.chars && options.chars(html);
|
9399 |
+
if (!stack.length && options.warn) {
|
9400 |
+
options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
|
9401 |
+
}
|
9402 |
+
break
|
9403 |
+
}
|
9404 |
+
}
|
9405 |
+
|
9406 |
+
// Clean up any remaining tags
|
9407 |
+
parseEndTag();
|
9408 |
+
|
9409 |
+
function advance (n) {
|
9410 |
+
index += n;
|
9411 |
+
html = html.substring(n);
|
9412 |
+
}
|
9413 |
+
|
9414 |
+
function parseStartTag () {
|
9415 |
+
var start = html.match(startTagOpen);
|
9416 |
+
if (start) {
|
9417 |
+
var match = {
|
9418 |
+
tagName: start[1],
|
9419 |
+
attrs: [],
|
9420 |
+
start: index
|
9421 |
+
};
|
9422 |
+
advance(start[0].length);
|
9423 |
+
var end, attr;
|
9424 |
+
while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
9425 |
+
attr.start = index;
|
9426 |
+
advance(attr[0].length);
|
9427 |
+
attr.end = index;
|
9428 |
+
match.attrs.push(attr);
|
9429 |
+
}
|
9430 |
+
if (end) {
|
9431 |
+
match.unarySlash = end[1];
|
9432 |
+
advance(end[0].length);
|
9433 |
+
match.end = index;
|
9434 |
+
return match
|
9435 |
+
}
|
9436 |
+
}
|
9437 |
+
}
|
9438 |
+
|
9439 |
+
function handleStartTag (match) {
|
9440 |
+
var tagName = match.tagName;
|
9441 |
+
var unarySlash = match.unarySlash;
|
9442 |
+
|
9443 |
+
if (expectHTML) {
|
9444 |
+
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
9445 |
+
parseEndTag(lastTag);
|
9446 |
+
}
|
9447 |
+
if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
9448 |
+
parseEndTag(tagName);
|
9449 |
+
}
|
9450 |
+
}
|
9451 |
+
|
9452 |
+
var unary = isUnaryTag$$1(tagName) || !!unarySlash;
|
9453 |
+
|
9454 |
+
var l = match.attrs.length;
|
9455 |
+
var attrs = new Array(l);
|
9456 |
+
for (var i = 0; i < l; i++) {
|
9457 |
+
var args = match.attrs[i];
|
9458 |
+
var value = args[3] || args[4] || args[5] || '';
|
9459 |
+
var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
9460 |
+
? options.shouldDecodeNewlinesForHref
|
9461 |
+
: options.shouldDecodeNewlines;
|
9462 |
+
attrs[i] = {
|
9463 |
+
name: args[1],
|
9464 |
+
value: decodeAttr(value, shouldDecodeNewlines)
|
9465 |
+
};
|
9466 |
+
if (options.outputSourceRange) {
|
9467 |
+
attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
9468 |
+
attrs[i].end = args.end;
|
9469 |
+
}
|
9470 |
+
}
|
9471 |
+
|
9472 |
+
if (!unary) {
|
9473 |
+
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
|
9474 |
+
lastTag = tagName;
|
9475 |
+
}
|
9476 |
+
|
9477 |
+
if (options.start) {
|
9478 |
+
options.start(tagName, attrs, unary, match.start, match.end);
|
9479 |
+
}
|
9480 |
+
}
|
9481 |
+
|
9482 |
+
function parseEndTag (tagName, start, end) {
|
9483 |
+
var pos, lowerCasedTagName;
|
9484 |
+
if (start == null) { start = index; }
|
9485 |
+
if (end == null) { end = index; }
|
9486 |
+
|
9487 |
+
// Find the closest opened tag of the same type
|
9488 |
+
if (tagName) {
|
9489 |
+
lowerCasedTagName = tagName.toLowerCase();
|
9490 |
+
for (pos = stack.length - 1; pos >= 0; pos--) {
|
9491 |
+
if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
9492 |
+
break
|
9493 |
+
}
|
9494 |
+
}
|
9495 |
+
} else {
|
9496 |
+
// If no tag name is provided, clean shop
|
9497 |
+
pos = 0;
|
9498 |
+
}
|
9499 |
+
|
9500 |
+
if (pos >= 0) {
|
9501 |
+
// Close all the open elements, up the stack
|
9502 |
+
for (var i = stack.length - 1; i >= pos; i--) {
|
9503 |
+
if (i > pos || !tagName &&
|
9504 |
+
options.warn
|
9505 |
+
) {
|
9506 |
+
options.warn(
|
9507 |
+
("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
9508 |
+
{ start: stack[i].start, end: stack[i].end }
|
9509 |
+
);
|
9510 |
+
}
|
9511 |
+
if (options.end) {
|
9512 |
+
options.end(stack[i].tag, start, end);
|
9513 |
+
}
|
9514 |
+
}
|
9515 |
+
|
9516 |
+
// Remove the open elements from the stack
|
9517 |
+
stack.length = pos;
|
9518 |
+
lastTag = pos && stack[pos - 1].tag;
|
9519 |
+
} else if (lowerCasedTagName === 'br') {
|
9520 |
+
if (options.start) {
|
9521 |
+
options.start(tagName, [], true, start, end);
|
9522 |
+
}
|
9523 |
+
} else if (lowerCasedTagName === 'p') {
|
9524 |
+
if (options.start) {
|
9525 |
+
options.start(tagName, [], false, start, end);
|
9526 |
+
}
|
9527 |
+
if (options.end) {
|
9528 |
+
options.end(tagName, start, end);
|
9529 |
+
}
|
9530 |
+
}
|
9531 |
+
}
|
9532 |
+
}
|
9533 |
+
|
9534 |
+
/* */
|
9535 |
+
|
9536 |
+
var onRE = /^@|^v-on:/;
|
9537 |
+
var dirRE = /^v-|^@|^:/;
|
9538 |
+
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
9539 |
+
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
9540 |
+
var stripParensRE = /^\(|\)$/g;
|
9541 |
+
var dynamicArgRE = /^\[.*\]$/;
|
9542 |
+
|
9543 |
+
var argRE = /:(.*)$/;
|
9544 |
+
var bindRE = /^:|^\.|^v-bind:/;
|
9545 |
+
var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
|
9546 |
+
|
9547 |
+
var slotRE = /^v-slot(:|$)|^#/;
|
9548 |
+
|
9549 |
+
var lineBreakRE = /[\r\n]/;
|
9550 |
+
var whitespaceRE$1 = /\s+/g;
|
9551 |
+
|
9552 |
+
var invalidAttributeRE = /[\s"'<>\/=]/;
|
9553 |
+
|
9554 |
+
var decodeHTMLCached = cached(he.decode);
|
9555 |
+
|
9556 |
+
var emptySlotScopeToken = "_empty_";
|
9557 |
+
|
9558 |
+
// configurable state
|
9559 |
+
var warn$2;
|
9560 |
+
var delimiters;
|
9561 |
+
var transforms;
|
9562 |
+
var preTransforms;
|
9563 |
+
var postTransforms;
|
9564 |
+
var platformIsPreTag;
|
9565 |
+
var platformMustUseProp;
|
9566 |
+
var platformGetTagNamespace;
|
9567 |
+
var maybeComponent;
|
9568 |
+
|
9569 |
+
function createASTElement (
|
9570 |
+
tag,
|
9571 |
+
attrs,
|
9572 |
+
parent
|
9573 |
+
) {
|
9574 |
+
return {
|
9575 |
+
type: 1,
|
9576 |
+
tag: tag,
|
9577 |
+
attrsList: attrs,
|
9578 |
+
attrsMap: makeAttrsMap(attrs),
|
9579 |
+
rawAttrsMap: {},
|
9580 |
+
parent: parent,
|
9581 |
+
children: []
|
9582 |
+
}
|
9583 |
+
}
|
9584 |
+
|
9585 |
+
/**
|
9586 |
+
* Convert HTML string to AST.
|
9587 |
+
*/
|
9588 |
+
function parse (
|
9589 |
+
template,
|
9590 |
+
options
|
9591 |
+
) {
|
9592 |
+
warn$2 = options.warn || baseWarn;
|
9593 |
+
|
9594 |
+
platformIsPreTag = options.isPreTag || no;
|
9595 |
+
platformMustUseProp = options.mustUseProp || no;
|
9596 |
+
platformGetTagNamespace = options.getTagNamespace || no;
|
9597 |
+
var isReservedTag = options.isReservedTag || no;
|
9598 |
+
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
9599 |
+
|
9600 |
+
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
9601 |
+
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
9602 |
+
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
9603 |
+
|
9604 |
+
delimiters = options.delimiters;
|
9605 |
+
|
9606 |
+
var stack = [];
|
9607 |
+
var preserveWhitespace = options.preserveWhitespace !== false;
|
9608 |
+
var whitespaceOption = options.whitespace;
|
9609 |
+
var root;
|
9610 |
+
var currentParent;
|
9611 |
+
var inVPre = false;
|
9612 |
+
var inPre = false;
|
9613 |
+
var warned = false;
|
9614 |
+
|
9615 |
+
function warnOnce (msg, range) {
|
9616 |
+
if (!warned) {
|
9617 |
+
warned = true;
|
9618 |
+
warn$2(msg, range);
|
9619 |
+
}
|
9620 |
+
}
|
9621 |
+
|
9622 |
+
function closeElement (element) {
|
9623 |
+
trimEndingWhitespace(element);
|
9624 |
+
if (!inVPre && !element.processed) {
|
9625 |
+
element = processElement(element, options);
|
9626 |
+
}
|
9627 |
+
// tree management
|
9628 |
+
if (!stack.length && element !== root) {
|
9629 |
+
// allow root elements with v-if, v-else-if and v-else
|
9630 |
+
if (root.if && (element.elseif || element.else)) {
|
9631 |
+
{
|
9632 |
+
checkRootConstraints(element);
|
9633 |
+
}
|
9634 |
+
addIfCondition(root, {
|
9635 |
+
exp: element.elseif,
|
9636 |
+
block: element
|
9637 |
+
});
|
9638 |
+
} else {
|
9639 |
+
warnOnce(
|
9640 |
+
"Component template should contain exactly one root element. " +
|
9641 |
+
"If you are using v-if on multiple elements, " +
|
9642 |
+
"use v-else-if to chain them instead.",
|
9643 |
+
{ start: element.start }
|
9644 |
+
);
|
9645 |
+
}
|
9646 |
+
}
|
9647 |
+
if (currentParent && !element.forbidden) {
|
9648 |
+
if (element.elseif || element.else) {
|
9649 |
+
processIfConditions(element, currentParent);
|
9650 |
+
} else {
|
9651 |
+
if (element.slotScope) {
|
9652 |
+
// scoped slot
|
9653 |
+
// keep it in the children list so that v-else(-if) conditions can
|
9654 |
+
// find it as the prev node.
|
9655 |
+
var name = element.slotTarget || '"default"'
|
9656 |
+
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
|
9657 |
+
}
|
9658 |
+
currentParent.children.push(element);
|
9659 |
+
element.parent = currentParent;
|
9660 |
+
}
|
9661 |
+
}
|
9662 |
+
|
9663 |
+
// final children cleanup
|
9664 |
+
// filter out scoped slots
|
9665 |
+
element.children = element.children.filter(function (c) { return !(c).slotScope; });
|
9666 |
+
// remove trailing whitespace node again
|
9667 |
+
trimEndingWhitespace(element);
|
9668 |
+
|
9669 |
+
// check pre state
|
9670 |
+
if (element.pre) {
|
9671 |
+
inVPre = false;
|
9672 |
+
}
|
9673 |
+
if (platformIsPreTag(element.tag)) {
|
9674 |
+
inPre = false;
|
9675 |
+
}
|
9676 |
+
// apply post-transforms
|
9677 |
+
for (var i = 0; i < postTransforms.length; i++) {
|
9678 |
+
postTransforms[i](element, options);
|
9679 |
+
}
|
9680 |
+
}
|
9681 |
+
|
9682 |
+
function trimEndingWhitespace (el) {
|
9683 |
+
// remove trailing whitespace node
|
9684 |
+
if (!inPre) {
|
9685 |
+
var lastNode;
|
9686 |
+
while (
|
9687 |
+
(lastNode = el.children[el.children.length - 1]) &&
|
9688 |
+
lastNode.type === 3 &&
|
9689 |
+
lastNode.text === ' '
|
9690 |
+
) {
|
9691 |
+
el.children.pop();
|
9692 |
+
}
|
9693 |
+
}
|
9694 |
+
}
|
9695 |
+
|
9696 |
+
function checkRootConstraints (el) {
|
9697 |
+
if (el.tag === 'slot' || el.tag === 'template') {
|
9698 |
+
warnOnce(
|
9699 |
+
"Cannot use <" + (el.tag) + "> as component root element because it may " +
|
9700 |
+
'contain multiple nodes.',
|
9701 |
+
{ start: el.start }
|
9702 |
+
);
|
9703 |
+
}
|
9704 |
+
if (el.attrsMap.hasOwnProperty('v-for')) {
|
9705 |
+
warnOnce(
|
9706 |
+
'Cannot use v-for on stateful component root element because ' +
|
9707 |
+
'it renders multiple elements.',
|
9708 |
+
el.rawAttrsMap['v-for']
|
9709 |
+
);
|
9710 |
+
}
|
9711 |
+
}
|
9712 |
+
|
9713 |
+
parseHTML(template, {
|
9714 |
+
warn: warn$2,
|
9715 |
+
expectHTML: options.expectHTML,
|
9716 |
+
isUnaryTag: options.isUnaryTag,
|
9717 |
+
canBeLeftOpenTag: options.canBeLeftOpenTag,
|
9718 |
+
shouldDecodeNewlines: options.shouldDecodeNewlines,
|
9719 |
+
shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
9720 |
+
shouldKeepComment: options.comments,
|
9721 |
+
outputSourceRange: options.outputSourceRange,
|
9722 |
+
start: function start (tag, attrs, unary, start$1, end) {
|
9723 |
+
// check namespace.
|
9724 |
+
// inherit parent ns if there is one
|
9725 |
+
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
9726 |
+
|
9727 |
+
// handle IE svg bug
|
9728 |
+
/* istanbul ignore if */
|
9729 |
+
if (isIE && ns === 'svg') {
|
9730 |
+
attrs = guardIESVGBug(attrs);
|
9731 |
+
}
|
9732 |
+
|
9733 |
+
var element = createASTElement(tag, attrs, currentParent);
|
9734 |
+
if (ns) {
|
9735 |
+
element.ns = ns;
|
9736 |
+
}
|
9737 |
+
|
9738 |
+
{
|
9739 |
+
if (options.outputSourceRange) {
|
9740 |
+
element.start = start$1;
|
9741 |
+
element.end = end;
|
9742 |
+
element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
9743 |
+
cumulated[attr.name] = attr;
|
9744 |
+
return cumulated
|
9745 |
+
}, {});
|
9746 |
+
}
|
9747 |
+
attrs.forEach(function (attr) {
|
9748 |
+
if (invalidAttributeRE.test(attr.name)) {
|
9749 |
+
warn$2(
|
9750 |
+
"Invalid dynamic argument expression: attribute names cannot contain " +
|
9751 |
+
"spaces, quotes, <, >, / or =.",
|
9752 |
+
{
|
9753 |
+
start: attr.start + attr.name.indexOf("["),
|
9754 |
+
end: attr.start + attr.name.length
|
9755 |
+
}
|
9756 |
+
);
|
9757 |
+
}
|
9758 |
+
});
|
9759 |
+
}
|
9760 |
+
|
9761 |
+
if (isForbiddenTag(element) && !isServerRendering()) {
|
9762 |
+
element.forbidden = true;
|
9763 |
+
warn$2(
|
9764 |
+
'Templates should only be responsible for mapping the state to the ' +
|
9765 |
+
'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
9766 |
+
"<" + tag + ">" + ', as they will not be parsed.',
|
9767 |
+
{ start: element.start }
|
9768 |
+
);
|
9769 |
+
}
|
9770 |
+
|
9771 |
+
// apply pre-transforms
|
9772 |
+
for (var i = 0; i < preTransforms.length; i++) {
|
9773 |
+
element = preTransforms[i](element, options) || element;
|
9774 |
+
}
|
9775 |
+
|
9776 |
+
if (!inVPre) {
|
9777 |
+
processPre(element);
|
9778 |
+
if (element.pre) {
|
9779 |
+
inVPre = true;
|
9780 |
+
}
|
9781 |
+
}
|
9782 |
+
if (platformIsPreTag(element.tag)) {
|
9783 |
+
inPre = true;
|
9784 |
+
}
|
9785 |
+
if (inVPre) {
|
9786 |
+
processRawAttrs(element);
|
9787 |
+
} else if (!element.processed) {
|
9788 |
+
// structural directives
|
9789 |
+
processFor(element);
|
9790 |
+
processIf(element);
|
9791 |
+
processOnce(element);
|
9792 |
+
}
|
9793 |
+
|
9794 |
+
if (!root) {
|
9795 |
+
root = element;
|
9796 |
+
{
|
9797 |
+
checkRootConstraints(root);
|
9798 |
+
}
|
9799 |
+
}
|
9800 |
+
|
9801 |
+
if (!unary) {
|
9802 |
+
currentParent = element;
|
9803 |
+
stack.push(element);
|
9804 |
+
} else {
|
9805 |
+
closeElement(element);
|
9806 |
+
}
|
9807 |
+
},
|
9808 |
+
|
9809 |
+
end: function end (tag, start, end$1) {
|
9810 |
+
var element = stack[stack.length - 1];
|
9811 |
+
// pop stack
|
9812 |
+
stack.length -= 1;
|
9813 |
+
currentParent = stack[stack.length - 1];
|
9814 |
+
if (options.outputSourceRange) {
|
9815 |
+
element.end = end$1;
|
9816 |
+
}
|
9817 |
+
closeElement(element);
|
9818 |
+
},
|
9819 |
+
|
9820 |
+
chars: function chars (text, start, end) {
|
9821 |
+
if (!currentParent) {
|
9822 |
+
{
|
9823 |
+
if (text === template) {
|
9824 |
+
warnOnce(
|
9825 |
+
'Component template requires a root element, rather than just text.',
|
9826 |
+
{ start: start }
|
9827 |
+
);
|
9828 |
+
} else if ((text = text.trim())) {
|
9829 |
+
warnOnce(
|
9830 |
+
("text \"" + text + "\" outside root element will be ignored."),
|
9831 |
+
{ start: start }
|
9832 |
+
);
|
9833 |
+
}
|
9834 |
+
}
|
9835 |
+
return
|
9836 |
+
}
|
9837 |
+
// IE textarea placeholder bug
|
9838 |
+
/* istanbul ignore if */
|
9839 |
+
if (isIE &&
|
9840 |
+
currentParent.tag === 'textarea' &&
|
9841 |
+
currentParent.attrsMap.placeholder === text
|
9842 |
+
) {
|
9843 |
+
return
|
9844 |
+
}
|
9845 |
+
var children = currentParent.children;
|
9846 |
+
if (inPre || text.trim()) {
|
9847 |
+
text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
|
9848 |
+
} else if (!children.length) {
|
9849 |
+
// remove the whitespace-only node right after an opening tag
|
9850 |
+
text = '';
|
9851 |
+
} else if (whitespaceOption) {
|
9852 |
+
if (whitespaceOption === 'condense') {
|
9853 |
+
// in condense mode, remove the whitespace node if it contains
|
9854 |
+
// line break, otherwise condense to a single space
|
9855 |
+
text = lineBreakRE.test(text) ? '' : ' ';
|
9856 |
+
} else {
|
9857 |
+
text = ' ';
|
9858 |
+
}
|
9859 |
+
} else {
|
9860 |
+
text = preserveWhitespace ? ' ' : '';
|
9861 |
+
}
|
9862 |
+
if (text) {
|
9863 |
+
if (!inPre && whitespaceOption === 'condense') {
|
9864 |
+
// condense consecutive whitespaces into single space
|
9865 |
+
text = text.replace(whitespaceRE$1, ' ');
|
9866 |
+
}
|
9867 |
+
var res;
|
9868 |
+
var child;
|
9869 |
+
if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
9870 |
+
child = {
|
9871 |
+
type: 2,
|
9872 |
+
expression: res.expression,
|
9873 |
+
tokens: res.tokens,
|
9874 |
+
text: text
|
9875 |
+
};
|
9876 |
+
} else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
|
9877 |
+
child = {
|
9878 |
+
type: 3,
|
9879 |
+
text: text
|
9880 |
+
};
|
9881 |
+
}
|
9882 |
+
if (child) {
|
9883 |
+
if (options.outputSourceRange) {
|
9884 |
+
child.start = start;
|
9885 |
+
child.end = end;
|
9886 |
+
}
|
9887 |
+
children.push(child);
|
9888 |
+
}
|
9889 |
+
}
|
9890 |
+
},
|
9891 |
+
comment: function comment (text, start, end) {
|
9892 |
+
// adding anyting as a sibling to the root node is forbidden
|
9893 |
+
// comments should still be allowed, but ignored
|
9894 |
+
if (currentParent) {
|
9895 |
+
var child = {
|
9896 |
+
type: 3,
|
9897 |
+
text: text,
|
9898 |
+
isComment: true
|
9899 |
+
};
|
9900 |
+
if (options.outputSourceRange) {
|
9901 |
+
child.start = start;
|
9902 |
+
child.end = end;
|
9903 |
+
}
|
9904 |
+
currentParent.children.push(child);
|
9905 |
+
}
|
9906 |
+
}
|
9907 |
+
});
|
9908 |
+
return root
|
9909 |
+
}
|
9910 |
+
|
9911 |
+
function processPre (el) {
|
9912 |
+
if (getAndRemoveAttr(el, 'v-pre') != null) {
|
9913 |
+
el.pre = true;
|
9914 |
+
}
|
9915 |
+
}
|
9916 |
+
|
9917 |
+
function processRawAttrs (el) {
|
9918 |
+
var list = el.attrsList;
|
9919 |
+
var len = list.length;
|
9920 |
+
if (len) {
|
9921 |
+
var attrs = el.attrs = new Array(len);
|
9922 |
+
for (var i = 0; i < len; i++) {
|
9923 |
+
attrs[i] = {
|
9924 |
+
name: list[i].name,
|
9925 |
+
value: JSON.stringify(list[i].value)
|
9926 |
+
};
|
9927 |
+
if (list[i].start != null) {
|
9928 |
+
attrs[i].start = list[i].start;
|
9929 |
+
attrs[i].end = list[i].end;
|
9930 |
+
}
|
9931 |
+
}
|
9932 |
+
} else if (!el.pre) {
|
9933 |
+
// non root node in pre blocks with no attributes
|
9934 |
+
el.plain = true;
|
9935 |
+
}
|
9936 |
+
}
|
9937 |
+
|
9938 |
+
function processElement (
|
9939 |
+
element,
|
9940 |
+
options
|
9941 |
+
) {
|
9942 |
+
processKey(element);
|
9943 |
+
|
9944 |
+
// determine whether this is a plain element after
|
9945 |
+
// removing structural attributes
|
9946 |
+
element.plain = (
|
9947 |
+
!element.key &&
|
9948 |
+
!element.scopedSlots &&
|
9949 |
+
!element.attrsList.length
|
9950 |
+
);
|
9951 |
+
|
9952 |
+
processRef(element);
|
9953 |
+
processSlotContent(element);
|
9954 |
+
processSlotOutlet(element);
|
9955 |
+
processComponent(element);
|
9956 |
+
for (var i = 0; i < transforms.length; i++) {
|
9957 |
+
element = transforms[i](element, options) || element;
|
9958 |
+
}
|
9959 |
+
processAttrs(element);
|
9960 |
+
return element
|
9961 |
+
}
|
9962 |
+
|
9963 |
+
function processKey (el) {
|
9964 |
+
var exp = getBindingAttr(el, 'key');
|
9965 |
+
if (exp) {
|
9966 |
+
{
|
9967 |
+
if (el.tag === 'template') {
|
9968 |
+
warn$2(
|
9969 |
+
"<template> cannot be keyed. Place the key on real elements instead.",
|
9970 |
+
getRawBindingAttr(el, 'key')
|
9971 |
+
);
|
9972 |
+
}
|
9973 |
+
if (el.for) {
|
9974 |
+
var iterator = el.iterator2 || el.iterator1;
|
9975 |
+
var parent = el.parent;
|
9976 |
+
if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
9977 |
+
warn$2(
|
9978 |
+
"Do not use v-for index as key on <transition-group> children, " +
|
9979 |
+
"this is the same as not using keys.",
|
9980 |
+
getRawBindingAttr(el, 'key'),
|
9981 |
+
true /* tip */
|
9982 |
+
);
|
9983 |
+
}
|
9984 |
+
}
|
9985 |
+
}
|
9986 |
+
el.key = exp;
|
9987 |
+
}
|
9988 |
+
}
|
9989 |
+
|
9990 |
+
function processRef (el) {
|
9991 |
+
var ref = getBindingAttr(el, 'ref');
|
9992 |
+
if (ref) {
|
9993 |
+
el.ref = ref;
|
9994 |
+
el.refInFor = checkInFor(el);
|
9995 |
+
}
|
9996 |
+
}
|
9997 |
+
|
9998 |
+
function processFor (el) {
|
9999 |
+
var exp;
|
10000 |
+
if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
10001 |
+
var res = parseFor(exp);
|
10002 |
+
if (res) {
|
10003 |
+
extend(el, res);
|
10004 |
+
} else {
|
10005 |
+
warn$2(
|
10006 |
+
("Invalid v-for expression: " + exp),
|
10007 |
+
el.rawAttrsMap['v-for']
|
10008 |
+
);
|
10009 |
+
}
|
10010 |
+
}
|
10011 |
+
}
|
10012 |
+
|
10013 |
+
|
10014 |
+
|
10015 |
+
function parseFor (exp) {
|
10016 |
+
var inMatch = exp.match(forAliasRE);
|
10017 |
+
if (!inMatch) { return }
|
10018 |
+
var res = {};
|
10019 |
+
res.for = inMatch[2].trim();
|
10020 |
+
var alias = inMatch[1].trim().replace(stripParensRE, '');
|
10021 |
+
var iteratorMatch = alias.match(forIteratorRE);
|
10022 |
+
if (iteratorMatch) {
|
10023 |
+
res.alias = alias.replace(forIteratorRE, '').trim();
|
10024 |
+
res.iterator1 = iteratorMatch[1].trim();
|
10025 |
+
if (iteratorMatch[2]) {
|
10026 |
+
res.iterator2 = iteratorMatch[2].trim();
|
10027 |
+
}
|
10028 |
+
} else {
|
10029 |
+
res.alias = alias;
|
10030 |
+
}
|
10031 |
+
return res
|
10032 |
+
}
|
10033 |
+
|
10034 |
+
function processIf (el) {
|
10035 |
+
var exp = getAndRemoveAttr(el, 'v-if');
|
10036 |
+
if (exp) {
|
10037 |
+
el.if = exp;
|
10038 |
+
addIfCondition(el, {
|
10039 |
+
exp: exp,
|
10040 |
+
block: el
|
10041 |
+
});
|
10042 |
+
} else {
|
10043 |
+
if (getAndRemoveAttr(el, 'v-else') != null) {
|
10044 |
+
el.else = true;
|
10045 |
+
}
|
10046 |
+
var elseif = getAndRemoveAttr(el, 'v-else-if');
|
10047 |
+
if (elseif) {
|
10048 |
+
el.elseif = elseif;
|
10049 |
+
}
|
10050 |
+
}
|
10051 |
+
}
|
10052 |
+
|
10053 |
+
function processIfConditions (el, parent) {
|
10054 |
+
var prev = findPrevElement(parent.children);
|
10055 |
+
if (prev && prev.if) {
|
10056 |
+
addIfCondition(prev, {
|
10057 |
+
exp: el.elseif,
|
10058 |
+
block: el
|
10059 |
+
});
|
10060 |
+
} else {
|
10061 |
+
warn$2(
|
10062 |
+
"v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
|
10063 |
+
"used on element <" + (el.tag) + "> without corresponding v-if.",
|
10064 |
+
el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
|
10065 |
+
);
|
10066 |
+
}
|
10067 |
+
}
|
10068 |
+
|
10069 |
+
function findPrevElement (children) {
|
10070 |
+
var i = children.length;
|
10071 |
+
while (i--) {
|
10072 |
+
if (children[i].type === 1) {
|
10073 |
+
return children[i]
|
10074 |
+
} else {
|
10075 |
+
if (children[i].text !== ' ') {
|
10076 |
+
warn$2(
|
10077 |
+
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
10078 |
+
"will be ignored.",
|
10079 |
+
children[i]
|
10080 |
+
);
|
10081 |
+
}
|
10082 |
+
children.pop();
|
10083 |
+
}
|
10084 |
+
}
|
10085 |
+
}
|
10086 |
+
|
10087 |
+
function addIfCondition (el, condition) {
|
10088 |
+
if (!el.ifConditions) {
|
10089 |
+
el.ifConditions = [];
|
10090 |
+
}
|
10091 |
+
el.ifConditions.push(condition);
|
10092 |
+
}
|
10093 |
+
|
10094 |
+
function processOnce (el) {
|
10095 |
+
var once$$1 = getAndRemoveAttr(el, 'v-once');
|
10096 |
+
if (once$$1 != null) {
|
10097 |
+
el.once = true;
|
10098 |
+
}
|
10099 |
+
}
|
10100 |
+
|
10101 |
+
// handle content being passed to a component as slot,
|
10102 |
+
// e.g. <template slot="xxx">, <div slot-scope="xxx">
|
10103 |
+
function processSlotContent (el) {
|
10104 |
+
var slotScope;
|
10105 |
+
if (el.tag === 'template') {
|
10106 |
+
slotScope = getAndRemoveAttr(el, 'scope');
|
10107 |
+
/* istanbul ignore if */
|
10108 |
+
if (slotScope) {
|
10109 |
+
warn$2(
|
10110 |
+
"the \"scope\" attribute for scoped slots have been deprecated and " +
|
10111 |
+
"replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
10112 |
+
"can also be used on plain elements in addition to <template> to " +
|
10113 |
+
"denote scoped slots.",
|
10114 |
+
el.rawAttrsMap['scope'],
|
10115 |
+
true
|
10116 |
+
);
|
10117 |
+
}
|
10118 |
+
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
10119 |
+
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
10120 |
+
/* istanbul ignore if */
|
10121 |
+
if (el.attrsMap['v-for']) {
|
10122 |
+
warn$2(
|
10123 |
+
"Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
10124 |
+
"(v-for takes higher priority). Use a wrapper <template> for the " +
|
10125 |
+
"scoped slot to make it clearer.",
|
10126 |
+
el.rawAttrsMap['slot-scope'],
|
10127 |
+
true
|
10128 |
+
);
|
10129 |
+
}
|
10130 |
+
el.slotScope = slotScope;
|
10131 |
+
}
|
10132 |
+
|
10133 |
+
// slot="xxx"
|
10134 |
+
var slotTarget = getBindingAttr(el, 'slot');
|
10135 |
+
if (slotTarget) {
|
10136 |
+
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
10137 |
+
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
10138 |
+
// preserve slot as an attribute for native shadow DOM compat
|
10139 |
+
// only for non-scoped slots.
|
10140 |
+
if (el.tag !== 'template' && !el.slotScope) {
|
10141 |
+
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
10142 |
+
}
|
10143 |
+
}
|
10144 |
+
|
10145 |
+
// 2.6 v-slot syntax
|
10146 |
+
{
|
10147 |
+
if (el.tag === 'template') {
|
10148 |
+
// v-slot on <template>
|
10149 |
+
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
10150 |
+
if (slotBinding) {
|
10151 |
+
{
|
10152 |
+
if (el.slotTarget || el.slotScope) {
|
10153 |
+
warn$2(
|
10154 |
+
"Unexpected mixed usage of different slot syntaxes.",
|
10155 |
+
el
|
10156 |
+
);
|
10157 |
+
}
|
10158 |
+
if (el.parent && !maybeComponent(el.parent)) {
|
10159 |
+
warn$2(
|
10160 |
+
"<template v-slot> can only appear at the root level inside " +
|
10161 |
+
"the receiving the component",
|
10162 |
+
el
|
10163 |
+
);
|
10164 |
+
}
|
10165 |
+
}
|
10166 |
+
var ref = getSlotName(slotBinding);
|
10167 |
+
var name = ref.name;
|
10168 |
+
var dynamic = ref.dynamic;
|
10169 |
+
el.slotTarget = name;
|
10170 |
+
el.slotTargetDynamic = dynamic;
|
10171 |
+
el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
|
10172 |
+
}
|
10173 |
+
} else {
|
10174 |
+
// v-slot on component, denotes default slot
|
10175 |
+
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
10176 |
+
if (slotBinding$1) {
|
10177 |
+
{
|
10178 |
+
if (!maybeComponent(el)) {
|
10179 |
+
warn$2(
|
10180 |
+
"v-slot can only be used on components or <template>.",
|
10181 |
+
slotBinding$1
|
10182 |
+
);
|
10183 |
+
}
|
10184 |
+
if (el.slotScope || el.slotTarget) {
|
10185 |
+
warn$2(
|
10186 |
+
"Unexpected mixed usage of different slot syntaxes.",
|
10187 |
+
el
|
10188 |
+
);
|
10189 |
+
}
|
10190 |
+
if (el.scopedSlots) {
|
10191 |
+
warn$2(
|
10192 |
+
"To avoid scope ambiguity, the default slot should also use " +
|
10193 |
+
"<template> syntax when there are other named slots.",
|
10194 |
+
slotBinding$1
|
10195 |
+
);
|
10196 |
+
}
|
10197 |
+
}
|
10198 |
+
// add the component's children to its default slot
|
10199 |
+
var slots = el.scopedSlots || (el.scopedSlots = {});
|
10200 |
+
var ref$1 = getSlotName(slotBinding$1);
|
10201 |
+
var name$1 = ref$1.name;
|
10202 |
+
var dynamic$1 = ref$1.dynamic;
|
10203 |
+
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
10204 |
+
slotContainer.slotTarget = name$1;
|
10205 |
+
slotContainer.slotTargetDynamic = dynamic$1;
|
10206 |
+
slotContainer.children = el.children.filter(function (c) {
|
10207 |
+
if (!c.slotScope) {
|
10208 |
+
c.parent = slotContainer;
|
10209 |
+
return true
|
10210 |
+
}
|
10211 |
+
});
|
10212 |
+
slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
|
10213 |
+
// remove children as they are returned from scopedSlots now
|
10214 |
+
el.children = [];
|
10215 |
+
// mark el non-plain so data gets generated
|
10216 |
+
el.plain = false;
|
10217 |
+
}
|
10218 |
+
}
|
10219 |
+
}
|
10220 |
+
}
|
10221 |
+
|
10222 |
+
function getSlotName (binding) {
|
10223 |
+
var name = binding.name.replace(slotRE, '');
|
10224 |
+
if (!name) {
|
10225 |
+
if (binding.name[0] !== '#') {
|
10226 |
+
name = 'default';
|
10227 |
+
} else {
|
10228 |
+
warn$2(
|
10229 |
+
"v-slot shorthand syntax requires a slot name.",
|
10230 |
+
binding
|
10231 |
+
);
|
10232 |
+
}
|
10233 |
+
}
|
10234 |
+
return dynamicArgRE.test(name)
|
10235 |
+
// dynamic [name]
|
10236 |
+
? { name: name.slice(1, -1), dynamic: true }
|
10237 |
+
// static name
|
10238 |
+
: { name: ("\"" + name + "\""), dynamic: false }
|
10239 |
+
}
|
10240 |
+
|
10241 |
+
// handle <slot/> outlets
|
10242 |
+
function processSlotOutlet (el) {
|
10243 |
+
if (el.tag === 'slot') {
|
10244 |
+
el.slotName = getBindingAttr(el, 'name');
|
10245 |
+
if (el.key) {
|
10246 |
+
warn$2(
|
10247 |
+
"`key` does not work on <slot> because slots are abstract outlets " +
|
10248 |
+
"and can possibly expand into multiple elements. " +
|
10249 |
+
"Use the key on a wrapping element instead.",
|
10250 |
+
getRawBindingAttr(el, 'key')
|
10251 |
+
);
|
10252 |
+
}
|
10253 |
+
}
|
10254 |
+
}
|
10255 |
+
|
10256 |
+
function processComponent (el) {
|
10257 |
+
var binding;
|
10258 |
+
if ((binding = getBindingAttr(el, 'is'))) {
|
10259 |
+
el.component = binding;
|
10260 |
+
}
|
10261 |
+
if (getAndRemoveAttr(el, 'inline-template') != null) {
|
10262 |
+
el.inlineTemplate = true;
|
10263 |
+
}
|
10264 |
+
}
|
10265 |
+
|
10266 |
+
function processAttrs (el) {
|
10267 |
+
var list = el.attrsList;
|
10268 |
+
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
10269 |
+
for (i = 0, l = list.length; i < l; i++) {
|
10270 |
+
name = rawName = list[i].name;
|
10271 |
+
value = list[i].value;
|
10272 |
+
if (dirRE.test(name)) {
|
10273 |
+
// mark element as dynamic
|
10274 |
+
el.hasBindings = true;
|
10275 |
+
// modifiers
|
10276 |
+
modifiers = parseModifiers(name.replace(dirRE, ''));
|
10277 |
+
// support .foo shorthand syntax for the .prop modifier
|
10278 |
+
if (modifiers) {
|
10279 |
+
name = name.replace(modifierRE, '');
|
10280 |
+
}
|
10281 |
+
if (bindRE.test(name)) { // v-bind
|
10282 |
+
name = name.replace(bindRE, '');
|
10283 |
+
value = parseFilters(value);
|
10284 |
+
isDynamic = dynamicArgRE.test(name);
|
10285 |
+
if (isDynamic) {
|
10286 |
+
name = name.slice(1, -1);
|
10287 |
+
}
|
10288 |
+
if (
|
10289 |
+
value.trim().length === 0
|
10290 |
+
) {
|
10291 |
+
warn$2(
|
10292 |
+
("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
|
10293 |
+
);
|
10294 |
+
}
|
10295 |
+
if (modifiers) {
|
10296 |
+
if (modifiers.prop && !isDynamic) {
|
10297 |
+
name = camelize(name);
|
10298 |
+
if (name === 'innerHtml') { name = 'innerHTML'; }
|
10299 |
+
}
|
10300 |
+
if (modifiers.camel && !isDynamic) {
|
10301 |
+
name = camelize(name);
|
10302 |
+
}
|
10303 |
+
if (modifiers.sync) {
|
10304 |
+
syncGen = genAssignmentCode(value, "$event");
|
10305 |
+
if (!isDynamic) {
|
10306 |
+
addHandler(
|
10307 |
+
el,
|
10308 |
+
("update:" + (camelize(name))),
|
10309 |
+
syncGen,
|
10310 |
+
null,
|
10311 |
+
false,
|
10312 |
+
warn$2,
|
10313 |
+
list[i]
|
10314 |
+
);
|
10315 |
+
if (hyphenate(name) !== camelize(name)) {
|
10316 |
+
addHandler(
|
10317 |
+
el,
|
10318 |
+
("update:" + (hyphenate(name))),
|
10319 |
+
syncGen,
|
10320 |
+
null,
|
10321 |
+
false,
|
10322 |
+
warn$2,
|
10323 |
+
list[i]
|
10324 |
+
);
|
10325 |
+
}
|
10326 |
+
} else {
|
10327 |
+
// handler w/ dynamic event name
|
10328 |
+
addHandler(
|
10329 |
+
el,
|
10330 |
+
("\"update:\"+(" + name + ")"),
|
10331 |
+
syncGen,
|
10332 |
+
null,
|
10333 |
+
false,
|
10334 |
+
warn$2,
|
10335 |
+
list[i],
|
10336 |
+
true // dynamic
|
10337 |
+
);
|
10338 |
+
}
|
10339 |
+
}
|
10340 |
+
}
|
10341 |
+
if ((modifiers && modifiers.prop) || (
|
10342 |
+
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
10343 |
+
)) {
|
10344 |
+
addProp(el, name, value, list[i], isDynamic);
|
10345 |
+
} else {
|
10346 |
+
addAttr(el, name, value, list[i], isDynamic);
|
10347 |
+
}
|
10348 |
+
} else if (onRE.test(name)) { // v-on
|
10349 |
+
name = name.replace(onRE, '');
|
10350 |
+
isDynamic = dynamicArgRE.test(name);
|
10351 |
+
if (isDynamic) {
|
10352 |
+
name = name.slice(1, -1);
|
10353 |
+
}
|
10354 |
+
addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
10355 |
+
} else { // normal directives
|
10356 |
+
name = name.replace(dirRE, '');
|
10357 |
+
// parse arg
|
10358 |
+
var argMatch = name.match(argRE);
|
10359 |
+
var arg = argMatch && argMatch[1];
|
10360 |
+
isDynamic = false;
|
10361 |
+
if (arg) {
|
10362 |
+
name = name.slice(0, -(arg.length + 1));
|
10363 |
+
if (dynamicArgRE.test(arg)) {
|
10364 |
+
arg = arg.slice(1, -1);
|
10365 |
+
isDynamic = true;
|
10366 |
+
}
|
10367 |
+
}
|
10368 |
+
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
10369 |
+
if (name === 'model') {
|
10370 |
+
checkForAliasModel(el, value);
|
10371 |
+
}
|
10372 |
+
}
|
10373 |
+
} else {
|
10374 |
+
// literal attribute
|
10375 |
+
{
|
10376 |
+
var res = parseText(value, delimiters);
|
10377 |
+
if (res) {
|
10378 |
+
warn$2(
|
10379 |
+
name + "=\"" + value + "\": " +
|
10380 |
+
'Interpolation inside attributes has been removed. ' +
|
10381 |
+
'Use v-bind or the colon shorthand instead. For example, ' +
|
10382 |
+
'instead of <div id="{{ val }}">, use <div :id="val">.',
|
10383 |
+
list[i]
|
10384 |
+
);
|
10385 |
+
}
|
10386 |
+
}
|
10387 |
+
addAttr(el, name, JSON.stringify(value), list[i]);
|
10388 |
+
// #6887 firefox doesn't update muted state if set via attribute
|
10389 |
+
// even immediately after element creation
|
10390 |
+
if (!el.component &&
|
10391 |
+
name === 'muted' &&
|
10392 |
+
platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
10393 |
+
addProp(el, name, 'true', list[i]);
|
10394 |
+
}
|
10395 |
+
}
|
10396 |
+
}
|
10397 |
+
}
|
10398 |
+
|
10399 |
+
function checkInFor (el) {
|
10400 |
+
var parent = el;
|
10401 |
+
while (parent) {
|
10402 |
+
if (parent.for !== undefined) {
|
10403 |
+
return true
|
10404 |
+
}
|
10405 |
+
parent = parent.parent;
|
10406 |
+
}
|
10407 |
+
return false
|
10408 |
+
}
|
10409 |
+
|
10410 |
+
function parseModifiers (name) {
|
10411 |
+
var match = name.match(modifierRE);
|
10412 |
+
if (match) {
|
10413 |
+
var ret = {};
|
10414 |
+
match.forEach(function (m) { ret[m.slice(1)] = true; });
|
10415 |
+
return ret
|
10416 |
+
}
|
10417 |
+
}
|
10418 |
+
|
10419 |
+
function makeAttrsMap (attrs) {
|
10420 |
+
var map = {};
|
10421 |
+
for (var i = 0, l = attrs.length; i < l; i++) {
|
10422 |
+
if (
|
10423 |
+
map[attrs[i].name] && !isIE && !isEdge
|
10424 |
+
) {
|
10425 |
+
warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
10426 |
+
}
|
10427 |
+
map[attrs[i].name] = attrs[i].value;
|
10428 |
+
}
|
10429 |
+
return map
|
10430 |
+
}
|
10431 |
+
|
10432 |
+
// for script (e.g. type="x/template") or style, do not decode content
|
10433 |
+
function isTextTag (el) {
|
10434 |
+
return el.tag === 'script' || el.tag === 'style'
|
10435 |
+
}
|
10436 |
+
|
10437 |
+
function isForbiddenTag (el) {
|
10438 |
+
return (
|
10439 |
+
el.tag === 'style' ||
|
10440 |
+
(el.tag === 'script' && (
|
10441 |
+
!el.attrsMap.type ||
|
10442 |
+
el.attrsMap.type === 'text/javascript'
|
10443 |
+
))
|
10444 |
+
)
|
10445 |
+
}
|
10446 |
+
|
10447 |
+
var ieNSBug = /^xmlns:NS\d+/;
|
10448 |
+
var ieNSPrefix = /^NS\d+:/;
|
10449 |
+
|
10450 |
+
/* istanbul ignore next */
|
10451 |
+
function guardIESVGBug (attrs) {
|
10452 |
+
var res = [];
|
10453 |
+
for (var i = 0; i < attrs.length; i++) {
|
10454 |
+
var attr = attrs[i];
|
10455 |
+
if (!ieNSBug.test(attr.name)) {
|
10456 |
+
attr.name = attr.name.replace(ieNSPrefix, '');
|
10457 |
+
res.push(attr);
|
10458 |
+
}
|
10459 |
+
}
|
10460 |
+
return res
|
10461 |
+
}
|
10462 |
+
|
10463 |
+
function checkForAliasModel (el, value) {
|
10464 |
+
var _el = el;
|
10465 |
+
while (_el) {
|
10466 |
+
if (_el.for && _el.alias === value) {
|
10467 |
+
warn$2(
|
10468 |
+
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
10469 |
+
"You are binding v-model directly to a v-for iteration alias. " +
|
10470 |
+
"This will not be able to modify the v-for source array because " +
|
10471 |
+
"writing to the alias is like modifying a function local variable. " +
|
10472 |
+
"Consider using an array of objects and use v-model on an object property instead.",
|
10473 |
+
el.rawAttrsMap['v-model']
|
10474 |
+
);
|
10475 |
+
}
|
10476 |
+
_el = _el.parent;
|
10477 |
+
}
|
10478 |
+
}
|
10479 |
+
|
10480 |
+
/* */
|
10481 |
+
|
10482 |
+
function preTransformNode (el, options) {
|
10483 |
+
if (el.tag === 'input') {
|
10484 |
+
var map = el.attrsMap;
|
10485 |
+
if (!map['v-model']) {
|
10486 |
+
return
|
10487 |
+
}
|
10488 |
+
|
10489 |
+
var typeBinding;
|
10490 |
+
if (map[':type'] || map['v-bind:type']) {
|
10491 |
+
typeBinding = getBindingAttr(el, 'type');
|
10492 |
+
}
|
10493 |
+
if (!map.type && !typeBinding && map['v-bind']) {
|
10494 |
+
typeBinding = "(" + (map['v-bind']) + ").type";
|
10495 |
+
}
|
10496 |
+
|
10497 |
+
if (typeBinding) {
|
10498 |
+
var ifCondition = getAndRemoveAttr(el, 'v-if', true);
|
10499 |
+
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
|
10500 |
+
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
|
10501 |
+
var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
|
10502 |
+
// 1. checkbox
|
10503 |
+
var branch0 = cloneASTElement(el);
|
10504 |
+
// process for on the main node
|
10505 |
+
processFor(branch0);
|
10506 |
+
addRawAttr(branch0, 'type', 'checkbox');
|
10507 |
+
processElement(branch0, options);
|
10508 |
+
branch0.processed = true; // prevent it from double-processed
|
10509 |
+
branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
|
10510 |
+
addIfCondition(branch0, {
|
10511 |
+
exp: branch0.if,
|
10512 |
+
block: branch0
|
10513 |
+
});
|
10514 |
+
// 2. add radio else-if condition
|
10515 |
+
var branch1 = cloneASTElement(el);
|
10516 |
+
getAndRemoveAttr(branch1, 'v-for', true);
|
10517 |
+
addRawAttr(branch1, 'type', 'radio');
|
10518 |
+
processElement(branch1, options);
|
10519 |
+
addIfCondition(branch0, {
|
10520 |
+
exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
|
10521 |
+
block: branch1
|
10522 |
+
});
|
10523 |
+
// 3. other
|
10524 |
+
var branch2 = cloneASTElement(el);
|
10525 |
+
getAndRemoveAttr(branch2, 'v-for', true);
|
10526 |
+
addRawAttr(branch2, ':type', typeBinding);
|
10527 |
+
processElement(branch2, options);
|
10528 |
+
addIfCondition(branch0, {
|
10529 |
+
exp: ifCondition,
|
10530 |
+
block: branch2
|
10531 |
+
});
|
10532 |
+
|
10533 |
+
if (hasElse) {
|
10534 |
+
branch0.else = true;
|
10535 |
+
} else if (elseIfCondition) {
|
10536 |
+
branch0.elseif = elseIfCondition;
|
10537 |
+
}
|
10538 |
+
|
10539 |
+
return branch0
|
10540 |
+
}
|
10541 |
+
}
|
10542 |
+
}
|
10543 |
+
|
10544 |
+
function cloneASTElement (el) {
|
10545 |
+
return createASTElement(el.tag, el.attrsList.slice(), el.parent)
|
10546 |
+
}
|
10547 |
+
|
10548 |
+
var model$1 = {
|
10549 |
+
preTransformNode: preTransformNode
|
10550 |
+
};
|
10551 |
+
|
10552 |
+
var modules$1 = [
|
10553 |
+
klass$1,
|
10554 |
+
style$1,
|
10555 |
+
model$1
|
10556 |
+
];
|
10557 |
+
|
10558 |
+
/* */
|
10559 |
+
|
10560 |
+
function text (el, dir) {
|
10561 |
+
if (dir.value) {
|
10562 |
+
addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
|
10563 |
+
}
|
10564 |
+
}
|
10565 |
+
|
10566 |
+
/* */
|
10567 |
+
|
10568 |
+
function html (el, dir) {
|
10569 |
+
if (dir.value) {
|
10570 |
+
addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
|
10571 |
+
}
|
10572 |
+
}
|
10573 |
+
|
10574 |
+
var directives$1 = {
|
10575 |
+
model: model,
|
10576 |
+
text: text,
|
10577 |
+
html: html
|
10578 |
+
};
|
10579 |
+
|
10580 |
+
/* */
|
10581 |
+
|
10582 |
+
var baseOptions = {
|
10583 |
+
expectHTML: true,
|
10584 |
+
modules: modules$1,
|
10585 |
+
directives: directives$1,
|
10586 |
+
isPreTag: isPreTag,
|
10587 |
+
isUnaryTag: isUnaryTag,
|
10588 |
+
mustUseProp: mustUseProp,
|
10589 |
+
canBeLeftOpenTag: canBeLeftOpenTag,
|
10590 |
+
isReservedTag: isReservedTag,
|
10591 |
+
getTagNamespace: getTagNamespace,
|
10592 |
+
staticKeys: genStaticKeys(modules$1)
|
10593 |
+
};
|
10594 |
+
|
10595 |
+
/* */
|
10596 |
+
|
10597 |
+
var isStaticKey;
|
10598 |
+
var isPlatformReservedTag;
|
10599 |
+
|
10600 |
+
var genStaticKeysCached = cached(genStaticKeys$1);
|
10601 |
+
|
10602 |
+
/**
|
10603 |
+
* Goal of the optimizer: walk the generated template AST tree
|
10604 |
+
* and detect sub-trees that are purely static, i.e. parts of
|
10605 |
+
* the DOM that never needs to change.
|
10606 |
+
*
|
10607 |
+
* Once we detect these sub-trees, we can:
|
10608 |
+
*
|
10609 |
+
* 1. Hoist them into constants, so that we no longer need to
|
10610 |
+
* create fresh nodes for them on each re-render;
|
10611 |
+
* 2. Completely skip them in the patching process.
|
10612 |
+
*/
|
10613 |
+
function optimize (root, options) {
|
10614 |
+
if (!root) { return }
|
10615 |
+
isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
10616 |
+
isPlatformReservedTag = options.isReservedTag || no;
|
10617 |
+
// first pass: mark all non-static nodes.
|
10618 |
+
markStatic$1(root);
|
10619 |
+
// second pass: mark static roots.
|
10620 |
+
markStaticRoots(root, false);
|
10621 |
+
}
|
10622 |
+
|
10623 |
+
function genStaticKeys$1 (keys) {
|
10624 |
+
return makeMap(
|
10625 |
+
'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
10626 |
+
(keys ? ',' + keys : '')
|
10627 |
+
)
|
10628 |
+
}
|
10629 |
+
|
10630 |
+
function markStatic$1 (node) {
|
10631 |
+
node.static = isStatic(node);
|
10632 |
+
if (node.type === 1) {
|
10633 |
+
// do not make component slot content static. this avoids
|
10634 |
+
// 1. components not able to mutate slot nodes
|
10635 |
+
// 2. static slot content fails for hot-reloading
|
10636 |
+
if (
|
10637 |
+
!isPlatformReservedTag(node.tag) &&
|
10638 |
+
node.tag !== 'slot' &&
|
10639 |
+
node.attrsMap['inline-template'] == null
|
10640 |
+
) {
|
10641 |
+
return
|
10642 |
+
}
|
10643 |
+
for (var i = 0, l = node.children.length; i < l; i++) {
|
10644 |
+
var child = node.children[i];
|
10645 |
+
markStatic$1(child);
|
10646 |
+
if (!child.static) {
|
10647 |
+
node.static = false;
|
10648 |
+
}
|
10649 |
+
}
|
10650 |
+
if (node.ifConditions) {
|
10651 |
+
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10652 |
+
var block = node.ifConditions[i$1].block;
|
10653 |
+
markStatic$1(block);
|
10654 |
+
if (!block.static) {
|
10655 |
+
node.static = false;
|
10656 |
+
}
|
10657 |
+
}
|
10658 |
+
}
|
10659 |
+
}
|
10660 |
+
}
|
10661 |
+
|
10662 |
+
function markStaticRoots (node, isInFor) {
|
10663 |
+
if (node.type === 1) {
|
10664 |
+
if (node.static || node.once) {
|
10665 |
+
node.staticInFor = isInFor;
|
10666 |
+
}
|
10667 |
+
// For a node to qualify as a static root, it should have children that
|
10668 |
+
// are not just static text. Otherwise the cost of hoisting out will
|
10669 |
+
// outweigh the benefits and it's better off to just always render it fresh.
|
10670 |
+
if (node.static && node.children.length && !(
|
10671 |
+
node.children.length === 1 &&
|
10672 |
+
node.children[0].type === 3
|
10673 |
+
)) {
|
10674 |
+
node.staticRoot = true;
|
10675 |
+
return
|
10676 |
+
} else {
|
10677 |
+
node.staticRoot = false;
|
10678 |
+
}
|
10679 |
+
if (node.children) {
|
10680 |
+
for (var i = 0, l = node.children.length; i < l; i++) {
|
10681 |
+
markStaticRoots(node.children[i], isInFor || !!node.for);
|
10682 |
+
}
|
10683 |
+
}
|
10684 |
+
if (node.ifConditions) {
|
10685 |
+
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10686 |
+
markStaticRoots(node.ifConditions[i$1].block, isInFor);
|
10687 |
+
}
|
10688 |
+
}
|
10689 |
+
}
|
10690 |
+
}
|
10691 |
+
|
10692 |
+
function isStatic (node) {
|
10693 |
+
if (node.type === 2) { // expression
|
10694 |
+
return false
|
10695 |
+
}
|
10696 |
+
if (node.type === 3) { // text
|
10697 |
+
return true
|
10698 |
+
}
|
10699 |
+
return !!(node.pre || (
|
10700 |
+
!node.hasBindings && // no dynamic bindings
|
10701 |
+
!node.if && !node.for && // not v-if or v-for or v-else
|
10702 |
+
!isBuiltInTag(node.tag) && // not a built-in
|
10703 |
+
isPlatformReservedTag(node.tag) && // not a component
|
10704 |
+
!isDirectChildOfTemplateFor(node) &&
|
10705 |
+
Object.keys(node).every(isStaticKey)
|
10706 |
+
))
|
10707 |
+
}
|
10708 |
+
|
10709 |
+
function isDirectChildOfTemplateFor (node) {
|
10710 |
+
while (node.parent) {
|
10711 |
+
node = node.parent;
|
10712 |
+
if (node.tag !== 'template') {
|
10713 |
+
return false
|
10714 |
+
}
|
10715 |
+
if (node.for) {
|
10716 |
+
return true
|
10717 |
+
}
|
10718 |
+
}
|
10719 |
+
return false
|
10720 |
+
}
|
10721 |
+
|
10722 |
+
/* */
|
10723 |
+
|
10724 |
+
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
|
10725 |
+
var fnInvokeRE = /\([^)]*?\);*$/;
|
10726 |
+
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
10727 |
+
|
10728 |
+
// KeyboardEvent.keyCode aliases
|
10729 |
+
var keyCodes = {
|
10730 |
+
esc: 27,
|
10731 |
+
tab: 9,
|
10732 |
+
enter: 13,
|
10733 |
+
space: 32,
|
10734 |
+
up: 38,
|
10735 |
+
left: 37,
|
10736 |
+
right: 39,
|
10737 |
+
down: 40,
|
10738 |
+
'delete': [8, 46]
|
10739 |
+
};
|
10740 |
+
|
10741 |
+
// KeyboardEvent.key aliases
|
10742 |
+
var keyNames = {
|
10743 |
+
// #7880: IE11 and Edge use `Esc` for Escape key name.
|
10744 |
+
esc: ['Esc', 'Escape'],
|
10745 |
+
tab: 'Tab',
|
10746 |
+
enter: 'Enter',
|
10747 |
+
// #9112: IE11 uses `Spacebar` for Space key name.
|
10748 |
+
space: [' ', 'Spacebar'],
|
10749 |
+
// #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
|
10750 |
+
up: ['Up', 'ArrowUp'],
|
10751 |
+
left: ['Left', 'ArrowLeft'],
|
10752 |
+
right: ['Right', 'ArrowRight'],
|
10753 |
+
down: ['Down', 'ArrowDown'],
|
10754 |
+
// #9112: IE11 uses `Del` for Delete key name.
|
10755 |
+
'delete': ['Backspace', 'Delete', 'Del']
|
10756 |
+
};
|
10757 |
+
|
10758 |
+
// #4868: modifiers that prevent the execution of the listener
|
10759 |
+
// need to explicitly return null so that we can determine whether to remove
|
10760 |
+
// the listener for .once
|
10761 |
+
var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
|
10762 |
+
|
10763 |
+
var modifierCode = {
|
10764 |
+
stop: '$event.stopPropagation();',
|
10765 |
+
prevent: '$event.preventDefault();',
|
10766 |
+
self: genGuard("$event.target !== $event.currentTarget"),
|
10767 |
+
ctrl: genGuard("!$event.ctrlKey"),
|
10768 |
+
shift: genGuard("!$event.shiftKey"),
|
10769 |
+
alt: genGuard("!$event.altKey"),
|
10770 |
+
meta: genGuard("!$event.metaKey"),
|
10771 |
+
left: genGuard("'button' in $event && $event.button !== 0"),
|
10772 |
+
middle: genGuard("'button' in $event && $event.button !== 1"),
|
10773 |
+
right: genGuard("'button' in $event && $event.button !== 2")
|
10774 |
+
};
|
10775 |
+
|
10776 |
+
function genHandlers (
|
10777 |
+
events,
|
10778 |
+
isNative
|
10779 |
+
) {
|
10780 |
+
var prefix = isNative ? 'nativeOn:' : 'on:';
|
10781 |
+
var staticHandlers = "";
|
10782 |
+
var dynamicHandlers = "";
|
10783 |
+
for (var name in events) {
|
10784 |
+
var handlerCode = genHandler(events[name]);
|
10785 |
+
if (events[name] && events[name].dynamic) {
|
10786 |
+
dynamicHandlers += name + "," + handlerCode + ",";
|
10787 |
+
} else {
|
10788 |
+
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
10789 |
+
}
|
10790 |
+
}
|
10791 |
+
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
10792 |
+
if (dynamicHandlers) {
|
10793 |
+
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
10794 |
+
} else {
|
10795 |
+
return prefix + staticHandlers
|
10796 |
+
}
|
10797 |
+
}
|
10798 |
+
|
10799 |
+
function genHandler (handler) {
|
10800 |
+
if (!handler) {
|
10801 |
+
return 'function(){}'
|
10802 |
+
}
|
10803 |
+
|
10804 |
+
if (Array.isArray(handler)) {
|
10805 |
+
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
10806 |
+
}
|
10807 |
+
|
10808 |
+
var isMethodPath = simplePathRE.test(handler.value);
|
10809 |
+
var isFunctionExpression = fnExpRE.test(handler.value);
|
10810 |
+
var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
|
10811 |
+
|
10812 |
+
if (!handler.modifiers) {
|
10813 |
+
if (isMethodPath || isFunctionExpression) {
|
10814 |
+
return handler.value
|
10815 |
+
}
|
10816 |
+
return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
|
10817 |
+
} else {
|
10818 |
+
var code = '';
|
10819 |
+
var genModifierCode = '';
|
10820 |
+
var keys = [];
|
10821 |
+
for (var key in handler.modifiers) {
|
10822 |
+
if (modifierCode[key]) {
|
10823 |
+
genModifierCode += modifierCode[key];
|
10824 |
+
// left/right
|
10825 |
+
if (keyCodes[key]) {
|
10826 |
+
keys.push(key);
|
10827 |
+
}
|
10828 |
+
} else if (key === 'exact') {
|
10829 |
+
var modifiers = (handler.modifiers);
|
10830 |
+
genModifierCode += genGuard(
|
10831 |
+
['ctrl', 'shift', 'alt', 'meta']
|
10832 |
+
.filter(function (keyModifier) { return !modifiers[keyModifier]; })
|
10833 |
+
.map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
|
10834 |
+
.join('||')
|
10835 |
+
);
|
10836 |
+
} else {
|
10837 |
+
keys.push(key);
|
10838 |
+
}
|
10839 |
+
}
|
10840 |
+
if (keys.length) {
|
10841 |
+
code += genKeyFilter(keys);
|
10842 |
+
}
|
10843 |
+
// Make sure modifiers like prevent and stop get executed after key filtering
|
10844 |
+
if (genModifierCode) {
|
10845 |
+
code += genModifierCode;
|
10846 |
+
}
|
10847 |
+
var handlerCode = isMethodPath
|
10848 |
+
? ("return " + (handler.value) + "($event)")
|
10849 |
+
: isFunctionExpression
|
10850 |
+
? ("return (" + (handler.value) + ")($event)")
|
10851 |
+
: isFunctionInvocation
|
10852 |
+
? ("return " + (handler.value))
|
10853 |
+
: handler.value;
|
10854 |
+
return ("function($event){" + code + handlerCode + "}")
|
10855 |
+
}
|
10856 |
+
}
|
10857 |
+
|
10858 |
+
function genKeyFilter (keys) {
|
10859 |
+
return (
|
10860 |
+
// make sure the key filters only apply to KeyboardEvents
|
10861 |
+
// #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
|
10862 |
+
// key events that do not have keyCode property...
|
10863 |
+
"if(!$event.type.indexOf('key')&&" +
|
10864 |
+
(keys.map(genFilterCode).join('&&')) + ")return null;"
|
10865 |
+
)
|
10866 |
+
}
|
10867 |
+
|
10868 |
+
function genFilterCode (key) {
|
10869 |
+
var keyVal = parseInt(key, 10);
|
10870 |
+
if (keyVal) {
|
10871 |
+
return ("$event.keyCode!==" + keyVal)
|
10872 |
+
}
|
10873 |
+
var keyCode = keyCodes[key];
|
10874 |
+
var keyName = keyNames[key];
|
10875 |
+
return (
|
10876 |
+
"_k($event.keyCode," +
|
10877 |
+
(JSON.stringify(key)) + "," +
|
10878 |
+
(JSON.stringify(keyCode)) + "," +
|
10879 |
+
"$event.key," +
|
10880 |
+
"" + (JSON.stringify(keyName)) +
|
10881 |
+
")"
|
10882 |
+
)
|
10883 |
+
}
|
10884 |
+
|
10885 |
+
/* */
|
10886 |
+
|
10887 |
+
function on (el, dir) {
|
10888 |
+
if (dir.modifiers) {
|
10889 |
+
warn("v-on without argument does not support modifiers.");
|
10890 |
+
}
|
10891 |
+
el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
|
10892 |
+
}
|
10893 |
+
|
10894 |
+
/* */
|
10895 |
+
|
10896 |
+
function bind$1 (el, dir) {
|
10897 |
+
el.wrapData = function (code) {
|
10898 |
+
return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
|
10899 |
+
};
|
10900 |
+
}
|
10901 |
+
|
10902 |
+
/* */
|
10903 |
+
|
10904 |
+
var baseDirectives = {
|
10905 |
+
on: on,
|
10906 |
+
bind: bind$1,
|
10907 |
+
cloak: noop
|
10908 |
+
};
|
10909 |
+
|
10910 |
+
/* */
|
10911 |
+
|
10912 |
+
|
10913 |
+
|
10914 |
+
|
10915 |
+
|
10916 |
+
var CodegenState = function CodegenState (options) {
|
10917 |
+
this.options = options;
|
10918 |
+
this.warn = options.warn || baseWarn;
|
10919 |
+
this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
10920 |
+
this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
10921 |
+
this.directives = extend(extend({}, baseDirectives), options.directives);
|
10922 |
+
var isReservedTag = options.isReservedTag || no;
|
10923 |
+
this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
10924 |
+
this.onceId = 0;
|
10925 |
+
this.staticRenderFns = [];
|
10926 |
+
this.pre = false;
|
10927 |
+
};
|
10928 |
+
|
10929 |
+
|
10930 |
+
|
10931 |
+
function generate (
|
10932 |
+
ast,
|
10933 |
+
options
|
10934 |
+
) {
|
10935 |
+
var state = new CodegenState(options);
|
10936 |
+
var code = ast ? genElement(ast, state) : '_c("div")';
|
10937 |
+
return {
|
10938 |
+
render: ("with(this){return " + code + "}"),
|
10939 |
+
staticRenderFns: state.staticRenderFns
|
10940 |
+
}
|
10941 |
+
}
|
10942 |
+
|
10943 |
+
function genElement (el, state) {
|
10944 |
+
if (el.parent) {
|
10945 |
+
el.pre = el.pre || el.parent.pre;
|
10946 |
+
}
|
10947 |
+
|
10948 |
+
if (el.staticRoot && !el.staticProcessed) {
|
10949 |
+
return genStatic(el, state)
|
10950 |
+
} else if (el.once && !el.onceProcessed) {
|
10951 |
+
return genOnce(el, state)
|
10952 |
+
} else if (el.for && !el.forProcessed) {
|
10953 |
+
return genFor(el, state)
|
10954 |
+
} else if (el.if && !el.ifProcessed) {
|
10955 |
+
return genIf(el, state)
|
10956 |
+
} else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
10957 |
+
return genChildren(el, state) || 'void 0'
|
10958 |
+
} else if (el.tag === 'slot') {
|
10959 |
+
return genSlot(el, state)
|
10960 |
+
} else {
|
10961 |
+
// component or element
|
10962 |
+
var code;
|
10963 |
+
if (el.component) {
|
10964 |
+
code = genComponent(el.component, el, state);
|
10965 |
+
} else {
|
10966 |
+
var data;
|
10967 |
+
if (!el.plain || (el.pre && state.maybeComponent(el))) {
|
10968 |
+
data = genData$2(el, state);
|
10969 |
+
}
|
10970 |
+
|
10971 |
+
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
10972 |
+
code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
10973 |
+
}
|
10974 |
+
// module transforms
|
10975 |
+
for (var i = 0; i < state.transforms.length; i++) {
|
10976 |
+
code = state.transforms[i](el, code);
|
10977 |
+
}
|
10978 |
+
return code
|
10979 |
+
}
|
10980 |
+
}
|
10981 |
+
|
10982 |
+
// hoist static sub-trees out
|
10983 |
+
function genStatic (el, state) {
|
10984 |
+
el.staticProcessed = true;
|
10985 |
+
// Some elements (templates) need to behave differently inside of a v-pre
|
10986 |
+
// node. All pre nodes are static roots, so we can use this as a location to
|
10987 |
+
// wrap a state change and reset it upon exiting the pre node.
|
10988 |
+
var originalPreState = state.pre;
|
10989 |
+
if (el.pre) {
|
10990 |
+
state.pre = el.pre;
|
10991 |
+
}
|
10992 |
+
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
10993 |
+
state.pre = originalPreState;
|
10994 |
+
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
10995 |
+
}
|
10996 |
+
|
10997 |
+
// v-once
|
10998 |
+
function genOnce (el, state) {
|
10999 |
+
el.onceProcessed = true;
|
11000 |
+
if (el.if && !el.ifProcessed) {
|
11001 |
+
return genIf(el, state)
|
11002 |
+
} else if (el.staticInFor) {
|
11003 |
+
var key = '';
|
11004 |
+
var parent = el.parent;
|
11005 |
+
while (parent) {
|
11006 |
+
if (parent.for) {
|
11007 |
+
key = parent.key;
|
11008 |
+
break
|
11009 |
+
}
|
11010 |
+
parent = parent.parent;
|
11011 |
+
}
|
11012 |
+
if (!key) {
|
11013 |
+
state.warn(
|
11014 |
+
"v-once can only be used inside v-for that is keyed. ",
|
11015 |
+
el.rawAttrsMap['v-once']
|
11016 |
+
);
|
11017 |
+
return genElement(el, state)
|
11018 |
+
}
|
11019 |
+
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
11020 |
+
} else {
|
11021 |
+
return genStatic(el, state)
|
11022 |
+
}
|
11023 |
+
}
|
11024 |
+
|
11025 |
+
function genIf (
|
11026 |
+
el,
|
11027 |
+
state,
|
11028 |
+
altGen,
|
11029 |
+
altEmpty
|
11030 |
+
) {
|
11031 |
+
el.ifProcessed = true; // avoid recursion
|
11032 |
+
return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
|
11033 |
+
}
|
11034 |
+
|
11035 |
+
function genIfConditions (
|
11036 |
+
conditions,
|
11037 |
+
state,
|
11038 |
+
altGen,
|
11039 |
+
altEmpty
|
11040 |
+
) {
|
11041 |
+
if (!conditions.length) {
|
11042 |
+
return altEmpty || '_e()'
|
11043 |
+
}
|
11044 |
+
|
11045 |
+
var condition = conditions.shift();
|
11046 |
+
if (condition.exp) {
|
11047 |
+
return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
|
11048 |
+
} else {
|
11049 |
+
return ("" + (genTernaryExp(condition.block)))
|
11050 |
+
}
|
11051 |
+
|
11052 |
+
// v-if with v-once should generate code like (a)?_m(0):_m(1)
|
11053 |
+
function genTernaryExp (el) {
|
11054 |
+
return altGen
|
11055 |
+
? altGen(el, state)
|
11056 |
+
: el.once
|
11057 |
+
? genOnce(el, state)
|
11058 |
+
: genElement(el, state)
|
11059 |
+
}
|
11060 |
+
}
|
11061 |
+
|
11062 |
+
function genFor (
|
11063 |
+
el,
|
11064 |
+
state,
|
11065 |
+
altGen,
|
11066 |
+
altHelper
|
11067 |
+
) {
|
11068 |
+
var exp = el.for;
|
11069 |
+
var alias = el.alias;
|
11070 |
+
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
|
11071 |
+
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
|
11072 |
+
|
11073 |
+
if (state.maybeComponent(el) &&
|
11074 |
+
el.tag !== 'slot' &&
|
11075 |
+
el.tag !== 'template' &&
|
11076 |
+
!el.key
|
11077 |
+
) {
|
11078 |
+
state.warn(
|
11079 |
+
"<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
|
11080 |
+
"v-for should have explicit keys. " +
|
11081 |
+
"See https://vuejs.org/guide/list.html#key for more info.",
|
11082 |
+
el.rawAttrsMap['v-for'],
|
11083 |
+
true /* tip */
|
11084 |
+
);
|
11085 |
+
}
|
11086 |
+
|
11087 |
+
el.forProcessed = true; // avoid recursion
|
11088 |
+
return (altHelper || '_l') + "((" + exp + ")," +
|
11089 |
+
"function(" + alias + iterator1 + iterator2 + "){" +
|
11090 |
+
"return " + ((altGen || genElement)(el, state)) +
|
11091 |
+
'})'
|
11092 |
+
}
|
11093 |
+
|
11094 |
+
function genData$2 (el, state) {
|
11095 |
+
var data = '{';
|
11096 |
+
|
11097 |
+
// directives first.
|
11098 |
+
// directives may mutate the el's other properties before they are generated.
|
11099 |
+
var dirs = genDirectives(el, state);
|
11100 |
+
if (dirs) { data += dirs + ','; }
|
11101 |
+
|
11102 |
+
// key
|
11103 |
+
if (el.key) {
|
11104 |
+
data += "key:" + (el.key) + ",";
|
11105 |
+
}
|
11106 |
+
// ref
|
11107 |
+
if (el.ref) {
|
11108 |
+
data += "ref:" + (el.ref) + ",";
|
11109 |
+
}
|
11110 |
+
if (el.refInFor) {
|
11111 |
+
data += "refInFor:true,";
|
11112 |
+
}
|
11113 |
+
// pre
|
11114 |
+
if (el.pre) {
|
11115 |
+
data += "pre:true,";
|
11116 |
+
}
|
11117 |
+
// record original tag name for components using "is" attribute
|
11118 |
+
if (el.component) {
|
11119 |
+
data += "tag:\"" + (el.tag) + "\",";
|
11120 |
+
}
|
11121 |
+
// module data generation functions
|
11122 |
+
for (var i = 0; i < state.dataGenFns.length; i++) {
|
11123 |
+
data += state.dataGenFns[i](el);
|
11124 |
+
}
|
11125 |
+
// attributes
|
11126 |
+
if (el.attrs) {
|
11127 |
+
data += "attrs:" + (genProps(el.attrs)) + ",";
|
11128 |
+
}
|
11129 |
+
// DOM props
|
11130 |
+
if (el.props) {
|
11131 |
+
data += "domProps:" + (genProps(el.props)) + ",";
|
11132 |
+
}
|
11133 |
+
// event handlers
|
11134 |
+
if (el.events) {
|
11135 |
+
data += (genHandlers(el.events, false)) + ",";
|
11136 |
+
}
|
11137 |
+
if (el.nativeEvents) {
|
11138 |
+
data += (genHandlers(el.nativeEvents, true)) + ",";
|
11139 |
+
}
|
11140 |
+
// slot target
|
11141 |
+
// only for non-scoped slots
|
11142 |
+
if (el.slotTarget && !el.slotScope) {
|
11143 |
+
data += "slot:" + (el.slotTarget) + ",";
|
11144 |
+
}
|
11145 |
+
// scoped slots
|
11146 |
+
if (el.scopedSlots) {
|
11147 |
+
data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
|
11148 |
+
}
|
11149 |
+
// component v-model
|
11150 |
+
if (el.model) {
|
11151 |
+
data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
11152 |
+
}
|
11153 |
+
// inline-template
|
11154 |
+
if (el.inlineTemplate) {
|
11155 |
+
var inlineTemplate = genInlineTemplate(el, state);
|
11156 |
+
if (inlineTemplate) {
|
11157 |
+
data += inlineTemplate + ",";
|
11158 |
+
}
|
11159 |
+
}
|
11160 |
+
data = data.replace(/,$/, '') + '}';
|
11161 |
+
// v-bind dynamic argument wrap
|
11162 |
+
// v-bind with dynamic arguments must be applied using the same v-bind object
|
11163 |
+
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
11164 |
+
if (el.dynamicAttrs) {
|
11165 |
+
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
11166 |
+
}
|
11167 |
+
// v-bind data wrap
|
11168 |
+
if (el.wrapData) {
|
11169 |
+
data = el.wrapData(data);
|
11170 |
+
}
|
11171 |
+
// v-on data wrap
|
11172 |
+
if (el.wrapListeners) {
|
11173 |
+
data = el.wrapListeners(data);
|
11174 |
+
}
|
11175 |
+
return data
|
11176 |
+
}
|
11177 |
+
|
11178 |
+
function genDirectives (el, state) {
|
11179 |
+
var dirs = el.directives;
|
11180 |
+
if (!dirs) { return }
|
11181 |
+
var res = 'directives:[';
|
11182 |
+
var hasRuntime = false;
|
11183 |
+
var i, l, dir, needRuntime;
|
11184 |
+
for (i = 0, l = dirs.length; i < l; i++) {
|
11185 |
+
dir = dirs[i];
|
11186 |
+
needRuntime = true;
|
11187 |
+
var gen = state.directives[dir.name];
|
11188 |
+
if (gen) {
|
11189 |
+
// compile-time directive that manipulates AST.
|
11190 |
+
// returns true if it also needs a runtime counterpart.
|
11191 |
+
needRuntime = !!gen(el, dir, state.warn);
|
11192 |
+
}
|
11193 |
+
if (needRuntime) {
|
11194 |
+
hasRuntime = true;
|
11195 |
+
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
11196 |
+
}
|
11197 |
+
}
|
11198 |
+
if (hasRuntime) {
|
11199 |
+
return res.slice(0, -1) + ']'
|
11200 |
+
}
|
11201 |
+
}
|
11202 |
+
|
11203 |
+
function genInlineTemplate (el, state) {
|
11204 |
+
var ast = el.children[0];
|
11205 |
+
if (el.children.length !== 1 || ast.type !== 1) {
|
11206 |
+
state.warn(
|
11207 |
+
'Inline-template components must have exactly one child element.',
|
11208 |
+
{ start: el.start }
|
11209 |
+
);
|
11210 |
+
}
|
11211 |
+
if (ast && ast.type === 1) {
|
11212 |
+
var inlineRenderFns = generate(ast, state.options);
|
11213 |
+
return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
|
11214 |
+
}
|
11215 |
+
}
|
11216 |
+
|
11217 |
+
function genScopedSlots (
|
11218 |
+
el,
|
11219 |
+
slots,
|
11220 |
+
state
|
11221 |
+
) {
|
11222 |
+
// by default scoped slots are considered "stable", this allows child
|
11223 |
+
// components with only scoped slots to skip forced updates from parent.
|
11224 |
+
// but in some cases we have to bail-out of this optimization
|
11225 |
+
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
11226 |
+
var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
|
11227 |
+
var slot = slots[key];
|
11228 |
+
return (
|
11229 |
+
slot.slotTargetDynamic ||
|
11230 |
+
slot.if ||
|
11231 |
+
slot.for ||
|
11232 |
+
containsSlotChild(slot) // is passing down slot from parent which may be dynamic
|
11233 |
+
)
|
11234 |
+
});
|
11235 |
+
|
11236 |
+
// #9534: if a component with scoped slots is inside a conditional branch,
|
11237 |
+
// it's possible for the same component to be reused but with different
|
11238 |
+
// compiled slot content. To avoid that, we generate a unique key based on
|
11239 |
+
// the generated code of all the slot contents.
|
11240 |
+
var needsKey = !!el.if;
|
11241 |
+
|
11242 |
+
// OR when it is inside another scoped slot or v-for (the reactivity may be
|
11243 |
+
// disconnected due to the intermediate scope variable)
|
11244 |
+
// #9438, #9506
|
11245 |
+
// TODO: this can be further optimized by properly analyzing in-scope bindings
|
11246 |
+
// and skip force updating ones that do not actually use scope variables.
|
11247 |
+
if (!needsForceUpdate) {
|
11248 |
+
var parent = el.parent;
|
11249 |
+
while (parent) {
|
11250 |
+
if (
|
11251 |
+
(parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
|
11252 |
+
parent.for
|
11253 |
+
) {
|
11254 |
+
needsForceUpdate = true;
|
11255 |
+
break
|
11256 |
+
}
|
11257 |
+
if (parent.if) {
|
11258 |
+
needsKey = true;
|
11259 |
+
}
|
11260 |
+
parent = parent.parent;
|
11261 |
+
}
|
11262 |
+
}
|
11263 |
+
|
11264 |
+
var generatedSlots = Object.keys(slots)
|
11265 |
+
.map(function (key) { return genScopedSlot(slots[key], state); })
|
11266 |
+
.join(',');
|
11267 |
+
|
11268 |
+
return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
|
11269 |
+
}
|
11270 |
+
|
11271 |
+
function hash(str) {
|
11272 |
+
var hash = 5381;
|
11273 |
+
var i = str.length;
|
11274 |
+
while(i) {
|
11275 |
+
hash = (hash * 33) ^ str.charCodeAt(--i);
|
11276 |
+
}
|
11277 |
+
return hash >>> 0
|
11278 |
+
}
|
11279 |
+
|
11280 |
+
function containsSlotChild (el) {
|
11281 |
+
if (el.type === 1) {
|
11282 |
+
if (el.tag === 'slot') {
|
11283 |
+
return true
|
11284 |
+
}
|
11285 |
+
return el.children.some(containsSlotChild)
|
11286 |
+
}
|
11287 |
+
return false
|
11288 |
+
}
|
11289 |
+
|
11290 |
+
function genScopedSlot (
|
11291 |
+
el,
|
11292 |
+
state
|
11293 |
+
) {
|
11294 |
+
var isLegacySyntax = el.attrsMap['slot-scope'];
|
11295 |
+
if (el.if && !el.ifProcessed && !isLegacySyntax) {
|
11296 |
+
return genIf(el, state, genScopedSlot, "null")
|
11297 |
+
}
|
11298 |
+
if (el.for && !el.forProcessed) {
|
11299 |
+
return genFor(el, state, genScopedSlot)
|
11300 |
+
}
|
11301 |
+
var slotScope = el.slotScope === emptySlotScopeToken
|
11302 |
+
? ""
|
11303 |
+
: String(el.slotScope);
|
11304 |
+
var fn = "function(" + slotScope + "){" +
|
11305 |
+
"return " + (el.tag === 'template'
|
11306 |
+
? el.if && isLegacySyntax
|
11307 |
+
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
|
11308 |
+
: genChildren(el, state) || 'undefined'
|
11309 |
+
: genElement(el, state)) + "}";
|
11310 |
+
// reverse proxy v-slot without scope on this.$slots
|
11311 |
+
var reverseProxy = slotScope ? "" : ",proxy:true";
|
11312 |
+
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
|
11313 |
+
}
|
11314 |
+
|
11315 |
+
function genChildren (
|
11316 |
+
el,
|
11317 |
+
state,
|
11318 |
+
checkSkip,
|
11319 |
+
altGenElement,
|
11320 |
+
altGenNode
|
11321 |
+
) {
|
11322 |
+
var children = el.children;
|
11323 |
+
if (children.length) {
|
11324 |
+
var el$1 = children[0];
|
11325 |
+
// optimize single v-for
|
11326 |
+
if (children.length === 1 &&
|
11327 |
+
el$1.for &&
|
11328 |
+
el$1.tag !== 'template' &&
|
11329 |
+
el$1.tag !== 'slot'
|
11330 |
+
) {
|
11331 |
+
var normalizationType = checkSkip
|
11332 |
+
? state.maybeComponent(el$1) ? ",1" : ",0"
|
11333 |
+
: "";
|
11334 |
+
return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
|
11335 |
+
}
|
11336 |
+
var normalizationType$1 = checkSkip
|
11337 |
+
? getNormalizationType(children, state.maybeComponent)
|
11338 |
+
: 0;
|
11339 |
+
var gen = altGenNode || genNode;
|
11340 |
+
return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
|
11341 |
+
}
|
11342 |
+
}
|
11343 |
+
|
11344 |
+
// determine the normalization needed for the children array.
|
11345 |
+
// 0: no normalization needed
|
11346 |
+
// 1: simple normalization needed (possible 1-level deep nested array)
|
11347 |
+
// 2: full normalization needed
|
11348 |
+
function getNormalizationType (
|
11349 |
+
children,
|
11350 |
+
maybeComponent
|
11351 |
+
) {
|
11352 |
+
var res = 0;
|
11353 |
+
for (var i = 0; i < children.length; i++) {
|
11354 |
+
var el = children[i];
|
11355 |
+
if (el.type !== 1) {
|
11356 |
+
continue
|
11357 |
+
}
|
11358 |
+
if (needsNormalization(el) ||
|
11359 |
+
(el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
11360 |
+
res = 2;
|
11361 |
+
break
|
11362 |
+
}
|
11363 |
+
if (maybeComponent(el) ||
|
11364 |
+
(el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
11365 |
+
res = 1;
|
11366 |
+
}
|
11367 |
+
}
|
11368 |
+
return res
|
11369 |
+
}
|
11370 |
+
|
11371 |
+
function needsNormalization (el) {
|
11372 |
+
return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
11373 |
+
}
|
11374 |
+
|
11375 |
+
function genNode (node, state) {
|
11376 |
+
if (node.type === 1) {
|
11377 |
+
return genElement(node, state)
|
11378 |
+
} else if (node.type === 3 && node.isComment) {
|
11379 |
+
return genComment(node)
|
11380 |
+
} else {
|
11381 |
+
return genText(node)
|
11382 |
+
}
|
11383 |
+
}
|
11384 |
+
|
11385 |
+
function genText (text) {
|
11386 |
+
return ("_v(" + (text.type === 2
|
11387 |
+
? text.expression // no need for () because already wrapped in _s()
|
11388 |
+
: transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
11389 |
+
}
|
11390 |
+
|
11391 |
+
function genComment (comment) {
|
11392 |
+
return ("_e(" + (JSON.stringify(comment.text)) + ")")
|
11393 |
+
}
|
11394 |
+
|
11395 |
+
function genSlot (el, state) {
|
11396 |
+
var slotName = el.slotName || '"default"';
|
11397 |
+
var children = genChildren(el, state);
|
11398 |
+
var res = "_t(" + slotName + (children ? ("," + children) : '');
|
11399 |
+
var attrs = el.attrs || el.dynamicAttrs
|
11400 |
+
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
11401 |
+
// slot props are camelized
|
11402 |
+
name: camelize(attr.name),
|
11403 |
+
value: attr.value,
|
11404 |
+
dynamic: attr.dynamic
|
11405 |
+
}); }))
|
11406 |
+
: null;
|
11407 |
+
var bind$$1 = el.attrsMap['v-bind'];
|
11408 |
+
if ((attrs || bind$$1) && !children) {
|
11409 |
+
res += ",null";
|
11410 |
+
}
|
11411 |
+
if (attrs) {
|
11412 |
+
res += "," + attrs;
|
11413 |
+
}
|
11414 |
+
if (bind$$1) {
|
11415 |
+
res += (attrs ? '' : ',null') + "," + bind$$1;
|
11416 |
+
}
|
11417 |
+
return res + ')'
|
11418 |
+
}
|
11419 |
+
|
11420 |
+
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
|
11421 |
+
function genComponent (
|
11422 |
+
componentName,
|
11423 |
+
el,
|
11424 |
+
state
|
11425 |
+
) {
|
11426 |
+
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
11427 |
+
return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
|
11428 |
+
}
|
11429 |
+
|
11430 |
+
function genProps (props) {
|
11431 |
+
var staticProps = "";
|
11432 |
+
var dynamicProps = "";
|
11433 |
+
for (var i = 0; i < props.length; i++) {
|
11434 |
+
var prop = props[i];
|
11435 |
+
var value = transformSpecialNewlines(prop.value);
|
11436 |
+
if (prop.dynamic) {
|
11437 |
+
dynamicProps += (prop.name) + "," + value + ",";
|
11438 |
+
} else {
|
11439 |
+
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
11440 |
+
}
|
11441 |
+
}
|
11442 |
+
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
11443 |
+
if (dynamicProps) {
|
11444 |
+
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
11445 |
+
} else {
|
11446 |
+
return staticProps
|
11447 |
+
}
|
11448 |
+
}
|
11449 |
+
|
11450 |
+
// #3895, #4268
|
11451 |
+
function transformSpecialNewlines (text) {
|
11452 |
+
return text
|
11453 |
+
.replace(/\u2028/g, '\\u2028')
|
11454 |
+
.replace(/\u2029/g, '\\u2029')
|
11455 |
+
}
|
11456 |
+
|
11457 |
+
/* */
|
11458 |
+
|
11459 |
+
|
11460 |
+
|
11461 |
+
// these keywords should not appear inside expressions, but operators like
|
11462 |
+
// typeof, instanceof and in are allowed
|
11463 |
+
var prohibitedKeywordRE = new RegExp('\\b' + (
|
11464 |
+
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
11465 |
+
'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
11466 |
+
'extends,finally,continue,debugger,function,arguments'
|
11467 |
+
).split(',').join('\\b|\\b') + '\\b');
|
11468 |
+
|
11469 |
+
// these unary operators should not be used as property/method names
|
11470 |
+
var unaryOperatorsRE = new RegExp('\\b' + (
|
11471 |
+
'delete,typeof,void'
|
11472 |
+
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
11473 |
+
|
11474 |
+
// strip strings in expressions
|
11475 |
+
var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
11476 |
+
|
11477 |
+
// detect problematic expressions in a template
|
11478 |
+
function detectErrors (ast, warn) {
|
11479 |
+
if (ast) {
|
11480 |
+
checkNode(ast, warn);
|
11481 |
+
}
|
11482 |
+
}
|
11483 |
+
|
11484 |
+
function checkNode (node, warn) {
|
11485 |
+
if (node.type === 1) {
|
11486 |
+
for (var name in node.attrsMap) {
|
11487 |
+
if (dirRE.test(name)) {
|
11488 |
+
var value = node.attrsMap[name];
|
11489 |
+
if (value) {
|
11490 |
+
var range = node.rawAttrsMap[name];
|
11491 |
+
if (name === 'v-for') {
|
11492 |
+
checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
11493 |
+
} else if (onRE.test(name)) {
|
11494 |
+
checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
11495 |
+
} else {
|
11496 |
+
checkExpression(value, (name + "=\"" + value + "\""), warn, range);
|
11497 |
+
}
|
11498 |
+
}
|
11499 |
+
}
|
11500 |
+
}
|
11501 |
+
if (node.children) {
|
11502 |
+
for (var i = 0; i < node.children.length; i++) {
|
11503 |
+
checkNode(node.children[i], warn);
|
11504 |
+
}
|
11505 |
+
}
|
11506 |
+
} else if (node.type === 2) {
|
11507 |
+
checkExpression(node.expression, node.text, warn, node);
|
11508 |
+
}
|
11509 |
+
}
|
11510 |
+
|
11511 |
+
function checkEvent (exp, text, warn, range) {
|
11512 |
+
var stipped = exp.replace(stripStringRE, '');
|
11513 |
+
var keywordMatch = stipped.match(unaryOperatorsRE);
|
11514 |
+
if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
11515 |
+
warn(
|
11516 |
+
"avoid using JavaScript unary operator as property name: " +
|
11517 |
+
"\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
11518 |
+
range
|
11519 |
+
);
|
11520 |
+
}
|
11521 |
+
checkExpression(exp, text, warn, range);
|
11522 |
+
}
|
11523 |
+
|
11524 |
+
function checkFor (node, text, warn, range) {
|
11525 |
+
checkExpression(node.for || '', text, warn, range);
|
11526 |
+
checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
11527 |
+
checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
11528 |
+
checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
11529 |
+
}
|
11530 |
+
|
11531 |
+
function checkIdentifier (
|
11532 |
+
ident,
|
11533 |
+
type,
|
11534 |
+
text,
|
11535 |
+
warn,
|
11536 |
+
range
|
11537 |
+
) {
|
11538 |
+
if (typeof ident === 'string') {
|
11539 |
+
try {
|
11540 |
+
new Function(("var " + ident + "=_"));
|
11541 |
+
} catch (e) {
|
11542 |
+
warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
|
11543 |
+
}
|
11544 |
+
}
|
11545 |
+
}
|
11546 |
+
|
11547 |
+
function checkExpression (exp, text, warn, range) {
|
11548 |
+
try {
|
11549 |
+
new Function(("return " + exp));
|
11550 |
+
} catch (e) {
|
11551 |
+
var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
|
11552 |
+
if (keywordMatch) {
|
11553 |
+
warn(
|
11554 |
+
"avoid using JavaScript keyword as property name: " +
|
11555 |
+
"\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
|
11556 |
+
range
|
11557 |
+
);
|
11558 |
+
} else {
|
11559 |
+
warn(
|
11560 |
+
"invalid expression: " + (e.message) + " in\n\n" +
|
11561 |
+
" " + exp + "\n\n" +
|
11562 |
+
" Raw expression: " + (text.trim()) + "\n",
|
11563 |
+
range
|
11564 |
+
);
|
11565 |
+
}
|
11566 |
+
}
|
11567 |
+
}
|
11568 |
+
|
11569 |
+
/* */
|
11570 |
+
|
11571 |
+
var range = 2;
|
11572 |
+
|
11573 |
+
function generateCodeFrame (
|
11574 |
+
source,
|
11575 |
+
start,
|
11576 |
+
end
|
11577 |
+
) {
|
11578 |
+
if ( start === void 0 ) start = 0;
|
11579 |
+
if ( end === void 0 ) end = source.length;
|
11580 |
+
|
11581 |
+
var lines = source.split(/\r?\n/);
|
11582 |
+
var count = 0;
|
11583 |
+
var res = [];
|
11584 |
+
for (var i = 0; i < lines.length; i++) {
|
11585 |
+
count += lines[i].length + 1;
|
11586 |
+
if (count >= start) {
|
11587 |
+
for (var j = i - range; j <= i + range || end > count; j++) {
|
11588 |
+
if (j < 0 || j >= lines.length) { continue }
|
11589 |
+
res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
|
11590 |
+
var lineLength = lines[j].length;
|
11591 |
+
if (j === i) {
|
11592 |
+
// push underline
|
11593 |
+
var pad = start - (count - lineLength) + 1;
|
11594 |
+
var length = end > count ? lineLength - pad : end - start;
|
11595 |
+
res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
|
11596 |
+
} else if (j > i) {
|
11597 |
+
if (end > count) {
|
11598 |
+
var length$1 = Math.min(end - count, lineLength);
|
11599 |
+
res.push(" | " + repeat$1("^", length$1));
|
11600 |
+
}
|
11601 |
+
count += lineLength + 1;
|
11602 |
+
}
|
11603 |
+
}
|
11604 |
+
break
|
11605 |
+
}
|
11606 |
+
}
|
11607 |
+
return res.join('\n')
|
11608 |
+
}
|
11609 |
+
|
11610 |
+
function repeat$1 (str, n) {
|
11611 |
+
var result = '';
|
11612 |
+
if (n > 0) {
|
11613 |
+
while (true) { // eslint-disable-line
|
11614 |
+
if (n & 1) { result += str; }
|
11615 |
+
n >>>= 1;
|
11616 |
+
if (n <= 0) { break }
|
11617 |
+
str += str;
|
11618 |
+
}
|
11619 |
+
}
|
11620 |
+
return result
|
11621 |
+
}
|
11622 |
+
|
11623 |
+
/* */
|
11624 |
+
|
11625 |
+
|
11626 |
+
|
11627 |
+
function createFunction (code, errors) {
|
11628 |
+
try {
|
11629 |
+
return new Function(code)
|
11630 |
+
} catch (err) {
|
11631 |
+
errors.push({ err: err, code: code });
|
11632 |
+
return noop
|
11633 |
+
}
|
11634 |
+
}
|
11635 |
+
|
11636 |
+
function createCompileToFunctionFn (compile) {
|
11637 |
+
var cache = Object.create(null);
|
11638 |
+
|
11639 |
+
return function compileToFunctions (
|
11640 |
+
template,
|
11641 |
+
options,
|
11642 |
+
vm
|
11643 |
+
) {
|
11644 |
+
options = extend({}, options);
|
11645 |
+
var warn$$1 = options.warn || warn;
|
11646 |
+
delete options.warn;
|
11647 |
+
|
11648 |
+
/* istanbul ignore if */
|
11649 |
+
{
|
11650 |
+
// detect possible CSP restriction
|
11651 |
+
try {
|
11652 |
+
new Function('return 1');
|
11653 |
+
} catch (e) {
|
11654 |
+
if (e.toString().match(/unsafe-eval|CSP/)) {
|
11655 |
+
warn$$1(
|
11656 |
+
'It seems you are using the standalone build of Vue.js in an ' +
|
11657 |
+
'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
11658 |
+
'The template compiler cannot work in this environment. Consider ' +
|
11659 |
+
'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
11660 |
+
'templates into render functions.'
|
11661 |
+
);
|
11662 |
+
}
|
11663 |
+
}
|
11664 |
+
}
|
11665 |
+
|
11666 |
+
// check cache
|
11667 |
+
var key = options.delimiters
|
11668 |
+
? String(options.delimiters) + template
|
11669 |
+
: template;
|
11670 |
+
if (cache[key]) {
|
11671 |
+
return cache[key]
|
11672 |
+
}
|
11673 |
+
|
11674 |
+
// compile
|
11675 |
+
var compiled = compile(template, options);
|
11676 |
+
|
11677 |
+
// check compilation errors/tips
|
11678 |
+
{
|
11679 |
+
if (compiled.errors && compiled.errors.length) {
|
11680 |
+
if (options.outputSourceRange) {
|
11681 |
+
compiled.errors.forEach(function (e) {
|
11682 |
+
warn$$1(
|
11683 |
+
"Error compiling template:\n\n" + (e.msg) + "\n\n" +
|
11684 |
+
generateCodeFrame(template, e.start, e.end),
|
11685 |
+
vm
|
11686 |
+
);
|
11687 |
+
});
|
11688 |
+
} else {
|
11689 |
+
warn$$1(
|
11690 |
+
"Error compiling template:\n\n" + template + "\n\n" +
|
11691 |
+
compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
|
11692 |
+
vm
|
11693 |
+
);
|
11694 |
+
}
|
11695 |
+
}
|
11696 |
+
if (compiled.tips && compiled.tips.length) {
|
11697 |
+
if (options.outputSourceRange) {
|
11698 |
+
compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
11699 |
+
} else {
|
11700 |
+
compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
11701 |
+
}
|
11702 |
+
}
|
11703 |
+
}
|
11704 |
+
|
11705 |
+
// turn code into functions
|
11706 |
+
var res = {};
|
11707 |
+
var fnGenErrors = [];
|
11708 |
+
res.render = createFunction(compiled.render, fnGenErrors);
|
11709 |
+
res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
11710 |
+
return createFunction(code, fnGenErrors)
|
11711 |
+
});
|
11712 |
+
|
11713 |
+
// check function generation errors.
|
11714 |
+
// this should only happen if there is a bug in the compiler itself.
|
11715 |
+
// mostly for codegen development use
|
11716 |
+
/* istanbul ignore if */
|
11717 |
+
{
|
11718 |
+
if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
11719 |
+
warn$$1(
|
11720 |
+
"Failed to generate render function:\n\n" +
|
11721 |
+
fnGenErrors.map(function (ref) {
|
11722 |
+
var err = ref.err;
|
11723 |
+
var code = ref.code;
|
11724 |
+
|
11725 |
+
return ((err.toString()) + " in\n\n" + code + "\n");
|
11726 |
+
}).join('\n'),
|
11727 |
+
vm
|
11728 |
+
);
|
11729 |
+
}
|
11730 |
+
}
|
11731 |
+
|
11732 |
+
return (cache[key] = res)
|
11733 |
+
}
|
11734 |
+
}
|
11735 |
+
|
11736 |
+
/* */
|
11737 |
+
|
11738 |
+
function createCompilerCreator (baseCompile) {
|
11739 |
+
return function createCompiler (baseOptions) {
|
11740 |
+
function compile (
|
11741 |
+
template,
|
11742 |
+
options
|
11743 |
+
) {
|
11744 |
+
var finalOptions = Object.create(baseOptions);
|
11745 |
+
var errors = [];
|
11746 |
+
var tips = [];
|
11747 |
+
|
11748 |
+
var warn = function (msg, range, tip) {
|
11749 |
+
(tip ? tips : errors).push(msg);
|
11750 |
+
};
|
11751 |
+
|
11752 |
+
if (options) {
|
11753 |
+
if (options.outputSourceRange) {
|
11754 |
+
// $flow-disable-line
|
11755 |
+
var leadingSpaceLength = template.match(/^\s*/)[0].length;
|
11756 |
+
|
11757 |
+
warn = function (msg, range, tip) {
|
11758 |
+
var data = { msg: msg };
|
11759 |
+
if (range) {
|
11760 |
+
if (range.start != null) {
|
11761 |
+
data.start = range.start + leadingSpaceLength;
|
11762 |
+
}
|
11763 |
+
if (range.end != null) {
|
11764 |
+
data.end = range.end + leadingSpaceLength;
|
11765 |
+
}
|
11766 |
+
}
|
11767 |
+
(tip ? tips : errors).push(data);
|
11768 |
+
};
|
11769 |
+
}
|
11770 |
+
// merge custom modules
|
11771 |
+
if (options.modules) {
|
11772 |
+
finalOptions.modules =
|
11773 |
+
(baseOptions.modules || []).concat(options.modules);
|
11774 |
+
}
|
11775 |
+
// merge custom directives
|
11776 |
+
if (options.directives) {
|
11777 |
+
finalOptions.directives = extend(
|
11778 |
+
Object.create(baseOptions.directives || null),
|
11779 |
+
options.directives
|
11780 |
+
);
|
11781 |
+
}
|
11782 |
+
// copy other options
|
11783 |
+
for (var key in options) {
|
11784 |
+
if (key !== 'modules' && key !== 'directives') {
|
11785 |
+
finalOptions[key] = options[key];
|
11786 |
+
}
|
11787 |
+
}
|
11788 |
+
}
|
11789 |
+
|
11790 |
+
finalOptions.warn = warn;
|
11791 |
+
|
11792 |
+
var compiled = baseCompile(template.trim(), finalOptions);
|
11793 |
+
{
|
11794 |
+
detectErrors(compiled.ast, warn);
|
11795 |
+
}
|
11796 |
+
compiled.errors = errors;
|
11797 |
+
compiled.tips = tips;
|
11798 |
+
return compiled
|
11799 |
+
}
|
11800 |
+
|
11801 |
+
return {
|
11802 |
+
compile: compile,
|
11803 |
+
compileToFunctions: createCompileToFunctionFn(compile)
|
11804 |
+
}
|
11805 |
+
}
|
11806 |
+
}
|
11807 |
+
|
11808 |
+
/* */
|
11809 |
+
|
11810 |
+
// `createCompilerCreator` allows creating compilers that use alternative
|
11811 |
+
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
|
11812 |
+
// Here we just export a default compiler using the default parts.
|
11813 |
+
var createCompiler = createCompilerCreator(function baseCompile (
|
11814 |
+
template,
|
11815 |
+
options
|
11816 |
+
) {
|
11817 |
+
var ast = parse(template.trim(), options);
|
11818 |
+
if (options.optimize !== false) {
|
11819 |
+
optimize(ast, options);
|
11820 |
+
}
|
11821 |
+
var code = generate(ast, options);
|
11822 |
+
return {
|
11823 |
+
ast: ast,
|
11824 |
+
render: code.render,
|
11825 |
+
staticRenderFns: code.staticRenderFns
|
11826 |
+
}
|
11827 |
+
});
|
11828 |
+
|
11829 |
+
/* */
|
11830 |
+
|
11831 |
+
var ref$1 = createCompiler(baseOptions);
|
11832 |
+
var compile = ref$1.compile;
|
11833 |
+
var compileToFunctions = ref$1.compileToFunctions;
|
11834 |
+
|
11835 |
+
/* */
|
11836 |
+
|
11837 |
+
// check whether current browser encodes a char inside attribute values
|
11838 |
+
var div;
|
11839 |
+
function getShouldDecode (href) {
|
11840 |
+
div = div || document.createElement('div');
|
11841 |
+
div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
|
11842 |
+
return div.innerHTML.indexOf(' ') > 0
|
11843 |
+
}
|
11844 |
+
|
11845 |
+
// #3663: IE encodes newlines inside attribute values while other browsers don't
|
11846 |
+
var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
|
11847 |
+
// #6828: chrome encodes content in a[href]
|
11848 |
+
var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
|
11849 |
+
|
11850 |
+
/* */
|
11851 |
+
|
11852 |
+
var idToTemplate = cached(function (id) {
|
11853 |
+
var el = query(id);
|
11854 |
+
return el && el.innerHTML
|
11855 |
+
});
|
11856 |
+
|
11857 |
+
var mount = Vue.prototype.$mount;
|
11858 |
+
Vue.prototype.$mount = function (
|
11859 |
+
el,
|
11860 |
+
hydrating
|
11861 |
+
) {
|
11862 |
+
el = el && query(el);
|
11863 |
+
|
11864 |
+
/* istanbul ignore if */
|
11865 |
+
if (el === document.body || el === document.documentElement) {
|
11866 |
+
warn(
|
11867 |
+
"Do not mount Vue to <html> or <body> - mount to normal elements instead."
|
11868 |
+
);
|
11869 |
+
return this
|
11870 |
+
}
|
11871 |
+
|
11872 |
+
var options = this.$options;
|
11873 |
+
// resolve template/el and convert to render function
|
11874 |
+
if (!options.render) {
|
11875 |
+
var template = options.template;
|
11876 |
+
if (template) {
|
11877 |
+
if (typeof template === 'string') {
|
11878 |
+
if (template.charAt(0) === '#') {
|
11879 |
+
template = idToTemplate(template);
|
11880 |
+
/* istanbul ignore if */
|
11881 |
+
if (!template) {
|
11882 |
+
warn(
|
11883 |
+
("Template element not found or is empty: " + (options.template)),
|
11884 |
+
this
|
11885 |
+
);
|
11886 |
+
}
|
11887 |
+
}
|
11888 |
+
} else if (template.nodeType) {
|
11889 |
+
template = template.innerHTML;
|
11890 |
+
} else {
|
11891 |
+
{
|
11892 |
+
warn('invalid template option:' + template, this);
|
11893 |
+
}
|
11894 |
+
return this
|
11895 |
+
}
|
11896 |
+
} else if (el) {
|
11897 |
+
template = getOuterHTML(el);
|
11898 |
+
}
|
11899 |
+
if (template) {
|
11900 |
+
/* istanbul ignore if */
|
11901 |
+
if (config.performance && mark) {
|
11902 |
+
mark('compile');
|
11903 |
+
}
|
11904 |
+
|
11905 |
+
var ref = compileToFunctions(template, {
|
11906 |
+
outputSourceRange: "development" !== 'production',
|
11907 |
+
shouldDecodeNewlines: shouldDecodeNewlines,
|
11908 |
+
shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
|
11909 |
+
delimiters: options.delimiters,
|
11910 |
+
comments: options.comments
|
11911 |
+
}, this);
|
11912 |
+
var render = ref.render;
|
11913 |
+
var staticRenderFns = ref.staticRenderFns;
|
11914 |
+
options.render = render;
|
11915 |
+
options.staticRenderFns = staticRenderFns;
|
11916 |
+
|
11917 |
+
/* istanbul ignore if */
|
11918 |
+
if (config.performance && mark) {
|
11919 |
+
mark('compile end');
|
11920 |
+
measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
|
11921 |
+
}
|
11922 |
+
}
|
11923 |
+
}
|
11924 |
+
return mount.call(this, el, hydrating)
|
11925 |
+
};
|
11926 |
+
|
11927 |
+
/**
|
11928 |
+
* Get outerHTML of elements, taking care
|
11929 |
+
* of SVG elements in IE as well.
|
11930 |
+
*/
|
11931 |
+
function getOuterHTML (el) {
|
11932 |
+
if (el.outerHTML) {
|
11933 |
+
return el.outerHTML
|
11934 |
+
} else {
|
11935 |
+
var container = document.createElement('div');
|
11936 |
+
container.appendChild(el.cloneNode(true));
|
11937 |
+
return container.innerHTML
|
11938 |
+
}
|
11939 |
+
}
|
11940 |
+
|
11941 |
+
Vue.compile = compileToFunctions;
|
11942 |
+
|
11943 |
+
return Vue;
|
11944 |
+
|
11945 |
}));
|
11946 |
+
/**
|
11947 |
+
* vuex v3.1.0
|
11948 |
+
* (c) 2019 Evan You
|
11949 |
+
* @license MIT
|
11950 |
+
*/
|
11951 |
+
(function (global, factory) {
|
11952 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
11953 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
11954 |
+
(global = global || self, global.Vuex = factory());
|
11955 |
+
}(this, function () { 'use strict';
|
11956 |
+
|
11957 |
+
function applyMixin (Vue) {
|
11958 |
+
var version = Number(Vue.version.split('.')[0]);
|
11959 |
+
|
11960 |
+
if (version >= 2) {
|
11961 |
+
Vue.mixin({ beforeCreate: vuexInit });
|
11962 |
+
} else {
|
11963 |
+
// override init and inject vuex init procedure
|
11964 |
+
// for 1.x backwards compatibility.
|
11965 |
+
var _init = Vue.prototype._init;
|
11966 |
+
Vue.prototype._init = function (options) {
|
11967 |
+
if ( options === void 0 ) options = {};
|
11968 |
+
|
11969 |
+
options.init = options.init
|
11970 |
+
? [vuexInit].concat(options.init)
|
11971 |
+
: vuexInit;
|
11972 |
+
_init.call(this, options);
|
11973 |
+
};
|
11974 |
+
}
|
11975 |
+
|
11976 |
+
/**
|
11977 |
+
* Vuex init hook, injected into each instances init hooks list.
|
11978 |
+
*/
|
11979 |
+
|
11980 |
+
function vuexInit () {
|
11981 |
+
var options = this.$options;
|
11982 |
+
// store injection
|
11983 |
+
if (options.store) {
|
11984 |
+
this.$store = typeof options.store === 'function'
|
11985 |
+
? options.store()
|
11986 |
+
: options.store;
|
11987 |
+
} else if (options.parent && options.parent.$store) {
|
11988 |
+
this.$store = options.parent.$store;
|
11989 |
+
}
|
11990 |
+
}
|
11991 |
+
}
|
11992 |
+
|
11993 |
+
var devtoolHook =
|
11994 |
+
typeof window !== 'undefined' &&
|
11995 |
+
window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
11996 |
+
|
11997 |
+
function devtoolPlugin (store) {
|
11998 |
+
if (!devtoolHook) { return }
|
11999 |
+
|
12000 |
+
store._devtoolHook = devtoolHook;
|
12001 |
+
|
12002 |
+
devtoolHook.emit('vuex:init', store);
|
12003 |
+
|
12004 |
+
devtoolHook.on('vuex:travel-to-state', function (targetState) {
|
12005 |
+
store.replaceState(targetState);
|
12006 |
+
});
|
12007 |
+
|
12008 |
+
store.subscribe(function (mutation, state) {
|
12009 |
+
devtoolHook.emit('vuex:mutation', mutation, state);
|
12010 |
+
});
|
12011 |
+
}
|
12012 |
+
|
12013 |
+
/**
|
12014 |
+
* Get the first item that pass the test
|
12015 |
+
* by second argument function
|
12016 |
+
*
|
12017 |
+
* @param {Array} list
|
12018 |
+
* @param {Function} f
|
12019 |
+
* @return {*}
|
12020 |
+
*/
|
12021 |
+
|
12022 |
+
/**
|
12023 |
+
* forEach for object
|
12024 |
+
*/
|
12025 |
+
function forEachValue (obj, fn) {
|
12026 |
+
Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
|
12027 |
+
}
|
12028 |
+
|
12029 |
+
function isObject (obj) {
|
12030 |
+
return obj !== null && typeof obj === 'object'
|
12031 |
+
}
|
12032 |
+
|
12033 |
+
function isPromise (val) {
|
12034 |
+
return val && typeof val.then === 'function'
|
12035 |
+
}
|
12036 |
+
|
12037 |
+
function assert (condition, msg) {
|
12038 |
+
if (!condition) { throw new Error(("[vuex] " + msg)) }
|
12039 |
+
}
|
12040 |
+
|
12041 |
+
// Base data struct for store's module, package with some attribute and method
|
12042 |
+
var Module = function Module (rawModule, runtime) {
|
12043 |
+
this.runtime = runtime;
|
12044 |
+
// Store some children item
|
12045 |
+
this._children = Object.create(null);
|
12046 |
+
// Store the origin module object which passed by programmer
|
12047 |
+
this._rawModule = rawModule;
|
12048 |
+
var rawState = rawModule.state;
|
12049 |
+
|
12050 |
+
// Store the origin module's state
|
12051 |
+
this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
|
12052 |
+
};
|
12053 |
+
|
12054 |
+
var prototypeAccessors = { namespaced: { configurable: true } };
|
12055 |
+
|
12056 |
+
prototypeAccessors.namespaced.get = function () {
|
12057 |
+
return !!this._rawModule.namespaced
|
12058 |
+
};
|
12059 |
+
|
12060 |
+
Module.prototype.addChild = function addChild (key, module) {
|
12061 |
+
this._children[key] = module;
|
12062 |
+
};
|
12063 |
+
|
12064 |
+
Module.prototype.removeChild = function removeChild (key) {
|
12065 |
+
delete this._children[key];
|
12066 |
+
};
|
12067 |
+
|
12068 |
+
Module.prototype.getChild = function getChild (key) {
|
12069 |
+
return this._children[key]
|
12070 |
+
};
|
12071 |
+
|
12072 |
+
Module.prototype.update = function update (rawModule) {
|
12073 |
+
this._rawModule.namespaced = rawModule.namespaced;
|
12074 |
+
if (rawModule.actions) {
|
12075 |
+
this._rawModule.actions = rawModule.actions;
|
12076 |
+
}
|
12077 |
+
if (rawModule.mutations) {
|
12078 |
+
this._rawModule.mutations = rawModule.mutations;
|
12079 |
+
}
|
12080 |
+
if (rawModule.getters) {
|
12081 |
+
this._rawModule.getters = rawModule.getters;
|
12082 |
+
}
|
12083 |
+
};
|
12084 |
+
|
12085 |
+
Module.prototype.forEachChild = function forEachChild (fn) {
|
12086 |
+
forEachValue(this._children, fn);
|
12087 |
+
};
|
12088 |
+
|
12089 |
+
Module.prototype.forEachGetter = function forEachGetter (fn) {
|
12090 |
+
if (this._rawModule.getters) {
|
12091 |
+
forEachValue(this._rawModule.getters, fn);
|
12092 |
+
}
|
12093 |
+
};
|
12094 |
+
|
12095 |
+
Module.prototype.forEachAction = function forEachAction (fn) {
|
12096 |
+
if (this._rawModule.actions) {
|
12097 |
+
forEachValue(this._rawModule.actions, fn);
|
12098 |
+
}
|
12099 |
+
};
|
12100 |
+
|
12101 |
+
Module.prototype.forEachMutation = function forEachMutation (fn) {
|
12102 |
+
if (this._rawModule.mutations) {
|
12103 |
+
forEachValue(this._rawModule.mutations, fn);
|
12104 |
+
}
|
12105 |
+
};
|
12106 |
+
|
12107 |
+
Object.defineProperties( Module.prototype, prototypeAccessors );
|
12108 |
+
|
12109 |
+
var ModuleCollection = function ModuleCollection (rawRootModule) {
|
12110 |
+
// register root module (Vuex.Store options)
|
12111 |
+
this.register([], rawRootModule, false);
|
12112 |
+
};
|
12113 |
+
|
12114 |
+
ModuleCollection.prototype.get = function get (path) {
|
12115 |
+
return path.reduce(function (module, key) {
|
12116 |
+
return module.getChild(key)
|
12117 |
+
}, this.root)
|
12118 |
+
};
|
12119 |
+
|
12120 |
+
ModuleCollection.prototype.getNamespace = function getNamespace (path) {
|
12121 |
+
var module = this.root;
|
12122 |
+
return path.reduce(function (namespace, key) {
|
12123 |
+
module = module.getChild(key);
|
12124 |
+
return namespace + (module.namespaced ? key + '/' : '')
|
12125 |
+
}, '')
|
12126 |
+
};
|
12127 |
+
|
12128 |
+
ModuleCollection.prototype.update = function update$1 (rawRootModule) {
|
12129 |
+
update([], this.root, rawRootModule);
|
12130 |
+
};
|
12131 |
+
|
12132 |
+
ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
|
12133 |
+
var this$1 = this;
|
12134 |
+
if ( runtime === void 0 ) runtime = true;
|
12135 |
+
|
12136 |
+
{
|
12137 |
+
assertRawModule(path, rawModule);
|
12138 |
+
}
|
12139 |
+
|
12140 |
+
var newModule = new Module(rawModule, runtime);
|
12141 |
+
if (path.length === 0) {
|
12142 |
+
this.root = newModule;
|
12143 |
+
} else {
|
12144 |
+
var parent = this.get(path.slice(0, -1));
|
12145 |
+
parent.addChild(path[path.length - 1], newModule);
|
12146 |
+
}
|
12147 |
+
|
12148 |
+
// register nested modules
|
12149 |
+
if (rawModule.modules) {
|
12150 |
+
forEachValue(rawModule.modules, function (rawChildModule, key) {
|
12151 |
+
this$1.register(path.concat(key), rawChildModule, runtime);
|
12152 |
+
});
|
12153 |
+
}
|
12154 |
+
};
|
12155 |
+
|
12156 |
+
ModuleCollection.prototype.unregister = function unregister (path) {
|
12157 |
+
var parent = this.get(path.slice(0, -1));
|
12158 |
+
var key = path[path.length - 1];
|
12159 |
+
if (!parent.getChild(key).runtime) { return }
|
12160 |
+
|
12161 |
+
parent.removeChild(key);
|
12162 |
+
};
|
12163 |
+
|
12164 |
+
function update (path, targetModule, newModule) {
|
12165 |
+
{
|
12166 |
+
assertRawModule(path, newModule);
|
12167 |
+
}
|
12168 |
+
|
12169 |
+
// update target module
|
12170 |
+
targetModule.update(newModule);
|
12171 |
+
|
12172 |
+
// update nested modules
|
12173 |
+
if (newModule.modules) {
|
12174 |
+
for (var key in newModule.modules) {
|
12175 |
+
if (!targetModule.getChild(key)) {
|
12176 |
+
{
|
12177 |
+
console.warn(
|
12178 |
+
"[vuex] trying to add a new module '" + key + "' on hot reloading, " +
|
12179 |
+
'manual reload is needed'
|
12180 |
+
);
|
12181 |
+
}
|
12182 |
+
return
|
12183 |
+
}
|
12184 |
+
update(
|
12185 |
+
path.concat(key),
|
12186 |
+
targetModule.getChild(key),
|
12187 |
+
newModule.modules[key]
|
12188 |
+
);
|
12189 |
+
}
|
12190 |
+
}
|
12191 |
+
}
|
12192 |
+
|
12193 |
+
var functionAssert = {
|
12194 |
+
assert: function (value) { return typeof value === 'function'; },
|
12195 |
+
expected: 'function'
|
12196 |
+
};
|
12197 |
+
|
12198 |
+
var objectAssert = {
|
12199 |
+
assert: function (value) { return typeof value === 'function' ||
|
12200 |
+
(typeof value === 'object' && typeof value.handler === 'function'); },
|
12201 |
+
expected: 'function or object with "handler" function'
|
12202 |
+
};
|
12203 |
+
|
12204 |
+
var assertTypes = {
|
12205 |
+
getters: functionAssert,
|
12206 |
+
mutations: functionAssert,
|
12207 |
+
actions: objectAssert
|
12208 |
+
};
|
12209 |
+
|
12210 |
+
function assertRawModule (path, rawModule) {
|
12211 |
+
Object.keys(assertTypes).forEach(function (key) {
|
12212 |
+
if (!rawModule[key]) { return }
|
12213 |
+
|
12214 |
+
var assertOptions = assertTypes[key];
|
12215 |
+
|
12216 |
+
forEachValue(rawModule[key], function (value, type) {
|
12217 |
+
assert(
|
12218 |
+
assertOptions.assert(value),
|
12219 |
+
makeAssertionMessage(path, key, type, value, assertOptions.expected)
|
12220 |
+
);
|
12221 |
+
});
|
12222 |
+
});
|
12223 |
+
}
|
12224 |
+
|
12225 |
+
function makeAssertionMessage (path, key, type, value, expected) {
|
12226 |
+
var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
|
12227 |
+
if (path.length > 0) {
|
12228 |
+
buf += " in module \"" + (path.join('.')) + "\"";
|
12229 |
+
}
|
12230 |
+
buf += " is " + (JSON.stringify(value)) + ".";
|
12231 |
+
return buf
|
12232 |
+
}
|
12233 |
+
|
12234 |
+
var Vue; // bind on install
|
12235 |
+
|
12236 |
+
var Store = function Store (options) {
|
12237 |
+
var this$1 = this;
|
12238 |
+
if ( options === void 0 ) options = {};
|
12239 |
+
|
12240 |
+
// Auto install if it is not done yet and `window` has `Vue`.
|
12241 |
+
// To allow users to avoid auto-installation in some cases,
|
12242 |
+
// this code should be placed here. See #731
|
12243 |
+
if (!Vue && typeof window !== 'undefined' && window.Vue) {
|
12244 |
+
install(window.Vue);
|
12245 |
+
}
|
12246 |
+
|
12247 |
+
{
|
12248 |
+
assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
|
12249 |
+
assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
|
12250 |
+
assert(this instanceof Store, "store must be called with the new operator.");
|
12251 |
+
}
|
12252 |
+
|
12253 |
+
var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
|
12254 |
+
var strict = options.strict; if ( strict === void 0 ) strict = false;
|
12255 |
+
|
12256 |
+
// store internal state
|
12257 |
+
this._committing = false;
|
12258 |
+
this._actions = Object.create(null);
|
12259 |
+
this._actionSubscribers = [];
|
12260 |
+
this._mutations = Object.create(null);
|
12261 |
+
this._wrappedGetters = Object.create(null);
|
12262 |
+
this._modules = new ModuleCollection(options);
|
12263 |
+
this._modulesNamespaceMap = Object.create(null);
|
12264 |
+
this._subscribers = [];
|
12265 |
+
this._watcherVM = new Vue();
|
12266 |
+
|
12267 |
+
// bind commit and dispatch to self
|
12268 |
+
var store = this;
|
12269 |
+
var ref = this;
|
12270 |
+
var dispatch = ref.dispatch;
|
12271 |
+
var commit = ref.commit;
|
12272 |
+
this.dispatch = function boundDispatch (type, payload) {
|
12273 |
+
return dispatch.call(store, type, payload)
|
12274 |
+
};
|
12275 |
+
this.commit = function boundCommit (type, payload, options) {
|
12276 |
+
return commit.call(store, type, payload, options)
|
12277 |
+
};
|
12278 |
+
|
12279 |
+
// strict mode
|
12280 |
+
this.strict = strict;
|
12281 |
+
|
12282 |
+
var state = this._modules.root.state;
|
12283 |
+
|
12284 |
+
// init root module.
|
12285 |
+
// this also recursively registers all sub-modules
|
12286 |
+
// and collects all module getters inside this._wrappedGetters
|
12287 |
+
installModule(this, state, [], this._modules.root);
|
12288 |
+
|
12289 |
+
// initialize the store vm, which is responsible for the reactivity
|
12290 |
+
// (also registers _wrappedGetters as computed properties)
|
12291 |
+
resetStoreVM(this, state);
|
12292 |
+
|
12293 |
+
// apply plugins
|
12294 |
+
plugins.forEach(function (plugin) { return plugin(this$1); });
|
12295 |
+
|
12296 |
+
var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
|
12297 |
+
if (useDevtools) {
|
12298 |
+
devtoolPlugin(this);
|
12299 |
+
}
|
12300 |
+
};
|
12301 |
+
|
12302 |
+
var prototypeAccessors$1 = { state: { configurable: true } };
|
12303 |
+
|
12304 |
+
prototypeAccessors$1.state.get = function () {
|
12305 |
+
return this._vm._data.$$state
|
12306 |
+
};
|
12307 |
+
|
12308 |
+
prototypeAccessors$1.state.set = function (v) {
|
12309 |
+
{
|
12310 |
+
assert(false, "use store.replaceState() to explicit replace store state.");
|
12311 |
+
}
|
12312 |
+
};
|
12313 |
+
|
12314 |
+
Store.prototype.commit = function commit (_type, _payload, _options) {
|
12315 |
+
var this$1 = this;
|
12316 |
+
|
12317 |
+
// check object-style commit
|
12318 |
+
var ref = unifyObjectStyle(_type, _payload, _options);
|
12319 |
+
var type = ref.type;
|
12320 |
+
var payload = ref.payload;
|
12321 |
+
var options = ref.options;
|
12322 |
+
|
12323 |
+
var mutation = { type: type, payload: payload };
|
12324 |
+
var entry = this._mutations[type];
|
12325 |
+
if (!entry) {
|
12326 |
+
{
|
12327 |
+
console.error(("[vuex] unknown mutation type: " + type));
|
12328 |
+
}
|
12329 |
+
return
|
12330 |
+
}
|
12331 |
+
this._withCommit(function () {
|
12332 |
+
entry.forEach(function commitIterator (handler) {
|
12333 |
+
handler(payload);
|
12334 |
+
});
|
12335 |
+
});
|
12336 |
+
this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); });
|
12337 |
+
|
12338 |
+
if (
|
12339 |
+
options && options.silent
|
12340 |
+
) {
|
12341 |
+
console.warn(
|
12342 |
+
"[vuex] mutation type: " + type + ". Silent option has been removed. " +
|
12343 |
+
'Use the filter functionality in the vue-devtools'
|
12344 |
+
);
|
12345 |
+
}
|
12346 |
+
};
|
12347 |
+
|
12348 |
+
Store.prototype.dispatch = function dispatch (_type, _payload) {
|
12349 |
+
var this$1 = this;
|
12350 |
+
|
12351 |
+
// check object-style dispatch
|
12352 |
+
var ref = unifyObjectStyle(_type, _payload);
|
12353 |
+
var type = ref.type;
|
12354 |
+
var payload = ref.payload;
|
12355 |
+
|
12356 |
+
var action = { type: type, payload: payload };
|
12357 |
+
var entry = this._actions[type];
|
12358 |
+
if (!entry) {
|
12359 |
+
{
|
12360 |
+
console.error(("[vuex] unknown action type: " + type));
|
12361 |
+
}
|
12362 |
+
return
|
12363 |
+
}
|
12364 |
+
|
12365 |
+
try {
|
12366 |
+
this._actionSubscribers
|
12367 |
+
.filter(function (sub) { return sub.before; })
|
12368 |
+
.forEach(function (sub) { return sub.before(action, this$1.state); });
|
12369 |
+
} catch (e) {
|
12370 |
+
{
|
12371 |
+
console.warn("[vuex] error in before action subscribers: ");
|
12372 |
+
console.error(e);
|
12373 |
+
}
|
12374 |
+
}
|
12375 |
+
|
12376 |
+
var result = entry.length > 1
|
12377 |
+
? Promise.all(entry.map(function (handler) { return handler(payload); }))
|
12378 |
+
: entry[0](payload);
|
12379 |
+
|
12380 |
+
return result.then(function (res) {
|
12381 |
+
try {
|
12382 |
+
this$1._actionSubscribers
|
12383 |
+
.filter(function (sub) { return sub.after; })
|
12384 |
+
.forEach(function (sub) { return sub.after(action, this$1.state); });
|
12385 |
+
} catch (e) {
|
12386 |
+
{
|
12387 |
+
console.warn("[vuex] error in after action subscribers: ");
|
12388 |
+
console.error(e);
|
12389 |
+
}
|
12390 |
+
}
|
12391 |
+
return res
|
12392 |
+
})
|
12393 |
+
};
|
12394 |
+
|
12395 |
+
Store.prototype.subscribe = function subscribe (fn) {
|
12396 |
+
return genericSubscribe(fn, this._subscribers)
|
12397 |
+
};
|
12398 |
+
|
12399 |
+
Store.prototype.subscribeAction = function subscribeAction (fn) {
|
12400 |
+
var subs = typeof fn === 'function' ? { before: fn } : fn;
|
12401 |
+
return genericSubscribe(subs, this._actionSubscribers)
|
12402 |
+
};
|
12403 |
+
|
12404 |
+
Store.prototype.watch = function watch (getter, cb, options) {
|
12405 |
+
var this$1 = this;
|
12406 |
+
|
12407 |
+
{
|
12408 |
+
assert(typeof getter === 'function', "store.watch only accepts a function.");
|
12409 |
+
}
|
12410 |
+
return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
|
12411 |
+
};
|
12412 |
+
|
12413 |
+
Store.prototype.replaceState = function replaceState (state) {
|
12414 |
+
var this$1 = this;
|
12415 |
+
|
12416 |
+
this._withCommit(function () {
|
12417 |
+
this$1._vm._data.$$state = state;
|
12418 |
+
});
|
12419 |
+
};
|
12420 |
+
|
12421 |
+
Store.prototype.registerModule = function registerModule (path, rawModule, options) {
|
12422 |
+
if ( options === void 0 ) options = {};
|
12423 |
+
|
12424 |
+
if (typeof path === 'string') { path = [path]; }
|
12425 |
+
|
12426 |
+
{
|
12427 |
+
assert(Array.isArray(path), "module path must be a string or an Array.");
|
12428 |
+
assert(path.length > 0, 'cannot register the root module by using registerModule.');
|
12429 |
+
}
|
12430 |
+
|
12431 |
+
this._modules.register(path, rawModule);
|
12432 |
+
installModule(this, this.state, path, this._modules.get(path), options.preserveState);
|
12433 |
+
// reset store to update getters...
|
12434 |
+
resetStoreVM(this, this.state);
|
12435 |
+
};
|
12436 |
+
|
12437 |
+
Store.prototype.unregisterModule = function unregisterModule (path) {
|
12438 |
+
var this$1 = this;
|
12439 |
+
|
12440 |
+
if (typeof path === 'string') { path = [path]; }
|
12441 |
+
|
12442 |
+
{
|
12443 |
+
assert(Array.isArray(path), "module path must be a string or an Array.");
|
12444 |
+
}
|
12445 |
+
|
12446 |
+
this._modules.unregister(path);
|
12447 |
+
this._withCommit(function () {
|
12448 |
+
var parentState = getNestedState(this$1.state, path.slice(0, -1));
|
12449 |
+
Vue.delete(parentState, path[path.length - 1]);
|
12450 |
+
});
|
12451 |
+
resetStore(this);
|
12452 |
+
};
|
12453 |
+
|
12454 |
+
Store.prototype.hotUpdate = function hotUpdate (newOptions) {
|
12455 |
+
this._modules.update(newOptions);
|
12456 |
+
resetStore(this, true);
|
12457 |
+
};
|
12458 |
+
|
12459 |
+
Store.prototype._withCommit = function _withCommit (fn) {
|
12460 |
+
var committing = this._committing;
|
12461 |
+
this._committing = true;
|
12462 |
+
fn();
|
12463 |
+
this._committing = committing;
|
12464 |
+
};
|
12465 |
+
|
12466 |
+
Object.defineProperties( Store.prototype, prototypeAccessors$1 );
|
12467 |
+
|
12468 |
+
function genericSubscribe (fn, subs) {
|
12469 |
+
if (subs.indexOf(fn) < 0) {
|
12470 |
+
subs.push(fn);
|
12471 |
+
}
|
12472 |
+
return function () {
|
12473 |
+
var i = subs.indexOf(fn);
|
12474 |
+
if (i > -1) {
|
12475 |
+
subs.splice(i, 1);
|
12476 |
+
}
|
12477 |
+
}
|
12478 |
+
}
|
12479 |
+
|
12480 |
+
function resetStore (store, hot) {
|
12481 |
+
store._actions = Object.create(null);
|
12482 |
+
store._mutations = Object.create(null);
|
12483 |
+
store._wrappedGetters = Object.create(null);
|
12484 |
+
store._modulesNamespaceMap = Object.create(null);
|
12485 |
+
var state = store.state;
|
12486 |
+
// init all modules
|
12487 |
+
installModule(store, state, [], store._modules.root, true);
|
12488 |
+
// reset vm
|
12489 |
+
resetStoreVM(store, state, hot);
|
12490 |
+
}
|
12491 |
+
|
12492 |
+
function resetStoreVM (store, state, hot) {
|
12493 |
+
var oldVm = store._vm;
|
12494 |
+
|
12495 |
+
// bind store public getters
|
12496 |
+
store.getters = {};
|
12497 |
+
var wrappedGetters = store._wrappedGetters;
|
12498 |
+
var computed = {};
|
12499 |
+
forEachValue(wrappedGetters, function (fn, key) {
|
12500 |
+
// use computed to leverage its lazy-caching mechanism
|
12501 |
+
computed[key] = function () { return fn(store); };
|
12502 |
+
Object.defineProperty(store.getters, key, {
|
12503 |
+
get: function () { return store._vm[key]; },
|
12504 |
+
enumerable: true // for local getters
|
12505 |
+
});
|
12506 |
+
});
|
12507 |
+
|
12508 |
+
// use a Vue instance to store the state tree
|
12509 |
+
// suppress warnings just in case the user has added
|
12510 |
+
// some funky global mixins
|
12511 |
+
var silent = Vue.config.silent;
|
12512 |
+
Vue.config.silent = true;
|
12513 |
+
store._vm = new Vue({
|
12514 |
+
data: {
|
12515 |
+
$$state: state
|
12516 |
+
},
|
12517 |
+
computed: computed
|
12518 |
+
});
|
12519 |
+
Vue.config.silent = silent;
|
12520 |
+
|
12521 |
+
// enable strict mode for new vm
|
12522 |
+
if (store.strict) {
|
12523 |
+
enableStrictMode(store);
|
12524 |
+
}
|
12525 |
+
|
12526 |
+
if (oldVm) {
|
12527 |
+
if (hot) {
|
12528 |
+
// dispatch changes in all subscribed watchers
|
12529 |
+
// to force getter re-evaluation for hot reloading.
|
12530 |
+
store._withCommit(function () {
|
12531 |
+
oldVm._data.$$state = null;
|
12532 |
+
});
|
12533 |
+
}
|
12534 |
+
Vue.nextTick(function () { return oldVm.$destroy(); });
|
12535 |
+
}
|
12536 |
+
}
|
12537 |
+
|
12538 |
+
function installModule (store, rootState, path, module, hot) {
|
12539 |
+
var isRoot = !path.length;
|
12540 |
+
var namespace = store._modules.getNamespace(path);
|
12541 |
+
|
12542 |
+
// register in namespace map
|
12543 |
+
if (module.namespaced) {
|
12544 |
+
store._modulesNamespaceMap[namespace] = module;
|
12545 |
+
}
|
12546 |
+
|
12547 |
+
// set state
|
12548 |
+
if (!isRoot && !hot) {
|
12549 |
+
var parentState = getNestedState(rootState, path.slice(0, -1));
|
12550 |
+
var moduleName = path[path.length - 1];
|
12551 |
+
store._withCommit(function () {
|
12552 |
+
Vue.set(parentState, moduleName, module.state);
|
12553 |
+
});
|
12554 |
+
}
|
12555 |
+
|
12556 |
+
var local = module.context = makeLocalContext(store, namespace, path);
|
12557 |
+
|
12558 |
+
module.forEachMutation(function (mutation, key) {
|
12559 |
+
var namespacedType = namespace + key;
|
12560 |
+
registerMutation(store, namespacedType, mutation, local);
|
12561 |
+
});
|
12562 |
+
|
12563 |
+
module.forEachAction(function (action, key) {
|
12564 |
+
var type = action.root ? key : namespace + key;
|
12565 |
+
var handler = action.handler || action;
|
12566 |
+
registerAction(store, type, handler, local);
|
12567 |
+
});
|
12568 |
+
|
12569 |
+
module.forEachGetter(function (getter, key) {
|
12570 |
+
var namespacedType = namespace + key;
|
12571 |
+
registerGetter(store, namespacedType, getter, local);
|
12572 |
+
});
|
12573 |
+
|
12574 |
+
module.forEachChild(function (child, key) {
|
12575 |
+
installModule(store, rootState, path.concat(key), child, hot);
|
12576 |
+
});
|
12577 |
+
}
|
12578 |
+
|
12579 |
+
/**
|
12580 |
+
* make localized dispatch, commit, getters and state
|
12581 |
+
* if there is no namespace, just use root ones
|
12582 |
+
*/
|
12583 |
+
function makeLocalContext (store, namespace, path) {
|
12584 |
+
var noNamespace = namespace === '';
|
12585 |
+
|
12586 |
+
var local = {
|
12587 |
+
dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
|
12588 |
+
var args = unifyObjectStyle(_type, _payload, _options);
|
12589 |
+
var payload = args.payload;
|
12590 |
+
var options = args.options;
|
12591 |
+
var type = args.type;
|
12592 |
+
|
12593 |
+
if (!options || !options.root) {
|
12594 |
+
type = namespace + type;
|
12595 |
+
if (!store._actions[type]) {
|
12596 |
+
console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
|
12597 |
+
return
|
12598 |
+
}
|
12599 |
+
}
|
12600 |
+
|
12601 |
+
return store.dispatch(type, payload)
|
12602 |
+
},
|
12603 |
+
|
12604 |
+
commit: noNamespace ? store.commit : function (_type, _payload, _options) {
|
12605 |
+
var args = unifyObjectStyle(_type, _payload, _options);
|
12606 |
+
var payload = args.payload;
|
12607 |
+
var options = args.options;
|
12608 |
+
var type = args.type;
|
12609 |
+
|
12610 |
+
if (!options || !options.root) {
|
12611 |
+
type = namespace + type;
|
12612 |
+
if (!store._mutations[type]) {
|
12613 |
+
console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
|
12614 |
+
return
|
12615 |
+
}
|
12616 |
+
}
|
12617 |
+
|
12618 |
+
store.commit(type, payload, options);
|
12619 |
+
}
|
12620 |
+
};
|
12621 |
+
|
12622 |
+
// getters and state object must be gotten lazily
|
12623 |
+
// because they will be changed by vm update
|
12624 |
+
Object.defineProperties(local, {
|
12625 |
+
getters: {
|
12626 |
+
get: noNamespace
|
12627 |
+
? function () { return store.getters; }
|
12628 |
+
: function () { return makeLocalGetters(store, namespace); }
|
12629 |
+
},
|
12630 |
+
state: {
|
12631 |
+
get: function () { return getNestedState(store.state, path); }
|
12632 |
+
}
|
12633 |
+
});
|
12634 |
+
|
12635 |
+
return local
|
12636 |
+
}
|
12637 |
+
|
12638 |
+
function makeLocalGetters (store, namespace) {
|
12639 |
+
var gettersProxy = {};
|
12640 |
+
|
12641 |
+
var splitPos = namespace.length;
|
12642 |
+
Object.keys(store.getters).forEach(function (type) {
|
12643 |
+
// skip if the target getter is not match this namespace
|
12644 |
+
if (type.slice(0, splitPos) !== namespace) { return }
|
12645 |
+
|
12646 |
+
// extract local getter type
|
12647 |
+
var localType = type.slice(splitPos);
|
12648 |
+
|
12649 |
+
// Add a port to the getters proxy.
|
12650 |
+
// Define as getter property because
|
12651 |
+
// we do not want to evaluate the getters in this time.
|
12652 |
+
Object.defineProperty(gettersProxy, localType, {
|
12653 |
+
get: function () { return store.getters[type]; },
|
12654 |
+
enumerable: true
|
12655 |
+
});
|
12656 |
+
});
|
12657 |
+
|
12658 |
+
return gettersProxy
|
12659 |
+
}
|
12660 |
+
|
12661 |
+
function registerMutation (store, type, handler, local) {
|
12662 |
+
var entry = store._mutations[type] || (store._mutations[type] = []);
|
12663 |
+
entry.push(function wrappedMutationHandler (payload) {
|
12664 |
+
handler.call(store, local.state, payload);
|
12665 |
+
});
|
12666 |
+
}
|
12667 |
+
|
12668 |
+
function registerAction (store, type, handler, local) {
|
12669 |
+
var entry = store._actions[type] || (store._actions[type] = []);
|
12670 |
+
entry.push(function wrappedActionHandler (payload, cb) {
|
12671 |
+
var res = handler.call(store, {
|
12672 |
+
dispatch: local.dispatch,
|
12673 |
+
commit: local.commit,
|
12674 |
+
getters: local.getters,
|
12675 |
+
state: local.state,
|
12676 |
+
rootGetters: store.getters,
|
12677 |
+
rootState: store.state
|
12678 |
+
}, payload, cb);
|
12679 |
+
if (!isPromise(res)) {
|
12680 |
+
res = Promise.resolve(res);
|
12681 |
+
}
|
12682 |
+
if (store._devtoolHook) {
|
12683 |
+
return res.catch(function (err) {
|
12684 |
+
store._devtoolHook.emit('vuex:error', err);
|
12685 |
+
throw err
|
12686 |
+
})
|
12687 |
+
} else {
|
12688 |
+
return res
|
12689 |
+
}
|
12690 |
+
});
|
12691 |
+
}
|
12692 |
+
|
12693 |
+
function registerGetter (store, type, rawGetter, local) {
|
12694 |
+
if (store._wrappedGetters[type]) {
|
12695 |
+
{
|
12696 |
+
console.error(("[vuex] duplicate getter key: " + type));
|
12697 |
+
}
|
12698 |
+
return
|
12699 |
+
}
|
12700 |
+
store._wrappedGetters[type] = function wrappedGetter (store) {
|
12701 |
+
return rawGetter(
|
12702 |
+
local.state, // local state
|
12703 |
+
local.getters, // local getters
|
12704 |
+
store.state, // root state
|
12705 |
+
store.getters // root getters
|
12706 |
+
)
|
12707 |
+
};
|
12708 |
+
}
|
12709 |
+
|
12710 |
+
function enableStrictMode (store) {
|
12711 |
+
store._vm.$watch(function () { return this._data.$$state }, function () {
|
12712 |
+
{
|
12713 |
+
assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
|
12714 |
+
}
|
12715 |
+
}, { deep: true, sync: true });
|
12716 |
+
}
|
12717 |
+
|
12718 |
+
function getNestedState (state, path) {
|
12719 |
+
return path.length
|
12720 |
+
? path.reduce(function (state, key) { return state[key]; }, state)
|
12721 |
+
: state
|
12722 |
+
}
|
12723 |
+
|
12724 |
+
function unifyObjectStyle (type, payload, options) {
|
12725 |
+
if (isObject(type) && type.type) {
|
12726 |
+
options = payload;
|
12727 |
+
payload = type;
|
12728 |
+
type = type.type;
|
12729 |
+
}
|
12730 |
+
|
12731 |
+
{
|
12732 |
+
assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + "."));
|
12733 |
+
}
|
12734 |
+
|
12735 |
+
return { type: type, payload: payload, options: options }
|
12736 |
+
}
|
12737 |
+
|
12738 |
+
function install (_Vue) {
|
12739 |
+
if (Vue && _Vue === Vue) {
|
12740 |
+
{
|
12741 |
+
console.error(
|
12742 |
+
'[vuex] already installed. Vue.use(Vuex) should be called only once.'
|
12743 |
+
);
|
12744 |
+
}
|
12745 |
+
return
|
12746 |
+
}
|
12747 |
+
Vue = _Vue;
|
12748 |
+
applyMixin(Vue);
|
12749 |
+
}
|
12750 |
+
|
12751 |
+
/**
|
12752 |
+
* Reduce the code which written in Vue.js for getting the state.
|
12753 |
+
* @param {String} [namespace] - Module's namespace
|
12754 |
+
* @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.
|
12755 |
+
* @param {Object}
|
12756 |
+
*/
|
12757 |
+
var mapState = normalizeNamespace(function (namespace, states) {
|
12758 |
+
var res = {};
|
12759 |
+
normalizeMap(states).forEach(function (ref) {
|
12760 |
+
var key = ref.key;
|
12761 |
+
var val = ref.val;
|
12762 |
+
|
12763 |
+
res[key] = function mappedState () {
|
12764 |
+
var state = this.$store.state;
|
12765 |
+
var getters = this.$store.getters;
|
12766 |
+
if (namespace) {
|
12767 |
+
var module = getModuleByNamespace(this.$store, 'mapState', namespace);
|
12768 |
+
if (!module) {
|
12769 |
+
return
|
12770 |
+
}
|
12771 |
+
state = module.context.state;
|
12772 |
+
getters = module.context.getters;
|
12773 |
+
}
|
12774 |
+
return typeof val === 'function'
|
12775 |
+
? val.call(this, state, getters)
|
12776 |
+
: state[val]
|
12777 |
+
};
|
12778 |
+
// mark vuex getter for devtools
|
12779 |
+
res[key].vuex = true;
|
12780 |
+
});
|
12781 |
+
return res
|
12782 |
+
});
|
12783 |
+
|
12784 |
+
/**
|
12785 |
+
* Reduce the code which written in Vue.js for committing the mutation
|
12786 |
+
* @param {String} [namespace] - Module's namespace
|
12787 |
+
* @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept anthor params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped fun
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|