vant 3.6.10 → 3.6.12
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/field/Field.mjs +38 -5
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/uploader/Uploader.mjs +6 -4
- package/es/uploader/UploaderPreviewItem.mjs +1 -1
- package/es/uploader/types.d.ts +1 -0
- package/es/uploader/utils.mjs +1 -1
- package/lib/field/Field.js +38 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/uploader/Uploader.js +6 -4
- package/lib/uploader/UploaderPreviewItem.js +1 -1
- package/lib/uploader/types.d.ts +1 -0
- package/lib/uploader/utils.js +1 -1
- package/lib/vant.cjs.js +47 -12
- package/lib/vant.es.js +47 -12
- package/lib/vant.js +47 -12
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1785 -1785
- package/package.json +1 -1
package/es/field/Field.mjs
CHANGED
@@ -178,6 +178,7 @@ var stdin_default = defineComponent({
|
|
178
178
|
}
|
179
179
|
};
|
180
180
|
const limitValueLength = (value) => {
|
181
|
+
var _a;
|
181
182
|
const {
|
182
183
|
maxlength
|
183
184
|
} = props;
|
@@ -186,6 +187,13 @@ var stdin_default = defineComponent({
|
|
186
187
|
if (modelValue && getStringLength(modelValue) === +maxlength) {
|
187
188
|
return modelValue;
|
188
189
|
}
|
190
|
+
const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
|
191
|
+
if (state.focused && selectionEnd) {
|
192
|
+
const valueArr = [...value];
|
193
|
+
const exceededLength = valueArr.length - +maxlength;
|
194
|
+
valueArr.splice(selectionEnd - exceededLength, exceededLength);
|
195
|
+
return valueArr.join("");
|
196
|
+
}
|
189
197
|
return cutString(value, +maxlength);
|
190
198
|
}
|
191
199
|
return value;
|
@@ -193,22 +201,47 @@ var stdin_default = defineComponent({
|
|
193
201
|
const updateValue = (value, trigger = "onChange") => {
|
194
202
|
const originalValue = value;
|
195
203
|
value = limitValueLength(value);
|
196
|
-
const
|
204
|
+
const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
|
197
205
|
if (props.type === "number" || props.type === "digit") {
|
198
206
|
const isNumber = props.type === "number";
|
199
207
|
value = formatNumber(value, isNumber, isNumber);
|
200
208
|
}
|
209
|
+
let formatterDiffLen = 0;
|
201
210
|
if (props.formatter && trigger === props.formatTrigger) {
|
202
|
-
|
211
|
+
const {
|
212
|
+
formatter,
|
213
|
+
maxlength
|
214
|
+
} = props;
|
215
|
+
value = formatter(value);
|
216
|
+
if (isDef(maxlength) && getStringLength(value) > maxlength) {
|
217
|
+
value = cutString(value, +maxlength);
|
218
|
+
}
|
219
|
+
if (inputRef.value && state.focused) {
|
220
|
+
const {
|
221
|
+
selectionEnd
|
222
|
+
} = inputRef.value;
|
223
|
+
const bcoVal = cutString(originalValue, selectionEnd);
|
224
|
+
formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
|
225
|
+
}
|
203
226
|
}
|
204
227
|
if (inputRef.value && inputRef.value.value !== value) {
|
205
|
-
if (state.focused
|
206
|
-
|
228
|
+
if (state.focused) {
|
229
|
+
let {
|
207
230
|
selectionStart,
|
208
231
|
selectionEnd
|
209
232
|
} = inputRef.value;
|
210
233
|
inputRef.value.value = value;
|
211
|
-
|
234
|
+
if (isDef(selectionStart) && isDef(selectionEnd)) {
|
235
|
+
const valueLen = getStringLength(value);
|
236
|
+
if (limitDiffLen) {
|
237
|
+
selectionStart -= limitDiffLen;
|
238
|
+
selectionEnd -= limitDiffLen;
|
239
|
+
} else if (formatterDiffLen) {
|
240
|
+
selectionStart += formatterDiffLen;
|
241
|
+
selectionEnd += formatterDiffLen;
|
242
|
+
}
|
243
|
+
inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
|
244
|
+
}
|
212
245
|
} else {
|
213
246
|
inputRef.value.value = value;
|
214
247
|
}
|
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -84,7 +84,7 @@ import { Tag } from "./tag/index.mjs";
|
|
84
84
|
import { Toast } from "./toast/index.mjs";
|
85
85
|
import { TreeSelect } from "./tree-select/index.mjs";
|
86
86
|
import { Uploader } from "./uploader/index.mjs";
|
87
|
-
const version = "3.6.
|
87
|
+
const version = "3.6.12";
|
88
88
|
function install(app) {
|
89
89
|
const components = [
|
90
90
|
ActionBar,
|
package/es/uploader/Uploader.mjs
CHANGED
@@ -91,7 +91,8 @@ var stdin_default = defineComponent({
|
|
91
91
|
const result = {
|
92
92
|
file,
|
93
93
|
status: "",
|
94
|
-
message: ""
|
94
|
+
message: "",
|
95
|
+
objectUrl: URL.createObjectURL(file)
|
95
96
|
};
|
96
97
|
if (contents[index]) {
|
97
98
|
result.content = contents[index];
|
@@ -105,7 +106,8 @@ var stdin_default = defineComponent({
|
|
105
106
|
const result = {
|
106
107
|
file: files,
|
107
108
|
status: "",
|
108
|
-
message: ""
|
109
|
+
message: "",
|
110
|
+
objectUrl: URL.createObjectURL(files)
|
109
111
|
};
|
110
112
|
if (content) {
|
111
113
|
result.content = content;
|
@@ -147,8 +149,8 @@ var stdin_default = defineComponent({
|
|
147
149
|
if (props.previewFullImage) {
|
148
150
|
const imageFiles = props.modelValue.filter(isImageFile);
|
149
151
|
const images = imageFiles.map((item2) => {
|
150
|
-
if (item2.
|
151
|
-
item2.url =
|
152
|
+
if (item2.objectUrl && !item2.url && item2.status !== "failed") {
|
153
|
+
item2.url = item2.objectUrl;
|
152
154
|
urls.push(item2.url);
|
153
155
|
}
|
154
156
|
return item2.url;
|
@@ -98,7 +98,7 @@ var stdin_default = defineComponent({
|
|
98
98
|
if (isImageFile(item)) {
|
99
99
|
return _createVNode(Image, {
|
100
100
|
"fit": imageFit,
|
101
|
-
"src": item.content || item.url,
|
101
|
+
"src": item.objectUrl || item.content || item.url,
|
102
102
|
"class": bem("preview-image"),
|
103
103
|
"width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
|
104
104
|
"height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
|
package/es/uploader/types.d.ts
CHANGED
package/es/uploader/utils.mjs
CHANGED
@@ -40,7 +40,7 @@ function filterFiles(items, maxSize) {
|
|
40
40
|
});
|
41
41
|
return { valid, invalid };
|
42
42
|
}
|
43
|
-
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
43
|
+
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
|
44
44
|
const isImageUrl = (url) => IMAGE_REGEXP.test(url);
|
45
45
|
function isImageFile(item) {
|
46
46
|
if (item.isImage) {
|
package/lib/field/Field.js
CHANGED
@@ -201,6 +201,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
201
201
|
}
|
202
202
|
};
|
203
203
|
const limitValueLength = (value) => {
|
204
|
+
var _a;
|
204
205
|
const {
|
205
206
|
maxlength
|
206
207
|
} = props;
|
@@ -209,6 +210,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
209
210
|
if (modelValue && (0, import_utils2.getStringLength)(modelValue) === +maxlength) {
|
210
211
|
return modelValue;
|
211
212
|
}
|
213
|
+
const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
|
214
|
+
if (state.focused && selectionEnd) {
|
215
|
+
const valueArr = [...value];
|
216
|
+
const exceededLength = valueArr.length - +maxlength;
|
217
|
+
valueArr.splice(selectionEnd - exceededLength, exceededLength);
|
218
|
+
return valueArr.join("");
|
219
|
+
}
|
212
220
|
return (0, import_utils2.cutString)(value, +maxlength);
|
213
221
|
}
|
214
222
|
return value;
|
@@ -216,22 +224,47 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
216
224
|
const updateValue = (value, trigger = "onChange") => {
|
217
225
|
const originalValue = value;
|
218
226
|
value = limitValueLength(value);
|
219
|
-
const
|
227
|
+
const limitDiffLen = (0, import_utils2.getStringLength)(originalValue) - (0, import_utils2.getStringLength)(value);
|
220
228
|
if (props.type === "number" || props.type === "digit") {
|
221
229
|
const isNumber = props.type === "number";
|
222
230
|
value = (0, import_utils.formatNumber)(value, isNumber, isNumber);
|
223
231
|
}
|
232
|
+
let formatterDiffLen = 0;
|
224
233
|
if (props.formatter && trigger === props.formatTrigger) {
|
225
|
-
|
234
|
+
const {
|
235
|
+
formatter,
|
236
|
+
maxlength
|
237
|
+
} = props;
|
238
|
+
value = formatter(value);
|
239
|
+
if ((0, import_utils.isDef)(maxlength) && (0, import_utils2.getStringLength)(value) > maxlength) {
|
240
|
+
value = (0, import_utils2.cutString)(value, +maxlength);
|
241
|
+
}
|
242
|
+
if (inputRef.value && state.focused) {
|
243
|
+
const {
|
244
|
+
selectionEnd
|
245
|
+
} = inputRef.value;
|
246
|
+
const bcoVal = (0, import_utils2.cutString)(originalValue, selectionEnd);
|
247
|
+
formatterDiffLen = (0, import_utils2.getStringLength)(formatter(bcoVal)) - (0, import_utils2.getStringLength)(bcoVal);
|
248
|
+
}
|
226
249
|
}
|
227
250
|
if (inputRef.value && inputRef.value.value !== value) {
|
228
|
-
if (state.focused
|
229
|
-
|
251
|
+
if (state.focused) {
|
252
|
+
let {
|
230
253
|
selectionStart,
|
231
254
|
selectionEnd
|
232
255
|
} = inputRef.value;
|
233
256
|
inputRef.value.value = value;
|
234
|
-
|
257
|
+
if ((0, import_utils.isDef)(selectionStart) && (0, import_utils.isDef)(selectionEnd)) {
|
258
|
+
const valueLen = (0, import_utils2.getStringLength)(value);
|
259
|
+
if (limitDiffLen) {
|
260
|
+
selectionStart -= limitDiffLen;
|
261
|
+
selectionEnd -= limitDiffLen;
|
262
|
+
} else if (formatterDiffLen) {
|
263
|
+
selectionStart += formatterDiffLen;
|
264
|
+
selectionEnd += formatterDiffLen;
|
265
|
+
}
|
266
|
+
inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
|
267
|
+
}
|
235
268
|
} else {
|
236
269
|
inputRef.value.value = value;
|
237
270
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -196,7 +196,7 @@ __reExport(stdin_exports, require("./tag"), module.exports);
|
|
196
196
|
__reExport(stdin_exports, require("./toast"), module.exports);
|
197
197
|
__reExport(stdin_exports, require("./tree-select"), module.exports);
|
198
198
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
199
|
-
const version = "3.6.
|
199
|
+
const version = "3.6.12";
|
200
200
|
function install(app) {
|
201
201
|
const components = [
|
202
202
|
import_action_bar.ActionBar,
|
package/lib/uploader/Uploader.js
CHANGED
@@ -119,7 +119,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
119
119
|
const result = {
|
120
120
|
file,
|
121
121
|
status: "",
|
122
|
-
message: ""
|
122
|
+
message: "",
|
123
|
+
objectUrl: URL.createObjectURL(file)
|
123
124
|
};
|
124
125
|
if (contents[index]) {
|
125
126
|
result.content = contents[index];
|
@@ -133,7 +134,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
133
134
|
const result = {
|
134
135
|
file: files,
|
135
136
|
status: "",
|
136
|
-
message: ""
|
137
|
+
message: "",
|
138
|
+
objectUrl: URL.createObjectURL(files)
|
137
139
|
};
|
138
140
|
if (content) {
|
139
141
|
result.content = content;
|
@@ -175,8 +177,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
175
177
|
if (props.previewFullImage) {
|
176
178
|
const imageFiles = props.modelValue.filter(import_utils2.isImageFile);
|
177
179
|
const images = imageFiles.map((item2) => {
|
178
|
-
if (item2.
|
179
|
-
item2.url =
|
180
|
+
if (item2.objectUrl && !item2.url && item2.status !== "failed") {
|
181
|
+
item2.url = item2.objectUrl;
|
180
182
|
urls.push(item2.url);
|
181
183
|
}
|
182
184
|
return item2.url;
|
@@ -120,7 +120,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
120
120
|
if ((0, import_utils.isImageFile)(item)) {
|
121
121
|
return (0, import_vue.createVNode)(import_image.Image, {
|
122
122
|
"fit": imageFit,
|
123
|
-
"src": item.content || item.url,
|
123
|
+
"src": item.objectUrl || item.content || item.url,
|
124
124
|
"class": (0, import_utils.bem)("preview-image"),
|
125
125
|
"width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
|
126
126
|
"height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
|
package/lib/uploader/types.d.ts
CHANGED
package/lib/uploader/utils.js
CHANGED
@@ -69,7 +69,7 @@ function filterFiles(items, maxSize) {
|
|
69
69
|
});
|
70
70
|
return { valid, invalid };
|
71
71
|
}
|
72
|
-
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
72
|
+
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
|
73
73
|
const isImageUrl = (url) => IMAGE_REGEXP.test(url);
|
74
74
|
function isImageFile(item) {
|
75
75
|
if (item.isImage) {
|
package/lib/vant.cjs.js
CHANGED
@@ -2832,6 +2832,7 @@ var stdin_default$1m = vue.defineComponent({
|
|
2832
2832
|
}
|
2833
2833
|
};
|
2834
2834
|
const limitValueLength = (value) => {
|
2835
|
+
var _a;
|
2835
2836
|
const {
|
2836
2837
|
maxlength
|
2837
2838
|
} = props;
|
@@ -2840,6 +2841,13 @@ var stdin_default$1m = vue.defineComponent({
|
|
2840
2841
|
if (modelValue && getStringLength(modelValue) === +maxlength) {
|
2841
2842
|
return modelValue;
|
2842
2843
|
}
|
2844
|
+
const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
|
2845
|
+
if (state.focused && selectionEnd) {
|
2846
|
+
const valueArr = [...value];
|
2847
|
+
const exceededLength = valueArr.length - +maxlength;
|
2848
|
+
valueArr.splice(selectionEnd - exceededLength, exceededLength);
|
2849
|
+
return valueArr.join("");
|
2850
|
+
}
|
2843
2851
|
return cutString(value, +maxlength);
|
2844
2852
|
}
|
2845
2853
|
return value;
|
@@ -2847,22 +2855,47 @@ var stdin_default$1m = vue.defineComponent({
|
|
2847
2855
|
const updateValue = (value, trigger = "onChange") => {
|
2848
2856
|
const originalValue = value;
|
2849
2857
|
value = limitValueLength(value);
|
2850
|
-
const
|
2858
|
+
const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
|
2851
2859
|
if (props.type === "number" || props.type === "digit") {
|
2852
2860
|
const isNumber = props.type === "number";
|
2853
2861
|
value = formatNumber(value, isNumber, isNumber);
|
2854
2862
|
}
|
2863
|
+
let formatterDiffLen = 0;
|
2855
2864
|
if (props.formatter && trigger === props.formatTrigger) {
|
2856
|
-
|
2865
|
+
const {
|
2866
|
+
formatter,
|
2867
|
+
maxlength
|
2868
|
+
} = props;
|
2869
|
+
value = formatter(value);
|
2870
|
+
if (isDef(maxlength) && getStringLength(value) > maxlength) {
|
2871
|
+
value = cutString(value, +maxlength);
|
2872
|
+
}
|
2873
|
+
if (inputRef.value && state.focused) {
|
2874
|
+
const {
|
2875
|
+
selectionEnd
|
2876
|
+
} = inputRef.value;
|
2877
|
+
const bcoVal = cutString(originalValue, selectionEnd);
|
2878
|
+
formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
|
2879
|
+
}
|
2857
2880
|
}
|
2858
2881
|
if (inputRef.value && inputRef.value.value !== value) {
|
2859
|
-
if (state.focused
|
2860
|
-
|
2882
|
+
if (state.focused) {
|
2883
|
+
let {
|
2861
2884
|
selectionStart,
|
2862
2885
|
selectionEnd
|
2863
2886
|
} = inputRef.value;
|
2864
2887
|
inputRef.value.value = value;
|
2865
|
-
|
2888
|
+
if (isDef(selectionStart) && isDef(selectionEnd)) {
|
2889
|
+
const valueLen = getStringLength(value);
|
2890
|
+
if (limitDiffLen) {
|
2891
|
+
selectionStart -= limitDiffLen;
|
2892
|
+
selectionEnd -= limitDiffLen;
|
2893
|
+
} else if (formatterDiffLen) {
|
2894
|
+
selectionStart += formatterDiffLen;
|
2895
|
+
selectionEnd += formatterDiffLen;
|
2896
|
+
}
|
2897
|
+
inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
|
2898
|
+
}
|
2866
2899
|
} else {
|
2867
2900
|
inputRef.value.value = value;
|
2868
2901
|
}
|
@@ -13698,7 +13731,7 @@ function filterFiles(items, maxSize) {
|
|
13698
13731
|
});
|
13699
13732
|
return { valid, invalid };
|
13700
13733
|
}
|
13701
|
-
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
13734
|
+
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
|
13702
13735
|
const isImageUrl = (url) => IMAGE_REGEXP.test(url);
|
13703
13736
|
function isImageFile(item) {
|
13704
13737
|
if (item.isImage) {
|
@@ -13808,7 +13841,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
13808
13841
|
if (isImageFile(item)) {
|
13809
13842
|
return vue.createVNode(Image$1, {
|
13810
13843
|
"fit": imageFit,
|
13811
|
-
"src": item.content || item.url,
|
13844
|
+
"src": item.objectUrl || item.content || item.url,
|
13812
13845
|
"class": bem("preview-image"),
|
13813
13846
|
"width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
|
13814
13847
|
"height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
|
@@ -13917,7 +13950,8 @@ var stdin_default$4 = vue.defineComponent({
|
|
13917
13950
|
const result = {
|
13918
13951
|
file,
|
13919
13952
|
status: "",
|
13920
|
-
message: ""
|
13953
|
+
message: "",
|
13954
|
+
objectUrl: URL.createObjectURL(file)
|
13921
13955
|
};
|
13922
13956
|
if (contents[index]) {
|
13923
13957
|
result.content = contents[index];
|
@@ -13931,7 +13965,8 @@ var stdin_default$4 = vue.defineComponent({
|
|
13931
13965
|
const result = {
|
13932
13966
|
file: files,
|
13933
13967
|
status: "",
|
13934
|
-
message: ""
|
13968
|
+
message: "",
|
13969
|
+
objectUrl: URL.createObjectURL(files)
|
13935
13970
|
};
|
13936
13971
|
if (content) {
|
13937
13972
|
result.content = content;
|
@@ -13973,8 +14008,8 @@ var stdin_default$4 = vue.defineComponent({
|
|
13973
14008
|
if (props.previewFullImage) {
|
13974
14009
|
const imageFiles = props.modelValue.filter(isImageFile);
|
13975
14010
|
const images = imageFiles.map((item2) => {
|
13976
|
-
if (item2.
|
13977
|
-
item2.url =
|
14011
|
+
if (item2.objectUrl && !item2.url && item2.status !== "failed") {
|
14012
|
+
item2.url = item2.objectUrl;
|
13978
14013
|
urls.push(item2.url);
|
13979
14014
|
}
|
13980
14015
|
return item2.url;
|
@@ -14967,7 +15002,7 @@ const Lazyload = {
|
|
14967
15002
|
});
|
14968
15003
|
}
|
14969
15004
|
};
|
14970
|
-
const version = "3.6.
|
15005
|
+
const version = "3.6.12";
|
14971
15006
|
function install(app) {
|
14972
15007
|
const components = [
|
14973
15008
|
ActionBar,
|
package/lib/vant.es.js
CHANGED
@@ -2830,6 +2830,7 @@ var stdin_default$1m = defineComponent({
|
|
2830
2830
|
}
|
2831
2831
|
};
|
2832
2832
|
const limitValueLength = (value) => {
|
2833
|
+
var _a;
|
2833
2834
|
const {
|
2834
2835
|
maxlength
|
2835
2836
|
} = props;
|
@@ -2838,6 +2839,13 @@ var stdin_default$1m = defineComponent({
|
|
2838
2839
|
if (modelValue && getStringLength(modelValue) === +maxlength) {
|
2839
2840
|
return modelValue;
|
2840
2841
|
}
|
2842
|
+
const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
|
2843
|
+
if (state.focused && selectionEnd) {
|
2844
|
+
const valueArr = [...value];
|
2845
|
+
const exceededLength = valueArr.length - +maxlength;
|
2846
|
+
valueArr.splice(selectionEnd - exceededLength, exceededLength);
|
2847
|
+
return valueArr.join("");
|
2848
|
+
}
|
2841
2849
|
return cutString(value, +maxlength);
|
2842
2850
|
}
|
2843
2851
|
return value;
|
@@ -2845,22 +2853,47 @@ var stdin_default$1m = defineComponent({
|
|
2845
2853
|
const updateValue = (value, trigger = "onChange") => {
|
2846
2854
|
const originalValue = value;
|
2847
2855
|
value = limitValueLength(value);
|
2848
|
-
const
|
2856
|
+
const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
|
2849
2857
|
if (props.type === "number" || props.type === "digit") {
|
2850
2858
|
const isNumber = props.type === "number";
|
2851
2859
|
value = formatNumber(value, isNumber, isNumber);
|
2852
2860
|
}
|
2861
|
+
let formatterDiffLen = 0;
|
2853
2862
|
if (props.formatter && trigger === props.formatTrigger) {
|
2854
|
-
|
2863
|
+
const {
|
2864
|
+
formatter,
|
2865
|
+
maxlength
|
2866
|
+
} = props;
|
2867
|
+
value = formatter(value);
|
2868
|
+
if (isDef(maxlength) && getStringLength(value) > maxlength) {
|
2869
|
+
value = cutString(value, +maxlength);
|
2870
|
+
}
|
2871
|
+
if (inputRef.value && state.focused) {
|
2872
|
+
const {
|
2873
|
+
selectionEnd
|
2874
|
+
} = inputRef.value;
|
2875
|
+
const bcoVal = cutString(originalValue, selectionEnd);
|
2876
|
+
formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
|
2877
|
+
}
|
2855
2878
|
}
|
2856
2879
|
if (inputRef.value && inputRef.value.value !== value) {
|
2857
|
-
if (state.focused
|
2858
|
-
|
2880
|
+
if (state.focused) {
|
2881
|
+
let {
|
2859
2882
|
selectionStart,
|
2860
2883
|
selectionEnd
|
2861
2884
|
} = inputRef.value;
|
2862
2885
|
inputRef.value.value = value;
|
2863
|
-
|
2886
|
+
if (isDef(selectionStart) && isDef(selectionEnd)) {
|
2887
|
+
const valueLen = getStringLength(value);
|
2888
|
+
if (limitDiffLen) {
|
2889
|
+
selectionStart -= limitDiffLen;
|
2890
|
+
selectionEnd -= limitDiffLen;
|
2891
|
+
} else if (formatterDiffLen) {
|
2892
|
+
selectionStart += formatterDiffLen;
|
2893
|
+
selectionEnd += formatterDiffLen;
|
2894
|
+
}
|
2895
|
+
inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
|
2896
|
+
}
|
2864
2897
|
} else {
|
2865
2898
|
inputRef.value.value = value;
|
2866
2899
|
}
|
@@ -13696,7 +13729,7 @@ function filterFiles(items, maxSize) {
|
|
13696
13729
|
});
|
13697
13730
|
return { valid, invalid };
|
13698
13731
|
}
|
13699
|
-
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
13732
|
+
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
|
13700
13733
|
const isImageUrl = (url) => IMAGE_REGEXP.test(url);
|
13701
13734
|
function isImageFile(item) {
|
13702
13735
|
if (item.isImage) {
|
@@ -13806,7 +13839,7 @@ var stdin_default$5 = defineComponent({
|
|
13806
13839
|
if (isImageFile(item)) {
|
13807
13840
|
return createVNode(Image$1, {
|
13808
13841
|
"fit": imageFit,
|
13809
|
-
"src": item.content || item.url,
|
13842
|
+
"src": item.objectUrl || item.content || item.url,
|
13810
13843
|
"class": bem("preview-image"),
|
13811
13844
|
"width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
|
13812
13845
|
"height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
|
@@ -13915,7 +13948,8 @@ var stdin_default$4 = defineComponent({
|
|
13915
13948
|
const result = {
|
13916
13949
|
file,
|
13917
13950
|
status: "",
|
13918
|
-
message: ""
|
13951
|
+
message: "",
|
13952
|
+
objectUrl: URL.createObjectURL(file)
|
13919
13953
|
};
|
13920
13954
|
if (contents[index]) {
|
13921
13955
|
result.content = contents[index];
|
@@ -13929,7 +13963,8 @@ var stdin_default$4 = defineComponent({
|
|
13929
13963
|
const result = {
|
13930
13964
|
file: files,
|
13931
13965
|
status: "",
|
13932
|
-
message: ""
|
13966
|
+
message: "",
|
13967
|
+
objectUrl: URL.createObjectURL(files)
|
13933
13968
|
};
|
13934
13969
|
if (content) {
|
13935
13970
|
result.content = content;
|
@@ -13971,8 +14006,8 @@ var stdin_default$4 = defineComponent({
|
|
13971
14006
|
if (props.previewFullImage) {
|
13972
14007
|
const imageFiles = props.modelValue.filter(isImageFile);
|
13973
14008
|
const images = imageFiles.map((item2) => {
|
13974
|
-
if (item2.
|
13975
|
-
item2.url =
|
14009
|
+
if (item2.objectUrl && !item2.url && item2.status !== "failed") {
|
14010
|
+
item2.url = item2.objectUrl;
|
13976
14011
|
urls.push(item2.url);
|
13977
14012
|
}
|
13978
14013
|
return item2.url;
|
@@ -14965,7 +15000,7 @@ const Lazyload = {
|
|
14965
15000
|
});
|
14966
15001
|
}
|
14967
15002
|
};
|
14968
|
-
const version = "3.6.
|
15003
|
+
const version = "3.6.12";
|
14969
15004
|
function install(app) {
|
14970
15005
|
const components = [
|
14971
15006
|
ActionBar,
|