vant 4.0.1 → 4.0.3
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 +4 -0
- package/es/cell/Cell.mjs +6 -1
- package/es/composables/use-height.mjs +3 -1
- package/es/field/Field.mjs +19 -10
- package/es/image/Image.mjs +14 -3
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/utils/mount-component.mjs +1 -1
- package/lib/cell/Cell.js +6 -1
- package/lib/composables/use-height.js +2 -0
- package/lib/field/Field.js +19 -10
- package/lib/image/Image.js +13 -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 +40 -14
- package/lib/vant.es.js +40 -14
- package/lib/vant.js +40 -14
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -81,6 +81,10 @@ app.use(Button);
|
|
81
81
|
|
82
82
|
See more in [Quickstart](https://vant-ui.github.io/vant#/en-US/quickstart).
|
83
83
|
|
84
|
+
## Start On Visual Studio Code Web
|
85
|
+
|
86
|
+
[https://github.dev/youzan/vant](https://github.dev/youzan/vant)
|
87
|
+
|
84
88
|
## Browser Support
|
85
89
|
|
86
90
|
Vant 2 supports modern browsers and Android >= 4.0、iOS >= 8.0.
|
package/es/cell/Cell.mjs
CHANGED
@@ -43,11 +43,16 @@ var stdin_default = defineComponent({
|
|
43
43
|
}
|
44
44
|
};
|
45
45
|
const renderTitle = () => {
|
46
|
+
var _a;
|
46
47
|
if (slots.title || isDef(props.title)) {
|
48
|
+
const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
|
49
|
+
if (Array.isArray(titleSlot) && titleSlot.length === 0) {
|
50
|
+
return;
|
51
|
+
}
|
47
52
|
return _createVNode("div", {
|
48
53
|
"class": [bem("title"), props.titleClass],
|
49
54
|
"style": props.titleStyle
|
50
|
-
}, [
|
55
|
+
}, [titleSlot || _createVNode("span", null, [props.title]), renderLabel()]);
|
51
56
|
}
|
52
57
|
};
|
53
58
|
const renderValue = () => {
|
@@ -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) {
|
@@ -432,9 +436,14 @@ var stdin_default = defineComponent({
|
|
432
436
|
return () => {
|
433
437
|
const disabled = getProp("disabled");
|
434
438
|
const labelAlign = getProp("labelAlign");
|
435
|
-
const Label = renderLabel();
|
436
439
|
const LeftIcon = renderLeftIcon();
|
437
|
-
const renderTitle = () =>
|
440
|
+
const renderTitle = () => {
|
441
|
+
const Label = renderLabel();
|
442
|
+
if (labelAlign === "top") {
|
443
|
+
return [LeftIcon, Label].filter(Boolean);
|
444
|
+
}
|
445
|
+
return Label || [];
|
446
|
+
};
|
438
447
|
return _createVNode(Cell, {
|
439
448
|
"size": props.size,
|
440
449
|
"class": bem({
|
@@ -454,7 +463,7 @@ var stdin_default = defineComponent({
|
|
454
463
|
"arrowDirection": props.arrowDirection
|
455
464
|
}, {
|
456
465
|
icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
|
457
|
-
title:
|
466
|
+
title: renderTitle,
|
458
467
|
value: renderFieldBody,
|
459
468
|
extra: slots.extra
|
460
469
|
});
|
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,14 @@ var stdin_default = defineComponent({
|
|
134
137
|
$Lazyload.$off("error", onLazyLoadError);
|
135
138
|
});
|
136
139
|
}
|
140
|
+
onMounted(() => {
|
141
|
+
nextTick(() => {
|
142
|
+
var _a;
|
143
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
144
|
+
onLoad();
|
145
|
+
}
|
146
|
+
});
|
147
|
+
});
|
137
148
|
return () => {
|
138
149
|
var _a;
|
139
150
|
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.3";
|
91
91
|
function install(app) {
|
92
92
|
const components = [
|
93
93
|
ActionBar,
|
package/lib/cell/Cell.js
CHANGED
@@ -67,11 +67,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
67
67
|
}
|
68
68
|
};
|
69
69
|
const renderTitle = () => {
|
70
|
+
var _a;
|
70
71
|
if (slots.title || (0, import_utils.isDef)(props.title)) {
|
72
|
+
const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
|
73
|
+
if (Array.isArray(titleSlot) && titleSlot.length === 0) {
|
74
|
+
return;
|
75
|
+
}
|
71
76
|
return (0, import_vue.createVNode)("div", {
|
72
77
|
"class": [bem("title"), props.titleClass],
|
73
78
|
"style": props.titleStyle
|
74
|
-
}, [
|
79
|
+
}, [titleSlot || (0, import_vue.createVNode)("span", null, [props.title]), renderLabel()]);
|
75
80
|
}
|
76
81
|
};
|
77
82
|
const renderValue = () => {
|
@@ -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) {
|
@@ -456,9 +460,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
456
460
|
return () => {
|
457
461
|
const disabled = getProp("disabled");
|
458
462
|
const labelAlign = getProp("labelAlign");
|
459
|
-
const Label = renderLabel();
|
460
463
|
const LeftIcon = renderLeftIcon();
|
461
|
-
const renderTitle = () =>
|
464
|
+
const renderTitle = () => {
|
465
|
+
const Label = renderLabel();
|
466
|
+
if (labelAlign === "top") {
|
467
|
+
return [LeftIcon, Label].filter(Boolean);
|
468
|
+
}
|
469
|
+
return Label || [];
|
470
|
+
};
|
462
471
|
return (0, import_vue.createVNode)(import_cell.Cell, {
|
463
472
|
"size": props.size,
|
464
473
|
"class": bem({
|
@@ -478,7 +487,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
478
487
|
"arrowDirection": props.arrowDirection
|
479
488
|
}, {
|
480
489
|
icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
|
481
|
-
title:
|
490
|
+
title: renderTitle,
|
482
491
|
value: renderFieldBody,
|
483
492
|
extra: slots.extra
|
484
493
|
});
|
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,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
157
160
|
$Lazyload.$off("error", onLazyLoadError);
|
158
161
|
});
|
159
162
|
}
|
163
|
+
(0, import_vue2.onMounted)(() => {
|
164
|
+
(0, import_vue2.nextTick)(() => {
|
165
|
+
var _a;
|
166
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
167
|
+
onLoad();
|
168
|
+
}
|
169
|
+
});
|
170
|
+
});
|
160
171
|
return () => {
|
161
172
|
var _a;
|
162
173
|
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.3";
|
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) {
|
@@ -3478,11 +3479,16 @@ var stdin_default$1l = vue.defineComponent({
|
|
3478
3479
|
}
|
3479
3480
|
};
|
3480
3481
|
const renderTitle = () => {
|
3482
|
+
var _a;
|
3481
3483
|
if (slots.title || isDef(props.title)) {
|
3484
|
+
const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
|
3485
|
+
if (Array.isArray(titleSlot) && titleSlot.length === 0) {
|
3486
|
+
return;
|
3487
|
+
}
|
3482
3488
|
return vue.createVNode("div", {
|
3483
3489
|
"class": [bem$1a("title"), props.titleClass],
|
3484
3490
|
"style": props.titleStyle
|
3485
|
-
}, [
|
3491
|
+
}, [titleSlot || vue.createVNode("span", null, [props.title]), renderLabel()]);
|
3486
3492
|
}
|
3487
3493
|
};
|
3488
3494
|
const renderValue = () => {
|
@@ -3976,7 +3982,9 @@ var stdin_default$1j = vue.defineComponent({
|
|
3976
3982
|
return value;
|
3977
3983
|
};
|
3978
3984
|
const updateValue = (value, trigger = "onChange") => {
|
3985
|
+
const originalValue = value;
|
3979
3986
|
value = limitValueLength(value);
|
3987
|
+
const isExceedLimit = value !== originalValue;
|
3980
3988
|
if (props.type === "number" || props.type === "digit") {
|
3981
3989
|
const isNumber = props.type === "number";
|
3982
3990
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -3985,13 +3993,15 @@ var stdin_default$1j = vue.defineComponent({
|
|
3985
3993
|
value = props.formatter(value);
|
3986
3994
|
}
|
3987
3995
|
if (inputRef.value && inputRef.value.value !== value) {
|
3988
|
-
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
3992
|
-
|
3993
|
-
|
3994
|
-
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
|
3996
|
+
if (state.focused && isExceedLimit) {
|
3997
|
+
const {
|
3998
|
+
selectionStart,
|
3999
|
+
selectionEnd
|
4000
|
+
} = inputRef.value;
|
4001
|
+
inputRef.value.value = value;
|
4002
|
+
inputRef.value.setSelectionRange(selectionStart - 1, selectionEnd - 1);
|
4003
|
+
} else {
|
4004
|
+
inputRef.value.value = value;
|
3995
4005
|
}
|
3996
4006
|
}
|
3997
4007
|
if (value !== props.modelValue) {
|
@@ -4216,9 +4226,14 @@ var stdin_default$1j = vue.defineComponent({
|
|
4216
4226
|
return () => {
|
4217
4227
|
const disabled = getProp("disabled");
|
4218
4228
|
const labelAlign = getProp("labelAlign");
|
4219
|
-
const Label = renderLabel();
|
4220
4229
|
const LeftIcon = renderLeftIcon();
|
4221
|
-
const renderTitle = () =>
|
4230
|
+
const renderTitle = () => {
|
4231
|
+
const Label = renderLabel();
|
4232
|
+
if (labelAlign === "top") {
|
4233
|
+
return [LeftIcon, Label].filter(Boolean);
|
4234
|
+
}
|
4235
|
+
return Label || [];
|
4236
|
+
};
|
4222
4237
|
return vue.createVNode(Cell, {
|
4223
4238
|
"size": props.size,
|
4224
4239
|
"class": bem$18({
|
@@ -4238,7 +4253,7 @@ var stdin_default$1j = vue.defineComponent({
|
|
4238
4253
|
"arrowDirection": props.arrowDirection
|
4239
4254
|
}, {
|
4240
4255
|
icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
|
4241
|
-
title:
|
4256
|
+
title: renderTitle,
|
4242
4257
|
value: renderFieldBody,
|
4243
4258
|
extra: slots.extra
|
4244
4259
|
});
|
@@ -6502,8 +6517,10 @@ var stdin_default$13 = vue.defineComponent({
|
|
6502
6517
|
loading.value = true;
|
6503
6518
|
});
|
6504
6519
|
const onLoad = (event) => {
|
6505
|
-
loading.value
|
6506
|
-
|
6520
|
+
if (loading.value) {
|
6521
|
+
loading.value = false;
|
6522
|
+
emit("load", event);
|
6523
|
+
}
|
6507
6524
|
};
|
6508
6525
|
const onError = (event) => {
|
6509
6526
|
error.value = true;
|
@@ -6551,6 +6568,7 @@ var stdin_default$13 = vue.defineComponent({
|
|
6551
6568
|
}, attrs), null), [[vue.resolveDirective("lazy"), props.src]]);
|
6552
6569
|
}
|
6553
6570
|
return vue.createVNode("img", vue.mergeProps({
|
6571
|
+
"ref": imageRef,
|
6554
6572
|
"src": props.src,
|
6555
6573
|
"onLoad": onLoad,
|
6556
6574
|
"onError": onError
|
@@ -6585,6 +6603,14 @@ var stdin_default$13 = vue.defineComponent({
|
|
6585
6603
|
$Lazyload.$off("error", onLazyLoadError);
|
6586
6604
|
});
|
6587
6605
|
}
|
6606
|
+
vue.onMounted(() => {
|
6607
|
+
vue.nextTick(() => {
|
6608
|
+
var _a;
|
6609
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6610
|
+
onLoad();
|
6611
|
+
}
|
6612
|
+
});
|
6613
|
+
});
|
6588
6614
|
return () => {
|
6589
6615
|
var _a;
|
6590
6616
|
return vue.createVNode("div", {
|
@@ -14821,7 +14847,7 @@ const Lazyload = {
|
|
14821
14847
|
});
|
14822
14848
|
}
|
14823
14849
|
};
|
14824
|
-
const version = "4.0.
|
14850
|
+
const version = "4.0.3";
|
14825
14851
|
function install(app) {
|
14826
14852
|
const components = [
|
14827
14853
|
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) {
|
@@ -3476,11 +3477,16 @@ var stdin_default$1l = defineComponent({
|
|
3476
3477
|
}
|
3477
3478
|
};
|
3478
3479
|
const renderTitle = () => {
|
3480
|
+
var _a;
|
3479
3481
|
if (slots.title || isDef(props.title)) {
|
3482
|
+
const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
|
3483
|
+
if (Array.isArray(titleSlot) && titleSlot.length === 0) {
|
3484
|
+
return;
|
3485
|
+
}
|
3480
3486
|
return createVNode("div", {
|
3481
3487
|
"class": [bem$1a("title"), props.titleClass],
|
3482
3488
|
"style": props.titleStyle
|
3483
|
-
}, [
|
3489
|
+
}, [titleSlot || createVNode("span", null, [props.title]), renderLabel()]);
|
3484
3490
|
}
|
3485
3491
|
};
|
3486
3492
|
const renderValue = () => {
|
@@ -3974,7 +3980,9 @@ var stdin_default$1j = defineComponent({
|
|
3974
3980
|
return value;
|
3975
3981
|
};
|
3976
3982
|
const updateValue = (value, trigger = "onChange") => {
|
3983
|
+
const originalValue = value;
|
3977
3984
|
value = limitValueLength(value);
|
3985
|
+
const isExceedLimit = value !== originalValue;
|
3978
3986
|
if (props.type === "number" || props.type === "digit") {
|
3979
3987
|
const isNumber = props.type === "number";
|
3980
3988
|
value = formatNumber(value, isNumber, isNumber);
|
@@ -3983,13 +3991,15 @@ var stdin_default$1j = defineComponent({
|
|
3983
3991
|
value = props.formatter(value);
|
3984
3992
|
}
|
3985
3993
|
if (inputRef.value && inputRef.value.value !== value) {
|
3986
|
-
|
3987
|
-
|
3988
|
-
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
3992
|
-
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
|
3994
|
+
if (state.focused && isExceedLimit) {
|
3995
|
+
const {
|
3996
|
+
selectionStart,
|
3997
|
+
selectionEnd
|
3998
|
+
} = inputRef.value;
|
3999
|
+
inputRef.value.value = value;
|
4000
|
+
inputRef.value.setSelectionRange(selectionStart - 1, selectionEnd - 1);
|
4001
|
+
} else {
|
4002
|
+
inputRef.value.value = value;
|
3993
4003
|
}
|
3994
4004
|
}
|
3995
4005
|
if (value !== props.modelValue) {
|
@@ -4214,9 +4224,14 @@ var stdin_default$1j = defineComponent({
|
|
4214
4224
|
return () => {
|
4215
4225
|
const disabled = getProp("disabled");
|
4216
4226
|
const labelAlign = getProp("labelAlign");
|
4217
|
-
const Label = renderLabel();
|
4218
4227
|
const LeftIcon = renderLeftIcon();
|
4219
|
-
const renderTitle = () =>
|
4228
|
+
const renderTitle = () => {
|
4229
|
+
const Label = renderLabel();
|
4230
|
+
if (labelAlign === "top") {
|
4231
|
+
return [LeftIcon, Label].filter(Boolean);
|
4232
|
+
}
|
4233
|
+
return Label || [];
|
4234
|
+
};
|
4220
4235
|
return createVNode(Cell, {
|
4221
4236
|
"size": props.size,
|
4222
4237
|
"class": bem$18({
|
@@ -4236,7 +4251,7 @@ var stdin_default$1j = defineComponent({
|
|
4236
4251
|
"arrowDirection": props.arrowDirection
|
4237
4252
|
}, {
|
4238
4253
|
icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
|
4239
|
-
title:
|
4254
|
+
title: renderTitle,
|
4240
4255
|
value: renderFieldBody,
|
4241
4256
|
extra: slots.extra
|
4242
4257
|
});
|
@@ -6500,8 +6515,10 @@ var stdin_default$13 = defineComponent({
|
|
6500
6515
|
loading.value = true;
|
6501
6516
|
});
|
6502
6517
|
const onLoad = (event) => {
|
6503
|
-
loading.value
|
6504
|
-
|
6518
|
+
if (loading.value) {
|
6519
|
+
loading.value = false;
|
6520
|
+
emit("load", event);
|
6521
|
+
}
|
6505
6522
|
};
|
6506
6523
|
const onError = (event) => {
|
6507
6524
|
error.value = true;
|
@@ -6549,6 +6566,7 @@ var stdin_default$13 = defineComponent({
|
|
6549
6566
|
}, attrs), null), [[resolveDirective("lazy"), props.src]]);
|
6550
6567
|
}
|
6551
6568
|
return createVNode("img", mergeProps({
|
6569
|
+
"ref": imageRef,
|
6552
6570
|
"src": props.src,
|
6553
6571
|
"onLoad": onLoad,
|
6554
6572
|
"onError": onError
|
@@ -6583,6 +6601,14 @@ var stdin_default$13 = defineComponent({
|
|
6583
6601
|
$Lazyload.$off("error", onLazyLoadError);
|
6584
6602
|
});
|
6585
6603
|
}
|
6604
|
+
onMounted(() => {
|
6605
|
+
nextTick(() => {
|
6606
|
+
var _a;
|
6607
|
+
if ((_a = imageRef.value) == null ? void 0 : _a.complete) {
|
6608
|
+
onLoad();
|
6609
|
+
}
|
6610
|
+
});
|
6611
|
+
});
|
6586
6612
|
return () => {
|
6587
6613
|
var _a;
|
6588
6614
|
return createVNode("div", {
|
@@ -14819,7 +14845,7 @@ const Lazyload = {
|
|
14819
14845
|
});
|
14820
14846
|
}
|
14821
14847
|
};
|
14822
|
-
const version = "4.0.
|
14848
|
+
const version = "4.0.3";
|
14823
14849
|
function install(app) {
|
14824
14850
|
const components = [
|
14825
14851
|
ActionBar,
|