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