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