1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | 'use strict';
|
7 |
|
8 |
|
9 |
|
10 | var emptyObject = Object.freeze({});
|
11 |
|
12 |
|
13 |
|
14 | function isUndef (v) {
|
15 | return v === undefined || v === null
|
16 | }
|
17 |
|
18 | function isDef (v) {
|
19 | return v !== undefined && v !== null
|
20 | }
|
21 |
|
22 | function isTrue (v) {
|
23 | return v === true
|
24 | }
|
25 |
|
26 | function isFalse (v) {
|
27 | return v === false
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | function isPrimitive (value) {
|
34 | return (
|
35 | typeof value === 'string' ||
|
36 | typeof value === 'number' ||
|
37 |
|
38 | typeof value === 'symbol' ||
|
39 | typeof value === 'boolean'
|
40 | )
|
41 | }
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | function isObject (obj) {
|
49 | return obj !== null && typeof obj === 'object'
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | var _toString = Object.prototype.toString;
|
56 |
|
57 | function toRawType (value) {
|
58 | return _toString.call(value).slice(8, -1)
|
59 | }
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | function isPlainObject (obj) {
|
66 | return _toString.call(obj) === '[object Object]'
|
67 | }
|
68 |
|
69 | function isRegExp (v) {
|
70 | return _toString.call(v) === '[object RegExp]'
|
71 | }
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | function isValidArrayIndex (val) {
|
77 | var n = parseFloat(String(val));
|
78 | return n >= 0 && Math.floor(n) === n && isFinite(val)
|
79 | }
|
80 |
|
81 | function isPromise (val) {
|
82 | return (
|
83 | isDef(val) &&
|
84 | typeof val.then === 'function' &&
|
85 | typeof val.catch === 'function'
|
86 | )
|
87 | }
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | function toString (val) {
|
93 | return val == null
|
94 | ? ''
|
95 | : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
96 | ? JSON.stringify(val, null, 2)
|
97 | : String(val)
|
98 | }
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | function toNumber (val) {
|
105 | var n = parseFloat(val);
|
106 | return isNaN(n) ? val : n
|
107 | }
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | function makeMap (
|
114 | str,
|
115 | expectsLowerCase
|
116 | ) {
|
117 | var map = Object.create(null);
|
118 | var list = str.split(',');
|
119 | for (var i = 0; i < list.length; i++) {
|
120 | map[list[i]] = true;
|
121 | }
|
122 | return expectsLowerCase
|
123 | ? function (val) { return map[val.toLowerCase()]; }
|
124 | : function (val) { return map[val]; }
|
125 | }
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | var isBuiltInTag = makeMap('slot,component', true);
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
136 |
|
137 |
|
138 |
|
139 |
|
140 | function remove (arr, item) {
|
141 | if (arr.length) {
|
142 | var index = arr.indexOf(item);
|
143 | if (index > -1) {
|
144 | return arr.splice(index, 1)
|
145 | }
|
146 | }
|
147 | }
|
148 |
|
149 |
|
150 |
|
151 |
|
152 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
153 | function hasOwn (obj, key) {
|
154 | return hasOwnProperty.call(obj, key)
|
155 | }
|
156 |
|
157 |
|
158 |
|
159 |
|
160 | function cached (fn) {
|
161 | var cache = Object.create(null);
|
162 | return (function cachedFn (str) {
|
163 | var hit = cache[str];
|
164 | return hit || (cache[str] = fn(str))
|
165 | })
|
166 | }
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | var camelizeRE = /-(\w)/g;
|
172 | var camelize = cached(function (str) {
|
173 | return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
174 | });
|
175 |
|
176 |
|
177 |
|
178 |
|
179 | var capitalize = cached(function (str) {
|
180 | return str.charAt(0).toUpperCase() + str.slice(1)
|
181 | });
|
182 |
|
183 |
|
184 |
|
185 |
|
186 | var hyphenateRE = /\B([A-Z])/g;
|
187 | var hyphenate = cached(function (str) {
|
188 | return str.replace(hyphenateRE, '-$1').toLowerCase()
|
189 | });
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | function polyfillBind (fn, ctx) {
|
201 | function boundFn (a) {
|
202 | var l = arguments.length;
|
203 | return l
|
204 | ? l > 1
|
205 | ? fn.apply(ctx, arguments)
|
206 | : fn.call(ctx, a)
|
207 | : fn.call(ctx)
|
208 | }
|
209 |
|
210 | boundFn._length = fn.length;
|
211 | return boundFn
|
212 | }
|
213 |
|
214 | function nativeBind (fn, ctx) {
|
215 | return fn.bind(ctx)
|
216 | }
|
217 |
|
218 | var bind = Function.prototype.bind
|
219 | ? nativeBind
|
220 | : polyfillBind;
|
221 |
|
222 |
|
223 |
|
224 |
|
225 | function toArray (list, start) {
|
226 | start = start || 0;
|
227 | var i = list.length - start;
|
228 | var ret = new Array(i);
|
229 | while (i--) {
|
230 | ret[i] = list[i + start];
|
231 | }
|
232 | return ret
|
233 | }
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | function extend (to, _from) {
|
239 | for (var key in _from) {
|
240 | to[key] = _from[key];
|
241 | }
|
242 | return to
|
243 | }
|
244 |
|
245 |
|
246 |
|
247 |
|
248 | function toObject (arr) {
|
249 | var res = {};
|
250 | for (var i = 0; i < arr.length; i++) {
|
251 | if (arr[i]) {
|
252 | extend(res, arr[i]);
|
253 | }
|
254 | }
|
255 | return res
|
256 | }
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 | function noop (a, b, c) {}
|
266 |
|
267 |
|
268 |
|
269 |
|
270 | var no = function (a, b, c) { return false; };
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 | var identity = function (_) { return _; };
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 | function looseEqual (a, b) {
|
284 | if (a === b) { return true }
|
285 | var isObjectA = isObject(a);
|
286 | var isObjectB = isObject(b);
|
287 | if (isObjectA && isObjectB) {
|
288 | try {
|
289 | var isArrayA = Array.isArray(a);
|
290 | var isArrayB = Array.isArray(b);
|
291 | if (isArrayA && isArrayB) {
|
292 | return a.length === b.length && a.every(function (e, i) {
|
293 | return looseEqual(e, b[i])
|
294 | })
|
295 | } else if (a instanceof Date && b instanceof Date) {
|
296 | return a.getTime() === b.getTime()
|
297 | } else if (!isArrayA && !isArrayB) {
|
298 | var keysA = Object.keys(a);
|
299 | var keysB = Object.keys(b);
|
300 | return keysA.length === keysB.length && keysA.every(function (key) {
|
301 | return looseEqual(a[key], b[key])
|
302 | })
|
303 | } else {
|
304 |
|
305 | return false
|
306 | }
|
307 | } catch (e) {
|
308 |
|
309 | return false
|
310 | }
|
311 | } else if (!isObjectA && !isObjectB) {
|
312 | return String(a) === String(b)
|
313 | } else {
|
314 | return false
|
315 | }
|
316 | }
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 | function looseIndexOf (arr, val) {
|
324 | for (var i = 0; i < arr.length; i++) {
|
325 | if (looseEqual(arr[i], val)) { return i }
|
326 | }
|
327 | return -1
|
328 | }
|
329 |
|
330 |
|
331 |
|
332 |
|
333 | function once (fn) {
|
334 | var called = false;
|
335 | return function () {
|
336 | if (!called) {
|
337 | called = true;
|
338 | fn.apply(this, arguments);
|
339 | }
|
340 | }
|
341 | }
|
342 |
|
343 | var SSR_ATTR = 'data-server-rendered';
|
344 |
|
345 | var ASSET_TYPES = [
|
346 | 'component',
|
347 | 'directive',
|
348 | 'filter'
|
349 | ];
|
350 |
|
351 | var LIFECYCLE_HOOKS = [
|
352 | 'beforeCreate',
|
353 | 'created',
|
354 | 'beforeMount',
|
355 | 'mounted',
|
356 | 'beforeUpdate',
|
357 | 'updated',
|
358 | 'beforeDestroy',
|
359 | 'destroyed',
|
360 | 'activated',
|
361 | 'deactivated',
|
362 | 'errorCaptured',
|
363 | 'serverPrefetch'
|
364 | ];
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 | var config = ({
|
371 | |
372 |
|
373 |
|
374 |
|
375 | optionMergeStrategies: Object.create(null),
|
376 |
|
377 | |
378 |
|
379 |
|
380 | silent: false,
|
381 |
|
382 | |
383 |
|
384 |
|
385 | productionTip: "development" !== 'production',
|
386 |
|
387 | |
388 |
|
389 |
|
390 | devtools: "development" !== 'production',
|
391 |
|
392 | |
393 |
|
394 |
|
395 | performance: false,
|
396 |
|
397 | |
398 |
|
399 |
|
400 | errorHandler: null,
|
401 |
|
402 | |
403 |
|
404 |
|
405 | warnHandler: null,
|
406 |
|
407 | |
408 |
|
409 |
|
410 | ignoredElements: [],
|
411 |
|
412 | |
413 |
|
414 |
|
415 |
|
416 | keyCodes: Object.create(null),
|
417 |
|
418 | |
419 |
|
420 |
|
421 |
|
422 | isReservedTag: no,
|
423 |
|
424 | |
425 |
|
426 |
|
427 |
|
428 | isReservedAttr: no,
|
429 |
|
430 | |
431 |
|
432 |
|
433 |
|
434 | isUnknownElement: no,
|
435 |
|
436 | |
437 |
|
438 |
|
439 | getTagNamespace: noop,
|
440 |
|
441 | |
442 |
|
443 |
|
444 | parsePlatformTagName: identity,
|
445 |
|
446 | |
447 |
|
448 |
|
449 |
|
450 | mustUseProp: no,
|
451 |
|
452 | |
453 |
|
454 |
|
455 |
|
456 | async: true,
|
457 |
|
458 | |
459 |
|
460 |
|
461 | _lifecycleHooks: LIFECYCLE_HOOKS
|
462 | });
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 | var unicodeLetters = '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';
|
472 |
|
473 |
|
474 |
|
475 |
|
476 | function isReserved (str) {
|
477 | var c = (str + '').charCodeAt(0);
|
478 | return c === 0x24 || c === 0x5F
|
479 | }
|
480 |
|
481 |
|
482 |
|
483 |
|
484 | function def (obj, key, val, enumerable) {
|
485 | Object.defineProperty(obj, key, {
|
486 | value: val,
|
487 | enumerable: !!enumerable,
|
488 | writable: true,
|
489 | configurable: true
|
490 | });
|
491 | }
|
492 |
|
493 |
|
494 |
|
495 |
|
496 | var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
|
497 | function parsePath (path) {
|
498 | if (bailRE.test(path)) {
|
499 | return
|
500 | }
|
501 | var segments = path.split('.');
|
502 | return function (obj) {
|
503 | for (var i = 0; i < segments.length; i++) {
|
504 | if (!obj) { return }
|
505 | obj = obj[segments[i]];
|
506 | }
|
507 | return obj
|
508 | }
|
509 | }
|
510 |
|
511 |
|
512 |
|
513 |
|
514 | var hasProto = '__proto__' in {};
|
515 |
|
516 |
|
517 | var inBrowser = typeof window !== 'undefined';
|
518 | var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
519 | var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
520 | var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
521 | var isIE = UA && /msie|trident/.test(UA);
|
522 | var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
523 | var isEdge = UA && UA.indexOf('edge/') > 0;
|
524 | var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
525 | var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
526 | var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
527 | var isPhantomJS = UA && /phantomjs/.test(UA);
|
528 |
|
529 |
|
530 | var nativeWatch = ({}).watch;
|
531 |
|
532 | var supportsPassive = false;
|
533 | if (inBrowser) {
|
534 | try {
|
535 | var opts = {};
|
536 | Object.defineProperty(opts, 'passive', ({
|
537 | get: function get () {
|
538 |
|
539 | supportsPassive = true;
|
540 | }
|
541 | }));
|
542 | window.addEventListener('test-passive', null, opts);
|
543 | } catch (e) {}
|
544 | }
|
545 |
|
546 |
|
547 |
|
548 | var _isServer;
|
549 | var isServerRendering = function () {
|
550 | if (_isServer === undefined) {
|
551 |
|
552 | if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
553 |
|
554 |
|
555 | _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
556 | } else {
|
557 | _isServer = false;
|
558 | }
|
559 | }
|
560 | return _isServer
|
561 | };
|
562 |
|
563 |
|
564 | var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
565 |
|
566 |
|
567 | function isNative (Ctor) {
|
568 | return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
569 | }
|
570 |
|
571 | var hasSymbol =
|
572 | typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
573 | typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
574 |
|
575 | var _Set;
|
576 |
|
577 | if (typeof Set !== 'undefined' && isNative(Set)) {
|
578 |
|
579 | _Set = Set;
|
580 | } else {
|
581 |
|
582 | _Set = (function () {
|
583 | function Set () {
|
584 | this.set = Object.create(null);
|
585 | }
|
586 | Set.prototype.has = function has (key) {
|
587 | return this.set[key] === true
|
588 | };
|
589 | Set.prototype.add = function add (key) {
|
590 | this.set[key] = true;
|
591 | };
|
592 | Set.prototype.clear = function clear () {
|
593 | this.set = Object.create(null);
|
594 | };
|
595 |
|
596 | return Set;
|
597 | }());
|
598 | }
|
599 |
|
600 |
|
601 |
|
602 | var warn = noop;
|
603 | var tip = noop;
|
604 | var generateComponentTrace = (noop);
|
605 | var formatComponentName = (noop);
|
606 |
|
607 | {
|
608 | var hasConsole = typeof console !== 'undefined';
|
609 | var classifyRE = /(?:^|[-_])(\w)/g;
|
610 | var classify = function (str) { return str
|
611 | .replace(classifyRE, function (c) { return c.toUpperCase(); })
|
612 | .replace(/[-_]/g, ''); };
|
613 |
|
614 | warn = function (msg, vm) {
|
615 | var trace = vm ? generateComponentTrace(vm) : '';
|
616 |
|
617 | if (config.warnHandler) {
|
618 | config.warnHandler.call(null, msg, vm, trace);
|
619 | } else if (hasConsole && (!config.silent)) {
|
620 | console.error(("[Vue warn]: " + msg + trace));
|
621 | }
|
622 | };
|
623 |
|
624 | tip = function (msg, vm) {
|
625 | if (hasConsole && (!config.silent)) {
|
626 | console.warn("[Vue tip]: " + msg + (
|
627 | vm ? generateComponentTrace(vm) : ''
|
628 | ));
|
629 | }
|
630 | };
|
631 |
|
632 | formatComponentName = function (vm, includeFile) {
|
633 | if (vm.$root === vm) {
|
634 | return '<Root>'
|
635 | }
|
636 | var options = typeof vm === 'function' && vm.cid != null
|
637 | ? vm.options
|
638 | : vm._isVue
|
639 | ? vm.$options || vm.constructor.options
|
640 | : vm;
|
641 | var name = options.name || options._componentTag;
|
642 | var file = options.__file;
|
643 | if (!name && file) {
|
644 | var match = file.match(/([^/\\]+)\.vue$/);
|
645 | name = match && match[1];
|
646 | }
|
647 |
|
648 | return (
|
649 | (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
650 | (file && includeFile !== false ? (" at " + file) : '')
|
651 | )
|
652 | };
|
653 |
|
654 | var repeat = function (str, n) {
|
655 | var res = '';
|
656 | while (n) {
|
657 | if (n % 2 === 1) { res += str; }
|
658 | if (n > 1) { str += str; }
|
659 | n >>= 1;
|
660 | }
|
661 | return res
|
662 | };
|
663 |
|
664 | generateComponentTrace = function (vm) {
|
665 | if (vm._isVue && vm.$parent) {
|
666 | var tree = [];
|
667 | var currentRecursiveSequence = 0;
|
668 | while (vm) {
|
669 | if (tree.length > 0) {
|
670 | var last = tree[tree.length - 1];
|
671 | if (last.constructor === vm.constructor) {
|
672 | currentRecursiveSequence++;
|
673 | vm = vm.$parent;
|
674 | continue
|
675 | } else if (currentRecursiveSequence > 0) {
|
676 | tree[tree.length - 1] = [last, currentRecursiveSequence];
|
677 | currentRecursiveSequence = 0;
|
678 | }
|
679 | }
|
680 | tree.push(vm);
|
681 | vm = vm.$parent;
|
682 | }
|
683 | return '\n\nfound in\n\n' + tree
|
684 | .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
685 | ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
686 | : formatComponentName(vm))); })
|
687 | .join('\n')
|
688 | } else {
|
689 | return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
690 | }
|
691 | };
|
692 | }
|
693 |
|
694 |
|
695 |
|
696 | var uid = 0;
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 | var Dep = function Dep () {
|
703 | this.id = uid++;
|
704 | this.subs = [];
|
705 | };
|
706 |
|
707 | Dep.prototype.addSub = function addSub (sub) {
|
708 | this.subs.push(sub);
|
709 | };
|
710 |
|
711 | Dep.prototype.removeSub = function removeSub (sub) {
|
712 | remove(this.subs, sub);
|
713 | };
|
714 |
|
715 | Dep.prototype.depend = function depend () {
|
716 | if (Dep.target) {
|
717 | Dep.target.addDep(this);
|
718 | }
|
719 | };
|
720 |
|
721 | Dep.prototype.notify = function notify () {
|
722 |
|
723 | var subs = this.subs.slice();
|
724 | if (!config.async) {
|
725 |
|
726 |
|
727 |
|
728 | subs.sort(function (a, b) { return a.id - b.id; });
|
729 | }
|
730 | for (var i = 0, l = subs.length; i < l; i++) {
|
731 | subs[i].update();
|
732 | }
|
733 | };
|
734 |
|
735 |
|
736 |
|
737 |
|
738 | Dep.target = null;
|
739 | var targetStack = [];
|
740 |
|
741 | function pushTarget (target) {
|
742 | targetStack.push(target);
|
743 | Dep.target = target;
|
744 | }
|
745 |
|
746 | function popTarget () {
|
747 | targetStack.pop();
|
748 | Dep.target = targetStack[targetStack.length - 1];
|
749 | }
|
750 |
|
751 |
|
752 |
|
753 | var VNode = function VNode (
|
754 | tag,
|
755 | data,
|
756 | children,
|
757 | text,
|
758 | elm,
|
759 | context,
|
760 | componentOptions,
|
761 | asyncFactory
|
762 | ) {
|
763 | this.tag = tag;
|
764 | this.data = data;
|
765 | this.children = children;
|
766 | this.text = text;
|
767 | this.elm = elm;
|
768 | this.ns = undefined;
|
769 | this.context = context;
|
770 | this.fnContext = undefined;
|
771 | this.fnOptions = undefined;
|
772 | this.fnScopeId = undefined;
|
773 | this.key = data && data.key;
|
774 | this.componentOptions = componentOptions;
|
775 | this.componentInstance = undefined;
|
776 | this.parent = undefined;
|
777 | this.raw = false;
|
778 | this.isStatic = false;
|
779 | this.isRootInsert = true;
|
780 | this.isComment = false;
|
781 | this.isCloned = false;
|
782 | this.isOnce = false;
|
783 | this.asyncFactory = asyncFactory;
|
784 | this.asyncMeta = undefined;
|
785 | this.isAsyncPlaceholder = false;
|
786 | };
|
787 |
|
788 | var prototypeAccessors = { child: { configurable: true } };
|
789 |
|
790 |
|
791 |
|
792 | prototypeAccessors.child.get = function () {
|
793 | return this.componentInstance
|
794 | };
|
795 |
|
796 | Object.defineProperties( VNode.prototype, prototypeAccessors );
|
797 |
|
798 | var createEmptyVNode = function (text) {
|
799 | if ( text === void 0 ) text = '';
|
800 |
|
801 | var node = new VNode();
|
802 | node.text = text;
|
803 | node.isComment = true;
|
804 | return node
|
805 | };
|
806 |
|
807 | function createTextVNode (val) {
|
808 | return new VNode(undefined, undefined, undefined, String(val))
|
809 | }
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 | function cloneVNode (vnode) {
|
816 | var cloned = new VNode(
|
817 | vnode.tag,
|
818 | vnode.data,
|
819 |
|
820 |
|
821 |
|
822 | vnode.children && vnode.children.slice(),
|
823 | vnode.text,
|
824 | vnode.elm,
|
825 | vnode.context,
|
826 | vnode.componentOptions,
|
827 | vnode.asyncFactory
|
828 | );
|
829 | cloned.ns = vnode.ns;
|
830 | cloned.isStatic = vnode.isStatic;
|
831 | cloned.key = vnode.key;
|
832 | cloned.isComment = vnode.isComment;
|
833 | cloned.fnContext = vnode.fnContext;
|
834 | cloned.fnOptions = vnode.fnOptions;
|
835 | cloned.fnScopeId = vnode.fnScopeId;
|
836 | cloned.asyncMeta = vnode.asyncMeta;
|
837 | cloned.isCloned = true;
|
838 | return cloned
|
839 | }
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | var arrayProto = Array.prototype;
|
847 | var arrayMethods = Object.create(arrayProto);
|
848 |
|
849 | var methodsToPatch = [
|
850 | 'push',
|
851 | 'pop',
|
852 | 'shift',
|
853 | 'unshift',
|
854 | 'splice',
|
855 | 'sort',
|
856 | 'reverse'
|
857 | ];
|
858 |
|
859 |
|
860 |
|
861 |
|
862 | methodsToPatch.forEach(function (method) {
|
863 |
|
864 | var original = arrayProto[method];
|
865 | def(arrayMethods, method, function mutator () {
|
866 | var args = [], len = arguments.length;
|
867 | while ( len-- ) args[ len ] = arguments[ len ];
|
868 |
|
869 | var result = original.apply(this, args);
|
870 | var ob = this.__ob__;
|
871 | var inserted;
|
872 | switch (method) {
|
873 | case 'push':
|
874 | case 'unshift':
|
875 | inserted = args;
|
876 | break
|
877 | case 'splice':
|
878 | inserted = args.slice(2);
|
879 | break
|
880 | }
|
881 | if (inserted) { ob.observeArray(inserted); }
|
882 |
|
883 | ob.dep.notify();
|
884 | return result
|
885 | });
|
886 | });
|
887 |
|
888 |
|
889 |
|
890 | var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 | var shouldObserve = true;
|
897 |
|
898 | function toggleObserving (value) {
|
899 | shouldObserve = value;
|
900 | }
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 | var Observer = function Observer (value) {
|
909 | this.value = value;
|
910 | this.dep = new Dep();
|
911 | this.vmCount = 0;
|
912 | def(value, '__ob__', this);
|
913 | if (Array.isArray(value)) {
|
914 | if (hasProto) {
|
915 | protoAugment(value, arrayMethods);
|
916 | } else {
|
917 | copyAugment(value, arrayMethods, arrayKeys);
|
918 | }
|
919 | this.observeArray(value);
|
920 | } else {
|
921 | this.walk(value);
|
922 | }
|
923 | };
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 | Observer.prototype.walk = function walk (obj) {
|
931 | var keys = Object.keys(obj);
|
932 | for (var i = 0; i < keys.length; i++) {
|
933 | defineReactive$$1(obj, keys[i]);
|
934 | }
|
935 | };
|
936 |
|
937 |
|
938 |
|
939 |
|
940 | Observer.prototype.observeArray = function observeArray (items) {
|
941 | for (var i = 0, l = items.length; i < l; i++) {
|
942 | observe(items[i]);
|
943 | }
|
944 | };
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 | function protoAugment (target, src) {
|
953 |
|
954 | target.__proto__ = src;
|
955 |
|
956 | }
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 | function copyAugment (target, src, keys) {
|
964 | for (var i = 0, l = keys.length; i < l; i++) {
|
965 | var key = keys[i];
|
966 | def(target, key, src[key]);
|
967 | }
|
968 | }
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 | function observe (value, asRootData) {
|
976 | if (!isObject(value) || value instanceof VNode) {
|
977 | return
|
978 | }
|
979 | var ob;
|
980 | if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
981 | ob = value.__ob__;
|
982 | } else if (
|
983 | shouldObserve &&
|
984 | !isServerRendering() &&
|
985 | (Array.isArray(value) || isPlainObject(value)) &&
|
986 | Object.isExtensible(value) &&
|
987 | !value._isVue
|
988 | ) {
|
989 | ob = new Observer(value);
|
990 | }
|
991 | if (asRootData && ob) {
|
992 | ob.vmCount++;
|
993 | }
|
994 | return ob
|
995 | }
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 | function defineReactive$$1 (
|
1001 | obj,
|
1002 | key,
|
1003 | val,
|
1004 | customSetter,
|
1005 | shallow
|
1006 | ) {
|
1007 | var dep = new Dep();
|
1008 |
|
1009 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
1010 | if (property && property.configurable === false) {
|
1011 | return
|
1012 | }
|
1013 |
|
1014 |
|
1015 | var getter = property && property.get;
|
1016 | var setter = property && property.set;
|
1017 | if ((!getter || setter) && arguments.length === 2) {
|
1018 | val = obj[key];
|
1019 | }
|
1020 |
|
1021 | var childOb = !shallow && observe(val);
|
1022 | Object.defineProperty(obj, key, {
|
1023 | enumerable: true,
|
1024 | configurable: true,
|
1025 | get: function reactiveGetter () {
|
1026 | var value = getter ? getter.call(obj) : val;
|
1027 | if (Dep.target) {
|
1028 | dep.depend();
|
1029 | if (childOb) {
|
1030 | childOb.dep.depend();
|
1031 | if (Array.isArray(value)) {
|
1032 | dependArray(value);
|
1033 | }
|
1034 | }
|
1035 | }
|
1036 | return value
|
1037 | },
|
1038 | set: function reactiveSetter (newVal) {
|
1039 | var value = getter ? getter.call(obj) : val;
|
1040 |
|
1041 | if (newVal === value || (newVal !== newVal && value !== value)) {
|
1042 | return
|
1043 | }
|
1044 |
|
1045 | if (customSetter) {
|
1046 | customSetter();
|
1047 | }
|
1048 |
|
1049 | if (getter && !setter) { return }
|
1050 | if (setter) {
|
1051 | setter.call(obj, newVal);
|
1052 | } else {
|
1053 | val = newVal;
|
1054 | }
|
1055 | childOb = !shallow && observe(newVal);
|
1056 | dep.notify();
|
1057 | }
|
1058 | });
|
1059 | }
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 | function set (target, key, val) {
|
1067 | if (isUndef(target) || isPrimitive(target)
|
1068 | ) {
|
1069 | warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1070 | }
|
1071 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1072 | target.length = Math.max(target.length, key);
|
1073 | target.splice(key, 1, val);
|
1074 | return val
|
1075 | }
|
1076 | if (key in target && !(key in Object.prototype)) {
|
1077 | target[key] = val;
|
1078 | return val
|
1079 | }
|
1080 | var ob = (target).__ob__;
|
1081 | if (target._isVue || (ob && ob.vmCount)) {
|
1082 | warn(
|
1083 | 'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1084 | 'at runtime - declare it upfront in the data option.'
|
1085 | );
|
1086 | return val
|
1087 | }
|
1088 | if (!ob) {
|
1089 | target[key] = val;
|
1090 | return val
|
1091 | }
|
1092 | defineReactive$$1(ob.value, key, val);
|
1093 | ob.dep.notify();
|
1094 | return val
|
1095 | }
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 | function del (target, key) {
|
1101 | if (isUndef(target) || isPrimitive(target)
|
1102 | ) {
|
1103 | warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
1104 | }
|
1105 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1106 | target.splice(key, 1);
|
1107 | return
|
1108 | }
|
1109 | var ob = (target).__ob__;
|
1110 | if (target._isVue || (ob && ob.vmCount)) {
|
1111 | warn(
|
1112 | 'Avoid deleting properties on a Vue instance or its root $data ' +
|
1113 | '- just set it to null.'
|
1114 | );
|
1115 | return
|
1116 | }
|
1117 | if (!hasOwn(target, key)) {
|
1118 | return
|
1119 | }
|
1120 | delete target[key];
|
1121 | if (!ob) {
|
1122 | return
|
1123 | }
|
1124 | ob.dep.notify();
|
1125 | }
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 | function dependArray (value) {
|
1132 | for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1133 | e = value[i];
|
1134 | e && e.__ob__ && e.__ob__.dep.depend();
|
1135 | if (Array.isArray(e)) {
|
1136 | dependArray(e);
|
1137 | }
|
1138 | }
|
1139 | }
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 | var strats = config.optionMergeStrategies;
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 | {
|
1154 | strats.el = strats.propsData = function (parent, child, vm, key) {
|
1155 | if (!vm) {
|
1156 | warn(
|
1157 | "option \"" + key + "\" can only be used during instance " +
|
1158 | 'creation with the `new` keyword.'
|
1159 | );
|
1160 | }
|
1161 | return defaultStrat(parent, child)
|
1162 | };
|
1163 | }
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | function mergeData (to, from) {
|
1169 | if (!from) { return to }
|
1170 | var key, toVal, fromVal;
|
1171 |
|
1172 | var keys = hasSymbol
|
1173 | ? Reflect.ownKeys(from)
|
1174 | : Object.keys(from);
|
1175 |
|
1176 | for (var i = 0; i < keys.length; i++) {
|
1177 | key = keys[i];
|
1178 |
|
1179 | if (key === '__ob__') { continue }
|
1180 | toVal = to[key];
|
1181 | fromVal = from[key];
|
1182 | if (!hasOwn(to, key)) {
|
1183 | set(to, key, fromVal);
|
1184 | } else if (
|
1185 | toVal !== fromVal &&
|
1186 | isPlainObject(toVal) &&
|
1187 | isPlainObject(fromVal)
|
1188 | ) {
|
1189 | mergeData(toVal, fromVal);
|
1190 | }
|
1191 | }
|
1192 | return to
|
1193 | }
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 | function mergeDataOrFn (
|
1199 | parentVal,
|
1200 | childVal,
|
1201 | vm
|
1202 | ) {
|
1203 | if (!vm) {
|
1204 |
|
1205 | if (!childVal) {
|
1206 | return parentVal
|
1207 | }
|
1208 | if (!parentVal) {
|
1209 | return childVal
|
1210 | }
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 | return function mergedDataFn () {
|
1217 | return mergeData(
|
1218 | typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1219 | typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1220 | )
|
1221 | }
|
1222 | } else {
|
1223 | return function mergedInstanceDataFn () {
|
1224 |
|
1225 | var instanceData = typeof childVal === 'function'
|
1226 | ? childVal.call(vm, vm)
|
1227 | : childVal;
|
1228 | var defaultData = typeof parentVal === 'function'
|
1229 | ? parentVal.call(vm, vm)
|
1230 | : parentVal;
|
1231 | if (instanceData) {
|
1232 | return mergeData(instanceData, defaultData)
|
1233 | } else {
|
1234 | return defaultData
|
1235 | }
|
1236 | }
|
1237 | }
|
1238 | }
|
1239 |
|
1240 | strats.data = function (
|
1241 | parentVal,
|
1242 | childVal,
|
1243 | vm
|
1244 | ) {
|
1245 | if (!vm) {
|
1246 | if (childVal && typeof childVal !== 'function') {
|
1247 | warn(
|
1248 | 'The "data" option should be a function ' +
|
1249 | 'that returns a per-instance value in component ' +
|
1250 | 'definitions.',
|
1251 | vm
|
1252 | );
|
1253 |
|
1254 | return parentVal
|
1255 | }
|
1256 | return mergeDataOrFn(parentVal, childVal)
|
1257 | }
|
1258 |
|
1259 | return mergeDataOrFn(parentVal, childVal, vm)
|
1260 | };
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 | function mergeHook (
|
1266 | parentVal,
|
1267 | childVal
|
1268 | ) {
|
1269 | var res = childVal
|
1270 | ? parentVal
|
1271 | ? parentVal.concat(childVal)
|
1272 | : Array.isArray(childVal)
|
1273 | ? childVal
|
1274 | : [childVal]
|
1275 | : parentVal;
|
1276 | return res
|
1277 | ? dedupeHooks(res)
|
1278 | : res
|
1279 | }
|
1280 |
|
1281 | function dedupeHooks (hooks) {
|
1282 | var res = [];
|
1283 | for (var i = 0; i < hooks.length; i++) {
|
1284 | if (res.indexOf(hooks[i]) === -1) {
|
1285 | res.push(hooks[i]);
|
1286 | }
|
1287 | }
|
1288 | return res
|
1289 | }
|
1290 |
|
1291 | LIFECYCLE_HOOKS.forEach(function (hook) {
|
1292 | strats[hook] = mergeHook;
|
1293 | });
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 | function mergeAssets (
|
1303 | parentVal,
|
1304 | childVal,
|
1305 | vm,
|
1306 | key
|
1307 | ) {
|
1308 | var res = Object.create(parentVal || null);
|
1309 | if (childVal) {
|
1310 | assertObjectType(key, childVal, vm);
|
1311 | return extend(res, childVal)
|
1312 | } else {
|
1313 | return res
|
1314 | }
|
1315 | }
|
1316 |
|
1317 | ASSET_TYPES.forEach(function (type) {
|
1318 | strats[type + 's'] = mergeAssets;
|
1319 | });
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 | strats.watch = function (
|
1328 | parentVal,
|
1329 | childVal,
|
1330 | vm,
|
1331 | key
|
1332 | ) {
|
1333 |
|
1334 | if (parentVal === nativeWatch) { parentVal = undefined; }
|
1335 | if (childVal === nativeWatch) { childVal = undefined; }
|
1336 |
|
1337 | if (!childVal) { return Object.create(parentVal || null) }
|
1338 | {
|
1339 | assertObjectType(key, childVal, vm);
|
1340 | }
|
1341 | if (!parentVal) { return childVal }
|
1342 | var ret = {};
|
1343 | extend(ret, parentVal);
|
1344 | for (var key$1 in childVal) {
|
1345 | var parent = ret[key$1];
|
1346 | var child = childVal[key$1];
|
1347 | if (parent && !Array.isArray(parent)) {
|
1348 | parent = [parent];
|
1349 | }
|
1350 | ret[key$1] = parent
|
1351 | ? parent.concat(child)
|
1352 | : Array.isArray(child) ? child : [child];
|
1353 | }
|
1354 | return ret
|
1355 | };
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 | strats.props =
|
1361 | strats.methods =
|
1362 | strats.inject =
|
1363 | strats.computed = function (
|
1364 | parentVal,
|
1365 | childVal,
|
1366 | vm,
|
1367 | key
|
1368 | ) {
|
1369 | if (childVal && "development" !== 'production') {
|
1370 | assertObjectType(key, childVal, vm);
|
1371 | }
|
1372 | if (!parentVal) { return childVal }
|
1373 | var ret = Object.create(null);
|
1374 | extend(ret, parentVal);
|
1375 | if (childVal) { extend(ret, childVal); }
|
1376 | return ret
|
1377 | };
|
1378 | strats.provide = mergeDataOrFn;
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 | var defaultStrat = function (parentVal, childVal) {
|
1384 | return childVal === undefined
|
1385 | ? parentVal
|
1386 | : childVal
|
1387 | };
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 | function checkComponents (options) {
|
1393 | for (var key in options.components) {
|
1394 | validateComponentName(key);
|
1395 | }
|
1396 | }
|
1397 |
|
1398 | function validateComponentName (name) {
|
1399 | if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
|
1400 | warn(
|
1401 | 'Invalid component name: "' + name + '". Component names ' +
|
1402 | 'should conform to valid custom element name in html5 specification.'
|
1403 | );
|
1404 | }
|
1405 | if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
1406 | warn(
|
1407 | 'Do not use built-in or reserved HTML elements as component ' +
|
1408 | 'id: ' + name
|
1409 | );
|
1410 | }
|
1411 | }
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 | function normalizeProps (options, vm) {
|
1418 | var props = options.props;
|
1419 | if (!props) { return }
|
1420 | var res = {};
|
1421 | var i, val, name;
|
1422 | if (Array.isArray(props)) {
|
1423 | i = props.length;
|
1424 | while (i--) {
|
1425 | val = props[i];
|
1426 | if (typeof val === 'string') {
|
1427 | name = camelize(val);
|
1428 | res[name] = { type: null };
|
1429 | } else {
|
1430 | warn('props must be strings when using array syntax.');
|
1431 | }
|
1432 | }
|
1433 | } else if (isPlainObject(props)) {
|
1434 | for (var key in props) {
|
1435 | val = props[key];
|
1436 | name = camelize(key);
|
1437 | res[name] = isPlainObject(val)
|
1438 | ? val
|
1439 | : { type: val };
|
1440 | }
|
1441 | } else {
|
1442 | warn(
|
1443 | "Invalid value for option \"props\": expected an Array or an Object, " +
|
1444 | "but got " + (toRawType(props)) + ".",
|
1445 | vm
|
1446 | );
|
1447 | }
|
1448 | options.props = res;
|
1449 | }
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 | function normalizeInject (options, vm) {
|
1455 | var inject = options.inject;
|
1456 | if (!inject) { return }
|
1457 | var normalized = options.inject = {};
|
1458 | if (Array.isArray(inject)) {
|
1459 | for (var i = 0; i < inject.length; i++) {
|
1460 | normalized[inject[i]] = { from: inject[i] };
|
1461 | }
|
1462 | } else if (isPlainObject(inject)) {
|
1463 | for (var key in inject) {
|
1464 | var val = inject[key];
|
1465 | normalized[key] = isPlainObject(val)
|
1466 | ? extend({ from: key }, val)
|
1467 | : { from: val };
|
1468 | }
|
1469 | } else {
|
1470 | warn(
|
1471 | "Invalid value for option \"inject\": expected an Array or an Object, " +
|
1472 | "but got " + (toRawType(inject)) + ".",
|
1473 | vm
|
1474 | );
|
1475 | }
|
1476 | }
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 | function normalizeDirectives (options) {
|
1482 | var dirs = options.directives;
|
1483 | if (dirs) {
|
1484 | for (var key in dirs) {
|
1485 | var def$$1 = dirs[key];
|
1486 | if (typeof def$$1 === 'function') {
|
1487 | dirs[key] = { bind: def$$1, update: def$$1 };
|
1488 | }
|
1489 | }
|
1490 | }
|
1491 | }
|
1492 |
|
1493 | function assertObjectType (name, value, vm) {
|
1494 | if (!isPlainObject(value)) {
|
1495 | warn(
|
1496 | "Invalid value for option \"" + name + "\": expected an Object, " +
|
1497 | "but got " + (toRawType(value)) + ".",
|
1498 | vm
|
1499 | );
|
1500 | }
|
1501 | }
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 | function mergeOptions (
|
1508 | parent,
|
1509 | child,
|
1510 | vm
|
1511 | ) {
|
1512 | {
|
1513 | checkComponents(child);
|
1514 | }
|
1515 |
|
1516 | if (typeof child === 'function') {
|
1517 | child = child.options;
|
1518 | }
|
1519 |
|
1520 | normalizeProps(child, vm);
|
1521 | normalizeInject(child, vm);
|
1522 | normalizeDirectives(child);
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 | if (!child._base) {
|
1529 | if (child.extends) {
|
1530 | parent = mergeOptions(parent, child.extends, vm);
|
1531 | }
|
1532 | if (child.mixins) {
|
1533 | for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1534 | parent = mergeOptions(parent, child.mixins[i], vm);
|
1535 | }
|
1536 | }
|
1537 | }
|
1538 |
|
1539 | var options = {};
|
1540 | var key;
|
1541 | for (key in parent) {
|
1542 | mergeField(key);
|
1543 | }
|
1544 | for (key in child) {
|
1545 | if (!hasOwn(parent, key)) {
|
1546 | mergeField(key);
|
1547 | }
|
1548 | }
|
1549 | function mergeField (key) {
|
1550 | var strat = strats[key] || defaultStrat;
|
1551 | options[key] = strat(parent[key], child[key], vm, key);
|
1552 | }
|
1553 | return options
|
1554 | }
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 | function resolveAsset (
|
1562 | options,
|
1563 | type,
|
1564 | id,
|
1565 | warnMissing
|
1566 | ) {
|
1567 |
|
1568 | if (typeof id !== 'string') {
|
1569 | return
|
1570 | }
|
1571 | var assets = options[type];
|
1572 |
|
1573 | if (hasOwn(assets, id)) { return assets[id] }
|
1574 | var camelizedId = camelize(id);
|
1575 | if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1576 | var PascalCaseId = capitalize(camelizedId);
|
1577 | if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1578 |
|
1579 | var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1580 | if (warnMissing && !res) {
|
1581 | warn(
|
1582 | 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
1583 | options
|
1584 | );
|
1585 | }
|
1586 | return res
|
1587 | }
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 | function validateProp (
|
1594 | key,
|
1595 | propOptions,
|
1596 | propsData,
|
1597 | vm
|
1598 | ) {
|
1599 | var prop = propOptions[key];
|
1600 | var absent = !hasOwn(propsData, key);
|
1601 | var value = propsData[key];
|
1602 |
|
1603 | var booleanIndex = getTypeIndex(Boolean, prop.type);
|
1604 | if (booleanIndex > -1) {
|
1605 | if (absent && !hasOwn(prop, 'default')) {
|
1606 | value = false;
|
1607 | } else if (value === '' || value === hyphenate(key)) {
|
1608 |
|
1609 |
|
1610 | var stringIndex = getTypeIndex(String, prop.type);
|
1611 | if (stringIndex < 0 || booleanIndex < stringIndex) {
|
1612 | value = true;
|
1613 | }
|
1614 | }
|
1615 | }
|
1616 |
|
1617 | if (value === undefined) {
|
1618 | value = getPropDefaultValue(vm, prop, key);
|
1619 |
|
1620 |
|
1621 | var prevShouldObserve = shouldObserve;
|
1622 | toggleObserving(true);
|
1623 | observe(value);
|
1624 | toggleObserving(prevShouldObserve);
|
1625 | }
|
1626 | {
|
1627 | assertProp(prop, key, value, vm, absent);
|
1628 | }
|
1629 | return value
|
1630 | }
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 | function getPropDefaultValue (vm, prop, key) {
|
1636 |
|
1637 | if (!hasOwn(prop, 'default')) {
|
1638 | return undefined
|
1639 | }
|
1640 | var def = prop.default;
|
1641 |
|
1642 | if (isObject(def)) {
|
1643 | warn(
|
1644 | 'Invalid default value for prop "' + key + '": ' +
|
1645 | 'Props with type Object/Array must use a factory function ' +
|
1646 | 'to return the default value.',
|
1647 | vm
|
1648 | );
|
1649 | }
|
1650 |
|
1651 |
|
1652 | if (vm && vm.$options.propsData &&
|
1653 | vm.$options.propsData[key] === undefined &&
|
1654 | vm._props[key] !== undefined
|
1655 | ) {
|
1656 | return vm._props[key]
|
1657 | }
|
1658 |
|
1659 |
|
1660 | return typeof def === 'function' && getType(prop.type) !== 'Function'
|
1661 | ? def.call(vm)
|
1662 | : def
|
1663 | }
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 | function assertProp (
|
1669 | prop,
|
1670 | name,
|
1671 | value,
|
1672 | vm,
|
1673 | absent
|
1674 | ) {
|
1675 | if (prop.required && absent) {
|
1676 | warn(
|
1677 | 'Missing required prop: "' + name + '"',
|
1678 | vm
|
1679 | );
|
1680 | return
|
1681 | }
|
1682 | if (value == null && !prop.required) {
|
1683 | return
|
1684 | }
|
1685 | var type = prop.type;
|
1686 | var valid = !type || type === true;
|
1687 | var expectedTypes = [];
|
1688 | if (type) {
|
1689 | if (!Array.isArray(type)) {
|
1690 | type = [type];
|
1691 | }
|
1692 | for (var i = 0; i < type.length && !valid; i++) {
|
1693 | var assertedType = assertType(value, type[i]);
|
1694 | expectedTypes.push(assertedType.expectedType || '');
|
1695 | valid = assertedType.valid;
|
1696 | }
|
1697 | }
|
1698 |
|
1699 | if (!valid) {
|
1700 | warn(
|
1701 | getInvalidTypeMessage(name, value, expectedTypes),
|
1702 | vm
|
1703 | );
|
1704 | return
|
1705 | }
|
1706 | var validator = prop.validator;
|
1707 | if (validator) {
|
1708 | if (!validator(value)) {
|
1709 | warn(
|
1710 | 'Invalid prop: custom validator check failed for prop "' + name + '".',
|
1711 | vm
|
1712 | );
|
1713 | }
|
1714 | }
|
1715 | }
|
1716 |
|
1717 | var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
1718 |
|
1719 | function assertType (value, type) {
|
1720 | var valid;
|
1721 | var expectedType = getType(type);
|
1722 | if (simpleCheckRE.test(expectedType)) {
|
1723 | var t = typeof value;
|
1724 | valid = t === expectedType.toLowerCase();
|
1725 |
|
1726 | if (!valid && t === 'object') {
|
1727 | valid = value instanceof type;
|
1728 | }
|
1729 | } else if (expectedType === 'Object') {
|
1730 | valid = isPlainObject(value);
|
1731 | } else if (expectedType === 'Array') {
|
1732 | valid = Array.isArray(value);
|
1733 | } else {
|
1734 | valid = value instanceof type;
|
1735 | }
|
1736 | return {
|
1737 | valid: valid,
|
1738 | expectedType: expectedType
|
1739 | }
|
1740 | }
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 | function getType (fn) {
|
1748 | var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
1749 | return match ? match[1] : ''
|
1750 | }
|
1751 |
|
1752 | function isSameType (a, b) {
|
1753 | return getType(a) === getType(b)
|
1754 | }
|
1755 |
|
1756 | function getTypeIndex (type, expectedTypes) {
|
1757 | if (!Array.isArray(expectedTypes)) {
|
1758 | return isSameType(expectedTypes, type) ? 0 : -1
|
1759 | }
|
1760 | for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
1761 | if (isSameType(expectedTypes[i], type)) {
|
1762 | return i
|
1763 | }
|
1764 | }
|
1765 | return -1
|
1766 | }
|
1767 |
|
1768 | function getInvalidTypeMessage (name, value, expectedTypes) {
|
1769 | var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
1770 | " Expected " + (expectedTypes.map(capitalize).join(', '));
|
1771 | var expectedType = expectedTypes[0];
|
1772 | var receivedType = toRawType(value);
|
1773 | var expectedValue = styleValue(value, expectedType);
|
1774 | var receivedValue = styleValue(value, receivedType);
|
1775 |
|
1776 | if (expectedTypes.length === 1 &&
|
1777 | isExplicable(expectedType) &&
|
1778 | !isBoolean(expectedType, receivedType)) {
|
1779 | message += " with value " + expectedValue;
|
1780 | }
|
1781 | message += ", got " + receivedType + " ";
|
1782 |
|
1783 | if (isExplicable(receivedType)) {
|
1784 | message += "with value " + receivedValue + ".";
|
1785 | }
|
1786 | return message
|
1787 | }
|
1788 |
|
1789 | function styleValue (value, type) {
|
1790 | if (type === 'String') {
|
1791 | return ("\"" + value + "\"")
|
1792 | } else if (type === 'Number') {
|
1793 | return ("" + (Number(value)))
|
1794 | } else {
|
1795 | return ("" + value)
|
1796 | }
|
1797 | }
|
1798 |
|
1799 | function isExplicable (value) {
|
1800 | var explicitTypes = ['string', 'number', 'boolean'];
|
1801 | return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
1802 | }
|
1803 |
|
1804 | function isBoolean () {
|
1805 | var args = [], len = arguments.length;
|
1806 | while ( len-- ) args[ len ] = arguments[ len ];
|
1807 |
|
1808 | return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
1809 | }
|
1810 |
|
1811 |
|
1812 |
|
1813 | function handleError (err, vm, info) {
|
1814 | if (vm) {
|
1815 | var cur = vm;
|
1816 | while ((cur = cur.$parent)) {
|
1817 | var hooks = cur.$options.errorCaptured;
|
1818 | if (hooks) {
|
1819 | for (var i = 0; i < hooks.length; i++) {
|
1820 | try {
|
1821 | var capture = hooks[i].call(cur, err, vm, info) === false;
|
1822 | if (capture) { return }
|
1823 | } catch (e) {
|
1824 | globalHandleError(e, cur, 'errorCaptured hook');
|
1825 | }
|
1826 | }
|
1827 | }
|
1828 | }
|
1829 | }
|
1830 | globalHandleError(err, vm, info);
|
1831 | }
|
1832 |
|
1833 | function invokeWithErrorHandling (
|
1834 | handler,
|
1835 | context,
|
1836 | args,
|
1837 | vm,
|
1838 | info
|
1839 | ) {
|
1840 | var res;
|
1841 | try {
|
1842 | res = args ? handler.apply(context, args) : handler.call(context);
|
1843 | if (isPromise(res)) {
|
1844 | res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
1845 | }
|
1846 | } catch (e) {
|
1847 | handleError(e, vm, info);
|
1848 | }
|
1849 | return res
|
1850 | }
|
1851 |
|
1852 | function globalHandleError (err, vm, info) {
|
1853 | if (config.errorHandler) {
|
1854 | try {
|
1855 | return config.errorHandler.call(null, err, vm, info)
|
1856 | } catch (e) {
|
1857 | logError(e, null, 'config.errorHandler');
|
1858 | }
|
1859 | }
|
1860 | logError(err, vm, info);
|
1861 | }
|
1862 |
|
1863 | function logError (err, vm, info) {
|
1864 | {
|
1865 | warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
1866 | }
|
1867 |
|
1868 | if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
1869 | console.error(err);
|
1870 | } else {
|
1871 | throw err
|
1872 | }
|
1873 | }
|
1874 |
|
1875 |
|
1876 |
|
1877 | var isUsingMicroTask = false;
|
1878 |
|
1879 | var callbacks = [];
|
1880 | var pending = false;
|
1881 |
|
1882 | function flushCallbacks () {
|
1883 | pending = false;
|
1884 | var copies = callbacks.slice(0);
|
1885 | callbacks.length = 0;
|
1886 | for (var i = 0; i < copies.length; i++) {
|
1887 | copies[i]();
|
1888 | }
|
1889 | }
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 | var timerFunc;
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 | if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
1912 | var p = Promise.resolve();
|
1913 | timerFunc = function () {
|
1914 | p.then(flushCallbacks);
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 | if (isIOS) { setTimeout(noop); }
|
1921 | };
|
1922 | isUsingMicroTask = true;
|
1923 | } else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1924 | isNative(MutationObserver) ||
|
1925 |
|
1926 | MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1927 | )) {
|
1928 |
|
1929 |
|
1930 |
|
1931 | var counter = 1;
|
1932 | var observer = new MutationObserver(flushCallbacks);
|
1933 | var textNode = document.createTextNode(String(counter));
|
1934 | observer.observe(textNode, {
|
1935 | characterData: true
|
1936 | });
|
1937 | timerFunc = function () {
|
1938 | counter = (counter + 1) % 2;
|
1939 | textNode.data = String(counter);
|
1940 | };
|
1941 | isUsingMicroTask = true;
|
1942 | } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
1943 |
|
1944 |
|
1945 |
|
1946 | timerFunc = function () {
|
1947 | setImmediate(flushCallbacks);
|
1948 | };
|
1949 | } else {
|
1950 |
|
1951 | timerFunc = function () {
|
1952 | setTimeout(flushCallbacks, 0);
|
1953 | };
|
1954 | }
|
1955 |
|
1956 | function nextTick (cb, ctx) {
|
1957 | var _resolve;
|
1958 | callbacks.push(function () {
|
1959 | if (cb) {
|
1960 | try {
|
1961 | cb.call(ctx);
|
1962 | } catch (e) {
|
1963 | handleError(e, ctx, 'nextTick');
|
1964 | }
|
1965 | } else if (_resolve) {
|
1966 | _resolve(ctx);
|
1967 | }
|
1968 | });
|
1969 | if (!pending) {
|
1970 | pending = true;
|
1971 | timerFunc();
|
1972 | }
|
1973 |
|
1974 | if (!cb && typeof Promise !== 'undefined') {
|
1975 | return new Promise(function (resolve) {
|
1976 | _resolve = resolve;
|
1977 | })
|
1978 | }
|
1979 | }
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 | var initProxy;
|
1986 |
|
1987 | {
|
1988 | var allowedGlobals = makeMap(
|
1989 | 'Infinity,undefined,NaN,isFinite,isNaN,' +
|
1990 | 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
1991 | 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
1992 | 'require'
|
1993 | );
|
1994 |
|
1995 | var warnNonPresent = function (target, key) {
|
1996 | warn(
|
1997 | "Property or method \"" + key + "\" is not defined on the instance but " +
|
1998 | 'referenced during render. Make sure that this property is reactive, ' +
|
1999 | 'either in the data option, or for class-based components, by ' +
|
2000 | 'initializing the property. ' +
|
2001 | 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
2002 | target
|
2003 | );
|
2004 | };
|
2005 |
|
2006 | var warnReservedPrefix = function (target, key) {
|
2007 | warn(
|
2008 | "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
2009 | 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
2010 | 'prevent conflicts with Vue internals' +
|
2011 | 'See: https://vuejs.org/v2/api/#data',
|
2012 | target
|
2013 | );
|
2014 | };
|
2015 |
|
2016 | var hasProxy =
|
2017 | typeof Proxy !== 'undefined' && isNative(Proxy);
|
2018 |
|
2019 | if (hasProxy) {
|
2020 | var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
2021 | config.keyCodes = new Proxy(config.keyCodes, {
|
2022 | set: function set (target, key, value) {
|
2023 | if (isBuiltInModifier(key)) {
|
2024 | warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
2025 | return false
|
2026 | } else {
|
2027 | target[key] = value;
|
2028 | return true
|
2029 | }
|
2030 | }
|
2031 | });
|
2032 | }
|
2033 |
|
2034 | var hasHandler = {
|
2035 | has: function has (target, key) {
|
2036 | var has = key in target;
|
2037 | var isAllowed = allowedGlobals(key) ||
|
2038 | (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
2039 | if (!has && !isAllowed) {
|
2040 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2041 | else { warnNonPresent(target, key); }
|
2042 | }
|
2043 | return has || !isAllowed
|
2044 | }
|
2045 | };
|
2046 |
|
2047 | var getHandler = {
|
2048 | get: function get (target, key) {
|
2049 | if (typeof key === 'string' && !(key in target)) {
|
2050 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2051 | else { warnNonPresent(target, key); }
|
2052 | }
|
2053 | return target[key]
|
2054 | }
|
2055 | };
|
2056 |
|
2057 | initProxy = function initProxy (vm) {
|
2058 | if (hasProxy) {
|
2059 |
|
2060 | var options = vm.$options;
|
2061 | var handlers = options.render && options.render._withStripped
|
2062 | ? getHandler
|
2063 | : hasHandler;
|
2064 | vm._renderProxy = new Proxy(vm, handlers);
|
2065 | } else {
|
2066 | vm._renderProxy = vm;
|
2067 | }
|
2068 | };
|
2069 | }
|
2070 |
|
2071 |
|
2072 |
|
2073 | var seenObjects = new _Set();
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 | function traverse (val) {
|
2081 | _traverse(val, seenObjects);
|
2082 | seenObjects.clear();
|
2083 | }
|
2084 |
|
2085 | function _traverse (val, seen) {
|
2086 | var i, keys;
|
2087 | var isA = Array.isArray(val);
|
2088 | if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
2089 | return
|
2090 | }
|
2091 | if (val.__ob__) {
|
2092 | var depId = val.__ob__.dep.id;
|
2093 | if (seen.has(depId)) {
|
2094 | return
|
2095 | }
|
2096 | seen.add(depId);
|
2097 | }
|
2098 | if (isA) {
|
2099 | i = val.length;
|
2100 | while (i--) { _traverse(val[i], seen); }
|
2101 | } else {
|
2102 | keys = Object.keys(val);
|
2103 | i = keys.length;
|
2104 | while (i--) { _traverse(val[keys[i]], seen); }
|
2105 | }
|
2106 | }
|
2107 |
|
2108 | var mark;
|
2109 | var measure;
|
2110 |
|
2111 | {
|
2112 | var perf = inBrowser && window.performance;
|
2113 |
|
2114 | if (
|
2115 | perf &&
|
2116 | perf.mark &&
|
2117 | perf.measure &&
|
2118 | perf.clearMarks &&
|
2119 | perf.clearMeasures
|
2120 | ) {
|
2121 | mark = function (tag) { return perf.mark(tag); };
|
2122 | measure = function (name, startTag, endTag) {
|
2123 | perf.measure(name, startTag, endTag);
|
2124 | perf.clearMarks(startTag);
|
2125 | perf.clearMarks(endTag);
|
2126 |
|
2127 | };
|
2128 | }
|
2129 | }
|
2130 |
|
2131 |
|
2132 |
|
2133 | var normalizeEvent = cached(function (name) {
|
2134 | var passive = name.charAt(0) === '&';
|
2135 | name = passive ? name.slice(1) : name;
|
2136 | var once$$1 = name.charAt(0) === '~';
|
2137 | name = once$$1 ? name.slice(1) : name;
|
2138 | var capture = name.charAt(0) === '!';
|
2139 | name = capture ? name.slice(1) : name;
|
2140 | return {
|
2141 | name: name,
|
2142 | once: once$$1,
|
2143 | capture: capture,
|
2144 | passive: passive
|
2145 | }
|
2146 | });
|
2147 |
|
2148 | function createFnInvoker (fns, vm) {
|
2149 | function invoker () {
|
2150 | var arguments$1 = arguments;
|
2151 |
|
2152 | var fns = invoker.fns;
|
2153 | if (Array.isArray(fns)) {
|
2154 | var cloned = fns.slice();
|
2155 | for (var i = 0; i < cloned.length; i++) {
|
2156 | invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
2157 | }
|
2158 | } else {
|
2159 |
|
2160 | return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
2161 | }
|
2162 | }
|
2163 | invoker.fns = fns;
|
2164 | return invoker
|
2165 | }
|
2166 |
|
2167 | function updateListeners (
|
2168 | on,
|
2169 | oldOn,
|
2170 | add,
|
2171 | remove$$1,
|
2172 | createOnceHandler,
|
2173 | vm
|
2174 | ) {
|
2175 | var name, def$$1, cur, old, event;
|
2176 | for (name in on) {
|
2177 | def$$1 = cur = on[name];
|
2178 | old = oldOn[name];
|
2179 | event = normalizeEvent(name);
|
2180 | if (isUndef(cur)) {
|
2181 | warn(
|
2182 | "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
2183 | vm
|
2184 | );
|
2185 | } else if (isUndef(old)) {
|
2186 | if (isUndef(cur.fns)) {
|
2187 | cur = on[name] = createFnInvoker(cur, vm);
|
2188 | }
|
2189 | if (isTrue(event.once)) {
|
2190 | cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
2191 | }
|
2192 | add(event.name, cur, event.capture, event.passive, event.params);
|
2193 | } else if (cur !== old) {
|
2194 | old.fns = cur;
|
2195 | on[name] = old;
|
2196 | }
|
2197 | }
|
2198 | for (name in oldOn) {
|
2199 | if (isUndef(on[name])) {
|
2200 | event = normalizeEvent(name);
|
2201 | remove$$1(event.name, oldOn[name], event.capture);
|
2202 | }
|
2203 | }
|
2204 | }
|
2205 |
|
2206 |
|
2207 |
|
2208 | function mergeVNodeHook (def, hookKey, hook) {
|
2209 | if (def instanceof VNode) {
|
2210 | def = def.data.hook || (def.data.hook = {});
|
2211 | }
|
2212 | var invoker;
|
2213 | var oldHook = def[hookKey];
|
2214 |
|
2215 | function wrappedHook () {
|
2216 | hook.apply(this, arguments);
|
2217 |
|
2218 |
|
2219 | remove(invoker.fns, wrappedHook);
|
2220 | }
|
2221 |
|
2222 | if (isUndef(oldHook)) {
|
2223 |
|
2224 | invoker = createFnInvoker([wrappedHook]);
|
2225 | } else {
|
2226 |
|
2227 | if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
2228 |
|
2229 | invoker = oldHook;
|
2230 | invoker.fns.push(wrappedHook);
|
2231 | } else {
|
2232 |
|
2233 | invoker = createFnInvoker([oldHook, wrappedHook]);
|
2234 | }
|
2235 | }
|
2236 |
|
2237 | invoker.merged = true;
|
2238 | def[hookKey] = invoker;
|
2239 | }
|
2240 |
|
2241 |
|
2242 |
|
2243 | function extractPropsFromVNodeData (
|
2244 | data,
|
2245 | Ctor,
|
2246 | tag
|
2247 | ) {
|
2248 |
|
2249 |
|
2250 |
|
2251 | var propOptions = Ctor.options.props;
|
2252 | if (isUndef(propOptions)) {
|
2253 | return
|
2254 | }
|
2255 | var res = {};
|
2256 | var attrs = data.attrs;
|
2257 | var props = data.props;
|
2258 | if (isDef(attrs) || isDef(props)) {
|
2259 | for (var key in propOptions) {
|
2260 | var altKey = hyphenate(key);
|
2261 | {
|
2262 | var keyInLowerCase = key.toLowerCase();
|
2263 | if (
|
2264 | key !== keyInLowerCase &&
|
2265 | attrs && hasOwn(attrs, keyInLowerCase)
|
2266 | ) {
|
2267 | tip(
|
2268 | "Prop \"" + keyInLowerCase + "\" is passed to component " +
|
2269 | (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
2270 | " \"" + key + "\". " +
|
2271 | "Note that HTML attributes are case-insensitive and camelCased " +
|
2272 | "props need to use their kebab-case equivalents when using in-DOM " +
|
2273 | "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
2274 | );
|
2275 | }
|
2276 | }
|
2277 | checkProp(res, props, key, altKey, true) ||
|
2278 | checkProp(res, attrs, key, altKey, false);
|
2279 | }
|
2280 | }
|
2281 | return res
|
2282 | }
|
2283 |
|
2284 | function checkProp (
|
2285 | res,
|
2286 | hash,
|
2287 | key,
|
2288 | altKey,
|
2289 | preserve
|
2290 | ) {
|
2291 | if (isDef(hash)) {
|
2292 | if (hasOwn(hash, key)) {
|
2293 | res[key] = hash[key];
|
2294 | if (!preserve) {
|
2295 | delete hash[key];
|
2296 | }
|
2297 | return true
|
2298 | } else if (hasOwn(hash, altKey)) {
|
2299 | res[key] = hash[altKey];
|
2300 | if (!preserve) {
|
2301 | delete hash[altKey];
|
2302 | }
|
2303 | return true
|
2304 | }
|
2305 | }
|
2306 | return false
|
2307 | }
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 | function simpleNormalizeChildren (children) {
|
2324 | for (var i = 0; i < children.length; i++) {
|
2325 | if (Array.isArray(children[i])) {
|
2326 | return Array.prototype.concat.apply([], children)
|
2327 | }
|
2328 | }
|
2329 | return children
|
2330 | }
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 | function normalizeChildren (children) {
|
2337 | return isPrimitive(children)
|
2338 | ? [createTextVNode(children)]
|
2339 | : Array.isArray(children)
|
2340 | ? normalizeArrayChildren(children)
|
2341 | : undefined
|
2342 | }
|
2343 |
|
2344 | function isTextNode (node) {
|
2345 | return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
2346 | }
|
2347 |
|
2348 | function normalizeArrayChildren (children, nestedIndex) {
|
2349 | var res = [];
|
2350 | var i, c, lastIndex, last;
|
2351 | for (i = 0; i < children.length; i++) {
|
2352 | c = children[i];
|
2353 | if (isUndef(c) || typeof c === 'boolean') { continue }
|
2354 | lastIndex = res.length - 1;
|
2355 | last = res[lastIndex];
|
2356 |
|
2357 | if (Array.isArray(c)) {
|
2358 | if (c.length > 0) {
|
2359 | c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
2360 |
|
2361 | if (isTextNode(c[0]) && isTextNode(last)) {
|
2362 | res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
2363 | c.shift();
|
2364 | }
|
2365 | res.push.apply(res, c);
|
2366 | }
|
2367 | } else if (isPrimitive(c)) {
|
2368 | if (isTextNode(last)) {
|
2369 |
|
2370 |
|
2371 |
|
2372 | res[lastIndex] = createTextVNode(last.text + c);
|
2373 | } else if (c !== '') {
|
2374 |
|
2375 | res.push(createTextVNode(c));
|
2376 | }
|
2377 | } else {
|
2378 | if (isTextNode(c) && isTextNode(last)) {
|
2379 |
|
2380 | res[lastIndex] = createTextVNode(last.text + c.text);
|
2381 | } else {
|
2382 |
|
2383 | if (isTrue(children._isVList) &&
|
2384 | isDef(c.tag) &&
|
2385 | isUndef(c.key) &&
|
2386 | isDef(nestedIndex)) {
|
2387 | c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2388 | }
|
2389 | res.push(c);
|
2390 | }
|
2391 | }
|
2392 | }
|
2393 | return res
|
2394 | }
|
2395 |
|
2396 |
|
2397 |
|
2398 | function ensureCtor (comp, base) {
|
2399 | if (
|
2400 | comp.__esModule ||
|
2401 | (hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
2402 | ) {
|
2403 | comp = comp.default;
|
2404 | }
|
2405 | return isObject(comp)
|
2406 | ? base.extend(comp)
|
2407 | : comp
|
2408 | }
|
2409 |
|
2410 | function createAsyncPlaceholder (
|
2411 | factory,
|
2412 | data,
|
2413 | context,
|
2414 | children,
|
2415 | tag
|
2416 | ) {
|
2417 | var node = createEmptyVNode();
|
2418 | node.asyncFactory = factory;
|
2419 | node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
2420 | return node
|
2421 | }
|
2422 |
|
2423 | function resolveAsyncComponent (
|
2424 | factory,
|
2425 | baseCtor,
|
2426 | context
|
2427 | ) {
|
2428 | if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
2429 | return factory.errorComp
|
2430 | }
|
2431 |
|
2432 | if (isDef(factory.resolved)) {
|
2433 | return factory.resolved
|
2434 | }
|
2435 |
|
2436 | if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
2437 | return factory.loadingComp
|
2438 | }
|
2439 |
|
2440 | if (isDef(factory.contexts)) {
|
2441 |
|
2442 | factory.contexts.push(context);
|
2443 | } else {
|
2444 | var contexts = factory.contexts = [context];
|
2445 | var sync = true;
|
2446 |
|
2447 | var forceRender = function (renderCompleted) {
|
2448 | for (var i = 0, l = contexts.length; i < l; i++) {
|
2449 | contexts[i].$forceUpdate();
|
2450 | }
|
2451 |
|
2452 | if (renderCompleted) {
|
2453 | contexts.length = 0;
|
2454 | }
|
2455 | };
|
2456 |
|
2457 | var resolve = once(function (res) {
|
2458 |
|
2459 | factory.resolved = ensureCtor(res, baseCtor);
|
2460 |
|
2461 |
|
2462 | if (!sync) {
|
2463 | forceRender(true);
|
2464 | } else {
|
2465 | contexts.length = 0;
|
2466 | }
|
2467 | });
|
2468 |
|
2469 | var reject = once(function (reason) {
|
2470 | warn(
|
2471 | "Failed to resolve async component: " + (String(factory)) +
|
2472 | (reason ? ("\nReason: " + reason) : '')
|
2473 | );
|
2474 | if (isDef(factory.errorComp)) {
|
2475 | factory.error = true;
|
2476 | forceRender(true);
|
2477 | }
|
2478 | });
|
2479 |
|
2480 | var res = factory(resolve, reject);
|
2481 |
|
2482 | if (isObject(res)) {
|
2483 | if (isPromise(res)) {
|
2484 |
|
2485 | if (isUndef(factory.resolved)) {
|
2486 | res.then(resolve, reject);
|
2487 | }
|
2488 | } else if (isPromise(res.component)) {
|
2489 | res.component.then(resolve, reject);
|
2490 |
|
2491 | if (isDef(res.error)) {
|
2492 | factory.errorComp = ensureCtor(res.error, baseCtor);
|
2493 | }
|
2494 |
|
2495 | if (isDef(res.loading)) {
|
2496 | factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
2497 | if (res.delay === 0) {
|
2498 | factory.loading = true;
|
2499 | } else {
|
2500 | setTimeout(function () {
|
2501 | if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
2502 | factory.loading = true;
|
2503 | forceRender(false);
|
2504 | }
|
2505 | }, res.delay || 200);
|
2506 | }
|
2507 | }
|
2508 |
|
2509 | if (isDef(res.timeout)) {
|
2510 | setTimeout(function () {
|
2511 | if (isUndef(factory.resolved)) {
|
2512 | reject(
|
2513 | "timeout (" + (res.timeout) + "ms)"
|
2514 | );
|
2515 | }
|
2516 | }, res.timeout);
|
2517 | }
|
2518 | }
|
2519 | }
|
2520 |
|
2521 | sync = false;
|
2522 |
|
2523 | return factory.loading
|
2524 | ? factory.loadingComp
|
2525 | : factory.resolved
|
2526 | }
|
2527 | }
|
2528 |
|
2529 |
|
2530 |
|
2531 | function isAsyncPlaceholder (node) {
|
2532 | return node.isComment && node.asyncFactory
|
2533 | }
|
2534 |
|
2535 |
|
2536 |
|
2537 | function getFirstComponentChild (children) {
|
2538 | if (Array.isArray(children)) {
|
2539 | for (var i = 0; i < children.length; i++) {
|
2540 | var c = children[i];
|
2541 | if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
2542 | return c
|
2543 | }
|
2544 | }
|
2545 | }
|
2546 | }
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 | function initEvents (vm) {
|
2553 | vm._events = Object.create(null);
|
2554 | vm._hasHookEvent = false;
|
2555 |
|
2556 | var listeners = vm.$options._parentListeners;
|
2557 | if (listeners) {
|
2558 | updateComponentListeners(vm, listeners);
|
2559 | }
|
2560 | }
|
2561 |
|
2562 | var target;
|
2563 |
|
2564 | function add (event, fn) {
|
2565 | target.$on(event, fn);
|
2566 | }
|
2567 |
|
2568 | function remove$1 (event, fn) {
|
2569 | target.$off(event, fn);
|
2570 | }
|
2571 |
|
2572 | function createOnceHandler (event, fn) {
|
2573 | var _target = target;
|
2574 | return function onceHandler () {
|
2575 | var res = fn.apply(null, arguments);
|
2576 | if (res !== null) {
|
2577 | _target.$off(event, onceHandler);
|
2578 | }
|
2579 | }
|
2580 | }
|
2581 |
|
2582 | function updateComponentListeners (
|
2583 | vm,
|
2584 | listeners,
|
2585 | oldListeners
|
2586 | ) {
|
2587 | target = vm;
|
2588 | updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
2589 | target = undefined;
|
2590 | }
|
2591 |
|
2592 | function eventsMixin (Vue) {
|
2593 | var hookRE = /^hook:/;
|
2594 | Vue.prototype.$on = function (event, fn) {
|
2595 | var vm = this;
|
2596 | if (Array.isArray(event)) {
|
2597 | for (var i = 0, l = event.length; i < l; i++) {
|
2598 | vm.$on(event[i], fn);
|
2599 | }
|
2600 | } else {
|
2601 | (vm._events[event] || (vm._events[event] = [])).push(fn);
|
2602 |
|
2603 |
|
2604 | if (hookRE.test(event)) {
|
2605 | vm._hasHookEvent = true;
|
2606 | }
|
2607 | }
|
2608 | return vm
|
2609 | };
|
2610 |
|
2611 | Vue.prototype.$once = function (event, fn) {
|
2612 | var vm = this;
|
2613 | function on () {
|
2614 | vm.$off(event, on);
|
2615 | fn.apply(vm, arguments);
|
2616 | }
|
2617 | on.fn = fn;
|
2618 | vm.$on(event, on);
|
2619 | return vm
|
2620 | };
|
2621 |
|
2622 | Vue.prototype.$off = function (event, fn) {
|
2623 | var vm = this;
|
2624 |
|
2625 | if (!arguments.length) {
|
2626 | vm._events = Object.create(null);
|
2627 | return vm
|
2628 | }
|
2629 |
|
2630 | if (Array.isArray(event)) {
|
2631 | for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
2632 | vm.$off(event[i$1], fn);
|
2633 | }
|
2634 | return vm
|
2635 | }
|
2636 |
|
2637 | var cbs = vm._events[event];
|
2638 | if (!cbs) {
|
2639 | return vm
|
2640 | }
|
2641 | if (!fn) {
|
2642 | vm._events[event] = null;
|
2643 | return vm
|
2644 | }
|
2645 |
|
2646 | var cb;
|
2647 | var i = cbs.length;
|
2648 | while (i--) {
|
2649 | cb = cbs[i];
|
2650 | if (cb === fn || cb.fn === fn) {
|
2651 | cbs.splice(i, 1);
|
2652 | break
|
2653 | }
|
2654 | }
|
2655 | return vm
|
2656 | };
|
2657 |
|
2658 | Vue.prototype.$emit = function (event) {
|
2659 | var vm = this;
|
2660 | {
|
2661 | var lowerCaseEvent = event.toLowerCase();
|
2662 | if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
2663 | tip(
|
2664 | "Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
2665 | (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
2666 | "Note that HTML attributes are case-insensitive and you cannot use " +
|
2667 | "v-on to listen to camelCase events when using in-DOM templates. " +
|
2668 | "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
2669 | );
|
2670 | }
|
2671 | }
|
2672 | var cbs = vm._events[event];
|
2673 | if (cbs) {
|
2674 | cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
2675 | var args = toArray(arguments, 1);
|
2676 | var info = "event handler for \"" + event + "\"";
|
2677 | for (var i = 0, l = cbs.length; i < l; i++) {
|
2678 | invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
2679 | }
|
2680 | }
|
2681 | return vm
|
2682 | };
|
2683 | }
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 | function resolveSlots (
|
2693 | children,
|
2694 | context
|
2695 | ) {
|
2696 | if (!children || !children.length) {
|
2697 | return {}
|
2698 | }
|
2699 | var slots = {};
|
2700 | for (var i = 0, l = children.length; i < l; i++) {
|
2701 | var child = children[i];
|
2702 | var data = child.data;
|
2703 |
|
2704 | if (data && data.attrs && data.attrs.slot) {
|
2705 | delete data.attrs.slot;
|
2706 | }
|
2707 |
|
2708 |
|
2709 | if ((child.context === context || child.fnContext === context) &&
|
2710 | data && data.slot != null
|
2711 | ) {
|
2712 | var name = data.slot;
|
2713 | var slot = (slots[name] || (slots[name] = []));
|
2714 | if (child.tag === 'template') {
|
2715 | slot.push.apply(slot, child.children || []);
|
2716 | } else {
|
2717 | slot.push(child);
|
2718 | }
|
2719 | } else {
|
2720 | (slots.default || (slots.default = [])).push(child);
|
2721 | }
|
2722 | }
|
2723 |
|
2724 | for (var name$1 in slots) {
|
2725 | if (slots[name$1].every(isWhitespace)) {
|
2726 | delete slots[name$1];
|
2727 | }
|
2728 | }
|
2729 | return slots
|
2730 | }
|
2731 |
|
2732 | function isWhitespace (node) {
|
2733 | return (node.isComment && !node.asyncFactory) || node.text === ' '
|
2734 | }
|
2735 |
|
2736 | function resolveScopedSlots (
|
2737 | fns, // see flow/vnode
|
2738 | hasDynamicKeys,
|
2739 | res
|
2740 | ) {
|
2741 | res = res || { $stable: !hasDynamicKeys };
|
2742 | for (var i = 0; i < fns.length; i++) {
|
2743 | var slot = fns[i];
|
2744 | if (Array.isArray(slot)) {
|
2745 | resolveScopedSlots(slot, hasDynamicKeys, res);
|
2746 | } else if (slot) {
|
2747 | res[slot.key] = slot.fn;
|
2748 | }
|
2749 | }
|
2750 | return res
|
2751 | }
|
2752 |
|
2753 |
|
2754 |
|
2755 | var activeInstance = null;
|
2756 | var isUpdatingChildComponent = false;
|
2757 |
|
2758 | function setActiveInstance(vm) {
|
2759 | var prevActiveInstance = activeInstance;
|
2760 | activeInstance = vm;
|
2761 | return function () {
|
2762 | activeInstance = prevActiveInstance;
|
2763 | }
|
2764 | }
|
2765 |
|
2766 | function initLifecycle (vm) {
|
2767 | var options = vm.$options;
|
2768 |
|
2769 |
|
2770 | var parent = options.parent;
|
2771 | if (parent && !options.abstract) {
|
2772 | while (parent.$options.abstract && parent.$parent) {
|
2773 | parent = parent.$parent;
|
2774 | }
|
2775 | parent.$children.push(vm);
|
2776 | }
|
2777 |
|
2778 | vm.$parent = parent;
|
2779 | vm.$root = parent ? parent.$root : vm;
|
2780 |
|
2781 | vm.$children = [];
|
2782 | vm.$refs = {};
|
2783 |
|
2784 | vm._watcher = null;
|
2785 | vm._inactive = null;
|
2786 | vm._directInactive = false;
|
2787 | vm._isMounted = false;
|
2788 | vm._isDestroyed = false;
|
2789 | vm._isBeingDestroyed = false;
|
2790 | }
|
2791 |
|
2792 | function lifecycleMixin (Vue) {
|
2793 | Vue.prototype._update = function (vnode, hydrating) {
|
2794 | var vm = this;
|
2795 | var prevEl = vm.$el;
|
2796 | var prevVnode = vm._vnode;
|
2797 | var restoreActiveInstance = setActiveInstance(vm);
|
2798 | vm._vnode = vnode;
|
2799 |
|
2800 |
|
2801 | if (!prevVnode) {
|
2802 |
|
2803 | vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false );
|
2804 | } else {
|
2805 |
|
2806 | vm.$el = vm.__patch__(prevVnode, vnode);
|
2807 | }
|
2808 | restoreActiveInstance();
|
2809 |
|
2810 | if (prevEl) {
|
2811 | prevEl.__vue__ = null;
|
2812 | }
|
2813 | if (vm.$el) {
|
2814 | vm.$el.__vue__ = vm;
|
2815 | }
|
2816 |
|
2817 | if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
2818 | vm.$parent.$el = vm.$el;
|
2819 | }
|
2820 |
|
2821 |
|
2822 | };
|
2823 |
|
2824 | Vue.prototype.$forceUpdate = function () {
|
2825 | var vm = this;
|
2826 | if (vm._watcher) {
|
2827 | vm._watcher.update();
|
2828 | }
|
2829 | };
|
2830 |
|
2831 | Vue.prototype.$destroy = function () {
|
2832 | var vm = this;
|
2833 | if (vm._isBeingDestroyed) {
|
2834 | return
|
2835 | }
|
2836 | callHook(vm, 'beforeDestroy');
|
2837 | vm._isBeingDestroyed = true;
|
2838 |
|
2839 | var parent = vm.$parent;
|
2840 | if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
2841 | remove(parent.$children, vm);
|
2842 | }
|
2843 |
|
2844 | if (vm._watcher) {
|
2845 | vm._watcher.teardown();
|
2846 | }
|
2847 | var i = vm._watchers.length;
|
2848 | while (i--) {
|
2849 | vm._watchers[i].teardown();
|
2850 | }
|
2851 |
|
2852 |
|
2853 | if (vm._data.__ob__) {
|
2854 | vm._data.__ob__.vmCount--;
|
2855 | }
|
2856 |
|
2857 | vm._isDestroyed = true;
|
2858 |
|
2859 | vm.__patch__(vm._vnode, null);
|
2860 |
|
2861 | callHook(vm, 'destroyed');
|
2862 |
|
2863 | vm.$off();
|
2864 |
|
2865 | if (vm.$el) {
|
2866 | vm.$el.__vue__ = null;
|
2867 | }
|
2868 |
|
2869 | if (vm.$vnode) {
|
2870 | vm.$vnode.parent = null;
|
2871 | }
|
2872 | };
|
2873 | }
|
2874 |
|
2875 | function mountComponent (
|
2876 | vm,
|
2877 | el,
|
2878 | hydrating
|
2879 | ) {
|
2880 | vm.$el = el;
|
2881 | if (!vm.$options.render) {
|
2882 | vm.$options.render = createEmptyVNode;
|
2883 | {
|
2884 |
|
2885 | if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
2886 | vm.$options.el || el) {
|
2887 | warn(
|
2888 | 'You are using the runtime-only build of Vue where the template ' +
|
2889 | 'compiler is not available. Either pre-compile the templates into ' +
|
2890 | 'render functions, or use the compiler-included build.',
|
2891 | vm
|
2892 | );
|
2893 | } else {
|
2894 | warn(
|
2895 | 'Failed to mount component: template or render function not defined.',
|
2896 | vm
|
2897 | );
|
2898 | }
|
2899 | }
|
2900 | }
|
2901 | callHook(vm, 'beforeMount');
|
2902 |
|
2903 | var updateComponent;
|
2904 |
|
2905 | if (config.performance && mark) {
|
2906 | updateComponent = function () {
|
2907 | var name = vm._name;
|
2908 | var id = vm._uid;
|
2909 | var startTag = "vue-perf-start:" + id;
|
2910 | var endTag = "vue-perf-end:" + id;
|
2911 |
|
2912 | mark(startTag);
|
2913 | var vnode = vm._render();
|
2914 | mark(endTag);
|
2915 | measure(("vue " + name + " render"), startTag, endTag);
|
2916 |
|
2917 | mark(startTag);
|
2918 | vm._update(vnode, hydrating);
|
2919 | mark(endTag);
|
2920 | measure(("vue " + name + " patch"), startTag, endTag);
|
2921 | };
|
2922 | } else {
|
2923 | updateComponent = function () {
|
2924 | vm._update(vm._render(), hydrating);
|
2925 | };
|
2926 | }
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 | new Watcher(vm, updateComponent, noop, {
|
2932 | before: function before () {
|
2933 | if (vm._isMounted && !vm._isDestroyed) {
|
2934 | callHook(vm, 'beforeUpdate');
|
2935 | }
|
2936 | }
|
2937 | }, true );
|
2938 | hydrating = false;
|
2939 |
|
2940 |
|
2941 |
|
2942 | if (vm.$vnode == null) {
|
2943 | vm._isMounted = true;
|
2944 | callHook(vm, 'mounted');
|
2945 | }
|
2946 | return vm
|
2947 | }
|
2948 |
|
2949 | function updateChildComponent (
|
2950 | vm,
|
2951 | propsData,
|
2952 | listeners,
|
2953 | parentVnode,
|
2954 | renderChildren
|
2955 | ) {
|
2956 | {
|
2957 | isUpdatingChildComponent = true;
|
2958 | }
|
2959 |
|
2960 |
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 | var hasDynamicScopedSlot = !!(
|
2967 | (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
2968 | (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
2969 | );
|
2970 |
|
2971 |
|
2972 |
|
2973 | var needsForceUpdate = !!(
|
2974 | renderChildren ||
|
2975 | vm.$options._renderChildren ||
|
2976 | hasDynamicScopedSlot
|
2977 | );
|
2978 |
|
2979 | vm.$options._parentVnode = parentVnode;
|
2980 | vm.$vnode = parentVnode;
|
2981 |
|
2982 | if (vm._vnode) {
|
2983 | vm._vnode.parent = parentVnode;
|
2984 | }
|
2985 | vm.$options._renderChildren = renderChildren;
|
2986 |
|
2987 |
|
2988 |
|
2989 |
|
2990 | vm.$attrs = parentVnode.data.attrs || emptyObject;
|
2991 | vm.$listeners = listeners || emptyObject;
|
2992 |
|
2993 |
|
2994 | if (propsData && vm.$options.props) {
|
2995 | toggleObserving(false);
|
2996 | var props = vm._props;
|
2997 | var propKeys = vm.$options._propKeys || [];
|
2998 | for (var i = 0; i < propKeys.length; i++) {
|
2999 | var key = propKeys[i];
|
3000 | var propOptions = vm.$options.props;
|
3001 | props[key] = validateProp(key, propOptions, propsData, vm);
|
3002 | }
|
3003 | toggleObserving(true);
|
3004 |
|
3005 | vm.$options.propsData = propsData;
|
3006 | }
|
3007 |
|
3008 |
|
3009 | listeners = listeners || emptyObject;
|
3010 | var oldListeners = vm.$options._parentListeners;
|
3011 | vm.$options._parentListeners = listeners;
|
3012 | updateComponentListeners(vm, listeners, oldListeners);
|
3013 |
|
3014 |
|
3015 | if (needsForceUpdate) {
|
3016 | vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
3017 | vm.$forceUpdate();
|
3018 | }
|
3019 |
|
3020 | {
|
3021 | isUpdatingChildComponent = false;
|
3022 | }
|
3023 | }
|
3024 |
|
3025 | function isInInactiveTree (vm) {
|
3026 | while (vm && (vm = vm.$parent)) {
|
3027 | if (vm._inactive) { return true }
|
3028 | }
|
3029 | return false
|
3030 | }
|
3031 |
|
3032 | function activateChildComponent (vm, direct) {
|
3033 | if (direct) {
|
3034 | vm._directInactive = false;
|
3035 | if (isInInactiveTree(vm)) {
|
3036 | return
|
3037 | }
|
3038 | } else if (vm._directInactive) {
|
3039 | return
|
3040 | }
|
3041 | if (vm._inactive || vm._inactive === null) {
|
3042 | vm._inactive = false;
|
3043 | for (var i = 0; i < vm.$children.length; i++) {
|
3044 | activateChildComponent(vm.$children[i]);
|
3045 | }
|
3046 | callHook(vm, 'activated');
|
3047 | }
|
3048 | }
|
3049 |
|
3050 | function deactivateChildComponent (vm, direct) {
|
3051 | if (direct) {
|
3052 | vm._directInactive = true;
|
3053 | if (isInInactiveTree(vm)) {
|
3054 | return
|
3055 | }
|
3056 | }
|
3057 | if (!vm._inactive) {
|
3058 | vm._inactive = true;
|
3059 | for (var i = 0; i < vm.$children.length; i++) {
|
3060 | deactivateChildComponent(vm.$children[i]);
|
3061 | }
|
3062 | callHook(vm, 'deactivated');
|
3063 | }
|
3064 | }
|
3065 |
|
3066 | function callHook (vm, hook) {
|
3067 |
|
3068 | pushTarget();
|
3069 | var handlers = vm.$options[hook];
|
3070 | var info = hook + " hook";
|
3071 | if (handlers) {
|
3072 | for (var i = 0, j = handlers.length; i < j; i++) {
|
3073 | invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
3074 | }
|
3075 | }
|
3076 | if (vm._hasHookEvent) {
|
3077 | vm.$emit('hook:' + hook);
|
3078 | }
|
3079 | popTarget();
|
3080 | }
|
3081 |
|
3082 |
|
3083 |
|
3084 | var MAX_UPDATE_COUNT = 100;
|
3085 |
|
3086 | var queue = [];
|
3087 | var activatedChildren = [];
|
3088 | var has = {};
|
3089 | var circular = {};
|
3090 | var waiting = false;
|
3091 | var flushing = false;
|
3092 | var index = 0;
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 | function resetSchedulerState () {
|
3098 | index = queue.length = activatedChildren.length = 0;
|
3099 | has = {};
|
3100 | {
|
3101 | circular = {};
|
3102 | }
|
3103 | waiting = flushing = false;
|
3104 | }
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 | var currentFlushTimestamp = 0;
|
3112 |
|
3113 |
|
3114 | var getNow = Date.now;
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 | if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
3121 |
|
3122 |
|
3123 |
|
3124 | getNow = function () { return performance.now(); };
|
3125 | }
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 | function flushSchedulerQueue () {
|
3131 | currentFlushTimestamp = getNow();
|
3132 | flushing = true;
|
3133 | var watcher, id;
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 | queue.sort(function (a, b) { return a.id - b.id; });
|
3144 |
|
3145 |
|
3146 |
|
3147 | for (index = 0; index < queue.length; index++) {
|
3148 | watcher = queue[index];
|
3149 | if (watcher.before) {
|
3150 | watcher.before();
|
3151 | }
|
3152 | id = watcher.id;
|
3153 | has[id] = null;
|
3154 | watcher.run();
|
3155 |
|
3156 | if (has[id] != null) {
|
3157 | circular[id] = (circular[id] || 0) + 1;
|
3158 | if (circular[id] > MAX_UPDATE_COUNT) {
|
3159 | warn(
|
3160 | 'You may have an infinite update loop ' + (
|
3161 | watcher.user
|
3162 | ? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
3163 | : "in a component render function."
|
3164 | ),
|
3165 | watcher.vm
|
3166 | );
|
3167 | break
|
3168 | }
|
3169 | }
|
3170 | }
|
3171 |
|
3172 |
|
3173 | var activatedQueue = activatedChildren.slice();
|
3174 | var updatedQueue = queue.slice();
|
3175 |
|
3176 | resetSchedulerState();
|
3177 |
|
3178 |
|
3179 | callActivatedHooks(activatedQueue);
|
3180 | callUpdatedHooks(updatedQueue);
|
3181 |
|
3182 |
|
3183 |
|
3184 | if (devtools && config.devtools) {
|
3185 | devtools.emit('flush');
|
3186 | }
|
3187 | }
|
3188 |
|
3189 | function callUpdatedHooks (queue) {
|
3190 | var i = queue.length;
|
3191 | while (i--) {
|
3192 | var watcher = queue[i];
|
3193 | var vm = watcher.vm;
|
3194 | if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
3195 | callHook(vm, 'updated');
|
3196 | }
|
3197 | }
|
3198 | }
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 | function queueActivatedComponent (vm) {
|
3205 |
|
3206 |
|
3207 | vm._inactive = false;
|
3208 | activatedChildren.push(vm);
|
3209 | }
|
3210 |
|
3211 | function callActivatedHooks (queue) {
|
3212 | for (var i = 0; i < queue.length; i++) {
|
3213 | queue[i]._inactive = true;
|
3214 | activateChildComponent(queue[i], true );
|
3215 | }
|
3216 | }
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 | function queueWatcher (watcher) {
|
3224 | var id = watcher.id;
|
3225 | if (has[id] == null) {
|
3226 | has[id] = true;
|
3227 | if (!flushing) {
|
3228 | queue.push(watcher);
|
3229 | } else {
|
3230 |
|
3231 |
|
3232 | var i = queue.length - 1;
|
3233 | while (i > index && queue[i].id > watcher.id) {
|
3234 | i--;
|
3235 | }
|
3236 | queue.splice(i + 1, 0, watcher);
|
3237 | }
|
3238 |
|
3239 | if (!waiting) {
|
3240 | waiting = true;
|
3241 |
|
3242 | if (!config.async) {
|
3243 | flushSchedulerQueue();
|
3244 | return
|
3245 | }
|
3246 | nextTick(flushSchedulerQueue);
|
3247 | }
|
3248 | }
|
3249 | }
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 |
|
3255 | var uid$1 = 0;
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 | var Watcher = function Watcher (
|
3263 | vm,
|
3264 | expOrFn,
|
3265 | cb,
|
3266 | options,
|
3267 | isRenderWatcher
|
3268 | ) {
|
3269 | this.vm = vm;
|
3270 | if (isRenderWatcher) {
|
3271 | vm._watcher = this;
|
3272 | }
|
3273 | vm._watchers.push(this);
|
3274 |
|
3275 | if (options) {
|
3276 | this.deep = !!options.deep;
|
3277 | this.user = !!options.user;
|
3278 | this.lazy = !!options.lazy;
|
3279 | this.sync = !!options.sync;
|
3280 | this.before = options.before;
|
3281 | } else {
|
3282 | this.deep = this.user = this.lazy = this.sync = false;
|
3283 | }
|
3284 | this.cb = cb;
|
3285 | this.id = ++uid$1;
|
3286 | this.active = true;
|
3287 | this.dirty = this.lazy;
|
3288 | this.deps = [];
|
3289 | this.newDeps = [];
|
3290 | this.depIds = new _Set();
|
3291 | this.newDepIds = new _Set();
|
3292 | this.expression = expOrFn.toString();
|
3293 |
|
3294 | if (typeof expOrFn === 'function') {
|
3295 | this.getter = expOrFn;
|
3296 | } else {
|
3297 | this.getter = parsePath(expOrFn);
|
3298 | if (!this.getter) {
|
3299 | this.getter = noop;
|
3300 | warn(
|
3301 | "Failed watching path: \"" + expOrFn + "\" " +
|
3302 | 'Watcher only accepts simple dot-delimited paths. ' +
|
3303 | 'For full control, use a function instead.',
|
3304 | vm
|
3305 | );
|
3306 | }
|
3307 | }
|
3308 | this.value = this.lazy
|
3309 | ? undefined
|
3310 | : this.get();
|
3311 | };
|
3312 |
|
3313 |
|
3314 |
|
3315 |
|
3316 | Watcher.prototype.get = function get () {
|
3317 | pushTarget(this);
|
3318 | var value;
|
3319 | var vm = this.vm;
|
3320 | try {
|
3321 | value = this.getter.call(vm, vm);
|
3322 | } catch (e) {
|
3323 | if (this.user) {
|
3324 | handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
3325 | } else {
|
3326 | throw e
|
3327 | }
|
3328 | } finally {
|
3329 |
|
3330 |
|
3331 | if (this.deep) {
|
3332 | traverse(value);
|
3333 | }
|
3334 | popTarget();
|
3335 | this.cleanupDeps();
|
3336 | }
|
3337 | return value
|
3338 | };
|
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 | Watcher.prototype.addDep = function addDep (dep) {
|
3344 | var id = dep.id;
|
3345 | if (!this.newDepIds.has(id)) {
|
3346 | this.newDepIds.add(id);
|
3347 | this.newDeps.push(dep);
|
3348 | if (!this.depIds.has(id)) {
|
3349 | dep.addSub(this);
|
3350 | }
|
3351 | }
|
3352 | };
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 | Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
3358 | var i = this.deps.length;
|
3359 | while (i--) {
|
3360 | var dep = this.deps[i];
|
3361 | if (!this.newDepIds.has(dep.id)) {
|
3362 | dep.removeSub(this);
|
3363 | }
|
3364 | }
|
3365 | var tmp = this.depIds;
|
3366 | this.depIds = this.newDepIds;
|
3367 | this.newDepIds = tmp;
|
3368 | this.newDepIds.clear();
|
3369 | tmp = this.deps;
|
3370 | this.deps = this.newDeps;
|
3371 | this.newDeps = tmp;
|
3372 | this.newDeps.length = 0;
|
3373 | };
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 |
|
3379 | Watcher.prototype.update = function update () {
|
3380 |
|
3381 | if (this.lazy) {
|
3382 | this.dirty = true;
|
3383 | } else if (this.sync) {
|
3384 | this.run();
|
3385 | } else {
|
3386 | queueWatcher(this);
|
3387 | }
|
3388 | };
|
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 | Watcher.prototype.run = function run () {
|
3395 | if (this.active) {
|
3396 | var value = this.get();
|
3397 | if (
|
3398 | value !== this.value ||
|
3399 |
|
3400 |
|
3401 |
|
3402 | isObject(value) ||
|
3403 | this.deep
|
3404 | ) {
|
3405 |
|
3406 | var oldValue = this.value;
|
3407 | this.value = value;
|
3408 | if (this.user) {
|
3409 | try {
|
3410 | this.cb.call(this.vm, value, oldValue);
|
3411 | } catch (e) {
|
3412 | handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
3413 | }
|
3414 | } else {
|
3415 | this.cb.call(this.vm, value, oldValue);
|
3416 | }
|
3417 | }
|
3418 | }
|
3419 | };
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 | Watcher.prototype.evaluate = function evaluate () {
|
3426 | this.value = this.get();
|
3427 | this.dirty = false;
|
3428 | };
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 | Watcher.prototype.depend = function depend () {
|
3434 | var i = this.deps.length;
|
3435 | while (i--) {
|
3436 | this.deps[i].depend();
|
3437 | }
|
3438 | };
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 | Watcher.prototype.teardown = function teardown () {
|
3444 | if (this.active) {
|
3445 |
|
3446 |
|
3447 |
|
3448 | if (!this.vm._isBeingDestroyed) {
|
3449 | remove(this.vm._watchers, this);
|
3450 | }
|
3451 | var i = this.deps.length;
|
3452 | while (i--) {
|
3453 | this.deps[i].removeSub(this);
|
3454 | }
|
3455 | this.active = false;
|
3456 | }
|
3457 | };
|
3458 |
|
3459 |
|
3460 |
|
3461 | var sharedPropertyDefinition = {
|
3462 | enumerable: true,
|
3463 | configurable: true,
|
3464 | get: noop,
|
3465 | set: noop
|
3466 | };
|
3467 |
|
3468 | function proxy (target, sourceKey, key) {
|
3469 | sharedPropertyDefinition.get = function proxyGetter () {
|
3470 | return this[sourceKey][key]
|
3471 | };
|
3472 | sharedPropertyDefinition.set = function proxySetter (val) {
|
3473 | this[sourceKey][key] = val;
|
3474 | };
|
3475 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
3476 | }
|
3477 |
|
3478 | function initState (vm) {
|
3479 | vm._watchers = [];
|
3480 | var opts = vm.$options;
|
3481 | if (opts.props) { initProps(vm, opts.props); }
|
3482 | if (opts.methods) { initMethods(vm, opts.methods); }
|
3483 | if (opts.data) {
|
3484 | initData(vm);
|
3485 | } else {
|
3486 | observe(vm._data = {}, true );
|
3487 | }
|
3488 | if (opts.computed) { initComputed(vm, opts.computed); }
|
3489 | if (opts.watch && opts.watch !== nativeWatch) {
|
3490 | initWatch(vm, opts.watch);
|
3491 | }
|
3492 | }
|
3493 |
|
3494 | function initProps (vm, propsOptions) {
|
3495 | var propsData = vm.$options.propsData || {};
|
3496 | var props = vm._props = {};
|
3497 |
|
3498 |
|
3499 | var keys = vm.$options._propKeys = [];
|
3500 | var isRoot = !vm.$parent;
|
3501 |
|
3502 | if (!isRoot) {
|
3503 | toggleObserving(false);
|
3504 | }
|
3505 | var loop = function ( key ) {
|
3506 | keys.push(key);
|
3507 | var value = validateProp(key, propsOptions, propsData, vm);
|
3508 |
|
3509 | {
|
3510 | var hyphenatedKey = hyphenate(key);
|
3511 | if (isReservedAttribute(hyphenatedKey) ||
|
3512 | config.isReservedAttr(hyphenatedKey)) {
|
3513 | warn(
|
3514 | ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
3515 | vm
|
3516 | );
|
3517 | }
|
3518 | defineReactive$$1(props, key, value, function () {
|
3519 | if (!isRoot && !isUpdatingChildComponent) {
|
3520 | warn(
|
3521 | "Avoid mutating a prop directly since the value will be " +
|
3522 | "overwritten whenever the parent component re-renders. " +
|
3523 | "Instead, use a data or computed property based on the prop's " +
|
3524 | "value. Prop being mutated: \"" + key + "\"",
|
3525 | vm
|
3526 | );
|
3527 | }
|
3528 | });
|
3529 | }
|
3530 |
|
3531 |
|
3532 |
|
3533 | if (!(key in vm)) {
|
3534 | proxy(vm, "_props", key);
|
3535 | }
|
3536 | };
|
3537 |
|
3538 | for (var key in propsOptions) loop( key );
|
3539 | toggleObserving(true);
|
3540 | }
|
3541 |
|
3542 | function initData (vm) {
|
3543 | var data = vm.$options.data;
|
3544 | data = vm._data = typeof data === 'function'
|
3545 | ? getData(data, vm)
|
3546 | : data || {};
|
3547 | if (!isPlainObject(data)) {
|
3548 | data = {};
|
3549 | warn(
|
3550 | 'data functions should return an object:\n' +
|
3551 | 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
3552 | vm
|
3553 | );
|
3554 | }
|
3555 |
|
3556 | var keys = Object.keys(data);
|
3557 | var props = vm.$options.props;
|
3558 | var methods = vm.$options.methods;
|
3559 | var i = keys.length;
|
3560 | while (i--) {
|
3561 | var key = keys[i];
|
3562 | {
|
3563 | if (methods && hasOwn(methods, key)) {
|
3564 | warn(
|
3565 | ("Method \"" + key + "\" has already been defined as a data property."),
|
3566 | vm
|
3567 | );
|
3568 | }
|
3569 | }
|
3570 | if (props && hasOwn(props, key)) {
|
3571 | warn(
|
3572 | "The data property \"" + key + "\" is already declared as a prop. " +
|
3573 | "Use prop default value instead.",
|
3574 | vm
|
3575 | );
|
3576 | } else if (!isReserved(key)) {
|
3577 | proxy(vm, "_data", key);
|
3578 | }
|
3579 | }
|
3580 |
|
3581 | observe(data, true );
|
3582 | }
|
3583 |
|
3584 | function getData (data, vm) {
|
3585 |
|
3586 | pushTarget();
|
3587 | try {
|
3588 | return data.call(vm, vm)
|
3589 | } catch (e) {
|
3590 | handleError(e, vm, "data()");
|
3591 | return {}
|
3592 | } finally {
|
3593 | popTarget();
|
3594 | }
|
3595 | }
|
3596 |
|
3597 | var computedWatcherOptions = { lazy: true };
|
3598 |
|
3599 | function initComputed (vm, computed) {
|
3600 |
|
3601 | var watchers = vm._computedWatchers = Object.create(null);
|
3602 |
|
3603 | var isSSR = isServerRendering();
|
3604 |
|
3605 | for (var key in computed) {
|
3606 | var userDef = computed[key];
|
3607 | var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
3608 | if (getter == null) {
|
3609 | warn(
|
3610 | ("Getter is missing for computed property \"" + key + "\"."),
|
3611 | vm
|
3612 | );
|
3613 | }
|
3614 |
|
3615 | if (!isSSR) {
|
3616 |
|
3617 | watchers[key] = new Watcher(
|
3618 | vm,
|
3619 | getter || noop,
|
3620 | noop,
|
3621 | computedWatcherOptions
|
3622 | );
|
3623 | }
|
3624 |
|
3625 |
|
3626 |
|
3627 |
|
3628 | if (!(key in vm)) {
|
3629 | defineComputed(vm, key, userDef);
|
3630 | } else {
|
3631 | if (key in vm.$data) {
|
3632 | warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
3633 | } else if (vm.$options.props && key in vm.$options.props) {
|
3634 | warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
3635 | }
|
3636 | }
|
3637 | }
|
3638 | }
|
3639 |
|
3640 | function defineComputed (
|
3641 | target,
|
3642 | key,
|
3643 | userDef
|
3644 | ) {
|
3645 | var shouldCache = !isServerRendering();
|
3646 | if (typeof userDef === 'function') {
|
3647 | sharedPropertyDefinition.get = shouldCache
|
3648 | ? createComputedGetter(key)
|
3649 | : createGetterInvoker(userDef);
|
3650 | sharedPropertyDefinition.set = noop;
|
3651 | } else {
|
3652 | sharedPropertyDefinition.get = userDef.get
|
3653 | ? shouldCache && userDef.cache !== false
|
3654 | ? createComputedGetter(key)
|
3655 | : createGetterInvoker(userDef.get)
|
3656 | : noop;
|
3657 | sharedPropertyDefinition.set = userDef.set || noop;
|
3658 | }
|
3659 | if (sharedPropertyDefinition.set === noop) {
|
3660 | sharedPropertyDefinition.set = function () {
|
3661 | warn(
|
3662 | ("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
3663 | this
|
3664 | );
|
3665 | };
|
3666 | }
|
3667 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
3668 | }
|
3669 |
|
3670 | function createComputedGetter (key) {
|
3671 | return function computedGetter () {
|
3672 | var watcher = this._computedWatchers && this._computedWatchers[key];
|
3673 | if (watcher) {
|
3674 | if (watcher.dirty) {
|
3675 | watcher.evaluate();
|
3676 | }
|
3677 | if (Dep.target) {
|
3678 | watcher.depend();
|
3679 | }
|
3680 | return watcher.value
|
3681 | }
|
3682 | }
|
3683 | }
|
3684 |
|
3685 | function createGetterInvoker(fn) {
|
3686 | return function computedGetter () {
|
3687 | return fn.call(this, this)
|
3688 | }
|
3689 | }
|
3690 |
|
3691 | function initMethods (vm, methods) {
|
3692 | var props = vm.$options.props;
|
3693 | for (var key in methods) {
|
3694 | {
|
3695 | if (typeof methods[key] !== 'function') {
|
3696 | warn(
|
3697 | "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
3698 | "Did you reference the function correctly?",
|
3699 | vm
|
3700 | );
|
3701 | }
|
3702 | if (props && hasOwn(props, key)) {
|
3703 | warn(
|
3704 | ("Method \"" + key + "\" has already been defined as a prop."),
|
3705 | vm
|
3706 | );
|
3707 | }
|
3708 | if ((key in vm) && isReserved(key)) {
|
3709 | warn(
|
3710 | "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
3711 | "Avoid defining component methods that start with _ or $."
|
3712 | );
|
3713 | }
|
3714 | }
|
3715 | vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
3716 | }
|
3717 | }
|
3718 |
|
3719 | function initWatch (vm, watch) {
|
3720 | for (var key in watch) {
|
3721 | var handler = watch[key];
|
3722 | if (Array.isArray(handler)) {
|
3723 | for (var i = 0; i < handler.length; i++) {
|
3724 | createWatcher(vm, key, handler[i]);
|
3725 | }
|
3726 | } else {
|
3727 | createWatcher(vm, key, handler);
|
3728 | }
|
3729 | }
|
3730 | }
|
3731 |
|
3732 | function createWatcher (
|
3733 | vm,
|
3734 | expOrFn,
|
3735 | handler,
|
3736 | options
|
3737 | ) {
|
3738 | if (isPlainObject(handler)) {
|
3739 | options = handler;
|
3740 | handler = handler.handler;
|
3741 | }
|
3742 | if (typeof handler === 'string') {
|
3743 | handler = vm[handler];
|
3744 | }
|
3745 | return vm.$watch(expOrFn, handler, options)
|
3746 | }
|
3747 |
|
3748 | function stateMixin (Vue) {
|
3749 |
|
3750 |
|
3751 |
|
3752 | var dataDef = {};
|
3753 | dataDef.get = function () { return this._data };
|
3754 | var propsDef = {};
|
3755 | propsDef.get = function () { return this._props };
|
3756 | {
|
3757 | dataDef.set = function () {
|
3758 | warn(
|
3759 | 'Avoid replacing instance root $data. ' +
|
3760 | 'Use nested data properties instead.',
|
3761 | this
|
3762 | );
|
3763 | };
|
3764 | propsDef.set = function () {
|
3765 | warn("$props is readonly.", this);
|
3766 | };
|
3767 | }
|
3768 | Object.defineProperty(Vue.prototype, '$data', dataDef);
|
3769 | Object.defineProperty(Vue.prototype, '$props', propsDef);
|
3770 |
|
3771 | Vue.prototype.$set = set;
|
3772 | Vue.prototype.$delete = del;
|
3773 |
|
3774 | Vue.prototype.$watch = function (
|
3775 | expOrFn,
|
3776 | cb,
|
3777 | options
|
3778 | ) {
|
3779 | var vm = this;
|
3780 | if (isPlainObject(cb)) {
|
3781 | return createWatcher(vm, expOrFn, cb, options)
|
3782 | }
|
3783 | options = options || {};
|
3784 | options.user = true;
|
3785 | var watcher = new Watcher(vm, expOrFn, cb, options);
|
3786 | if (options.immediate) {
|
3787 | try {
|
3788 | cb.call(vm, watcher.value);
|
3789 | } catch (error) {
|
3790 | handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
3791 | }
|
3792 | }
|
3793 | return function unwatchFn () {
|
3794 | watcher.teardown();
|
3795 | }
|
3796 | };
|
3797 | }
|
3798 |
|
3799 |
|
3800 |
|
3801 | function initProvide (vm) {
|
3802 | var provide = vm.$options.provide;
|
3803 | if (provide) {
|
3804 | vm._provided = typeof provide === 'function'
|
3805 | ? provide.call(vm)
|
3806 | : provide;
|
3807 | }
|
3808 | }
|
3809 |
|
3810 | function initInjections (vm) {
|
3811 | var result = resolveInject(vm.$options.inject, vm);
|
3812 | if (result) {
|
3813 | toggleObserving(false);
|
3814 | Object.keys(result).forEach(function (key) {
|
3815 |
|
3816 | {
|
3817 | defineReactive$$1(vm, key, result[key], function () {
|
3818 | warn(
|
3819 | "Avoid mutating an injected value directly since the changes will be " +
|
3820 | "overwritten whenever the provided component re-renders. " +
|
3821 | "injection being mutated: \"" + key + "\"",
|
3822 | vm
|
3823 | );
|
3824 | });
|
3825 | }
|
3826 | });
|
3827 | toggleObserving(true);
|
3828 | }
|
3829 | }
|
3830 |
|
3831 | function resolveInject (inject, vm) {
|
3832 | if (inject) {
|
3833 |
|
3834 | var result = Object.create(null);
|
3835 | var keys = hasSymbol
|
3836 | ? Reflect.ownKeys(inject)
|
3837 | : Object.keys(inject);
|
3838 |
|
3839 | for (var i = 0; i < keys.length; i++) {
|
3840 | var key = keys[i];
|
3841 |
|
3842 | if (key === '__ob__') { continue }
|
3843 | var provideKey = inject[key].from;
|
3844 | var source = vm;
|
3845 | while (source) {
|
3846 | if (source._provided && hasOwn(source._provided, provideKey)) {
|
3847 | result[key] = source._provided[provideKey];
|
3848 | break
|
3849 | }
|
3850 | source = source.$parent;
|
3851 | }
|
3852 | if (!source) {
|
3853 | if ('default' in inject[key]) {
|
3854 | var provideDefault = inject[key].default;
|
3855 | result[key] = typeof provideDefault === 'function'
|
3856 | ? provideDefault.call(vm)
|
3857 | : provideDefault;
|
3858 | } else {
|
3859 | warn(("Injection \"" + key + "\" not found"), vm);
|
3860 | }
|
3861 | }
|
3862 | }
|
3863 | return result
|
3864 | }
|
3865 | }
|
3866 |
|
3867 |
|
3868 |
|
3869 | function normalizeScopedSlots (
|
3870 | slots,
|
3871 | normalSlots
|
3872 | ) {
|
3873 | var res;
|
3874 | if (!slots) {
|
3875 | res = {};
|
3876 | } else if (slots._normalized) {
|
3877 | return slots
|
3878 | } else {
|
3879 | res = {};
|
3880 | for (var key in slots) {
|
3881 | if (slots[key] && key[0] !== '$') {
|
3882 | res[key] = normalizeScopedSlot(slots[key]);
|
3883 | }
|
3884 | }
|
3885 | }
|
3886 |
|
3887 | for (var key$1 in normalSlots) {
|
3888 | if (!(key$1 in res)) {
|
3889 | res[key$1] = proxyNormalSlot(normalSlots, key$1);
|
3890 | }
|
3891 | }
|
3892 | res._normalized = true;
|
3893 | res.$stable = slots ? slots.$stable : true;
|
3894 | return res
|
3895 | }
|
3896 |
|
3897 | function normalizeScopedSlot(fn) {
|
3898 | return function (scope) {
|
3899 | var res = fn(scope);
|
3900 | return res && typeof res === 'object' && !Array.isArray(res)
|
3901 | ? [res]
|
3902 | : normalizeChildren(res)
|
3903 | }
|
3904 | }
|
3905 |
|
3906 | function proxyNormalSlot(slots, key) {
|
3907 | return function () { return slots[key]; }
|
3908 | }
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
3913 |
|
3914 |
|
3915 | function renderList (
|
3916 | val,
|
3917 | render
|
3918 | ) {
|
3919 | var ret, i, l, keys, key;
|
3920 | if (Array.isArray(val) || typeof val === 'string') {
|
3921 | ret = new Array(val.length);
|
3922 | for (i = 0, l = val.length; i < l; i++) {
|
3923 | ret[i] = render(val[i], i);
|
3924 | }
|
3925 | } else if (typeof val === 'number') {
|
3926 | ret = new Array(val);
|
3927 | for (i = 0; i < val; i++) {
|
3928 | ret[i] = render(i + 1, i);
|
3929 | }
|
3930 | } else if (isObject(val)) {
|
3931 | if (hasSymbol && val[Symbol.iterator]) {
|
3932 | ret = [];
|
3933 | var iterator = val[Symbol.iterator]();
|
3934 | var result = iterator.next();
|
3935 | while (!result.done) {
|
3936 | ret.push(render(result.value, ret.length));
|
3937 | result = iterator.next();
|
3938 | }
|
3939 | } else {
|
3940 | keys = Object.keys(val);
|
3941 | ret = new Array(keys.length);
|
3942 | for (i = 0, l = keys.length; i < l; i++) {
|
3943 | key = keys[i];
|
3944 | ret[i] = render(val[key], key, i);
|
3945 | }
|
3946 | }
|
3947 | }
|
3948 | if (!isDef(ret)) {
|
3949 | ret = [];
|
3950 | }
|
3951 | (ret)._isVList = true;
|
3952 | return ret
|
3953 | }
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 | function renderSlot (
|
3961 | name,
|
3962 | fallback,
|
3963 | props,
|
3964 | bindObject
|
3965 | ) {
|
3966 | var scopedSlotFn = this.$scopedSlots[name];
|
3967 | var nodes;
|
3968 | if (scopedSlotFn) {
|
3969 | props = props || {};
|
3970 | if (bindObject) {
|
3971 | if (!isObject(bindObject)) {
|
3972 | warn(
|
3973 | 'slot v-bind without argument expects an Object',
|
3974 | this
|
3975 | );
|
3976 | }
|
3977 | props = extend(extend({}, bindObject), props);
|
3978 | }
|
3979 | nodes = scopedSlotFn(props) || fallback;
|
3980 | } else {
|
3981 | nodes = this.$slots[name] || fallback;
|
3982 | }
|
3983 |
|
3984 | var target = props && props.slot;
|
3985 | if (target) {
|
3986 | return this.$createElement('template', { slot: target }, nodes)
|
3987 | } else {
|
3988 | return nodes
|
3989 | }
|
3990 | }
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 | function resolveFilter (id) {
|
3998 | return resolveAsset(this.$options, 'filters', id, true) || identity
|
3999 | }
|
4000 |
|
4001 |
|
4002 |
|
4003 | function isKeyNotMatch (expect, actual) {
|
4004 | if (Array.isArray(expect)) {
|
4005 | return expect.indexOf(actual) === -1
|
4006 | } else {
|
4007 | return expect !== actual
|
4008 | }
|
4009 | }
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 | function checkKeyCodes (
|
4017 | eventKeyCode,
|
4018 | key,
|
4019 | builtInKeyCode,
|
4020 | eventKeyName,
|
4021 | builtInKeyName
|
4022 | ) {
|
4023 | var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
4024 | if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
4025 | return isKeyNotMatch(builtInKeyName, eventKeyName)
|
4026 | } else if (mappedKeyCode) {
|
4027 | return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
4028 | } else if (eventKeyName) {
|
4029 | return hyphenate(eventKeyName) !== key
|
4030 | }
|
4031 | }
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 | function bindObjectProps (
|
4039 | data,
|
4040 | tag,
|
4041 | value,
|
4042 | asProp,
|
4043 | isSync
|
4044 | ) {
|
4045 | if (value) {
|
4046 | if (!isObject(value)) {
|
4047 | warn(
|
4048 | 'v-bind without argument expects an Object or Array value',
|
4049 | this
|
4050 | );
|
4051 | } else {
|
4052 | if (Array.isArray(value)) {
|
4053 | value = toObject(value);
|
4054 | }
|
4055 | var hash;
|
4056 | var loop = function ( key ) {
|
4057 | if (
|
4058 | key === 'class' ||
|
4059 | key === 'style' ||
|
4060 | isReservedAttribute(key)
|
4061 | ) {
|
4062 | hash = data;
|
4063 | } else {
|
4064 | var type = data.attrs && data.attrs.type;
|
4065 | hash = asProp || config.mustUseProp(tag, type, key)
|
4066 | ? data.domProps || (data.domProps = {})
|
4067 | : data.attrs || (data.attrs = {});
|
4068 | }
|
4069 | var camelizedKey = camelize(key);
|
4070 | if (!(key in hash) && !(camelizedKey in hash)) {
|
4071 | hash[key] = value[key];
|
4072 |
|
4073 | if (isSync) {
|
4074 | var on = data.on || (data.on = {});
|
4075 | on[("update:" + camelizedKey)] = function ($event) {
|
4076 | value[key] = $event;
|
4077 | };
|
4078 | }
|
4079 | }
|
4080 | };
|
4081 |
|
4082 | for (var key in value) loop( key );
|
4083 | }
|
4084 | }
|
4085 | return data
|
4086 | }
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 |
|
4092 |
|
4093 | function renderStatic (
|
4094 | index,
|
4095 | isInFor
|
4096 | ) {
|
4097 | var cached = this._staticTrees || (this._staticTrees = []);
|
4098 | var tree = cached[index];
|
4099 |
|
4100 |
|
4101 | if (tree && !isInFor) {
|
4102 | return tree
|
4103 | }
|
4104 |
|
4105 | tree = cached[index] = this.$options.staticRenderFns[index].call(
|
4106 | this._renderProxy,
|
4107 | null,
|
4108 | this
|
4109 | );
|
4110 | markStatic(tree, ("__static__" + index), false);
|
4111 | return tree
|
4112 | }
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 | function markOnce (
|
4119 | tree,
|
4120 | index,
|
4121 | key
|
4122 | ) {
|
4123 | markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
4124 | return tree
|
4125 | }
|
4126 |
|
4127 | function markStatic (
|
4128 | tree,
|
4129 | key,
|
4130 | isOnce
|
4131 | ) {
|
4132 | if (Array.isArray(tree)) {
|
4133 | for (var i = 0; i < tree.length; i++) {
|
4134 | if (tree[i] && typeof tree[i] !== 'string') {
|
4135 | markStaticNode(tree[i], (key + "_" + i), isOnce);
|
4136 | }
|
4137 | }
|
4138 | } else {
|
4139 | markStaticNode(tree, key, isOnce);
|
4140 | }
|
4141 | }
|
4142 |
|
4143 | function markStaticNode (node, key, isOnce) {
|
4144 | node.isStatic = true;
|
4145 | node.key = key;
|
4146 | node.isOnce = isOnce;
|
4147 | }
|
4148 |
|
4149 |
|
4150 |
|
4151 | function bindObjectListeners (data, value) {
|
4152 | if (value) {
|
4153 | if (!isPlainObject(value)) {
|
4154 | warn(
|
4155 | 'v-on without argument expects an Object value',
|
4156 | this
|
4157 | );
|
4158 | } else {
|
4159 | var on = data.on = data.on ? extend({}, data.on) : {};
|
4160 | for (var key in value) {
|
4161 | var existing = on[key];
|
4162 | var ours = value[key];
|
4163 | on[key] = existing ? [].concat(existing, ours) : ours;
|
4164 | }
|
4165 | }
|
4166 | }
|
4167 | return data
|
4168 | }
|
4169 |
|
4170 |
|
4171 |
|
4172 | function bindDynamicKeys (baseObj, values) {
|
4173 | for (var i = 0; i < values.length; i += 2) {
|
4174 | var key = values[i];
|
4175 | if (typeof key === 'string' && key) {
|
4176 | baseObj[values[i]] = values[i + 1];
|
4177 | } else if (key !== '' && key !== null) {
|
4178 |
|
4179 | warn(
|
4180 | ("Invalid value for dynamic directive argument (expected string or null): " + key),
|
4181 | this
|
4182 | );
|
4183 | }
|
4184 | }
|
4185 | return baseObj
|
4186 | }
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 | function prependModifier (value, symbol) {
|
4192 | return typeof value === 'string' ? symbol + value : value
|
4193 | }
|
4194 |
|
4195 |
|
4196 |
|
4197 | function installRenderHelpers (target) {
|
4198 | target._o = markOnce;
|
4199 | target._n = toNumber;
|
4200 | target._s = toString;
|
4201 | target._l = renderList;
|
4202 | target._t = renderSlot;
|
4203 | target._q = looseEqual;
|
4204 | target._i = looseIndexOf;
|
4205 | target._m = renderStatic;
|
4206 | target._f = resolveFilter;
|
4207 | target._k = checkKeyCodes;
|
4208 | target._b = bindObjectProps;
|
4209 | target._v = createTextVNode;
|
4210 | target._e = createEmptyVNode;
|
4211 | target._u = resolveScopedSlots;
|
4212 | target._g = bindObjectListeners;
|
4213 | target._d = bindDynamicKeys;
|
4214 | target._p = prependModifier;
|
4215 | }
|
4216 |
|
4217 |
|
4218 |
|
4219 | function FunctionalRenderContext (
|
4220 | data,
|
4221 | props,
|
4222 | children,
|
4223 | parent,
|
4224 | Ctor
|
4225 | ) {
|
4226 | var options = Ctor.options;
|
4227 |
|
4228 |
|
4229 | var contextVm;
|
4230 | if (hasOwn(parent, '_uid')) {
|
4231 | contextVm = Object.create(parent);
|
4232 |
|
4233 | contextVm._original = parent;
|
4234 | } else {
|
4235 |
|
4236 |
|
4237 |
|
4238 | contextVm = parent;
|
4239 |
|
4240 | parent = parent._original;
|
4241 | }
|
4242 | var isCompiled = isTrue(options._compiled);
|
4243 | var needNormalization = !isCompiled;
|
4244 |
|
4245 | this.data = data;
|
4246 | this.props = props;
|
4247 | this.children = children;
|
4248 | this.parent = parent;
|
4249 | this.listeners = data.on || emptyObject;
|
4250 | this.injections = resolveInject(options.inject, parent);
|
4251 | this.slots = function () { return resolveSlots(children, parent); };
|
4252 |
|
4253 | Object.defineProperty(this, 'scopedSlots', ({
|
4254 | enumerable: true,
|
4255 | get: function get () {
|
4256 | return normalizeScopedSlots(data.scopedSlots, this.slots())
|
4257 | }
|
4258 | }));
|
4259 |
|
4260 |
|
4261 | if (isCompiled) {
|
4262 |
|
4263 | this.$options = options;
|
4264 |
|
4265 | this.$slots = this.slots();
|
4266 | this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
4267 | }
|
4268 |
|
4269 | if (options._scopeId) {
|
4270 | this._c = function (a, b, c, d) {
|
4271 | var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
4272 | if (vnode && !Array.isArray(vnode)) {
|
4273 | vnode.fnScopeId = options._scopeId;
|
4274 | vnode.fnContext = parent;
|
4275 | }
|
4276 | return vnode
|
4277 | };
|
4278 | } else {
|
4279 | this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
4280 | }
|
4281 | }
|
4282 |
|
4283 | installRenderHelpers(FunctionalRenderContext.prototype);
|
4284 |
|
4285 | function createFunctionalComponent (
|
4286 | Ctor,
|
4287 | propsData,
|
4288 | data,
|
4289 | contextVm,
|
4290 | children
|
4291 | ) {
|
4292 | var options = Ctor.options;
|
4293 | var props = {};
|
4294 | var propOptions = options.props;
|
4295 | if (isDef(propOptions)) {
|
4296 | for (var key in propOptions) {
|
4297 | props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
4298 | }
|
4299 | } else {
|
4300 | if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
4301 | if (isDef(data.props)) { mergeProps(props, data.props); }
|
4302 | }
|
4303 |
|
4304 | var renderContext = new FunctionalRenderContext(
|
4305 | data,
|
4306 | props,
|
4307 | children,
|
4308 | contextVm,
|
4309 | Ctor
|
4310 | );
|
4311 |
|
4312 | var vnode = options.render.call(null, renderContext._c, renderContext);
|
4313 |
|
4314 | if (vnode instanceof VNode) {
|
4315 | return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
4316 | } else if (Array.isArray(vnode)) {
|
4317 | var vnodes = normalizeChildren(vnode) || [];
|
4318 | var res = new Array(vnodes.length);
|
4319 | for (var i = 0; i < vnodes.length; i++) {
|
4320 | res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
4321 | }
|
4322 | return res
|
4323 | }
|
4324 | }
|
4325 |
|
4326 | function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
4327 |
|
4328 |
|
4329 |
|
4330 | var clone = cloneVNode(vnode);
|
4331 | clone.fnContext = contextVm;
|
4332 | clone.fnOptions = options;
|
4333 | {
|
4334 | (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
4335 | }
|
4336 | if (data.slot) {
|
4337 | (clone.data || (clone.data = {})).slot = data.slot;
|
4338 | }
|
4339 | return clone
|
4340 | }
|
4341 |
|
4342 | function mergeProps (to, from) {
|
4343 | for (var key in from) {
|
4344 | to[camelize(key)] = from[key];
|
4345 | }
|
4346 | }
|
4347 |
|
4348 |
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 | var componentVNodeHooks = {
|
4358 | init: function init (vnode, hydrating) {
|
4359 | if (
|
4360 | vnode.componentInstance &&
|
4361 | !vnode.componentInstance._isDestroyed &&
|
4362 | vnode.data.keepAlive
|
4363 | ) {
|
4364 |
|
4365 | var mountedNode = vnode;
|
4366 | componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
4367 | } else {
|
4368 | var child = vnode.componentInstance = createComponentInstanceForVnode(
|
4369 | vnode,
|
4370 | activeInstance
|
4371 | );
|
4372 | child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
4373 | }
|
4374 | },
|
4375 |
|
4376 | prepatch: function prepatch (oldVnode, vnode) {
|
4377 | var options = vnode.componentOptions;
|
4378 | var child = vnode.componentInstance = oldVnode.componentInstance;
|
4379 | updateChildComponent(
|
4380 | child,
|
4381 | options.propsData,
|
4382 | options.listeners,
|
4383 | vnode,
|
4384 | options.children
|
4385 | );
|
4386 | },
|
4387 |
|
4388 | insert: function insert (vnode) {
|
4389 | var context = vnode.context;
|
4390 | var componentInstance = vnode.componentInstance;
|
4391 | if (!componentInstance._isMounted) {
|
4392 | componentInstance._isMounted = true;
|
4393 | callHook(componentInstance, 'mounted');
|
4394 | }
|
4395 | if (vnode.data.keepAlive) {
|
4396 | if (context._isMounted) {
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 | queueActivatedComponent(componentInstance);
|
4403 | } else {
|
4404 | activateChildComponent(componentInstance, true );
|
4405 | }
|
4406 | }
|
4407 | },
|
4408 |
|
4409 | destroy: function destroy (vnode) {
|
4410 | var componentInstance = vnode.componentInstance;
|
4411 | if (!componentInstance._isDestroyed) {
|
4412 | if (!vnode.data.keepAlive) {
|
4413 | componentInstance.$destroy();
|
4414 | } else {
|
4415 | deactivateChildComponent(componentInstance, true );
|
4416 | }
|
4417 | }
|
4418 | }
|
4419 | };
|
4420 |
|
4421 | var hooksToMerge = Object.keys(componentVNodeHooks);
|
4422 |
|
4423 | function createComponent (
|
4424 | Ctor,
|
4425 | data,
|
4426 | context,
|
4427 | children,
|
4428 | tag
|
4429 | ) {
|
4430 | if (isUndef(Ctor)) {
|
4431 | return
|
4432 | }
|
4433 |
|
4434 | var baseCtor = context.$options._base;
|
4435 |
|
4436 |
|
4437 | if (isObject(Ctor)) {
|
4438 | Ctor = baseCtor.extend(Ctor);
|
4439 | }
|
4440 |
|
4441 |
|
4442 |
|
4443 | if (typeof Ctor !== 'function') {
|
4444 | {
|
4445 | warn(("Invalid Component definition: " + (String(Ctor))), context);
|
4446 | }
|
4447 | return
|
4448 | }
|
4449 |
|
4450 |
|
4451 | var asyncFactory;
|
4452 | if (isUndef(Ctor.cid)) {
|
4453 | asyncFactory = Ctor;
|
4454 | Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
|
4455 | if (Ctor === undefined) {
|
4456 |
|
4457 |
|
4458 |
|
4459 | return createAsyncPlaceholder(
|
4460 | asyncFactory,
|
4461 | data,
|
4462 | context,
|
4463 | children,
|
4464 | tag
|
4465 | )
|
4466 | }
|
4467 | }
|
4468 |
|
4469 | data = data || {};
|
4470 |
|
4471 |
|
4472 |
|
4473 | resolveConstructorOptions(Ctor);
|
4474 |
|
4475 |
|
4476 | if (isDef(data.model)) {
|
4477 | transformModel(Ctor.options, data);
|
4478 | }
|
4479 |
|
4480 |
|
4481 | var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
4482 |
|
4483 |
|
4484 | if (isTrue(Ctor.options.functional)) {
|
4485 | return createFunctionalComponent(Ctor, propsData, data, context, children)
|
4486 | }
|
4487 |
|
4488 |
|
4489 |
|
4490 | var listeners = data.on;
|
4491 |
|
4492 |
|
4493 | data.on = data.nativeOn;
|
4494 |
|
4495 | if (isTrue(Ctor.options.abstract)) {
|
4496 |
|
4497 |
|
4498 |
|
4499 |
|
4500 | var slot = data.slot;
|
4501 | data = {};
|
4502 | if (slot) {
|
4503 | data.slot = slot;
|
4504 | }
|
4505 | }
|
4506 |
|
4507 |
|
4508 | installComponentHooks(data);
|
4509 |
|
4510 |
|
4511 | var name = Ctor.options.name || tag;
|
4512 | var vnode = new VNode(
|
4513 | ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
4514 | data, undefined, undefined, undefined, context,
|
4515 | { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
4516 | asyncFactory
|
4517 | );
|
4518 |
|
4519 | return vnode
|
4520 | }
|
4521 |
|
4522 | function createComponentInstanceForVnode (
|
4523 | vnode, // we know it's MountedComponentVNode but flow doesn't
|
4524 | parent // activeInstance in lifecycle state
|
4525 | ) {
|
4526 | var options = {
|
4527 | _isComponent: true,
|
4528 | _parentVnode: vnode,
|
4529 | parent: parent
|
4530 | };
|
4531 |
|
4532 | var inlineTemplate = vnode.data.inlineTemplate;
|
4533 | if (isDef(inlineTemplate)) {
|
4534 | options.render = inlineTemplate.render;
|
4535 | options.staticRenderFns = inlineTemplate.staticRenderFns;
|
4536 | }
|
4537 | return new vnode.componentOptions.Ctor(options)
|
4538 | }
|
4539 |
|
4540 | function installComponentHooks (data) {
|
4541 | var hooks = data.hook || (data.hook = {});
|
4542 | for (var i = 0; i < hooksToMerge.length; i++) {
|
4543 | var key = hooksToMerge[i];
|
4544 | var existing = hooks[key];
|
4545 | var toMerge = componentVNodeHooks[key];
|
4546 | if (existing !== toMerge && !(existing && existing._merged)) {
|
4547 | hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
4548 | }
|
4549 | }
|
4550 | }
|
4551 |
|
4552 | function mergeHook$1 (f1, f2) {
|
4553 | var merged = function (a, b) {
|
4554 |
|
4555 | f1(a, b);
|
4556 | f2(a, b);
|
4557 | };
|
4558 | merged._merged = true;
|
4559 | return merged
|
4560 | }
|
4561 |
|
4562 |
|
4563 |
|
4564 | function transformModel (options, data) {
|
4565 | var prop = (options.model && options.model.prop) || 'value';
|
4566 | var event = (options.model && options.model.event) || 'input'
|
4567 | ;(data.props || (data.props = {}))[prop] = data.model.value;
|
4568 | var on = data.on || (data.on = {});
|
4569 | var existing = on[event];
|
4570 | var callback = data.model.callback;
|
4571 | if (isDef(existing)) {
|
4572 | if (
|
4573 | Array.isArray(existing)
|
4574 | ? existing.indexOf(callback) === -1
|
4575 | : existing !== callback
|
4576 | ) {
|
4577 | on[event] = [callback].concat(existing);
|
4578 | }
|
4579 | } else {
|
4580 | on[event] = callback;
|
4581 | }
|
4582 | }
|
4583 |
|
4584 |
|
4585 |
|
4586 | var SIMPLE_NORMALIZE = 1;
|
4587 | var ALWAYS_NORMALIZE = 2;
|
4588 |
|
4589 |
|
4590 |
|
4591 | function createElement (
|
4592 | context,
|
4593 | tag,
|
4594 | data,
|
4595 | children,
|
4596 | normalizationType,
|
4597 | alwaysNormalize
|
4598 | ) {
|
4599 | if (Array.isArray(data) || isPrimitive(data)) {
|
4600 | normalizationType = children;
|
4601 | children = data;
|
4602 | data = undefined;
|
4603 | }
|
4604 | if (isTrue(alwaysNormalize)) {
|
4605 | normalizationType = ALWAYS_NORMALIZE;
|
4606 | }
|
4607 | return _createElement(context, tag, data, children, normalizationType)
|
4608 | }
|
4609 |
|
4610 | function _createElement (
|
4611 | context,
|
4612 | tag,
|
4613 | data,
|
4614 | children,
|
4615 | normalizationType
|
4616 | ) {
|
4617 | if (isDef(data) && isDef((data).__ob__)) {
|
4618 | warn(
|
4619 | "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
4620 | 'Always create fresh vnode data objects in each render!',
|
4621 | context
|
4622 | );
|
4623 | return createEmptyVNode()
|
4624 | }
|
4625 |
|
4626 | if (isDef(data) && isDef(data.is)) {
|
4627 | tag = data.is;
|
4628 | }
|
4629 | if (!tag) {
|
4630 |
|
4631 | return createEmptyVNode()
|
4632 | }
|
4633 |
|
4634 | if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
4635 | ) {
|
4636 | {
|
4637 | warn(
|
4638 | 'Avoid using non-primitive value as key, ' +
|
4639 | 'use string/number value instead.',
|
4640 | context
|
4641 | );
|
4642 | }
|
4643 | }
|
4644 |
|
4645 | if (Array.isArray(children) &&
|
4646 | typeof children[0] === 'function'
|
4647 | ) {
|
4648 | data = data || {};
|
4649 | data.scopedSlots = { default: children[0] };
|
4650 | children.length = 0;
|
4651 | }
|
4652 | if (normalizationType === ALWAYS_NORMALIZE) {
|
4653 | children = normalizeChildren(children);
|
4654 | } else if (normalizationType === SIMPLE_NORMALIZE) {
|
4655 | children = simpleNormalizeChildren(children);
|
4656 | }
|
4657 | var vnode, ns;
|
4658 | if (typeof tag === 'string') {
|
4659 | var Ctor;
|
4660 | ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
4661 | if (config.isReservedTag(tag)) {
|
4662 |
|
4663 | vnode = new VNode(
|
4664 | config.parsePlatformTagName(tag), data, children,
|
4665 | undefined, undefined, context
|
4666 | );
|
4667 | } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
4668 |
|
4669 | vnode = createComponent(Ctor, data, context, children, tag);
|
4670 | } else {
|
4671 |
|
4672 |
|
4673 |
|
4674 | vnode = new VNode(
|
4675 | tag, data, children,
|
4676 | undefined, undefined, context
|
4677 | );
|
4678 | }
|
4679 | } else {
|
4680 |
|
4681 | vnode = createComponent(tag, data, context, children);
|
4682 | }
|
4683 | if (Array.isArray(vnode)) {
|
4684 | return vnode
|
4685 | } else if (isDef(vnode)) {
|
4686 | if (isDef(ns)) { applyNS(vnode, ns); }
|
4687 | if (isDef(data)) { registerDeepBindings(data); }
|
4688 | return vnode
|
4689 | } else {
|
4690 | return createEmptyVNode()
|
4691 | }
|
4692 | }
|
4693 |
|
4694 | function applyNS (vnode, ns, force) {
|
4695 | vnode.ns = ns;
|
4696 | if (vnode.tag === 'foreignObject') {
|
4697 |
|
4698 | ns = undefined;
|
4699 | force = true;
|
4700 | }
|
4701 | if (isDef(vnode.children)) {
|
4702 | for (var i = 0, l = vnode.children.length; i < l; i++) {
|
4703 | var child = vnode.children[i];
|
4704 | if (isDef(child.tag) && (
|
4705 | isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
4706 | applyNS(child, ns, force);
|
4707 | }
|
4708 | }
|
4709 | }
|
4710 | }
|
4711 |
|
4712 |
|
4713 |
|
4714 |
|
4715 | function registerDeepBindings (data) {
|
4716 | if (isObject(data.style)) {
|
4717 | traverse(data.style);
|
4718 | }
|
4719 | if (isObject(data.class)) {
|
4720 | traverse(data.class);
|
4721 | }
|
4722 | }
|
4723 |
|
4724 |
|
4725 |
|
4726 | function initRender (vm) {
|
4727 | vm._vnode = null;
|
4728 | vm._staticTrees = null;
|
4729 | var options = vm.$options;
|
4730 | var parentVnode = vm.$vnode = options._parentVnode;
|
4731 | var renderContext = parentVnode && parentVnode.context;
|
4732 | vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
4733 | vm.$scopedSlots = emptyObject;
|
4734 |
|
4735 |
|
4736 |
|
4737 |
|
4738 | vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
4739 |
|
4740 |
|
4741 | vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
4742 |
|
4743 |
|
4744 |
|
4745 | var parentData = parentVnode && parentVnode.data;
|
4746 |
|
4747 |
|
4748 | {
|
4749 | defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
4750 | !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
4751 | }, true);
|
4752 | defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
4753 | !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
4754 | }, true);
|
4755 | }
|
4756 | }
|
4757 |
|
4758 | function renderMixin (Vue) {
|
4759 |
|
4760 | installRenderHelpers(Vue.prototype);
|
4761 |
|
4762 | Vue.prototype.$nextTick = function (fn) {
|
4763 | return nextTick(fn, this)
|
4764 | };
|
4765 |
|
4766 | Vue.prototype._render = function () {
|
4767 | var vm = this;
|
4768 | var ref = vm.$options;
|
4769 | var render = ref.render;
|
4770 | var _parentVnode = ref._parentVnode;
|
4771 |
|
4772 | if (_parentVnode) {
|
4773 | vm.$scopedSlots = normalizeScopedSlots(
|
4774 | _parentVnode.data.scopedSlots,
|
4775 | vm.$slots
|
4776 | );
|
4777 | }
|
4778 |
|
4779 |
|
4780 |
|
4781 | vm.$vnode = _parentVnode;
|
4782 |
|
4783 | var vnode;
|
4784 | try {
|
4785 | vnode = render.call(vm._renderProxy, vm.$createElement);
|
4786 | } catch (e) {
|
4787 | handleError(e, vm, "render");
|
4788 |
|
4789 |
|
4790 |
|
4791 | if (vm.$options.renderError) {
|
4792 | try {
|
4793 | vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
4794 | } catch (e) {
|
4795 | handleError(e, vm, "renderError");
|
4796 | vnode = vm._vnode;
|
4797 | }
|
4798 | } else {
|
4799 | vnode = vm._vnode;
|
4800 | }
|
4801 | }
|
4802 |
|
4803 | if (Array.isArray(vnode) && vnode.length === 1) {
|
4804 | vnode = vnode[0];
|
4805 | }
|
4806 |
|
4807 | if (!(vnode instanceof VNode)) {
|
4808 | if (Array.isArray(vnode)) {
|
4809 | warn(
|
4810 | 'Multiple root nodes returned from render function. Render function ' +
|
4811 | 'should return a single root node.',
|
4812 | vm
|
4813 | );
|
4814 | }
|
4815 | vnode = createEmptyVNode();
|
4816 | }
|
4817 |
|
4818 | vnode.parent = _parentVnode;
|
4819 | return vnode
|
4820 | };
|
4821 | }
|
4822 |
|
4823 |
|
4824 |
|
4825 | var uid$3 = 0;
|
4826 |
|
4827 | function initMixin (Vue) {
|
4828 | Vue.prototype._init = function (options) {
|
4829 | var vm = this;
|
4830 |
|
4831 | vm._uid = uid$3++;
|
4832 |
|
4833 | var startTag, endTag;
|
4834 |
|
4835 | if (config.performance && mark) {
|
4836 | startTag = "vue-perf-start:" + (vm._uid);
|
4837 | endTag = "vue-perf-end:" + (vm._uid);
|
4838 | mark(startTag);
|
4839 | }
|
4840 |
|
4841 |
|
4842 | vm._isVue = true;
|
4843 |
|
4844 | if (options && options._isComponent) {
|
4845 |
|
4846 |
|
4847 |
|
4848 | initInternalComponent(vm, options);
|
4849 | } else {
|
4850 | vm.$options = mergeOptions(
|
4851 | resolveConstructorOptions(vm.constructor),
|
4852 | options || {},
|
4853 | vm
|
4854 | );
|
4855 | }
|
4856 |
|
4857 | {
|
4858 | initProxy(vm);
|
4859 | }
|
4860 |
|
4861 | vm._self = vm;
|
4862 | initLifecycle(vm);
|
4863 | initEvents(vm);
|
4864 | initRender(vm);
|
4865 | callHook(vm, 'beforeCreate');
|
4866 | initInjections(vm);
|
4867 | initState(vm);
|
4868 | initProvide(vm);
|
4869 | callHook(vm, 'created');
|
4870 |
|
4871 |
|
4872 | if (config.performance && mark) {
|
4873 | vm._name = formatComponentName(vm, false);
|
4874 | mark(endTag);
|
4875 | measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
4876 | }
|
4877 |
|
4878 | if (vm.$options.el) {
|
4879 | vm.$mount(vm.$options.el);
|
4880 | }
|
4881 | };
|
4882 | }
|
4883 |
|
4884 | function initInternalComponent (vm, options) {
|
4885 | var opts = vm.$options = Object.create(vm.constructor.options);
|
4886 |
|
4887 | var parentVnode = options._parentVnode;
|
4888 | opts.parent = options.parent;
|
4889 | opts._parentVnode = parentVnode;
|
4890 |
|
4891 | var vnodeComponentOptions = parentVnode.componentOptions;
|
4892 | opts.propsData = vnodeComponentOptions.propsData;
|
4893 | opts._parentListeners = vnodeComponentOptions.listeners;
|
4894 | opts._renderChildren = vnodeComponentOptions.children;
|
4895 | opts._componentTag = vnodeComponentOptions.tag;
|
4896 |
|
4897 | if (options.render) {
|
4898 | opts.render = options.render;
|
4899 | opts.staticRenderFns = options.staticRenderFns;
|
4900 | }
|
4901 | }
|
4902 |
|
4903 | function resolveConstructorOptions (Ctor) {
|
4904 | var options = Ctor.options;
|
4905 | if (Ctor.super) {
|
4906 | var superOptions = resolveConstructorOptions(Ctor.super);
|
4907 | var cachedSuperOptions = Ctor.superOptions;
|
4908 | if (superOptions !== cachedSuperOptions) {
|
4909 |
|
4910 |
|
4911 | Ctor.superOptions = superOptions;
|
4912 |
|
4913 | var modifiedOptions = resolveModifiedOptions(Ctor);
|
4914 |
|
4915 | if (modifiedOptions) {
|
4916 | extend(Ctor.extendOptions, modifiedOptions);
|
4917 | }
|
4918 | options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
4919 | if (options.name) {
|
4920 | options.components[options.name] = Ctor;
|
4921 | }
|
4922 | }
|
4923 | }
|
4924 | return options
|
4925 | }
|
4926 |
|
4927 | function resolveModifiedOptions (Ctor) {
|
4928 | var modified;
|
4929 | var latest = Ctor.options;
|
4930 | var sealed = Ctor.sealedOptions;
|
4931 | for (var key in latest) {
|
4932 | if (latest[key] !== sealed[key]) {
|
4933 | if (!modified) { modified = {}; }
|
4934 | modified[key] = latest[key];
|
4935 | }
|
4936 | }
|
4937 | return modified
|
4938 | }
|
4939 |
|
4940 | function Vue (options) {
|
4941 | if (!(this instanceof Vue)
|
4942 | ) {
|
4943 | warn('Vue is a constructor and should be called with the `new` keyword');
|
4944 | }
|
4945 | this._init(options);
|
4946 | }
|
4947 |
|
4948 | initMixin(Vue);
|
4949 | stateMixin(Vue);
|
4950 | eventsMixin(Vue);
|
4951 | lifecycleMixin(Vue);
|
4952 | renderMixin(Vue);
|
4953 |
|
4954 |
|
4955 |
|
4956 | function initUse (Vue) {
|
4957 | Vue.use = function (plugin) {
|
4958 | var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
4959 | if (installedPlugins.indexOf(plugin) > -1) {
|
4960 | return this
|
4961 | }
|
4962 |
|
4963 |
|
4964 | var args = toArray(arguments, 1);
|
4965 | args.unshift(this);
|
4966 | if (typeof plugin.install === 'function') {
|
4967 | plugin.install.apply(plugin, args);
|
4968 | } else if (typeof plugin === 'function') {
|
4969 | plugin.apply(null, args);
|
4970 | }
|
4971 | installedPlugins.push(plugin);
|
4972 | return this
|
4973 | };
|
4974 | }
|
4975 |
|
4976 |
|
4977 |
|
4978 | function initMixin$1 (Vue) {
|
4979 | Vue.mixin = function (mixin) {
|
4980 | this.options = mergeOptions(this.options, mixin);
|
4981 | return this
|
4982 | };
|
4983 | }
|
4984 |
|
4985 |
|
4986 |
|
4987 | function initExtend (Vue) {
|
4988 | |
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 | Vue.cid = 0;
|
4994 | var cid = 1;
|
4995 |
|
4996 | |
4997 |
|
4998 |
|
4999 | Vue.extend = function (extendOptions) {
|
5000 | extendOptions = extendOptions || {};
|
5001 | var Super = this;
|
5002 | var SuperId = Super.cid;
|
5003 | var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5004 | if (cachedCtors[SuperId]) {
|
5005 | return cachedCtors[SuperId]
|
5006 | }
|
5007 |
|
5008 | var name = extendOptions.name || Super.options.name;
|
5009 | if (name) {
|
5010 | validateComponentName(name);
|
5011 | }
|
5012 |
|
5013 | var Sub = function VueComponent (options) {
|
5014 | this._init(options);
|
5015 | };
|
5016 | Sub.prototype = Object.create(Super.prototype);
|
5017 | Sub.prototype.constructor = Sub;
|
5018 | Sub.cid = cid++;
|
5019 | Sub.options = mergeOptions(
|
5020 | Super.options,
|
5021 | extendOptions
|
5022 | );
|
5023 | Sub['super'] = Super;
|
5024 |
|
5025 |
|
5026 |
|
5027 |
|
5028 | if (Sub.options.props) {
|
5029 | initProps$1(Sub);
|
5030 | }
|
5031 | if (Sub.options.computed) {
|
5032 | initComputed$1(Sub);
|
5033 | }
|
5034 |
|
5035 |
|
5036 | Sub.extend = Super.extend;
|
5037 | Sub.mixin = Super.mixin;
|
5038 | Sub.use = Super.use;
|
5039 |
|
5040 |
|
5041 |
|
5042 | ASSET_TYPES.forEach(function (type) {
|
5043 | Sub[type] = Super[type];
|
5044 | });
|
5045 |
|
5046 | if (name) {
|
5047 | Sub.options.components[name] = Sub;
|
5048 | }
|
5049 |
|
5050 |
|
5051 |
|
5052 |
|
5053 | Sub.superOptions = Super.options;
|
5054 | Sub.extendOptions = extendOptions;
|
5055 | Sub.sealedOptions = extend({}, Sub.options);
|
5056 |
|
5057 |
|
5058 | cachedCtors[SuperId] = Sub;
|
5059 | return Sub
|
5060 | };
|
5061 | }
|
5062 |
|
5063 | function initProps$1 (Comp) {
|
5064 | var props = Comp.options.props;
|
5065 | for (var key in props) {
|
5066 | proxy(Comp.prototype, "_props", key);
|
5067 | }
|
5068 | }
|
5069 |
|
5070 | function initComputed$1 (Comp) {
|
5071 | var computed = Comp.options.computed;
|
5072 | for (var key in computed) {
|
5073 | defineComputed(Comp.prototype, key, computed[key]);
|
5074 | }
|
5075 | }
|
5076 |
|
5077 |
|
5078 |
|
5079 | function initAssetRegisters (Vue) {
|
5080 | |
5081 |
|
5082 |
|
5083 | ASSET_TYPES.forEach(function (type) {
|
5084 | Vue[type] = function (
|
5085 | id,
|
5086 | definition
|
5087 | ) {
|
5088 | if (!definition) {
|
5089 | return this.options[type + 's'][id]
|
5090 | } else {
|
5091 |
|
5092 | if (type === 'component') {
|
5093 | validateComponentName(id);
|
5094 | }
|
5095 | if (type === 'component' && isPlainObject(definition)) {
|
5096 | definition.name = definition.name || id;
|
5097 | definition = this.options._base.extend(definition);
|
5098 | }
|
5099 | if (type === 'directive' && typeof definition === 'function') {
|
5100 | definition = { bind: definition, update: definition };
|
5101 | }
|
5102 | this.options[type + 's'][id] = definition;
|
5103 | return definition
|
5104 | }
|
5105 | };
|
5106 | });
|
5107 | }
|
5108 |
|
5109 |
|
5110 |
|
5111 |
|
5112 |
|
5113 | function getComponentName (opts) {
|
5114 | return opts && (opts.Ctor.options.name || opts.tag)
|
5115 | }
|
5116 |
|
5117 | function matches (pattern, name) {
|
5118 | if (Array.isArray(pattern)) {
|
5119 | return pattern.indexOf(name) > -1
|
5120 | } else if (typeof pattern === 'string') {
|
5121 | return pattern.split(',').indexOf(name) > -1
|
5122 | } else if (isRegExp(pattern)) {
|
5123 | return pattern.test(name)
|
5124 | }
|
5125 |
|
5126 | return false
|
5127 | }
|
5128 |
|
5129 | function pruneCache (keepAliveInstance, filter) {
|
5130 | var cache = keepAliveInstance.cache;
|
5131 | var keys = keepAliveInstance.keys;
|
5132 | var _vnode = keepAliveInstance._vnode;
|
5133 | for (var key in cache) {
|
5134 | var cachedNode = cache[key];
|
5135 | if (cachedNode) {
|
5136 | var name = getComponentName(cachedNode.componentOptions);
|
5137 | if (name && !filter(name)) {
|
5138 | pruneCacheEntry(cache, key, keys, _vnode);
|
5139 | }
|
5140 | }
|
5141 | }
|
5142 | }
|
5143 |
|
5144 | function pruneCacheEntry (
|
5145 | cache,
|
5146 | key,
|
5147 | keys,
|
5148 | current
|
5149 | ) {
|
5150 | var cached$$1 = cache[key];
|
5151 | if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
5152 | cached$$1.componentInstance.$destroy();
|
5153 | }
|
5154 | cache[key] = null;
|
5155 | remove(keys, key);
|
5156 | }
|
5157 |
|
5158 | var patternTypes = [String, RegExp, Array];
|
5159 |
|
5160 | var KeepAlive = {
|
5161 | name: 'keep-alive',
|
5162 | abstract: true,
|
5163 |
|
5164 | props: {
|
5165 | include: patternTypes,
|
5166 | exclude: patternTypes,
|
5167 | max: [String, Number]
|
5168 | },
|
5169 |
|
5170 | created: function created () {
|
5171 | this.cache = Object.create(null);
|
5172 | this.keys = [];
|
5173 | },
|
5174 |
|
5175 | destroyed: function destroyed () {
|
5176 | for (var key in this.cache) {
|
5177 | pruneCacheEntry(this.cache, key, this.keys);
|
5178 | }
|
5179 | },
|
5180 |
|
5181 | mounted: function mounted () {
|
5182 | var this$1 = this;
|
5183 |
|
5184 | this.$watch('include', function (val) {
|
5185 | pruneCache(this$1, function (name) { return matches(val, name); });
|
5186 | });
|
5187 | this.$watch('exclude', function (val) {
|
5188 | pruneCache(this$1, function (name) { return !matches(val, name); });
|
5189 | });
|
5190 | },
|
5191 |
|
5192 | render: function render () {
|
5193 | var slot = this.$slots.default;
|
5194 | var vnode = getFirstComponentChild(slot);
|
5195 | var componentOptions = vnode && vnode.componentOptions;
|
5196 | if (componentOptions) {
|
5197 |
|
5198 | var name = getComponentName(componentOptions);
|
5199 | var ref = this;
|
5200 | var include = ref.include;
|
5201 | var exclude = ref.exclude;
|
5202 | if (
|
5203 |
|
5204 | (include && (!name || !matches(include, name))) ||
|
5205 |
|
5206 | (exclude && name && matches(exclude, name))
|
5207 | ) {
|
5208 | return vnode
|
5209 | }
|
5210 |
|
5211 | var ref$1 = this;
|
5212 | var cache = ref$1.cache;
|
5213 | var keys = ref$1.keys;
|
5214 | var key = vnode.key == null
|
5215 |
|
5216 |
|
5217 | ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
5218 | : vnode.key;
|
5219 | if (cache[key]) {
|
5220 | vnode.componentInstance = cache[key].componentInstance;
|
5221 |
|
5222 | remove(keys, key);
|
5223 | keys.push(key);
|
5224 | } else {
|
5225 | cache[key] = vnode;
|
5226 | keys.push(key);
|
5227 |
|
5228 | if (this.max && keys.length > parseInt(this.max)) {
|
5229 | pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5230 | }
|
5231 | }
|
5232 |
|
5233 | vnode.data.keepAlive = true;
|
5234 | }
|
5235 | return vnode || (slot && slot[0])
|
5236 | }
|
5237 | };
|
5238 |
|
5239 | var builtInComponents = {
|
5240 | KeepAlive: KeepAlive
|
5241 | };
|
5242 |
|
5243 |
|
5244 |
|
5245 | function initGlobalAPI (Vue) {
|
5246 |
|
5247 | var configDef = {};
|
5248 | configDef.get = function () { return config; };
|
5249 | {
|
5250 | configDef.set = function () {
|
5251 | warn(
|
5252 | 'Do not replace the Vue.config object, set individual fields instead.'
|
5253 | );
|
5254 | };
|
5255 | }
|
5256 | Object.defineProperty(Vue, 'config', configDef);
|
5257 |
|
5258 |
|
5259 |
|
5260 |
|
5261 | Vue.util = {
|
5262 | warn: warn,
|
5263 | extend: extend,
|
5264 | mergeOptions: mergeOptions,
|
5265 | defineReactive: defineReactive$$1
|
5266 | };
|
5267 |
|
5268 | Vue.set = set;
|
5269 | Vue.delete = del;
|
5270 | Vue.nextTick = nextTick;
|
5271 |
|
5272 | // 2.6 explicit observable API
|
5273 | Vue.observable = function (obj) {
|
5274 | observe(obj);
|
5275 | return obj
|
5276 | };
|
5277 |
|
5278 | Vue.options = Object.create(null);
|
5279 | ASSET_TYPES.forEach(function (type) {
|
5280 | Vue.options[type + 's'] = Object.create(null);
|
5281 | });
|
5282 |
|
5283 |
|
5284 |
|
5285 | Vue.options._base = Vue;
|
5286 |
|
5287 | extend(Vue.options.components, builtInComponents);
|
5288 |
|
5289 | initUse(Vue);
|
5290 | initMixin$1(Vue);
|
5291 | initExtend(Vue);
|
5292 | initAssetRegisters(Vue);
|
5293 | }
|
5294 |
|
5295 | initGlobalAPI(Vue);
|
5296 |
|
5297 | Object.defineProperty(Vue.prototype, '$isServer', {
|
5298 | get: isServerRendering
|
5299 | });
|
5300 |
|
5301 | Object.defineProperty(Vue.prototype, '$ssrContext', {
|
5302 | get: function get () {
|
5303 |
|
5304 | return this.$vnode && this.$vnode.ssrContext
|
5305 | }
|
5306 | });
|
5307 |
|
5308 |
|
5309 | Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
5310 | value: FunctionalRenderContext
|
5311 | });
|
5312 |
|
5313 | Vue.version = '2.6.0';
|
5314 |
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 | var isReservedAttr = makeMap('style,class');
|
5320 |
|
5321 |
|
5322 | var acceptValue = makeMap('input,textarea,option,select,progress');
|
5323 | var mustUseProp = function (tag, type, attr) {
|
5324 | return (
|
5325 | (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
5326 | (attr === 'selected' && tag === 'option') ||
|
5327 | (attr === 'checked' && tag === 'input') ||
|
5328 | (attr === 'muted' && tag === 'video')
|
5329 | )
|
5330 | };
|
5331 |
|
5332 | var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
5333 |
|
5334 | var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
5335 |
|
5336 | var convertEnumeratedValue = function (key, value) {
|
5337 | return isFalsyAttrValue(value) || value === 'false'
|
5338 | ? 'false'
|
5339 |
|
5340 | : key === 'contenteditable' && isValidContentEditableValue(value)
|
5341 | ? value
|
5342 | : 'true'
|
5343 | };
|
5344 |
|
5345 | var isBooleanAttr = makeMap(
|
5346 | 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
5347 | 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
5348 | 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
5349 | 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
5350 | 'required,reversed,scoped,seamless,selected,sortable,translate,' +
|
5351 | 'truespeed,typemustmatch,visible'
|
5352 | );
|
5353 |
|
5354 | var xlinkNS = 'http://www.w3.org/1999/xlink';
|
5355 |
|
5356 | var isXlink = function (name) {
|
5357 | return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
5358 | };
|
5359 |
|
5360 | var getXlinkProp = function (name) {
|
5361 | return isXlink(name) ? name.slice(6, name.length) : ''
|
5362 | };
|
5363 |
|
5364 | var isFalsyAttrValue = function (val) {
|
5365 | return val == null || val === false
|
5366 | };
|
5367 |
|
5368 |
|
5369 |
|
5370 | function genClassForVnode (vnode) {
|
5371 | var data = vnode.data;
|
5372 | var parentNode = vnode;
|
5373 | var childNode = vnode;
|
5374 | while (isDef(childNode.componentInstance)) {
|
5375 | childNode = childNode.componentInstance._vnode;
|
5376 | if (childNode && childNode.data) {
|
5377 | data = mergeClassData(childNode.data, data);
|
5378 | }
|
5379 | }
|
5380 | while (isDef(parentNode = parentNode.parent)) {
|
5381 | if (parentNode && parentNode.data) {
|
5382 | data = mergeClassData(data, parentNode.data);
|
5383 | }
|
5384 | }
|
5385 | return renderClass(data.staticClass, data.class)
|
5386 | }
|
5387 |
|
5388 | function mergeClassData (child, parent) {
|
5389 | return {
|
5390 | staticClass: concat(child.staticClass, parent.staticClass),
|
5391 | class: isDef(child.class)
|
5392 | ? [child.class, parent.class]
|
5393 | : parent.class
|
5394 | }
|
5395 | }
|
5396 |
|
5397 | function renderClass (
|
5398 | staticClass,
|
5399 | dynamicClass
|
5400 | ) {
|
5401 | if (isDef(staticClass) || isDef(dynamicClass)) {
|
5402 | return concat(staticClass, stringifyClass(dynamicClass))
|
5403 | }
|
5404 |
|
5405 | return ''
|
5406 | }
|
5407 |
|
5408 | function concat (a, b) {
|
5409 | return a ? b ? (a + ' ' + b) : a : (b || '')
|
5410 | }
|
5411 |
|
5412 | function stringifyClass (value) {
|
5413 | if (Array.isArray(value)) {
|
5414 | return stringifyArray(value)
|
5415 | }
|
5416 | if (isObject(value)) {
|
5417 | return stringifyObject(value)
|
5418 | }
|
5419 | if (typeof value === 'string') {
|
5420 | return value
|
5421 | }
|
5422 |
|
5423 | return ''
|
5424 | }
|
5425 |
|
5426 | function stringifyArray (value) {
|
5427 | var res = '';
|
5428 | var stringified;
|
5429 | for (var i = 0, l = value.length; i < l; i++) {
|
5430 | if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
5431 | if (res) { res += ' '; }
|
5432 | res += stringified;
|
5433 | }
|
5434 | }
|
5435 | return res
|
5436 | }
|
5437 |
|
5438 | function stringifyObject (value) {
|
5439 | var res = '';
|
5440 | for (var key in value) {
|
5441 | if (value[key]) {
|
5442 | if (res) { res += ' '; }
|
5443 | res += key;
|
5444 | }
|
5445 | }
|
5446 | return res
|
5447 | }
|
5448 |
|
5449 |
|
5450 |
|
5451 | var namespaceMap = {
|
5452 | svg: 'http://www.w3.org/2000/svg',
|
5453 | math: 'http://www.w3.org/1998/Math/MathML'
|
5454 | };
|
5455 |
|
5456 | var isHTMLTag = makeMap(
|
5457 | 'html,body,base,head,link,meta,style,title,' +
|
5458 | 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
5459 | 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
5460 | 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
5461 | 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
5462 | 'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
5463 | 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
5464 | 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
5465 | 'output,progress,select,textarea,' +
|
5466 | 'details,dialog,menu,menuitem,summary,' +
|
5467 | 'content,element,shadow,template,blockquote,iframe,tfoot'
|
5468 | );
|
5469 |
|
5470 |
|
5471 |
|
5472 | var isSVG = makeMap(
|
5473 | 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
5474 | 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
5475 | 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
5476 | true
|
5477 | );
|
5478 |
|
5479 | var isReservedTag = function (tag) {
|
5480 | return isHTMLTag(tag) || isSVG(tag)
|
5481 | };
|
5482 |
|
5483 | function getTagNamespace (tag) {
|
5484 | if (isSVG(tag)) {
|
5485 | return 'svg'
|
5486 | }
|
5487 |
|
5488 |
|
5489 | if (tag === 'math') {
|
5490 | return 'math'
|
5491 | }
|
5492 | }
|
5493 |
|
5494 | var unknownElementCache = Object.create(null);
|
5495 | function isUnknownElement (tag) {
|
5496 |
|
5497 | if (!inBrowser) {
|
5498 | return true
|
5499 | }
|
5500 | if (isReservedTag(tag)) {
|
5501 | return false
|
5502 | }
|
5503 | tag = tag.toLowerCase();
|
5504 |
|
5505 | if (unknownElementCache[tag] != null) {
|
5506 | return unknownElementCache[tag]
|
5507 | }
|
5508 | var el = document.createElement(tag);
|
5509 | if (tag.indexOf('-') > -1) {
|
5510 |
|
5511 | return (unknownElementCache[tag] = (
|
5512 | el.constructor === window.HTMLUnknownElement ||
|
5513 | el.constructor === window.HTMLElement
|
5514 | ))
|
5515 | } else {
|
5516 | return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
5517 | }
|
5518 | }
|
5519 |
|
5520 | var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
5521 |
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 |
|
5527 | function query (el) {
|
5528 | if (typeof el === 'string') {
|
5529 | var selected = document.querySelector(el);
|
5530 | if (!selected) {
|
5531 | warn(
|
5532 | 'Cannot find element: ' + el
|
5533 | );
|
5534 | return document.createElement('div')
|
5535 | }
|
5536 | return selected
|
5537 | } else {
|
5538 | return el
|
5539 | }
|
5540 | }
|
5541 |
|
5542 |
|
5543 |
|
5544 | function createElement$1 (tagName, vnode) {
|
5545 | var elm = document.createElement(tagName);
|
5546 | if (tagName !== 'select') {
|
5547 | return elm
|
5548 | }
|
5549 |
|
5550 | if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
5551 | elm.setAttribute('multiple', 'multiple');
|
5552 | }
|
5553 | return elm
|
5554 | }
|
5555 |
|
5556 | function createElementNS (namespace, tagName) {
|
5557 | return document.createElementNS(namespaceMap[namespace], tagName)
|
5558 | }
|
5559 |
|
5560 | function createTextNode (text) {
|
5561 | return document.createTextNode(text)
|
5562 | }
|
5563 |
|
5564 | function createComment (text) {
|
5565 | return document.createComment(text)
|
5566 | }
|
5567 |
|
5568 | function insertBefore (parentNode, newNode, referenceNode) {
|
5569 | parentNode.insertBefore(newNode, referenceNode);
|
5570 | }
|
5571 |
|
5572 | function removeChild (node, child) {
|
5573 | node.removeChild(child);
|
5574 | }
|
5575 |
|
5576 | function appendChild (node, child) {
|
5577 | node.appendChild(child);
|
5578 | }
|
5579 |
|
5580 | function parentNode (node) {
|
5581 | return node.parentNode
|
5582 | }
|
5583 |
|
5584 | function nextSibling (node) {
|
5585 | return node.nextSibling
|
5586 | }
|
5587 |
|
5588 | function tagName (node) {
|
5589 | return node.tagName
|
5590 | }
|
5591 |
|
5592 | function setTextContent (node, text) {
|
5593 | node.textContent = text;
|
5594 | }
|
5595 |
|
5596 | function setStyleScope (node, scopeId) {
|
5597 | node.setAttribute(scopeId, '');
|
5598 | }
|
5599 |
|
5600 | var nodeOps = Object.freeze({
|
5601 | createElement: createElement$1,
|
5602 | createElementNS: createElementNS,
|
5603 | createTextNode: createTextNode,
|
5604 | createComment: createComment,
|
5605 | insertBefore: insertBefore,
|
5606 | removeChild: removeChild,
|
5607 | appendChild: appendChild,
|
5608 | parentNode: parentNode,
|
5609 | nextSibling: nextSibling,
|
5610 | tagName: tagName,
|
5611 | setTextContent: setTextContent,
|
5612 | setStyleScope: setStyleScope
|
5613 | });
|
5614 |
|
5615 |
|
5616 |
|
5617 | var ref = {
|
5618 | create: function create (_, vnode) {
|
5619 | registerRef(vnode);
|
5620 | },
|
5621 | update: function update (oldVnode, vnode) {
|
5622 | if (oldVnode.data.ref !== vnode.data.ref) {
|
5623 | registerRef(oldVnode, true);
|
5624 | registerRef(vnode);
|
5625 | }
|
5626 | },
|
5627 | destroy: function destroy (vnode) {
|
5628 | registerRef(vnode, true);
|
5629 | }
|
5630 | };
|
5631 |
|
5632 | function registerRef (vnode, isRemoval) {
|
5633 | var key = vnode.data.ref;
|
5634 | if (!isDef(key)) { return }
|
5635 |
|
5636 | var vm = vnode.context;
|
5637 | var ref = vnode.componentInstance || vnode.elm;
|
5638 | var refs = vm.$refs;
|
5639 | if (isRemoval) {
|
5640 | if (Array.isArray(refs[key])) {
|
5641 | remove(refs[key], ref);
|
5642 | } else if (refs[key] === ref) {
|
5643 | refs[key] = undefined;
|
5644 | }
|
5645 | } else {
|
5646 | if (vnode.data.refInFor) {
|
5647 | if (!Array.isArray(refs[key])) {
|
5648 | refs[key] = [ref];
|
5649 | } else if (refs[key].indexOf(ref) < 0) {
|
5650 |
|
5651 | refs[key].push(ref);
|
5652 | }
|
5653 | } else {
|
5654 | refs[key] = ref;
|
5655 | }
|
5656 | }
|
5657 | }
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 | var emptyNode = new VNode('', {}, []);
|
5672 |
|
5673 | var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
5674 |
|
5675 | function sameVnode (a, b) {
|
5676 | return (
|
5677 | a.key === b.key && (
|
5678 | (
|
5679 | a.tag === b.tag &&
|
5680 | a.isComment === b.isComment &&
|
5681 | isDef(a.data) === isDef(b.data) &&
|
5682 | sameInputType(a, b)
|
5683 | ) || (
|
5684 | isTrue(a.isAsyncPlaceholder) &&
|
5685 | a.asyncFactory === b.asyncFactory &&
|
5686 | isUndef(b.asyncFactory.error)
|
5687 | )
|
5688 | )
|
5689 | )
|
5690 | }
|
5691 |
|
5692 | function sameInputType (a, b) {
|
5693 | if (a.tag !== 'input') { return true }
|
5694 | var i;
|
5695 | var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
5696 | var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
5697 | return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
5698 | }
|
5699 |
|
5700 | function createKeyToOldIdx (children, beginIdx, endIdx) {
|
5701 | var i, key;
|
5702 | var map = {};
|
5703 | for (i = beginIdx; i <= endIdx; ++i) {
|
5704 | key = children[i].key;
|
5705 | if (isDef(key)) { map[key] = i; }
|
5706 | }
|
5707 | return map
|
5708 | }
|
5709 |
|
5710 | function createPatchFunction (backend) {
|
5711 | var i, j;
|
5712 | var cbs = {};
|
5713 |
|
5714 | var modules = backend.modules;
|
5715 | var nodeOps = backend.nodeOps;
|
5716 |
|
5717 | for (i = 0; i < hooks.length; ++i) {
|
5718 | cbs[hooks[i]] = [];
|
5719 | for (j = 0; j < modules.length; ++j) {
|
5720 | if (isDef(modules[j][hooks[i]])) {
|
5721 | cbs[hooks[i]].push(modules[j][hooks[i]]);
|
5722 | }
|
5723 | }
|
5724 | }
|
5725 |
|
5726 | function emptyNodeAt (elm) {
|
5727 | return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
5728 | }
|
5729 |
|
5730 | function createRmCb (childElm, listeners) {
|
5731 | function remove$$1 () {
|
5732 | if (--remove$$1.listeners === 0) {
|
5733 | removeNode(childElm);
|
5734 | }
|
5735 | }
|
5736 | remove$$1.listeners = listeners;
|
5737 | return remove$$1
|
5738 | }
|
5739 |
|
5740 | function removeNode (el) {
|
5741 | var parent = nodeOps.parentNode(el);
|
5742 |
|
5743 | if (isDef(parent)) {
|
5744 | nodeOps.removeChild(parent, el);
|
5745 | }
|
5746 | }
|
5747 |
|
5748 | function isUnknownElement$$1 (vnode, inVPre) {
|
5749 | return (
|
5750 | !inVPre &&
|
5751 | !vnode.ns &&
|
5752 | !(
|
5753 | config.ignoredElements.length &&
|
5754 | config.ignoredElements.some(function (ignore) {
|
5755 | return isRegExp(ignore)
|
5756 | ? ignore.test(vnode.tag)
|
5757 | : ignore === vnode.tag
|
5758 | })
|
5759 | ) &&
|
5760 | config.isUnknownElement(vnode.tag)
|
5761 | )
|
5762 | }
|
5763 |
|
5764 | var creatingElmInVPre = 0;
|
5765 |
|
5766 | function createElm (
|
5767 | vnode,
|
5768 | insertedVnodeQueue,
|
5769 | parentElm,
|
5770 | refElm,
|
5771 | nested,
|
5772 | ownerArray,
|
5773 | index
|
5774 | ) {
|
5775 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 | vnode = ownerArray[index] = cloneVNode(vnode);
|
5782 | }
|
5783 |
|
5784 | vnode.isRootInsert = !nested;
|
5785 | if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
5786 | return
|
5787 | }
|
5788 |
|
5789 | var data = vnode.data;
|
5790 | var children = vnode.children;
|
5791 | var tag = vnode.tag;
|
5792 | if (isDef(tag)) {
|
5793 | {
|
5794 | if (data && data.pre) {
|
5795 | creatingElmInVPre++;
|
5796 | }
|
5797 | if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
5798 | warn(
|
5799 | 'Unknown custom element: <' + tag + '> - did you ' +
|
5800 | 'register the component correctly? For recursive components, ' +
|
5801 | 'make sure to provide the "name" option.',
|
5802 | vnode.context
|
5803 | );
|
5804 | }
|
5805 | }
|
5806 |
|
5807 | vnode.elm = vnode.ns
|
5808 | ? nodeOps.createElementNS(vnode.ns, tag)
|
5809 | : nodeOps.createElement(tag, vnode);
|
5810 | setScope(vnode);
|
5811 |
|
5812 |
|
5813 | {
|
5814 | createChildren(vnode, children, insertedVnodeQueue);
|
5815 | if (isDef(data)) {
|
5816 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
5817 | }
|
5818 | insert(parentElm, vnode.elm, refElm);
|
5819 | }
|
5820 |
|
5821 | if (data && data.pre) {
|
5822 | creatingElmInVPre--;
|
5823 | }
|
5824 | } else if (isTrue(vnode.isComment)) {
|
5825 | vnode.elm = nodeOps.createComment(vnode.text);
|
5826 | insert(parentElm, vnode.elm, refElm);
|
5827 | } else {
|
5828 | vnode.elm = nodeOps.createTextNode(vnode.text);
|
5829 | insert(parentElm, vnode.elm, refElm);
|
5830 | }
|
5831 | }
|
5832 |
|
5833 | function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5834 | var i = vnode.data;
|
5835 | if (isDef(i)) {
|
5836 | var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
5837 | if (isDef(i = i.hook) && isDef(i = i.init)) {
|
5838 | i(vnode, false );
|
5839 | }
|
5840 |
|
5841 |
|
5842 |
|
5843 |
|
5844 | if (isDef(vnode.componentInstance)) {
|
5845 | initComponent(vnode, insertedVnodeQueue);
|
5846 | insert(parentElm, vnode.elm, refElm);
|
5847 | if (isTrue(isReactivated)) {
|
5848 | reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
5849 | }
|
5850 | return true
|
5851 | }
|
5852 | }
|
5853 | }
|
5854 |
|
5855 | function initComponent (vnode, insertedVnodeQueue) {
|
5856 | if (isDef(vnode.data.pendingInsert)) {
|
5857 | insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
5858 | vnode.data.pendingInsert = null;
|
5859 | }
|
5860 | vnode.elm = vnode.componentInstance.$el;
|
5861 | if (isPatchable(vnode)) {
|
5862 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
5863 | setScope(vnode);
|
5864 | } else {
|
5865 |
|
5866 |
|
5867 | registerRef(vnode);
|
5868 |
|
5869 | insertedVnodeQueue.push(vnode);
|
5870 | }
|
5871 | }
|
5872 |
|
5873 | function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5874 | var i;
|
5875 |
|
5876 |
|
5877 |
|
5878 |
|
5879 | var innerNode = vnode;
|
5880 | while (innerNode.componentInstance) {
|
5881 | innerNode = innerNode.componentInstance._vnode;
|
5882 | if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
5883 | for (i = 0; i < cbs.activate.length; ++i) {
|
5884 | cbs.activate[i](emptyNode, innerNode);
|
5885 | }
|
5886 | insertedVnodeQueue.push(innerNode);
|
5887 | break
|
5888 | }
|
5889 | }
|
5890 |
|
5891 |
|
5892 | insert(parentElm, vnode.elm, refElm);
|
5893 | }
|
5894 |
|
5895 | function insert (parent, elm, ref$$1) {
|
5896 | if (isDef(parent)) {
|
5897 | if (isDef(ref$$1)) {
|
5898 | if (nodeOps.parentNode(ref$$1) === parent) {
|
5899 | nodeOps.insertBefore(parent, elm, ref$$1);
|
5900 | }
|
5901 | } else {
|
5902 | nodeOps.appendChild(parent, elm);
|
5903 | }
|
5904 | }
|
5905 | }
|
5906 |
|
5907 | function createChildren (vnode, children, insertedVnodeQueue) {
|
5908 | if (Array.isArray(children)) {
|
5909 | {
|
5910 | checkDuplicateKeys(children);
|
5911 | }
|
5912 | for (var i = 0; i < children.length; ++i) {
|
5913 | createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
5914 | }
|
5915 | } else if (isPrimitive(vnode.text)) {
|
5916 | nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
5917 | }
|
5918 | }
|
5919 |
|
5920 | function isPatchable (vnode) {
|
5921 | while (vnode.componentInstance) {
|
5922 | vnode = vnode.componentInstance._vnode;
|
5923 | }
|
5924 | return isDef(vnode.tag)
|
5925 | }
|
5926 |
|
5927 | function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
5928 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
5929 | cbs.create[i$1](emptyNode, vnode);
|
5930 | }
|
5931 | i = vnode.data.hook;
|
5932 | if (isDef(i)) {
|
5933 | if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
5934 | if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
5935 | }
|
5936 | }
|
5937 |
|
5938 |
|
5939 |
|
5940 |
|
5941 | function setScope (vnode) {
|
5942 | var i;
|
5943 | if (isDef(i = vnode.fnScopeId)) {
|
5944 | nodeOps.setStyleScope(vnode.elm, i);
|
5945 | } else {
|
5946 | var ancestor = vnode;
|
5947 | while (ancestor) {
|
5948 | if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
5949 | nodeOps.setStyleScope(vnode.elm, i);
|
5950 | }
|
5951 | ancestor = ancestor.parent;
|
5952 | }
|
5953 | }
|
5954 |
|
5955 | if (isDef(i = activeInstance) &&
|
5956 | i !== vnode.context &&
|
5957 | i !== vnode.fnContext &&
|
5958 | isDef(i = i.$options._scopeId)
|
5959 | ) {
|
5960 | nodeOps.setStyleScope(vnode.elm, i);
|
5961 | }
|
5962 | }
|
5963 |
|
5964 | function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
5965 | for (; startIdx <= endIdx; ++startIdx) {
|
5966 | createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
5967 | }
|
5968 | }
|
5969 |
|
5970 | function invokeDestroyHook (vnode) {
|
5971 | var i, j;
|
5972 | var data = vnode.data;
|
5973 | if (isDef(data)) {
|
5974 | if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
5975 | for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
5976 | }
|
5977 | if (isDef(i = vnode.children)) {
|
5978 | for (j = 0; j < vnode.children.length; ++j) {
|
5979 | invokeDestroyHook(vnode.children[j]);
|
5980 | }
|
5981 | }
|
5982 | }
|
5983 |
|
5984 | function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
|
5985 | for (; startIdx <= endIdx; ++startIdx) {
|
5986 | var ch = vnodes[startIdx];
|
5987 | if (isDef(ch)) {
|
5988 | if (isDef(ch.tag)) {
|
5989 | removeAndInvokeRemoveHook(ch);
|
5990 | invokeDestroyHook(ch);
|
5991 | } else {
|
5992 | removeNode(ch.elm);
|
5993 | }
|
5994 | }
|
5995 | }
|
5996 | }
|
5997 |
|
5998 | function removeAndInvokeRemoveHook (vnode, rm) {
|
5999 | if (isDef(rm) || isDef(vnode.data)) {
|
6000 | var i;
|
6001 | var listeners = cbs.remove.length + 1;
|
6002 | if (isDef(rm)) {
|
6003 |
|
6004 |
|
6005 | rm.listeners += listeners;
|
6006 | } else {
|
6007 |
|
6008 | rm = createRmCb(vnode.elm, listeners);
|
6009 | }
|
6010 |
|
6011 | if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
6012 | removeAndInvokeRemoveHook(i, rm);
|
6013 | }
|
6014 | for (i = 0; i < cbs.remove.length; ++i) {
|
6015 | cbs.remove[i](vnode, rm);
|
6016 | }
|
6017 | if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
6018 | i(vnode, rm);
|
6019 | } else {
|
6020 | rm();
|
6021 | }
|
6022 | } else {
|
6023 | removeNode(vnode.elm);
|
6024 | }
|
6025 | }
|
6026 |
|
6027 | function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6028 | var oldStartIdx = 0;
|
6029 | var newStartIdx = 0;
|
6030 | var oldEndIdx = oldCh.length - 1;
|
6031 | var oldStartVnode = oldCh[0];
|
6032 | var oldEndVnode = oldCh[oldEndIdx];
|
6033 | var newEndIdx = newCh.length - 1;
|
6034 | var newStartVnode = newCh[0];
|
6035 | var newEndVnode = newCh[newEndIdx];
|
6036 | var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 | var canMove = !removeOnly;
|
6042 |
|
6043 | {
|
6044 | checkDuplicateKeys(newCh);
|
6045 | }
|
6046 |
|
6047 | while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6048 | if (isUndef(oldStartVnode)) {
|
6049 | oldStartVnode = oldCh[++oldStartIdx];
|
6050 | } else if (isUndef(oldEndVnode)) {
|
6051 | oldEndVnode = oldCh[--oldEndIdx];
|
6052 | } else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6053 | patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6054 | oldStartVnode = oldCh[++oldStartIdx];
|
6055 | newStartVnode = newCh[++newStartIdx];
|
6056 | } else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6057 | patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6058 | oldEndVnode = oldCh[--oldEndIdx];
|
6059 | newEndVnode = newCh[--newEndIdx];
|
6060 | } else if (sameVnode(oldStartVnode, newEndVnode)) {
|
6061 | patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6062 | canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6063 | oldStartVnode = oldCh[++oldStartIdx];
|
6064 | newEndVnode = newCh[--newEndIdx];
|
6065 | } else if (sameVnode(oldEndVnode, newStartVnode)) {
|
6066 | patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6067 | canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6068 | oldEndVnode = oldCh[--oldEndIdx];
|
6069 | newStartVnode = newCh[++newStartIdx];
|
6070 | } else {
|
6071 | if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
6072 | idxInOld = isDef(newStartVnode.key)
|
6073 | ? oldKeyToIdx[newStartVnode.key]
|
6074 | : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6075 | if (isUndef(idxInOld)) {
|
6076 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6077 | } else {
|
6078 | vnodeToMove = oldCh[idxInOld];
|
6079 | if (sameVnode(vnodeToMove, newStartVnode)) {
|
6080 | patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6081 | oldCh[idxInOld] = undefined;
|
6082 | canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6083 | } else {
|
6084 |
|
6085 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6086 | }
|
6087 | }
|
6088 | newStartVnode = newCh[++newStartIdx];
|
6089 | }
|
6090 | }
|
6091 | if (oldStartIdx > oldEndIdx) {
|
6092 | refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6093 | addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6094 | } else if (newStartIdx > newEndIdx) {
|
6095 | removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
6096 | }
|
6097 | }
|
6098 |
|
6099 | function checkDuplicateKeys (children) {
|
6100 | var seenKeys = {};
|
6101 | for (var i = 0; i < children.length; i++) {
|
6102 | var vnode = children[i];
|
6103 | var key = vnode.key;
|
6104 | if (isDef(key)) {
|
6105 | if (seenKeys[key]) {
|
6106 | warn(
|
6107 | ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
6108 | vnode.context
|
6109 | );
|
6110 | } else {
|
6111 | seenKeys[key] = true;
|
6112 | }
|
6113 | }
|
6114 | }
|
6115 | }
|
6116 |
|
6117 | function findIdxInOld (node, oldCh, start, end) {
|
6118 | for (var i = start; i < end; i++) {
|
6119 | var c = oldCh[i];
|
6120 | if (isDef(c) && sameVnode(node, c)) { return i }
|
6121 | }
|
6122 | }
|
6123 |
|
6124 | function patchVnode (
|
6125 | oldVnode,
|
6126 | vnode,
|
6127 | insertedVnodeQueue,
|
6128 | ownerArray,
|
6129 | index,
|
6130 | removeOnly
|
6131 | ) {
|
6132 | if (oldVnode === vnode) {
|
6133 | return
|
6134 | }
|
6135 |
|
6136 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6137 |
|
6138 | vnode = ownerArray[index] = cloneVNode(vnode);
|
6139 | }
|
6140 |
|
6141 | var elm = vnode.elm = oldVnode.elm;
|
6142 |
|
6143 | if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6144 | if (isDef(vnode.asyncFactory.resolved)) {
|
6145 | hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6146 | } else {
|
6147 | vnode.isAsyncPlaceholder = true;
|
6148 | }
|
6149 | return
|
6150 | }
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 | if (isTrue(vnode.isStatic) &&
|
6157 | isTrue(oldVnode.isStatic) &&
|
6158 | vnode.key === oldVnode.key &&
|
6159 | (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
6160 | ) {
|
6161 | vnode.componentInstance = oldVnode.componentInstance;
|
6162 | return
|
6163 | }
|
6164 |
|
6165 | var i;
|
6166 | var data = vnode.data;
|
6167 | if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
6168 | i(oldVnode, vnode);
|
6169 | }
|
6170 |
|
6171 | var oldCh = oldVnode.children;
|
6172 | var ch = vnode.children;
|
6173 | if (isDef(data) && isPatchable(vnode)) {
|
6174 | for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
6175 | if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
6176 | }
|
6177 | if (isUndef(vnode.text)) {
|
6178 | if (isDef(oldCh) && isDef(ch)) {
|
6179 | if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
6180 | } else if (isDef(ch)) {
|
6181 | {
|
6182 | checkDuplicateKeys(ch);
|
6183 | }
|
6184 | if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
6185 | addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6186 | } else if (isDef(oldCh)) {
|
6187 | removeVnodes(elm, oldCh, 0, oldCh.length - 1);
|
6188 | } else if (isDef(oldVnode.text)) {
|
6189 | nodeOps.setTextContent(elm, '');
|
6190 | }
|
6191 | } else if (oldVnode.text !== vnode.text) {
|
6192 | nodeOps.setTextContent(elm, vnode.text);
|
6193 | }
|
6194 | if (isDef(data)) {
|
6195 | if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
6196 | }
|
6197 | }
|
6198 |
|
6199 | function invokeInsertHook (vnode, queue, initial) {
|
6200 |
|
6201 |
|
6202 | if (isTrue(initial) && isDef(vnode.parent)) {
|
6203 | vnode.parent.data.pendingInsert = queue;
|
6204 | } else {
|
6205 | for (var i = 0; i < queue.length; ++i) {
|
6206 | queue[i].data.hook.insert(queue[i]);
|
6207 | }
|
6208 | }
|
6209 | }
|
6210 |
|
6211 | var hydrationBailed = false;
|
6212 |
|
6213 |
|
6214 |
|
6215 |
|
6216 | var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6217 |
|
6218 |
|
6219 | function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
6220 | var i;
|
6221 | var tag = vnode.tag;
|
6222 | var data = vnode.data;
|
6223 | var children = vnode.children;
|
6224 | inVPre = inVPre || (data && data.pre);
|
6225 | vnode.elm = elm;
|
6226 |
|
6227 | if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6228 | vnode.isAsyncPlaceholder = true;
|
6229 | return true
|
6230 | }
|
6231 |
|
6232 | {
|
6233 | if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6234 | return false
|
6235 | }
|
6236 | }
|
6237 | if (isDef(data)) {
|
6238 | if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true ); }
|
6239 | if (isDef(i = vnode.componentInstance)) {
|
6240 |
|
6241 | initComponent(vnode, insertedVnodeQueue);
|
6242 | return true
|
6243 | }
|
6244 | }
|
6245 | if (isDef(tag)) {
|
6246 | if (isDef(children)) {
|
6247 |
|
6248 | if (!elm.hasChildNodes()) {
|
6249 | createChildren(vnode, children, insertedVnodeQueue);
|
6250 | } else {
|
6251 |
|
6252 | if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
6253 | if (i !== elm.innerHTML) {
|
6254 |
|
6255 | if (typeof console !== 'undefined' &&
|
6256 | !hydrationBailed
|
6257 | ) {
|
6258 | hydrationBailed = true;
|
6259 | console.warn('Parent: ', elm);
|
6260 | console.warn('server innerHTML: ', i);
|
6261 | console.warn('client innerHTML: ', elm.innerHTML);
|
6262 | }
|
6263 | return false
|
6264 | }
|
6265 | } else {
|
6266 |
|
6267 | var childrenMatch = true;
|
6268 | var childNode = elm.firstChild;
|
6269 | for (var i$1 = 0; i$1 < children.length; i$1++) {
|
6270 | if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
6271 | childrenMatch = false;
|
6272 | break
|
6273 | }
|
6274 | childNode = childNode.nextSibling;
|
6275 | }
|
6276 |
|
6277 |
|
6278 | if (!childrenMatch || childNode) {
|
6279 |
|
6280 | if (typeof console !== 'undefined' &&
|
6281 | !hydrationBailed
|
6282 | ) {
|
6283 | hydrationBailed = true;
|
6284 | console.warn('Parent: ', elm);
|
6285 | console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
6286 | }
|
6287 | return false
|
6288 | }
|
6289 | }
|
6290 | }
|
6291 | }
|
6292 | if (isDef(data)) {
|
6293 | var fullInvoke = false;
|
6294 | for (var key in data) {
|
6295 | if (!isRenderedModule(key)) {
|
6296 | fullInvoke = true;
|
6297 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
6298 | break
|
6299 | }
|
6300 | }
|
6301 | if (!fullInvoke && data['class']) {
|
6302 |
|
6303 | traverse(data['class']);
|
6304 | }
|
6305 | }
|
6306 | } else if (elm.data !== vnode.text) {
|
6307 | elm.data = vnode.text;
|
6308 | }
|
6309 | return true
|
6310 | }
|
6311 |
|
6312 | function assertNodeMatch (node, vnode, inVPre) {
|
6313 | if (isDef(vnode.tag)) {
|
6314 | return vnode.tag.indexOf('vue-component') === 0 || (
|
6315 | !isUnknownElement$$1(vnode, inVPre) &&
|
6316 | vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
6317 | )
|
6318 | } else {
|
6319 | return node.nodeType === (vnode.isComment ? 8 : 3)
|
6320 | }
|
6321 | }
|
6322 |
|
6323 | return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
6324 | if (isUndef(vnode)) {
|
6325 | if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
6326 | return
|
6327 | }
|
6328 |
|
6329 | var isInitialPatch = false;
|
6330 | var insertedVnodeQueue = [];
|
6331 |
|
6332 | if (isUndef(oldVnode)) {
|
6333 |
|
6334 | isInitialPatch = true;
|
6335 | createElm(vnode, insertedVnodeQueue);
|
6336 | } else {
|
6337 | var isRealElement = isDef(oldVnode.nodeType);
|
6338 | if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
6339 |
|
6340 | patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
6341 | } else {
|
6342 | if (isRealElement) {
|
6343 |
|
6344 |
|
6345 |
|
6346 | if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
6347 | oldVnode.removeAttribute(SSR_ATTR);
|
6348 | hydrating = true;
|
6349 | }
|
6350 | if (isTrue(hydrating)) {
|
6351 | if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
6352 | invokeInsertHook(vnode, insertedVnodeQueue, true);
|
6353 | return oldVnode
|
6354 | } else {
|
6355 | warn(
|
6356 | 'The client-side rendered virtual DOM tree is not matching ' +
|
6357 | 'server-rendered content. This is likely caused by incorrect ' +
|
6358 | 'HTML markup, for example nesting block-level elements inside ' +
|
6359 | '<p>, or missing <tbody>. Bailing hydration and performing ' +
|
6360 | 'full client-side render.'
|
6361 | );
|
6362 | }
|
6363 | }
|
6364 |
|
6365 |
|
6366 | oldVnode = emptyNodeAt(oldVnode);
|
6367 | }
|
6368 |
|
6369 |
|
6370 | var oldElm = oldVnode.elm;
|
6371 | var parentElm = nodeOps.parentNode(oldElm);
|
6372 |
|
6373 |
|
6374 | createElm(
|
6375 | vnode,
|
6376 | insertedVnodeQueue,
|
6377 |
|
6378 |
|
6379 |
|
6380 | oldElm._leaveCb ? null : parentElm,
|
6381 | nodeOps.nextSibling(oldElm)
|
6382 | );
|
6383 |
|
6384 |
|
6385 | if (isDef(vnode.parent)) {
|
6386 | var ancestor = vnode.parent;
|
6387 | var patchable = isPatchable(vnode);
|
6388 | while (ancestor) {
|
6389 | for (var i = 0; i < cbs.destroy.length; ++i) {
|
6390 | cbs.destroy[i](ancestor);
|
6391 | }
|
6392 | ancestor.elm = vnode.elm;
|
6393 | if (patchable) {
|
6394 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6395 | cbs.create[i$1](emptyNode, ancestor);
|
6396 | }
|
6397 |
|
6398 |
|
6399 |
|
6400 | var insert = ancestor.data.hook.insert;
|
6401 | if (insert.merged) {
|
6402 |
|
6403 | for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
6404 | insert.fns[i$2]();
|
6405 | }
|
6406 | }
|
6407 | } else {
|
6408 | registerRef(ancestor);
|
6409 | }
|
6410 | ancestor = ancestor.parent;
|
6411 | }
|
6412 | }
|
6413 |
|
6414 |
|
6415 | if (isDef(parentElm)) {
|
6416 | removeVnodes(parentElm, [oldVnode], 0, 0);
|
6417 | } else if (isDef(oldVnode.tag)) {
|
6418 | invokeDestroyHook(oldVnode);
|
6419 | }
|
6420 | }
|
6421 | }
|
6422 |
|
6423 | invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
6424 | return vnode.elm
|
6425 | }
|
6426 | }
|
6427 |
|
6428 |
|
6429 |
|
6430 | var directives = {
|
6431 | create: updateDirectives,
|
6432 | update: updateDirectives,
|
6433 | destroy: function unbindDirectives (vnode) {
|
6434 | updateDirectives(vnode, emptyNode);
|
6435 | }
|
6436 | };
|
6437 |
|
6438 | function updateDirectives (oldVnode, vnode) {
|
6439 | if (oldVnode.data.directives || vnode.data.directives) {
|
6440 | _update(oldVnode, vnode);
|
6441 | }
|
6442 | }
|
6443 |
|
6444 | function _update (oldVnode, vnode) {
|
6445 | var isCreate = oldVnode === emptyNode;
|
6446 | var isDestroy = vnode === emptyNode;
|
6447 | var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
6448 | var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
6449 |
|
6450 | var dirsWithInsert = [];
|
6451 | var dirsWithPostpatch = [];
|
6452 |
|
6453 | var key, oldDir, dir;
|
6454 | for (key in newDirs) {
|
6455 | oldDir = oldDirs[key];
|
6456 | dir = newDirs[key];
|
6457 | if (!oldDir) {
|
6458 |
|
6459 | callHook$1(dir, 'bind', vnode, oldVnode);
|
6460 | if (dir.def && dir.def.inserted) {
|
6461 | dirsWithInsert.push(dir);
|
6462 | }
|
6463 | } else {
|
6464 |
|
6465 | dir.oldValue = oldDir.value;
|
6466 | dir.oldArg = oldDir.arg;
|
6467 | callHook$1(dir, 'update', vnode, oldVnode);
|
6468 | if (dir.def && dir.def.componentUpdated) {
|
6469 | dirsWithPostpatch.push(dir);
|
6470 | }
|
6471 | }
|
6472 | }
|
6473 |
|
6474 | if (dirsWithInsert.length) {
|
6475 | var callInsert = function () {
|
6476 | for (var i = 0; i < dirsWithInsert.length; i++) {
|
6477 | callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
6478 | }
|
6479 | };
|
6480 | if (isCreate) {
|
6481 | mergeVNodeHook(vnode, 'insert', callInsert);
|
6482 | } else {
|
6483 | callInsert();
|
6484 | }
|
6485 | }
|
6486 |
|
6487 | if (dirsWithPostpatch.length) {
|
6488 | mergeVNodeHook(vnode, 'postpatch', function () {
|
6489 | for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
6490 | callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
6491 | }
|
6492 | });
|
6493 | }
|
6494 |
|
6495 | if (!isCreate) {
|
6496 | for (key in oldDirs) {
|
6497 | if (!newDirs[key]) {
|
6498 |
|
6499 | callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
6500 | }
|
6501 | }
|
6502 | }
|
6503 | }
|
6504 |
|
6505 | var emptyModifiers = Object.create(null);
|
6506 |
|
6507 | function normalizeDirectives$1 (
|
6508 | dirs,
|
6509 | vm
|
6510 | ) {
|
6511 | var res = Object.create(null);
|
6512 | if (!dirs) {
|
6513 |
|
6514 | return res
|
6515 | }
|
6516 | var i, dir;
|
6517 | for (i = 0; i < dirs.length; i++) {
|
6518 | dir = dirs[i];
|
6519 | if (!dir.modifiers) {
|
6520 |
|
6521 | dir.modifiers = emptyModifiers;
|
6522 | }
|
6523 | res[getRawDirName(dir)] = dir;
|
6524 | dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
6525 | }
|
6526 |
|
6527 | return res
|
6528 | }
|
6529 |
|
6530 | function getRawDirName (dir) {
|
6531 | return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
6532 | }
|
6533 |
|
6534 | function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
6535 | var fn = dir.def && dir.def[hook];
|
6536 | if (fn) {
|
6537 | try {
|
6538 | fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
6539 | } catch (e) {
|
6540 | handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
6541 | }
|
6542 | }
|
6543 | }
|
6544 |
|
6545 | var baseModules = [
|
6546 | ref,
|
6547 | directives
|
6548 | ];
|
6549 |
|
6550 |
|
6551 |
|
6552 | function updateAttrs (oldVnode, vnode) {
|
6553 | var opts = vnode.componentOptions;
|
6554 | if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
6555 | return
|
6556 | }
|
6557 | if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
6558 | return
|
6559 | }
|
6560 | var key, cur, old;
|
6561 | var elm = vnode.elm;
|
6562 | var oldAttrs = oldVnode.data.attrs || {};
|
6563 | var attrs = vnode.data.attrs || {};
|
6564 |
|
6565 | if (isDef(attrs.__ob__)) {
|
6566 | attrs = vnode.data.attrs = extend({}, attrs);
|
6567 | }
|
6568 |
|
6569 | for (key in attrs) {
|
6570 | cur = attrs[key];
|
6571 | old = oldAttrs[key];
|
6572 | if (old !== cur) {
|
6573 | setAttr(elm, key, cur);
|
6574 | }
|
6575 | }
|
6576 |
|
6577 |
|
6578 |
|
6579 | if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
6580 | setAttr(elm, 'value', attrs.value);
|
6581 | }
|
6582 | for (key in oldAttrs) {
|
6583 | if (isUndef(attrs[key])) {
|
6584 | if (isXlink(key)) {
|
6585 | elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6586 | } else if (!isEnumeratedAttr(key)) {
|
6587 | elm.removeAttribute(key);
|
6588 | }
|
6589 | }
|
6590 | }
|
6591 | }
|
6592 |
|
6593 | function setAttr (el, key, value) {
|
6594 | if (el.tagName.indexOf('-') > -1) {
|
6595 | baseSetAttr(el, key, value);
|
6596 | } else if (isBooleanAttr(key)) {
|
6597 |
|
6598 |
|
6599 | if (isFalsyAttrValue(value)) {
|
6600 | el.removeAttribute(key);
|
6601 | } else {
|
6602 |
|
6603 |
|
6604 | value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
6605 | ? 'true'
|
6606 | : key;
|
6607 | el.setAttribute(key, value);
|
6608 | }
|
6609 | } else if (isEnumeratedAttr(key)) {
|
6610 | el.setAttribute(key, convertEnumeratedValue(key, value));
|
6611 | } else if (isXlink(key)) {
|
6612 | if (isFalsyAttrValue(value)) {
|
6613 | el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6614 | } else {
|
6615 | el.setAttributeNS(xlinkNS, key, value);
|
6616 | }
|
6617 | } else {
|
6618 | baseSetAttr(el, key, value);
|
6619 | }
|
6620 | }
|
6621 |
|
6622 | function baseSetAttr (el, key, value) {
|
6623 | if (isFalsyAttrValue(value)) {
|
6624 | el.removeAttribute(key);
|
6625 | } else {
|
6626 |
|
6627 |
|
6628 |
|
6629 |
|
6630 | if (
|
6631 | isIE && !isIE9 &&
|
6632 | (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') &&
|
6633 | key === 'placeholder' && !el.__ieph
|
6634 | ) {
|
6635 | var blocker = function (e) {
|
6636 | e.stopImmediatePropagation();
|
6637 | el.removeEventListener('input', blocker);
|
6638 | };
|
6639 | el.addEventListener('input', blocker);
|
6640 |
|
6641 | el.__ieph = true;
|
6642 | }
|
6643 | el.setAttribute(key, value);
|
6644 | }
|
6645 | }
|
6646 |
|
6647 | var attrs = {
|
6648 | create: updateAttrs,
|
6649 | update: updateAttrs
|
6650 | };
|
6651 |
|
6652 |
|
6653 |
|
6654 | function updateClass (oldVnode, vnode) {
|
6655 | var el = vnode.elm;
|
6656 | var data = vnode.data;
|
6657 | var oldData = oldVnode.data;
|
6658 | if (
|
6659 | isUndef(data.staticClass) &&
|
6660 | isUndef(data.class) && (
|
6661 | isUndef(oldData) || (
|
6662 | isUndef(oldData.staticClass) &&
|
6663 | isUndef(oldData.class)
|
6664 | )
|
6665 | )
|
6666 | ) {
|
6667 | return
|
6668 | }
|
6669 |
|
6670 | var cls = genClassForVnode(vnode);
|
6671 |
|
6672 |
|
6673 | var transitionClass = el._transitionClasses;
|
6674 | if (isDef(transitionClass)) {
|
6675 | cls = concat(cls, stringifyClass(transitionClass));
|
6676 | }
|
6677 |
|
6678 |
|
6679 | if (cls !== el._prevClass) {
|
6680 | el.setAttribute('class', cls);
|
6681 | el._prevClass = cls;
|
6682 | }
|
6683 | }
|
6684 |
|
6685 | var klass = {
|
6686 | create: updateClass,
|
6687 | update: updateClass
|
6688 | };
|
6689 |
|
6690 |
|
6691 |
|
6692 |
|
6693 |
|
6694 |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 | var RANGE_TOKEN = '__r';
|
6701 | var CHECKBOX_RADIO_TOKEN = '__c';
|
6702 |
|
6703 |
|
6704 |
|
6705 |
|
6706 |
|
6707 |
|
6708 |
|
6709 | function normalizeEvents (on) {
|
6710 |
|
6711 | if (isDef(on[RANGE_TOKEN])) {
|
6712 |
|
6713 | var event = isIE ? 'change' : 'input';
|
6714 | on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
6715 | delete on[RANGE_TOKEN];
|
6716 | }
|
6717 |
|
6718 |
|
6719 |
|
6720 | if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
6721 | on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
6722 | delete on[CHECKBOX_RADIO_TOKEN];
|
6723 | }
|
6724 | }
|
6725 |
|
6726 | var target$1;
|
6727 |
|
6728 | function createOnceHandler$1 (event, handler, capture) {
|
6729 | var _target = target$1;
|
6730 | return function onceHandler () {
|
6731 | var res = handler.apply(null, arguments);
|
6732 | if (res !== null) {
|
6733 | remove$2(event, onceHandler, capture, _target);
|
6734 | }
|
6735 | }
|
6736 | }
|
6737 |
|
6738 | function add$1 (
|
6739 | name,
|
6740 | handler,
|
6741 | capture,
|
6742 | passive
|
6743 | ) {
|
6744 |
|
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 | if (isUsingMicroTask) {
|
6751 | var attachedTimestamp = currentFlushTimestamp;
|
6752 | var original = handler;
|
6753 | handler = original._wrapper = function (e) {
|
6754 | if (e.timeStamp >= attachedTimestamp) {
|
6755 | return original.apply(this, arguments)
|
6756 | }
|
6757 | };
|
6758 | }
|
6759 | target$1.addEventListener(
|
6760 | name,
|
6761 | handler,
|
6762 | supportsPassive
|
6763 | ? { capture: capture, passive: passive }
|
6764 | : capture
|
6765 | );
|
6766 | }
|
6767 |
|
6768 | function remove$2 (
|
6769 | name,
|
6770 | handler,
|
6771 | capture,
|
6772 | _target
|
6773 | ) {
|
6774 | (_target || target$1).removeEventListener(
|
6775 | name,
|
6776 | handler._wrapper || handler,
|
6777 | capture
|
6778 | );
|
6779 | }
|
6780 |
|
6781 | function updateDOMListeners (oldVnode, vnode) {
|
6782 | if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
6783 | return
|
6784 | }
|
6785 | var on = vnode.data.on || {};
|
6786 | var oldOn = oldVnode.data.on || {};
|
6787 | target$1 = vnode.elm;
|
6788 | normalizeEvents(on);
|
6789 | updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
6790 | target$1 = undefined;
|
6791 | }
|
6792 |
|
6793 | var events = {
|
6794 | create: updateDOMListeners,
|
6795 | update: updateDOMListeners
|
6796 | };
|
6797 |
|
6798 |
|
6799 |
|
6800 | var svgContainer;
|
6801 |
|
6802 | function updateDOMProps (oldVnode, vnode) {
|
6803 | if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
6804 | return
|
6805 | }
|
6806 | var key, cur;
|
6807 | var elm = vnode.elm;
|
6808 | var oldProps = oldVnode.data.domProps || {};
|
6809 | var props = vnode.data.domProps || {};
|
6810 |
|
6811 | if (isDef(props.__ob__)) {
|
6812 | props = vnode.data.domProps = extend({}, props);
|
6813 | }
|
6814 |
|
6815 | for (key in oldProps) {
|
6816 | if (isUndef(props[key])) {
|
6817 | elm[key] = '';
|
6818 | }
|
6819 | }
|
6820 | for (key in props) {
|
6821 | cur = props[key];
|
6822 |
|
6823 |
|
6824 |
|
6825 | if (key === 'textContent' || key === 'innerHTML') {
|
6826 | if (vnode.children) { vnode.children.length = 0; }
|
6827 | if (cur === oldProps[key]) { continue }
|
6828 |
|
6829 |
|
6830 | if (elm.childNodes.length === 1) {
|
6831 | elm.removeChild(elm.childNodes[0]);
|
6832 | }
|
6833 | }
|
6834 |
|
6835 |
|
6836 |
|
6837 |
|
6838 |
|
6839 | if (key !== 'value' && cur === oldProps[key]) {
|
6840 | continue
|
6841 | }
|
6842 |
|
6843 | if (key === 'value') {
|
6844 |
|
6845 |
|
6846 | elm._value = cur;
|
6847 |
|
6848 | var strCur = isUndef(cur) ? '' : String(cur);
|
6849 | if (shouldUpdateValue(elm, strCur)) {
|
6850 | elm.value = strCur;
|
6851 | }
|
6852 | } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
6853 |
|
6854 | svgContainer = svgContainer || document.createElement('div');
|
6855 | svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
6856 | var svg = svgContainer.firstChild;
|
6857 | while (elm.firstChild) {
|
6858 | elm.removeChild(elm.firstChild);
|
6859 | }
|
6860 | while (svg.firstChild) {
|
6861 | elm.appendChild(svg.firstChild);
|
6862 | }
|
6863 | } else {
|
6864 | elm[key] = cur;
|
6865 | }
|
6866 | }
|
6867 | }
|
6868 |
|
6869 |
|
6870 |
|
6871 |
|
6872 | function shouldUpdateValue (elm, checkVal) {
|
6873 | return (!elm.composing && (
|
6874 | elm.tagName === 'OPTION' ||
|
6875 | isNotInFocusAndDirty(elm, checkVal) ||
|
6876 | isDirtyWithModifiers(elm, checkVal)
|
6877 | ))
|
6878 | }
|
6879 |
|
6880 | function isNotInFocusAndDirty (elm, checkVal) {
|
6881 |
|
6882 |
|
6883 | var notInFocus = true;
|
6884 |
|
6885 |
|
6886 | try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
6887 | return notInFocus && elm.value !== checkVal
|
6888 | }
|
6889 |
|
6890 | function isDirtyWithModifiers (elm, newVal) {
|
6891 | var value = elm.value;
|
6892 | var modifiers = elm._vModifiers;
|
6893 | if (isDef(modifiers)) {
|
6894 | if (modifiers.number) {
|
6895 | return toNumber(value) !== toNumber(newVal)
|
6896 | }
|
6897 | if (modifiers.trim) {
|
6898 | return value.trim() !== newVal.trim()
|
6899 | }
|
6900 | }
|
6901 | return value !== newVal
|
6902 | }
|
6903 |
|
6904 | var domProps = {
|
6905 | create: updateDOMProps,
|
6906 | update: updateDOMProps
|
6907 | };
|
6908 |
|
6909 |
|
6910 |
|
6911 | var parseStyleText = cached(function (cssText) {
|
6912 | var res = {};
|
6913 | var listDelimiter = /;(?![^(]*\))/g;
|
6914 | var propertyDelimiter = /:(.+)/;
|
6915 | cssText.split(listDelimiter).forEach(function (item) {
|
6916 | if (item) {
|
6917 | var tmp = item.split(propertyDelimiter);
|
6918 | tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
6919 | }
|
6920 | });
|
6921 | return res
|
6922 | });
|
6923 |
|
6924 |
|
6925 | function normalizeStyleData (data) {
|
6926 | var style = normalizeStyleBinding(data.style);
|
6927 |
|
6928 |
|
6929 | return data.staticStyle
|
6930 | ? extend(data.staticStyle, style)
|
6931 | : style
|
6932 | }
|
6933 |
|
6934 |
|
6935 | function normalizeStyleBinding (bindingStyle) {
|
6936 | if (Array.isArray(bindingStyle)) {
|
6937 | return toObject(bindingStyle)
|
6938 | }
|
6939 | if (typeof bindingStyle === 'string') {
|
6940 | return parseStyleText(bindingStyle)
|
6941 | }
|
6942 | return bindingStyle
|
6943 | }
|
6944 |
|
6945 |
|
6946 |
|
6947 |
|
6948 |
|
6949 | function getStyle (vnode, checkChild) {
|
6950 | var res = {};
|
6951 | var styleData;
|
6952 |
|
6953 | if (checkChild) {
|
6954 | var childNode = vnode;
|
6955 | while (childNode.componentInstance) {
|
6956 | childNode = childNode.componentInstance._vnode;
|
6957 | if (
|
6958 | childNode && childNode.data &&
|
6959 | (styleData = normalizeStyleData(childNode.data))
|
6960 | ) {
|
6961 | extend(res, styleData);
|
6962 | }
|
6963 | }
|
6964 | }
|
6965 |
|
6966 | if ((styleData = normalizeStyleData(vnode.data))) {
|
6967 | extend(res, styleData);
|
6968 | }
|
6969 |
|
6970 | var parentNode = vnode;
|
6971 | while ((parentNode = parentNode.parent)) {
|
6972 | if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
6973 | extend(res, styleData);
|
6974 | }
|
6975 | }
|
6976 | return res
|
6977 | }
|
6978 |
|
6979 |
|
6980 |
|
6981 | var cssVarRE = /^--/;
|
6982 | var importantRE = /\s*!important$/;
|
6983 | var setProp = function (el, name, val) {
|
6984 |
|
6985 | if (cssVarRE.test(name)) {
|
6986 | el.style.setProperty(name, val);
|
6987 | } else if (importantRE.test(val)) {
|
6988 | el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
6989 | } else {
|
6990 | var normalizedName = normalize(name);
|
6991 | if (Array.isArray(val)) {
|
6992 |
|
6993 |
|
6994 |
|
6995 | for (var i = 0, len = val.length; i < len; i++) {
|
6996 | el.style[normalizedName] = val[i];
|
6997 | }
|
6998 | } else {
|
6999 | el.style[normalizedName] = val;
|
7000 | }
|
7001 | }
|
7002 | };
|
7003 |
|
7004 | var vendorNames = ['Webkit', 'Moz', 'ms'];
|
7005 |
|
7006 | var emptyStyle;
|
7007 | var normalize = cached(function (prop) {
|
7008 | emptyStyle = emptyStyle || document.createElement('div').style;
|
7009 | prop = camelize(prop);
|
7010 | if (prop !== 'filter' && (prop in emptyStyle)) {
|
7011 | return prop
|
7012 | }
|
7013 | var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
7014 | for (var i = 0; i < vendorNames.length; i++) {
|
7015 | var name = vendorNames[i] + capName;
|
7016 | if (name in emptyStyle) {
|
7017 | return name
|
7018 | }
|
7019 | }
|
7020 | });
|
7021 |
|
7022 | function updateStyle (oldVnode, vnode) {
|
7023 | var data = vnode.data;
|
7024 | var oldData = oldVnode.data;
|
7025 |
|
7026 | if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
7027 | isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
7028 | ) {
|
7029 | return
|
7030 | }
|
7031 |
|
7032 | var cur, name;
|
7033 | var el = vnode.elm;
|
7034 | var oldStaticStyle = oldData.staticStyle;
|
7035 | var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
7036 |
|
7037 |
|
7038 | var oldStyle = oldStaticStyle || oldStyleBinding;
|
7039 |
|
7040 | var style = normalizeStyleBinding(vnode.data.style) || {};
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 | vnode.data.normalizedStyle = isDef(style.__ob__)
|
7046 | ? extend({}, style)
|
7047 | : style;
|
7048 |
|
7049 | var newStyle = getStyle(vnode, true);
|
7050 |
|
7051 | for (name in oldStyle) {
|
7052 | if (isUndef(newStyle[name])) {
|
7053 | setProp(el, name, '');
|
7054 | }
|
7055 | }
|
7056 | for (name in newStyle) {
|
7057 | cur = newStyle[name];
|
7058 | if (cur !== oldStyle[name]) {
|
7059 |
|
7060 | setProp(el, name, cur == null ? '' : cur);
|
7061 | }
|
7062 | }
|
7063 | }
|
7064 |
|
7065 | var style = {
|
7066 | create: updateStyle,
|
7067 | update: updateStyle
|
7068 | };
|
7069 |
|
7070 |
|
7071 |
|
7072 | var whitespaceRE = /\s+/;
|
7073 |
|
7074 |
|
7075 |
|
7076 |
|
7077 |
|
7078 | function addClass (el, cls) {
|
7079 |
|
7080 | if (!cls || !(cls = cls.trim())) {
|
7081 | return
|
7082 | }
|
7083 |
|
7084 |
|
7085 | if (el.classList) {
|
7086 | if (cls.indexOf(' ') > -1) {
|
7087 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
7088 | } else {
|
7089 | el.classList.add(cls);
|
7090 | }
|
7091 | } else {
|
7092 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7093 | if (cur.indexOf(' ' + cls + ' ') < 0) {
|
7094 | el.setAttribute('class', (cur + cls).trim());
|
7095 | }
|
7096 | }
|
7097 | }
|
7098 |
|
7099 |
|
7100 |
|
7101 |
|
7102 |
|
7103 | function removeClass (el, cls) {
|
7104 |
|
7105 | if (!cls || !(cls = cls.trim())) {
|
7106 | return
|
7107 | }
|
7108 |
|
7109 |
|
7110 | if (el.classList) {
|
7111 | if (cls.indexOf(' ') > -1) {
|
7112 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
7113 | } else {
|
7114 | el.classList.remove(cls);
|
7115 | }
|
7116 | if (!el.classList.length) {
|
7117 | el.removeAttribute('class');
|
7118 | }
|
7119 | } else {
|
7120 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7121 | var tar = ' ' + cls + ' ';
|
7122 | while (cur.indexOf(tar) >= 0) {
|
7123 | cur = cur.replace(tar, ' ');
|
7124 | }
|
7125 | cur = cur.trim();
|
7126 | if (cur) {
|
7127 | el.setAttribute('class', cur);
|
7128 | } else {
|
7129 | el.removeAttribute('class');
|
7130 | }
|
7131 | }
|
7132 | }
|
7133 |
|
7134 |
|
7135 |
|
7136 | function resolveTransition (def$$1) {
|
7137 | if (!def$$1) {
|
7138 | return
|
7139 | }
|
7140 |
|
7141 | if (typeof def$$1 === 'object') {
|
7142 | var res = {};
|
7143 | if (def$$1.css !== false) {
|
7144 | extend(res, autoCssTransition(def$$1.name || 'v'));
|
7145 | }
|
7146 | extend(res, def$$1);
|
7147 | return res
|
7148 | } else if (typeof def$$1 === 'string') {
|
7149 | return autoCssTransition(def$$1)
|
7150 | }
|
7151 | }
|
7152 |
|
7153 | var autoCssTransition = cached(function (name) {
|
7154 | return {
|
7155 | enterClass: (name + "-enter"),
|
7156 | enterToClass: (name + "-enter-to"),
|
7157 | enterActiveClass: (name + "-enter-active"),
|
7158 | leaveClass: (name + "-leave"),
|
7159 | leaveToClass: (name + "-leave-to"),
|
7160 | leaveActiveClass: (name + "-leave-active")
|
7161 | }
|
7162 | });
|
7163 |
|
7164 | var hasTransition = inBrowser && !isIE9;
|
7165 | var TRANSITION = 'transition';
|
7166 | var ANIMATION = 'animation';
|
7167 |
|
7168 |
|
7169 | var transitionProp = 'transition';
|
7170 | var transitionEndEvent = 'transitionend';
|
7171 | var animationProp = 'animation';
|
7172 | var animationEndEvent = 'animationend';
|
7173 | if (hasTransition) {
|
7174 |
|
7175 | if (window.ontransitionend === undefined &&
|
7176 | window.onwebkittransitionend !== undefined
|
7177 | ) {
|
7178 | transitionProp = 'WebkitTransition';
|
7179 | transitionEndEvent = 'webkitTransitionEnd';
|
7180 | }
|
7181 | if (window.onanimationend === undefined &&
|
7182 | window.onwebkitanimationend !== undefined
|
7183 | ) {
|
7184 | animationProp = 'WebkitAnimation';
|
7185 | animationEndEvent = 'webkitAnimationEnd';
|
7186 | }
|
7187 | }
|
7188 |
|
7189 |
|
7190 | var raf = inBrowser
|
7191 | ? window.requestAnimationFrame
|
7192 | ? window.requestAnimationFrame.bind(window)
|
7193 | : setTimeout
|
7194 | : function (fn) { return fn(); };
|
7195 |
|
7196 | function nextFrame (fn) {
|
7197 | raf(function () {
|
7198 | raf(fn);
|
7199 | });
|
7200 | }
|
7201 |
|
7202 | function addTransitionClass (el, cls) {
|
7203 | var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
7204 | if (transitionClasses.indexOf(cls) < 0) {
|
7205 | transitionClasses.push(cls);
|
7206 | addClass(el, cls);
|
7207 | }
|
7208 | }
|
7209 |
|
7210 | function removeTransitionClass (el, cls) {
|
7211 | if (el._transitionClasses) {
|
7212 | remove(el._transitionClasses, cls);
|
7213 | }
|
7214 | removeClass(el, cls);
|
7215 | }
|
7216 |
|
7217 | function whenTransitionEnds (
|
7218 | el,
|
7219 | expectedType,
|
7220 | cb
|
7221 | ) {
|
7222 | var ref = getTransitionInfo(el, expectedType);
|
7223 | var type = ref.type;
|
7224 | var timeout = ref.timeout;
|
7225 | var propCount = ref.propCount;
|
7226 | if (!type) { return cb() }
|
7227 | var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
7228 | var ended = 0;
|
7229 | var end = function () {
|
7230 | el.removeEventListener(event, onEnd);
|
7231 | cb();
|
7232 | };
|
7233 | var onEnd = function (e) {
|
7234 | if (e.target === el) {
|
7235 | if (++ended >= propCount) {
|
7236 | end();
|
7237 | }
|
7238 | }
|
7239 | };
|
7240 | setTimeout(function () {
|
7241 | if (ended < propCount) {
|
7242 | end();
|
7243 | }
|
7244 | }, timeout + 1);
|
7245 | el.addEventListener(event, onEnd);
|
7246 | }
|
7247 |
|
7248 | var transformRE = /\b(transform|all)(,|$)/;
|
7249 |
|
7250 | function getTransitionInfo (el, expectedType) {
|
7251 | var styles = window.getComputedStyle(el);
|
7252 |
|
7253 | var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
7254 | var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
7255 | var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
7256 | var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
7257 | var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
7258 | var animationTimeout = getTimeout(animationDelays, animationDurations);
|
7259 |
|
7260 | var type;
|
7261 | var timeout = 0;
|
7262 | var propCount = 0;
|
7263 |
|
7264 | if (expectedType === TRANSITION) {
|
7265 | if (transitionTimeout > 0) {
|
7266 | type = TRANSITION;
|
7267 | timeout = transitionTimeout;
|
7268 | propCount = transitionDurations.length;
|
7269 | }
|
7270 | } else if (expectedType === ANIMATION) {
|
7271 | if (animationTimeout > 0) {
|
7272 | type = ANIMATION;
|
7273 | timeout = animationTimeout;
|
7274 | propCount = animationDurations.length;
|
7275 | }
|
7276 | } else {
|
7277 | timeout = Math.max(transitionTimeout, animationTimeout);
|
7278 | type = timeout > 0
|
7279 | ? transitionTimeout > animationTimeout
|
7280 | ? TRANSITION
|
7281 | : ANIMATION
|
7282 | : null;
|
7283 | propCount = type
|
7284 | ? type === TRANSITION
|
7285 | ? transitionDurations.length
|
7286 | : animationDurations.length
|
7287 | : 0;
|
7288 | }
|
7289 | var hasTransform =
|
7290 | type === TRANSITION &&
|
7291 | transformRE.test(styles[transitionProp + 'Property']);
|
7292 | return {
|
7293 | type: type,
|
7294 | timeout: timeout,
|
7295 | propCount: propCount,
|
7296 | hasTransform: hasTransform
|
7297 | }
|
7298 | }
|
7299 |
|
7300 | function getTimeout (delays, durations) {
|
7301 |
|
7302 | while (delays.length < durations.length) {
|
7303 | delays = delays.concat(delays);
|
7304 | }
|
7305 |
|
7306 | return Math.max.apply(null, durations.map(function (d, i) {
|
7307 | return toMs(d) + toMs(delays[i])
|
7308 | }))
|
7309 | }
|
7310 |
|
7311 |
|
7312 |
|
7313 |
|
7314 |
|
7315 | function toMs (s) {
|
7316 | return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
7317 | }
|
7318 |
|
7319 |
|
7320 |
|
7321 | function enter (vnode, toggleDisplay) {
|
7322 | var el = vnode.elm;
|
7323 |
|
7324 |
|
7325 | if (isDef(el._leaveCb)) {
|
7326 | el._leaveCb.cancelled = true;
|
7327 | el._leaveCb();
|
7328 | }
|
7329 |
|
7330 | var data = resolveTransition(vnode.data.transition);
|
7331 | if (isUndef(data)) {
|
7332 | return
|
7333 | }
|
7334 |
|
7335 |
|
7336 | if (isDef(el._enterCb) || el.nodeType !== 1) {
|
7337 | return
|
7338 | }
|
7339 |
|
7340 | var css = data.css;
|
7341 | var type = data.type;
|
7342 | var enterClass = data.enterClass;
|
7343 | var enterToClass = data.enterToClass;
|
7344 | var enterActiveClass = data.enterActiveClass;
|
7345 | var appearClass = data.appearClass;
|
7346 | var appearToClass = data.appearToClass;
|
7347 | var appearActiveClass = data.appearActiveClass;
|
7348 | var beforeEnter = data.beforeEnter;
|
7349 | var enter = data.enter;
|
7350 | var afterEnter = data.afterEnter;
|
7351 | var enterCancelled = data.enterCancelled;
|
7352 | var beforeAppear = data.beforeAppear;
|
7353 | var appear = data.appear;
|
7354 | var afterAppear = data.afterAppear;
|
7355 | var appearCancelled = data.appearCancelled;
|
7356 | var duration = data.duration;
|
7357 |
|
7358 |
|
7359 |
|
7360 |
|
7361 |
|
7362 | var context = activeInstance;
|
7363 | var transitionNode = activeInstance.$vnode;
|
7364 | while (transitionNode && transitionNode.parent) {
|
7365 | transitionNode = transitionNode.parent;
|
7366 | context = transitionNode.context;
|
7367 | }
|
7368 |
|
7369 | var isAppear = !context._isMounted || !vnode.isRootInsert;
|
7370 |
|
7371 | if (isAppear && !appear && appear !== '') {
|
7372 | return
|
7373 | }
|
7374 |
|
7375 | var startClass = isAppear && appearClass
|
7376 | ? appearClass
|
7377 | : enterClass;
|
7378 | var activeClass = isAppear && appearActiveClass
|
7379 | ? appearActiveClass
|
7380 | : enterActiveClass;
|
7381 | var toClass = isAppear && appearToClass
|
7382 | ? appearToClass
|
7383 | : enterToClass;
|
7384 |
|
7385 | var beforeEnterHook = isAppear
|
7386 | ? (beforeAppear || beforeEnter)
|
7387 | : beforeEnter;
|
7388 | var enterHook = isAppear
|
7389 | ? (typeof appear === 'function' ? appear : enter)
|
7390 | : enter;
|
7391 | var afterEnterHook = isAppear
|
7392 | ? (afterAppear || afterEnter)
|
7393 | : afterEnter;
|
7394 | var enterCancelledHook = isAppear
|
7395 | ? (appearCancelled || enterCancelled)
|
7396 | : enterCancelled;
|
7397 |
|
7398 | var explicitEnterDuration = toNumber(
|
7399 | isObject(duration)
|
7400 | ? duration.enter
|
7401 | : duration
|
7402 | );
|
7403 |
|
7404 | if (explicitEnterDuration != null) {
|
7405 | checkDuration(explicitEnterDuration, 'enter', vnode);
|
7406 | }
|
7407 |
|
7408 | var expectsCSS = css !== false && !isIE9;
|
7409 | var userWantsControl = getHookArgumentsLength(enterHook);
|
7410 |
|
7411 | var cb = el._enterCb = once(function () {
|
7412 | if (expectsCSS) {
|
7413 | removeTransitionClass(el, toClass);
|
7414 | removeTransitionClass(el, activeClass);
|
7415 | }
|
7416 | if (cb.cancelled) {
|
7417 | if (expectsCSS) {
|
7418 | removeTransitionClass(el, startClass);
|
7419 | }
|
7420 | enterCancelledHook && enterCancelledHook(el);
|
7421 | } else {
|
7422 | afterEnterHook && afterEnterHook(el);
|
7423 | }
|
7424 | el._enterCb = null;
|
7425 | });
|
7426 |
|
7427 | if (!vnode.data.show) {
|
7428 |
|
7429 | mergeVNodeHook(vnode, 'insert', function () {
|
7430 | var parent = el.parentNode;
|
7431 | var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
7432 | if (pendingNode &&
|
7433 | pendingNode.tag === vnode.tag &&
|
7434 | pendingNode.elm._leaveCb
|
7435 | ) {
|
7436 | pendingNode.elm._leaveCb();
|
7437 | }
|
7438 | enterHook && enterHook(el, cb);
|
7439 | });
|
7440 | }
|
7441 |
|
7442 |
|
7443 | beforeEnterHook && beforeEnterHook(el);
|
7444 | if (expectsCSS) {
|
7445 | addTransitionClass(el, startClass);
|
7446 | addTransitionClass(el, activeClass);
|
7447 | nextFrame(function () {
|
7448 | removeTransitionClass(el, startClass);
|
7449 | if (!cb.cancelled) {
|
7450 | addTransitionClass(el, toClass);
|
7451 | if (!userWantsControl) {
|
7452 | if (isValidDuration(explicitEnterDuration)) {
|
7453 | setTimeout(cb, explicitEnterDuration);
|
7454 | } else {
|
7455 | whenTransitionEnds(el, type, cb);
|
7456 | }
|
7457 | }
|
7458 | }
|
7459 | });
|
7460 | }
|
7461 |
|
7462 | if (vnode.data.show) {
|
7463 | toggleDisplay && toggleDisplay();
|
7464 | enterHook && enterHook(el, cb);
|
7465 | }
|
7466 |
|
7467 | if (!expectsCSS && !userWantsControl) {
|
7468 | cb();
|
7469 | }
|
7470 | }
|
7471 |
|
7472 | function leave (vnode, rm) {
|
7473 | var el = vnode.elm;
|
7474 |
|
7475 |
|
7476 | if (isDef(el._enterCb)) {
|
7477 | el._enterCb.cancelled = true;
|
7478 | el._enterCb();
|
7479 | }
|
7480 |
|
7481 | var data = resolveTransition(vnode.data.transition);
|
7482 | if (isUndef(data) || el.nodeType !== 1) {
|
7483 | return rm()
|
7484 | }
|
7485 |
|
7486 |
|
7487 | if (isDef(el._leaveCb)) {
|
7488 | return
|
7489 | }
|
7490 |
|
7491 | var css = data.css;
|
7492 | var type = data.type;
|
7493 | var leaveClass = data.leaveClass;
|
7494 | var leaveToClass = data.leaveToClass;
|
7495 | var leaveActiveClass = data.leaveActiveClass;
|
7496 | var beforeLeave = data.beforeLeave;
|
7497 | var leave = data.leave;
|
7498 | var afterLeave = data.afterLeave;
|
7499 | var leaveCancelled = data.leaveCancelled;
|
7500 | var delayLeave = data.delayLeave;
|
7501 | var duration = data.duration;
|
7502 |
|
7503 | var expectsCSS = css !== false && !isIE9;
|
7504 | var userWantsControl = getHookArgumentsLength(leave);
|
7505 |
|
7506 | var explicitLeaveDuration = toNumber(
|
7507 | isObject(duration)
|
7508 | ? duration.leave
|
7509 | : duration
|
7510 | );
|
7511 |
|
7512 | if (isDef(explicitLeaveDuration)) {
|
7513 | checkDuration(explicitLeaveDuration, 'leave', vnode);
|
7514 | }
|
7515 |
|
7516 | var cb = el._leaveCb = once(function () {
|
7517 | if (el.parentNode && el.parentNode._pending) {
|
7518 | el.parentNode._pending[vnode.key] = null;
|
7519 | }
|
7520 | if (expectsCSS) {
|
7521 | removeTransitionClass(el, leaveToClass);
|
7522 | removeTransitionClass(el, leaveActiveClass);
|
7523 | }
|
7524 | if (cb.cancelled) {
|
7525 | if (expectsCSS) {
|
7526 | removeTransitionClass(el, leaveClass);
|
7527 | }
|
7528 | leaveCancelled && leaveCancelled(el);
|
7529 | } else {
|
7530 | rm();
|
7531 | afterLeave && afterLeave(el);
|
7532 | }
|
7533 | el._leaveCb = null;
|
7534 | });
|
7535 |
|
7536 | if (delayLeave) {
|
7537 | delayLeave(performLeave);
|
7538 | } else {
|
7539 | performLeave();
|
7540 | }
|
7541 |
|
7542 | function performLeave () {
|
7543 |
|
7544 | if (cb.cancelled) {
|
7545 | return
|
7546 | }
|
7547 |
|
7548 | if (!vnode.data.show && el.parentNode) {
|
7549 | (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
7550 | }
|
7551 | beforeLeave && beforeLeave(el);
|
7552 | if (expectsCSS) {
|
7553 | addTransitionClass(el, leaveClass);
|
7554 | addTransitionClass(el, leaveActiveClass);
|
7555 | nextFrame(function () {
|
7556 | removeTransitionClass(el, leaveClass);
|
7557 | if (!cb.cancelled) {
|
7558 | addTransitionClass(el, leaveToClass);
|
7559 | if (!userWantsControl) {
|
7560 | if (isValidDuration(explicitLeaveDuration)) {
|
7561 | setTimeout(cb, explicitLeaveDuration);
|
7562 | } else {
|
7563 | whenTransitionEnds(el, type, cb);
|
7564 | }
|
7565 | }
|
7566 | }
|
7567 | });
|
7568 | }
|
7569 | leave && leave(el, cb);
|
7570 | if (!expectsCSS && !userWantsControl) {
|
7571 | cb();
|
7572 | }
|
7573 | }
|
7574 | }
|
7575 |
|
7576 |
|
7577 | function checkDuration (val, name, vnode) {
|
7578 | if (typeof val !== 'number') {
|
7579 | warn(
|
7580 | "<transition> explicit " + name + " duration is not a valid number - " +
|
7581 | "got " + (JSON.stringify(val)) + ".",
|
7582 | vnode.context
|
7583 | );
|
7584 | } else if (isNaN(val)) {
|
7585 | warn(
|
7586 | "<transition> explicit " + name + " duration is NaN - " +
|
7587 | 'the duration expression might be incorrect.',
|
7588 | vnode.context
|
7589 | );
|
7590 | }
|
7591 | }
|
7592 |
|
7593 | function isValidDuration (val) {
|
7594 | return typeof val === 'number' && !isNaN(val)
|
7595 | }
|
7596 |
|
7597 |
|
7598 |
|
7599 |
|
7600 |
|
7601 |
|
7602 |
|
7603 | function getHookArgumentsLength (fn) {
|
7604 | if (isUndef(fn)) {
|
7605 | return false
|
7606 | }
|
7607 | var invokerFns = fn.fns;
|
7608 | if (isDef(invokerFns)) {
|
7609 |
|
7610 | return getHookArgumentsLength(
|
7611 | Array.isArray(invokerFns)
|
7612 | ? invokerFns[0]
|
7613 | : invokerFns
|
7614 | )
|
7615 | } else {
|
7616 | return (fn._length || fn.length) > 1
|
7617 | }
|
7618 | }
|
7619 |
|
7620 | function _enter (_, vnode) {
|
7621 | if (vnode.data.show !== true) {
|
7622 | enter(vnode);
|
7623 | }
|
7624 | }
|
7625 |
|
7626 | var transition = inBrowser ? {
|
7627 | create: _enter,
|
7628 | activate: _enter,
|
7629 | remove: function remove$$1 (vnode, rm) {
|
7630 |
|
7631 | if (vnode.data.show !== true) {
|
7632 | leave(vnode, rm);
|
7633 | } else {
|
7634 | rm();
|
7635 | }
|
7636 | }
|
7637 | } : {};
|
7638 |
|
7639 | var platformModules = [
|
7640 | attrs,
|
7641 | klass,
|
7642 | events,
|
7643 | domProps,
|
7644 | style,
|
7645 | transition
|
7646 | ];
|
7647 |
|
7648 |
|
7649 |
|
7650 |
|
7651 |
|
7652 | var modules = platformModules.concat(baseModules);
|
7653 |
|
7654 | var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
7655 |
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 | if (isIE9) {
|
7663 |
|
7664 | document.addEventListener('selectionchange', function () {
|
7665 | var el = document.activeElement;
|
7666 | if (el && el.vmodel) {
|
7667 | trigger(el, 'input');
|
7668 | }
|
7669 | });
|
7670 | }
|
7671 |
|
7672 | var directive = {
|
7673 | inserted: function inserted (el, binding, vnode, oldVnode) {
|
7674 | if (vnode.tag === 'select') {
|
7675 |
|
7676 | if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
7677 | mergeVNodeHook(vnode, 'postpatch', function () {
|
7678 | directive.componentUpdated(el, binding, vnode);
|
7679 | });
|
7680 | } else {
|
7681 | setSelected(el, binding, vnode.context);
|
7682 | }
|
7683 | el._vOptions = [].map.call(el.options, getValue);
|
7684 | } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
7685 | el._vModifiers = binding.modifiers;
|
7686 | if (!binding.modifiers.lazy) {
|
7687 | el.addEventListener('compositionstart', onCompositionStart);
|
7688 | el.addEventListener('compositionend', onCompositionEnd);
|
7689 |
|
7690 |
|
7691 |
|
7692 |
|
7693 | el.addEventListener('change', onCompositionEnd);
|
7694 |
|
7695 | if (isIE9) {
|
7696 | el.vmodel = true;
|
7697 | }
|
7698 | }
|
7699 | }
|
7700 | },
|
7701 |
|
7702 | componentUpdated: function componentUpdated (el, binding, vnode) {
|
7703 | if (vnode.tag === 'select') {
|
7704 | setSelected(el, binding, vnode.context);
|
7705 |
|
7706 |
|
7707 |
|
7708 |
|
7709 | var prevOptions = el._vOptions;
|
7710 | var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
7711 | if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
7712 |
|
7713 |
|
7714 | var needReset = el.multiple
|
7715 | ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
7716 | : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
7717 | if (needReset) {
|
7718 | trigger(el, 'change');
|
7719 | }
|
7720 | }
|
7721 | }
|
7722 | }
|
7723 | };
|
7724 |
|
7725 | function setSelected (el, binding, vm) {
|
7726 | actuallySetSelected(el, binding, vm);
|
7727 |
|
7728 | if (isIE || isEdge) {
|
7729 | setTimeout(function () {
|
7730 | actuallySetSelected(el, binding, vm);
|
7731 | }, 0);
|
7732 | }
|
7733 | }
|
7734 |
|
7735 | function actuallySetSelected (el, binding, vm) {
|
7736 | var value = binding.value;
|
7737 | var isMultiple = el.multiple;
|
7738 | if (isMultiple && !Array.isArray(value)) {
|
7739 | warn(
|
7740 | "<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
7741 | "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
7742 | vm
|
7743 | );
|
7744 | return
|
7745 | }
|
7746 | var selected, option;
|
7747 | for (var i = 0, l = el.options.length; i < l; i++) {
|
7748 | option = el.options[i];
|
7749 | if (isMultiple) {
|
7750 | selected = looseIndexOf(value, getValue(option)) > -1;
|
7751 | if (option.selected !== selected) {
|
7752 | option.selected = selected;
|
7753 | }
|
7754 | } else {
|
7755 | if (looseEqual(getValue(option), value)) {
|
7756 | if (el.selectedIndex !== i) {
|
7757 | el.selectedIndex = i;
|
7758 | }
|
7759 | return
|
7760 | }
|
7761 | }
|
7762 | }
|
7763 | if (!isMultiple) {
|
7764 | el.selectedIndex = -1;
|
7765 | }
|
7766 | }
|
7767 |
|
7768 | function hasNoMatchingOption (value, options) {
|
7769 | return options.every(function (o) { return !looseEqual(o, value); })
|
7770 | }
|
7771 |
|
7772 | function getValue (option) {
|
7773 | return '_value' in option
|
7774 | ? option._value
|
7775 | : option.value
|
7776 | }
|
7777 |
|
7778 | function onCompositionStart (e) {
|
7779 | e.target.composing = true;
|
7780 | }
|
7781 |
|
7782 | function onCompositionEnd (e) {
|
7783 |
|
7784 | if (!e.target.composing) { return }
|
7785 | e.target.composing = false;
|
7786 | trigger(e.target, 'input');
|
7787 | }
|
7788 |
|
7789 | function trigger (el, type) {
|
7790 | var e = document.createEvent('HTMLEvents');
|
7791 | e.initEvent(type, true, true);
|
7792 | el.dispatchEvent(e);
|
7793 | }
|
7794 |
|
7795 |
|
7796 |
|
7797 |
|
7798 | function locateNode (vnode) {
|
7799 | return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
7800 | ? locateNode(vnode.componentInstance._vnode)
|
7801 | : vnode
|
7802 | }
|
7803 |
|
7804 | var show = {
|
7805 | bind: function bind (el, ref, vnode) {
|
7806 | var value = ref.value;
|
7807 |
|
7808 | vnode = locateNode(vnode);
|
7809 | var transition$$1 = vnode.data && vnode.data.transition;
|
7810 | var originalDisplay = el.__vOriginalDisplay =
|
7811 | el.style.display === 'none' ? '' : el.style.display;
|
7812 | if (value && transition$$1) {
|
7813 | vnode.data.show = true;
|
7814 | enter(vnode, function () {
|
7815 | el.style.display = originalDisplay;
|
7816 | });
|
7817 | } else {
|
7818 | el.style.display = value ? originalDisplay : 'none';
|
7819 | }
|
7820 | },
|
7821 |
|
7822 | update: function update (el, ref, vnode) {
|
7823 | var value = ref.value;
|
7824 | var oldValue = ref.oldValue;
|
7825 |
|
7826 |
|
7827 | if (!value === !oldValue) { return }
|
7828 | vnode = locateNode(vnode);
|
7829 | var transition$$1 = vnode.data && vnode.data.transition;
|
7830 | if (transition$$1) {
|
7831 | vnode.data.show = true;
|
7832 | if (value) {
|
7833 | enter(vnode, function () {
|
7834 | el.style.display = el.__vOriginalDisplay;
|
7835 | });
|
7836 | } else {
|
7837 | leave(vnode, function () {
|
7838 | el.style.display = 'none';
|
7839 | });
|
7840 | }
|
7841 | } else {
|
7842 | el.style.display = value ? el.__vOriginalDisplay : 'none';
|
7843 | }
|
7844 | },
|
7845 |
|
7846 | unbind: function unbind (
|
7847 | el,
|
7848 | binding,
|
7849 | vnode,
|
7850 | oldVnode,
|
7851 | isDestroy
|
7852 | ) {
|
7853 | if (!isDestroy) {
|
7854 | el.style.display = el.__vOriginalDisplay;
|
7855 | }
|
7856 | }
|
7857 | };
|
7858 |
|
7859 | var platformDirectives = {
|
7860 | model: directive,
|
7861 | show: show
|
7862 | };
|
7863 |
|
7864 |
|
7865 |
|
7866 | var transitionProps = {
|
7867 | name: String,
|
7868 | appear: Boolean,
|
7869 | css: Boolean,
|
7870 | mode: String,
|
7871 | type: String,
|
7872 | enterClass: String,
|
7873 | leaveClass: String,
|
7874 | enterToClass: String,
|
7875 | leaveToClass: String,
|
7876 | enterActiveClass: String,
|
7877 | leaveActiveClass: String,
|
7878 | appearClass: String,
|
7879 | appearActiveClass: String,
|
7880 | appearToClass: String,
|
7881 | duration: [Number, String, Object]
|
7882 | };
|
7883 |
|
7884 |
|
7885 |
|
7886 | function getRealChild (vnode) {
|
7887 | var compOptions = vnode && vnode.componentOptions;
|
7888 | if (compOptions && compOptions.Ctor.options.abstract) {
|
7889 | return getRealChild(getFirstComponentChild(compOptions.children))
|
7890 | } else {
|
7891 | return vnode
|
7892 | }
|
7893 | }
|
7894 |
|
7895 | function extractTransitionData (comp) {
|
7896 | var data = {};
|
7897 | var options = comp.$options;
|
7898 |
|
7899 | for (var key in options.propsData) {
|
7900 | data[key] = comp[key];
|
7901 | }
|
7902 |
|
7903 |
|
7904 | var listeners = options._parentListeners;
|
7905 | for (var key$1 in listeners) {
|
7906 | data[camelize(key$1)] = listeners[key$1];
|
7907 | }
|
7908 | return data
|
7909 | }
|
7910 |
|
7911 | function placeholder (h, rawChild) {
|
7912 | if (/\d-keep-alive$/.test(rawChild.tag)) {
|
7913 | return h('keep-alive', {
|
7914 | props: rawChild.componentOptions.propsData
|
7915 | })
|
7916 | }
|
7917 | }
|
7918 |
|
7919 | function hasParentTransition (vnode) {
|
7920 | while ((vnode = vnode.parent)) {
|
7921 | if (vnode.data.transition) {
|
7922 | return true
|
7923 | }
|
7924 | }
|
7925 | }
|
7926 |
|
7927 | function isSameChild (child, oldChild) {
|
7928 | return oldChild.key === child.key && oldChild.tag === child.tag
|
7929 | }
|
7930 |
|
7931 | var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
7932 |
|
7933 | var isVShowDirective = function (d) { return d.name === 'show'; };
|
7934 |
|
7935 | var Transition = {
|
7936 | name: 'transition',
|
7937 | props: transitionProps,
|
7938 | abstract: true,
|
7939 |
|
7940 | render: function render (h) {
|
7941 | var this$1 = this;
|
7942 |
|
7943 | var children = this.$slots.default;
|
7944 | if (!children) {
|
7945 | return
|
7946 | }
|
7947 |
|
7948 |
|
7949 | children = children.filter(isNotTextNode);
|
7950 |
|
7951 | if (!children.length) {
|
7952 | return
|
7953 | }
|
7954 |
|
7955 |
|
7956 | if (children.length > 1) {
|
7957 | warn(
|
7958 | '<transition> can only be used on a single element. Use ' +
|
7959 | '<transition-group> for lists.',
|
7960 | this.$parent
|
7961 | );
|
7962 | }
|
7963 |
|
7964 | var mode = this.mode;
|
7965 |
|
7966 |
|
7967 | if (mode && mode !== 'in-out' && mode !== 'out-in'
|
7968 | ) {
|
7969 | warn(
|
7970 | 'invalid <transition> mode: ' + mode,
|
7971 | this.$parent
|
7972 | );
|
7973 | }
|
7974 |
|
7975 | var rawChild = children[0];
|
7976 |
|
7977 |
|
7978 |
|
7979 | if (hasParentTransition(this.$vnode)) {
|
7980 | return rawChild
|
7981 | }
|
7982 |
|
7983 |
|
7984 |
|
7985 | var child = getRealChild(rawChild);
|
7986 |
|
7987 | if (!child) {
|
7988 | return rawChild
|
7989 | }
|
7990 |
|
7991 | if (this._leaving) {
|
7992 | return placeholder(h, rawChild)
|
7993 | }
|
7994 |
|
7995 |
|
7996 |
|
7997 |
|
7998 | var id = "__transition-" + (this._uid) + "-";
|
7999 | child.key = child.key == null
|
8000 | ? child.isComment
|
8001 | ? id + 'comment'
|
8002 | : id + child.tag
|
8003 | : isPrimitive(child.key)
|
8004 | ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
8005 | : child.key;
|
8006 |
|
8007 | var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
8008 | var oldRawChild = this._vnode;
|
8009 | var oldChild = getRealChild(oldRawChild);
|
8010 |
|
8011 |
|
8012 |
|
8013 | if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
8014 | child.data.show = true;
|
8015 | }
|
8016 |
|
8017 | if (
|
8018 | oldChild &&
|
8019 | oldChild.data &&
|
8020 | !isSameChild(child, oldChild) &&
|
8021 | !isAsyncPlaceholder(oldChild) &&
|
8022 |
|
8023 | !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
8024 | ) {
|
8025 |
|
8026 |
|
8027 | var oldData = oldChild.data.transition = extend({}, data);
|
8028 |
|
8029 | if (mode === 'out-in') {
|
8030 |
|
8031 | this._leaving = true;
|
8032 | mergeVNodeHook(oldData, 'afterLeave', function () {
|
8033 | this$1._leaving = false;
|
8034 | this$1.$forceUpdate();
|
8035 | });
|
8036 | return placeholder(h, rawChild)
|
8037 | } else if (mode === 'in-out') {
|
8038 | if (isAsyncPlaceholder(child)) {
|
8039 | return oldRawChild
|
8040 | }
|
8041 | var delayedLeave;
|
8042 | var performLeave = function () { delayedLeave(); };
|
8043 | mergeVNodeHook(data, 'afterEnter', performLeave);
|
8044 | mergeVNodeHook(data, 'enterCancelled', performLeave);
|
8045 | mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
8046 | }
|
8047 | }
|
8048 |
|
8049 | return rawChild
|
8050 | }
|
8051 | };
|
8052 |
|
8053 |
|
8054 |
|
8055 | var props = extend({
|
8056 | tag: String,
|
8057 | moveClass: String
|
8058 | }, transitionProps);
|
8059 |
|
8060 | delete props.mode;
|
8061 |
|
8062 | var TransitionGroup = {
|
8063 | props: props,
|
8064 |
|
8065 | beforeMount: function beforeMount () {
|
8066 | var this$1 = this;
|
8067 |
|
8068 | var update = this._update;
|
8069 | this._update = function (vnode, hydrating) {
|
8070 | var restoreActiveInstance = setActiveInstance(this$1);
|
8071 |
|
8072 | this$1.__patch__(
|
8073 | this$1._vnode,
|
8074 | this$1.kept,
|
8075 | false,
|
8076 | true
|
8077 | );
|
8078 | this$1._vnode = this$1.kept;
|
8079 | restoreActiveInstance();
|
8080 | update.call(this$1, vnode, hydrating);
|
8081 | };
|
8082 | },
|
8083 |
|
8084 | render: function render (h) {
|
8085 | var tag = this.tag || this.$vnode.data.tag || 'span';
|
8086 | var map = Object.create(null);
|
8087 | var prevChildren = this.prevChildren = this.children;
|
8088 | var rawChildren = this.$slots.default || [];
|
8089 | var children = this.children = [];
|
8090 | var transitionData = extractTransitionData(this);
|
8091 |
|
8092 | for (var i = 0; i < rawChildren.length; i++) {
|
8093 | var c = rawChildren[i];
|
8094 | if (c.tag) {
|
8095 | if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
8096 | children.push(c);
|
8097 | map[c.key] = c
|
8098 | ;(c.data || (c.data = {})).transition = transitionData;
|
8099 | } else {
|
8100 | var opts = c.componentOptions;
|
8101 | var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
8102 | warn(("<transition-group> children must be keyed: <" + name + ">"));
|
8103 | }
|
8104 | }
|
8105 | }
|
8106 |
|
8107 | if (prevChildren) {
|
8108 | var kept = [];
|
8109 | var removed = [];
|
8110 | for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
8111 | var c$1 = prevChildren[i$1];
|
8112 | c$1.data.transition = transitionData;
|
8113 | c$1.data.pos = c$1.elm.getBoundingClientRect();
|
8114 | if (map[c$1.key]) {
|
8115 | kept.push(c$1);
|
8116 | } else {
|
8117 | removed.push(c$1);
|
8118 | }
|
8119 | }
|
8120 | this.kept = h(tag, null, kept);
|
8121 | this.removed = removed;
|
8122 | }
|
8123 |
|
8124 | return h(tag, null, children)
|
8125 | },
|
8126 |
|
8127 | updated: function updated () {
|
8128 | var children = this.prevChildren;
|
8129 | var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
8130 | if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
8131 | return
|
8132 | }
|
8133 |
|
8134 |
|
8135 |
|
8136 | children.forEach(callPendingCbs);
|
8137 | children.forEach(recordPosition);
|
8138 | children.forEach(applyTranslation);
|
8139 |
|
8140 |
|
8141 |
|
8142 |
|
8143 | this._reflow = document.body.offsetHeight;
|
8144 |
|
8145 | children.forEach(function (c) {
|
8146 | if (c.data.moved) {
|
8147 | var el = c.elm;
|
8148 | var s = el.style;
|
8149 | addTransitionClass(el, moveClass);
|
8150 | s.transform = s.WebkitTransform = s.transitionDuration = '';
|
8151 | el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
8152 | if (e && e.target !== el) {
|
8153 | return
|
8154 | }
|
8155 | if (!e || /transform$/.test(e.propertyName)) {
|
8156 | el.removeEventListener(transitionEndEvent, cb);
|
8157 | el._moveCb = null;
|
8158 | removeTransitionClass(el, moveClass);
|
8159 | }
|
8160 | });
|
8161 | }
|
8162 | });
|
8163 | },
|
8164 |
|
8165 | methods: {
|
8166 | hasMove: function hasMove (el, moveClass) {
|
8167 |
|
8168 | if (!hasTransition) {
|
8169 | return false
|
8170 | }
|
8171 |
|
8172 | if (this._hasMove) {
|
8173 | return this._hasMove
|
8174 | }
|
8175 |
|
8176 |
|
8177 |
|
8178 |
|
8179 |
|
8180 | var clone = el.cloneNode();
|
8181 | if (el._transitionClasses) {
|
8182 | el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
8183 | }
|
8184 | addClass(clone, moveClass);
|
8185 | clone.style.display = 'none';
|
8186 | this.$el.appendChild(clone);
|
8187 | var info = getTransitionInfo(clone);
|
8188 | this.$el.removeChild(clone);
|
8189 | return (this._hasMove = info.hasTransform)
|
8190 | }
|
8191 | }
|
8192 | };
|
8193 |
|
8194 | function callPendingCbs (c) {
|
8195 |
|
8196 | if (c.elm._moveCb) {
|
8197 | c.elm._moveCb();
|
8198 | }
|
8199 |
|
8200 | if (c.elm._enterCb) {
|
8201 | c.elm._enterCb();
|
8202 | }
|
8203 | }
|
8204 |
|
8205 | function recordPosition (c) {
|
8206 | c.data.newPos = c.elm.getBoundingClientRect();
|
8207 | }
|
8208 |
|
8209 | function applyTranslation (c) {
|
8210 | var oldPos = c.data.pos;
|
8211 | var newPos = c.data.newPos;
|
8212 | var dx = oldPos.left - newPos.left;
|
8213 | var dy = oldPos.top - newPos.top;
|
8214 | if (dx || dy) {
|
8215 | c.data.moved = true;
|
8216 | var s = c.elm.style;
|
8217 | s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
8218 | s.transitionDuration = '0s';
|
8219 | }
|
8220 | }
|
8221 |
|
8222 | var platformComponents = {
|
8223 | Transition: Transition,
|
8224 | TransitionGroup: TransitionGroup
|
8225 | };
|
8226 |
|
8227 |
|
8228 |
|
8229 |
|
8230 | Vue.config.mustUseProp = mustUseProp;
|
8231 | Vue.config.isReservedTag = isReservedTag;
|
8232 | Vue.config.isReservedAttr = isReservedAttr;
|
8233 | Vue.config.getTagNamespace = getTagNamespace;
|
8234 | Vue.config.isUnknownElement = isUnknownElement;
|
8235 |
|
8236 |
|
8237 | extend(Vue.options.directives, platformDirectives);
|
8238 | extend(Vue.options.components, platformComponents);
|
8239 |
|
8240 |
|
8241 | Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
8242 |
|
8243 |
|
8244 | Vue.prototype.$mount = function (
|
8245 | el,
|
8246 | hydrating
|
8247 | ) {
|
8248 | el = el && inBrowser ? query(el) : undefined;
|
8249 | return mountComponent(this, el, hydrating)
|
8250 | };
|
8251 |
|
8252 |
|
8253 |
|
8254 | if (inBrowser) {
|
8255 | setTimeout(function () {
|
8256 | if (config.devtools) {
|
8257 | if (devtools) {
|
8258 | devtools.emit('init', Vue);
|
8259 | } else {
|
8260 | console[console.info ? 'info' : 'log'](
|
8261 | 'Download the Vue Devtools extension for a better development experience:\n' +
|
8262 | 'https://github.com/vuejs/vue-devtools'
|
8263 | );
|
8264 | }
|
8265 | }
|
8266 | if (config.productionTip !== false &&
|
8267 | typeof console !== 'undefined'
|
8268 | ) {
|
8269 | console[console.info ? 'info' : 'log'](
|
8270 | "You are running Vue in development mode.\n" +
|
8271 | "Make sure to turn on production mode when deploying for production.\n" +
|
8272 | "See more tips at https://vuejs.org/guide/deployment.html"
|
8273 | );
|
8274 | }
|
8275 | }, 0);
|
8276 | }
|
8277 |
|
8278 |
|
8279 |
|
8280 | module.exports = Vue;
|