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
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type ExtractPropTypes } from 'vue';
|
1
|
+
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
import type { CouponInfo } from '../coupon';
|
3
3
|
export declare const couponCellProps: {
|
4
4
|
title: StringConstructor;
|
@@ -11,15 +11,15 @@ export declare const couponCellProps: {
|
|
11
11
|
default: true;
|
12
12
|
};
|
13
13
|
coupons: {
|
14
|
-
type:
|
14
|
+
type: PropType<CouponInfo[]>;
|
15
15
|
default: () => never[];
|
16
16
|
};
|
17
17
|
currency: {
|
18
|
-
type:
|
18
|
+
type: PropType<string>;
|
19
19
|
default: string;
|
20
20
|
};
|
21
21
|
chosenCoupon: {
|
22
|
-
type:
|
22
|
+
type: PropType<number | number[]>;
|
23
23
|
default: number;
|
24
24
|
};
|
25
25
|
};
|
@@ -35,15 +35,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
35
35
|
default: true;
|
36
36
|
};
|
37
37
|
coupons: {
|
38
|
-
type:
|
38
|
+
type: PropType<CouponInfo[]>;
|
39
39
|
default: () => never[];
|
40
40
|
};
|
41
41
|
currency: {
|
42
|
-
type:
|
42
|
+
type: PropType<string>;
|
43
43
|
default: string;
|
44
44
|
};
|
45
45
|
chosenCoupon: {
|
46
|
-
type:
|
46
|
+
type: PropType<number | number[]>;
|
47
47
|
default: number;
|
48
48
|
};
|
49
49
|
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
@@ -57,15 +57,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
57
57
|
default: true;
|
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
|
chosenCoupon: {
|
68
|
-
type:
|
68
|
+
type: PropType<number | number[]>;
|
69
69
|
default: number;
|
70
70
|
};
|
71
71
|
}>>, {
|
@@ -73,6 +73,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
73
73
|
currency: string;
|
74
74
|
editable: boolean;
|
75
75
|
coupons: CouponInfo[];
|
76
|
-
chosenCoupon:
|
76
|
+
chosenCoupon: number | number[];
|
77
77
|
}, {}>;
|
78
78
|
export default _default;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
2
|
import { defineComponent } from "vue";
|
3
|
-
import { isDef, truthProp, makeArrayProp, makeStringProp,
|
3
|
+
import { isDef, truthProp, makeArrayProp, makeStringProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { Cell } from "../cell/index.mjs";
|
5
5
|
const [name, bem, t] = createNamespace("coupon-cell");
|
6
6
|
const couponCellProps = {
|
@@ -9,23 +9,39 @@ const couponCellProps = {
|
|
9
9
|
editable: truthProp,
|
10
10
|
coupons: makeArrayProp(),
|
11
11
|
currency: makeStringProp("\xA5"),
|
12
|
-
chosenCoupon:
|
12
|
+
chosenCoupon: {
|
13
|
+
type: [Number, Array],
|
14
|
+
default: -1
|
15
|
+
}
|
16
|
+
};
|
17
|
+
const getValue = (coupon) => {
|
18
|
+
const {
|
19
|
+
value,
|
20
|
+
denominations
|
21
|
+
} = coupon;
|
22
|
+
if (isDef(value)) {
|
23
|
+
return value;
|
24
|
+
}
|
25
|
+
if (isDef(denominations)) {
|
26
|
+
return denominations;
|
27
|
+
}
|
28
|
+
return 0;
|
13
29
|
};
|
14
30
|
function formatValue({
|
15
31
|
coupons,
|
16
32
|
chosenCoupon,
|
17
33
|
currency
|
18
34
|
}) {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
} else if (isDef(coupon.denominations)) {
|
27
|
-
value = coupon.denominations;
|
35
|
+
let value = 0;
|
36
|
+
let isExist = false;
|
37
|
+
(Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
|
38
|
+
const coupon = coupons[+i];
|
39
|
+
if (coupon) {
|
40
|
+
isExist = true;
|
41
|
+
value += getValue(coupon);
|
28
42
|
}
|
43
|
+
});
|
44
|
+
if (isExist) {
|
29
45
|
return `-${currency} ${(value / 100).toFixed(2)}`;
|
30
46
|
}
|
31
47
|
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
@@ -35,7 +51,7 @@ var stdin_default = defineComponent({
|
|
35
51
|
props: couponCellProps,
|
36
52
|
setup(props) {
|
37
53
|
return () => {
|
38
|
-
const selected = props.coupons[+props.chosenCoupon];
|
54
|
+
const selected = Array.isArray(props.chosenCoupon) ? props.chosenCoupon.length : props.coupons[+props.chosenCoupon];
|
39
55
|
return _createVNode(Cell, {
|
40
56
|
"class": bem(),
|
41
57
|
"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;
|
@@ -16,7 +16,6 @@ const couponListProps = {
|
|
16
16
|
currency: makeStringProp("\xA5"),
|
17
17
|
showCount: truthProp,
|
18
18
|
emptyImage: String,
|
19
|
-
chosenCoupon: makeNumberProp(-1),
|
20
19
|
enabledTitle: String,
|
21
20
|
disabledTitle: String,
|
22
21
|
disabledCoupons: makeArrayProp(),
|
@@ -28,7 +27,11 @@ const couponListProps = {
|
|
28
27
|
exchangeButtonText: String,
|
29
28
|
displayedCouponIndex: makeNumberProp(-1),
|
30
29
|
exchangeButtonLoading: Boolean,
|
31
|
-
exchangeButtonDisabled: Boolean
|
30
|
+
exchangeButtonDisabled: Boolean,
|
31
|
+
chosenCoupon: {
|
32
|
+
type: [Number, Array],
|
33
|
+
default: -1
|
34
|
+
}
|
32
35
|
};
|
33
36
|
var stdin_default = defineComponent({
|
34
37
|
name,
|
@@ -96,10 +99,17 @@ var stdin_default = defineComponent({
|
|
96
99
|
};
|
97
100
|
const renderCouponTab = () => {
|
98
101
|
const {
|
99
|
-
coupons
|
102
|
+
coupons,
|
103
|
+
chosenCoupon
|
100
104
|
} = props;
|
101
105
|
const count = props.showCount ? ` (${coupons.length})` : "";
|
102
106
|
const title = (props.enabledTitle || t("enable")) + count;
|
107
|
+
const updateChosenCoupon = (currentValues = [], value = 0) => {
|
108
|
+
if (currentValues.includes(value)) {
|
109
|
+
return currentValues.filter((item) => item !== value);
|
110
|
+
}
|
111
|
+
return [...currentValues, value];
|
112
|
+
};
|
103
113
|
return _createVNode(Tab, {
|
104
114
|
"title": title
|
105
115
|
}, {
|
@@ -116,9 +126,9 @@ var stdin_default = defineComponent({
|
|
116
126
|
"key": coupon.id,
|
117
127
|
"ref": setCouponRefs(index),
|
118
128
|
"coupon": coupon,
|
119
|
-
"chosen": index ===
|
129
|
+
"chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
|
120
130
|
"currency": props.currency,
|
121
|
-
"onClick": () => emit("change", index)
|
131
|
+
"onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
|
122
132
|
}, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
123
133
|
}
|
124
134
|
});
|
@@ -171,13 +181,13 @@ var stdin_default = defineComponent({
|
|
171
181
|
default: () => [renderCouponTab(), renderDisabledTab()]
|
172
182
|
}), _createVNode("div", {
|
173
183
|
"class": bem("bottom")
|
174
|
-
}, [_withDirectives(_createVNode(Button, {
|
184
|
+
}, [slots["list-button"] ? slots["list-button"]() : _withDirectives(_createVNode(Button, {
|
175
185
|
"round": true,
|
176
186
|
"block": true,
|
177
187
|
"type": "primary",
|
178
188
|
"class": bem("close"),
|
179
189
|
"text": props.closeButtonText || t("close"),
|
180
|
-
"onClick": () => emit("change", -1)
|
190
|
+
"onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? [] : -1)
|
181
191
|
}, null), [[_vShow, props.showCloseButton]])])]);
|
182
192
|
}
|
183
193
|
});
|
@@ -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;
|
@@ -2,6 +2,7 @@ import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
|
2
2
|
import { ref, watch, computed, defineComponent } from "vue";
|
3
3
|
import { pick, extend, isDate, isSameValue, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { genOptions, sharedProps, getMonthEndDay, pickerInheritKeys, formatValueRange } from "./utils.mjs";
|
5
|
+
import { useExpose } from "../composables/use-expose.mjs";
|
5
6
|
import { Picker } from "../picker/index.mjs";
|
6
7
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
7
8
|
const [name] = createNamespace("date-picker");
|
@@ -31,6 +32,7 @@ var stdin_default = defineComponent({
|
|
31
32
|
}) {
|
32
33
|
const currentValues = ref(props.modelValue);
|
33
34
|
const updatedByExternalSources = ref(false);
|
35
|
+
const pickerRef = ref();
|
34
36
|
const genYearOptions = () => {
|
35
37
|
const minYear = props.minDate.getFullYear();
|
36
38
|
const maxYear = props.maxDate.getFullYear();
|
@@ -72,6 +74,11 @@ var stdin_default = defineComponent({
|
|
72
74
|
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : getMonthEndDay(year, month);
|
73
75
|
return genOptions(minDate, maxDate, "day", props.formatter, props.filter);
|
74
76
|
};
|
77
|
+
const confirm = () => {
|
78
|
+
var _a;
|
79
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
80
|
+
};
|
81
|
+
const getSelectedDate = () => currentValues.value;
|
75
82
|
const columns = computed(() => props.columnsType.map((type) => {
|
76
83
|
switch (type) {
|
77
84
|
case "year":
|
@@ -105,7 +112,12 @@ var stdin_default = defineComponent({
|
|
105
112
|
const onChange = (...args) => emit("change", ...args);
|
106
113
|
const onCancel = (...args) => emit("cancel", ...args);
|
107
114
|
const onConfirm = (...args) => emit("confirm", ...args);
|
115
|
+
useExpose({
|
116
|
+
confirm,
|
117
|
+
getSelectedDate
|
118
|
+
});
|
108
119
|
return () => _createVNode(Picker, _mergeProps({
|
120
|
+
"ref": pickerRef,
|
109
121
|
"modelValue": currentValues.value,
|
110
122
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
111
123
|
"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/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -99,7 +99,7 @@ import { Toast } from "./toast/index.mjs";
|
|
99
99
|
import { TreeSelect } from "./tree-select/index.mjs";
|
100
100
|
import { Uploader } from "./uploader/index.mjs";
|
101
101
|
import { Watermark } from "./watermark/index.mjs";
|
102
|
-
const version = "4.8.
|
102
|
+
const version = "4.8.10";
|
103
103
|
function install(app) {
|
104
104
|
const components = [
|
105
105
|
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;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
2
2
|
import { computed, defineComponent, ref, watch } from "vue";
|
3
3
|
import { formatValueRange, genOptions, pickerInheritKeys, sharedProps } from "../date-picker/utils.mjs";
|
4
|
-
import {
|
4
|
+
import { pick, extend, isSameValue, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
5
|
+
import { useExpose } from "../composables/use-expose.mjs";
|
5
6
|
import { Picker } from "../picker/index.mjs";
|
6
7
|
const [name] = createNamespace("time-picker");
|
7
8
|
const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
|
@@ -36,10 +37,16 @@ var stdin_default = defineComponent({
|
|
36
37
|
slots
|
37
38
|
}) {
|
38
39
|
const currentValues = ref(props.modelValue);
|
40
|
+
const pickerRef = ref();
|
39
41
|
const getValidTime = (time) => {
|
40
42
|
const timeLimitArr = time.split(":");
|
41
43
|
return fullColumns.map((col, i) => props.columnsType.includes(col) ? timeLimitArr[i] : "00");
|
42
44
|
};
|
45
|
+
const confirm = () => {
|
46
|
+
var _a;
|
47
|
+
return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
|
48
|
+
};
|
49
|
+
const getSelectedTime = () => currentValues.value;
|
43
50
|
const columns = computed(() => {
|
44
51
|
let {
|
45
52
|
minHour,
|
@@ -112,7 +119,12 @@ var stdin_default = defineComponent({
|
|
112
119
|
const onChange = (...args) => emit("change", ...args);
|
113
120
|
const onCancel = (...args) => emit("cancel", ...args);
|
114
121
|
const onConfirm = (...args) => emit("confirm", ...args);
|
122
|
+
useExpose({
|
123
|
+
confirm,
|
124
|
+
getSelectedTime
|
125
|
+
});
|
115
126
|
return () => _createVNode(Picker, _mergeProps({
|
127
|
+
"ref": pickerRef,
|
116
128
|
"modelValue": currentValues.value,
|
117
129
|
"onUpdate:modelValue": ($event) => currentValues.value = $event,
|
118
130
|
"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;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type ExtractPropTypes } from 'vue';
|
1
|
+
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
import type { CouponInfo } from '../coupon';
|
3
3
|
export declare const couponCellProps: {
|
4
4
|
title: StringConstructor;
|
@@ -11,15 +11,15 @@ export declare const couponCellProps: {
|
|
11
11
|
default: true;
|
12
12
|
};
|
13
13
|
coupons: {
|
14
|
-
type:
|
14
|
+
type: PropType<CouponInfo[]>;
|
15
15
|
default: () => never[];
|
16
16
|
};
|
17
17
|
currency: {
|
18
|
-
type:
|
18
|
+
type: PropType<string>;
|
19
19
|
default: string;
|
20
20
|
};
|
21
21
|
chosenCoupon: {
|
22
|
-
type:
|
22
|
+
type: PropType<number | number[]>;
|
23
23
|
default: number;
|
24
24
|
};
|
25
25
|
};
|
@@ -35,15 +35,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
35
35
|
default: true;
|
36
36
|
};
|
37
37
|
coupons: {
|
38
|
-
type:
|
38
|
+
type: PropType<CouponInfo[]>;
|
39
39
|
default: () => never[];
|
40
40
|
};
|
41
41
|
currency: {
|
42
|
-
type:
|
42
|
+
type: PropType<string>;
|
43
43
|
default: string;
|
44
44
|
};
|
45
45
|
chosenCoupon: {
|
46
|
-
type:
|
46
|
+
type: PropType<number | number[]>;
|
47
47
|
default: number;
|
48
48
|
};
|
49
49
|
}, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
@@ -57,15 +57,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
57
57
|
default: true;
|
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
|
chosenCoupon: {
|
68
|
-
type:
|
68
|
+
type: PropType<number | number[]>;
|
69
69
|
default: number;
|
70
70
|
};
|
71
71
|
}>>, {
|
@@ -73,6 +73,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
73
73
|
currency: string;
|
74
74
|
editable: boolean;
|
75
75
|
coupons: CouponInfo[];
|
76
|
-
chosenCoupon:
|
76
|
+
chosenCoupon: number | number[];
|
77
77
|
}, {}>;
|
78
78
|
export default _default;
|