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