vant 3.5.1 → 3.5.4
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/LICENSE +10 -0
- package/README.md +13 -13
- package/changelog.generated.md +54 -0
- package/es/action-bar/ActionBar.d.ts +4 -0
- package/es/action-bar/ActionBar.mjs +13 -2
- package/es/action-bar/index.d.ts +3 -0
- package/es/button/index.less +1 -1
- package/es/calendar/Calendar.mjs +3 -1
- package/es/calendar/types.d.ts +1 -0
- package/es/cell/Cell.d.ts +1 -1
- package/es/cell/index.d.ts +1 -1
- package/es/collapse/Collapse.d.ts +8 -1
- package/es/collapse/Collapse.mjs +28 -1
- package/es/collapse/index.d.ts +1 -1
- package/es/collapse-item/CollapseItem.d.ts +1 -1
- package/es/collapse-item/CollapseItem.mjs +3 -1
- package/es/collapse-item/index.d.ts +1 -1
- package/es/collapse-item/index.less +1 -1
- package/es/composables/use-height.d.ts +1 -1
- package/es/composables/use-height.mjs +6 -2
- package/es/composables/use-placeholder.mjs +1 -1
- package/es/dialog/Dialog.d.ts +1 -1
- package/es/field/Field.d.ts +4 -2
- package/es/field/Field.mjs +7 -1
- package/es/field/index.d.ts +4 -2
- package/es/field/index.less +1 -1
- package/es/grid-item/index.less +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/locale/index.d.ts +1 -1
- package/es/popover/Popover.mjs +17 -18
- package/es/sidebar-item/index.less +1 -1
- package/es/submit-bar/SubmitBar.d.ts +4 -0
- package/es/submit-bar/SubmitBar.mjs +13 -2
- package/es/submit-bar/index.d.ts +3 -0
- package/es/swipe/index.less +1 -1
- package/es/switch/index.less +1 -1
- package/es/toast/index.less +1 -1
- package/es/uploader/Uploader.mjs +1 -1
- package/es/utils/basic.d.ts +3 -3
- package/es/utils/create.d.ts +1 -1
- package/lib/action-bar/ActionBar.d.ts +4 -0
- package/lib/action-bar/ActionBar.js +12 -1
- package/lib/action-bar/index.d.ts +3 -0
- package/lib/button/index.less +1 -1
- package/lib/calendar/Calendar.js +3 -1
- package/lib/calendar/types.d.ts +1 -0
- package/lib/cell/Cell.d.ts +1 -1
- package/lib/cell/index.d.ts +1 -1
- package/lib/collapse/Collapse.d.ts +8 -1
- package/lib/collapse/Collapse.js +28 -1
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse-item/CollapseItem.d.ts +1 -1
- package/lib/collapse-item/CollapseItem.js +3 -1
- package/lib/collapse-item/index.d.ts +1 -1
- package/lib/collapse-item/index.less +1 -1
- package/lib/composables/use-height.d.ts +1 -1
- package/lib/composables/use-height.js +6 -2
- package/lib/composables/use-placeholder.js +1 -1
- package/lib/dialog/Dialog.d.ts +1 -1
- package/lib/field/Field.d.ts +4 -2
- package/lib/field/Field.js +7 -1
- package/lib/field/index.d.ts +4 -2
- package/lib/field/index.less +1 -1
- package/lib/grid-item/index.less +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/index.d.ts +1 -1
- package/lib/popover/Popover.js +17 -18
- package/lib/sidebar-item/index.less +1 -1
- package/lib/submit-bar/SubmitBar.d.ts +4 -0
- package/lib/submit-bar/SubmitBar.js +12 -1
- package/lib/submit-bar/index.d.ts +3 -0
- package/lib/swipe/index.less +1 -1
- package/lib/switch/index.less +1 -1
- package/lib/toast/index.less +1 -1
- package/lib/uploader/Uploader.js +1 -1
- package/lib/utils/basic.d.ts +3 -3
- package/lib/utils/create.d.ts +1 -1
- package/lib/vant.cjs.js +182 -50
- package/lib/vant.es.js +271 -49
- package/lib/vant.js +107 -48
- package/lib/vant.min.js +1 -1
- package/{vetur → lib}/web-types.json +1346 -1312
- package/package.json +9 -14
- package/lib/ssr.js +0 -7
- package/lib/ssr.mjs +0 -1
- package/lib/vant.cjs.min.js +0 -1
- package/lib/vant.es.min.js +0 -14667
- package/vetur/attributes.json +0 -3474
- package/vetur/tags.json +0 -1202
package/es/popover/Popover.mjs
CHANGED
@@ -43,22 +43,23 @@ var stdin_default = defineComponent({
|
|
43
43
|
let popper;
|
44
44
|
const wrapperRef = ref();
|
45
45
|
const popoverRef = ref();
|
46
|
+
const getPopoverOptions = () => ({
|
47
|
+
placement: props.placement,
|
48
|
+
modifiers: [{
|
49
|
+
name: "computeStyles",
|
50
|
+
options: {
|
51
|
+
adaptive: false,
|
52
|
+
gpuAcceleration: false
|
53
|
+
}
|
54
|
+
}, extend({}, offsetModifier, {
|
55
|
+
options: {
|
56
|
+
offset: props.offset
|
57
|
+
}
|
58
|
+
})]
|
59
|
+
});
|
46
60
|
const createPopperInstance = () => {
|
47
61
|
if (wrapperRef.value && popoverRef.value) {
|
48
|
-
return createPopper(wrapperRef.value, popoverRef.value.popupRef.value,
|
49
|
-
placement: props.placement,
|
50
|
-
modifiers: [{
|
51
|
-
name: "computeStyles",
|
52
|
-
options: {
|
53
|
-
adaptive: false,
|
54
|
-
gpuAcceleration: false
|
55
|
-
}
|
56
|
-
}, extend({}, offsetModifier, {
|
57
|
-
options: {
|
58
|
-
offset: props.offset
|
59
|
-
}
|
60
|
-
})]
|
61
|
-
});
|
62
|
+
return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
|
62
63
|
}
|
63
64
|
return null;
|
64
65
|
};
|
@@ -70,9 +71,7 @@ var stdin_default = defineComponent({
|
|
70
71
|
if (!popper) {
|
71
72
|
popper = createPopperInstance();
|
72
73
|
} else {
|
73
|
-
popper.setOptions(
|
74
|
-
placement: props.placement
|
75
|
-
});
|
74
|
+
popper.setOptions(getPopoverOptions());
|
76
75
|
}
|
77
76
|
});
|
78
77
|
};
|
@@ -143,7 +142,7 @@ var stdin_default = defineComponent({
|
|
143
142
|
popper = null;
|
144
143
|
}
|
145
144
|
});
|
146
|
-
watch(() => [props.show, props.placement], updateLocation);
|
145
|
+
watch(() => [props.show, props.offset, props.placement], updateLocation);
|
147
146
|
useClickAway(wrapperRef, onClickAway, {
|
148
147
|
eventName: "touchstart"
|
149
148
|
});
|
@@ -20,6 +20,7 @@ declare const submitBarProps: {
|
|
20
20
|
};
|
21
21
|
buttonColor: StringConstructor;
|
22
22
|
suffixLabel: StringConstructor;
|
23
|
+
placeholder: BooleanConstructor;
|
23
24
|
decimalLength: {
|
24
25
|
type: (NumberConstructor | StringConstructor)[];
|
25
26
|
default: number;
|
@@ -49,6 +50,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
49
50
|
};
|
50
51
|
buttonColor: StringConstructor;
|
51
52
|
suffixLabel: StringConstructor;
|
53
|
+
placeholder: BooleanConstructor;
|
52
54
|
decimalLength: {
|
53
55
|
type: (NumberConstructor | StringConstructor)[];
|
54
56
|
default: number;
|
@@ -76,6 +78,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
76
78
|
};
|
77
79
|
buttonColor: StringConstructor;
|
78
80
|
suffixLabel: StringConstructor;
|
81
|
+
placeholder: BooleanConstructor;
|
79
82
|
decimalLength: {
|
80
83
|
type: (NumberConstructor | StringConstructor)[];
|
81
84
|
default: number;
|
@@ -88,6 +91,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
88
91
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
89
92
|
}, {
|
90
93
|
disabled: boolean;
|
94
|
+
placeholder: boolean;
|
91
95
|
safeAreaInsetBottom: boolean;
|
92
96
|
loading: boolean;
|
93
97
|
currency: string;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
|
-
import { defineComponent } from "vue";
|
2
|
+
import { ref, defineComponent } from "vue";
|
3
3
|
import { truthProp, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { Icon } from "../icon/index.mjs";
|
5
5
|
import { Button } from "../button/index.mjs";
|
6
|
+
import { usePlaceholder } from "../composables/use-placeholder.mjs";
|
6
7
|
const [name, bem, t] = createNamespace("submit-bar");
|
7
8
|
const submitBarProps = {
|
8
9
|
tip: String,
|
@@ -17,6 +18,7 @@ const submitBarProps = {
|
|
17
18
|
buttonType: makeStringProp("danger"),
|
18
19
|
buttonColor: String,
|
19
20
|
suffixLabel: String,
|
21
|
+
placeholder: Boolean,
|
20
22
|
decimalLength: makeNumericProp(2),
|
21
23
|
safeAreaInsetBottom: truthProp
|
22
24
|
};
|
@@ -28,6 +30,8 @@ var stdin_default = defineComponent({
|
|
28
30
|
emit,
|
29
31
|
slots
|
30
32
|
}) {
|
33
|
+
const root = ref();
|
34
|
+
const renderPlaceholder = usePlaceholder(root, bem);
|
31
35
|
const renderText = () => {
|
32
36
|
const {
|
33
37
|
price,
|
@@ -87,9 +91,10 @@ var stdin_default = defineComponent({
|
|
87
91
|
"onClick": onClickButton
|
88
92
|
}, null);
|
89
93
|
};
|
90
|
-
|
94
|
+
const renderSubmitBar = () => {
|
91
95
|
var _a, _b;
|
92
96
|
return _createVNode("div", {
|
97
|
+
"ref": root,
|
93
98
|
"class": [bem(), {
|
94
99
|
"van-safe-area-bottom": props.safeAreaInsetBottom
|
95
100
|
}]
|
@@ -97,6 +102,12 @@ var stdin_default = defineComponent({
|
|
97
102
|
"class": bem("bar")
|
98
103
|
}, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
|
99
104
|
};
|
105
|
+
return () => {
|
106
|
+
if (props.placeholder) {
|
107
|
+
return renderPlaceholder(renderSubmitBar);
|
108
|
+
}
|
109
|
+
return renderSubmitBar();
|
110
|
+
};
|
100
111
|
}
|
101
112
|
});
|
102
113
|
export {
|
package/es/submit-bar/index.d.ts
CHANGED
@@ -17,6 +17,7 @@ export declare const SubmitBar: import("../utils").WithInstall<import("vue").Def
|
|
17
17
|
};
|
18
18
|
buttonColor: StringConstructor;
|
19
19
|
suffixLabel: StringConstructor;
|
20
|
+
placeholder: BooleanConstructor;
|
20
21
|
decimalLength: {
|
21
22
|
type: (NumberConstructor | StringConstructor)[];
|
22
23
|
default: number;
|
@@ -44,6 +45,7 @@ export declare const SubmitBar: import("../utils").WithInstall<import("vue").Def
|
|
44
45
|
};
|
45
46
|
buttonColor: StringConstructor;
|
46
47
|
suffixLabel: StringConstructor;
|
48
|
+
placeholder: BooleanConstructor;
|
47
49
|
decimalLength: {
|
48
50
|
type: (NumberConstructor | StringConstructor)[];
|
49
51
|
default: number;
|
@@ -56,6 +58,7 @@ export declare const SubmitBar: import("../utils").WithInstall<import("vue").Def
|
|
56
58
|
onSubmit?: ((...args: any[]) => any) | undefined;
|
57
59
|
}, {
|
58
60
|
disabled: boolean;
|
61
|
+
placeholder: boolean;
|
59
62
|
safeAreaInsetBottom: boolean;
|
60
63
|
loading: boolean;
|
61
64
|
currency: string;
|
package/es/swipe/index.less
CHANGED
package/es/switch/index.less
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
left: 0;
|
34
34
|
width: var(--van-switch-node-size);
|
35
35
|
height: var(--van-switch-node-size);
|
36
|
-
// https://github.com/
|
36
|
+
// https://github.com/vant-ui/vant/issues/9839
|
37
37
|
font-size: inherit;
|
38
38
|
background: var(--van-switch-node-background-color);
|
39
39
|
border-radius: 100%;
|
package/es/toast/index.less
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
// allow newline character
|
39
39
|
white-space: pre-wrap;
|
40
40
|
text-align: center;
|
41
|
-
// https://github.com/
|
41
|
+
// https://github.com/vant-ui/vant/issues/8959
|
42
42
|
word-break: break-all;
|
43
43
|
background: var(--van-toast-background-color);
|
44
44
|
border-radius: var(--van-toast-border-radius);
|
package/es/uploader/Uploader.mjs
CHANGED
@@ -147,7 +147,7 @@ var stdin_default = defineComponent({
|
|
147
147
|
if (props.previewFullImage) {
|
148
148
|
const imageFiles = props.modelValue.filter(isImageFile);
|
149
149
|
const images = imageFiles.map((item2) => {
|
150
|
-
if (item2.file && !item2.url) {
|
150
|
+
if (item2.file && !item2.url && item2.status !== "failed") {
|
151
151
|
item2.url = URL.createObjectURL(item2.file);
|
152
152
|
urls.push(item2.url);
|
153
153
|
}
|
package/es/utils/basic.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { ComponentPublicInstance } from 'vue';
|
2
2
|
export declare function noop(): void;
|
3
3
|
export declare const extend: {
|
4
|
-
<T, U>(target: T, source: U): T & U;
|
5
|
-
<T_1, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
6
|
-
<T_2, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
4
|
+
<T extends {}, U>(target: T, source: U): T & U;
|
5
|
+
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
6
|
+
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
7
7
|
(target: object, ...sources: any[]): any;
|
8
8
|
};
|
9
9
|
export declare const inBrowser: boolean;
|
package/es/utils/create.d.ts
CHANGED
@@ -12,6 +12,6 @@ export declare type Mods = Mod | Mod[];
|
|
12
12
|
* b('text', { disabled }) // 'button__text button__text--disabled'
|
13
13
|
* b(['disabled', 'primary']) // 'button button--disabled button--primary'
|
14
14
|
*/
|
15
|
-
export declare function createBEM(name: string): (el?: Mods
|
15
|
+
export declare function createBEM(name: string): (el?: Mods, mods?: Mods) => Mods;
|
16
16
|
export declare type BEM = ReturnType<typeof createBEM>;
|
17
17
|
export declare function createNamespace(name: string): readonly [string, (el?: Mods | undefined, mods?: Mods | undefined) => Mods, (path: string, ...args: unknown[]) => any];
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { type ExtractPropTypes } from 'vue';
|
2
2
|
export declare const ACTION_BAR_KEY: unique symbol;
|
3
3
|
declare const actionBarProps: {
|
4
|
+
placeholder: BooleanConstructor;
|
4
5
|
safeAreaInsetBottom: {
|
5
6
|
type: BooleanConstructor;
|
6
7
|
default: true;
|
@@ -8,16 +9,19 @@ declare const actionBarProps: {
|
|
8
9
|
};
|
9
10
|
export declare type ActionBarProps = ExtractPropTypes<typeof actionBarProps>;
|
10
11
|
declare const _default: import("vue").DefineComponent<{
|
12
|
+
placeholder: BooleanConstructor;
|
11
13
|
safeAreaInsetBottom: {
|
12
14
|
type: BooleanConstructor;
|
13
15
|
default: true;
|
14
16
|
};
|
15
17
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
18
|
+
placeholder: BooleanConstructor;
|
16
19
|
safeAreaInsetBottom: {
|
17
20
|
type: BooleanConstructor;
|
18
21
|
default: true;
|
19
22
|
};
|
20
23
|
}>>, {
|
24
|
+
placeholder: boolean;
|
21
25
|
safeAreaInsetBottom: boolean;
|
22
26
|
}>;
|
23
27
|
export default _default;
|
@@ -25,9 +25,11 @@ var import_vue = require("vue");
|
|
25
25
|
var import_vue2 = require("vue");
|
26
26
|
var import_utils = require("../utils");
|
27
27
|
var import_use = require("@vant/use");
|
28
|
+
var import_use_placeholder = require("../composables/use-placeholder");
|
28
29
|
const [name, bem] = (0, import_utils.createNamespace)("action-bar");
|
29
30
|
const ACTION_BAR_KEY = Symbol(name);
|
30
31
|
const actionBarProps = {
|
32
|
+
placeholder: Boolean,
|
31
33
|
safeAreaInsetBottom: import_utils.truthProp
|
32
34
|
};
|
33
35
|
var stdin_default = (0, import_vue2.defineComponent)({
|
@@ -36,17 +38,26 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
36
38
|
setup(props, {
|
37
39
|
slots
|
38
40
|
}) {
|
41
|
+
const root = (0, import_vue2.ref)();
|
42
|
+
const renderPlaceholder = (0, import_use_placeholder.usePlaceholder)(root, bem);
|
39
43
|
const {
|
40
44
|
linkChildren
|
41
45
|
} = (0, import_use.useChildren)(ACTION_BAR_KEY);
|
42
46
|
linkChildren();
|
43
|
-
|
47
|
+
const renderActionBar = () => {
|
44
48
|
var _a;
|
45
49
|
return (0, import_vue.createVNode)("div", {
|
50
|
+
"ref": root,
|
46
51
|
"class": [bem(), {
|
47
52
|
"van-safe-area-bottom": props.safeAreaInsetBottom
|
48
53
|
}]
|
49
54
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
50
55
|
};
|
56
|
+
return () => {
|
57
|
+
if (props.placeholder) {
|
58
|
+
return renderPlaceholder(renderActionBar);
|
59
|
+
}
|
60
|
+
return renderActionBar();
|
61
|
+
};
|
51
62
|
}
|
52
63
|
});
|
@@ -1,14 +1,17 @@
|
|
1
1
|
export declare const ActionBar: import("../utils").WithInstall<import("vue").DefineComponent<{
|
2
|
+
placeholder: BooleanConstructor;
|
2
3
|
safeAreaInsetBottom: {
|
3
4
|
type: BooleanConstructor;
|
4
5
|
default: true;
|
5
6
|
};
|
6
7
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
8
|
+
placeholder: BooleanConstructor;
|
7
9
|
safeAreaInsetBottom: {
|
8
10
|
type: BooleanConstructor;
|
9
11
|
default: true;
|
10
12
|
};
|
11
13
|
}>>, {
|
14
|
+
placeholder: boolean;
|
12
15
|
safeAreaInsetBottom: boolean;
|
13
16
|
}>>;
|
14
17
|
export default ActionBar;
|
package/lib/button/index.less
CHANGED
package/lib/calendar/Calendar.js
CHANGED
@@ -158,6 +158,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
158
158
|
}
|
159
159
|
return !currentDate.value;
|
160
160
|
});
|
161
|
+
const getSelectedDate = () => currentDate.value;
|
161
162
|
const onScroll = () => {
|
162
163
|
const top = (0, import_utils.getScrollTop)(bodyRef.value);
|
163
164
|
const bottom = top + bodyHeight;
|
@@ -400,7 +401,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
400
401
|
});
|
401
402
|
(0, import_use_expose.useExpose)({
|
402
403
|
reset,
|
403
|
-
scrollToDate
|
404
|
+
scrollToDate,
|
405
|
+
getSelectedDate
|
404
406
|
});
|
405
407
|
(0, import_use.onMountedOrActivated)(init);
|
406
408
|
return () => {
|
package/lib/calendar/types.d.ts
CHANGED
@@ -15,6 +15,7 @@ export declare type CalendarDayItem = {
|
|
15
15
|
export declare type CalendarExpose = {
|
16
16
|
reset: (date?: Date | Date[]) => void;
|
17
17
|
scrollToDate: (targetDate: Date) => void;
|
18
|
+
getSelectedDate: () => Date | Date[] | null;
|
18
19
|
};
|
19
20
|
export declare type CalendarInstance = ComponentPublicInstance<CalendarProps, CalendarExpose>;
|
20
21
|
export declare type CalendarMonthInstance = ComponentPublicInstance<CalendarMonthProps, {
|
package/lib/cell/Cell.d.ts
CHANGED
@@ -110,10 +110,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
110
110
|
replace: BooleanConstructor;
|
111
111
|
}>>, {
|
112
112
|
replace: boolean;
|
113
|
+
required: boolean;
|
113
114
|
center: boolean;
|
114
115
|
isLink: boolean;
|
115
116
|
border: boolean;
|
116
|
-
required: boolean;
|
117
117
|
clickable: boolean | null;
|
118
118
|
}>;
|
119
119
|
export default _default;
|
package/lib/cell/index.d.ts
CHANGED
@@ -54,10 +54,10 @@ export declare const Cell: import("../utils").WithInstall<import("vue").DefineCo
|
|
54
54
|
replace: BooleanConstructor;
|
55
55
|
}>>, {
|
56
56
|
replace: boolean;
|
57
|
+
required: boolean;
|
57
58
|
center: boolean;
|
58
59
|
isLink: boolean;
|
59
60
|
border: boolean;
|
60
|
-
required: boolean;
|
61
61
|
clickable: boolean | null;
|
62
62
|
}>>;
|
63
63
|
export default Cell;
|
@@ -1,9 +1,13 @@
|
|
1
|
-
import { type PropType, type InjectionKey, type ExtractPropTypes } from 'vue';
|
1
|
+
import { type PropType, type InjectionKey, type ExtractPropTypes, type ComponentPublicInstance } from 'vue';
|
2
2
|
import { type Numeric } from '../utils';
|
3
3
|
export declare type CollapseProvide = {
|
4
4
|
toggle: (name: Numeric, expanded: boolean) => void;
|
5
5
|
isExpanded: (name: Numeric) => boolean;
|
6
6
|
};
|
7
|
+
export declare type CollapseToggleAllOptions = boolean | {
|
8
|
+
expanded?: boolean;
|
9
|
+
skipDisabled?: boolean;
|
10
|
+
};
|
7
11
|
export declare const COLLAPSE_KEY: InjectionKey<CollapseProvide>;
|
8
12
|
declare const collapseProps: {
|
9
13
|
border: {
|
@@ -17,6 +21,9 @@ declare const collapseProps: {
|
|
17
21
|
};
|
18
22
|
};
|
19
23
|
export declare type CollapseProps = ExtractPropTypes<typeof collapseProps>;
|
24
|
+
export declare type CollapseInstance = ComponentPublicInstance<{
|
25
|
+
toggleAll: (options?: boolean | CollapseToggleAllOptions) => void;
|
26
|
+
}>;
|
20
27
|
declare const _default: import("vue").DefineComponent<{
|
21
28
|
border: {
|
22
29
|
type: BooleanConstructor;
|
package/lib/collapse/Collapse.js
CHANGED
@@ -25,6 +25,7 @@ var import_vue = require("vue");
|
|
25
25
|
var import_vue2 = require("vue");
|
26
26
|
var import_utils = require("../utils");
|
27
27
|
var import_use = require("@vant/use");
|
28
|
+
var import_use_expose = require("../composables/use-expose");
|
28
29
|
const [name, bem] = (0, import_utils.createNamespace)("collapse");
|
29
30
|
const COLLAPSE_KEY = Symbol(name);
|
30
31
|
const collapseProps = {
|
@@ -55,7 +56,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
55
56
|
slots
|
56
57
|
}) {
|
57
58
|
const {
|
58
|
-
linkChildren
|
59
|
+
linkChildren,
|
60
|
+
children
|
59
61
|
} = (0, import_use.useChildren)(COLLAPSE_KEY);
|
60
62
|
const updateName = (name2) => {
|
61
63
|
emit("change", name2);
|
@@ -74,6 +76,28 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
74
76
|
updateName(modelValue.filter((activeName) => activeName !== name2));
|
75
77
|
}
|
76
78
|
};
|
79
|
+
const toggleAll = (options = {}) => {
|
80
|
+
if (props.accordion) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
if (typeof options === "boolean") {
|
84
|
+
options = {
|
85
|
+
expanded: options
|
86
|
+
};
|
87
|
+
}
|
88
|
+
const {
|
89
|
+
expanded,
|
90
|
+
skipDisabled
|
91
|
+
} = options;
|
92
|
+
const expandedChildren = children.filter((item) => {
|
93
|
+
if (item.disabled && skipDisabled) {
|
94
|
+
return item.expanded.value;
|
95
|
+
}
|
96
|
+
return expanded != null ? expanded : !item.expanded.value;
|
97
|
+
});
|
98
|
+
const names = expandedChildren.map((item) => item.itemName.value);
|
99
|
+
updateName(names);
|
100
|
+
};
|
77
101
|
const isExpanded = (name2) => {
|
78
102
|
const {
|
79
103
|
accordion,
|
@@ -84,6 +108,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
84
108
|
}
|
85
109
|
return accordion ? modelValue === name2 : modelValue.includes(name2);
|
86
110
|
};
|
111
|
+
(0, import_use_expose.useExpose)({
|
112
|
+
toggleAll
|
113
|
+
});
|
87
114
|
linkChildren({
|
88
115
|
toggle,
|
89
116
|
isExpanded
|
package/lib/collapse/index.d.ts
CHANGED
@@ -27,7 +27,7 @@ export declare const Collapse: import("../utils").WithInstall<import("vue").Defi
|
|
27
27
|
accordion: boolean;
|
28
28
|
}>>;
|
29
29
|
export default Collapse;
|
30
|
-
export type { CollapseProps } from './Collapse';
|
30
|
+
export type { CollapseProps, CollapseInstance, CollapseToggleAllOptions, } from './Collapse';
|
31
31
|
declare module 'vue' {
|
32
32
|
interface GlobalComponents {
|
33
33
|
VanCollapse: typeof Collapse;
|
@@ -107,11 +107,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
107
107
|
default: true;
|
108
108
|
};
|
109
109
|
}>>, {
|
110
|
+
required: boolean;
|
110
111
|
center: boolean;
|
111
112
|
disabled: boolean;
|
112
113
|
isLink: boolean;
|
113
114
|
border: boolean;
|
114
|
-
required: boolean;
|
115
115
|
clickable: boolean | null;
|
116
116
|
readonly: boolean;
|
117
117
|
lazyRender: boolean;
|
@@ -142,7 +142,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
142
142
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[import_vue.vShow, show.value]]);
|
143
143
|
});
|
144
144
|
(0, import_use_expose.useExpose)({
|
145
|
-
toggle
|
145
|
+
toggle,
|
146
|
+
expanded,
|
147
|
+
itemName: name2
|
146
148
|
});
|
147
149
|
return () => (0, import_vue.createVNode)("div", {
|
148
150
|
"class": [bem({
|
@@ -69,11 +69,11 @@ export declare const CollapseItem: import("../utils").WithInstall<import("vue").
|
|
69
69
|
default: true;
|
70
70
|
};
|
71
71
|
}>>, {
|
72
|
+
required: boolean;
|
72
73
|
center: boolean;
|
73
74
|
disabled: boolean;
|
74
75
|
isLink: boolean;
|
75
76
|
border: boolean;
|
76
|
-
required: boolean;
|
77
77
|
clickable: boolean | null;
|
78
78
|
readonly: boolean;
|
79
79
|
lazyRender: boolean;
|
@@ -23,7 +23,7 @@
|
|
23
23
|
&__title {
|
24
24
|
.van-cell__right-icon::before {
|
25
25
|
// using translateZ to fix safari rendering issues
|
26
|
-
// see: https://github.com/
|
26
|
+
// see: https://github.com/vant-ui/vant/issues/8608
|
27
27
|
transform: rotate(90deg) translateZ(0);
|
28
28
|
transition: transform var(--van-collapse-item-transition-duration);
|
29
29
|
}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { Ref } from 'vue';
|
2
|
-
export declare const useHeight: (element: Element | Ref<Element | undefined
|
2
|
+
export declare const useHeight: (element: Element | Ref<Element | undefined>, withSafeArea?: boolean) => Ref<number | undefined>;
|
@@ -22,14 +22,18 @@ __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
|
-
const useHeight = (element) => {
|
25
|
+
const useHeight = (element, withSafeArea) => {
|
26
26
|
const height = (0, import_vue.ref)();
|
27
27
|
const setHeight = () => {
|
28
28
|
height.value = (0, import_use.useRect)(element).height;
|
29
29
|
};
|
30
30
|
(0, import_vue.onMounted)(() => {
|
31
31
|
(0, import_vue.nextTick)(setHeight);
|
32
|
-
|
32
|
+
if (withSafeArea) {
|
33
|
+
for (let i = 1; i <= 3; i++) {
|
34
|
+
setTimeout(setHeight, 100 * i);
|
35
|
+
}
|
36
|
+
}
|
33
37
|
});
|
34
38
|
return height;
|
35
39
|
};
|
@@ -23,7 +23,7 @@ module.exports = __toCommonJS(stdin_exports);
|
|
23
23
|
var import_vue = require("vue");
|
24
24
|
var import_use_height = require("./use-height");
|
25
25
|
function usePlaceholder(contentRef, bem) {
|
26
|
-
const height = (0, import_use_height.useHeight)(contentRef);
|
26
|
+
const height = (0, import_use_height.useHeight)(contentRef, true);
|
27
27
|
return (renderContent) => (0, import_vue.createVNode)("div", {
|
28
28
|
"class": bem("placeholder"),
|
29
29
|
"style": {
|
package/lib/dialog/Dialog.d.ts
CHANGED
@@ -30,7 +30,7 @@ declare const dialogProps: {
|
|
30
30
|
theme: PropType<DialogTheme>;
|
31
31
|
width: (NumberConstructor | StringConstructor)[];
|
32
32
|
message: PropType<DialogMessage>;
|
33
|
-
callback: PropType<(action?: DialogAction
|
33
|
+
callback: PropType<(action?: DialogAction) => void>;
|
34
34
|
allowHtml: BooleanConstructor;
|
35
35
|
className: PropType<unknown>;
|
36
36
|
transition: {
|
package/lib/field/Field.d.ts
CHANGED
@@ -209,7 +209,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
209
209
|
type: BooleanConstructor;
|
210
210
|
default: null;
|
211
211
|
};
|
212
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "focus" | "blur" | "keypress" | "click-input" | "click-left-icon" | "click-right-icon" | "update:modelValue")[], "clear" | "focus" | "blur" | "keypress" | "click-input" | "click-left-icon" | "click-right-icon" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
212
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clear" | "focus" | "blur" | "keypress" | "click-input" | "end-validate" | "start-validate" | "click-left-icon" | "click-right-icon" | "update:modelValue")[], "clear" | "focus" | "blur" | "keypress" | "click-input" | "end-validate" | "start-validate" | "click-left-icon" | "click-right-icon" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
213
213
|
icon: StringConstructor;
|
214
214
|
size: PropType<import("../cell").CellSize>;
|
215
215
|
title: (NumberConstructor | StringConstructor)[];
|
@@ -297,17 +297,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
297
297
|
onKeypress?: ((...args: any[]) => any) | undefined;
|
298
298
|
onClear?: ((...args: any[]) => any) | undefined;
|
299
299
|
"onClick-input"?: ((...args: any[]) => any) | undefined;
|
300
|
+
"onEnd-validate"?: ((...args: any[]) => any) | undefined;
|
301
|
+
"onStart-validate"?: ((...args: any[]) => any) | undefined;
|
300
302
|
"onClick-left-icon"?: ((...args: any[]) => any) | undefined;
|
301
303
|
"onClick-right-icon"?: ((...args: any[]) => any) | undefined;
|
302
304
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
303
305
|
}, {
|
304
306
|
type: FieldType;
|
307
|
+
required: boolean;
|
305
308
|
center: boolean;
|
306
309
|
autofocus: boolean;
|
307
310
|
disabled: boolean;
|
308
311
|
isLink: boolean;
|
309
312
|
border: boolean;
|
310
|
-
required: boolean;
|
311
313
|
clickable: boolean | null;
|
312
314
|
clearable: boolean;
|
313
315
|
clearIcon: string;
|
package/lib/field/Field.js
CHANGED
@@ -81,7 +81,7 @@ const fieldProps = (0, import_utils.extend)({}, import_Cell.cellSharedProps, fie
|
|
81
81
|
var stdin_default = (0, import_vue2.defineComponent)({
|
82
82
|
name,
|
83
83
|
props: fieldProps,
|
84
|
-
emits: ["blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon", "update:modelValue"],
|
84
|
+
emits: ["blur", "focus", "clear", "keypress", "click-input", "end-validate", "start-validate", "click-left-icon", "click-right-icon", "update:modelValue"],
|
85
85
|
setup(props, {
|
86
86
|
emit,
|
87
87
|
slots
|
@@ -155,18 +155,24 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
155
155
|
state.status = "unvalidated";
|
156
156
|
state.validateMessage = "";
|
157
157
|
};
|
158
|
+
const endValidate = () => emit("end-validate", {
|
159
|
+
status: state.status
|
160
|
+
});
|
158
161
|
const validate = (rules = props.rules) => new Promise((resolve) => {
|
159
162
|
resetValidation();
|
160
163
|
if (rules) {
|
164
|
+
emit("start-validate");
|
161
165
|
runRules(rules).then(() => {
|
162
166
|
if (state.status === "failed") {
|
163
167
|
resolve({
|
164
168
|
name: props.name,
|
165
169
|
message: state.validateMessage
|
166
170
|
});
|
171
|
+
endValidate();
|
167
172
|
} else {
|
168
173
|
state.status = "passed";
|
169
174
|
resolve();
|
175
|
+
endValidate();
|
170
176
|
}
|
171
177
|
});
|
172
178
|
} else {
|