vant 4.8.8 → 4.8.10
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/coupon-cell/CouponCell.d.ts +11 -11
- package/es/coupon-cell/CouponCell.mjs +28 -12
- package/es/coupon-cell/index.d.ts +3 -3
- package/es/coupon-list/CouponList.d.ts +26 -26
- package/es/coupon-list/CouponList.mjs +17 -7
- package/es/coupon-list/index.d.ts +9 -9
- package/es/date-picker/DatePicker.d.ts +6 -1
- package/es/date-picker/DatePicker.mjs +12 -0
- package/es/date-picker/index.d.ts +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/time-picker/TimePicker.d.ts +6 -1
- package/es/time-picker/TimePicker.mjs +13 -1
- package/es/time-picker/index.d.ts +1 -1
- package/lib/coupon-cell/CouponCell.d.ts +11 -11
- package/lib/coupon-cell/CouponCell.js +27 -11
- package/lib/coupon-cell/index.d.ts +3 -3
- package/lib/coupon-list/CouponList.d.ts +26 -26
- package/lib/coupon-list/CouponList.js +17 -7
- package/lib/coupon-list/index.d.ts +9 -9
- package/lib/date-picker/DatePicker.d.ts +6 -1
- package/lib/date-picker/DatePicker.js +12 -0
- package/lib/date-picker/index.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/time-picker/TimePicker.d.ts +6 -1
- package/lib/time-picker/TimePicker.js +12 -0
- package/lib/time-picker/index.d.ts +1 -1
- package/lib/vant.cjs.js +71 -23
- package/lib/vant.es.js +71 -23
- package/lib/vant.js +72 -24
- package/lib/vant.min.js +3 -3
- package/lib/web-types.json +1 -1
- package/package.json +12 -12
@@ -32,23 +32,39 @@ const couponCellProps = {
|
|
32
32
|
editable: import_utils.truthProp,
|
33
33
|
coupons: (0, import_utils.makeArrayProp)(),
|
34
34
|
currency: (0, import_utils.makeStringProp)("\xA5"),
|
35
|
-
chosenCoupon:
|
35
|
+
chosenCoupon: {
|
36
|
+
type: [Number, Array],
|
37
|
+
default: -1
|
38
|
+
}
|
39
|
+
};
|
40
|
+
const getValue = (coupon) => {
|
41
|
+
const {
|
42
|
+
value,
|
43
|
+
denominations
|
44
|
+
} = coupon;
|
45
|
+
if ((0, import_utils.isDef)(value)) {
|
46
|
+
return value;
|
47
|
+
}
|
48
|
+
if ((0, import_utils.isDef)(denominations)) {
|
49
|
+
return denominations;
|
50
|
+
}
|
51
|
+
return 0;
|
36
52
|
};
|
37
53
|
function formatValue({
|
38
54
|
coupons,
|
39
55
|
chosenCoupon,
|
40
56
|
currency
|
41
57
|
}) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
} else if ((0, import_utils.isDef)(coupon.denominations)) {
|
50
|
-
value = coupon.denominations;
|
58
|
+
let value = 0;
|
59
|
+
let isExist = false;
|
60
|
+
(Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
|
61
|
+
const coupon = coupons[+i];
|
62
|
+
if (coupon) {
|
63
|
+
isExist = true;
|
64
|
+
value += getValue(coupon);
|
51
65
|
}
|
66
|
+
});
|
67
|
+
if (isExist) {
|
52
68
|
return `-${currency} ${(value / 100).toFixed(2)}`;
|
53
69
|
}
|
54
70
|
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
@@ -58,7 +74,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
58
74
|
props: couponCellProps,
|
59
75
|
setup(props) {
|
60
76
|
return () => {
|
61
|
-
const selected = props.coupons[+props.chosenCoupon];
|
77
|
+
const selected = Array.isArray(props.chosenCoupon) ? props.chosenCoupon.length : props.coupons[+props.chosenCoupon];
|
62
78
|
return (0, import_vue.createVNode)(import_cell.Cell, {
|
63
79
|
"class": bem(),
|
64
80
|
"value": formatValue(props),
|
@@ -17,7 +17,7 @@ export declare const CouponCell: import("../utils").WithInstall<import("vue").De
|
|
17
17
|
default: string;
|
18
18
|
};
|
19
19
|
chosenCoupon: {
|
20
|
-
type: (
|
20
|
+
type: import("vue").PropType<number | number[]>;
|
21
21
|
default: number;
|
22
22
|
};
|
23
23
|
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
@@ -39,7 +39,7 @@ export declare const CouponCell: import("../utils").WithInstall<import("vue").De
|
|
39
39
|
default: string;
|
40
40
|
};
|
41
41
|
chosenCoupon: {
|
42
|
-
type: (
|
42
|
+
type: import("vue").PropType<number | number[]>;
|
43
43
|
default: number;
|
44
44
|
};
|
45
45
|
}>>, {
|
@@ -47,7 +47,7 @@ export declare const CouponCell: import("../utils").WithInstall<import("vue").De
|
|
47
47
|
currency: string;
|
48
48
|
editable: boolean;
|
49
49
|
coupons: import("..").CouponInfo[];
|
50
|
-
chosenCoupon:
|
50
|
+
chosenCoupon: number | number[];
|
51
51
|
}, {}>>;
|
52
52
|
export default CouponCell;
|
53
53
|
export { couponCellProps } from './CouponCell';
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import { type ExtractPropTypes } from 'vue';
|
1
|
+
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
import { CouponInfo } from '../coupon';
|
3
3
|
export declare const couponListProps: {
|
4
4
|
code: {
|
5
|
-
type:
|
5
|
+
type: PropType<string>;
|
6
6
|
default: string;
|
7
7
|
};
|
8
8
|
coupons: {
|
9
|
-
type:
|
9
|
+
type: PropType<CouponInfo[]>;
|
10
10
|
default: () => never[];
|
11
11
|
};
|
12
12
|
currency: {
|
13
|
-
type:
|
13
|
+
type: PropType<string>;
|
14
14
|
default: string;
|
15
15
|
};
|
16
16
|
showCount: {
|
@@ -18,14 +18,10 @@ export declare const couponListProps: {
|
|
18
18
|
default: true;
|
19
19
|
};
|
20
20
|
emptyImage: StringConstructor;
|
21
|
-
chosenCoupon: {
|
22
|
-
type: NumberConstructor;
|
23
|
-
default: number;
|
24
|
-
};
|
25
21
|
enabledTitle: StringConstructor;
|
26
22
|
disabledTitle: StringConstructor;
|
27
23
|
disabledCoupons: {
|
28
|
-
type:
|
24
|
+
type: PropType<CouponInfo[]>;
|
29
25
|
default: () => never[];
|
30
26
|
};
|
31
27
|
showExchangeBar: {
|
@@ -49,19 +45,23 @@ export declare const couponListProps: {
|
|
49
45
|
};
|
50
46
|
exchangeButtonLoading: BooleanConstructor;
|
51
47
|
exchangeButtonDisabled: BooleanConstructor;
|
48
|
+
chosenCoupon: {
|
49
|
+
type: PropType<number | number[]>;
|
50
|
+
default: number;
|
51
|
+
};
|
52
52
|
};
|
53
53
|
export type CouponListProps = ExtractPropTypes<typeof couponListProps>;
|
54
54
|
declare const _default: import("vue").DefineComponent<{
|
55
55
|
code: {
|
56
|
-
type:
|
56
|
+
type: PropType<string>;
|
57
57
|
default: string;
|
58
58
|
};
|
59
59
|
coupons: {
|
60
|
-
type:
|
60
|
+
type: PropType<CouponInfo[]>;
|
61
61
|
default: () => never[];
|
62
62
|
};
|
63
63
|
currency: {
|
64
|
-
type:
|
64
|
+
type: PropType<string>;
|
65
65
|
default: string;
|
66
66
|
};
|
67
67
|
showCount: {
|
@@ -69,14 +69,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
69
69
|
default: true;
|
70
70
|
};
|
71
71
|
emptyImage: StringConstructor;
|
72
|
-
chosenCoupon: {
|
73
|
-
type: NumberConstructor;
|
74
|
-
default: number;
|
75
|
-
};
|
76
72
|
enabledTitle: StringConstructor;
|
77
73
|
disabledTitle: StringConstructor;
|
78
74
|
disabledCoupons: {
|
79
|
-
type:
|
75
|
+
type: PropType<CouponInfo[]>;
|
80
76
|
default: () => never[];
|
81
77
|
};
|
82
78
|
showExchangeBar: {
|
@@ -100,17 +96,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
100
96
|
};
|
101
97
|
exchangeButtonLoading: BooleanConstructor;
|
102
98
|
exchangeButtonDisabled: BooleanConstructor;
|
99
|
+
chosenCoupon: {
|
100
|
+
type: PropType<number | number[]>;
|
101
|
+
default: number;
|
102
|
+
};
|
103
103
|
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "exchange" | "update:code")[], "change" | "exchange" | "update:code", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
104
104
|
code: {
|
105
|
-
type:
|
105
|
+
type: PropType<string>;
|
106
106
|
default: string;
|
107
107
|
};
|
108
108
|
coupons: {
|
109
|
-
type:
|
109
|
+
type: PropType<CouponInfo[]>;
|
110
110
|
default: () => never[];
|
111
111
|
};
|
112
112
|
currency: {
|
113
|
-
type:
|
113
|
+
type: PropType<string>;
|
114
114
|
default: string;
|
115
115
|
};
|
116
116
|
showCount: {
|
@@ -118,14 +118,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
118
118
|
default: true;
|
119
119
|
};
|
120
120
|
emptyImage: StringConstructor;
|
121
|
-
chosenCoupon: {
|
122
|
-
type: NumberConstructor;
|
123
|
-
default: number;
|
124
|
-
};
|
125
121
|
enabledTitle: StringConstructor;
|
126
122
|
disabledTitle: StringConstructor;
|
127
123
|
disabledCoupons: {
|
128
|
-
type:
|
124
|
+
type: PropType<CouponInfo[]>;
|
129
125
|
default: () => never[];
|
130
126
|
};
|
131
127
|
showExchangeBar: {
|
@@ -149,6 +145,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
149
145
|
};
|
150
146
|
exchangeButtonLoading: BooleanConstructor;
|
151
147
|
exchangeButtonDisabled: BooleanConstructor;
|
148
|
+
chosenCoupon: {
|
149
|
+
type: PropType<number | number[]>;
|
150
|
+
default: number;
|
151
|
+
};
|
152
152
|
}>> & {
|
153
153
|
onChange?: ((...args: any[]) => any) | undefined;
|
154
154
|
onExchange?: ((...args: any[]) => any) | undefined;
|
@@ -157,7 +157,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
157
157
|
code: string;
|
158
158
|
currency: string;
|
159
159
|
coupons: CouponInfo[];
|
160
|
-
chosenCoupon: number;
|
160
|
+
chosenCoupon: number | number[];
|
161
161
|
showCount: boolean;
|
162
162
|
disabledCoupons: CouponInfo[];
|
163
163
|
showExchangeBar: boolean;
|
@@ -39,7 +39,6 @@ const couponListProps = {
|
|
39
39
|
currency: (0, import_utils.makeStringProp)("\xA5"),
|
40
40
|
showCount: import_utils.truthProp,
|
41
41
|
emptyImage: String,
|
42
|
-
chosenCoupon: (0, import_utils.makeNumberProp)(-1),
|
43
42
|
enabledTitle: String,
|
44
43
|
disabledTitle: String,
|
45
44
|
disabledCoupons: (0, import_utils.makeArrayProp)(),
|
@@ -51,7 +50,11 @@ const couponListProps = {
|
|
51
50
|
exchangeButtonText: String,
|
52
51
|
displayedCouponIndex: (0, import_utils.makeNumberProp)(-1),
|
53
52
|
exchangeButtonLoading: Boolean,
|
54
|
-
exchangeButtonDisabled: Boolean
|
53
|
+
exchangeButtonDisabled: Boolean,
|
54
|
+
chosenCoupon: {
|
55
|
+
type: [Number, Array],
|
56
|
+
default: -1
|
57
|
+
}
|
55
58
|
};
|
56
59
|
var stdin_default = (0, import_vue2.defineComponent)({
|
57
60
|
name,
|
@@ -119,10 +122,17 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
119
122
|
};
|
120
123
|
const renderCouponTab = () => {
|
121
124
|
const {
|
122
|
-
coupons
|
125
|
+
coupons,
|
126
|
+
chosenCoupon
|
123
127
|
} = props;
|
124
128
|
const count = props.showCount ? ` (${coupons.length})` : "";
|
125
129
|
const title = (props.enabledTitle || t("enable")) + count;
|
130
|
+
const updateChosenCoupon = (currentValues = [], value = 0) => {
|
131
|
+
if (currentValues.includes(value)) {
|
132
|
+
return currentValues.filter((item) => item !== value);
|
133
|
+
}
|
134
|
+
return [...currentValues, value];
|
135
|
+
};
|
126
136
|
return (0, import_vue.createVNode)(import_tab.Tab, {
|
127
137
|
"title": title
|
128
138
|
}, {
|
@@ -139,9 +149,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
139
149
|
"key": coupon.id,
|
140
150
|
"ref": setCouponRefs(index),
|
141
151
|
"coupon": coupon,
|
142
|
-
"chosen": index ===
|
152
|
+
"chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
|
143
153
|
"currency": props.currency,
|
144
|
-
"onClick": () => emit("change", index)
|
154
|
+
"onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
|
145
155
|
}, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
146
156
|
}
|
147
157
|
});
|
@@ -194,13 +204,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
194
204
|
default: () => [renderCouponTab(), renderDisabledTab()]
|
195
205
|
}), (0, import_vue.createVNode)("div", {
|
196
206
|
"class": bem("bottom")
|
197
|
-
}, [(0, import_vue.withDirectives)((0, import_vue.createVNode)(import_button.Button, {
|
207
|
+
}, [slots["list-button"] ? slots["list-button"]() : (0, import_vue.withDirectives)((0, import_vue.createVNode)(import_button.Button, {
|
198
208
|
"round": true,
|
199
209
|
"block": true,
|
200
210
|
"type": "primary",
|
201
211
|
"class": bem("close"),
|
202
212
|
"text": props.closeButtonText || t("close"),
|
203
|
-
"onClick": () => emit("change", -1)
|
213
|
+
"onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? [] : -1)
|
204
214
|
}, null), [[import_vue.vShow, props.showCloseButton]])])]);
|
205
215
|
}
|
206
216
|
});
|
@@ -16,10 +16,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
16
16
|
default: true;
|
17
17
|
};
|
18
18
|
emptyImage: StringConstructor;
|
19
|
-
chosenCoupon: {
|
20
|
-
type: NumberConstructor;
|
21
|
-
default: number;
|
22
|
-
};
|
23
19
|
enabledTitle: StringConstructor;
|
24
20
|
disabledTitle: StringConstructor;
|
25
21
|
disabledCoupons: {
|
@@ -47,6 +43,10 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
47
43
|
};
|
48
44
|
exchangeButtonLoading: BooleanConstructor;
|
49
45
|
exchangeButtonDisabled: BooleanConstructor;
|
46
|
+
chosenCoupon: {
|
47
|
+
type: import("vue").PropType<number | number[]>;
|
48
|
+
default: number;
|
49
|
+
};
|
50
50
|
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "exchange" | "update:code")[], "change" | "exchange" | "update:code", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
51
51
|
code: {
|
52
52
|
type: import("vue").PropType<string>;
|
@@ -65,10 +65,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
65
65
|
default: true;
|
66
66
|
};
|
67
67
|
emptyImage: StringConstructor;
|
68
|
-
chosenCoupon: {
|
69
|
-
type: NumberConstructor;
|
70
|
-
default: number;
|
71
|
-
};
|
72
68
|
enabledTitle: StringConstructor;
|
73
69
|
disabledTitle: StringConstructor;
|
74
70
|
disabledCoupons: {
|
@@ -96,6 +92,10 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
96
92
|
};
|
97
93
|
exchangeButtonLoading: BooleanConstructor;
|
98
94
|
exchangeButtonDisabled: BooleanConstructor;
|
95
|
+
chosenCoupon: {
|
96
|
+
type: import("vue").PropType<number | number[]>;
|
97
|
+
default: number;
|
98
|
+
};
|
99
99
|
}>> & {
|
100
100
|
onChange?: ((...args: any[]) => any) | undefined;
|
101
101
|
onExchange?: ((...args: any[]) => any) | undefined;
|
@@ -104,7 +104,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
104
104
|
code: string;
|
105
105
|
currency: string;
|
106
106
|
coupons: import("..").CouponInfo[];
|
107
|
-
chosenCoupon: number;
|
107
|
+
chosenCoupon: number | number[];
|
108
108
|
showCount: boolean;
|
109
109
|
disabledCoupons: import("..").CouponInfo[];
|
110
110
|
showExchangeBar: boolean;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type PropType, type ExtractPropTypes } from 'vue';
|
1
|
+
import { type ComponentPublicInstance, type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
export type DatePickerColumnType = 'year' | 'month' | 'day';
|
3
3
|
export declare const datePickerProps: {
|
4
4
|
loading: BooleanConstructor;
|
@@ -50,7 +50,12 @@ export declare const datePickerProps: {
|
|
50
50
|
validator: (val: unknown) => val is Date;
|
51
51
|
};
|
52
52
|
};
|
53
|
+
export type DatePickerExpose = {
|
54
|
+
confirm: () => void;
|
55
|
+
getSelectedDate: () => string[];
|
56
|
+
};
|
53
57
|
export type DatePickerProps = ExtractPropTypes<typeof datePickerProps>;
|
58
|
+
export type DatePickerInstance = ComponentPublicInstance<DatePickerProps, DatePickerExpose>;
|
54
59
|
declare const _default: import("vue").DefineComponent<{
|
55
60
|
loading: BooleanConstructor;
|
56
61
|
readonly: BooleanConstructor;
|
@@ -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_utils2 = require("./utils");
|
28
|
+
var import_use_expose = require("../composables/use-expose");
|
28
29
|
var import_picker = require("../picker");
|
29
30
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
30
31
|
const [name] = (0, import_utils.createNamespace)("date-picker");
|
@@ -54,6 +55,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
54
55
|
}) {
|
55
56
|
const currentValues = (0, import_vue2.ref)(props.modelValue);
|
56
57
|
const updatedByExternalSources = (0, import_vue2.ref)(false);
|
58
|
+
const pickerRef = (0, import_vue2.ref)();
|
57
59
|
const genYearOptions = () => {
|
58
60
|
const minYear = props.minDate.getFullYear();
|
59
61
|
const maxYear = props.maxDate.getFullYear();
|
@@ -95,6 +97,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
95
97
|
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : (0, import_utils2.getMonthEndDay)(year, month);
|
96
98
|
return (0, import_utils2.genOptions)(minDate, maxDate, "day", props.formatter, props.filter);
|
97
99
|
};
|
100
|
+
const confirm = () => {
|
101
|
+
var _a;
|
102
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
103
|
+
};
|
104
|
+
const getSelectedDate = () => currentValues.value;
|
98
105
|
const columns = (0, import_vue2.computed)(() => props.columnsType.map((type) => {
|
99
106
|
switch (type) {
|
100
107
|
case "year":
|
@@ -128,7 +135,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
128
135
|
const onChange = (...args) => emit("change", ...args);
|
129
136
|
const onCancel = (...args) => emit("cancel", ...args);
|
130
137
|
const onConfirm = (...args) => emit("confirm", ...args);
|
138
|
+
(0, import_use_expose.useExpose)({
|
139
|
+
confirm,
|
140
|
+
getSelectedDate
|
141
|
+
});
|
131
142
|
return () => (0, import_vue.createVNode)(import_picker.Picker, (0, import_vue.mergeProps)({
|
143
|
+
"ref": pickerRef,
|
132
144
|
"modelValue": currentValues.value,
|
133
145
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
134
146
|
"columns": columns.value,
|
@@ -119,7 +119,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
119
119
|
export default DatePicker;
|
120
120
|
export { datePickerProps } from './DatePicker';
|
121
121
|
export type { DatePickerProps };
|
122
|
-
export type { DatePickerColumnType } from './DatePicker';
|
122
|
+
export type { DatePickerColumnType, DatePickerInstance } from './DatePicker';
|
123
123
|
declare module 'vue' {
|
124
124
|
interface GlobalComponents {
|
125
125
|
VanDatePicker: typeof DatePicker;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -226,7 +226,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
|
|
226
226
|
__reExport(stdin_exports, require("./tree-select"), module.exports);
|
227
227
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
228
228
|
__reExport(stdin_exports, require("./watermark"), module.exports);
|
229
|
-
const version = "4.8.
|
229
|
+
const version = "4.8.10";
|
230
230
|
function install(app) {
|
231
231
|
const components = [
|
232
232
|
import_action_bar.ActionBar,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type ExtractPropTypes, type PropType } from 'vue';
|
1
|
+
import { type ExtractPropTypes, type PropType, type ComponentPublicInstance } from 'vue';
|
2
2
|
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
|
3
3
|
export declare const timePickerProps: {
|
4
4
|
loading: BooleanConstructor;
|
@@ -74,6 +74,11 @@ export declare const timePickerProps: {
|
|
74
74
|
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
75
75
|
};
|
76
76
|
export type TimePickerProps = ExtractPropTypes<typeof timePickerProps>;
|
77
|
+
export type TimePickerExpose = {
|
78
|
+
confirm: () => void;
|
79
|
+
getSelectedTime: () => string[];
|
80
|
+
};
|
81
|
+
export type TimePickerInstance = ComponentPublicInstance<TimePickerProps, TimePickerExpose>;
|
77
82
|
declare const _default: import("vue").DefineComponent<{
|
78
83
|
loading: BooleanConstructor;
|
79
84
|
readonly: BooleanConstructor;
|
@@ -25,6 +25,7 @@ var import_vue = require("vue");
|
|
25
25
|
var import_vue2 = require("vue");
|
26
26
|
var import_utils = require("../date-picker/utils");
|
27
27
|
var import_utils2 = require("../utils");
|
28
|
+
var import_use_expose = require("../composables/use-expose");
|
28
29
|
var import_picker = require("../picker");
|
29
30
|
const [name] = (0, import_utils2.createNamespace)("time-picker");
|
30
31
|
const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
|
@@ -59,10 +60,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
59
60
|
slots
|
60
61
|
}) {
|
61
62
|
const currentValues = (0, import_vue2.ref)(props.modelValue);
|
63
|
+
const pickerRef = (0, import_vue2.ref)();
|
62
64
|
const getValidTime = (time) => {
|
63
65
|
const timeLimitArr = time.split(":");
|
64
66
|
return fullColumns.map((col, i) => props.columnsType.includes(col) ? timeLimitArr[i] : "00");
|
65
67
|
};
|
68
|
+
const confirm = () => {
|
69
|
+
var _a;
|
70
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
71
|
+
};
|
72
|
+
const getSelectedTime = () => currentValues.value;
|
66
73
|
const columns = (0, import_vue2.computed)(() => {
|
67
74
|
let {
|
68
75
|
minHour,
|
@@ -135,7 +142,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
135
142
|
const onChange = (...args) => emit("change", ...args);
|
136
143
|
const onCancel = (...args) => emit("cancel", ...args);
|
137
144
|
const onConfirm = (...args) => emit("confirm", ...args);
|
145
|
+
(0, import_use_expose.useExpose)({
|
146
|
+
confirm,
|
147
|
+
getSelectedTime
|
148
|
+
});
|
138
149
|
return () => (0, import_vue.createVNode)(import_picker.Picker, (0, import_vue.mergeProps)({
|
150
|
+
"ref": pickerRef,
|
139
151
|
"modelValue": currentValues.value,
|
140
152
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
141
153
|
"columns": columns.value,
|
@@ -169,7 +169,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
169
169
|
export default TimePicker;
|
170
170
|
export { timePickerProps } from './TimePicker';
|
171
171
|
export type { TimePickerProps };
|
172
|
-
export type { TimePickerColumnType } from './TimePicker';
|
172
|
+
export type { TimePickerColumnType, TimePickerInstance } from './TimePicker';
|
173
173
|
declare module 'vue' {
|
174
174
|
interface GlobalComponents {
|
175
175
|
VanTimePicker: typeof TimePicker;
|