vant 4.0.1 → 4.0.2
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/es/composables/use-height.mjs +3 -1
- package/es/field/Field.mjs +11 -7
- package/es/image/Image.mjs +12 -3
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/utils/mount-component.mjs +1 -1
- package/lib/composables/use-height.js +2 -0
- package/lib/field/Field.js +11 -7
- package/lib/image/Image.js +11 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/mount-component.js +2 -2
- package/lib/vant.cjs.js +24 -10
- package/lib/vant.es.js +24 -10
- package/lib/vant.js +24 -10
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
import { useRect } from "@vant/use";
|
2
|
-
import { ref, onMounted, nextTick } from "vue";
|
2
|
+
import { ref, onMounted, nextTick, watch } from "vue";
|
3
|
+
import { windowHeight, windowWidth } from "../utils/index.mjs";
|
3
4
|
import { onPopupReopen } from "./on-popup-reopen.mjs";
|
4
5
|
const useHeight = (element, withSafeArea) => {
|
5
6
|
const height = ref();
|
@@ -15,6 +16,7 @@ const useHeight = (element, withSafeArea) => {
|
|
15
16
|
}
|
16
17
|
});
|
17
18
|
onPopupReopen(() => nextTick(setHeight));
|
19
|
+
watch([windowWidth, windowHeight], setHeight);
|
18
20
|
return height;
|
19
21
|
};
|
20
22
|
export {
|
package/es/field/Field.mjs
CHANGED
@@ -192,7 +192,9 @@ var stdin_default = defineComponent({
|
|
192
192
|
return value;
|
193
193
|
};
|
194
194
|
const updateValue = (value, trigger = "onChange") => {
|
195
|
+
const originalValue = value;
|
195
196
|
value = limitValueLength(value);
|
197
|
+
const isExceedLimit = value !== originalValue;
|
196
198
|
if (props.type === "number" || props.type === "digit") {
|
197
199
|
const isNumber = props.type === "number";
|
198
200
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -201,13 +203,15 @@ var stdin_default = defineComponent({
|
|
201
203
|
value = props.formatter(value);
|
202
204
|
}
|
203
205
|
if (inputRef.value && inputRef.value.value !== value) {
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
|
206
|
+
if (state.focused && isExceedLimit) {
|
207
|
+
const {
|
208
|
+
selectionStart,
|
209
|
+
selectionEnd
|
210
|
+
} = inputRef.value;
|
211
|
+
inputRef.value.value = value;
|
212
|
+
inputRef.value.setSelectionRange(selectionStart - 1, selectionEnd - 1);
|
213
|
+
} else {
|
214
|
+
inputRef.value.value = value;
|
211
215
|
}
|
212
216
|
}
|
213
217
|
if (value !== props.modelValue) {
|
package/es/image/Image.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { withDirectives as _withDirectives, mergeProps as _mergeProps, resolveDirective as _resolveDirective, createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, computed, nextTick, onBeforeUnmount, defineComponent, getCurrentInstance } from "vue";
|
2
|
+
import { ref, watch, computed, nextTick, onMounted, onBeforeUnmount, defineComponent, getCurrentInstance } from "vue";
|
3
3
|
import { isDef, addUnit, inBrowser, truthProp, numericProp, makeStringProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { Icon } from "../icon/index.mjs";
|
5
5
|
const [name, bem] = createNamespace("image");
|
@@ -51,8 +51,10 @@ var stdin_default = defineComponent({
|
|
51
51
|
loading.value = true;
|
52
52
|
});
|
53
53
|
const onLoad = (event) => {
|
54
|
-
loading.value
|
55
|
-
|
54
|
+
if (loading.value) {
|
55
|
+
loading.value = false;
|
56
|
+
emit("load", event);
|
57
|
+
}
|
56
58
|
};
|
57
59
|
const onError = (event) => {
|
58
60
|
error.value = true;
|
@@ -100,6 +102,7 @@ var stdin_default = defineComponent({
|
|
100
102
|
}, attrs), null), [[_resolveDirective("lazy"), props.src]]);
|
101
103
|
}
|
102
104
|
return _createVNode("img", _mergeProps({
|
105
|
+
"ref": imageRef,
|
103
106
|
"src": props.src,
|
104
107
|
"onLoad": onLoad,
|
105
108
|
"onError": onError
|
@@ -134,6 +137,12 @@ var stdin_default = defineComponent({
|
|
134
137
|
$Lazyload.$off("error", onLazyLoadError);
|
135
138
|
});
|
136
139
|
}
|
140
|
+
onMounted(() => {
|
141
|
+
var _a;
|
142
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
143
|
+
onLoad();
|
144
|
+
}
|
145
|
+
});
|
137
146
|
return () => {
|
138
147
|
var _a;
|
139
148
|
return _createVNode("div", {
|
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -87,7 +87,7 @@ import { TimePicker } from "./time-picker/index.mjs";
|
|
87
87
|
import { Toast } from "./toast/index.mjs";
|
88
88
|
import { TreeSelect } from "./tree-select/index.mjs";
|
89
89
|
import { Uploader } from "./uploader/index.mjs";
|
90
|
-
const version = "4.0.
|
90
|
+
const version = "4.0.2";
|
91
91
|
function install(app) {
|
92
92
|
const components = [
|
93
93
|
ActionBar,
|
@@ -22,6 +22,7 @@ __export(stdin_exports, {
|
|
22
22
|
module.exports = __toCommonJS(stdin_exports);
|
23
23
|
var import_use = require("@vant/use");
|
24
24
|
var import_vue = require("vue");
|
25
|
+
var import_utils = require("../utils");
|
25
26
|
var import_on_popup_reopen = require("./on-popup-reopen");
|
26
27
|
const useHeight = (element, withSafeArea) => {
|
27
28
|
const height = (0, import_vue.ref)();
|
@@ -37,5 +38,6 @@ const useHeight = (element, withSafeArea) => {
|
|
37
38
|
}
|
38
39
|
});
|
39
40
|
(0, import_on_popup_reopen.onPopupReopen)(() => (0, import_vue.nextTick)(setHeight));
|
41
|
+
(0, import_vue.watch)([import_utils.windowWidth, import_utils.windowHeight], setHeight);
|
40
42
|
return height;
|
41
43
|
};
|
package/lib/field/Field.js
CHANGED
@@ -216,7 +216,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
216
216
|
return value;
|
217
217
|
};
|
218
218
|
const updateValue = (value, trigger = "onChange") => {
|
219
|
+
const originalValue = value;
|
219
220
|
value = limitValueLength(value);
|
221
|
+
const isExceedLimit = value !== originalValue;
|
220
222
|
if (props.type === "number" || props.type === "digit") {
|
221
223
|
const isNumber = props.type === "number";
|
222
224
|
value = (0, import_utils.formatNumber)(value, isNumber, isNumber);
|
@@ -225,13 +227,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
225
227
|
value = props.formatter(value);
|
226
228
|
}
|
227
229
|
if (inputRef.value && inputRef.value.value !== value) {
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
|
230
|
+
if (state.focused && isExceedLimit) {
|
231
|
+
const {
|
232
|
+
selectionStart,
|
233
|
+
selectionEnd
|
234
|
+
} = inputRef.value;
|
235
|
+
inputRef.value.value = value;
|
236
|
+
inputRef.value.setSelectionRange(selectionStart - 1, selectionEnd - 1);
|
237
|
+
} else {
|
238
|
+
inputRef.value.value = value;
|
235
239
|
}
|
236
240
|
}
|
237
241
|
if (value !== props.modelValue) {
|
package/lib/image/Image.js
CHANGED
@@ -74,8 +74,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
74
74
|
loading.value = true;
|
75
75
|
});
|
76
76
|
const onLoad = (event) => {
|
77
|
-
loading.value
|
78
|
-
|
77
|
+
if (loading.value) {
|
78
|
+
loading.value = false;
|
79
|
+
emit("load", event);
|
80
|
+
}
|
79
81
|
};
|
80
82
|
const onError = (event) => {
|
81
83
|
error.value = true;
|
@@ -123,6 +125,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
123
125
|
}, attrs), null), [[(0, import_vue.resolveDirective)("lazy"), props.src]]);
|
124
126
|
}
|
125
127
|
return (0, import_vue.createVNode)("img", (0, import_vue.mergeProps)({
|
128
|
+
"ref": imageRef,
|
126
129
|
"src": props.src,
|
127
130
|
"onLoad": onLoad,
|
128
131
|
"onError": onError
|
@@ -157,6 +160,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
157
160
|
$Lazyload.$off("error", onLazyLoadError);
|
158
161
|
});
|
159
162
|
}
|
163
|
+
(0, import_vue2.onMounted)(() => {
|
164
|
+
var _a;
|
165
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
166
|
+
onLoad();
|
167
|
+
}
|
168
|
+
});
|
160
169
|
return () => {
|
161
170
|
var _a;
|
162
171
|
return (0, import_vue.createVNode)("div", {
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -202,7 +202,7 @@ __reExport(stdin_exports, require("./time-picker"), module.exports);
|
|
202
202
|
__reExport(stdin_exports, require("./toast"), module.exports);
|
203
203
|
__reExport(stdin_exports, require("./tree-select"), module.exports);
|
204
204
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
205
|
-
const version = "4.0.
|
205
|
+
const version = "4.0.2";
|
206
206
|
function install(app) {
|
207
207
|
const components = [
|
208
208
|
import_action_bar.ActionBar,
|
@@ -22,7 +22,7 @@ __export(stdin_exports, {
|
|
22
22
|
});
|
23
23
|
module.exports = __toCommonJS(stdin_exports);
|
24
24
|
var import_vue = require("vue");
|
25
|
-
var
|
25
|
+
var import_basic = require("./basic");
|
26
26
|
var import_use_expose = require("../composables/use-expose");
|
27
27
|
function usePopupState() {
|
28
28
|
const state = (0, import_vue.reactive)({
|
@@ -32,7 +32,7 @@ function usePopupState() {
|
|
32
32
|
state.show = show;
|
33
33
|
};
|
34
34
|
const open = (props) => {
|
35
|
-
(0,
|
35
|
+
(0, import_basic.extend)(state, props, { transitionAppear: true });
|
36
36
|
toggle(true);
|
37
37
|
};
|
38
38
|
const close = () => toggle(false);
|
package/lib/vant.cjs.js
CHANGED
@@ -428,6 +428,7 @@ const useHeight = (element, withSafeArea) => {
|
|
428
428
|
}
|
429
429
|
});
|
430
430
|
onPopupReopen(() => vue.nextTick(setHeight));
|
431
|
+
vue.watch([windowWidth, windowHeight], setHeight);
|
431
432
|
return height;
|
432
433
|
};
|
433
434
|
function usePlaceholder(contentRef, bem2) {
|
@@ -3976,7 +3977,9 @@ var stdin_default$1j = vue.defineComponent({
|
|
3976
3977
|
return value;
|
3977
3978
|
};
|
3978
3979
|
const updateValue = (value, trigger = "onChange") => {
|
3980
|
+
const originalValue = value;
|
3979
3981
|
value = limitValueLength(value);
|
3982
|
+
const isExceedLimit = value !== originalValue;
|
3980
3983
|
if (props.type === "number" || props.type === "digit") {
|
3981
3984
|
const isNumber = props.type === "number";
|
3982
3985
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -3985,13 +3988,15 @@ var stdin_default$1j = vue.defineComponent({
|
|
3985
3988
|
value = props.formatter(value);
|
3986
3989
|
}
|
3987
3990
|
if (inputRef.value && inputRef.value.value !== value) {
|
3988
|
-
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
3992
|
-
|
3993
|
-
|
3994
|
-
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
|
3991
|
+
if (state.focused && isExceedLimit) {
|
3992
|
+
const {
|
3993
|
+
selectionStart,
|
3994
|
+
selectionEnd
|
3995
|
+
} = inputRef.value;
|
3996
|
+
inputRef.value.value = value;
|
3997
|
+
inputRef.value.setSelectionRange(selectionStart - 1, selectionEnd - 1);
|
3998
|
+
} else {
|
3999
|
+
inputRef.value.value = value;
|
3995
4000
|
}
|
3996
4001
|
}
|
3997
4002
|
if (value !== props.modelValue) {
|
@@ -6502,8 +6507,10 @@ var stdin_default$13 = vue.defineComponent({
|
|
6502
6507
|
loading.value = true;
|
6503
6508
|
});
|
6504
6509
|
const onLoad = (event) => {
|
6505
|
-
loading.value
|
6506
|
-
|
6510
|
+
if (loading.value) {
|
6511
|
+
loading.value = false;
|
6512
|
+
emit("load", event);
|
6513
|
+
}
|
6507
6514
|
};
|
6508
6515
|
const onError = (event) => {
|
6509
6516
|
error.value = true;
|
@@ -6551,6 +6558,7 @@ var stdin_default$13 = vue.defineComponent({
|
|
6551
6558
|
}, attrs), null), [[vue.resolveDirective("lazy"), props.src]]);
|
6552
6559
|
}
|
6553
6560
|
return vue.createVNode("img", vue.mergeProps({
|
6561
|
+
"ref": imageRef,
|
6554
6562
|
"src": props.src,
|
6555
6563
|
"onLoad": onLoad,
|
6556
6564
|
"onError": onError
|
@@ -6585,6 +6593,12 @@ var stdin_default$13 = vue.defineComponent({
|
|
6585
6593
|
$Lazyload.$off("error", onLazyLoadError);
|
6586
6594
|
});
|
6587
6595
|
}
|
6596
|
+
vue.onMounted(() => {
|
6597
|
+
var _a;
|
6598
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6599
|
+
onLoad();
|
6600
|
+
}
|
6601
|
+
});
|
6588
6602
|
return () => {
|
6589
6603
|
var _a;
|
6590
6604
|
return vue.createVNode("div", {
|
@@ -14821,7 +14835,7 @@ const Lazyload = {
|
|
14821
14835
|
});
|
14822
14836
|
}
|
14823
14837
|
};
|
14824
|
-
const version = "4.0.
|
14838
|
+
const version = "4.0.2";
|
14825
14839
|
function install(app) {
|
14826
14840
|
const components = [
|
14827
14841
|
ActionBar,
|
package/lib/vant.es.js
CHANGED
@@ -426,6 +426,7 @@ const useHeight = (element, withSafeArea) => {
|
|
426
426
|
}
|
427
427
|
});
|
428
428
|
onPopupReopen(() => nextTick(setHeight));
|
429
|
+
watch([windowWidth, windowHeight], setHeight);
|
429
430
|
return height;
|
430
431
|
};
|
431
432
|
function usePlaceholder(contentRef, bem2) {
|
@@ -3974,7 +3975,9 @@ var stdin_default$1j = defineComponent({
|
|
3974
3975
|
return value;
|
3975
3976
|
};
|
3976
3977
|
const updateValue = (value, trigger = "onChange") => {
|
3978
|
+
const originalValue = value;
|
3977
3979
|
value = limitValueLength(value);
|
3980
|
+
const isExceedLimit = value !== originalValue;
|
3978
3981
|
if (props.type === "number" || props.type === "digit") {
|
3979
3982
|
const isNumber = props.type === "number";
|
3980
3983
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -3983,13 +3986,15 @@ var stdin_default$1j = defineComponent({
|
|
3983
3986
|
value = props.formatter(value);
|
3984
3987
|
}
|
3985
3988
|
if (inputRef.value && inputRef.value.value !== value) {
|
3986
|
-
|
3987
|
-
|
3988
|
-
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
3992
|
-
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
|
3989
|
+
if (state.focused && isExceedLimit) {
|
3990
|
+
const {
|
3991
|
+
selectionStart,
|
3992
|
+
selectionEnd
|
3993
|
+
} = inputRef.value;
|
3994
|
+
inputRef.value.value = value;
|
3995
|
+
inputRef.value.setSelectionRange(selectionStart - 1, selectionEnd - 1);
|
3996
|
+
} else {
|
3997
|
+
inputRef.value.value = value;
|
3993
3998
|
}
|
3994
3999
|
}
|
3995
4000
|
if (value !== props.modelValue) {
|
@@ -6500,8 +6505,10 @@ var stdin_default$13 = defineComponent({
|
|
6500
6505
|
loading.value = true;
|
6501
6506
|
});
|
6502
6507
|
const onLoad = (event) => {
|
6503
|
-
loading.value
|
6504
|
-
|
6508
|
+
if (loading.value) {
|
6509
|
+
loading.value = false;
|
6510
|
+
emit("load", event);
|
6511
|
+
}
|
6505
6512
|
};
|
6506
6513
|
const onError = (event) => {
|
6507
6514
|
error.value = true;
|
@@ -6549,6 +6556,7 @@ var stdin_default$13 = defineComponent({
|
|
6549
6556
|
}, attrs), null), [[resolveDirective("lazy"), props.src]]);
|
6550
6557
|
}
|
6551
6558
|
return createVNode("img", mergeProps({
|
6559
|
+
"ref": imageRef,
|
6552
6560
|
"src": props.src,
|
6553
6561
|
"onLoad": onLoad,
|
6554
6562
|
"onError": onError
|
@@ -6583,6 +6591,12 @@ var stdin_default$13 = defineComponent({
|
|
6583
6591
|
$Lazyload.$off("error", onLazyLoadError);
|
6584
6592
|
});
|
6585
6593
|
}
|
6594
|
+
onMounted(() => {
|
6595
|
+
var _a;
|
6596
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6597
|
+
onLoad();
|
6598
|
+
}
|
6599
|
+
});
|
6586
6600
|
return () => {
|
6587
6601
|
var _a;
|
6588
6602
|
return createVNode("div", {
|
@@ -14819,7 +14833,7 @@ const Lazyload = {
|
|
14819
14833
|
});
|
14820
14834
|
}
|
14821
14835
|
};
|
14822
|
-
const version = "4.0.
|
14836
|
+
const version = "4.0.2";
|
14823
14837
|
function install(app) {
|
14824
14838
|
const components = [
|
14825
14839
|
ActionBar,
|
package/lib/vant.js
CHANGED
@@ -795,6 +795,7 @@
|
|
795
795
|
}
|
796
796
|
});
|
797
797
|
onPopupReopen(() => vue.nextTick(setHeight));
|
798
|
+
vue.watch([windowWidth, windowHeight], setHeight);
|
798
799
|
return height2;
|
799
800
|
};
|
800
801
|
function usePlaceholder(contentRef, bem2) {
|
@@ -4334,7 +4335,9 @@
|
|
4334
4335
|
return value;
|
4335
4336
|
};
|
4336
4337
|
const updateValue = (value, trigger = "onChange") => {
|
4338
|
+
const originalValue = value;
|
4337
4339
|
value = limitValueLength(value);
|
4340
|
+
const isExceedLimit = value !== originalValue;
|
4338
4341
|
if (props.type === "number" || props.type === "digit") {
|
4339
4342
|
const isNumber = props.type === "number";
|
4340
4343
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -4343,13 +4346,15 @@
|
|
4343
4346
|
value = props.formatter(value);
|
4344
4347
|
}
|
4345
4348
|
if (inputRef.value && inputRef.value.value !== value) {
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
4350
|
-
|
4351
|
-
|
4352
|
-
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
|
4349
|
+
if (state.focused && isExceedLimit) {
|
4350
|
+
const {
|
4351
|
+
selectionStart,
|
4352
|
+
selectionEnd
|
4353
|
+
} = inputRef.value;
|
4354
|
+
inputRef.value.value = value;
|
4355
|
+
inputRef.value.setSelectionRange(selectionStart - 1, selectionEnd - 1);
|
4356
|
+
} else {
|
4357
|
+
inputRef.value.value = value;
|
4353
4358
|
}
|
4354
4359
|
}
|
4355
4360
|
if (value !== props.modelValue) {
|
@@ -6857,8 +6862,10 @@
|
|
6857
6862
|
loading.value = true;
|
6858
6863
|
});
|
6859
6864
|
const onLoad = (event) => {
|
6860
|
-
loading.value
|
6861
|
-
|
6865
|
+
if (loading.value) {
|
6866
|
+
loading.value = false;
|
6867
|
+
emit("load", event);
|
6868
|
+
}
|
6862
6869
|
};
|
6863
6870
|
const onError = (event) => {
|
6864
6871
|
error.value = true;
|
@@ -6906,6 +6913,7 @@
|
|
6906
6913
|
}, attrs), null), [[vue.resolveDirective("lazy"), props.src]]);
|
6907
6914
|
}
|
6908
6915
|
return vue.createVNode("img", vue.mergeProps({
|
6916
|
+
"ref": imageRef,
|
6909
6917
|
"src": props.src,
|
6910
6918
|
"onLoad": onLoad,
|
6911
6919
|
"onError": onError
|
@@ -6940,6 +6948,12 @@
|
|
6940
6948
|
$Lazyload.$off("error", onLazyLoadError);
|
6941
6949
|
});
|
6942
6950
|
}
|
6951
|
+
vue.onMounted(() => {
|
6952
|
+
var _a;
|
6953
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6954
|
+
onLoad();
|
6955
|
+
}
|
6956
|
+
});
|
6943
6957
|
return () => {
|
6944
6958
|
var _a;
|
6945
6959
|
return vue.createVNode("div", {
|
@@ -16027,7 +16041,7 @@
|
|
16027
16041
|
});
|
16028
16042
|
}
|
16029
16043
|
};
|
16030
|
-
const version = "4.0.
|
16044
|
+
const version = "4.0.2";
|
16031
16045
|
function install(app) {
|
16032
16046
|
const components = [
|
16033
16047
|
ActionBar,
|