vant 4.4.1 → 4.5.0
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/address-list/AddressList.d.ts +13 -0
- package/es/address-list/AddressList.mjs +4 -2
- package/es/address-list/AddressListItem.d.ts +9 -0
- package/es/address-list/AddressListItem.mjs +4 -3
- package/es/address-list/index.d.ts +9 -0
- package/es/back-top/BackTop.mjs +14 -1
- package/es/date-picker/DatePicker.d.ts +3 -3
- package/es/date-picker/index.d.ts +2 -2
- package/es/date-picker/utils.d.ts +4 -2
- package/es/date-picker/utils.mjs +8 -3
- package/es/dropdown-menu/DropdownMenu.mjs +10 -3
- package/es/dropdown-menu/types.d.ts +5 -1
- package/es/floating-panel/FloatingPanel.d.ts +77 -0
- package/es/floating-panel/FloatingPanel.mjs +126 -0
- package/es/floating-panel/index.css +1 -0
- package/es/floating-panel/index.d.ts +60 -0
- package/es/floating-panel/index.mjs +8 -0
- package/es/floating-panel/style/index.d.ts +1 -0
- package/es/floating-panel/style/index.mjs +2 -0
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/slider/Slider.mjs +10 -2
- package/es/time-picker/TimePicker.d.ts +31 -4
- package/es/time-picker/TimePicker.mjs +73 -21
- package/es/time-picker/index.d.ts +20 -2
- package/es/utils/basic.d.ts +3 -0
- package/lib/address-list/AddressList.d.ts +13 -0
- package/lib/address-list/AddressList.js +3 -1
- package/lib/address-list/AddressListItem.d.ts +9 -0
- package/lib/address-list/AddressListItem.js +3 -2
- package/lib/address-list/index.d.ts +9 -0
- package/lib/back-top/BackTop.js +13 -0
- package/lib/date-picker/DatePicker.d.ts +3 -3
- package/lib/date-picker/index.d.ts +2 -2
- package/lib/date-picker/utils.d.ts +4 -2
- package/lib/date-picker/utils.js +2 -2
- package/lib/dropdown-menu/DropdownMenu.js +10 -3
- package/lib/dropdown-menu/types.d.ts +5 -1
- package/lib/floating-panel/FloatingPanel.d.ts +77 -0
- package/lib/floating-panel/FloatingPanel.js +145 -0
- package/lib/floating-panel/index.css +1 -0
- package/lib/floating-panel/index.d.ts +60 -0
- package/lib/floating-panel/index.js +37 -0
- package/lib/floating-panel/style/index.d.ts +1 -0
- package/lib/floating-panel/style/index.js +2 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/slider/Slider.js +10 -2
- package/lib/time-picker/TimePicker.d.ts +31 -4
- package/lib/time-picker/TimePicker.js +84 -32
- package/lib/time-picker/index.d.ts +20 -2
- package/lib/utils/basic.d.ts +3 -0
- package/lib/vant.cjs.js +770 -570
- package/lib/vant.es.js +770 -570
- package/lib/vant.js +766 -566
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/es/index.mjs
CHANGED
@@ -35,6 +35,7 @@ import { DropdownItem } from "./dropdown-item/index.mjs";
|
|
35
35
|
import { DropdownMenu } from "./dropdown-menu/index.mjs";
|
36
36
|
import { Empty } from "./empty/index.mjs";
|
37
37
|
import { Field } from "./field/index.mjs";
|
38
|
+
import { FloatingPanel } from "./floating-panel/index.mjs";
|
38
39
|
import { Form } from "./form/index.mjs";
|
39
40
|
import { Grid } from "./grid/index.mjs";
|
40
41
|
import { GridItem } from "./grid-item/index.mjs";
|
@@ -95,7 +96,7 @@ import { Toast } from "./toast/index.mjs";
|
|
95
96
|
import { TreeSelect } from "./tree-select/index.mjs";
|
96
97
|
import { Uploader } from "./uploader/index.mjs";
|
97
98
|
import { Watermark } from "./watermark/index.mjs";
|
98
|
-
const version = "4.
|
99
|
+
const version = "4.5.0";
|
99
100
|
function install(app) {
|
100
101
|
const components = [
|
101
102
|
ActionBar,
|
@@ -135,6 +136,7 @@ function install(app) {
|
|
135
136
|
DropdownMenu,
|
136
137
|
Empty,
|
137
138
|
Field,
|
139
|
+
FloatingPanel,
|
138
140
|
Form,
|
139
141
|
Grid,
|
140
142
|
GridItem,
|
@@ -241,6 +243,7 @@ export * from "./dropdown-item/index.mjs";
|
|
241
243
|
export * from "./dropdown-menu/index.mjs";
|
242
244
|
export * from "./empty/index.mjs";
|
243
245
|
export * from "./field/index.mjs";
|
246
|
+
export * from "./floating-panel/index.mjs";
|
244
247
|
export * from "./form/index.mjs";
|
245
248
|
export * from "./grid/index.mjs";
|
246
249
|
export * from "./grid-item/index.mjs";
|
package/es/slider/Slider.mjs
CHANGED
@@ -210,17 +210,25 @@ var stdin_default = defineComponent({
|
|
210
210
|
return bem("button-wrapper", props.reverse ? "left" : "right");
|
211
211
|
};
|
212
212
|
const renderButtonContent = (value, index) => {
|
213
|
+
const dragging = dragStatus.value === "dragging";
|
213
214
|
if (typeof index === "number") {
|
214
215
|
const slot = slots[index === 0 ? "left-button" : "right-button"];
|
216
|
+
let dragIndex;
|
217
|
+
if (dragging && Array.isArray(current)) {
|
218
|
+
dragIndex = current[0] > current[1] ? buttonIndex ^ 1 : buttonIndex;
|
219
|
+
}
|
215
220
|
if (slot) {
|
216
221
|
return slot({
|
217
|
-
value
|
222
|
+
value,
|
223
|
+
dragging,
|
224
|
+
dragIndex
|
218
225
|
});
|
219
226
|
}
|
220
227
|
}
|
221
228
|
if (slots.button) {
|
222
229
|
return slots.button({
|
223
|
-
value
|
230
|
+
value,
|
231
|
+
dragging
|
224
232
|
});
|
225
233
|
}
|
226
234
|
return _createVNode("div", {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type
|
1
|
+
import { type ExtractPropTypes, type PropType } from 'vue';
|
2
2
|
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
|
3
3
|
export declare const timePickerProps: {
|
4
4
|
loading: BooleanConstructor;
|
@@ -29,7 +29,7 @@ export declare const timePickerProps: {
|
|
29
29
|
type: PropType<string[]>;
|
30
30
|
default: () => never[];
|
31
31
|
};
|
32
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
|
32
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
|
33
33
|
formatter: {
|
34
34
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
35
35
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -59,10 +59,19 @@ export declare const timePickerProps: {
|
|
59
59
|
type: (NumberConstructor | StringConstructor)[];
|
60
60
|
default: number;
|
61
61
|
};
|
62
|
+
minTime: {
|
63
|
+
type: StringConstructor;
|
64
|
+
validator: (val: string) => boolean;
|
65
|
+
};
|
66
|
+
maxTime: {
|
67
|
+
type: StringConstructor;
|
68
|
+
validator: (val: string) => boolean;
|
69
|
+
};
|
62
70
|
columnsType: {
|
63
71
|
type: PropType<TimePickerColumnType[]>;
|
64
72
|
default: () => string[];
|
65
73
|
};
|
74
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
66
75
|
};
|
67
76
|
export type TimePickerProps = ExtractPropTypes<typeof timePickerProps>;
|
68
77
|
declare const _default: import("vue").DefineComponent<{
|
@@ -94,7 +103,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
94
103
|
type: PropType<string[]>;
|
95
104
|
default: () => never[];
|
96
105
|
};
|
97
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
|
106
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
|
98
107
|
formatter: {
|
99
108
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
100
109
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -124,10 +133,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
124
133
|
type: (NumberConstructor | StringConstructor)[];
|
125
134
|
default: number;
|
126
135
|
};
|
136
|
+
minTime: {
|
137
|
+
type: StringConstructor;
|
138
|
+
validator: (val: string) => boolean;
|
139
|
+
};
|
140
|
+
maxTime: {
|
141
|
+
type: StringConstructor;
|
142
|
+
validator: (val: string) => boolean;
|
143
|
+
};
|
127
144
|
columnsType: {
|
128
145
|
type: PropType<TimePickerColumnType[]>;
|
129
146
|
default: () => string[];
|
130
147
|
};
|
148
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
131
149
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
132
150
|
loading: BooleanConstructor;
|
133
151
|
readonly: BooleanConstructor;
|
@@ -157,7 +175,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
157
175
|
type: PropType<string[]>;
|
158
176
|
default: () => never[];
|
159
177
|
};
|
160
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
|
178
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
|
161
179
|
formatter: {
|
162
180
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
163
181
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -187,10 +205,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
187
205
|
type: (NumberConstructor | StringConstructor)[];
|
188
206
|
default: number;
|
189
207
|
};
|
208
|
+
minTime: {
|
209
|
+
type: StringConstructor;
|
210
|
+
validator: (val: string) => boolean;
|
211
|
+
};
|
212
|
+
maxTime: {
|
213
|
+
type: StringConstructor;
|
214
|
+
validator: (val: string) => boolean;
|
215
|
+
};
|
190
216
|
columnsType: {
|
191
217
|
type: PropType<TimePickerColumnType[]>;
|
192
218
|
default: () => string[];
|
193
219
|
};
|
220
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
194
221
|
}>> & {
|
195
222
|
onChange?: ((...args: any[]) => any) | undefined;
|
196
223
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { computed, defineComponent, ref, watch } from "vue";
|
3
|
+
import { formatValueRange, genOptions, pickerInheritKeys, sharedProps } from "../date-picker/utils.mjs";
|
4
|
+
import { createNamespace, extend, isSameValue, makeNumericProp, pick } from "../utils/index.mjs";
|
5
5
|
import { Picker } from "../picker/index.mjs";
|
6
6
|
const [name] = createNamespace("time-picker");
|
7
|
+
const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
|
8
|
+
const fullColumns = ["hour", "minute", "second"];
|
7
9
|
const timePickerProps = extend({}, sharedProps, {
|
8
10
|
minHour: makeNumericProp(0),
|
9
11
|
maxHour: makeNumericProp(23),
|
@@ -11,10 +13,19 @@ const timePickerProps = extend({}, sharedProps, {
|
|
11
13
|
maxMinute: makeNumericProp(59),
|
12
14
|
minSecond: makeNumericProp(0),
|
13
15
|
maxSecond: makeNumericProp(59),
|
16
|
+
minTime: {
|
17
|
+
type: String,
|
18
|
+
validator: validateTime
|
19
|
+
},
|
20
|
+
maxTime: {
|
21
|
+
type: String,
|
22
|
+
validator: validateTime
|
23
|
+
},
|
14
24
|
columnsType: {
|
15
25
|
type: Array,
|
16
26
|
default: () => ["hour", "minute"]
|
17
|
-
}
|
27
|
+
},
|
28
|
+
filter: Function
|
18
29
|
});
|
19
30
|
var stdin_default = defineComponent({
|
20
31
|
name,
|
@@ -25,25 +36,66 @@ var stdin_default = defineComponent({
|
|
25
36
|
slots
|
26
37
|
}) {
|
27
38
|
const currentValues = ref(props.modelValue);
|
28
|
-
const
|
29
|
-
const
|
30
|
-
|
31
|
-
|
39
|
+
const getValidTime = (time) => {
|
40
|
+
const timeLimitArr = time.split(":");
|
41
|
+
return fullColumns.map((col, i) => props.columnsType.includes(col) ? timeLimitArr[i] : "00");
|
42
|
+
};
|
43
|
+
const columns = computed(() => {
|
44
|
+
let {
|
45
|
+
minHour,
|
46
|
+
maxHour,
|
47
|
+
minMinute,
|
48
|
+
maxMinute,
|
49
|
+
minSecond,
|
50
|
+
maxSecond
|
32
51
|
} = props;
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
52
|
+
if (props.minTime || props.maxTime) {
|
53
|
+
const fullTime = {
|
54
|
+
hour: 0,
|
55
|
+
minute: 0,
|
56
|
+
second: 0
|
57
|
+
};
|
58
|
+
props.columnsType.forEach((col, i) => {
|
59
|
+
var _a;
|
60
|
+
fullTime[col] = (_a = currentValues.value[i]) != null ? _a : 0;
|
61
|
+
});
|
62
|
+
const {
|
63
|
+
hour,
|
64
|
+
minute
|
65
|
+
} = fullTime;
|
66
|
+
if (props.minTime) {
|
67
|
+
const [minH, minM, minS] = getValidTime(props.minTime);
|
68
|
+
minHour = minH;
|
69
|
+
minMinute = +hour <= +minHour ? minM : "00";
|
70
|
+
minSecond = +hour <= +minHour && +minute <= +minMinute ? minS : "00";
|
71
|
+
}
|
72
|
+
if (props.maxTime) {
|
73
|
+
const [maxH, maxM, maxS] = getValidTime(props.maxTime);
|
74
|
+
maxHour = maxH;
|
75
|
+
maxMinute = +hour >= +maxHour ? maxM : "59";
|
76
|
+
maxSecond = +hour >= +maxHour && +minute >= +maxMinute ? maxS : "59";
|
77
|
+
}
|
45
78
|
}
|
46
|
-
|
79
|
+
return props.columnsType.map((type) => {
|
80
|
+
const {
|
81
|
+
filter,
|
82
|
+
formatter
|
83
|
+
} = props;
|
84
|
+
switch (type) {
|
85
|
+
case "hour":
|
86
|
+
return genOptions(+minHour, +maxHour, type, formatter, filter, currentValues.value);
|
87
|
+
case "minute":
|
88
|
+
return genOptions(+minMinute, +maxMinute, type, formatter, filter, currentValues.value);
|
89
|
+
case "second":
|
90
|
+
return genOptions(+minSecond, +maxSecond, type, formatter, filter, currentValues.value);
|
91
|
+
default:
|
92
|
+
if (process.env.NODE_ENV !== "production") {
|
93
|
+
throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
|
94
|
+
}
|
95
|
+
return [];
|
96
|
+
}
|
97
|
+
});
|
98
|
+
});
|
47
99
|
watch(currentValues, (newValues) => {
|
48
100
|
if (!isSameValue(newValues, props.modelValue)) {
|
49
101
|
emit("update:modelValue", newValues);
|
@@ -28,7 +28,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
28
28
|
type: import("vue").PropType<string[]>;
|
29
29
|
default: () => never[];
|
30
30
|
};
|
31
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[]) => import("..").PickerOption[]>;
|
31
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values?: string[] | undefined) => import("..").PickerOption[]>;
|
32
32
|
formatter: {
|
33
33
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
34
34
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -58,10 +58,19 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
58
58
|
type: (NumberConstructor | StringConstructor)[];
|
59
59
|
default: number;
|
60
60
|
};
|
61
|
+
minTime: {
|
62
|
+
type: StringConstructor;
|
63
|
+
validator: (val: string) => boolean;
|
64
|
+
};
|
65
|
+
maxTime: {
|
66
|
+
type: StringConstructor;
|
67
|
+
validator: (val: string) => boolean;
|
68
|
+
};
|
61
69
|
columnsType: {
|
62
70
|
type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
|
63
71
|
default: () => string[];
|
64
72
|
};
|
73
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
65
74
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
66
75
|
loading: BooleanConstructor;
|
67
76
|
readonly: BooleanConstructor;
|
@@ -91,7 +100,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
91
100
|
type: import("vue").PropType<string[]>;
|
92
101
|
default: () => never[];
|
93
102
|
};
|
94
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[]) => import("..").PickerOption[]>;
|
103
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values?: string[] | undefined) => import("..").PickerOption[]>;
|
95
104
|
formatter: {
|
96
105
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
97
106
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -121,10 +130,19 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
121
130
|
type: (NumberConstructor | StringConstructor)[];
|
122
131
|
default: number;
|
123
132
|
};
|
133
|
+
minTime: {
|
134
|
+
type: StringConstructor;
|
135
|
+
validator: (val: string) => boolean;
|
136
|
+
};
|
137
|
+
maxTime: {
|
138
|
+
type: StringConstructor;
|
139
|
+
validator: (val: string) => boolean;
|
140
|
+
};
|
124
141
|
columnsType: {
|
125
142
|
type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
|
126
143
|
default: () => string[];
|
127
144
|
};
|
145
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
128
146
|
}>> & {
|
129
147
|
onChange?: ((...args: any[]) => any) | undefined;
|
130
148
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
package/es/utils/basic.d.ts
CHANGED
@@ -13,6 +13,9 @@ export declare function get(object: any, path: string): any;
|
|
13
13
|
export type Writeable<T> = {
|
14
14
|
-readonly [P in keyof T]: T[P];
|
15
15
|
};
|
16
|
+
export type RequiredParams<T> = T extends (...args: infer P) => infer R ? (...args: {
|
17
|
+
[K in keyof P]-?: NonNullable<P[K]>;
|
18
|
+
}) => R : never;
|
16
19
|
export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>, ignoreUndefined?: boolean): Writeable<Pick<T, U>>;
|
17
20
|
export declare const isSameValue: (newValue: unknown, oldValue: unknown) => boolean;
|
18
21
|
export declare const toArray: <T>(item: T | T[]) => T[];
|
@@ -17,6 +17,10 @@ export declare const addressListProps: {
|
|
17
17
|
};
|
18
18
|
addButtonText: StringConstructor;
|
19
19
|
defaultTagText: StringConstructor;
|
20
|
+
rightIcon: {
|
21
|
+
type: import("vue").PropType<string>;
|
22
|
+
default: string;
|
23
|
+
};
|
20
24
|
};
|
21
25
|
export type AddressListProps = ExtractPropTypes<typeof addressListProps>;
|
22
26
|
declare const _default: import("vue").DefineComponent<{
|
@@ -36,6 +40,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
36
40
|
};
|
37
41
|
addButtonText: StringConstructor;
|
38
42
|
defaultTagText: StringConstructor;
|
43
|
+
rightIcon: {
|
44
|
+
type: import("vue").PropType<string>;
|
45
|
+
default: string;
|
46
|
+
};
|
39
47
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled")[], "select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
40
48
|
list: {
|
41
49
|
type: import("vue").PropType<AddressListAddress[]>;
|
@@ -53,6 +61,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
53
61
|
};
|
54
62
|
addButtonText: StringConstructor;
|
55
63
|
defaultTagText: StringConstructor;
|
64
|
+
rightIcon: {
|
65
|
+
type: import("vue").PropType<string>;
|
66
|
+
default: string;
|
67
|
+
};
|
56
68
|
}>> & {
|
57
69
|
onSelect?: ((...args: any[]) => any) | undefined;
|
58
70
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
@@ -62,6 +74,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
62
74
|
onEditDisabled?: ((...args: any[]) => any) | undefined;
|
63
75
|
onSelectDisabled?: ((...args: any[]) => any) | undefined;
|
64
76
|
}, {
|
77
|
+
rightIcon: string;
|
65
78
|
switchable: boolean;
|
66
79
|
list: AddressListAddress[];
|
67
80
|
disabledList: AddressListAddress[];
|
@@ -45,7 +45,8 @@ const addressListProps = {
|
|
45
45
|
disabledText: String,
|
46
46
|
disabledList: (0, import_utils.makeArrayProp)(),
|
47
47
|
addButtonText: String,
|
48
|
-
defaultTagText: String
|
48
|
+
defaultTagText: String,
|
49
|
+
rightIcon: (0, import_utils.makeStringProp)("edit")
|
49
50
|
};
|
50
51
|
var stdin_default = (0, import_vue2.defineComponent)({
|
51
52
|
name,
|
@@ -70,6 +71,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
70
71
|
"disabled": disabled,
|
71
72
|
"switchable": props.switchable,
|
72
73
|
"defaultTagText": props.defaultTagText,
|
74
|
+
"rightIcon": props.rightIcon,
|
73
75
|
"onEdit": onEdit,
|
74
76
|
"onClick": onClick,
|
75
77
|
"onSelect": onSelect
|
@@ -15,6 +15,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
15
15
|
disabled: BooleanConstructor;
|
16
16
|
switchable: BooleanConstructor;
|
17
17
|
defaultTagText: StringConstructor;
|
18
|
+
rightIcon: {
|
19
|
+
type: PropType<string>;
|
20
|
+
default: string;
|
21
|
+
};
|
18
22
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "click" | "edit")[], "select" | "click" | "edit", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
19
23
|
address: {
|
20
24
|
type: PropType<AddressListAddress>;
|
@@ -23,12 +27,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
23
27
|
disabled: BooleanConstructor;
|
24
28
|
switchable: BooleanConstructor;
|
25
29
|
defaultTagText: StringConstructor;
|
30
|
+
rightIcon: {
|
31
|
+
type: PropType<string>;
|
32
|
+
default: string;
|
33
|
+
};
|
26
34
|
}>> & {
|
27
35
|
onClick?: ((...args: any[]) => any) | undefined;
|
28
36
|
onSelect?: ((...args: any[]) => any) | undefined;
|
29
37
|
onEdit?: ((...args: any[]) => any) | undefined;
|
30
38
|
}, {
|
31
39
|
disabled: boolean;
|
40
|
+
rightIcon: string;
|
32
41
|
switchable: boolean;
|
33
42
|
}, {}>;
|
34
43
|
export default _default;
|
@@ -34,7 +34,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
34
34
|
address: (0, import_utils.makeRequiredProp)(Object),
|
35
35
|
disabled: Boolean,
|
36
36
|
switchable: Boolean,
|
37
|
-
defaultTagText: String
|
37
|
+
defaultTagText: String,
|
38
|
+
rightIcon: (0, import_utils.makeStringProp)("edit")
|
38
39
|
},
|
39
40
|
emits: ["edit", "click", "select"],
|
40
41
|
setup(props, {
|
@@ -48,7 +49,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
48
49
|
emit("click");
|
49
50
|
};
|
50
51
|
const renderRightIcon = () => (0, import_vue.createVNode)(import_icon.Icon, {
|
51
|
-
"name":
|
52
|
+
"name": props.rightIcon,
|
52
53
|
"class": bem("edit"),
|
53
54
|
"onClick": (event) => {
|
54
55
|
event.stopPropagation();
|
@@ -15,6 +15,10 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
|
|
15
15
|
};
|
16
16
|
addButtonText: StringConstructor;
|
17
17
|
defaultTagText: StringConstructor;
|
18
|
+
rightIcon: {
|
19
|
+
type: import("vue").PropType<string>;
|
20
|
+
default: string;
|
21
|
+
};
|
18
22
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled")[], "select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
19
23
|
list: {
|
20
24
|
type: import("vue").PropType<import("./AddressListItem").AddressListAddress[]>;
|
@@ -32,6 +36,10 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
|
|
32
36
|
};
|
33
37
|
addButtonText: StringConstructor;
|
34
38
|
defaultTagText: StringConstructor;
|
39
|
+
rightIcon: {
|
40
|
+
type: import("vue").PropType<string>;
|
41
|
+
default: string;
|
42
|
+
};
|
35
43
|
}>> & {
|
36
44
|
onSelect?: ((...args: any[]) => any) | undefined;
|
37
45
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
@@ -41,6 +49,7 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
|
|
41
49
|
onEditDisabled?: ((...args: any[]) => any) | undefined;
|
42
50
|
onSelectDisabled?: ((...args: any[]) => any) | undefined;
|
43
51
|
}, {
|
52
|
+
rightIcon: string;
|
44
53
|
switchable: boolean;
|
45
54
|
list: import("./AddressListItem").AddressListAddress[];
|
46
55
|
disabledList: import("./AddressListItem").AddressListAddress[];
|
package/lib/back-top/BackTop.js
CHANGED
@@ -50,6 +50,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
50
50
|
slots,
|
51
51
|
attrs
|
52
52
|
}) {
|
53
|
+
let shouldReshow = false;
|
53
54
|
const show = (0, import_vue2.ref)(false);
|
54
55
|
const root = (0, import_vue2.ref)();
|
55
56
|
const scrollParent = (0, import_vue2.ref)();
|
@@ -96,6 +97,18 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
96
97
|
target: scrollParent
|
97
98
|
});
|
98
99
|
(0, import_vue2.onMounted)(updateTarget);
|
100
|
+
(0, import_vue2.onActivated)(() => {
|
101
|
+
if (shouldReshow) {
|
102
|
+
show.value = true;
|
103
|
+
shouldReshow = false;
|
104
|
+
}
|
105
|
+
});
|
106
|
+
(0, import_vue2.onDeactivated)(() => {
|
107
|
+
if (show.value && props.teleport) {
|
108
|
+
show.value = false;
|
109
|
+
shouldReshow = true;
|
110
|
+
}
|
111
|
+
});
|
99
112
|
(0, import_vue2.watch)(() => props.target, updateTarget);
|
100
113
|
return () => {
|
101
114
|
const Content = (0, import_vue.createVNode)("div", (0, import_vue.mergeProps)({
|
@@ -29,7 +29,7 @@ export declare const datePickerProps: {
|
|
29
29
|
type: PropType<string[]>;
|
30
30
|
default: () => never[];
|
31
31
|
};
|
32
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
|
32
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
|
33
33
|
formatter: {
|
34
34
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
35
35
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
80
80
|
type: PropType<string[]>;
|
81
81
|
default: () => never[];
|
82
82
|
};
|
83
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
|
83
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
|
84
84
|
formatter: {
|
85
85
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
86
86
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -129,7 +129,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
129
129
|
type: PropType<string[]>;
|
130
130
|
default: () => never[];
|
131
131
|
};
|
132
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
|
132
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
|
133
133
|
formatter: {
|
134
134
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
135
135
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -28,7 +28,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
28
28
|
type: import("vue").PropType<string[]>;
|
29
29
|
default: () => never[];
|
30
30
|
};
|
31
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[]) => import("..").PickerOption[]>;
|
31
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values?: string[] | undefined) => import("..").PickerOption[]>;
|
32
32
|
formatter: {
|
33
33
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
34
34
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -77,7 +77,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
77
77
|
type: import("vue").PropType<string[]>;
|
78
78
|
default: () => never[];
|
79
79
|
};
|
80
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[]) => import("..").PickerOption[]>;
|
80
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values?: string[] | undefined) => import("..").PickerOption[]>;
|
81
81
|
formatter: {
|
82
82
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
83
83
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -1,6 +1,8 @@
|
|
1
|
+
import { type RequiredParams } from '../utils';
|
1
2
|
import type { PropType } from 'vue';
|
2
3
|
import type { PickerOption } from '../picker';
|
3
|
-
type Filter = (columnType: string, options: PickerOption[]) => PickerOption[];
|
4
|
+
type Filter = (columnType: string, options: PickerOption[], values?: string[]) => PickerOption[];
|
5
|
+
export type TimeFilter = RequiredParams<Filter>;
|
4
6
|
type Formatter = (type: string, option: PickerOption) => PickerOption;
|
5
7
|
export declare const sharedProps: {
|
6
8
|
loading: BooleanConstructor;
|
@@ -40,6 +42,6 @@ export declare const sharedProps: {
|
|
40
42
|
export declare const pickerInheritKeys: ("title" | "readonly" | "loading" | "allowHtml" | "optionHeight" | "showToolbar" | "swipeDuration" | "visibleOptionNum" | "cancelButtonText" | "confirmButtonText")[];
|
41
43
|
export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
|
42
44
|
export declare const getMonthEndDay: (year: number, month: number) => number;
|
43
|
-
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter?: Filter) => PickerOption[];
|
45
|
+
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter?: Filter | TimeFilter, values?: string[]) => PickerOption[];
|
44
46
|
export declare const formatValueRange: (values: string[], columns: PickerOption[][]) => string[];
|
45
47
|
export {};
|
package/lib/date-picker/utils.js
CHANGED
@@ -48,7 +48,7 @@ function times(n, iteratee) {
|
|
48
48
|
return result;
|
49
49
|
}
|
50
50
|
const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
|
51
|
-
const genOptions = (min, max, type, formatter, filter) => {
|
51
|
+
const genOptions = (min, max, type, formatter, filter, values) => {
|
52
52
|
const options = times(max - min + 1, (index) => {
|
53
53
|
const value = (0, import_utils.padZero)(min + index);
|
54
54
|
return formatter(type, {
|
@@ -56,7 +56,7 @@ const genOptions = (min, max, type, formatter, filter) => {
|
|
56
56
|
value
|
57
57
|
});
|
58
58
|
});
|
59
|
-
return filter ? filter(type, options) : options;
|
59
|
+
return filter ? filter(type, options, values) : options;
|
60
60
|
};
|
61
61
|
const formatValueRange = (values, columns) => values.map((value, index) => {
|
62
62
|
const column = columns[index];
|
@@ -26,6 +26,7 @@ var import_vue = require("vue");
|
|
26
26
|
var import_vue2 = require("vue");
|
27
27
|
var import_utils = require("../utils");
|
28
28
|
var import_use_id = require("../composables/use-id");
|
29
|
+
var import_use_expose = require("../composables/use-expose");
|
29
30
|
var import_use = require("@vant/use");
|
30
31
|
const [name, bem] = (0, import_utils.createNamespace)("dropdown-menu");
|
31
32
|
const dropdownMenuProps = {
|
@@ -61,11 +62,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
61
62
|
};
|
62
63
|
}
|
63
64
|
});
|
65
|
+
const close = () => {
|
66
|
+
children.forEach((item) => {
|
67
|
+
item.toggle(false);
|
68
|
+
});
|
69
|
+
};
|
64
70
|
const onClickAway = () => {
|
65
71
|
if (props.closeOnClickOutside) {
|
66
|
-
|
67
|
-
item.toggle(false);
|
68
|
-
});
|
72
|
+
close();
|
69
73
|
}
|
70
74
|
};
|
71
75
|
const updateOffset = () => {
|
@@ -128,6 +132,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
128
132
|
"class": "van-ellipsis"
|
129
133
|
}, [item.renderTitle()])])]);
|
130
134
|
};
|
135
|
+
(0, import_use_expose.useExpose)({
|
136
|
+
close
|
137
|
+
});
|
131
138
|
linkChildren({
|
132
139
|
id,
|
133
140
|
props,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Ref } from 'vue';
|
1
|
+
import type { ComponentPublicInstance, Ref } from 'vue';
|
2
2
|
import type { DropdownMenuProps } from './DropdownMenu';
|
3
3
|
export type DropdownMenuDirection = 'up' | 'down';
|
4
4
|
export type DropdownMenuProvide = {
|
@@ -7,6 +7,10 @@ export type DropdownMenuProvide = {
|
|
7
7
|
offset: Ref<number>;
|
8
8
|
updateOffset: () => void;
|
9
9
|
};
|
10
|
+
export type DropdownMenuExpose = {
|
11
|
+
close: () => void;
|
12
|
+
};
|
13
|
+
export type DropdownMenuInstance = ComponentPublicInstance<DropdownMenuProps, DropdownMenuExpose>;
|
10
14
|
export type DropdownMenuThemeVars = {
|
11
15
|
dropdownMenuHeight?: string;
|
12
16
|
dropdownMenuBackground?: string;
|