1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | (function (global, factory) {
|
7 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
8 | typeof define === 'function' && define.amd ? define(factory) :
|
9 | (global = global || self, global.Vue = factory());
|
10 | }(this, function () { 'use strict';
|
11 |
|
12 |
|
13 |
|
14 | var emptyObject = Object.freeze({});
|
15 |
|
16 |
|
17 |
|
18 | function isUndef (v) {
|
19 | return v === undefined || v === null
|
20 | }
|
21 |
|
22 | function isDef (v) {
|
23 | return v !== undefined && v !== null
|
24 | }
|
25 |
|
26 | function isTrue (v) {
|
27 | return v === true
|
28 | }
|
29 |
|
30 | function isFalse (v) {
|
31 | return v === false
|
32 | }
|
33 |
|
34 | |
35 |
|
36 |
|
37 | function isPrimitive (value) {
|
38 | return (
|
39 | typeof value === 'string' ||
|
40 | typeof value === 'number' ||
|
41 |
|
42 | typeof value === 'symbol' ||
|
43 | typeof value === 'boolean'
|
44 | )
|
45 | }
|
46 |
|
47 | |
48 |
|
49 |
|
50 |
|
51 |
|
52 | function isObject (obj) {
|
53 | return obj !== null && typeof obj === 'object'
|
54 | }
|
55 |
|
56 | |
57 |
|
58 |
|
59 | var _toString = Object.prototype.toString;
|
60 |
|
61 | function toRawType (value) {
|
62 | return _toString.call(value).slice(8, -1)
|
63 | }
|
64 |
|
65 | |
66 |
|
67 |
|
68 |
|
69 | function isPlainObject (obj) {
|
70 | return _toString.call(obj) === '[object Object]'
|
71 | }
|
72 |
|
73 | function isRegExp (v) {
|
74 | return _toString.call(v) === '[object RegExp]'
|
75 | }
|
76 |
|
77 | |
78 |
|
79 |
|
80 | function isValidArrayIndex (val) {
|
81 | var n = parseFloat(String(val));
|
82 | return n >= 0 && Math.floor(n) === n && isFinite(val)
|
83 | }
|
84 |
|
85 | function isPromise (val) {
|
86 | return (
|
87 | isDef(val) &&
|
88 | typeof val.then === 'function' &&
|
89 | typeof val.catch === 'function'
|
90 | )
|
91 | }
|
92 |
|
93 | |
94 |
|
95 |
|
96 | function toString (val) {
|
97 | return val == null
|
98 | ? ''
|
99 | : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
100 | ? JSON.stringify(val, null, 2)
|
101 | : String(val)
|
102 | }
|
103 |
|
104 | |
105 |
|
106 |
|
107 |
|
108 | function toNumber (val) {
|
109 | var n = parseFloat(val);
|
110 | return isNaN(n) ? val : n
|
111 | }
|
112 |
|
113 | |
114 |
|
115 |
|
116 |
|
117 | function makeMap (
|
118 | str,
|
119 | expectsLowerCase
|
120 | ) {
|
121 | var map = Object.create(null);
|
122 | var list = str.split(',');
|
123 | for (var i = 0; i < list.length; i++) {
|
124 | map[list[i]] = true;
|
125 | }
|
126 | return expectsLowerCase
|
127 | ? function (val) { return map[val.toLowerCase()]; }
|
128 | : function (val) { return map[val]; }
|
129 | }
|
130 |
|
131 | |
132 |
|
133 |
|
134 | var isBuiltInTag = makeMap('slot,component', true);
|
135 |
|
136 | |
137 |
|
138 |
|
139 | var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
140 |
|
141 | |
142 |
|
143 |
|
144 | function remove (arr, item) {
|
145 | if (arr.length) {
|
146 | var index = arr.indexOf(item);
|
147 | if (index > -1) {
|
148 | return arr.splice(index, 1)
|
149 | }
|
150 | }
|
151 | }
|
152 |
|
153 | |
154 |
|
155 |
|
156 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
157 | function hasOwn (obj, key) {
|
158 | return hasOwnProperty.call(obj, key)
|
159 | }
|
160 |
|
161 | |
162 |
|
163 |
|
164 | function cached (fn) {
|
165 | var cache = Object.create(null);
|
166 | return (function cachedFn (str) {
|
167 | var hit = cache[str];
|
168 | return hit || (cache[str] = fn(str))
|
169 | })
|
170 | }
|
171 |
|
172 | |
173 |
|
174 |
|
175 | var camelizeRE = /-(\w)/g;
|
176 | var camelize = cached(function (str) {
|
177 | return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
178 | });
|
179 |
|
180 | |
181 |
|
182 |
|
183 | var capitalize = cached(function (str) {
|
184 | return str.charAt(0).toUpperCase() + str.slice(1)
|
185 | });
|
186 |
|
187 | |
188 |
|
189 |
|
190 | var hyphenateRE = /\B([A-Z])/g;
|
191 | var hyphenate = cached(function (str) {
|
192 | return str.replace(hyphenateRE, '-$1').toLowerCase()
|
193 | });
|
194 |
|
195 | |
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 | function polyfillBind (fn, ctx) {
|
205 | function boundFn (a) {
|
206 | var l = arguments.length;
|
207 | return l
|
208 | ? l > 1
|
209 | ? fn.apply(ctx, arguments)
|
210 | : fn.call(ctx, a)
|
211 | : fn.call(ctx)
|
212 | }
|
213 |
|
214 | boundFn._length = fn.length;
|
215 | return boundFn
|
216 | }
|
217 |
|
218 | function nativeBind (fn, ctx) {
|
219 | return fn.bind(ctx)
|
220 | }
|
221 |
|
222 | var bind = Function.prototype.bind
|
223 | ? nativeBind
|
224 | : polyfillBind;
|
225 |
|
226 | |
227 |
|
228 |
|
229 | function toArray (list, start) {
|
230 | start = start || 0;
|
231 | var i = list.length - start;
|
232 | var ret = new Array(i);
|
233 | while (i--) {
|
234 | ret[i] = list[i + start];
|
235 | }
|
236 | return ret
|
237 | }
|
238 |
|
239 | |
240 |
|
241 |
|
242 | function extend (to, _from) {
|
243 | for (var key in _from) {
|
244 | to[key] = _from[key];
|
245 | }
|
246 | return to
|
247 | }
|
248 |
|
249 | |
250 |
|
251 |
|
252 | function toObject (arr) {
|
253 | var res = {};
|
254 | for (var i = 0; i < arr.length; i++) {
|
255 | if (arr[i]) {
|
256 | extend(res, arr[i]);
|
257 | }
|
258 | }
|
259 | return res
|
260 | }
|
261 |
|
262 |
|
263 |
|
264 | |
265 |
|
266 |
|
267 |
|
268 |
|
269 | function noop (a, b, c) {}
|
270 |
|
271 | |
272 |
|
273 |
|
274 | var no = function (a, b, c) { return false; };
|
275 |
|
276 |
|
277 |
|
278 | |
279 |
|
280 |
|
281 | var identity = function (_) { return _; };
|
282 |
|
283 | |
284 |
|
285 |
|
286 | function genStaticKeys (modules) {
|
287 | return modules.reduce(function (keys, m) {
|
288 | return keys.concat(m.staticKeys || [])
|
289 | }, []).join(',')
|
290 | }
|
291 |
|
292 | |
293 |
|
294 |
|
295 |
|
296 | function looseEqual (a, b) {
|
297 | if (a === b) { return true }
|
298 | var isObjectA = isObject(a);
|
299 | var isObjectB = isObject(b);
|
300 | if (isObjectA && isObjectB) {
|
301 | try {
|
302 | var isArrayA = Array.isArray(a);
|
303 | var isArrayB = Array.isArray(b);
|
304 | if (isArrayA && isArrayB) {
|
305 | return a.length === b.length && a.every(function (e, i) {
|
306 | return looseEqual(e, b[i])
|
307 | })
|
308 | } else if (a instanceof Date && b instanceof Date) {
|
309 | return a.getTime() === b.getTime()
|
310 | } else if (!isArrayA && !isArrayB) {
|
311 | var keysA = Object.keys(a);
|
312 | var keysB = Object.keys(b);
|
313 | return keysA.length === keysB.length && keysA.every(function (key) {
|
314 | return looseEqual(a[key], b[key])
|
315 | })
|
316 | } else {
|
317 |
|
318 | return false
|
319 | }
|
320 | } catch (e) {
|
321 |
|
322 | return false
|
323 | }
|
324 | } else if (!isObjectA && !isObjectB) {
|
325 | return String(a) === String(b)
|
326 | } else {
|
327 | return false
|
328 | }
|
329 | }
|
330 |
|
331 | |
332 |
|
333 |
|
334 |
|
335 |
|
336 | function looseIndexOf (arr, val) {
|
337 | for (var i = 0; i < arr.length; i++) {
|
338 | if (looseEqual(arr[i], val)) { return i }
|
339 | }
|
340 | return -1
|
341 | }
|
342 |
|
343 | |
344 |
|
345 |
|
346 | function once (fn) {
|
347 | var called = false;
|
348 | return function () {
|
349 | if (!called) {
|
350 | called = true;
|
351 | fn.apply(this, arguments);
|
352 | }
|
353 | }
|
354 | }
|
355 |
|
356 | var SSR_ATTR = 'data-server-rendered';
|
357 |
|
358 | var ASSET_TYPES = [
|
359 | 'component',
|
360 | 'directive',
|
361 | 'filter'
|
362 | ];
|
363 |
|
364 | var LIFECYCLE_HOOKS = [
|
365 | 'beforeCreate',
|
366 | 'created',
|
367 | 'beforeMount',
|
368 | 'mounted',
|
369 | 'beforeUpdate',
|
370 | 'updated',
|
371 | 'beforeDestroy',
|
372 | 'destroyed',
|
373 | 'activated',
|
374 | 'deactivated',
|
375 | 'errorCaptured',
|
376 | 'serverPrefetch'
|
377 | ];
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 | var config = ({
|
384 | |
385 |
|
386 |
|
387 |
|
388 | optionMergeStrategies: Object.create(null),
|
389 |
|
390 | |
391 |
|
392 |
|
393 | silent: false,
|
394 |
|
395 | |
396 |
|
397 |
|
398 | productionTip: "development" !== 'production',
|
399 |
|
400 | |
401 |
|
402 |
|
403 | devtools: "development" !== 'production',
|
404 |
|
405 | |
406 |
|
407 |
|
408 | performance: false,
|
409 |
|
410 | |
411 |
|
412 |
|
413 | errorHandler: null,
|
414 |
|
415 | |
416 |
|
417 |
|
418 | warnHandler: null,
|
419 |
|
420 | |
421 |
|
422 |
|
423 | ignoredElements: [],
|
424 |
|
425 | |
426 |
|
427 |
|
428 |
|
429 | keyCodes: Object.create(null),
|
430 |
|
431 | |
432 |
|
433 |
|
434 |
|
435 | isReservedTag: no,
|
436 |
|
437 | |
438 |
|
439 |
|
440 |
|
441 | isReservedAttr: no,
|
442 |
|
443 | |
444 |
|
445 |
|
446 |
|
447 | isUnknownElement: no,
|
448 |
|
449 | |
450 |
|
451 |
|
452 | getTagNamespace: noop,
|
453 |
|
454 | |
455 |
|
456 |
|
457 | parsePlatformTagName: identity,
|
458 |
|
459 | |
460 |
|
461 |
|
462 |
|
463 | mustUseProp: no,
|
464 |
|
465 | |
466 |
|
467 |
|
468 |
|
469 | async: true,
|
470 |
|
471 | |
472 |
|
473 |
|
474 | _lifecycleHooks: LIFECYCLE_HOOKS
|
475 | });
|
476 |
|
477 |
|
478 |
|
479 | |
480 |
|
481 |
|
482 |
|
483 |
|
484 | var unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD';
|
485 |
|
486 | |
487 |
|
488 |
|
489 | function isReserved (str) {
|
490 | var c = (str + '').charCodeAt(0);
|
491 | return c === 0x24 || c === 0x5F
|
492 | }
|
493 |
|
494 | |
495 |
|
496 |
|
497 | function def (obj, key, val, enumerable) {
|
498 | Object.defineProperty(obj, key, {
|
499 | value: val,
|
500 | enumerable: !!enumerable,
|
501 | writable: true,
|
502 | configurable: true
|
503 | });
|
504 | }
|
505 |
|
506 | |
507 |
|
508 |
|
509 | var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
|
510 | function parsePath (path) {
|
511 | if (bailRE.test(path)) {
|
512 | return
|
513 | }
|
514 | var segments = path.split('.');
|
515 | return function (obj) {
|
516 | for (var i = 0; i < segments.length; i++) {
|
517 | if (!obj) { return }
|
518 | obj = obj[segments[i]];
|
519 | }
|
520 | return obj
|
521 | }
|
522 | }
|
523 |
|
524 |
|
525 |
|
526 |
|
527 | var hasProto = '__proto__' in {};
|
528 |
|
529 |
|
530 | var inBrowser = typeof window !== 'undefined';
|
531 | var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
532 | var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
533 | var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
534 | var isIE = UA && /msie|trident/.test(UA);
|
535 | var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
536 | var isEdge = UA && UA.indexOf('edge/') > 0;
|
537 | var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
538 | var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
539 | var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
540 | var isPhantomJS = UA && /phantomjs/.test(UA);
|
541 |
|
542 |
|
543 | var nativeWatch = ({}).watch;
|
544 |
|
545 | var supportsPassive = false;
|
546 | if (inBrowser) {
|
547 | try {
|
548 | var opts = {};
|
549 | Object.defineProperty(opts, 'passive', ({
|
550 | get: function get () {
|
551 |
|
552 | supportsPassive = true;
|
553 | }
|
554 | }));
|
555 | window.addEventListener('test-passive', null, opts);
|
556 | } catch (e) {}
|
557 | }
|
558 |
|
559 |
|
560 |
|
561 | var _isServer;
|
562 | var isServerRendering = function () {
|
563 | if (_isServer === undefined) {
|
564 |
|
565 | if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
566 |
|
567 |
|
568 | _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
569 | } else {
|
570 | _isServer = false;
|
571 | }
|
572 | }
|
573 | return _isServer
|
574 | };
|
575 |
|
576 |
|
577 | var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
578 |
|
579 |
|
580 | function isNative (Ctor) {
|
581 | return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
582 | }
|
583 |
|
584 | var hasSymbol =
|
585 | typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
586 | typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
587 |
|
588 | var _Set;
|
589 |
|
590 | if (typeof Set !== 'undefined' && isNative(Set)) {
|
591 |
|
592 | _Set = Set;
|
593 | } else {
|
594 |
|
595 | _Set = (function () {
|
596 | function Set () {
|
597 | this.set = Object.create(null);
|
598 | }
|
599 | Set.prototype.has = function has (key) {
|
600 | return this.set[key] === true
|
601 | };
|
602 | Set.prototype.add = function add (key) {
|
603 | this.set[key] = true;
|
604 | };
|
605 | Set.prototype.clear = function clear () {
|
606 | this.set = Object.create(null);
|
607 | };
|
608 |
|
609 | return Set;
|
610 | }());
|
611 | }
|
612 |
|
613 |
|
614 |
|
615 | var warn = noop;
|
616 | var tip = noop;
|
617 | var generateComponentTrace = (noop);
|
618 | var formatComponentName = (noop);
|
619 |
|
620 | {
|
621 | var hasConsole = typeof console !== 'undefined';
|
622 | var classifyRE = /(?:^|[-_])(\w)/g;
|
623 | var classify = function (str) { return str
|
624 | .replace(classifyRE, function (c) { return c.toUpperCase(); })
|
625 | .replace(/[-_]/g, ''); };
|
626 |
|
627 | warn = function (msg, vm) {
|
628 | var trace = vm ? generateComponentTrace(vm) : '';
|
629 |
|
630 | if (config.warnHandler) {
|
631 | config.warnHandler.call(null, msg, vm, trace);
|
632 | } else if (hasConsole && (!config.silent)) {
|
633 | console.error(("[Vue warn]: " + msg + trace));
|
634 | }
|
635 | };
|
636 |
|
637 | tip = function (msg, vm) {
|
638 | if (hasConsole && (!config.silent)) {
|
639 | console.warn("[Vue tip]: " + msg + (
|
640 | vm ? generateComponentTrace(vm) : ''
|
641 | ));
|
642 | }
|
643 | };
|
644 |
|
645 | formatComponentName = function (vm, includeFile) {
|
646 | if (vm.$root === vm) {
|
647 | return '<Root>'
|
648 | }
|
649 | var options = typeof vm === 'function' && vm.cid != null
|
650 | ? vm.options
|
651 | : vm._isVue
|
652 | ? vm.$options || vm.constructor.options
|
653 | : vm;
|
654 | var name = options.name || options._componentTag;
|
655 | var file = options.__file;
|
656 | if (!name && file) {
|
657 | var match = file.match(/([^/\\]+)\.vue$/);
|
658 | name = match && match[1];
|
659 | }
|
660 |
|
661 | return (
|
662 | (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
663 | (file && includeFile !== false ? (" at " + file) : '')
|
664 | )
|
665 | };
|
666 |
|
667 | var repeat = function (str, n) {
|
668 | var res = '';
|
669 | while (n) {
|
670 | if (n % 2 === 1) { res += str; }
|
671 | if (n > 1) { str += str; }
|
672 | n >>= 1;
|
673 | }
|
674 | return res
|
675 | };
|
676 |
|
677 | generateComponentTrace = function (vm) {
|
678 | if (vm._isVue && vm.$parent) {
|
679 | var tree = [];
|
680 | var currentRecursiveSequence = 0;
|
681 | while (vm) {
|
682 | if (tree.length > 0) {
|
683 | var last = tree[tree.length - 1];
|
684 | if (last.constructor === vm.constructor) {
|
685 | currentRecursiveSequence++;
|
686 | vm = vm.$parent;
|
687 | continue
|
688 | } else if (currentRecursiveSequence > 0) {
|
689 | tree[tree.length - 1] = [last, currentRecursiveSequence];
|
690 | currentRecursiveSequence = 0;
|
691 | }
|
692 | }
|
693 | tree.push(vm);
|
694 | vm = vm.$parent;
|
695 | }
|
696 | return '\n\nfound in\n\n' + tree
|
697 | .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
698 | ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
699 | : formatComponentName(vm))); })
|
700 | .join('\n')
|
701 | } else {
|
702 | return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
703 | }
|
704 | };
|
705 | }
|
706 |
|
707 |
|
708 |
|
709 | var uid = 0;
|
710 |
|
711 | |
712 |
|
713 |
|
714 |
|
715 | var Dep = function Dep () {
|
716 | this.id = uid++;
|
717 | this.subs = [];
|
718 | };
|
719 |
|
720 | Dep.prototype.addSub = function addSub (sub) {
|
721 | this.subs.push(sub);
|
722 | };
|
723 |
|
724 | Dep.prototype.removeSub = function removeSub (sub) {
|
725 | remove(this.subs, sub);
|
726 | };
|
727 |
|
728 | Dep.prototype.depend = function depend () {
|
729 | if (Dep.target) {
|
730 | Dep.target.addDep(this);
|
731 | }
|
732 | };
|
733 |
|
734 | Dep.prototype.notify = function notify () {
|
735 |
|
736 | var subs = this.subs.slice();
|
737 | if (!config.async) {
|
738 |
|
739 |
|
740 |
|
741 | subs.sort(function (a, b) { return a.id - b.id; });
|
742 | }
|
743 | for (var i = 0, l = subs.length; i < l; i++) {
|
744 | subs[i].update();
|
745 | }
|
746 | };
|
747 |
|
748 |
|
749 |
|
750 |
|
751 | Dep.target = null;
|
752 | var targetStack = [];
|
753 |
|
754 | function pushTarget (target) {
|
755 | targetStack.push(target);
|
756 | Dep.target = target;
|
757 | }
|
758 |
|
759 | function popTarget () {
|
760 | targetStack.pop();
|
761 | Dep.target = targetStack[targetStack.length - 1];
|
762 | }
|
763 |
|
764 |
|
765 |
|
766 | var VNode = function VNode (
|
767 | tag,
|
768 | data,
|
769 | children,
|
770 | text,
|
771 | elm,
|
772 | context,
|
773 | componentOptions,
|
774 | asyncFactory
|
775 | ) {
|
776 | this.tag = tag;
|
777 | this.data = data;
|
778 | this.children = children;
|
779 | this.text = text;
|
780 | this.elm = elm;
|
781 | this.ns = undefined;
|
782 | this.context = context;
|
783 | this.fnContext = undefined;
|
784 | this.fnOptions = undefined;
|
785 | this.fnScopeId = undefined;
|
786 | this.key = data && data.key;
|
787 | this.componentOptions = componentOptions;
|
788 | this.componentInstance = undefined;
|
789 | this.parent = undefined;
|
790 | this.raw = false;
|
791 | this.isStatic = false;
|
792 | this.isRootInsert = true;
|
793 | this.isComment = false;
|
794 | this.isCloned = false;
|
795 | this.isOnce = false;
|
796 | this.asyncFactory = asyncFactory;
|
797 | this.asyncMeta = undefined;
|
798 | this.isAsyncPlaceholder = false;
|
799 | };
|
800 |
|
801 | var prototypeAccessors = { child: { configurable: true } };
|
802 |
|
803 |
|
804 |
|
805 | prototypeAccessors.child.get = function () {
|
806 | return this.componentInstance
|
807 | };
|
808 |
|
809 | Object.defineProperties( VNode.prototype, prototypeAccessors );
|
810 |
|
811 | var createEmptyVNode = function (text) {
|
812 | if ( text === void 0 ) text = '';
|
813 |
|
814 | var node = new VNode();
|
815 | node.text = text;
|
816 | node.isComment = true;
|
817 | return node
|
818 | };
|
819 |
|
820 | function createTextVNode (val) {
|
821 | return new VNode(undefined, undefined, undefined, String(val))
|
822 | }
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 | function cloneVNode (vnode) {
|
829 | var cloned = new VNode(
|
830 | vnode.tag,
|
831 | vnode.data,
|
832 |
|
833 |
|
834 |
|
835 | vnode.children && vnode.children.slice(),
|
836 | vnode.text,
|
837 | vnode.elm,
|
838 | vnode.context,
|
839 | vnode.componentOptions,
|
840 | vnode.asyncFactory
|
841 | );
|
842 | cloned.ns = vnode.ns;
|
843 | cloned.isStatic = vnode.isStatic;
|
844 | cloned.key = vnode.key;
|
845 | cloned.isComment = vnode.isComment;
|
846 | cloned.fnContext = vnode.fnContext;
|
847 | cloned.fnOptions = vnode.fnOptions;
|
848 | cloned.fnScopeId = vnode.fnScopeId;
|
849 | cloned.asyncMeta = vnode.asyncMeta;
|
850 | cloned.isCloned = true;
|
851 | return cloned
|
852 | }
|
853 |
|
854 | |
855 |
|
856 |
|
857 |
|
858 |
|
859 | var arrayProto = Array.prototype;
|
860 | var arrayMethods = Object.create(arrayProto);
|
861 |
|
862 | var methodsToPatch = [
|
863 | 'push',
|
864 | 'pop',
|
865 | 'shift',
|
866 | 'unshift',
|
867 | 'splice',
|
868 | 'sort',
|
869 | 'reverse'
|
870 | ];
|
871 |
|
872 | |
873 |
|
874 |
|
875 | methodsToPatch.forEach(function (method) {
|
876 |
|
877 | var original = arrayProto[method];
|
878 | def(arrayMethods, method, function mutator () {
|
879 | var args = [], len = arguments.length;
|
880 | while ( len-- ) args[ len ] = arguments[ len ];
|
881 |
|
882 | var result = original.apply(this, args);
|
883 | var ob = this.__ob__;
|
884 | var inserted;
|
885 | switch (method) {
|
886 | case 'push':
|
887 | case 'unshift':
|
888 | inserted = args;
|
889 | break
|
890 | case 'splice':
|
891 | inserted = args.slice(2);
|
892 | break
|
893 | }
|
894 | if (inserted) { ob.observeArray(inserted); }
|
895 |
|
896 | ob.dep.notify();
|
897 | return result
|
898 | });
|
899 | });
|
900 |
|
901 |
|
902 |
|
903 | var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
904 |
|
905 | |
906 |
|
907 |
|
908 |
|
909 | var shouldObserve = true;
|
910 |
|
911 | function toggleObserving (value) {
|
912 | shouldObserve = value;
|
913 | }
|
914 |
|
915 | |
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 | var Observer = function Observer (value) {
|
922 | this.value = value;
|
923 | this.dep = new Dep();
|
924 | this.vmCount = 0;
|
925 | def(value, '__ob__', this);
|
926 | if (Array.isArray(value)) {
|
927 | if (hasProto) {
|
928 | protoAugment(value, arrayMethods);
|
929 | } else {
|
930 | copyAugment(value, arrayMethods, arrayKeys);
|
931 | }
|
932 | this.observeArray(value);
|
933 | } else {
|
934 | this.walk(value);
|
935 | }
|
936 | };
|
937 |
|
938 | |
939 |
|
940 |
|
941 |
|
942 |
|
943 | Observer.prototype.walk = function walk (obj) {
|
944 | var keys = Object.keys(obj);
|
945 | for (var i = 0; i < keys.length; i++) {
|
946 | defineReactive$$1(obj, keys[i]);
|
947 | }
|
948 | };
|
949 |
|
950 | |
951 |
|
952 |
|
953 | Observer.prototype.observeArray = function observeArray (items) {
|
954 | for (var i = 0, l = items.length; i < l; i++) {
|
955 | observe(items[i]);
|
956 | }
|
957 | };
|
958 |
|
959 |
|
960 |
|
961 | |
962 |
|
963 |
|
964 |
|
965 | function protoAugment (target, src) {
|
966 |
|
967 | target.__proto__ = src;
|
968 |
|
969 | }
|
970 |
|
971 | |
972 |
|
973 |
|
974 |
|
975 |
|
976 | function copyAugment (target, src, keys) {
|
977 | for (var i = 0, l = keys.length; i < l; i++) {
|
978 | var key = keys[i];
|
979 | def(target, key, src[key]);
|
980 | }
|
981 | }
|
982 |
|
983 | |
984 |
|
985 |
|
986 |
|
987 |
|
988 | function observe (value, asRootData) {
|
989 | if (!isObject(value) || value instanceof VNode) {
|
990 | return
|
991 | }
|
992 | var ob;
|
993 | if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
994 | ob = value.__ob__;
|
995 | } else if (
|
996 | shouldObserve &&
|
997 | !isServerRendering() &&
|
998 | (Array.isArray(value) || isPlainObject(value)) &&
|
999 | Object.isExtensible(value) &&
|
1000 | !value._isVue
|
1001 | ) {
|
1002 | ob = new Observer(value);
|
1003 | }
|
1004 | if (asRootData && ob) {
|
1005 | ob.vmCount++;
|
1006 | }
|
1007 | return ob
|
1008 | }
|
1009 |
|
1010 | |
1011 |
|
1012 |
|
1013 | function defineReactive$$1 (
|
1014 | obj,
|
1015 | key,
|
1016 | val,
|
1017 | customSetter,
|
1018 | shallow
|
1019 | ) {
|
1020 | var dep = new Dep();
|
1021 |
|
1022 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
1023 | if (property && property.configurable === false) {
|
1024 | return
|
1025 | }
|
1026 |
|
1027 |
|
1028 | var getter = property && property.get;
|
1029 | var setter = property && property.set;
|
1030 | if ((!getter || setter) && arguments.length === 2) {
|
1031 | val = obj[key];
|
1032 | }
|
1033 |
|
1034 | var childOb = !shallow && observe(val);
|
1035 | Object.defineProperty(obj, key, {
|
1036 | enumerable: true,
|
1037 | configurable: true,
|
1038 | get: function reactiveGetter () {
|
1039 | var value = getter ? getter.call(obj) : val;
|
1040 | if (Dep.target) {
|
1041 | dep.depend();
|
1042 | if (childOb) {
|
1043 | childOb.dep.depend();
|
1044 | if (Array.isArray(value)) {
|
1045 | dependArray(value);
|
1046 | }
|
1047 | }
|
1048 | }
|
1049 | return value
|
1050 | },
|
1051 | set: function reactiveSetter (newVal) {
|
1052 | var value = getter ? getter.call(obj) : val;
|
1053 |
|
1054 | if (newVal === value || (newVal !== newVal && value !== value)) {
|
1055 | return
|
1056 | }
|
1057 |
|
1058 | if (customSetter) {
|
1059 | customSetter();
|
1060 | }
|
1061 |
|
1062 | if (getter && !setter) { return }
|
1063 | if (setter) {
|
1064 | setter.call(obj, newVal);
|
1065 | } else {
|
1066 | val = newVal;
|
1067 | }
|
1068 | childOb = !shallow && observe(newVal);
|
1069 | dep.notify();
|
1070 | }
|
1071 | });
|
1072 | }
|
1073 |
|
1074 | |
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 | function set (target, key, val) {
|
1080 | if (isUndef(target) || isPrimitive(target)
|
1081 | ) {
|
1082 | warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1083 | }
|
1084 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1085 | target.length = Math.max(target.length, key);
|
1086 | target.splice(key, 1, val);
|
1087 | return val
|
1088 | }
|
1089 | if (key in target && !(key in Object.prototype)) {
|
1090 | target[key] = val;
|
1091 | return val
|
1092 | }
|
1093 | var ob = (target).__ob__;
|
1094 | if (target._isVue || (ob && ob.vmCount)) {
|
1095 | warn(
|
1096 | 'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1097 | 'at runtime - declare it upfront in the data option.'
|
1098 | );
|
1099 | return val
|
1100 | }
|
1101 | if (!ob) {
|
1102 | target[key] = val;
|
1103 | return val
|
1104 | }
|
1105 | defineReactive$$1(ob.value, key, val);
|
1106 | ob.dep.notify();
|
1107 | return val
|
1108 | }
|
1109 |
|
1110 | |
1111 |
|
1112 |
|
1113 | function del (target, key) {
|
1114 | if (isUndef(target) || isPrimitive(target)
|
1115 | ) {
|
1116 | warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
1117 | }
|
1118 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1119 | target.splice(key, 1);
|
1120 | return
|
1121 | }
|
1122 | var ob = (target).__ob__;
|
1123 | if (target._isVue || (ob && ob.vmCount)) {
|
1124 | warn(
|
1125 | 'Avoid deleting properties on a Vue instance or its root $data ' +
|
1126 | '- just set it to null.'
|
1127 | );
|
1128 | return
|
1129 | }
|
1130 | if (!hasOwn(target, key)) {
|
1131 | return
|
1132 | }
|
1133 | delete target[key];
|
1134 | if (!ob) {
|
1135 | return
|
1136 | }
|
1137 | ob.dep.notify();
|
1138 | }
|
1139 |
|
1140 | |
1141 |
|
1142 |
|
1143 |
|
1144 | function dependArray (value) {
|
1145 | for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1146 | e = value[i];
|
1147 | e && e.__ob__ && e.__ob__.dep.depend();
|
1148 | if (Array.isArray(e)) {
|
1149 | dependArray(e);
|
1150 | }
|
1151 | }
|
1152 | }
|
1153 |
|
1154 |
|
1155 |
|
1156 | |
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 | var strats = config.optionMergeStrategies;
|
1162 |
|
1163 | |
1164 |
|
1165 |
|
1166 | {
|
1167 | strats.el = strats.propsData = function (parent, child, vm, key) {
|
1168 | if (!vm) {
|
1169 | warn(
|
1170 | "option \"" + key + "\" can only be used during instance " +
|
1171 | 'creation with the `new` keyword.'
|
1172 | );
|
1173 | }
|
1174 | return defaultStrat(parent, child)
|
1175 | };
|
1176 | }
|
1177 |
|
1178 | |
1179 |
|
1180 |
|
1181 | function mergeData (to, from) {
|
1182 | if (!from) { return to }
|
1183 | var key, toVal, fromVal;
|
1184 |
|
1185 | var keys = hasSymbol
|
1186 | ? Reflect.ownKeys(from)
|
1187 | : Object.keys(from);
|
1188 |
|
1189 | for (var i = 0; i < keys.length; i++) {
|
1190 | key = keys[i];
|
1191 |
|
1192 | if (key === '__ob__') { continue }
|
1193 | toVal = to[key];
|
1194 | fromVal = from[key];
|
1195 | if (!hasOwn(to, key)) {
|
1196 | set(to, key, fromVal);
|
1197 | } else if (
|
1198 | toVal !== fromVal &&
|
1199 | isPlainObject(toVal) &&
|
1200 | isPlainObject(fromVal)
|
1201 | ) {
|
1202 | mergeData(toVal, fromVal);
|
1203 | }
|
1204 | }
|
1205 | return to
|
1206 | }
|
1207 |
|
1208 | |
1209 |
|
1210 |
|
1211 | function mergeDataOrFn (
|
1212 | parentVal,
|
1213 | childVal,
|
1214 | vm
|
1215 | ) {
|
1216 | if (!vm) {
|
1217 |
|
1218 | if (!childVal) {
|
1219 | return parentVal
|
1220 | }
|
1221 | if (!parentVal) {
|
1222 | return childVal
|
1223 | }
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 | return function mergedDataFn () {
|
1230 | return mergeData(
|
1231 | typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1232 | typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1233 | )
|
1234 | }
|
1235 | } else {
|
1236 | return function mergedInstanceDataFn () {
|
1237 |
|
1238 | var instanceData = typeof childVal === 'function'
|
1239 | ? childVal.call(vm, vm)
|
1240 | : childVal;
|
1241 | var defaultData = typeof parentVal === 'function'
|
1242 | ? parentVal.call(vm, vm)
|
1243 | : parentVal;
|
1244 | if (instanceData) {
|
1245 | return mergeData(instanceData, defaultData)
|
1246 | } else {
|
1247 | return defaultData
|
1248 | }
|
1249 | }
|
1250 | }
|
1251 | }
|
1252 |
|
1253 | strats.data = function (
|
1254 | parentVal,
|
1255 | childVal,
|
1256 | vm
|
1257 | ) {
|
1258 | if (!vm) {
|
1259 | if (childVal && typeof childVal !== 'function') {
|
1260 | warn(
|
1261 | 'The "data" option should be a function ' +
|
1262 | 'that returns a per-instance value in component ' +
|
1263 | 'definitions.',
|
1264 | vm
|
1265 | );
|
1266 |
|
1267 | return parentVal
|
1268 | }
|
1269 | return mergeDataOrFn(parentVal, childVal)
|
1270 | }
|
1271 |
|
1272 | return mergeDataOrFn(parentVal, childVal, vm)
|
1273 | };
|
1274 |
|
1275 | |
1276 |
|
1277 |
|
1278 | function mergeHook (
|
1279 | parentVal,
|
1280 | childVal
|
1281 | ) {
|
1282 | var res = childVal
|
1283 | ? parentVal
|
1284 | ? parentVal.concat(childVal)
|
1285 | : Array.isArray(childVal)
|
1286 | ? childVal
|
1287 | : [childVal]
|
1288 | : parentVal;
|
1289 | return res
|
1290 | ? dedupeHooks(res)
|
1291 | : res
|
1292 | }
|
1293 |
|
1294 | function dedupeHooks (hooks) {
|
1295 | var res = [];
|
1296 | for (var i = 0; i < hooks.length; i++) {
|
1297 | if (res.indexOf(hooks[i]) === -1) {
|
1298 | res.push(hooks[i]);
|
1299 | }
|
1300 | }
|
1301 | return res
|
1302 | }
|
1303 |
|
1304 | LIFECYCLE_HOOKS.forEach(function (hook) {
|
1305 | strats[hook] = mergeHook;
|
1306 | });
|
1307 |
|
1308 | |
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 | function mergeAssets (
|
1316 | parentVal,
|
1317 | childVal,
|
1318 | vm,
|
1319 | key
|
1320 | ) {
|
1321 | var res = Object.create(parentVal || null);
|
1322 | if (childVal) {
|
1323 | assertObjectType(key, childVal, vm);
|
1324 | return extend(res, childVal)
|
1325 | } else {
|
1326 | return res
|
1327 | }
|
1328 | }
|
1329 |
|
1330 | ASSET_TYPES.forEach(function (type) {
|
1331 | strats[type + 's'] = mergeAssets;
|
1332 | });
|
1333 |
|
1334 | |
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 | strats.watch = function (
|
1341 | parentVal,
|
1342 | childVal,
|
1343 | vm,
|
1344 | key
|
1345 | ) {
|
1346 |
|
1347 | if (parentVal === nativeWatch) { parentVal = undefined; }
|
1348 | if (childVal === nativeWatch) { childVal = undefined; }
|
1349 |
|
1350 | if (!childVal) { return Object.create(parentVal || null) }
|
1351 | {
|
1352 | assertObjectType(key, childVal, vm);
|
1353 | }
|
1354 | if (!parentVal) { return childVal }
|
1355 | var ret = {};
|
1356 | extend(ret, parentVal);
|
1357 | for (var key$1 in childVal) {
|
1358 | var parent = ret[key$1];
|
1359 | var child = childVal[key$1];
|
1360 | if (parent && !Array.isArray(parent)) {
|
1361 | parent = [parent];
|
1362 | }
|
1363 | ret[key$1] = parent
|
1364 | ? parent.concat(child)
|
1365 | : Array.isArray(child) ? child : [child];
|
1366 | }
|
1367 | return ret
|
1368 | };
|
1369 |
|
1370 | |
1371 |
|
1372 |
|
1373 | strats.props =
|
1374 | strats.methods =
|
1375 | strats.inject =
|
1376 | strats.computed = function (
|
1377 | parentVal,
|
1378 | childVal,
|
1379 | vm,
|
1380 | key
|
1381 | ) {
|
1382 | if (childVal && "development" !== 'production') {
|
1383 | assertObjectType(key, childVal, vm);
|
1384 | }
|
1385 | if (!parentVal) { return childVal }
|
1386 | var ret = Object.create(null);
|
1387 | extend(ret, parentVal);
|
1388 | if (childVal) { extend(ret, childVal); }
|
1389 | return ret
|
1390 | };
|
1391 | strats.provide = mergeDataOrFn;
|
1392 |
|
1393 | |
1394 |
|
1395 |
|
1396 | var defaultStrat = function (parentVal, childVal) {
|
1397 | return childVal === undefined
|
1398 | ? parentVal
|
1399 | : childVal
|
1400 | };
|
1401 |
|
1402 | |
1403 |
|
1404 |
|
1405 | function checkComponents (options) {
|
1406 | for (var key in options.components) {
|
1407 | validateComponentName(key);
|
1408 | }
|
1409 | }
|
1410 |
|
1411 | function validateComponentName (name) {
|
1412 | if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
|
1413 | warn(
|
1414 | 'Invalid component name: "' + name + '". Component names ' +
|
1415 | 'should conform to valid custom element name in html5 specification.'
|
1416 | );
|
1417 | }
|
1418 | if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
1419 | warn(
|
1420 | 'Do not use built-in or reserved HTML elements as component ' +
|
1421 | 'id: ' + name
|
1422 | );
|
1423 | }
|
1424 | }
|
1425 |
|
1426 | |
1427 |
|
1428 |
|
1429 |
|
1430 | function normalizeProps (options, vm) {
|
1431 | var props = options.props;
|
1432 | if (!props) { return }
|
1433 | var res = {};
|
1434 | var i, val, name;
|
1435 | if (Array.isArray(props)) {
|
1436 | i = props.length;
|
1437 | while (i--) {
|
1438 | val = props[i];
|
1439 | if (typeof val === 'string') {
|
1440 | name = camelize(val);
|
1441 | res[name] = { type: null };
|
1442 | } else {
|
1443 | warn('props must be strings when using array syntax.');
|
1444 | }
|
1445 | }
|
1446 | } else if (isPlainObject(props)) {
|
1447 | for (var key in props) {
|
1448 | val = props[key];
|
1449 | name = camelize(key);
|
1450 | res[name] = isPlainObject(val)
|
1451 | ? val
|
1452 | : { type: val };
|
1453 | }
|
1454 | } else {
|
1455 | warn(
|
1456 | "Invalid value for option \"props\": expected an Array or an Object, " +
|
1457 | "but got " + (toRawType(props)) + ".",
|
1458 | vm
|
1459 | );
|
1460 | }
|
1461 | options.props = res;
|
1462 | }
|
1463 |
|
1464 | |
1465 |
|
1466 |
|
1467 | function normalizeInject (options, vm) {
|
1468 | var inject = options.inject;
|
1469 | if (!inject) { return }
|
1470 | var normalized = options.inject = {};
|
1471 | if (Array.isArray(inject)) {
|
1472 | for (var i = 0; i < inject.length; i++) {
|
1473 | normalized[inject[i]] = { from: inject[i] };
|
1474 | }
|
1475 | } else if (isPlainObject(inject)) {
|
1476 | for (var key in inject) {
|
1477 | var val = inject[key];
|
1478 | normalized[key] = isPlainObject(val)
|
1479 | ? extend({ from: key }, val)
|
1480 | : { from: val };
|
1481 | }
|
1482 | } else {
|
1483 | warn(
|
1484 | "Invalid value for option \"inject\": expected an Array or an Object, " +
|
1485 | "but got " + (toRawType(inject)) + ".",
|
1486 | vm
|
1487 | );
|
1488 | }
|
1489 | }
|
1490 |
|
1491 | |
1492 |
|
1493 |
|
1494 | function normalizeDirectives (options) {
|
1495 | var dirs = options.directives;
|
1496 | if (dirs) {
|
1497 | for (var key in dirs) {
|
1498 | var def$$1 = dirs[key];
|
1499 | if (typeof def$$1 === 'function') {
|
1500 | dirs[key] = { bind: def$$1, update: def$$1 };
|
1501 | }
|
1502 | }
|
1503 | }
|
1504 | }
|
1505 |
|
1506 | function assertObjectType (name, value, vm) {
|
1507 | if (!isPlainObject(value)) {
|
1508 | warn(
|
1509 | "Invalid value for option \"" + name + "\": expected an Object, " +
|
1510 | "but got " + (toRawType(value)) + ".",
|
1511 | vm
|
1512 | );
|
1513 | }
|
1514 | }
|
1515 |
|
1516 | |
1517 |
|
1518 |
|
1519 |
|
1520 | function mergeOptions (
|
1521 | parent,
|
1522 | child,
|
1523 | vm
|
1524 | ) {
|
1525 | {
|
1526 | checkComponents(child);
|
1527 | }
|
1528 |
|
1529 | if (typeof child === 'function') {
|
1530 | child = child.options;
|
1531 | }
|
1532 |
|
1533 | normalizeProps(child, vm);
|
1534 | normalizeInject(child, vm);
|
1535 | normalizeDirectives(child);
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 | if (!child._base) {
|
1542 | if (child.extends) {
|
1543 | parent = mergeOptions(parent, child.extends, vm);
|
1544 | }
|
1545 | if (child.mixins) {
|
1546 | for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1547 | parent = mergeOptions(parent, child.mixins[i], vm);
|
1548 | }
|
1549 | }
|
1550 | }
|
1551 |
|
1552 | var options = {};
|
1553 | var key;
|
1554 | for (key in parent) {
|
1555 | mergeField(key);
|
1556 | }
|
1557 | for (key in child) {
|
1558 | if (!hasOwn(parent, key)) {
|
1559 | mergeField(key);
|
1560 | }
|
1561 | }
|
1562 | function mergeField (key) {
|
1563 | var strat = strats[key] || defaultStrat;
|
1564 | options[key] = strat(parent[key], child[key], vm, key);
|
1565 | }
|
1566 | return options
|
1567 | }
|
1568 |
|
1569 | |
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 | function resolveAsset (
|
1575 | options,
|
1576 | type,
|
1577 | id,
|
1578 | warnMissing
|
1579 | ) {
|
1580 |
|
1581 | if (typeof id !== 'string') {
|
1582 | return
|
1583 | }
|
1584 | var assets = options[type];
|
1585 |
|
1586 | if (hasOwn(assets, id)) { return assets[id] }
|
1587 | var camelizedId = camelize(id);
|
1588 | if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1589 | var PascalCaseId = capitalize(camelizedId);
|
1590 | if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1591 |
|
1592 | var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1593 | if (warnMissing && !res) {
|
1594 | warn(
|
1595 | 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
1596 | options
|
1597 | );
|
1598 | }
|
1599 | return res
|
1600 | }
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 | function validateProp (
|
1607 | key,
|
1608 | propOptions,
|
1609 | propsData,
|
1610 | vm
|
1611 | ) {
|
1612 | var prop = propOptions[key];
|
1613 | var absent = !hasOwn(propsData, key);
|
1614 | var value = propsData[key];
|
1615 |
|
1616 | var booleanIndex = getTypeIndex(Boolean, prop.type);
|
1617 | if (booleanIndex > -1) {
|
1618 | if (absent && !hasOwn(prop, 'default')) {
|
1619 | value = false;
|
1620 | } else if (value === '' || value === hyphenate(key)) {
|
1621 |
|
1622 |
|
1623 | var stringIndex = getTypeIndex(String, prop.type);
|
1624 | if (stringIndex < 0 || booleanIndex < stringIndex) {
|
1625 | value = true;
|
1626 | }
|
1627 | }
|
1628 | }
|
1629 |
|
1630 | if (value === undefined) {
|
1631 | value = getPropDefaultValue(vm, prop, key);
|
1632 |
|
1633 |
|
1634 | var prevShouldObserve = shouldObserve;
|
1635 | toggleObserving(true);
|
1636 | observe(value);
|
1637 | toggleObserving(prevShouldObserve);
|
1638 | }
|
1639 | {
|
1640 | assertProp(prop, key, value, vm, absent);
|
1641 | }
|
1642 | return value
|
1643 | }
|
1644 |
|
1645 | |
1646 |
|
1647 |
|
1648 | function getPropDefaultValue (vm, prop, key) {
|
1649 |
|
1650 | if (!hasOwn(prop, 'default')) {
|
1651 | return undefined
|
1652 | }
|
1653 | var def = prop.default;
|
1654 |
|
1655 | if (isObject(def)) {
|
1656 | warn(
|
1657 | 'Invalid default value for prop "' + key + '": ' +
|
1658 | 'Props with type Object/Array must use a factory function ' +
|
1659 | 'to return the default value.',
|
1660 | vm
|
1661 | );
|
1662 | }
|
1663 |
|
1664 |
|
1665 | if (vm && vm.$options.propsData &&
|
1666 | vm.$options.propsData[key] === undefined &&
|
1667 | vm._props[key] !== undefined
|
1668 | ) {
|
1669 | return vm._props[key]
|
1670 | }
|
1671 |
|
1672 |
|
1673 | return typeof def === 'function' && getType(prop.type) !== 'Function'
|
1674 | ? def.call(vm)
|
1675 | : def
|
1676 | }
|
1677 |
|
1678 | |
1679 |
|
1680 |
|
1681 | function assertProp (
|
1682 | prop,
|
1683 | name,
|
1684 | value,
|
1685 | vm,
|
1686 | absent
|
1687 | ) {
|
1688 | if (prop.required && absent) {
|
1689 | warn(
|
1690 | 'Missing required prop: "' + name + '"',
|
1691 | vm
|
1692 | );
|
1693 | return
|
1694 | }
|
1695 | if (value == null && !prop.required) {
|
1696 | return
|
1697 | }
|
1698 | var type = prop.type;
|
1699 | var valid = !type || type === true;
|
1700 | var expectedTypes = [];
|
1701 | if (type) {
|
1702 | if (!Array.isArray(type)) {
|
1703 | type = [type];
|
1704 | }
|
1705 | for (var i = 0; i < type.length && !valid; i++) {
|
1706 | var assertedType = assertType(value, type[i]);
|
1707 | expectedTypes.push(assertedType.expectedType || '');
|
1708 | valid = assertedType.valid;
|
1709 | }
|
1710 | }
|
1711 |
|
1712 | if (!valid) {
|
1713 | warn(
|
1714 | getInvalidTypeMessage(name, value, expectedTypes),
|
1715 | vm
|
1716 | );
|
1717 | return
|
1718 | }
|
1719 | var validator = prop.validator;
|
1720 | if (validator) {
|
1721 | if (!validator(value)) {
|
1722 | warn(
|
1723 | 'Invalid prop: custom validator check failed for prop "' + name + '".',
|
1724 | vm
|
1725 | );
|
1726 | }
|
1727 | }
|
1728 | }
|
1729 |
|
1730 | var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
1731 |
|
1732 | function assertType (value, type) {
|
1733 | var valid;
|
1734 | var expectedType = getType(type);
|
1735 | if (simpleCheckRE.test(expectedType)) {
|
1736 | var t = typeof value;
|
1737 | valid = t === expectedType.toLowerCase();
|
1738 |
|
1739 | if (!valid && t === 'object') {
|
1740 | valid = value instanceof type;
|
1741 | }
|
1742 | } else if (expectedType === 'Object') {
|
1743 | valid = isPlainObject(value);
|
1744 | } else if (expectedType === 'Array') {
|
1745 | valid = Array.isArray(value);
|
1746 | } else {
|
1747 | valid = value instanceof type;
|
1748 | }
|
1749 | return {
|
1750 | valid: valid,
|
1751 | expectedType: expectedType
|
1752 | }
|
1753 | }
|
1754 |
|
1755 | |
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 | function getType (fn) {
|
1761 | var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
1762 | return match ? match[1] : ''
|
1763 | }
|
1764 |
|
1765 | function isSameType (a, b) {
|
1766 | return getType(a) === getType(b)
|
1767 | }
|
1768 |
|
1769 | function getTypeIndex (type, expectedTypes) {
|
1770 | if (!Array.isArray(expectedTypes)) {
|
1771 | return isSameType(expectedTypes, type) ? 0 : -1
|
1772 | }
|
1773 | for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
1774 | if (isSameType(expectedTypes[i], type)) {
|
1775 | return i
|
1776 | }
|
1777 | }
|
1778 | return -1
|
1779 | }
|
1780 |
|
1781 | function getInvalidTypeMessage (name, value, expectedTypes) {
|
1782 | var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
1783 | " Expected " + (expectedTypes.map(capitalize).join(', '));
|
1784 | var expectedType = expectedTypes[0];
|
1785 | var receivedType = toRawType(value);
|
1786 | var expectedValue = styleValue(value, expectedType);
|
1787 | var receivedValue = styleValue(value, receivedType);
|
1788 |
|
1789 | if (expectedTypes.length === 1 &&
|
1790 | isExplicable(expectedType) &&
|
1791 | !isBoolean(expectedType, receivedType)) {
|
1792 | message += " with value " + expectedValue;
|
1793 | }
|
1794 | message += ", got " + receivedType + " ";
|
1795 |
|
1796 | if (isExplicable(receivedType)) {
|
1797 | message += "with value " + receivedValue + ".";
|
1798 | }
|
1799 | return message
|
1800 | }
|
1801 |
|
1802 | function styleValue (value, type) {
|
1803 | if (type === 'String') {
|
1804 | return ("\"" + value + "\"")
|
1805 | } else if (type === 'Number') {
|
1806 | return ("" + (Number(value)))
|
1807 | } else {
|
1808 | return ("" + value)
|
1809 | }
|
1810 | }
|
1811 |
|
1812 | function isExplicable (value) {
|
1813 | var explicitTypes = ['string', 'number', 'boolean'];
|
1814 | return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
1815 | }
|
1816 |
|
1817 | function isBoolean () {
|
1818 | var args = [], len = arguments.length;
|
1819 | while ( len-- ) args[ len ] = arguments[ len ];
|
1820 |
|
1821 | return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
1822 | }
|
1823 |
|
1824 |
|
1825 |
|
1826 | function handleError (err, vm, info) {
|
1827 | if (vm) {
|
1828 | var cur = vm;
|
1829 | while ((cur = cur.$parent)) {
|
1830 | var hooks = cur.$options.errorCaptured;
|
1831 | if (hooks) {
|
1832 | for (var i = 0; i < hooks.length; i++) {
|
1833 | try {
|
1834 | var capture = hooks[i].call(cur, err, vm, info) === false;
|
1835 | if (capture) { return }
|
1836 | } catch (e) {
|
1837 | globalHandleError(e, cur, 'errorCaptured hook');
|
1838 | }
|
1839 | }
|
1840 | }
|
1841 | }
|
1842 | }
|
1843 | globalHandleError(err, vm, info);
|
1844 | }
|
1845 |
|
1846 | function invokeWithErrorHandling (
|
1847 | handler,
|
1848 | context,
|
1849 | args,
|
1850 | vm,
|
1851 | info
|
1852 | ) {
|
1853 | var res;
|
1854 | try {
|
1855 | res = args ? handler.apply(context, args) : handler.call(context);
|
1856 | if (isPromise(res)) {
|
1857 | res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
1858 | }
|
1859 | } catch (e) {
|
1860 | handleError(e, vm, info);
|
1861 | }
|
1862 | return res
|
1863 | }
|
1864 |
|
1865 | function globalHandleError (err, vm, info) {
|
1866 | if (config.errorHandler) {
|
1867 | try {
|
1868 | return config.errorHandler.call(null, err, vm, info)
|
1869 | } catch (e) {
|
1870 | logError(e, null, 'config.errorHandler');
|
1871 | }
|
1872 | }
|
1873 | logError(err, vm, info);
|
1874 | }
|
1875 |
|
1876 | function logError (err, vm, info) {
|
1877 | {
|
1878 | warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
1879 | }
|
1880 |
|
1881 | if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
1882 | console.error(err);
|
1883 | } else {
|
1884 | throw err
|
1885 | }
|
1886 | }
|
1887 |
|
1888 |
|
1889 |
|
1890 | var isUsingMicroTask = false;
|
1891 |
|
1892 | var callbacks = [];
|
1893 | var pending = false;
|
1894 |
|
1895 | function flushCallbacks () {
|
1896 | pending = false;
|
1897 | var copies = callbacks.slice(0);
|
1898 | callbacks.length = 0;
|
1899 | for (var i = 0; i < copies.length; i++) {
|
1900 | copies[i]();
|
1901 | }
|
1902 | }
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 | var timerFunc;
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 | if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
1925 | var p = Promise.resolve();
|
1926 | timerFunc = function () {
|
1927 | p.then(flushCallbacks);
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 | if (isIOS) { setTimeout(noop); }
|
1934 | };
|
1935 | isUsingMicroTask = true;
|
1936 | } else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1937 | isNative(MutationObserver) ||
|
1938 |
|
1939 | MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1940 | )) {
|
1941 |
|
1942 |
|
1943 |
|
1944 | var counter = 1;
|
1945 | var observer = new MutationObserver(flushCallbacks);
|
1946 | var textNode = document.createTextNode(String(counter));
|
1947 | observer.observe(textNode, {
|
1948 | characterData: true
|
1949 | });
|
1950 | timerFunc = function () {
|
1951 | counter = (counter + 1) % 2;
|
1952 | textNode.data = String(counter);
|
1953 | };
|
1954 | isUsingMicroTask = true;
|
1955 | } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
1956 |
|
1957 |
|
1958 |
|
1959 | timerFunc = function () {
|
1960 | setImmediate(flushCallbacks);
|
1961 | };
|
1962 | } else {
|
1963 |
|
1964 | timerFunc = function () {
|
1965 | setTimeout(flushCallbacks, 0);
|
1966 | };
|
1967 | }
|
1968 |
|
1969 | function nextTick (cb, ctx) {
|
1970 | var _resolve;
|
1971 | callbacks.push(function () {
|
1972 | if (cb) {
|
1973 | try {
|
1974 | cb.call(ctx);
|
1975 | } catch (e) {
|
1976 | handleError(e, ctx, 'nextTick');
|
1977 | }
|
1978 | } else if (_resolve) {
|
1979 | _resolve(ctx);
|
1980 | }
|
1981 | });
|
1982 | if (!pending) {
|
1983 | pending = true;
|
1984 | timerFunc();
|
1985 | }
|
1986 |
|
1987 | if (!cb && typeof Promise !== 'undefined') {
|
1988 | return new Promise(function (resolve) {
|
1989 | _resolve = resolve;
|
1990 | })
|
1991 | }
|
1992 | }
|
1993 |
|
1994 |
|
1995 |
|
1996 | var mark;
|
1997 | var measure;
|
1998 |
|
1999 | {
|
2000 | var perf = inBrowser && window.performance;
|
2001 |
|
2002 | if (
|
2003 | perf &&
|
2004 | perf.mark &&
|
2005 | perf.measure &&
|
2006 | perf.clearMarks &&
|
2007 | perf.clearMeasures
|
2008 | ) {
|
2009 | mark = function (tag) { return perf.mark(tag); };
|
2010 | measure = function (name, startTag, endTag) {
|
2011 | perf.measure(name, startTag, endTag);
|
2012 | perf.clearMarks(startTag);
|
2013 | perf.clearMarks(endTag);
|
2014 |
|
2015 | };
|
2016 | }
|
2017 | }
|
2018 |
|
2019 |
|
2020 |
|
2021 | var initProxy;
|
2022 |
|
2023 | {
|
2024 | var allowedGlobals = makeMap(
|
2025 | 'Infinity,undefined,NaN,isFinite,isNaN,' +
|
2026 | 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
2027 | 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
2028 | 'require'
|
2029 | );
|
2030 |
|
2031 | var warnNonPresent = function (target, key) {
|
2032 | warn(
|
2033 | "Property or method \"" + key + "\" is not defined on the instance but " +
|
2034 | 'referenced during render. Make sure that this property is reactive, ' +
|
2035 | 'either in the data option, or for class-based components, by ' +
|
2036 | 'initializing the property. ' +
|
2037 | 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
2038 | target
|
2039 | );
|
2040 | };
|
2041 |
|
2042 | var warnReservedPrefix = function (target, key) {
|
2043 | warn(
|
2044 | "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
2045 | 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
2046 | 'prevent conflicts with Vue internals' +
|
2047 | 'See: https://vuejs.org/v2/api/#data',
|
2048 | target
|
2049 | );
|
2050 | };
|
2051 |
|
2052 | var hasProxy =
|
2053 | typeof Proxy !== 'undefined' && isNative(Proxy);
|
2054 |
|
2055 | if (hasProxy) {
|
2056 | var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
2057 | config.keyCodes = new Proxy(config.keyCodes, {
|
2058 | set: function set (target, key, value) {
|
2059 | if (isBuiltInModifier(key)) {
|
2060 | warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
2061 | return false
|
2062 | } else {
|
2063 | target[key] = value;
|
2064 | return true
|
2065 | }
|
2066 | }
|
2067 | });
|
2068 | }
|
2069 |
|
2070 | var hasHandler = {
|
2071 | has: function has (target, key) {
|
2072 | var has = key in target;
|
2073 | var isAllowed = allowedGlobals(key) ||
|
2074 | (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
2075 | if (!has && !isAllowed) {
|
2076 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2077 | else { warnNonPresent(target, key); }
|
2078 | }
|
2079 | return has || !isAllowed
|
2080 | }
|
2081 | };
|
2082 |
|
2083 | var getHandler = {
|
2084 | get: function get (target, key) {
|
2085 | if (typeof key === 'string' && !(key in target)) {
|
2086 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2087 | else { warnNonPresent(target, key); }
|
2088 | }
|
2089 | return target[key]
|
2090 | }
|
2091 | };
|
2092 |
|
2093 | initProxy = function initProxy (vm) {
|
2094 | if (hasProxy) {
|
2095 |
|
2096 | var options = vm.$options;
|
2097 | var handlers = options.render && options.render._withStripped
|
2098 | ? getHandler
|
2099 | : hasHandler;
|
2100 | vm._renderProxy = new Proxy(vm, handlers);
|
2101 | } else {
|
2102 | vm._renderProxy = vm;
|
2103 | }
|
2104 | };
|
2105 | }
|
2106 |
|
2107 |
|
2108 |
|
2109 | var seenObjects = new _Set();
|
2110 |
|
2111 | |
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 | function traverse (val) {
|
2117 | _traverse(val, seenObjects);
|
2118 | seenObjects.clear();
|
2119 | }
|
2120 |
|
2121 | function _traverse (val, seen) {
|
2122 | var i, keys;
|
2123 | var isA = Array.isArray(val);
|
2124 | if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
2125 | return
|
2126 | }
|
2127 | if (val.__ob__) {
|
2128 | var depId = val.__ob__.dep.id;
|
2129 | if (seen.has(depId)) {
|
2130 | return
|
2131 | }
|
2132 | seen.add(depId);
|
2133 | }
|
2134 | if (isA) {
|
2135 | i = val.length;
|
2136 | while (i--) { _traverse(val[i], seen); }
|
2137 | } else {
|
2138 | keys = Object.keys(val);
|
2139 | i = keys.length;
|
2140 | while (i--) { _traverse(val[keys[i]], seen); }
|
2141 | }
|
2142 | }
|
2143 |
|
2144 |
|
2145 |
|
2146 | var normalizeEvent = cached(function (name) {
|
2147 | var passive = name.charAt(0) === '&';
|
2148 | name = passive ? name.slice(1) : name;
|
2149 | var once$$1 = name.charAt(0) === '~';
|
2150 | name = once$$1 ? name.slice(1) : name;
|
2151 | var capture = name.charAt(0) === '!';
|
2152 | name = capture ? name.slice(1) : name;
|
2153 | return {
|
2154 | name: name,
|
2155 | once: once$$1,
|
2156 | capture: capture,
|
2157 | passive: passive
|
2158 | }
|
2159 | });
|
2160 |
|
2161 | function createFnInvoker (fns, vm) {
|
2162 | function invoker () {
|
2163 | var arguments$1 = arguments;
|
2164 |
|
2165 | var fns = invoker.fns;
|
2166 | if (Array.isArray(fns)) {
|
2167 | var cloned = fns.slice();
|
2168 | for (var i = 0; i < cloned.length; i++) {
|
2169 | invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
2170 | }
|
2171 | } else {
|
2172 |
|
2173 | return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
2174 | }
|
2175 | }
|
2176 | invoker.fns = fns;
|
2177 | return invoker
|
2178 | }
|
2179 |
|
2180 | function updateListeners (
|
2181 | on,
|
2182 | oldOn,
|
2183 | add,
|
2184 | remove$$1,
|
2185 | createOnceHandler,
|
2186 | vm
|
2187 | ) {
|
2188 | var name, def$$1, cur, old, event;
|
2189 | for (name in on) {
|
2190 | def$$1 = cur = on[name];
|
2191 | old = oldOn[name];
|
2192 | event = normalizeEvent(name);
|
2193 | if (isUndef(cur)) {
|
2194 | warn(
|
2195 | "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
2196 | vm
|
2197 | );
|
2198 | } else if (isUndef(old)) {
|
2199 | if (isUndef(cur.fns)) {
|
2200 | cur = on[name] = createFnInvoker(cur, vm);
|
2201 | }
|
2202 | if (isTrue(event.once)) {
|
2203 | cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
2204 | }
|
2205 | add(event.name, cur, event.capture, event.passive, event.params);
|
2206 | } else if (cur !== old) {
|
2207 | old.fns = cur;
|
2208 | on[name] = old;
|
2209 | }
|
2210 | }
|
2211 | for (name in oldOn) {
|
2212 | if (isUndef(on[name])) {
|
2213 | event = normalizeEvent(name);
|
2214 | remove$$1(event.name, oldOn[name], event.capture);
|
2215 | }
|
2216 | }
|
2217 | }
|
2218 |
|
2219 |
|
2220 |
|
2221 | function mergeVNodeHook (def, hookKey, hook) {
|
2222 | if (def instanceof VNode) {
|
2223 | def = def.data.hook || (def.data.hook = {});
|
2224 | }
|
2225 | var invoker;
|
2226 | var oldHook = def[hookKey];
|
2227 |
|
2228 | function wrappedHook () {
|
2229 | hook.apply(this, arguments);
|
2230 |
|
2231 |
|
2232 | remove(invoker.fns, wrappedHook);
|
2233 | }
|
2234 |
|
2235 | if (isUndef(oldHook)) {
|
2236 |
|
2237 | invoker = createFnInvoker([wrappedHook]);
|
2238 | } else {
|
2239 |
|
2240 | if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
2241 |
|
2242 | invoker = oldHook;
|
2243 | invoker.fns.push(wrappedHook);
|
2244 | } else {
|
2245 |
|
2246 | invoker = createFnInvoker([oldHook, wrappedHook]);
|
2247 | }
|
2248 | }
|
2249 |
|
2250 | invoker.merged = true;
|
2251 | def[hookKey] = invoker;
|
2252 | }
|
2253 |
|
2254 |
|
2255 |
|
2256 | function extractPropsFromVNodeData (
|
2257 | data,
|
2258 | Ctor,
|
2259 | tag
|
2260 | ) {
|
2261 |
|
2262 |
|
2263 |
|
2264 | var propOptions = Ctor.options.props;
|
2265 | if (isUndef(propOptions)) {
|
2266 | return
|
2267 | }
|
2268 | var res = {};
|
2269 | var attrs = data.attrs;
|
2270 | var props = data.props;
|
2271 | if (isDef(attrs) || isDef(props)) {
|
2272 | for (var key in propOptions) {
|
2273 | var altKey = hyphenate(key);
|
2274 | {
|
2275 | var keyInLowerCase = key.toLowerCase();
|
2276 | if (
|
2277 | key !== keyInLowerCase &&
|
2278 | attrs && hasOwn(attrs, keyInLowerCase)
|
2279 | ) {
|
2280 | tip(
|
2281 | "Prop \"" + keyInLowerCase + "\" is passed to component " +
|
2282 | (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
2283 | " \"" + key + "\". " +
|
2284 | "Note that HTML attributes are case-insensitive and camelCased " +
|
2285 | "props need to use their kebab-case equivalents when using in-DOM " +
|
2286 | "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
2287 | );
|
2288 | }
|
2289 | }
|
2290 | checkProp(res, props, key, altKey, true) ||
|
2291 | checkProp(res, attrs, key, altKey, false);
|
2292 | }
|
2293 | }
|
2294 | return res
|
2295 | }
|
2296 |
|
2297 | function checkProp (
|
2298 | res,
|
2299 | hash,
|
2300 | key,
|
2301 | altKey,
|
2302 | preserve
|
2303 | ) {
|
2304 | if (isDef(hash)) {
|
2305 | if (hasOwn(hash, key)) {
|
2306 | res[key] = hash[key];
|
2307 | if (!preserve) {
|
2308 | delete hash[key];
|
2309 | }
|
2310 | return true
|
2311 | } else if (hasOwn(hash, altKey)) {
|
2312 | res[key] = hash[altKey];
|
2313 | if (!preserve) {
|
2314 | delete hash[altKey];
|
2315 | }
|
2316 | return true
|
2317 | }
|
2318 | }
|
2319 | return false
|
2320 | }
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 | function simpleNormalizeChildren (children) {
|
2337 | for (var i = 0; i < children.length; i++) {
|
2338 | if (Array.isArray(children[i])) {
|
2339 | return Array.prototype.concat.apply([], children)
|
2340 | }
|
2341 | }
|
2342 | return children
|
2343 | }
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 | function normalizeChildren (children) {
|
2350 | return isPrimitive(children)
|
2351 | ? [createTextVNode(children)]
|
2352 | : Array.isArray(children)
|
2353 | ? normalizeArrayChildren(children)
|
2354 | : undefined
|
2355 | }
|
2356 |
|
2357 | function isTextNode (node) {
|
2358 | return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
2359 | }
|
2360 |
|
2361 | function normalizeArrayChildren (children, nestedIndex) {
|
2362 | var res = [];
|
2363 | var i, c, lastIndex, last;
|
2364 | for (i = 0; i < children.length; i++) {
|
2365 | c = children[i];
|
2366 | if (isUndef(c) || typeof c === 'boolean') { continue }
|
2367 | lastIndex = res.length - 1;
|
2368 | last = res[lastIndex];
|
2369 |
|
2370 | if (Array.isArray(c)) {
|
2371 | if (c.length > 0) {
|
2372 | c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
2373 |
|
2374 | if (isTextNode(c[0]) && isTextNode(last)) {
|
2375 | res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
2376 | c.shift();
|
2377 | }
|
2378 | res.push.apply(res, c);
|
2379 | }
|
2380 | } else if (isPrimitive(c)) {
|
2381 | if (isTextNode(last)) {
|
2382 |
|
2383 |
|
2384 |
|
2385 | res[lastIndex] = createTextVNode(last.text + c);
|
2386 | } else if (c !== '') {
|
2387 |
|
2388 | res.push(createTextVNode(c));
|
2389 | }
|
2390 | } else {
|
2391 | if (isTextNode(c) && isTextNode(last)) {
|
2392 |
|
2393 | res[lastIndex] = createTextVNode(last.text + c.text);
|
2394 | } else {
|
2395 |
|
2396 | if (isTrue(children._isVList) &&
|
2397 | isDef(c.tag) &&
|
2398 | isUndef(c.key) &&
|
2399 | isDef(nestedIndex)) {
|
2400 | c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2401 | }
|
2402 | res.push(c);
|
2403 | }
|
2404 | }
|
2405 | }
|
2406 | return res
|
2407 | }
|
2408 |
|
2409 |
|
2410 |
|
2411 | function ensureCtor (comp, base) {
|
2412 | if (
|
2413 | comp.__esModule ||
|
2414 | (hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
2415 | ) {
|
2416 | comp = comp.default;
|
2417 | }
|
2418 | return isObject(comp)
|
2419 | ? base.extend(comp)
|
2420 | : comp
|
2421 | }
|
2422 |
|
2423 | function createAsyncPlaceholder (
|
2424 | factory,
|
2425 | data,
|
2426 | context,
|
2427 | children,
|
2428 | tag
|
2429 | ) {
|
2430 | var node = createEmptyVNode();
|
2431 | node.asyncFactory = factory;
|
2432 | node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
2433 | return node
|
2434 | }
|
2435 |
|
2436 | function resolveAsyncComponent (
|
2437 | factory,
|
2438 | baseCtor,
|
2439 | context
|
2440 | ) {
|
2441 | if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
2442 | return factory.errorComp
|
2443 | }
|
2444 |
|
2445 | if (isDef(factory.resolved)) {
|
2446 | return factory.resolved
|
2447 | }
|
2448 |
|
2449 | if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
2450 | return factory.loadingComp
|
2451 | }
|
2452 |
|
2453 | if (isDef(factory.contexts)) {
|
2454 |
|
2455 | factory.contexts.push(context);
|
2456 | } else {
|
2457 | var contexts = factory.contexts = [context];
|
2458 | var sync = true;
|
2459 |
|
2460 | var forceRender = function (renderCompleted) {
|
2461 | for (var i = 0, l = contexts.length; i < l; i++) {
|
2462 | contexts[i].$forceUpdate();
|
2463 | }
|
2464 |
|
2465 | if (renderCompleted) {
|
2466 | contexts.length = 0;
|
2467 | }
|
2468 | };
|
2469 |
|
2470 | var resolve = once(function (res) {
|
2471 |
|
2472 | factory.resolved = ensureCtor(res, baseCtor);
|
2473 |
|
2474 |
|
2475 | if (!sync) {
|
2476 | forceRender(true);
|
2477 | } else {
|
2478 | contexts.length = 0;
|
2479 | }
|
2480 | });
|
2481 |
|
2482 | var reject = once(function (reason) {
|
2483 | warn(
|
2484 | "Failed to resolve async component: " + (String(factory)) +
|
2485 | (reason ? ("\nReason: " + reason) : '')
|
2486 | );
|
2487 | if (isDef(factory.errorComp)) {
|
2488 | factory.error = true;
|
2489 | forceRender(true);
|
2490 | }
|
2491 | });
|
2492 |
|
2493 | var res = factory(resolve, reject);
|
2494 |
|
2495 | if (isObject(res)) {
|
2496 | if (isPromise(res)) {
|
2497 |
|
2498 | if (isUndef(factory.resolved)) {
|
2499 | res.then(resolve, reject);
|
2500 | }
|
2501 | } else if (isPromise(res.component)) {
|
2502 | res.component.then(resolve, reject);
|
2503 |
|
2504 | if (isDef(res.error)) {
|
2505 | factory.errorComp = ensureCtor(res.error, baseCtor);
|
2506 | }
|
2507 |
|
2508 | if (isDef(res.loading)) {
|
2509 | factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
2510 | if (res.delay === 0) {
|
2511 | factory.loading = true;
|
2512 | } else {
|
2513 | setTimeout(function () {
|
2514 | if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
2515 | factory.loading = true;
|
2516 | forceRender(false);
|
2517 | }
|
2518 | }, res.delay || 200);
|
2519 | }
|
2520 | }
|
2521 |
|
2522 | if (isDef(res.timeout)) {
|
2523 | setTimeout(function () {
|
2524 | if (isUndef(factory.resolved)) {
|
2525 | reject(
|
2526 | "timeout (" + (res.timeout) + "ms)"
|
2527 | );
|
2528 | }
|
2529 | }, res.timeout);
|
2530 | }
|
2531 | }
|
2532 | }
|
2533 |
|
2534 | sync = false;
|
2535 |
|
2536 | return factory.loading
|
2537 | ? factory.loadingComp
|
2538 | : factory.resolved
|
2539 | }
|
2540 | }
|
2541 |
|
2542 |
|
2543 |
|
2544 | function isAsyncPlaceholder (node) {
|
2545 | return node.isComment && node.asyncFactory
|
2546 | }
|
2547 |
|
2548 |
|
2549 |
|
2550 | function getFirstComponentChild (children) {
|
2551 | if (Array.isArray(children)) {
|
2552 | for (var i = 0; i < children.length; i++) {
|
2553 | var c = children[i];
|
2554 | if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
2555 | return c
|
2556 | }
|
2557 | }
|
2558 | }
|
2559 | }
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 | function initEvents (vm) {
|
2566 | vm._events = Object.create(null);
|
2567 | vm._hasHookEvent = false;
|
2568 |
|
2569 | var listeners = vm.$options._parentListeners;
|
2570 | if (listeners) {
|
2571 | updateComponentListeners(vm, listeners);
|
2572 | }
|
2573 | }
|
2574 |
|
2575 | var target;
|
2576 |
|
2577 | function add (event, fn) {
|
2578 | target.$on(event, fn);
|
2579 | }
|
2580 |
|
2581 | function remove$1 (event, fn) {
|
2582 | target.$off(event, fn);
|
2583 | }
|
2584 |
|
2585 | function createOnceHandler (event, fn) {
|
2586 | var _target = target;
|
2587 | return function onceHandler () {
|
2588 | var res = fn.apply(null, arguments);
|
2589 | if (res !== null) {
|
2590 | _target.$off(event, onceHandler);
|
2591 | }
|
2592 | }
|
2593 | }
|
2594 |
|
2595 | function updateComponentListeners (
|
2596 | vm,
|
2597 | listeners,
|
2598 | oldListeners
|
2599 | ) {
|
2600 | target = vm;
|
2601 | updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
2602 | target = undefined;
|
2603 | }
|
2604 |
|
2605 | function eventsMixin (Vue) {
|
2606 | var hookRE = /^hook:/;
|
2607 | Vue.prototype.$on = function (event, fn) {
|
2608 | var vm = this;
|
2609 | if (Array.isArray(event)) {
|
2610 | for (var i = 0, l = event.length; i < l; i++) {
|
2611 | vm.$on(event[i], fn);
|
2612 | }
|
2613 | } else {
|
2614 | (vm._events[event] || (vm._events[event] = [])).push(fn);
|
2615 |
|
2616 |
|
2617 | if (hookRE.test(event)) {
|
2618 | vm._hasHookEvent = true;
|
2619 | }
|
2620 | }
|
2621 | return vm
|
2622 | };
|
2623 |
|
2624 | Vue.prototype.$once = function (event, fn) {
|
2625 | var vm = this;
|
2626 | function on () {
|
2627 | vm.$off(event, on);
|
2628 | fn.apply(vm, arguments);
|
2629 | }
|
2630 | on.fn = fn;
|
2631 | vm.$on(event, on);
|
2632 | return vm
|
2633 | };
|
2634 |
|
2635 | Vue.prototype.$off = function (event, fn) {
|
2636 | var vm = this;
|
2637 |
|
2638 | if (!arguments.length) {
|
2639 | vm._events = Object.create(null);
|
2640 | return vm
|
2641 | }
|
2642 |
|
2643 | if (Array.isArray(event)) {
|
2644 | for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
2645 | vm.$off(event[i$1], fn);
|
2646 | }
|
2647 | return vm
|
2648 | }
|
2649 |
|
2650 | var cbs = vm._events[event];
|
2651 | if (!cbs) {
|
2652 | return vm
|
2653 | }
|
2654 | if (!fn) {
|
2655 | vm._events[event] = null;
|
2656 | return vm
|
2657 | }
|
2658 |
|
2659 | var cb;
|
2660 | var i = cbs.length;
|
2661 | while (i--) {
|
2662 | cb = cbs[i];
|
2663 | if (cb === fn || cb.fn === fn) {
|
2664 | cbs.splice(i, 1);
|
2665 | break
|
2666 | }
|
2667 | }
|
2668 | return vm
|
2669 | };
|
2670 |
|
2671 | Vue.prototype.$emit = function (event) {
|
2672 | var vm = this;
|
2673 | {
|
2674 | var lowerCaseEvent = event.toLowerCase();
|
2675 | if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
2676 | tip(
|
2677 | "Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
2678 | (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
2679 | "Note that HTML attributes are case-insensitive and you cannot use " +
|
2680 | "v-on to listen to camelCase events when using in-DOM templates. " +
|
2681 | "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
2682 | );
|
2683 | }
|
2684 | }
|
2685 | var cbs = vm._events[event];
|
2686 | if (cbs) {
|
2687 | cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
2688 | var args = toArray(arguments, 1);
|
2689 | var info = "event handler for \"" + event + "\"";
|
2690 | for (var i = 0, l = cbs.length; i < l; i++) {
|
2691 | invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
2692 | }
|
2693 | }
|
2694 | return vm
|
2695 | };
|
2696 | }
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 | |
2703 |
|
2704 |
|
2705 | function resolveSlots (
|
2706 | children,
|
2707 | context
|
2708 | ) {
|
2709 | if (!children || !children.length) {
|
2710 | return {}
|
2711 | }
|
2712 | var slots = {};
|
2713 | for (var i = 0, l = children.length; i < l; i++) {
|
2714 | var child = children[i];
|
2715 | var data = child.data;
|
2716 |
|
2717 | if (data && data.attrs && data.attrs.slot) {
|
2718 | delete data.attrs.slot;
|
2719 | }
|
2720 |
|
2721 |
|
2722 | if ((child.context === context || child.fnContext === context) &&
|
2723 | data && data.slot != null
|
2724 | ) {
|
2725 | var name = data.slot;
|
2726 | var slot = (slots[name] || (slots[name] = []));
|
2727 | if (child.tag === 'template') {
|
2728 | slot.push.apply(slot, child.children || []);
|
2729 | } else {
|
2730 | slot.push(child);
|
2731 | }
|
2732 | } else {
|
2733 | (slots.default || (slots.default = [])).push(child);
|
2734 | }
|
2735 | }
|
2736 |
|
2737 | for (var name$1 in slots) {
|
2738 | if (slots[name$1].every(isWhitespace)) {
|
2739 | delete slots[name$1];
|
2740 | }
|
2741 | }
|
2742 | return slots
|
2743 | }
|
2744 |
|
2745 | function isWhitespace (node) {
|
2746 | return (node.isComment && !node.asyncFactory) || node.text === ' '
|
2747 | }
|
2748 |
|
2749 | function resolveScopedSlots (
|
2750 | fns, // see flow/vnode
|
2751 | hasDynamicKeys,
|
2752 | res
|
2753 | ) {
|
2754 | res = res || { $stable: !hasDynamicKeys };
|
2755 | for (var i = 0; i < fns.length; i++) {
|
2756 | var slot = fns[i];
|
2757 | if (Array.isArray(slot)) {
|
2758 | resolveScopedSlots(slot, hasDynamicKeys, res);
|
2759 | } else if (slot) {
|
2760 | res[slot.key] = slot.fn;
|
2761 | }
|
2762 | }
|
2763 | return res
|
2764 | }
|
2765 |
|
2766 |
|
2767 |
|
2768 | var activeInstance = null;
|
2769 | var isUpdatingChildComponent = false;
|
2770 |
|
2771 | function setActiveInstance(vm) {
|
2772 | var prevActiveInstance = activeInstance;
|
2773 | activeInstance = vm;
|
2774 | return function () {
|
2775 | activeInstance = prevActiveInstance;
|
2776 | }
|
2777 | }
|
2778 |
|
2779 | function initLifecycle (vm) {
|
2780 | var options = vm.$options;
|
2781 |
|
2782 |
|
2783 | var parent = options.parent;
|
2784 | if (parent && !options.abstract) {
|
2785 | while (parent.$options.abstract && parent.$parent) {
|
2786 | parent = parent.$parent;
|
2787 | }
|
2788 | parent.$children.push(vm);
|
2789 | }
|
2790 |
|
2791 | vm.$parent = parent;
|
2792 | vm.$root = parent ? parent.$root : vm;
|
2793 |
|
2794 | vm.$children = [];
|
2795 | vm.$refs = {};
|
2796 |
|
2797 | vm._watcher = null;
|
2798 | vm._inactive = null;
|
2799 | vm._directInactive = false;
|
2800 | vm._isMounted = false;
|
2801 | vm._isDestroyed = false;
|
2802 | vm._isBeingDestroyed = false;
|
2803 | }
|
2804 |
|
2805 | function lifecycleMixin (Vue) {
|
2806 | Vue.prototype._update = function (vnode, hydrating) {
|
2807 | var vm = this;
|
2808 | var prevEl = vm.$el;
|
2809 | var prevVnode = vm._vnode;
|
2810 | var restoreActiveInstance = setActiveInstance(vm);
|
2811 | vm._vnode = vnode;
|
2812 |
|
2813 |
|
2814 | if (!prevVnode) {
|
2815 |
|
2816 | vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false );
|
2817 | } else {
|
2818 |
|
2819 | vm.$el = vm.__patch__(prevVnode, vnode);
|
2820 | }
|
2821 | restoreActiveInstance();
|
2822 |
|
2823 | if (prevEl) {
|
2824 | prevEl.__vue__ = null;
|
2825 | }
|
2826 | if (vm.$el) {
|
2827 | vm.$el.__vue__ = vm;
|
2828 | }
|
2829 |
|
2830 | if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
2831 | vm.$parent.$el = vm.$el;
|
2832 | }
|
2833 |
|
2834 |
|
2835 | };
|
2836 |
|
2837 | Vue.prototype.$forceUpdate = function () {
|
2838 | var vm = this;
|
2839 | if (vm._watcher) {
|
2840 | vm._watcher.update();
|
2841 | }
|
2842 | };
|
2843 |
|
2844 | Vue.prototype.$destroy = function () {
|
2845 | var vm = this;
|
2846 | if (vm._isBeingDestroyed) {
|
2847 | return
|
2848 | }
|
2849 | callHook(vm, 'beforeDestroy');
|
2850 | vm._isBeingDestroyed = true;
|
2851 |
|
2852 | var parent = vm.$parent;
|
2853 | if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
2854 | remove(parent.$children, vm);
|
2855 | }
|
2856 |
|
2857 | if (vm._watcher) {
|
2858 | vm._watcher.teardown();
|
2859 | }
|
2860 | var i = vm._watchers.length;
|
2861 | while (i--) {
|
2862 | vm._watchers[i].teardown();
|
2863 | }
|
2864 |
|
2865 |
|
2866 | if (vm._data.__ob__) {
|
2867 | vm._data.__ob__.vmCount--;
|
2868 | }
|
2869 |
|
2870 | vm._isDestroyed = true;
|
2871 |
|
2872 | vm.__patch__(vm._vnode, null);
|
2873 |
|
2874 | callHook(vm, 'destroyed');
|
2875 |
|
2876 | vm.$off();
|
2877 |
|
2878 | if (vm.$el) {
|
2879 | vm.$el.__vue__ = null;
|
2880 | }
|
2881 |
|
2882 | if (vm.$vnode) {
|
2883 | vm.$vnode.parent = null;
|
2884 | }
|
2885 | };
|
2886 | }
|
2887 |
|
2888 | function mountComponent (
|
2889 | vm,
|
2890 | el,
|
2891 | hydrating
|
2892 | ) {
|
2893 | vm.$el = el;
|
2894 | if (!vm.$options.render) {
|
2895 | vm.$options.render = createEmptyVNode;
|
2896 | {
|
2897 |
|
2898 | if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
2899 | vm.$options.el || el) {
|
2900 | warn(
|
2901 | 'You are using the runtime-only build of Vue where the template ' +
|
2902 | 'compiler is not available. Either pre-compile the templates into ' +
|
2903 | 'render functions, or use the compiler-included build.',
|
2904 | vm
|
2905 | );
|
2906 | } else {
|
2907 | warn(
|
2908 | 'Failed to mount component: template or render function not defined.',
|
2909 | vm
|
2910 | );
|
2911 | }
|
2912 | }
|
2913 | }
|
2914 | callHook(vm, 'beforeMount');
|
2915 |
|
2916 | var updateComponent;
|
2917 |
|
2918 | if (config.performance && mark) {
|
2919 | updateComponent = function () {
|
2920 | var name = vm._name;
|
2921 | var id = vm._uid;
|
2922 | var startTag = "vue-perf-start:" + id;
|
2923 | var endTag = "vue-perf-end:" + id;
|
2924 |
|
2925 | mark(startTag);
|
2926 | var vnode = vm._render();
|
2927 | mark(endTag);
|
2928 | measure(("vue " + name + " render"), startTag, endTag);
|
2929 |
|
2930 | mark(startTag);
|
2931 | vm._update(vnode, hydrating);
|
2932 | mark(endTag);
|
2933 | measure(("vue " + name + " patch"), startTag, endTag);
|
2934 | };
|
2935 | } else {
|
2936 | updateComponent = function () {
|
2937 | vm._update(vm._render(), hydrating);
|
2938 | };
|
2939 | }
|
2940 |
|
2941 |
|
2942 |
|
2943 |
|
2944 | new Watcher(vm, updateComponent, noop, {
|
2945 | before: function before () {
|
2946 | if (vm._isMounted && !vm._isDestroyed) {
|
2947 | callHook(vm, 'beforeUpdate');
|
2948 | }
|
2949 | }
|
2950 | }, true );
|
2951 | hydrating = false;
|
2952 |
|
2953 |
|
2954 |
|
2955 | if (vm.$vnode == null) {
|
2956 | vm._isMounted = true;
|
2957 | callHook(vm, 'mounted');
|
2958 | }
|
2959 | return vm
|
2960 | }
|
2961 |
|
2962 | function updateChildComponent (
|
2963 | vm,
|
2964 | propsData,
|
2965 | listeners,
|
2966 | parentVnode,
|
2967 | renderChildren
|
2968 | ) {
|
2969 | {
|
2970 | isUpdatingChildComponent = true;
|
2971 | }
|
2972 |
|
2973 |
|
2974 |
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 | var hasDynamicScopedSlot = !!(
|
2980 | (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
2981 | (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
2982 | );
|
2983 |
|
2984 |
|
2985 |
|
2986 | var needsForceUpdate = !!(
|
2987 | renderChildren ||
|
2988 | vm.$options._renderChildren ||
|
2989 | hasDynamicScopedSlot
|
2990 | );
|
2991 |
|
2992 | vm.$options._parentVnode = parentVnode;
|
2993 | vm.$vnode = parentVnode;
|
2994 |
|
2995 | if (vm._vnode) {
|
2996 | vm._vnode.parent = parentVnode;
|
2997 | }
|
2998 | vm.$options._renderChildren = renderChildren;
|
2999 |
|
3000 |
|
3001 |
|
3002 |
|
3003 | vm.$attrs = parentVnode.data.attrs || emptyObject;
|
3004 | vm.$listeners = listeners || emptyObject;
|
3005 |
|
3006 |
|
3007 | if (propsData && vm.$options.props) {
|
3008 | toggleObserving(false);
|
3009 | var props = vm._props;
|
3010 | var propKeys = vm.$options._propKeys || [];
|
3011 | for (var i = 0; i < propKeys.length; i++) {
|
3012 | var key = propKeys[i];
|
3013 | var propOptions = vm.$options.props;
|
3014 | props[key] = validateProp(key, propOptions, propsData, vm);
|
3015 | }
|
3016 | toggleObserving(true);
|
3017 |
|
3018 | vm.$options.propsData = propsData;
|
3019 | }
|
3020 |
|
3021 |
|
3022 | listeners = listeners || emptyObject;
|
3023 | var oldListeners = vm.$options._parentListeners;
|
3024 | vm.$options._parentListeners = listeners;
|
3025 | updateComponentListeners(vm, listeners, oldListeners);
|
3026 |
|
3027 |
|
3028 | if (needsForceUpdate) {
|
3029 | vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
3030 | vm.$forceUpdate();
|
3031 | }
|
3032 |
|
3033 | {
|
3034 | isUpdatingChildComponent = false;
|
3035 | }
|
3036 | }
|
3037 |
|
3038 | function isInInactiveTree (vm) {
|
3039 | while (vm && (vm = vm.$parent)) {
|
3040 | if (vm._inactive) { return true }
|
3041 | }
|
3042 | return false
|
3043 | }
|
3044 |
|
3045 | function activateChildComponent (vm, direct) {
|
3046 | if (direct) {
|
3047 | vm._directInactive = false;
|
3048 | if (isInInactiveTree(vm)) {
|
3049 | return
|
3050 | }
|
3051 | } else if (vm._directInactive) {
|
3052 | return
|
3053 | }
|
3054 | if (vm._inactive || vm._inactive === null) {
|
3055 | vm._inactive = false;
|
3056 | for (var i = 0; i < vm.$children.length; i++) {
|
3057 | activateChildComponent(vm.$children[i]);
|
3058 | }
|
3059 | callHook(vm, 'activated');
|
3060 | }
|
3061 | }
|
3062 |
|
3063 | function deactivateChildComponent (vm, direct) {
|
3064 | if (direct) {
|
3065 | vm._directInactive = true;
|
3066 | if (isInInactiveTree(vm)) {
|
3067 | return
|
3068 | }
|
3069 | }
|
3070 | if (!vm._inactive) {
|
3071 | vm._inactive = true;
|
3072 | for (var i = 0; i < vm.$children.length; i++) {
|
3073 | deactivateChildComponent(vm.$children[i]);
|
3074 | }
|
3075 | callHook(vm, 'deactivated');
|
3076 | }
|
3077 | }
|
3078 |
|
3079 | function callHook (vm, hook) {
|
3080 |
|
3081 | pushTarget();
|
3082 | var handlers = vm.$options[hook];
|
3083 | var info = hook + " hook";
|
3084 | if (handlers) {
|
3085 | for (var i = 0, j = handlers.length; i < j; i++) {
|
3086 | invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
3087 | }
|
3088 | }
|
3089 | if (vm._hasHookEvent) {
|
3090 | vm.$emit('hook:' + hook);
|
3091 | }
|
3092 | popTarget();
|
3093 | }
|
3094 |
|
3095 |
|
3096 |
|
3097 | var MAX_UPDATE_COUNT = 100;
|
3098 |
|
3099 | var queue = [];
|
3100 | var activatedChildren = [];
|
3101 | var has = {};
|
3102 | var circular = {};
|
3103 | var waiting = false;
|
3104 | var flushing = false;
|
3105 | var index = 0;
|
3106 |
|
3107 | |
3108 |
|
3109 |
|
3110 | function resetSchedulerState () {
|
3111 | index = queue.length = activatedChildren.length = 0;
|
3112 | has = {};
|
3113 | {
|
3114 | circular = {};
|
3115 | }
|
3116 | waiting = flushing = false;
|
3117 | }
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 | var currentFlushTimestamp = 0;
|
3125 |
|
3126 |
|
3127 | var getNow = Date.now;
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 | if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
3134 |
|
3135 |
|
3136 |
|
3137 | getNow = function () { return performance.now(); };
|
3138 | }
|
3139 |
|
3140 | |
3141 |
|
3142 |
|
3143 | function flushSchedulerQueue () {
|
3144 | currentFlushTimestamp = getNow();
|
3145 | flushing = true;
|
3146 | var watcher, id;
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 | queue.sort(function (a, b) { return a.id - b.id; });
|
3157 |
|
3158 |
|
3159 |
|
3160 | for (index = 0; index < queue.length; index++) {
|
3161 | watcher = queue[index];
|
3162 | if (watcher.before) {
|
3163 | watcher.before();
|
3164 | }
|
3165 | id = watcher.id;
|
3166 | has[id] = null;
|
3167 | watcher.run();
|
3168 |
|
3169 | if (has[id] != null) {
|
3170 | circular[id] = (circular[id] || 0) + 1;
|
3171 | if (circular[id] > MAX_UPDATE_COUNT) {
|
3172 | warn(
|
3173 | 'You may have an infinite update loop ' + (
|
3174 | watcher.user
|
3175 | ? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
3176 | : "in a component render function."
|
3177 | ),
|
3178 | watcher.vm
|
3179 | );
|
3180 | break
|
3181 | }
|
3182 | }
|
3183 | }
|
3184 |
|
3185 |
|
3186 | var activatedQueue = activatedChildren.slice();
|
3187 | var updatedQueue = queue.slice();
|
3188 |
|
3189 | resetSchedulerState();
|
3190 |
|
3191 |
|
3192 | callActivatedHooks(activatedQueue);
|
3193 | callUpdatedHooks(updatedQueue);
|
3194 |
|
3195 |
|
3196 |
|
3197 | if (devtools && config.devtools) {
|
3198 | devtools.emit('flush');
|
3199 | }
|
3200 | }
|
3201 |
|
3202 | function callUpdatedHooks (queue) {
|
3203 | var i = queue.length;
|
3204 | while (i--) {
|
3205 | var watcher = queue[i];
|
3206 | var vm = watcher.vm;
|
3207 | if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
3208 | callHook(vm, 'updated');
|
3209 | }
|
3210 | }
|
3211 | }
|
3212 |
|
3213 | |
3214 |
|
3215 |
|
3216 |
|
3217 | function queueActivatedComponent (vm) {
|
3218 |
|
3219 |
|
3220 | vm._inactive = false;
|
3221 | activatedChildren.push(vm);
|
3222 | }
|
3223 |
|
3224 | function callActivatedHooks (queue) {
|
3225 | for (var i = 0; i < queue.length; i++) {
|
3226 | queue[i]._inactive = true;
|
3227 | activateChildComponent(queue[i], true );
|
3228 | }
|
3229 | }
|
3230 |
|
3231 | |
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 | function queueWatcher (watcher) {
|
3237 | var id = watcher.id;
|
3238 | if (has[id] == null) {
|
3239 | has[id] = true;
|
3240 | if (!flushing) {
|
3241 | queue.push(watcher);
|
3242 | } else {
|
3243 |
|
3244 |
|
3245 | var i = queue.length - 1;
|
3246 | while (i > index && queue[i].id > watcher.id) {
|
3247 | i--;
|
3248 | }
|
3249 | queue.splice(i + 1, 0, watcher);
|
3250 | }
|
3251 |
|
3252 | if (!waiting) {
|
3253 | waiting = true;
|
3254 |
|
3255 | if (!config.async) {
|
3256 | flushSchedulerQueue();
|
3257 | return
|
3258 | }
|
3259 | nextTick(flushSchedulerQueue);
|
3260 | }
|
3261 | }
|
3262 | }
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 | var uid$1 = 0;
|
3269 |
|
3270 | |
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 | var Watcher = function Watcher (
|
3276 | vm,
|
3277 | expOrFn,
|
3278 | cb,
|
3279 | options,
|
3280 | isRenderWatcher
|
3281 | ) {
|
3282 | this.vm = vm;
|
3283 | if (isRenderWatcher) {
|
3284 | vm._watcher = this;
|
3285 | }
|
3286 | vm._watchers.push(this);
|
3287 |
|
3288 | if (options) {
|
3289 | this.deep = !!options.deep;
|
3290 | this.user = !!options.user;
|
3291 | this.lazy = !!options.lazy;
|
3292 | this.sync = !!options.sync;
|
3293 | this.before = options.before;
|
3294 | } else {
|
3295 | this.deep = this.user = this.lazy = this.sync = false;
|
3296 | }
|
3297 | this.cb = cb;
|
3298 | this.id = ++uid$1;
|
3299 | this.active = true;
|
3300 | this.dirty = this.lazy;
|
3301 | this.deps = [];
|
3302 | this.newDeps = [];
|
3303 | this.depIds = new _Set();
|
3304 | this.newDepIds = new _Set();
|
3305 | this.expression = expOrFn.toString();
|
3306 |
|
3307 | if (typeof expOrFn === 'function') {
|
3308 | this.getter = expOrFn;
|
3309 | } else {
|
3310 | this.getter = parsePath(expOrFn);
|
3311 | if (!this.getter) {
|
3312 | this.getter = noop;
|
3313 | warn(
|
3314 | "Failed watching path: \"" + expOrFn + "\" " +
|
3315 | 'Watcher only accepts simple dot-delimited paths. ' +
|
3316 | 'For full control, use a function instead.',
|
3317 | vm
|
3318 | );
|
3319 | }
|
3320 | }
|
3321 | this.value = this.lazy
|
3322 | ? undefined
|
3323 | : this.get();
|
3324 | };
|
3325 |
|
3326 | |
3327 |
|
3328 |
|
3329 | Watcher.prototype.get = function get () {
|
3330 | pushTarget(this);
|
3331 | var value;
|
3332 | var vm = this.vm;
|
3333 | try {
|
3334 | value = this.getter.call(vm, vm);
|
3335 | } catch (e) {
|
3336 | if (this.user) {
|
3337 | handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
3338 | } else {
|
3339 | throw e
|
3340 | }
|
3341 | } finally {
|
3342 |
|
3343 |
|
3344 | if (this.deep) {
|
3345 | traverse(value);
|
3346 | }
|
3347 | popTarget();
|
3348 | this.cleanupDeps();
|
3349 | }
|
3350 | return value
|
3351 | };
|
3352 |
|
3353 | |
3354 |
|
3355 |
|
3356 | Watcher.prototype.addDep = function addDep (dep) {
|
3357 | var id = dep.id;
|
3358 | if (!this.newDepIds.has(id)) {
|
3359 | this.newDepIds.add(id);
|
3360 | this.newDeps.push(dep);
|
3361 | if (!this.depIds.has(id)) {
|
3362 | dep.addSub(this);
|
3363 | }
|
3364 | }
|
3365 | };
|
3366 |
|
3367 | |
3368 |
|
3369 |
|
3370 | Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
3371 | var i = this.deps.length;
|
3372 | while (i--) {
|
3373 | var dep = this.deps[i];
|
3374 | if (!this.newDepIds.has(dep.id)) {
|
3375 | dep.removeSub(this);
|
3376 | }
|
3377 | }
|
3378 | var tmp = this.depIds;
|
3379 | this.depIds = this.newDepIds;
|
3380 | this.newDepIds = tmp;
|
3381 | this.newDepIds.clear();
|
3382 | tmp = this.deps;
|
3383 | this.deps = this.newDeps;
|
3384 | this.newDeps = tmp;
|
3385 | this.newDeps.length = 0;
|
3386 | };
|
3387 |
|
3388 | |
3389 |
|
3390 |
|
3391 |
|
3392 | Watcher.prototype.update = function update () {
|
3393 |
|
3394 | if (this.lazy) {
|
3395 | this.dirty = true;
|
3396 | } else if (this.sync) {
|
3397 | this.run();
|
3398 | } else {
|
3399 | queueWatcher(this);
|
3400 | }
|
3401 | };
|
3402 |
|
3403 | |
3404 |
|
3405 |
|
3406 |
|
3407 | Watcher.prototype.run = function run () {
|
3408 | if (this.active) {
|
3409 | var value = this.get();
|
3410 | if (
|
3411 | value !== this.value ||
|
3412 |
|
3413 |
|
3414 |
|
3415 | isObject(value) ||
|
3416 | this.deep
|
3417 | ) {
|
3418 |
|
3419 | var oldValue = this.value;
|
3420 | this.value = value;
|
3421 | if (this.user) {
|
3422 | try {
|
3423 | this.cb.call(this.vm, value, oldValue);
|
3424 | } catch (e) {
|
3425 | handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
3426 | }
|
3427 | } else {
|
3428 | this.cb.call(this.vm, value, oldValue);
|
3429 | }
|
3430 | }
|
3431 | }
|
3432 | };
|
3433 |
|
3434 | |
3435 |
|
3436 |
|
3437 |
|
3438 | Watcher.prototype.evaluate = function evaluate () {
|
3439 | this.value = this.get();
|
3440 | this.dirty = false;
|
3441 | };
|
3442 |
|
3443 | |
3444 |
|
3445 |
|
3446 | Watcher.prototype.depend = function depend () {
|
3447 | var i = this.deps.length;
|
3448 | while (i--) {
|
3449 | this.deps[i].depend();
|
3450 | }
|
3451 | };
|
3452 |
|
3453 | |
3454 |
|
3455 |
|
3456 | Watcher.prototype.teardown = function teardown () {
|
3457 | if (this.active) {
|
3458 |
|
3459 |
|
3460 |
|
3461 | if (!this.vm._isBeingDestroyed) {
|
3462 | remove(this.vm._watchers, this);
|
3463 | }
|
3464 | var i = this.deps.length;
|
3465 | while (i--) {
|
3466 | this.deps[i].removeSub(this);
|
3467 | }
|
3468 | this.active = false;
|
3469 | }
|
3470 | };
|
3471 |
|
3472 |
|
3473 |
|
3474 | var sharedPropertyDefinition = {
|
3475 | enumerable: true,
|
3476 | configurable: true,
|
3477 | get: noop,
|
3478 | set: noop
|
3479 | };
|
3480 |
|
3481 | function proxy (target, sourceKey, key) {
|
3482 | sharedPropertyDefinition.get = function proxyGetter () {
|
3483 | return this[sourceKey][key]
|
3484 | };
|
3485 | sharedPropertyDefinition.set = function proxySetter (val) {
|
3486 | this[sourceKey][key] = val;
|
3487 | };
|
3488 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
3489 | }
|
3490 |
|
3491 | function initState (vm) {
|
3492 | vm._watchers = [];
|
3493 | var opts = vm.$options;
|
3494 | if (opts.props) { initProps(vm, opts.props); }
|
3495 | if (opts.methods) { initMethods(vm, opts.methods); }
|
3496 | if (opts.data) {
|
3497 | initData(vm);
|
3498 | } else {
|
3499 | observe(vm._data = {}, true );
|
3500 | }
|
3501 | if (opts.computed) { initComputed(vm, opts.computed); }
|
3502 | if (opts.watch && opts.watch !== nativeWatch) {
|
3503 | initWatch(vm, opts.watch);
|
3504 | }
|
3505 | }
|
3506 |
|
3507 | function initProps (vm, propsOptions) {
|
3508 | var propsData = vm.$options.propsData || {};
|
3509 | var props = vm._props = {};
|
3510 |
|
3511 |
|
3512 | var keys = vm.$options._propKeys = [];
|
3513 | var isRoot = !vm.$parent;
|
3514 |
|
3515 | if (!isRoot) {
|
3516 | toggleObserving(false);
|
3517 | }
|
3518 | var loop = function ( key ) {
|
3519 | keys.push(key);
|
3520 | var value = validateProp(key, propsOptions, propsData, vm);
|
3521 |
|
3522 | {
|
3523 | var hyphenatedKey = hyphenate(key);
|
3524 | if (isReservedAttribute(hyphenatedKey) ||
|
3525 | config.isReservedAttr(hyphenatedKey)) {
|
3526 | warn(
|
3527 | ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
3528 | vm
|
3529 | );
|
3530 | }
|
3531 | defineReactive$$1(props, key, value, function () {
|
3532 | if (!isRoot && !isUpdatingChildComponent) {
|
3533 | warn(
|
3534 | "Avoid mutating a prop directly since the value will be " +
|
3535 | "overwritten whenever the parent component re-renders. " +
|
3536 | "Instead, use a data or computed property based on the prop's " +
|
3537 | "value. Prop being mutated: \"" + key + "\"",
|
3538 | vm
|
3539 | );
|
3540 | }
|
3541 | });
|
3542 | }
|
3543 |
|
3544 |
|
3545 |
|
3546 | if (!(key in vm)) {
|
3547 | proxy(vm, "_props", key);
|
3548 | }
|
3549 | };
|
3550 |
|
3551 | for (var key in propsOptions) loop( key );
|
3552 | toggleObserving(true);
|
3553 | }
|
3554 |
|
3555 | function initData (vm) {
|
3556 | var data = vm.$options.data;
|
3557 | data = vm._data = typeof data === 'function'
|
3558 | ? getData(data, vm)
|
3559 | : data || {};
|
3560 | if (!isPlainObject(data)) {
|
3561 | data = {};
|
3562 | warn(
|
3563 | 'data functions should return an object:\n' +
|
3564 | 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
3565 | vm
|
3566 | );
|
3567 | }
|
3568 |
|
3569 | var keys = Object.keys(data);
|
3570 | var props = vm.$options.props;
|
3571 | var methods = vm.$options.methods;
|
3572 | var i = keys.length;
|
3573 | while (i--) {
|
3574 | var key = keys[i];
|
3575 | {
|
3576 | if (methods && hasOwn(methods, key)) {
|
3577 | warn(
|
3578 | ("Method \"" + key + "\" has already been defined as a data property."),
|
3579 | vm
|
3580 | );
|
3581 | }
|
3582 | }
|
3583 | if (props && hasOwn(props, key)) {
|
3584 | warn(
|
3585 | "The data property \"" + key + "\" is already declared as a prop. " +
|
3586 | "Use prop default value instead.",
|
3587 | vm
|
3588 | );
|
3589 | } else if (!isReserved(key)) {
|
3590 | proxy(vm, "_data", key);
|
3591 | }
|
3592 | }
|
3593 |
|
3594 | observe(data, true );
|
3595 | }
|
3596 |
|
3597 | function getData (data, vm) {
|
3598 |
|
3599 | pushTarget();
|
3600 | try {
|
3601 | return data.call(vm, vm)
|
3602 | } catch (e) {
|
3603 | handleError(e, vm, "data()");
|
3604 | return {}
|
3605 | } finally {
|
3606 | popTarget();
|
3607 | }
|
3608 | }
|
3609 |
|
3610 | var computedWatcherOptions = { lazy: true };
|
3611 |
|
3612 | function initComputed (vm, computed) {
|
3613 |
|
3614 | var watchers = vm._computedWatchers = Object.create(null);
|
3615 |
|
3616 | var isSSR = isServerRendering();
|
3617 |
|
3618 | for (var key in computed) {
|
3619 | var userDef = computed[key];
|
3620 | var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
3621 | if (getter == null) {
|
3622 | warn(
|
3623 | ("Getter is missing for computed property \"" + key + "\"."),
|
3624 | vm
|
3625 | );
|
3626 | }
|
3627 |
|
3628 | if (!isSSR) {
|
3629 |
|
3630 | watchers[key] = new Watcher(
|
3631 | vm,
|
3632 | getter || noop,
|
3633 | noop,
|
3634 | computedWatcherOptions
|
3635 | );
|
3636 | }
|
3637 |
|
3638 |
|
3639 |
|
3640 |
|
3641 | if (!(key in vm)) {
|
3642 | defineComputed(vm, key, userDef);
|
3643 | } else {
|
3644 | if (key in vm.$data) {
|
3645 | warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
3646 | } else if (vm.$options.props && key in vm.$options.props) {
|
3647 | warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
3648 | }
|
3649 | }
|
3650 | }
|
3651 | }
|
3652 |
|
3653 | function defineComputed (
|
3654 | target,
|
3655 | key,
|
3656 | userDef
|
3657 | ) {
|
3658 | var shouldCache = !isServerRendering();
|
3659 | if (typeof userDef === 'function') {
|
3660 | sharedPropertyDefinition.get = shouldCache
|
3661 | ? createComputedGetter(key)
|
3662 | : createGetterInvoker(userDef);
|
3663 | sharedPropertyDefinition.set = noop;
|
3664 | } else {
|
3665 | sharedPropertyDefinition.get = userDef.get
|
3666 | ? shouldCache && userDef.cache !== false
|
3667 | ? createComputedGetter(key)
|
3668 | : createGetterInvoker(userDef.get)
|
3669 | : noop;
|
3670 | sharedPropertyDefinition.set = userDef.set || noop;
|
3671 | }
|
3672 | if (sharedPropertyDefinition.set === noop) {
|
3673 | sharedPropertyDefinition.set = function () {
|
3674 | warn(
|
3675 | ("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
3676 | this
|
3677 | );
|
3678 | };
|
3679 | }
|
3680 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
3681 | }
|
3682 |
|
3683 | function createComputedGetter (key) {
|
3684 | return function computedGetter () {
|
3685 | var watcher = this._computedWatchers && this._computedWatchers[key];
|
3686 | if (watcher) {
|
3687 | if (watcher.dirty) {
|
3688 | watcher.evaluate();
|
3689 | }
|
3690 | if (Dep.target) {
|
3691 | watcher.depend();
|
3692 | }
|
3693 | return watcher.value
|
3694 | }
|
3695 | }
|
3696 | }
|
3697 |
|
3698 | function createGetterInvoker(fn) {
|
3699 | return function computedGetter () {
|
3700 | return fn.call(this, this)
|
3701 | }
|
3702 | }
|
3703 |
|
3704 | function initMethods (vm, methods) {
|
3705 | var props = vm.$options.props;
|
3706 | for (var key in methods) {
|
3707 | {
|
3708 | if (typeof methods[key] !== 'function') {
|
3709 | warn(
|
3710 | "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
3711 | "Did you reference the function correctly?",
|
3712 | vm
|
3713 | );
|
3714 | }
|
3715 | if (props && hasOwn(props, key)) {
|
3716 | warn(
|
3717 | ("Method \"" + key + "\" has already been defined as a prop."),
|
3718 | vm
|
3719 | );
|
3720 | }
|
3721 | if ((key in vm) && isReserved(key)) {
|
3722 | warn(
|
3723 | "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
3724 | "Avoid defining component methods that start with _ or $."
|
3725 | );
|
3726 | }
|
3727 | }
|
3728 | vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
3729 | }
|
3730 | }
|
3731 |
|
3732 | function initWatch (vm, watch) {
|
3733 | for (var key in watch) {
|
3734 | var handler = watch[key];
|
3735 | if (Array.isArray(handler)) {
|
3736 | for (var i = 0; i < handler.length; i++) {
|
3737 | createWatcher(vm, key, handler[i]);
|
3738 | }
|
3739 | } else {
|
3740 | createWatcher(vm, key, handler);
|
3741 | }
|
3742 | }
|
3743 | }
|
3744 |
|
3745 | function createWatcher (
|
3746 | vm,
|
3747 | expOrFn,
|
3748 | handler,
|
3749 | options
|
3750 | ) {
|
3751 | if (isPlainObject(handler)) {
|
3752 | options = handler;
|
3753 | handler = handler.handler;
|
3754 | }
|
3755 | if (typeof handler === 'string') {
|
3756 | handler = vm[handler];
|
3757 | }
|
3758 | return vm.$watch(expOrFn, handler, options)
|
3759 | }
|
3760 |
|
3761 | function stateMixin (Vue) {
|
3762 |
|
3763 |
|
3764 |
|
3765 | var dataDef = {};
|
3766 | dataDef.get = function () { return this._data };
|
3767 | var propsDef = {};
|
3768 | propsDef.get = function () { return this._props };
|
3769 | {
|
3770 | dataDef.set = function () {
|
3771 | warn(
|
3772 | 'Avoid replacing instance root $data. ' +
|
3773 | 'Use nested data properties instead.',
|
3774 | this
|
3775 | );
|
3776 | };
|
3777 | propsDef.set = function () {
|
3778 | warn("$props is readonly.", this);
|
3779 | };
|
3780 | }
|
3781 | Object.defineProperty(Vue.prototype, '$data', dataDef);
|
3782 | Object.defineProperty(Vue.prototype, '$props', propsDef);
|
3783 |
|
3784 | Vue.prototype.$set = set;
|
3785 | Vue.prototype.$delete = del;
|
3786 |
|
3787 | Vue.prototype.$watch = function (
|
3788 | expOrFn,
|
3789 | cb,
|
3790 | options
|
3791 | ) {
|
3792 | var vm = this;
|
3793 | if (isPlainObject(cb)) {
|
3794 | return createWatcher(vm, expOrFn, cb, options)
|
3795 | }
|
3796 | options = options || {};
|
3797 | options.user = true;
|
3798 | var watcher = new Watcher(vm, expOrFn, cb, options);
|
3799 | if (options.immediate) {
|
3800 | try {
|
3801 | cb.call(vm, watcher.value);
|
3802 | } catch (error) {
|
3803 | handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
3804 | }
|
3805 | }
|
3806 | return function unwatchFn () {
|
3807 | watcher.teardown();
|
3808 | }
|
3809 | };
|
3810 | }
|
3811 |
|
3812 |
|
3813 |
|
3814 | function initProvide (vm) {
|
3815 | var provide = vm.$options.provide;
|
3816 | if (provide) {
|
3817 | vm._provided = typeof provide === 'function'
|
3818 | ? provide.call(vm)
|
3819 | : provide;
|
3820 | }
|
3821 | }
|
3822 |
|
3823 | function initInjections (vm) {
|
3824 | var result = resolveInject(vm.$options.inject, vm);
|
3825 | if (result) {
|
3826 | toggleObserving(false);
|
3827 | Object.keys(result).forEach(function (key) {
|
3828 |
|
3829 | {
|
3830 | defineReactive$$1(vm, key, result[key], function () {
|
3831 | warn(
|
3832 | "Avoid mutating an injected value directly since the changes will be " +
|
3833 | "overwritten whenever the provided component re-renders. " +
|
3834 | "injection being mutated: \"" + key + "\"",
|
3835 | vm
|
3836 | );
|
3837 | });
|
3838 | }
|
3839 | });
|
3840 | toggleObserving(true);
|
3841 | }
|
3842 | }
|
3843 |
|
3844 | function resolveInject (inject, vm) {
|
3845 | if (inject) {
|
3846 |
|
3847 | var result = Object.create(null);
|
3848 | var keys = hasSymbol
|
3849 | ? Reflect.ownKeys(inject)
|
3850 | : Object.keys(inject);
|
3851 |
|
3852 | for (var i = 0; i < keys.length; i++) {
|
3853 | var key = keys[i];
|
3854 |
|
3855 | if (key === '__ob__') { continue }
|
3856 | var provideKey = inject[key].from;
|
3857 | var source = vm;
|
3858 | while (source) {
|
3859 | if (source._provided && hasOwn(source._provided, provideKey)) {
|
3860 | result[key] = source._provided[provideKey];
|
3861 | break
|
3862 | }
|
3863 | source = source.$parent;
|
3864 | }
|
3865 | if (!source) {
|
3866 | if ('default' in inject[key]) {
|
3867 | var provideDefault = inject[key].default;
|
3868 | result[key] = typeof provideDefault === 'function'
|
3869 | ? provideDefault.call(vm)
|
3870 | : provideDefault;
|
3871 | } else {
|
3872 | warn(("Injection \"" + key + "\" not found"), vm);
|
3873 | }
|
3874 | }
|
3875 | }
|
3876 | return result
|
3877 | }
|
3878 | }
|
3879 |
|
3880 |
|
3881 |
|
3882 | function normalizeScopedSlots (
|
3883 | slots,
|
3884 | normalSlots
|
3885 | ) {
|
3886 | var res;
|
3887 | if (!slots) {
|
3888 | res = {};
|
3889 | } else if (slots._normalized) {
|
3890 | return slots
|
3891 | } else {
|
3892 | res = {};
|
3893 | for (var key in slots) {
|
3894 | if (slots[key] && key[0] !== '$') {
|
3895 | res[key] = normalizeScopedSlot(slots[key]);
|
3896 | }
|
3897 | }
|
3898 | }
|
3899 |
|
3900 | for (var key$1 in normalSlots) {
|
3901 | if (!(key$1 in res)) {
|
3902 | res[key$1] = proxyNormalSlot(normalSlots, key$1);
|
3903 | }
|
3904 | }
|
3905 | res._normalized = true;
|
3906 | res.$stable = slots ? slots.$stable : true;
|
3907 | return res
|
3908 | }
|
3909 |
|
3910 | function normalizeScopedSlot(fn) {
|
3911 | return function (scope) {
|
3912 | var res = fn(scope);
|
3913 | return res && typeof res === 'object' && !Array.isArray(res)
|
3914 | ? [res]
|
3915 | : normalizeChildren(res)
|
3916 | }
|
3917 | }
|
3918 |
|
3919 | function proxyNormalSlot(slots, key) {
|
3920 | return function () { return slots[key]; }
|
3921 | }
|
3922 |
|
3923 |
|
3924 |
|
3925 | |
3926 |
|
3927 |
|
3928 | function renderList (
|
3929 | val,
|
3930 | render
|
3931 | ) {
|
3932 | var ret, i, l, keys, key;
|
3933 | if (Array.isArray(val) || typeof val === 'string') {
|
3934 | ret = new Array(val.length);
|
3935 | for (i = 0, l = val.length; i < l; i++) {
|
3936 | ret[i] = render(val[i], i);
|
3937 | }
|
3938 | } else if (typeof val === 'number') {
|
3939 | ret = new Array(val);
|
3940 | for (i = 0; i < val; i++) {
|
3941 | ret[i] = render(i + 1, i);
|
3942 | }
|
3943 | } else if (isObject(val)) {
|
3944 | if (hasSymbol && val[Symbol.iterator]) {
|
3945 | ret = [];
|
3946 | var iterator = val[Symbol.iterator]();
|
3947 | var result = iterator.next();
|
3948 | while (!result.done) {
|
3949 | ret.push(render(result.value, ret.length));
|
3950 | result = iterator.next();
|
3951 | }
|
3952 | } else {
|
3953 | keys = Object.keys(val);
|
3954 | ret = new Array(keys.length);
|
3955 | for (i = 0, l = keys.length; i < l; i++) {
|
3956 | key = keys[i];
|
3957 | ret[i] = render(val[key], key, i);
|
3958 | }
|
3959 | }
|
3960 | }
|
3961 | if (!isDef(ret)) {
|
3962 | ret = [];
|
3963 | }
|
3964 | (ret)._isVList = true;
|
3965 | return ret
|
3966 | }
|
3967 |
|
3968 |
|
3969 |
|
3970 | |
3971 |
|
3972 |
|
3973 | function renderSlot (
|
3974 | name,
|
3975 | fallback,
|
3976 | props,
|
3977 | bindObject
|
3978 | ) {
|
3979 | var scopedSlotFn = this.$scopedSlots[name];
|
3980 | var nodes;
|
3981 | if (scopedSlotFn) {
|
3982 | props = props || {};
|
3983 | if (bindObject) {
|
3984 | if (!isObject(bindObject)) {
|
3985 | warn(
|
3986 | 'slot v-bind without argument expects an Object',
|
3987 | this
|
3988 | );
|
3989 | }
|
3990 | props = extend(extend({}, bindObject), props);
|
3991 | }
|
3992 | nodes = scopedSlotFn(props) || fallback;
|
3993 | } else {
|
3994 | nodes = this.$slots[name] || fallback;
|
3995 | }
|
3996 |
|
3997 | var target = props && props.slot;
|
3998 | if (target) {
|
3999 | return this.$createElement('template', { slot: target }, nodes)
|
4000 | } else {
|
4001 | return nodes
|
4002 | }
|
4003 | }
|
4004 |
|
4005 |
|
4006 |
|
4007 | |
4008 |
|
4009 |
|
4010 | function resolveFilter (id) {
|
4011 | return resolveAsset(this.$options, 'filters', id, true) || identity
|
4012 | }
|
4013 |
|
4014 |
|
4015 |
|
4016 | function isKeyNotMatch (expect, actual) {
|
4017 | if (Array.isArray(expect)) {
|
4018 | return expect.indexOf(actual) === -1
|
4019 | } else {
|
4020 | return expect !== actual
|
4021 | }
|
4022 | }
|
4023 |
|
4024 | |
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 | function checkKeyCodes (
|
4030 | eventKeyCode,
|
4031 | key,
|
4032 | builtInKeyCode,
|
4033 | eventKeyName,
|
4034 | builtInKeyName
|
4035 | ) {
|
4036 | var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
4037 | if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
4038 | return isKeyNotMatch(builtInKeyName, eventKeyName)
|
4039 | } else if (mappedKeyCode) {
|
4040 | return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
4041 | } else if (eventKeyName) {
|
4042 | return hyphenate(eventKeyName) !== key
|
4043 | }
|
4044 | }
|
4045 |
|
4046 |
|
4047 |
|
4048 | |
4049 |
|
4050 |
|
4051 | function bindObjectProps (
|
4052 | data,
|
4053 | tag,
|
4054 | value,
|
4055 | asProp,
|
4056 | isSync
|
4057 | ) {
|
4058 | if (value) {
|
4059 | if (!isObject(value)) {
|
4060 | warn(
|
4061 | 'v-bind without argument expects an Object or Array value',
|
4062 | this
|
4063 | );
|
4064 | } else {
|
4065 | if (Array.isArray(value)) {
|
4066 | value = toObject(value);
|
4067 | }
|
4068 | var hash;
|
4069 | var loop = function ( key ) {
|
4070 | if (
|
4071 | key === 'class' ||
|
4072 | key === 'style' ||
|
4073 | isReservedAttribute(key)
|
4074 | ) {
|
4075 | hash = data;
|
4076 | } else {
|
4077 | var type = data.attrs && data.attrs.type;
|
4078 | hash = asProp || config.mustUseProp(tag, type, key)
|
4079 | ? data.domProps || (data.domProps = {})
|
4080 | : data.attrs || (data.attrs = {});
|
4081 | }
|
4082 | var camelizedKey = camelize(key);
|
4083 | if (!(key in hash) && !(camelizedKey in hash)) {
|
4084 | hash[key] = value[key];
|
4085 |
|
4086 | if (isSync) {
|
4087 | var on = data.on || (data.on = {});
|
4088 | on[("update:" + camelizedKey)] = function ($event) {
|
4089 | value[key] = $event;
|
4090 | };
|
4091 | }
|
4092 | }
|
4093 | };
|
4094 |
|
4095 | for (var key in value) loop( key );
|
4096 | }
|
4097 | }
|
4098 | return data
|
4099 | }
|
4100 |
|
4101 |
|
4102 |
|
4103 | |
4104 |
|
4105 |
|
4106 | function renderStatic (
|
4107 | index,
|
4108 | isInFor
|
4109 | ) {
|
4110 | var cached = this._staticTrees || (this._staticTrees = []);
|
4111 | var tree = cached[index];
|
4112 |
|
4113 |
|
4114 | if (tree && !isInFor) {
|
4115 | return tree
|
4116 | }
|
4117 |
|
4118 | tree = cached[index] = this.$options.staticRenderFns[index].call(
|
4119 | this._renderProxy,
|
4120 | null,
|
4121 | this
|
4122 | );
|
4123 | markStatic(tree, ("__static__" + index), false);
|
4124 | return tree
|
4125 | }
|
4126 |
|
4127 | |
4128 |
|
4129 |
|
4130 |
|
4131 | function markOnce (
|
4132 | tree,
|
4133 | index,
|
4134 | key
|
4135 | ) {
|
4136 | markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
4137 | return tree
|
4138 | }
|
4139 |
|
4140 | function markStatic (
|
4141 | tree,
|
4142 | key,
|
4143 | isOnce
|
4144 | ) {
|
4145 | if (Array.isArray(tree)) {
|
4146 | for (var i = 0; i < tree.length; i++) {
|
4147 | if (tree[i] && typeof tree[i] !== 'string') {
|
4148 | markStaticNode(tree[i], (key + "_" + i), isOnce);
|
4149 | }
|
4150 | }
|
4151 | } else {
|
4152 | markStaticNode(tree, key, isOnce);
|
4153 | }
|
4154 | }
|
4155 |
|
4156 | function markStaticNode (node, key, isOnce) {
|
4157 | node.isStatic = true;
|
4158 | node.key = key;
|
4159 | node.isOnce = isOnce;
|
4160 | }
|
4161 |
|
4162 |
|
4163 |
|
4164 | function bindObjectListeners (data, value) {
|
4165 | if (value) {
|
4166 | if (!isPlainObject(value)) {
|
4167 | warn(
|
4168 | 'v-on without argument expects an Object value',
|
4169 | this
|
4170 | );
|
4171 | } else {
|
4172 | var on = data.on = data.on ? extend({}, data.on) : {};
|
4173 | for (var key in value) {
|
4174 | var existing = on[key];
|
4175 | var ours = value[key];
|
4176 | on[key] = existing ? [].concat(existing, ours) : ours;
|
4177 | }
|
4178 | }
|
4179 | }
|
4180 | return data
|
4181 | }
|
4182 |
|
4183 |
|
4184 |
|
4185 | function bindDynamicKeys (baseObj, values) {
|
4186 | for (var i = 0; i < values.length; i += 2) {
|
4187 | var key = values[i];
|
4188 | if (typeof key === 'string' && key) {
|
4189 | baseObj[values[i]] = values[i + 1];
|
4190 | } else if (key !== '' && key !== null) {
|
4191 |
|
4192 | warn(
|
4193 | ("Invalid value for dynamic directive argument (expected string or null): " + key),
|
4194 | this
|
4195 | );
|
4196 | }
|
4197 | }
|
4198 | return baseObj
|
4199 | }
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 | function prependModifier (value, symbol) {
|
4205 | return typeof value === 'string' ? symbol + value : value
|
4206 | }
|
4207 |
|
4208 |
|
4209 |
|
4210 | function installRenderHelpers (target) {
|
4211 | target._o = markOnce;
|
4212 | target._n = toNumber;
|
4213 | target._s = toString;
|
4214 | target._l = renderList;
|
4215 | target._t = renderSlot;
|
4216 | target._q = looseEqual;
|
4217 | target._i = looseIndexOf;
|
4218 | target._m = renderStatic;
|
4219 | target._f = resolveFilter;
|
4220 | target._k = checkKeyCodes;
|
4221 | target._b = bindObjectProps;
|
4222 | target._v = createTextVNode;
|
4223 | target._e = createEmptyVNode;
|
4224 | target._u = resolveScopedSlots;
|
4225 | target._g = bindObjectListeners;
|
4226 | target._d = bindDynamicKeys;
|
4227 | target._p = prependModifier;
|
4228 | }
|
4229 |
|
4230 |
|
4231 |
|
4232 | function FunctionalRenderContext (
|
4233 | data,
|
4234 | props,
|
4235 | children,
|
4236 | parent,
|
4237 | Ctor
|
4238 | ) {
|
4239 | var options = Ctor.options;
|
4240 |
|
4241 |
|
4242 | var contextVm;
|
4243 | if (hasOwn(parent, '_uid')) {
|
4244 | contextVm = Object.create(parent);
|
4245 |
|
4246 | contextVm._original = parent;
|
4247 | } else {
|
4248 |
|
4249 |
|
4250 |
|
4251 | contextVm = parent;
|
4252 |
|
4253 | parent = parent._original;
|
4254 | }
|
4255 | var isCompiled = isTrue(options._compiled);
|
4256 | var needNormalization = !isCompiled;
|
4257 |
|
4258 | this.data = data;
|
4259 | this.props = props;
|
4260 | this.children = children;
|
4261 | this.parent = parent;
|
4262 | this.listeners = data.on || emptyObject;
|
4263 | this.injections = resolveInject(options.inject, parent);
|
4264 | this.slots = function () { return resolveSlots(children, parent); };
|
4265 |
|
4266 | Object.defineProperty(this, 'scopedSlots', ({
|
4267 | enumerable: true,
|
4268 | get: function get () {
|
4269 | return normalizeScopedSlots(data.scopedSlots, this.slots())
|
4270 | }
|
4271 | }));
|
4272 |
|
4273 |
|
4274 | if (isCompiled) {
|
4275 |
|
4276 | this.$options = options;
|
4277 |
|
4278 | this.$slots = this.slots();
|
4279 | this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
4280 | }
|
4281 |
|
4282 | if (options._scopeId) {
|
4283 | this._c = function (a, b, c, d) {
|
4284 | var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
4285 | if (vnode && !Array.isArray(vnode)) {
|
4286 | vnode.fnScopeId = options._scopeId;
|
4287 | vnode.fnContext = parent;
|
4288 | }
|
4289 | return vnode
|
4290 | };
|
4291 | } else {
|
4292 | this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
4293 | }
|
4294 | }
|
4295 |
|
4296 | installRenderHelpers(FunctionalRenderContext.prototype);
|
4297 |
|
4298 | function createFunctionalComponent (
|
4299 | Ctor,
|
4300 | propsData,
|
4301 | data,
|
4302 | contextVm,
|
4303 | children
|
4304 | ) {
|
4305 | var options = Ctor.options;
|
4306 | var props = {};
|
4307 | var propOptions = options.props;
|
4308 | if (isDef(propOptions)) {
|
4309 | for (var key in propOptions) {
|
4310 | props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
4311 | }
|
4312 | } else {
|
4313 | if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
4314 | if (isDef(data.props)) { mergeProps(props, data.props); }
|
4315 | }
|
4316 |
|
4317 | var renderContext = new FunctionalRenderContext(
|
4318 | data,
|
4319 | props,
|
4320 | children,
|
4321 | contextVm,
|
4322 | Ctor
|
4323 | );
|
4324 |
|
4325 | var vnode = options.render.call(null, renderContext._c, renderContext);
|
4326 |
|
4327 | if (vnode instanceof VNode) {
|
4328 | return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
4329 | } else if (Array.isArray(vnode)) {
|
4330 | var vnodes = normalizeChildren(vnode) || [];
|
4331 | var res = new Array(vnodes.length);
|
4332 | for (var i = 0; i < vnodes.length; i++) {
|
4333 | res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
4334 | }
|
4335 | return res
|
4336 | }
|
4337 | }
|
4338 |
|
4339 | function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
4340 |
|
4341 |
|
4342 |
|
4343 | var clone = cloneVNode(vnode);
|
4344 | clone.fnContext = contextVm;
|
4345 | clone.fnOptions = options;
|
4346 | {
|
4347 | (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
4348 | }
|
4349 | if (data.slot) {
|
4350 | (clone.data || (clone.data = {})).slot = data.slot;
|
4351 | }
|
4352 | return clone
|
4353 | }
|
4354 |
|
4355 | function mergeProps (to, from) {
|
4356 | for (var key in from) {
|
4357 | to[camelize(key)] = from[key];
|
4358 | }
|
4359 | }
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 | var componentVNodeHooks = {
|
4371 | init: function init (vnode, hydrating) {
|
4372 | if (
|
4373 | vnode.componentInstance &&
|
4374 | !vnode.componentInstance._isDestroyed &&
|
4375 | vnode.data.keepAlive
|
4376 | ) {
|
4377 |
|
4378 | var mountedNode = vnode;
|
4379 | componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
4380 | } else {
|
4381 | var child = vnode.componentInstance = createComponentInstanceForVnode(
|
4382 | vnode,
|
4383 | activeInstance
|
4384 | );
|
4385 | child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
4386 | }
|
4387 | },
|
4388 |
|
4389 | prepatch: function prepatch (oldVnode, vnode) {
|
4390 | var options = vnode.componentOptions;
|
4391 | var child = vnode.componentInstance = oldVnode.componentInstance;
|
4392 | updateChildComponent(
|
4393 | child,
|
4394 | options.propsData,
|
4395 | options.listeners,
|
4396 | vnode,
|
4397 | options.children
|
4398 | );
|
4399 | },
|
4400 |
|
4401 | insert: function insert (vnode) {
|
4402 | var context = vnode.context;
|
4403 | var componentInstance = vnode.componentInstance;
|
4404 | if (!componentInstance._isMounted) {
|
4405 | componentInstance._isMounted = true;
|
4406 | callHook(componentInstance, 'mounted');
|
4407 | }
|
4408 | if (vnode.data.keepAlive) {
|
4409 | if (context._isMounted) {
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 |
|
4415 | queueActivatedComponent(componentInstance);
|
4416 | } else {
|
4417 | activateChildComponent(componentInstance, true );
|
4418 | }
|
4419 | }
|
4420 | },
|
4421 |
|
4422 | destroy: function destroy (vnode) {
|
4423 | var componentInstance = vnode.componentInstance;
|
4424 | if (!componentInstance._isDestroyed) {
|
4425 | if (!vnode.data.keepAlive) {
|
4426 | componentInstance.$destroy();
|
4427 | } else {
|
4428 | deactivateChildComponent(componentInstance, true );
|
4429 | }
|
4430 | }
|
4431 | }
|
4432 | };
|
4433 |
|
4434 | var hooksToMerge = Object.keys(componentVNodeHooks);
|
4435 |
|
4436 | function createComponent (
|
4437 | Ctor,
|
4438 | data,
|
4439 | context,
|
4440 | children,
|
4441 | tag
|
4442 | ) {
|
4443 | if (isUndef(Ctor)) {
|
4444 | return
|
4445 | }
|
4446 |
|
4447 | var baseCtor = context.$options._base;
|
4448 |
|
4449 |
|
4450 | if (isObject(Ctor)) {
|
4451 | Ctor = baseCtor.extend(Ctor);
|
4452 | }
|
4453 |
|
4454 |
|
4455 |
|
4456 | if (typeof Ctor !== 'function') {
|
4457 | {
|
4458 | warn(("Invalid Component definition: " + (String(Ctor))), context);
|
4459 | }
|
4460 | return
|
4461 | }
|
4462 |
|
4463 |
|
4464 | var asyncFactory;
|
4465 | if (isUndef(Ctor.cid)) {
|
4466 | asyncFactory = Ctor;
|
4467 | Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
|
4468 | if (Ctor === undefined) {
|
4469 |
|
4470 |
|
4471 |
|
4472 | return createAsyncPlaceholder(
|
4473 | asyncFactory,
|
4474 | data,
|
4475 | context,
|
4476 | children,
|
4477 | tag
|
4478 | )
|
4479 | }
|
4480 | }
|
4481 |
|
4482 | data = data || {};
|
4483 |
|
4484 |
|
4485 |
|
4486 | resolveConstructorOptions(Ctor);
|
4487 |
|
4488 |
|
4489 | if (isDef(data.model)) {
|
4490 | transformModel(Ctor.options, data);
|
4491 | }
|
4492 |
|
4493 |
|
4494 | var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
4495 |
|
4496 |
|
4497 | if (isTrue(Ctor.options.functional)) {
|
4498 | return createFunctionalComponent(Ctor, propsData, data, context, children)
|
4499 | }
|
4500 |
|
4501 |
|
4502 |
|
4503 | var listeners = data.on;
|
4504 |
|
4505 |
|
4506 | data.on = data.nativeOn;
|
4507 |
|
4508 | if (isTrue(Ctor.options.abstract)) {
|
4509 |
|
4510 |
|
4511 |
|
4512 |
|
4513 | var slot = data.slot;
|
4514 | data = {};
|
4515 | if (slot) {
|
4516 | data.slot = slot;
|
4517 | }
|
4518 | }
|
4519 |
|
4520 |
|
4521 | installComponentHooks(data);
|
4522 |
|
4523 |
|
4524 | var name = Ctor.options.name || tag;
|
4525 | var vnode = new VNode(
|
4526 | ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
4527 | data, undefined, undefined, undefined, context,
|
4528 | { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
4529 | asyncFactory
|
4530 | );
|
4531 |
|
4532 | return vnode
|
4533 | }
|
4534 |
|
4535 | function createComponentInstanceForVnode (
|
4536 | vnode, // we know it's MountedComponentVNode but flow doesn't
|
4537 | parent // activeInstance in lifecycle state
|
4538 | ) {
|
4539 | var options = {
|
4540 | _isComponent: true,
|
4541 | _parentVnode: vnode,
|
4542 | parent: parent
|
4543 | };
|
4544 |
|
4545 | var inlineTemplate = vnode.data.inlineTemplate;
|
4546 | if (isDef(inlineTemplate)) {
|
4547 | options.render = inlineTemplate.render;
|
4548 | options.staticRenderFns = inlineTemplate.staticRenderFns;
|
4549 | }
|
4550 | return new vnode.componentOptions.Ctor(options)
|
4551 | }
|
4552 |
|
4553 | function installComponentHooks (data) {
|
4554 | var hooks = data.hook || (data.hook = {});
|
4555 | for (var i = 0; i < hooksToMerge.length; i++) {
|
4556 | var key = hooksToMerge[i];
|
4557 | var existing = hooks[key];
|
4558 | var toMerge = componentVNodeHooks[key];
|
4559 | if (existing !== toMerge && !(existing && existing._merged)) {
|
4560 | hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
4561 | }
|
4562 | }
|
4563 | }
|
4564 |
|
4565 | function mergeHook$1 (f1, f2) {
|
4566 | var merged = function (a, b) {
|
4567 |
|
4568 | f1(a, b);
|
4569 | f2(a, b);
|
4570 | };
|
4571 | merged._merged = true;
|
4572 | return merged
|
4573 | }
|
4574 |
|
4575 |
|
4576 |
|
4577 | function transformModel (options, data) {
|
4578 | var prop = (options.model && options.model.prop) || 'value';
|
4579 | var event = (options.model && options.model.event) || 'input'
|
4580 | ;(data.props || (data.props = {}))[prop] = data.model.value;
|
4581 | var on = data.on || (data.on = {});
|
4582 | var existing = on[event];
|
4583 | var callback = data.model.callback;
|
4584 | if (isDef(existing)) {
|
4585 | if (
|
4586 | Array.isArray(existing)
|
4587 | ? existing.indexOf(callback) === -1
|
4588 | : existing !== callback
|
4589 | ) {
|
4590 | on[event] = [callback].concat(existing);
|
4591 | }
|
4592 | } else {
|
4593 | on[event] = callback;
|
4594 | }
|
4595 | }
|
4596 |
|
4597 |
|
4598 |
|
4599 | var SIMPLE_NORMALIZE = 1;
|
4600 | var ALWAYS_NORMALIZE = 2;
|
4601 |
|
4602 |
|
4603 |
|
4604 | function createElement (
|
4605 | context,
|
4606 | tag,
|
4607 | data,
|
4608 | children,
|
4609 | normalizationType,
|
4610 | alwaysNormalize
|
4611 | ) {
|
4612 | if (Array.isArray(data) || isPrimitive(data)) {
|
4613 | normalizationType = children;
|
4614 | children = data;
|
4615 | data = undefined;
|
4616 | }
|
4617 | if (isTrue(alwaysNormalize)) {
|
4618 | normalizationType = ALWAYS_NORMALIZE;
|
4619 | }
|
4620 | return _createElement(context, tag, data, children, normalizationType)
|
4621 | }
|
4622 |
|
4623 | function _createElement (
|
4624 | context,
|
4625 | tag,
|
4626 | data,
|
4627 | children,
|
4628 | normalizationType
|
4629 | ) {
|
4630 | if (isDef(data) && isDef((data).__ob__)) {
|
4631 | warn(
|
4632 | "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
4633 | 'Always create fresh vnode data objects in each render!',
|
4634 | context
|
4635 | );
|
4636 | return createEmptyVNode()
|
4637 | }
|
4638 |
|
4639 | if (isDef(data) && isDef(data.is)) {
|
4640 | tag = data.is;
|
4641 | }
|
4642 | if (!tag) {
|
4643 |
|
4644 | return createEmptyVNode()
|
4645 | }
|
4646 |
|
4647 | if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
4648 | ) {
|
4649 | {
|
4650 | warn(
|
4651 | 'Avoid using non-primitive value as key, ' +
|
4652 | 'use string/number value instead.',
|
4653 | context
|
4654 | );
|
4655 | }
|
4656 | }
|
4657 |
|
4658 | if (Array.isArray(children) &&
|
4659 | typeof children[0] === 'function'
|
4660 | ) {
|
4661 | data = data || {};
|
4662 | data.scopedSlots = { default: children[0] };
|
4663 | children.length = 0;
|
4664 | }
|
4665 | if (normalizationType === ALWAYS_NORMALIZE) {
|
4666 | children = normalizeChildren(children);
|
4667 | } else if (normalizationType === SIMPLE_NORMALIZE) {
|
4668 | children = simpleNormalizeChildren(children);
|
4669 | }
|
4670 | var vnode, ns;
|
4671 | if (typeof tag === 'string') {
|
4672 | var Ctor;
|
4673 | ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
4674 | if (config.isReservedTag(tag)) {
|
4675 |
|
4676 | vnode = new VNode(
|
4677 | config.parsePlatformTagName(tag), data, children,
|
4678 | undefined, undefined, context
|
4679 | );
|
4680 | } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
4681 |
|
4682 | vnode = createComponent(Ctor, data, context, children, tag);
|
4683 | } else {
|
4684 |
|
4685 |
|
4686 |
|
4687 | vnode = new VNode(
|
4688 | tag, data, children,
|
4689 | undefined, undefined, context
|
4690 | );
|
4691 | }
|
4692 | } else {
|
4693 |
|
4694 | vnode = createComponent(tag, data, context, children);
|
4695 | }
|
4696 | if (Array.isArray(vnode)) {
|
4697 | return vnode
|
4698 | } else if (isDef(vnode)) {
|
4699 | if (isDef(ns)) { applyNS(vnode, ns); }
|
4700 | if (isDef(data)) { registerDeepBindings(data); }
|
4701 | return vnode
|
4702 | } else {
|
4703 | return createEmptyVNode()
|
4704 | }
|
4705 | }
|
4706 |
|
4707 | function applyNS (vnode, ns, force) {
|
4708 | vnode.ns = ns;
|
4709 | if (vnode.tag === 'foreignObject') {
|
4710 |
|
4711 | ns = undefined;
|
4712 | force = true;
|
4713 | }
|
4714 | if (isDef(vnode.children)) {
|
4715 | for (var i = 0, l = vnode.children.length; i < l; i++) {
|
4716 | var child = vnode.children[i];
|
4717 | if (isDef(child.tag) && (
|
4718 | isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
4719 | applyNS(child, ns, force);
|
4720 | }
|
4721 | }
|
4722 | }
|
4723 | }
|
4724 |
|
4725 |
|
4726 |
|
4727 |
|
4728 | function registerDeepBindings (data) {
|
4729 | if (isObject(data.style)) {
|
4730 | traverse(data.style);
|
4731 | }
|
4732 | if (isObject(data.class)) {
|
4733 | traverse(data.class);
|
4734 | }
|
4735 | }
|
4736 |
|
4737 |
|
4738 |
|
4739 | function initRender (vm) {
|
4740 | vm._vnode = null;
|
4741 | vm._staticTrees = null;
|
4742 | var options = vm.$options;
|
4743 | var parentVnode = vm.$vnode = options._parentVnode;
|
4744 | var renderContext = parentVnode && parentVnode.context;
|
4745 | vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
4746 | vm.$scopedSlots = emptyObject;
|
4747 |
|
4748 |
|
4749 |
|
4750 |
|
4751 | vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
4752 |
|
4753 |
|
4754 | vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
4755 |
|
4756 |
|
4757 |
|
4758 | var parentData = parentVnode && parentVnode.data;
|
4759 |
|
4760 |
|
4761 | {
|
4762 | defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
4763 | !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
4764 | }, true);
|
4765 | defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
4766 | !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
4767 | }, true);
|
4768 | }
|
4769 | }
|
4770 |
|
4771 | function renderMixin (Vue) {
|
4772 |
|
4773 | installRenderHelpers(Vue.prototype);
|
4774 |
|
4775 | Vue.prototype.$nextTick = function (fn) {
|
4776 | return nextTick(fn, this)
|
4777 | };
|
4778 |
|
4779 | Vue.prototype._render = function () {
|
4780 | var vm = this;
|
4781 | var ref = vm.$options;
|
4782 | var render = ref.render;
|
4783 | var _parentVnode = ref._parentVnode;
|
4784 |
|
4785 | if (_parentVnode) {
|
4786 | vm.$scopedSlots = normalizeScopedSlots(
|
4787 | _parentVnode.data.scopedSlots,
|
4788 | vm.$slots
|
4789 | );
|
4790 | }
|
4791 |
|
4792 |
|
4793 |
|
4794 | vm.$vnode = _parentVnode;
|
4795 |
|
4796 | var vnode;
|
4797 | try {
|
4798 | vnode = render.call(vm._renderProxy, vm.$createElement);
|
4799 | } catch (e) {
|
4800 | handleError(e, vm, "render");
|
4801 |
|
4802 |
|
4803 |
|
4804 | if (vm.$options.renderError) {
|
4805 | try {
|
4806 | vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
4807 | } catch (e) {
|
4808 | handleError(e, vm, "renderError");
|
4809 | vnode = vm._vnode;
|
4810 | }
|
4811 | } else {
|
4812 | vnode = vm._vnode;
|
4813 | }
|
4814 | }
|
4815 |
|
4816 | if (Array.isArray(vnode) && vnode.length === 1) {
|
4817 | vnode = vnode[0];
|
4818 | }
|
4819 |
|
4820 | if (!(vnode instanceof VNode)) {
|
4821 | if (Array.isArray(vnode)) {
|
4822 | warn(
|
4823 | 'Multiple root nodes returned from render function. Render function ' +
|
4824 | 'should return a single root node.',
|
4825 | vm
|
4826 | );
|
4827 | }
|
4828 | vnode = createEmptyVNode();
|
4829 | }
|
4830 |
|
4831 | vnode.parent = _parentVnode;
|
4832 | return vnode
|
4833 | };
|
4834 | }
|
4835 |
|
4836 |
|
4837 |
|
4838 | var uid$3 = 0;
|
4839 |
|
4840 | function initMixin (Vue) {
|
4841 | Vue.prototype._init = function (options) {
|
4842 | var vm = this;
|
4843 |
|
4844 | vm._uid = uid$3++;
|
4845 |
|
4846 | var startTag, endTag;
|
4847 |
|
4848 | if (config.performance && mark) {
|
4849 | startTag = "vue-perf-start:" + (vm._uid);
|
4850 | endTag = "vue-perf-end:" + (vm._uid);
|
4851 | mark(startTag);
|
4852 | }
|
4853 |
|
4854 |
|
4855 | vm._isVue = true;
|
4856 |
|
4857 | if (options && options._isComponent) {
|
4858 |
|
4859 |
|
4860 |
|
4861 | initInternalComponent(vm, options);
|
4862 | } else {
|
4863 | vm.$options = mergeOptions(
|
4864 | resolveConstructorOptions(vm.constructor),
|
4865 | options || {},
|
4866 | vm
|
4867 | );
|
4868 | }
|
4869 |
|
4870 | {
|
4871 | initProxy(vm);
|
4872 | }
|
4873 |
|
4874 | vm._self = vm;
|
4875 | initLifecycle(vm);
|
4876 | initEvents(vm);
|
4877 | initRender(vm);
|
4878 | callHook(vm, 'beforeCreate');
|
4879 | initInjections(vm);
|
4880 | initState(vm);
|
4881 | initProvide(vm);
|
4882 | callHook(vm, 'created');
|
4883 |
|
4884 |
|
4885 | if (config.performance && mark) {
|
4886 | vm._name = formatComponentName(vm, false);
|
4887 | mark(endTag);
|
4888 | measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
4889 | }
|
4890 |
|
4891 | if (vm.$options.el) {
|
4892 | vm.$mount(vm.$options.el);
|
4893 | }
|
4894 | };
|
4895 | }
|
4896 |
|
4897 | function initInternalComponent (vm, options) {
|
4898 | var opts = vm.$options = Object.create(vm.constructor.options);
|
4899 |
|
4900 | var parentVnode = options._parentVnode;
|
4901 | opts.parent = options.parent;
|
4902 | opts._parentVnode = parentVnode;
|
4903 |
|
4904 | var vnodeComponentOptions = parentVnode.componentOptions;
|
4905 | opts.propsData = vnodeComponentOptions.propsData;
|
4906 | opts._parentListeners = vnodeComponentOptions.listeners;
|
4907 | opts._renderChildren = vnodeComponentOptions.children;
|
4908 | opts._componentTag = vnodeComponentOptions.tag;
|
4909 |
|
4910 | if (options.render) {
|
4911 | opts.render = options.render;
|
4912 | opts.staticRenderFns = options.staticRenderFns;
|
4913 | }
|
4914 | }
|
4915 |
|
4916 | function resolveConstructorOptions (Ctor) {
|
4917 | var options = Ctor.options;
|
4918 | if (Ctor.super) {
|
4919 | var superOptions = resolveConstructorOptions(Ctor.super);
|
4920 | var cachedSuperOptions = Ctor.superOptions;
|
4921 | if (superOptions !== cachedSuperOptions) {
|
4922 |
|
4923 |
|
4924 | Ctor.superOptions = superOptions;
|
4925 |
|
4926 | var modifiedOptions = resolveModifiedOptions(Ctor);
|
4927 |
|
4928 | if (modifiedOptions) {
|
4929 | extend(Ctor.extendOptions, modifiedOptions);
|
4930 | }
|
4931 | options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
4932 | if (options.name) {
|
4933 | options.components[options.name] = Ctor;
|
4934 | }
|
4935 | }
|
4936 | }
|
4937 | return options
|
4938 | }
|
4939 |
|
4940 | function resolveModifiedOptions (Ctor) {
|
4941 | var modified;
|
4942 | var latest = Ctor.options;
|
4943 | var sealed = Ctor.sealedOptions;
|
4944 | for (var key in latest) {
|
4945 | if (latest[key] !== sealed[key]) {
|
4946 | if (!modified) { modified = {}; }
|
4947 | modified[key] = latest[key];
|
4948 | }
|
4949 | }
|
4950 | return modified
|
4951 | }
|
4952 |
|
4953 | function Vue (options) {
|
4954 | if (!(this instanceof Vue)
|
4955 | ) {
|
4956 | warn('Vue is a constructor and should be called with the `new` keyword');
|
4957 | }
|
4958 | this._init(options);
|
4959 | }
|
4960 |
|
4961 | initMixin(Vue);
|
4962 | stateMixin(Vue);
|
4963 | eventsMixin(Vue);
|
4964 | lifecycleMixin(Vue);
|
4965 | renderMixin(Vue);
|
4966 |
|
4967 |
|
4968 |
|
4969 | function initUse (Vue) {
|
4970 | Vue.use = function (plugin) {
|
4971 | var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
4972 | if (installedPlugins.indexOf(plugin) > -1) {
|
4973 | return this
|
4974 | }
|
4975 |
|
4976 |
|
4977 | var args = toArray(arguments, 1);
|
4978 | args.unshift(this);
|
4979 | if (typeof plugin.install === 'function') {
|
4980 | plugin.install.apply(plugin, args);
|
4981 | } else if (typeof plugin === 'function') {
|
4982 | plugin.apply(null, args);
|
4983 | }
|
4984 | installedPlugins.push(plugin);
|
4985 | return this
|
4986 | };
|
4987 | }
|
4988 |
|
4989 |
|
4990 |
|
4991 | function initMixin$1 (Vue) {
|
4992 | Vue.mixin = function (mixin) {
|
4993 | this.options = mergeOptions(this.options, mixin);
|
4994 | return this
|
4995 | };
|
4996 | }
|
4997 |
|
4998 |
|
4999 |
|
5000 | function initExtend (Vue) {
|
5001 | |
5002 |
|
5003 |
|
5004 |
|
5005 |
|
5006 | Vue.cid = 0;
|
5007 | var cid = 1;
|
5008 |
|
5009 | |
5010 |
|
5011 |
|
5012 | Vue.extend = function (extendOptions) {
|
5013 | extendOptions = extendOptions || {};
|
5014 | var Super = this;
|
5015 | var SuperId = Super.cid;
|
5016 | var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5017 | if (cachedCtors[SuperId]) {
|
5018 | return cachedCtors[SuperId]
|
5019 | }
|
5020 |
|
5021 | var name = extendOptions.name || Super.options.name;
|
5022 | if (name) {
|
5023 | validateComponentName(name);
|
5024 | }
|
5025 |
|
5026 | var Sub = function VueComponent (options) {
|
5027 | this._init(options);
|
5028 | };
|
5029 | Sub.prototype = Object.create(Super.prototype);
|
5030 | Sub.prototype.constructor = Sub;
|
5031 | Sub.cid = cid++;
|
5032 | Sub.options = mergeOptions(
|
5033 | Super.options,
|
5034 | extendOptions
|
5035 | );
|
5036 | Sub['super'] = Super;
|
5037 |
|
5038 |
|
5039 |
|
5040 |
|
5041 | if (Sub.options.props) {
|
5042 | initProps$1(Sub);
|
5043 | }
|
5044 | if (Sub.options.computed) {
|
5045 | initComputed$1(Sub);
|
5046 | }
|
5047 |
|
5048 |
|
5049 | Sub.extend = Super.extend;
|
5050 | Sub.mixin = Super.mixin;
|
5051 | Sub.use = Super.use;
|
5052 |
|
5053 |
|
5054 |
|
5055 | ASSET_TYPES.forEach(function (type) {
|
5056 | Sub[type] = Super[type];
|
5057 | });
|
5058 |
|
5059 | if (name) {
|
5060 | Sub.options.components[name] = Sub;
|
5061 | }
|
5062 |
|
5063 |
|
5064 |
|
5065 |
|
5066 | Sub.superOptions = Super.options;
|
5067 | Sub.extendOptions = extendOptions;
|
5068 | Sub.sealedOptions = extend({}, Sub.options);
|
5069 |
|
5070 |
|
5071 | cachedCtors[SuperId] = Sub;
|
5072 | return Sub
|
5073 | };
|
5074 | }
|
5075 |
|
5076 | function initProps$1 (Comp) {
|
5077 | var props = Comp.options.props;
|
5078 | for (var key in props) {
|
5079 | proxy(Comp.prototype, "_props", key);
|
5080 | }
|
5081 | }
|
5082 |
|
5083 | function initComputed$1 (Comp) {
|
5084 | var computed = Comp.options.computed;
|
5085 | for (var key in computed) {
|
5086 | defineComputed(Comp.prototype, key, computed[key]);
|
5087 | }
|
5088 | }
|
5089 |
|
5090 |
|
5091 |
|
5092 | function initAssetRegisters (Vue) {
|
5093 | |
5094 |
|
5095 |
|
5096 | ASSET_TYPES.forEach(function (type) {
|
5097 | Vue[type] = function (
|
5098 | id,
|
5099 | definition
|
5100 | ) {
|
5101 | if (!definition) {
|
5102 | return this.options[type + 's'][id]
|
5103 | } else {
|
5104 |
|
5105 | if (type === 'component') {
|
5106 | validateComponentName(id);
|
5107 | }
|
5108 | if (type === 'component' && isPlainObject(definition)) {
|
5109 | definition.name = definition.name || id;
|
5110 | definition = this.options._base.extend(definition);
|
5111 | }
|
5112 | if (type === 'directive' && typeof definition === 'function') {
|
5113 | definition = { bind: definition, update: definition };
|
5114 | }
|
5115 | this.options[type + 's'][id] = definition;
|
5116 | return definition
|
5117 | }
|
5118 | };
|
5119 | });
|
5120 | }
|
5121 |
|
5122 |
|
5123 |
|
5124 |
|
5125 |
|
5126 | function getComponentName (opts) {
|
5127 | return opts && (opts.Ctor.options.name || opts.tag)
|
5128 | }
|
5129 |
|
5130 | function matches (pattern, name) {
|
5131 | if (Array.isArray(pattern)) {
|
5132 | return pattern.indexOf(name) > -1
|
5133 | } else if (typeof pattern === 'string') {
|
5134 | return pattern.split(',').indexOf(name) > -1
|
5135 | } else if (isRegExp(pattern)) {
|
5136 | return pattern.test(name)
|
5137 | }
|
5138 |
|
5139 | return false
|
5140 | }
|
5141 |
|
5142 | function pruneCache (keepAliveInstance, filter) {
|
5143 | var cache = keepAliveInstance.cache;
|
5144 | var keys = keepAliveInstance.keys;
|
5145 | var _vnode = keepAliveInstance._vnode;
|
5146 | for (var key in cache) {
|
5147 | var cachedNode = cache[key];
|
5148 | if (cachedNode) {
|
5149 | var name = getComponentName(cachedNode.componentOptions);
|
5150 | if (name && !filter(name)) {
|
5151 | pruneCacheEntry(cache, key, keys, _vnode);
|
5152 | }
|
5153 | }
|
5154 | }
|
5155 | }
|
5156 |
|
5157 | function pruneCacheEntry (
|
5158 | cache,
|
5159 | key,
|
5160 | keys,
|
5161 | current
|
5162 | ) {
|
5163 | var cached$$1 = cache[key];
|
5164 | if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
5165 | cached$$1.componentInstance.$destroy();
|
5166 | }
|
5167 | cache[key] = null;
|
5168 | remove(keys, key);
|
5169 | }
|
5170 |
|
5171 | var patternTypes = [String, RegExp, Array];
|
5172 |
|
5173 | var KeepAlive = {
|
5174 | name: 'keep-alive',
|
5175 | abstract: true,
|
5176 |
|
5177 | props: {
|
5178 | include: patternTypes,
|
5179 | exclude: patternTypes,
|
5180 | max: [String, Number]
|
5181 | },
|
5182 |
|
5183 | created: function created () {
|
5184 | this.cache = Object.create(null);
|
5185 | this.keys = [];
|
5186 | },
|
5187 |
|
5188 | destroyed: function destroyed () {
|
5189 | for (var key in this.cache) {
|
5190 | pruneCacheEntry(this.cache, key, this.keys);
|
5191 | }
|
5192 | },
|
5193 |
|
5194 | mounted: function mounted () {
|
5195 | var this$1 = this;
|
5196 |
|
5197 | this.$watch('include', function (val) {
|
5198 | pruneCache(this$1, function (name) { return matches(val, name); });
|
5199 | });
|
5200 | this.$watch('exclude', function (val) {
|
5201 | pruneCache(this$1, function (name) { return !matches(val, name); });
|
5202 | });
|
5203 | },
|
5204 |
|
5205 | render: function render () {
|
5206 | var slot = this.$slots.default;
|
5207 | var vnode = getFirstComponentChild(slot);
|
5208 | var componentOptions = vnode && vnode.componentOptions;
|
5209 | if (componentOptions) {
|
5210 |
|
5211 | var name = getComponentName(componentOptions);
|
5212 | var ref = this;
|
5213 | var include = ref.include;
|
5214 | var exclude = ref.exclude;
|
5215 | if (
|
5216 |
|
5217 | (include && (!name || !matches(include, name))) ||
|
5218 |
|
5219 | (exclude && name && matches(exclude, name))
|
5220 | ) {
|
5221 | return vnode
|
5222 | }
|
5223 |
|
5224 | var ref$1 = this;
|
5225 | var cache = ref$1.cache;
|
5226 | var keys = ref$1.keys;
|
5227 | var key = vnode.key == null
|
5228 |
|
5229 |
|
5230 | ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
5231 | : vnode.key;
|
5232 | if (cache[key]) {
|
5233 | vnode.componentInstance = cache[key].componentInstance;
|
5234 |
|
5235 | remove(keys, key);
|
5236 | keys.push(key);
|
5237 | } else {
|
5238 | cache[key] = vnode;
|
5239 | keys.push(key);
|
5240 |
|
5241 | if (this.max && keys.length > parseInt(this.max)) {
|
5242 | pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5243 | }
|
5244 | }
|
5245 |
|
5246 | vnode.data.keepAlive = true;
|
5247 | }
|
5248 | return vnode || (slot && slot[0])
|
5249 | }
|
5250 | };
|
5251 |
|
5252 | var builtInComponents = {
|
5253 | KeepAlive: KeepAlive
|
5254 | };
|
5255 |
|
5256 |
|
5257 |
|
5258 | function initGlobalAPI (Vue) {
|
5259 |
|
5260 | var configDef = {};
|
5261 | configDef.get = function () { return config; };
|
5262 | {
|
5263 | configDef.set = function () {
|
5264 | warn(
|
5265 | 'Do not replace the Vue.config object, set individual fields instead.'
|
5266 | );
|
5267 | };
|
5268 | }
|
5269 | Object.defineProperty(Vue, 'config', configDef);
|
5270 |
|
5271 |
|
5272 |
|
5273 |
|
5274 | Vue.util = {
|
5275 | warn: warn,
|
5276 | extend: extend,
|
5277 | mergeOptions: mergeOptions,
|
5278 | defineReactive: defineReactive$$1
|
5279 | };
|
5280 |
|
5281 | Vue.set = set;
|
5282 | Vue.delete = del;
|
5283 | Vue.nextTick = nextTick;
|
5284 |
|
5285 | // 2.6 explicit observable API
|
5286 | Vue.observable = function (obj) {
|
5287 | observe(obj);
|
5288 | return obj
|
5289 | };
|
5290 |
|
5291 | Vue.options = Object.create(null);
|
5292 | ASSET_TYPES.forEach(function (type) {
|
5293 | Vue.options[type + 's'] = Object.create(null);
|
5294 | });
|
5295 |
|
5296 |
|
5297 |
|
5298 | Vue.options._base = Vue;
|
5299 |
|
5300 | extend(Vue.options.components, builtInComponents);
|
5301 |
|
5302 | initUse(Vue);
|
5303 | initMixin$1(Vue);
|
5304 | initExtend(Vue);
|
5305 | initAssetRegisters(Vue);
|
5306 | }
|
5307 |
|
5308 | initGlobalAPI(Vue);
|
5309 |
|
5310 | Object.defineProperty(Vue.prototype, '$isServer', {
|
5311 | get: isServerRendering
|
5312 | });
|
5313 |
|
5314 | Object.defineProperty(Vue.prototype, '$ssrContext', {
|
5315 | get: function get () {
|
5316 |
|
5317 | return this.$vnode && this.$vnode.ssrContext
|
5318 | }
|
5319 | });
|
5320 |
|
5321 |
|
5322 | Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
5323 | value: FunctionalRenderContext
|
5324 | });
|
5325 |
|
5326 | Vue.version = '2.6.0';
|
5327 |
|
5328 |
|
5329 |
|
5330 |
|
5331 |
|
5332 | var isReservedAttr = makeMap('style,class');
|
5333 |
|
5334 |
|
5335 | var acceptValue = makeMap('input,textarea,option,select,progress');
|
5336 | var mustUseProp = function (tag, type, attr) {
|
5337 | return (
|
5338 | (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
5339 | (attr === 'selected' && tag === 'option') ||
|
5340 | (attr === 'checked' && tag === 'input') ||
|
5341 | (attr === 'muted' && tag === 'video')
|
5342 | )
|
5343 | };
|
5344 |
|
5345 | var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
5346 |
|
5347 | var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
5348 |
|
5349 | var convertEnumeratedValue = function (key, value) {
|
5350 | return isFalsyAttrValue(value) || value === 'false'
|
5351 | ? 'false'
|
5352 |
|
5353 | : key === 'contenteditable' && isValidContentEditableValue(value)
|
5354 | ? value
|
5355 | : 'true'
|
5356 | };
|
5357 |
|
5358 | var isBooleanAttr = makeMap(
|
5359 | 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
5360 | 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
5361 | 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
5362 | 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
5363 | 'required,reversed,scoped,seamless,selected,sortable,translate,' +
|
5364 | 'truespeed,typemustmatch,visible'
|
5365 | );
|
5366 |
|
5367 | var xlinkNS = 'http://www.w3.org/1999/xlink';
|
5368 |
|
5369 | var isXlink = function (name) {
|
5370 | return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
5371 | };
|
5372 |
|
5373 | var getXlinkProp = function (name) {
|
5374 | return isXlink(name) ? name.slice(6, name.length) : ''
|
5375 | };
|
5376 |
|
5377 | var isFalsyAttrValue = function (val) {
|
5378 | return val == null || val === false
|
5379 | };
|
5380 |
|
5381 |
|
5382 |
|
5383 | function genClassForVnode (vnode) {
|
5384 | var data = vnode.data;
|
5385 | var parentNode = vnode;
|
5386 | var childNode = vnode;
|
5387 | while (isDef(childNode.componentInstance)) {
|
5388 | childNode = childNode.componentInstance._vnode;
|
5389 | if (childNode && childNode.data) {
|
5390 | data = mergeClassData(childNode.data, data);
|
5391 | }
|
5392 | }
|
5393 | while (isDef(parentNode = parentNode.parent)) {
|
5394 | if (parentNode && parentNode.data) {
|
5395 | data = mergeClassData(data, parentNode.data);
|
5396 | }
|
5397 | }
|
5398 | return renderClass(data.staticClass, data.class)
|
5399 | }
|
5400 |
|
5401 | function mergeClassData (child, parent) {
|
5402 | return {
|
5403 | staticClass: concat(child.staticClass, parent.staticClass),
|
5404 | class: isDef(child.class)
|
5405 | ? [child.class, parent.class]
|
5406 | : parent.class
|
5407 | }
|
5408 | }
|
5409 |
|
5410 | function renderClass (
|
5411 | staticClass,
|
5412 | dynamicClass
|
5413 | ) {
|
5414 | if (isDef(staticClass) || isDef(dynamicClass)) {
|
5415 | return concat(staticClass, stringifyClass(dynamicClass))
|
5416 | }
|
5417 |
|
5418 | return ''
|
5419 | }
|
5420 |
|
5421 | function concat (a, b) {
|
5422 | return a ? b ? (a + ' ' + b) : a : (b || '')
|
5423 | }
|
5424 |
|
5425 | function stringifyClass (value) {
|
5426 | if (Array.isArray(value)) {
|
5427 | return stringifyArray(value)
|
5428 | }
|
5429 | if (isObject(value)) {
|
5430 | return stringifyObject(value)
|
5431 | }
|
5432 | if (typeof value === 'string') {
|
5433 | return value
|
5434 | }
|
5435 |
|
5436 | return ''
|
5437 | }
|
5438 |
|
5439 | function stringifyArray (value) {
|
5440 | var res = '';
|
5441 | var stringified;
|
5442 | for (var i = 0, l = value.length; i < l; i++) {
|
5443 | if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
5444 | if (res) { res += ' '; }
|
5445 | res += stringified;
|
5446 | }
|
5447 | }
|
5448 | return res
|
5449 | }
|
5450 |
|
5451 | function stringifyObject (value) {
|
5452 | var res = '';
|
5453 | for (var key in value) {
|
5454 | if (value[key]) {
|
5455 | if (res) { res += ' '; }
|
5456 | res += key;
|
5457 | }
|
5458 | }
|
5459 | return res
|
5460 | }
|
5461 |
|
5462 |
|
5463 |
|
5464 | var namespaceMap = {
|
5465 | svg: 'http://www.w3.org/2000/svg',
|
5466 | math: 'http://www.w3.org/1998/Math/MathML'
|
5467 | };
|
5468 |
|
5469 | var isHTMLTag = makeMap(
|
5470 | 'html,body,base,head,link,meta,style,title,' +
|
5471 | 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
5472 | 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
5473 | 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
5474 | 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
5475 | 'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
5476 | 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
5477 | 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
5478 | 'output,progress,select,textarea,' +
|
5479 | 'details,dialog,menu,menuitem,summary,' +
|
5480 | 'content,element,shadow,template,blockquote,iframe,tfoot'
|
5481 | );
|
5482 |
|
5483 |
|
5484 |
|
5485 | var isSVG = makeMap(
|
5486 | 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
5487 | 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
5488 | 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
5489 | true
|
5490 | );
|
5491 |
|
5492 | var isPreTag = function (tag) { return tag === 'pre'; };
|
5493 |
|
5494 | var isReservedTag = function (tag) {
|
5495 | return isHTMLTag(tag) || isSVG(tag)
|
5496 | };
|
5497 |
|
5498 | function getTagNamespace (tag) {
|
5499 | if (isSVG(tag)) {
|
5500 | return 'svg'
|
5501 | }
|
5502 |
|
5503 |
|
5504 | if (tag === 'math') {
|
5505 | return 'math'
|
5506 | }
|
5507 | }
|
5508 |
|
5509 | var unknownElementCache = Object.create(null);
|
5510 | function isUnknownElement (tag) {
|
5511 |
|
5512 | if (!inBrowser) {
|
5513 | return true
|
5514 | }
|
5515 | if (isReservedTag(tag)) {
|
5516 | return false
|
5517 | }
|
5518 | tag = tag.toLowerCase();
|
5519 |
|
5520 | if (unknownElementCache[tag] != null) {
|
5521 | return unknownElementCache[tag]
|
5522 | }
|
5523 | var el = document.createElement(tag);
|
5524 | if (tag.indexOf('-') > -1) {
|
5525 |
|
5526 | return (unknownElementCache[tag] = (
|
5527 | el.constructor === window.HTMLUnknownElement ||
|
5528 | el.constructor === window.HTMLElement
|
5529 | ))
|
5530 | } else {
|
5531 | return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
5532 | }
|
5533 | }
|
5534 |
|
5535 | var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
5536 |
|
5537 |
|
5538 |
|
5539 | |
5540 |
|
5541 |
|
5542 | function query (el) {
|
5543 | if (typeof el === 'string') {
|
5544 | var selected = document.querySelector(el);
|
5545 | if (!selected) {
|
5546 | warn(
|
5547 | 'Cannot find element: ' + el
|
5548 | );
|
5549 | return document.createElement('div')
|
5550 | }
|
5551 | return selected
|
5552 | } else {
|
5553 | return el
|
5554 | }
|
5555 | }
|
5556 |
|
5557 |
|
5558 |
|
5559 | function createElement$1 (tagName, vnode) {
|
5560 | var elm = document.createElement(tagName);
|
5561 | if (tagName !== 'select') {
|
5562 | return elm
|
5563 | }
|
5564 |
|
5565 | if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
5566 | elm.setAttribute('multiple', 'multiple');
|
5567 | }
|
5568 | return elm
|
5569 | }
|
5570 |
|
5571 | function createElementNS (namespace, tagName) {
|
5572 | return document.createElementNS(namespaceMap[namespace], tagName)
|
5573 | }
|
5574 |
|
5575 | function createTextNode (text) {
|
5576 | return document.createTextNode(text)
|
5577 | }
|
5578 |
|
5579 | function createComment (text) {
|
5580 | return document.createComment(text)
|
5581 | }
|
5582 |
|
5583 | function insertBefore (parentNode, newNode, referenceNode) {
|
5584 | parentNode.insertBefore(newNode, referenceNode);
|
5585 | }
|
5586 |
|
5587 | function removeChild (node, child) {
|
5588 | node.removeChild(child);
|
5589 | }
|
5590 |
|
5591 | function appendChild (node, child) {
|
5592 | node.appendChild(child);
|
5593 | }
|
5594 |
|
5595 | function parentNode (node) {
|
5596 | return node.parentNode
|
5597 | }
|
5598 |
|
5599 | function nextSibling (node) {
|
5600 | return node.nextSibling
|
5601 | }
|
5602 |
|
5603 | function tagName (node) {
|
5604 | return node.tagName
|
5605 | }
|
5606 |
|
5607 | function setTextContent (node, text) {
|
5608 | node.textContent = text;
|
5609 | }
|
5610 |
|
5611 | function setStyleScope (node, scopeId) {
|
5612 | node.setAttribute(scopeId, '');
|
5613 | }
|
5614 |
|
5615 | var nodeOps = Object.freeze({
|
5616 | createElement: createElement$1,
|
5617 | createElementNS: createElementNS,
|
5618 | createTextNode: createTextNode,
|
5619 | createComment: createComment,
|
5620 | insertBefore: insertBefore,
|
5621 | removeChild: removeChild,
|
5622 | appendChild: appendChild,
|
5623 | parentNode: parentNode,
|
5624 | nextSibling: nextSibling,
|
5625 | tagName: tagName,
|
5626 | setTextContent: setTextContent,
|
5627 | setStyleScope: setStyleScope
|
5628 | });
|
5629 |
|
5630 |
|
5631 |
|
5632 | var ref = {
|
5633 | create: function create (_, vnode) {
|
5634 | registerRef(vnode);
|
5635 | },
|
5636 | update: function update (oldVnode, vnode) {
|
5637 | if (oldVnode.data.ref !== vnode.data.ref) {
|
5638 | registerRef(oldVnode, true);
|
5639 | registerRef(vnode);
|
5640 | }
|
5641 | },
|
5642 | destroy: function destroy (vnode) {
|
5643 | registerRef(vnode, true);
|
5644 | }
|
5645 | };
|
5646 |
|
5647 | function registerRef (vnode, isRemoval) {
|
5648 | var key = vnode.data.ref;
|
5649 | if (!isDef(key)) { return }
|
5650 |
|
5651 | var vm = vnode.context;
|
5652 | var ref = vnode.componentInstance || vnode.elm;
|
5653 | var refs = vm.$refs;
|
5654 | if (isRemoval) {
|
5655 | if (Array.isArray(refs[key])) {
|
5656 | remove(refs[key], ref);
|
5657 | } else if (refs[key] === ref) {
|
5658 | refs[key] = undefined;
|
5659 | }
|
5660 | } else {
|
5661 | if (vnode.data.refInFor) {
|
5662 | if (!Array.isArray(refs[key])) {
|
5663 | refs[key] = [ref];
|
5664 | } else if (refs[key].indexOf(ref) < 0) {
|
5665 |
|
5666 | refs[key].push(ref);
|
5667 | }
|
5668 | } else {
|
5669 | refs[key] = ref;
|
5670 | }
|
5671 | }
|
5672 | }
|
5673 |
|
5674 | |
5675 |
|
5676 |
|
5677 |
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 | var emptyNode = new VNode('', {}, []);
|
5687 |
|
5688 | var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
5689 |
|
5690 | function sameVnode (a, b) {
|
5691 | return (
|
5692 | a.key === b.key && (
|
5693 | (
|
5694 | a.tag === b.tag &&
|
5695 | a.isComment === b.isComment &&
|
5696 | isDef(a.data) === isDef(b.data) &&
|
5697 | sameInputType(a, b)
|
5698 | ) || (
|
5699 | isTrue(a.isAsyncPlaceholder) &&
|
5700 | a.asyncFactory === b.asyncFactory &&
|
5701 | isUndef(b.asyncFactory.error)
|
5702 | )
|
5703 | )
|
5704 | )
|
5705 | }
|
5706 |
|
5707 | function sameInputType (a, b) {
|
5708 | if (a.tag !== 'input') { return true }
|
5709 | var i;
|
5710 | var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
5711 | var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
5712 | return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
5713 | }
|
5714 |
|
5715 | function createKeyToOldIdx (children, beginIdx, endIdx) {
|
5716 | var i, key;
|
5717 | var map = {};
|
5718 | for (i = beginIdx; i <= endIdx; ++i) {
|
5719 | key = children[i].key;
|
5720 | if (isDef(key)) { map[key] = i; }
|
5721 | }
|
5722 | return map
|
5723 | }
|
5724 |
|
5725 | function createPatchFunction (backend) {
|
5726 | var i, j;
|
5727 | var cbs = {};
|
5728 |
|
5729 | var modules = backend.modules;
|
5730 | var nodeOps = backend.nodeOps;
|
5731 |
|
5732 | for (i = 0; i < hooks.length; ++i) {
|
5733 | cbs[hooks[i]] = [];
|
5734 | for (j = 0; j < modules.length; ++j) {
|
5735 | if (isDef(modules[j][hooks[i]])) {
|
5736 | cbs[hooks[i]].push(modules[j][hooks[i]]);
|
5737 | }
|
5738 | }
|
5739 | }
|
5740 |
|
5741 | function emptyNodeAt (elm) {
|
5742 | return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
5743 | }
|
5744 |
|
5745 | function createRmCb (childElm, listeners) {
|
5746 | function remove$$1 () {
|
5747 | if (--remove$$1.listeners === 0) {
|
5748 | removeNode(childElm);
|
5749 | }
|
5750 | }
|
5751 | remove$$1.listeners = listeners;
|
5752 | return remove$$1
|
5753 | }
|
5754 |
|
5755 | function removeNode (el) {
|
5756 | var parent = nodeOps.parentNode(el);
|
5757 |
|
5758 | if (isDef(parent)) {
|
5759 | nodeOps.removeChild(parent, el);
|
5760 | }
|
5761 | }
|
5762 |
|
5763 | function isUnknownElement$$1 (vnode, inVPre) {
|
5764 | return (
|
5765 | !inVPre &&
|
5766 | !vnode.ns &&
|
5767 | !(
|
5768 | config.ignoredElements.length &&
|
5769 | config.ignoredElements.some(function (ignore) {
|
5770 | return isRegExp(ignore)
|
5771 | ? ignore.test(vnode.tag)
|
5772 | : ignore === vnode.tag
|
5773 | })
|
5774 | ) &&
|
5775 | config.isUnknownElement(vnode.tag)
|
5776 | )
|
5777 | }
|
5778 |
|
5779 | var creatingElmInVPre = 0;
|
5780 |
|
5781 | function createElm (
|
5782 | vnode,
|
5783 | insertedVnodeQueue,
|
5784 | parentElm,
|
5785 | refElm,
|
5786 | nested,
|
5787 | ownerArray,
|
5788 | index
|
5789 | ) {
|
5790 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
5791 |
|
5792 |
|
5793 |
|
5794 |
|
5795 |
|
5796 | vnode = ownerArray[index] = cloneVNode(vnode);
|
5797 | }
|
5798 |
|
5799 | vnode.isRootInsert = !nested;
|
5800 | if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
5801 | return
|
5802 | }
|
5803 |
|
5804 | var data = vnode.data;
|
5805 | var children = vnode.children;
|
5806 | var tag = vnode.tag;
|
5807 | if (isDef(tag)) {
|
5808 | {
|
5809 | if (data && data.pre) {
|
5810 | creatingElmInVPre++;
|
5811 | }
|
5812 | if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
5813 | warn(
|
5814 | 'Unknown custom element: <' + tag + '> - did you ' +
|
5815 | 'register the component correctly? For recursive components, ' +
|
5816 | 'make sure to provide the "name" option.',
|
5817 | vnode.context
|
5818 | );
|
5819 | }
|
5820 | }
|
5821 |
|
5822 | vnode.elm = vnode.ns
|
5823 | ? nodeOps.createElementNS(vnode.ns, tag)
|
5824 | : nodeOps.createElement(tag, vnode);
|
5825 | setScope(vnode);
|
5826 |
|
5827 |
|
5828 | {
|
5829 | createChildren(vnode, children, insertedVnodeQueue);
|
5830 | if (isDef(data)) {
|
5831 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
5832 | }
|
5833 | insert(parentElm, vnode.elm, refElm);
|
5834 | }
|
5835 |
|
5836 | if (data && data.pre) {
|
5837 | creatingElmInVPre--;
|
5838 | }
|
5839 | } else if (isTrue(vnode.isComment)) {
|
5840 | vnode.elm = nodeOps.createComment(vnode.text);
|
5841 | insert(parentElm, vnode.elm, refElm);
|
5842 | } else {
|
5843 | vnode.elm = nodeOps.createTextNode(vnode.text);
|
5844 | insert(parentElm, vnode.elm, refElm);
|
5845 | }
|
5846 | }
|
5847 |
|
5848 | function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5849 | var i = vnode.data;
|
5850 | if (isDef(i)) {
|
5851 | var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
5852 | if (isDef(i = i.hook) && isDef(i = i.init)) {
|
5853 | i(vnode, false );
|
5854 | }
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 | if (isDef(vnode.componentInstance)) {
|
5860 | initComponent(vnode, insertedVnodeQueue);
|
5861 | insert(parentElm, vnode.elm, refElm);
|
5862 | if (isTrue(isReactivated)) {
|
5863 | reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
5864 | }
|
5865 | return true
|
5866 | }
|
5867 | }
|
5868 | }
|
5869 |
|
5870 | function initComponent (vnode, insertedVnodeQueue) {
|
5871 | if (isDef(vnode.data.pendingInsert)) {
|
5872 | insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
5873 | vnode.data.pendingInsert = null;
|
5874 | }
|
5875 | vnode.elm = vnode.componentInstance.$el;
|
5876 | if (isPatchable(vnode)) {
|
5877 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
5878 | setScope(vnode);
|
5879 | } else {
|
5880 |
|
5881 |
|
5882 | registerRef(vnode);
|
5883 |
|
5884 | insertedVnodeQueue.push(vnode);
|
5885 | }
|
5886 | }
|
5887 |
|
5888 | function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5889 | var i;
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 | var innerNode = vnode;
|
5895 | while (innerNode.componentInstance) {
|
5896 | innerNode = innerNode.componentInstance._vnode;
|
5897 | if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
5898 | for (i = 0; i < cbs.activate.length; ++i) {
|
5899 | cbs.activate[i](emptyNode, innerNode);
|
5900 | }
|
5901 | insertedVnodeQueue.push(innerNode);
|
5902 | break
|
5903 | }
|
5904 | }
|
5905 |
|
5906 |
|
5907 | insert(parentElm, vnode.elm, refElm);
|
5908 | }
|
5909 |
|
5910 | function insert (parent, elm, ref$$1) {
|
5911 | if (isDef(parent)) {
|
5912 | if (isDef(ref$$1)) {
|
5913 | if (nodeOps.parentNode(ref$$1) === parent) {
|
5914 | nodeOps.insertBefore(parent, elm, ref$$1);
|
5915 | }
|
5916 | } else {
|
5917 | nodeOps.appendChild(parent, elm);
|
5918 | }
|
5919 | }
|
5920 | }
|
5921 |
|
5922 | function createChildren (vnode, children, insertedVnodeQueue) {
|
5923 | if (Array.isArray(children)) {
|
5924 | {
|
5925 | checkDuplicateKeys(children);
|
5926 | }
|
5927 | for (var i = 0; i < children.length; ++i) {
|
5928 | createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
5929 | }
|
5930 | } else if (isPrimitive(vnode.text)) {
|
5931 | nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
5932 | }
|
5933 | }
|
5934 |
|
5935 | function isPatchable (vnode) {
|
5936 | while (vnode.componentInstance) {
|
5937 | vnode = vnode.componentInstance._vnode;
|
5938 | }
|
5939 | return isDef(vnode.tag)
|
5940 | }
|
5941 |
|
5942 | function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
5943 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
5944 | cbs.create[i$1](emptyNode, vnode);
|
5945 | }
|
5946 | i = vnode.data.hook;
|
5947 | if (isDef(i)) {
|
5948 | if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
5949 | if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
5950 | }
|
5951 | }
|
5952 |
|
5953 |
|
5954 |
|
5955 |
|
5956 | function setScope (vnode) {
|
5957 | var i;
|
5958 | if (isDef(i = vnode.fnScopeId)) {
|
5959 | nodeOps.setStyleScope(vnode.elm, i);
|
5960 | } else {
|
5961 | var ancestor = vnode;
|
5962 | while (ancestor) {
|
5963 | if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
5964 | nodeOps.setStyleScope(vnode.elm, i);
|
5965 | }
|
5966 | ancestor = ancestor.parent;
|
5967 | }
|
5968 | }
|
5969 |
|
5970 | if (isDef(i = activeInstance) &&
|
5971 | i !== vnode.context &&
|
5972 | i !== vnode.fnContext &&
|
5973 | isDef(i = i.$options._scopeId)
|
5974 | ) {
|
5975 | nodeOps.setStyleScope(vnode.elm, i);
|
5976 | }
|
5977 | }
|
5978 |
|
5979 | function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
5980 | for (; startIdx <= endIdx; ++startIdx) {
|
5981 | createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
5982 | }
|
5983 | }
|
5984 |
|
5985 | function invokeDestroyHook (vnode) {
|
5986 | var i, j;
|
5987 | var data = vnode.data;
|
5988 | if (isDef(data)) {
|
5989 | if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
5990 | for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
5991 | }
|
5992 | if (isDef(i = vnode.children)) {
|
5993 | for (j = 0; j < vnode.children.length; ++j) {
|
5994 | invokeDestroyHook(vnode.children[j]);
|
5995 | }
|
5996 | }
|
5997 | }
|
5998 |
|
5999 | function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
|
6000 | for (; startIdx <= endIdx; ++startIdx) {
|
6001 | var ch = vnodes[startIdx];
|
6002 | if (isDef(ch)) {
|
6003 | if (isDef(ch.tag)) {
|
6004 | removeAndInvokeRemoveHook(ch);
|
6005 | invokeDestroyHook(ch);
|
6006 | } else {
|
6007 | removeNode(ch.elm);
|
6008 | }
|
6009 | }
|
6010 | }
|
6011 | }
|
6012 |
|
6013 | function removeAndInvokeRemoveHook (vnode, rm) {
|
6014 | if (isDef(rm) || isDef(vnode.data)) {
|
6015 | var i;
|
6016 | var listeners = cbs.remove.length + 1;
|
6017 | if (isDef(rm)) {
|
6018 |
|
6019 |
|
6020 | rm.listeners += listeners;
|
6021 | } else {
|
6022 |
|
6023 | rm = createRmCb(vnode.elm, listeners);
|
6024 | }
|
6025 |
|
6026 | if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
6027 | removeAndInvokeRemoveHook(i, rm);
|
6028 | }
|
6029 | for (i = 0; i < cbs.remove.length; ++i) {
|
6030 | cbs.remove[i](vnode, rm);
|
6031 | }
|
6032 | if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
6033 | i(vnode, rm);
|
6034 | } else {
|
6035 | rm();
|
6036 | }
|
6037 | } else {
|
6038 | removeNode(vnode.elm);
|
6039 | }
|
6040 | }
|
6041 |
|
6042 | function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6043 | var oldStartIdx = 0;
|
6044 | var newStartIdx = 0;
|
6045 | var oldEndIdx = oldCh.length - 1;
|
6046 | var oldStartVnode = oldCh[0];
|
6047 | var oldEndVnode = oldCh[oldEndIdx];
|
6048 | var newEndIdx = newCh.length - 1;
|
6049 | var newStartVnode = newCh[0];
|
6050 | var newEndVnode = newCh[newEndIdx];
|
6051 | var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6052 |
|
6053 |
|
6054 |
|
6055 |
|
6056 | var canMove = !removeOnly;
|
6057 |
|
6058 | {
|
6059 | checkDuplicateKeys(newCh);
|
6060 | }
|
6061 |
|
6062 | while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6063 | if (isUndef(oldStartVnode)) {
|
6064 | oldStartVnode = oldCh[++oldStartIdx];
|
6065 | } else if (isUndef(oldEndVnode)) {
|
6066 | oldEndVnode = oldCh[--oldEndIdx];
|
6067 | } else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6068 | patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6069 | oldStartVnode = oldCh[++oldStartIdx];
|
6070 | newStartVnode = newCh[++newStartIdx];
|
6071 | } else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6072 | patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6073 | oldEndVnode = oldCh[--oldEndIdx];
|
6074 | newEndVnode = newCh[--newEndIdx];
|
6075 | } else if (sameVnode(oldStartVnode, newEndVnode)) {
|
6076 | patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6077 | canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6078 | oldStartVnode = oldCh[++oldStartIdx];
|
6079 | newEndVnode = newCh[--newEndIdx];
|
6080 | } else if (sameVnode(oldEndVnode, newStartVnode)) {
|
6081 | patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6082 | canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6083 | oldEndVnode = oldCh[--oldEndIdx];
|
6084 | newStartVnode = newCh[++newStartIdx];
|
6085 | } else {
|
6086 | if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
6087 | idxInOld = isDef(newStartVnode.key)
|
6088 | ? oldKeyToIdx[newStartVnode.key]
|
6089 | : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6090 | if (isUndef(idxInOld)) {
|
6091 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6092 | } else {
|
6093 | vnodeToMove = oldCh[idxInOld];
|
6094 | if (sameVnode(vnodeToMove, newStartVnode)) {
|
6095 | patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6096 | oldCh[idxInOld] = undefined;
|
6097 | canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6098 | } else {
|
6099 |
|
6100 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6101 | }
|
6102 | }
|
6103 | newStartVnode = newCh[++newStartIdx];
|
6104 | }
|
6105 | }
|
6106 | if (oldStartIdx > oldEndIdx) {
|
6107 | refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6108 | addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6109 | } else if (newStartIdx > newEndIdx) {
|
6110 | removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
6111 | }
|
6112 | }
|
6113 |
|
6114 | function checkDuplicateKeys (children) {
|
6115 | var seenKeys = {};
|
6116 | for (var i = 0; i < children.length; i++) {
|
6117 | var vnode = children[i];
|
6118 | var key = vnode.key;
|
6119 | if (isDef(key)) {
|
6120 | if (seenKeys[key]) {
|
6121 | warn(
|
6122 | ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
6123 | vnode.context
|
6124 | );
|
6125 | } else {
|
6126 | seenKeys[key] = true;
|
6127 | }
|
6128 | }
|
6129 | }
|
6130 | }
|
6131 |
|
6132 | function findIdxInOld (node, oldCh, start, end) {
|
6133 | for (var i = start; i < end; i++) {
|
6134 | var c = oldCh[i];
|
6135 | if (isDef(c) && sameVnode(node, c)) { return i }
|
6136 | }
|
6137 | }
|
6138 |
|
6139 | function patchVnode (
|
6140 | oldVnode,
|
6141 | vnode,
|
6142 | insertedVnodeQueue,
|
6143 | ownerArray,
|
6144 | index,
|
6145 | removeOnly
|
6146 | ) {
|
6147 | if (oldVnode === vnode) {
|
6148 | return
|
6149 | }
|
6150 |
|
6151 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6152 |
|
6153 | vnode = ownerArray[index] = cloneVNode(vnode);
|
6154 | }
|
6155 |
|
6156 | var elm = vnode.elm = oldVnode.elm;
|
6157 |
|
6158 | if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6159 | if (isDef(vnode.asyncFactory.resolved)) {
|
6160 | hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6161 | } else {
|
6162 | vnode.isAsyncPlaceholder = true;
|
6163 | }
|
6164 | return
|
6165 | }
|
6166 |
|
6167 |
|
6168 |
|
6169 |
|
6170 |
|
6171 | if (isTrue(vnode.isStatic) &&
|
6172 | isTrue(oldVnode.isStatic) &&
|
6173 | vnode.key === oldVnode.key &&
|
6174 | (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
6175 | ) {
|
6176 | vnode.componentInstance = oldVnode.componentInstance;
|
6177 | return
|
6178 | }
|
6179 |
|
6180 | var i;
|
6181 | var data = vnode.data;
|
6182 | if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
6183 | i(oldVnode, vnode);
|
6184 | }
|
6185 |
|
6186 | var oldCh = oldVnode.children;
|
6187 | var ch = vnode.children;
|
6188 | if (isDef(data) && isPatchable(vnode)) {
|
6189 | for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
6190 | if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
6191 | }
|
6192 | if (isUndef(vnode.text)) {
|
6193 | if (isDef(oldCh) && isDef(ch)) {
|
6194 | if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
6195 | } else if (isDef(ch)) {
|
6196 | {
|
6197 | checkDuplicateKeys(ch);
|
6198 | }
|
6199 | if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
6200 | addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6201 | } else if (isDef(oldCh)) {
|
6202 | removeVnodes(elm, oldCh, 0, oldCh.length - 1);
|
6203 | } else if (isDef(oldVnode.text)) {
|
6204 | nodeOps.setTextContent(elm, '');
|
6205 | }
|
6206 | } else if (oldVnode.text !== vnode.text) {
|
6207 | nodeOps.setTextContent(elm, vnode.text);
|
6208 | }
|
6209 | if (isDef(data)) {
|
6210 | if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
6211 | }
|
6212 | }
|
6213 |
|
6214 | function invokeInsertHook (vnode, queue, initial) {
|
6215 |
|
6216 |
|
6217 | if (isTrue(initial) && isDef(vnode.parent)) {
|
6218 | vnode.parent.data.pendingInsert = queue;
|
6219 | } else {
|
6220 | for (var i = 0; i < queue.length; ++i) {
|
6221 | queue[i].data.hook.insert(queue[i]);
|
6222 | }
|
6223 | }
|
6224 | }
|
6225 |
|
6226 | var hydrationBailed = false;
|
6227 |
|
6228 |
|
6229 |
|
6230 |
|
6231 | var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6232 |
|
6233 |
|
6234 | function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
6235 | var i;
|
6236 | var tag = vnode.tag;
|
6237 | var data = vnode.data;
|
6238 | var children = vnode.children;
|
6239 | inVPre = inVPre || (data && data.pre);
|
6240 | vnode.elm = elm;
|
6241 |
|
6242 | if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6243 | vnode.isAsyncPlaceholder = true;
|
6244 | return true
|
6245 | }
|
6246 |
|
6247 | {
|
6248 | if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6249 | return false
|
6250 | }
|
6251 | }
|
6252 | if (isDef(data)) {
|
6253 | if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true ); }
|
6254 | if (isDef(i = vnode.componentInstance)) {
|
6255 |
|
6256 | initComponent(vnode, insertedVnodeQueue);
|
6257 | return true
|
6258 | }
|
6259 | }
|
6260 | if (isDef(tag)) {
|
6261 | if (isDef(children)) {
|
6262 |
|
6263 | if (!elm.hasChildNodes()) {
|
6264 | createChildren(vnode, children, insertedVnodeQueue);
|
6265 | } else {
|
6266 |
|
6267 | if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
6268 | if (i !== elm.innerHTML) {
|
6269 |
|
6270 | if (typeof console !== 'undefined' &&
|
6271 | !hydrationBailed
|
6272 | ) {
|
6273 | hydrationBailed = true;
|
6274 | console.warn('Parent: ', elm);
|
6275 | console.warn('server innerHTML: ', i);
|
6276 | console.warn('client innerHTML: ', elm.innerHTML);
|
6277 | }
|
6278 | return false
|
6279 | }
|
6280 | } else {
|
6281 |
|
6282 | var childrenMatch = true;
|
6283 | var childNode = elm.firstChild;
|
6284 | for (var i$1 = 0; i$1 < children.length; i$1++) {
|
6285 | if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
6286 | childrenMatch = false;
|
6287 | break
|
6288 | }
|
6289 | childNode = childNode.nextSibling;
|
6290 | }
|
6291 |
|
6292 |
|
6293 | if (!childrenMatch || childNode) {
|
6294 |
|
6295 | if (typeof console !== 'undefined' &&
|
6296 | !hydrationBailed
|
6297 | ) {
|
6298 | hydrationBailed = true;
|
6299 | console.warn('Parent: ', elm);
|
6300 | console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
6301 | }
|
6302 | return false
|
6303 | }
|
6304 | }
|
6305 | }
|
6306 | }
|
6307 | if (isDef(data)) {
|
6308 | var fullInvoke = false;
|
6309 | for (var key in data) {
|
6310 | if (!isRenderedModule(key)) {
|
6311 | fullInvoke = true;
|
6312 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
6313 | break
|
6314 | }
|
6315 | }
|
6316 | if (!fullInvoke && data['class']) {
|
6317 |
|
6318 | traverse(data['class']);
|
6319 | }
|
6320 | }
|
6321 | } else if (elm.data !== vnode.text) {
|
6322 | elm.data = vnode.text;
|
6323 | }
|
6324 | return true
|
6325 | }
|
6326 |
|
6327 | function assertNodeMatch (node, vnode, inVPre) {
|
6328 | if (isDef(vnode.tag)) {
|
6329 | return vnode.tag.indexOf('vue-component') === 0 || (
|
6330 | !isUnknownElement$$1(vnode, inVPre) &&
|
6331 | vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
6332 | )
|
6333 | } else {
|
6334 | return node.nodeType === (vnode.isComment ? 8 : 3)
|
6335 | }
|
6336 | }
|
6337 |
|
6338 | return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
6339 | if (isUndef(vnode)) {
|
6340 | if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
6341 | return
|
6342 | }
|
6343 |
|
6344 | var isInitialPatch = false;
|
6345 | var insertedVnodeQueue = [];
|
6346 |
|
6347 | if (isUndef(oldVnode)) {
|
6348 |
|
6349 | isInitialPatch = true;
|
6350 | createElm(vnode, insertedVnodeQueue);
|
6351 | } else {
|
6352 | var isRealElement = isDef(oldVnode.nodeType);
|
6353 | if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
6354 |
|
6355 | patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
6356 | } else {
|
6357 | if (isRealElement) {
|
6358 |
|
6359 |
|
6360 |
|
6361 | if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
6362 | oldVnode.removeAttribute(SSR_ATTR);
|
6363 | hydrating = true;
|
6364 | }
|
6365 | if (isTrue(hydrating)) {
|
6366 | if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
6367 | invokeInsertHook(vnode, insertedVnodeQueue, true);
|
6368 | return oldVnode
|
6369 | } else {
|
6370 | warn(
|
6371 | 'The client-side rendered virtual DOM tree is not matching ' +
|
6372 | 'server-rendered content. This is likely caused by incorrect ' +
|
6373 | 'HTML markup, for example nesting block-level elements inside ' +
|
6374 | '<p>, or missing <tbody>. Bailing hydration and performing ' +
|
6375 | 'full client-side render.'
|
6376 | );
|
6377 | }
|
6378 | }
|
6379 |
|
6380 |
|
6381 | oldVnode = emptyNodeAt(oldVnode);
|
6382 | }
|
6383 |
|
6384 |
|
6385 | var oldElm = oldVnode.elm;
|
6386 | var parentElm = nodeOps.parentNode(oldElm);
|
6387 |
|
6388 |
|
6389 | createElm(
|
6390 | vnode,
|
6391 | insertedVnodeQueue,
|
6392 |
|
6393 |
|
6394 |
|
6395 | oldElm._leaveCb ? null : parentElm,
|
6396 | nodeOps.nextSibling(oldElm)
|
6397 | );
|
6398 |
|
6399 |
|
6400 | if (isDef(vnode.parent)) {
|
6401 | var ancestor = vnode.parent;
|
6402 | var patchable = isPatchable(vnode);
|
6403 | while (ancestor) {
|
6404 | for (var i = 0; i < cbs.destroy.length; ++i) {
|
6405 | cbs.destroy[i](ancestor);
|
6406 | }
|
6407 | ancestor.elm = vnode.elm;
|
6408 | if (patchable) {
|
6409 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6410 | cbs.create[i$1](emptyNode, ancestor);
|
6411 | }
|
6412 |
|
6413 |
|
6414 |
|
6415 | var insert = ancestor.data.hook.insert;
|
6416 | if (insert.merged) {
|
6417 |
|
6418 | for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
6419 | insert.fns[i$2]();
|
6420 | }
|
6421 | }
|
6422 | } else {
|
6423 | registerRef(ancestor);
|
6424 | }
|
6425 | ancestor = ancestor.parent;
|
6426 | }
|
6427 | }
|
6428 |
|
6429 |
|
6430 | if (isDef(parentElm)) {
|
6431 | removeVnodes(parentElm, [oldVnode], 0, 0);
|
6432 | } else if (isDef(oldVnode.tag)) {
|
6433 | invokeDestroyHook(oldVnode);
|
6434 | }
|
6435 | }
|
6436 | }
|
6437 |
|
6438 | invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
6439 | return vnode.elm
|
6440 | }
|
6441 | }
|
6442 |
|
6443 |
|
6444 |
|
6445 | var directives = {
|
6446 | create: updateDirectives,
|
6447 | update: updateDirectives,
|
6448 | destroy: function unbindDirectives (vnode) {
|
6449 | updateDirectives(vnode, emptyNode);
|
6450 | }
|
6451 | };
|
6452 |
|
6453 | function updateDirectives (oldVnode, vnode) {
|
6454 | if (oldVnode.data.directives || vnode.data.directives) {
|
6455 | _update(oldVnode, vnode);
|
6456 | }
|
6457 | }
|
6458 |
|
6459 | function _update (oldVnode, vnode) {
|
6460 | var isCreate = oldVnode === emptyNode;
|
6461 | var isDestroy = vnode === emptyNode;
|
6462 | var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
6463 | var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
6464 |
|
6465 | var dirsWithInsert = [];
|
6466 | var dirsWithPostpatch = [];
|
6467 |
|
6468 | var key, oldDir, dir;
|
6469 | for (key in newDirs) {
|
6470 | oldDir = oldDirs[key];
|
6471 | dir = newDirs[key];
|
6472 | if (!oldDir) {
|
6473 |
|
6474 | callHook$1(dir, 'bind', vnode, oldVnode);
|
6475 | if (dir.def && dir.def.inserted) {
|
6476 | dirsWithInsert.push(dir);
|
6477 | }
|
6478 | } else {
|
6479 |
|
6480 | dir.oldValue = oldDir.value;
|
6481 | dir.oldArg = oldDir.arg;
|
6482 | callHook$1(dir, 'update', vnode, oldVnode);
|
6483 | if (dir.def && dir.def.componentUpdated) {
|
6484 | dirsWithPostpatch.push(dir);
|
6485 | }
|
6486 | }
|
6487 | }
|
6488 |
|
6489 | if (dirsWithInsert.length) {
|
6490 | var callInsert = function () {
|
6491 | for (var i = 0; i < dirsWithInsert.length; i++) {
|
6492 | callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
6493 | }
|
6494 | };
|
6495 | if (isCreate) {
|
6496 | mergeVNodeHook(vnode, 'insert', callInsert);
|
6497 | } else {
|
6498 | callInsert();
|
6499 | }
|
6500 | }
|
6501 |
|
6502 | if (dirsWithPostpatch.length) {
|
6503 | mergeVNodeHook(vnode, 'postpatch', function () {
|
6504 | for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
6505 | callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
6506 | }
|
6507 | });
|
6508 | }
|
6509 |
|
6510 | if (!isCreate) {
|
6511 | for (key in oldDirs) {
|
6512 | if (!newDirs[key]) {
|
6513 |
|
6514 | callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
6515 | }
|
6516 | }
|
6517 | }
|
6518 | }
|
6519 |
|
6520 | var emptyModifiers = Object.create(null);
|
6521 |
|
6522 | function normalizeDirectives$1 (
|
6523 | dirs,
|
6524 | vm
|
6525 | ) {
|
6526 | var res = Object.create(null);
|
6527 | if (!dirs) {
|
6528 |
|
6529 | return res
|
6530 | }
|
6531 | var i, dir;
|
6532 | for (i = 0; i < dirs.length; i++) {
|
6533 | dir = dirs[i];
|
6534 | if (!dir.modifiers) {
|
6535 |
|
6536 | dir.modifiers = emptyModifiers;
|
6537 | }
|
6538 | res[getRawDirName(dir)] = dir;
|
6539 | dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
6540 | }
|
6541 |
|
6542 | return res
|
6543 | }
|
6544 |
|
6545 | function getRawDirName (dir) {
|
6546 | return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
6547 | }
|
6548 |
|
6549 | function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
6550 | var fn = dir.def && dir.def[hook];
|
6551 | if (fn) {
|
6552 | try {
|
6553 | fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
6554 | } catch (e) {
|
6555 | handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
6556 | }
|
6557 | }
|
6558 | }
|
6559 |
|
6560 | var baseModules = [
|
6561 | ref,
|
6562 | directives
|
6563 | ];
|
6564 |
|
6565 |
|
6566 |
|
6567 | function updateAttrs (oldVnode, vnode) {
|
6568 | var opts = vnode.componentOptions;
|
6569 | if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
6570 | return
|
6571 | }
|
6572 | if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
6573 | return
|
6574 | }
|
6575 | var key, cur, old;
|
6576 | var elm = vnode.elm;
|
6577 | var oldAttrs = oldVnode.data.attrs || {};
|
6578 | var attrs = vnode.data.attrs || {};
|
6579 |
|
6580 | if (isDef(attrs.__ob__)) {
|
6581 | attrs = vnode.data.attrs = extend({}, attrs);
|
6582 | }
|
6583 |
|
6584 | for (key in attrs) {
|
6585 | cur = attrs[key];
|
6586 | old = oldAttrs[key];
|
6587 | if (old !== cur) {
|
6588 | setAttr(elm, key, cur);
|
6589 | }
|
6590 | }
|
6591 |
|
6592 |
|
6593 |
|
6594 | if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
6595 | setAttr(elm, 'value', attrs.value);
|
6596 | }
|
6597 | for (key in oldAttrs) {
|
6598 | if (isUndef(attrs[key])) {
|
6599 | if (isXlink(key)) {
|
6600 | elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6601 | } else if (!isEnumeratedAttr(key)) {
|
6602 | elm.removeAttribute(key);
|
6603 | }
|
6604 | }
|
6605 | }
|
6606 | }
|
6607 |
|
6608 | function setAttr (el, key, value) {
|
6609 | if (el.tagName.indexOf('-') > -1) {
|
6610 | baseSetAttr(el, key, value);
|
6611 | } else if (isBooleanAttr(key)) {
|
6612 |
|
6613 |
|
6614 | if (isFalsyAttrValue(value)) {
|
6615 | el.removeAttribute(key);
|
6616 | } else {
|
6617 |
|
6618 |
|
6619 | value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
6620 | ? 'true'
|
6621 | : key;
|
6622 | el.setAttribute(key, value);
|
6623 | }
|
6624 | } else if (isEnumeratedAttr(key)) {
|
6625 | el.setAttribute(key, convertEnumeratedValue(key, value));
|
6626 | } else if (isXlink(key)) {
|
6627 | if (isFalsyAttrValue(value)) {
|
6628 | el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6629 | } else {
|
6630 | el.setAttributeNS(xlinkNS, key, value);
|
6631 | }
|
6632 | } else {
|
6633 | baseSetAttr(el, key, value);
|
6634 | }
|
6635 | }
|
6636 |
|
6637 | function baseSetAttr (el, key, value) {
|
6638 | if (isFalsyAttrValue(value)) {
|
6639 | el.removeAttribute(key);
|
6640 | } else {
|
6641 |
|
6642 |
|
6643 |
|
6644 |
|
6645 | if (
|
6646 | isIE && !isIE9 &&
|
6647 | (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') &&
|
6648 | key === 'placeholder' && !el.__ieph
|
6649 | ) {
|
6650 | var blocker = function (e) {
|
6651 | e.stopImmediatePropagation();
|
6652 | el.removeEventListener('input', blocker);
|
6653 | };
|
6654 | el.addEventListener('input', blocker);
|
6655 |
|
6656 | el.__ieph = true;
|
6657 | }
|
6658 | el.setAttribute(key, value);
|
6659 | }
|
6660 | }
|
6661 |
|
6662 | var attrs = {
|
6663 | create: updateAttrs,
|
6664 | update: updateAttrs
|
6665 | };
|
6666 |
|
6667 |
|
6668 |
|
6669 | function updateClass (oldVnode, vnode) {
|
6670 | var el = vnode.elm;
|
6671 | var data = vnode.data;
|
6672 | var oldData = oldVnode.data;
|
6673 | if (
|
6674 | isUndef(data.staticClass) &&
|
6675 | isUndef(data.class) && (
|
6676 | isUndef(oldData) || (
|
6677 | isUndef(oldData.staticClass) &&
|
6678 | isUndef(oldData.class)
|
6679 | )
|
6680 | )
|
6681 | ) {
|
6682 | return
|
6683 | }
|
6684 |
|
6685 | var cls = genClassForVnode(vnode);
|
6686 |
|
6687 |
|
6688 | var transitionClass = el._transitionClasses;
|
6689 | if (isDef(transitionClass)) {
|
6690 | cls = concat(cls, stringifyClass(transitionClass));
|
6691 | }
|
6692 |
|
6693 |
|
6694 | if (cls !== el._prevClass) {
|
6695 | el.setAttribute('class', cls);
|
6696 | el._prevClass = cls;
|
6697 | }
|
6698 | }
|
6699 |
|
6700 | var klass = {
|
6701 | create: updateClass,
|
6702 | update: updateClass
|
6703 | };
|
6704 |
|
6705 |
|
6706 |
|
6707 | var validDivisionCharRE = /[\w).+\-_$\]]/;
|
6708 |
|
6709 | function parseFilters (exp) {
|
6710 | var inSingle = false;
|
6711 | var inDouble = false;
|
6712 | var inTemplateString = false;
|
6713 | var inRegex = false;
|
6714 | var curly = 0;
|
6715 | var square = 0;
|
6716 | var paren = 0;
|
6717 | var lastFilterIndex = 0;
|
6718 | var c, prev, i, expression, filters;
|
6719 |
|
6720 | for (i = 0; i < exp.length; i++) {
|
6721 | prev = c;
|
6722 | c = exp.charCodeAt(i);
|
6723 | if (inSingle) {
|
6724 | if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
|
6725 | } else if (inDouble) {
|
6726 | if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
|
6727 | } else if (inTemplateString) {
|
6728 | if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
|
6729 | } else if (inRegex) {
|
6730 | if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
|
6731 | } else if (
|
6732 | c === 0x7C &&
|
6733 | exp.charCodeAt(i + 1) !== 0x7C &&
|
6734 | exp.charCodeAt(i - 1) !== 0x7C &&
|
6735 | !curly && !square && !paren
|
6736 | ) {
|
6737 | if (expression === undefined) {
|
6738 |
|
6739 | lastFilterIndex = i + 1;
|
6740 | expression = exp.slice(0, i).trim();
|
6741 | } else {
|
6742 | pushFilter();
|
6743 | }
|
6744 | } else {
|
6745 | switch (c) {
|
6746 | case 0x22: inDouble = true; break
|
6747 | case 0x27: inSingle = true; break
|
6748 | case 0x60: inTemplateString = true; break
|
6749 | case 0x28: paren++; break
|
6750 | case 0x29: paren--; break
|
6751 | case 0x5B: square++; break
|
6752 | case 0x5D: square--; break
|
6753 | case 0x7B: curly++; break
|
6754 | case 0x7D: curly--; break
|
6755 | }
|
6756 | if (c === 0x2f) {
|
6757 | var j = i - 1;
|
6758 | var p = (void 0);
|
6759 |
|
6760 | for (; j >= 0; j--) {
|
6761 | p = exp.charAt(j);
|
6762 | if (p !== ' ') { break }
|
6763 | }
|
6764 | if (!p || !validDivisionCharRE.test(p)) {
|
6765 | inRegex = true;
|
6766 | }
|
6767 | }
|
6768 | }
|
6769 | }
|
6770 |
|
6771 | if (expression === undefined) {
|
6772 | expression = exp.slice(0, i).trim();
|
6773 | } else if (lastFilterIndex !== 0) {
|
6774 | pushFilter();
|
6775 | }
|
6776 |
|
6777 | function pushFilter () {
|
6778 | (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
6779 | lastFilterIndex = i + 1;
|
6780 | }
|
6781 |
|
6782 | if (filters) {
|
6783 | for (i = 0; i < filters.length; i++) {
|
6784 | expression = wrapFilter(expression, filters[i]);
|
6785 | }
|
6786 | }
|
6787 |
|
6788 | return expression
|
6789 | }
|
6790 |
|
6791 | function wrapFilter (exp, filter) {
|
6792 | var i = filter.indexOf('(');
|
6793 | if (i < 0) {
|
6794 |
|
6795 | return ("_f(\"" + filter + "\")(" + exp + ")")
|
6796 | } else {
|
6797 | var name = filter.slice(0, i);
|
6798 | var args = filter.slice(i + 1);
|
6799 | return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
|
6800 | }
|
6801 | }
|
6802 |
|
6803 |
|
6804 |
|
6805 |
|
6806 |
|
6807 |
|
6808 | function baseWarn (msg, range) {
|
6809 | console.error(("[Vue compiler]: " + msg));
|
6810 | }
|
6811 |
|
6812 |
|
6813 | function pluckModuleFunction (
|
6814 | modules,
|
6815 | key
|
6816 | ) {
|
6817 | return modules
|
6818 | ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
|
6819 | : []
|
6820 | }
|
6821 |
|
6822 | function addProp (el, name, value, range, dynamic) {
|
6823 | (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6824 | el.plain = false;
|
6825 | }
|
6826 |
|
6827 | function addAttr (el, name, value, range, dynamic) {
|
6828 | var attrs = dynamic
|
6829 | ? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
6830 | : (el.attrs || (el.attrs = []));
|
6831 | attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6832 | el.plain = false;
|
6833 | }
|
6834 |
|
6835 |
|
6836 | function addRawAttr (el, name, value, range) {
|
6837 | el.attrsMap[name] = value;
|
6838 | el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
|
6839 | }
|
6840 |
|
6841 | function addDirective (
|
6842 | el,
|
6843 | name,
|
6844 | rawName,
|
6845 | value,
|
6846 | arg,
|
6847 | isDynamicArg,
|
6848 | modifiers,
|
6849 | range
|
6850 | ) {
|
6851 | (el.directives || (el.directives = [])).push(rangeSetItem({
|
6852 | name: name,
|
6853 | rawName: rawName,
|
6854 | value: value,
|
6855 | arg: arg,
|
6856 | isDynamicArg: isDynamicArg,
|
6857 | modifiers: modifiers
|
6858 | }, range));
|
6859 | el.plain = false;
|
6860 | }
|
6861 |
|
6862 | function prependModifierMarker (symbol, name, dynamic) {
|
6863 | return dynamic
|
6864 | ? ("_p(" + name + ",\"" + symbol + "\")")
|
6865 | : symbol + name
|
6866 | }
|
6867 |
|
6868 | function addHandler (
|
6869 | el,
|
6870 | name,
|
6871 | value,
|
6872 | modifiers,
|
6873 | important,
|
6874 | warn,
|
6875 | range,
|
6876 | dynamic
|
6877 | ) {
|
6878 | modifiers = modifiers || emptyObject;
|
6879 |
|
6880 |
|
6881 | if (
|
6882 | warn &&
|
6883 | modifiers.prevent && modifiers.passive
|
6884 | ) {
|
6885 | warn(
|
6886 | 'passive and prevent can\'t be used together. ' +
|
6887 | 'Passive handler can\'t prevent default event.',
|
6888 | range
|
6889 | );
|
6890 | }
|
6891 |
|
6892 |
|
6893 |
|
6894 |
|
6895 | if (modifiers.right) {
|
6896 | if (dynamic) {
|
6897 | name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
6898 | } else if (name === 'click') {
|
6899 | name = 'contextmenu';
|
6900 | delete modifiers.right;
|
6901 | }
|
6902 | } else if (modifiers.middle) {
|
6903 | if (dynamic) {
|
6904 | name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
6905 | } else if (name === 'click') {
|
6906 | name = 'mouseup';
|
6907 | }
|
6908 | }
|
6909 |
|
6910 |
|
6911 | if (modifiers.capture) {
|
6912 | delete modifiers.capture;
|
6913 | name = prependModifierMarker('!', name, dynamic);
|
6914 | }
|
6915 | if (modifiers.once) {
|
6916 | delete modifiers.once;
|
6917 | name = prependModifierMarker('~', name, dynamic);
|
6918 | }
|
6919 |
|
6920 | if (modifiers.passive) {
|
6921 | delete modifiers.passive;
|
6922 | name = prependModifierMarker('&', name, dynamic);
|
6923 | }
|
6924 |
|
6925 | var events;
|
6926 | if (modifiers.native) {
|
6927 | delete modifiers.native;
|
6928 | events = el.nativeEvents || (el.nativeEvents = {});
|
6929 | } else {
|
6930 | events = el.events || (el.events = {});
|
6931 | }
|
6932 |
|
6933 | var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
6934 | if (modifiers !== emptyObject) {
|
6935 | newHandler.modifiers = modifiers;
|
6936 | }
|
6937 |
|
6938 | var handlers = events[name];
|
6939 |
|
6940 | if (Array.isArray(handlers)) {
|
6941 | important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
6942 | } else if (handlers) {
|
6943 | events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
6944 | } else {
|
6945 | events[name] = newHandler;
|
6946 | }
|
6947 |
|
6948 | el.plain = false;
|
6949 | }
|
6950 |
|
6951 | function getRawBindingAttr (
|
6952 | el,
|
6953 | name
|
6954 | ) {
|
6955 | return el.rawAttrsMap[':' + name] ||
|
6956 | el.rawAttrsMap['v-bind:' + name] ||
|
6957 | el.rawAttrsMap[name]
|
6958 | }
|
6959 |
|
6960 | function getBindingAttr (
|
6961 | el,
|
6962 | name,
|
6963 | getStatic
|
6964 | ) {
|
6965 | var dynamicValue =
|
6966 | getAndRemoveAttr(el, ':' + name) ||
|
6967 | getAndRemoveAttr(el, 'v-bind:' + name);
|
6968 | if (dynamicValue != null) {
|
6969 | return parseFilters(dynamicValue)
|
6970 | } else if (getStatic !== false) {
|
6971 | var staticValue = getAndRemoveAttr(el, name);
|
6972 | if (staticValue != null) {
|
6973 | return JSON.stringify(staticValue)
|
6974 | }
|
6975 | }
|
6976 | }
|
6977 |
|
6978 |
|
6979 |
|
6980 |
|
6981 |
|
6982 | function getAndRemoveAttr (
|
6983 | el,
|
6984 | name,
|
6985 | removeFromMap
|
6986 | ) {
|
6987 | var val;
|
6988 | if ((val = el.attrsMap[name]) != null) {
|
6989 | var list = el.attrsList;
|
6990 | for (var i = 0, l = list.length; i < l; i++) {
|
6991 | if (list[i].name === name) {
|
6992 | list.splice(i, 1);
|
6993 | break
|
6994 | }
|
6995 | }
|
6996 | }
|
6997 | if (removeFromMap) {
|
6998 | delete el.attrsMap[name];
|
6999 | }
|
7000 | return val
|
7001 | }
|
7002 |
|
7003 | function getAndRemoveAttrByRegex (
|
7004 | el,
|
7005 | name
|
7006 | ) {
|
7007 | var list = el.attrsList;
|
7008 | for (var i = 0, l = list.length; i < l; i++) {
|
7009 | var attr = list[i];
|
7010 | if (name.test(attr.name)) {
|
7011 | list.splice(i, 1);
|
7012 | return attr
|
7013 | }
|
7014 | }
|
7015 | }
|
7016 |
|
7017 | function rangeSetItem (
|
7018 | item,
|
7019 | range
|
7020 | ) {
|
7021 | if (range) {
|
7022 | if (range.start != null) {
|
7023 | item.start = range.start;
|
7024 | }
|
7025 | if (range.end != null) {
|
7026 | item.end = range.end;
|
7027 | }
|
7028 | }
|
7029 | return item
|
7030 | }
|
7031 |
|
7032 |
|
7033 |
|
7034 | |
7035 |
|
7036 |
|
7037 | function genComponentModel (
|
7038 | el,
|
7039 | value,
|
7040 | modifiers
|
7041 | ) {
|
7042 | var ref = modifiers || {};
|
7043 | var number = ref.number;
|
7044 | var trim = ref.trim;
|
7045 |
|
7046 | var baseValueExpression = '$$v';
|
7047 | var valueExpression = baseValueExpression;
|
7048 | if (trim) {
|
7049 | valueExpression =
|
7050 | "(typeof " + baseValueExpression + " === 'string'" +
|
7051 | "? " + baseValueExpression + ".trim()" +
|
7052 | ": " + baseValueExpression + ")";
|
7053 | }
|
7054 | if (number) {
|
7055 | valueExpression = "_n(" + valueExpression + ")";
|
7056 | }
|
7057 | var assignment = genAssignmentCode(value, valueExpression);
|
7058 |
|
7059 | el.model = {
|
7060 | value: ("(" + value + ")"),
|
7061 | expression: JSON.stringify(value),
|
7062 | callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
7063 | };
|
7064 | }
|
7065 |
|
7066 | |
7067 |
|
7068 |
|
7069 | function genAssignmentCode (
|
7070 | value,
|
7071 | assignment
|
7072 | ) {
|
7073 | var res = parseModel(value);
|
7074 | if (res.key === null) {
|
7075 | return (value + "=" + assignment)
|
7076 | } else {
|
7077 | return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
|
7078 | }
|
7079 | }
|
7080 |
|
7081 | |
7082 |
|
7083 |
|
7084 |
|
7085 |
|
7086 |
|
7087 |
|
7088 |
|
7089 |
|
7090 |
|
7091 |
|
7092 |
|
7093 |
|
7094 |
|
7095 |
|
7096 | var len, str, chr, index$1, expressionPos, expressionEndPos;
|
7097 |
|
7098 |
|
7099 |
|
7100 | function parseModel (val) {
|
7101 |
|
7102 |
|
7103 | val = val.trim();
|
7104 | len = val.length;
|
7105 |
|
7106 | if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
7107 | index$1 = val.lastIndexOf('.');
|
7108 | if (index$1 > -1) {
|
7109 | return {
|
7110 | exp: val.slice(0, index$1),
|
7111 | key: '"' + val.slice(index$1 + 1) + '"'
|
7112 | }
|
7113 | } else {
|
7114 | return {
|
7115 | exp: val,
|
7116 | key: null
|
7117 | }
|
7118 | }
|
7119 | }
|
7120 |
|
7121 | str = val;
|
7122 | index$1 = expressionPos = expressionEndPos = 0;
|
7123 |
|
7124 | while (!eof()) {
|
7125 | chr = next();
|
7126 |
|
7127 | if (isStringStart(chr)) {
|
7128 | parseString(chr);
|
7129 | } else if (chr === 0x5B) {
|
7130 | parseBracket(chr);
|
7131 | }
|
7132 | }
|
7133 |
|
7134 | return {
|
7135 | exp: val.slice(0, expressionPos),
|
7136 | key: val.slice(expressionPos + 1, expressionEndPos)
|
7137 | }
|
7138 | }
|
7139 |
|
7140 | function next () {
|
7141 | return str.charCodeAt(++index$1)
|
7142 | }
|
7143 |
|
7144 | function eof () {
|
7145 | return index$1 >= len
|
7146 | }
|
7147 |
|
7148 | function isStringStart (chr) {
|
7149 | return chr === 0x22 || chr === 0x27
|
7150 | }
|
7151 |
|
7152 | function parseBracket (chr) {
|
7153 | var inBracket = 1;
|
7154 | expressionPos = index$1;
|
7155 | while (!eof()) {
|
7156 | chr = next();
|
7157 | if (isStringStart(chr)) {
|
7158 | parseString(chr);
|
7159 | continue
|
7160 | }
|
7161 | if (chr === 0x5B) { inBracket++; }
|
7162 | if (chr === 0x5D) { inBracket--; }
|
7163 | if (inBracket === 0) {
|
7164 | expressionEndPos = index$1;
|
7165 | break
|
7166 | }
|
7167 | }
|
7168 | }
|
7169 |
|
7170 | function parseString (chr) {
|
7171 | var stringQuote = chr;
|
7172 | while (!eof()) {
|
7173 | chr = next();
|
7174 | if (chr === stringQuote) {
|
7175 | break
|
7176 | }
|
7177 | }
|
7178 | }
|
7179 |
|
7180 |
|
7181 |
|
7182 | var warn$1;
|
7183 |
|
7184 |
|
7185 |
|
7186 | var RANGE_TOKEN = '__r';
|
7187 | var CHECKBOX_RADIO_TOKEN = '__c';
|
7188 |
|
7189 | function model (
|
7190 | el,
|
7191 | dir,
|
7192 | _warn
|
7193 | ) {
|
7194 | warn$1 = _warn;
|
7195 | var value = dir.value;
|
7196 | var modifiers = dir.modifiers;
|
7197 | var tag = el.tag;
|
7198 | var type = el.attrsMap.type;
|
7199 |
|
7200 | {
|
7201 |
|
7202 |
|
7203 | if (tag === 'input' && type === 'file') {
|
7204 | warn$1(
|
7205 | "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
|
7206 | "File inputs are read only. Use a v-on:change listener instead.",
|
7207 | el.rawAttrsMap['v-model']
|
7208 | );
|
7209 | }
|
7210 | }
|
7211 |
|
7212 | if (el.component) {
|
7213 | genComponentModel(el, value, modifiers);
|
7214 |
|
7215 | return false
|
7216 | } else if (tag === 'select') {
|
7217 | genSelect(el, value, modifiers);
|
7218 | } else if (tag === 'input' && type === 'checkbox') {
|
7219 | genCheckboxModel(el, value, modifiers);
|
7220 | } else if (tag === 'input' && type === 'radio') {
|
7221 | genRadioModel(el, value, modifiers);
|
7222 | } else if (tag === 'input' || tag === 'textarea') {
|
7223 | genDefaultModel(el, value, modifiers);
|
7224 | } else if (!config.isReservedTag(tag)) {
|
7225 | genComponentModel(el, value, modifiers);
|
7226 |
|
7227 | return false
|
7228 | } else {
|
7229 | warn$1(
|
7230 | "<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
7231 | "v-model is not supported on this element type. " +
|
7232 | 'If you are working with contenteditable, it\'s recommended to ' +
|
7233 | 'wrap a library dedicated for that purpose inside a custom component.',
|
7234 | el.rawAttrsMap['v-model']
|
7235 | );
|
7236 | }
|
7237 |
|
7238 |
|
7239 | return true
|
7240 | }
|
7241 |
|
7242 | function genCheckboxModel (
|
7243 | el,
|
7244 | value,
|
7245 | modifiers
|
7246 | ) {
|
7247 | var number = modifiers && modifiers.number;
|
7248 | var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7249 | var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
7250 | var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
7251 | addProp(el, 'checked',
|
7252 | "Array.isArray(" + value + ")" +
|
7253 | "?_i(" + value + "," + valueBinding + ")>-1" + (
|
7254 | trueValueBinding === 'true'
|
7255 | ? (":(" + value + ")")
|
7256 | : (":_q(" + value + "," + trueValueBinding + ")")
|
7257 | )
|
7258 | );
|
7259 | addHandler(el, 'change',
|
7260 | "var $$a=" + value + "," +
|
7261 | '$$el=$event.target,' +
|
7262 | "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
|
7263 | 'if(Array.isArray($$a)){' +
|
7264 | "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
|
7265 | '$$i=_i($$a,$$v);' +
|
7266 | "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
|
7267 | "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
|
7268 | "}else{" + (genAssignmentCode(value, '$$c')) + "}",
|
7269 | null, true
|
7270 | );
|
7271 | }
|
7272 |
|
7273 | function genRadioModel (
|
7274 | el,
|
7275 | value,
|
7276 | modifiers
|
7277 | ) {
|
7278 | var number = modifiers && modifiers.number;
|
7279 | var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7280 | valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
7281 | addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
|
7282 | addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
|
7283 | }
|
7284 |
|
7285 | function genSelect (
|
7286 | el,
|
7287 | value,
|
7288 | modifiers
|
7289 | ) {
|
7290 | var number = modifiers && modifiers.number;
|
7291 | var selectedVal = "Array.prototype.filter" +
|
7292 | ".call($event.target.options,function(o){return o.selected})" +
|
7293 | ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
|
7294 | "return " + (number ? '_n(val)' : 'val') + "})";
|
7295 |
|
7296 | var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
|
7297 | var code = "var $$selectedVal = " + selectedVal + ";";
|
7298 | code = code + " " + (genAssignmentCode(value, assignment));
|
7299 | addHandler(el, 'change', code, null, true);
|
7300 | }
|
7301 |
|
7302 | function genDefaultModel (
|
7303 | el,
|
7304 | value,
|
7305 | modifiers
|
7306 | ) {
|
7307 | var type = el.attrsMap.type;
|
7308 |
|
7309 |
|
7310 |
|
7311 | {
|
7312 | var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
7313 | var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
7314 | if (value$1 && !typeBinding) {
|
7315 | var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
7316 | warn$1(
|
7317 | binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
|
7318 | 'because the latter already expands to a value binding internally',
|
7319 | el.rawAttrsMap[binding]
|
7320 | );
|
7321 | }
|
7322 | }
|
7323 |
|
7324 | var ref = modifiers || {};
|
7325 | var lazy = ref.lazy;
|
7326 | var number = ref.number;
|
7327 | var trim = ref.trim;
|
7328 | var needCompositionGuard = !lazy && type !== 'range';
|
7329 | var event = lazy
|
7330 | ? 'change'
|
7331 | : type === 'range'
|
7332 | ? RANGE_TOKEN
|
7333 | : 'input';
|
7334 |
|
7335 | var valueExpression = '$event.target.value';
|
7336 | if (trim) {
|
7337 | valueExpression = "$event.target.value.trim()";
|
7338 | }
|
7339 | if (number) {
|
7340 | valueExpression = "_n(" + valueExpression + ")";
|
7341 | }
|
7342 |
|
7343 | var code = genAssignmentCode(value, valueExpression);
|
7344 | if (needCompositionGuard) {
|
7345 | code = "if($event.target.composing)return;" + code;
|
7346 | }
|
7347 |
|
7348 | addProp(el, 'value', ("(" + value + ")"));
|
7349 | addHandler(el, event, code, null, true);
|
7350 | if (trim || number) {
|
7351 | addHandler(el, 'blur', '$forceUpdate()');
|
7352 | }
|
7353 | }
|
7354 |
|
7355 |
|
7356 |
|
7357 |
|
7358 |
|
7359 |
|
7360 |
|
7361 | function normalizeEvents (on) {
|
7362 |
|
7363 | if (isDef(on[RANGE_TOKEN])) {
|
7364 |
|
7365 | var event = isIE ? 'change' : 'input';
|
7366 | on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
7367 | delete on[RANGE_TOKEN];
|
7368 | }
|
7369 |
|
7370 |
|
7371 |
|
7372 | if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
7373 | on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
7374 | delete on[CHECKBOX_RADIO_TOKEN];
|
7375 | }
|
7376 | }
|
7377 |
|
7378 | var target$1;
|
7379 |
|
7380 | function createOnceHandler$1 (event, handler, capture) {
|
7381 | var _target = target$1;
|
7382 | return function onceHandler () {
|
7383 | var res = handler.apply(null, arguments);
|
7384 | if (res !== null) {
|
7385 | remove$2(event, onceHandler, capture, _target);
|
7386 | }
|
7387 | }
|
7388 | }
|
7389 |
|
7390 | function add$1 (
|
7391 | name,
|
7392 | handler,
|
7393 | capture,
|
7394 | passive
|
7395 | ) {
|
7396 |
|
7397 |
|
7398 |
|
7399 |
|
7400 |
|
7401 |
|
7402 | if (isUsingMicroTask) {
|
7403 | var attachedTimestamp = currentFlushTimestamp;
|
7404 | var original = handler;
|
7405 | handler = original._wrapper = function (e) {
|
7406 | if (e.timeStamp >= attachedTimestamp) {
|
7407 | return original.apply(this, arguments)
|
7408 | }
|
7409 | };
|
7410 | }
|
7411 | target$1.addEventListener(
|
7412 | name,
|
7413 | handler,
|
7414 | supportsPassive
|
7415 | ? { capture: capture, passive: passive }
|
7416 | : capture
|
7417 | );
|
7418 | }
|
7419 |
|
7420 | function remove$2 (
|
7421 | name,
|
7422 | handler,
|
7423 | capture,
|
7424 | _target
|
7425 | ) {
|
7426 | (_target || target$1).removeEventListener(
|
7427 | name,
|
7428 | handler._wrapper || handler,
|
7429 | capture
|
7430 | );
|
7431 | }
|
7432 |
|
7433 | function updateDOMListeners (oldVnode, vnode) {
|
7434 | if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
7435 | return
|
7436 | }
|
7437 | var on = vnode.data.on || {};
|
7438 | var oldOn = oldVnode.data.on || {};
|
7439 | target$1 = vnode.elm;
|
7440 | normalizeEvents(on);
|
7441 | updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
7442 | target$1 = undefined;
|
7443 | }
|
7444 |
|
7445 | var events = {
|
7446 | create: updateDOMListeners,
|
7447 | update: updateDOMListeners
|
7448 | };
|
7449 |
|
7450 |
|
7451 |
|
7452 | var svgContainer;
|
7453 |
|
7454 | function updateDOMProps (oldVnode, vnode) {
|
7455 | if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
7456 | return
|
7457 | }
|
7458 | var key, cur;
|
7459 | var elm = vnode.elm;
|
7460 | var oldProps = oldVnode.data.domProps || {};
|
7461 | var props = vnode.data.domProps || {};
|
7462 |
|
7463 | if (isDef(props.__ob__)) {
|
7464 | props = vnode.data.domProps = extend({}, props);
|
7465 | }
|
7466 |
|
7467 | for (key in oldProps) {
|
7468 | if (isUndef(props[key])) {
|
7469 | elm[key] = '';
|
7470 | }
|
7471 | }
|
7472 | for (key in props) {
|
7473 | cur = props[key];
|
7474 |
|
7475 |
|
7476 |
|
7477 | if (key === 'textContent' || key === 'innerHTML') {
|
7478 | if (vnode.children) { vnode.children.length = 0; }
|
7479 | if (cur === oldProps[key]) { continue }
|
7480 |
|
7481 |
|
7482 | if (elm.childNodes.length === 1) {
|
7483 | elm.removeChild(elm.childNodes[0]);
|
7484 | }
|
7485 | }
|
7486 |
|
7487 |
|
7488 |
|
7489 |
|
7490 |
|
7491 | if (key !== 'value' && cur === oldProps[key]) {
|
7492 | continue
|
7493 | }
|
7494 |
|
7495 | if (key === 'value') {
|
7496 |
|
7497 |
|
7498 | elm._value = cur;
|
7499 |
|
7500 | var strCur = isUndef(cur) ? '' : String(cur);
|
7501 | if (shouldUpdateValue(elm, strCur)) {
|
7502 | elm.value = strCur;
|
7503 | }
|
7504 | } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
7505 |
|
7506 | svgContainer = svgContainer || document.createElement('div');
|
7507 | svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
7508 | var svg = svgContainer.firstChild;
|
7509 | while (elm.firstChild) {
|
7510 | elm.removeChild(elm.firstChild);
|
7511 | }
|
7512 | while (svg.firstChild) {
|
7513 | elm.appendChild(svg.firstChild);
|
7514 | }
|
7515 | } else {
|
7516 | elm[key] = cur;
|
7517 | }
|
7518 | }
|
7519 | }
|
7520 |
|
7521 |
|
7522 |
|
7523 |
|
7524 | function shouldUpdateValue (elm, checkVal) {
|
7525 | return (!elm.composing && (
|
7526 | elm.tagName === 'OPTION' ||
|
7527 | isNotInFocusAndDirty(elm, checkVal) ||
|
7528 | isDirtyWithModifiers(elm, checkVal)
|
7529 | ))
|
7530 | }
|
7531 |
|
7532 | function isNotInFocusAndDirty (elm, checkVal) {
|
7533 |
|
7534 |
|
7535 | var notInFocus = true;
|
7536 |
|
7537 |
|
7538 | try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
7539 | return notInFocus && elm.value !== checkVal
|
7540 | }
|
7541 |
|
7542 | function isDirtyWithModifiers (elm, newVal) {
|
7543 | var value = elm.value;
|
7544 | var modifiers = elm._vModifiers;
|
7545 | if (isDef(modifiers)) {
|
7546 | if (modifiers.number) {
|
7547 | return toNumber(value) !== toNumber(newVal)
|
7548 | }
|
7549 | if (modifiers.trim) {
|
7550 | return value.trim() !== newVal.trim()
|
7551 | }
|
7552 | }
|
7553 | return value !== newVal
|
7554 | }
|
7555 |
|
7556 | var domProps = {
|
7557 | create: updateDOMProps,
|
7558 | update: updateDOMProps
|
7559 | };
|
7560 |
|
7561 |
|
7562 |
|
7563 | var parseStyleText = cached(function (cssText) {
|
7564 | var res = {};
|
7565 | var listDelimiter = /;(?![^(]*\))/g;
|
7566 | var propertyDelimiter = /:(.+)/;
|
7567 | cssText.split(listDelimiter).forEach(function (item) {
|
7568 | if (item) {
|
7569 | var tmp = item.split(propertyDelimiter);
|
7570 | tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
7571 | }
|
7572 | });
|
7573 | return res
|
7574 | });
|
7575 |
|
7576 |
|
7577 | function normalizeStyleData (data) {
|
7578 | var style = normalizeStyleBinding(data.style);
|
7579 |
|
7580 |
|
7581 | return data.staticStyle
|
7582 | ? extend(data.staticStyle, style)
|
7583 | : style
|
7584 | }
|
7585 |
|
7586 |
|
7587 | function normalizeStyleBinding (bindingStyle) {
|
7588 | if (Array.isArray(bindingStyle)) {
|
7589 | return toObject(bindingStyle)
|
7590 | }
|
7591 | if (typeof bindingStyle === 'string') {
|
7592 | return parseStyleText(bindingStyle)
|
7593 | }
|
7594 | return bindingStyle
|
7595 | }
|
7596 |
|
7597 | |
7598 |
|
7599 |
|
7600 |
|
7601 | function getStyle (vnode, checkChild) {
|
7602 | var res = {};
|
7603 | var styleData;
|
7604 |
|
7605 | if (checkChild) {
|
7606 | var childNode = vnode;
|
7607 | while (childNode.componentInstance) {
|
7608 | childNode = childNode.componentInstance._vnode;
|
7609 | if (
|
7610 | childNode && childNode.data &&
|
7611 | (styleData = normalizeStyleData(childNode.data))
|
7612 | ) {
|
7613 | extend(res, styleData);
|
7614 | }
|
7615 | }
|
7616 | }
|
7617 |
|
7618 | if ((styleData = normalizeStyleData(vnode.data))) {
|
7619 | extend(res, styleData);
|
7620 | }
|
7621 |
|
7622 | var parentNode = vnode;
|
7623 | while ((parentNode = parentNode.parent)) {
|
7624 | if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
7625 | extend(res, styleData);
|
7626 | }
|
7627 | }
|
7628 | return res
|
7629 | }
|
7630 |
|
7631 |
|
7632 |
|
7633 | var cssVarRE = /^--/;
|
7634 | var importantRE = /\s*!important$/;
|
7635 | var setProp = function (el, name, val) {
|
7636 |
|
7637 | if (cssVarRE.test(name)) {
|
7638 | el.style.setProperty(name, val);
|
7639 | } else if (importantRE.test(val)) {
|
7640 | el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
7641 | } else {
|
7642 | var normalizedName = normalize(name);
|
7643 | if (Array.isArray(val)) {
|
7644 |
|
7645 |
|
7646 |
|
7647 | for (var i = 0, len = val.length; i < len; i++) {
|
7648 | el.style[normalizedName] = val[i];
|
7649 | }
|
7650 | } else {
|
7651 | el.style[normalizedName] = val;
|
7652 | }
|
7653 | }
|
7654 | };
|
7655 |
|
7656 | var vendorNames = ['Webkit', 'Moz', 'ms'];
|
7657 |
|
7658 | var emptyStyle;
|
7659 | var normalize = cached(function (prop) {
|
7660 | emptyStyle = emptyStyle || document.createElement('div').style;
|
7661 | prop = camelize(prop);
|
7662 | if (prop !== 'filter' && (prop in emptyStyle)) {
|
7663 | return prop
|
7664 | }
|
7665 | var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
7666 | for (var i = 0; i < vendorNames.length; i++) {
|
7667 | var name = vendorNames[i] + capName;
|
7668 | if (name in emptyStyle) {
|
7669 | return name
|
7670 | }
|
7671 | }
|
7672 | });
|
7673 |
|
7674 | function updateStyle (oldVnode, vnode) {
|
7675 | var data = vnode.data;
|
7676 | var oldData = oldVnode.data;
|
7677 |
|
7678 | if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
7679 | isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
7680 | ) {
|
7681 | return
|
7682 | }
|
7683 |
|
7684 | var cur, name;
|
7685 | var el = vnode.elm;
|
7686 | var oldStaticStyle = oldData.staticStyle;
|
7687 | var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
7688 |
|
7689 |
|
7690 | var oldStyle = oldStaticStyle || oldStyleBinding;
|
7691 |
|
7692 | var style = normalizeStyleBinding(vnode.data.style) || {};
|
7693 |
|
7694 |
|
7695 |
|
7696 |
|
7697 | vnode.data.normalizedStyle = isDef(style.__ob__)
|
7698 | ? extend({}, style)
|
7699 | : style;
|
7700 |
|
7701 | var newStyle = getStyle(vnode, true);
|
7702 |
|
7703 | for (name in oldStyle) {
|
7704 | if (isUndef(newStyle[name])) {
|
7705 | setProp(el, name, '');
|
7706 | }
|
7707 | }
|
7708 | for (name in newStyle) {
|
7709 | cur = newStyle[name];
|
7710 | if (cur !== oldStyle[name]) {
|
7711 |
|
7712 | setProp(el, name, cur == null ? '' : cur);
|
7713 | }
|
7714 | }
|
7715 | }
|
7716 |
|
7717 | var style = {
|
7718 | create: updateStyle,
|
7719 | update: updateStyle
|
7720 | };
|
7721 |
|
7722 |
|
7723 |
|
7724 | var whitespaceRE = /\s+/;
|
7725 |
|
7726 | |
7727 |
|
7728 |
|
7729 |
|
7730 | function addClass (el, cls) {
|
7731 |
|
7732 | if (!cls || !(cls = cls.trim())) {
|
7733 | return
|
7734 | }
|
7735 |
|
7736 |
|
7737 | if (el.classList) {
|
7738 | if (cls.indexOf(' ') > -1) {
|
7739 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
7740 | } else {
|
7741 | el.classList.add(cls);
|
7742 | }
|
7743 | } else {
|
7744 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7745 | if (cur.indexOf(' ' + cls + ' ') < 0) {
|
7746 | el.setAttribute('class', (cur + cls).trim());
|
7747 | }
|
7748 | }
|
7749 | }
|
7750 |
|
7751 | |
7752 |
|
7753 |
|
7754 |
|
7755 | function removeClass (el, cls) {
|
7756 |
|
7757 | if (!cls || !(cls = cls.trim())) {
|
7758 | return
|
7759 | }
|
7760 |
|
7761 |
|
7762 | if (el.classList) {
|
7763 | if (cls.indexOf(' ') > -1) {
|
7764 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
7765 | } else {
|
7766 | el.classList.remove(cls);
|
7767 | }
|
7768 | if (!el.classList.length) {
|
7769 | el.removeAttribute('class');
|
7770 | }
|
7771 | } else {
|
7772 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7773 | var tar = ' ' + cls + ' ';
|
7774 | while (cur.indexOf(tar) >= 0) {
|
7775 | cur = cur.replace(tar, ' ');
|
7776 | }
|
7777 | cur = cur.trim();
|
7778 | if (cur) {
|
7779 | el.setAttribute('class', cur);
|
7780 | } else {
|
7781 | el.removeAttribute('class');
|
7782 | }
|
7783 | }
|
7784 | }
|
7785 |
|
7786 |
|
7787 |
|
7788 | function resolveTransition (def$$1) {
|
7789 | if (!def$$1) {
|
7790 | return
|
7791 | }
|
7792 |
|
7793 | if (typeof def$$1 === 'object') {
|
7794 | var res = {};
|
7795 | if (def$$1.css !== false) {
|
7796 | extend(res, autoCssTransition(def$$1.name || 'v'));
|
7797 | }
|
7798 | extend(res, def$$1);
|
7799 | return res
|
7800 | } else if (typeof def$$1 === 'string') {
|
7801 | return autoCssTransition(def$$1)
|
7802 | }
|
7803 | }
|
7804 |
|
7805 | var autoCssTransition = cached(function (name) {
|
7806 | return {
|
7807 | enterClass: (name + "-enter"),
|
7808 | enterToClass: (name + "-enter-to"),
|
7809 | enterActiveClass: (name + "-enter-active"),
|
7810 | leaveClass: (name + "-leave"),
|
7811 | leaveToClass: (name + "-leave-to"),
|
7812 | leaveActiveClass: (name + "-leave-active")
|
7813 | }
|
7814 | });
|
7815 |
|
7816 | var hasTransition = inBrowser && !isIE9;
|
7817 | var TRANSITION = 'transition';
|
7818 | var ANIMATION = 'animation';
|
7819 |
|
7820 |
|
7821 | var transitionProp = 'transition';
|
7822 | var transitionEndEvent = 'transitionend';
|
7823 | var animationProp = 'animation';
|
7824 | var animationEndEvent = 'animationend';
|
7825 | if (hasTransition) {
|
7826 |
|
7827 | if (window.ontransitionend === undefined &&
|
7828 | window.onwebkittransitionend !== undefined
|
7829 | ) {
|
7830 | transitionProp = 'WebkitTransition';
|
7831 | transitionEndEvent = 'webkitTransitionEnd';
|
7832 | }
|
7833 | if (window.onanimationend === undefined &&
|
7834 | window.onwebkitanimationend !== undefined
|
7835 | ) {
|
7836 | animationProp = 'WebkitAnimation';
|
7837 | animationEndEvent = 'webkitAnimationEnd';
|
7838 | }
|
7839 | }
|
7840 |
|
7841 |
|
7842 | var raf = inBrowser
|
7843 | ? window.requestAnimationFrame
|
7844 | ? window.requestAnimationFrame.bind(window)
|
7845 | : setTimeout
|
7846 | : function (fn) { return fn(); };
|
7847 |
|
7848 | function nextFrame (fn) {
|
7849 | raf(function () {
|
7850 | raf(fn);
|
7851 | });
|
7852 | }
|
7853 |
|
7854 | function addTransitionClass (el, cls) {
|
7855 | var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
7856 | if (transitionClasses.indexOf(cls) < 0) {
|
7857 | transitionClasses.push(cls);
|
7858 | addClass(el, cls);
|
7859 | }
|
7860 | }
|
7861 |
|
7862 | function removeTransitionClass (el, cls) {
|
7863 | if (el._transitionClasses) {
|
7864 | remove(el._transitionClasses, cls);
|
7865 | }
|
7866 | removeClass(el, cls);
|
7867 | }
|
7868 |
|
7869 | function whenTransitionEnds (
|
7870 | el,
|
7871 | expectedType,
|
7872 | cb
|
7873 | ) {
|
7874 | var ref = getTransitionInfo(el, expectedType);
|
7875 | var type = ref.type;
|
7876 | var timeout = ref.timeout;
|
7877 | var propCount = ref.propCount;
|
7878 | if (!type) { return cb() }
|
7879 | var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
7880 | var ended = 0;
|
7881 | var end = function () {
|
7882 | el.removeEventListener(event, onEnd);
|
7883 | cb();
|
7884 | };
|
7885 | var onEnd = function (e) {
|
7886 | if (e.target === el) {
|
7887 | if (++ended >= propCount) {
|
7888 | end();
|
7889 | }
|
7890 | }
|
7891 | };
|
7892 | setTimeout(function () {
|
7893 | if (ended < propCount) {
|
7894 | end();
|
7895 | }
|
7896 | }, timeout + 1);
|
7897 | el.addEventListener(event, onEnd);
|
7898 | }
|
7899 |
|
7900 | var transformRE = /\b(transform|all)(,|$)/;
|
7901 |
|
7902 | function getTransitionInfo (el, expectedType) {
|
7903 | var styles = window.getComputedStyle(el);
|
7904 |
|
7905 | var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
7906 | var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
7907 | var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
7908 | var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
7909 | var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
7910 | var animationTimeout = getTimeout(animationDelays, animationDurations);
|
7911 |
|
7912 | var type;
|
7913 | var timeout = 0;
|
7914 | var propCount = 0;
|
7915 |
|
7916 | if (expectedType === TRANSITION) {
|
7917 | if (transitionTimeout > 0) {
|
7918 | type = TRANSITION;
|
7919 | timeout = transitionTimeout;
|
7920 | propCount = transitionDurations.length;
|
7921 | }
|
7922 | } else if (expectedType === ANIMATION) {
|
7923 | if (animationTimeout > 0) {
|
7924 | type = ANIMATION;
|
7925 | timeout = animationTimeout;
|
7926 | propCount = animationDurations.length;
|
7927 | }
|
7928 | } else {
|
7929 | timeout = Math.max(transitionTimeout, animationTimeout);
|
7930 | type = timeout > 0
|
7931 | ? transitionTimeout > animationTimeout
|
7932 | ? TRANSITION
|
7933 | : ANIMATION
|
7934 | : null;
|
7935 | propCount = type
|
7936 | ? type === TRANSITION
|
7937 | ? transitionDurations.length
|
7938 | : animationDurations.length
|
7939 | : 0;
|
7940 | }
|
7941 | var hasTransform =
|
7942 | type === TRANSITION &&
|
7943 | transformRE.test(styles[transitionProp + 'Property']);
|
7944 | return {
|
7945 | type: type,
|
7946 | timeout: timeout,
|
7947 | propCount: propCount,
|
7948 | hasTransform: hasTransform
|
7949 | }
|
7950 | }
|
7951 |
|
7952 | function getTimeout (delays, durations) {
|
7953 |
|
7954 | while (delays.length < durations.length) {
|
7955 | delays = delays.concat(delays);
|
7956 | }
|
7957 |
|
7958 | return Math.max.apply(null, durations.map(function (d, i) {
|
7959 | return toMs(d) + toMs(delays[i])
|
7960 | }))
|
7961 | }
|
7962 |
|
7963 |
|
7964 |
|
7965 |
|
7966 |
|
7967 | function toMs (s) {
|
7968 | return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
7969 | }
|
7970 |
|
7971 |
|
7972 |
|
7973 | function enter (vnode, toggleDisplay) {
|
7974 | var el = vnode.elm;
|
7975 |
|
7976 |
|
7977 | if (isDef(el._leaveCb)) {
|
7978 | el._leaveCb.cancelled = true;
|
7979 | el._leaveCb();
|
7980 | }
|
7981 |
|
7982 | var data = resolveTransition(vnode.data.transition);
|
7983 | if (isUndef(data)) {
|
7984 | return
|
7985 | }
|
7986 |
|
7987 |
|
7988 | if (isDef(el._enterCb) || el.nodeType !== 1) {
|
7989 | return
|
7990 | }
|
7991 |
|
7992 | var css = data.css;
|
7993 | var type = data.type;
|
7994 | var enterClass = data.enterClass;
|
7995 | var enterToClass = data.enterToClass;
|
7996 | var enterActiveClass = data.enterActiveClass;
|
7997 | var appearClass = data.appearClass;
|
7998 | var appearToClass = data.appearToClass;
|
7999 | var appearActiveClass = data.appearActiveClass;
|
8000 | var beforeEnter = data.beforeEnter;
|
8001 | var enter = data.enter;
|
8002 | var afterEnter = data.afterEnter;
|
8003 | var enterCancelled = data.enterCancelled;
|
8004 | var beforeAppear = data.beforeAppear;
|
8005 | var appear = data.appear;
|
8006 | var afterAppear = data.afterAppear;
|
8007 | var appearCancelled = data.appearCancelled;
|
8008 | var duration = data.duration;
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 | var context = activeInstance;
|
8015 | var transitionNode = activeInstance.$vnode;
|
8016 | while (transitionNode && transitionNode.parent) {
|
8017 | transitionNode = transitionNode.parent;
|
8018 | context = transitionNode.context;
|
8019 | }
|
8020 |
|
8021 | var isAppear = !context._isMounted || !vnode.isRootInsert;
|
8022 |
|
8023 | if (isAppear && !appear && appear !== '') {
|
8024 | return
|
8025 | }
|
8026 |
|
8027 | var startClass = isAppear && appearClass
|
8028 | ? appearClass
|
8029 | : enterClass;
|
8030 | var activeClass = isAppear && appearActiveClass
|
8031 | ? appearActiveClass
|
8032 | : enterActiveClass;
|
8033 | var toClass = isAppear && appearToClass
|
8034 | ? appearToClass
|
8035 | : enterToClass;
|
8036 |
|
8037 | var beforeEnterHook = isAppear
|
8038 | ? (beforeAppear || beforeEnter)
|
8039 | : beforeEnter;
|
8040 | var enterHook = isAppear
|
8041 | ? (typeof appear === 'function' ? appear : enter)
|
8042 | : enter;
|
8043 | var afterEnterHook = isAppear
|
8044 | ? (afterAppear || afterEnter)
|
8045 | : afterEnter;
|
8046 | var enterCancelledHook = isAppear
|
8047 | ? (appearCancelled || enterCancelled)
|
8048 | : enterCancelled;
|
8049 |
|
8050 | var explicitEnterDuration = toNumber(
|
8051 | isObject(duration)
|
8052 | ? duration.enter
|
8053 | : duration
|
8054 | );
|
8055 |
|
8056 | if (explicitEnterDuration != null) {
|
8057 | checkDuration(explicitEnterDuration, 'enter', vnode);
|
8058 | }
|
8059 |
|
8060 | var expectsCSS = css !== false && !isIE9;
|
8061 | var userWantsControl = getHookArgumentsLength(enterHook);
|
8062 |
|
8063 | var cb = el._enterCb = once(function () {
|
8064 | if (expectsCSS) {
|
8065 | removeTransitionClass(el, toClass);
|
8066 | removeTransitionClass(el, activeClass);
|
8067 | }
|
8068 | if (cb.cancelled) {
|
8069 | if (expectsCSS) {
|
8070 | removeTransitionClass(el, startClass);
|
8071 | }
|
8072 | enterCancelledHook && enterCancelledHook(el);
|
8073 | } else {
|
8074 | afterEnterHook && afterEnterHook(el);
|
8075 | }
|
8076 | el._enterCb = null;
|
8077 | });
|
8078 |
|
8079 | if (!vnode.data.show) {
|
8080 |
|
8081 | mergeVNodeHook(vnode, 'insert', function () {
|
8082 | var parent = el.parentNode;
|
8083 | var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
8084 | if (pendingNode &&
|
8085 | pendingNode.tag === vnode.tag &&
|
8086 | pendingNode.elm._leaveCb
|
8087 | ) {
|
8088 | pendingNode.elm._leaveCb();
|
8089 | }
|
8090 | enterHook && enterHook(el, cb);
|
8091 | });
|
8092 | }
|
8093 |
|
8094 |
|
8095 | beforeEnterHook && beforeEnterHook(el);
|
8096 | if (expectsCSS) {
|
8097 | addTransitionClass(el, startClass);
|
8098 | addTransitionClass(el, activeClass);
|
8099 | nextFrame(function () {
|
8100 | removeTransitionClass(el, startClass);
|
8101 | if (!cb.cancelled) {
|
8102 | addTransitionClass(el, toClass);
|
8103 | if (!userWantsControl) {
|
8104 | if (isValidDuration(explicitEnterDuration)) {
|
8105 | setTimeout(cb, explicitEnterDuration);
|
8106 | } else {
|
8107 | whenTransitionEnds(el, type, cb);
|
8108 | }
|
8109 | }
|
8110 | }
|
8111 | });
|
8112 | }
|
8113 |
|
8114 | if (vnode.data.show) {
|
8115 | toggleDisplay && toggleDisplay();
|
8116 | enterHook && enterHook(el, cb);
|
8117 | }
|
8118 |
|
8119 | if (!expectsCSS && !userWantsControl) {
|
8120 | cb();
|
8121 | }
|
8122 | }
|
8123 |
|
8124 | function leave (vnode, rm) {
|
8125 | var el = vnode.elm;
|
8126 |
|
8127 |
|
8128 | if (isDef(el._enterCb)) {
|
8129 | el._enterCb.cancelled = true;
|
8130 | el._enterCb();
|
8131 | }
|
8132 |
|
8133 | var data = resolveTransition(vnode.data.transition);
|
8134 | if (isUndef(data) || el.nodeType !== 1) {
|
8135 | return rm()
|
8136 | }
|
8137 |
|
8138 |
|
8139 | if (isDef(el._leaveCb)) {
|
8140 | return
|
8141 | }
|
8142 |
|
8143 | var css = data.css;
|
8144 | var type = data.type;
|
8145 | var leaveClass = data.leaveClass;
|
8146 | var leaveToClass = data.leaveToClass;
|
8147 | var leaveActiveClass = data.leaveActiveClass;
|
8148 | var beforeLeave = data.beforeLeave;
|
8149 | var leave = data.leave;
|
8150 | var afterLeave = data.afterLeave;
|
8151 | var leaveCancelled = data.leaveCancelled;
|
8152 | var delayLeave = data.delayLeave;
|
8153 | var duration = data.duration;
|
8154 |
|
8155 | var expectsCSS = css !== false && !isIE9;
|
8156 | var userWantsControl = getHookArgumentsLength(leave);
|
8157 |
|
8158 | var explicitLeaveDuration = toNumber(
|
8159 | isObject(duration)
|
8160 | ? duration.leave
|
8161 | : duration
|
8162 | );
|
8163 |
|
8164 | if (isDef(explicitLeaveDuration)) {
|
8165 | checkDuration(explicitLeaveDuration, 'leave', vnode);
|
8166 | }
|
8167 |
|
8168 | var cb = el._leaveCb = once(function () {
|
8169 | if (el.parentNode && el.parentNode._pending) {
|
8170 | el.parentNode._pending[vnode.key] = null;
|
8171 | }
|
8172 | if (expectsCSS) {
|
8173 | removeTransitionClass(el, leaveToClass);
|
8174 | removeTransitionClass(el, leaveActiveClass);
|
8175 | }
|
8176 | if (cb.cancelled) {
|
8177 | if (expectsCSS) {
|
8178 | removeTransitionClass(el, leaveClass);
|
8179 | }
|
8180 | leaveCancelled && leaveCancelled(el);
|
8181 | } else {
|
8182 | rm();
|
8183 | afterLeave && afterLeave(el);
|
8184 | }
|
8185 | el._leaveCb = null;
|
8186 | });
|
8187 |
|
8188 | if (delayLeave) {
|
8189 | delayLeave(performLeave);
|
8190 | } else {
|
8191 | performLeave();
|
8192 | }
|
8193 |
|
8194 | function performLeave () {
|
8195 |
|
8196 | if (cb.cancelled) {
|
8197 | return
|
8198 | }
|
8199 |
|
8200 | if (!vnode.data.show && el.parentNode) {
|
8201 | (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
8202 | }
|
8203 | beforeLeave && beforeLeave(el);
|
8204 | if (expectsCSS) {
|
8205 | addTransitionClass(el, leaveClass);
|
8206 | addTransitionClass(el, leaveActiveClass);
|
8207 | nextFrame(function () {
|
8208 | removeTransitionClass(el, leaveClass);
|
8209 | if (!cb.cancelled) {
|
8210 | addTransitionClass(el, leaveToClass);
|
8211 | if (!userWantsControl) {
|
8212 | if (isValidDuration(explicitLeaveDuration)) {
|
8213 | setTimeout(cb, explicitLeaveDuration);
|
8214 | } else {
|
8215 | whenTransitionEnds(el, type, cb);
|
8216 | }
|
8217 | }
|
8218 | }
|
8219 | });
|
8220 | }
|
8221 | leave && leave(el, cb);
|
8222 | if (!expectsCSS && !userWantsControl) {
|
8223 | cb();
|
8224 | }
|
8225 | }
|
8226 | }
|
8227 |
|
8228 |
|
8229 | function checkDuration (val, name, vnode) {
|
8230 | if (typeof val !== 'number') {
|
8231 | warn(
|
8232 | "<transition> explicit " + name + " duration is not a valid number - " +
|
8233 | "got " + (JSON.stringify(val)) + ".",
|
8234 | vnode.context
|
8235 | );
|
8236 | } else if (isNaN(val)) {
|
8237 | warn(
|
8238 | "<transition> explicit " + name + " duration is NaN - " +
|
8239 | 'the duration expression might be incorrect.',
|
8240 | vnode.context
|
8241 | );
|
8242 | }
|
8243 | }
|
8244 |
|
8245 | function isValidDuration (val) {
|
8246 | return typeof val === 'number' && !isNaN(val)
|
8247 | }
|
8248 |
|
8249 | |
8250 |
|
8251 |
|
8252 |
|
8253 |
|
8254 |
|
8255 | function getHookArgumentsLength (fn) {
|
8256 | if (isUndef(fn)) {
|
8257 | return false
|
8258 | }
|
8259 | var invokerFns = fn.fns;
|
8260 | if (isDef(invokerFns)) {
|
8261 |
|
8262 | return getHookArgumentsLength(
|
8263 | Array.isArray(invokerFns)
|
8264 | ? invokerFns[0]
|
8265 | : invokerFns
|
8266 | )
|
8267 | } else {
|
8268 | return (fn._length || fn.length) > 1
|
8269 | }
|
8270 | }
|
8271 |
|
8272 | function _enter (_, vnode) {
|
8273 | if (vnode.data.show !== true) {
|
8274 | enter(vnode);
|
8275 | }
|
8276 | }
|
8277 |
|
8278 | var transition = inBrowser ? {
|
8279 | create: _enter,
|
8280 | activate: _enter,
|
8281 | remove: function remove$$1 (vnode, rm) {
|
8282 |
|
8283 | if (vnode.data.show !== true) {
|
8284 | leave(vnode, rm);
|
8285 | } else {
|
8286 | rm();
|
8287 | }
|
8288 | }
|
8289 | } : {};
|
8290 |
|
8291 | var platformModules = [
|
8292 | attrs,
|
8293 | klass,
|
8294 | events,
|
8295 | domProps,
|
8296 | style,
|
8297 | transition
|
8298 | ];
|
8299 |
|
8300 |
|
8301 |
|
8302 |
|
8303 |
|
8304 | var modules = platformModules.concat(baseModules);
|
8305 |
|
8306 | var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
8307 |
|
8308 | |
8309 |
|
8310 |
|
8311 |
|
8312 |
|
8313 |
|
8314 | if (isIE9) {
|
8315 |
|
8316 | document.addEventListener('selectionchange', function () {
|
8317 | var el = document.activeElement;
|
8318 | if (el && el.vmodel) {
|
8319 | trigger(el, 'input');
|
8320 | }
|
8321 | });
|
8322 | }
|
8323 |
|
8324 | var directive = {
|
8325 | inserted: function inserted (el, binding, vnode, oldVnode) {
|
8326 | if (vnode.tag === 'select') {
|
8327 |
|
8328 | if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
8329 | mergeVNodeHook(vnode, 'postpatch', function () {
|
8330 | directive.componentUpdated(el, binding, vnode);
|
8331 | });
|
8332 | } else {
|
8333 | setSelected(el, binding, vnode.context);
|
8334 | }
|
8335 | el._vOptions = [].map.call(el.options, getValue);
|
8336 | } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
8337 | el._vModifiers = binding.modifiers;
|
8338 | if (!binding.modifiers.lazy) {
|
8339 | el.addEventListener('compositionstart', onCompositionStart);
|
8340 | el.addEventListener('compositionend', onCompositionEnd);
|
8341 |
|
8342 |
|
8343 |
|
8344 |
|
8345 | el.addEventListener('change', onCompositionEnd);
|
8346 |
|
8347 | if (isIE9) {
|
8348 | el.vmodel = true;
|
8349 | }
|
8350 | }
|
8351 | }
|
8352 | },
|
8353 |
|
8354 | componentUpdated: function componentUpdated (el, binding, vnode) {
|
8355 | if (vnode.tag === 'select') {
|
8356 | setSelected(el, binding, vnode.context);
|
8357 |
|
8358 |
|
8359 |
|
8360 |
|
8361 | var prevOptions = el._vOptions;
|
8362 | var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
8363 | if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
8364 |
|
8365 |
|
8366 | var needReset = el.multiple
|
8367 | ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
8368 | : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
8369 | if (needReset) {
|
8370 | trigger(el, 'change');
|
8371 | }
|
8372 | }
|
8373 | }
|
8374 | }
|
8375 | };
|
8376 |
|
8377 | function setSelected (el, binding, vm) {
|
8378 | actuallySetSelected(el, binding, vm);
|
8379 |
|
8380 | if (isIE || isEdge) {
|
8381 | setTimeout(function () {
|
8382 | actuallySetSelected(el, binding, vm);
|
8383 | }, 0);
|
8384 | }
|
8385 | }
|
8386 |
|
8387 | function actuallySetSelected (el, binding, vm) {
|
8388 | var value = binding.value;
|
8389 | var isMultiple = el.multiple;
|
8390 | if (isMultiple && !Array.isArray(value)) {
|
8391 | warn(
|
8392 | "<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
8393 | "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
8394 | vm
|
8395 | );
|
8396 | return
|
8397 | }
|
8398 | var selected, option;
|
8399 | for (var i = 0, l = el.options.length; i < l; i++) {
|
8400 | option = el.options[i];
|
8401 | if (isMultiple) {
|
8402 | selected = looseIndexOf(value, getValue(option)) > -1;
|
8403 | if (option.selected !== selected) {
|
8404 | option.selected = selected;
|
8405 | }
|
8406 | } else {
|
8407 | if (looseEqual(getValue(option), value)) {
|
8408 | if (el.selectedIndex !== i) {
|
8409 | el.selectedIndex = i;
|
8410 | }
|
8411 | return
|
8412 | }
|
8413 | }
|
8414 | }
|
8415 | if (!isMultiple) {
|
8416 | el.selectedIndex = -1;
|
8417 | }
|
8418 | }
|
8419 |
|
8420 | function hasNoMatchingOption (value, options) {
|
8421 | return options.every(function (o) { return !looseEqual(o, value); })
|
8422 | }
|
8423 |
|
8424 | function getValue (option) {
|
8425 | return '_value' in option
|
8426 | ? option._value
|
8427 | : option.value
|
8428 | }
|
8429 |
|
8430 | function onCompositionStart (e) {
|
8431 | e.target.composing = true;
|
8432 | }
|
8433 |
|
8434 | function onCompositionEnd (e) {
|
8435 |
|
8436 | if (!e.target.composing) { return }
|
8437 | e.target.composing = false;
|
8438 | trigger(e.target, 'input');
|
8439 | }
|
8440 |
|
8441 | function trigger (el, type) {
|
8442 | var e = document.createEvent('HTMLEvents');
|
8443 | e.initEvent(type, true, true);
|
8444 | el.dispatchEvent(e);
|
8445 | }
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 | function locateNode (vnode) {
|
8451 | return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
8452 | ? locateNode(vnode.componentInstance._vnode)
|
8453 | : vnode
|
8454 | }
|
8455 |
|
8456 | var show = {
|
8457 | bind: function bind (el, ref, vnode) {
|
8458 | var value = ref.value;
|
8459 |
|
8460 | vnode = locateNode(vnode);
|
8461 | var transition$$1 = vnode.data && vnode.data.transition;
|
8462 | var originalDisplay = el.__vOriginalDisplay =
|
8463 | el.style.display === 'none' ? '' : el.style.display;
|
8464 | if (value && transition$$1) {
|
8465 | vnode.data.show = true;
|
8466 | enter(vnode, function () {
|
8467 | el.style.display = originalDisplay;
|
8468 | });
|
8469 | } else {
|
8470 | el.style.display = value ? originalDisplay : 'none';
|
8471 | }
|
8472 | },
|
8473 |
|
8474 | update: function update (el, ref, vnode) {
|
8475 | var value = ref.value;
|
8476 | var oldValue = ref.oldValue;
|
8477 |
|
8478 |
|
8479 | if (!value === !oldValue) { return }
|
8480 | vnode = locateNode(vnode);
|
8481 | var transition$$1 = vnode.data && vnode.data.transition;
|
8482 | if (transition$$1) {
|
8483 | vnode.data.show = true;
|
8484 | if (value) {
|
8485 | enter(vnode, function () {
|
8486 | el.style.display = el.__vOriginalDisplay;
|
8487 | });
|
8488 | } else {
|
8489 | leave(vnode, function () {
|
8490 | el.style.display = 'none';
|
8491 | });
|
8492 | }
|
8493 | } else {
|
8494 | el.style.display = value ? el.__vOriginalDisplay : 'none';
|
8495 | }
|
8496 | },
|
8497 |
|
8498 | unbind: function unbind (
|
8499 | el,
|
8500 | binding,
|
8501 | vnode,
|
8502 | oldVnode,
|
8503 | isDestroy
|
8504 | ) {
|
8505 | if (!isDestroy) {
|
8506 | el.style.display = el.__vOriginalDisplay;
|
8507 | }
|
8508 | }
|
8509 | };
|
8510 |
|
8511 | var platformDirectives = {
|
8512 | model: directive,
|
8513 | show: show
|
8514 | };
|
8515 |
|
8516 |
|
8517 |
|
8518 | var transitionProps = {
|
8519 | name: String,
|
8520 | appear: Boolean,
|
8521 | css: Boolean,
|
8522 | mode: String,
|
8523 | type: String,
|
8524 | enterClass: String,
|
8525 | leaveClass: String,
|
8526 | enterToClass: String,
|
8527 | leaveToClass: String,
|
8528 | enterActiveClass: String,
|
8529 | leaveActiveClass: String,
|
8530 | appearClass: String,
|
8531 | appearActiveClass: String,
|
8532 | appearToClass: String,
|
8533 | duration: [Number, String, Object]
|
8534 | };
|
8535 |
|
8536 |
|
8537 |
|
8538 | function getRealChild (vnode) {
|
8539 | var compOptions = vnode && vnode.componentOptions;
|
8540 | if (compOptions && compOptions.Ctor.options.abstract) {
|
8541 | return getRealChild(getFirstComponentChild(compOptions.children))
|
8542 | } else {
|
8543 | return vnode
|
8544 | }
|
8545 | }
|
8546 |
|
8547 | function extractTransitionData (comp) {
|
8548 | var data = {};
|
8549 | var options = comp.$options;
|
8550 |
|
8551 | for (var key in options.propsData) {
|
8552 | data[key] = comp[key];
|
8553 | }
|
8554 |
|
8555 |
|
8556 | var listeners = options._parentListeners;
|
8557 | for (var key$1 in listeners) {
|
8558 | data[camelize(key$1)] = listeners[key$1];
|
8559 | }
|
8560 | return data
|
8561 | }
|
8562 |
|
8563 | function placeholder (h, rawChild) {
|
8564 | if (/\d-keep-alive$/.test(rawChild.tag)) {
|
8565 | return h('keep-alive', {
|
8566 | props: rawChild.componentOptions.propsData
|
8567 | })
|
8568 | }
|
8569 | }
|
8570 |
|
8571 | function hasParentTransition (vnode) {
|
8572 | while ((vnode = vnode.parent)) {
|
8573 | if (vnode.data.transition) {
|
8574 | return true
|
8575 | }
|
8576 | }
|
8577 | }
|
8578 |
|
8579 | function isSameChild (child, oldChild) {
|
8580 | return oldChild.key === child.key && oldChild.tag === child.tag
|
8581 | }
|
8582 |
|
8583 | var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
8584 |
|
8585 | var isVShowDirective = function (d) { return d.name === 'show'; };
|
8586 |
|
8587 | var Transition = {
|
8588 | name: 'transition',
|
8589 | props: transitionProps,
|
8590 | abstract: true,
|
8591 |
|
8592 | render: function render (h) {
|
8593 | var this$1 = this;
|
8594 |
|
8595 | var children = this.$slots.default;
|
8596 | if (!children) {
|
8597 | return
|
8598 | }
|
8599 |
|
8600 |
|
8601 | children = children.filter(isNotTextNode);
|
8602 |
|
8603 | if (!children.length) {
|
8604 | return
|
8605 | }
|
8606 |
|
8607 |
|
8608 | if (children.length > 1) {
|
8609 | warn(
|
8610 | '<transition> can only be used on a single element. Use ' +
|
8611 | '<transition-group> for lists.',
|
8612 | this.$parent
|
8613 | );
|
8614 | }
|
8615 |
|
8616 | var mode = this.mode;
|
8617 |
|
8618 |
|
8619 | if (mode && mode !== 'in-out' && mode !== 'out-in'
|
8620 | ) {
|
8621 | warn(
|
8622 | 'invalid <transition> mode: ' + mode,
|
8623 | this.$parent
|
8624 | );
|
8625 | }
|
8626 |
|
8627 | var rawChild = children[0];
|
8628 |
|
8629 |
|
8630 |
|
8631 | if (hasParentTransition(this.$vnode)) {
|
8632 | return rawChild
|
8633 | }
|
8634 |
|
8635 |
|
8636 |
|
8637 | var child = getRealChild(rawChild);
|
8638 |
|
8639 | if (!child) {
|
8640 | return rawChild
|
8641 | }
|
8642 |
|
8643 | if (this._leaving) {
|
8644 | return placeholder(h, rawChild)
|
8645 | }
|
8646 |
|
8647 |
|
8648 |
|
8649 |
|
8650 | var id = "__transition-" + (this._uid) + "-";
|
8651 | child.key = child.key == null
|
8652 | ? child.isComment
|
8653 | ? id + 'comment'
|
8654 | : id + child.tag
|
8655 | : isPrimitive(child.key)
|
8656 | ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
8657 | : child.key;
|
8658 |
|
8659 | var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
8660 | var oldRawChild = this._vnode;
|
8661 | var oldChild = getRealChild(oldRawChild);
|
8662 |
|
8663 |
|
8664 |
|
8665 | if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
8666 | child.data.show = true;
|
8667 | }
|
8668 |
|
8669 | if (
|
8670 | oldChild &&
|
8671 | oldChild.data &&
|
8672 | !isSameChild(child, oldChild) &&
|
8673 | !isAsyncPlaceholder(oldChild) &&
|
8674 |
|
8675 | !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
8676 | ) {
|
8677 |
|
8678 |
|
8679 | var oldData = oldChild.data.transition = extend({}, data);
|
8680 |
|
8681 | if (mode === 'out-in') {
|
8682 |
|
8683 | this._leaving = true;
|
8684 | mergeVNodeHook(oldData, 'afterLeave', function () {
|
8685 | this$1._leaving = false;
|
8686 | this$1.$forceUpdate();
|
8687 | });
|
8688 | return placeholder(h, rawChild)
|
8689 | } else if (mode === 'in-out') {
|
8690 | if (isAsyncPlaceholder(child)) {
|
8691 | return oldRawChild
|
8692 | }
|
8693 | var delayedLeave;
|
8694 | var performLeave = function () { delayedLeave(); };
|
8695 | mergeVNodeHook(data, 'afterEnter', performLeave);
|
8696 | mergeVNodeHook(data, 'enterCancelled', performLeave);
|
8697 | mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
8698 | }
|
8699 | }
|
8700 |
|
8701 | return rawChild
|
8702 | }
|
8703 | };
|
8704 |
|
8705 |
|
8706 |
|
8707 | var props = extend({
|
8708 | tag: String,
|
8709 | moveClass: String
|
8710 | }, transitionProps);
|
8711 |
|
8712 | delete props.mode;
|
8713 |
|
8714 | var TransitionGroup = {
|
8715 | props: props,
|
8716 |
|
8717 | beforeMount: function beforeMount () {
|
8718 | var this$1 = this;
|
8719 |
|
8720 | var update = this._update;
|
8721 | this._update = function (vnode, hydrating) {
|
8722 | var restoreActiveInstance = setActiveInstance(this$1);
|
8723 |
|
8724 | this$1.__patch__(
|
8725 | this$1._vnode,
|
8726 | this$1.kept,
|
8727 | false,
|
8728 | true
|
8729 | );
|
8730 | this$1._vnode = this$1.kept;
|
8731 | restoreActiveInstance();
|
8732 | update.call(this$1, vnode, hydrating);
|
8733 | };
|
8734 | },
|
8735 |
|
8736 | render: function render (h) {
|
8737 | var tag = this.tag || this.$vnode.data.tag || 'span';
|
8738 | var map = Object.create(null);
|
8739 | var prevChildren = this.prevChildren = this.children;
|
8740 | var rawChildren = this.$slots.default || [];
|
8741 | var children = this.children = [];
|
8742 | var transitionData = extractTransitionData(this);
|
8743 |
|
8744 | for (var i = 0; i < rawChildren.length; i++) {
|
8745 | var c = rawChildren[i];
|
8746 | if (c.tag) {
|
8747 | if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
8748 | children.push(c);
|
8749 | map[c.key] = c
|
8750 | ;(c.data || (c.data = {})).transition = transitionData;
|
8751 | } else {
|
8752 | var opts = c.componentOptions;
|
8753 | var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
8754 | warn(("<transition-group> children must be keyed: <" + name + ">"));
|
8755 | }
|
8756 | }
|
8757 | }
|
8758 |
|
8759 | if (prevChildren) {
|
8760 | var kept = [];
|
8761 | var removed = [];
|
8762 | for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
8763 | var c$1 = prevChildren[i$1];
|
8764 | c$1.data.transition = transitionData;
|
8765 | c$1.data.pos = c$1.elm.getBoundingClientRect();
|
8766 | if (map[c$1.key]) {
|
8767 | kept.push(c$1);
|
8768 | } else {
|
8769 | removed.push(c$1);
|
8770 | }
|
8771 | }
|
8772 | this.kept = h(tag, null, kept);
|
8773 | this.removed = removed;
|
8774 | }
|
8775 |
|
8776 | return h(tag, null, children)
|
8777 | },
|
8778 |
|
8779 | updated: function updated () {
|
8780 | var children = this.prevChildren;
|
8781 | var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
8782 | if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
8783 | return
|
8784 | }
|
8785 |
|
8786 |
|
8787 |
|
8788 | children.forEach(callPendingCbs);
|
8789 | children.forEach(recordPosition);
|
8790 | children.forEach(applyTranslation);
|
8791 |
|
8792 |
|
8793 |
|
8794 |
|
8795 | this._reflow = document.body.offsetHeight;
|
8796 |
|
8797 | children.forEach(function (c) {
|
8798 | if (c.data.moved) {
|
8799 | var el = c.elm;
|
8800 | var s = el.style;
|
8801 | addTransitionClass(el, moveClass);
|
8802 | s.transform = s.WebkitTransform = s.transitionDuration = '';
|
8803 | el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
8804 | if (e && e.target !== el) {
|
8805 | return
|
8806 | }
|
8807 | if (!e || /transform$/.test(e.propertyName)) {
|
8808 | el.removeEventListener(transitionEndEvent, cb);
|
8809 | el._moveCb = null;
|
8810 | removeTransitionClass(el, moveClass);
|
8811 | }
|
8812 | });
|
8813 | }
|
8814 | });
|
8815 | },
|
8816 |
|
8817 | methods: {
|
8818 | hasMove: function hasMove (el, moveClass) {
|
8819 |
|
8820 | if (!hasTransition) {
|
8821 | return false
|
8822 | }
|
8823 |
|
8824 | if (this._hasMove) {
|
8825 | return this._hasMove
|
8826 | }
|
8827 |
|
8828 |
|
8829 |
|
8830 |
|
8831 |
|
8832 | var clone = el.cloneNode();
|
8833 | if (el._transitionClasses) {
|
8834 | el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
8835 | }
|
8836 | addClass(clone, moveClass);
|
8837 | clone.style.display = 'none';
|
8838 | this.$el.appendChild(clone);
|
8839 | var info = getTransitionInfo(clone);
|
8840 | this.$el.removeChild(clone);
|
8841 | return (this._hasMove = info.hasTransform)
|
8842 | }
|
8843 | }
|
8844 | };
|
8845 |
|
8846 | function callPendingCbs (c) {
|
8847 |
|
8848 | if (c.elm._moveCb) {
|
8849 | c.elm._moveCb();
|
8850 | }
|
8851 |
|
8852 | if (c.elm._enterCb) {
|
8853 | c.elm._enterCb();
|
8854 | }
|
8855 | }
|
8856 |
|
8857 | function recordPosition (c) {
|
8858 | c.data.newPos = c.elm.getBoundingClientRect();
|
8859 | }
|
8860 |
|
8861 | function applyTranslation (c) {
|
8862 | var oldPos = c.data.pos;
|
8863 | var newPos = c.data.newPos;
|
8864 | var dx = oldPos.left - newPos.left;
|
8865 | var dy = oldPos.top - newPos.top;
|
8866 | if (dx || dy) {
|
8867 | c.data.moved = true;
|
8868 | var s = c.elm.style;
|
8869 | s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
8870 | s.transitionDuration = '0s';
|
8871 | }
|
8872 | }
|
8873 |
|
8874 | var platformComponents = {
|
8875 | Transition: Transition,
|
8876 | TransitionGroup: TransitionGroup
|
8877 | };
|
8878 |
|
8879 |
|
8880 |
|
8881 |
|
8882 | Vue.config.mustUseProp = mustUseProp;
|
8883 | Vue.config.isReservedTag = isReservedTag;
|
8884 | Vue.config.isReservedAttr = isReservedAttr;
|
8885 | Vue.config.getTagNamespace = getTagNamespace;
|
8886 | Vue.config.isUnknownElement = isUnknownElement;
|
8887 |
|
8888 |
|
8889 | extend(Vue.options.directives, platformDirectives);
|
8890 | extend(Vue.options.components, platformComponents);
|
8891 |
|
8892 |
|
8893 | Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
8894 |
|
8895 |
|
8896 | Vue.prototype.$mount = function (
|
8897 | el,
|
8898 | hydrating
|
8899 | ) {
|
8900 | el = el && inBrowser ? query(el) : undefined;
|
8901 | return mountComponent(this, el, hydrating)
|
8902 | };
|
8903 |
|
8904 |
|
8905 |
|
8906 | if (inBrowser) {
|
8907 | setTimeout(function () {
|
8908 | if (config.devtools) {
|
8909 | if (devtools) {
|
8910 | devtools.emit('init', Vue);
|
8911 | } else {
|
8912 | console[console.info ? 'info' : 'log'](
|
8913 | 'Download the Vue Devtools extension for a better development experience:\n' +
|
8914 | 'https://github.com/vuejs/vue-devtools'
|
8915 | );
|
8916 | }
|
8917 | }
|
8918 | if (config.productionTip !== false &&
|
8919 | typeof console !== 'undefined'
|
8920 | ) {
|
8921 | console[console.info ? 'info' : 'log'](
|
8922 | "You are running Vue in development mode.\n" +
|
8923 | "Make sure to turn on production mode when deploying for production.\n" +
|
8924 | "See more tips at https://vuejs.org/guide/deployment.html"
|
8925 | );
|
8926 | }
|
8927 | }, 0);
|
8928 | }
|
8929 |
|
8930 |
|
8931 |
|
8932 | var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
8933 | var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
8934 |
|
8935 | var buildRegex = cached(function (delimiters) {
|
8936 | var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
8937 | var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
8938 | return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
8939 | });
|
8940 |
|
8941 |
|
8942 |
|
8943 | function parseText (
|
8944 | text,
|
8945 | delimiters
|
8946 | ) {
|
8947 | var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
8948 | if (!tagRE.test(text)) {
|
8949 | return
|
8950 | }
|
8951 | var tokens = [];
|
8952 | var rawTokens = [];
|
8953 | var lastIndex = tagRE.lastIndex = 0;
|
8954 | var match, index, tokenValue;
|
8955 | while ((match = tagRE.exec(text))) {
|
8956 | index = match.index;
|
8957 |
|
8958 | if (index > lastIndex) {
|
8959 | rawTokens.push(tokenValue = text.slice(lastIndex, index));
|
8960 | tokens.push(JSON.stringify(tokenValue));
|
8961 | }
|
8962 |
|
8963 | var exp = parseFilters(match[1].trim());
|
8964 | tokens.push(("_s(" + exp + ")"));
|
8965 | rawTokens.push({ '@binding': exp });
|
8966 | lastIndex = index + match[0].length;
|
8967 | }
|
8968 | if (lastIndex < text.length) {
|
8969 | rawTokens.push(tokenValue = text.slice(lastIndex));
|
8970 | tokens.push(JSON.stringify(tokenValue));
|
8971 | }
|
8972 | return {
|
8973 | expression: tokens.join('+'),
|
8974 | tokens: rawTokens
|
8975 | }
|
8976 | }
|
8977 |
|
8978 |
|
8979 |
|
8980 | function transformNode (el, options) {
|
8981 | var warn = options.warn || baseWarn;
|
8982 | var staticClass = getAndRemoveAttr(el, 'class');
|
8983 | if (staticClass) {
|
8984 | var res = parseText(staticClass, options.delimiters);
|
8985 | if (res) {
|
8986 | warn(
|
8987 | "class=\"" + staticClass + "\": " +
|
8988 | 'Interpolation inside attributes has been removed. ' +
|
8989 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
8990 | 'instead of <div class="{{ val }}">, use <div :class="val">.',
|
8991 | el.rawAttrsMap['class']
|
8992 | );
|
8993 | }
|
8994 | }
|
8995 | if (staticClass) {
|
8996 | el.staticClass = JSON.stringify(staticClass);
|
8997 | }
|
8998 | var classBinding = getBindingAttr(el, 'class', false );
|
8999 | if (classBinding) {
|
9000 | el.classBinding = classBinding;
|
9001 | }
|
9002 | }
|
9003 |
|
9004 | function genData (el) {
|
9005 | var data = '';
|
9006 | if (el.staticClass) {
|
9007 | data += "staticClass:" + (el.staticClass) + ",";
|
9008 | }
|
9009 | if (el.classBinding) {
|
9010 | data += "class:" + (el.classBinding) + ",";
|
9011 | }
|
9012 | return data
|
9013 | }
|
9014 |
|
9015 | var klass$1 = {
|
9016 | staticKeys: ['staticClass'],
|
9017 | transformNode: transformNode,
|
9018 | genData: genData
|
9019 | };
|
9020 |
|
9021 |
|
9022 |
|
9023 | function transformNode$1 (el, options) {
|
9024 | var warn = options.warn || baseWarn;
|
9025 | var staticStyle = getAndRemoveAttr(el, 'style');
|
9026 | if (staticStyle) {
|
9027 |
|
9028 | {
|
9029 | var res = parseText(staticStyle, options.delimiters);
|
9030 | if (res) {
|
9031 | warn(
|
9032 | "style=\"" + staticStyle + "\": " +
|
9033 | 'Interpolation inside attributes has been removed. ' +
|
9034 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
9035 | 'instead of <div style="{{ val }}">, use <div :style="val">.',
|
9036 | el.rawAttrsMap['style']
|
9037 | );
|
9038 | }
|
9039 | }
|
9040 | el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
9041 | }
|
9042 |
|
9043 | var styleBinding = getBindingAttr(el, 'style', false );
|
9044 | if (styleBinding) {
|
9045 | el.styleBinding = styleBinding;
|
9046 | }
|
9047 | }
|
9048 |
|
9049 | function genData$1 (el) {
|
9050 | var data = '';
|
9051 | if (el.staticStyle) {
|
9052 | data += "staticStyle:" + (el.staticStyle) + ",";
|
9053 | }
|
9054 | if (el.styleBinding) {
|
9055 | data += "style:(" + (el.styleBinding) + "),";
|
9056 | }
|
9057 | return data
|
9058 | }
|
9059 |
|
9060 | var style$1 = {
|
9061 | staticKeys: ['staticStyle'],
|
9062 | transformNode: transformNode$1,
|
9063 | genData: genData$1
|
9064 | };
|
9065 |
|
9066 |
|
9067 |
|
9068 | var decoder;
|
9069 |
|
9070 | var he = {
|
9071 | decode: function decode (html) {
|
9072 | decoder = decoder || document.createElement('div');
|
9073 | decoder.innerHTML = html;
|
9074 | return decoder.textContent
|
9075 | }
|
9076 | };
|
9077 |
|
9078 |
|
9079 |
|
9080 | var isUnaryTag = makeMap(
|
9081 | 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
9082 | 'link,meta,param,source,track,wbr'
|
9083 | );
|
9084 |
|
9085 |
|
9086 |
|
9087 | var canBeLeftOpenTag = makeMap(
|
9088 | 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
9089 | );
|
9090 |
|
9091 |
|
9092 |
|
9093 | var isNonPhrasingTag = makeMap(
|
9094 | 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
9095 | 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
9096 | 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
9097 | 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
9098 | 'title,tr,track'
|
9099 | );
|
9100 |
|
9101 | |
9102 |
|
9103 |
|
9104 |
|
9105 |
|
9106 | var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9107 | var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9108 | var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
|
9109 | var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
9110 | var startTagOpen = new RegExp(("^<" + qnameCapture));
|
9111 | var startTagClose = /^\s*(\/?)>/;
|
9112 | var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
9113 | var doctype = /^<!DOCTYPE [^>]+>/i;
|
9114 |
|
9115 | var comment = /^<!\--/;
|
9116 | var conditionalComment = /^<!\[/;
|
9117 |
|
9118 |
|
9119 | var isPlainTextElement = makeMap('script,style,textarea', true);
|
9120 | var reCache = {};
|
9121 |
|
9122 | var decodingMap = {
|
9123 | '<': '<',
|
9124 | '>': '>',
|
9125 | '"': '"',
|
9126 | '&': '&',
|
9127 | ' ': '\n',
|
9128 | '	': '\t'
|
9129 | };
|
9130 | var encodedAttr = /&(?:lt|gt|quot|amp);/g;
|
9131 | var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
|
9132 |
|
9133 |
|
9134 | var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
9135 | var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
|
9136 |
|
9137 | function decodeAttr (value, shouldDecodeNewlines) {
|
9138 | var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
9139 | return value.replace(re, function (match) { return decodingMap[match]; })
|
9140 | }
|
9141 |
|
9142 | function parseHTML (html, options) {
|
9143 | var stack = [];
|
9144 | var expectHTML = options.expectHTML;
|
9145 | var isUnaryTag$$1 = options.isUnaryTag || no;
|
9146 | var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
9147 | var index = 0;
|
9148 | var last, lastTag;
|
9149 | while (html) {
|
9150 | last = html;
|
9151 |
|
9152 | if (!lastTag || !isPlainTextElement(lastTag)) {
|
9153 | var textEnd = html.indexOf('<');
|
9154 | if (textEnd === 0) {
|
9155 |
|
9156 | if (comment.test(html)) {
|
9157 | var commentEnd = html.indexOf('-->');
|
9158 |
|
9159 | if (commentEnd >= 0) {
|
9160 | if (options.shouldKeepComment) {
|
9161 | options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
9162 | }
|
9163 | advance(commentEnd + 3);
|
9164 | continue
|
9165 | }
|
9166 | }
|
9167 |
|
9168 |
|
9169 | if (conditionalComment.test(html)) {
|
9170 | var conditionalEnd = html.indexOf(']>');
|
9171 |
|
9172 | if (conditionalEnd >= 0) {
|
9173 | advance(conditionalEnd + 2);
|
9174 | continue
|
9175 | }
|
9176 | }
|
9177 |
|
9178 |
|
9179 | var doctypeMatch = html.match(doctype);
|
9180 | if (doctypeMatch) {
|
9181 | advance(doctypeMatch[0].length);
|
9182 | continue
|
9183 | }
|
9184 |
|
9185 |
|
9186 | var endTagMatch = html.match(endTag);
|
9187 | if (endTagMatch) {
|
9188 | var curIndex = index;
|
9189 | advance(endTagMatch[0].length);
|
9190 | parseEndTag(endTagMatch[1], curIndex, index);
|
9191 | continue
|
9192 | }
|
9193 |
|
9194 |
|
9195 | var startTagMatch = parseStartTag();
|
9196 | if (startTagMatch) {
|
9197 | handleStartTag(startTagMatch);
|
9198 | if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
9199 | advance(1);
|
9200 | }
|
9201 | continue
|
9202 | }
|
9203 | }
|
9204 |
|
9205 | var text = (void 0), rest = (void 0), next = (void 0);
|
9206 | if (textEnd >= 0) {
|
9207 | rest = html.slice(textEnd);
|
9208 | while (
|
9209 | !endTag.test(rest) &&
|
9210 | !startTagOpen.test(rest) &&
|
9211 | !comment.test(rest) &&
|
9212 | !conditionalComment.test(rest)
|
9213 | ) {
|
9214 |
|
9215 | next = rest.indexOf('<', 1);
|
9216 | if (next < 0) { break }
|
9217 | textEnd += next;
|
9218 | rest = html.slice(textEnd);
|
9219 | }
|
9220 | text = html.substring(0, textEnd);
|
9221 | }
|
9222 |
|
9223 | if (textEnd < 0) {
|
9224 | text = html;
|
9225 | }
|
9226 |
|
9227 | if (text) {
|
9228 | advance(text.length);
|
9229 | }
|
9230 |
|
9231 | if (options.chars && text) {
|
9232 | options.chars(text, index - text.length, index);
|
9233 | }
|
9234 | } else {
|
9235 | var endTagLength = 0;
|
9236 | var stackedTag = lastTag.toLowerCase();
|
9237 | var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
|
9238 | var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
|
9239 | endTagLength = endTag.length;
|
9240 | if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
9241 | text = text
|
9242 | .replace(/<!\--([\s\S]*?)-->/g, '$1')
|
9243 | .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
9244 | }
|
9245 | if (shouldIgnoreFirstNewline(stackedTag, text)) {
|
9246 | text = text.slice(1);
|
9247 | }
|
9248 | if (options.chars) {
|
9249 | options.chars(text);
|
9250 | }
|
9251 | return ''
|
9252 | });
|
9253 | index += html.length - rest$1.length;
|
9254 | html = rest$1;
|
9255 | parseEndTag(stackedTag, index - endTagLength, index);
|
9256 | }
|
9257 |
|
9258 | if (html === last) {
|
9259 | options.chars && options.chars(html);
|
9260 | if (!stack.length && options.warn) {
|
9261 | options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
|
9262 | }
|
9263 | break
|
9264 | }
|
9265 | }
|
9266 |
|
9267 |
|
9268 | parseEndTag();
|
9269 |
|
9270 | function advance (n) {
|
9271 | index += n;
|
9272 | html = html.substring(n);
|
9273 | }
|
9274 |
|
9275 | function parseStartTag () {
|
9276 | var start = html.match(startTagOpen);
|
9277 | if (start) {
|
9278 | var match = {
|
9279 | tagName: start[1],
|
9280 | attrs: [],
|
9281 | start: index
|
9282 | };
|
9283 | advance(start[0].length);
|
9284 | var end, attr;
|
9285 | while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
9286 | attr.start = index;
|
9287 | advance(attr[0].length);
|
9288 | attr.end = index;
|
9289 | match.attrs.push(attr);
|
9290 | }
|
9291 | if (end) {
|
9292 | match.unarySlash = end[1];
|
9293 | advance(end[0].length);
|
9294 | match.end = index;
|
9295 | return match
|
9296 | }
|
9297 | }
|
9298 | }
|
9299 |
|
9300 | function handleStartTag (match) {
|
9301 | var tagName = match.tagName;
|
9302 | var unarySlash = match.unarySlash;
|
9303 |
|
9304 | if (expectHTML) {
|
9305 | if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
9306 | parseEndTag(lastTag);
|
9307 | }
|
9308 | if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
9309 | parseEndTag(tagName);
|
9310 | }
|
9311 | }
|
9312 |
|
9313 | var unary = isUnaryTag$$1(tagName) || !!unarySlash;
|
9314 |
|
9315 | var l = match.attrs.length;
|
9316 | var attrs = new Array(l);
|
9317 | for (var i = 0; i < l; i++) {
|
9318 | var args = match.attrs[i];
|
9319 | var value = args[3] || args[4] || args[5] || '';
|
9320 | var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
9321 | ? options.shouldDecodeNewlinesForHref
|
9322 | : options.shouldDecodeNewlines;
|
9323 | attrs[i] = {
|
9324 | name: args[1],
|
9325 | value: decodeAttr(value, shouldDecodeNewlines)
|
9326 | };
|
9327 | if (options.outputSourceRange) {
|
9328 | attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
9329 | attrs[i].end = args.end;
|
9330 | }
|
9331 | }
|
9332 |
|
9333 | if (!unary) {
|
9334 | stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
|
9335 | lastTag = tagName;
|
9336 | }
|
9337 |
|
9338 | if (options.start) {
|
9339 | options.start(tagName, attrs, unary, match.start, match.end);
|
9340 | }
|
9341 | }
|
9342 |
|
9343 | function parseEndTag (tagName, start, end) {
|
9344 | var pos, lowerCasedTagName;
|
9345 | if (start == null) { start = index; }
|
9346 | if (end == null) { end = index; }
|
9347 |
|
9348 |
|
9349 | if (tagName) {
|
9350 | lowerCasedTagName = tagName.toLowerCase();
|
9351 | for (pos = stack.length - 1; pos >= 0; pos--) {
|
9352 | if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
9353 | break
|
9354 | }
|
9355 | }
|
9356 | } else {
|
9357 |
|
9358 | pos = 0;
|
9359 | }
|
9360 |
|
9361 | if (pos >= 0) {
|
9362 |
|
9363 | for (var i = stack.length - 1; i >= pos; i--) {
|
9364 | if (i > pos || !tagName &&
|
9365 | options.warn
|
9366 | ) {
|
9367 | options.warn(
|
9368 | ("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
9369 | { start: stack[i].start }
|
9370 | );
|
9371 | }
|
9372 | if (options.end) {
|
9373 | options.end(stack[i].tag, start, end);
|
9374 | }
|
9375 | }
|
9376 |
|
9377 |
|
9378 | stack.length = pos;
|
9379 | lastTag = pos && stack[pos - 1].tag;
|
9380 | } else if (lowerCasedTagName === 'br') {
|
9381 | if (options.start) {
|
9382 | options.start(tagName, [], true, start, end);
|
9383 | }
|
9384 | } else if (lowerCasedTagName === 'p') {
|
9385 | if (options.start) {
|
9386 | options.start(tagName, [], false, start, end);
|
9387 | }
|
9388 | if (options.end) {
|
9389 | options.end(tagName, start, end);
|
9390 | }
|
9391 | }
|
9392 | }
|
9393 | }
|
9394 |
|
9395 |
|
9396 |
|
9397 | var onRE = /^@|^v-on:/;
|
9398 | var dirRE = /^v-|^@|^:/;
|
9399 | var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
9400 | var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
9401 | var stripParensRE = /^\(|\)$/g;
|
9402 | var dynamicArgRE = /^\[.*\]$/;
|
9403 |
|
9404 | var argRE = /:(.*)$/;
|
9405 | var bindRE = /^:|^\.|^v-bind:/;
|
9406 | var modifierRE = /\.[^.]+/g;
|
9407 |
|
9408 | var slotRE = /^v-slot(:|$)|^#/;
|
9409 |
|
9410 | var lineBreakRE = /[\r\n]/;
|
9411 | var whitespaceRE$1 = /\s+/g;
|
9412 |
|
9413 | var invalidAttributeRE = /[\s"'<>\/=]/;
|
9414 |
|
9415 | var decodeHTMLCached = cached(he.decode);
|
9416 |
|
9417 |
|
9418 | var warn$2;
|
9419 | var delimiters;
|
9420 | var transforms;
|
9421 | var preTransforms;
|
9422 | var postTransforms;
|
9423 | var platformIsPreTag;
|
9424 | var platformMustUseProp;
|
9425 | var platformGetTagNamespace;
|
9426 | var maybeComponent;
|
9427 |
|
9428 | function createASTElement (
|
9429 | tag,
|
9430 | attrs,
|
9431 | parent
|
9432 | ) {
|
9433 | return {
|
9434 | type: 1,
|
9435 | tag: tag,
|
9436 | attrsList: attrs,
|
9437 | attrsMap: makeAttrsMap(attrs),
|
9438 | rawAttrsMap: {},
|
9439 | parent: parent,
|
9440 | children: []
|
9441 | }
|
9442 | }
|
9443 |
|
9444 | |
9445 |
|
9446 |
|
9447 | function parse (
|
9448 | template,
|
9449 | options
|
9450 | ) {
|
9451 | warn$2 = options.warn || baseWarn;
|
9452 |
|
9453 | platformIsPreTag = options.isPreTag || no;
|
9454 | platformMustUseProp = options.mustUseProp || no;
|
9455 | platformGetTagNamespace = options.getTagNamespace || no;
|
9456 | var isReservedTag = options.isReservedTag || no;
|
9457 | maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
9458 |
|
9459 | transforms = pluckModuleFunction(options.modules, 'transformNode');
|
9460 | preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
9461 | postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
9462 |
|
9463 | delimiters = options.delimiters;
|
9464 |
|
9465 | var stack = [];
|
9466 | var preserveWhitespace = options.preserveWhitespace !== false;
|
9467 | var whitespaceOption = options.whitespace;
|
9468 | var root;
|
9469 | var currentParent;
|
9470 | var inVPre = false;
|
9471 | var inPre = false;
|
9472 | var warned = false;
|
9473 |
|
9474 | function warnOnce (msg, range) {
|
9475 | if (!warned) {
|
9476 | warned = true;
|
9477 | warn$2(msg, range);
|
9478 | }
|
9479 | }
|
9480 |
|
9481 | function closeElement (element) {
|
9482 | trimEndingWhitespace(element);
|
9483 | if (!inVPre && !element.processed) {
|
9484 | element = processElement(element, options);
|
9485 | }
|
9486 |
|
9487 | if (!stack.length && element !== root) {
|
9488 |
|
9489 | if (root.if && (element.elseif || element.else)) {
|
9490 | {
|
9491 | checkRootConstraints(element);
|
9492 | }
|
9493 | addIfCondition(root, {
|
9494 | exp: element.elseif,
|
9495 | block: element
|
9496 | });
|
9497 | } else {
|
9498 | warnOnce(
|
9499 | "Component template should contain exactly one root element. " +
|
9500 | "If you are using v-if on multiple elements, " +
|
9501 | "use v-else-if to chain them instead.",
|
9502 | { start: element.start }
|
9503 | );
|
9504 | }
|
9505 | }
|
9506 | if (currentParent && !element.forbidden) {
|
9507 | if (element.elseif || element.else) {
|
9508 | processIfConditions(element, currentParent);
|
9509 | } else {
|
9510 | if (element.slotScope) {
|
9511 |
|
9512 |
|
9513 |
|
9514 | var name = element.slotTarget || '"default"'
|
9515 | ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
|
9516 | }
|
9517 | currentParent.children.push(element);
|
9518 | element.parent = currentParent;
|
9519 | }
|
9520 | }
|
9521 |
|
9522 |
|
9523 |
|
9524 | element.children = element.children.filter(function (c) { return !(c).slotScope; });
|
9525 |
|
9526 | trimEndingWhitespace(element);
|
9527 |
|
9528 |
|
9529 | if (element.pre) {
|
9530 | inVPre = false;
|
9531 | }
|
9532 | if (platformIsPreTag(element.tag)) {
|
9533 | inPre = false;
|
9534 | }
|
9535 |
|
9536 | for (var i = 0; i < postTransforms.length; i++) {
|
9537 | postTransforms[i](element, options);
|
9538 | }
|
9539 | }
|
9540 |
|
9541 | function trimEndingWhitespace (el) {
|
9542 |
|
9543 | if (!inPre) {
|
9544 | var lastNode;
|
9545 | while (
|
9546 | (lastNode = el.children[el.children.length - 1]) &&
|
9547 | lastNode.type === 3 &&
|
9548 | lastNode.text === ' '
|
9549 | ) {
|
9550 | el.children.pop();
|
9551 | }
|
9552 | }
|
9553 | }
|
9554 |
|
9555 | function checkRootConstraints (el) {
|
9556 | if (el.tag === 'slot' || el.tag === 'template') {
|
9557 | warnOnce(
|
9558 | "Cannot use <" + (el.tag) + "> as component root element because it may " +
|
9559 | 'contain multiple nodes.',
|
9560 | { start: el.start }
|
9561 | );
|
9562 | }
|
9563 | if (el.attrsMap.hasOwnProperty('v-for')) {
|
9564 | warnOnce(
|
9565 | 'Cannot use v-for on stateful component root element because ' +
|
9566 | 'it renders multiple elements.',
|
9567 | el.rawAttrsMap['v-for']
|
9568 | );
|
9569 | }
|
9570 | }
|
9571 |
|
9572 | parseHTML(template, {
|
9573 | warn: warn$2,
|
9574 | expectHTML: options.expectHTML,
|
9575 | isUnaryTag: options.isUnaryTag,
|
9576 | canBeLeftOpenTag: options.canBeLeftOpenTag,
|
9577 | shouldDecodeNewlines: options.shouldDecodeNewlines,
|
9578 | shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
9579 | shouldKeepComment: options.comments,
|
9580 | outputSourceRange: options.outputSourceRange,
|
9581 | start: function start (tag, attrs, unary, start$1) {
|
9582 |
|
9583 |
|
9584 | var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
9585 |
|
9586 |
|
9587 |
|
9588 | if (isIE && ns === 'svg') {
|
9589 | attrs = guardIESVGBug(attrs);
|
9590 | }
|
9591 |
|
9592 | var element = createASTElement(tag, attrs, currentParent);
|
9593 | if (ns) {
|
9594 | element.ns = ns;
|
9595 | }
|
9596 |
|
9597 | {
|
9598 | if (options.outputSourceRange) {
|
9599 | element.start = start$1;
|
9600 | element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
9601 | cumulated[attr.name] = attr;
|
9602 | return cumulated
|
9603 | }, {});
|
9604 | }
|
9605 | attrs.forEach(function (attr) {
|
9606 | if (invalidAttributeRE.test(attr.name)) {
|
9607 | warn$2(
|
9608 | "Invalid dynamic argument expression: attribute names cannot contain " +
|
9609 | "spaces, quotes, <, >, / or =.",
|
9610 | {
|
9611 | start: attr.start + attr.name.indexOf("["),
|
9612 | end: attr.start + attr.name.length
|
9613 | }
|
9614 | );
|
9615 | }
|
9616 | });
|
9617 | }
|
9618 |
|
9619 | if (isForbiddenTag(element) && !isServerRendering()) {
|
9620 | element.forbidden = true;
|
9621 | warn$2(
|
9622 | 'Templates should only be responsible for mapping the state to the ' +
|
9623 | 'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
9624 | "<" + tag + ">" + ', as they will not be parsed.',
|
9625 | { start: element.start }
|
9626 | );
|
9627 | }
|
9628 |
|
9629 |
|
9630 | for (var i = 0; i < preTransforms.length; i++) {
|
9631 | element = preTransforms[i](element, options) || element;
|
9632 | }
|
9633 |
|
9634 | if (!inVPre) {
|
9635 | processPre(element);
|
9636 | if (element.pre) {
|
9637 | inVPre = true;
|
9638 | }
|
9639 | }
|
9640 | if (platformIsPreTag(element.tag)) {
|
9641 | inPre = true;
|
9642 | }
|
9643 | if (inVPre) {
|
9644 | processRawAttrs(element);
|
9645 | } else if (!element.processed) {
|
9646 |
|
9647 | processFor(element);
|
9648 | processIf(element);
|
9649 | processOnce(element);
|
9650 | }
|
9651 |
|
9652 | if (!root) {
|
9653 | root = element;
|
9654 | {
|
9655 | checkRootConstraints(root);
|
9656 | }
|
9657 | }
|
9658 |
|
9659 | if (!unary) {
|
9660 | currentParent = element;
|
9661 | stack.push(element);
|
9662 | } else {
|
9663 | closeElement(element);
|
9664 | }
|
9665 | },
|
9666 |
|
9667 | end: function end (tag, start, end$1) {
|
9668 | var element = stack[stack.length - 1];
|
9669 |
|
9670 | stack.length -= 1;
|
9671 | currentParent = stack[stack.length - 1];
|
9672 | if (options.outputSourceRange) {
|
9673 | element.end = end$1;
|
9674 | }
|
9675 | closeElement(element);
|
9676 | },
|
9677 |
|
9678 | chars: function chars (text, start, end) {
|
9679 | if (!currentParent) {
|
9680 | {
|
9681 | if (text === template) {
|
9682 | warnOnce(
|
9683 | 'Component template requires a root element, rather than just text.',
|
9684 | { start: start }
|
9685 | );
|
9686 | } else if ((text = text.trim())) {
|
9687 | warnOnce(
|
9688 | ("text \"" + text + "\" outside root element will be ignored."),
|
9689 | { start: start }
|
9690 | );
|
9691 | }
|
9692 | }
|
9693 | return
|
9694 | }
|
9695 |
|
9696 |
|
9697 | if (isIE &&
|
9698 | currentParent.tag === 'textarea' &&
|
9699 | currentParent.attrsMap.placeholder === text
|
9700 | ) {
|
9701 | return
|
9702 | }
|
9703 | var children = currentParent.children;
|
9704 | if (inPre || text.trim()) {
|
9705 | text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
|
9706 | } else if (!children.length) {
|
9707 |
|
9708 | text = '';
|
9709 | } else if (whitespaceOption) {
|
9710 | if (whitespaceOption === 'condense') {
|
9711 |
|
9712 |
|
9713 | text = lineBreakRE.test(text) ? '' : ' ';
|
9714 | } else {
|
9715 | text = ' ';
|
9716 | }
|
9717 | } else {
|
9718 | text = preserveWhitespace ? ' ' : '';
|
9719 | }
|
9720 | if (text) {
|
9721 | if (whitespaceOption === 'condense') {
|
9722 |
|
9723 | text = text.replace(whitespaceRE$1, ' ');
|
9724 | }
|
9725 | var res;
|
9726 | var child;
|
9727 | if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
9728 | child = {
|
9729 | type: 2,
|
9730 | expression: res.expression,
|
9731 | tokens: res.tokens,
|
9732 | text: text
|
9733 | };
|
9734 | } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
|
9735 | child = {
|
9736 | type: 3,
|
9737 | text: text
|
9738 | };
|
9739 | }
|
9740 | if (child) {
|
9741 | if (options.outputSourceRange) {
|
9742 | child.start = start;
|
9743 | child.end = end;
|
9744 | }
|
9745 | children.push(child);
|
9746 | }
|
9747 | }
|
9748 | },
|
9749 | comment: function comment (text, start, end) {
|
9750 | var child = {
|
9751 | type: 3,
|
9752 | text: text,
|
9753 | isComment: true
|
9754 | };
|
9755 | if (options.outputSourceRange) {
|
9756 | child.start = start;
|
9757 | child.end = end;
|
9758 | }
|
9759 | currentParent.children.push(child);
|
9760 | }
|
9761 | });
|
9762 | return root
|
9763 | }
|
9764 |
|
9765 | function processPre (el) {
|
9766 | if (getAndRemoveAttr(el, 'v-pre') != null) {
|
9767 | el.pre = true;
|
9768 | }
|
9769 | }
|
9770 |
|
9771 | function processRawAttrs (el) {
|
9772 | var list = el.attrsList;
|
9773 | var len = list.length;
|
9774 | if (len) {
|
9775 | var attrs = el.attrs = new Array(len);
|
9776 | for (var i = 0; i < len; i++) {
|
9777 | attrs[i] = {
|
9778 | name: list[i].name,
|
9779 | value: JSON.stringify(list[i].value)
|
9780 | };
|
9781 | if (list[i].start != null) {
|
9782 | attrs[i].start = list[i].start;
|
9783 | attrs[i].end = list[i].end;
|
9784 | }
|
9785 | }
|
9786 | } else if (!el.pre) {
|
9787 |
|
9788 | el.plain = true;
|
9789 | }
|
9790 | }
|
9791 |
|
9792 | function processElement (
|
9793 | element,
|
9794 | options
|
9795 | ) {
|
9796 | processKey(element);
|
9797 |
|
9798 |
|
9799 |
|
9800 | element.plain = (
|
9801 | !element.key &&
|
9802 | !element.scopedSlots &&
|
9803 | !element.attrsList.length
|
9804 | );
|
9805 |
|
9806 | processRef(element);
|
9807 | processSlotContent(element);
|
9808 | processSlotOutlet(element);
|
9809 | processComponent(element);
|
9810 | for (var i = 0; i < transforms.length; i++) {
|
9811 | element = transforms[i](element, options) || element;
|
9812 | }
|
9813 | processAttrs(element);
|
9814 | return element
|
9815 | }
|
9816 |
|
9817 | function processKey (el) {
|
9818 | var exp = getBindingAttr(el, 'key');
|
9819 | if (exp) {
|
9820 | {
|
9821 | if (el.tag === 'template') {
|
9822 | warn$2(
|
9823 | "<template> cannot be keyed. Place the key on real elements instead.",
|
9824 | getRawBindingAttr(el, 'key')
|
9825 | );
|
9826 | }
|
9827 | if (el.for) {
|
9828 | var iterator = el.iterator2 || el.iterator1;
|
9829 | var parent = el.parent;
|
9830 | if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
9831 | warn$2(
|
9832 | "Do not use v-for index as key on <transition-group> children, " +
|
9833 | "this is the same as not using keys.",
|
9834 | getRawBindingAttr(el, 'key'),
|
9835 | true
|
9836 | );
|
9837 | }
|
9838 | }
|
9839 | }
|
9840 | el.key = exp;
|
9841 | }
|
9842 | }
|
9843 |
|
9844 | function processRef (el) {
|
9845 | var ref = getBindingAttr(el, 'ref');
|
9846 | if (ref) {
|
9847 | el.ref = ref;
|
9848 | el.refInFor = checkInFor(el);
|
9849 | }
|
9850 | }
|
9851 |
|
9852 | function processFor (el) {
|
9853 | var exp;
|
9854 | if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
9855 | var res = parseFor(exp);
|
9856 | if (res) {
|
9857 | extend(el, res);
|
9858 | } else {
|
9859 | warn$2(
|
9860 | ("Invalid v-for expression: " + exp),
|
9861 | el.rawAttrsMap['v-for']
|
9862 | );
|
9863 | }
|
9864 | }
|
9865 | }
|
9866 |
|
9867 |
|
9868 |
|
9869 | function parseFor (exp) {
|
9870 | var inMatch = exp.match(forAliasRE);
|
9871 | if (!inMatch) { return }
|
9872 | var res = {};
|
9873 | res.for = inMatch[2].trim();
|
9874 | var alias = inMatch[1].trim().replace(stripParensRE, '');
|
9875 | var iteratorMatch = alias.match(forIteratorRE);
|
9876 | if (iteratorMatch) {
|
9877 | res.alias = alias.replace(forIteratorRE, '').trim();
|
9878 | res.iterator1 = iteratorMatch[1].trim();
|
9879 | if (iteratorMatch[2]) {
|
9880 | res.iterator2 = iteratorMatch[2].trim();
|
9881 | }
|
9882 | } else {
|
9883 | res.alias = alias;
|
9884 | }
|
9885 | return res
|
9886 | }
|
9887 |
|
9888 | function processIf (el) {
|
9889 | var exp = getAndRemoveAttr(el, 'v-if');
|
9890 | if (exp) {
|
9891 | el.if = exp;
|
9892 | addIfCondition(el, {
|
9893 | exp: exp,
|
9894 | block: el
|
9895 | });
|
9896 | } else {
|
9897 | if (getAndRemoveAttr(el, 'v-else') != null) {
|
9898 | el.else = true;
|
9899 | }
|
9900 | var elseif = getAndRemoveAttr(el, 'v-else-if');
|
9901 | if (elseif) {
|
9902 | el.elseif = elseif;
|
9903 | }
|
9904 | }
|
9905 | }
|
9906 |
|
9907 | function processIfConditions (el, parent) {
|
9908 | var prev = findPrevElement(parent.children);
|
9909 | if (prev && prev.if) {
|
9910 | addIfCondition(prev, {
|
9911 | exp: el.elseif,
|
9912 | block: el
|
9913 | });
|
9914 | } else {
|
9915 | warn$2(
|
9916 | "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
|
9917 | "used on element <" + (el.tag) + "> without corresponding v-if.",
|
9918 | el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
|
9919 | );
|
9920 | }
|
9921 | }
|
9922 |
|
9923 | function findPrevElement (children) {
|
9924 | var i = children.length;
|
9925 | while (i--) {
|
9926 | if (children[i].type === 1) {
|
9927 | return children[i]
|
9928 | } else {
|
9929 | if (children[i].text !== ' ') {
|
9930 | warn$2(
|
9931 | "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
9932 | "will be ignored.",
|
9933 | children[i]
|
9934 | );
|
9935 | }
|
9936 | children.pop();
|
9937 | }
|
9938 | }
|
9939 | }
|
9940 |
|
9941 | function addIfCondition (el, condition) {
|
9942 | if (!el.ifConditions) {
|
9943 | el.ifConditions = [];
|
9944 | }
|
9945 | el.ifConditions.push(condition);
|
9946 | }
|
9947 |
|
9948 | function processOnce (el) {
|
9949 | var once$$1 = getAndRemoveAttr(el, 'v-once');
|
9950 | if (once$$1 != null) {
|
9951 | el.once = true;
|
9952 | }
|
9953 | }
|
9954 |
|
9955 |
|
9956 |
|
9957 | function processSlotContent (el) {
|
9958 | var slotScope;
|
9959 | if (el.tag === 'template') {
|
9960 | slotScope = getAndRemoveAttr(el, 'scope');
|
9961 |
|
9962 | if (slotScope) {
|
9963 | warn$2(
|
9964 | "the \"scope\" attribute for scoped slots have been deprecated and " +
|
9965 | "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
9966 | "can also be used on plain elements in addition to <template> to " +
|
9967 | "denote scoped slots.",
|
9968 | el.rawAttrsMap['scope'],
|
9969 | true
|
9970 | );
|
9971 | }
|
9972 | el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
9973 | } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
9974 |
|
9975 | if (el.attrsMap['v-for']) {
|
9976 | warn$2(
|
9977 | "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
9978 | "(v-for takes higher priority). Use a wrapper <template> for the " +
|
9979 | "scoped slot to make it clearer.",
|
9980 | el.rawAttrsMap['slot-scope'],
|
9981 | true
|
9982 | );
|
9983 | }
|
9984 | el.slotScope = slotScope;
|
9985 | }
|
9986 |
|
9987 |
|
9988 | var slotTarget = getBindingAttr(el, 'slot');
|
9989 | if (slotTarget) {
|
9990 | el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
9991 | el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
9992 |
|
9993 |
|
9994 | if (el.tag !== 'template' && !el.slotScope) {
|
9995 | addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
9996 | }
|
9997 | }
|
9998 |
|
9999 |
|
10000 | {
|
10001 | if (el.tag === 'template') {
|
10002 |
|
10003 | var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
10004 | if (slotBinding) {
|
10005 | {
|
10006 | if (el.slotTarget || el.slotScope) {
|
10007 | warn$2(
|
10008 | "Unexpected mixed usage of different slot syntaxes.",
|
10009 | el
|
10010 | );
|
10011 | }
|
10012 | if (el.parent && !maybeComponent(el.parent)) {
|
10013 | warn$2(
|
10014 | "<template v-slot> can only appear at the root level inside " +
|
10015 | "the receiving the component",
|
10016 | el
|
10017 | );
|
10018 | }
|
10019 | }
|
10020 | var ref = getSlotName(slotBinding);
|
10021 | var name = ref.name;
|
10022 | var dynamic = ref.dynamic;
|
10023 | el.slotTarget = name;
|
10024 | el.slotTargetDynamic = dynamic;
|
10025 | el.slotScope = slotBinding.value || "_";
|
10026 | }
|
10027 | } else {
|
10028 |
|
10029 | var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
10030 | if (slotBinding$1) {
|
10031 | {
|
10032 | if (!maybeComponent(el)) {
|
10033 | warn$2(
|
10034 | "v-slot can only be used on components or <template>.",
|
10035 | slotBinding$1
|
10036 | );
|
10037 | }
|
10038 | if (el.slotScope || el.slotTarget) {
|
10039 | warn$2(
|
10040 | "Unexpected mixed usage of different slot syntaxes.",
|
10041 | el
|
10042 | );
|
10043 | }
|
10044 | if (el.scopedSlots) {
|
10045 | warn$2(
|
10046 | "To avoid scope ambiguity, the default slot should also use " +
|
10047 | "<template> syntax when there are other named slots.",
|
10048 | slotBinding$1
|
10049 | );
|
10050 | }
|
10051 | }
|
10052 |
|
10053 | var slots = el.scopedSlots || (el.scopedSlots = {});
|
10054 | var ref$1 = getSlotName(slotBinding$1);
|
10055 | var name$1 = ref$1.name;
|
10056 | var dynamic$1 = ref$1.dynamic;
|
10057 | var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
10058 | slotContainer.slotTarget = name$1;
|
10059 | slotContainer.slotTargetDynamic = dynamic$1;
|
10060 | slotContainer.children = el.children.filter(function (c) { return !(c).slotScope; });
|
10061 | slotContainer.slotScope = slotBinding$1.value || "_";
|
10062 |
|
10063 | el.children = [];
|
10064 |
|
10065 | el.plain = false;
|
10066 | }
|
10067 | }
|
10068 | }
|
10069 | }
|
10070 |
|
10071 | function getSlotName (binding) {
|
10072 | var name = binding.name.replace(slotRE, '');
|
10073 | if (!name) {
|
10074 | if (binding.name[0] !== '#') {
|
10075 | name = 'default';
|
10076 | } else {
|
10077 | warn$2(
|
10078 | "v-slot shorthand syntax requires a slot name.",
|
10079 | binding
|
10080 | );
|
10081 | }
|
10082 | }
|
10083 | return dynamicArgRE.test(name)
|
10084 |
|
10085 | ? { name: name.slice(1, -1), dynamic: true }
|
10086 |
|
10087 | : { name: ("\"" + name + "\""), dynamic: false }
|
10088 | }
|
10089 |
|
10090 |
|
10091 | function processSlotOutlet (el) {
|
10092 | if (el.tag === 'slot') {
|
10093 | el.slotName = getBindingAttr(el, 'name');
|
10094 | if (el.key) {
|
10095 | warn$2(
|
10096 | "`key` does not work on <slot> because slots are abstract outlets " +
|
10097 | "and can possibly expand into multiple elements. " +
|
10098 | "Use the key on a wrapping element instead.",
|
10099 | getRawBindingAttr(el, 'key')
|
10100 | );
|
10101 | }
|
10102 | }
|
10103 | }
|
10104 |
|
10105 | function processComponent (el) {
|
10106 | var binding;
|
10107 | if ((binding = getBindingAttr(el, 'is'))) {
|
10108 | el.component = binding;
|
10109 | }
|
10110 | if (getAndRemoveAttr(el, 'inline-template') != null) {
|
10111 | el.inlineTemplate = true;
|
10112 | }
|
10113 | }
|
10114 |
|
10115 | function processAttrs (el) {
|
10116 | var list = el.attrsList;
|
10117 | var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
10118 | for (i = 0, l = list.length; i < l; i++) {
|
10119 | name = rawName = list[i].name;
|
10120 | value = list[i].value;
|
10121 | if (dirRE.test(name)) {
|
10122 |
|
10123 | el.hasBindings = true;
|
10124 |
|
10125 | modifiers = parseModifiers(name.replace(dirRE, ''));
|
10126 |
|
10127 | if (modifiers) {
|
10128 | name = name.replace(modifierRE, '');
|
10129 | }
|
10130 | if (bindRE.test(name)) {
|
10131 | name = name.replace(bindRE, '');
|
10132 | value = parseFilters(value);
|
10133 | isDynamic = dynamicArgRE.test(name);
|
10134 | if (isDynamic) {
|
10135 | name = name.slice(1, -1);
|
10136 | }
|
10137 | if (
|
10138 | value.trim().length === 0
|
10139 | ) {
|
10140 | warn$2(
|
10141 | ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
|
10142 | );
|
10143 | }
|
10144 | if (modifiers) {
|
10145 | if (modifiers.prop && !isDynamic) {
|
10146 | name = camelize(name);
|
10147 | if (name === 'innerHtml') { name = 'innerHTML'; }
|
10148 | }
|
10149 | if (modifiers.camel && !isDynamic) {
|
10150 | name = camelize(name);
|
10151 | }
|
10152 | if (modifiers.sync) {
|
10153 | syncGen = genAssignmentCode(value, "$event");
|
10154 | if (!isDynamic) {
|
10155 | addHandler(
|
10156 | el,
|
10157 | ("update:" + (camelize(name))),
|
10158 | syncGen,
|
10159 | null,
|
10160 | false,
|
10161 | warn$2,
|
10162 | list[i]
|
10163 | );
|
10164 | if (hyphenate(name) !== camelize(name)) {
|
10165 | addHandler(
|
10166 | el,
|
10167 | ("update:" + (hyphenate(name))),
|
10168 | syncGen,
|
10169 | null,
|
10170 | false,
|
10171 | warn$2,
|
10172 | list[i]
|
10173 | );
|
10174 | }
|
10175 | } else {
|
10176 |
|
10177 | addHandler(
|
10178 | el,
|
10179 | ("\"update:\"+(" + name + ")"),
|
10180 | syncGen,
|
10181 | null,
|
10182 | false,
|
10183 | warn$2,
|
10184 | list[i],
|
10185 | true
|
10186 | );
|
10187 | }
|
10188 | }
|
10189 | }
|
10190 | if ((modifiers && modifiers.prop) || (
|
10191 | !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
10192 | )) {
|
10193 | addProp(el, name, value, list[i], isDynamic);
|
10194 | } else {
|
10195 | addAttr(el, name, value, list[i], isDynamic);
|
10196 | }
|
10197 | } else if (onRE.test(name)) {
|
10198 | name = name.replace(onRE, '');
|
10199 | isDynamic = dynamicArgRE.test(name);
|
10200 | if (isDynamic) {
|
10201 | name = name.slice(1, -1);
|
10202 | }
|
10203 | addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
10204 | } else {
|
10205 | name = name.replace(dirRE, '');
|
10206 |
|
10207 | var argMatch = name.match(argRE);
|
10208 | var arg = argMatch && argMatch[1];
|
10209 | isDynamic = false;
|
10210 | if (arg) {
|
10211 | name = name.slice(0, -(arg.length + 1));
|
10212 | if (dynamicArgRE.test(arg)) {
|
10213 | arg = arg.slice(1, -1);
|
10214 | isDynamic = true;
|
10215 | }
|
10216 | }
|
10217 | addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
10218 | if (name === 'model') {
|
10219 | checkForAliasModel(el, value);
|
10220 | }
|
10221 | }
|
10222 | } else {
|
10223 |
|
10224 | {
|
10225 | var res = parseText(value, delimiters);
|
10226 | if (res) {
|
10227 | warn$2(
|
10228 | name + "=\"" + value + "\": " +
|
10229 | 'Interpolation inside attributes has been removed. ' +
|
10230 | 'Use v-bind or the colon shorthand instead. For example, ' +
|
10231 | 'instead of <div id="{{ val }}">, use <div :id="val">.',
|
10232 | list[i]
|
10233 | );
|
10234 | }
|
10235 | }
|
10236 | addAttr(el, name, JSON.stringify(value), list[i]);
|
10237 |
|
10238 |
|
10239 | if (!el.component &&
|
10240 | name === 'muted' &&
|
10241 | platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
10242 | addProp(el, name, 'true', list[i]);
|
10243 | }
|
10244 | }
|
10245 | }
|
10246 | }
|
10247 |
|
10248 | function checkInFor (el) {
|
10249 | var parent = el;
|
10250 | while (parent) {
|
10251 | if (parent.for !== undefined) {
|
10252 | return true
|
10253 | }
|
10254 | parent = parent.parent;
|
10255 | }
|
10256 | return false
|
10257 | }
|
10258 |
|
10259 | function parseModifiers (name) {
|
10260 | var match = name.match(modifierRE);
|
10261 | if (match) {
|
10262 | var ret = {};
|
10263 | match.forEach(function (m) { ret[m.slice(1)] = true; });
|
10264 | return ret
|
10265 | }
|
10266 | }
|
10267 |
|
10268 | function makeAttrsMap (attrs) {
|
10269 | var map = {};
|
10270 | for (var i = 0, l = attrs.length; i < l; i++) {
|
10271 | if (
|
10272 | map[attrs[i].name] && !isIE && !isEdge
|
10273 | ) {
|
10274 | warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
10275 | }
|
10276 | map[attrs[i].name] = attrs[i].value;
|
10277 | }
|
10278 | return map
|
10279 | }
|
10280 |
|
10281 |
|
10282 | function isTextTag (el) {
|
10283 | return el.tag === 'script' || el.tag === 'style'
|
10284 | }
|
10285 |
|
10286 | function isForbiddenTag (el) {
|
10287 | return (
|
10288 | el.tag === 'style' ||
|
10289 | (el.tag === 'script' && (
|
10290 | !el.attrsMap.type ||
|
10291 | el.attrsMap.type === 'text/javascript'
|
10292 | ))
|
10293 | )
|
10294 | }
|
10295 |
|
10296 | var ieNSBug = /^xmlns:NS\d+/;
|
10297 | var ieNSPrefix = /^NS\d+:/;
|
10298 |
|
10299 |
|
10300 | function guardIESVGBug (attrs) {
|
10301 | var res = [];
|
10302 | for (var i = 0; i < attrs.length; i++) {
|
10303 | var attr = attrs[i];
|
10304 | if (!ieNSBug.test(attr.name)) {
|
10305 | attr.name = attr.name.replace(ieNSPrefix, '');
|
10306 | res.push(attr);
|
10307 | }
|
10308 | }
|
10309 | return res
|
10310 | }
|
10311 |
|
10312 | function checkForAliasModel (el, value) {
|
10313 | var _el = el;
|
10314 | while (_el) {
|
10315 | if (_el.for && _el.alias === value) {
|
10316 | warn$2(
|
10317 | "<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
10318 | "You are binding v-model directly to a v-for iteration alias. " +
|
10319 | "This will not be able to modify the v-for source array because " +
|
10320 | "writing to the alias is like modifying a function local variable. " +
|
10321 | "Consider using an array of objects and use v-model on an object property instead.",
|
10322 | el.rawAttrsMap['v-model']
|
10323 | );
|
10324 | }
|
10325 | _el = _el.parent;
|
10326 | }
|
10327 | }
|
10328 |
|
10329 |
|
10330 |
|
10331 | function preTransformNode (el, options) {
|
10332 | if (el.tag === 'input') {
|
10333 | var map = el.attrsMap;
|
10334 | if (!map['v-model']) {
|
10335 | return
|
10336 | }
|
10337 |
|
10338 | var typeBinding;
|
10339 | if (map[':type'] || map['v-bind:type']) {
|
10340 | typeBinding = getBindingAttr(el, 'type');
|
10341 | }
|
10342 | if (!map.type && !typeBinding && map['v-bind']) {
|
10343 | typeBinding = "(" + (map['v-bind']) + ").type";
|
10344 | }
|
10345 |
|
10346 | if (typeBinding) {
|
10347 | var ifCondition = getAndRemoveAttr(el, 'v-if', true);
|
10348 | var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
|
10349 | var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
|
10350 | var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
|
10351 |
|
10352 | var branch0 = cloneASTElement(el);
|
10353 |
|
10354 | processFor(branch0);
|
10355 | addRawAttr(branch0, 'type', 'checkbox');
|
10356 | processElement(branch0, options);
|
10357 | branch0.processed = true;
|
10358 | branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
|
10359 | addIfCondition(branch0, {
|
10360 | exp: branch0.if,
|
10361 | block: branch0
|
10362 | });
|
10363 |
|
10364 | var branch1 = cloneASTElement(el);
|
10365 | getAndRemoveAttr(branch1, 'v-for', true);
|
10366 | addRawAttr(branch1, 'type', 'radio');
|
10367 | processElement(branch1, options);
|
10368 | addIfCondition(branch0, {
|
10369 | exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
|
10370 | block: branch1
|
10371 | });
|
10372 |
|
10373 | var branch2 = cloneASTElement(el);
|
10374 | getAndRemoveAttr(branch2, 'v-for', true);
|
10375 | addRawAttr(branch2, ':type', typeBinding);
|
10376 | processElement(branch2, options);
|
10377 | addIfCondition(branch0, {
|
10378 | exp: ifCondition,
|
10379 | block: branch2
|
10380 | });
|
10381 |
|
10382 | if (hasElse) {
|
10383 | branch0.else = true;
|
10384 | } else if (elseIfCondition) {
|
10385 | branch0.elseif = elseIfCondition;
|
10386 | }
|
10387 |
|
10388 | return branch0
|
10389 | }
|
10390 | }
|
10391 | }
|
10392 |
|
10393 | function cloneASTElement (el) {
|
10394 | return createASTElement(el.tag, el.attrsList.slice(), el.parent)
|
10395 | }
|
10396 |
|
10397 | var model$1 = {
|
10398 | preTransformNode: preTransformNode
|
10399 | };
|
10400 |
|
10401 | var modules$1 = [
|
10402 | klass$1,
|
10403 | style$1,
|
10404 | model$1
|
10405 | ];
|
10406 |
|
10407 |
|
10408 |
|
10409 | function text (el, dir) {
|
10410 | if (dir.value) {
|
10411 | addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
|
10412 | }
|
10413 | }
|
10414 |
|
10415 |
|
10416 |
|
10417 | function html (el, dir) {
|
10418 | if (dir.value) {
|
10419 | addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
|
10420 | }
|
10421 | }
|
10422 |
|
10423 | var directives$1 = {
|
10424 | model: model,
|
10425 | text: text,
|
10426 | html: html
|
10427 | };
|
10428 |
|
10429 |
|
10430 |
|
10431 | var baseOptions = {
|
10432 | expectHTML: true,
|
10433 | modules: modules$1,
|
10434 | directives: directives$1,
|
10435 | isPreTag: isPreTag,
|
10436 | isUnaryTag: isUnaryTag,
|
10437 | mustUseProp: mustUseProp,
|
10438 | canBeLeftOpenTag: canBeLeftOpenTag,
|
10439 | isReservedTag: isReservedTag,
|
10440 | getTagNamespace: getTagNamespace,
|
10441 | staticKeys: genStaticKeys(modules$1)
|
10442 | };
|
10443 |
|
10444 |
|
10445 |
|
10446 | var isStaticKey;
|
10447 | var isPlatformReservedTag;
|
10448 |
|
10449 | var genStaticKeysCached = cached(genStaticKeys$1);
|
10450 |
|
10451 | |
10452 |
|
10453 |
|
10454 |
|
10455 |
|
10456 |
|
10457 |
|
10458 |
|
10459 |
|
10460 |
|
10461 |
|
10462 | function optimize (root, options) {
|
10463 | if (!root) { return }
|
10464 | isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
10465 | isPlatformReservedTag = options.isReservedTag || no;
|
10466 |
|
10467 | markStatic$1(root);
|
10468 |
|
10469 | markStaticRoots(root, false);
|
10470 | }
|
10471 |
|
10472 | function genStaticKeys$1 (keys) {
|
10473 | return makeMap(
|
10474 | 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
10475 | (keys ? ',' + keys : '')
|
10476 | )
|
10477 | }
|
10478 |
|
10479 | function markStatic$1 (node) {
|
10480 | node.static = isStatic(node);
|
10481 | if (node.type === 1) {
|
10482 |
|
10483 |
|
10484 |
|
10485 | if (
|
10486 | !isPlatformReservedTag(node.tag) &&
|
10487 | node.tag !== 'slot' &&
|
10488 | node.attrsMap['inline-template'] == null
|
10489 | ) {
|
10490 | return
|
10491 | }
|
10492 | for (var i = 0, l = node.children.length; i < l; i++) {
|
10493 | var child = node.children[i];
|
10494 | markStatic$1(child);
|
10495 | if (!child.static) {
|
10496 | node.static = false;
|
10497 | }
|
10498 | }
|
10499 | if (node.ifConditions) {
|
10500 | for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10501 | var block = node.ifConditions[i$1].block;
|
10502 | markStatic$1(block);
|
10503 | if (!block.static) {
|
10504 | node.static = false;
|
10505 | }
|
10506 | }
|
10507 | }
|
10508 | }
|
10509 | }
|
10510 |
|
10511 | function markStaticRoots (node, isInFor) {
|
10512 | if (node.type === 1) {
|
10513 | if (node.static || node.once) {
|
10514 | node.staticInFor = isInFor;
|
10515 | }
|
10516 |
|
10517 |
|
10518 |
|
10519 | if (node.static && node.children.length && !(
|
10520 | node.children.length === 1 &&
|
10521 | node.children[0].type === 3
|
10522 | )) {
|
10523 | node.staticRoot = true;
|
10524 | return
|
10525 | } else {
|
10526 | node.staticRoot = false;
|
10527 | }
|
10528 | if (node.children) {
|
10529 | for (var i = 0, l = node.children.length; i < l; i++) {
|
10530 | markStaticRoots(node.children[i], isInFor || !!node.for);
|
10531 | }
|
10532 | }
|
10533 | if (node.ifConditions) {
|
10534 | for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10535 | markStaticRoots(node.ifConditions[i$1].block, isInFor);
|
10536 | }
|
10537 | }
|
10538 | }
|
10539 | }
|
10540 |
|
10541 | function isStatic (node) {
|
10542 | if (node.type === 2) {
|
10543 | return false
|
10544 | }
|
10545 | if (node.type === 3) {
|
10546 | return true
|
10547 | }
|
10548 | return !!(node.pre || (
|
10549 | !node.hasBindings &&
|
10550 | !node.if && !node.for &&
|
10551 | !isBuiltInTag(node.tag) &&
|
10552 | isPlatformReservedTag(node.tag) &&
|
10553 | !isDirectChildOfTemplateFor(node) &&
|
10554 | Object.keys(node).every(isStaticKey)
|
10555 | ))
|
10556 | }
|
10557 |
|
10558 | function isDirectChildOfTemplateFor (node) {
|
10559 | while (node.parent) {
|
10560 | node = node.parent;
|
10561 | if (node.tag !== 'template') {
|
10562 | return false
|
10563 | }
|
10564 | if (node.for) {
|
10565 | return true
|
10566 | }
|
10567 | }
|
10568 | return false
|
10569 | }
|
10570 |
|
10571 |
|
10572 |
|
10573 | var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
|
10574 | var fnInvokeRE = /\([^)]*?\);*$/;
|
10575 | var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
10576 |
|
10577 |
|
10578 | var keyCodes = {
|
10579 | esc: 27,
|
10580 | tab: 9,
|
10581 | enter: 13,
|
10582 | space: 32,
|
10583 | up: 38,
|
10584 | left: 37,
|
10585 | right: 39,
|
10586 | down: 40,
|
10587 | 'delete': [8, 46]
|
10588 | };
|
10589 |
|
10590 |
|
10591 | var keyNames = {
|
10592 |
|
10593 | esc: ['Esc', 'Escape'],
|
10594 | tab: 'Tab',
|
10595 | enter: 'Enter',
|
10596 |
|
10597 | space: [' ', 'Spacebar'],
|
10598 |
|
10599 | up: ['Up', 'ArrowUp'],
|
10600 | left: ['Left', 'ArrowLeft'],
|
10601 | right: ['Right', 'ArrowRight'],
|
10602 | down: ['Down', 'ArrowDown'],
|
10603 |
|
10604 | 'delete': ['Backspace', 'Delete', 'Del']
|
10605 | };
|
10606 |
|
10607 |
|
10608 |
|
10609 |
|
10610 | var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
|
10611 |
|
10612 | var modifierCode = {
|
10613 | stop: '$event.stopPropagation();',
|
10614 | prevent: '$event.preventDefault();',
|
10615 | self: genGuard("$event.target !== $event.currentTarget"),
|
10616 | ctrl: genGuard("!$event.ctrlKey"),
|
10617 | shift: genGuard("!$event.shiftKey"),
|
10618 | alt: genGuard("!$event.altKey"),
|
10619 | meta: genGuard("!$event.metaKey"),
|
10620 | left: genGuard("'button' in $event && $event.button !== 0"),
|
10621 | middle: genGuard("'button' in $event && $event.button !== 1"),
|
10622 | right: genGuard("'button' in $event && $event.button !== 2")
|
10623 | };
|
10624 |
|
10625 | function genHandlers (
|
10626 | events,
|
10627 | isNative
|
10628 | ) {
|
10629 | var prefix = isNative ? 'nativeOn:' : 'on:';
|
10630 | var staticHandlers = "";
|
10631 | var dynamicHandlers = "";
|
10632 | for (var name in events) {
|
10633 | var handlerCode = genHandler(events[name]);
|
10634 | if (events[name] && events[name].dynamic) {
|
10635 | dynamicHandlers += name + "," + handlerCode + ",";
|
10636 | } else {
|
10637 | staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
10638 | }
|
10639 | }
|
10640 | staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
10641 | if (dynamicHandlers) {
|
10642 | return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
10643 | } else {
|
10644 | return prefix + staticHandlers
|
10645 | }
|
10646 | }
|
10647 |
|
10648 | function genHandler (handler) {
|
10649 | if (!handler) {
|
10650 | return 'function(){}'
|
10651 | }
|
10652 |
|
10653 | if (Array.isArray(handler)) {
|
10654 | return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
10655 | }
|
10656 |
|
10657 | var isMethodPath = simplePathRE.test(handler.value);
|
10658 | var isFunctionExpression = fnExpRE.test(handler.value);
|
10659 | var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
|
10660 |
|
10661 | if (!handler.modifiers) {
|
10662 | if (isMethodPath || isFunctionExpression) {
|
10663 | return handler.value
|
10664 | }
|
10665 | return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}")
|
10666 | } else {
|
10667 | var code = '';
|
10668 | var genModifierCode = '';
|
10669 | var keys = [];
|
10670 | for (var key in handler.modifiers) {
|
10671 | if (modifierCode[key]) {
|
10672 | genModifierCode += modifierCode[key];
|
10673 |
|
10674 | if (keyCodes[key]) {
|
10675 | keys.push(key);
|
10676 | }
|
10677 | } else if (key === 'exact') {
|
10678 | var modifiers = (handler.modifiers);
|
10679 | genModifierCode += genGuard(
|
10680 | ['ctrl', 'shift', 'alt', 'meta']
|
10681 | .filter(function (keyModifier) { return !modifiers[keyModifier]; })
|
10682 | .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
|
10683 | .join('||')
|
10684 | );
|
10685 | } else {
|
10686 | keys.push(key);
|
10687 | }
|
10688 | }
|
10689 | if (keys.length) {
|
10690 | code += genKeyFilter(keys);
|
10691 | }
|
10692 |
|
10693 | if (genModifierCode) {
|
10694 | code += genModifierCode;
|
10695 | }
|
10696 | var handlerCode = isMethodPath
|
10697 | ? ("return " + (handler.value) + "($event)")
|
10698 | : isFunctionExpression
|
10699 | ? ("return (" + (handler.value) + ")($event)")
|
10700 | : isFunctionInvocation
|
10701 | ? ("return " + (handler.value))
|
10702 | : handler.value;
|
10703 | return ("function($event){" + code + handlerCode + "}")
|
10704 | }
|
10705 | }
|
10706 |
|
10707 | function genKeyFilter (keys) {
|
10708 | return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
10709 | }
|
10710 |
|
10711 | function genFilterCode (key) {
|
10712 | var keyVal = parseInt(key, 10);
|
10713 | if (keyVal) {
|
10714 | return ("$event.keyCode!==" + keyVal)
|
10715 | }
|
10716 | var keyCode = keyCodes[key];
|
10717 | var keyName = keyNames[key];
|
10718 | return (
|
10719 | "_k($event.keyCode," +
|
10720 | (JSON.stringify(key)) + "," +
|
10721 | (JSON.stringify(keyCode)) + "," +
|
10722 | "$event.key," +
|
10723 | "" + (JSON.stringify(keyName)) +
|
10724 | ")"
|
10725 | )
|
10726 | }
|
10727 |
|
10728 |
|
10729 |
|
10730 | function on (el, dir) {
|
10731 | if (dir.modifiers) {
|
10732 | warn("v-on without argument does not support modifiers.");
|
10733 | }
|
10734 | el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
|
10735 | }
|
10736 |
|
10737 |
|
10738 |
|
10739 | function bind$1 (el, dir) {
|
10740 | el.wrapData = function (code) {
|
10741 | return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
|
10742 | };
|
10743 | }
|
10744 |
|
10745 |
|
10746 |
|
10747 | var baseDirectives = {
|
10748 | on: on,
|
10749 | bind: bind$1,
|
10750 | cloak: noop
|
10751 | };
|
10752 |
|
10753 |
|
10754 |
|
10755 |
|
10756 |
|
10757 |
|
10758 |
|
10759 | var CodegenState = function CodegenState (options) {
|
10760 | this.options = options;
|
10761 | this.warn = options.warn || baseWarn;
|
10762 | this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
10763 | this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
10764 | this.directives = extend(extend({}, baseDirectives), options.directives);
|
10765 | var isReservedTag = options.isReservedTag || no;
|
10766 | this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
10767 | this.onceId = 0;
|
10768 | this.staticRenderFns = [];
|
10769 | this.pre = false;
|
10770 | };
|
10771 |
|
10772 |
|
10773 |
|
10774 | function generate (
|
10775 | ast,
|
10776 | options
|
10777 | ) {
|
10778 | var state = new CodegenState(options);
|
10779 | var code = ast ? genElement(ast, state) : '_c("div")';
|
10780 | return {
|
10781 | render: ("with(this){return " + code + "}"),
|
10782 | staticRenderFns: state.staticRenderFns
|
10783 | }
|
10784 | }
|
10785 |
|
10786 | function genElement (el, state) {
|
10787 | if (el.parent) {
|
10788 | el.pre = el.pre || el.parent.pre;
|
10789 | }
|
10790 |
|
10791 | if (el.staticRoot && !el.staticProcessed) {
|
10792 | return genStatic(el, state)
|
10793 | } else if (el.once && !el.onceProcessed) {
|
10794 | return genOnce(el, state)
|
10795 | } else if (el.for && !el.forProcessed) {
|
10796 | return genFor(el, state)
|
10797 | } else if (el.if && !el.ifProcessed) {
|
10798 | return genIf(el, state)
|
10799 | } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
10800 | return genChildren(el, state) || 'void 0'
|
10801 | } else if (el.tag === 'slot') {
|
10802 | return genSlot(el, state)
|
10803 | } else {
|
10804 |
|
10805 | var code;
|
10806 | if (el.component) {
|
10807 | code = genComponent(el.component, el, state);
|
10808 | } else {
|
10809 | var data;
|
10810 | if (!el.plain || (el.pre && state.maybeComponent(el))) {
|
10811 | data = genData$2(el, state);
|
10812 | }
|
10813 |
|
10814 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
10815 | code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
10816 | }
|
10817 |
|
10818 | for (var i = 0; i < state.transforms.length; i++) {
|
10819 | code = state.transforms[i](el, code);
|
10820 | }
|
10821 | return code
|
10822 | }
|
10823 | }
|
10824 |
|
10825 |
|
10826 | function genStatic (el, state) {
|
10827 | el.staticProcessed = true;
|
10828 |
|
10829 |
|
10830 |
|
10831 | var originalPreState = state.pre;
|
10832 | if (el.pre) {
|
10833 | state.pre = el.pre;
|
10834 | }
|
10835 | state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
10836 | state.pre = originalPreState;
|
10837 | return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
10838 | }
|
10839 |
|
10840 |
|
10841 | function genOnce (el, state) {
|
10842 | el.onceProcessed = true;
|
10843 | if (el.if && !el.ifProcessed) {
|
10844 | return genIf(el, state)
|
10845 | } else if (el.staticInFor) {
|
10846 | var key = '';
|
10847 | var parent = el.parent;
|
10848 | while (parent) {
|
10849 | if (parent.for) {
|
10850 | key = parent.key;
|
10851 | break
|
10852 | }
|
10853 | parent = parent.parent;
|
10854 | }
|
10855 | if (!key) {
|
10856 | state.warn(
|
10857 | "v-once can only be used inside v-for that is keyed. ",
|
10858 | el.rawAttrsMap['v-once']
|
10859 | );
|
10860 | return genElement(el, state)
|
10861 | }
|
10862 | return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
10863 | } else {
|
10864 | return genStatic(el, state)
|
10865 | }
|
10866 | }
|
10867 |
|
10868 | function genIf (
|
10869 | el,
|
10870 | state,
|
10871 | altGen,
|
10872 | altEmpty
|
10873 | ) {
|
10874 | el.ifProcessed = true;
|
10875 | return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
|
10876 | }
|
10877 |
|
10878 | function genIfConditions (
|
10879 | conditions,
|
10880 | state,
|
10881 | altGen,
|
10882 | altEmpty
|
10883 | ) {
|
10884 | if (!conditions.length) {
|
10885 | return altEmpty || '_e()'
|
10886 | }
|
10887 |
|
10888 | var condition = conditions.shift();
|
10889 | if (condition.exp) {
|
10890 | return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
|
10891 | } else {
|
10892 | return ("" + (genTernaryExp(condition.block)))
|
10893 | }
|
10894 |
|
10895 |
|
10896 | function genTernaryExp (el) {
|
10897 | return altGen
|
10898 | ? altGen(el, state)
|
10899 | : el.once
|
10900 | ? genOnce(el, state)
|
10901 | : genElement(el, state)
|
10902 | }
|
10903 | }
|
10904 |
|
10905 | function genFor (
|
10906 | el,
|
10907 | state,
|
10908 | altGen,
|
10909 | altHelper
|
10910 | ) {
|
10911 | var exp = el.for;
|
10912 | var alias = el.alias;
|
10913 | var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
|
10914 | var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
|
10915 |
|
10916 | if (state.maybeComponent(el) &&
|
10917 | el.tag !== 'slot' &&
|
10918 | el.tag !== 'template' &&
|
10919 | !el.key
|
10920 | ) {
|
10921 | state.warn(
|
10922 | "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
|
10923 | "v-for should have explicit keys. " +
|
10924 | "See https://vuejs.org/guide/list.html#key for more info.",
|
10925 | el.rawAttrsMap['v-for'],
|
10926 | true
|
10927 | );
|
10928 | }
|
10929 |
|
10930 | el.forProcessed = true;
|
10931 | return (altHelper || '_l') + "((" + exp + ")," +
|
10932 | "function(" + alias + iterator1 + iterator2 + "){" +
|
10933 | "return " + ((altGen || genElement)(el, state)) +
|
10934 | '})'
|
10935 | }
|
10936 |
|
10937 | function genData$2 (el, state) {
|
10938 | var data = '{';
|
10939 |
|
10940 |
|
10941 |
|
10942 | var dirs = genDirectives(el, state);
|
10943 | if (dirs) { data += dirs + ','; }
|
10944 |
|
10945 |
|
10946 | if (el.key) {
|
10947 | data += "key:" + (el.key) + ",";
|
10948 | }
|
10949 |
|
10950 | if (el.ref) {
|
10951 | data += "ref:" + (el.ref) + ",";
|
10952 | }
|
10953 | if (el.refInFor) {
|
10954 | data += "refInFor:true,";
|
10955 | }
|
10956 |
|
10957 | if (el.pre) {
|
10958 | data += "pre:true,";
|
10959 | }
|
10960 |
|
10961 | if (el.component) {
|
10962 | data += "tag:\"" + (el.tag) + "\",";
|
10963 | }
|
10964 |
|
10965 | for (var i = 0; i < state.dataGenFns.length; i++) {
|
10966 | data += state.dataGenFns[i](el);
|
10967 | }
|
10968 |
|
10969 | if (el.attrs) {
|
10970 | data += "attrs:" + (genProps(el.attrs)) + ",";
|
10971 | }
|
10972 |
|
10973 | if (el.props) {
|
10974 | data += "domProps:" + (genProps(el.props)) + ",";
|
10975 | }
|
10976 |
|
10977 | if (el.events) {
|
10978 | data += (genHandlers(el.events, false)) + ",";
|
10979 | }
|
10980 | if (el.nativeEvents) {
|
10981 | data += (genHandlers(el.nativeEvents, true)) + ",";
|
10982 | }
|
10983 |
|
10984 |
|
10985 | if (el.slotTarget && !el.slotScope) {
|
10986 | data += "slot:" + (el.slotTarget) + ",";
|
10987 | }
|
10988 |
|
10989 | if (el.scopedSlots) {
|
10990 | data += (genScopedSlots(el.scopedSlots, state)) + ",";
|
10991 | }
|
10992 |
|
10993 | if (el.model) {
|
10994 | data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
10995 | }
|
10996 |
|
10997 | if (el.inlineTemplate) {
|
10998 | var inlineTemplate = genInlineTemplate(el, state);
|
10999 | if (inlineTemplate) {
|
11000 | data += inlineTemplate + ",";
|
11001 | }
|
11002 | }
|
11003 | data = data.replace(/,$/, '') + '}';
|
11004 |
|
11005 |
|
11006 |
|
11007 | if (el.dynamicAttrs) {
|
11008 | data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
11009 | }
|
11010 |
|
11011 | if (el.wrapData) {
|
11012 | data = el.wrapData(data);
|
11013 | }
|
11014 |
|
11015 | if (el.wrapListeners) {
|
11016 | data = el.wrapListeners(data);
|
11017 | }
|
11018 | return data
|
11019 | }
|
11020 |
|
11021 | function genDirectives (el, state) {
|
11022 | var dirs = el.directives;
|
11023 | if (!dirs) { return }
|
11024 | var res = 'directives:[';
|
11025 | var hasRuntime = false;
|
11026 | var i, l, dir, needRuntime;
|
11027 | for (i = 0, l = dirs.length; i < l; i++) {
|
11028 | dir = dirs[i];
|
11029 | needRuntime = true;
|
11030 | var gen = state.directives[dir.name];
|
11031 | if (gen) {
|
11032 |
|
11033 |
|
11034 | needRuntime = !!gen(el, dir, state.warn);
|
11035 | }
|
11036 | if (needRuntime) {
|
11037 | hasRuntime = true;
|
11038 | res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
11039 | }
|
11040 | }
|
11041 | if (hasRuntime) {
|
11042 | return res.slice(0, -1) + ']'
|
11043 | }
|
11044 | }
|
11045 |
|
11046 | function genInlineTemplate (el, state) {
|
11047 | var ast = el.children[0];
|
11048 | if (el.children.length !== 1 || ast.type !== 1) {
|
11049 | state.warn(
|
11050 | 'Inline-template components must have exactly one child element.',
|
11051 | { start: el.start }
|
11052 | );
|
11053 | }
|
11054 | if (ast.type === 1) {
|
11055 | var inlineRenderFns = generate(ast, state.options);
|
11056 | return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
|
11057 | }
|
11058 | }
|
11059 |
|
11060 | function genScopedSlots (
|
11061 | slots,
|
11062 | state
|
11063 | ) {
|
11064 | var hasDynamicKeys = Object.keys(slots).some(function (key) {
|
11065 | var slot = slots[key];
|
11066 | return slot.slotTargetDynamic || slot.if || slot.for
|
11067 | });
|
11068 | return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
11069 | return genScopedSlot(slots[key], state)
|
11070 | }).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
|
11071 | }
|
11072 |
|
11073 | function genScopedSlot (
|
11074 | el,
|
11075 | state
|
11076 | ) {
|
11077 | if (el.if && !el.ifProcessed) {
|
11078 | return genIf(el, state, genScopedSlot, "null")
|
11079 | }
|
11080 | if (el.for && !el.forProcessed) {
|
11081 | return genFor(el, state, genScopedSlot)
|
11082 | }
|
11083 | var fn = "function(" + (String(el.slotScope)) + "){" +
|
11084 | "return " + (el.tag === 'template'
|
11085 | ? genChildren(el, state) || 'undefined'
|
11086 | : genElement(el, state)) + "}";
|
11087 | return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + "}")
|
11088 | }
|
11089 |
|
11090 | function genChildren (
|
11091 | el,
|
11092 | state,
|
11093 | checkSkip,
|
11094 | altGenElement,
|
11095 | altGenNode
|
11096 | ) {
|
11097 | var children = el.children;
|
11098 | if (children.length) {
|
11099 | var el$1 = children[0];
|
11100 |
|
11101 | if (children.length === 1 &&
|
11102 | el$1.for &&
|
11103 | el$1.tag !== 'template' &&
|
11104 | el$1.tag !== 'slot'
|
11105 | ) {
|
11106 | var normalizationType = checkSkip
|
11107 | ? state.maybeComponent(el$1) ? ",1" : ",0"
|
11108 | : "";
|
11109 | return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
|
11110 | }
|
11111 | var normalizationType$1 = checkSkip
|
11112 | ? getNormalizationType(children, state.maybeComponent)
|
11113 | : 0;
|
11114 | var gen = altGenNode || genNode;
|
11115 | return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
|
11116 | }
|
11117 | }
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 | function getNormalizationType (
|
11124 | children,
|
11125 | maybeComponent
|
11126 | ) {
|
11127 | var res = 0;
|
11128 | for (var i = 0; i < children.length; i++) {
|
11129 | var el = children[i];
|
11130 | if (el.type !== 1) {
|
11131 | continue
|
11132 | }
|
11133 | if (needsNormalization(el) ||
|
11134 | (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
11135 | res = 2;
|
11136 | break
|
11137 | }
|
11138 | if (maybeComponent(el) ||
|
11139 | (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
11140 | res = 1;
|
11141 | }
|
11142 | }
|
11143 | return res
|
11144 | }
|
11145 |
|
11146 | function needsNormalization (el) {
|
11147 | return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
11148 | }
|
11149 |
|
11150 | function genNode (node, state) {
|
11151 | if (node.type === 1) {
|
11152 | return genElement(node, state)
|
11153 | } else if (node.type === 3 && node.isComment) {
|
11154 | return genComment(node)
|
11155 | } else {
|
11156 | return genText(node)
|
11157 | }
|
11158 | }
|
11159 |
|
11160 | function genText (text) {
|
11161 | return ("_v(" + (text.type === 2
|
11162 | ? text.expression
|
11163 | : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
11164 | }
|
11165 |
|
11166 | function genComment (comment) {
|
11167 | return ("_e(" + (JSON.stringify(comment.text)) + ")")
|
11168 | }
|
11169 |
|
11170 | function genSlot (el, state) {
|
11171 | var slotName = el.slotName || '"default"';
|
11172 | var children = genChildren(el, state);
|
11173 | var res = "_t(" + slotName + (children ? ("," + children) : '');
|
11174 | var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
|
11175 | var bind$$1 = el.attrsMap['v-bind'];
|
11176 | if ((attrs || bind$$1) && !children) {
|
11177 | res += ",null";
|
11178 | }
|
11179 | if (attrs) {
|
11180 | res += "," + attrs;
|
11181 | }
|
11182 | if (bind$$1) {
|
11183 | res += (attrs ? '' : ',null') + "," + bind$$1;
|
11184 | }
|
11185 | return res + ')'
|
11186 | }
|
11187 |
|
11188 |
|
11189 | function genComponent (
|
11190 | componentName,
|
11191 | el,
|
11192 | state
|
11193 | ) {
|
11194 | var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
11195 | return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
|
11196 | }
|
11197 |
|
11198 | function genProps (props) {
|
11199 | var staticProps = "";
|
11200 | var dynamicProps = "";
|
11201 | for (var i = 0; i < props.length; i++) {
|
11202 | var prop = props[i];
|
11203 | var value = transformSpecialNewlines(prop.value);
|
11204 | if (prop.dynamic) {
|
11205 | dynamicProps += (prop.name) + "," + value + ",";
|
11206 | } else {
|
11207 | staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
11208 | }
|
11209 | }
|
11210 | staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
11211 | if (dynamicProps) {
|
11212 | return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
11213 | } else {
|
11214 | return staticProps
|
11215 | }
|
11216 | }
|
11217 |
|
11218 |
|
11219 | function transformSpecialNewlines (text) {
|
11220 | return text
|
11221 | .replace(/\u2028/g, '\\u2028')
|
11222 | .replace(/\u2029/g, '\\u2029')
|
11223 | }
|
11224 |
|
11225 |
|
11226 |
|
11227 |
|
11228 |
|
11229 |
|
11230 |
|
11231 | var prohibitedKeywordRE = new RegExp('\\b' + (
|
11232 | 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
11233 | 'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
11234 | 'extends,finally,continue,debugger,function,arguments'
|
11235 | ).split(',').join('\\b|\\b') + '\\b');
|
11236 |
|
11237 |
|
11238 | var unaryOperatorsRE = new RegExp('\\b' + (
|
11239 | 'delete,typeof,void'
|
11240 | ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
11241 |
|
11242 |
|
11243 | var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
11244 |
|
11245 |
|
11246 | function detectErrors (ast, warn) {
|
11247 | if (ast) {
|
11248 | checkNode(ast, warn);
|
11249 | }
|
11250 | }
|
11251 |
|
11252 | function checkNode (node, warn) {
|
11253 | if (node.type === 1) {
|
11254 | for (var name in node.attrsMap) {
|
11255 | if (dirRE.test(name)) {
|
11256 | var value = node.attrsMap[name];
|
11257 | if (value) {
|
11258 | var range = node.rawAttrsMap[name];
|
11259 | if (name === 'v-for') {
|
11260 | checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
11261 | } else if (onRE.test(name)) {
|
11262 | checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
11263 | } else {
|
11264 | checkExpression(value, (name + "=\"" + value + "\""), warn, range);
|
11265 | }
|
11266 | }
|
11267 | }
|
11268 | }
|
11269 | if (node.children) {
|
11270 | for (var i = 0; i < node.children.length; i++) {
|
11271 | checkNode(node.children[i], warn);
|
11272 | }
|
11273 | }
|
11274 | } else if (node.type === 2) {
|
11275 | checkExpression(node.expression, node.text, warn, node);
|
11276 | }
|
11277 | }
|
11278 |
|
11279 | function checkEvent (exp, text, warn, range) {
|
11280 | var stipped = exp.replace(stripStringRE, '');
|
11281 | var keywordMatch = stipped.match(unaryOperatorsRE);
|
11282 | if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
11283 | warn(
|
11284 | "avoid using JavaScript unary operator as property name: " +
|
11285 | "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
11286 | range
|
11287 | );
|
11288 | }
|
11289 | checkExpression(exp, text, warn, range);
|
11290 | }
|
11291 |
|
11292 | function checkFor (node, text, warn, range) {
|
11293 | checkExpression(node.for || '', text, warn, range);
|
11294 | checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
11295 | checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
11296 | checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
11297 | }
|
11298 |
|
11299 | function checkIdentifier (
|
11300 | ident,
|
11301 | type,
|
11302 | text,
|
11303 | warn,
|
11304 | range
|
11305 | ) {
|
11306 | if (typeof ident === 'string') {
|
11307 | try {
|
11308 | new Function(("var " + ident + "=_"));
|
11309 | } catch (e) {
|
11310 | warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
|
11311 | }
|
11312 | }
|
11313 | }
|
11314 |
|
11315 | function checkExpression (exp, text, warn, range) {
|
11316 | try {
|
11317 | new Function(("return " + exp));
|
11318 | } catch (e) {
|
11319 | var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
|
11320 | if (keywordMatch) {
|
11321 | warn(
|
11322 | "avoid using JavaScript keyword as property name: " +
|
11323 | "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
|
11324 | range
|
11325 | );
|
11326 | } else {
|
11327 | warn(
|
11328 | "invalid expression: " + (e.message) + " in\n\n" +
|
11329 | " " + exp + "\n\n" +
|
11330 | " Raw expression: " + (text.trim()) + "\n",
|
11331 | range
|
11332 | );
|
11333 | }
|
11334 | }
|
11335 | }
|
11336 |
|
11337 |
|
11338 |
|
11339 | var range = 2;
|
11340 |
|
11341 | function generateCodeFrame (
|
11342 | source,
|
11343 | start,
|
11344 | end
|
11345 | ) {
|
11346 | if ( start === void 0 ) start = 0;
|
11347 | if ( end === void 0 ) end = source.length;
|
11348 |
|
11349 | var lines = source.split(/\r?\n/);
|
11350 | var count = 0;
|
11351 | var res = [];
|
11352 | for (var i = 0; i < lines.length; i++) {
|
11353 | count += lines[i].length + 1;
|
11354 | if (count >= start) {
|
11355 | for (var j = i - range; j <= i + range || end > count; j++) {
|
11356 | if (j < 0 || j >= lines.length) { continue }
|
11357 | res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
|
11358 | var lineLength = lines[j].length;
|
11359 | if (j === i) {
|
11360 |
|
11361 | var pad = start - (count - lineLength) + 1;
|
11362 | var length = end > count ? lineLength - pad : end - start;
|
11363 | res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
|
11364 | } else if (j > i) {
|
11365 | if (end > count) {
|
11366 | var length$1 = Math.min(end - count, lineLength);
|
11367 | res.push(" | " + repeat$1("^", length$1));
|
11368 | }
|
11369 | count += lineLength + 1;
|
11370 | }
|
11371 | }
|
11372 | break
|
11373 | }
|
11374 | }
|
11375 | return res.join('\n')
|
11376 | }
|
11377 |
|
11378 | function repeat$1 (str, n) {
|
11379 | var result = '';
|
11380 | while (true) {
|
11381 | if (n & 1) { result += str; }
|
11382 | n >>>= 1;
|
11383 | if (n <= 0) { break }
|
11384 | str += str;
|
11385 | }
|
11386 | return result
|
11387 | }
|
11388 |
|
11389 |
|
11390 |
|
11391 |
|
11392 |
|
11393 | function createFunction (code, errors) {
|
11394 | try {
|
11395 | return new Function(code)
|
11396 | } catch (err) {
|
11397 | errors.push({ err: err, code: code });
|
11398 | return noop
|
11399 | }
|
11400 | }
|
11401 |
|
11402 | function createCompileToFunctionFn (compile) {
|
11403 | var cache = Object.create(null);
|
11404 |
|
11405 | return function compileToFunctions (
|
11406 | template,
|
11407 | options,
|
11408 | vm
|
11409 | ) {
|
11410 | options = extend({}, options);
|
11411 | var warn$$1 = options.warn || warn;
|
11412 | delete options.warn;
|
11413 |
|
11414 |
|
11415 | {
|
11416 |
|
11417 | try {
|
11418 | new Function('return 1');
|
11419 | } catch (e) {
|
11420 | if (e.toString().match(/unsafe-eval|CSP/)) {
|
11421 | warn$$1(
|
11422 | 'It seems you are using the standalone build of Vue.js in an ' +
|
11423 | 'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
11424 | 'The template compiler cannot work in this environment. Consider ' +
|
11425 | 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
11426 | 'templates into render functions.'
|
11427 | );
|
11428 | }
|
11429 | }
|
11430 | }
|
11431 |
|
11432 |
|
11433 | var key = options.delimiters
|
11434 | ? String(options.delimiters) + template
|
11435 | : template;
|
11436 | if (cache[key]) {
|
11437 | return cache[key]
|
11438 | }
|
11439 |
|
11440 |
|
11441 | var compiled = compile(template, options);
|
11442 |
|
11443 |
|
11444 | {
|
11445 | if (compiled.errors && compiled.errors.length) {
|
11446 | if (options.outputSourceRange) {
|
11447 | compiled.errors.forEach(function (e) {
|
11448 | warn$$1(
|
11449 | "Error compiling template:\n\n" + (e.msg) + "\n\n" +
|
11450 | generateCodeFrame(template, e.start, e.end),
|
11451 | vm
|
11452 | );
|
11453 | });
|
11454 | } else {
|
11455 | warn$$1(
|
11456 | "Error compiling template:\n\n" + template + "\n\n" +
|
11457 | compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
|
11458 | vm
|
11459 | );
|
11460 | }
|
11461 | }
|
11462 | if (compiled.tips && compiled.tips.length) {
|
11463 | if (options.outputSourceRange) {
|
11464 | compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
11465 | } else {
|
11466 | compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
11467 | }
|
11468 | }
|
11469 | }
|
11470 |
|
11471 |
|
11472 | var res = {};
|
11473 | var fnGenErrors = [];
|
11474 | res.render = createFunction(compiled.render, fnGenErrors);
|
11475 | res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
11476 | return createFunction(code, fnGenErrors)
|
11477 | });
|
11478 |
|
11479 |
|
11480 |
|
11481 |
|
11482 |
|
11483 | {
|
11484 | if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
11485 | warn$$1(
|
11486 | "Failed to generate render function:\n\n" +
|
11487 | fnGenErrors.map(function (ref) {
|
11488 | var err = ref.err;
|
11489 | var code = ref.code;
|
11490 |
|
11491 | return ((err.toString()) + " in\n\n" + code + "\n");
|
11492 | }).join('\n'),
|
11493 | vm
|
11494 | );
|
11495 | }
|
11496 | }
|
11497 |
|
11498 | return (cache[key] = res)
|
11499 | }
|
11500 | }
|
11501 |
|
11502 |
|
11503 |
|
11504 | function createCompilerCreator (baseCompile) {
|
11505 | return function createCompiler (baseOptions) {
|
11506 | function compile (
|
11507 | template,
|
11508 | options
|
11509 | ) {
|
11510 | var finalOptions = Object.create(baseOptions);
|
11511 | var errors = [];
|
11512 | var tips = [];
|
11513 |
|
11514 | var warn = function (msg, range, tip) {
|
11515 | (tip ? tips : errors).push(msg);
|
11516 | };
|
11517 |
|
11518 | if (options) {
|
11519 | if (options.outputSourceRange) {
|
11520 |
|
11521 | var leadingSpaceLength = template.match(/^\s*/)[0].length;
|
11522 |
|
11523 | warn = function (msg, range, tip) {
|
11524 | var data = { msg: msg };
|
11525 | if (range) {
|
11526 | if (range.start != null) {
|
11527 | data.start = range.start + leadingSpaceLength;
|
11528 | }
|
11529 | if (range.end != null) {
|
11530 | data.end = range.end + leadingSpaceLength;
|
11531 | }
|
11532 | }
|
11533 | (tip ? tips : errors).push(data);
|
11534 | };
|
11535 | }
|
11536 |
|
11537 | if (options.modules) {
|
11538 | finalOptions.modules =
|
11539 | (baseOptions.modules || []).concat(options.modules);
|
11540 | }
|
11541 |
|
11542 | if (options.directives) {
|
11543 | finalOptions.directives = extend(
|
11544 | Object.create(baseOptions.directives || null),
|
11545 | options.directives
|
11546 | );
|
11547 | }
|
11548 |
|
11549 | for (var key in options) {
|
11550 | if (key !== 'modules' && key !== 'directives') {
|
11551 | finalOptions[key] = options[key];
|
11552 | }
|
11553 | }
|
11554 | }
|
11555 |
|
11556 | finalOptions.warn = warn;
|
11557 |
|
11558 | var compiled = baseCompile(template.trim(), finalOptions);
|
11559 | {
|
11560 | detectErrors(compiled.ast, warn);
|
11561 | }
|
11562 | compiled.errors = errors;
|
11563 | compiled.tips = tips;
|
11564 | return compiled
|
11565 | }
|
11566 |
|
11567 | return {
|
11568 | compile: compile,
|
11569 | compileToFunctions: createCompileToFunctionFn(compile)
|
11570 | }
|
11571 | }
|
11572 | }
|
11573 |
|
11574 |
|
11575 |
|
11576 |
|
11577 |
|
11578 |
|
11579 | var createCompiler = createCompilerCreator(function baseCompile (
|
11580 | template,
|
11581 | options
|
11582 | ) {
|
11583 | var ast = parse(template.trim(), options);
|
11584 | if (options.optimize !== false) {
|
11585 | optimize(ast, options);
|
11586 | }
|
11587 | var code = generate(ast, options);
|
11588 | return {
|
11589 | ast: ast,
|
11590 | render: code.render,
|
11591 | staticRenderFns: code.staticRenderFns
|
11592 | }
|
11593 | });
|
11594 |
|
11595 |
|
11596 |
|
11597 | var ref$1 = createCompiler(baseOptions);
|
11598 | var compile = ref$1.compile;
|
11599 | var compileToFunctions = ref$1.compileToFunctions;
|
11600 |
|
11601 |
|
11602 |
|
11603 |
|
11604 | var div;
|
11605 | function getShouldDecode (href) {
|
11606 | div = div || document.createElement('div');
|
11607 | div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
|
11608 | return div.innerHTML.indexOf(' ') > 0
|
11609 | }
|
11610 |
|
11611 |
|
11612 | var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
|
11613 |
|
11614 | var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
|
11615 |
|
11616 |
|
11617 |
|
11618 | var idToTemplate = cached(function (id) {
|
11619 | var el = query(id);
|
11620 | return el && el.innerHTML
|
11621 | });
|
11622 |
|
11623 | var mount = Vue.prototype.$mount;
|
11624 | Vue.prototype.$mount = function (
|
11625 | el,
|
11626 | hydrating
|
11627 | ) {
|
11628 | el = el && query(el);
|
11629 |
|
11630 |
|
11631 | if (el === document.body || el === document.documentElement) {
|
11632 | warn(
|
11633 | "Do not mount Vue to <html> or <body> - mount to normal elements instead."
|
11634 | );
|
11635 | return this
|
11636 | }
|
11637 |
|
11638 | var options = this.$options;
|
11639 |
|
11640 | if (!options.render) {
|
11641 | var template = options.template;
|
11642 | if (template) {
|
11643 | if (typeof template === 'string') {
|
11644 | if (template.charAt(0) === '#') {
|
11645 | template = idToTemplate(template);
|
11646 |
|
11647 | if (!template) {
|
11648 | warn(
|
11649 | ("Template element not found or is empty: " + (options.template)),
|
11650 | this
|
11651 | );
|
11652 | }
|
11653 | }
|
11654 | } else if (template.nodeType) {
|
11655 | template = template.innerHTML;
|
11656 | } else {
|
11657 | {
|
11658 | warn('invalid template option:' + template, this);
|
11659 | }
|
11660 | return this
|
11661 | }
|
11662 | } else if (el) {
|
11663 | template = getOuterHTML(el);
|
11664 | }
|
11665 | if (template) {
|
11666 |
|
11667 | if (config.performance && mark) {
|
11668 | mark('compile');
|
11669 | }
|
11670 |
|
11671 | var ref = compileToFunctions(template, {
|
11672 | outputSourceRange: "development" !== 'production',
|
11673 | shouldDecodeNewlines: shouldDecodeNewlines,
|
11674 | shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
|
11675 | delimiters: options.delimiters,
|
11676 | comments: options.comments
|
11677 | }, this);
|
11678 | var render = ref.render;
|
11679 | var staticRenderFns = ref.staticRenderFns;
|
11680 | options.render = render;
|
11681 | options.staticRenderFns = staticRenderFns;
|
11682 |
|
11683 |
|
11684 | if (config.performance && mark) {
|
11685 | mark('compile end');
|
11686 | measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
|
11687 | }
|
11688 | }
|
11689 | }
|
11690 | return mount.call(this, el, hydrating)
|
11691 | };
|
11692 |
|
11693 | |
11694 |
|
11695 |
|
11696 |
|
11697 | function getOuterHTML (el) {
|
11698 | if (el.outerHTML) {
|
11699 | return el.outerHTML
|
11700 | } else {
|
11701 | var container = document.createElement('div');
|
11702 | container.appendChild(el.cloneNode(true));
|
11703 | return container.innerHTML
|
11704 | }
|
11705 | }
|
11706 |
|
11707 | Vue.compile = compileToFunctions;
|
11708 |
|
11709 | return Vue;
|
11710 |
|
11711 | }));
|