1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var emptyObject = Object.freeze({});
|
9 |
|
10 |
|
11 |
|
12 | function isUndef (v) {
|
13 | return v === undefined || v === null
|
14 | }
|
15 |
|
16 | function isDef (v) {
|
17 | return v !== undefined && v !== null
|
18 | }
|
19 |
|
20 | function isTrue (v) {
|
21 | return v === true
|
22 | }
|
23 |
|
24 | function isFalse (v) {
|
25 | return v === false
|
26 | }
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | function isPrimitive (value) {
|
32 | return (
|
33 | typeof value === 'string' ||
|
34 | typeof value === 'number' ||
|
35 |
|
36 | typeof value === 'symbol' ||
|
37 | typeof value === 'boolean'
|
38 | )
|
39 | }
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function isObject (obj) {
|
47 | return obj !== null && typeof obj === 'object'
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | var _toString = Object.prototype.toString;
|
54 |
|
55 | function toRawType (value) {
|
56 | return _toString.call(value).slice(8, -1)
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | function isPlainObject (obj) {
|
64 | return _toString.call(obj) === '[object Object]'
|
65 | }
|
66 |
|
67 | function isRegExp (v) {
|
68 | return _toString.call(v) === '[object RegExp]'
|
69 | }
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | function isValidArrayIndex (val) {
|
75 | var n = parseFloat(String(val));
|
76 | return n >= 0 && Math.floor(n) === n && isFinite(val)
|
77 | }
|
78 |
|
79 | function isPromise (val) {
|
80 | return (
|
81 | isDef(val) &&
|
82 | typeof val.then === 'function' &&
|
83 | typeof val.catch === 'function'
|
84 | )
|
85 | }
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | function toString (val) {
|
91 | return val == null
|
92 | ? ''
|
93 | : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
94 | ? JSON.stringify(val, null, 2)
|
95 | : String(val)
|
96 | }
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | function toNumber (val) {
|
103 | var n = parseFloat(val);
|
104 | return isNaN(n) ? val : n
|
105 | }
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | function makeMap (
|
112 | str,
|
113 | expectsLowerCase
|
114 | ) {
|
115 | var map = Object.create(null);
|
116 | var list = str.split(',');
|
117 | for (var i = 0; i < list.length; i++) {
|
118 | map[list[i]] = true;
|
119 | }
|
120 | return expectsLowerCase
|
121 | ? function (val) { return map[val.toLowerCase()]; }
|
122 | : function (val) { return map[val]; }
|
123 | }
|
124 |
|
125 |
|
126 |
|
127 |
|
128 | var isBuiltInTag = makeMap('slot,component', true);
|
129 |
|
130 |
|
131 |
|
132 |
|
133 | var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | function remove (arr, item) {
|
139 | if (arr.length) {
|
140 | var index = arr.indexOf(item);
|
141 | if (index > -1) {
|
142 | return arr.splice(index, 1)
|
143 | }
|
144 | }
|
145 | }
|
146 |
|
147 |
|
148 |
|
149 |
|
150 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
151 | function hasOwn (obj, key) {
|
152 | return hasOwnProperty.call(obj, key)
|
153 | }
|
154 |
|
155 |
|
156 |
|
157 |
|
158 | function cached (fn) {
|
159 | var cache = Object.create(null);
|
160 | return (function cachedFn (str) {
|
161 | var hit = cache[str];
|
162 | return hit || (cache[str] = fn(str))
|
163 | })
|
164 | }
|
165 |
|
166 |
|
167 |
|
168 |
|
169 | var camelizeRE = /-(\w)/g;
|
170 | var camelize = cached(function (str) {
|
171 | return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
172 | });
|
173 |
|
174 |
|
175 |
|
176 |
|
177 | var capitalize = cached(function (str) {
|
178 | return str.charAt(0).toUpperCase() + str.slice(1)
|
179 | });
|
180 |
|
181 |
|
182 |
|
183 |
|
184 | var hyphenateRE = /\B([A-Z])/g;
|
185 | var hyphenate = cached(function (str) {
|
186 | return str.replace(hyphenateRE, '-$1').toLowerCase()
|
187 | });
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 | function polyfillBind (fn, ctx) {
|
199 | function boundFn (a) {
|
200 | var l = arguments.length;
|
201 | return l
|
202 | ? l > 1
|
203 | ? fn.apply(ctx, arguments)
|
204 | : fn.call(ctx, a)
|
205 | : fn.call(ctx)
|
206 | }
|
207 |
|
208 | boundFn._length = fn.length;
|
209 | return boundFn
|
210 | }
|
211 |
|
212 | function nativeBind (fn, ctx) {
|
213 | return fn.bind(ctx)
|
214 | }
|
215 |
|
216 | var bind = Function.prototype.bind
|
217 | ? nativeBind
|
218 | : polyfillBind;
|
219 |
|
220 |
|
221 |
|
222 |
|
223 | function toArray (list, start) {
|
224 | start = start || 0;
|
225 | var i = list.length - start;
|
226 | var ret = new Array(i);
|
227 | while (i--) {
|
228 | ret[i] = list[i + start];
|
229 | }
|
230 | return ret
|
231 | }
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | function extend (to, _from) {
|
237 | for (var key in _from) {
|
238 | to[key] = _from[key];
|
239 | }
|
240 | return to
|
241 | }
|
242 |
|
243 |
|
244 |
|
245 |
|
246 | function toObject (arr) {
|
247 | var res = {};
|
248 | for (var i = 0; i < arr.length; i++) {
|
249 | if (arr[i]) {
|
250 | extend(res, arr[i]);
|
251 | }
|
252 | }
|
253 | return res
|
254 | }
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 | function noop (a, b, c) {}
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | var no = function (a, b, c) { return false; };
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | var identity = function (_) { return _; };
|
276 |
|
277 |
|
278 |
|
279 |
|
280 | function genStaticKeys (modules) {
|
281 | return modules.reduce(function (keys, m) {
|
282 | return keys.concat(m.staticKeys || [])
|
283 | }, []).join(',')
|
284 | }
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | function looseEqual (a, b) {
|
291 | if (a === b) { return true }
|
292 | var isObjectA = isObject(a);
|
293 | var isObjectB = isObject(b);
|
294 | if (isObjectA && isObjectB) {
|
295 | try {
|
296 | var isArrayA = Array.isArray(a);
|
297 | var isArrayB = Array.isArray(b);
|
298 | if (isArrayA && isArrayB) {
|
299 | return a.length === b.length && a.every(function (e, i) {
|
300 | return looseEqual(e, b[i])
|
301 | })
|
302 | } else if (a instanceof Date && b instanceof Date) {
|
303 | return a.getTime() === b.getTime()
|
304 | } else if (!isArrayA && !isArrayB) {
|
305 | var keysA = Object.keys(a);
|
306 | var keysB = Object.keys(b);
|
307 | return keysA.length === keysB.length && keysA.every(function (key) {
|
308 | return looseEqual(a[key], b[key])
|
309 | })
|
310 | } else {
|
311 |
|
312 | return false
|
313 | }
|
314 | } catch (e) {
|
315 |
|
316 | return false
|
317 | }
|
318 | } else if (!isObjectA && !isObjectB) {
|
319 | return String(a) === String(b)
|
320 | } else {
|
321 | return false
|
322 | }
|
323 | }
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 | function looseIndexOf (arr, val) {
|
331 | for (var i = 0; i < arr.length; i++) {
|
332 | if (looseEqual(arr[i], val)) { return i }
|
333 | }
|
334 | return -1
|
335 | }
|
336 |
|
337 |
|
338 |
|
339 |
|
340 | function once (fn) {
|
341 | var called = false;
|
342 | return function () {
|
343 | if (!called) {
|
344 | called = true;
|
345 | fn.apply(this, arguments);
|
346 | }
|
347 | }
|
348 | }
|
349 |
|
350 | var SSR_ATTR = 'data-server-rendered';
|
351 |
|
352 | var ASSET_TYPES = [
|
353 | 'component',
|
354 | 'directive',
|
355 | 'filter'
|
356 | ];
|
357 |
|
358 | var LIFECYCLE_HOOKS = [
|
359 | 'beforeCreate',
|
360 | 'created',
|
361 | 'beforeMount',
|
362 | 'mounted',
|
363 | 'beforeUpdate',
|
364 | 'updated',
|
365 | 'beforeDestroy',
|
366 | 'destroyed',
|
367 | 'activated',
|
368 | 'deactivated',
|
369 | 'errorCaptured',
|
370 | 'serverPrefetch'
|
371 | ];
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 | var config = ({
|
378 | |
379 |
|
380 |
|
381 |
|
382 | optionMergeStrategies: Object.create(null),
|
383 |
|
384 | |
385 |
|
386 |
|
387 | silent: false,
|
388 |
|
389 | |
390 |
|
391 |
|
392 | productionTip: process.env.NODE_ENV !== 'production',
|
393 |
|
394 | |
395 |
|
396 |
|
397 | devtools: process.env.NODE_ENV !== 'production',
|
398 |
|
399 | |
400 |
|
401 |
|
402 | performance: false,
|
403 |
|
404 | |
405 |
|
406 |
|
407 | errorHandler: null,
|
408 |
|
409 | |
410 |
|
411 |
|
412 | warnHandler: null,
|
413 |
|
414 | |
415 |
|
416 |
|
417 | ignoredElements: [],
|
418 |
|
419 | |
420 |
|
421 |
|
422 |
|
423 | keyCodes: Object.create(null),
|
424 |
|
425 | |
426 |
|
427 |
|
428 |
|
429 | isReservedTag: no,
|
430 |
|
431 | |
432 |
|
433 |
|
434 |
|
435 | isReservedAttr: no,
|
436 |
|
437 | |
438 |
|
439 |
|
440 |
|
441 | isUnknownElement: no,
|
442 |
|
443 | |
444 |
|
445 |
|
446 | getTagNamespace: noop,
|
447 |
|
448 | |
449 |
|
450 |
|
451 | parsePlatformTagName: identity,
|
452 |
|
453 | |
454 |
|
455 |
|
456 |
|
457 | mustUseProp: no,
|
458 |
|
459 | |
460 |
|
461 |
|
462 |
|
463 | async: true,
|
464 |
|
465 | |
466 |
|
467 |
|
468 | _lifecycleHooks: LIFECYCLE_HOOKS
|
469 | });
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 | 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';
|
479 |
|
480 |
|
481 |
|
482 |
|
483 | function isReserved (str) {
|
484 | var c = (str + '').charCodeAt(0);
|
485 | return c === 0x24 || c === 0x5F
|
486 | }
|
487 |
|
488 |
|
489 |
|
490 |
|
491 | function def (obj, key, val, enumerable) {
|
492 | Object.defineProperty(obj, key, {
|
493 | value: val,
|
494 | enumerable: !!enumerable,
|
495 | writable: true,
|
496 | configurable: true
|
497 | });
|
498 | }
|
499 |
|
500 |
|
501 |
|
502 |
|
503 | var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
|
504 | function parsePath (path) {
|
505 | if (bailRE.test(path)) {
|
506 | return
|
507 | }
|
508 | var segments = path.split('.');
|
509 | return function (obj) {
|
510 | for (var i = 0; i < segments.length; i++) {
|
511 | if (!obj) { return }
|
512 | obj = obj[segments[i]];
|
513 | }
|
514 | return obj
|
515 | }
|
516 | }
|
517 |
|
518 |
|
519 |
|
520 |
|
521 | var hasProto = '__proto__' in {};
|
522 |
|
523 |
|
524 | var inBrowser = typeof window !== 'undefined';
|
525 | var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
526 | var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
527 | var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
528 | var isIE = UA && /msie|trident/.test(UA);
|
529 | var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
530 | var isEdge = UA && UA.indexOf('edge/') > 0;
|
531 | var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
532 | var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
533 | var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
534 | var isPhantomJS = UA && /phantomjs/.test(UA);
|
535 | var isFF = UA && UA.match(/firefox\/(\d+)/);
|
536 |
|
537 |
|
538 | var nativeWatch = ({}).watch;
|
539 |
|
540 | var supportsPassive = false;
|
541 | if (inBrowser) {
|
542 | try {
|
543 | var opts = {};
|
544 | Object.defineProperty(opts, 'passive', ({
|
545 | get: function get () {
|
546 |
|
547 | supportsPassive = true;
|
548 | }
|
549 | }));
|
550 | window.addEventListener('test-passive', null, opts);
|
551 | } catch (e) {}
|
552 | }
|
553 |
|
554 |
|
555 |
|
556 | var _isServer;
|
557 | var isServerRendering = function () {
|
558 | if (_isServer === undefined) {
|
559 |
|
560 | if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
561 |
|
562 |
|
563 | _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
564 | } else {
|
565 | _isServer = false;
|
566 | }
|
567 | }
|
568 | return _isServer
|
569 | };
|
570 |
|
571 |
|
572 | var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
573 |
|
574 |
|
575 | function isNative (Ctor) {
|
576 | return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
577 | }
|
578 |
|
579 | var hasSymbol =
|
580 | typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
581 | typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
582 |
|
583 | var _Set;
|
584 |
|
585 | if (typeof Set !== 'undefined' && isNative(Set)) {
|
586 |
|
587 | _Set = Set;
|
588 | } else {
|
589 |
|
590 | _Set = (function () {
|
591 | function Set () {
|
592 | this.set = Object.create(null);
|
593 | }
|
594 | Set.prototype.has = function has (key) {
|
595 | return this.set[key] === true
|
596 | };
|
597 | Set.prototype.add = function add (key) {
|
598 | this.set[key] = true;
|
599 | };
|
600 | Set.prototype.clear = function clear () {
|
601 | this.set = Object.create(null);
|
602 | };
|
603 |
|
604 | return Set;
|
605 | }());
|
606 | }
|
607 |
|
608 |
|
609 |
|
610 | var warn = noop;
|
611 | var tip = noop;
|
612 | var generateComponentTrace = (noop);
|
613 | var formatComponentName = (noop);
|
614 |
|
615 | if (process.env.NODE_ENV !== 'production') {
|
616 | var hasConsole = typeof console !== 'undefined';
|
617 | var classifyRE = /(?:^|[-_])(\w)/g;
|
618 | var classify = function (str) { return str
|
619 | .replace(classifyRE, function (c) { return c.toUpperCase(); })
|
620 | .replace(/[-_]/g, ''); };
|
621 |
|
622 | warn = function (msg, vm) {
|
623 | var trace = vm ? generateComponentTrace(vm) : '';
|
624 |
|
625 | if (config.warnHandler) {
|
626 | config.warnHandler.call(null, msg, vm, trace);
|
627 | } else if (hasConsole && (!config.silent)) {
|
628 | console.error(("[Vue warn]: " + msg + trace));
|
629 | }
|
630 | };
|
631 |
|
632 | tip = function (msg, vm) {
|
633 | if (hasConsole && (!config.silent)) {
|
634 | console.warn("[Vue tip]: " + msg + (
|
635 | vm ? generateComponentTrace(vm) : ''
|
636 | ));
|
637 | }
|
638 | };
|
639 |
|
640 | formatComponentName = function (vm, includeFile) {
|
641 | if (vm.$root === vm) {
|
642 | return '<Root>'
|
643 | }
|
644 | var options = typeof vm === 'function' && vm.cid != null
|
645 | ? vm.options
|
646 | : vm._isVue
|
647 | ? vm.$options || vm.constructor.options
|
648 | : vm;
|
649 | var name = options.name || options._componentTag;
|
650 | var file = options.__file;
|
651 | if (!name && file) {
|
652 | var match = file.match(/([^/\\]+)\.vue$/);
|
653 | name = match && match[1];
|
654 | }
|
655 |
|
656 | return (
|
657 | (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
658 | (file && includeFile !== false ? (" at " + file) : '')
|
659 | )
|
660 | };
|
661 |
|
662 | var repeat = function (str, n) {
|
663 | var res = '';
|
664 | while (n) {
|
665 | if (n % 2 === 1) { res += str; }
|
666 | if (n > 1) { str += str; }
|
667 | n >>= 1;
|
668 | }
|
669 | return res
|
670 | };
|
671 |
|
672 | generateComponentTrace = function (vm) {
|
673 | if (vm._isVue && vm.$parent) {
|
674 | var tree = [];
|
675 | var currentRecursiveSequence = 0;
|
676 | while (vm) {
|
677 | if (tree.length > 0) {
|
678 | var last = tree[tree.length - 1];
|
679 | if (last.constructor === vm.constructor) {
|
680 | currentRecursiveSequence++;
|
681 | vm = vm.$parent;
|
682 | continue
|
683 | } else if (currentRecursiveSequence > 0) {
|
684 | tree[tree.length - 1] = [last, currentRecursiveSequence];
|
685 | currentRecursiveSequence = 0;
|
686 | }
|
687 | }
|
688 | tree.push(vm);
|
689 | vm = vm.$parent;
|
690 | }
|
691 | return '\n\nfound in\n\n' + tree
|
692 | .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
693 | ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
694 | : formatComponentName(vm))); })
|
695 | .join('\n')
|
696 | } else {
|
697 | return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
698 | }
|
699 | };
|
700 | }
|
701 |
|
702 |
|
703 |
|
704 | var uid = 0;
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 | var Dep = function Dep () {
|
711 | this.id = uid++;
|
712 | this.subs = [];
|
713 | };
|
714 |
|
715 | Dep.prototype.addSub = function addSub (sub) {
|
716 | this.subs.push(sub);
|
717 | };
|
718 |
|
719 | Dep.prototype.removeSub = function removeSub (sub) {
|
720 | remove(this.subs, sub);
|
721 | };
|
722 |
|
723 | Dep.prototype.depend = function depend () {
|
724 | if (Dep.target) {
|
725 | Dep.target.addDep(this);
|
726 | }
|
727 | };
|
728 |
|
729 | Dep.prototype.notify = function notify () {
|
730 |
|
731 | var subs = this.subs.slice();
|
732 | if (process.env.NODE_ENV !== 'production' && !config.async) {
|
733 |
|
734 |
|
735 |
|
736 | subs.sort(function (a, b) { return a.id - b.id; });
|
737 | }
|
738 | for (var i = 0, l = subs.length; i < l; i++) {
|
739 | subs[i].update();
|
740 | }
|
741 | };
|
742 |
|
743 |
|
744 |
|
745 |
|
746 | Dep.target = null;
|
747 | var targetStack = [];
|
748 |
|
749 | function pushTarget (target) {
|
750 | targetStack.push(target);
|
751 | Dep.target = target;
|
752 | }
|
753 |
|
754 | function popTarget () {
|
755 | targetStack.pop();
|
756 | Dep.target = targetStack[targetStack.length - 1];
|
757 | }
|
758 |
|
759 |
|
760 |
|
761 | var VNode = function VNode (
|
762 | tag,
|
763 | data,
|
764 | children,
|
765 | text,
|
766 | elm,
|
767 | context,
|
768 | componentOptions,
|
769 | asyncFactory
|
770 | ) {
|
771 | this.tag = tag;
|
772 | this.data = data;
|
773 | this.children = children;
|
774 | this.text = text;
|
775 | this.elm = elm;
|
776 | this.ns = undefined;
|
777 | this.context = context;
|
778 | this.fnContext = undefined;
|
779 | this.fnOptions = undefined;
|
780 | this.fnScopeId = undefined;
|
781 | this.key = data && data.key;
|
782 | this.componentOptions = componentOptions;
|
783 | this.componentInstance = undefined;
|
784 | this.parent = undefined;
|
785 | this.raw = false;
|
786 | this.isStatic = false;
|
787 | this.isRootInsert = true;
|
788 | this.isComment = false;
|
789 | this.isCloned = false;
|
790 | this.isOnce = false;
|
791 | this.asyncFactory = asyncFactory;
|
792 | this.asyncMeta = undefined;
|
793 | this.isAsyncPlaceholder = false;
|
794 | };
|
795 |
|
796 | var prototypeAccessors = { child: { configurable: true } };
|
797 |
|
798 |
|
799 |
|
800 | prototypeAccessors.child.get = function () {
|
801 | return this.componentInstance
|
802 | };
|
803 |
|
804 | Object.defineProperties( VNode.prototype, prototypeAccessors );
|
805 |
|
806 | var createEmptyVNode = function (text) {
|
807 | if ( text === void 0 ) text = '';
|
808 |
|
809 | var node = new VNode();
|
810 | node.text = text;
|
811 | node.isComment = true;
|
812 | return node
|
813 | };
|
814 |
|
815 | function createTextVNode (val) {
|
816 | return new VNode(undefined, undefined, undefined, String(val))
|
817 | }
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 | function cloneVNode (vnode) {
|
824 | var cloned = new VNode(
|
825 | vnode.tag,
|
826 | vnode.data,
|
827 |
|
828 |
|
829 |
|
830 | vnode.children && vnode.children.slice(),
|
831 | vnode.text,
|
832 | vnode.elm,
|
833 | vnode.context,
|
834 | vnode.componentOptions,
|
835 | vnode.asyncFactory
|
836 | );
|
837 | cloned.ns = vnode.ns;
|
838 | cloned.isStatic = vnode.isStatic;
|
839 | cloned.key = vnode.key;
|
840 | cloned.isComment = vnode.isComment;
|
841 | cloned.fnContext = vnode.fnContext;
|
842 | cloned.fnOptions = vnode.fnOptions;
|
843 | cloned.fnScopeId = vnode.fnScopeId;
|
844 | cloned.asyncMeta = vnode.asyncMeta;
|
845 | cloned.isCloned = true;
|
846 | return cloned
|
847 | }
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 | var arrayProto = Array.prototype;
|
855 | var arrayMethods = Object.create(arrayProto);
|
856 |
|
857 | var methodsToPatch = [
|
858 | 'push',
|
859 | 'pop',
|
860 | 'shift',
|
861 | 'unshift',
|
862 | 'splice',
|
863 | 'sort',
|
864 | 'reverse'
|
865 | ];
|
866 |
|
867 |
|
868 |
|
869 |
|
870 | methodsToPatch.forEach(function (method) {
|
871 |
|
872 | var original = arrayProto[method];
|
873 | def(arrayMethods, method, function mutator () {
|
874 | var args = [], len = arguments.length;
|
875 | while ( len-- ) args[ len ] = arguments[ len ];
|
876 |
|
877 | var result = original.apply(this, args);
|
878 | var ob = this.__ob__;
|
879 | var inserted;
|
880 | switch (method) {
|
881 | case 'push':
|
882 | case 'unshift':
|
883 | inserted = args;
|
884 | break
|
885 | case 'splice':
|
886 | inserted = args.slice(2);
|
887 | break
|
888 | }
|
889 | if (inserted) { ob.observeArray(inserted); }
|
890 |
|
891 | ob.dep.notify();
|
892 | return result
|
893 | });
|
894 | });
|
895 |
|
896 |
|
897 |
|
898 | var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 | var shouldObserve = true;
|
905 |
|
906 | function toggleObserving (value) {
|
907 | shouldObserve = value;
|
908 | }
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 | var Observer = function Observer (value) {
|
917 | this.value = value;
|
918 | this.dep = new Dep();
|
919 | this.vmCount = 0;
|
920 | def(value, '__ob__', this);
|
921 | if (Array.isArray(value)) {
|
922 | if (hasProto) {
|
923 | protoAugment(value, arrayMethods);
|
924 | } else {
|
925 | copyAugment(value, arrayMethods, arrayKeys);
|
926 | }
|
927 | this.observeArray(value);
|
928 | } else {
|
929 | this.walk(value);
|
930 | }
|
931 | };
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 | Observer.prototype.walk = function walk (obj) {
|
939 | var keys = Object.keys(obj);
|
940 | for (var i = 0; i < keys.length; i++) {
|
941 | defineReactive$$1(obj, keys[i]);
|
942 | }
|
943 | };
|
944 |
|
945 |
|
946 |
|
947 |
|
948 | Observer.prototype.observeArray = function observeArray (items) {
|
949 | for (var i = 0, l = items.length; i < l; i++) {
|
950 | observe(items[i]);
|
951 | }
|
952 | };
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 | function protoAugment (target, src) {
|
961 |
|
962 | target.__proto__ = src;
|
963 |
|
964 | }
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 | function copyAugment (target, src, keys) {
|
972 | for (var i = 0, l = keys.length; i < l; i++) {
|
973 | var key = keys[i];
|
974 | def(target, key, src[key]);
|
975 | }
|
976 | }
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 | function observe (value, asRootData) {
|
984 | if (!isObject(value) || value instanceof VNode) {
|
985 | return
|
986 | }
|
987 | var ob;
|
988 | if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
989 | ob = value.__ob__;
|
990 | } else if (
|
991 | shouldObserve &&
|
992 | !isServerRendering() &&
|
993 | (Array.isArray(value) || isPlainObject(value)) &&
|
994 | Object.isExtensible(value) &&
|
995 | !value._isVue
|
996 | ) {
|
997 | ob = new Observer(value);
|
998 | }
|
999 | if (asRootData && ob) {
|
1000 | ob.vmCount++;
|
1001 | }
|
1002 | return ob
|
1003 | }
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 | function defineReactive$$1 (
|
1009 | obj,
|
1010 | key,
|
1011 | val,
|
1012 | customSetter,
|
1013 | shallow
|
1014 | ) {
|
1015 | var dep = new Dep();
|
1016 |
|
1017 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
1018 | if (property && property.configurable === false) {
|
1019 | return
|
1020 | }
|
1021 |
|
1022 |
|
1023 | var getter = property && property.get;
|
1024 | var setter = property && property.set;
|
1025 | if ((!getter || setter) && arguments.length === 2) {
|
1026 | val = obj[key];
|
1027 | }
|
1028 |
|
1029 | var childOb = !shallow && observe(val);
|
1030 | Object.defineProperty(obj, key, {
|
1031 | enumerable: true,
|
1032 | configurable: true,
|
1033 | get: function reactiveGetter () {
|
1034 | var value = getter ? getter.call(obj) : val;
|
1035 | if (Dep.target) {
|
1036 | dep.depend();
|
1037 | if (childOb) {
|
1038 | childOb.dep.depend();
|
1039 | if (Array.isArray(value)) {
|
1040 | dependArray(value);
|
1041 | }
|
1042 | }
|
1043 | }
|
1044 | return value
|
1045 | },
|
1046 | set: function reactiveSetter (newVal) {
|
1047 | var value = getter ? getter.call(obj) : val;
|
1048 |
|
1049 | if (newVal === value || (newVal !== newVal && value !== value)) {
|
1050 | return
|
1051 | }
|
1052 |
|
1053 | if (process.env.NODE_ENV !== 'production' && customSetter) {
|
1054 | customSetter();
|
1055 | }
|
1056 |
|
1057 | if (getter && !setter) { return }
|
1058 | if (setter) {
|
1059 | setter.call(obj, newVal);
|
1060 | } else {
|
1061 | val = newVal;
|
1062 | }
|
1063 | childOb = !shallow && observe(newVal);
|
1064 | dep.notify();
|
1065 | }
|
1066 | });
|
1067 | }
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 | function set (target, key, val) {
|
1075 | if (process.env.NODE_ENV !== 'production' &&
|
1076 | (isUndef(target) || isPrimitive(target))
|
1077 | ) {
|
1078 | warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1079 | }
|
1080 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1081 | target.length = Math.max(target.length, key);
|
1082 | target.splice(key, 1, val);
|
1083 | return val
|
1084 | }
|
1085 | if (key in target && !(key in Object.prototype)) {
|
1086 | target[key] = val;
|
1087 | return val
|
1088 | }
|
1089 | var ob = (target).__ob__;
|
1090 | if (target._isVue || (ob && ob.vmCount)) {
|
1091 | process.env.NODE_ENV !== 'production' && warn(
|
1092 | 'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1093 | 'at runtime - declare it upfront in the data option.'
|
1094 | );
|
1095 | return val
|
1096 | }
|
1097 | if (!ob) {
|
1098 | target[key] = val;
|
1099 | return val
|
1100 | }
|
1101 | defineReactive$$1(ob.value, key, val);
|
1102 | ob.dep.notify();
|
1103 | return val
|
1104 | }
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 | function del (target, key) {
|
1110 | if (process.env.NODE_ENV !== 'production' &&
|
1111 | (isUndef(target) || isPrimitive(target))
|
1112 | ) {
|
1113 | warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
1114 | }
|
1115 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1116 | target.splice(key, 1);
|
1117 | return
|
1118 | }
|
1119 | var ob = (target).__ob__;
|
1120 | if (target._isVue || (ob && ob.vmCount)) {
|
1121 | process.env.NODE_ENV !== 'production' && warn(
|
1122 | 'Avoid deleting properties on a Vue instance or its root $data ' +
|
1123 | '- just set it to null.'
|
1124 | );
|
1125 | return
|
1126 | }
|
1127 | if (!hasOwn(target, key)) {
|
1128 | return
|
1129 | }
|
1130 | delete target[key];
|
1131 | if (!ob) {
|
1132 | return
|
1133 | }
|
1134 | ob.dep.notify();
|
1135 | }
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 | function dependArray (value) {
|
1142 | for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1143 | e = value[i];
|
1144 | e && e.__ob__ && e.__ob__.dep.depend();
|
1145 | if (Array.isArray(e)) {
|
1146 | dependArray(e);
|
1147 | }
|
1148 | }
|
1149 | }
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 | var strats = config.optionMergeStrategies;
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 | if (process.env.NODE_ENV !== 'production') {
|
1164 | strats.el = strats.propsData = function (parent, child, vm, key) {
|
1165 | if (!vm) {
|
1166 | warn(
|
1167 | "option \"" + key + "\" can only be used during instance " +
|
1168 | 'creation with the `new` keyword.'
|
1169 | );
|
1170 | }
|
1171 | return defaultStrat(parent, child)
|
1172 | };
|
1173 | }
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 | function mergeData (to, from) {
|
1179 | if (!from) { return to }
|
1180 | var key, toVal, fromVal;
|
1181 |
|
1182 | var keys = hasSymbol
|
1183 | ? Reflect.ownKeys(from)
|
1184 | : Object.keys(from);
|
1185 |
|
1186 | for (var i = 0; i < keys.length; i++) {
|
1187 | key = keys[i];
|
1188 |
|
1189 | if (key === '__ob__') { continue }
|
1190 | toVal = to[key];
|
1191 | fromVal = from[key];
|
1192 | if (!hasOwn(to, key)) {
|
1193 | set(to, key, fromVal);
|
1194 | } else if (
|
1195 | toVal !== fromVal &&
|
1196 | isPlainObject(toVal) &&
|
1197 | isPlainObject(fromVal)
|
1198 | ) {
|
1199 | mergeData(toVal, fromVal);
|
1200 | }
|
1201 | }
|
1202 | return to
|
1203 | }
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 | function mergeDataOrFn (
|
1209 | parentVal,
|
1210 | childVal,
|
1211 | vm
|
1212 | ) {
|
1213 | if (!vm) {
|
1214 |
|
1215 | if (!childVal) {
|
1216 | return parentVal
|
1217 | }
|
1218 | if (!parentVal) {
|
1219 | return childVal
|
1220 | }
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 | return function mergedDataFn () {
|
1227 | return mergeData(
|
1228 | typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1229 | typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1230 | )
|
1231 | }
|
1232 | } else {
|
1233 | return function mergedInstanceDataFn () {
|
1234 |
|
1235 | var instanceData = typeof childVal === 'function'
|
1236 | ? childVal.call(vm, vm)
|
1237 | : childVal;
|
1238 | var defaultData = typeof parentVal === 'function'
|
1239 | ? parentVal.call(vm, vm)
|
1240 | : parentVal;
|
1241 | if (instanceData) {
|
1242 | return mergeData(instanceData, defaultData)
|
1243 | } else {
|
1244 | return defaultData
|
1245 | }
|
1246 | }
|
1247 | }
|
1248 | }
|
1249 |
|
1250 | strats.data = function (
|
1251 | parentVal,
|
1252 | childVal,
|
1253 | vm
|
1254 | ) {
|
1255 | if (!vm) {
|
1256 | if (childVal && typeof childVal !== 'function') {
|
1257 | process.env.NODE_ENV !== 'production' && warn(
|
1258 | 'The "data" option should be a function ' +
|
1259 | 'that returns a per-instance value in component ' +
|
1260 | 'definitions.',
|
1261 | vm
|
1262 | );
|
1263 |
|
1264 | return parentVal
|
1265 | }
|
1266 | return mergeDataOrFn(parentVal, childVal)
|
1267 | }
|
1268 |
|
1269 | return mergeDataOrFn(parentVal, childVal, vm)
|
1270 | };
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 | function mergeHook (
|
1276 | parentVal,
|
1277 | childVal
|
1278 | ) {
|
1279 | var res = childVal
|
1280 | ? parentVal
|
1281 | ? parentVal.concat(childVal)
|
1282 | : Array.isArray(childVal)
|
1283 | ? childVal
|
1284 | : [childVal]
|
1285 | : parentVal;
|
1286 | return res
|
1287 | ? dedupeHooks(res)
|
1288 | : res
|
1289 | }
|
1290 |
|
1291 | function dedupeHooks (hooks) {
|
1292 | var res = [];
|
1293 | for (var i = 0; i < hooks.length; i++) {
|
1294 | if (res.indexOf(hooks[i]) === -1) {
|
1295 | res.push(hooks[i]);
|
1296 | }
|
1297 | }
|
1298 | return res
|
1299 | }
|
1300 |
|
1301 | LIFECYCLE_HOOKS.forEach(function (hook) {
|
1302 | strats[hook] = mergeHook;
|
1303 | });
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 | function mergeAssets (
|
1313 | parentVal,
|
1314 | childVal,
|
1315 | vm,
|
1316 | key
|
1317 | ) {
|
1318 | var res = Object.create(parentVal || null);
|
1319 | if (childVal) {
|
1320 | process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
|
1321 | return extend(res, childVal)
|
1322 | } else {
|
1323 | return res
|
1324 | }
|
1325 | }
|
1326 |
|
1327 | ASSET_TYPES.forEach(function (type) {
|
1328 | strats[type + 's'] = mergeAssets;
|
1329 | });
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 | strats.watch = function (
|
1338 | parentVal,
|
1339 | childVal,
|
1340 | vm,
|
1341 | key
|
1342 | ) {
|
1343 |
|
1344 | if (parentVal === nativeWatch) { parentVal = undefined; }
|
1345 | if (childVal === nativeWatch) { childVal = undefined; }
|
1346 |
|
1347 | if (!childVal) { return Object.create(parentVal || null) }
|
1348 | if (process.env.NODE_ENV !== 'production') {
|
1349 | assertObjectType(key, childVal, vm);
|
1350 | }
|
1351 | if (!parentVal) { return childVal }
|
1352 | var ret = {};
|
1353 | extend(ret, parentVal);
|
1354 | for (var key$1 in childVal) {
|
1355 | var parent = ret[key$1];
|
1356 | var child = childVal[key$1];
|
1357 | if (parent && !Array.isArray(parent)) {
|
1358 | parent = [parent];
|
1359 | }
|
1360 | ret[key$1] = parent
|
1361 | ? parent.concat(child)
|
1362 | : Array.isArray(child) ? child : [child];
|
1363 | }
|
1364 | return ret
|
1365 | };
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 | strats.props =
|
1371 | strats.methods =
|
1372 | strats.inject =
|
1373 | strats.computed = function (
|
1374 | parentVal,
|
1375 | childVal,
|
1376 | vm,
|
1377 | key
|
1378 | ) {
|
1379 | if (childVal && process.env.NODE_ENV !== 'production') {
|
1380 | assertObjectType(key, childVal, vm);
|
1381 | }
|
1382 | if (!parentVal) { return childVal }
|
1383 | var ret = Object.create(null);
|
1384 | extend(ret, parentVal);
|
1385 | if (childVal) { extend(ret, childVal); }
|
1386 | return ret
|
1387 | };
|
1388 | strats.provide = mergeDataOrFn;
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 | var defaultStrat = function (parentVal, childVal) {
|
1394 | return childVal === undefined
|
1395 | ? parentVal
|
1396 | : childVal
|
1397 | };
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 | function checkComponents (options) {
|
1403 | for (var key in options.components) {
|
1404 | validateComponentName(key);
|
1405 | }
|
1406 | }
|
1407 |
|
1408 | function validateComponentName (name) {
|
1409 | if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
|
1410 | warn(
|
1411 | 'Invalid component name: "' + name + '". Component names ' +
|
1412 | 'should conform to valid custom element name in html5 specification.'
|
1413 | );
|
1414 | }
|
1415 | if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
1416 | warn(
|
1417 | 'Do not use built-in or reserved HTML elements as component ' +
|
1418 | 'id: ' + name
|
1419 | );
|
1420 | }
|
1421 | }
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 | function normalizeProps (options, vm) {
|
1428 | var props = options.props;
|
1429 | if (!props) { return }
|
1430 | var res = {};
|
1431 | var i, val, name;
|
1432 | if (Array.isArray(props)) {
|
1433 | i = props.length;
|
1434 | while (i--) {
|
1435 | val = props[i];
|
1436 | if (typeof val === 'string') {
|
1437 | name = camelize(val);
|
1438 | res[name] = { type: null };
|
1439 | } else if (process.env.NODE_ENV !== 'production') {
|
1440 | warn('props must be strings when using array syntax.');
|
1441 | }
|
1442 | }
|
1443 | } else if (isPlainObject(props)) {
|
1444 | for (var key in props) {
|
1445 | val = props[key];
|
1446 | name = camelize(key);
|
1447 | res[name] = isPlainObject(val)
|
1448 | ? val
|
1449 | : { type: val };
|
1450 | }
|
1451 | } else if (process.env.NODE_ENV !== 'production') {
|
1452 | warn(
|
1453 | "Invalid value for option \"props\": expected an Array or an Object, " +
|
1454 | "but got " + (toRawType(props)) + ".",
|
1455 | vm
|
1456 | );
|
1457 | }
|
1458 | options.props = res;
|
1459 | }
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 | function normalizeInject (options, vm) {
|
1465 | var inject = options.inject;
|
1466 | if (!inject) { return }
|
1467 | var normalized = options.inject = {};
|
1468 | if (Array.isArray(inject)) {
|
1469 | for (var i = 0; i < inject.length; i++) {
|
1470 | normalized[inject[i]] = { from: inject[i] };
|
1471 | }
|
1472 | } else if (isPlainObject(inject)) {
|
1473 | for (var key in inject) {
|
1474 | var val = inject[key];
|
1475 | normalized[key] = isPlainObject(val)
|
1476 | ? extend({ from: key }, val)
|
1477 | : { from: val };
|
1478 | }
|
1479 | } else if (process.env.NODE_ENV !== 'production') {
|
1480 | warn(
|
1481 | "Invalid value for option \"inject\": expected an Array or an Object, " +
|
1482 | "but got " + (toRawType(inject)) + ".",
|
1483 | vm
|
1484 | );
|
1485 | }
|
1486 | }
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 | function normalizeDirectives (options) {
|
1492 | var dirs = options.directives;
|
1493 | if (dirs) {
|
1494 | for (var key in dirs) {
|
1495 | var def$$1 = dirs[key];
|
1496 | if (typeof def$$1 === 'function') {
|
1497 | dirs[key] = { bind: def$$1, update: def$$1 };
|
1498 | }
|
1499 | }
|
1500 | }
|
1501 | }
|
1502 |
|
1503 | function assertObjectType (name, value, vm) {
|
1504 | if (!isPlainObject(value)) {
|
1505 | warn(
|
1506 | "Invalid value for option \"" + name + "\": expected an Object, " +
|
1507 | "but got " + (toRawType(value)) + ".",
|
1508 | vm
|
1509 | );
|
1510 | }
|
1511 | }
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 | function mergeOptions (
|
1518 | parent,
|
1519 | child,
|
1520 | vm
|
1521 | ) {
|
1522 | if (process.env.NODE_ENV !== 'production') {
|
1523 | checkComponents(child);
|
1524 | }
|
1525 |
|
1526 | if (typeof child === 'function') {
|
1527 | child = child.options;
|
1528 | }
|
1529 |
|
1530 | normalizeProps(child, vm);
|
1531 | normalizeInject(child, vm);
|
1532 | normalizeDirectives(child);
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 | if (!child._base) {
|
1539 | if (child.extends) {
|
1540 | parent = mergeOptions(parent, child.extends, vm);
|
1541 | }
|
1542 | if (child.mixins) {
|
1543 | for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1544 | parent = mergeOptions(parent, child.mixins[i], vm);
|
1545 | }
|
1546 | }
|
1547 | }
|
1548 |
|
1549 | var options = {};
|
1550 | var key;
|
1551 | for (key in parent) {
|
1552 | mergeField(key);
|
1553 | }
|
1554 | for (key in child) {
|
1555 | if (!hasOwn(parent, key)) {
|
1556 | mergeField(key);
|
1557 | }
|
1558 | }
|
1559 | function mergeField (key) {
|
1560 | var strat = strats[key] || defaultStrat;
|
1561 | options[key] = strat(parent[key], child[key], vm, key);
|
1562 | }
|
1563 | return options
|
1564 | }
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 | function resolveAsset (
|
1572 | options,
|
1573 | type,
|
1574 | id,
|
1575 | warnMissing
|
1576 | ) {
|
1577 |
|
1578 | if (typeof id !== 'string') {
|
1579 | return
|
1580 | }
|
1581 | var assets = options[type];
|
1582 |
|
1583 | if (hasOwn(assets, id)) { return assets[id] }
|
1584 | var camelizedId = camelize(id);
|
1585 | if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1586 | var PascalCaseId = capitalize(camelizedId);
|
1587 | if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1588 |
|
1589 | var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1590 | if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
|
1591 | warn(
|
1592 | 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
1593 | options
|
1594 | );
|
1595 | }
|
1596 | return res
|
1597 | }
|
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 | function validateProp (
|
1604 | key,
|
1605 | propOptions,
|
1606 | propsData,
|
1607 | vm
|
1608 | ) {
|
1609 | var prop = propOptions[key];
|
1610 | var absent = !hasOwn(propsData, key);
|
1611 | var value = propsData[key];
|
1612 |
|
1613 | var booleanIndex = getTypeIndex(Boolean, prop.type);
|
1614 | if (booleanIndex > -1) {
|
1615 | if (absent && !hasOwn(prop, 'default')) {
|
1616 | value = false;
|
1617 | } else if (value === '' || value === hyphenate(key)) {
|
1618 |
|
1619 |
|
1620 | var stringIndex = getTypeIndex(String, prop.type);
|
1621 | if (stringIndex < 0 || booleanIndex < stringIndex) {
|
1622 | value = true;
|
1623 | }
|
1624 | }
|
1625 | }
|
1626 |
|
1627 | if (value === undefined) {
|
1628 | value = getPropDefaultValue(vm, prop, key);
|
1629 |
|
1630 |
|
1631 | var prevShouldObserve = shouldObserve;
|
1632 | toggleObserving(true);
|
1633 | observe(value);
|
1634 | toggleObserving(prevShouldObserve);
|
1635 | }
|
1636 | if (
|
1637 | process.env.NODE_ENV !== 'production' &&
|
1638 |
|
1639 | !(false)
|
1640 | ) {
|
1641 | assertProp(prop, key, value, vm, absent);
|
1642 | }
|
1643 | return value
|
1644 | }
|
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 | function getPropDefaultValue (vm, prop, key) {
|
1650 |
|
1651 | if (!hasOwn(prop, 'default')) {
|
1652 | return undefined
|
1653 | }
|
1654 | var def = prop.default;
|
1655 |
|
1656 | if (process.env.NODE_ENV !== 'production' && isObject(def)) {
|
1657 | warn(
|
1658 | 'Invalid default value for prop "' + key + '": ' +
|
1659 | 'Props with type Object/Array must use a factory function ' +
|
1660 | 'to return the default value.',
|
1661 | vm
|
1662 | );
|
1663 | }
|
1664 |
|
1665 |
|
1666 | if (vm && vm.$options.propsData &&
|
1667 | vm.$options.propsData[key] === undefined &&
|
1668 | vm._props[key] !== undefined
|
1669 | ) {
|
1670 | return vm._props[key]
|
1671 | }
|
1672 |
|
1673 |
|
1674 | return typeof def === 'function' && getType(prop.type) !== 'Function'
|
1675 | ? def.call(vm)
|
1676 | : def
|
1677 | }
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 | function assertProp (
|
1683 | prop,
|
1684 | name,
|
1685 | value,
|
1686 | vm,
|
1687 | absent
|
1688 | ) {
|
1689 | if (prop.required && absent) {
|
1690 | warn(
|
1691 | 'Missing required prop: "' + name + '"',
|
1692 | vm
|
1693 | );
|
1694 | return
|
1695 | }
|
1696 | if (value == null && !prop.required) {
|
1697 | return
|
1698 | }
|
1699 | var type = prop.type;
|
1700 | var valid = !type || type === true;
|
1701 | var expectedTypes = [];
|
1702 | if (type) {
|
1703 | if (!Array.isArray(type)) {
|
1704 | type = [type];
|
1705 | }
|
1706 | for (var i = 0; i < type.length && !valid; i++) {
|
1707 | var assertedType = assertType(value, type[i]);
|
1708 | expectedTypes.push(assertedType.expectedType || '');
|
1709 | valid = assertedType.valid;
|
1710 | }
|
1711 | }
|
1712 |
|
1713 | if (!valid) {
|
1714 | warn(
|
1715 | getInvalidTypeMessage(name, value, expectedTypes),
|
1716 | vm
|
1717 | );
|
1718 | return
|
1719 | }
|
1720 | var validator = prop.validator;
|
1721 | if (validator) {
|
1722 | if (!validator(value)) {
|
1723 | warn(
|
1724 | 'Invalid prop: custom validator check failed for prop "' + name + '".',
|
1725 | vm
|
1726 | );
|
1727 | }
|
1728 | }
|
1729 | }
|
1730 |
|
1731 | var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
1732 |
|
1733 | function assertType (value, type) {
|
1734 | var valid;
|
1735 | var expectedType = getType(type);
|
1736 | if (simpleCheckRE.test(expectedType)) {
|
1737 | var t = typeof value;
|
1738 | valid = t === expectedType.toLowerCase();
|
1739 |
|
1740 | if (!valid && t === 'object') {
|
1741 | valid = value instanceof type;
|
1742 | }
|
1743 | } else if (expectedType === 'Object') {
|
1744 | valid = isPlainObject(value);
|
1745 | } else if (expectedType === 'Array') {
|
1746 | valid = Array.isArray(value);
|
1747 | } else {
|
1748 | valid = value instanceof type;
|
1749 | }
|
1750 | return {
|
1751 | valid: valid,
|
1752 | expectedType: expectedType
|
1753 | }
|
1754 | }
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 | function getType (fn) {
|
1762 | var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
1763 | return match ? match[1] : ''
|
1764 | }
|
1765 |
|
1766 | function isSameType (a, b) {
|
1767 | return getType(a) === getType(b)
|
1768 | }
|
1769 |
|
1770 | function getTypeIndex (type, expectedTypes) {
|
1771 | if (!Array.isArray(expectedTypes)) {
|
1772 | return isSameType(expectedTypes, type) ? 0 : -1
|
1773 | }
|
1774 | for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
1775 | if (isSameType(expectedTypes[i], type)) {
|
1776 | return i
|
1777 | }
|
1778 | }
|
1779 | return -1
|
1780 | }
|
1781 |
|
1782 | function getInvalidTypeMessage (name, value, expectedTypes) {
|
1783 | var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
1784 | " Expected " + (expectedTypes.map(capitalize).join(', '));
|
1785 | var expectedType = expectedTypes[0];
|
1786 | var receivedType = toRawType(value);
|
1787 | var expectedValue = styleValue(value, expectedType);
|
1788 | var receivedValue = styleValue(value, receivedType);
|
1789 |
|
1790 | if (expectedTypes.length === 1 &&
|
1791 | isExplicable(expectedType) &&
|
1792 | !isBoolean(expectedType, receivedType)) {
|
1793 | message += " with value " + expectedValue;
|
1794 | }
|
1795 | message += ", got " + receivedType + " ";
|
1796 |
|
1797 | if (isExplicable(receivedType)) {
|
1798 | message += "with value " + receivedValue + ".";
|
1799 | }
|
1800 | return message
|
1801 | }
|
1802 |
|
1803 | function styleValue (value, type) {
|
1804 | if (type === 'String') {
|
1805 | return ("\"" + value + "\"")
|
1806 | } else if (type === 'Number') {
|
1807 | return ("" + (Number(value)))
|
1808 | } else {
|
1809 | return ("" + value)
|
1810 | }
|
1811 | }
|
1812 |
|
1813 | function isExplicable (value) {
|
1814 | var explicitTypes = ['string', 'number', 'boolean'];
|
1815 | return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
1816 | }
|
1817 |
|
1818 | function isBoolean () {
|
1819 | var args = [], len = arguments.length;
|
1820 | while ( len-- ) args[ len ] = arguments[ len ];
|
1821 |
|
1822 | return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
1823 | }
|
1824 |
|
1825 |
|
1826 |
|
1827 | function handleError (err, vm, info) {
|
1828 |
|
1829 |
|
1830 | pushTarget();
|
1831 | try {
|
1832 | if (vm) {
|
1833 | var cur = vm;
|
1834 | while ((cur = cur.$parent)) {
|
1835 | var hooks = cur.$options.errorCaptured;
|
1836 | if (hooks) {
|
1837 | for (var i = 0; i < hooks.length; i++) {
|
1838 | try {
|
1839 | var capture = hooks[i].call(cur, err, vm, info) === false;
|
1840 | if (capture) { return }
|
1841 | } catch (e) {
|
1842 | globalHandleError(e, cur, 'errorCaptured hook');
|
1843 | }
|
1844 | }
|
1845 | }
|
1846 | }
|
1847 | }
|
1848 | globalHandleError(err, vm, info);
|
1849 | } finally {
|
1850 | popTarget();
|
1851 | }
|
1852 | }
|
1853 |
|
1854 | function invokeWithErrorHandling (
|
1855 | handler,
|
1856 | context,
|
1857 | args,
|
1858 | vm,
|
1859 | info
|
1860 | ) {
|
1861 | var res;
|
1862 | try {
|
1863 | res = args ? handler.apply(context, args) : handler.call(context);
|
1864 | if (res && !res._isVue && isPromise(res)) {
|
1865 |
|
1866 |
|
1867 | res = res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
1868 | }
|
1869 | } catch (e) {
|
1870 | handleError(e, vm, info);
|
1871 | }
|
1872 | return res
|
1873 | }
|
1874 |
|
1875 | function globalHandleError (err, vm, info) {
|
1876 | if (config.errorHandler) {
|
1877 | try {
|
1878 | return config.errorHandler.call(null, err, vm, info)
|
1879 | } catch (e) {
|
1880 |
|
1881 |
|
1882 | if (e !== err) {
|
1883 | logError(e, null, 'config.errorHandler');
|
1884 | }
|
1885 | }
|
1886 | }
|
1887 | logError(err, vm, info);
|
1888 | }
|
1889 |
|
1890 | function logError (err, vm, info) {
|
1891 | if (process.env.NODE_ENV !== 'production') {
|
1892 | warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
1893 | }
|
1894 |
|
1895 | if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
1896 | console.error(err);
|
1897 | } else {
|
1898 | throw err
|
1899 | }
|
1900 | }
|
1901 |
|
1902 |
|
1903 |
|
1904 | var isUsingMicroTask = false;
|
1905 |
|
1906 | var callbacks = [];
|
1907 | var pending = false;
|
1908 |
|
1909 | function flushCallbacks () {
|
1910 | pending = false;
|
1911 | var copies = callbacks.slice(0);
|
1912 | callbacks.length = 0;
|
1913 | for (var i = 0; i < copies.length; i++) {
|
1914 | copies[i]();
|
1915 | }
|
1916 | }
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 | var timerFunc;
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 | if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
1939 | var p = Promise.resolve();
|
1940 | timerFunc = function () {
|
1941 | p.then(flushCallbacks);
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 | if (isIOS) { setTimeout(noop); }
|
1948 | };
|
1949 | isUsingMicroTask = true;
|
1950 | } else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1951 | isNative(MutationObserver) ||
|
1952 |
|
1953 | MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1954 | )) {
|
1955 |
|
1956 |
|
1957 |
|
1958 | var counter = 1;
|
1959 | var observer = new MutationObserver(flushCallbacks);
|
1960 | var textNode = document.createTextNode(String(counter));
|
1961 | observer.observe(textNode, {
|
1962 | characterData: true
|
1963 | });
|
1964 | timerFunc = function () {
|
1965 | counter = (counter + 1) % 2;
|
1966 | textNode.data = String(counter);
|
1967 | };
|
1968 | isUsingMicroTask = true;
|
1969 | } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
1970 |
|
1971 |
|
1972 |
|
1973 | timerFunc = function () {
|
1974 | setImmediate(flushCallbacks);
|
1975 | };
|
1976 | } else {
|
1977 |
|
1978 | timerFunc = function () {
|
1979 | setTimeout(flushCallbacks, 0);
|
1980 | };
|
1981 | }
|
1982 |
|
1983 | function nextTick (cb, ctx) {
|
1984 | var _resolve;
|
1985 | callbacks.push(function () {
|
1986 | if (cb) {
|
1987 | try {
|
1988 | cb.call(ctx);
|
1989 | } catch (e) {
|
1990 | handleError(e, ctx, 'nextTick');
|
1991 | }
|
1992 | } else if (_resolve) {
|
1993 | _resolve(ctx);
|
1994 | }
|
1995 | });
|
1996 | if (!pending) {
|
1997 | pending = true;
|
1998 | timerFunc();
|
1999 | }
|
2000 |
|
2001 | if (!cb && typeof Promise !== 'undefined') {
|
2002 | return new Promise(function (resolve) {
|
2003 | _resolve = resolve;
|
2004 | })
|
2005 | }
|
2006 | }
|
2007 |
|
2008 |
|
2009 |
|
2010 | var mark;
|
2011 | var measure;
|
2012 |
|
2013 | if (process.env.NODE_ENV !== 'production') {
|
2014 | var perf = inBrowser && window.performance;
|
2015 |
|
2016 | if (
|
2017 | perf &&
|
2018 | perf.mark &&
|
2019 | perf.measure &&
|
2020 | perf.clearMarks &&
|
2021 | perf.clearMeasures
|
2022 | ) {
|
2023 | mark = function (tag) { return perf.mark(tag); };
|
2024 | measure = function (name, startTag, endTag) {
|
2025 | perf.measure(name, startTag, endTag);
|
2026 | perf.clearMarks(startTag);
|
2027 | perf.clearMarks(endTag);
|
2028 |
|
2029 | };
|
2030 | }
|
2031 | }
|
2032 |
|
2033 |
|
2034 |
|
2035 | var initProxy;
|
2036 |
|
2037 | if (process.env.NODE_ENV !== 'production') {
|
2038 | var allowedGlobals = makeMap(
|
2039 | 'Infinity,undefined,NaN,isFinite,isNaN,' +
|
2040 | 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
2041 | 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
2042 | 'require'
|
2043 | );
|
2044 |
|
2045 | var warnNonPresent = function (target, key) {
|
2046 | warn(
|
2047 | "Property or method \"" + key + "\" is not defined on the instance but " +
|
2048 | 'referenced during render. Make sure that this property is reactive, ' +
|
2049 | 'either in the data option, or for class-based components, by ' +
|
2050 | 'initializing the property. ' +
|
2051 | 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
2052 | target
|
2053 | );
|
2054 | };
|
2055 |
|
2056 | var warnReservedPrefix = function (target, key) {
|
2057 | warn(
|
2058 | "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
2059 | 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
2060 | 'prevent conflicts with Vue internals' +
|
2061 | 'See: https://vuejs.org/v2/api/#data',
|
2062 | target
|
2063 | );
|
2064 | };
|
2065 |
|
2066 | var hasProxy =
|
2067 | typeof Proxy !== 'undefined' && isNative(Proxy);
|
2068 |
|
2069 | if (hasProxy) {
|
2070 | var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
2071 | config.keyCodes = new Proxy(config.keyCodes, {
|
2072 | set: function set (target, key, value) {
|
2073 | if (isBuiltInModifier(key)) {
|
2074 | warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
2075 | return false
|
2076 | } else {
|
2077 | target[key] = value;
|
2078 | return true
|
2079 | }
|
2080 | }
|
2081 | });
|
2082 | }
|
2083 |
|
2084 | var hasHandler = {
|
2085 | has: function has (target, key) {
|
2086 | var has = key in target;
|
2087 | var isAllowed = allowedGlobals(key) ||
|
2088 | (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
2089 | if (!has && !isAllowed) {
|
2090 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2091 | else { warnNonPresent(target, key); }
|
2092 | }
|
2093 | return has || !isAllowed
|
2094 | }
|
2095 | };
|
2096 |
|
2097 | var getHandler = {
|
2098 | get: function get (target, key) {
|
2099 | if (typeof key === 'string' && !(key in target)) {
|
2100 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2101 | else { warnNonPresent(target, key); }
|
2102 | }
|
2103 | return target[key]
|
2104 | }
|
2105 | };
|
2106 |
|
2107 | initProxy = function initProxy (vm) {
|
2108 | if (hasProxy) {
|
2109 |
|
2110 | var options = vm.$options;
|
2111 | var handlers = options.render && options.render._withStripped
|
2112 | ? getHandler
|
2113 | : hasHandler;
|
2114 | vm._renderProxy = new Proxy(vm, handlers);
|
2115 | } else {
|
2116 | vm._renderProxy = vm;
|
2117 | }
|
2118 | };
|
2119 | }
|
2120 |
|
2121 |
|
2122 |
|
2123 | var seenObjects = new _Set();
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 | function traverse (val) {
|
2131 | _traverse(val, seenObjects);
|
2132 | seenObjects.clear();
|
2133 | }
|
2134 |
|
2135 | function _traverse (val, seen) {
|
2136 | var i, keys;
|
2137 | var isA = Array.isArray(val);
|
2138 | if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
2139 | return
|
2140 | }
|
2141 | if (val.__ob__) {
|
2142 | var depId = val.__ob__.dep.id;
|
2143 | if (seen.has(depId)) {
|
2144 | return
|
2145 | }
|
2146 | seen.add(depId);
|
2147 | }
|
2148 | if (isA) {
|
2149 | i = val.length;
|
2150 | while (i--) { _traverse(val[i], seen); }
|
2151 | } else {
|
2152 | keys = Object.keys(val);
|
2153 | i = keys.length;
|
2154 | while (i--) { _traverse(val[keys[i]], seen); }
|
2155 | }
|
2156 | }
|
2157 |
|
2158 |
|
2159 |
|
2160 | var normalizeEvent = cached(function (name) {
|
2161 | var passive = name.charAt(0) === '&';
|
2162 | name = passive ? name.slice(1) : name;
|
2163 | var once$$1 = name.charAt(0) === '~';
|
2164 | name = once$$1 ? name.slice(1) : name;
|
2165 | var capture = name.charAt(0) === '!';
|
2166 | name = capture ? name.slice(1) : name;
|
2167 | return {
|
2168 | name: name,
|
2169 | once: once$$1,
|
2170 | capture: capture,
|
2171 | passive: passive
|
2172 | }
|
2173 | });
|
2174 |
|
2175 | function createFnInvoker (fns, vm) {
|
2176 | function invoker () {
|
2177 | var arguments$1 = arguments;
|
2178 |
|
2179 | var fns = invoker.fns;
|
2180 | if (Array.isArray(fns)) {
|
2181 | var cloned = fns.slice();
|
2182 | for (var i = 0; i < cloned.length; i++) {
|
2183 | invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
2184 | }
|
2185 | } else {
|
2186 |
|
2187 | return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
2188 | }
|
2189 | }
|
2190 | invoker.fns = fns;
|
2191 | return invoker
|
2192 | }
|
2193 |
|
2194 | function updateListeners (
|
2195 | on,
|
2196 | oldOn,
|
2197 | add,
|
2198 | remove$$1,
|
2199 | createOnceHandler,
|
2200 | vm
|
2201 | ) {
|
2202 | var name, def$$1, cur, old, event;
|
2203 | for (name in on) {
|
2204 | def$$1 = cur = on[name];
|
2205 | old = oldOn[name];
|
2206 | event = normalizeEvent(name);
|
2207 | if (isUndef(cur)) {
|
2208 | process.env.NODE_ENV !== 'production' && warn(
|
2209 | "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
2210 | vm
|
2211 | );
|
2212 | } else if (isUndef(old)) {
|
2213 | if (isUndef(cur.fns)) {
|
2214 | cur = on[name] = createFnInvoker(cur, vm);
|
2215 | }
|
2216 | if (isTrue(event.once)) {
|
2217 | cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
2218 | }
|
2219 | add(event.name, cur, event.capture, event.passive, event.params);
|
2220 | } else if (cur !== old) {
|
2221 | old.fns = cur;
|
2222 | on[name] = old;
|
2223 | }
|
2224 | }
|
2225 | for (name in oldOn) {
|
2226 | if (isUndef(on[name])) {
|
2227 | event = normalizeEvent(name);
|
2228 | remove$$1(event.name, oldOn[name], event.capture);
|
2229 | }
|
2230 | }
|
2231 | }
|
2232 |
|
2233 |
|
2234 |
|
2235 | function mergeVNodeHook (def, hookKey, hook) {
|
2236 | if (def instanceof VNode) {
|
2237 | def = def.data.hook || (def.data.hook = {});
|
2238 | }
|
2239 | var invoker;
|
2240 | var oldHook = def[hookKey];
|
2241 |
|
2242 | function wrappedHook () {
|
2243 | hook.apply(this, arguments);
|
2244 |
|
2245 |
|
2246 | remove(invoker.fns, wrappedHook);
|
2247 | }
|
2248 |
|
2249 | if (isUndef(oldHook)) {
|
2250 |
|
2251 | invoker = createFnInvoker([wrappedHook]);
|
2252 | } else {
|
2253 |
|
2254 | if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
2255 |
|
2256 | invoker = oldHook;
|
2257 | invoker.fns.push(wrappedHook);
|
2258 | } else {
|
2259 |
|
2260 | invoker = createFnInvoker([oldHook, wrappedHook]);
|
2261 | }
|
2262 | }
|
2263 |
|
2264 | invoker.merged = true;
|
2265 | def[hookKey] = invoker;
|
2266 | }
|
2267 |
|
2268 |
|
2269 |
|
2270 | function extractPropsFromVNodeData (
|
2271 | data,
|
2272 | Ctor,
|
2273 | tag
|
2274 | ) {
|
2275 |
|
2276 |
|
2277 |
|
2278 | var propOptions = Ctor.options.props;
|
2279 | if (isUndef(propOptions)) {
|
2280 | return
|
2281 | }
|
2282 | var res = {};
|
2283 | var attrs = data.attrs;
|
2284 | var props = data.props;
|
2285 | if (isDef(attrs) || isDef(props)) {
|
2286 | for (var key in propOptions) {
|
2287 | var altKey = hyphenate(key);
|
2288 | if (process.env.NODE_ENV !== 'production') {
|
2289 | var keyInLowerCase = key.toLowerCase();
|
2290 | if (
|
2291 | key !== keyInLowerCase &&
|
2292 | attrs && hasOwn(attrs, keyInLowerCase)
|
2293 | ) {
|
2294 | tip(
|
2295 | "Prop \"" + keyInLowerCase + "\" is passed to component " +
|
2296 | (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
2297 | " \"" + key + "\". " +
|
2298 | "Note that HTML attributes are case-insensitive and camelCased " +
|
2299 | "props need to use their kebab-case equivalents when using in-DOM " +
|
2300 | "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
2301 | );
|
2302 | }
|
2303 | }
|
2304 | checkProp(res, props, key, altKey, true) ||
|
2305 | checkProp(res, attrs, key, altKey, false);
|
2306 | }
|
2307 | }
|
2308 | return res
|
2309 | }
|
2310 |
|
2311 | function checkProp (
|
2312 | res,
|
2313 | hash,
|
2314 | key,
|
2315 | altKey,
|
2316 | preserve
|
2317 | ) {
|
2318 | if (isDef(hash)) {
|
2319 | if (hasOwn(hash, key)) {
|
2320 | res[key] = hash[key];
|
2321 | if (!preserve) {
|
2322 | delete hash[key];
|
2323 | }
|
2324 | return true
|
2325 | } else if (hasOwn(hash, altKey)) {
|
2326 | res[key] = hash[altKey];
|
2327 | if (!preserve) {
|
2328 | delete hash[altKey];
|
2329 | }
|
2330 | return true
|
2331 | }
|
2332 | }
|
2333 | return false
|
2334 | }
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 | function simpleNormalizeChildren (children) {
|
2351 | for (var i = 0; i < children.length; i++) {
|
2352 | if (Array.isArray(children[i])) {
|
2353 | return Array.prototype.concat.apply([], children)
|
2354 | }
|
2355 | }
|
2356 | return children
|
2357 | }
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 | function normalizeChildren (children) {
|
2364 | return isPrimitive(children)
|
2365 | ? [createTextVNode(children)]
|
2366 | : Array.isArray(children)
|
2367 | ? normalizeArrayChildren(children)
|
2368 | : undefined
|
2369 | }
|
2370 |
|
2371 | function isTextNode (node) {
|
2372 | return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
2373 | }
|
2374 |
|
2375 | function normalizeArrayChildren (children, nestedIndex) {
|
2376 | var res = [];
|
2377 | var i, c, lastIndex, last;
|
2378 | for (i = 0; i < children.length; i++) {
|
2379 | c = children[i];
|
2380 | if (isUndef(c) || typeof c === 'boolean') { continue }
|
2381 | lastIndex = res.length - 1;
|
2382 | last = res[lastIndex];
|
2383 |
|
2384 | if (Array.isArray(c)) {
|
2385 | if (c.length > 0) {
|
2386 | c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
2387 |
|
2388 | if (isTextNode(c[0]) && isTextNode(last)) {
|
2389 | res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
2390 | c.shift();
|
2391 | }
|
2392 | res.push.apply(res, c);
|
2393 | }
|
2394 | } else if (isPrimitive(c)) {
|
2395 | if (isTextNode(last)) {
|
2396 |
|
2397 |
|
2398 |
|
2399 | res[lastIndex] = createTextVNode(last.text + c);
|
2400 | } else if (c !== '') {
|
2401 |
|
2402 | res.push(createTextVNode(c));
|
2403 | }
|
2404 | } else {
|
2405 | if (isTextNode(c) && isTextNode(last)) {
|
2406 |
|
2407 | res[lastIndex] = createTextVNode(last.text + c.text);
|
2408 | } else {
|
2409 |
|
2410 | if (isTrue(children._isVList) &&
|
2411 | isDef(c.tag) &&
|
2412 | isUndef(c.key) &&
|
2413 | isDef(nestedIndex)) {
|
2414 | c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2415 | }
|
2416 | res.push(c);
|
2417 | }
|
2418 | }
|
2419 | }
|
2420 | return res
|
2421 | }
|
2422 |
|
2423 |
|
2424 |
|
2425 | function initProvide (vm) {
|
2426 | var provide = vm.$options.provide;
|
2427 | if (provide) {
|
2428 | vm._provided = typeof provide === 'function'
|
2429 | ? provide.call(vm)
|
2430 | : provide;
|
2431 | }
|
2432 | }
|
2433 |
|
2434 | function initInjections (vm) {
|
2435 | var result = resolveInject(vm.$options.inject, vm);
|
2436 | if (result) {
|
2437 | toggleObserving(false);
|
2438 | Object.keys(result).forEach(function (key) {
|
2439 |
|
2440 | if (process.env.NODE_ENV !== 'production') {
|
2441 | defineReactive$$1(vm, key, result[key], function () {
|
2442 | warn(
|
2443 | "Avoid mutating an injected value directly since the changes will be " +
|
2444 | "overwritten whenever the provided component re-renders. " +
|
2445 | "injection being mutated: \"" + key + "\"",
|
2446 | vm
|
2447 | );
|
2448 | });
|
2449 | } else {
|
2450 | defineReactive$$1(vm, key, result[key]);
|
2451 | }
|
2452 | });
|
2453 | toggleObserving(true);
|
2454 | }
|
2455 | }
|
2456 |
|
2457 | function resolveInject (inject, vm) {
|
2458 | if (inject) {
|
2459 |
|
2460 | var result = Object.create(null);
|
2461 | var keys = hasSymbol
|
2462 | ? Reflect.ownKeys(inject)
|
2463 | : Object.keys(inject);
|
2464 |
|
2465 | for (var i = 0; i < keys.length; i++) {
|
2466 | var key = keys[i];
|
2467 |
|
2468 | if (key === '__ob__') { continue }
|
2469 | var provideKey = inject[key].from;
|
2470 | var source = vm;
|
2471 | while (source) {
|
2472 | if (source._provided && hasOwn(source._provided, provideKey)) {
|
2473 | result[key] = source._provided[provideKey];
|
2474 | break
|
2475 | }
|
2476 | source = source.$parent;
|
2477 | }
|
2478 | if (!source) {
|
2479 | if ('default' in inject[key]) {
|
2480 | var provideDefault = inject[key].default;
|
2481 | result[key] = typeof provideDefault === 'function'
|
2482 | ? provideDefault.call(vm)
|
2483 | : provideDefault;
|
2484 | } else if (process.env.NODE_ENV !== 'production') {
|
2485 | warn(("Injection \"" + key + "\" not found"), vm);
|
2486 | }
|
2487 | }
|
2488 | }
|
2489 | return result
|
2490 | }
|
2491 | }
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 | function resolveSlots (
|
2501 | children,
|
2502 | context
|
2503 | ) {
|
2504 | if (!children || !children.length) {
|
2505 | return {}
|
2506 | }
|
2507 | var slots = {};
|
2508 | for (var i = 0, l = children.length; i < l; i++) {
|
2509 | var child = children[i];
|
2510 | var data = child.data;
|
2511 |
|
2512 | if (data && data.attrs && data.attrs.slot) {
|
2513 | delete data.attrs.slot;
|
2514 | }
|
2515 |
|
2516 |
|
2517 | if ((child.context === context || child.fnContext === context) &&
|
2518 | data && data.slot != null
|
2519 | ) {
|
2520 | var name = data.slot;
|
2521 | var slot = (slots[name] || (slots[name] = []));
|
2522 | if (child.tag === 'template') {
|
2523 | slot.push.apply(slot, child.children || []);
|
2524 | } else {
|
2525 | slot.push(child);
|
2526 | }
|
2527 | } else {
|
2528 | (slots.default || (slots.default = [])).push(child);
|
2529 | }
|
2530 | }
|
2531 |
|
2532 | for (var name$1 in slots) {
|
2533 | if (slots[name$1].every(isWhitespace)) {
|
2534 | delete slots[name$1];
|
2535 | }
|
2536 | }
|
2537 | return slots
|
2538 | }
|
2539 |
|
2540 | function isWhitespace (node) {
|
2541 | return (node.isComment && !node.asyncFactory) || node.text === ' '
|
2542 | }
|
2543 |
|
2544 |
|
2545 |
|
2546 | function normalizeScopedSlots (
|
2547 | slots,
|
2548 | normalSlots,
|
2549 | prevSlots
|
2550 | ) {
|
2551 | var res;
|
2552 | var isStable = slots ? !!slots.$stable : true;
|
2553 | var key = slots && slots.$key;
|
2554 | if (!slots) {
|
2555 | res = {};
|
2556 | } else if (slots._normalized) {
|
2557 |
|
2558 | return slots._normalized
|
2559 | } else if (
|
2560 | isStable &&
|
2561 | prevSlots &&
|
2562 | prevSlots !== emptyObject &&
|
2563 | key === prevSlots.$key &&
|
2564 | Object.keys(normalSlots).length === 0
|
2565 | ) {
|
2566 |
|
2567 |
|
2568 | return prevSlots
|
2569 | } else {
|
2570 | res = {};
|
2571 | for (var key$1 in slots) {
|
2572 | if (slots[key$1] && key$1[0] !== '$') {
|
2573 | res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
|
2574 | }
|
2575 | }
|
2576 | }
|
2577 |
|
2578 | for (var key$2 in normalSlots) {
|
2579 | if (!(key$2 in res)) {
|
2580 | res[key$2] = proxyNormalSlot(normalSlots, key$2);
|
2581 | }
|
2582 | }
|
2583 |
|
2584 |
|
2585 | if (slots && Object.isExtensible(slots)) {
|
2586 | (slots)._normalized = res;
|
2587 | }
|
2588 | def(res, '$stable', isStable);
|
2589 | def(res, '$key', key);
|
2590 | return res
|
2591 | }
|
2592 |
|
2593 | function normalizeScopedSlot(normalSlots, key, fn) {
|
2594 | var normalized = function () {
|
2595 | var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
2596 | res = res && typeof res === 'object' && !Array.isArray(res)
|
2597 | ? [res]
|
2598 | : normalizeChildren(res);
|
2599 | return res && res.length === 0
|
2600 | ? undefined
|
2601 | : res
|
2602 | };
|
2603 |
|
2604 |
|
2605 |
|
2606 | if (fn.proxy) {
|
2607 | Object.defineProperty(normalSlots, key, {
|
2608 | get: normalized,
|
2609 | enumerable: true,
|
2610 | configurable: true
|
2611 | });
|
2612 | }
|
2613 | return normalized
|
2614 | }
|
2615 |
|
2616 | function proxyNormalSlot(slots, key) {
|
2617 | return function () { return slots[key]; }
|
2618 | }
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 | function renderList (
|
2626 | val,
|
2627 | render
|
2628 | ) {
|
2629 | var ret, i, l, keys, key;
|
2630 | if (Array.isArray(val) || typeof val === 'string') {
|
2631 | ret = new Array(val.length);
|
2632 | for (i = 0, l = val.length; i < l; i++) {
|
2633 | ret[i] = render(val[i], i);
|
2634 | }
|
2635 | } else if (typeof val === 'number') {
|
2636 | ret = new Array(val);
|
2637 | for (i = 0; i < val; i++) {
|
2638 | ret[i] = render(i + 1, i);
|
2639 | }
|
2640 | } else if (isObject(val)) {
|
2641 | if (hasSymbol && val[Symbol.iterator]) {
|
2642 | ret = [];
|
2643 | var iterator = val[Symbol.iterator]();
|
2644 | var result = iterator.next();
|
2645 | while (!result.done) {
|
2646 | ret.push(render(result.value, ret.length));
|
2647 | result = iterator.next();
|
2648 | }
|
2649 | } else {
|
2650 | keys = Object.keys(val);
|
2651 | ret = new Array(keys.length);
|
2652 | for (i = 0, l = keys.length; i < l; i++) {
|
2653 | key = keys[i];
|
2654 | ret[i] = render(val[key], key, i);
|
2655 | }
|
2656 | }
|
2657 | }
|
2658 | if (!isDef(ret)) {
|
2659 | ret = [];
|
2660 | }
|
2661 | (ret)._isVList = true;
|
2662 | return ret
|
2663 | }
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 | function renderSlot (
|
2671 | name,
|
2672 | fallback,
|
2673 | props,
|
2674 | bindObject
|
2675 | ) {
|
2676 | var scopedSlotFn = this.$scopedSlots[name];
|
2677 | var nodes;
|
2678 | if (scopedSlotFn) {
|
2679 | props = props || {};
|
2680 | if (bindObject) {
|
2681 | if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
|
2682 | warn(
|
2683 | 'slot v-bind without argument expects an Object',
|
2684 | this
|
2685 | );
|
2686 | }
|
2687 | props = extend(extend({}, bindObject), props);
|
2688 | }
|
2689 | nodes = scopedSlotFn(props) || fallback;
|
2690 | } else {
|
2691 | nodes = this.$slots[name] || fallback;
|
2692 | }
|
2693 |
|
2694 | var target = props && props.slot;
|
2695 | if (target) {
|
2696 | return this.$createElement('template', { slot: target }, nodes)
|
2697 | } else {
|
2698 | return nodes
|
2699 | }
|
2700 | }
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 | function resolveFilter (id) {
|
2708 | return resolveAsset(this.$options, 'filters', id, true) || identity
|
2709 | }
|
2710 |
|
2711 |
|
2712 |
|
2713 | function isKeyNotMatch (expect, actual) {
|
2714 | if (Array.isArray(expect)) {
|
2715 | return expect.indexOf(actual) === -1
|
2716 | } else {
|
2717 | return expect !== actual
|
2718 | }
|
2719 | }
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 | function checkKeyCodes (
|
2727 | eventKeyCode,
|
2728 | key,
|
2729 | builtInKeyCode,
|
2730 | eventKeyName,
|
2731 | builtInKeyName
|
2732 | ) {
|
2733 | var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
2734 | if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
2735 | return isKeyNotMatch(builtInKeyName, eventKeyName)
|
2736 | } else if (mappedKeyCode) {
|
2737 | return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
2738 | } else if (eventKeyName) {
|
2739 | return hyphenate(eventKeyName) !== key
|
2740 | }
|
2741 | }
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 |
|
2748 | function bindObjectProps (
|
2749 | data,
|
2750 | tag,
|
2751 | value,
|
2752 | asProp,
|
2753 | isSync
|
2754 | ) {
|
2755 | if (value) {
|
2756 | if (!isObject(value)) {
|
2757 | process.env.NODE_ENV !== 'production' && warn(
|
2758 | 'v-bind without argument expects an Object or Array value',
|
2759 | this
|
2760 | );
|
2761 | } else {
|
2762 | if (Array.isArray(value)) {
|
2763 | value = toObject(value);
|
2764 | }
|
2765 | var hash;
|
2766 | var loop = function ( key ) {
|
2767 | if (
|
2768 | key === 'class' ||
|
2769 | key === 'style' ||
|
2770 | isReservedAttribute(key)
|
2771 | ) {
|
2772 | hash = data;
|
2773 | } else {
|
2774 | var type = data.attrs && data.attrs.type;
|
2775 | hash = asProp || config.mustUseProp(tag, type, key)
|
2776 | ? data.domProps || (data.domProps = {})
|
2777 | : data.attrs || (data.attrs = {});
|
2778 | }
|
2779 | var camelizedKey = camelize(key);
|
2780 | if (!(key in hash) && !(camelizedKey in hash)) {
|
2781 | hash[key] = value[key];
|
2782 |
|
2783 | if (isSync) {
|
2784 | var on = data.on || (data.on = {});
|
2785 | on[("update:" + camelizedKey)] = function ($event) {
|
2786 | value[key] = $event;
|
2787 | };
|
2788 | }
|
2789 | }
|
2790 | };
|
2791 |
|
2792 | for (var key in value) loop( key );
|
2793 | }
|
2794 | }
|
2795 | return data
|
2796 | }
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 | function renderStatic (
|
2804 | index,
|
2805 | isInFor
|
2806 | ) {
|
2807 | var cached = this._staticTrees || (this._staticTrees = []);
|
2808 | var tree = cached[index];
|
2809 |
|
2810 |
|
2811 | if (tree && !isInFor) {
|
2812 | return tree
|
2813 | }
|
2814 |
|
2815 | tree = cached[index] = this.$options.staticRenderFns[index].call(
|
2816 | this._renderProxy,
|
2817 | null,
|
2818 | this
|
2819 | );
|
2820 | markStatic(tree, ("__static__" + index), false);
|
2821 | return tree
|
2822 | }
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 | function markOnce (
|
2829 | tree,
|
2830 | index,
|
2831 | key
|
2832 | ) {
|
2833 | markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
2834 | return tree
|
2835 | }
|
2836 |
|
2837 | function markStatic (
|
2838 | tree,
|
2839 | key,
|
2840 | isOnce
|
2841 | ) {
|
2842 | if (Array.isArray(tree)) {
|
2843 | for (var i = 0; i < tree.length; i++) {
|
2844 | if (tree[i] && typeof tree[i] !== 'string') {
|
2845 | markStaticNode(tree[i], (key + "_" + i), isOnce);
|
2846 | }
|
2847 | }
|
2848 | } else {
|
2849 | markStaticNode(tree, key, isOnce);
|
2850 | }
|
2851 | }
|
2852 |
|
2853 | function markStaticNode (node, key, isOnce) {
|
2854 | node.isStatic = true;
|
2855 | node.key = key;
|
2856 | node.isOnce = isOnce;
|
2857 | }
|
2858 |
|
2859 |
|
2860 |
|
2861 | function bindObjectListeners (data, value) {
|
2862 | if (value) {
|
2863 | if (!isPlainObject(value)) {
|
2864 | process.env.NODE_ENV !== 'production' && warn(
|
2865 | 'v-on without argument expects an Object value',
|
2866 | this
|
2867 | );
|
2868 | } else {
|
2869 | var on = data.on = data.on ? extend({}, data.on) : {};
|
2870 | for (var key in value) {
|
2871 | var existing = on[key];
|
2872 | var ours = value[key];
|
2873 | on[key] = existing ? [].concat(existing, ours) : ours;
|
2874 | }
|
2875 | }
|
2876 | }
|
2877 | return data
|
2878 | }
|
2879 |
|
2880 |
|
2881 |
|
2882 | function resolveScopedSlots (
|
2883 | fns, // see flow/vnode
|
2884 | res,
|
2885 |
|
2886 | hasDynamicKeys,
|
2887 | contentHashKey
|
2888 | ) {
|
2889 | res = res || { $stable: !hasDynamicKeys };
|
2890 | for (var i = 0; i < fns.length; i++) {
|
2891 | var slot = fns[i];
|
2892 | if (Array.isArray(slot)) {
|
2893 | resolveScopedSlots(slot, res, hasDynamicKeys);
|
2894 | } else if (slot) {
|
2895 |
|
2896 | if (slot.proxy) {
|
2897 | slot.fn.proxy = true;
|
2898 | }
|
2899 | res[slot.key] = slot.fn;
|
2900 | }
|
2901 | }
|
2902 | if (contentHashKey) {
|
2903 | (res).$key = contentHashKey;
|
2904 | }
|
2905 | return res
|
2906 | }
|
2907 |
|
2908 |
|
2909 |
|
2910 | function bindDynamicKeys (baseObj, values) {
|
2911 | for (var i = 0; i < values.length; i += 2) {
|
2912 | var key = values[i];
|
2913 | if (typeof key === 'string' && key) {
|
2914 | baseObj[values[i]] = values[i + 1];
|
2915 | } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
|
2916 |
|
2917 | warn(
|
2918 | ("Invalid value for dynamic directive argument (expected string or null): " + key),
|
2919 | this
|
2920 | );
|
2921 | }
|
2922 | }
|
2923 | return baseObj
|
2924 | }
|
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 | function prependModifier (value, symbol) {
|
2930 | return typeof value === 'string' ? symbol + value : value
|
2931 | }
|
2932 |
|
2933 |
|
2934 |
|
2935 | function installRenderHelpers (target) {
|
2936 | target._o = markOnce;
|
2937 | target._n = toNumber;
|
2938 | target._s = toString;
|
2939 | target._l = renderList;
|
2940 | target._t = renderSlot;
|
2941 | target._q = looseEqual;
|
2942 | target._i = looseIndexOf;
|
2943 | target._m = renderStatic;
|
2944 | target._f = resolveFilter;
|
2945 | target._k = checkKeyCodes;
|
2946 | target._b = bindObjectProps;
|
2947 | target._v = createTextVNode;
|
2948 | target._e = createEmptyVNode;
|
2949 | target._u = resolveScopedSlots;
|
2950 | target._g = bindObjectListeners;
|
2951 | target._d = bindDynamicKeys;
|
2952 | target._p = prependModifier;
|
2953 | }
|
2954 |
|
2955 |
|
2956 |
|
2957 | function FunctionalRenderContext (
|
2958 | data,
|
2959 | props,
|
2960 | children,
|
2961 | parent,
|
2962 | Ctor
|
2963 | ) {
|
2964 | var this$1 = this;
|
2965 |
|
2966 | var options = Ctor.options;
|
2967 |
|
2968 |
|
2969 | var contextVm;
|
2970 | if (hasOwn(parent, '_uid')) {
|
2971 | contextVm = Object.create(parent);
|
2972 |
|
2973 | contextVm._original = parent;
|
2974 | } else {
|
2975 |
|
2976 |
|
2977 |
|
2978 | contextVm = parent;
|
2979 |
|
2980 | parent = parent._original;
|
2981 | }
|
2982 | var isCompiled = isTrue(options._compiled);
|
2983 | var needNormalization = !isCompiled;
|
2984 |
|
2985 | this.data = data;
|
2986 | this.props = props;
|
2987 | this.children = children;
|
2988 | this.parent = parent;
|
2989 | this.listeners = data.on || emptyObject;
|
2990 | this.injections = resolveInject(options.inject, parent);
|
2991 | this.slots = function () {
|
2992 | if (!this$1.$slots) {
|
2993 | normalizeScopedSlots(
|
2994 | data.scopedSlots,
|
2995 | this$1.$slots = resolveSlots(children, parent)
|
2996 | );
|
2997 | }
|
2998 | return this$1.$slots
|
2999 | };
|
3000 |
|
3001 | Object.defineProperty(this, 'scopedSlots', ({
|
3002 | enumerable: true,
|
3003 | get: function get () {
|
3004 | return normalizeScopedSlots(data.scopedSlots, this.slots())
|
3005 | }
|
3006 | }));
|
3007 |
|
3008 |
|
3009 | if (isCompiled) {
|
3010 |
|
3011 | this.$options = options;
|
3012 |
|
3013 | this.$slots = this.slots();
|
3014 | this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
3015 | }
|
3016 |
|
3017 | if (options._scopeId) {
|
3018 | this._c = function (a, b, c, d) {
|
3019 | var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
3020 | if (vnode && !Array.isArray(vnode)) {
|
3021 | vnode.fnScopeId = options._scopeId;
|
3022 | vnode.fnContext = parent;
|
3023 | }
|
3024 | return vnode
|
3025 | };
|
3026 | } else {
|
3027 | this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
3028 | }
|
3029 | }
|
3030 |
|
3031 | installRenderHelpers(FunctionalRenderContext.prototype);
|
3032 |
|
3033 | function createFunctionalComponent (
|
3034 | Ctor,
|
3035 | propsData,
|
3036 | data,
|
3037 | contextVm,
|
3038 | children
|
3039 | ) {
|
3040 | var options = Ctor.options;
|
3041 | var props = {};
|
3042 | var propOptions = options.props;
|
3043 | if (isDef(propOptions)) {
|
3044 | for (var key in propOptions) {
|
3045 | props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
3046 | }
|
3047 | } else {
|
3048 | if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
3049 | if (isDef(data.props)) { mergeProps(props, data.props); }
|
3050 | }
|
3051 |
|
3052 | var renderContext = new FunctionalRenderContext(
|
3053 | data,
|
3054 | props,
|
3055 | children,
|
3056 | contextVm,
|
3057 | Ctor
|
3058 | );
|
3059 |
|
3060 | var vnode = options.render.call(null, renderContext._c, renderContext);
|
3061 |
|
3062 | if (vnode instanceof VNode) {
|
3063 | return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
3064 | } else if (Array.isArray(vnode)) {
|
3065 | var vnodes = normalizeChildren(vnode) || [];
|
3066 | var res = new Array(vnodes.length);
|
3067 | for (var i = 0; i < vnodes.length; i++) {
|
3068 | res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
3069 | }
|
3070 | return res
|
3071 | }
|
3072 | }
|
3073 |
|
3074 | function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
3075 |
|
3076 |
|
3077 |
|
3078 | var clone = cloneVNode(vnode);
|
3079 | clone.fnContext = contextVm;
|
3080 | clone.fnOptions = options;
|
3081 | if (process.env.NODE_ENV !== 'production') {
|
3082 | (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
3083 | }
|
3084 | if (data.slot) {
|
3085 | (clone.data || (clone.data = {})).slot = data.slot;
|
3086 | }
|
3087 | return clone
|
3088 | }
|
3089 |
|
3090 | function mergeProps (to, from) {
|
3091 | for (var key in from) {
|
3092 | to[camelize(key)] = from[key];
|
3093 | }
|
3094 | }
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 | var componentVNodeHooks = {
|
3106 | init: function init (vnode, hydrating) {
|
3107 | if (
|
3108 | vnode.componentInstance &&
|
3109 | !vnode.componentInstance._isDestroyed &&
|
3110 | vnode.data.keepAlive
|
3111 | ) {
|
3112 |
|
3113 | var mountedNode = vnode;
|
3114 | componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
3115 | } else {
|
3116 | var child = vnode.componentInstance = createComponentInstanceForVnode(
|
3117 | vnode,
|
3118 | activeInstance
|
3119 | );
|
3120 | child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
3121 | }
|
3122 | },
|
3123 |
|
3124 | prepatch: function prepatch (oldVnode, vnode) {
|
3125 | var options = vnode.componentOptions;
|
3126 | var child = vnode.componentInstance = oldVnode.componentInstance;
|
3127 | updateChildComponent(
|
3128 | child,
|
3129 | options.propsData,
|
3130 | options.listeners,
|
3131 | vnode,
|
3132 | options.children
|
3133 | );
|
3134 | },
|
3135 |
|
3136 | insert: function insert (vnode) {
|
3137 | var context = vnode.context;
|
3138 | var componentInstance = vnode.componentInstance;
|
3139 | if (!componentInstance._isMounted) {
|
3140 | componentInstance._isMounted = true;
|
3141 | callHook(componentInstance, 'mounted');
|
3142 | }
|
3143 | if (vnode.data.keepAlive) {
|
3144 | if (context._isMounted) {
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 | queueActivatedComponent(componentInstance);
|
3151 | } else {
|
3152 | activateChildComponent(componentInstance, true );
|
3153 | }
|
3154 | }
|
3155 | },
|
3156 |
|
3157 | destroy: function destroy (vnode) {
|
3158 | var componentInstance = vnode.componentInstance;
|
3159 | if (!componentInstance._isDestroyed) {
|
3160 | if (!vnode.data.keepAlive) {
|
3161 | componentInstance.$destroy();
|
3162 | } else {
|
3163 | deactivateChildComponent(componentInstance, true );
|
3164 | }
|
3165 | }
|
3166 | }
|
3167 | };
|
3168 |
|
3169 | var hooksToMerge = Object.keys(componentVNodeHooks);
|
3170 |
|
3171 | function createComponent (
|
3172 | Ctor,
|
3173 | data,
|
3174 | context,
|
3175 | children,
|
3176 | tag
|
3177 | ) {
|
3178 | if (isUndef(Ctor)) {
|
3179 | return
|
3180 | }
|
3181 |
|
3182 | var baseCtor = context.$options._base;
|
3183 |
|
3184 |
|
3185 | if (isObject(Ctor)) {
|
3186 | Ctor = baseCtor.extend(Ctor);
|
3187 | }
|
3188 |
|
3189 |
|
3190 |
|
3191 | if (typeof Ctor !== 'function') {
|
3192 | if (process.env.NODE_ENV !== 'production') {
|
3193 | warn(("Invalid Component definition: " + (String(Ctor))), context);
|
3194 | }
|
3195 | return
|
3196 | }
|
3197 |
|
3198 |
|
3199 | var asyncFactory;
|
3200 | if (isUndef(Ctor.cid)) {
|
3201 | asyncFactory = Ctor;
|
3202 | Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
3203 | if (Ctor === undefined) {
|
3204 |
|
3205 |
|
3206 |
|
3207 | return createAsyncPlaceholder(
|
3208 | asyncFactory,
|
3209 | data,
|
3210 | context,
|
3211 | children,
|
3212 | tag
|
3213 | )
|
3214 | }
|
3215 | }
|
3216 |
|
3217 | data = data || {};
|
3218 |
|
3219 |
|
3220 |
|
3221 | resolveConstructorOptions(Ctor);
|
3222 |
|
3223 |
|
3224 | if (isDef(data.model)) {
|
3225 | transformModel(Ctor.options, data);
|
3226 | }
|
3227 |
|
3228 |
|
3229 | var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
3230 |
|
3231 |
|
3232 | if (isTrue(Ctor.options.functional)) {
|
3233 | return createFunctionalComponent(Ctor, propsData, data, context, children)
|
3234 | }
|
3235 |
|
3236 |
|
3237 |
|
3238 | var listeners = data.on;
|
3239 |
|
3240 |
|
3241 | data.on = data.nativeOn;
|
3242 |
|
3243 | if (isTrue(Ctor.options.abstract)) {
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 | var slot = data.slot;
|
3249 | data = {};
|
3250 | if (slot) {
|
3251 | data.slot = slot;
|
3252 | }
|
3253 | }
|
3254 |
|
3255 |
|
3256 | installComponentHooks(data);
|
3257 |
|
3258 |
|
3259 | var name = Ctor.options.name || tag;
|
3260 | var vnode = new VNode(
|
3261 | ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
3262 | data, undefined, undefined, undefined, context,
|
3263 | { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
3264 | asyncFactory
|
3265 | );
|
3266 |
|
3267 | return vnode
|
3268 | }
|
3269 |
|
3270 | function createComponentInstanceForVnode (
|
3271 | vnode, // we know it's MountedComponentVNode but flow doesn't
|
3272 | parent // activeInstance in lifecycle state
|
3273 | ) {
|
3274 | var options = {
|
3275 | _isComponent: true,
|
3276 | _parentVnode: vnode,
|
3277 | parent: parent
|
3278 | };
|
3279 |
|
3280 | var inlineTemplate = vnode.data.inlineTemplate;
|
3281 | if (isDef(inlineTemplate)) {
|
3282 | options.render = inlineTemplate.render;
|
3283 | options.staticRenderFns = inlineTemplate.staticRenderFns;
|
3284 | }
|
3285 | return new vnode.componentOptions.Ctor(options)
|
3286 | }
|
3287 |
|
3288 | function installComponentHooks (data) {
|
3289 | var hooks = data.hook || (data.hook = {});
|
3290 | for (var i = 0; i < hooksToMerge.length; i++) {
|
3291 | var key = hooksToMerge[i];
|
3292 | var existing = hooks[key];
|
3293 | var toMerge = componentVNodeHooks[key];
|
3294 | if (existing !== toMerge && !(existing && existing._merged)) {
|
3295 | hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
3296 | }
|
3297 | }
|
3298 | }
|
3299 |
|
3300 | function mergeHook$1 (f1, f2) {
|
3301 | var merged = function (a, b) {
|
3302 |
|
3303 | f1(a, b);
|
3304 | f2(a, b);
|
3305 | };
|
3306 | merged._merged = true;
|
3307 | return merged
|
3308 | }
|
3309 |
|
3310 |
|
3311 |
|
3312 | function transformModel (options, data) {
|
3313 | var prop = (options.model && options.model.prop) || 'value';
|
3314 | var event = (options.model && options.model.event) || 'input'
|
3315 | ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
3316 | var on = data.on || (data.on = {});
|
3317 | var existing = on[event];
|
3318 | var callback = data.model.callback;
|
3319 | if (isDef(existing)) {
|
3320 | if (
|
3321 | Array.isArray(existing)
|
3322 | ? existing.indexOf(callback) === -1
|
3323 | : existing !== callback
|
3324 | ) {
|
3325 | on[event] = [callback].concat(existing);
|
3326 | }
|
3327 | } else {
|
3328 | on[event] = callback;
|
3329 | }
|
3330 | }
|
3331 |
|
3332 |
|
3333 |
|
3334 | var SIMPLE_NORMALIZE = 1;
|
3335 | var ALWAYS_NORMALIZE = 2;
|
3336 |
|
3337 |
|
3338 |
|
3339 | function createElement (
|
3340 | context,
|
3341 | tag,
|
3342 | data,
|
3343 | children,
|
3344 | normalizationType,
|
3345 | alwaysNormalize
|
3346 | ) {
|
3347 | if (Array.isArray(data) || isPrimitive(data)) {
|
3348 | normalizationType = children;
|
3349 | children = data;
|
3350 | data = undefined;
|
3351 | }
|
3352 | if (isTrue(alwaysNormalize)) {
|
3353 | normalizationType = ALWAYS_NORMALIZE;
|
3354 | }
|
3355 | return _createElement(context, tag, data, children, normalizationType)
|
3356 | }
|
3357 |
|
3358 | function _createElement (
|
3359 | context,
|
3360 | tag,
|
3361 | data,
|
3362 | children,
|
3363 | normalizationType
|
3364 | ) {
|
3365 | if (isDef(data) && isDef((data).__ob__)) {
|
3366 | process.env.NODE_ENV !== 'production' && warn(
|
3367 | "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
3368 | 'Always create fresh vnode data objects in each render!',
|
3369 | context
|
3370 | );
|
3371 | return createEmptyVNode()
|
3372 | }
|
3373 |
|
3374 | if (isDef(data) && isDef(data.is)) {
|
3375 | tag = data.is;
|
3376 | }
|
3377 | if (!tag) {
|
3378 |
|
3379 | return createEmptyVNode()
|
3380 | }
|
3381 |
|
3382 | if (process.env.NODE_ENV !== 'production' &&
|
3383 | isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
3384 | ) {
|
3385 | {
|
3386 | warn(
|
3387 | 'Avoid using non-primitive value as key, ' +
|
3388 | 'use string/number value instead.',
|
3389 | context
|
3390 | );
|
3391 | }
|
3392 | }
|
3393 |
|
3394 | if (Array.isArray(children) &&
|
3395 | typeof children[0] === 'function'
|
3396 | ) {
|
3397 | data = data || {};
|
3398 | data.scopedSlots = { default: children[0] };
|
3399 | children.length = 0;
|
3400 | }
|
3401 | if (normalizationType === ALWAYS_NORMALIZE) {
|
3402 | children = normalizeChildren(children);
|
3403 | } else if (normalizationType === SIMPLE_NORMALIZE) {
|
3404 | children = simpleNormalizeChildren(children);
|
3405 | }
|
3406 | var vnode, ns;
|
3407 | if (typeof tag === 'string') {
|
3408 | var Ctor;
|
3409 | ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
3410 | if (config.isReservedTag(tag)) {
|
3411 |
|
3412 | vnode = new VNode(
|
3413 | config.parsePlatformTagName(tag), data, children,
|
3414 | undefined, undefined, context
|
3415 | );
|
3416 | } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
3417 |
|
3418 | vnode = createComponent(Ctor, data, context, children, tag);
|
3419 | } else {
|
3420 |
|
3421 |
|
3422 |
|
3423 | vnode = new VNode(
|
3424 | tag, data, children,
|
3425 | undefined, undefined, context
|
3426 | );
|
3427 | }
|
3428 | } else {
|
3429 |
|
3430 | vnode = createComponent(tag, data, context, children);
|
3431 | }
|
3432 | if (Array.isArray(vnode)) {
|
3433 | return vnode
|
3434 | } else if (isDef(vnode)) {
|
3435 | if (isDef(ns)) { applyNS(vnode, ns); }
|
3436 | if (isDef(data)) { registerDeepBindings(data); }
|
3437 | return vnode
|
3438 | } else {
|
3439 | return createEmptyVNode()
|
3440 | }
|
3441 | }
|
3442 |
|
3443 | function applyNS (vnode, ns, force) {
|
3444 | vnode.ns = ns;
|
3445 | if (vnode.tag === 'foreignObject') {
|
3446 |
|
3447 | ns = undefined;
|
3448 | force = true;
|
3449 | }
|
3450 | if (isDef(vnode.children)) {
|
3451 | for (var i = 0, l = vnode.children.length; i < l; i++) {
|
3452 | var child = vnode.children[i];
|
3453 | if (isDef(child.tag) && (
|
3454 | isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
3455 | applyNS(child, ns, force);
|
3456 | }
|
3457 | }
|
3458 | }
|
3459 | }
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 | function registerDeepBindings (data) {
|
3465 | if (isObject(data.style)) {
|
3466 | traverse(data.style);
|
3467 | }
|
3468 | if (isObject(data.class)) {
|
3469 | traverse(data.class);
|
3470 | }
|
3471 | }
|
3472 |
|
3473 |
|
3474 |
|
3475 | function initRender (vm) {
|
3476 | vm._vnode = null;
|
3477 | vm._staticTrees = null;
|
3478 | var options = vm.$options;
|
3479 | var parentVnode = vm.$vnode = options._parentVnode;
|
3480 | var renderContext = parentVnode && parentVnode.context;
|
3481 | vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
3482 | vm.$scopedSlots = emptyObject;
|
3483 |
|
3484 |
|
3485 |
|
3486 |
|
3487 | vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
3488 |
|
3489 |
|
3490 | vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
3491 |
|
3492 |
|
3493 |
|
3494 | var parentData = parentVnode && parentVnode.data;
|
3495 |
|
3496 |
|
3497 | if (process.env.NODE_ENV !== 'production') {
|
3498 | defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
3499 | !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
3500 | }, true);
|
3501 | defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
3502 | !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
3503 | }, true);
|
3504 | } else {
|
3505 | defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
|
3506 | defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
|
3507 | }
|
3508 | }
|
3509 |
|
3510 | var currentRenderingInstance = null;
|
3511 |
|
3512 | function renderMixin (Vue) {
|
3513 |
|
3514 | installRenderHelpers(Vue.prototype);
|
3515 |
|
3516 | Vue.prototype.$nextTick = function (fn) {
|
3517 | return nextTick(fn, this)
|
3518 | };
|
3519 |
|
3520 | Vue.prototype._render = function () {
|
3521 | var vm = this;
|
3522 | var ref = vm.$options;
|
3523 | var render = ref.render;
|
3524 | var _parentVnode = ref._parentVnode;
|
3525 |
|
3526 | if (_parentVnode) {
|
3527 | vm.$scopedSlots = normalizeScopedSlots(
|
3528 | _parentVnode.data.scopedSlots,
|
3529 | vm.$slots,
|
3530 | vm.$scopedSlots
|
3531 | );
|
3532 | }
|
3533 |
|
3534 |
|
3535 |
|
3536 | vm.$vnode = _parentVnode;
|
3537 |
|
3538 | var vnode;
|
3539 | try {
|
3540 |
|
3541 |
|
3542 |
|
3543 | currentRenderingInstance = vm;
|
3544 | vnode = render.call(vm._renderProxy, vm.$createElement);
|
3545 | } catch (e) {
|
3546 | handleError(e, vm, "render");
|
3547 |
|
3548 |
|
3549 |
|
3550 | if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
|
3551 | try {
|
3552 | vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
3553 | } catch (e) {
|
3554 | handleError(e, vm, "renderError");
|
3555 | vnode = vm._vnode;
|
3556 | }
|
3557 | } else {
|
3558 | vnode = vm._vnode;
|
3559 | }
|
3560 | } finally {
|
3561 | currentRenderingInstance = null;
|
3562 | }
|
3563 |
|
3564 | if (Array.isArray(vnode) && vnode.length === 1) {
|
3565 | vnode = vnode[0];
|
3566 | }
|
3567 |
|
3568 | if (!(vnode instanceof VNode)) {
|
3569 | if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
|
3570 | warn(
|
3571 | 'Multiple root nodes returned from render function. Render function ' +
|
3572 | 'should return a single root node.',
|
3573 | vm
|
3574 | );
|
3575 | }
|
3576 | vnode = createEmptyVNode();
|
3577 | }
|
3578 |
|
3579 | vnode.parent = _parentVnode;
|
3580 | return vnode
|
3581 | };
|
3582 | }
|
3583 |
|
3584 |
|
3585 |
|
3586 | function ensureCtor (comp, base) {
|
3587 | if (
|
3588 | comp.__esModule ||
|
3589 | (hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
3590 | ) {
|
3591 | comp = comp.default;
|
3592 | }
|
3593 | return isObject(comp)
|
3594 | ? base.extend(comp)
|
3595 | : comp
|
3596 | }
|
3597 |
|
3598 | function createAsyncPlaceholder (
|
3599 | factory,
|
3600 | data,
|
3601 | context,
|
3602 | children,
|
3603 | tag
|
3604 | ) {
|
3605 | var node = createEmptyVNode();
|
3606 | node.asyncFactory = factory;
|
3607 | node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
3608 | return node
|
3609 | }
|
3610 |
|
3611 | function resolveAsyncComponent (
|
3612 | factory,
|
3613 | baseCtor
|
3614 | ) {
|
3615 | if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
3616 | return factory.errorComp
|
3617 | }
|
3618 |
|
3619 | if (isDef(factory.resolved)) {
|
3620 | return factory.resolved
|
3621 | }
|
3622 |
|
3623 | if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
3624 | return factory.loadingComp
|
3625 | }
|
3626 |
|
3627 | var owner = currentRenderingInstance;
|
3628 | if (isDef(factory.owners)) {
|
3629 |
|
3630 | factory.owners.push(owner);
|
3631 | } else {
|
3632 | var owners = factory.owners = [owner];
|
3633 | var sync = true;
|
3634 |
|
3635 | var forceRender = function (renderCompleted) {
|
3636 | for (var i = 0, l = owners.length; i < l; i++) {
|
3637 | (owners[i]).$forceUpdate();
|
3638 | }
|
3639 |
|
3640 | if (renderCompleted) {
|
3641 | owners.length = 0;
|
3642 | }
|
3643 | };
|
3644 |
|
3645 | var resolve = once(function (res) {
|
3646 |
|
3647 | factory.resolved = ensureCtor(res, baseCtor);
|
3648 |
|
3649 |
|
3650 | if (!sync) {
|
3651 | forceRender(true);
|
3652 | } else {
|
3653 | owners.length = 0;
|
3654 | }
|
3655 | });
|
3656 |
|
3657 | var reject = once(function (reason) {
|
3658 | process.env.NODE_ENV !== 'production' && warn(
|
3659 | "Failed to resolve async component: " + (String(factory)) +
|
3660 | (reason ? ("\nReason: " + reason) : '')
|
3661 | );
|
3662 | if (isDef(factory.errorComp)) {
|
3663 | factory.error = true;
|
3664 | forceRender(true);
|
3665 | }
|
3666 | });
|
3667 |
|
3668 | var res = factory(resolve, reject);
|
3669 |
|
3670 | if (isObject(res)) {
|
3671 | if (isPromise(res)) {
|
3672 |
|
3673 | if (isUndef(factory.resolved)) {
|
3674 | res.then(resolve, reject);
|
3675 | }
|
3676 | } else if (isPromise(res.component)) {
|
3677 | res.component.then(resolve, reject);
|
3678 |
|
3679 | if (isDef(res.error)) {
|
3680 | factory.errorComp = ensureCtor(res.error, baseCtor);
|
3681 | }
|
3682 |
|
3683 | if (isDef(res.loading)) {
|
3684 | factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
3685 | if (res.delay === 0) {
|
3686 | factory.loading = true;
|
3687 | } else {
|
3688 | setTimeout(function () {
|
3689 | if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
3690 | factory.loading = true;
|
3691 | forceRender(false);
|
3692 | }
|
3693 | }, res.delay || 200);
|
3694 | }
|
3695 | }
|
3696 |
|
3697 | if (isDef(res.timeout)) {
|
3698 | setTimeout(function () {
|
3699 | if (isUndef(factory.resolved)) {
|
3700 | reject(
|
3701 | process.env.NODE_ENV !== 'production'
|
3702 | ? ("timeout (" + (res.timeout) + "ms)")
|
3703 | : null
|
3704 | );
|
3705 | }
|
3706 | }, res.timeout);
|
3707 | }
|
3708 | }
|
3709 | }
|
3710 |
|
3711 | sync = false;
|
3712 |
|
3713 | return factory.loading
|
3714 | ? factory.loadingComp
|
3715 | : factory.resolved
|
3716 | }
|
3717 | }
|
3718 |
|
3719 |
|
3720 |
|
3721 | function isAsyncPlaceholder (node) {
|
3722 | return node.isComment && node.asyncFactory
|
3723 | }
|
3724 |
|
3725 |
|
3726 |
|
3727 | function getFirstComponentChild (children) {
|
3728 | if (Array.isArray(children)) {
|
3729 | for (var i = 0; i < children.length; i++) {
|
3730 | var c = children[i];
|
3731 | if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
3732 | return c
|
3733 | }
|
3734 | }
|
3735 | }
|
3736 | }
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 | function initEvents (vm) {
|
3743 | vm._events = Object.create(null);
|
3744 | vm._hasHookEvent = false;
|
3745 |
|
3746 | var listeners = vm.$options._parentListeners;
|
3747 | if (listeners) {
|
3748 | updateComponentListeners(vm, listeners);
|
3749 | }
|
3750 | }
|
3751 |
|
3752 | var target;
|
3753 |
|
3754 | function add (event, fn) {
|
3755 | target.$on(event, fn);
|
3756 | }
|
3757 |
|
3758 | function remove$1 (event, fn) {
|
3759 | target.$off(event, fn);
|
3760 | }
|
3761 |
|
3762 | function createOnceHandler (event, fn) {
|
3763 | var _target = target;
|
3764 | return function onceHandler () {
|
3765 | var res = fn.apply(null, arguments);
|
3766 | if (res !== null) {
|
3767 | _target.$off(event, onceHandler);
|
3768 | }
|
3769 | }
|
3770 | }
|
3771 |
|
3772 | function updateComponentListeners (
|
3773 | vm,
|
3774 | listeners,
|
3775 | oldListeners
|
3776 | ) {
|
3777 | target = vm;
|
3778 | updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
3779 | target = undefined;
|
3780 | }
|
3781 |
|
3782 | function eventsMixin (Vue) {
|
3783 | var hookRE = /^hook:/;
|
3784 | Vue.prototype.$on = function (event, fn) {
|
3785 | var vm = this;
|
3786 | if (Array.isArray(event)) {
|
3787 | for (var i = 0, l = event.length; i < l; i++) {
|
3788 | vm.$on(event[i], fn);
|
3789 | }
|
3790 | } else {
|
3791 | (vm._events[event] || (vm._events[event] = [])).push(fn);
|
3792 |
|
3793 |
|
3794 | if (hookRE.test(event)) {
|
3795 | vm._hasHookEvent = true;
|
3796 | }
|
3797 | }
|
3798 | return vm
|
3799 | };
|
3800 |
|
3801 | Vue.prototype.$once = function (event, fn) {
|
3802 | var vm = this;
|
3803 | function on () {
|
3804 | vm.$off(event, on);
|
3805 | fn.apply(vm, arguments);
|
3806 | }
|
3807 | on.fn = fn;
|
3808 | vm.$on(event, on);
|
3809 | return vm
|
3810 | };
|
3811 |
|
3812 | Vue.prototype.$off = function (event, fn) {
|
3813 | var vm = this;
|
3814 |
|
3815 | if (!arguments.length) {
|
3816 | vm._events = Object.create(null);
|
3817 | return vm
|
3818 | }
|
3819 |
|
3820 | if (Array.isArray(event)) {
|
3821 | for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
3822 | vm.$off(event[i$1], fn);
|
3823 | }
|
3824 | return vm
|
3825 | }
|
3826 |
|
3827 | var cbs = vm._events[event];
|
3828 | if (!cbs) {
|
3829 | return vm
|
3830 | }
|
3831 | if (!fn) {
|
3832 | vm._events[event] = null;
|
3833 | return vm
|
3834 | }
|
3835 |
|
3836 | var cb;
|
3837 | var i = cbs.length;
|
3838 | while (i--) {
|
3839 | cb = cbs[i];
|
3840 | if (cb === fn || cb.fn === fn) {
|
3841 | cbs.splice(i, 1);
|
3842 | break
|
3843 | }
|
3844 | }
|
3845 | return vm
|
3846 | };
|
3847 |
|
3848 | Vue.prototype.$emit = function (event) {
|
3849 | var vm = this;
|
3850 | if (process.env.NODE_ENV !== 'production') {
|
3851 | var lowerCaseEvent = event.toLowerCase();
|
3852 | if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
3853 | tip(
|
3854 | "Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
3855 | (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
3856 | "Note that HTML attributes are case-insensitive and you cannot use " +
|
3857 | "v-on to listen to camelCase events when using in-DOM templates. " +
|
3858 | "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
3859 | );
|
3860 | }
|
3861 | }
|
3862 | var cbs = vm._events[event];
|
3863 | if (cbs) {
|
3864 | cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
3865 | var args = toArray(arguments, 1);
|
3866 | var info = "event handler for \"" + event + "\"";
|
3867 | for (var i = 0, l = cbs.length; i < l; i++) {
|
3868 | invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
3869 | }
|
3870 | }
|
3871 | return vm
|
3872 | };
|
3873 | }
|
3874 |
|
3875 |
|
3876 |
|
3877 | var activeInstance = null;
|
3878 | var isUpdatingChildComponent = false;
|
3879 |
|
3880 | function setActiveInstance(vm) {
|
3881 | var prevActiveInstance = activeInstance;
|
3882 | activeInstance = vm;
|
3883 | return function () {
|
3884 | activeInstance = prevActiveInstance;
|
3885 | }
|
3886 | }
|
3887 |
|
3888 | function initLifecycle (vm) {
|
3889 | var options = vm.$options;
|
3890 |
|
3891 |
|
3892 | var parent = options.parent;
|
3893 | if (parent && !options.abstract) {
|
3894 | while (parent.$options.abstract && parent.$parent) {
|
3895 | parent = parent.$parent;
|
3896 | }
|
3897 | parent.$children.push(vm);
|
3898 | }
|
3899 |
|
3900 | vm.$parent = parent;
|
3901 | vm.$root = parent ? parent.$root : vm;
|
3902 |
|
3903 | vm.$children = [];
|
3904 | vm.$refs = {};
|
3905 |
|
3906 | vm._watcher = null;
|
3907 | vm._inactive = null;
|
3908 | vm._directInactive = false;
|
3909 | vm._isMounted = false;
|
3910 | vm._isDestroyed = false;
|
3911 | vm._isBeingDestroyed = false;
|
3912 | }
|
3913 |
|
3914 | function lifecycleMixin (Vue) {
|
3915 | Vue.prototype._update = function (vnode, hydrating) {
|
3916 | var vm = this;
|
3917 | var prevEl = vm.$el;
|
3918 | var prevVnode = vm._vnode;
|
3919 | var restoreActiveInstance = setActiveInstance(vm);
|
3920 | vm._vnode = vnode;
|
3921 |
|
3922 |
|
3923 | if (!prevVnode) {
|
3924 |
|
3925 | vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false );
|
3926 | } else {
|
3927 |
|
3928 | vm.$el = vm.__patch__(prevVnode, vnode);
|
3929 | }
|
3930 | restoreActiveInstance();
|
3931 |
|
3932 | if (prevEl) {
|
3933 | prevEl.__vue__ = null;
|
3934 | }
|
3935 | if (vm.$el) {
|
3936 | vm.$el.__vue__ = vm;
|
3937 | }
|
3938 |
|
3939 | if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
3940 | vm.$parent.$el = vm.$el;
|
3941 | }
|
3942 |
|
3943 |
|
3944 | };
|
3945 |
|
3946 | Vue.prototype.$forceUpdate = function () {
|
3947 | var vm = this;
|
3948 | if (vm._watcher) {
|
3949 | vm._watcher.update();
|
3950 | }
|
3951 | };
|
3952 |
|
3953 | Vue.prototype.$destroy = function () {
|
3954 | var vm = this;
|
3955 | if (vm._isBeingDestroyed) {
|
3956 | return
|
3957 | }
|
3958 | callHook(vm, 'beforeDestroy');
|
3959 | vm._isBeingDestroyed = true;
|
3960 |
|
3961 | var parent = vm.$parent;
|
3962 | if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
3963 | remove(parent.$children, vm);
|
3964 | }
|
3965 |
|
3966 | if (vm._watcher) {
|
3967 | vm._watcher.teardown();
|
3968 | }
|
3969 | var i = vm._watchers.length;
|
3970 | while (i--) {
|
3971 | vm._watchers[i].teardown();
|
3972 | }
|
3973 |
|
3974 |
|
3975 | if (vm._data.__ob__) {
|
3976 | vm._data.__ob__.vmCount--;
|
3977 | }
|
3978 |
|
3979 | vm._isDestroyed = true;
|
3980 |
|
3981 | vm.__patch__(vm._vnode, null);
|
3982 |
|
3983 | callHook(vm, 'destroyed');
|
3984 |
|
3985 | vm.$off();
|
3986 |
|
3987 | if (vm.$el) {
|
3988 | vm.$el.__vue__ = null;
|
3989 | }
|
3990 |
|
3991 | if (vm.$vnode) {
|
3992 | vm.$vnode.parent = null;
|
3993 | }
|
3994 | };
|
3995 | }
|
3996 |
|
3997 | function mountComponent (
|
3998 | vm,
|
3999 | el,
|
4000 | hydrating
|
4001 | ) {
|
4002 | vm.$el = el;
|
4003 | if (!vm.$options.render) {
|
4004 | vm.$options.render = createEmptyVNode;
|
4005 | if (process.env.NODE_ENV !== 'production') {
|
4006 |
|
4007 | if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
4008 | vm.$options.el || el) {
|
4009 | warn(
|
4010 | 'You are using the runtime-only build of Vue where the template ' +
|
4011 | 'compiler is not available. Either pre-compile the templates into ' +
|
4012 | 'render functions, or use the compiler-included build.',
|
4013 | vm
|
4014 | );
|
4015 | } else {
|
4016 | warn(
|
4017 | 'Failed to mount component: template or render function not defined.',
|
4018 | vm
|
4019 | );
|
4020 | }
|
4021 | }
|
4022 | }
|
4023 | callHook(vm, 'beforeMount');
|
4024 |
|
4025 | var updateComponent;
|
4026 |
|
4027 | if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
4028 | updateComponent = function () {
|
4029 | var name = vm._name;
|
4030 | var id = vm._uid;
|
4031 | var startTag = "vue-perf-start:" + id;
|
4032 | var endTag = "vue-perf-end:" + id;
|
4033 |
|
4034 | mark(startTag);
|
4035 | var vnode = vm._render();
|
4036 | mark(endTag);
|
4037 | measure(("vue " + name + " render"), startTag, endTag);
|
4038 |
|
4039 | mark(startTag);
|
4040 | vm._update(vnode, hydrating);
|
4041 | mark(endTag);
|
4042 | measure(("vue " + name + " patch"), startTag, endTag);
|
4043 | };
|
4044 | } else {
|
4045 | updateComponent = function () {
|
4046 | vm._update(vm._render(), hydrating);
|
4047 | };
|
4048 | }
|
4049 |
|
4050 |
|
4051 |
|
4052 |
|
4053 | new Watcher(vm, updateComponent, noop, {
|
4054 | before: function before () {
|
4055 | if (vm._isMounted && !vm._isDestroyed) {
|
4056 | callHook(vm, 'beforeUpdate');
|
4057 | }
|
4058 | }
|
4059 | }, true );
|
4060 | hydrating = false;
|
4061 |
|
4062 |
|
4063 |
|
4064 | if (vm.$vnode == null) {
|
4065 | vm._isMounted = true;
|
4066 | callHook(vm, 'mounted');
|
4067 | }
|
4068 | return vm
|
4069 | }
|
4070 |
|
4071 | function updateChildComponent (
|
4072 | vm,
|
4073 | propsData,
|
4074 | listeners,
|
4075 | parentVnode,
|
4076 | renderChildren
|
4077 | ) {
|
4078 | if (process.env.NODE_ENV !== 'production') {
|
4079 | isUpdatingChildComponent = true;
|
4080 | }
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 | var newScopedSlots = parentVnode.data.scopedSlots;
|
4089 | var oldScopedSlots = vm.$scopedSlots;
|
4090 | var hasDynamicScopedSlot = !!(
|
4091 | (newScopedSlots && !newScopedSlots.$stable) ||
|
4092 | (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
4093 | (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
4094 | );
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 | var needsForceUpdate = !!(
|
4100 | renderChildren ||
|
4101 | vm.$options._renderChildren ||
|
4102 | hasDynamicScopedSlot
|
4103 | );
|
4104 |
|
4105 | vm.$options._parentVnode = parentVnode;
|
4106 | vm.$vnode = parentVnode;
|
4107 |
|
4108 | if (vm._vnode) {
|
4109 | vm._vnode.parent = parentVnode;
|
4110 | }
|
4111 | vm.$options._renderChildren = renderChildren;
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 | vm.$attrs = parentVnode.data.attrs || emptyObject;
|
4117 | vm.$listeners = listeners || emptyObject;
|
4118 |
|
4119 |
|
4120 | if (propsData && vm.$options.props) {
|
4121 | toggleObserving(false);
|
4122 | var props = vm._props;
|
4123 | var propKeys = vm.$options._propKeys || [];
|
4124 | for (var i = 0; i < propKeys.length; i++) {
|
4125 | var key = propKeys[i];
|
4126 | var propOptions = vm.$options.props;
|
4127 | props[key] = validateProp(key, propOptions, propsData, vm);
|
4128 | }
|
4129 | toggleObserving(true);
|
4130 |
|
4131 | vm.$options.propsData = propsData;
|
4132 | }
|
4133 |
|
4134 |
|
4135 | listeners = listeners || emptyObject;
|
4136 | var oldListeners = vm.$options._parentListeners;
|
4137 | vm.$options._parentListeners = listeners;
|
4138 | updateComponentListeners(vm, listeners, oldListeners);
|
4139 |
|
4140 |
|
4141 | if (needsForceUpdate) {
|
4142 | vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
4143 | vm.$forceUpdate();
|
4144 | }
|
4145 |
|
4146 | if (process.env.NODE_ENV !== 'production') {
|
4147 | isUpdatingChildComponent = false;
|
4148 | }
|
4149 | }
|
4150 |
|
4151 | function isInInactiveTree (vm) {
|
4152 | while (vm && (vm = vm.$parent)) {
|
4153 | if (vm._inactive) { return true }
|
4154 | }
|
4155 | return false
|
4156 | }
|
4157 |
|
4158 | function activateChildComponent (vm, direct) {
|
4159 | if (direct) {
|
4160 | vm._directInactive = false;
|
4161 | if (isInInactiveTree(vm)) {
|
4162 | return
|
4163 | }
|
4164 | } else if (vm._directInactive) {
|
4165 | return
|
4166 | }
|
4167 | if (vm._inactive || vm._inactive === null) {
|
4168 | vm._inactive = false;
|
4169 | for (var i = 0; i < vm.$children.length; i++) {
|
4170 | activateChildComponent(vm.$children[i]);
|
4171 | }
|
4172 | callHook(vm, 'activated');
|
4173 | }
|
4174 | }
|
4175 |
|
4176 | function deactivateChildComponent (vm, direct) {
|
4177 | if (direct) {
|
4178 | vm._directInactive = true;
|
4179 | if (isInInactiveTree(vm)) {
|
4180 | return
|
4181 | }
|
4182 | }
|
4183 | if (!vm._inactive) {
|
4184 | vm._inactive = true;
|
4185 | for (var i = 0; i < vm.$children.length; i++) {
|
4186 | deactivateChildComponent(vm.$children[i]);
|
4187 | }
|
4188 | callHook(vm, 'deactivated');
|
4189 | }
|
4190 | }
|
4191 |
|
4192 | function callHook (vm, hook) {
|
4193 |
|
4194 | pushTarget();
|
4195 | var handlers = vm.$options[hook];
|
4196 | var info = hook + " hook";
|
4197 | if (handlers) {
|
4198 | for (var i = 0, j = handlers.length; i < j; i++) {
|
4199 | invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
4200 | }
|
4201 | }
|
4202 | if (vm._hasHookEvent) {
|
4203 | vm.$emit('hook:' + hook);
|
4204 | }
|
4205 | popTarget();
|
4206 | }
|
4207 |
|
4208 |
|
4209 |
|
4210 | var MAX_UPDATE_COUNT = 100;
|
4211 |
|
4212 | var queue = [];
|
4213 | var activatedChildren = [];
|
4214 | var has = {};
|
4215 | var circular = {};
|
4216 | var waiting = false;
|
4217 | var flushing = false;
|
4218 | var index = 0;
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 | function resetSchedulerState () {
|
4224 | index = queue.length = activatedChildren.length = 0;
|
4225 | has = {};
|
4226 | if (process.env.NODE_ENV !== 'production') {
|
4227 | circular = {};
|
4228 | }
|
4229 | waiting = flushing = false;
|
4230 | }
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 | var currentFlushTimestamp = 0;
|
4238 |
|
4239 |
|
4240 | var getNow = Date.now;
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 | if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
4247 |
|
4248 |
|
4249 |
|
4250 | getNow = function () { return performance.now(); };
|
4251 | }
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 | function flushSchedulerQueue () {
|
4257 | currentFlushTimestamp = getNow();
|
4258 | flushing = true;
|
4259 | var watcher, id;
|
4260 |
|
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 |
|
4269 | queue.sort(function (a, b) { return a.id - b.id; });
|
4270 |
|
4271 |
|
4272 |
|
4273 | for (index = 0; index < queue.length; index++) {
|
4274 | watcher = queue[index];
|
4275 | if (watcher.before) {
|
4276 | watcher.before();
|
4277 | }
|
4278 | id = watcher.id;
|
4279 | has[id] = null;
|
4280 | watcher.run();
|
4281 |
|
4282 | if (process.env.NODE_ENV !== 'production' && has[id] != null) {
|
4283 | circular[id] = (circular[id] || 0) + 1;
|
4284 | if (circular[id] > MAX_UPDATE_COUNT) {
|
4285 | warn(
|
4286 | 'You may have an infinite update loop ' + (
|
4287 | watcher.user
|
4288 | ? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
4289 | : "in a component render function."
|
4290 | ),
|
4291 | watcher.vm
|
4292 | );
|
4293 | break
|
4294 | }
|
4295 | }
|
4296 | }
|
4297 |
|
4298 |
|
4299 | var activatedQueue = activatedChildren.slice();
|
4300 | var updatedQueue = queue.slice();
|
4301 |
|
4302 | resetSchedulerState();
|
4303 |
|
4304 |
|
4305 | callActivatedHooks(activatedQueue);
|
4306 | callUpdatedHooks(updatedQueue);
|
4307 |
|
4308 |
|
4309 |
|
4310 | if (devtools && config.devtools) {
|
4311 | devtools.emit('flush');
|
4312 | }
|
4313 | }
|
4314 |
|
4315 | function callUpdatedHooks (queue) {
|
4316 | var i = queue.length;
|
4317 | while (i--) {
|
4318 | var watcher = queue[i];
|
4319 | var vm = watcher.vm;
|
4320 | if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
4321 | callHook(vm, 'updated');
|
4322 | }
|
4323 | }
|
4324 | }
|
4325 |
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 | function queueActivatedComponent (vm) {
|
4331 |
|
4332 |
|
4333 | vm._inactive = false;
|
4334 | activatedChildren.push(vm);
|
4335 | }
|
4336 |
|
4337 | function callActivatedHooks (queue) {
|
4338 | for (var i = 0; i < queue.length; i++) {
|
4339 | queue[i]._inactive = true;
|
4340 | activateChildComponent(queue[i], true );
|
4341 | }
|
4342 | }
|
4343 |
|
4344 |
|
4345 |
|
4346 |
|
4347 |
|
4348 |
|
4349 | function queueWatcher (watcher) {
|
4350 | var id = watcher.id;
|
4351 | if (has[id] == null) {
|
4352 | has[id] = true;
|
4353 | if (!flushing) {
|
4354 | queue.push(watcher);
|
4355 | } else {
|
4356 |
|
4357 |
|
4358 | var i = queue.length - 1;
|
4359 | while (i > index && queue[i].id > watcher.id) {
|
4360 | i--;
|
4361 | }
|
4362 | queue.splice(i + 1, 0, watcher);
|
4363 | }
|
4364 |
|
4365 | if (!waiting) {
|
4366 | waiting = true;
|
4367 |
|
4368 | if (process.env.NODE_ENV !== 'production' && !config.async) {
|
4369 | flushSchedulerQueue();
|
4370 | return
|
4371 | }
|
4372 | nextTick(flushSchedulerQueue);
|
4373 | }
|
4374 | }
|
4375 | }
|
4376 |
|
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 | var uid$2 = 0;
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 |
|
4388 | var Watcher = function Watcher (
|
4389 | vm,
|
4390 | expOrFn,
|
4391 | cb,
|
4392 | options,
|
4393 | isRenderWatcher
|
4394 | ) {
|
4395 | this.vm = vm;
|
4396 | if (isRenderWatcher) {
|
4397 | vm._watcher = this;
|
4398 | }
|
4399 | vm._watchers.push(this);
|
4400 |
|
4401 | if (options) {
|
4402 | this.deep = !!options.deep;
|
4403 | this.user = !!options.user;
|
4404 | this.lazy = !!options.lazy;
|
4405 | this.sync = !!options.sync;
|
4406 | this.before = options.before;
|
4407 | } else {
|
4408 | this.deep = this.user = this.lazy = this.sync = false;
|
4409 | }
|
4410 | this.cb = cb;
|
4411 | this.id = ++uid$2;
|
4412 | this.active = true;
|
4413 | this.dirty = this.lazy;
|
4414 | this.deps = [];
|
4415 | this.newDeps = [];
|
4416 | this.depIds = new _Set();
|
4417 | this.newDepIds = new _Set();
|
4418 | this.expression = process.env.NODE_ENV !== 'production'
|
4419 | ? expOrFn.toString()
|
4420 | : '';
|
4421 |
|
4422 | if (typeof expOrFn === 'function') {
|
4423 | this.getter = expOrFn;
|
4424 | } else {
|
4425 | this.getter = parsePath(expOrFn);
|
4426 | if (!this.getter) {
|
4427 | this.getter = noop;
|
4428 | process.env.NODE_ENV !== 'production' && warn(
|
4429 | "Failed watching path: \"" + expOrFn + "\" " +
|
4430 | 'Watcher only accepts simple dot-delimited paths. ' +
|
4431 | 'For full control, use a function instead.',
|
4432 | vm
|
4433 | );
|
4434 | }
|
4435 | }
|
4436 | this.value = this.lazy
|
4437 | ? undefined
|
4438 | : this.get();
|
4439 | };
|
4440 |
|
4441 |
|
4442 |
|
4443 |
|
4444 | Watcher.prototype.get = function get () {
|
4445 | pushTarget(this);
|
4446 | var value;
|
4447 | var vm = this.vm;
|
4448 | try {
|
4449 | value = this.getter.call(vm, vm);
|
4450 | } catch (e) {
|
4451 | if (this.user) {
|
4452 | handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
4453 | } else {
|
4454 | throw e
|
4455 | }
|
4456 | } finally {
|
4457 |
|
4458 |
|
4459 | if (this.deep) {
|
4460 | traverse(value);
|
4461 | }
|
4462 | popTarget();
|
4463 | this.cleanupDeps();
|
4464 | }
|
4465 | return value
|
4466 | };
|
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 | Watcher.prototype.addDep = function addDep (dep) {
|
4472 | var id = dep.id;
|
4473 | if (!this.newDepIds.has(id)) {
|
4474 | this.newDepIds.add(id);
|
4475 | this.newDeps.push(dep);
|
4476 | if (!this.depIds.has(id)) {
|
4477 | dep.addSub(this);
|
4478 | }
|
4479 | }
|
4480 | };
|
4481 |
|
4482 |
|
4483 |
|
4484 |
|
4485 | Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
4486 | var i = this.deps.length;
|
4487 | while (i--) {
|
4488 | var dep = this.deps[i];
|
4489 | if (!this.newDepIds.has(dep.id)) {
|
4490 | dep.removeSub(this);
|
4491 | }
|
4492 | }
|
4493 | var tmp = this.depIds;
|
4494 | this.depIds = this.newDepIds;
|
4495 | this.newDepIds = tmp;
|
4496 | this.newDepIds.clear();
|
4497 | tmp = this.deps;
|
4498 | this.deps = this.newDeps;
|
4499 | this.newDeps = tmp;
|
4500 | this.newDeps.length = 0;
|
4501 | };
|
4502 |
|
4503 |
|
4504 |
|
4505 |
|
4506 |
|
4507 | Watcher.prototype.update = function update () {
|
4508 |
|
4509 | if (this.lazy) {
|
4510 | this.dirty = true;
|
4511 | } else if (this.sync) {
|
4512 | this.run();
|
4513 | } else {
|
4514 | queueWatcher(this);
|
4515 | }
|
4516 | };
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 |
|
4522 | Watcher.prototype.run = function run () {
|
4523 | if (this.active) {
|
4524 | var value = this.get();
|
4525 | if (
|
4526 | value !== this.value ||
|
4527 |
|
4528 |
|
4529 |
|
4530 | isObject(value) ||
|
4531 | this.deep
|
4532 | ) {
|
4533 |
|
4534 | var oldValue = this.value;
|
4535 | this.value = value;
|
4536 | if (this.user) {
|
4537 | try {
|
4538 | this.cb.call(this.vm, value, oldValue);
|
4539 | } catch (e) {
|
4540 | handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
4541 | }
|
4542 | } else {
|
4543 | this.cb.call(this.vm, value, oldValue);
|
4544 | }
|
4545 | }
|
4546 | }
|
4547 | };
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 | Watcher.prototype.evaluate = function evaluate () {
|
4554 | this.value = this.get();
|
4555 | this.dirty = false;
|
4556 | };
|
4557 |
|
4558 |
|
4559 |
|
4560 |
|
4561 | Watcher.prototype.depend = function depend () {
|
4562 | var i = this.deps.length;
|
4563 | while (i--) {
|
4564 | this.deps[i].depend();
|
4565 | }
|
4566 | };
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 | Watcher.prototype.teardown = function teardown () {
|
4572 | if (this.active) {
|
4573 |
|
4574 |
|
4575 |
|
4576 | if (!this.vm._isBeingDestroyed) {
|
4577 | remove(this.vm._watchers, this);
|
4578 | }
|
4579 | var i = this.deps.length;
|
4580 | while (i--) {
|
4581 | this.deps[i].removeSub(this);
|
4582 | }
|
4583 | this.active = false;
|
4584 | }
|
4585 | };
|
4586 |
|
4587 |
|
4588 |
|
4589 | var sharedPropertyDefinition = {
|
4590 | enumerable: true,
|
4591 | configurable: true,
|
4592 | get: noop,
|
4593 | set: noop
|
4594 | };
|
4595 |
|
4596 | function proxy (target, sourceKey, key) {
|
4597 | sharedPropertyDefinition.get = function proxyGetter () {
|
4598 | return this[sourceKey][key]
|
4599 | };
|
4600 | sharedPropertyDefinition.set = function proxySetter (val) {
|
4601 | this[sourceKey][key] = val;
|
4602 | };
|
4603 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
4604 | }
|
4605 |
|
4606 | function initState (vm) {
|
4607 | vm._watchers = [];
|
4608 | var opts = vm.$options;
|
4609 | if (opts.props) { initProps(vm, opts.props); }
|
4610 | if (opts.methods) { initMethods(vm, opts.methods); }
|
4611 | if (opts.data) {
|
4612 | initData(vm);
|
4613 | } else {
|
4614 | observe(vm._data = {}, true );
|
4615 | }
|
4616 | if (opts.computed) { initComputed(vm, opts.computed); }
|
4617 | if (opts.watch && opts.watch !== nativeWatch) {
|
4618 | initWatch(vm, opts.watch);
|
4619 | }
|
4620 | }
|
4621 |
|
4622 | function initProps (vm, propsOptions) {
|
4623 | var propsData = vm.$options.propsData || {};
|
4624 | var props = vm._props = {};
|
4625 |
|
4626 |
|
4627 | var keys = vm.$options._propKeys = [];
|
4628 | var isRoot = !vm.$parent;
|
4629 |
|
4630 | if (!isRoot) {
|
4631 | toggleObserving(false);
|
4632 | }
|
4633 | var loop = function ( key ) {
|
4634 | keys.push(key);
|
4635 | var value = validateProp(key, propsOptions, propsData, vm);
|
4636 |
|
4637 | if (process.env.NODE_ENV !== 'production') {
|
4638 | var hyphenatedKey = hyphenate(key);
|
4639 | if (isReservedAttribute(hyphenatedKey) ||
|
4640 | config.isReservedAttr(hyphenatedKey)) {
|
4641 | warn(
|
4642 | ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
4643 | vm
|
4644 | );
|
4645 | }
|
4646 | defineReactive$$1(props, key, value, function () {
|
4647 | if (!isRoot && !isUpdatingChildComponent) {
|
4648 | warn(
|
4649 | "Avoid mutating a prop directly since the value will be " +
|
4650 | "overwritten whenever the parent component re-renders. " +
|
4651 | "Instead, use a data or computed property based on the prop's " +
|
4652 | "value. Prop being mutated: \"" + key + "\"",
|
4653 | vm
|
4654 | );
|
4655 | }
|
4656 | });
|
4657 | } else {
|
4658 | defineReactive$$1(props, key, value);
|
4659 | }
|
4660 |
|
4661 |
|
4662 |
|
4663 | if (!(key in vm)) {
|
4664 | proxy(vm, "_props", key);
|
4665 | }
|
4666 | };
|
4667 |
|
4668 | for (var key in propsOptions) loop( key );
|
4669 | toggleObserving(true);
|
4670 | }
|
4671 |
|
4672 | function initData (vm) {
|
4673 | var data = vm.$options.data;
|
4674 | data = vm._data = typeof data === 'function'
|
4675 | ? getData(data, vm)
|
4676 | : data || {};
|
4677 | if (!isPlainObject(data)) {
|
4678 | data = {};
|
4679 | process.env.NODE_ENV !== 'production' && warn(
|
4680 | 'data functions should return an object:\n' +
|
4681 | 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
4682 | vm
|
4683 | );
|
4684 | }
|
4685 |
|
4686 | var keys = Object.keys(data);
|
4687 | var props = vm.$options.props;
|
4688 | var methods = vm.$options.methods;
|
4689 | var i = keys.length;
|
4690 | while (i--) {
|
4691 | var key = keys[i];
|
4692 | if (process.env.NODE_ENV !== 'production') {
|
4693 | if (methods && hasOwn(methods, key)) {
|
4694 | warn(
|
4695 | ("Method \"" + key + "\" has already been defined as a data property."),
|
4696 | vm
|
4697 | );
|
4698 | }
|
4699 | }
|
4700 | if (props && hasOwn(props, key)) {
|
4701 | process.env.NODE_ENV !== 'production' && warn(
|
4702 | "The data property \"" + key + "\" is already declared as a prop. " +
|
4703 | "Use prop default value instead.",
|
4704 | vm
|
4705 | );
|
4706 | } else if (!isReserved(key)) {
|
4707 | proxy(vm, "_data", key);
|
4708 | }
|
4709 | }
|
4710 |
|
4711 | observe(data, true );
|
4712 | }
|
4713 |
|
4714 | function getData (data, vm) {
|
4715 |
|
4716 | pushTarget();
|
4717 | try {
|
4718 | return data.call(vm, vm)
|
4719 | } catch (e) {
|
4720 | handleError(e, vm, "data()");
|
4721 | return {}
|
4722 | } finally {
|
4723 | popTarget();
|
4724 | }
|
4725 | }
|
4726 |
|
4727 | var computedWatcherOptions = { lazy: true };
|
4728 |
|
4729 | function initComputed (vm, computed) {
|
4730 |
|
4731 | var watchers = vm._computedWatchers = Object.create(null);
|
4732 |
|
4733 | var isSSR = isServerRendering();
|
4734 |
|
4735 | for (var key in computed) {
|
4736 | var userDef = computed[key];
|
4737 | var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
4738 | if (process.env.NODE_ENV !== 'production' && getter == null) {
|
4739 | warn(
|
4740 | ("Getter is missing for computed property \"" + key + "\"."),
|
4741 | vm
|
4742 | );
|
4743 | }
|
4744 |
|
4745 | if (!isSSR) {
|
4746 |
|
4747 | watchers[key] = new Watcher(
|
4748 | vm,
|
4749 | getter || noop,
|
4750 | noop,
|
4751 | computedWatcherOptions
|
4752 | );
|
4753 | }
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 | if (!(key in vm)) {
|
4759 | defineComputed(vm, key, userDef);
|
4760 | } else if (process.env.NODE_ENV !== 'production') {
|
4761 | if (key in vm.$data) {
|
4762 | warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
4763 | } else if (vm.$options.props && key in vm.$options.props) {
|
4764 | warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
4765 | }
|
4766 | }
|
4767 | }
|
4768 | }
|
4769 |
|
4770 | function defineComputed (
|
4771 | target,
|
4772 | key,
|
4773 | userDef
|
4774 | ) {
|
4775 | var shouldCache = !isServerRendering();
|
4776 | if (typeof userDef === 'function') {
|
4777 | sharedPropertyDefinition.get = shouldCache
|
4778 | ? createComputedGetter(key)
|
4779 | : createGetterInvoker(userDef);
|
4780 | sharedPropertyDefinition.set = noop;
|
4781 | } else {
|
4782 | sharedPropertyDefinition.get = userDef.get
|
4783 | ? shouldCache && userDef.cache !== false
|
4784 | ? createComputedGetter(key)
|
4785 | : createGetterInvoker(userDef.get)
|
4786 | : noop;
|
4787 | sharedPropertyDefinition.set = userDef.set || noop;
|
4788 | }
|
4789 | if (process.env.NODE_ENV !== 'production' &&
|
4790 | sharedPropertyDefinition.set === noop) {
|
4791 | sharedPropertyDefinition.set = function () {
|
4792 | warn(
|
4793 | ("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
4794 | this
|
4795 | );
|
4796 | };
|
4797 | }
|
4798 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
4799 | }
|
4800 |
|
4801 | function createComputedGetter (key) {
|
4802 | return function computedGetter () {
|
4803 | var watcher = this._computedWatchers && this._computedWatchers[key];
|
4804 | if (watcher) {
|
4805 | if (watcher.dirty) {
|
4806 | watcher.evaluate();
|
4807 | }
|
4808 | if (Dep.target) {
|
4809 | watcher.depend();
|
4810 | }
|
4811 | return watcher.value
|
4812 | }
|
4813 | }
|
4814 | }
|
4815 |
|
4816 | function createGetterInvoker(fn) {
|
4817 | return function computedGetter () {
|
4818 | return fn.call(this, this)
|
4819 | }
|
4820 | }
|
4821 |
|
4822 | function initMethods (vm, methods) {
|
4823 | var props = vm.$options.props;
|
4824 | for (var key in methods) {
|
4825 | if (process.env.NODE_ENV !== 'production') {
|
4826 | if (typeof methods[key] !== 'function') {
|
4827 | warn(
|
4828 | "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
4829 | "Did you reference the function correctly?",
|
4830 | vm
|
4831 | );
|
4832 | }
|
4833 | if (props && hasOwn(props, key)) {
|
4834 | warn(
|
4835 | ("Method \"" + key + "\" has already been defined as a prop."),
|
4836 | vm
|
4837 | );
|
4838 | }
|
4839 | if ((key in vm) && isReserved(key)) {
|
4840 | warn(
|
4841 | "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
4842 | "Avoid defining component methods that start with _ or $."
|
4843 | );
|
4844 | }
|
4845 | }
|
4846 | vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
4847 | }
|
4848 | }
|
4849 |
|
4850 | function initWatch (vm, watch) {
|
4851 | for (var key in watch) {
|
4852 | var handler = watch[key];
|
4853 | if (Array.isArray(handler)) {
|
4854 | for (var i = 0; i < handler.length; i++) {
|
4855 | createWatcher(vm, key, handler[i]);
|
4856 | }
|
4857 | } else {
|
4858 | createWatcher(vm, key, handler);
|
4859 | }
|
4860 | }
|
4861 | }
|
4862 |
|
4863 | function createWatcher (
|
4864 | vm,
|
4865 | expOrFn,
|
4866 | handler,
|
4867 | options
|
4868 | ) {
|
4869 | if (isPlainObject(handler)) {
|
4870 | options = handler;
|
4871 | handler = handler.handler;
|
4872 | }
|
4873 | if (typeof handler === 'string') {
|
4874 | handler = vm[handler];
|
4875 | }
|
4876 | return vm.$watch(expOrFn, handler, options)
|
4877 | }
|
4878 |
|
4879 | function stateMixin (Vue) {
|
4880 |
|
4881 |
|
4882 |
|
4883 | var dataDef = {};
|
4884 | dataDef.get = function () { return this._data };
|
4885 | var propsDef = {};
|
4886 | propsDef.get = function () { return this._props };
|
4887 | if (process.env.NODE_ENV !== 'production') {
|
4888 | dataDef.set = function () {
|
4889 | warn(
|
4890 | 'Avoid replacing instance root $data. ' +
|
4891 | 'Use nested data properties instead.',
|
4892 | this
|
4893 | );
|
4894 | };
|
4895 | propsDef.set = function () {
|
4896 | warn("$props is readonly.", this);
|
4897 | };
|
4898 | }
|
4899 | Object.defineProperty(Vue.prototype, '$data', dataDef);
|
4900 | Object.defineProperty(Vue.prototype, '$props', propsDef);
|
4901 |
|
4902 | Vue.prototype.$set = set;
|
4903 | Vue.prototype.$delete = del;
|
4904 |
|
4905 | Vue.prototype.$watch = function (
|
4906 | expOrFn,
|
4907 | cb,
|
4908 | options
|
4909 | ) {
|
4910 | var vm = this;
|
4911 | if (isPlainObject(cb)) {
|
4912 | return createWatcher(vm, expOrFn, cb, options)
|
4913 | }
|
4914 | options = options || {};
|
4915 | options.user = true;
|
4916 | var watcher = new Watcher(vm, expOrFn, cb, options);
|
4917 | if (options.immediate) {
|
4918 | try {
|
4919 | cb.call(vm, watcher.value);
|
4920 | } catch (error) {
|
4921 | handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
4922 | }
|
4923 | }
|
4924 | return function unwatchFn () {
|
4925 | watcher.teardown();
|
4926 | }
|
4927 | };
|
4928 | }
|
4929 |
|
4930 |
|
4931 |
|
4932 | var uid$3 = 0;
|
4933 |
|
4934 | function initMixin (Vue) {
|
4935 | Vue.prototype._init = function (options) {
|
4936 | var vm = this;
|
4937 |
|
4938 | vm._uid = uid$3++;
|
4939 |
|
4940 | var startTag, endTag;
|
4941 |
|
4942 | if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
4943 | startTag = "vue-perf-start:" + (vm._uid);
|
4944 | endTag = "vue-perf-end:" + (vm._uid);
|
4945 | mark(startTag);
|
4946 | }
|
4947 |
|
4948 |
|
4949 | vm._isVue = true;
|
4950 |
|
4951 | if (options && options._isComponent) {
|
4952 |
|
4953 |
|
4954 |
|
4955 | initInternalComponent(vm, options);
|
4956 | } else {
|
4957 | vm.$options = mergeOptions(
|
4958 | resolveConstructorOptions(vm.constructor),
|
4959 | options || {},
|
4960 | vm
|
4961 | );
|
4962 | }
|
4963 |
|
4964 | if (process.env.NODE_ENV !== 'production') {
|
4965 | initProxy(vm);
|
4966 | } else {
|
4967 | vm._renderProxy = vm;
|
4968 | }
|
4969 |
|
4970 | vm._self = vm;
|
4971 | initLifecycle(vm);
|
4972 | initEvents(vm);
|
4973 | initRender(vm);
|
4974 | callHook(vm, 'beforeCreate');
|
4975 | initInjections(vm);
|
4976 | initState(vm);
|
4977 | initProvide(vm);
|
4978 | callHook(vm, 'created');
|
4979 |
|
4980 |
|
4981 | if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
4982 | vm._name = formatComponentName(vm, false);
|
4983 | mark(endTag);
|
4984 | measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
4985 | }
|
4986 |
|
4987 | if (vm.$options.el) {
|
4988 | vm.$mount(vm.$options.el);
|
4989 | }
|
4990 | };
|
4991 | }
|
4992 |
|
4993 | function initInternalComponent (vm, options) {
|
4994 | var opts = vm.$options = Object.create(vm.constructor.options);
|
4995 |
|
4996 | var parentVnode = options._parentVnode;
|
4997 | opts.parent = options.parent;
|
4998 | opts._parentVnode = parentVnode;
|
4999 |
|
5000 | var vnodeComponentOptions = parentVnode.componentOptions;
|
5001 | opts.propsData = vnodeComponentOptions.propsData;
|
5002 | opts._parentListeners = vnodeComponentOptions.listeners;
|
5003 | opts._renderChildren = vnodeComponentOptions.children;
|
5004 | opts._componentTag = vnodeComponentOptions.tag;
|
5005 |
|
5006 | if (options.render) {
|
5007 | opts.render = options.render;
|
5008 | opts.staticRenderFns = options.staticRenderFns;
|
5009 | }
|
5010 | }
|
5011 |
|
5012 | function resolveConstructorOptions (Ctor) {
|
5013 | var options = Ctor.options;
|
5014 | if (Ctor.super) {
|
5015 | var superOptions = resolveConstructorOptions(Ctor.super);
|
5016 | var cachedSuperOptions = Ctor.superOptions;
|
5017 | if (superOptions !== cachedSuperOptions) {
|
5018 |
|
5019 |
|
5020 | Ctor.superOptions = superOptions;
|
5021 |
|
5022 | var modifiedOptions = resolveModifiedOptions(Ctor);
|
5023 |
|
5024 | if (modifiedOptions) {
|
5025 | extend(Ctor.extendOptions, modifiedOptions);
|
5026 | }
|
5027 | options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
5028 | if (options.name) {
|
5029 | options.components[options.name] = Ctor;
|
5030 | }
|
5031 | }
|
5032 | }
|
5033 | return options
|
5034 | }
|
5035 |
|
5036 | function resolveModifiedOptions (Ctor) {
|
5037 | var modified;
|
5038 | var latest = Ctor.options;
|
5039 | var sealed = Ctor.sealedOptions;
|
5040 | for (var key in latest) {
|
5041 | if (latest[key] !== sealed[key]) {
|
5042 | if (!modified) { modified = {}; }
|
5043 | modified[key] = latest[key];
|
5044 | }
|
5045 | }
|
5046 | return modified
|
5047 | }
|
5048 |
|
5049 | function Vue (options) {
|
5050 | if (process.env.NODE_ENV !== 'production' &&
|
5051 | !(this instanceof Vue)
|
5052 | ) {
|
5053 | warn('Vue is a constructor and should be called with the `new` keyword');
|
5054 | }
|
5055 | this._init(options);
|
5056 | }
|
5057 |
|
5058 | initMixin(Vue);
|
5059 | stateMixin(Vue);
|
5060 | eventsMixin(Vue);
|
5061 | lifecycleMixin(Vue);
|
5062 | renderMixin(Vue);
|
5063 |
|
5064 |
|
5065 |
|
5066 | function initUse (Vue) {
|
5067 | Vue.use = function (plugin) {
|
5068 | var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
5069 | if (installedPlugins.indexOf(plugin) > -1) {
|
5070 | return this
|
5071 | }
|
5072 |
|
5073 |
|
5074 | var args = toArray(arguments, 1);
|
5075 | args.unshift(this);
|
5076 | if (typeof plugin.install === 'function') {
|
5077 | plugin.install.apply(plugin, args);
|
5078 | } else if (typeof plugin === 'function') {
|
5079 | plugin.apply(null, args);
|
5080 | }
|
5081 | installedPlugins.push(plugin);
|
5082 | return this
|
5083 | };
|
5084 | }
|
5085 |
|
5086 |
|
5087 |
|
5088 | function initMixin$1 (Vue) {
|
5089 | Vue.mixin = function (mixin) {
|
5090 | this.options = mergeOptions(this.options, mixin);
|
5091 | return this
|
5092 | };
|
5093 | }
|
5094 |
|
5095 |
|
5096 |
|
5097 | function initExtend (Vue) {
|
5098 | |
5099 |
|
5100 |
|
5101 |
|
5102 |
|
5103 | Vue.cid = 0;
|
5104 | var cid = 1;
|
5105 |
|
5106 | |
5107 |
|
5108 |
|
5109 | Vue.extend = function (extendOptions) {
|
5110 | extendOptions = extendOptions || {};
|
5111 | var Super = this;
|
5112 | var SuperId = Super.cid;
|
5113 | var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5114 | if (cachedCtors[SuperId]) {
|
5115 | return cachedCtors[SuperId]
|
5116 | }
|
5117 |
|
5118 | var name = extendOptions.name || Super.options.name;
|
5119 | if (process.env.NODE_ENV !== 'production' && name) {
|
5120 | validateComponentName(name);
|
5121 | }
|
5122 |
|
5123 | var Sub = function VueComponent (options) {
|
5124 | this._init(options);
|
5125 | };
|
5126 | Sub.prototype = Object.create(Super.prototype);
|
5127 | Sub.prototype.constructor = Sub;
|
5128 | Sub.cid = cid++;
|
5129 | Sub.options = mergeOptions(
|
5130 | Super.options,
|
5131 | extendOptions
|
5132 | );
|
5133 | Sub['super'] = Super;
|
5134 |
|
5135 |
|
5136 |
|
5137 |
|
5138 | if (Sub.options.props) {
|
5139 | initProps$1(Sub);
|
5140 | }
|
5141 | if (Sub.options.computed) {
|
5142 | initComputed$1(Sub);
|
5143 | }
|
5144 |
|
5145 |
|
5146 | Sub.extend = Super.extend;
|
5147 | Sub.mixin = Super.mixin;
|
5148 | Sub.use = Super.use;
|
5149 |
|
5150 |
|
5151 |
|
5152 | ASSET_TYPES.forEach(function (type) {
|
5153 | Sub[type] = Super[type];
|
5154 | });
|
5155 |
|
5156 | if (name) {
|
5157 | Sub.options.components[name] = Sub;
|
5158 | }
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 | Sub.superOptions = Super.options;
|
5164 | Sub.extendOptions = extendOptions;
|
5165 | Sub.sealedOptions = extend({}, Sub.options);
|
5166 |
|
5167 |
|
5168 | cachedCtors[SuperId] = Sub;
|
5169 | return Sub
|
5170 | };
|
5171 | }
|
5172 |
|
5173 | function initProps$1 (Comp) {
|
5174 | var props = Comp.options.props;
|
5175 | for (var key in props) {
|
5176 | proxy(Comp.prototype, "_props", key);
|
5177 | }
|
5178 | }
|
5179 |
|
5180 | function initComputed$1 (Comp) {
|
5181 | var computed = Comp.options.computed;
|
5182 | for (var key in computed) {
|
5183 | defineComputed(Comp.prototype, key, computed[key]);
|
5184 | }
|
5185 | }
|
5186 |
|
5187 |
|
5188 |
|
5189 | function initAssetRegisters (Vue) {
|
5190 | |
5191 |
|
5192 |
|
5193 | ASSET_TYPES.forEach(function (type) {
|
5194 | Vue[type] = function (
|
5195 | id,
|
5196 | definition
|
5197 | ) {
|
5198 | if (!definition) {
|
5199 | return this.options[type + 's'][id]
|
5200 | } else {
|
5201 |
|
5202 | if (process.env.NODE_ENV !== 'production' && type === 'component') {
|
5203 | validateComponentName(id);
|
5204 | }
|
5205 | if (type === 'component' && isPlainObject(definition)) {
|
5206 | definition.name = definition.name || id;
|
5207 | definition = this.options._base.extend(definition);
|
5208 | }
|
5209 | if (type === 'directive' && typeof definition === 'function') {
|
5210 | definition = { bind: definition, update: definition };
|
5211 | }
|
5212 | this.options[type + 's'][id] = definition;
|
5213 | return definition
|
5214 | }
|
5215 | };
|
5216 | });
|
5217 | }
|
5218 |
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 | function getComponentName (opts) {
|
5224 | return opts && (opts.Ctor.options.name || opts.tag)
|
5225 | }
|
5226 |
|
5227 | function matches (pattern, name) {
|
5228 | if (Array.isArray(pattern)) {
|
5229 | return pattern.indexOf(name) > -1
|
5230 | } else if (typeof pattern === 'string') {
|
5231 | return pattern.split(',').indexOf(name) > -1
|
5232 | } else if (isRegExp(pattern)) {
|
5233 | return pattern.test(name)
|
5234 | }
|
5235 |
|
5236 | return false
|
5237 | }
|
5238 |
|
5239 | function pruneCache (keepAliveInstance, filter) {
|
5240 | var cache = keepAliveInstance.cache;
|
5241 | var keys = keepAliveInstance.keys;
|
5242 | var _vnode = keepAliveInstance._vnode;
|
5243 | for (var key in cache) {
|
5244 | var cachedNode = cache[key];
|
5245 | if (cachedNode) {
|
5246 | var name = getComponentName(cachedNode.componentOptions);
|
5247 | if (name && !filter(name)) {
|
5248 | pruneCacheEntry(cache, key, keys, _vnode);
|
5249 | }
|
5250 | }
|
5251 | }
|
5252 | }
|
5253 |
|
5254 | function pruneCacheEntry (
|
5255 | cache,
|
5256 | key,
|
5257 | keys,
|
5258 | current
|
5259 | ) {
|
5260 | var cached$$1 = cache[key];
|
5261 | if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
5262 | cached$$1.componentInstance.$destroy();
|
5263 | }
|
5264 | cache[key] = null;
|
5265 | remove(keys, key);
|
5266 | }
|
5267 |
|
5268 | var patternTypes = [String, RegExp, Array];
|
5269 |
|
5270 | var KeepAlive = {
|
5271 | name: 'keep-alive',
|
5272 | abstract: true,
|
5273 |
|
5274 | props: {
|
5275 | include: patternTypes,
|
5276 | exclude: patternTypes,
|
5277 | max: [String, Number]
|
5278 | },
|
5279 |
|
5280 | created: function created () {
|
5281 | this.cache = Object.create(null);
|
5282 | this.keys = [];
|
5283 | },
|
5284 |
|
5285 | destroyed: function destroyed () {
|
5286 | for (var key in this.cache) {
|
5287 | pruneCacheEntry(this.cache, key, this.keys);
|
5288 | }
|
5289 | },
|
5290 |
|
5291 | mounted: function mounted () {
|
5292 | var this$1 = this;
|
5293 |
|
5294 | this.$watch('include', function (val) {
|
5295 | pruneCache(this$1, function (name) { return matches(val, name); });
|
5296 | });
|
5297 | this.$watch('exclude', function (val) {
|
5298 | pruneCache(this$1, function (name) { return !matches(val, name); });
|
5299 | });
|
5300 | },
|
5301 |
|
5302 | render: function render () {
|
5303 | var slot = this.$slots.default;
|
5304 | var vnode = getFirstComponentChild(slot);
|
5305 | var componentOptions = vnode && vnode.componentOptions;
|
5306 | if (componentOptions) {
|
5307 |
|
5308 | var name = getComponentName(componentOptions);
|
5309 | var ref = this;
|
5310 | var include = ref.include;
|
5311 | var exclude = ref.exclude;
|
5312 | if (
|
5313 |
|
5314 | (include && (!name || !matches(include, name))) ||
|
5315 |
|
5316 | (exclude && name && matches(exclude, name))
|
5317 | ) {
|
5318 | return vnode
|
5319 | }
|
5320 |
|
5321 | var ref$1 = this;
|
5322 | var cache = ref$1.cache;
|
5323 | var keys = ref$1.keys;
|
5324 | var key = vnode.key == null
|
5325 |
|
5326 |
|
5327 | ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
5328 | : vnode.key;
|
5329 | if (cache[key]) {
|
5330 | vnode.componentInstance = cache[key].componentInstance;
|
5331 |
|
5332 | remove(keys, key);
|
5333 | keys.push(key);
|
5334 | } else {
|
5335 | cache[key] = vnode;
|
5336 | keys.push(key);
|
5337 |
|
5338 | if (this.max && keys.length > parseInt(this.max)) {
|
5339 | pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5340 | }
|
5341 | }
|
5342 |
|
5343 | vnode.data.keepAlive = true;
|
5344 | }
|
5345 | return vnode || (slot && slot[0])
|
5346 | }
|
5347 | };
|
5348 |
|
5349 | var builtInComponents = {
|
5350 | KeepAlive: KeepAlive
|
5351 | };
|
5352 |
|
5353 |
|
5354 |
|
5355 | function initGlobalAPI (Vue) {
|
5356 |
|
5357 | var configDef = {};
|
5358 | configDef.get = function () { return config; };
|
5359 | if (process.env.NODE_ENV !== 'production') {
|
5360 | configDef.set = function () {
|
5361 | warn(
|
5362 | 'Do not replace the Vue.config object, set individual fields instead.'
|
5363 | );
|
5364 | };
|
5365 | }
|
5366 | Object.defineProperty(Vue, 'config', configDef);
|
5367 |
|
5368 |
|
5369 |
|
5370 |
|
5371 | Vue.util = {
|
5372 | warn: warn,
|
5373 | extend: extend,
|
5374 | mergeOptions: mergeOptions,
|
5375 | defineReactive: defineReactive$$1
|
5376 | };
|
5377 |
|
5378 | Vue.set = set;
|
5379 | Vue.delete = del;
|
5380 | Vue.nextTick = nextTick;
|
5381 |
|
5382 | // 2.6 explicit observable API
|
5383 | Vue.observable = function (obj) {
|
5384 | observe(obj);
|
5385 | return obj
|
5386 | };
|
5387 |
|
5388 | Vue.options = Object.create(null);
|
5389 | ASSET_TYPES.forEach(function (type) {
|
5390 | Vue.options[type + 's'] = Object.create(null);
|
5391 | });
|
5392 |
|
5393 |
|
5394 |
|
5395 | Vue.options._base = Vue;
|
5396 |
|
5397 | extend(Vue.options.components, builtInComponents);
|
5398 |
|
5399 | initUse(Vue);
|
5400 | initMixin$1(Vue);
|
5401 | initExtend(Vue);
|
5402 | initAssetRegisters(Vue);
|
5403 | }
|
5404 |
|
5405 | initGlobalAPI(Vue);
|
5406 |
|
5407 | Object.defineProperty(Vue.prototype, '$isServer', {
|
5408 | get: isServerRendering
|
5409 | });
|
5410 |
|
5411 | Object.defineProperty(Vue.prototype, '$ssrContext', {
|
5412 | get: function get () {
|
5413 |
|
5414 | return this.$vnode && this.$vnode.ssrContext
|
5415 | }
|
5416 | });
|
5417 |
|
5418 |
|
5419 | Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
5420 | value: FunctionalRenderContext
|
5421 | });
|
5422 |
|
5423 | Vue.version = '2.6.7';
|
5424 |
|
5425 |
|
5426 |
|
5427 |
|
5428 |
|
5429 | var isReservedAttr = makeMap('style,class');
|
5430 |
|
5431 |
|
5432 | var acceptValue = makeMap('input,textarea,option,select,progress');
|
5433 | var mustUseProp = function (tag, type, attr) {
|
5434 | return (
|
5435 | (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
5436 | (attr === 'selected' && tag === 'option') ||
|
5437 | (attr === 'checked' && tag === 'input') ||
|
5438 | (attr === 'muted' && tag === 'video')
|
5439 | )
|
5440 | };
|
5441 |
|
5442 | var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
5443 |
|
5444 | var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
5445 |
|
5446 | var convertEnumeratedValue = function (key, value) {
|
5447 | return isFalsyAttrValue(value) || value === 'false'
|
5448 | ? 'false'
|
5449 |
|
5450 | : key === 'contenteditable' && isValidContentEditableValue(value)
|
5451 | ? value
|
5452 | : 'true'
|
5453 | };
|
5454 |
|
5455 | var isBooleanAttr = makeMap(
|
5456 | 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
5457 | 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
5458 | 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
5459 | 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
5460 | 'required,reversed,scoped,seamless,selected,sortable,translate,' +
|
5461 | 'truespeed,typemustmatch,visible'
|
5462 | );
|
5463 |
|
5464 | var xlinkNS = 'http://www.w3.org/1999/xlink';
|
5465 |
|
5466 | var isXlink = function (name) {
|
5467 | return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
5468 | };
|
5469 |
|
5470 | var getXlinkProp = function (name) {
|
5471 | return isXlink(name) ? name.slice(6, name.length) : ''
|
5472 | };
|
5473 |
|
5474 | var isFalsyAttrValue = function (val) {
|
5475 | return val == null || val === false
|
5476 | };
|
5477 |
|
5478 |
|
5479 |
|
5480 | function genClassForVnode (vnode) {
|
5481 | var data = vnode.data;
|
5482 | var parentNode = vnode;
|
5483 | var childNode = vnode;
|
5484 | while (isDef(childNode.componentInstance)) {
|
5485 | childNode = childNode.componentInstance._vnode;
|
5486 | if (childNode && childNode.data) {
|
5487 | data = mergeClassData(childNode.data, data);
|
5488 | }
|
5489 | }
|
5490 | while (isDef(parentNode = parentNode.parent)) {
|
5491 | if (parentNode && parentNode.data) {
|
5492 | data = mergeClassData(data, parentNode.data);
|
5493 | }
|
5494 | }
|
5495 | return renderClass(data.staticClass, data.class)
|
5496 | }
|
5497 |
|
5498 | function mergeClassData (child, parent) {
|
5499 | return {
|
5500 | staticClass: concat(child.staticClass, parent.staticClass),
|
5501 | class: isDef(child.class)
|
5502 | ? [child.class, parent.class]
|
5503 | : parent.class
|
5504 | }
|
5505 | }
|
5506 |
|
5507 | function renderClass (
|
5508 | staticClass,
|
5509 | dynamicClass
|
5510 | ) {
|
5511 | if (isDef(staticClass) || isDef(dynamicClass)) {
|
5512 | return concat(staticClass, stringifyClass(dynamicClass))
|
5513 | }
|
5514 |
|
5515 | return ''
|
5516 | }
|
5517 |
|
5518 | function concat (a, b) {
|
5519 | return a ? b ? (a + ' ' + b) : a : (b || '')
|
5520 | }
|
5521 |
|
5522 | function stringifyClass (value) {
|
5523 | if (Array.isArray(value)) {
|
5524 | return stringifyArray(value)
|
5525 | }
|
5526 | if (isObject(value)) {
|
5527 | return stringifyObject(value)
|
5528 | }
|
5529 | if (typeof value === 'string') {
|
5530 | return value
|
5531 | }
|
5532 |
|
5533 | return ''
|
5534 | }
|
5535 |
|
5536 | function stringifyArray (value) {
|
5537 | var res = '';
|
5538 | var stringified;
|
5539 | for (var i = 0, l = value.length; i < l; i++) {
|
5540 | if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
5541 | if (res) { res += ' '; }
|
5542 | res += stringified;
|
5543 | }
|
5544 | }
|
5545 | return res
|
5546 | }
|
5547 |
|
5548 | function stringifyObject (value) {
|
5549 | var res = '';
|
5550 | for (var key in value) {
|
5551 | if (value[key]) {
|
5552 | if (res) { res += ' '; }
|
5553 | res += key;
|
5554 | }
|
5555 | }
|
5556 | return res
|
5557 | }
|
5558 |
|
5559 |
|
5560 |
|
5561 | var namespaceMap = {
|
5562 | svg: 'http://www.w3.org/2000/svg',
|
5563 | math: 'http://www.w3.org/1998/Math/MathML'
|
5564 | };
|
5565 |
|
5566 | var isHTMLTag = makeMap(
|
5567 | 'html,body,base,head,link,meta,style,title,' +
|
5568 | 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
5569 | 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
5570 | 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
5571 | 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
5572 | 'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
5573 | 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
5574 | 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
5575 | 'output,progress,select,textarea,' +
|
5576 | 'details,dialog,menu,menuitem,summary,' +
|
5577 | 'content,element,shadow,template,blockquote,iframe,tfoot'
|
5578 | );
|
5579 |
|
5580 |
|
5581 |
|
5582 | var isSVG = makeMap(
|
5583 | 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
5584 | 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
5585 | 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
5586 | true
|
5587 | );
|
5588 |
|
5589 | var isPreTag = function (tag) { return tag === 'pre'; };
|
5590 |
|
5591 | var isReservedTag = function (tag) {
|
5592 | return isHTMLTag(tag) || isSVG(tag)
|
5593 | };
|
5594 |
|
5595 | function getTagNamespace (tag) {
|
5596 | if (isSVG(tag)) {
|
5597 | return 'svg'
|
5598 | }
|
5599 |
|
5600 |
|
5601 | if (tag === 'math') {
|
5602 | return 'math'
|
5603 | }
|
5604 | }
|
5605 |
|
5606 | var unknownElementCache = Object.create(null);
|
5607 | function isUnknownElement (tag) {
|
5608 |
|
5609 | if (!inBrowser) {
|
5610 | return true
|
5611 | }
|
5612 | if (isReservedTag(tag)) {
|
5613 | return false
|
5614 | }
|
5615 | tag = tag.toLowerCase();
|
5616 |
|
5617 | if (unknownElementCache[tag] != null) {
|
5618 | return unknownElementCache[tag]
|
5619 | }
|
5620 | var el = document.createElement(tag);
|
5621 | if (tag.indexOf('-') > -1) {
|
5622 |
|
5623 | return (unknownElementCache[tag] = (
|
5624 | el.constructor === window.HTMLUnknownElement ||
|
5625 | el.constructor === window.HTMLElement
|
5626 | ))
|
5627 | } else {
|
5628 | return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
5629 | }
|
5630 | }
|
5631 |
|
5632 | var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 | function query (el) {
|
5640 | if (typeof el === 'string') {
|
5641 | var selected = document.querySelector(el);
|
5642 | if (!selected) {
|
5643 | process.env.NODE_ENV !== 'production' && warn(
|
5644 | 'Cannot find element: ' + el
|
5645 | );
|
5646 | return document.createElement('div')
|
5647 | }
|
5648 | return selected
|
5649 | } else {
|
5650 | return el
|
5651 | }
|
5652 | }
|
5653 |
|
5654 |
|
5655 |
|
5656 | function createElement$1 (tagName, vnode) {
|
5657 | var elm = document.createElement(tagName);
|
5658 | if (tagName !== 'select') {
|
5659 | return elm
|
5660 | }
|
5661 |
|
5662 | if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
5663 | elm.setAttribute('multiple', 'multiple');
|
5664 | }
|
5665 | return elm
|
5666 | }
|
5667 |
|
5668 | function createElementNS (namespace, tagName) {
|
5669 | return document.createElementNS(namespaceMap[namespace], tagName)
|
5670 | }
|
5671 |
|
5672 | function createTextNode (text) {
|
5673 | return document.createTextNode(text)
|
5674 | }
|
5675 |
|
5676 | function createComment (text) {
|
5677 | return document.createComment(text)
|
5678 | }
|
5679 |
|
5680 | function insertBefore (parentNode, newNode, referenceNode) {
|
5681 | parentNode.insertBefore(newNode, referenceNode);
|
5682 | }
|
5683 |
|
5684 | function removeChild (node, child) {
|
5685 | node.removeChild(child);
|
5686 | }
|
5687 |
|
5688 | function appendChild (node, child) {
|
5689 | node.appendChild(child);
|
5690 | }
|
5691 |
|
5692 | function parentNode (node) {
|
5693 | return node.parentNode
|
5694 | }
|
5695 |
|
5696 | function nextSibling (node) {
|
5697 | return node.nextSibling
|
5698 | }
|
5699 |
|
5700 | function tagName (node) {
|
5701 | return node.tagName
|
5702 | }
|
5703 |
|
5704 | function setTextContent (node, text) {
|
5705 | node.textContent = text;
|
5706 | }
|
5707 |
|
5708 | function setStyleScope (node, scopeId) {
|
5709 | node.setAttribute(scopeId, '');
|
5710 | }
|
5711 |
|
5712 | var nodeOps = Object.freeze({
|
5713 | createElement: createElement$1,
|
5714 | createElementNS: createElementNS,
|
5715 | createTextNode: createTextNode,
|
5716 | createComment: createComment,
|
5717 | insertBefore: insertBefore,
|
5718 | removeChild: removeChild,
|
5719 | appendChild: appendChild,
|
5720 | parentNode: parentNode,
|
5721 | nextSibling: nextSibling,
|
5722 | tagName: tagName,
|
5723 | setTextContent: setTextContent,
|
5724 | setStyleScope: setStyleScope
|
5725 | });
|
5726 |
|
5727 |
|
5728 |
|
5729 | var ref = {
|
5730 | create: function create (_, vnode) {
|
5731 | registerRef(vnode);
|
5732 | },
|
5733 | update: function update (oldVnode, vnode) {
|
5734 | if (oldVnode.data.ref !== vnode.data.ref) {
|
5735 | registerRef(oldVnode, true);
|
5736 | registerRef(vnode);
|
5737 | }
|
5738 | },
|
5739 | destroy: function destroy (vnode) {
|
5740 | registerRef(vnode, true);
|
5741 | }
|
5742 | };
|
5743 |
|
5744 | function registerRef (vnode, isRemoval) {
|
5745 | var key = vnode.data.ref;
|
5746 | if (!isDef(key)) { return }
|
5747 |
|
5748 | var vm = vnode.context;
|
5749 | var ref = vnode.componentInstance || vnode.elm;
|
5750 | var refs = vm.$refs;
|
5751 | if (isRemoval) {
|
5752 | if (Array.isArray(refs[key])) {
|
5753 | remove(refs[key], ref);
|
5754 | } else if (refs[key] === ref) {
|
5755 | refs[key] = undefined;
|
5756 | }
|
5757 | } else {
|
5758 | if (vnode.data.refInFor) {
|
5759 | if (!Array.isArray(refs[key])) {
|
5760 | refs[key] = [ref];
|
5761 | } else if (refs[key].indexOf(ref) < 0) {
|
5762 |
|
5763 | refs[key].push(ref);
|
5764 | }
|
5765 | } else {
|
5766 | refs[key] = ref;
|
5767 | }
|
5768 | }
|
5769 | }
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 |
|
5783 | var emptyNode = new VNode('', {}, []);
|
5784 |
|
5785 | var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
5786 |
|
5787 | function sameVnode (a, b) {
|
5788 | return (
|
5789 | a.key === b.key && (
|
5790 | (
|
5791 | a.tag === b.tag &&
|
5792 | a.isComment === b.isComment &&
|
5793 | isDef(a.data) === isDef(b.data) &&
|
5794 | sameInputType(a, b)
|
5795 | ) || (
|
5796 | isTrue(a.isAsyncPlaceholder) &&
|
5797 | a.asyncFactory === b.asyncFactory &&
|
5798 | isUndef(b.asyncFactory.error)
|
5799 | )
|
5800 | )
|
5801 | )
|
5802 | }
|
5803 |
|
5804 | function sameInputType (a, b) {
|
5805 | if (a.tag !== 'input') { return true }
|
5806 | var i;
|
5807 | var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
5808 | var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
5809 | return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
5810 | }
|
5811 |
|
5812 | function createKeyToOldIdx (children, beginIdx, endIdx) {
|
5813 | var i, key;
|
5814 | var map = {};
|
5815 | for (i = beginIdx; i <= endIdx; ++i) {
|
5816 | key = children[i].key;
|
5817 | if (isDef(key)) { map[key] = i; }
|
5818 | }
|
5819 | return map
|
5820 | }
|
5821 |
|
5822 | function createPatchFunction (backend) {
|
5823 | var i, j;
|
5824 | var cbs = {};
|
5825 |
|
5826 | var modules = backend.modules;
|
5827 | var nodeOps = backend.nodeOps;
|
5828 |
|
5829 | for (i = 0; i < hooks.length; ++i) {
|
5830 | cbs[hooks[i]] = [];
|
5831 | for (j = 0; j < modules.length; ++j) {
|
5832 | if (isDef(modules[j][hooks[i]])) {
|
5833 | cbs[hooks[i]].push(modules[j][hooks[i]]);
|
5834 | }
|
5835 | }
|
5836 | }
|
5837 |
|
5838 | function emptyNodeAt (elm) {
|
5839 | return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
5840 | }
|
5841 |
|
5842 | function createRmCb (childElm, listeners) {
|
5843 | function remove$$1 () {
|
5844 | if (--remove$$1.listeners === 0) {
|
5845 | removeNode(childElm);
|
5846 | }
|
5847 | }
|
5848 | remove$$1.listeners = listeners;
|
5849 | return remove$$1
|
5850 | }
|
5851 |
|
5852 | function removeNode (el) {
|
5853 | var parent = nodeOps.parentNode(el);
|
5854 |
|
5855 | if (isDef(parent)) {
|
5856 | nodeOps.removeChild(parent, el);
|
5857 | }
|
5858 | }
|
5859 |
|
5860 | function isUnknownElement$$1 (vnode, inVPre) {
|
5861 | return (
|
5862 | !inVPre &&
|
5863 | !vnode.ns &&
|
5864 | !(
|
5865 | config.ignoredElements.length &&
|
5866 | config.ignoredElements.some(function (ignore) {
|
5867 | return isRegExp(ignore)
|
5868 | ? ignore.test(vnode.tag)
|
5869 | : ignore === vnode.tag
|
5870 | })
|
5871 | ) &&
|
5872 | config.isUnknownElement(vnode.tag)
|
5873 | )
|
5874 | }
|
5875 |
|
5876 | var creatingElmInVPre = 0;
|
5877 |
|
5878 | function createElm (
|
5879 | vnode,
|
5880 | insertedVnodeQueue,
|
5881 | parentElm,
|
5882 | refElm,
|
5883 | nested,
|
5884 | ownerArray,
|
5885 | index
|
5886 | ) {
|
5887 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
5888 |
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 | vnode = ownerArray[index] = cloneVNode(vnode);
|
5894 | }
|
5895 |
|
5896 | vnode.isRootInsert = !nested;
|
5897 | if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
5898 | return
|
5899 | }
|
5900 |
|
5901 | var data = vnode.data;
|
5902 | var children = vnode.children;
|
5903 | var tag = vnode.tag;
|
5904 | if (isDef(tag)) {
|
5905 | if (process.env.NODE_ENV !== 'production') {
|
5906 | if (data && data.pre) {
|
5907 | creatingElmInVPre++;
|
5908 | }
|
5909 | if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
5910 | warn(
|
5911 | 'Unknown custom element: <' + tag + '> - did you ' +
|
5912 | 'register the component correctly? For recursive components, ' +
|
5913 | 'make sure to provide the "name" option.',
|
5914 | vnode.context
|
5915 | );
|
5916 | }
|
5917 | }
|
5918 |
|
5919 | vnode.elm = vnode.ns
|
5920 | ? nodeOps.createElementNS(vnode.ns, tag)
|
5921 | : nodeOps.createElement(tag, vnode);
|
5922 | setScope(vnode);
|
5923 |
|
5924 |
|
5925 | {
|
5926 | createChildren(vnode, children, insertedVnodeQueue);
|
5927 | if (isDef(data)) {
|
5928 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
5929 | }
|
5930 | insert(parentElm, vnode.elm, refElm);
|
5931 | }
|
5932 |
|
5933 | if (process.env.NODE_ENV !== 'production' && data && data.pre) {
|
5934 | creatingElmInVPre--;
|
5935 | }
|
5936 | } else if (isTrue(vnode.isComment)) {
|
5937 | vnode.elm = nodeOps.createComment(vnode.text);
|
5938 | insert(parentElm, vnode.elm, refElm);
|
5939 | } else {
|
5940 | vnode.elm = nodeOps.createTextNode(vnode.text);
|
5941 | insert(parentElm, vnode.elm, refElm);
|
5942 | }
|
5943 | }
|
5944 |
|
5945 | function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5946 | var i = vnode.data;
|
5947 | if (isDef(i)) {
|
5948 | var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
5949 | if (isDef(i = i.hook) && isDef(i = i.init)) {
|
5950 | i(vnode, false );
|
5951 | }
|
5952 |
|
5953 |
|
5954 |
|
5955 |
|
5956 | if (isDef(vnode.componentInstance)) {
|
5957 | initComponent(vnode, insertedVnodeQueue);
|
5958 | insert(parentElm, vnode.elm, refElm);
|
5959 | if (isTrue(isReactivated)) {
|
5960 | reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
5961 | }
|
5962 | return true
|
5963 | }
|
5964 | }
|
5965 | }
|
5966 |
|
5967 | function initComponent (vnode, insertedVnodeQueue) {
|
5968 | if (isDef(vnode.data.pendingInsert)) {
|
5969 | insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
5970 | vnode.data.pendingInsert = null;
|
5971 | }
|
5972 | vnode.elm = vnode.componentInstance.$el;
|
5973 | if (isPatchable(vnode)) {
|
5974 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
5975 | setScope(vnode);
|
5976 | } else {
|
5977 |
|
5978 |
|
5979 | registerRef(vnode);
|
5980 |
|
5981 | insertedVnodeQueue.push(vnode);
|
5982 | }
|
5983 | }
|
5984 |
|
5985 | function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5986 | var i;
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 | var innerNode = vnode;
|
5992 | while (innerNode.componentInstance) {
|
5993 | innerNode = innerNode.componentInstance._vnode;
|
5994 | if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
5995 | for (i = 0; i < cbs.activate.length; ++i) {
|
5996 | cbs.activate[i](emptyNode, innerNode);
|
5997 | }
|
5998 | insertedVnodeQueue.push(innerNode);
|
5999 | break
|
6000 | }
|
6001 | }
|
6002 |
|
6003 |
|
6004 | insert(parentElm, vnode.elm, refElm);
|
6005 | }
|
6006 |
|
6007 | function insert (parent, elm, ref$$1) {
|
6008 | if (isDef(parent)) {
|
6009 | if (isDef(ref$$1)) {
|
6010 | if (nodeOps.parentNode(ref$$1) === parent) {
|
6011 | nodeOps.insertBefore(parent, elm, ref$$1);
|
6012 | }
|
6013 | } else {
|
6014 | nodeOps.appendChild(parent, elm);
|
6015 | }
|
6016 | }
|
6017 | }
|
6018 |
|
6019 | function createChildren (vnode, children, insertedVnodeQueue) {
|
6020 | if (Array.isArray(children)) {
|
6021 | if (process.env.NODE_ENV !== 'production') {
|
6022 | checkDuplicateKeys(children);
|
6023 | }
|
6024 | for (var i = 0; i < children.length; ++i) {
|
6025 | createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
6026 | }
|
6027 | } else if (isPrimitive(vnode.text)) {
|
6028 | nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
6029 | }
|
6030 | }
|
6031 |
|
6032 | function isPatchable (vnode) {
|
6033 | while (vnode.componentInstance) {
|
6034 | vnode = vnode.componentInstance._vnode;
|
6035 | }
|
6036 | return isDef(vnode.tag)
|
6037 | }
|
6038 |
|
6039 | function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
6040 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6041 | cbs.create[i$1](emptyNode, vnode);
|
6042 | }
|
6043 | i = vnode.data.hook;
|
6044 | if (isDef(i)) {
|
6045 | if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
6046 | if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
6047 | }
|
6048 | }
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 | function setScope (vnode) {
|
6054 | var i;
|
6055 | if (isDef(i = vnode.fnScopeId)) {
|
6056 | nodeOps.setStyleScope(vnode.elm, i);
|
6057 | } else {
|
6058 | var ancestor = vnode;
|
6059 | while (ancestor) {
|
6060 | if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
6061 | nodeOps.setStyleScope(vnode.elm, i);
|
6062 | }
|
6063 | ancestor = ancestor.parent;
|
6064 | }
|
6065 | }
|
6066 |
|
6067 | if (isDef(i = activeInstance) &&
|
6068 | i !== vnode.context &&
|
6069 | i !== vnode.fnContext &&
|
6070 | isDef(i = i.$options._scopeId)
|
6071 | ) {
|
6072 | nodeOps.setStyleScope(vnode.elm, i);
|
6073 | }
|
6074 | }
|
6075 |
|
6076 | function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
6077 | for (; startIdx <= endIdx; ++startIdx) {
|
6078 | createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
6079 | }
|
6080 | }
|
6081 |
|
6082 | function invokeDestroyHook (vnode) {
|
6083 | var i, j;
|
6084 | var data = vnode.data;
|
6085 | if (isDef(data)) {
|
6086 | if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
6087 | for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
6088 | }
|
6089 | if (isDef(i = vnode.children)) {
|
6090 | for (j = 0; j < vnode.children.length; ++j) {
|
6091 | invokeDestroyHook(vnode.children[j]);
|
6092 | }
|
6093 | }
|
6094 | }
|
6095 |
|
6096 | function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
|
6097 | for (; startIdx <= endIdx; ++startIdx) {
|
6098 | var ch = vnodes[startIdx];
|
6099 | if (isDef(ch)) {
|
6100 | if (isDef(ch.tag)) {
|
6101 | removeAndInvokeRemoveHook(ch);
|
6102 | invokeDestroyHook(ch);
|
6103 | } else {
|
6104 | removeNode(ch.elm);
|
6105 | }
|
6106 | }
|
6107 | }
|
6108 | }
|
6109 |
|
6110 | function removeAndInvokeRemoveHook (vnode, rm) {
|
6111 | if (isDef(rm) || isDef(vnode.data)) {
|
6112 | var i;
|
6113 | var listeners = cbs.remove.length + 1;
|
6114 | if (isDef(rm)) {
|
6115 |
|
6116 |
|
6117 | rm.listeners += listeners;
|
6118 | } else {
|
6119 |
|
6120 | rm = createRmCb(vnode.elm, listeners);
|
6121 | }
|
6122 |
|
6123 | if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
6124 | removeAndInvokeRemoveHook(i, rm);
|
6125 | }
|
6126 | for (i = 0; i < cbs.remove.length; ++i) {
|
6127 | cbs.remove[i](vnode, rm);
|
6128 | }
|
6129 | if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
6130 | i(vnode, rm);
|
6131 | } else {
|
6132 | rm();
|
6133 | }
|
6134 | } else {
|
6135 | removeNode(vnode.elm);
|
6136 | }
|
6137 | }
|
6138 |
|
6139 | function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6140 | var oldStartIdx = 0;
|
6141 | var newStartIdx = 0;
|
6142 | var oldEndIdx = oldCh.length - 1;
|
6143 | var oldStartVnode = oldCh[0];
|
6144 | var oldEndVnode = oldCh[oldEndIdx];
|
6145 | var newEndIdx = newCh.length - 1;
|
6146 | var newStartVnode = newCh[0];
|
6147 | var newEndVnode = newCh[newEndIdx];
|
6148 | var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6149 |
|
6150 |
|
6151 |
|
6152 |
|
6153 | var canMove = !removeOnly;
|
6154 |
|
6155 | if (process.env.NODE_ENV !== 'production') {
|
6156 | checkDuplicateKeys(newCh);
|
6157 | }
|
6158 |
|
6159 | while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6160 | if (isUndef(oldStartVnode)) {
|
6161 | oldStartVnode = oldCh[++oldStartIdx];
|
6162 | } else if (isUndef(oldEndVnode)) {
|
6163 | oldEndVnode = oldCh[--oldEndIdx];
|
6164 | } else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6165 | patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6166 | oldStartVnode = oldCh[++oldStartIdx];
|
6167 | newStartVnode = newCh[++newStartIdx];
|
6168 | } else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6169 | patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6170 | oldEndVnode = oldCh[--oldEndIdx];
|
6171 | newEndVnode = newCh[--newEndIdx];
|
6172 | } else if (sameVnode(oldStartVnode, newEndVnode)) {
|
6173 | patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6174 | canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6175 | oldStartVnode = oldCh[++oldStartIdx];
|
6176 | newEndVnode = newCh[--newEndIdx];
|
6177 | } else if (sameVnode(oldEndVnode, newStartVnode)) {
|
6178 | patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6179 | canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6180 | oldEndVnode = oldCh[--oldEndIdx];
|
6181 | newStartVnode = newCh[++newStartIdx];
|
6182 | } else {
|
6183 | if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
6184 | idxInOld = isDef(newStartVnode.key)
|
6185 | ? oldKeyToIdx[newStartVnode.key]
|
6186 | : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6187 | if (isUndef(idxInOld)) {
|
6188 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6189 | } else {
|
6190 | vnodeToMove = oldCh[idxInOld];
|
6191 | if (sameVnode(vnodeToMove, newStartVnode)) {
|
6192 | patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6193 | oldCh[idxInOld] = undefined;
|
6194 | canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6195 | } else {
|
6196 |
|
6197 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6198 | }
|
6199 | }
|
6200 | newStartVnode = newCh[++newStartIdx];
|
6201 | }
|
6202 | }
|
6203 | if (oldStartIdx > oldEndIdx) {
|
6204 | refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6205 | addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6206 | } else if (newStartIdx > newEndIdx) {
|
6207 | removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
6208 | }
|
6209 | }
|
6210 |
|
6211 | function checkDuplicateKeys (children) {
|
6212 | var seenKeys = {};
|
6213 | for (var i = 0; i < children.length; i++) {
|
6214 | var vnode = children[i];
|
6215 | var key = vnode.key;
|
6216 | if (isDef(key)) {
|
6217 | if (seenKeys[key]) {
|
6218 | warn(
|
6219 | ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
6220 | vnode.context
|
6221 | );
|
6222 | } else {
|
6223 | seenKeys[key] = true;
|
6224 | }
|
6225 | }
|
6226 | }
|
6227 | }
|
6228 |
|
6229 | function findIdxInOld (node, oldCh, start, end) {
|
6230 | for (var i = start; i < end; i++) {
|
6231 | var c = oldCh[i];
|
6232 | if (isDef(c) && sameVnode(node, c)) { return i }
|
6233 | }
|
6234 | }
|
6235 |
|
6236 | function patchVnode (
|
6237 | oldVnode,
|
6238 | vnode,
|
6239 | insertedVnodeQueue,
|
6240 | ownerArray,
|
6241 | index,
|
6242 | removeOnly
|
6243 | ) {
|
6244 | if (oldVnode === vnode) {
|
6245 | return
|
6246 | }
|
6247 |
|
6248 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6249 |
|
6250 | vnode = ownerArray[index] = cloneVNode(vnode);
|
6251 | }
|
6252 |
|
6253 | var elm = vnode.elm = oldVnode.elm;
|
6254 |
|
6255 | if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6256 | if (isDef(vnode.asyncFactory.resolved)) {
|
6257 | hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6258 | } else {
|
6259 | vnode.isAsyncPlaceholder = true;
|
6260 | }
|
6261 | return
|
6262 | }
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 | if (isTrue(vnode.isStatic) &&
|
6269 | isTrue(oldVnode.isStatic) &&
|
6270 | vnode.key === oldVnode.key &&
|
6271 | (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
6272 | ) {
|
6273 | vnode.componentInstance = oldVnode.componentInstance;
|
6274 | return
|
6275 | }
|
6276 |
|
6277 | var i;
|
6278 | var data = vnode.data;
|
6279 | if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
6280 | i(oldVnode, vnode);
|
6281 | }
|
6282 |
|
6283 | var oldCh = oldVnode.children;
|
6284 | var ch = vnode.children;
|
6285 | if (isDef(data) && isPatchable(vnode)) {
|
6286 | for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
6287 | if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
6288 | }
|
6289 | if (isUndef(vnode.text)) {
|
6290 | if (isDef(oldCh) && isDef(ch)) {
|
6291 | if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
6292 | } else if (isDef(ch)) {
|
6293 | if (process.env.NODE_ENV !== 'production') {
|
6294 | checkDuplicateKeys(ch);
|
6295 | }
|
6296 | if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
6297 | addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6298 | } else if (isDef(oldCh)) {
|
6299 | removeVnodes(elm, oldCh, 0, oldCh.length - 1);
|
6300 | } else if (isDef(oldVnode.text)) {
|
6301 | nodeOps.setTextContent(elm, '');
|
6302 | }
|
6303 | } else if (oldVnode.text !== vnode.text) {
|
6304 | nodeOps.setTextContent(elm, vnode.text);
|
6305 | }
|
6306 | if (isDef(data)) {
|
6307 | if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
6308 | }
|
6309 | }
|
6310 |
|
6311 | function invokeInsertHook (vnode, queue, initial) {
|
6312 |
|
6313 |
|
6314 | if (isTrue(initial) && isDef(vnode.parent)) {
|
6315 | vnode.parent.data.pendingInsert = queue;
|
6316 | } else {
|
6317 | for (var i = 0; i < queue.length; ++i) {
|
6318 | queue[i].data.hook.insert(queue[i]);
|
6319 | }
|
6320 | }
|
6321 | }
|
6322 |
|
6323 | var hydrationBailed = false;
|
6324 |
|
6325 |
|
6326 |
|
6327 |
|
6328 | var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6329 |
|
6330 |
|
6331 | function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
6332 | var i;
|
6333 | var tag = vnode.tag;
|
6334 | var data = vnode.data;
|
6335 | var children = vnode.children;
|
6336 | inVPre = inVPre || (data && data.pre);
|
6337 | vnode.elm = elm;
|
6338 |
|
6339 | if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6340 | vnode.isAsyncPlaceholder = true;
|
6341 | return true
|
6342 | }
|
6343 |
|
6344 | if (process.env.NODE_ENV !== 'production') {
|
6345 | if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6346 | return false
|
6347 | }
|
6348 | }
|
6349 | if (isDef(data)) {
|
6350 | if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true ); }
|
6351 | if (isDef(i = vnode.componentInstance)) {
|
6352 |
|
6353 | initComponent(vnode, insertedVnodeQueue);
|
6354 | return true
|
6355 | }
|
6356 | }
|
6357 | if (isDef(tag)) {
|
6358 | if (isDef(children)) {
|
6359 |
|
6360 | if (!elm.hasChildNodes()) {
|
6361 | createChildren(vnode, children, insertedVnodeQueue);
|
6362 | } else {
|
6363 |
|
6364 | if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
6365 | if (i !== elm.innerHTML) {
|
6366 |
|
6367 | if (process.env.NODE_ENV !== 'production' &&
|
6368 | typeof console !== 'undefined' &&
|
6369 | !hydrationBailed
|
6370 | ) {
|
6371 | hydrationBailed = true;
|
6372 | console.warn('Parent: ', elm);
|
6373 | console.warn('server innerHTML: ', i);
|
6374 | console.warn('client innerHTML: ', elm.innerHTML);
|
6375 | }
|
6376 | return false
|
6377 | }
|
6378 | } else {
|
6379 |
|
6380 | var childrenMatch = true;
|
6381 | var childNode = elm.firstChild;
|
6382 | for (var i$1 = 0; i$1 < children.length; i$1++) {
|
6383 | if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
6384 | childrenMatch = false;
|
6385 | break
|
6386 | }
|
6387 | childNode = childNode.nextSibling;
|
6388 | }
|
6389 |
|
6390 |
|
6391 | if (!childrenMatch || childNode) {
|
6392 |
|
6393 | if (process.env.NODE_ENV !== 'production' &&
|
6394 | typeof console !== 'undefined' &&
|
6395 | !hydrationBailed
|
6396 | ) {
|
6397 | hydrationBailed = true;
|
6398 | console.warn('Parent: ', elm);
|
6399 | console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
6400 | }
|
6401 | return false
|
6402 | }
|
6403 | }
|
6404 | }
|
6405 | }
|
6406 | if (isDef(data)) {
|
6407 | var fullInvoke = false;
|
6408 | for (var key in data) {
|
6409 | if (!isRenderedModule(key)) {
|
6410 | fullInvoke = true;
|
6411 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
6412 | break
|
6413 | }
|
6414 | }
|
6415 | if (!fullInvoke && data['class']) {
|
6416 |
|
6417 | traverse(data['class']);
|
6418 | }
|
6419 | }
|
6420 | } else if (elm.data !== vnode.text) {
|
6421 | elm.data = vnode.text;
|
6422 | }
|
6423 | return true
|
6424 | }
|
6425 |
|
6426 | function assertNodeMatch (node, vnode, inVPre) {
|
6427 | if (isDef(vnode.tag)) {
|
6428 | return vnode.tag.indexOf('vue-component') === 0 || (
|
6429 | !isUnknownElement$$1(vnode, inVPre) &&
|
6430 | vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
6431 | )
|
6432 | } else {
|
6433 | return node.nodeType === (vnode.isComment ? 8 : 3)
|
6434 | }
|
6435 | }
|
6436 |
|
6437 | return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
6438 | if (isUndef(vnode)) {
|
6439 | if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
6440 | return
|
6441 | }
|
6442 |
|
6443 | var isInitialPatch = false;
|
6444 | var insertedVnodeQueue = [];
|
6445 |
|
6446 | if (isUndef(oldVnode)) {
|
6447 |
|
6448 | isInitialPatch = true;
|
6449 | createElm(vnode, insertedVnodeQueue);
|
6450 | } else {
|
6451 | var isRealElement = isDef(oldVnode.nodeType);
|
6452 | if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
6453 |
|
6454 | patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
6455 | } else {
|
6456 | if (isRealElement) {
|
6457 |
|
6458 |
|
6459 |
|
6460 | if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
6461 | oldVnode.removeAttribute(SSR_ATTR);
|
6462 | hydrating = true;
|
6463 | }
|
6464 | if (isTrue(hydrating)) {
|
6465 | if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
6466 | invokeInsertHook(vnode, insertedVnodeQueue, true);
|
6467 | return oldVnode
|
6468 | } else if (process.env.NODE_ENV !== 'production') {
|
6469 | warn(
|
6470 | 'The client-side rendered virtual DOM tree is not matching ' +
|
6471 | 'server-rendered content. This is likely caused by incorrect ' +
|
6472 | 'HTML markup, for example nesting block-level elements inside ' +
|
6473 | '<p>, or missing <tbody>. Bailing hydration and performing ' +
|
6474 | 'full client-side render.'
|
6475 | );
|
6476 | }
|
6477 | }
|
6478 |
|
6479 |
|
6480 | oldVnode = emptyNodeAt(oldVnode);
|
6481 | }
|
6482 |
|
6483 |
|
6484 | var oldElm = oldVnode.elm;
|
6485 | var parentElm = nodeOps.parentNode(oldElm);
|
6486 |
|
6487 |
|
6488 | createElm(
|
6489 | vnode,
|
6490 | insertedVnodeQueue,
|
6491 |
|
6492 |
|
6493 |
|
6494 | oldElm._leaveCb ? null : parentElm,
|
6495 | nodeOps.nextSibling(oldElm)
|
6496 | );
|
6497 |
|
6498 |
|
6499 | if (isDef(vnode.parent)) {
|
6500 | var ancestor = vnode.parent;
|
6501 | var patchable = isPatchable(vnode);
|
6502 | while (ancestor) {
|
6503 | for (var i = 0; i < cbs.destroy.length; ++i) {
|
6504 | cbs.destroy[i](ancestor);
|
6505 | }
|
6506 | ancestor.elm = vnode.elm;
|
6507 | if (patchable) {
|
6508 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6509 | cbs.create[i$1](emptyNode, ancestor);
|
6510 | }
|
6511 |
|
6512 |
|
6513 |
|
6514 | var insert = ancestor.data.hook.insert;
|
6515 | if (insert.merged) {
|
6516 |
|
6517 | for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
6518 | insert.fns[i$2]();
|
6519 | }
|
6520 | }
|
6521 | } else {
|
6522 | registerRef(ancestor);
|
6523 | }
|
6524 | ancestor = ancestor.parent;
|
6525 | }
|
6526 | }
|
6527 |
|
6528 |
|
6529 | if (isDef(parentElm)) {
|
6530 | removeVnodes(parentElm, [oldVnode], 0, 0);
|
6531 | } else if (isDef(oldVnode.tag)) {
|
6532 | invokeDestroyHook(oldVnode);
|
6533 | }
|
6534 | }
|
6535 | }
|
6536 |
|
6537 | invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
6538 | return vnode.elm
|
6539 | }
|
6540 | }
|
6541 |
|
6542 |
|
6543 |
|
6544 | var directives = {
|
6545 | create: updateDirectives,
|
6546 | update: updateDirectives,
|
6547 | destroy: function unbindDirectives (vnode) {
|
6548 | updateDirectives(vnode, emptyNode);
|
6549 | }
|
6550 | };
|
6551 |
|
6552 | function updateDirectives (oldVnode, vnode) {
|
6553 | if (oldVnode.data.directives || vnode.data.directives) {
|
6554 | _update(oldVnode, vnode);
|
6555 | }
|
6556 | }
|
6557 |
|
6558 | function _update (oldVnode, vnode) {
|
6559 | var isCreate = oldVnode === emptyNode;
|
6560 | var isDestroy = vnode === emptyNode;
|
6561 | var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
6562 | var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
6563 |
|
6564 | var dirsWithInsert = [];
|
6565 | var dirsWithPostpatch = [];
|
6566 |
|
6567 | var key, oldDir, dir;
|
6568 | for (key in newDirs) {
|
6569 | oldDir = oldDirs[key];
|
6570 | dir = newDirs[key];
|
6571 | if (!oldDir) {
|
6572 |
|
6573 | callHook$1(dir, 'bind', vnode, oldVnode);
|
6574 | if (dir.def && dir.def.inserted) {
|
6575 | dirsWithInsert.push(dir);
|
6576 | }
|
6577 | } else {
|
6578 |
|
6579 | dir.oldValue = oldDir.value;
|
6580 | dir.oldArg = oldDir.arg;
|
6581 | callHook$1(dir, 'update', vnode, oldVnode);
|
6582 | if (dir.def && dir.def.componentUpdated) {
|
6583 | dirsWithPostpatch.push(dir);
|
6584 | }
|
6585 | }
|
6586 | }
|
6587 |
|
6588 | if (dirsWithInsert.length) {
|
6589 | var callInsert = function () {
|
6590 | for (var i = 0; i < dirsWithInsert.length; i++) {
|
6591 | callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
6592 | }
|
6593 | };
|
6594 | if (isCreate) {
|
6595 | mergeVNodeHook(vnode, 'insert', callInsert);
|
6596 | } else {
|
6597 | callInsert();
|
6598 | }
|
6599 | }
|
6600 |
|
6601 | if (dirsWithPostpatch.length) {
|
6602 | mergeVNodeHook(vnode, 'postpatch', function () {
|
6603 | for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
6604 | callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
6605 | }
|
6606 | });
|
6607 | }
|
6608 |
|
6609 | if (!isCreate) {
|
6610 | for (key in oldDirs) {
|
6611 | if (!newDirs[key]) {
|
6612 |
|
6613 | callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
6614 | }
|
6615 | }
|
6616 | }
|
6617 | }
|
6618 |
|
6619 | var emptyModifiers = Object.create(null);
|
6620 |
|
6621 | function normalizeDirectives$1 (
|
6622 | dirs,
|
6623 | vm
|
6624 | ) {
|
6625 | var res = Object.create(null);
|
6626 | if (!dirs) {
|
6627 |
|
6628 | return res
|
6629 | }
|
6630 | var i, dir;
|
6631 | for (i = 0; i < dirs.length; i++) {
|
6632 | dir = dirs[i];
|
6633 | if (!dir.modifiers) {
|
6634 |
|
6635 | dir.modifiers = emptyModifiers;
|
6636 | }
|
6637 | res[getRawDirName(dir)] = dir;
|
6638 | dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
6639 | }
|
6640 |
|
6641 | return res
|
6642 | }
|
6643 |
|
6644 | function getRawDirName (dir) {
|
6645 | return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
6646 | }
|
6647 |
|
6648 | function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
6649 | var fn = dir.def && dir.def[hook];
|
6650 | if (fn) {
|
6651 | try {
|
6652 | fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
6653 | } catch (e) {
|
6654 | handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
6655 | }
|
6656 | }
|
6657 | }
|
6658 |
|
6659 | var baseModules = [
|
6660 | ref,
|
6661 | directives
|
6662 | ];
|
6663 |
|
6664 |
|
6665 |
|
6666 | function updateAttrs (oldVnode, vnode) {
|
6667 | var opts = vnode.componentOptions;
|
6668 | if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
6669 | return
|
6670 | }
|
6671 | if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
6672 | return
|
6673 | }
|
6674 | var key, cur, old;
|
6675 | var elm = vnode.elm;
|
6676 | var oldAttrs = oldVnode.data.attrs || {};
|
6677 | var attrs = vnode.data.attrs || {};
|
6678 |
|
6679 | if (isDef(attrs.__ob__)) {
|
6680 | attrs = vnode.data.attrs = extend({}, attrs);
|
6681 | }
|
6682 |
|
6683 | for (key in attrs) {
|
6684 | cur = attrs[key];
|
6685 | old = oldAttrs[key];
|
6686 | if (old !== cur) {
|
6687 | setAttr(elm, key, cur);
|
6688 | }
|
6689 | }
|
6690 |
|
6691 |
|
6692 |
|
6693 | if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
6694 | setAttr(elm, 'value', attrs.value);
|
6695 | }
|
6696 | for (key in oldAttrs) {
|
6697 | if (isUndef(attrs[key])) {
|
6698 | if (isXlink(key)) {
|
6699 | elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6700 | } else if (!isEnumeratedAttr(key)) {
|
6701 | elm.removeAttribute(key);
|
6702 | }
|
6703 | }
|
6704 | }
|
6705 | }
|
6706 |
|
6707 | function setAttr (el, key, value) {
|
6708 | if (el.tagName.indexOf('-') > -1) {
|
6709 | baseSetAttr(el, key, value);
|
6710 | } else if (isBooleanAttr(key)) {
|
6711 |
|
6712 |
|
6713 | if (isFalsyAttrValue(value)) {
|
6714 | el.removeAttribute(key);
|
6715 | } else {
|
6716 |
|
6717 |
|
6718 | value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
6719 | ? 'true'
|
6720 | : key;
|
6721 | el.setAttribute(key, value);
|
6722 | }
|
6723 | } else if (isEnumeratedAttr(key)) {
|
6724 | el.setAttribute(key, convertEnumeratedValue(key, value));
|
6725 | } else if (isXlink(key)) {
|
6726 | if (isFalsyAttrValue(value)) {
|
6727 | el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6728 | } else {
|
6729 | el.setAttributeNS(xlinkNS, key, value);
|
6730 | }
|
6731 | } else {
|
6732 | baseSetAttr(el, key, value);
|
6733 | }
|
6734 | }
|
6735 |
|
6736 | function baseSetAttr (el, key, value) {
|
6737 | if (isFalsyAttrValue(value)) {
|
6738 | el.removeAttribute(key);
|
6739 | } else {
|
6740 |
|
6741 |
|
6742 |
|
6743 |
|
6744 | if (
|
6745 | isIE && !isIE9 &&
|
6746 | el.tagName === 'TEXTAREA' &&
|
6747 | key === 'placeholder' && value !== '' && !el.__ieph
|
6748 | ) {
|
6749 | var blocker = function (e) {
|
6750 | e.stopImmediatePropagation();
|
6751 | el.removeEventListener('input', blocker);
|
6752 | };
|
6753 | el.addEventListener('input', blocker);
|
6754 |
|
6755 | el.__ieph = true;
|
6756 | }
|
6757 | el.setAttribute(key, value);
|
6758 | }
|
6759 | }
|
6760 |
|
6761 | var attrs = {
|
6762 | create: updateAttrs,
|
6763 | update: updateAttrs
|
6764 | };
|
6765 |
|
6766 |
|
6767 |
|
6768 | function updateClass (oldVnode, vnode) {
|
6769 | var el = vnode.elm;
|
6770 | var data = vnode.data;
|
6771 | var oldData = oldVnode.data;
|
6772 | if (
|
6773 | isUndef(data.staticClass) &&
|
6774 | isUndef(data.class) && (
|
6775 | isUndef(oldData) || (
|
6776 | isUndef(oldData.staticClass) &&
|
6777 | isUndef(oldData.class)
|
6778 | )
|
6779 | )
|
6780 | ) {
|
6781 | return
|
6782 | }
|
6783 |
|
6784 | var cls = genClassForVnode(vnode);
|
6785 |
|
6786 |
|
6787 | var transitionClass = el._transitionClasses;
|
6788 | if (isDef(transitionClass)) {
|
6789 | cls = concat(cls, stringifyClass(transitionClass));
|
6790 | }
|
6791 |
|
6792 |
|
6793 | if (cls !== el._prevClass) {
|
6794 | el.setAttribute('class', cls);
|
6795 | el._prevClass = cls;
|
6796 | }
|
6797 | }
|
6798 |
|
6799 | var klass = {
|
6800 | create: updateClass,
|
6801 | update: updateClass
|
6802 | };
|
6803 |
|
6804 |
|
6805 |
|
6806 | var validDivisionCharRE = /[\w).+\-_$\]]/;
|
6807 |
|
6808 | function parseFilters (exp) {
|
6809 | var inSingle = false;
|
6810 | var inDouble = false;
|
6811 | var inTemplateString = false;
|
6812 | var inRegex = false;
|
6813 | var curly = 0;
|
6814 | var square = 0;
|
6815 | var paren = 0;
|
6816 | var lastFilterIndex = 0;
|
6817 | var c, prev, i, expression, filters;
|
6818 |
|
6819 | for (i = 0; i < exp.length; i++) {
|
6820 | prev = c;
|
6821 | c = exp.charCodeAt(i);
|
6822 | if (inSingle) {
|
6823 | if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
|
6824 | } else if (inDouble) {
|
6825 | if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
|
6826 | } else if (inTemplateString) {
|
6827 | if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
|
6828 | } else if (inRegex) {
|
6829 | if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
|
6830 | } else if (
|
6831 | c === 0x7C &&
|
6832 | exp.charCodeAt(i + 1) !== 0x7C &&
|
6833 | exp.charCodeAt(i - 1) !== 0x7C &&
|
6834 | !curly && !square && !paren
|
6835 | ) {
|
6836 | if (expression === undefined) {
|
6837 |
|
6838 | lastFilterIndex = i + 1;
|
6839 | expression = exp.slice(0, i).trim();
|
6840 | } else {
|
6841 | pushFilter();
|
6842 | }
|
6843 | } else {
|
6844 | switch (c) {
|
6845 | case 0x22: inDouble = true; break
|
6846 | case 0x27: inSingle = true; break
|
6847 | case 0x60: inTemplateString = true; break
|
6848 | case 0x28: paren++; break
|
6849 | case 0x29: paren--; break
|
6850 | case 0x5B: square++; break
|
6851 | case 0x5D: square--; break
|
6852 | case 0x7B: curly++; break
|
6853 | case 0x7D: curly--; break
|
6854 | }
|
6855 | if (c === 0x2f) {
|
6856 | var j = i - 1;
|
6857 | var p = (void 0);
|
6858 |
|
6859 | for (; j >= 0; j--) {
|
6860 | p = exp.charAt(j);
|
6861 | if (p !== ' ') { break }
|
6862 | }
|
6863 | if (!p || !validDivisionCharRE.test(p)) {
|
6864 | inRegex = true;
|
6865 | }
|
6866 | }
|
6867 | }
|
6868 | }
|
6869 |
|
6870 | if (expression === undefined) {
|
6871 | expression = exp.slice(0, i).trim();
|
6872 | } else if (lastFilterIndex !== 0) {
|
6873 | pushFilter();
|
6874 | }
|
6875 |
|
6876 | function pushFilter () {
|
6877 | (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
6878 | lastFilterIndex = i + 1;
|
6879 | }
|
6880 |
|
6881 | if (filters) {
|
6882 | for (i = 0; i < filters.length; i++) {
|
6883 | expression = wrapFilter(expression, filters[i]);
|
6884 | }
|
6885 | }
|
6886 |
|
6887 | return expression
|
6888 | }
|
6889 |
|
6890 | function wrapFilter (exp, filter) {
|
6891 | var i = filter.indexOf('(');
|
6892 | if (i < 0) {
|
6893 |
|
6894 | return ("_f(\"" + filter + "\")(" + exp + ")")
|
6895 | } else {
|
6896 | var name = filter.slice(0, i);
|
6897 | var args = filter.slice(i + 1);
|
6898 | return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
|
6899 | }
|
6900 | }
|
6901 |
|
6902 |
|
6903 |
|
6904 |
|
6905 |
|
6906 |
|
6907 | function baseWarn (msg, range) {
|
6908 | console.error(("[Vue compiler]: " + msg));
|
6909 | }
|
6910 |
|
6911 |
|
6912 | function pluckModuleFunction (
|
6913 | modules,
|
6914 | key
|
6915 | ) {
|
6916 | return modules
|
6917 | ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
|
6918 | : []
|
6919 | }
|
6920 |
|
6921 | function addProp (el, name, value, range, dynamic) {
|
6922 | (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6923 | el.plain = false;
|
6924 | }
|
6925 |
|
6926 | function addAttr (el, name, value, range, dynamic) {
|
6927 | var attrs = dynamic
|
6928 | ? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
6929 | : (el.attrs || (el.attrs = []));
|
6930 | attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6931 | el.plain = false;
|
6932 | }
|
6933 |
|
6934 |
|
6935 | function addRawAttr (el, name, value, range) {
|
6936 | el.attrsMap[name] = value;
|
6937 | el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
|
6938 | }
|
6939 |
|
6940 | function addDirective (
|
6941 | el,
|
6942 | name,
|
6943 | rawName,
|
6944 | value,
|
6945 | arg,
|
6946 | isDynamicArg,
|
6947 | modifiers,
|
6948 | range
|
6949 | ) {
|
6950 | (el.directives || (el.directives = [])).push(rangeSetItem({
|
6951 | name: name,
|
6952 | rawName: rawName,
|
6953 | value: value,
|
6954 | arg: arg,
|
6955 | isDynamicArg: isDynamicArg,
|
6956 | modifiers: modifiers
|
6957 | }, range));
|
6958 | el.plain = false;
|
6959 | }
|
6960 |
|
6961 | function prependModifierMarker (symbol, name, dynamic) {
|
6962 | return dynamic
|
6963 | ? ("_p(" + name + ",\"" + symbol + "\")")
|
6964 | : symbol + name
|
6965 | }
|
6966 |
|
6967 | function addHandler (
|
6968 | el,
|
6969 | name,
|
6970 | value,
|
6971 | modifiers,
|
6972 | important,
|
6973 | warn,
|
6974 | range,
|
6975 | dynamic
|
6976 | ) {
|
6977 | modifiers = modifiers || emptyObject;
|
6978 |
|
6979 |
|
6980 | if (
|
6981 | process.env.NODE_ENV !== 'production' && warn &&
|
6982 | modifiers.prevent && modifiers.passive
|
6983 | ) {
|
6984 | warn(
|
6985 | 'passive and prevent can\'t be used together. ' +
|
6986 | 'Passive handler can\'t prevent default event.',
|
6987 | range
|
6988 | );
|
6989 | }
|
6990 |
|
6991 |
|
6992 |
|
6993 |
|
6994 | if (modifiers.right) {
|
6995 | if (dynamic) {
|
6996 | name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
6997 | } else if (name === 'click') {
|
6998 | name = 'contextmenu';
|
6999 | delete modifiers.right;
|
7000 | }
|
7001 | } else if (modifiers.middle) {
|
7002 | if (dynamic) {
|
7003 | name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
7004 | } else if (name === 'click') {
|
7005 | name = 'mouseup';
|
7006 | }
|
7007 | }
|
7008 |
|
7009 |
|
7010 | if (modifiers.capture) {
|
7011 | delete modifiers.capture;
|
7012 | name = prependModifierMarker('!', name, dynamic);
|
7013 | }
|
7014 | if (modifiers.once) {
|
7015 | delete modifiers.once;
|
7016 | name = prependModifierMarker('~', name, dynamic);
|
7017 | }
|
7018 |
|
7019 | if (modifiers.passive) {
|
7020 | delete modifiers.passive;
|
7021 | name = prependModifierMarker('&', name, dynamic);
|
7022 | }
|
7023 |
|
7024 | var events;
|
7025 | if (modifiers.native) {
|
7026 | delete modifiers.native;
|
7027 | events = el.nativeEvents || (el.nativeEvents = {});
|
7028 | } else {
|
7029 | events = el.events || (el.events = {});
|
7030 | }
|
7031 |
|
7032 | var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
7033 | if (modifiers !== emptyObject) {
|
7034 | newHandler.modifiers = modifiers;
|
7035 | }
|
7036 |
|
7037 | var handlers = events[name];
|
7038 |
|
7039 | if (Array.isArray(handlers)) {
|
7040 | important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
7041 | } else if (handlers) {
|
7042 | events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
7043 | } else {
|
7044 | events[name] = newHandler;
|
7045 | }
|
7046 |
|
7047 | el.plain = false;
|
7048 | }
|
7049 |
|
7050 | function getRawBindingAttr (
|
7051 | el,
|
7052 | name
|
7053 | ) {
|
7054 | return el.rawAttrsMap[':' + name] ||
|
7055 | el.rawAttrsMap['v-bind:' + name] ||
|
7056 | el.rawAttrsMap[name]
|
7057 | }
|
7058 |
|
7059 | function getBindingAttr (
|
7060 | el,
|
7061 | name,
|
7062 | getStatic
|
7063 | ) {
|
7064 | var dynamicValue =
|
7065 | getAndRemoveAttr(el, ':' + name) ||
|
7066 | getAndRemoveAttr(el, 'v-bind:' + name);
|
7067 | if (dynamicValue != null) {
|
7068 | return parseFilters(dynamicValue)
|
7069 | } else if (getStatic !== false) {
|
7070 | var staticValue = getAndRemoveAttr(el, name);
|
7071 | if (staticValue != null) {
|
7072 | return JSON.stringify(staticValue)
|
7073 | }
|
7074 | }
|
7075 | }
|
7076 |
|
7077 |
|
7078 |
|
7079 |
|
7080 |
|
7081 | function getAndRemoveAttr (
|
7082 | el,
|
7083 | name,
|
7084 | removeFromMap
|
7085 | ) {
|
7086 | var val;
|
7087 | if ((val = el.attrsMap[name]) != null) {
|
7088 | var list = el.attrsList;
|
7089 | for (var i = 0, l = list.length; i < l; i++) {
|
7090 | if (list[i].name === name) {
|
7091 | list.splice(i, 1);
|
7092 | break
|
7093 | }
|
7094 | }
|
7095 | }
|
7096 | if (removeFromMap) {
|
7097 | delete el.attrsMap[name];
|
7098 | }
|
7099 | return val
|
7100 | }
|
7101 |
|
7102 | function getAndRemoveAttrByRegex (
|
7103 | el,
|
7104 | name
|
7105 | ) {
|
7106 | var list = el.attrsList;
|
7107 | for (var i = 0, l = list.length; i < l; i++) {
|
7108 | var attr = list[i];
|
7109 | if (name.test(attr.name)) {
|
7110 | list.splice(i, 1);
|
7111 | return attr
|
7112 | }
|
7113 | }
|
7114 | }
|
7115 |
|
7116 | function rangeSetItem (
|
7117 | item,
|
7118 | range
|
7119 | ) {
|
7120 | if (range) {
|
7121 | if (range.start != null) {
|
7122 | item.start = range.start;
|
7123 | }
|
7124 | if (range.end != null) {
|
7125 | item.end = range.end;
|
7126 | }
|
7127 | }
|
7128 | return item
|
7129 | }
|
7130 |
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 | function genComponentModel (
|
7137 | el,
|
7138 | value,
|
7139 | modifiers
|
7140 | ) {
|
7141 | var ref = modifiers || {};
|
7142 | var number = ref.number;
|
7143 | var trim = ref.trim;
|
7144 |
|
7145 | var baseValueExpression = '$$v';
|
7146 | var valueExpression = baseValueExpression;
|
7147 | if (trim) {
|
7148 | valueExpression =
|
7149 | "(typeof " + baseValueExpression + " === 'string'" +
|
7150 | "? " + baseValueExpression + ".trim()" +
|
7151 | ": " + baseValueExpression + ")";
|
7152 | }
|
7153 | if (number) {
|
7154 | valueExpression = "_n(" + valueExpression + ")";
|
7155 | }
|
7156 | var assignment = genAssignmentCode(value, valueExpression);
|
7157 |
|
7158 | el.model = {
|
7159 | value: ("(" + value + ")"),
|
7160 | expression: JSON.stringify(value),
|
7161 | callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
7162 | };
|
7163 | }
|
7164 |
|
7165 |
|
7166 |
|
7167 |
|
7168 | function genAssignmentCode (
|
7169 | value,
|
7170 | assignment
|
7171 | ) {
|
7172 | var res = parseModel(value);
|
7173 | if (res.key === null) {
|
7174 | return (value + "=" + assignment)
|
7175 | } else {
|
7176 | return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
|
7177 | }
|
7178 | }
|
7179 |
|
7180 |
|
7181 |
|
7182 |
|
7183 |
|
7184 |
|
7185 |
|
7186 |
|
7187 |
|
7188 |
|
7189 |
|
7190 |
|
7191 |
|
7192 |
|
7193 |
|
7194 |
|
7195 | var len, str, chr, index$1, expressionPos, expressionEndPos;
|
7196 |
|
7197 |
|
7198 |
|
7199 | function parseModel (val) {
|
7200 |
|
7201 |
|
7202 | val = val.trim();
|
7203 | len = val.length;
|
7204 |
|
7205 | if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
7206 | index$1 = val.lastIndexOf('.');
|
7207 | if (index$1 > -1) {
|
7208 | return {
|
7209 | exp: val.slice(0, index$1),
|
7210 | key: '"' + val.slice(index$1 + 1) + '"'
|
7211 | }
|
7212 | } else {
|
7213 | return {
|
7214 | exp: val,
|
7215 | key: null
|
7216 | }
|
7217 | }
|
7218 | }
|
7219 |
|
7220 | str = val;
|
7221 | index$1 = expressionPos = expressionEndPos = 0;
|
7222 |
|
7223 | while (!eof()) {
|
7224 | chr = next();
|
7225 |
|
7226 | if (isStringStart(chr)) {
|
7227 | parseString(chr);
|
7228 | } else if (chr === 0x5B) {
|
7229 | parseBracket(chr);
|
7230 | }
|
7231 | }
|
7232 |
|
7233 | return {
|
7234 | exp: val.slice(0, expressionPos),
|
7235 | key: val.slice(expressionPos + 1, expressionEndPos)
|
7236 | }
|
7237 | }
|
7238 |
|
7239 | function next () {
|
7240 | return str.charCodeAt(++index$1)
|
7241 | }
|
7242 |
|
7243 | function eof () {
|
7244 | return index$1 >= len
|
7245 | }
|
7246 |
|
7247 | function isStringStart (chr) {
|
7248 | return chr === 0x22 || chr === 0x27
|
7249 | }
|
7250 |
|
7251 | function parseBracket (chr) {
|
7252 | var inBracket = 1;
|
7253 | expressionPos = index$1;
|
7254 | while (!eof()) {
|
7255 | chr = next();
|
7256 | if (isStringStart(chr)) {
|
7257 | parseString(chr);
|
7258 | continue
|
7259 | }
|
7260 | if (chr === 0x5B) { inBracket++; }
|
7261 | if (chr === 0x5D) { inBracket--; }
|
7262 | if (inBracket === 0) {
|
7263 | expressionEndPos = index$1;
|
7264 | break
|
7265 | }
|
7266 | }
|
7267 | }
|
7268 |
|
7269 | function parseString (chr) {
|
7270 | var stringQuote = chr;
|
7271 | while (!eof()) {
|
7272 | chr = next();
|
7273 | if (chr === stringQuote) {
|
7274 | break
|
7275 | }
|
7276 | }
|
7277 | }
|
7278 |
|
7279 |
|
7280 |
|
7281 | var warn$1;
|
7282 |
|
7283 |
|
7284 |
|
7285 | var RANGE_TOKEN = '__r';
|
7286 | var CHECKBOX_RADIO_TOKEN = '__c';
|
7287 |
|
7288 | function model (
|
7289 | el,
|
7290 | dir,
|
7291 | _warn
|
7292 | ) {
|
7293 | warn$1 = _warn;
|
7294 | var value = dir.value;
|
7295 | var modifiers = dir.modifiers;
|
7296 | var tag = el.tag;
|
7297 | var type = el.attrsMap.type;
|
7298 |
|
7299 | if (process.env.NODE_ENV !== 'production') {
|
7300 |
|
7301 |
|
7302 | if (tag === 'input' && type === 'file') {
|
7303 | warn$1(
|
7304 | "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
|
7305 | "File inputs are read only. Use a v-on:change listener instead.",
|
7306 | el.rawAttrsMap['v-model']
|
7307 | );
|
7308 | }
|
7309 | }
|
7310 |
|
7311 | if (el.component) {
|
7312 | genComponentModel(el, value, modifiers);
|
7313 |
|
7314 | return false
|
7315 | } else if (tag === 'select') {
|
7316 | genSelect(el, value, modifiers);
|
7317 | } else if (tag === 'input' && type === 'checkbox') {
|
7318 | genCheckboxModel(el, value, modifiers);
|
7319 | } else if (tag === 'input' && type === 'radio') {
|
7320 | genRadioModel(el, value, modifiers);
|
7321 | } else if (tag === 'input' || tag === 'textarea') {
|
7322 | genDefaultModel(el, value, modifiers);
|
7323 | } else if (!config.isReservedTag(tag)) {
|
7324 | genComponentModel(el, value, modifiers);
|
7325 |
|
7326 | return false
|
7327 | } else if (process.env.NODE_ENV !== 'production') {
|
7328 | warn$1(
|
7329 | "<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
7330 | "v-model is not supported on this element type. " +
|
7331 | 'If you are working with contenteditable, it\'s recommended to ' +
|
7332 | 'wrap a library dedicated for that purpose inside a custom component.',
|
7333 | el.rawAttrsMap['v-model']
|
7334 | );
|
7335 | }
|
7336 |
|
7337 |
|
7338 | return true
|
7339 | }
|
7340 |
|
7341 | function genCheckboxModel (
|
7342 | el,
|
7343 | value,
|
7344 | modifiers
|
7345 | ) {
|
7346 | var number = modifiers && modifiers.number;
|
7347 | var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7348 | var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
7349 | var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
7350 | addProp(el, 'checked',
|
7351 | "Array.isArray(" + value + ")" +
|
7352 | "?_i(" + value + "," + valueBinding + ")>-1" + (
|
7353 | trueValueBinding === 'true'
|
7354 | ? (":(" + value + ")")
|
7355 | : (":_q(" + value + "," + trueValueBinding + ")")
|
7356 | )
|
7357 | );
|
7358 | addHandler(el, 'change',
|
7359 | "var $$a=" + value + "," +
|
7360 | '$$el=$event.target,' +
|
7361 | "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
|
7362 | 'if(Array.isArray($$a)){' +
|
7363 | "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
|
7364 | '$$i=_i($$a,$$v);' +
|
7365 | "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
|
7366 | "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
|
7367 | "}else{" + (genAssignmentCode(value, '$$c')) + "}",
|
7368 | null, true
|
7369 | );
|
7370 | }
|
7371 |
|
7372 | function genRadioModel (
|
7373 | el,
|
7374 | value,
|
7375 | modifiers
|
7376 | ) {
|
7377 | var number = modifiers && modifiers.number;
|
7378 | var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7379 | valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
7380 | addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
|
7381 | addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
|
7382 | }
|
7383 |
|
7384 | function genSelect (
|
7385 | el,
|
7386 | value,
|
7387 | modifiers
|
7388 | ) {
|
7389 | var number = modifiers && modifiers.number;
|
7390 | var selectedVal = "Array.prototype.filter" +
|
7391 | ".call($event.target.options,function(o){return o.selected})" +
|
7392 | ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
|
7393 | "return " + (number ? '_n(val)' : 'val') + "})";
|
7394 |
|
7395 | var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
|
7396 | var code = "var $$selectedVal = " + selectedVal + ";";
|
7397 | code = code + " " + (genAssignmentCode(value, assignment));
|
7398 | addHandler(el, 'change', code, null, true);
|
7399 | }
|
7400 |
|
7401 | function genDefaultModel (
|
7402 | el,
|
7403 | value,
|
7404 | modifiers
|
7405 | ) {
|
7406 | var type = el.attrsMap.type;
|
7407 |
|
7408 |
|
7409 |
|
7410 | if (process.env.NODE_ENV !== 'production') {
|
7411 | var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
7412 | var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
7413 | if (value$1 && !typeBinding) {
|
7414 | var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
7415 | warn$1(
|
7416 | binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
|
7417 | 'because the latter already expands to a value binding internally',
|
7418 | el.rawAttrsMap[binding]
|
7419 | );
|
7420 | }
|
7421 | }
|
7422 |
|
7423 | var ref = modifiers || {};
|
7424 | var lazy = ref.lazy;
|
7425 | var number = ref.number;
|
7426 | var trim = ref.trim;
|
7427 | var needCompositionGuard = !lazy && type !== 'range';
|
7428 | var event = lazy
|
7429 | ? 'change'
|
7430 | : type === 'range'
|
7431 | ? RANGE_TOKEN
|
7432 | : 'input';
|
7433 |
|
7434 | var valueExpression = '$event.target.value';
|
7435 | if (trim) {
|
7436 | valueExpression = "$event.target.value.trim()";
|
7437 | }
|
7438 | if (number) {
|
7439 | valueExpression = "_n(" + valueExpression + ")";
|
7440 | }
|
7441 |
|
7442 | var code = genAssignmentCode(value, valueExpression);
|
7443 | if (needCompositionGuard) {
|
7444 | code = "if($event.target.composing)return;" + code;
|
7445 | }
|
7446 |
|
7447 | addProp(el, 'value', ("(" + value + ")"));
|
7448 | addHandler(el, event, code, null, true);
|
7449 | if (trim || number) {
|
7450 | addHandler(el, 'blur', '$forceUpdate()');
|
7451 | }
|
7452 | }
|
7453 |
|
7454 |
|
7455 |
|
7456 |
|
7457 |
|
7458 |
|
7459 |
|
7460 | function normalizeEvents (on) {
|
7461 |
|
7462 | if (isDef(on[RANGE_TOKEN])) {
|
7463 |
|
7464 | var event = isIE ? 'change' : 'input';
|
7465 | on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
7466 | delete on[RANGE_TOKEN];
|
7467 | }
|
7468 |
|
7469 |
|
7470 |
|
7471 | if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
7472 | on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
7473 | delete on[CHECKBOX_RADIO_TOKEN];
|
7474 | }
|
7475 | }
|
7476 |
|
7477 | var target$1;
|
7478 |
|
7479 | function createOnceHandler$1 (event, handler, capture) {
|
7480 | var _target = target$1;
|
7481 | return function onceHandler () {
|
7482 | var res = handler.apply(null, arguments);
|
7483 | if (res !== null) {
|
7484 | remove$2(event, onceHandler, capture, _target);
|
7485 | }
|
7486 | }
|
7487 | }
|
7488 |
|
7489 |
|
7490 |
|
7491 |
|
7492 | var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
7493 |
|
7494 | function add$1 (
|
7495 | name,
|
7496 | handler,
|
7497 | capture,
|
7498 | passive
|
7499 | ) {
|
7500 |
|
7501 |
|
7502 |
|
7503 |
|
7504 |
|
7505 |
|
7506 | if (useMicrotaskFix) {
|
7507 | var attachedTimestamp = currentFlushTimestamp;
|
7508 | var original = handler;
|
7509 | handler = original._wrapper = function (e) {
|
7510 | if (
|
7511 |
|
7512 |
|
7513 |
|
7514 | e.target === e.currentTarget ||
|
7515 |
|
7516 | e.timeStamp >= attachedTimestamp ||
|
7517 |
|
7518 | e.timeStamp === 0 ||
|
7519 |
|
7520 |
|
7521 |
|
7522 | e.target.ownerDocument !== document
|
7523 | ) {
|
7524 | return original.apply(this, arguments)
|
7525 | }
|
7526 | };
|
7527 | }
|
7528 | target$1.addEventListener(
|
7529 | name,
|
7530 | handler,
|
7531 | supportsPassive
|
7532 | ? { capture: capture, passive: passive }
|
7533 | : capture
|
7534 | );
|
7535 | }
|
7536 |
|
7537 | function remove$2 (
|
7538 | name,
|
7539 | handler,
|
7540 | capture,
|
7541 | _target
|
7542 | ) {
|
7543 | (_target || target$1).removeEventListener(
|
7544 | name,
|
7545 | handler._wrapper || handler,
|
7546 | capture
|
7547 | );
|
7548 | }
|
7549 |
|
7550 | function updateDOMListeners (oldVnode, vnode) {
|
7551 | if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
7552 | return
|
7553 | }
|
7554 | var on = vnode.data.on || {};
|
7555 | var oldOn = oldVnode.data.on || {};
|
7556 | target$1 = vnode.elm;
|
7557 | normalizeEvents(on);
|
7558 | updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
7559 | target$1 = undefined;
|
7560 | }
|
7561 |
|
7562 | var events = {
|
7563 | create: updateDOMListeners,
|
7564 | update: updateDOMListeners
|
7565 | };
|
7566 |
|
7567 |
|
7568 |
|
7569 | var svgContainer;
|
7570 |
|
7571 | function updateDOMProps (oldVnode, vnode) {
|
7572 | if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
7573 | return
|
7574 | }
|
7575 | var key, cur;
|
7576 | var elm = vnode.elm;
|
7577 | var oldProps = oldVnode.data.domProps || {};
|
7578 | var props = vnode.data.domProps || {};
|
7579 |
|
7580 | if (isDef(props.__ob__)) {
|
7581 | props = vnode.data.domProps = extend({}, props);
|
7582 | }
|
7583 |
|
7584 | for (key in oldProps) {
|
7585 | if (isUndef(props[key])) {
|
7586 | elm[key] = '';
|
7587 | }
|
7588 | }
|
7589 | for (key in props) {
|
7590 | cur = props[key];
|
7591 |
|
7592 |
|
7593 |
|
7594 | if (key === 'textContent' || key === 'innerHTML') {
|
7595 | if (vnode.children) { vnode.children.length = 0; }
|
7596 | if (cur === oldProps[key]) { continue }
|
7597 |
|
7598 |
|
7599 | if (elm.childNodes.length === 1) {
|
7600 | elm.removeChild(elm.childNodes[0]);
|
7601 | }
|
7602 | }
|
7603 |
|
7604 | if (key === 'value' && elm.tagName !== 'PROGRESS') {
|
7605 |
|
7606 |
|
7607 | elm._value = cur;
|
7608 |
|
7609 | var strCur = isUndef(cur) ? '' : String(cur);
|
7610 | if (shouldUpdateValue(elm, strCur)) {
|
7611 | elm.value = strCur;
|
7612 | }
|
7613 | } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
7614 |
|
7615 | svgContainer = svgContainer || document.createElement('div');
|
7616 | svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
7617 | var svg = svgContainer.firstChild;
|
7618 | while (elm.firstChild) {
|
7619 | elm.removeChild(elm.firstChild);
|
7620 | }
|
7621 | while (svg.firstChild) {
|
7622 | elm.appendChild(svg.firstChild);
|
7623 | }
|
7624 | } else if (
|
7625 |
|
7626 |
|
7627 |
|
7628 |
|
7629 | cur !== oldProps[key]
|
7630 | ) {
|
7631 |
|
7632 |
|
7633 | try {
|
7634 | elm[key] = cur;
|
7635 | } catch (e) {}
|
7636 | }
|
7637 | }
|
7638 | }
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 | function shouldUpdateValue (elm, checkVal) {
|
7644 | return (!elm.composing && (
|
7645 | elm.tagName === 'OPTION' ||
|
7646 | isNotInFocusAndDirty(elm, checkVal) ||
|
7647 | isDirtyWithModifiers(elm, checkVal)
|
7648 | ))
|
7649 | }
|
7650 |
|
7651 | function isNotInFocusAndDirty (elm, checkVal) {
|
7652 |
|
7653 |
|
7654 | var notInFocus = true;
|
7655 |
|
7656 |
|
7657 | try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
7658 | return notInFocus && elm.value !== checkVal
|
7659 | }
|
7660 |
|
7661 | function isDirtyWithModifiers (elm, newVal) {
|
7662 | var value = elm.value;
|
7663 | var modifiers = elm._vModifiers;
|
7664 | if (isDef(modifiers)) {
|
7665 | if (modifiers.number) {
|
7666 | return toNumber(value) !== toNumber(newVal)
|
7667 | }
|
7668 | if (modifiers.trim) {
|
7669 | return value.trim() !== newVal.trim()
|
7670 | }
|
7671 | }
|
7672 | return value !== newVal
|
7673 | }
|
7674 |
|
7675 | var domProps = {
|
7676 | create: updateDOMProps,
|
7677 | update: updateDOMProps
|
7678 | };
|
7679 |
|
7680 |
|
7681 |
|
7682 | var parseStyleText = cached(function (cssText) {
|
7683 | var res = {};
|
7684 | var listDelimiter = /;(?![^(]*\))/g;
|
7685 | var propertyDelimiter = /:(.+)/;
|
7686 | cssText.split(listDelimiter).forEach(function (item) {
|
7687 | if (item) {
|
7688 | var tmp = item.split(propertyDelimiter);
|
7689 | tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
7690 | }
|
7691 | });
|
7692 | return res
|
7693 | });
|
7694 |
|
7695 |
|
7696 | function normalizeStyleData (data) {
|
7697 | var style = normalizeStyleBinding(data.style);
|
7698 |
|
7699 |
|
7700 | return data.staticStyle
|
7701 | ? extend(data.staticStyle, style)
|
7702 | : style
|
7703 | }
|
7704 |
|
7705 |
|
7706 | function normalizeStyleBinding (bindingStyle) {
|
7707 | if (Array.isArray(bindingStyle)) {
|
7708 | return toObject(bindingStyle)
|
7709 | }
|
7710 | if (typeof bindingStyle === 'string') {
|
7711 | return parseStyleText(bindingStyle)
|
7712 | }
|
7713 | return bindingStyle
|
7714 | }
|
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 |
|
7720 | function getStyle (vnode, checkChild) {
|
7721 | var res = {};
|
7722 | var styleData;
|
7723 |
|
7724 | if (checkChild) {
|
7725 | var childNode = vnode;
|
7726 | while (childNode.componentInstance) {
|
7727 | childNode = childNode.componentInstance._vnode;
|
7728 | if (
|
7729 | childNode && childNode.data &&
|
7730 | (styleData = normalizeStyleData(childNode.data))
|
7731 | ) {
|
7732 | extend(res, styleData);
|
7733 | }
|
7734 | }
|
7735 | }
|
7736 |
|
7737 | if ((styleData = normalizeStyleData(vnode.data))) {
|
7738 | extend(res, styleData);
|
7739 | }
|
7740 |
|
7741 | var parentNode = vnode;
|
7742 | while ((parentNode = parentNode.parent)) {
|
7743 | if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
7744 | extend(res, styleData);
|
7745 | }
|
7746 | }
|
7747 | return res
|
7748 | }
|
7749 |
|
7750 |
|
7751 |
|
7752 | var cssVarRE = /^--/;
|
7753 | var importantRE = /\s*!important$/;
|
7754 | var setProp = function (el, name, val) {
|
7755 |
|
7756 | if (cssVarRE.test(name)) {
|
7757 | el.style.setProperty(name, val);
|
7758 | } else if (importantRE.test(val)) {
|
7759 | el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
7760 | } else {
|
7761 | var normalizedName = normalize(name);
|
7762 | if (Array.isArray(val)) {
|
7763 |
|
7764 |
|
7765 |
|
7766 | for (var i = 0, len = val.length; i < len; i++) {
|
7767 | el.style[normalizedName] = val[i];
|
7768 | }
|
7769 | } else {
|
7770 | el.style[normalizedName] = val;
|
7771 | }
|
7772 | }
|
7773 | };
|
7774 |
|
7775 | var vendorNames = ['Webkit', 'Moz', 'ms'];
|
7776 |
|
7777 | var emptyStyle;
|
7778 | var normalize = cached(function (prop) {
|
7779 | emptyStyle = emptyStyle || document.createElement('div').style;
|
7780 | prop = camelize(prop);
|
7781 | if (prop !== 'filter' && (prop in emptyStyle)) {
|
7782 | return prop
|
7783 | }
|
7784 | var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
7785 | for (var i = 0; i < vendorNames.length; i++) {
|
7786 | var name = vendorNames[i] + capName;
|
7787 | if (name in emptyStyle) {
|
7788 | return name
|
7789 | }
|
7790 | }
|
7791 | });
|
7792 |
|
7793 | function updateStyle (oldVnode, vnode) {
|
7794 | var data = vnode.data;
|
7795 | var oldData = oldVnode.data;
|
7796 |
|
7797 | if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
7798 | isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
7799 | ) {
|
7800 | return
|
7801 | }
|
7802 |
|
7803 | var cur, name;
|
7804 | var el = vnode.elm;
|
7805 | var oldStaticStyle = oldData.staticStyle;
|
7806 | var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
7807 |
|
7808 |
|
7809 | var oldStyle = oldStaticStyle || oldStyleBinding;
|
7810 |
|
7811 | var style = normalizeStyleBinding(vnode.data.style) || {};
|
7812 |
|
7813 |
|
7814 |
|
7815 |
|
7816 | vnode.data.normalizedStyle = isDef(style.__ob__)
|
7817 | ? extend({}, style)
|
7818 | : style;
|
7819 |
|
7820 | var newStyle = getStyle(vnode, true);
|
7821 |
|
7822 | for (name in oldStyle) {
|
7823 | if (isUndef(newStyle[name])) {
|
7824 | setProp(el, name, '');
|
7825 | }
|
7826 | }
|
7827 | for (name in newStyle) {
|
7828 | cur = newStyle[name];
|
7829 | if (cur !== oldStyle[name]) {
|
7830 |
|
7831 | setProp(el, name, cur == null ? '' : cur);
|
7832 | }
|
7833 | }
|
7834 | }
|
7835 |
|
7836 | var style = {
|
7837 | create: updateStyle,
|
7838 | update: updateStyle
|
7839 | };
|
7840 |
|
7841 |
|
7842 |
|
7843 | var whitespaceRE = /\s+/;
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 | function addClass (el, cls) {
|
7850 |
|
7851 | if (!cls || !(cls = cls.trim())) {
|
7852 | return
|
7853 | }
|
7854 |
|
7855 |
|
7856 | if (el.classList) {
|
7857 | if (cls.indexOf(' ') > -1) {
|
7858 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
7859 | } else {
|
7860 | el.classList.add(cls);
|
7861 | }
|
7862 | } else {
|
7863 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7864 | if (cur.indexOf(' ' + cls + ' ') < 0) {
|
7865 | el.setAttribute('class', (cur + cls).trim());
|
7866 | }
|
7867 | }
|
7868 | }
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 | function removeClass (el, cls) {
|
7875 |
|
7876 | if (!cls || !(cls = cls.trim())) {
|
7877 | return
|
7878 | }
|
7879 |
|
7880 |
|
7881 | if (el.classList) {
|
7882 | if (cls.indexOf(' ') > -1) {
|
7883 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
7884 | } else {
|
7885 | el.classList.remove(cls);
|
7886 | }
|
7887 | if (!el.classList.length) {
|
7888 | el.removeAttribute('class');
|
7889 | }
|
7890 | } else {
|
7891 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7892 | var tar = ' ' + cls + ' ';
|
7893 | while (cur.indexOf(tar) >= 0) {
|
7894 | cur = cur.replace(tar, ' ');
|
7895 | }
|
7896 | cur = cur.trim();
|
7897 | if (cur) {
|
7898 | el.setAttribute('class', cur);
|
7899 | } else {
|
7900 | el.removeAttribute('class');
|
7901 | }
|
7902 | }
|
7903 | }
|
7904 |
|
7905 |
|
7906 |
|
7907 | function resolveTransition (def$$1) {
|
7908 | if (!def$$1) {
|
7909 | return
|
7910 | }
|
7911 |
|
7912 | if (typeof def$$1 === 'object') {
|
7913 | var res = {};
|
7914 | if (def$$1.css !== false) {
|
7915 | extend(res, autoCssTransition(def$$1.name || 'v'));
|
7916 | }
|
7917 | extend(res, def$$1);
|
7918 | return res
|
7919 | } else if (typeof def$$1 === 'string') {
|
7920 | return autoCssTransition(def$$1)
|
7921 | }
|
7922 | }
|
7923 |
|
7924 | var autoCssTransition = cached(function (name) {
|
7925 | return {
|
7926 | enterClass: (name + "-enter"),
|
7927 | enterToClass: (name + "-enter-to"),
|
7928 | enterActiveClass: (name + "-enter-active"),
|
7929 | leaveClass: (name + "-leave"),
|
7930 | leaveToClass: (name + "-leave-to"),
|
7931 | leaveActiveClass: (name + "-leave-active")
|
7932 | }
|
7933 | });
|
7934 |
|
7935 | var hasTransition = inBrowser && !isIE9;
|
7936 | var TRANSITION = 'transition';
|
7937 | var ANIMATION = 'animation';
|
7938 |
|
7939 |
|
7940 | var transitionProp = 'transition';
|
7941 | var transitionEndEvent = 'transitionend';
|
7942 | var animationProp = 'animation';
|
7943 | var animationEndEvent = 'animationend';
|
7944 | if (hasTransition) {
|
7945 |
|
7946 | if (window.ontransitionend === undefined &&
|
7947 | window.onwebkittransitionend !== undefined
|
7948 | ) {
|
7949 | transitionProp = 'WebkitTransition';
|
7950 | transitionEndEvent = 'webkitTransitionEnd';
|
7951 | }
|
7952 | if (window.onanimationend === undefined &&
|
7953 | window.onwebkitanimationend !== undefined
|
7954 | ) {
|
7955 | animationProp = 'WebkitAnimation';
|
7956 | animationEndEvent = 'webkitAnimationEnd';
|
7957 | }
|
7958 | }
|
7959 |
|
7960 |
|
7961 | var raf = inBrowser
|
7962 | ? window.requestAnimationFrame
|
7963 | ? window.requestAnimationFrame.bind(window)
|
7964 | : setTimeout
|
7965 | : function (fn) { return fn(); };
|
7966 |
|
7967 | function nextFrame (fn) {
|
7968 | raf(function () {
|
7969 | raf(fn);
|
7970 | });
|
7971 | }
|
7972 |
|
7973 | function addTransitionClass (el, cls) {
|
7974 | var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
7975 | if (transitionClasses.indexOf(cls) < 0) {
|
7976 | transitionClasses.push(cls);
|
7977 | addClass(el, cls);
|
7978 | }
|
7979 | }
|
7980 |
|
7981 | function removeTransitionClass (el, cls) {
|
7982 | if (el._transitionClasses) {
|
7983 | remove(el._transitionClasses, cls);
|
7984 | }
|
7985 | removeClass(el, cls);
|
7986 | }
|
7987 |
|
7988 | function whenTransitionEnds (
|
7989 | el,
|
7990 | expectedType,
|
7991 | cb
|
7992 | ) {
|
7993 | var ref = getTransitionInfo(el, expectedType);
|
7994 | var type = ref.type;
|
7995 | var timeout = ref.timeout;
|
7996 | var propCount = ref.propCount;
|
7997 | if (!type) { return cb() }
|
7998 | var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
7999 | var ended = 0;
|
8000 | var end = function () {
|
8001 | el.removeEventListener(event, onEnd);
|
8002 | cb();
|
8003 | };
|
8004 | var onEnd = function (e) {
|
8005 | if (e.target === el) {
|
8006 | if (++ended >= propCount) {
|
8007 | end();
|
8008 | }
|
8009 | }
|
8010 | };
|
8011 | setTimeout(function () {
|
8012 | if (ended < propCount) {
|
8013 | end();
|
8014 | }
|
8015 | }, timeout + 1);
|
8016 | el.addEventListener(event, onEnd);
|
8017 | }
|
8018 |
|
8019 | var transformRE = /\b(transform|all)(,|$)/;
|
8020 |
|
8021 | function getTransitionInfo (el, expectedType) {
|
8022 | var styles = window.getComputedStyle(el);
|
8023 |
|
8024 | var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
8025 | var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
8026 | var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
8027 | var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
8028 | var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
8029 | var animationTimeout = getTimeout(animationDelays, animationDurations);
|
8030 |
|
8031 | var type;
|
8032 | var timeout = 0;
|
8033 | var propCount = 0;
|
8034 |
|
8035 | if (expectedType === TRANSITION) {
|
8036 | if (transitionTimeout > 0) {
|
8037 | type = TRANSITION;
|
8038 | timeout = transitionTimeout;
|
8039 | propCount = transitionDurations.length;
|
8040 | }
|
8041 | } else if (expectedType === ANIMATION) {
|
8042 | if (animationTimeout > 0) {
|
8043 | type = ANIMATION;
|
8044 | timeout = animationTimeout;
|
8045 | propCount = animationDurations.length;
|
8046 | }
|
8047 | } else {
|
8048 | timeout = Math.max(transitionTimeout, animationTimeout);
|
8049 | type = timeout > 0
|
8050 | ? transitionTimeout > animationTimeout
|
8051 | ? TRANSITION
|
8052 | : ANIMATION
|
8053 | : null;
|
8054 | propCount = type
|
8055 | ? type === TRANSITION
|
8056 | ? transitionDurations.length
|
8057 | : animationDurations.length
|
8058 | : 0;
|
8059 | }
|
8060 | var hasTransform =
|
8061 | type === TRANSITION &&
|
8062 | transformRE.test(styles[transitionProp + 'Property']);
|
8063 | return {
|
8064 | type: type,
|
8065 | timeout: timeout,
|
8066 | propCount: propCount,
|
8067 | hasTransform: hasTransform
|
8068 | }
|
8069 | }
|
8070 |
|
8071 | function getTimeout (delays, durations) {
|
8072 |
|
8073 | while (delays.length < durations.length) {
|
8074 | delays = delays.concat(delays);
|
8075 | }
|
8076 |
|
8077 | return Math.max.apply(null, durations.map(function (d, i) {
|
8078 | return toMs(d) + toMs(delays[i])
|
8079 | }))
|
8080 | }
|
8081 |
|
8082 |
|
8083 |
|
8084 |
|
8085 |
|
8086 | function toMs (s) {
|
8087 | return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
8088 | }
|
8089 |
|
8090 |
|
8091 |
|
8092 | function enter (vnode, toggleDisplay) {
|
8093 | var el = vnode.elm;
|
8094 |
|
8095 |
|
8096 | if (isDef(el._leaveCb)) {
|
8097 | el._leaveCb.cancelled = true;
|
8098 | el._leaveCb();
|
8099 | }
|
8100 |
|
8101 | var data = resolveTransition(vnode.data.transition);
|
8102 | if (isUndef(data)) {
|
8103 | return
|
8104 | }
|
8105 |
|
8106 |
|
8107 | if (isDef(el._enterCb) || el.nodeType !== 1) {
|
8108 | return
|
8109 | }
|
8110 |
|
8111 | var css = data.css;
|
8112 | var type = data.type;
|
8113 | var enterClass = data.enterClass;
|
8114 | var enterToClass = data.enterToClass;
|
8115 | var enterActiveClass = data.enterActiveClass;
|
8116 | var appearClass = data.appearClass;
|
8117 | var appearToClass = data.appearToClass;
|
8118 | var appearActiveClass = data.appearActiveClass;
|
8119 | var beforeEnter = data.beforeEnter;
|
8120 | var enter = data.enter;
|
8121 | var afterEnter = data.afterEnter;
|
8122 | var enterCancelled = data.enterCancelled;
|
8123 | var beforeAppear = data.beforeAppear;
|
8124 | var appear = data.appear;
|
8125 | var afterAppear = data.afterAppear;
|
8126 | var appearCancelled = data.appearCancelled;
|
8127 | var duration = data.duration;
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 | var context = activeInstance;
|
8134 | var transitionNode = activeInstance.$vnode;
|
8135 | while (transitionNode && transitionNode.parent) {
|
8136 | transitionNode = transitionNode.parent;
|
8137 | context = transitionNode.context;
|
8138 | }
|
8139 |
|
8140 | var isAppear = !context._isMounted || !vnode.isRootInsert;
|
8141 |
|
8142 | if (isAppear && !appear && appear !== '') {
|
8143 | return
|
8144 | }
|
8145 |
|
8146 | var startClass = isAppear && appearClass
|
8147 | ? appearClass
|
8148 | : enterClass;
|
8149 | var activeClass = isAppear && appearActiveClass
|
8150 | ? appearActiveClass
|
8151 | : enterActiveClass;
|
8152 | var toClass = isAppear && appearToClass
|
8153 | ? appearToClass
|
8154 | : enterToClass;
|
8155 |
|
8156 | var beforeEnterHook = isAppear
|
8157 | ? (beforeAppear || beforeEnter)
|
8158 | : beforeEnter;
|
8159 | var enterHook = isAppear
|
8160 | ? (typeof appear === 'function' ? appear : enter)
|
8161 | : enter;
|
8162 | var afterEnterHook = isAppear
|
8163 | ? (afterAppear || afterEnter)
|
8164 | : afterEnter;
|
8165 | var enterCancelledHook = isAppear
|
8166 | ? (appearCancelled || enterCancelled)
|
8167 | : enterCancelled;
|
8168 |
|
8169 | var explicitEnterDuration = toNumber(
|
8170 | isObject(duration)
|
8171 | ? duration.enter
|
8172 | : duration
|
8173 | );
|
8174 |
|
8175 | if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
|
8176 | checkDuration(explicitEnterDuration, 'enter', vnode);
|
8177 | }
|
8178 |
|
8179 | var expectsCSS = css !== false && !isIE9;
|
8180 | var userWantsControl = getHookArgumentsLength(enterHook);
|
8181 |
|
8182 | var cb = el._enterCb = once(function () {
|
8183 | if (expectsCSS) {
|
8184 | removeTransitionClass(el, toClass);
|
8185 | removeTransitionClass(el, activeClass);
|
8186 | }
|
8187 | if (cb.cancelled) {
|
8188 | if (expectsCSS) {
|
8189 | removeTransitionClass(el, startClass);
|
8190 | }
|
8191 | enterCancelledHook && enterCancelledHook(el);
|
8192 | } else {
|
8193 | afterEnterHook && afterEnterHook(el);
|
8194 | }
|
8195 | el._enterCb = null;
|
8196 | });
|
8197 |
|
8198 | if (!vnode.data.show) {
|
8199 |
|
8200 | mergeVNodeHook(vnode, 'insert', function () {
|
8201 | var parent = el.parentNode;
|
8202 | var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
8203 | if (pendingNode &&
|
8204 | pendingNode.tag === vnode.tag &&
|
8205 | pendingNode.elm._leaveCb
|
8206 | ) {
|
8207 | pendingNode.elm._leaveCb();
|
8208 | }
|
8209 | enterHook && enterHook(el, cb);
|
8210 | });
|
8211 | }
|
8212 |
|
8213 |
|
8214 | beforeEnterHook && beforeEnterHook(el);
|
8215 | if (expectsCSS) {
|
8216 | addTransitionClass(el, startClass);
|
8217 | addTransitionClass(el, activeClass);
|
8218 | nextFrame(function () {
|
8219 | removeTransitionClass(el, startClass);
|
8220 | if (!cb.cancelled) {
|
8221 | addTransitionClass(el, toClass);
|
8222 | if (!userWantsControl) {
|
8223 | if (isValidDuration(explicitEnterDuration)) {
|
8224 | setTimeout(cb, explicitEnterDuration);
|
8225 | } else {
|
8226 | whenTransitionEnds(el, type, cb);
|
8227 | }
|
8228 | }
|
8229 | }
|
8230 | });
|
8231 | }
|
8232 |
|
8233 | if (vnode.data.show) {
|
8234 | toggleDisplay && toggleDisplay();
|
8235 | enterHook && enterHook(el, cb);
|
8236 | }
|
8237 |
|
8238 | if (!expectsCSS && !userWantsControl) {
|
8239 | cb();
|
8240 | }
|
8241 | }
|
8242 |
|
8243 | function leave (vnode, rm) {
|
8244 | var el = vnode.elm;
|
8245 |
|
8246 |
|
8247 | if (isDef(el._enterCb)) {
|
8248 | el._enterCb.cancelled = true;
|
8249 | el._enterCb();
|
8250 | }
|
8251 |
|
8252 | var data = resolveTransition(vnode.data.transition);
|
8253 | if (isUndef(data) || el.nodeType !== 1) {
|
8254 | return rm()
|
8255 | }
|
8256 |
|
8257 |
|
8258 | if (isDef(el._leaveCb)) {
|
8259 | return
|
8260 | }
|
8261 |
|
8262 | var css = data.css;
|
8263 | var type = data.type;
|
8264 | var leaveClass = data.leaveClass;
|
8265 | var leaveToClass = data.leaveToClass;
|
8266 | var leaveActiveClass = data.leaveActiveClass;
|
8267 | var beforeLeave = data.beforeLeave;
|
8268 | var leave = data.leave;
|
8269 | var afterLeave = data.afterLeave;
|
8270 | var leaveCancelled = data.leaveCancelled;
|
8271 | var delayLeave = data.delayLeave;
|
8272 | var duration = data.duration;
|
8273 |
|
8274 | var expectsCSS = css !== false && !isIE9;
|
8275 | var userWantsControl = getHookArgumentsLength(leave);
|
8276 |
|
8277 | var explicitLeaveDuration = toNumber(
|
8278 | isObject(duration)
|
8279 | ? duration.leave
|
8280 | : duration
|
8281 | );
|
8282 |
|
8283 | if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
|
8284 | checkDuration(explicitLeaveDuration, 'leave', vnode);
|
8285 | }
|
8286 |
|
8287 | var cb = el._leaveCb = once(function () {
|
8288 | if (el.parentNode && el.parentNode._pending) {
|
8289 | el.parentNode._pending[vnode.key] = null;
|
8290 | }
|
8291 | if (expectsCSS) {
|
8292 | removeTransitionClass(el, leaveToClass);
|
8293 | removeTransitionClass(el, leaveActiveClass);
|
8294 | }
|
8295 | if (cb.cancelled) {
|
8296 | if (expectsCSS) {
|
8297 | removeTransitionClass(el, leaveClass);
|
8298 | }
|
8299 | leaveCancelled && leaveCancelled(el);
|
8300 | } else {
|
8301 | rm();
|
8302 | afterLeave && afterLeave(el);
|
8303 | }
|
8304 | el._leaveCb = null;
|
8305 | });
|
8306 |
|
8307 | if (delayLeave) {
|
8308 | delayLeave(performLeave);
|
8309 | } else {
|
8310 | performLeave();
|
8311 | }
|
8312 |
|
8313 | function performLeave () {
|
8314 |
|
8315 | if (cb.cancelled) {
|
8316 | return
|
8317 | }
|
8318 |
|
8319 | if (!vnode.data.show && el.parentNode) {
|
8320 | (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
8321 | }
|
8322 | beforeLeave && beforeLeave(el);
|
8323 | if (expectsCSS) {
|
8324 | addTransitionClass(el, leaveClass);
|
8325 | addTransitionClass(el, leaveActiveClass);
|
8326 | nextFrame(function () {
|
8327 | removeTransitionClass(el, leaveClass);
|
8328 | if (!cb.cancelled) {
|
8329 | addTransitionClass(el, leaveToClass);
|
8330 | if (!userWantsControl) {
|
8331 | if (isValidDuration(explicitLeaveDuration)) {
|
8332 | setTimeout(cb, explicitLeaveDuration);
|
8333 | } else {
|
8334 | whenTransitionEnds(el, type, cb);
|
8335 | }
|
8336 | }
|
8337 | }
|
8338 | });
|
8339 | }
|
8340 | leave && leave(el, cb);
|
8341 | if (!expectsCSS && !userWantsControl) {
|
8342 | cb();
|
8343 | }
|
8344 | }
|
8345 | }
|
8346 |
|
8347 |
|
8348 | function checkDuration (val, name, vnode) {
|
8349 | if (typeof val !== 'number') {
|
8350 | warn(
|
8351 | "<transition> explicit " + name + " duration is not a valid number - " +
|
8352 | "got " + (JSON.stringify(val)) + ".",
|
8353 | vnode.context
|
8354 | );
|
8355 | } else if (isNaN(val)) {
|
8356 | warn(
|
8357 | "<transition> explicit " + name + " duration is NaN - " +
|
8358 | 'the duration expression might be incorrect.',
|
8359 | vnode.context
|
8360 | );
|
8361 | }
|
8362 | }
|
8363 |
|
8364 | function isValidDuration (val) {
|
8365 | return typeof val === 'number' && !isNaN(val)
|
8366 | }
|
8367 |
|
8368 |
|
8369 |
|
8370 |
|
8371 |
|
8372 |
|
8373 |
|
8374 | function getHookArgumentsLength (fn) {
|
8375 | if (isUndef(fn)) {
|
8376 | return false
|
8377 | }
|
8378 | var invokerFns = fn.fns;
|
8379 | if (isDef(invokerFns)) {
|
8380 |
|
8381 | return getHookArgumentsLength(
|
8382 | Array.isArray(invokerFns)
|
8383 | ? invokerFns[0]
|
8384 | : invokerFns
|
8385 | )
|
8386 | } else {
|
8387 | return (fn._length || fn.length) > 1
|
8388 | }
|
8389 | }
|
8390 |
|
8391 | function _enter (_, vnode) {
|
8392 | if (vnode.data.show !== true) {
|
8393 | enter(vnode);
|
8394 | }
|
8395 | }
|
8396 |
|
8397 | var transition = inBrowser ? {
|
8398 | create: _enter,
|
8399 | activate: _enter,
|
8400 | remove: function remove$$1 (vnode, rm) {
|
8401 |
|
8402 | if (vnode.data.show !== true) {
|
8403 | leave(vnode, rm);
|
8404 | } else {
|
8405 | rm();
|
8406 | }
|
8407 | }
|
8408 | } : {};
|
8409 |
|
8410 | var platformModules = [
|
8411 | attrs,
|
8412 | klass,
|
8413 | events,
|
8414 | domProps,
|
8415 | style,
|
8416 | transition
|
8417 | ];
|
8418 |
|
8419 |
|
8420 |
|
8421 |
|
8422 |
|
8423 | var modules = platformModules.concat(baseModules);
|
8424 |
|
8425 | var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
8426 |
|
8427 |
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 |
|
8433 | if (isIE9) {
|
8434 |
|
8435 | document.addEventListener('selectionchange', function () {
|
8436 | var el = document.activeElement;
|
8437 | if (el && el.vmodel) {
|
8438 | trigger(el, 'input');
|
8439 | }
|
8440 | });
|
8441 | }
|
8442 |
|
8443 | var directive = {
|
8444 | inserted: function inserted (el, binding, vnode, oldVnode) {
|
8445 | if (vnode.tag === 'select') {
|
8446 |
|
8447 | if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
8448 | mergeVNodeHook(vnode, 'postpatch', function () {
|
8449 | directive.componentUpdated(el, binding, vnode);
|
8450 | });
|
8451 | } else {
|
8452 | setSelected(el, binding, vnode.context);
|
8453 | }
|
8454 | el._vOptions = [].map.call(el.options, getValue);
|
8455 | } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
8456 | el._vModifiers = binding.modifiers;
|
8457 | if (!binding.modifiers.lazy) {
|
8458 | el.addEventListener('compositionstart', onCompositionStart);
|
8459 | el.addEventListener('compositionend', onCompositionEnd);
|
8460 |
|
8461 |
|
8462 |
|
8463 |
|
8464 | el.addEventListener('change', onCompositionEnd);
|
8465 |
|
8466 | if (isIE9) {
|
8467 | el.vmodel = true;
|
8468 | }
|
8469 | }
|
8470 | }
|
8471 | },
|
8472 |
|
8473 | componentUpdated: function componentUpdated (el, binding, vnode) {
|
8474 | if (vnode.tag === 'select') {
|
8475 | setSelected(el, binding, vnode.context);
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 | var prevOptions = el._vOptions;
|
8481 | var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
8482 | if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
8483 |
|
8484 |
|
8485 | var needReset = el.multiple
|
8486 | ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
8487 | : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
8488 | if (needReset) {
|
8489 | trigger(el, 'change');
|
8490 | }
|
8491 | }
|
8492 | }
|
8493 | }
|
8494 | };
|
8495 |
|
8496 | function setSelected (el, binding, vm) {
|
8497 | actuallySetSelected(el, binding, vm);
|
8498 |
|
8499 | if (isIE || isEdge) {
|
8500 | setTimeout(function () {
|
8501 | actuallySetSelected(el, binding, vm);
|
8502 | }, 0);
|
8503 | }
|
8504 | }
|
8505 |
|
8506 | function actuallySetSelected (el, binding, vm) {
|
8507 | var value = binding.value;
|
8508 | var isMultiple = el.multiple;
|
8509 | if (isMultiple && !Array.isArray(value)) {
|
8510 | process.env.NODE_ENV !== 'production' && warn(
|
8511 | "<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
8512 | "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
8513 | vm
|
8514 | );
|
8515 | return
|
8516 | }
|
8517 | var selected, option;
|
8518 | for (var i = 0, l = el.options.length; i < l; i++) {
|
8519 | option = el.options[i];
|
8520 | if (isMultiple) {
|
8521 | selected = looseIndexOf(value, getValue(option)) > -1;
|
8522 | if (option.selected !== selected) {
|
8523 | option.selected = selected;
|
8524 | }
|
8525 | } else {
|
8526 | if (looseEqual(getValue(option), value)) {
|
8527 | if (el.selectedIndex !== i) {
|
8528 | el.selectedIndex = i;
|
8529 | }
|
8530 | return
|
8531 | }
|
8532 | }
|
8533 | }
|
8534 | if (!isMultiple) {
|
8535 | el.selectedIndex = -1;
|
8536 | }
|
8537 | }
|
8538 |
|
8539 | function hasNoMatchingOption (value, options) {
|
8540 | return options.every(function (o) { return !looseEqual(o, value); })
|
8541 | }
|
8542 |
|
8543 | function getValue (option) {
|
8544 | return '_value' in option
|
8545 | ? option._value
|
8546 | : option.value
|
8547 | }
|
8548 |
|
8549 | function onCompositionStart (e) {
|
8550 | e.target.composing = true;
|
8551 | }
|
8552 |
|
8553 | function onCompositionEnd (e) {
|
8554 |
|
8555 | if (!e.target.composing) { return }
|
8556 | e.target.composing = false;
|
8557 | trigger(e.target, 'input');
|
8558 | }
|
8559 |
|
8560 | function trigger (el, type) {
|
8561 | var e = document.createEvent('HTMLEvents');
|
8562 | e.initEvent(type, true, true);
|
8563 | el.dispatchEvent(e);
|
8564 | }
|
8565 |
|
8566 |
|
8567 |
|
8568 |
|
8569 | function locateNode (vnode) {
|
8570 | return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
8571 | ? locateNode(vnode.componentInstance._vnode)
|
8572 | : vnode
|
8573 | }
|
8574 |
|
8575 | var show = {
|
8576 | bind: function bind (el, ref, vnode) {
|
8577 | var value = ref.value;
|
8578 |
|
8579 | vnode = locateNode(vnode);
|
8580 | var transition$$1 = vnode.data && vnode.data.transition;
|
8581 | var originalDisplay = el.__vOriginalDisplay =
|
8582 | el.style.display === 'none' ? '' : el.style.display;
|
8583 | if (value && transition$$1) {
|
8584 | vnode.data.show = true;
|
8585 | enter(vnode, function () {
|
8586 | el.style.display = originalDisplay;
|
8587 | });
|
8588 | } else {
|
8589 | el.style.display = value ? originalDisplay : 'none';
|
8590 | }
|
8591 | },
|
8592 |
|
8593 | update: function update (el, ref, vnode) {
|
8594 | var value = ref.value;
|
8595 | var oldValue = ref.oldValue;
|
8596 |
|
8597 |
|
8598 | if (!value === !oldValue) { return }
|
8599 | vnode = locateNode(vnode);
|
8600 | var transition$$1 = vnode.data && vnode.data.transition;
|
8601 | if (transition$$1) {
|
8602 | vnode.data.show = true;
|
8603 | if (value) {
|
8604 | enter(vnode, function () {
|
8605 | el.style.display = el.__vOriginalDisplay;
|
8606 | });
|
8607 | } else {
|
8608 | leave(vnode, function () {
|
8609 | el.style.display = 'none';
|
8610 | });
|
8611 | }
|
8612 | } else {
|
8613 | el.style.display = value ? el.__vOriginalDisplay : 'none';
|
8614 | }
|
8615 | },
|
8616 |
|
8617 | unbind: function unbind (
|
8618 | el,
|
8619 | binding,
|
8620 | vnode,
|
8621 | oldVnode,
|
8622 | isDestroy
|
8623 | ) {
|
8624 | if (!isDestroy) {
|
8625 | el.style.display = el.__vOriginalDisplay;
|
8626 | }
|
8627 | }
|
8628 | };
|
8629 |
|
8630 | var platformDirectives = {
|
8631 | model: directive,
|
8632 | show: show
|
8633 | };
|
8634 |
|
8635 |
|
8636 |
|
8637 | var transitionProps = {
|
8638 | name: String,
|
8639 | appear: Boolean,
|
8640 | css: Boolean,
|
8641 | mode: String,
|
8642 | type: String,
|
8643 | enterClass: String,
|
8644 | leaveClass: String,
|
8645 | enterToClass: String,
|
8646 | leaveToClass: String,
|
8647 | enterActiveClass: String,
|
8648 | leaveActiveClass: String,
|
8649 | appearClass: String,
|
8650 | appearActiveClass: String,
|
8651 | appearToClass: String,
|
8652 | duration: [Number, String, Object]
|
8653 | };
|
8654 |
|
8655 |
|
8656 |
|
8657 | function getRealChild (vnode) {
|
8658 | var compOptions = vnode && vnode.componentOptions;
|
8659 | if (compOptions && compOptions.Ctor.options.abstract) {
|
8660 | return getRealChild(getFirstComponentChild(compOptions.children))
|
8661 | } else {
|
8662 | return vnode
|
8663 | }
|
8664 | }
|
8665 |
|
8666 | function extractTransitionData (comp) {
|
8667 | var data = {};
|
8668 | var options = comp.$options;
|
8669 |
|
8670 | for (var key in options.propsData) {
|
8671 | data[key] = comp[key];
|
8672 | }
|
8673 |
|
8674 |
|
8675 | var listeners = options._parentListeners;
|
8676 | for (var key$1 in listeners) {
|
8677 | data[camelize(key$1)] = listeners[key$1];
|
8678 | }
|
8679 | return data
|
8680 | }
|
8681 |
|
8682 | function placeholder (h, rawChild) {
|
8683 | if (/\d-keep-alive$/.test(rawChild.tag)) {
|
8684 | return h('keep-alive', {
|
8685 | props: rawChild.componentOptions.propsData
|
8686 | })
|
8687 | }
|
8688 | }
|
8689 |
|
8690 | function hasParentTransition (vnode) {
|
8691 | while ((vnode = vnode.parent)) {
|
8692 | if (vnode.data.transition) {
|
8693 | return true
|
8694 | }
|
8695 | }
|
8696 | }
|
8697 |
|
8698 | function isSameChild (child, oldChild) {
|
8699 | return oldChild.key === child.key && oldChild.tag === child.tag
|
8700 | }
|
8701 |
|
8702 | var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
8703 |
|
8704 | var isVShowDirective = function (d) { return d.name === 'show'; };
|
8705 |
|
8706 | var Transition = {
|
8707 | name: 'transition',
|
8708 | props: transitionProps,
|
8709 | abstract: true,
|
8710 |
|
8711 | render: function render (h) {
|
8712 | var this$1 = this;
|
8713 |
|
8714 | var children = this.$slots.default;
|
8715 | if (!children) {
|
8716 | return
|
8717 | }
|
8718 |
|
8719 |
|
8720 | children = children.filter(isNotTextNode);
|
8721 |
|
8722 | if (!children.length) {
|
8723 | return
|
8724 | }
|
8725 |
|
8726 |
|
8727 | if (process.env.NODE_ENV !== 'production' && children.length > 1) {
|
8728 | warn(
|
8729 | '<transition> can only be used on a single element. Use ' +
|
8730 | '<transition-group> for lists.',
|
8731 | this.$parent
|
8732 | );
|
8733 | }
|
8734 |
|
8735 | var mode = this.mode;
|
8736 |
|
8737 |
|
8738 | if (process.env.NODE_ENV !== 'production' &&
|
8739 | mode && mode !== 'in-out' && mode !== 'out-in'
|
8740 | ) {
|
8741 | warn(
|
8742 | 'invalid <transition> mode: ' + mode,
|
8743 | this.$parent
|
8744 | );
|
8745 | }
|
8746 |
|
8747 | var rawChild = children[0];
|
8748 |
|
8749 |
|
8750 |
|
8751 | if (hasParentTransition(this.$vnode)) {
|
8752 | return rawChild
|
8753 | }
|
8754 |
|
8755 |
|
8756 |
|
8757 | var child = getRealChild(rawChild);
|
8758 |
|
8759 | if (!child) {
|
8760 | return rawChild
|
8761 | }
|
8762 |
|
8763 | if (this._leaving) {
|
8764 | return placeholder(h, rawChild)
|
8765 | }
|
8766 |
|
8767 |
|
8768 |
|
8769 |
|
8770 | var id = "__transition-" + (this._uid) + "-";
|
8771 | child.key = child.key == null
|
8772 | ? child.isComment
|
8773 | ? id + 'comment'
|
8774 | : id + child.tag
|
8775 | : isPrimitive(child.key)
|
8776 | ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
8777 | : child.key;
|
8778 |
|
8779 | var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
8780 | var oldRawChild = this._vnode;
|
8781 | var oldChild = getRealChild(oldRawChild);
|
8782 |
|
8783 |
|
8784 |
|
8785 | if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
8786 | child.data.show = true;
|
8787 | }
|
8788 |
|
8789 | if (
|
8790 | oldChild &&
|
8791 | oldChild.data &&
|
8792 | !isSameChild(child, oldChild) &&
|
8793 | !isAsyncPlaceholder(oldChild) &&
|
8794 |
|
8795 | !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
8796 | ) {
|
8797 |
|
8798 |
|
8799 | var oldData = oldChild.data.transition = extend({}, data);
|
8800 |
|
8801 | if (mode === 'out-in') {
|
8802 |
|
8803 | this._leaving = true;
|
8804 | mergeVNodeHook(oldData, 'afterLeave', function () {
|
8805 | this$1._leaving = false;
|
8806 | this$1.$forceUpdate();
|
8807 | });
|
8808 | return placeholder(h, rawChild)
|
8809 | } else if (mode === 'in-out') {
|
8810 | if (isAsyncPlaceholder(child)) {
|
8811 | return oldRawChild
|
8812 | }
|
8813 | var delayedLeave;
|
8814 | var performLeave = function () { delayedLeave(); };
|
8815 | mergeVNodeHook(data, 'afterEnter', performLeave);
|
8816 | mergeVNodeHook(data, 'enterCancelled', performLeave);
|
8817 | mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
8818 | }
|
8819 | }
|
8820 |
|
8821 | return rawChild
|
8822 | }
|
8823 | };
|
8824 |
|
8825 |
|
8826 |
|
8827 | var props = extend({
|
8828 | tag: String,
|
8829 | moveClass: String
|
8830 | }, transitionProps);
|
8831 |
|
8832 | delete props.mode;
|
8833 |
|
8834 | var TransitionGroup = {
|
8835 | props: props,
|
8836 |
|
8837 | beforeMount: function beforeMount () {
|
8838 | var this$1 = this;
|
8839 |
|
8840 | var update = this._update;
|
8841 | this._update = function (vnode, hydrating) {
|
8842 | var restoreActiveInstance = setActiveInstance(this$1);
|
8843 |
|
8844 | this$1.__patch__(
|
8845 | this$1._vnode,
|
8846 | this$1.kept,
|
8847 | false,
|
8848 | true
|
8849 | );
|
8850 | this$1._vnode = this$1.kept;
|
8851 | restoreActiveInstance();
|
8852 | update.call(this$1, vnode, hydrating);
|
8853 | };
|
8854 | },
|
8855 |
|
8856 | render: function render (h) {
|
8857 | var tag = this.tag || this.$vnode.data.tag || 'span';
|
8858 | var map = Object.create(null);
|
8859 | var prevChildren = this.prevChildren = this.children;
|
8860 | var rawChildren = this.$slots.default || [];
|
8861 | var children = this.children = [];
|
8862 | var transitionData = extractTransitionData(this);
|
8863 |
|
8864 | for (var i = 0; i < rawChildren.length; i++) {
|
8865 | var c = rawChildren[i];
|
8866 | if (c.tag) {
|
8867 | if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
8868 | children.push(c);
|
8869 | map[c.key] = c
|
8870 | ;(c.data || (c.data = {})).transition = transitionData;
|
8871 | } else if (process.env.NODE_ENV !== 'production') {
|
8872 | var opts = c.componentOptions;
|
8873 | var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
8874 | warn(("<transition-group> children must be keyed: <" + name + ">"));
|
8875 | }
|
8876 | }
|
8877 | }
|
8878 |
|
8879 | if (prevChildren) {
|
8880 | var kept = [];
|
8881 | var removed = [];
|
8882 | for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
8883 | var c$1 = prevChildren[i$1];
|
8884 | c$1.data.transition = transitionData;
|
8885 | c$1.data.pos = c$1.elm.getBoundingClientRect();
|
8886 | if (map[c$1.key]) {
|
8887 | kept.push(c$1);
|
8888 | } else {
|
8889 | removed.push(c$1);
|
8890 | }
|
8891 | }
|
8892 | this.kept = h(tag, null, kept);
|
8893 | this.removed = removed;
|
8894 | }
|
8895 |
|
8896 | return h(tag, null, children)
|
8897 | },
|
8898 |
|
8899 | updated: function updated () {
|
8900 | var children = this.prevChildren;
|
8901 | var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
8902 | if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
8903 | return
|
8904 | }
|
8905 |
|
8906 |
|
8907 |
|
8908 | children.forEach(callPendingCbs);
|
8909 | children.forEach(recordPosition);
|
8910 | children.forEach(applyTranslation);
|
8911 |
|
8912 |
|
8913 |
|
8914 |
|
8915 | this._reflow = document.body.offsetHeight;
|
8916 |
|
8917 | children.forEach(function (c) {
|
8918 | if (c.data.moved) {
|
8919 | var el = c.elm;
|
8920 | var s = el.style;
|
8921 | addTransitionClass(el, moveClass);
|
8922 | s.transform = s.WebkitTransform = s.transitionDuration = '';
|
8923 | el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
8924 | if (e && e.target !== el) {
|
8925 | return
|
8926 | }
|
8927 | if (!e || /transform$/.test(e.propertyName)) {
|
8928 | el.removeEventListener(transitionEndEvent, cb);
|
8929 | el._moveCb = null;
|
8930 | removeTransitionClass(el, moveClass);
|
8931 | }
|
8932 | });
|
8933 | }
|
8934 | });
|
8935 | },
|
8936 |
|
8937 | methods: {
|
8938 | hasMove: function hasMove (el, moveClass) {
|
8939 |
|
8940 | if (!hasTransition) {
|
8941 | return false
|
8942 | }
|
8943 |
|
8944 | if (this._hasMove) {
|
8945 | return this._hasMove
|
8946 | }
|
8947 |
|
8948 |
|
8949 |
|
8950 |
|
8951 |
|
8952 | var clone = el.cloneNode();
|
8953 | if (el._transitionClasses) {
|
8954 | el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
8955 | }
|
8956 | addClass(clone, moveClass);
|
8957 | clone.style.display = 'none';
|
8958 | this.$el.appendChild(clone);
|
8959 | var info = getTransitionInfo(clone);
|
8960 | this.$el.removeChild(clone);
|
8961 | return (this._hasMove = info.hasTransform)
|
8962 | }
|
8963 | }
|
8964 | };
|
8965 |
|
8966 | function callPendingCbs (c) {
|
8967 |
|
8968 | if (c.elm._moveCb) {
|
8969 | c.elm._moveCb();
|
8970 | }
|
8971 |
|
8972 | if (c.elm._enterCb) {
|
8973 | c.elm._enterCb();
|
8974 | }
|
8975 | }
|
8976 |
|
8977 | function recordPosition (c) {
|
8978 | c.data.newPos = c.elm.getBoundingClientRect();
|
8979 | }
|
8980 |
|
8981 | function applyTranslation (c) {
|
8982 | var oldPos = c.data.pos;
|
8983 | var newPos = c.data.newPos;
|
8984 | var dx = oldPos.left - newPos.left;
|
8985 | var dy = oldPos.top - newPos.top;
|
8986 | if (dx || dy) {
|
8987 | c.data.moved = true;
|
8988 | var s = c.elm.style;
|
8989 | s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
8990 | s.transitionDuration = '0s';
|
8991 | }
|
8992 | }
|
8993 |
|
8994 | var platformComponents = {
|
8995 | Transition: Transition,
|
8996 | TransitionGroup: TransitionGroup
|
8997 | };
|
8998 |
|
8999 |
|
9000 |
|
9001 |
|
9002 | Vue.config.mustUseProp = mustUseProp;
|
9003 | Vue.config.isReservedTag = isReservedTag;
|
9004 | Vue.config.isReservedAttr = isReservedAttr;
|
9005 | Vue.config.getTagNamespace = getTagNamespace;
|
9006 | Vue.config.isUnknownElement = isUnknownElement;
|
9007 |
|
9008 |
|
9009 | extend(Vue.options.directives, platformDirectives);
|
9010 | extend(Vue.options.components, platformComponents);
|
9011 |
|
9012 |
|
9013 | Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
9014 |
|
9015 |
|
9016 | Vue.prototype.$mount = function (
|
9017 | el,
|
9018 | hydrating
|
9019 | ) {
|
9020 | el = el && inBrowser ? query(el) : undefined;
|
9021 | return mountComponent(this, el, hydrating)
|
9022 | };
|
9023 |
|
9024 |
|
9025 |
|
9026 | if (inBrowser) {
|
9027 | setTimeout(function () {
|
9028 | if (config.devtools) {
|
9029 | if (devtools) {
|
9030 | devtools.emit('init', Vue);
|
9031 | } else if (
|
9032 | process.env.NODE_ENV !== 'production' &&
|
9033 | process.env.NODE_ENV !== 'test'
|
9034 | ) {
|
9035 | console[console.info ? 'info' : 'log'](
|
9036 | 'Download the Vue Devtools extension for a better development experience:\n' +
|
9037 | 'https://github.com/vuejs/vue-devtools'
|
9038 | );
|
9039 | }
|
9040 | }
|
9041 | if (process.env.NODE_ENV !== 'production' &&
|
9042 | process.env.NODE_ENV !== 'test' &&
|
9043 | config.productionTip !== false &&
|
9044 | typeof console !== 'undefined'
|
9045 | ) {
|
9046 | console[console.info ? 'info' : 'log'](
|
9047 | "You are running Vue in development mode.\n" +
|
9048 | "Make sure to turn on production mode when deploying for production.\n" +
|
9049 | "See more tips at https://vuejs.org/guide/deployment.html"
|
9050 | );
|
9051 | }
|
9052 | }, 0);
|
9053 | }
|
9054 |
|
9055 |
|
9056 |
|
9057 | var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
9058 | var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
9059 |
|
9060 | var buildRegex = cached(function (delimiters) {
|
9061 | var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
9062 | var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
9063 | return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
9064 | });
|
9065 |
|
9066 |
|
9067 |
|
9068 | function parseText (
|
9069 | text,
|
9070 | delimiters
|
9071 | ) {
|
9072 | var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
9073 | if (!tagRE.test(text)) {
|
9074 | return
|
9075 | }
|
9076 | var tokens = [];
|
9077 | var rawTokens = [];
|
9078 | var lastIndex = tagRE.lastIndex = 0;
|
9079 | var match, index, tokenValue;
|
9080 | while ((match = tagRE.exec(text))) {
|
9081 | index = match.index;
|
9082 |
|
9083 | if (index > lastIndex) {
|
9084 | rawTokens.push(tokenValue = text.slice(lastIndex, index));
|
9085 | tokens.push(JSON.stringify(tokenValue));
|
9086 | }
|
9087 |
|
9088 | var exp = parseFilters(match[1].trim());
|
9089 | tokens.push(("_s(" + exp + ")"));
|
9090 | rawTokens.push({ '@binding': exp });
|
9091 | lastIndex = index + match[0].length;
|
9092 | }
|
9093 | if (lastIndex < text.length) {
|
9094 | rawTokens.push(tokenValue = text.slice(lastIndex));
|
9095 | tokens.push(JSON.stringify(tokenValue));
|
9096 | }
|
9097 | return {
|
9098 | expression: tokens.join('+'),
|
9099 | tokens: rawTokens
|
9100 | }
|
9101 | }
|
9102 |
|
9103 |
|
9104 |
|
9105 | function transformNode (el, options) {
|
9106 | var warn = options.warn || baseWarn;
|
9107 | var staticClass = getAndRemoveAttr(el, 'class');
|
9108 | if (process.env.NODE_ENV !== 'production' && staticClass) {
|
9109 | var res = parseText(staticClass, options.delimiters);
|
9110 | if (res) {
|
9111 | warn(
|
9112 | "class=\"" + staticClass + "\": " +
|
9113 | 'Interpolation inside attributes has been removed. ' +
|
9114 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
9115 | 'instead of <div class="{{ val }}">, use <div :class="val">.',
|
9116 | el.rawAttrsMap['class']
|
9117 | );
|
9118 | }
|
9119 | }
|
9120 | if (staticClass) {
|
9121 | el.staticClass = JSON.stringify(staticClass);
|
9122 | }
|
9123 | var classBinding = getBindingAttr(el, 'class', false );
|
9124 | if (classBinding) {
|
9125 | el.classBinding = classBinding;
|
9126 | }
|
9127 | }
|
9128 |
|
9129 | function genData (el) {
|
9130 | var data = '';
|
9131 | if (el.staticClass) {
|
9132 | data += "staticClass:" + (el.staticClass) + ",";
|
9133 | }
|
9134 | if (el.classBinding) {
|
9135 | data += "class:" + (el.classBinding) + ",";
|
9136 | }
|
9137 | return data
|
9138 | }
|
9139 |
|
9140 | var klass$1 = {
|
9141 | staticKeys: ['staticClass'],
|
9142 | transformNode: transformNode,
|
9143 | genData: genData
|
9144 | };
|
9145 |
|
9146 |
|
9147 |
|
9148 | function transformNode$1 (el, options) {
|
9149 | var warn = options.warn || baseWarn;
|
9150 | var staticStyle = getAndRemoveAttr(el, 'style');
|
9151 | if (staticStyle) {
|
9152 |
|
9153 | if (process.env.NODE_ENV !== 'production') {
|
9154 | var res = parseText(staticStyle, options.delimiters);
|
9155 | if (res) {
|
9156 | warn(
|
9157 | "style=\"" + staticStyle + "\": " +
|
9158 | 'Interpolation inside attributes has been removed. ' +
|
9159 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
9160 | 'instead of <div style="{{ val }}">, use <div :style="val">.',
|
9161 | el.rawAttrsMap['style']
|
9162 | );
|
9163 | }
|
9164 | }
|
9165 | el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
9166 | }
|
9167 |
|
9168 | var styleBinding = getBindingAttr(el, 'style', false );
|
9169 | if (styleBinding) {
|
9170 | el.styleBinding = styleBinding;
|
9171 | }
|
9172 | }
|
9173 |
|
9174 | function genData$1 (el) {
|
9175 | var data = '';
|
9176 | if (el.staticStyle) {
|
9177 | data += "staticStyle:" + (el.staticStyle) + ",";
|
9178 | }
|
9179 | if (el.styleBinding) {
|
9180 | data += "style:(" + (el.styleBinding) + "),";
|
9181 | }
|
9182 | return data
|
9183 | }
|
9184 |
|
9185 | var style$1 = {
|
9186 | staticKeys: ['staticStyle'],
|
9187 | transformNode: transformNode$1,
|
9188 | genData: genData$1
|
9189 | };
|
9190 |
|
9191 |
|
9192 |
|
9193 | var decoder;
|
9194 |
|
9195 | var he = {
|
9196 | decode: function decode (html) {
|
9197 | decoder = decoder || document.createElement('div');
|
9198 | decoder.innerHTML = html;
|
9199 | return decoder.textContent
|
9200 | }
|
9201 | };
|
9202 |
|
9203 |
|
9204 |
|
9205 | var isUnaryTag = makeMap(
|
9206 | 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
9207 | 'link,meta,param,source,track,wbr'
|
9208 | );
|
9209 |
|
9210 |
|
9211 |
|
9212 | var canBeLeftOpenTag = makeMap(
|
9213 | 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
9214 | );
|
9215 |
|
9216 |
|
9217 |
|
9218 | var isNonPhrasingTag = makeMap(
|
9219 | 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
9220 | 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
9221 | 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
9222 | 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
9223 | 'title,tr,track'
|
9224 | );
|
9225 |
|
9226 |
|
9227 |
|
9228 |
|
9229 |
|
9230 |
|
9231 | var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9232 | var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9233 | var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
|
9234 | var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
9235 | var startTagOpen = new RegExp(("^<" + qnameCapture));
|
9236 | var startTagClose = /^\s*(\/?)>/;
|
9237 | var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
9238 | var doctype = /^<!DOCTYPE [^>]+>/i;
|
9239 |
|
9240 | var comment = /^<!\--/;
|
9241 | var conditionalComment = /^<!\[/;
|
9242 |
|
9243 |
|
9244 | var isPlainTextElement = makeMap('script,style,textarea', true);
|
9245 | var reCache = {};
|
9246 |
|
9247 | var decodingMap = {
|
9248 | '<': '<',
|
9249 | '>': '>',
|
9250 | '"': '"',
|
9251 | '&': '&',
|
9252 | ' ': '\n',
|
9253 | '	': '\t',
|
9254 | ''': "'"
|
9255 | };
|
9256 | var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
|
9257 | var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
|
9258 |
|
9259 |
|
9260 | var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
9261 | var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
|
9262 |
|
9263 | function decodeAttr (value, shouldDecodeNewlines) {
|
9264 | var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
9265 | return value.replace(re, function (match) { return decodingMap[match]; })
|
9266 | }
|
9267 |
|
9268 | function parseHTML (html, options) {
|
9269 | var stack = [];
|
9270 | var expectHTML = options.expectHTML;
|
9271 | var isUnaryTag$$1 = options.isUnaryTag || no;
|
9272 | var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
9273 | var index = 0;
|
9274 | var last, lastTag;
|
9275 | while (html) {
|
9276 | last = html;
|
9277 |
|
9278 | if (!lastTag || !isPlainTextElement(lastTag)) {
|
9279 | var textEnd = html.indexOf('<');
|
9280 | if (textEnd === 0) {
|
9281 |
|
9282 | if (comment.test(html)) {
|
9283 | var commentEnd = html.indexOf('-->');
|
9284 |
|
9285 | if (commentEnd >= 0) {
|
9286 | if (options.shouldKeepComment) {
|
9287 | options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
9288 | }
|
9289 | advance(commentEnd + 3);
|
9290 | continue
|
9291 | }
|
9292 | }
|
9293 |
|
9294 |
|
9295 | if (conditionalComment.test(html)) {
|
9296 | var conditionalEnd = html.indexOf(']>');
|
9297 |
|
9298 | if (conditionalEnd >= 0) {
|
9299 | advance(conditionalEnd + 2);
|
9300 | continue
|
9301 | }
|
9302 | }
|
9303 |
|
9304 |
|
9305 | var doctypeMatch = html.match(doctype);
|
9306 | if (doctypeMatch) {
|
9307 | advance(doctypeMatch[0].length);
|
9308 | continue
|
9309 | }
|
9310 |
|
9311 |
|
9312 | var endTagMatch = html.match(endTag);
|
9313 | if (endTagMatch) {
|
9314 | var curIndex = index;
|
9315 | advance(endTagMatch[0].length);
|
9316 | parseEndTag(endTagMatch[1], curIndex, index);
|
9317 | continue
|
9318 | }
|
9319 |
|
9320 |
|
9321 | var startTagMatch = parseStartTag();
|
9322 | if (startTagMatch) {
|
9323 | handleStartTag(startTagMatch);
|
9324 | if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
9325 | advance(1);
|
9326 | }
|
9327 | continue
|
9328 | }
|
9329 | }
|
9330 |
|
9331 | var text = (void 0), rest = (void 0), next = (void 0);
|
9332 | if (textEnd >= 0) {
|
9333 | rest = html.slice(textEnd);
|
9334 | while (
|
9335 | !endTag.test(rest) &&
|
9336 | !startTagOpen.test(rest) &&
|
9337 | !comment.test(rest) &&
|
9338 | !conditionalComment.test(rest)
|
9339 | ) {
|
9340 |
|
9341 | next = rest.indexOf('<', 1);
|
9342 | if (next < 0) { break }
|
9343 | textEnd += next;
|
9344 | rest = html.slice(textEnd);
|
9345 | }
|
9346 | text = html.substring(0, textEnd);
|
9347 | }
|
9348 |
|
9349 | if (textEnd < 0) {
|
9350 | text = html;
|
9351 | }
|
9352 |
|
9353 | if (text) {
|
9354 | advance(text.length);
|
9355 | }
|
9356 |
|
9357 | if (options.chars && text) {
|
9358 | options.chars(text, index - text.length, index);
|
9359 | }
|
9360 | } else {
|
9361 | var endTagLength = 0;
|
9362 | var stackedTag = lastTag.toLowerCase();
|
9363 | var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
|
9364 | var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
|
9365 | endTagLength = endTag.length;
|
9366 | if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
9367 | text = text
|
9368 | .replace(/<!\--([\s\S]*?)-->/g, '$1')
|
9369 | .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
9370 | }
|
9371 | if (shouldIgnoreFirstNewline(stackedTag, text)) {
|
9372 | text = text.slice(1);
|
9373 | }
|
9374 | if (options.chars) {
|
9375 | options.chars(text);
|
9376 | }
|
9377 | return ''
|
9378 | });
|
9379 | index += html.length - rest$1.length;
|
9380 | html = rest$1;
|
9381 | parseEndTag(stackedTag, index - endTagLength, index);
|
9382 | }
|
9383 |
|
9384 | if (html === last) {
|
9385 | options.chars && options.chars(html);
|
9386 | if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
|
9387 | options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
|
9388 | }
|
9389 | break
|
9390 | }
|
9391 | }
|
9392 |
|
9393 |
|
9394 | parseEndTag();
|
9395 |
|
9396 | function advance (n) {
|
9397 | index += n;
|
9398 | html = html.substring(n);
|
9399 | }
|
9400 |
|
9401 | function parseStartTag () {
|
9402 | var start = html.match(startTagOpen);
|
9403 | if (start) {
|
9404 | var match = {
|
9405 | tagName: start[1],
|
9406 | attrs: [],
|
9407 | start: index
|
9408 | };
|
9409 | advance(start[0].length);
|
9410 | var end, attr;
|
9411 | while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
9412 | attr.start = index;
|
9413 | advance(attr[0].length);
|
9414 | attr.end = index;
|
9415 | match.attrs.push(attr);
|
9416 | }
|
9417 | if (end) {
|
9418 | match.unarySlash = end[1];
|
9419 | advance(end[0].length);
|
9420 | match.end = index;
|
9421 | return match
|
9422 | }
|
9423 | }
|
9424 | }
|
9425 |
|
9426 | function handleStartTag (match) {
|
9427 | var tagName = match.tagName;
|
9428 | var unarySlash = match.unarySlash;
|
9429 |
|
9430 | if (expectHTML) {
|
9431 | if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
9432 | parseEndTag(lastTag);
|
9433 | }
|
9434 | if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
9435 | parseEndTag(tagName);
|
9436 | }
|
9437 | }
|
9438 |
|
9439 | var unary = isUnaryTag$$1(tagName) || !!unarySlash;
|
9440 |
|
9441 | var l = match.attrs.length;
|
9442 | var attrs = new Array(l);
|
9443 | for (var i = 0; i < l; i++) {
|
9444 | var args = match.attrs[i];
|
9445 | var value = args[3] || args[4] || args[5] || '';
|
9446 | var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
9447 | ? options.shouldDecodeNewlinesForHref
|
9448 | : options.shouldDecodeNewlines;
|
9449 | attrs[i] = {
|
9450 | name: args[1],
|
9451 | value: decodeAttr(value, shouldDecodeNewlines)
|
9452 | };
|
9453 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
9454 | attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
9455 | attrs[i].end = args.end;
|
9456 | }
|
9457 | }
|
9458 |
|
9459 | if (!unary) {
|
9460 | stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
|
9461 | lastTag = tagName;
|
9462 | }
|
9463 |
|
9464 | if (options.start) {
|
9465 | options.start(tagName, attrs, unary, match.start, match.end);
|
9466 | }
|
9467 | }
|
9468 |
|
9469 | function parseEndTag (tagName, start, end) {
|
9470 | var pos, lowerCasedTagName;
|
9471 | if (start == null) { start = index; }
|
9472 | if (end == null) { end = index; }
|
9473 |
|
9474 |
|
9475 | if (tagName) {
|
9476 | lowerCasedTagName = tagName.toLowerCase();
|
9477 | for (pos = stack.length - 1; pos >= 0; pos--) {
|
9478 | if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
9479 | break
|
9480 | }
|
9481 | }
|
9482 | } else {
|
9483 |
|
9484 | pos = 0;
|
9485 | }
|
9486 |
|
9487 | if (pos >= 0) {
|
9488 |
|
9489 | for (var i = stack.length - 1; i >= pos; i--) {
|
9490 | if (process.env.NODE_ENV !== 'production' &&
|
9491 | (i > pos || !tagName) &&
|
9492 | options.warn
|
9493 | ) {
|
9494 | options.warn(
|
9495 | ("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
9496 | { start: stack[i].start }
|
9497 | );
|
9498 | }
|
9499 | if (options.end) {
|
9500 | options.end(stack[i].tag, start, end);
|
9501 | }
|
9502 | }
|
9503 |
|
9504 |
|
9505 | stack.length = pos;
|
9506 | lastTag = pos && stack[pos - 1].tag;
|
9507 | } else if (lowerCasedTagName === 'br') {
|
9508 | if (options.start) {
|
9509 | options.start(tagName, [], true, start, end);
|
9510 | }
|
9511 | } else if (lowerCasedTagName === 'p') {
|
9512 | if (options.start) {
|
9513 | options.start(tagName, [], false, start, end);
|
9514 | }
|
9515 | if (options.end) {
|
9516 | options.end(tagName, start, end);
|
9517 | }
|
9518 | }
|
9519 | }
|
9520 | }
|
9521 |
|
9522 |
|
9523 |
|
9524 | var onRE = /^@|^v-on:/;
|
9525 | var dirRE = /^v-|^@|^:/;
|
9526 | var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
9527 | var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
9528 | var stripParensRE = /^\(|\)$/g;
|
9529 | var dynamicArgRE = /^\[.*\]$/;
|
9530 |
|
9531 | var argRE = /:(.*)$/;
|
9532 | var bindRE = /^:|^\.|^v-bind:/;
|
9533 | var modifierRE = /\.[^.]+/g;
|
9534 |
|
9535 | var slotRE = /^v-slot(:|$)|^#/;
|
9536 |
|
9537 | var lineBreakRE = /[\r\n]/;
|
9538 | var whitespaceRE$1 = /\s+/g;
|
9539 |
|
9540 | var invalidAttributeRE = /[\s"'<>\/=]/;
|
9541 |
|
9542 | var decodeHTMLCached = cached(he.decode);
|
9543 |
|
9544 | var emptySlotScopeToken = "_empty_";
|
9545 |
|
9546 |
|
9547 | var warn$2;
|
9548 | var delimiters;
|
9549 | var transforms;
|
9550 | var preTransforms;
|
9551 | var postTransforms;
|
9552 | var platformIsPreTag;
|
9553 | var platformMustUseProp;
|
9554 | var platformGetTagNamespace;
|
9555 | var maybeComponent;
|
9556 |
|
9557 | function createASTElement (
|
9558 | tag,
|
9559 | attrs,
|
9560 | parent
|
9561 | ) {
|
9562 | return {
|
9563 | type: 1,
|
9564 | tag: tag,
|
9565 | attrsList: attrs,
|
9566 | attrsMap: makeAttrsMap(attrs),
|
9567 | rawAttrsMap: {},
|
9568 | parent: parent,
|
9569 | children: []
|
9570 | }
|
9571 | }
|
9572 |
|
9573 |
|
9574 |
|
9575 |
|
9576 | function parse (
|
9577 | template,
|
9578 | options
|
9579 | ) {
|
9580 | warn$2 = options.warn || baseWarn;
|
9581 |
|
9582 | platformIsPreTag = options.isPreTag || no;
|
9583 | platformMustUseProp = options.mustUseProp || no;
|
9584 | platformGetTagNamespace = options.getTagNamespace || no;
|
9585 | var isReservedTag = options.isReservedTag || no;
|
9586 | maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
9587 |
|
9588 | transforms = pluckModuleFunction(options.modules, 'transformNode');
|
9589 | preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
9590 | postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
9591 |
|
9592 | delimiters = options.delimiters;
|
9593 |
|
9594 | var stack = [];
|
9595 | var preserveWhitespace = options.preserveWhitespace !== false;
|
9596 | var whitespaceOption = options.whitespace;
|
9597 | var root;
|
9598 | var currentParent;
|
9599 | var inVPre = false;
|
9600 | var inPre = false;
|
9601 | var warned = false;
|
9602 |
|
9603 | function warnOnce (msg, range) {
|
9604 | if (!warned) {
|
9605 | warned = true;
|
9606 | warn$2(msg, range);
|
9607 | }
|
9608 | }
|
9609 |
|
9610 | function closeElement (element) {
|
9611 | trimEndingWhitespace(element);
|
9612 | if (!inVPre && !element.processed) {
|
9613 | element = processElement(element, options);
|
9614 | }
|
9615 |
|
9616 | if (!stack.length && element !== root) {
|
9617 |
|
9618 | if (root.if && (element.elseif || element.else)) {
|
9619 | if (process.env.NODE_ENV !== 'production') {
|
9620 | checkRootConstraints(element);
|
9621 | }
|
9622 | addIfCondition(root, {
|
9623 | exp: element.elseif,
|
9624 | block: element
|
9625 | });
|
9626 | } else if (process.env.NODE_ENV !== 'production') {
|
9627 | warnOnce(
|
9628 | "Component template should contain exactly one root element. " +
|
9629 | "If you are using v-if on multiple elements, " +
|
9630 | "use v-else-if to chain them instead.",
|
9631 | { start: element.start }
|
9632 | );
|
9633 | }
|
9634 | }
|
9635 | if (currentParent && !element.forbidden) {
|
9636 | if (element.elseif || element.else) {
|
9637 | processIfConditions(element, currentParent);
|
9638 | } else {
|
9639 | if (element.slotScope) {
|
9640 |
|
9641 |
|
9642 |
|
9643 | var name = element.slotTarget || '"default"'
|
9644 | ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
|
9645 | }
|
9646 | currentParent.children.push(element);
|
9647 | element.parent = currentParent;
|
9648 | }
|
9649 | }
|
9650 |
|
9651 |
|
9652 |
|
9653 | element.children = element.children.filter(function (c) { return !(c).slotScope; });
|
9654 |
|
9655 | trimEndingWhitespace(element);
|
9656 |
|
9657 |
|
9658 | if (element.pre) {
|
9659 | inVPre = false;
|
9660 | }
|
9661 | if (platformIsPreTag(element.tag)) {
|
9662 | inPre = false;
|
9663 | }
|
9664 |
|
9665 | for (var i = 0; i < postTransforms.length; i++) {
|
9666 | postTransforms[i](element, options);
|
9667 | }
|
9668 | }
|
9669 |
|
9670 | function trimEndingWhitespace (el) {
|
9671 |
|
9672 | if (!inPre) {
|
9673 | var lastNode;
|
9674 | while (
|
9675 | (lastNode = el.children[el.children.length - 1]) &&
|
9676 | lastNode.type === 3 &&
|
9677 | lastNode.text === ' '
|
9678 | ) {
|
9679 | el.children.pop();
|
9680 | }
|
9681 | }
|
9682 | }
|
9683 |
|
9684 | function checkRootConstraints (el) {
|
9685 | if (el.tag === 'slot' || el.tag === 'template') {
|
9686 | warnOnce(
|
9687 | "Cannot use <" + (el.tag) + "> as component root element because it may " +
|
9688 | 'contain multiple nodes.',
|
9689 | { start: el.start }
|
9690 | );
|
9691 | }
|
9692 | if (el.attrsMap.hasOwnProperty('v-for')) {
|
9693 | warnOnce(
|
9694 | 'Cannot use v-for on stateful component root element because ' +
|
9695 | 'it renders multiple elements.',
|
9696 | el.rawAttrsMap['v-for']
|
9697 | );
|
9698 | }
|
9699 | }
|
9700 |
|
9701 | parseHTML(template, {
|
9702 | warn: warn$2,
|
9703 | expectHTML: options.expectHTML,
|
9704 | isUnaryTag: options.isUnaryTag,
|
9705 | canBeLeftOpenTag: options.canBeLeftOpenTag,
|
9706 | shouldDecodeNewlines: options.shouldDecodeNewlines,
|
9707 | shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
9708 | shouldKeepComment: options.comments,
|
9709 | outputSourceRange: options.outputSourceRange,
|
9710 | start: function start (tag, attrs, unary, start$1) {
|
9711 |
|
9712 |
|
9713 | var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
9714 |
|
9715 |
|
9716 |
|
9717 | if (isIE && ns === 'svg') {
|
9718 | attrs = guardIESVGBug(attrs);
|
9719 | }
|
9720 |
|
9721 | var element = createASTElement(tag, attrs, currentParent);
|
9722 | if (ns) {
|
9723 | element.ns = ns;
|
9724 | }
|
9725 |
|
9726 | if (process.env.NODE_ENV !== 'production') {
|
9727 | if (options.outputSourceRange) {
|
9728 | element.start = start$1;
|
9729 | element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
9730 | cumulated[attr.name] = attr;
|
9731 | return cumulated
|
9732 | }, {});
|
9733 | }
|
9734 | attrs.forEach(function (attr) {
|
9735 | if (invalidAttributeRE.test(attr.name)) {
|
9736 | warn$2(
|
9737 | "Invalid dynamic argument expression: attribute names cannot contain " +
|
9738 | "spaces, quotes, <, >, / or =.",
|
9739 | {
|
9740 | start: attr.start + attr.name.indexOf("["),
|
9741 | end: attr.start + attr.name.length
|
9742 | }
|
9743 | );
|
9744 | }
|
9745 | });
|
9746 | }
|
9747 |
|
9748 | if (isForbiddenTag(element) && !isServerRendering()) {
|
9749 | element.forbidden = true;
|
9750 | process.env.NODE_ENV !== 'production' && warn$2(
|
9751 | 'Templates should only be responsible for mapping the state to the ' +
|
9752 | 'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
9753 | "<" + tag + ">" + ', as they will not be parsed.',
|
9754 | { start: element.start }
|
9755 | );
|
9756 | }
|
9757 |
|
9758 |
|
9759 | for (var i = 0; i < preTransforms.length; i++) {
|
9760 | element = preTransforms[i](element, options) || element;
|
9761 | }
|
9762 |
|
9763 | if (!inVPre) {
|
9764 | processPre(element);
|
9765 | if (element.pre) {
|
9766 | inVPre = true;
|
9767 | }
|
9768 | }
|
9769 | if (platformIsPreTag(element.tag)) {
|
9770 | inPre = true;
|
9771 | }
|
9772 | if (inVPre) {
|
9773 | processRawAttrs(element);
|
9774 | } else if (!element.processed) {
|
9775 |
|
9776 | processFor(element);
|
9777 | processIf(element);
|
9778 | processOnce(element);
|
9779 | }
|
9780 |
|
9781 | if (!root) {
|
9782 | root = element;
|
9783 | if (process.env.NODE_ENV !== 'production') {
|
9784 | checkRootConstraints(root);
|
9785 | }
|
9786 | }
|
9787 |
|
9788 | if (!unary) {
|
9789 | currentParent = element;
|
9790 | stack.push(element);
|
9791 | } else {
|
9792 | closeElement(element);
|
9793 | }
|
9794 | },
|
9795 |
|
9796 | end: function end (tag, start, end$1) {
|
9797 | var element = stack[stack.length - 1];
|
9798 |
|
9799 | stack.length -= 1;
|
9800 | currentParent = stack[stack.length - 1];
|
9801 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
9802 | element.end = end$1;
|
9803 | }
|
9804 | closeElement(element);
|
9805 | },
|
9806 |
|
9807 | chars: function chars (text, start, end) {
|
9808 | if (!currentParent) {
|
9809 | if (process.env.NODE_ENV !== 'production') {
|
9810 | if (text === template) {
|
9811 | warnOnce(
|
9812 | 'Component template requires a root element, rather than just text.',
|
9813 | { start: start }
|
9814 | );
|
9815 | } else if ((text = text.trim())) {
|
9816 | warnOnce(
|
9817 | ("text \"" + text + "\" outside root element will be ignored."),
|
9818 | { start: start }
|
9819 | );
|
9820 | }
|
9821 | }
|
9822 | return
|
9823 | }
|
9824 |
|
9825 |
|
9826 | if (isIE &&
|
9827 | currentParent.tag === 'textarea' &&
|
9828 | currentParent.attrsMap.placeholder === text
|
9829 | ) {
|
9830 | return
|
9831 | }
|
9832 | var children = currentParent.children;
|
9833 | if (inPre || text.trim()) {
|
9834 | text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
|
9835 | } else if (!children.length) {
|
9836 |
|
9837 | text = '';
|
9838 | } else if (whitespaceOption) {
|
9839 | if (whitespaceOption === 'condense') {
|
9840 |
|
9841 |
|
9842 | text = lineBreakRE.test(text) ? '' : ' ';
|
9843 | } else {
|
9844 | text = ' ';
|
9845 | }
|
9846 | } else {
|
9847 | text = preserveWhitespace ? ' ' : '';
|
9848 | }
|
9849 | if (text) {
|
9850 | if (whitespaceOption === 'condense') {
|
9851 |
|
9852 | text = text.replace(whitespaceRE$1, ' ');
|
9853 | }
|
9854 | var res;
|
9855 | var child;
|
9856 | if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
9857 | child = {
|
9858 | type: 2,
|
9859 | expression: res.expression,
|
9860 | tokens: res.tokens,
|
9861 | text: text
|
9862 | };
|
9863 | } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
|
9864 | child = {
|
9865 | type: 3,
|
9866 | text: text
|
9867 | };
|
9868 | }
|
9869 | if (child) {
|
9870 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
9871 | child.start = start;
|
9872 | child.end = end;
|
9873 | }
|
9874 | children.push(child);
|
9875 | }
|
9876 | }
|
9877 | },
|
9878 | comment: function comment (text, start, end) {
|
9879 |
|
9880 |
|
9881 | if (currentParent) {
|
9882 | var child = {
|
9883 | type: 3,
|
9884 | text: text,
|
9885 | isComment: true
|
9886 | };
|
9887 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
9888 | child.start = start;
|
9889 | child.end = end;
|
9890 | }
|
9891 | currentParent.children.push(child);
|
9892 | }
|
9893 | }
|
9894 | });
|
9895 | return root
|
9896 | }
|
9897 |
|
9898 | function processPre (el) {
|
9899 | if (getAndRemoveAttr(el, 'v-pre') != null) {
|
9900 | el.pre = true;
|
9901 | }
|
9902 | }
|
9903 |
|
9904 | function processRawAttrs (el) {
|
9905 | var list = el.attrsList;
|
9906 | var len = list.length;
|
9907 | if (len) {
|
9908 | var attrs = el.attrs = new Array(len);
|
9909 | for (var i = 0; i < len; i++) {
|
9910 | attrs[i] = {
|
9911 | name: list[i].name,
|
9912 | value: JSON.stringify(list[i].value)
|
9913 | };
|
9914 | if (list[i].start != null) {
|
9915 | attrs[i].start = list[i].start;
|
9916 | attrs[i].end = list[i].end;
|
9917 | }
|
9918 | }
|
9919 | } else if (!el.pre) {
|
9920 |
|
9921 | el.plain = true;
|
9922 | }
|
9923 | }
|
9924 |
|
9925 | function processElement (
|
9926 | element,
|
9927 | options
|
9928 | ) {
|
9929 | processKey(element);
|
9930 |
|
9931 |
|
9932 |
|
9933 | element.plain = (
|
9934 | !element.key &&
|
9935 | !element.scopedSlots &&
|
9936 | !element.attrsList.length
|
9937 | );
|
9938 |
|
9939 | processRef(element);
|
9940 | processSlotContent(element);
|
9941 | processSlotOutlet(element);
|
9942 | processComponent(element);
|
9943 | for (var i = 0; i < transforms.length; i++) {
|
9944 | element = transforms[i](element, options) || element;
|
9945 | }
|
9946 | processAttrs(element);
|
9947 | return element
|
9948 | }
|
9949 |
|
9950 | function processKey (el) {
|
9951 | var exp = getBindingAttr(el, 'key');
|
9952 | if (exp) {
|
9953 | if (process.env.NODE_ENV !== 'production') {
|
9954 | if (el.tag === 'template') {
|
9955 | warn$2(
|
9956 | "<template> cannot be keyed. Place the key on real elements instead.",
|
9957 | getRawBindingAttr(el, 'key')
|
9958 | );
|
9959 | }
|
9960 | if (el.for) {
|
9961 | var iterator = el.iterator2 || el.iterator1;
|
9962 | var parent = el.parent;
|
9963 | if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
9964 | warn$2(
|
9965 | "Do not use v-for index as key on <transition-group> children, " +
|
9966 | "this is the same as not using keys.",
|
9967 | getRawBindingAttr(el, 'key'),
|
9968 | true
|
9969 | );
|
9970 | }
|
9971 | }
|
9972 | }
|
9973 | el.key = exp;
|
9974 | }
|
9975 | }
|
9976 |
|
9977 | function processRef (el) {
|
9978 | var ref = getBindingAttr(el, 'ref');
|
9979 | if (ref) {
|
9980 | el.ref = ref;
|
9981 | el.refInFor = checkInFor(el);
|
9982 | }
|
9983 | }
|
9984 |
|
9985 | function processFor (el) {
|
9986 | var exp;
|
9987 | if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
9988 | var res = parseFor(exp);
|
9989 | if (res) {
|
9990 | extend(el, res);
|
9991 | } else if (process.env.NODE_ENV !== 'production') {
|
9992 | warn$2(
|
9993 | ("Invalid v-for expression: " + exp),
|
9994 | el.rawAttrsMap['v-for']
|
9995 | );
|
9996 | }
|
9997 | }
|
9998 | }
|
9999 |
|
10000 |
|
10001 |
|
10002 | function parseFor (exp) {
|
10003 | var inMatch = exp.match(forAliasRE);
|
10004 | if (!inMatch) { return }
|
10005 | var res = {};
|
10006 | res.for = inMatch[2].trim();
|
10007 | var alias = inMatch[1].trim().replace(stripParensRE, '');
|
10008 | var iteratorMatch = alias.match(forIteratorRE);
|
10009 | if (iteratorMatch) {
|
10010 | res.alias = alias.replace(forIteratorRE, '').trim();
|
10011 | res.iterator1 = iteratorMatch[1].trim();
|
10012 | if (iteratorMatch[2]) {
|
10013 | res.iterator2 = iteratorMatch[2].trim();
|
10014 | }
|
10015 | } else {
|
10016 | res.alias = alias;
|
10017 | }
|
10018 | return res
|
10019 | }
|
10020 |
|
10021 | function processIf (el) {
|
10022 | var exp = getAndRemoveAttr(el, 'v-if');
|
10023 | if (exp) {
|
10024 | el.if = exp;
|
10025 | addIfCondition(el, {
|
10026 | exp: exp,
|
10027 | block: el
|
10028 | });
|
10029 | } else {
|
10030 | if (getAndRemoveAttr(el, 'v-else') != null) {
|
10031 | el.else = true;
|
10032 | }
|
10033 | var elseif = getAndRemoveAttr(el, 'v-else-if');
|
10034 | if (elseif) {
|
10035 | el.elseif = elseif;
|
10036 | }
|
10037 | }
|
10038 | }
|
10039 |
|
10040 | function processIfConditions (el, parent) {
|
10041 | var prev = findPrevElement(parent.children);
|
10042 | if (prev && prev.if) {
|
10043 | addIfCondition(prev, {
|
10044 | exp: el.elseif,
|
10045 | block: el
|
10046 | });
|
10047 | } else if (process.env.NODE_ENV !== 'production') {
|
10048 | warn$2(
|
10049 | "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
|
10050 | "used on element <" + (el.tag) + "> without corresponding v-if.",
|
10051 | el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
|
10052 | );
|
10053 | }
|
10054 | }
|
10055 |
|
10056 | function findPrevElement (children) {
|
10057 | var i = children.length;
|
10058 | while (i--) {
|
10059 | if (children[i].type === 1) {
|
10060 | return children[i]
|
10061 | } else {
|
10062 | if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
|
10063 | warn$2(
|
10064 | "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
10065 | "will be ignored.",
|
10066 | children[i]
|
10067 | );
|
10068 | }
|
10069 | children.pop();
|
10070 | }
|
10071 | }
|
10072 | }
|
10073 |
|
10074 | function addIfCondition (el, condition) {
|
10075 | if (!el.ifConditions) {
|
10076 | el.ifConditions = [];
|
10077 | }
|
10078 | el.ifConditions.push(condition);
|
10079 | }
|
10080 |
|
10081 | function processOnce (el) {
|
10082 | var once$$1 = getAndRemoveAttr(el, 'v-once');
|
10083 | if (once$$1 != null) {
|
10084 | el.once = true;
|
10085 | }
|
10086 | }
|
10087 |
|
10088 |
|
10089 |
|
10090 | function processSlotContent (el) {
|
10091 | var slotScope;
|
10092 | if (el.tag === 'template') {
|
10093 | slotScope = getAndRemoveAttr(el, 'scope');
|
10094 |
|
10095 | if (process.env.NODE_ENV !== 'production' && slotScope) {
|
10096 | warn$2(
|
10097 | "the \"scope\" attribute for scoped slots have been deprecated and " +
|
10098 | "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
10099 | "can also be used on plain elements in addition to <template> to " +
|
10100 | "denote scoped slots.",
|
10101 | el.rawAttrsMap['scope'],
|
10102 | true
|
10103 | );
|
10104 | }
|
10105 | el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
10106 | } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
10107 |
|
10108 | if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
|
10109 | warn$2(
|
10110 | "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
10111 | "(v-for takes higher priority). Use a wrapper <template> for the " +
|
10112 | "scoped slot to make it clearer.",
|
10113 | el.rawAttrsMap['slot-scope'],
|
10114 | true
|
10115 | );
|
10116 | }
|
10117 | el.slotScope = slotScope;
|
10118 | }
|
10119 |
|
10120 |
|
10121 | var slotTarget = getBindingAttr(el, 'slot');
|
10122 | if (slotTarget) {
|
10123 | el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
10124 | el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
10125 |
|
10126 |
|
10127 | if (el.tag !== 'template' && !el.slotScope) {
|
10128 | addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
10129 | }
|
10130 | }
|
10131 |
|
10132 |
|
10133 | {
|
10134 | if (el.tag === 'template') {
|
10135 |
|
10136 | var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
10137 | if (slotBinding) {
|
10138 | if (process.env.NODE_ENV !== 'production') {
|
10139 | if (el.slotTarget || el.slotScope) {
|
10140 | warn$2(
|
10141 | "Unexpected mixed usage of different slot syntaxes.",
|
10142 | el
|
10143 | );
|
10144 | }
|
10145 | if (el.parent && !maybeComponent(el.parent)) {
|
10146 | warn$2(
|
10147 | "<template v-slot> can only appear at the root level inside " +
|
10148 | "the receiving the component",
|
10149 | el
|
10150 | );
|
10151 | }
|
10152 | }
|
10153 | var ref = getSlotName(slotBinding);
|
10154 | var name = ref.name;
|
10155 | var dynamic = ref.dynamic;
|
10156 | el.slotTarget = name;
|
10157 | el.slotTargetDynamic = dynamic;
|
10158 | el.slotScope = slotBinding.value || emptySlotScopeToken;
|
10159 | }
|
10160 | } else {
|
10161 |
|
10162 | var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
10163 | if (slotBinding$1) {
|
10164 | if (process.env.NODE_ENV !== 'production') {
|
10165 | if (!maybeComponent(el)) {
|
10166 | warn$2(
|
10167 | "v-slot can only be used on components or <template>.",
|
10168 | slotBinding$1
|
10169 | );
|
10170 | }
|
10171 | if (el.slotScope || el.slotTarget) {
|
10172 | warn$2(
|
10173 | "Unexpected mixed usage of different slot syntaxes.",
|
10174 | el
|
10175 | );
|
10176 | }
|
10177 | if (el.scopedSlots) {
|
10178 | warn$2(
|
10179 | "To avoid scope ambiguity, the default slot should also use " +
|
10180 | "<template> syntax when there are other named slots.",
|
10181 | slotBinding$1
|
10182 | );
|
10183 | }
|
10184 | }
|
10185 |
|
10186 | var slots = el.scopedSlots || (el.scopedSlots = {});
|
10187 | var ref$1 = getSlotName(slotBinding$1);
|
10188 | var name$1 = ref$1.name;
|
10189 | var dynamic$1 = ref$1.dynamic;
|
10190 | var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
10191 | slotContainer.slotTarget = name$1;
|
10192 | slotContainer.slotTargetDynamic = dynamic$1;
|
10193 | slotContainer.children = el.children.filter(function (c) {
|
10194 | if (!c.slotScope) {
|
10195 | c.parent = slotContainer;
|
10196 | return true
|
10197 | }
|
10198 | });
|
10199 | slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
|
10200 |
|
10201 | el.children = [];
|
10202 |
|
10203 | el.plain = false;
|
10204 | }
|
10205 | }
|
10206 | }
|
10207 | }
|
10208 |
|
10209 | function getSlotName (binding) {
|
10210 | var name = binding.name.replace(slotRE, '');
|
10211 | if (!name) {
|
10212 | if (binding.name[0] !== '#') {
|
10213 | name = 'default';
|
10214 | } else if (process.env.NODE_ENV !== 'production') {
|
10215 | warn$2(
|
10216 | "v-slot shorthand syntax requires a slot name.",
|
10217 | binding
|
10218 | );
|
10219 | }
|
10220 | }
|
10221 | return dynamicArgRE.test(name)
|
10222 |
|
10223 | ? { name: name.slice(1, -1), dynamic: true }
|
10224 |
|
10225 | : { name: ("\"" + name + "\""), dynamic: false }
|
10226 | }
|
10227 |
|
10228 |
|
10229 | function processSlotOutlet (el) {
|
10230 | if (el.tag === 'slot') {
|
10231 | el.slotName = getBindingAttr(el, 'name');
|
10232 | if (process.env.NODE_ENV !== 'production' && el.key) {
|
10233 | warn$2(
|
10234 | "`key` does not work on <slot> because slots are abstract outlets " +
|
10235 | "and can possibly expand into multiple elements. " +
|
10236 | "Use the key on a wrapping element instead.",
|
10237 | getRawBindingAttr(el, 'key')
|
10238 | );
|
10239 | }
|
10240 | }
|
10241 | }
|
10242 |
|
10243 | function processComponent (el) {
|
10244 | var binding;
|
10245 | if ((binding = getBindingAttr(el, 'is'))) {
|
10246 | el.component = binding;
|
10247 | }
|
10248 | if (getAndRemoveAttr(el, 'inline-template') != null) {
|
10249 | el.inlineTemplate = true;
|
10250 | }
|
10251 | }
|
10252 |
|
10253 | function processAttrs (el) {
|
10254 | var list = el.attrsList;
|
10255 | var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
10256 | for (i = 0, l = list.length; i < l; i++) {
|
10257 | name = rawName = list[i].name;
|
10258 | value = list[i].value;
|
10259 | if (dirRE.test(name)) {
|
10260 |
|
10261 | el.hasBindings = true;
|
10262 |
|
10263 | modifiers = parseModifiers(name.replace(dirRE, ''));
|
10264 |
|
10265 | if (modifiers) {
|
10266 | name = name.replace(modifierRE, '');
|
10267 | }
|
10268 | if (bindRE.test(name)) {
|
10269 | name = name.replace(bindRE, '');
|
10270 | value = parseFilters(value);
|
10271 | isDynamic = dynamicArgRE.test(name);
|
10272 | if (isDynamic) {
|
10273 | name = name.slice(1, -1);
|
10274 | }
|
10275 | if (
|
10276 | process.env.NODE_ENV !== 'production' &&
|
10277 | value.trim().length === 0
|
10278 | ) {
|
10279 | warn$2(
|
10280 | ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
|
10281 | );
|
10282 | }
|
10283 | if (modifiers) {
|
10284 | if (modifiers.prop && !isDynamic) {
|
10285 | name = camelize(name);
|
10286 | if (name === 'innerHtml') { name = 'innerHTML'; }
|
10287 | }
|
10288 | if (modifiers.camel && !isDynamic) {
|
10289 | name = camelize(name);
|
10290 | }
|
10291 | if (modifiers.sync) {
|
10292 | syncGen = genAssignmentCode(value, "$event");
|
10293 | if (!isDynamic) {
|
10294 | addHandler(
|
10295 | el,
|
10296 | ("update:" + (camelize(name))),
|
10297 | syncGen,
|
10298 | null,
|
10299 | false,
|
10300 | warn$2,
|
10301 | list[i]
|
10302 | );
|
10303 | if (hyphenate(name) !== camelize(name)) {
|
10304 | addHandler(
|
10305 | el,
|
10306 | ("update:" + (hyphenate(name))),
|
10307 | syncGen,
|
10308 | null,
|
10309 | false,
|
10310 | warn$2,
|
10311 | list[i]
|
10312 | );
|
10313 | }
|
10314 | } else {
|
10315 |
|
10316 | addHandler(
|
10317 | el,
|
10318 | ("\"update:\"+(" + name + ")"),
|
10319 | syncGen,
|
10320 | null,
|
10321 | false,
|
10322 | warn$2,
|
10323 | list[i],
|
10324 | true
|
10325 | );
|
10326 | }
|
10327 | }
|
10328 | }
|
10329 | if ((modifiers && modifiers.prop) || (
|
10330 | !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
10331 | )) {
|
10332 | addProp(el, name, value, list[i], isDynamic);
|
10333 | } else {
|
10334 | addAttr(el, name, value, list[i], isDynamic);
|
10335 | }
|
10336 | } else if (onRE.test(name)) {
|
10337 | name = name.replace(onRE, '');
|
10338 | isDynamic = dynamicArgRE.test(name);
|
10339 | if (isDynamic) {
|
10340 | name = name.slice(1, -1);
|
10341 | }
|
10342 | addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
10343 | } else {
|
10344 | name = name.replace(dirRE, '');
|
10345 |
|
10346 | var argMatch = name.match(argRE);
|
10347 | var arg = argMatch && argMatch[1];
|
10348 | isDynamic = false;
|
10349 | if (arg) {
|
10350 | name = name.slice(0, -(arg.length + 1));
|
10351 | if (dynamicArgRE.test(arg)) {
|
10352 | arg = arg.slice(1, -1);
|
10353 | isDynamic = true;
|
10354 | }
|
10355 | }
|
10356 | addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
10357 | if (process.env.NODE_ENV !== 'production' && name === 'model') {
|
10358 | checkForAliasModel(el, value);
|
10359 | }
|
10360 | }
|
10361 | } else {
|
10362 |
|
10363 | if (process.env.NODE_ENV !== 'production') {
|
10364 | var res = parseText(value, delimiters);
|
10365 | if (res) {
|
10366 | warn$2(
|
10367 | name + "=\"" + value + "\": " +
|
10368 | 'Interpolation inside attributes has been removed. ' +
|
10369 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
10370 | 'instead of <div id="{{ val }}">, use <div :id="val">.',
|
10371 | list[i]
|
10372 | );
|
10373 | }
|
10374 | }
|
10375 | addAttr(el, name, JSON.stringify(value), list[i]);
|
10376 |
|
10377 |
|
10378 | if (!el.component &&
|
10379 | name === 'muted' &&
|
10380 | platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
10381 | addProp(el, name, 'true', list[i]);
|
10382 | }
|
10383 | }
|
10384 | }
|
10385 | }
|
10386 |
|
10387 | function checkInFor (el) {
|
10388 | var parent = el;
|
10389 | while (parent) {
|
10390 | if (parent.for !== undefined) {
|
10391 | return true
|
10392 | }
|
10393 | parent = parent.parent;
|
10394 | }
|
10395 | return false
|
10396 | }
|
10397 |
|
10398 | function parseModifiers (name) {
|
10399 | var match = name.match(modifierRE);
|
10400 | if (match) {
|
10401 | var ret = {};
|
10402 | match.forEach(function (m) { ret[m.slice(1)] = true; });
|
10403 | return ret
|
10404 | }
|
10405 | }
|
10406 |
|
10407 | function makeAttrsMap (attrs) {
|
10408 | var map = {};
|
10409 | for (var i = 0, l = attrs.length; i < l; i++) {
|
10410 | if (
|
10411 | process.env.NODE_ENV !== 'production' &&
|
10412 | map[attrs[i].name] && !isIE && !isEdge
|
10413 | ) {
|
10414 | warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
10415 | }
|
10416 | map[attrs[i].name] = attrs[i].value;
|
10417 | }
|
10418 | return map
|
10419 | }
|
10420 |
|
10421 |
|
10422 | function isTextTag (el) {
|
10423 | return el.tag === 'script' || el.tag === 'style'
|
10424 | }
|
10425 |
|
10426 | function isForbiddenTag (el) {
|
10427 | return (
|
10428 | el.tag === 'style' ||
|
10429 | (el.tag === 'script' && (
|
10430 | !el.attrsMap.type ||
|
10431 | el.attrsMap.type === 'text/javascript'
|
10432 | ))
|
10433 | )
|
10434 | }
|
10435 |
|
10436 | var ieNSBug = /^xmlns:NS\d+/;
|
10437 | var ieNSPrefix = /^NS\d+:/;
|
10438 |
|
10439 |
|
10440 | function guardIESVGBug (attrs) {
|
10441 | var res = [];
|
10442 | for (var i = 0; i < attrs.length; i++) {
|
10443 | var attr = attrs[i];
|
10444 | if (!ieNSBug.test(attr.name)) {
|
10445 | attr.name = attr.name.replace(ieNSPrefix, '');
|
10446 | res.push(attr);
|
10447 | }
|
10448 | }
|
10449 | return res
|
10450 | }
|
10451 |
|
10452 | function checkForAliasModel (el, value) {
|
10453 | var _el = el;
|
10454 | while (_el) {
|
10455 | if (_el.for && _el.alias === value) {
|
10456 | warn$2(
|
10457 | "<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
10458 | "You are binding v-model directly to a v-for iteration alias. " +
|
10459 | "This will not be able to modify the v-for source array because " +
|
10460 | "writing to the alias is like modifying a function local variable. " +
|
10461 | "Consider using an array of objects and use v-model on an object property instead.",
|
10462 | el.rawAttrsMap['v-model']
|
10463 | );
|
10464 | }
|
10465 | _el = _el.parent;
|
10466 | }
|
10467 | }
|
10468 |
|
10469 |
|
10470 |
|
10471 | function preTransformNode (el, options) {
|
10472 | if (el.tag === 'input') {
|
10473 | var map = el.attrsMap;
|
10474 | if (!map['v-model']) {
|
10475 | return
|
10476 | }
|
10477 |
|
10478 | var typeBinding;
|
10479 | if (map[':type'] || map['v-bind:type']) {
|
10480 | typeBinding = getBindingAttr(el, 'type');
|
10481 | }
|
10482 | if (!map.type && !typeBinding && map['v-bind']) {
|
10483 | typeBinding = "(" + (map['v-bind']) + ").type";
|
10484 | }
|
10485 |
|
10486 | if (typeBinding) {
|
10487 | var ifCondition = getAndRemoveAttr(el, 'v-if', true);
|
10488 | var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
|
10489 | var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
|
10490 | var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
|
10491 |
|
10492 | var branch0 = cloneASTElement(el);
|
10493 |
|
10494 | processFor(branch0);
|
10495 | addRawAttr(branch0, 'type', 'checkbox');
|
10496 | processElement(branch0, options);
|
10497 | branch0.processed = true;
|
10498 | branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
|
10499 | addIfCondition(branch0, {
|
10500 | exp: branch0.if,
|
10501 | block: branch0
|
10502 | });
|
10503 |
|
10504 | var branch1 = cloneASTElement(el);
|
10505 | getAndRemoveAttr(branch1, 'v-for', true);
|
10506 | addRawAttr(branch1, 'type', 'radio');
|
10507 | processElement(branch1, options);
|
10508 | addIfCondition(branch0, {
|
10509 | exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
|
10510 | block: branch1
|
10511 | });
|
10512 |
|
10513 | var branch2 = cloneASTElement(el);
|
10514 | getAndRemoveAttr(branch2, 'v-for', true);
|
10515 | addRawAttr(branch2, ':type', typeBinding);
|
10516 | processElement(branch2, options);
|
10517 | addIfCondition(branch0, {
|
10518 | exp: ifCondition,
|
10519 | block: branch2
|
10520 | });
|
10521 |
|
10522 | if (hasElse) {
|
10523 | branch0.else = true;
|
10524 | } else if (elseIfCondition) {
|
10525 | branch0.elseif = elseIfCondition;
|
10526 | }
|
10527 |
|
10528 | return branch0
|
10529 | }
|
10530 | }
|
10531 | }
|
10532 |
|
10533 | function cloneASTElement (el) {
|
10534 | return createASTElement(el.tag, el.attrsList.slice(), el.parent)
|
10535 | }
|
10536 |
|
10537 | var model$1 = {
|
10538 | preTransformNode: preTransformNode
|
10539 | };
|
10540 |
|
10541 | var modules$1 = [
|
10542 | klass$1,
|
10543 | style$1,
|
10544 | model$1
|
10545 | ];
|
10546 |
|
10547 |
|
10548 |
|
10549 | function text (el, dir) {
|
10550 | if (dir.value) {
|
10551 | addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
|
10552 | }
|
10553 | }
|
10554 |
|
10555 |
|
10556 |
|
10557 | function html (el, dir) {
|
10558 | if (dir.value) {
|
10559 | addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
|
10560 | }
|
10561 | }
|
10562 |
|
10563 | var directives$1 = {
|
10564 | model: model,
|
10565 | text: text,
|
10566 | html: html
|
10567 | };
|
10568 |
|
10569 |
|
10570 |
|
10571 | var baseOptions = {
|
10572 | expectHTML: true,
|
10573 | modules: modules$1,
|
10574 | directives: directives$1,
|
10575 | isPreTag: isPreTag,
|
10576 | isUnaryTag: isUnaryTag,
|
10577 | mustUseProp: mustUseProp,
|
10578 | canBeLeftOpenTag: canBeLeftOpenTag,
|
10579 | isReservedTag: isReservedTag,
|
10580 | getTagNamespace: getTagNamespace,
|
10581 | staticKeys: genStaticKeys(modules$1)
|
10582 | };
|
10583 |
|
10584 |
|
10585 |
|
10586 | var isStaticKey;
|
10587 | var isPlatformReservedTag;
|
10588 |
|
10589 | var genStaticKeysCached = cached(genStaticKeys$1);
|
10590 |
|
10591 |
|
10592 |
|
10593 |
|
10594 |
|
10595 |
|
10596 |
|
10597 |
|
10598 |
|
10599 |
|
10600 |
|
10601 |
|
10602 | function optimize (root, options) {
|
10603 | if (!root) { return }
|
10604 | isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
10605 | isPlatformReservedTag = options.isReservedTag || no;
|
10606 |
|
10607 | markStatic$1(root);
|
10608 |
|
10609 | markStaticRoots(root, false);
|
10610 | }
|
10611 |
|
10612 | function genStaticKeys$1 (keys) {
|
10613 | return makeMap(
|
10614 | 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
10615 | (keys ? ',' + keys : '')
|
10616 | )
|
10617 | }
|
10618 |
|
10619 | function markStatic$1 (node) {
|
10620 | node.static = isStatic(node);
|
10621 | if (node.type === 1) {
|
10622 |
|
10623 |
|
10624 |
|
10625 | if (
|
10626 | !isPlatformReservedTag(node.tag) &&
|
10627 | node.tag !== 'slot' &&
|
10628 | node.attrsMap['inline-template'] == null
|
10629 | ) {
|
10630 | return
|
10631 | }
|
10632 | for (var i = 0, l = node.children.length; i < l; i++) {
|
10633 | var child = node.children[i];
|
10634 | markStatic$1(child);
|
10635 | if (!child.static) {
|
10636 | node.static = false;
|
10637 | }
|
10638 | }
|
10639 | if (node.ifConditions) {
|
10640 | for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10641 | var block = node.ifConditions[i$1].block;
|
10642 | markStatic$1(block);
|
10643 | if (!block.static) {
|
10644 | node.static = false;
|
10645 | }
|
10646 | }
|
10647 | }
|
10648 | }
|
10649 | }
|
10650 |
|
10651 | function markStaticRoots (node, isInFor) {
|
10652 | if (node.type === 1) {
|
10653 | if (node.static || node.once) {
|
10654 | node.staticInFor = isInFor;
|
10655 | }
|
10656 |
|
10657 |
|
10658 |
|
10659 | if (node.static && node.children.length && !(
|
10660 | node.children.length === 1 &&
|
10661 | node.children[0].type === 3
|
10662 | )) {
|
10663 | node.staticRoot = true;
|
10664 | return
|
10665 | } else {
|
10666 | node.staticRoot = false;
|
10667 | }
|
10668 | if (node.children) {
|
10669 | for (var i = 0, l = node.children.length; i < l; i++) {
|
10670 | markStaticRoots(node.children[i], isInFor || !!node.for);
|
10671 | }
|
10672 | }
|
10673 | if (node.ifConditions) {
|
10674 | for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10675 | markStaticRoots(node.ifConditions[i$1].block, isInFor);
|
10676 | }
|
10677 | }
|
10678 | }
|
10679 | }
|
10680 |
|
10681 | function isStatic (node) {
|
10682 | if (node.type === 2) {
|
10683 | return false
|
10684 | }
|
10685 | if (node.type === 3) {
|
10686 | return true
|
10687 | }
|
10688 | return !!(node.pre || (
|
10689 | !node.hasBindings &&
|
10690 | !node.if && !node.for &&
|
10691 | !isBuiltInTag(node.tag) &&
|
10692 | isPlatformReservedTag(node.tag) &&
|
10693 | !isDirectChildOfTemplateFor(node) &&
|
10694 | Object.keys(node).every(isStaticKey)
|
10695 | ))
|
10696 | }
|
10697 |
|
10698 | function isDirectChildOfTemplateFor (node) {
|
10699 | while (node.parent) {
|
10700 | node = node.parent;
|
10701 | if (node.tag !== 'template') {
|
10702 | return false
|
10703 | }
|
10704 | if (node.for) {
|
10705 | return true
|
10706 | }
|
10707 | }
|
10708 | return false
|
10709 | }
|
10710 |
|
10711 |
|
10712 |
|
10713 | var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
|
10714 | var fnInvokeRE = /\([^)]*?\);*$/;
|
10715 | var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
10716 |
|
10717 |
|
10718 | var keyCodes = {
|
10719 | esc: 27,
|
10720 | tab: 9,
|
10721 | enter: 13,
|
10722 | space: 32,
|
10723 | up: 38,
|
10724 | left: 37,
|
10725 | right: 39,
|
10726 | down: 40,
|
10727 | 'delete': [8, 46]
|
10728 | };
|
10729 |
|
10730 |
|
10731 | var keyNames = {
|
10732 |
|
10733 | esc: ['Esc', 'Escape'],
|
10734 | tab: 'Tab',
|
10735 | enter: 'Enter',
|
10736 |
|
10737 | space: [' ', 'Spacebar'],
|
10738 |
|
10739 | up: ['Up', 'ArrowUp'],
|
10740 | left: ['Left', 'ArrowLeft'],
|
10741 | right: ['Right', 'ArrowRight'],
|
10742 | down: ['Down', 'ArrowDown'],
|
10743 |
|
10744 | 'delete': ['Backspace', 'Delete', 'Del']
|
10745 | };
|
10746 |
|
10747 |
|
10748 |
|
10749 |
|
10750 | var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
|
10751 |
|
10752 | var modifierCode = {
|
10753 | stop: '$event.stopPropagation();',
|
10754 | prevent: '$event.preventDefault();',
|
10755 | self: genGuard("$event.target !== $event.currentTarget"),
|
10756 | ctrl: genGuard("!$event.ctrlKey"),
|
10757 | shift: genGuard("!$event.shiftKey"),
|
10758 | alt: genGuard("!$event.altKey"),
|
10759 | meta: genGuard("!$event.metaKey"),
|
10760 | left: genGuard("'button' in $event && $event.button !== 0"),
|
10761 | middle: genGuard("'button' in $event && $event.button !== 1"),
|
10762 | right: genGuard("'button' in $event && $event.button !== 2")
|
10763 | };
|
10764 |
|
10765 | function genHandlers (
|
10766 | events,
|
10767 | isNative
|
10768 | ) {
|
10769 | var prefix = isNative ? 'nativeOn:' : 'on:';
|
10770 | var staticHandlers = "";
|
10771 | var dynamicHandlers = "";
|
10772 | for (var name in events) {
|
10773 | var handlerCode = genHandler(events[name]);
|
10774 | if (events[name] && events[name].dynamic) {
|
10775 | dynamicHandlers += name + "," + handlerCode + ",";
|
10776 | } else {
|
10777 | staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
10778 | }
|
10779 | }
|
10780 | staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
10781 | if (dynamicHandlers) {
|
10782 | return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
10783 | } else {
|
10784 | return prefix + staticHandlers
|
10785 | }
|
10786 | }
|
10787 |
|
10788 | function genHandler (handler) {
|
10789 | if (!handler) {
|
10790 | return 'function(){}'
|
10791 | }
|
10792 |
|
10793 | if (Array.isArray(handler)) {
|
10794 | return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
10795 | }
|
10796 |
|
10797 | var isMethodPath = simplePathRE.test(handler.value);
|
10798 | var isFunctionExpression = fnExpRE.test(handler.value);
|
10799 | var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
|
10800 |
|
10801 | if (!handler.modifiers) {
|
10802 | if (isMethodPath || isFunctionExpression) {
|
10803 | return handler.value
|
10804 | }
|
10805 | return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}")
|
10806 | } else {
|
10807 | var code = '';
|
10808 | var genModifierCode = '';
|
10809 | var keys = [];
|
10810 | for (var key in handler.modifiers) {
|
10811 | if (modifierCode[key]) {
|
10812 | genModifierCode += modifierCode[key];
|
10813 |
|
10814 | if (keyCodes[key]) {
|
10815 | keys.push(key);
|
10816 | }
|
10817 | } else if (key === 'exact') {
|
10818 | var modifiers = (handler.modifiers);
|
10819 | genModifierCode += genGuard(
|
10820 | ['ctrl', 'shift', 'alt', 'meta']
|
10821 | .filter(function (keyModifier) { return !modifiers[keyModifier]; })
|
10822 | .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
|
10823 | .join('||')
|
10824 | );
|
10825 | } else {
|
10826 | keys.push(key);
|
10827 | }
|
10828 | }
|
10829 | if (keys.length) {
|
10830 | code += genKeyFilter(keys);
|
10831 | }
|
10832 |
|
10833 | if (genModifierCode) {
|
10834 | code += genModifierCode;
|
10835 | }
|
10836 | var handlerCode = isMethodPath
|
10837 | ? ("return " + (handler.value) + "($event)")
|
10838 | : isFunctionExpression
|
10839 | ? ("return (" + (handler.value) + ")($event)")
|
10840 | : isFunctionInvocation
|
10841 | ? ("return " + (handler.value))
|
10842 | : handler.value;
|
10843 | return ("function($event){" + code + handlerCode + "}")
|
10844 | }
|
10845 | }
|
10846 |
|
10847 | function genKeyFilter (keys) {
|
10848 | return (
|
10849 |
|
10850 |
|
10851 |
|
10852 | "if(!$event.type.indexOf('key')&&" +
|
10853 | (keys.map(genFilterCode).join('&&')) + ")return null;"
|
10854 | )
|
10855 | }
|
10856 |
|
10857 | function genFilterCode (key) {
|
10858 | var keyVal = parseInt(key, 10);
|
10859 | if (keyVal) {
|
10860 | return ("$event.keyCode!==" + keyVal)
|
10861 | }
|
10862 | var keyCode = keyCodes[key];
|
10863 | var keyName = keyNames[key];
|
10864 | return (
|
10865 | "_k($event.keyCode," +
|
10866 | (JSON.stringify(key)) + "," +
|
10867 | (JSON.stringify(keyCode)) + "," +
|
10868 | "$event.key," +
|
10869 | "" + (JSON.stringify(keyName)) +
|
10870 | ")"
|
10871 | )
|
10872 | }
|
10873 |
|
10874 |
|
10875 |
|
10876 | function on (el, dir) {
|
10877 | if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
|
10878 | warn("v-on without argument does not support modifiers.");
|
10879 | }
|
10880 | el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
|
10881 | }
|
10882 |
|
10883 |
|
10884 |
|
10885 | function bind$1 (el, dir) {
|
10886 | el.wrapData = function (code) {
|
10887 | return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
|
10888 | };
|
10889 | }
|
10890 |
|
10891 |
|
10892 |
|
10893 | var baseDirectives = {
|
10894 | on: on,
|
10895 | bind: bind$1,
|
10896 | cloak: noop
|
10897 | };
|
10898 |
|
10899 |
|
10900 |
|
10901 |
|
10902 |
|
10903 |
|
10904 |
|
10905 | var CodegenState = function CodegenState (options) {
|
10906 | this.options = options;
|
10907 | this.warn = options.warn || baseWarn;
|
10908 | this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
10909 | this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
10910 | this.directives = extend(extend({}, baseDirectives), options.directives);
|
10911 | var isReservedTag = options.isReservedTag || no;
|
10912 | this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
10913 | this.onceId = 0;
|
10914 | this.staticRenderFns = [];
|
10915 | this.pre = false;
|
10916 | };
|
10917 |
|
10918 |
|
10919 |
|
10920 | function generate (
|
10921 | ast,
|
10922 | options
|
10923 | ) {
|
10924 | var state = new CodegenState(options);
|
10925 | var code = ast ? genElement(ast, state) : '_c("div")';
|
10926 | return {
|
10927 | render: ("with(this){return " + code + "}"),
|
10928 | staticRenderFns: state.staticRenderFns
|
10929 | }
|
10930 | }
|
10931 |
|
10932 | function genElement (el, state) {
|
10933 | if (el.parent) {
|
10934 | el.pre = el.pre || el.parent.pre;
|
10935 | }
|
10936 |
|
10937 | if (el.staticRoot && !el.staticProcessed) {
|
10938 | return genStatic(el, state)
|
10939 | } else if (el.once && !el.onceProcessed) {
|
10940 | return genOnce(el, state)
|
10941 | } else if (el.for && !el.forProcessed) {
|
10942 | return genFor(el, state)
|
10943 | } else if (el.if && !el.ifProcessed) {
|
10944 | return genIf(el, state)
|
10945 | } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
10946 | return genChildren(el, state) || 'void 0'
|
10947 | } else if (el.tag === 'slot') {
|
10948 | return genSlot(el, state)
|
10949 | } else {
|
10950 |
|
10951 | var code;
|
10952 | if (el.component) {
|
10953 | code = genComponent(el.component, el, state);
|
10954 | } else {
|
10955 | var data;
|
10956 | if (!el.plain || (el.pre && state.maybeComponent(el))) {
|
10957 | data = genData$2(el, state);
|
10958 | }
|
10959 |
|
10960 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
10961 | code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
10962 | }
|
10963 |
|
10964 | for (var i = 0; i < state.transforms.length; i++) {
|
10965 | code = state.transforms[i](el, code);
|
10966 | }
|
10967 | return code
|
10968 | }
|
10969 | }
|
10970 |
|
10971 |
|
10972 | function genStatic (el, state) {
|
10973 | el.staticProcessed = true;
|
10974 |
|
10975 |
|
10976 |
|
10977 | var originalPreState = state.pre;
|
10978 | if (el.pre) {
|
10979 | state.pre = el.pre;
|
10980 | }
|
10981 | state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
10982 | state.pre = originalPreState;
|
10983 | return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
10984 | }
|
10985 |
|
10986 |
|
10987 | function genOnce (el, state) {
|
10988 | el.onceProcessed = true;
|
10989 | if (el.if && !el.ifProcessed) {
|
10990 | return genIf(el, state)
|
10991 | } else if (el.staticInFor) {
|
10992 | var key = '';
|
10993 | var parent = el.parent;
|
10994 | while (parent) {
|
10995 | if (parent.for) {
|
10996 | key = parent.key;
|
10997 | break
|
10998 | }
|
10999 | parent = parent.parent;
|
11000 | }
|
11001 | if (!key) {
|
11002 | process.env.NODE_ENV !== 'production' && state.warn(
|
11003 | "v-once can only be used inside v-for that is keyed. ",
|
11004 | el.rawAttrsMap['v-once']
|
11005 | );
|
11006 | return genElement(el, state)
|
11007 | }
|
11008 | return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
11009 | } else {
|
11010 | return genStatic(el, state)
|
11011 | }
|
11012 | }
|
11013 |
|
11014 | function genIf (
|
11015 | el,
|
11016 | state,
|
11017 | altGen,
|
11018 | altEmpty
|
11019 | ) {
|
11020 | el.ifProcessed = true;
|
11021 | return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
|
11022 | }
|
11023 |
|
11024 | function genIfConditions (
|
11025 | conditions,
|
11026 | state,
|
11027 | altGen,
|
11028 | altEmpty
|
11029 | ) {
|
11030 | if (!conditions.length) {
|
11031 | return altEmpty || '_e()'
|
11032 | }
|
11033 |
|
11034 | var condition = conditions.shift();
|
11035 | if (condition.exp) {
|
11036 | return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
|
11037 | } else {
|
11038 | return ("" + (genTernaryExp(condition.block)))
|
11039 | }
|
11040 |
|
11041 |
|
11042 | function genTernaryExp (el) {
|
11043 | return altGen
|
11044 | ? altGen(el, state)
|
11045 | : el.once
|
11046 | ? genOnce(el, state)
|
11047 | : genElement(el, state)
|
11048 | }
|
11049 | }
|
11050 |
|
11051 | function genFor (
|
11052 | el,
|
11053 | state,
|
11054 | altGen,
|
11055 | altHelper
|
11056 | ) {
|
11057 | var exp = el.for;
|
11058 | var alias = el.alias;
|
11059 | var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
|
11060 | var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
|
11061 |
|
11062 | if (process.env.NODE_ENV !== 'production' &&
|
11063 | state.maybeComponent(el) &&
|
11064 | el.tag !== 'slot' &&
|
11065 | el.tag !== 'template' &&
|
11066 | !el.key
|
11067 | ) {
|
11068 | state.warn(
|
11069 | "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
|
11070 | "v-for should have explicit keys. " +
|
11071 | "See https://vuejs.org/guide/list.html#key for more info.",
|
11072 | el.rawAttrsMap['v-for'],
|
11073 | true
|
11074 | );
|
11075 | }
|
11076 |
|
11077 | el.forProcessed = true;
|
11078 | return (altHelper || '_l') + "((" + exp + ")," +
|
11079 | "function(" + alias + iterator1 + iterator2 + "){" +
|
11080 | "return " + ((altGen || genElement)(el, state)) +
|
11081 | '})'
|
11082 | }
|
11083 |
|
11084 | function genData$2 (el, state) {
|
11085 | var data = '{';
|
11086 |
|
11087 |
|
11088 |
|
11089 | var dirs = genDirectives(el, state);
|
11090 | if (dirs) { data += dirs + ','; }
|
11091 |
|
11092 |
|
11093 | if (el.key) {
|
11094 | data += "key:" + (el.key) + ",";
|
11095 | }
|
11096 |
|
11097 | if (el.ref) {
|
11098 | data += "ref:" + (el.ref) + ",";
|
11099 | }
|
11100 | if (el.refInFor) {
|
11101 | data += "refInFor:true,";
|
11102 | }
|
11103 |
|
11104 | if (el.pre) {
|
11105 | data += "pre:true,";
|
11106 | }
|
11107 |
|
11108 | if (el.component) {
|
11109 | data += "tag:\"" + (el.tag) + "\",";
|
11110 | }
|
11111 |
|
11112 | for (var i = 0; i < state.dataGenFns.length; i++) {
|
11113 | data += state.dataGenFns[i](el);
|
11114 | }
|
11115 |
|
11116 | if (el.attrs) {
|
11117 | data += "attrs:" + (genProps(el.attrs)) + ",";
|
11118 | }
|
11119 |
|
11120 | if (el.props) {
|
11121 | data += "domProps:" + (genProps(el.props)) + ",";
|
11122 | }
|
11123 |
|
11124 | if (el.events) {
|
11125 | data += (genHandlers(el.events, false)) + ",";
|
11126 | }
|
11127 | if (el.nativeEvents) {
|
11128 | data += (genHandlers(el.nativeEvents, true)) + ",";
|
11129 | }
|
11130 |
|
11131 |
|
11132 | if (el.slotTarget && !el.slotScope) {
|
11133 | data += "slot:" + (el.slotTarget) + ",";
|
11134 | }
|
11135 |
|
11136 | if (el.scopedSlots) {
|
11137 | data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
|
11138 | }
|
11139 |
|
11140 | if (el.model) {
|
11141 | data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
11142 | }
|
11143 |
|
11144 | if (el.inlineTemplate) {
|
11145 | var inlineTemplate = genInlineTemplate(el, state);
|
11146 | if (inlineTemplate) {
|
11147 | data += inlineTemplate + ",";
|
11148 | }
|
11149 | }
|
11150 | data = data.replace(/,$/, '') + '}';
|
11151 |
|
11152 |
|
11153 |
|
11154 | if (el.dynamicAttrs) {
|
11155 | data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
11156 | }
|
11157 |
|
11158 | if (el.wrapData) {
|
11159 | data = el.wrapData(data);
|
11160 | }
|
11161 |
|
11162 | if (el.wrapListeners) {
|
11163 | data = el.wrapListeners(data);
|
11164 | }
|
11165 | return data
|
11166 | }
|
11167 |
|
11168 | function genDirectives (el, state) {
|
11169 | var dirs = el.directives;
|
11170 | if (!dirs) { return }
|
11171 | var res = 'directives:[';
|
11172 | var hasRuntime = false;
|
11173 | var i, l, dir, needRuntime;
|
11174 | for (i = 0, l = dirs.length; i < l; i++) {
|
11175 | dir = dirs[i];
|
11176 | needRuntime = true;
|
11177 | var gen = state.directives[dir.name];
|
11178 | if (gen) {
|
11179 |
|
11180 |
|
11181 | needRuntime = !!gen(el, dir, state.warn);
|
11182 | }
|
11183 | if (needRuntime) {
|
11184 | hasRuntime = true;
|
11185 | res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
11186 | }
|
11187 | }
|
11188 | if (hasRuntime) {
|
11189 | return res.slice(0, -1) + ']'
|
11190 | }
|
11191 | }
|
11192 |
|
11193 | function genInlineTemplate (el, state) {
|
11194 | var ast = el.children[0];
|
11195 | if (process.env.NODE_ENV !== 'production' && (
|
11196 | el.children.length !== 1 || ast.type !== 1
|
11197 | )) {
|
11198 | state.warn(
|
11199 | 'Inline-template components must have exactly one child element.',
|
11200 | { start: el.start }
|
11201 | );
|
11202 | }
|
11203 | if (ast && ast.type === 1) {
|
11204 | var inlineRenderFns = generate(ast, state.options);
|
11205 | return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
|
11206 | }
|
11207 | }
|
11208 |
|
11209 | function genScopedSlots (
|
11210 | el,
|
11211 | slots,
|
11212 | state
|
11213 | ) {
|
11214 |
|
11215 |
|
11216 |
|
11217 |
|
11218 | var needsForceUpdate = Object.keys(slots).some(function (key) {
|
11219 | var slot = slots[key];
|
11220 | return (
|
11221 | slot.slotTargetDynamic ||
|
11222 | slot.if ||
|
11223 | slot.for ||
|
11224 | containsSlotChild(slot)
|
11225 | )
|
11226 | });
|
11227 |
|
11228 |
|
11229 |
|
11230 |
|
11231 |
|
11232 | var needsKey = !!el.if;
|
11233 |
|
11234 |
|
11235 |
|
11236 |
|
11237 |
|
11238 |
|
11239 | if (!needsForceUpdate) {
|
11240 | var parent = el.parent;
|
11241 | while (parent) {
|
11242 | if (
|
11243 | (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
|
11244 | parent.for
|
11245 | ) {
|
11246 | needsForceUpdate = true;
|
11247 | break
|
11248 | }
|
11249 | if (parent.if) {
|
11250 | needsKey = true;
|
11251 | }
|
11252 | parent = parent.parent;
|
11253 | }
|
11254 | }
|
11255 |
|
11256 | var generatedSlots = Object.keys(slots)
|
11257 | .map(function (key) { return genScopedSlot(slots[key], state); })
|
11258 | .join(',');
|
11259 |
|
11260 | return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
|
11261 | }
|
11262 |
|
11263 | function hash(str) {
|
11264 | var hash = 5381;
|
11265 | var i = str.length;
|
11266 | while(i) {
|
11267 | hash = (hash * 33) ^ str.charCodeAt(--i);
|
11268 | }
|
11269 | return hash >>> 0
|
11270 | }
|
11271 |
|
11272 | function containsSlotChild (el) {
|
11273 | if (el.type === 1) {
|
11274 | if (el.tag === 'slot') {
|
11275 | return true
|
11276 | }
|
11277 | return el.children.some(containsSlotChild)
|
11278 | }
|
11279 | return false
|
11280 | }
|
11281 |
|
11282 | function genScopedSlot (
|
11283 | el,
|
11284 | state
|
11285 | ) {
|
11286 | var isLegacySyntax = el.attrsMap['slot-scope'];
|
11287 | if (el.if && !el.ifProcessed && !isLegacySyntax) {
|
11288 | return genIf(el, state, genScopedSlot, "null")
|
11289 | }
|
11290 | if (el.for && !el.forProcessed) {
|
11291 | return genFor(el, state, genScopedSlot)
|
11292 | }
|
11293 | var slotScope = el.slotScope === emptySlotScopeToken
|
11294 | ? ""
|
11295 | : String(el.slotScope);
|
11296 | var fn = "function(" + slotScope + "){" +
|
11297 | "return " + (el.tag === 'template'
|
11298 | ? el.if && isLegacySyntax
|
11299 | ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
|
11300 | : genChildren(el, state) || 'undefined'
|
11301 | : genElement(el, state)) + "}";
|
11302 |
|
11303 | var reverseProxy = slotScope ? "" : ",proxy:true";
|
11304 | return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
|
11305 | }
|
11306 |
|
11307 | function genChildren (
|
11308 | el,
|
11309 | state,
|
11310 | checkSkip,
|
11311 | altGenElement,
|
11312 | altGenNode
|
11313 | ) {
|
11314 | var children = el.children;
|
11315 | if (children.length) {
|
11316 | var el$1 = children[0];
|
11317 |
|
11318 | if (children.length === 1 &&
|
11319 | el$1.for &&
|
11320 | el$1.tag !== 'template' &&
|
11321 | el$1.tag !== 'slot'
|
11322 | ) {
|
11323 | var normalizationType = checkSkip
|
11324 | ? state.maybeComponent(el$1) ? ",1" : ",0"
|
11325 | : "";
|
11326 | return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
|
11327 | }
|
11328 | var normalizationType$1 = checkSkip
|
11329 | ? getNormalizationType(children, state.maybeComponent)
|
11330 | : 0;
|
11331 | var gen = altGenNode || genNode;
|
11332 | return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
|
11333 | }
|
11334 | }
|
11335 |
|
11336 |
|
11337 |
|
11338 |
|
11339 |
|
11340 | function getNormalizationType (
|
11341 | children,
|
11342 | maybeComponent
|
11343 | ) {
|
11344 | var res = 0;
|
11345 | for (var i = 0; i < children.length; i++) {
|
11346 | var el = children[i];
|
11347 | if (el.type !== 1) {
|
11348 | continue
|
11349 | }
|
11350 | if (needsNormalization(el) ||
|
11351 | (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
11352 | res = 2;
|
11353 | break
|
11354 | }
|
11355 | if (maybeComponent(el) ||
|
11356 | (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
11357 | res = 1;
|
11358 | }
|
11359 | }
|
11360 | return res
|
11361 | }
|
11362 |
|
11363 | function needsNormalization (el) {
|
11364 | return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
11365 | }
|
11366 |
|
11367 | function genNode (node, state) {
|
11368 | if (node.type === 1) {
|
11369 | return genElement(node, state)
|
11370 | } else if (node.type === 3 && node.isComment) {
|
11371 | return genComment(node)
|
11372 | } else {
|
11373 | return genText(node)
|
11374 | }
|
11375 | }
|
11376 |
|
11377 | function genText (text) {
|
11378 | return ("_v(" + (text.type === 2
|
11379 | ? text.expression
|
11380 | : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
11381 | }
|
11382 |
|
11383 | function genComment (comment) {
|
11384 | return ("_e(" + (JSON.stringify(comment.text)) + ")")
|
11385 | }
|
11386 |
|
11387 | function genSlot (el, state) {
|
11388 | var slotName = el.slotName || '"default"';
|
11389 | var children = genChildren(el, state);
|
11390 | var res = "_t(" + slotName + (children ? ("," + children) : '');
|
11391 | var attrs = el.attrs || el.dynamicAttrs
|
11392 | ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
11393 |
|
11394 | name: camelize(attr.name),
|
11395 | value: attr.value,
|
11396 | dynamic: attr.dynamic
|
11397 | }); }))
|
11398 | : null;
|
11399 | var bind$$1 = el.attrsMap['v-bind'];
|
11400 | if ((attrs || bind$$1) && !children) {
|
11401 | res += ",null";
|
11402 | }
|
11403 | if (attrs) {
|
11404 | res += "," + attrs;
|
11405 | }
|
11406 | if (bind$$1) {
|
11407 | res += (attrs ? '' : ',null') + "," + bind$$1;
|
11408 | }
|
11409 | return res + ')'
|
11410 | }
|
11411 |
|
11412 |
|
11413 | function genComponent (
|
11414 | componentName,
|
11415 | el,
|
11416 | state
|
11417 | ) {
|
11418 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
11419 | return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
|
11420 | }
|
11421 |
|
11422 | function genProps (props) {
|
11423 | var staticProps = "";
|
11424 | var dynamicProps = "";
|
11425 | for (var i = 0; i < props.length; i++) {
|
11426 | var prop = props[i];
|
11427 | var value = transformSpecialNewlines(prop.value);
|
11428 | if (prop.dynamic) {
|
11429 | dynamicProps += (prop.name) + "," + value + ",";
|
11430 | } else {
|
11431 | staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
11432 | }
|
11433 | }
|
11434 | staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
11435 | if (dynamicProps) {
|
11436 | return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
11437 | } else {
|
11438 | return staticProps
|
11439 | }
|
11440 | }
|
11441 |
|
11442 |
|
11443 | function transformSpecialNewlines (text) {
|
11444 | return text
|
11445 | .replace(/\u2028/g, '\\u2028')
|
11446 | .replace(/\u2029/g, '\\u2029')
|
11447 | }
|
11448 |
|
11449 |
|
11450 |
|
11451 |
|
11452 |
|
11453 |
|
11454 |
|
11455 | var prohibitedKeywordRE = new RegExp('\\b' + (
|
11456 | 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
11457 | 'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
11458 | 'extends,finally,continue,debugger,function,arguments'
|
11459 | ).split(',').join('\\b|\\b') + '\\b');
|
11460 |
|
11461 |
|
11462 | var unaryOperatorsRE = new RegExp('\\b' + (
|
11463 | 'delete,typeof,void'
|
11464 | ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
11465 |
|
11466 |
|
11467 | var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
11468 |
|
11469 |
|
11470 | function detectErrors (ast, warn) {
|
11471 | if (ast) {
|
11472 | checkNode(ast, warn);
|
11473 | }
|
11474 | }
|
11475 |
|
11476 | function checkNode (node, warn) {
|
11477 | if (node.type === 1) {
|
11478 | for (var name in node.attrsMap) {
|
11479 | if (dirRE.test(name)) {
|
11480 | var value = node.attrsMap[name];
|
11481 | if (value) {
|
11482 | var range = node.rawAttrsMap[name];
|
11483 | if (name === 'v-for') {
|
11484 | checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
11485 | } else if (onRE.test(name)) {
|
11486 | checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
11487 | } else {
|
11488 | checkExpression(value, (name + "=\"" + value + "\""), warn, range);
|
11489 | }
|
11490 | }
|
11491 | }
|
11492 | }
|
11493 | if (node.children) {
|
11494 | for (var i = 0; i < node.children.length; i++) {
|
11495 | checkNode(node.children[i], warn);
|
11496 | }
|
11497 | }
|
11498 | } else if (node.type === 2) {
|
11499 | checkExpression(node.expression, node.text, warn, node);
|
11500 | }
|
11501 | }
|
11502 |
|
11503 | function checkEvent (exp, text, warn, range) {
|
11504 | var stipped = exp.replace(stripStringRE, '');
|
11505 | var keywordMatch = stipped.match(unaryOperatorsRE);
|
11506 | if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
11507 | warn(
|
11508 | "avoid using JavaScript unary operator as property name: " +
|
11509 | "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
11510 | range
|
11511 | );
|
11512 | }
|
11513 | checkExpression(exp, text, warn, range);
|
11514 | }
|
11515 |
|
11516 | function checkFor (node, text, warn, range) {
|
11517 | checkExpression(node.for || '', text, warn, range);
|
11518 | checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
11519 | checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
11520 | checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
11521 | }
|
11522 |
|
11523 | function checkIdentifier (
|
11524 | ident,
|
11525 | type,
|
11526 | text,
|
11527 | warn,
|
11528 | range
|
11529 | ) {
|
11530 | if (typeof ident === 'string') {
|
11531 | try {
|
11532 | new Function(("var " + ident + "=_"));
|
11533 | } catch (e) {
|
11534 | warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
|
11535 | }
|
11536 | }
|
11537 | }
|
11538 |
|
11539 | function checkExpression (exp, text, warn, range) {
|
11540 | try {
|
11541 | new Function(("return " + exp));
|
11542 | } catch (e) {
|
11543 | var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
|
11544 | if (keywordMatch) {
|
11545 | warn(
|
11546 | "avoid using JavaScript keyword as property name: " +
|
11547 | "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
|
11548 | range
|
11549 | );
|
11550 | } else {
|
11551 | warn(
|
11552 | "invalid expression: " + (e.message) + " in\n\n" +
|
11553 | " " + exp + "\n\n" +
|
11554 | " Raw expression: " + (text.trim()) + "\n",
|
11555 | range
|
11556 | );
|
11557 | }
|
11558 | }
|
11559 | }
|
11560 |
|
11561 |
|
11562 |
|
11563 | var range = 2;
|
11564 |
|
11565 | function generateCodeFrame (
|
11566 | source,
|
11567 | start,
|
11568 | end
|
11569 | ) {
|
11570 | if ( start === void 0 ) start = 0;
|
11571 | if ( end === void 0 ) end = source.length;
|
11572 |
|
11573 | var lines = source.split(/\r?\n/);
|
11574 | var count = 0;
|
11575 | var res = [];
|
11576 | for (var i = 0; i < lines.length; i++) {
|
11577 | count += lines[i].length + 1;
|
11578 | if (count >= start) {
|
11579 | for (var j = i - range; j <= i + range || end > count; j++) {
|
11580 | if (j < 0 || j >= lines.length) { continue }
|
11581 | res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
|
11582 | var lineLength = lines[j].length;
|
11583 | if (j === i) {
|
11584 |
|
11585 | var pad = start - (count - lineLength) + 1;
|
11586 | var length = end > count ? lineLength - pad : end - start;
|
11587 | res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
|
11588 | } else if (j > i) {
|
11589 | if (end > count) {
|
11590 | var length$1 = Math.min(end - count, lineLength);
|
11591 | res.push(" | " + repeat$1("^", length$1));
|
11592 | }
|
11593 | count += lineLength + 1;
|
11594 | }
|
11595 | }
|
11596 | break
|
11597 | }
|
11598 | }
|
11599 | return res.join('\n')
|
11600 | }
|
11601 |
|
11602 | function repeat$1 (str, n) {
|
11603 | var result = '';
|
11604 | if (n > 0) {
|
11605 | while (true) {
|
11606 | if (n & 1) { result += str; }
|
11607 | n >>>= 1;
|
11608 | if (n <= 0) { break }
|
11609 | str += str;
|
11610 | }
|
11611 | }
|
11612 | return result
|
11613 | }
|
11614 |
|
11615 |
|
11616 |
|
11617 |
|
11618 |
|
11619 | function createFunction (code, errors) {
|
11620 | try {
|
11621 | return new Function(code)
|
11622 | } catch (err) {
|
11623 | errors.push({ err: err, code: code });
|
11624 | return noop
|
11625 | }
|
11626 | }
|
11627 |
|
11628 | function createCompileToFunctionFn (compile) {
|
11629 | var cache = Object.create(null);
|
11630 |
|
11631 | return function compileToFunctions (
|
11632 | template,
|
11633 | options,
|
11634 | vm
|
11635 | ) {
|
11636 | options = extend({}, options);
|
11637 | var warn$$1 = options.warn || warn;
|
11638 | delete options.warn;
|
11639 |
|
11640 |
|
11641 | if (process.env.NODE_ENV !== 'production') {
|
11642 |
|
11643 | try {
|
11644 | new Function('return 1');
|
11645 | } catch (e) {
|
11646 | if (e.toString().match(/unsafe-eval|CSP/)) {
|
11647 | warn$$1(
|
11648 | 'It seems you are using the standalone build of Vue.js in an ' +
|
11649 | 'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
11650 | 'The template compiler cannot work in this environment. Consider ' +
|
11651 | 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
11652 | 'templates into render functions.'
|
11653 | );
|
11654 | }
|
11655 | }
|
11656 | }
|
11657 |
|
11658 |
|
11659 | var key = options.delimiters
|
11660 | ? String(options.delimiters) + template
|
11661 | : template;
|
11662 | if (cache[key]) {
|
11663 | return cache[key]
|
11664 | }
|
11665 |
|
11666 |
|
11667 | var compiled = compile(template, options);
|
11668 |
|
11669 |
|
11670 | if (process.env.NODE_ENV !== 'production') {
|
11671 | if (compiled.errors && compiled.errors.length) {
|
11672 | if (options.outputSourceRange) {
|
11673 | compiled.errors.forEach(function (e) {
|
11674 | warn$$1(
|
11675 | "Error compiling template:\n\n" + (e.msg) + "\n\n" +
|
11676 | generateCodeFrame(template, e.start, e.end),
|
11677 | vm
|
11678 | );
|
11679 | });
|
11680 | } else {
|
11681 | warn$$1(
|
11682 | "Error compiling template:\n\n" + template + "\n\n" +
|
11683 | compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
|
11684 | vm
|
11685 | );
|
11686 | }
|
11687 | }
|
11688 | if (compiled.tips && compiled.tips.length) {
|
11689 | if (options.outputSourceRange) {
|
11690 | compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
11691 | } else {
|
11692 | compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
11693 | }
|
11694 | }
|
11695 | }
|
11696 |
|
11697 |
|
11698 | var res = {};
|
11699 | var fnGenErrors = [];
|
11700 | res.render = createFunction(compiled.render, fnGenErrors);
|
11701 | res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
11702 | return createFunction(code, fnGenErrors)
|
11703 | });
|
11704 |
|
11705 |
|
11706 |
|
11707 |
|
11708 |
|
11709 | if (process.env.NODE_ENV !== 'production') {
|
11710 | if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
11711 | warn$$1(
|
11712 | "Failed to generate render function:\n\n" +
|
11713 | fnGenErrors.map(function (ref) {
|
11714 | var err = ref.err;
|
11715 | var code = ref.code;
|
11716 |
|
11717 | return ((err.toString()) + " in\n\n" + code + "\n");
|
11718 | }).join('\n'),
|
11719 | vm
|
11720 | );
|
11721 | }
|
11722 | }
|
11723 |
|
11724 | return (cache[key] = res)
|
11725 | }
|
11726 | }
|
11727 |
|
11728 |
|
11729 |
|
11730 | function createCompilerCreator (baseCompile) {
|
11731 | return function createCompiler (baseOptions) {
|
11732 | function compile (
|
11733 | template,
|
11734 | options
|
11735 | ) {
|
11736 | var finalOptions = Object.create(baseOptions);
|
11737 | var errors = [];
|
11738 | var tips = [];
|
11739 |
|
11740 | var warn = function (msg, range, tip) {
|
11741 | (tip ? tips : errors).push(msg);
|
11742 | };
|
11743 |
|
11744 | if (options) {
|
11745 | if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
|
11746 |
|
11747 | var leadingSpaceLength = template.match(/^\s*/)[0].length;
|
11748 |
|
11749 | warn = function (msg, range, tip) {
|
11750 | var data = { msg: msg };
|
11751 | if (range) {
|
11752 | if (range.start != null) {
|
11753 | data.start = range.start + leadingSpaceLength;
|
11754 | }
|
11755 | if (range.end != null) {
|
11756 | data.end = range.end + leadingSpaceLength;
|
11757 | }
|
11758 | }
|
11759 | (tip ? tips : errors).push(data);
|
11760 | };
|
11761 | }
|
11762 |
|
11763 | if (options.modules) {
|
11764 | finalOptions.modules =
|
11765 | (baseOptions.modules || []).concat(options.modules);
|
11766 | }
|
11767 |
|
11768 | if (options.directives) {
|
11769 | finalOptions.directives = extend(
|
11770 | Object.create(baseOptions.directives || null),
|
11771 | options.directives
|
11772 | );
|
11773 | }
|
11774 |
|
11775 | for (var key in options) {
|
11776 | if (key !== 'modules' && key !== 'directives') {
|
11777 | finalOptions[key] = options[key];
|
11778 | }
|
11779 | }
|
11780 | }
|
11781 |
|
11782 | finalOptions.warn = warn;
|
11783 |
|
11784 | var compiled = baseCompile(template.trim(), finalOptions);
|
11785 | if (process.env.NODE_ENV !== 'production') {
|
11786 | detectErrors(compiled.ast, warn);
|
11787 | }
|
11788 | compiled.errors = errors;
|
11789 | compiled.tips = tips;
|
11790 | return compiled
|
11791 | }
|
11792 |
|
11793 | return {
|
11794 | compile: compile,
|
11795 | compileToFunctions: createCompileToFunctionFn(compile)
|
11796 | }
|
11797 | }
|
11798 | }
|
11799 |
|
11800 |
|
11801 |
|
11802 |
|
11803 |
|
11804 |
|
11805 | var createCompiler = createCompilerCreator(function baseCompile (
|
11806 | template,
|
11807 | options
|
11808 | ) {
|
11809 | var ast = parse(template.trim(), options);
|
11810 | if (options.optimize !== false) {
|
11811 | optimize(ast, options);
|
11812 | }
|
11813 | var code = generate(ast, options);
|
11814 | return {
|
11815 | ast: ast,
|
11816 | render: code.render,
|
11817 | staticRenderFns: code.staticRenderFns
|
11818 | }
|
11819 | });
|
11820 |
|
11821 |
|
11822 |
|
11823 | var ref$1 = createCompiler(baseOptions);
|
11824 | var compile = ref$1.compile;
|
11825 | var compileToFunctions = ref$1.compileToFunctions;
|
11826 |
|
11827 |
|
11828 |
|
11829 |
|
11830 | var div;
|
11831 | function getShouldDecode (href) {
|
11832 | div = div || document.createElement('div');
|
11833 | div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
|
11834 | return div.innerHTML.indexOf(' ') > 0
|
11835 | }
|
11836 |
|
11837 |
|
11838 | var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
|
11839 |
|
11840 | var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
|
11841 |
|
11842 |
|
11843 |
|
11844 | var idToTemplate = cached(function (id) {
|
11845 | var el = query(id);
|
11846 | return el && el.innerHTML
|
11847 | });
|
11848 |
|
11849 | var mount = Vue.prototype.$mount;
|
11850 | Vue.prototype.$mount = function (
|
11851 | el,
|
11852 | hydrating
|
11853 | ) {
|
11854 | el = el && query(el);
|
11855 |
|
11856 |
|
11857 | if (el === document.body || el === document.documentElement) {
|
11858 | process.env.NODE_ENV !== 'production' && warn(
|
11859 | "Do not mount Vue to <html> or <body> - mount to normal elements instead."
|
11860 | );
|
11861 | return this
|
11862 | }
|
11863 |
|
11864 | var options = this.$options;
|
11865 |
|
11866 | if (!options.render) {
|
11867 | var template = options.template;
|
11868 | if (template) {
|
11869 | if (typeof template === 'string') {
|
11870 | if (template.charAt(0) === '#') {
|
11871 | template = idToTemplate(template);
|
11872 |
|
11873 | if (process.env.NODE_ENV !== 'production' && !template) {
|
11874 | warn(
|
11875 | ("Template element not found or is empty: " + (options.template)),
|
11876 | this
|
11877 | );
|
11878 | }
|
11879 | }
|
11880 | } else if (template.nodeType) {
|
11881 | template = template.innerHTML;
|
11882 | } else {
|
11883 | if (process.env.NODE_ENV !== 'production') {
|
11884 | warn('invalid template option:' + template, this);
|
11885 | }
|
11886 | return this
|
11887 | }
|
11888 | } else if (el) {
|
11889 | template = getOuterHTML(el);
|
11890 | }
|
11891 | if (template) {
|
11892 |
|
11893 | if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
11894 | mark('compile');
|
11895 | }
|
11896 |
|
11897 | var ref = compileToFunctions(template, {
|
11898 | outputSourceRange: process.env.NODE_ENV !== 'production',
|
11899 | shouldDecodeNewlines: shouldDecodeNewlines,
|
11900 | shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
|
11901 | delimiters: options.delimiters,
|
11902 | comments: options.comments
|
11903 | }, this);
|
11904 | var render = ref.render;
|
11905 | var staticRenderFns = ref.staticRenderFns;
|
11906 | options.render = render;
|
11907 | options.staticRenderFns = staticRenderFns;
|
11908 |
|
11909 |
|
11910 | if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
11911 | mark('compile end');
|
11912 | measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
|
11913 | }
|
11914 | }
|
11915 | }
|
11916 | return mount.call(this, el, hydrating)
|
11917 | };
|
11918 |
|
11919 |
|
11920 |
|
11921 |
|
11922 |
|
11923 | function getOuterHTML (el) {
|
11924 | if (el.outerHTML) {
|
11925 | return el.outerHTML
|
11926 | } else {
|
11927 | var container = document.createElement('div');
|
11928 | container.appendChild(el.cloneNode(true));
|
11929 | return container.innerHTML
|
11930 | }
|
11931 | }
|
11932 |
|
11933 | Vue.compile = compileToFunctions;
|
11934 |
|
11935 | export default Vue;
|