vant 4.0.0 → 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/README.md +2 -1
- package/es/composables/use-height.mjs +3 -1
- package/es/field/Field.mjs +12 -6
- package/es/image/Image.mjs +12 -3
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/picker/Picker.mjs +3 -1
- package/es/picker/types.d.ts +1 -0
- package/es/utils/mount-component.mjs +1 -1
- package/lib/composables/use-height.js +2 -0
- package/lib/field/Field.js +12 -6
- package/lib/image/Image.js +11 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/picker/Picker.js +3 -1
- package/lib/picker/types.d.ts +1 -0
- package/lib/utils/mount-component.js +2 -2
- package/lib/vant.cjs.js +28 -10
- package/lib/vant.es.js +28 -10
- package/lib/vant.js +28 -10
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
<img src="https://img.shields.io/github/workflow/status/vant-ui/vant/CI/dev?style=flat-square" alt="CI Status" />
|
12
12
|
<img src="https://img.shields.io/codecov/c/github/vant-ui/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
|
13
13
|
<img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
|
14
|
-
<img src="https://img.badgesize.io/https://unpkg.com/vant
|
14
|
+
<img src="https://img.badgesize.io/https://unpkg.com/vant/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
|
15
15
|
</p>
|
16
16
|
|
17
17
|
<p align="center">
|
@@ -38,6 +38,7 @@
|
|
38
38
|
- 🍭 Support Custom Theme
|
39
39
|
- 🍭 Support Accessibility (still improving)
|
40
40
|
- 🍭 Support Dark Mode
|
41
|
+
- 🍭 Support Nuxt 3
|
41
42
|
- 🍭 Support SSR
|
42
43
|
- 🌍 Support i18n, built-in 20+ languages
|
43
44
|
|
@@ -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,12 +203,16 @@ 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
|
-
|
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;
|
215
|
+
}
|
210
216
|
}
|
211
217
|
if (value !== props.modelValue) {
|
212
218
|
emit("update:modelValue", value);
|
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,
|
package/es/picker/Picker.mjs
CHANGED
@@ -59,6 +59,7 @@ var stdin_default = defineComponent({
|
|
59
59
|
});
|
60
60
|
const hasOptions = computed(() => currentColumns.value.some((options) => options.length));
|
61
61
|
const selectedOptions = computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
|
62
|
+
const selectedIndexes = computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
|
62
63
|
const setValue = (index, value) => {
|
63
64
|
if (selectedValues.value[index] !== value) {
|
64
65
|
const newValues = selectedValues.value.slice(0);
|
@@ -68,7 +69,8 @@ var stdin_default = defineComponent({
|
|
68
69
|
};
|
69
70
|
const getEventParams = () => ({
|
70
71
|
selectedValues: selectedValues.value.slice(0),
|
71
|
-
selectedOptions: selectedOptions.value
|
72
|
+
selectedOptions: selectedOptions.value,
|
73
|
+
selectedIndexes: selectedIndexes.value
|
72
74
|
});
|
73
75
|
const onChange = (value, columnIndex) => {
|
74
76
|
setValue(columnIndex, value);
|
package/es/picker/types.d.ts
CHANGED
@@ -37,6 +37,7 @@ export type PickerInstance = ComponentPublicInstance<PickerProps, PickerExpose>;
|
|
37
37
|
export type PickerConfirmEventParams = {
|
38
38
|
selectedValues: Numeric[];
|
39
39
|
selectedOptions: Array<PickerOption | undefined>;
|
40
|
+
selectedIndexes: number[];
|
40
41
|
};
|
41
42
|
export type PickerCancelEventParams = PickerConfirmEventParams;
|
42
43
|
export type PickerChangeEventParams = PickerConfirmEventParams & {
|
@@ -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,12 +227,16 @@ 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
|
-
|
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;
|
239
|
+
}
|
234
240
|
}
|
235
241
|
if (value !== props.modelValue) {
|
236
242
|
emit("update:modelValue", value);
|
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,
|
package/lib/picker/Picker.js
CHANGED
@@ -89,6 +89,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
89
89
|
});
|
90
90
|
const hasOptions = (0, import_vue2.computed)(() => currentColumns.value.some((options) => options.length));
|
91
91
|
const selectedOptions = (0, import_vue2.computed)(() => currentColumns.value.map((options, index) => (0, import_utils2.findOptionByValue)(options, selectedValues.value[index], fields.value)));
|
92
|
+
const selectedIndexes = (0, import_vue2.computed)(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
|
92
93
|
const setValue = (index, value) => {
|
93
94
|
if (selectedValues.value[index] !== value) {
|
94
95
|
const newValues = selectedValues.value.slice(0);
|
@@ -98,7 +99,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
98
99
|
};
|
99
100
|
const getEventParams = () => ({
|
100
101
|
selectedValues: selectedValues.value.slice(0),
|
101
|
-
selectedOptions: selectedOptions.value
|
102
|
+
selectedOptions: selectedOptions.value,
|
103
|
+
selectedIndexes: selectedIndexes.value
|
102
104
|
});
|
103
105
|
const onChange = (value, columnIndex) => {
|
104
106
|
setValue(columnIndex, value);
|
package/lib/picker/types.d.ts
CHANGED
@@ -37,6 +37,7 @@ export type PickerInstance = ComponentPublicInstance<PickerProps, PickerExpose>;
|
|
37
37
|
export type PickerConfirmEventParams = {
|
38
38
|
selectedValues: Numeric[];
|
39
39
|
selectedOptions: Array<PickerOption | undefined>;
|
40
|
+
selectedIndexes: number[];
|
40
41
|
};
|
41
42
|
export type PickerCancelEventParams = PickerConfirmEventParams;
|
42
43
|
export type PickerChangeEventParams = PickerConfirmEventParams & {
|
@@ -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) {
|
@@ -3151,6 +3152,7 @@ var stdin_default$1n = vue.defineComponent({
|
|
3151
3152
|
});
|
3152
3153
|
const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
|
3153
3154
|
const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
|
3155
|
+
const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
|
3154
3156
|
const setValue = (index, value) => {
|
3155
3157
|
if (selectedValues.value[index] !== value) {
|
3156
3158
|
const newValues = selectedValues.value.slice(0);
|
@@ -3160,7 +3162,8 @@ var stdin_default$1n = vue.defineComponent({
|
|
3160
3162
|
};
|
3161
3163
|
const getEventParams = () => ({
|
3162
3164
|
selectedValues: selectedValues.value.slice(0),
|
3163
|
-
selectedOptions: selectedOptions.value
|
3165
|
+
selectedOptions: selectedOptions.value,
|
3166
|
+
selectedIndexes: selectedIndexes.value
|
3164
3167
|
});
|
3165
3168
|
const onChange = (value, columnIndex) => {
|
3166
3169
|
setValue(columnIndex, value);
|
@@ -3974,7 +3977,9 @@ var stdin_default$1j = vue.defineComponent({
|
|
3974
3977
|
return value;
|
3975
3978
|
};
|
3976
3979
|
const updateValue = (value, trigger = "onChange") => {
|
3980
|
+
const originalValue = value;
|
3977
3981
|
value = limitValueLength(value);
|
3982
|
+
const isExceedLimit = value !== originalValue;
|
3978
3983
|
if (props.type === "number" || props.type === "digit") {
|
3979
3984
|
const isNumber = props.type === "number";
|
3980
3985
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -3983,12 +3988,16 @@ var stdin_default$1j = vue.defineComponent({
|
|
3983
3988
|
value = props.formatter(value);
|
3984
3989
|
}
|
3985
3990
|
if (inputRef.value && inputRef.value.value !== value) {
|
3986
|
-
|
3987
|
-
|
3988
|
-
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
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;
|
4000
|
+
}
|
3992
4001
|
}
|
3993
4002
|
if (value !== props.modelValue) {
|
3994
4003
|
emit("update:modelValue", value);
|
@@ -6498,8 +6507,10 @@ var stdin_default$13 = vue.defineComponent({
|
|
6498
6507
|
loading.value = true;
|
6499
6508
|
});
|
6500
6509
|
const onLoad = (event) => {
|
6501
|
-
loading.value
|
6502
|
-
|
6510
|
+
if (loading.value) {
|
6511
|
+
loading.value = false;
|
6512
|
+
emit("load", event);
|
6513
|
+
}
|
6503
6514
|
};
|
6504
6515
|
const onError = (event) => {
|
6505
6516
|
error.value = true;
|
@@ -6547,6 +6558,7 @@ var stdin_default$13 = vue.defineComponent({
|
|
6547
6558
|
}, attrs), null), [[vue.resolveDirective("lazy"), props.src]]);
|
6548
6559
|
}
|
6549
6560
|
return vue.createVNode("img", vue.mergeProps({
|
6561
|
+
"ref": imageRef,
|
6550
6562
|
"src": props.src,
|
6551
6563
|
"onLoad": onLoad,
|
6552
6564
|
"onError": onError
|
@@ -6581,6 +6593,12 @@ var stdin_default$13 = vue.defineComponent({
|
|
6581
6593
|
$Lazyload.$off("error", onLazyLoadError);
|
6582
6594
|
});
|
6583
6595
|
}
|
6596
|
+
vue.onMounted(() => {
|
6597
|
+
var _a;
|
6598
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6599
|
+
onLoad();
|
6600
|
+
}
|
6601
|
+
});
|
6584
6602
|
return () => {
|
6585
6603
|
var _a;
|
6586
6604
|
return vue.createVNode("div", {
|
@@ -14817,7 +14835,7 @@ const Lazyload = {
|
|
14817
14835
|
});
|
14818
14836
|
}
|
14819
14837
|
};
|
14820
|
-
const version = "4.0.
|
14838
|
+
const version = "4.0.2";
|
14821
14839
|
function install(app) {
|
14822
14840
|
const components = [
|
14823
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) {
|
@@ -3149,6 +3150,7 @@ var stdin_default$1n = defineComponent({
|
|
3149
3150
|
});
|
3150
3151
|
const hasOptions = computed(() => currentColumns.value.some((options) => options.length));
|
3151
3152
|
const selectedOptions = computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
|
3153
|
+
const selectedIndexes = computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
|
3152
3154
|
const setValue = (index, value) => {
|
3153
3155
|
if (selectedValues.value[index] !== value) {
|
3154
3156
|
const newValues = selectedValues.value.slice(0);
|
@@ -3158,7 +3160,8 @@ var stdin_default$1n = defineComponent({
|
|
3158
3160
|
};
|
3159
3161
|
const getEventParams = () => ({
|
3160
3162
|
selectedValues: selectedValues.value.slice(0),
|
3161
|
-
selectedOptions: selectedOptions.value
|
3163
|
+
selectedOptions: selectedOptions.value,
|
3164
|
+
selectedIndexes: selectedIndexes.value
|
3162
3165
|
});
|
3163
3166
|
const onChange = (value, columnIndex) => {
|
3164
3167
|
setValue(columnIndex, value);
|
@@ -3972,7 +3975,9 @@ var stdin_default$1j = defineComponent({
|
|
3972
3975
|
return value;
|
3973
3976
|
};
|
3974
3977
|
const updateValue = (value, trigger = "onChange") => {
|
3978
|
+
const originalValue = value;
|
3975
3979
|
value = limitValueLength(value);
|
3980
|
+
const isExceedLimit = value !== originalValue;
|
3976
3981
|
if (props.type === "number" || props.type === "digit") {
|
3977
3982
|
const isNumber = props.type === "number";
|
3978
3983
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -3981,12 +3986,16 @@ var stdin_default$1j = defineComponent({
|
|
3981
3986
|
value = props.formatter(value);
|
3982
3987
|
}
|
3983
3988
|
if (inputRef.value && inputRef.value.value !== value) {
|
3984
|
-
|
3985
|
-
|
3986
|
-
|
3987
|
-
|
3988
|
-
|
3989
|
-
|
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;
|
3998
|
+
}
|
3990
3999
|
}
|
3991
4000
|
if (value !== props.modelValue) {
|
3992
4001
|
emit("update:modelValue", value);
|
@@ -6496,8 +6505,10 @@ var stdin_default$13 = defineComponent({
|
|
6496
6505
|
loading.value = true;
|
6497
6506
|
});
|
6498
6507
|
const onLoad = (event) => {
|
6499
|
-
loading.value
|
6500
|
-
|
6508
|
+
if (loading.value) {
|
6509
|
+
loading.value = false;
|
6510
|
+
emit("load", event);
|
6511
|
+
}
|
6501
6512
|
};
|
6502
6513
|
const onError = (event) => {
|
6503
6514
|
error.value = true;
|
@@ -6545,6 +6556,7 @@ var stdin_default$13 = defineComponent({
|
|
6545
6556
|
}, attrs), null), [[resolveDirective("lazy"), props.src]]);
|
6546
6557
|
}
|
6547
6558
|
return createVNode("img", mergeProps({
|
6559
|
+
"ref": imageRef,
|
6548
6560
|
"src": props.src,
|
6549
6561
|
"onLoad": onLoad,
|
6550
6562
|
"onError": onError
|
@@ -6579,6 +6591,12 @@ var stdin_default$13 = defineComponent({
|
|
6579
6591
|
$Lazyload.$off("error", onLazyLoadError);
|
6580
6592
|
});
|
6581
6593
|
}
|
6594
|
+
onMounted(() => {
|
6595
|
+
var _a;
|
6596
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6597
|
+
onLoad();
|
6598
|
+
}
|
6599
|
+
});
|
6582
6600
|
return () => {
|
6583
6601
|
var _a;
|
6584
6602
|
return createVNode("div", {
|
@@ -14815,7 +14833,7 @@ const Lazyload = {
|
|
14815
14833
|
});
|
14816
14834
|
}
|
14817
14835
|
};
|
14818
|
-
const version = "4.0.
|
14836
|
+
const version = "4.0.2";
|
14819
14837
|
function install(app) {
|
14820
14838
|
const components = [
|
14821
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) {
|
@@ -3509,6 +3510,7 @@
|
|
3509
3510
|
});
|
3510
3511
|
const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
|
3511
3512
|
const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
|
3513
|
+
const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
|
3512
3514
|
const setValue = (index, value) => {
|
3513
3515
|
if (selectedValues.value[index] !== value) {
|
3514
3516
|
const newValues = selectedValues.value.slice(0);
|
@@ -3518,7 +3520,8 @@
|
|
3518
3520
|
};
|
3519
3521
|
const getEventParams = () => ({
|
3520
3522
|
selectedValues: selectedValues.value.slice(0),
|
3521
|
-
selectedOptions: selectedOptions.value
|
3523
|
+
selectedOptions: selectedOptions.value,
|
3524
|
+
selectedIndexes: selectedIndexes.value
|
3522
3525
|
});
|
3523
3526
|
const onChange = (value, columnIndex) => {
|
3524
3527
|
setValue(columnIndex, value);
|
@@ -4332,7 +4335,9 @@
|
|
4332
4335
|
return value;
|
4333
4336
|
};
|
4334
4337
|
const updateValue = (value, trigger = "onChange") => {
|
4338
|
+
const originalValue = value;
|
4335
4339
|
value = limitValueLength(value);
|
4340
|
+
const isExceedLimit = value !== originalValue;
|
4336
4341
|
if (props.type === "number" || props.type === "digit") {
|
4337
4342
|
const isNumber = props.type === "number";
|
4338
4343
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -4341,12 +4346,16 @@
|
|
4341
4346
|
value = props.formatter(value);
|
4342
4347
|
}
|
4343
4348
|
if (inputRef.value && inputRef.value.value !== value) {
|
4344
|
-
|
4345
|
-
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
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;
|
4358
|
+
}
|
4350
4359
|
}
|
4351
4360
|
if (value !== props.modelValue) {
|
4352
4361
|
emit("update:modelValue", value);
|
@@ -6853,8 +6862,10 @@
|
|
6853
6862
|
loading.value = true;
|
6854
6863
|
});
|
6855
6864
|
const onLoad = (event) => {
|
6856
|
-
loading.value
|
6857
|
-
|
6865
|
+
if (loading.value) {
|
6866
|
+
loading.value = false;
|
6867
|
+
emit("load", event);
|
6868
|
+
}
|
6858
6869
|
};
|
6859
6870
|
const onError = (event) => {
|
6860
6871
|
error.value = true;
|
@@ -6902,6 +6913,7 @@
|
|
6902
6913
|
}, attrs), null), [[vue.resolveDirective("lazy"), props.src]]);
|
6903
6914
|
}
|
6904
6915
|
return vue.createVNode("img", vue.mergeProps({
|
6916
|
+
"ref": imageRef,
|
6905
6917
|
"src": props.src,
|
6906
6918
|
"onLoad": onLoad,
|
6907
6919
|
"onError": onError
|
@@ -6936,6 +6948,12 @@
|
|
6936
6948
|
$Lazyload.$off("error", onLazyLoadError);
|
6937
6949
|
});
|
6938
6950
|
}
|
6951
|
+
vue.onMounted(() => {
|
6952
|
+
var _a;
|
6953
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6954
|
+
onLoad();
|
6955
|
+
}
|
6956
|
+
});
|
6939
6957
|
return () => {
|
6940
6958
|
var _a;
|
6941
6959
|
return vue.createVNode("div", {
|
@@ -16023,7 +16041,7 @@
|
|
16023
16041
|
});
|
16024
16042
|
}
|
16025
16043
|
};
|
16026
|
-
const version = "4.0.
|
16044
|
+
const version = "4.0.2";
|
16027
16045
|
function install(app) {
|
16028
16046
|
const components = [
|
16029
16047
|
ActionBar,
|