vue 3.5.39 → 3.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.cjs.js +1 -1
- package/dist/vue.cjs.prod.js +1 -1
- package/dist/vue.esm-browser.js +199 -68
- package/dist/vue.esm-browser.prod.js +9 -8
- package/dist/vue.esm-bundler.js +1 -1
- package/dist/vue.global.js +199 -68
- package/dist/vue.global.prod.js +10 -9
- package/dist/vue.runtime.esm-browser.js +142 -53
- package/dist/vue.runtime.esm-browser.prod.js +4 -3
- package/dist/vue.runtime.esm-bundler.js +1 -1
- package/dist/vue.runtime.global.js +142 -53
- package/dist/vue.runtime.global.prod.js +4 -3
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vue v3.5.
|
|
2
|
+
* vue v3.5.41
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -194,7 +194,7 @@ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
|
|
194
194
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
195
195
|
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
|
196
196
|
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
|
197
|
-
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,
|
|
197
|
+
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
|
198
198
|
);
|
|
199
199
|
function includeBooleanAttr(value) {
|
|
200
200
|
return !!value || value === "";
|
|
@@ -376,8 +376,9 @@ class EffectScope {
|
|
|
376
376
|
this._isPaused = true;
|
|
377
377
|
let i, l;
|
|
378
378
|
if (this.scopes) {
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
const scopes = this.scopes.slice();
|
|
380
|
+
for (i = 0, l = scopes.length; i < l; i++) {
|
|
381
|
+
scopes[i].pause();
|
|
381
382
|
}
|
|
382
383
|
}
|
|
383
384
|
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
@@ -394,12 +395,14 @@ class EffectScope {
|
|
|
394
395
|
this._isPaused = false;
|
|
395
396
|
let i, l;
|
|
396
397
|
if (this.scopes) {
|
|
397
|
-
|
|
398
|
-
|
|
398
|
+
const scopes = this.scopes.slice();
|
|
399
|
+
for (i = 0, l = scopes.length; i < l; i++) {
|
|
400
|
+
scopes[i].resume();
|
|
399
401
|
}
|
|
400
402
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
+
const effects = this.effects.slice();
|
|
404
|
+
for (i = 0, l = effects.length; i < l; i++) {
|
|
405
|
+
effects[i].resume();
|
|
403
406
|
}
|
|
404
407
|
}
|
|
405
408
|
}
|
|
@@ -461,8 +464,9 @@ class EffectScope {
|
|
|
461
464
|
}
|
|
462
465
|
this.cleanups.length = 0;
|
|
463
466
|
if (this.scopes) {
|
|
464
|
-
|
|
465
|
-
|
|
467
|
+
const scopes = this.scopes.slice();
|
|
468
|
+
for (i = 0, l = scopes.length; i < l; i++) {
|
|
469
|
+
scopes[i].stop(true);
|
|
466
470
|
}
|
|
467
471
|
this.scopes.length = 0;
|
|
468
472
|
}
|
|
@@ -2593,7 +2597,9 @@ function queuePostFlushCb(cb) {
|
|
|
2593
2597
|
cb.flags |= 1;
|
|
2594
2598
|
}
|
|
2595
2599
|
} else {
|
|
2596
|
-
|
|
2600
|
+
for (let i = 0; i < cb.length; i++) {
|
|
2601
|
+
pendingPostFlushCbs.push(cb[i]);
|
|
2602
|
+
}
|
|
2597
2603
|
}
|
|
2598
2604
|
queueFlush();
|
|
2599
2605
|
}
|
|
@@ -2629,7 +2635,9 @@ function flushPostFlushCbs(seen) {
|
|
|
2629
2635
|
);
|
|
2630
2636
|
pendingPostFlushCbs.length = 0;
|
|
2631
2637
|
if (activePostFlushCbs) {
|
|
2632
|
-
|
|
2638
|
+
for (let i = 0; i < deduped.length; i++) {
|
|
2639
|
+
activePostFlushCbs.push(deduped[i]);
|
|
2640
|
+
}
|
|
2633
2641
|
return;
|
|
2634
2642
|
}
|
|
2635
2643
|
activePostFlushCbs = deduped;
|
|
@@ -2959,10 +2967,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
2959
2967
|
setBlockTracking(-1);
|
|
2960
2968
|
}
|
|
2961
2969
|
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
2970
|
+
const prevStackSize = blockStack.length;
|
|
2962
2971
|
let res;
|
|
2963
2972
|
try {
|
|
2964
2973
|
res = fn(...args);
|
|
2965
2974
|
} finally {
|
|
2975
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2966
2976
|
setCurrentRenderingInstance(prevInstance);
|
|
2967
2977
|
if (renderFnWithContext._d) {
|
|
2968
2978
|
setBlockTracking(1);
|
|
@@ -3916,7 +3926,11 @@ function getInnerChild$1(vnode) {
|
|
|
3916
3926
|
function setTransitionHooks(vnode, hooks) {
|
|
3917
3927
|
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
3918
3928
|
vnode.transition = hooks;
|
|
3919
|
-
|
|
3929
|
+
const subTree = vnode.component.subTree;
|
|
3930
|
+
setTransitionHooks(
|
|
3931
|
+
isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree,
|
|
3932
|
+
hooks
|
|
3933
|
+
);
|
|
3920
3934
|
} else if (vnode.shapeFlag & 128) {
|
|
3921
3935
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
3922
3936
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
@@ -4076,12 +4090,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4076
4090
|
}
|
|
4077
4091
|
}
|
|
4078
4092
|
if (isFunction(ref)) {
|
|
4079
|
-
|
|
4080
|
-
try {
|
|
4081
|
-
callWithErrorHandling(ref, owner, 12, [value, refs]);
|
|
4082
|
-
} finally {
|
|
4083
|
-
resetTracking();
|
|
4084
|
-
}
|
|
4093
|
+
callWithErrorHandling(ref, owner, 12, [value, refs]);
|
|
4085
4094
|
} else {
|
|
4086
4095
|
const _isString = isString(ref);
|
|
4087
4096
|
const _isRef = isRef(ref);
|
|
@@ -4452,6 +4461,7 @@ Server rendered element contains more child nodes than client vdom.`
|
|
|
4452
4461
|
if (props) {
|
|
4453
4462
|
{
|
|
4454
4463
|
const isCustomElement = el.tagName.includes("-");
|
|
4464
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
4455
4465
|
for (const key in props) {
|
|
4456
4466
|
if (// #11189 skip if this node has directives that have created hooks
|
|
4457
4467
|
// as it could have mutated the DOM in any possible way
|
|
@@ -4460,7 +4470,10 @@ Server rendered element contains more child nodes than client vdom.`
|
|
|
4460
4470
|
}
|
|
4461
4471
|
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
|
|
4462
4472
|
key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
|
|
4463
|
-
|
|
4473
|
+
if (isUnchangedResourceProp(el, key, props[key])) {
|
|
4474
|
+
continue;
|
|
4475
|
+
}
|
|
4476
|
+
patchProp(el, key, null, props[key], namespace, parentComponent);
|
|
4464
4477
|
}
|
|
4465
4478
|
}
|
|
4466
4479
|
}
|
|
@@ -4642,6 +4655,13 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
4642
4655
|
};
|
|
4643
4656
|
return [hydrate, hydrateNode];
|
|
4644
4657
|
}
|
|
4658
|
+
const resourceProps = /* @__PURE__ */ new Set(["src", "srcset", "href", "poster"]);
|
|
4659
|
+
function isUnchangedResourceProp(el, key, clientValue) {
|
|
4660
|
+
if (!resourceProps.has(key)) {
|
|
4661
|
+
return false;
|
|
4662
|
+
}
|
|
4663
|
+
return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
|
|
4664
|
+
}
|
|
4645
4665
|
function propHasMismatch(el, key, clientValue, vnode, instance) {
|
|
4646
4666
|
let mismatchType;
|
|
4647
4667
|
let mismatchKey;
|
|
@@ -4679,7 +4699,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
|
|
|
4679
4699
|
mismatchKey = "style";
|
|
4680
4700
|
}
|
|
4681
4701
|
} else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
|
|
4682
|
-
if (
|
|
4702
|
+
if (key === "hidden") {
|
|
4703
|
+
actual = normalizeHiddenValue(el.getAttribute(key));
|
|
4704
|
+
expected = normalizeHiddenValue(clientValue);
|
|
4705
|
+
} else if (isBooleanAttr(key)) {
|
|
4683
4706
|
actual = el.hasAttribute(key);
|
|
4684
4707
|
expected = includeBooleanAttr(clientValue);
|
|
4685
4708
|
} else if (clientValue == null) {
|
|
@@ -4715,6 +4738,15 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
|
|
|
4715
4738
|
}
|
|
4716
4739
|
return false;
|
|
4717
4740
|
}
|
|
4741
|
+
function normalizeHiddenValue(value) {
|
|
4742
|
+
if (!isRenderableAttrValue(value)) {
|
|
4743
|
+
return false;
|
|
4744
|
+
}
|
|
4745
|
+
if (isString(value)) {
|
|
4746
|
+
return value.toLowerCase() === "until-found" ? "until-found" : "";
|
|
4747
|
+
}
|
|
4748
|
+
return includeBooleanAttr(value) ? "" : false;
|
|
4749
|
+
}
|
|
4718
4750
|
function toClassSet(str) {
|
|
4719
4751
|
return new Set(str.trim().split(/\s+/));
|
|
4720
4752
|
}
|
|
@@ -4963,6 +4995,7 @@ function defineAsyncComponent(source) {
|
|
|
4963
4995
|
name: "AsyncComponentWrapper",
|
|
4964
4996
|
__asyncLoader: load,
|
|
4965
4997
|
__asyncHydrate(el, instance, hydrate) {
|
|
4998
|
+
const wasConnected = el.isConnected;
|
|
4966
4999
|
let patched = false;
|
|
4967
5000
|
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
4968
5001
|
const performHydrate = () => {
|
|
@@ -4974,6 +5007,7 @@ function defineAsyncComponent(source) {
|
|
|
4974
5007
|
}
|
|
4975
5008
|
return;
|
|
4976
5009
|
}
|
|
5010
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
4977
5011
|
hydrate();
|
|
4978
5012
|
};
|
|
4979
5013
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -5532,14 +5566,16 @@ function createSlots(slots, dynamicSlots) {
|
|
|
5532
5566
|
return slots;
|
|
5533
5567
|
}
|
|
5534
5568
|
|
|
5535
|
-
function renderSlot(slots, name, props
|
|
5569
|
+
function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
|
|
5570
|
+
if (props == null) props = {};
|
|
5536
5571
|
if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
|
|
5537
|
-
const
|
|
5538
|
-
|
|
5572
|
+
const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
|
|
5573
|
+
const hasProps = Object.keys(slotProps).length > 0;
|
|
5574
|
+
if (name !== "default") slotProps.name = name;
|
|
5539
5575
|
return openBlock(), createBlock(
|
|
5540
5576
|
Fragment,
|
|
5541
5577
|
null,
|
|
5542
|
-
[createVNode("slot",
|
|
5578
|
+
[createVNode("slot", slotProps, fallback && fallback())],
|
|
5543
5579
|
hasProps ? -2 : 64
|
|
5544
5580
|
);
|
|
5545
5581
|
}
|
|
@@ -5553,26 +5589,34 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
5553
5589
|
if (slot && slot._c) {
|
|
5554
5590
|
slot._d = false;
|
|
5555
5591
|
}
|
|
5592
|
+
const prevStackSize = blockStack.length;
|
|
5556
5593
|
openBlock();
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5594
|
+
let rendered;
|
|
5595
|
+
try {
|
|
5596
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
5597
|
+
const slotKey = props.key || branchKey || // slot content array of a dynamic conditional slot may have a branch
|
|
5598
|
+
// key attached in the `createSlots` helper, respect that
|
|
5599
|
+
validSlotContent && validSlotContent.key;
|
|
5600
|
+
rendered = createBlock(
|
|
5601
|
+
Fragment,
|
|
5602
|
+
{
|
|
5603
|
+
key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content
|
|
5604
|
+
(!validSlotContent && fallback ? "_fb" : "")
|
|
5605
|
+
},
|
|
5606
|
+
validSlotContent || (fallback ? fallback() : []),
|
|
5607
|
+
validSlotContent && slots._ === 1 ? 64 : -2
|
|
5608
|
+
);
|
|
5609
|
+
} catch (err) {
|
|
5610
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
5611
|
+
throw err;
|
|
5612
|
+
} finally {
|
|
5613
|
+
if (slot && slot._c) {
|
|
5614
|
+
slot._d = true;
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
5570
5617
|
if (!noSlotted && rendered.scopeId) {
|
|
5571
5618
|
rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
5572
5619
|
}
|
|
5573
|
-
if (slot && slot._c) {
|
|
5574
|
-
slot._d = true;
|
|
5575
|
-
}
|
|
5576
5620
|
return rendered;
|
|
5577
5621
|
}
|
|
5578
5622
|
function ensureValidVNode(vnodes) {
|
|
@@ -6947,12 +6991,13 @@ function renderComponentRoot(instance) {
|
|
|
6947
6991
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
6948
6992
|
}
|
|
6949
6993
|
if (vnode.transition) {
|
|
6950
|
-
|
|
6994
|
+
const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
|
|
6995
|
+
if (!isElementRoot(child)) {
|
|
6951
6996
|
warn$1(
|
|
6952
6997
|
`Component inside <Transition> renders non-element root node that cannot be animated.`
|
|
6953
6998
|
);
|
|
6954
6999
|
}
|
|
6955
|
-
setTransitionHooks(
|
|
7000
|
+
setTransitionHooks(child, vnode.transition);
|
|
6956
7001
|
}
|
|
6957
7002
|
if (setRoot) {
|
|
6958
7003
|
setRoot(root);
|
|
@@ -9600,7 +9645,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
9600
9645
|
let hasUnresolvedAncestor = false;
|
|
9601
9646
|
while (parent) {
|
|
9602
9647
|
if (parent.pendingBranch) {
|
|
9603
|
-
|
|
9648
|
+
for (let i = 0; i < effects.length; i++) {
|
|
9649
|
+
parent.effects.push(effects[i]);
|
|
9650
|
+
}
|
|
9604
9651
|
hasUnresolvedAncestor = true;
|
|
9605
9652
|
break;
|
|
9606
9653
|
}
|
|
@@ -9965,6 +10012,14 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
9965
10012
|
if (vnode.key !== vnode.key) {
|
|
9966
10013
|
warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
9967
10014
|
}
|
|
10015
|
+
if (props && vnode.shapeFlag & 1) {
|
|
10016
|
+
const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
|
|
10017
|
+
if (overwritingProp && hasContentChildren(vnode.children)) {
|
|
10018
|
+
warn$1(
|
|
10019
|
+
`The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`
|
|
10020
|
+
);
|
|
10021
|
+
}
|
|
10022
|
+
}
|
|
9968
10023
|
if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
|
|
9969
10024
|
!isBlockNode && // has current parent block
|
|
9970
10025
|
currentBlock && // presence of a patch flag indicates this node needs patching on updates.
|
|
@@ -9978,6 +10033,11 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
9978
10033
|
}
|
|
9979
10034
|
return vnode;
|
|
9980
10035
|
}
|
|
10036
|
+
function hasContentChildren(children) {
|
|
10037
|
+
if (isString(children)) return children !== "";
|
|
10038
|
+
if (isArray(children)) return children.length > 0;
|
|
10039
|
+
return false;
|
|
10040
|
+
}
|
|
9981
10041
|
const createVNode = createVNodeWithArgsTransform ;
|
|
9982
10042
|
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
9983
10043
|
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
@@ -10426,7 +10486,12 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10426
10486
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
10427
10487
|
if (isSSR) {
|
|
10428
10488
|
return setupResult.then((resolvedResult) => {
|
|
10429
|
-
|
|
10489
|
+
setInSSRSetupState(true);
|
|
10490
|
+
try {
|
|
10491
|
+
handleSetupResult(instance, resolvedResult, isSSR);
|
|
10492
|
+
} finally {
|
|
10493
|
+
setInSSRSetupState(false);
|
|
10494
|
+
}
|
|
10430
10495
|
}).catch((e) => {
|
|
10431
10496
|
handleError(e, instance, 0);
|
|
10432
10497
|
});
|
|
@@ -10892,7 +10957,7 @@ function isMemoSame(cached, memo) {
|
|
|
10892
10957
|
return true;
|
|
10893
10958
|
}
|
|
10894
10959
|
|
|
10895
|
-
const version = "3.5.
|
|
10960
|
+
const version = "3.5.41";
|
|
10896
10961
|
const warn = warn$1 ;
|
|
10897
10962
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10898
10963
|
const devtools = devtools$1 ;
|
|
@@ -11862,7 +11927,9 @@ class VueElement extends BaseClass {
|
|
|
11862
11927
|
if (parent && parent._pendingResolve) {
|
|
11863
11928
|
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
11864
11929
|
this._pendingResolve = void 0;
|
|
11865
|
-
this.
|
|
11930
|
+
if (this.isConnected) {
|
|
11931
|
+
return this._resolveDef();
|
|
11932
|
+
}
|
|
11866
11933
|
});
|
|
11867
11934
|
} else {
|
|
11868
11935
|
this._resolveDef();
|
|
@@ -11912,7 +11979,7 @@ class VueElement extends BaseClass {
|
|
|
11912
11979
|
*/
|
|
11913
11980
|
_resolveDef() {
|
|
11914
11981
|
if (this._pendingResolve) {
|
|
11915
|
-
return;
|
|
11982
|
+
return this._pendingResolve;
|
|
11916
11983
|
}
|
|
11917
11984
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
11918
11985
|
this._setAttr(this.attributes[i].name);
|
|
@@ -11952,6 +12019,7 @@ class VueElement extends BaseClass {
|
|
|
11952
12019
|
def.configureApp = this._def.configureApp;
|
|
11953
12020
|
resolve(this._def = def, true);
|
|
11954
12021
|
});
|
|
12022
|
+
return this._pendingResolve;
|
|
11955
12023
|
} else {
|
|
11956
12024
|
resolve(this._def);
|
|
11957
12025
|
}
|
|
@@ -11989,6 +12057,11 @@ class VueElement extends BaseClass {
|
|
|
11989
12057
|
}
|
|
11990
12058
|
}
|
|
11991
12059
|
for (const key of declaredPropKeys.map(camelize)) {
|
|
12060
|
+
if (key in Object.getPrototypeOf(this)) {
|
|
12061
|
+
warn(
|
|
12062
|
+
`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
|
|
12063
|
+
);
|
|
12064
|
+
}
|
|
11992
12065
|
Object.defineProperty(this, key, {
|
|
11993
12066
|
get() {
|
|
11994
12067
|
return this._getProp(key);
|
|
@@ -12473,6 +12546,7 @@ function onCompositionEnd(e) {
|
|
|
12473
12546
|
}
|
|
12474
12547
|
}
|
|
12475
12548
|
const assignKey = /* @__PURE__ */ Symbol("_assign");
|
|
12549
|
+
const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
|
|
12476
12550
|
function castValue(value, trim, number) {
|
|
12477
12551
|
if (trim) value = value.trim();
|
|
12478
12552
|
if (number) value = looseToNumber(value);
|
|
@@ -12480,6 +12554,13 @@ function castValue(value, trim, number) {
|
|
|
12480
12554
|
}
|
|
12481
12555
|
const vModelText = {
|
|
12482
12556
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
12557
|
+
if (el.parentNode) {
|
|
12558
|
+
if (el.type === "text") {
|
|
12559
|
+
el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
|
|
12560
|
+
} else if (el.type === "textarea") {
|
|
12561
|
+
el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
|
|
12562
|
+
}
|
|
12563
|
+
}
|
|
12483
12564
|
el[assignKey] = getModelAssigner(vnode);
|
|
12484
12565
|
const castToNumber = number || vnode.props && vnode.props.type === "number";
|
|
12485
12566
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
@@ -12498,8 +12579,15 @@ const vModelText = {
|
|
|
12498
12579
|
}
|
|
12499
12580
|
},
|
|
12500
12581
|
// set value on mounted so it's after min/max for type="range"
|
|
12501
|
-
mounted(el, { value }) {
|
|
12502
|
-
|
|
12582
|
+
mounted(el, { value, modifiers: { trim, number } }) {
|
|
12583
|
+
const newValue = value == null ? "" : value;
|
|
12584
|
+
const initialValue = el[initialValueKey];
|
|
12585
|
+
delete el[initialValueKey];
|
|
12586
|
+
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
|
|
12587
|
+
el[assignKey](castValue(el.value, trim, number));
|
|
12588
|
+
} else {
|
|
12589
|
+
el.value = newValue;
|
|
12590
|
+
}
|
|
12503
12591
|
},
|
|
12504
12592
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
12505
12593
|
el[assignKey] = getModelAssigner(vnode);
|
|
@@ -12595,13 +12683,13 @@ const vModelSelect = {
|
|
|
12595
12683
|
// <select multiple> value need to be deep traversed
|
|
12596
12684
|
deep: true,
|
|
12597
12685
|
created(el, { value, modifiers: { number } }, vnode) {
|
|
12598
|
-
|
|
12686
|
+
el._modelValue = value;
|
|
12599
12687
|
addEventListener(el, "change", () => {
|
|
12600
12688
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
12601
12689
|
(o) => number ? looseToNumber(getValue(o)) : getValue(o)
|
|
12602
12690
|
);
|
|
12603
12691
|
el[assignKey](
|
|
12604
|
-
el.multiple ?
|
|
12692
|
+
el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]
|
|
12605
12693
|
);
|
|
12606
12694
|
el._assigning = true;
|
|
12607
12695
|
nextTick(() => {
|
|
@@ -12615,7 +12703,8 @@ const vModelSelect = {
|
|
|
12615
12703
|
mounted(el, { value }) {
|
|
12616
12704
|
setSelected(el, value);
|
|
12617
12705
|
},
|
|
12618
|
-
beforeUpdate(el,
|
|
12706
|
+
beforeUpdate(el, { value }, vnode) {
|
|
12707
|
+
el._modelValue = value;
|
|
12619
12708
|
el[assignKey] = getModelAssigner(vnode);
|
|
12620
12709
|
},
|
|
12621
12710
|
updated(el, { value }) {
|