vant 4.9.1 → 4.9.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/es/action-bar-button/ActionBarButton.d.ts +3 -3
- package/es/action-bar-button/index.d.ts +2 -2
- package/es/action-bar-icon/ActionBarIcon.d.ts +3 -3
- package/es/action-bar-icon/index.d.ts +2 -2
- package/es/button/Button.d.ts +3 -3
- package/es/button/index.d.ts +2 -2
- package/es/calendar/CalendarHeader.mjs +5 -17
- package/es/calendar/utils.mjs +6 -0
- package/es/card/Card.mjs +3 -3
- package/es/cell/Cell.d.ts +3 -3
- package/es/cell/index.d.ts +2 -2
- package/es/composables/use-route.d.ts +1 -2
- package/es/form/Form.d.ts +3 -0
- package/es/form/Form.mjs +9 -2
- package/es/form/index.d.ts +2 -0
- package/es/grid-item/GridItem.d.ts +3 -3
- package/es/grid-item/index.d.ts +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/notify/types.d.ts +3 -0
- package/es/sidebar-item/SidebarItem.d.ts +3 -3
- package/es/sidebar-item/index.d.ts +2 -2
- package/es/tab/Tab.d.ts +3 -3
- package/es/tab/index.d.ts +2 -2
- package/es/tabbar-item/TabbarItem.d.ts +3 -3
- package/es/tabbar-item/index.d.ts +2 -2
- package/es/tabs/utils.mjs +3 -1
- package/es/text-ellipsis/TextEllipsis.mjs +56 -46
- package/es/uploader/Uploader.mjs +6 -8
- package/es/uploader/index.d.ts +1 -1
- package/es/uploader/types.d.ts +1 -0
- package/lib/action-bar-button/ActionBarButton.d.ts +3 -3
- package/lib/action-bar-button/index.d.ts +2 -2
- package/lib/action-bar-icon/ActionBarIcon.d.ts +3 -3
- package/lib/action-bar-icon/index.d.ts +2 -2
- package/lib/button/Button.d.ts +3 -3
- package/lib/button/index.d.ts +2 -2
- package/lib/calendar/CalendarHeader.js +4 -16
- package/lib/calendar/utils.js +6 -0
- package/lib/card/Card.js +2 -2
- package/lib/cell/Cell.d.ts +3 -3
- package/lib/cell/index.d.ts +2 -2
- package/lib/composables/use-route.d.ts +1 -2
- package/lib/form/Form.d.ts +3 -0
- package/lib/form/Form.js +9 -2
- package/lib/form/index.d.ts +2 -0
- package/lib/grid-item/GridItem.d.ts +3 -3
- package/lib/grid-item/index.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/notify/types.d.ts +3 -0
- package/lib/sidebar-item/SidebarItem.d.ts +3 -3
- package/lib/sidebar-item/index.d.ts +2 -2
- package/lib/tab/Tab.d.ts +3 -3
- package/lib/tab/index.d.ts +2 -2
- package/lib/tabbar-item/TabbarItem.d.ts +3 -3
- package/lib/tabbar-item/index.d.ts +2 -2
- package/lib/tabs/utils.js +3 -1
- package/lib/text-ellipsis/TextEllipsis.js +55 -45
- package/lib/uploader/Uploader.js +6 -8
- package/lib/uploader/index.d.ts +1 -1
- package/lib/uploader/types.d.ts +1 -0
- package/lib/vant.cjs.js +86 -75
- package/lib/vant.es.js +86 -75
- package/lib/vant.js +87 -76
- package/lib/vant.min.js +3 -3
- package/lib/web-types.json +1 -1
- package/package.json +15 -15
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
import { type BadgeProps } from '../badge';
|
3
3
|
export declare const sidebarItemProps: {
|
4
|
-
to: PropType<import("vue-router").
|
4
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
5
5
|
url: StringConstructor;
|
6
6
|
replace: BooleanConstructor;
|
7
7
|
} & {
|
@@ -13,7 +13,7 @@ export declare const sidebarItemProps: {
|
|
13
13
|
};
|
14
14
|
export type SidebarItemProps = ExtractPropTypes<typeof sidebarItemProps>;
|
15
15
|
declare const _default: import("vue").DefineComponent<{
|
16
|
-
to: PropType<import("vue-router").
|
16
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
17
17
|
url: StringConstructor;
|
18
18
|
replace: BooleanConstructor;
|
19
19
|
} & {
|
@@ -23,7 +23,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
23
23
|
disabled: BooleanConstructor;
|
24
24
|
badgeProps: PropType<Partial<BadgeProps>>;
|
25
25
|
}, (() => import("vue/jsx-runtime").JSX.Element) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
26
|
-
to: PropType<import("vue-router").
|
26
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
27
27
|
url: StringConstructor;
|
28
28
|
replace: BooleanConstructor;
|
29
29
|
} & {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export declare const SidebarItem: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
|
-
to: import("vue").PropType<import("vue-router").
|
2
|
+
to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
3
3
|
url: StringConstructor;
|
4
4
|
replace: BooleanConstructor;
|
5
5
|
} & {
|
@@ -9,7 +9,7 @@ export declare const SidebarItem: import("../utils").WithInstall<import("vue").D
|
|
9
9
|
disabled: BooleanConstructor;
|
10
10
|
badgeProps: import("vue").PropType<Partial<import("..").BadgeProps>>;
|
11
11
|
}, (() => import("vue/jsx-runtime").JSX.Element) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
12
|
-
to: import("vue").PropType<import("vue-router").
|
12
|
+
to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
13
13
|
url: StringConstructor;
|
14
14
|
replace: BooleanConstructor;
|
15
15
|
} & {
|
package/lib/tab/Tab.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type PropType, type CSSProperties, type ExtractPropTypes } from 'vue';
|
2
2
|
export declare const tabProps: {
|
3
|
-
to: PropType<import("vue-router").
|
3
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
4
4
|
url: StringConstructor;
|
5
5
|
replace: BooleanConstructor;
|
6
6
|
} & {
|
@@ -18,7 +18,7 @@ export declare const tabProps: {
|
|
18
18
|
};
|
19
19
|
export type TabProps = ExtractPropTypes<typeof tabProps>;
|
20
20
|
declare const _default: import("vue").DefineComponent<{
|
21
|
-
to: PropType<import("vue-router").
|
21
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
22
22
|
url: StringConstructor;
|
23
23
|
replace: BooleanConstructor;
|
24
24
|
} & {
|
@@ -34,7 +34,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
34
34
|
default: true;
|
35
35
|
};
|
36
36
|
}, (() => import("vue/jsx-runtime").JSX.Element | undefined) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
37
|
-
to: PropType<import("vue-router").
|
37
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
38
38
|
url: StringConstructor;
|
39
39
|
replace: BooleanConstructor;
|
40
40
|
} & {
|
package/lib/tab/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
export declare const Tab: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
|
-
to: import("vue").PropType<import("vue-router").
|
2
|
+
to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
3
3
|
url: StringConstructor;
|
4
4
|
replace: BooleanConstructor;
|
5
5
|
} & {
|
@@ -15,7 +15,7 @@ export declare const Tab: import("../utils").WithInstall<import("vue").DefineCom
|
|
15
15
|
default: true;
|
16
16
|
};
|
17
17
|
}, (() => import("vue/jsx-runtime").JSX.Element | undefined) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
18
|
-
to: import("vue").PropType<import("vue-router").
|
18
|
+
to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
19
19
|
url: StringConstructor;
|
20
20
|
replace: BooleanConstructor;
|
21
21
|
} & {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
import { type BadgeProps } from '../badge';
|
3
3
|
export declare const tabbarItemProps: {
|
4
|
-
to: PropType<import("vue-router").
|
4
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
5
5
|
url: StringConstructor;
|
6
6
|
replace: BooleanConstructor;
|
7
7
|
} & {
|
@@ -14,7 +14,7 @@ export declare const tabbarItemProps: {
|
|
14
14
|
};
|
15
15
|
export type TabbarItemProps = ExtractPropTypes<typeof tabbarItemProps>;
|
16
16
|
declare const _default: import("vue").DefineComponent<{
|
17
|
-
to: PropType<import("vue-router").
|
17
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
18
18
|
url: StringConstructor;
|
19
19
|
replace: BooleanConstructor;
|
20
20
|
} & {
|
@@ -25,7 +25,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
25
25
|
badgeProps: PropType<Partial<BadgeProps>>;
|
26
26
|
iconPrefix: StringConstructor;
|
27
27
|
}, (() => import("vue/jsx-runtime").JSX.Element) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
28
|
-
to: PropType<import("vue-router").
|
28
|
+
to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
29
29
|
url: StringConstructor;
|
30
30
|
replace: BooleanConstructor;
|
31
31
|
} & {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export declare const TabbarItem: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
|
-
to: import("vue").PropType<import("vue-router").
|
2
|
+
to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
3
3
|
url: StringConstructor;
|
4
4
|
replace: BooleanConstructor;
|
5
5
|
} & {
|
@@ -10,7 +10,7 @@ export declare const TabbarItem: import("../utils").WithInstall<import("vue").De
|
|
10
10
|
badgeProps: import("vue").PropType<Partial<import("..").BadgeProps>>;
|
11
11
|
iconPrefix: StringConstructor;
|
12
12
|
}, (() => import("vue/jsx-runtime").JSX.Element) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
13
|
-
to: import("vue").PropType<import("vue-router").
|
13
|
+
to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
|
14
14
|
url: StringConstructor;
|
15
15
|
replace: BooleanConstructor;
|
16
16
|
} & {
|
package/lib/tabs/utils.js
CHANGED
@@ -28,11 +28,13 @@ function scrollLeftTo(scroller, to, duration) {
|
|
28
28
|
let count = 0;
|
29
29
|
const from = scroller.scrollLeft;
|
30
30
|
const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
31
|
+
let scrollLeft = from;
|
31
32
|
function cancel() {
|
32
33
|
(0, import_use.cancelRaf)(rafId);
|
33
34
|
}
|
34
35
|
function animate() {
|
35
|
-
|
36
|
+
scrollLeft += (to - from) / frames;
|
37
|
+
scroller.scrollLeft = scrollLeft;
|
36
38
|
if (++count < frames) {
|
37
39
|
rafId = (0, import_use.raf)(animate);
|
38
40
|
}
|
@@ -42,10 +42,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
42
42
|
emit,
|
43
43
|
slots
|
44
44
|
}) {
|
45
|
-
const text = (0, import_vue2.ref)(
|
45
|
+
const text = (0, import_vue2.ref)(props.content);
|
46
46
|
const expanded = (0, import_vue2.ref)(false);
|
47
47
|
const hasAction = (0, import_vue2.ref)(false);
|
48
48
|
const root = (0, import_vue2.ref)();
|
49
|
+
const actionRef = (0, import_vue2.ref)();
|
49
50
|
let needRecalculate = false;
|
50
51
|
const actionText = (0, import_vue2.computed)(() => expanded.value ? props.collapseText : props.expandText);
|
51
52
|
const pxToNum = (value) => {
|
@@ -73,57 +74,60 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
73
74
|
document.body.appendChild(container);
|
74
75
|
return container;
|
75
76
|
};
|
76
|
-
const
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
}
|
90
|
-
return dots + content.slice(right, end);
|
91
|
-
}
|
92
|
-
const middle2 = Math.round((left + right) / 2);
|
77
|
+
const calcEllipsisText = (container, maxHeight) => {
|
78
|
+
var _a, _b;
|
79
|
+
const {
|
80
|
+
content,
|
81
|
+
position,
|
82
|
+
dots
|
83
|
+
} = props;
|
84
|
+
const end = content.length;
|
85
|
+
const middle = 0 + end >> 1;
|
86
|
+
const actionHTML = slots.action ? (_b = (_a = actionRef.value) == null ? void 0 : _a.outerHTML) != null ? _b : "" : props.expandText;
|
87
|
+
const calcEllipse = () => {
|
88
|
+
const tail = (left, right) => {
|
89
|
+
if (right - left <= 1) {
|
93
90
|
if (position === "end") {
|
94
|
-
|
95
|
-
} else {
|
96
|
-
container2.innerText = dots + content.slice(middle2, end) + actionText.value;
|
97
|
-
}
|
98
|
-
if (container2.offsetHeight > maxHeight2) {
|
99
|
-
if (position === "end") {
|
100
|
-
return tail(left, middle2);
|
101
|
-
}
|
102
|
-
return tail(middle2, right);
|
91
|
+
return content.slice(0, left) + dots;
|
103
92
|
}
|
93
|
+
return dots + content.slice(right, end);
|
94
|
+
}
|
95
|
+
const middle2 = Math.round((left + right) / 2);
|
96
|
+
if (position === "end") {
|
97
|
+
container.innerText = content.slice(0, middle2) + dots;
|
98
|
+
} else {
|
99
|
+
container.innerText = dots + content.slice(middle2, end);
|
100
|
+
}
|
101
|
+
container.innerHTML += actionHTML;
|
102
|
+
if (container.offsetHeight > maxHeight) {
|
104
103
|
if (position === "end") {
|
105
|
-
return tail(
|
104
|
+
return tail(left, middle2);
|
106
105
|
}
|
107
|
-
return tail(
|
108
|
-
};
|
109
|
-
container2.innerText = tail(0, end);
|
110
|
-
};
|
111
|
-
const middleTail = (leftPart, rightPart) => {
|
112
|
-
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
113
|
-
return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
|
106
|
+
return tail(middle2, right);
|
114
107
|
}
|
115
|
-
|
116
|
-
|
117
|
-
container2.innerText = props.content.slice(0, leftMiddle) + props.dots + props.content.slice(rightMiddle, end) + props.expandText;
|
118
|
-
if (container2.offsetHeight >= maxHeight2) {
|
119
|
-
return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
108
|
+
if (position === "end") {
|
109
|
+
return tail(middle2, right);
|
120
110
|
}
|
121
|
-
return
|
111
|
+
return tail(left, middle2);
|
122
112
|
};
|
123
|
-
|
124
|
-
|
125
|
-
|
113
|
+
return tail(0, end);
|
114
|
+
};
|
115
|
+
const middleTail = (leftPart, rightPart) => {
|
116
|
+
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
117
|
+
return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
|
118
|
+
}
|
119
|
+
const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
120
|
+
const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
121
|
+
container.innerText = props.content.slice(0, leftMiddle) + props.dots + props.content.slice(rightMiddle, end);
|
122
|
+
container.innerHTML += actionHTML;
|
123
|
+
if (container.offsetHeight >= maxHeight) {
|
124
|
+
return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
125
|
+
}
|
126
|
+
return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
|
126
127
|
};
|
128
|
+
return props.position === "middle" ? middleTail([0, middle], [middle, end]) : calcEllipse();
|
129
|
+
};
|
130
|
+
const calcEllipsised = () => {
|
127
131
|
const container = cloneContainer();
|
128
132
|
if (!container) {
|
129
133
|
needRecalculate = true;
|
@@ -156,11 +160,17 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
156
160
|
expanded: expanded.value
|
157
161
|
}) : actionText.value;
|
158
162
|
return (0, import_vue.createVNode)("span", {
|
163
|
+
"ref": actionRef,
|
159
164
|
"class": bem("action"),
|
160
165
|
"onClick": onClickAction
|
161
166
|
}, [action]);
|
162
167
|
};
|
163
|
-
(0, import_vue2.onMounted)(
|
168
|
+
(0, import_vue2.onMounted)(() => {
|
169
|
+
calcEllipsised();
|
170
|
+
if (slots.action) {
|
171
|
+
(0, import_vue2.nextTick)(calcEllipsised);
|
172
|
+
}
|
173
|
+
});
|
164
174
|
(0, import_vue2.onActivated)(() => {
|
165
175
|
if (needRecalculate) {
|
166
176
|
needRecalculate = false;
|
package/lib/uploader/Uploader.js
CHANGED
@@ -216,7 +216,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
216
216
|
emit("update:modelValue", fileList);
|
217
217
|
emit("delete", item, getDetail(index));
|
218
218
|
};
|
219
|
-
const
|
219
|
+
const reuploadFile = (index) => {
|
220
220
|
isReuploading.value = true;
|
221
221
|
reuploadIndex.value = index;
|
222
222
|
(0, import_vue2.nextTick)(() => chooseFile());
|
@@ -236,7 +236,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
236
236
|
"onClick": () => emit(props.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
|
237
237
|
"onDelete": () => deleteFile(item, index),
|
238
238
|
"onPreview": () => previewImage(item),
|
239
|
-
"onReupload": () =>
|
239
|
+
"onReupload": () => reuploadFile(index)
|
240
240
|
}, (0, import_utils.pick)(props, ["name", "lazyLoad"]), previewData), (0, import_utils.pick)(slots, ["preview-cover", "preview-delete"]));
|
241
241
|
};
|
242
242
|
const renderPreviewList = () => {
|
@@ -246,10 +246,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
246
246
|
};
|
247
247
|
const onClickUpload = (event) => emit("clickUpload", event);
|
248
248
|
const renderUpload = () => {
|
249
|
-
|
250
|
-
return;
|
251
|
-
}
|
252
|
-
const hideUploader = props.modelValue.length >= +props.maxCount && props.reupload;
|
249
|
+
const lessThanMax = props.modelValue.length < +props.maxCount;
|
253
250
|
const Input = props.readonly ? null : (0, import_vue.createVNode)("input", {
|
254
251
|
"ref": inputRef,
|
255
252
|
"type": "file",
|
@@ -265,7 +262,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
265
262
|
return (0, import_vue.withDirectives)((0, import_vue.createVNode)("div", {
|
266
263
|
"class": (0, import_utils2.bem)("input-wrapper"),
|
267
264
|
"onClick": onClickUpload
|
268
|
-
}, [slots.default(), Input]), [[import_vue.vShow,
|
265
|
+
}, [slots.default(), Input]), [[import_vue.vShow, lessThanMax]]);
|
269
266
|
}
|
270
267
|
return (0, import_vue.withDirectives)((0, import_vue.createVNode)("div", {
|
271
268
|
"class": (0, import_utils2.bem)("upload", {
|
@@ -278,7 +275,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
278
275
|
"class": (0, import_utils2.bem)("upload-icon")
|
279
276
|
}, null), props.uploadText && (0, import_vue.createVNode)("span", {
|
280
277
|
"class": (0, import_utils2.bem)("upload-text")
|
281
|
-
}, [props.uploadText]), Input]), [[import_vue.vShow, props.showUpload &&
|
278
|
+
}, [props.uploadText]), Input]), [[import_vue.vShow, props.showUpload && lessThanMax]]);
|
282
279
|
};
|
283
280
|
const chooseFile = () => {
|
284
281
|
if (inputRef.value && !props.disabled) {
|
@@ -290,6 +287,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
290
287
|
});
|
291
288
|
(0, import_use_expose.useExpose)({
|
292
289
|
chooseFile,
|
290
|
+
reuploadFile,
|
293
291
|
closeImagePreview
|
294
292
|
});
|
295
293
|
(0, import_use.useCustomFieldValue)(() => props.modelValue);
|
package/lib/uploader/index.d.ts
CHANGED
@@ -151,7 +151,7 @@ export declare const Uploader: import("../utils").WithInstall<import("vue").Defi
|
|
151
151
|
export default Uploader;
|
152
152
|
export { uploaderProps } from './Uploader';
|
153
153
|
export type { UploaderProps };
|
154
|
-
export type { UploaderInstance, UploaderThemeVars, UploaderResultType, UploaderFileListItem, } from './types';
|
154
|
+
export type { UploaderInstance, UploaderThemeVars, UploaderResultType, UploaderFileListItem, UploaderBeforeRead, UploaderAfterRead, } from './types';
|
155
155
|
declare module 'vue' {
|
156
156
|
interface GlobalComponents {
|
157
157
|
VanUploader: typeof Uploader;
|
package/lib/uploader/types.d.ts
CHANGED
@@ -29,6 +29,7 @@ export type UploaderAfterRead = (items: UploaderFileListItem | UploaderFileListI
|
|
29
29
|
export type UploaderExpose = {
|
30
30
|
chooseFile: () => void;
|
31
31
|
closeImagePreview: () => void;
|
32
|
+
reuploadFile: (index: number) => void;
|
32
33
|
};
|
33
34
|
export type UploaderInstance = ComponentPublicInstance<UploaderProps, UploaderExpose>;
|
34
35
|
export type UploaderThemeVars = {
|
package/lib/vant.cjs.js
CHANGED
@@ -1985,11 +1985,13 @@ function scrollLeftTo(scroller, to, duration) {
|
|
1985
1985
|
let count = 0;
|
1986
1986
|
const from = scroller.scrollLeft;
|
1987
1987
|
const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
1988
|
+
let scrollLeft = from;
|
1988
1989
|
function cancel() {
|
1989
1990
|
use.cancelRaf(rafId);
|
1990
1991
|
}
|
1991
1992
|
function animate() {
|
1992
|
-
|
1993
|
+
scrollLeft += (to - from) / frames;
|
1994
|
+
scroller.scrollLeft = scrollLeft;
|
1993
1995
|
if (++count < frames) {
|
1994
1996
|
rafId = use.raf(animate);
|
1995
1997
|
}
|
@@ -3821,6 +3823,7 @@ const formProps = {
|
|
3821
3823
|
labelAlign: String,
|
3822
3824
|
inputAlign: String,
|
3823
3825
|
scrollToError: Boolean,
|
3826
|
+
scrollToErrorPosition: String,
|
3824
3827
|
validateFirst: Boolean,
|
3825
3828
|
submitOnEnter: truthProp,
|
3826
3829
|
showErrorMessage: truthProp,
|
@@ -3934,8 +3937,14 @@ var stdin_default$1w = vue.defineComponent({
|
|
3934
3937
|
values,
|
3935
3938
|
errors
|
3936
3939
|
});
|
3937
|
-
|
3938
|
-
|
3940
|
+
const {
|
3941
|
+
scrollToError,
|
3942
|
+
scrollToErrorPosition
|
3943
|
+
} = props2;
|
3944
|
+
if (scrollToError && errors[0].name) {
|
3945
|
+
scrollToField(errors[0].name, scrollToErrorPosition ? {
|
3946
|
+
block: scrollToErrorPosition
|
3947
|
+
} : void 0);
|
3939
3948
|
}
|
3940
3949
|
});
|
3941
3950
|
};
|
@@ -6330,11 +6339,17 @@ function getDayByOffset(date, offset) {
|
|
6330
6339
|
function getMonthByOffset(date, offset) {
|
6331
6340
|
const cloned = cloneDate(date);
|
6332
6341
|
cloned.setMonth(cloned.getMonth() + offset);
|
6342
|
+
if (cloned.getDate() !== date.getDate()) {
|
6343
|
+
cloned.setDate(0);
|
6344
|
+
}
|
6333
6345
|
return cloned;
|
6334
6346
|
}
|
6335
6347
|
function getYearByOffset(date, offset) {
|
6336
6348
|
const cloned = cloneDate(date);
|
6337
6349
|
cloned.setFullYear(cloned.getFullYear() + offset);
|
6350
|
+
if (cloned.getDate() !== date.getDate()) {
|
6351
|
+
cloned.setDate(0);
|
6352
|
+
}
|
6338
6353
|
return cloned;
|
6339
6354
|
}
|
6340
6355
|
const getPrevDay = (date) => getDayByOffset(date, -1);
|
@@ -6738,22 +6753,10 @@ var stdin_default$1e = vue.defineComponent({
|
|
6738
6753
|
slots,
|
6739
6754
|
emit
|
6740
6755
|
}) {
|
6741
|
-
const prevMonthDisabled = vue.computed(() =>
|
6742
|
-
|
6743
|
-
|
6744
|
-
|
6745
|
-
const prevYearDisabled = vue.computed(() => {
|
6746
|
-
const prevYear = getPrevYear(props2.date);
|
6747
|
-
return props2.minDate && prevYear < props2.minDate;
|
6748
|
-
});
|
6749
|
-
const nextMonthDisabled = vue.computed(() => {
|
6750
|
-
const nextMonth = getNextMonth(props2.date);
|
6751
|
-
return props2.maxDate && nextMonth > props2.maxDate;
|
6752
|
-
});
|
6753
|
-
const nextYearDisabled = vue.computed(() => {
|
6754
|
-
const nextYear = getNextYear(props2.date);
|
6755
|
-
return props2.maxDate && nextYear > props2.maxDate;
|
6756
|
-
});
|
6756
|
+
const prevMonthDisabled = vue.computed(() => props2.date && props2.minDate && compareMonth(getPrevMonth(props2.date), props2.minDate) < 0);
|
6757
|
+
const prevYearDisabled = vue.computed(() => props2.date && props2.minDate && compareMonth(getPrevYear(props2.date), props2.minDate) < 0);
|
6758
|
+
const nextMonthDisabled = vue.computed(() => props2.date && props2.maxDate && compareMonth(getNextMonth(props2.date), props2.maxDate) > 0);
|
6759
|
+
const nextYearDisabled = vue.computed(() => props2.date && props2.maxDate && compareMonth(getNextYear(props2.date), props2.maxDate) > 0);
|
6757
6760
|
const renderTitle = () => {
|
6758
6761
|
if (props2.showTitle) {
|
6759
6762
|
const text = props2.title || t$g("title");
|
@@ -7519,9 +7522,9 @@ var stdin_default$1b = vue.defineComponent({
|
|
7519
7522
|
"class": bem$11("price-currency")
|
7520
7523
|
}, [props2.currency]), vue.createVNode("span", {
|
7521
7524
|
"class": bem$11("price-integer")
|
7522
|
-
}, [priceArr[0]]), vue.createTextVNode("."), vue.createVNode("span", {
|
7525
|
+
}, [priceArr[0]]), priceArr.length > 1 && vue.createVNode(vue.Fragment, null, [vue.createTextVNode("."), vue.createVNode("span", {
|
7523
7526
|
"class": bem$11("price-decimal")
|
7524
|
-
}, [priceArr[1]])]);
|
7527
|
+
}, [priceArr[1]])])]);
|
7525
7528
|
};
|
7526
7529
|
return () => {
|
7527
7530
|
var _a, _b, _c;
|
@@ -15228,10 +15231,11 @@ var stdin_default$9 = vue.defineComponent({
|
|
15228
15231
|
emit,
|
15229
15232
|
slots
|
15230
15233
|
}) {
|
15231
|
-
const text = vue.ref(
|
15234
|
+
const text = vue.ref(props2.content);
|
15232
15235
|
const expanded = vue.ref(false);
|
15233
15236
|
const hasAction = vue.ref(false);
|
15234
15237
|
const root = vue.ref();
|
15238
|
+
const actionRef = vue.ref();
|
15235
15239
|
let needRecalculate = false;
|
15236
15240
|
const actionText = vue.computed(() => expanded.value ? props2.collapseText : props2.expandText);
|
15237
15241
|
const pxToNum = (value) => {
|
@@ -15259,57 +15263,60 @@ var stdin_default$9 = vue.defineComponent({
|
|
15259
15263
|
document.body.appendChild(container);
|
15260
15264
|
return container;
|
15261
15265
|
};
|
15262
|
-
const
|
15263
|
-
|
15264
|
-
|
15265
|
-
|
15266
|
-
|
15267
|
-
|
15268
|
-
|
15269
|
-
|
15270
|
-
|
15271
|
-
|
15272
|
-
|
15273
|
-
|
15274
|
-
|
15275
|
-
}
|
15276
|
-
return dots + content.slice(right, end);
|
15277
|
-
}
|
15278
|
-
const middle2 = Math.round((left + right) / 2);
|
15266
|
+
const calcEllipsisText = (container, maxHeight) => {
|
15267
|
+
var _a, _b;
|
15268
|
+
const {
|
15269
|
+
content,
|
15270
|
+
position,
|
15271
|
+
dots
|
15272
|
+
} = props2;
|
15273
|
+
const end = content.length;
|
15274
|
+
const middle = 0 + end >> 1;
|
15275
|
+
const actionHTML = slots.action ? (_b = (_a = actionRef.value) == null ? void 0 : _a.outerHTML) != null ? _b : "" : props2.expandText;
|
15276
|
+
const calcEllipse = () => {
|
15277
|
+
const tail = (left, right) => {
|
15278
|
+
if (right - left <= 1) {
|
15279
15279
|
if (position === "end") {
|
15280
|
-
|
15281
|
-
} else {
|
15282
|
-
container2.innerText = dots + content.slice(middle2, end) + actionText.value;
|
15283
|
-
}
|
15284
|
-
if (container2.offsetHeight > maxHeight2) {
|
15285
|
-
if (position === "end") {
|
15286
|
-
return tail(left, middle2);
|
15287
|
-
}
|
15288
|
-
return tail(middle2, right);
|
15280
|
+
return content.slice(0, left) + dots;
|
15289
15281
|
}
|
15282
|
+
return dots + content.slice(right, end);
|
15283
|
+
}
|
15284
|
+
const middle2 = Math.round((left + right) / 2);
|
15285
|
+
if (position === "end") {
|
15286
|
+
container.innerText = content.slice(0, middle2) + dots;
|
15287
|
+
} else {
|
15288
|
+
container.innerText = dots + content.slice(middle2, end);
|
15289
|
+
}
|
15290
|
+
container.innerHTML += actionHTML;
|
15291
|
+
if (container.offsetHeight > maxHeight) {
|
15290
15292
|
if (position === "end") {
|
15291
|
-
return tail(
|
15293
|
+
return tail(left, middle2);
|
15292
15294
|
}
|
15293
|
-
return tail(
|
15294
|
-
};
|
15295
|
-
container2.innerText = tail(0, end);
|
15296
|
-
};
|
15297
|
-
const middleTail = (leftPart, rightPart) => {
|
15298
|
-
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
15299
|
-
return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
|
15295
|
+
return tail(middle2, right);
|
15300
15296
|
}
|
15301
|
-
|
15302
|
-
|
15303
|
-
container2.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end) + props2.expandText;
|
15304
|
-
if (container2.offsetHeight >= maxHeight2) {
|
15305
|
-
return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
15297
|
+
if (position === "end") {
|
15298
|
+
return tail(middle2, right);
|
15306
15299
|
}
|
15307
|
-
return
|
15300
|
+
return tail(left, middle2);
|
15308
15301
|
};
|
15309
|
-
|
15310
|
-
|
15311
|
-
|
15302
|
+
return tail(0, end);
|
15303
|
+
};
|
15304
|
+
const middleTail = (leftPart, rightPart) => {
|
15305
|
+
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
15306
|
+
return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
|
15307
|
+
}
|
15308
|
+
const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
15309
|
+
const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
15310
|
+
container.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end);
|
15311
|
+
container.innerHTML += actionHTML;
|
15312
|
+
if (container.offsetHeight >= maxHeight) {
|
15313
|
+
return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
15314
|
+
}
|
15315
|
+
return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
|
15312
15316
|
};
|
15317
|
+
return props2.position === "middle" ? middleTail([0, middle], [middle, end]) : calcEllipse();
|
15318
|
+
};
|
15319
|
+
const calcEllipsised = () => {
|
15313
15320
|
const container = cloneContainer();
|
15314
15321
|
if (!container) {
|
15315
15322
|
needRecalculate = true;
|
@@ -15342,11 +15349,17 @@ var stdin_default$9 = vue.defineComponent({
|
|
15342
15349
|
expanded: expanded.value
|
15343
15350
|
}) : actionText.value;
|
15344
15351
|
return vue.createVNode("span", {
|
15352
|
+
"ref": actionRef,
|
15345
15353
|
"class": bem$3("action"),
|
15346
15354
|
"onClick": onClickAction
|
15347
15355
|
}, [action]);
|
15348
15356
|
};
|
15349
|
-
vue.onMounted(
|
15357
|
+
vue.onMounted(() => {
|
15358
|
+
calcEllipsised();
|
15359
|
+
if (slots.action) {
|
15360
|
+
vue.nextTick(calcEllipsised);
|
15361
|
+
}
|
15362
|
+
});
|
15350
15363
|
vue.onActivated(() => {
|
15351
15364
|
if (needRecalculate) {
|
15352
15365
|
needRecalculate = false;
|
@@ -15945,7 +15958,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
15945
15958
|
emit("update:modelValue", fileList);
|
15946
15959
|
emit("delete", item, getDetail(index));
|
15947
15960
|
};
|
15948
|
-
const
|
15961
|
+
const reuploadFile = (index) => {
|
15949
15962
|
isReuploading.value = true;
|
15950
15963
|
reuploadIndex.value = index;
|
15951
15964
|
vue.nextTick(() => chooseFile());
|
@@ -15965,7 +15978,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
15965
15978
|
"onClick": () => emit(props2.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
|
15966
15979
|
"onDelete": () => deleteFile(item, index),
|
15967
15980
|
"onPreview": () => previewImage(item),
|
15968
|
-
"onReupload": () =>
|
15981
|
+
"onReupload": () => reuploadFile(index)
|
15969
15982
|
}, pick(props2, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
|
15970
15983
|
};
|
15971
15984
|
const renderPreviewList = () => {
|
@@ -15975,10 +15988,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
15975
15988
|
};
|
15976
15989
|
const onClickUpload = (event) => emit("clickUpload", event);
|
15977
15990
|
const renderUpload = () => {
|
15978
|
-
|
15979
|
-
return;
|
15980
|
-
}
|
15981
|
-
const hideUploader = props2.modelValue.length >= +props2.maxCount && props2.reupload;
|
15991
|
+
const lessThanMax = props2.modelValue.length < +props2.maxCount;
|
15982
15992
|
const Input = props2.readonly ? null : vue.createVNode("input", {
|
15983
15993
|
"ref": inputRef,
|
15984
15994
|
"type": "file",
|
@@ -15994,7 +16004,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
15994
16004
|
return vue.withDirectives(vue.createVNode("div", {
|
15995
16005
|
"class": bem$1("input-wrapper"),
|
15996
16006
|
"onClick": onClickUpload
|
15997
|
-
}, [slots.default(), Input]), [[vue.vShow,
|
16007
|
+
}, [slots.default(), Input]), [[vue.vShow, lessThanMax]]);
|
15998
16008
|
}
|
15999
16009
|
return vue.withDirectives(vue.createVNode("div", {
|
16000
16010
|
"class": bem$1("upload", {
|
@@ -16007,7 +16017,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
16007
16017
|
"class": bem$1("upload-icon")
|
16008
16018
|
}, null), props2.uploadText && vue.createVNode("span", {
|
16009
16019
|
"class": bem$1("upload-text")
|
16010
|
-
}, [props2.uploadText]), Input]), [[vue.vShow, props2.showUpload &&
|
16020
|
+
}, [props2.uploadText]), Input]), [[vue.vShow, props2.showUpload && lessThanMax]]);
|
16011
16021
|
};
|
16012
16022
|
const chooseFile = () => {
|
16013
16023
|
if (inputRef.value && !props2.disabled) {
|
@@ -16019,6 +16029,7 @@ var stdin_default$5 = vue.defineComponent({
|
|
16019
16029
|
});
|
16020
16030
|
useExpose({
|
16021
16031
|
chooseFile,
|
16032
|
+
reuploadFile,
|
16022
16033
|
closeImagePreview
|
16023
16034
|
});
|
16024
16035
|
use.useCustomFieldValue(() => props2.modelValue);
|
@@ -17034,7 +17045,7 @@ const Lazyload = {
|
|
17034
17045
|
});
|
17035
17046
|
}
|
17036
17047
|
};
|
17037
|
-
const version = "4.9.
|
17048
|
+
const version = "4.9.3";
|
17038
17049
|
function install(app) {
|
17039
17050
|
const components = [
|
17040
17051
|
ActionBar,
|