vant 4.8.8 → 4.8.9
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 +4 -4
- package/es/coupon-cell/CouponCell.mjs +35 -12
- package/es/coupon-cell/index.d.ts +3 -3
- package/es/coupon-list/CouponList.d.ts +3 -13
- package/es/coupon-list/CouponList.mjs +15 -6
- package/es/coupon-list/index.d.ts +2 -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 +4 -4
- package/lib/coupon-cell/CouponCell.js +34 -11
- package/lib/coupon-cell/index.d.ts +3 -3
- package/lib/coupon-list/CouponList.d.ts +3 -13
- package/lib/coupon-list/CouponList.js +14 -5
- package/lib/coupon-list/index.d.ts +2 -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 -17
- package/lib/vant.es.js +71 -17
- package/lib/vant.js +72 -18
- package/lib/vant.min.js +3 -3
- package/lib/web-types.json +1 -1
- package/package.json +11 -11
@@ -19,7 +19,7 @@ export declare const couponCellProps: {
|
|
19
19
|
default: string;
|
20
20
|
};
|
21
21
|
chosenCoupon: {
|
22
|
-
type: (NumberConstructor |
|
22
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
23
23
|
default: number;
|
24
24
|
};
|
25
25
|
};
|
@@ -43,7 +43,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
43
43
|
default: string;
|
44
44
|
};
|
45
45
|
chosenCoupon: {
|
46
|
-
type: (NumberConstructor |
|
46
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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<{
|
@@ -65,7 +65,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
65
65
|
default: string;
|
66
66
|
};
|
67
67
|
chosenCoupon: {
|
68
|
-
type: (NumberConstructor |
|
68
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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 | unknown[];
|
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,33 +9,56 @@ 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
|
+
}
|
13
16
|
};
|
14
17
|
function formatValue({
|
15
18
|
coupons,
|
16
19
|
chosenCoupon,
|
17
20
|
currency
|
18
21
|
}) {
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
+
const getValue = (coupon) => {
|
23
|
+
let value2 = 0;
|
24
|
+
const {
|
25
|
+
value: couponValue,
|
26
|
+
denominations
|
27
|
+
} = coupon;
|
22
28
|
if (isDef(coupon.value)) {
|
23
|
-
|
24
|
-
value
|
25
|
-
} = coupon);
|
29
|
+
value2 = couponValue;
|
26
30
|
} else if (isDef(coupon.denominations)) {
|
27
|
-
|
31
|
+
value2 = denominations;
|
32
|
+
}
|
33
|
+
return value2;
|
34
|
+
};
|
35
|
+
let value = 0, isExist = false;
|
36
|
+
if (Array.isArray(chosenCoupon)) {
|
37
|
+
chosenCoupon.forEach((i) => {
|
38
|
+
const coupon = coupons[+i];
|
39
|
+
if (coupon) {
|
40
|
+
isExist = true;
|
41
|
+
value += getValue(coupon);
|
42
|
+
}
|
43
|
+
});
|
44
|
+
} else {
|
45
|
+
const coupon = coupons[+chosenCoupon];
|
46
|
+
if (coupon) {
|
47
|
+
isExist = true;
|
48
|
+
value = getValue(coupon);
|
28
49
|
}
|
29
|
-
return `-${currency} ${(value / 100).toFixed(2)}`;
|
30
50
|
}
|
31
|
-
|
51
|
+
if (!isExist) {
|
52
|
+
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
53
|
+
}
|
54
|
+
return `-${currency} ${(value / 100).toFixed(2)}`;
|
32
55
|
}
|
33
56
|
var stdin_default = defineComponent({
|
34
57
|
name,
|
35
58
|
props: couponCellProps,
|
36
59
|
setup(props) {
|
37
60
|
return () => {
|
38
|
-
const selected = props.coupons[+props.chosenCoupon];
|
61
|
+
const selected = Array.isArray(props.chosenCoupon) ? props.chosenCoupon.length : props.coupons[+props.chosenCoupon];
|
39
62
|
return _createVNode(Cell, {
|
40
63
|
"class": bem(),
|
41
64
|
"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: (NumberConstructor |
|
20
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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: (NumberConstructor |
|
42
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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 | unknown[];
|
51
51
|
}, {}>>;
|
52
52
|
export default CouponCell;
|
53
53
|
export { couponCellProps } from './CouponCell';
|
@@ -18,10 +18,7 @@ export declare const couponListProps: {
|
|
18
18
|
default: true;
|
19
19
|
};
|
20
20
|
emptyImage: StringConstructor;
|
21
|
-
chosenCoupon:
|
22
|
-
type: NumberConstructor;
|
23
|
-
default: number;
|
24
|
-
};
|
21
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
25
22
|
enabledTitle: StringConstructor;
|
26
23
|
disabledTitle: StringConstructor;
|
27
24
|
disabledCoupons: {
|
@@ -69,10 +66,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
69
66
|
default: true;
|
70
67
|
};
|
71
68
|
emptyImage: StringConstructor;
|
72
|
-
chosenCoupon:
|
73
|
-
type: NumberConstructor;
|
74
|
-
default: number;
|
75
|
-
};
|
69
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
76
70
|
enabledTitle: StringConstructor;
|
77
71
|
disabledTitle: StringConstructor;
|
78
72
|
disabledCoupons: {
|
@@ -118,10 +112,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
118
112
|
default: true;
|
119
113
|
};
|
120
114
|
emptyImage: StringConstructor;
|
121
|
-
chosenCoupon:
|
122
|
-
type: NumberConstructor;
|
123
|
-
default: number;
|
124
|
-
};
|
115
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
125
116
|
enabledTitle: StringConstructor;
|
126
117
|
disabledTitle: StringConstructor;
|
127
118
|
disabledCoupons: {
|
@@ -157,7 +148,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
157
148
|
code: string;
|
158
149
|
currency: string;
|
159
150
|
coupons: CouponInfo[];
|
160
|
-
chosenCoupon: number;
|
161
151
|
showCount: boolean;
|
162
152
|
disabledCoupons: CouponInfo[];
|
163
153
|
showExchangeBar: boolean;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, computed, nextTick, onMounted, defineComponent } from "vue";
|
2
|
+
import { ref, watch, computed, nextTick, onMounted, unref, defineComponent } from "vue";
|
3
3
|
import { truthProp, windowHeight, makeArrayProp, makeStringProp, makeNumberProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { useRefs } from "../composables/use-refs.mjs";
|
5
5
|
import { Tab } from "../tab/index.mjs";
|
@@ -16,7 +16,7 @@ const couponListProps = {
|
|
16
16
|
currency: makeStringProp("\xA5"),
|
17
17
|
showCount: truthProp,
|
18
18
|
emptyImage: String,
|
19
|
-
chosenCoupon:
|
19
|
+
chosenCoupon: [Number, Array],
|
20
20
|
enabledTitle: String,
|
21
21
|
disabledTitle: String,
|
22
22
|
disabledCoupons: makeArrayProp(),
|
@@ -100,6 +100,15 @@ var stdin_default = defineComponent({
|
|
100
100
|
} = props;
|
101
101
|
const count = props.showCount ? ` (${coupons.length})` : "";
|
102
102
|
const title = (props.enabledTitle || t("enable")) + count;
|
103
|
+
const getChosenCoupon = (chosenCoupon = [], value = 0) => {
|
104
|
+
const unrefChosenCoupon = unref(chosenCoupon);
|
105
|
+
const index = unrefChosenCoupon.indexOf(value);
|
106
|
+
if (index === -1) {
|
107
|
+
return [...unrefChosenCoupon, value];
|
108
|
+
}
|
109
|
+
unrefChosenCoupon.splice(index, 1);
|
110
|
+
return [...unrefChosenCoupon];
|
111
|
+
};
|
103
112
|
return _createVNode(Tab, {
|
104
113
|
"title": title
|
105
114
|
}, {
|
@@ -116,9 +125,9 @@ var stdin_default = defineComponent({
|
|
116
125
|
"key": coupon.id,
|
117
126
|
"ref": setCouponRefs(index),
|
118
127
|
"coupon": coupon,
|
119
|
-
"chosen": index === props.chosenCoupon,
|
128
|
+
"chosen": Array.isArray(props.chosenCoupon) ? props.chosenCoupon.includes(index) : index === props.chosenCoupon,
|
120
129
|
"currency": props.currency,
|
121
|
-
"onClick": () => emit("change", index)
|
130
|
+
"onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? getChosenCoupon(props.chosenCoupon, index) : index)
|
122
131
|
}, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
123
132
|
}
|
124
133
|
});
|
@@ -171,13 +180,13 @@ var stdin_default = defineComponent({
|
|
171
180
|
default: () => [renderCouponTab(), renderDisabledTab()]
|
172
181
|
}), _createVNode("div", {
|
173
182
|
"class": bem("bottom")
|
174
|
-
}, [_withDirectives(_createVNode(Button, {
|
183
|
+
}, [slots["list-button"] ? slots["list-button"]() : _withDirectives(_createVNode(Button, {
|
175
184
|
"round": true,
|
176
185
|
"block": true,
|
177
186
|
"type": "primary",
|
178
187
|
"class": bem("close"),
|
179
188
|
"text": props.closeButtonText || t("close"),
|
180
|
-
"onClick": () => emit("change", -1)
|
189
|
+
"onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? [] : -1)
|
181
190
|
}, null), [[_vShow, props.showCloseButton]])])]);
|
182
191
|
}
|
183
192
|
});
|
@@ -16,10 +16,7 @@ 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
|
-
};
|
19
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
23
20
|
enabledTitle: StringConstructor;
|
24
21
|
disabledTitle: StringConstructor;
|
25
22
|
disabledCoupons: {
|
@@ -65,10 +62,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
65
62
|
default: true;
|
66
63
|
};
|
67
64
|
emptyImage: StringConstructor;
|
68
|
-
chosenCoupon:
|
69
|
-
type: NumberConstructor;
|
70
|
-
default: number;
|
71
|
-
};
|
65
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
72
66
|
enabledTitle: StringConstructor;
|
73
67
|
disabledTitle: StringConstructor;
|
74
68
|
disabledCoupons: {
|
@@ -104,7 +98,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
104
98
|
code: string;
|
105
99
|
currency: string;
|
106
100
|
coupons: import("..").CouponInfo[];
|
107
|
-
chosenCoupon: number;
|
108
101
|
showCount: boolean;
|
109
102
|
disabledCoupons: import("..").CouponInfo[];
|
110
103
|
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.9";
|
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;
|
@@ -19,7 +19,7 @@ export declare const couponCellProps: {
|
|
19
19
|
default: string;
|
20
20
|
};
|
21
21
|
chosenCoupon: {
|
22
|
-
type: (NumberConstructor |
|
22
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
23
23
|
default: number;
|
24
24
|
};
|
25
25
|
};
|
@@ -43,7 +43,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
43
43
|
default: string;
|
44
44
|
};
|
45
45
|
chosenCoupon: {
|
46
|
-
type: (NumberConstructor |
|
46
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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<{
|
@@ -65,7 +65,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
65
65
|
default: string;
|
66
66
|
};
|
67
67
|
chosenCoupon: {
|
68
|
-
type: (NumberConstructor |
|
68
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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 | unknown[];
|
77
77
|
}, {}>;
|
78
78
|
export default _default;
|
@@ -32,33 +32,56 @@ 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
|
+
}
|
36
39
|
};
|
37
40
|
function formatValue({
|
38
41
|
coupons,
|
39
42
|
chosenCoupon,
|
40
43
|
currency
|
41
44
|
}) {
|
42
|
-
const
|
43
|
-
|
44
|
-
|
45
|
+
const getValue = (coupon) => {
|
46
|
+
let value2 = 0;
|
47
|
+
const {
|
48
|
+
value: couponValue,
|
49
|
+
denominations
|
50
|
+
} = coupon;
|
45
51
|
if ((0, import_utils.isDef)(coupon.value)) {
|
46
|
-
|
47
|
-
value
|
48
|
-
} = coupon);
|
52
|
+
value2 = couponValue;
|
49
53
|
} else if ((0, import_utils.isDef)(coupon.denominations)) {
|
50
|
-
|
54
|
+
value2 = denominations;
|
55
|
+
}
|
56
|
+
return value2;
|
57
|
+
};
|
58
|
+
let value = 0, isExist = false;
|
59
|
+
if (Array.isArray(chosenCoupon)) {
|
60
|
+
chosenCoupon.forEach((i) => {
|
61
|
+
const coupon = coupons[+i];
|
62
|
+
if (coupon) {
|
63
|
+
isExist = true;
|
64
|
+
value += getValue(coupon);
|
65
|
+
}
|
66
|
+
});
|
67
|
+
} else {
|
68
|
+
const coupon = coupons[+chosenCoupon];
|
69
|
+
if (coupon) {
|
70
|
+
isExist = true;
|
71
|
+
value = getValue(coupon);
|
51
72
|
}
|
52
|
-
return `-${currency} ${(value / 100).toFixed(2)}`;
|
53
73
|
}
|
54
|
-
|
74
|
+
if (!isExist) {
|
75
|
+
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
76
|
+
}
|
77
|
+
return `-${currency} ${(value / 100).toFixed(2)}`;
|
55
78
|
}
|
56
79
|
var stdin_default = (0, import_vue2.defineComponent)({
|
57
80
|
name,
|
58
81
|
props: couponCellProps,
|
59
82
|
setup(props) {
|
60
83
|
return () => {
|
61
|
-
const selected = props.coupons[+props.chosenCoupon];
|
84
|
+
const selected = Array.isArray(props.chosenCoupon) ? props.chosenCoupon.length : props.coupons[+props.chosenCoupon];
|
62
85
|
return (0, import_vue.createVNode)(import_cell.Cell, {
|
63
86
|
"class": bem(),
|
64
87
|
"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: (NumberConstructor |
|
20
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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: (NumberConstructor |
|
42
|
+
type: (NumberConstructor | ArrayConstructor)[];
|
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 | unknown[];
|
51
51
|
}, {}>>;
|
52
52
|
export default CouponCell;
|
53
53
|
export { couponCellProps } from './CouponCell';
|
@@ -18,10 +18,7 @@ export declare const couponListProps: {
|
|
18
18
|
default: true;
|
19
19
|
};
|
20
20
|
emptyImage: StringConstructor;
|
21
|
-
chosenCoupon:
|
22
|
-
type: NumberConstructor;
|
23
|
-
default: number;
|
24
|
-
};
|
21
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
25
22
|
enabledTitle: StringConstructor;
|
26
23
|
disabledTitle: StringConstructor;
|
27
24
|
disabledCoupons: {
|
@@ -69,10 +66,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
69
66
|
default: true;
|
70
67
|
};
|
71
68
|
emptyImage: StringConstructor;
|
72
|
-
chosenCoupon:
|
73
|
-
type: NumberConstructor;
|
74
|
-
default: number;
|
75
|
-
};
|
69
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
76
70
|
enabledTitle: StringConstructor;
|
77
71
|
disabledTitle: StringConstructor;
|
78
72
|
disabledCoupons: {
|
@@ -118,10 +112,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
118
112
|
default: true;
|
119
113
|
};
|
120
114
|
emptyImage: StringConstructor;
|
121
|
-
chosenCoupon:
|
122
|
-
type: NumberConstructor;
|
123
|
-
default: number;
|
124
|
-
};
|
115
|
+
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
125
116
|
enabledTitle: StringConstructor;
|
126
117
|
disabledTitle: StringConstructor;
|
127
118
|
disabledCoupons: {
|
@@ -157,7 +148,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
157
148
|
code: string;
|
158
149
|
currency: string;
|
159
150
|
coupons: CouponInfo[];
|
160
|
-
chosenCoupon: number;
|
161
151
|
showCount: boolean;
|
162
152
|
disabledCoupons: CouponInfo[];
|
163
153
|
showExchangeBar: boolean;
|
@@ -39,7 +39,7 @@ const couponListProps = {
|
|
39
39
|
currency: (0, import_utils.makeStringProp)("\xA5"),
|
40
40
|
showCount: import_utils.truthProp,
|
41
41
|
emptyImage: String,
|
42
|
-
chosenCoupon:
|
42
|
+
chosenCoupon: [Number, Array],
|
43
43
|
enabledTitle: String,
|
44
44
|
disabledTitle: String,
|
45
45
|
disabledCoupons: (0, import_utils.makeArrayProp)(),
|
@@ -123,6 +123,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
123
123
|
} = props;
|
124
124
|
const count = props.showCount ? ` (${coupons.length})` : "";
|
125
125
|
const title = (props.enabledTitle || t("enable")) + count;
|
126
|
+
const getChosenCoupon = (chosenCoupon = [], value = 0) => {
|
127
|
+
const unrefChosenCoupon = (0, import_vue2.unref)(chosenCoupon);
|
128
|
+
const index = unrefChosenCoupon.indexOf(value);
|
129
|
+
if (index === -1) {
|
130
|
+
return [...unrefChosenCoupon, value];
|
131
|
+
}
|
132
|
+
unrefChosenCoupon.splice(index, 1);
|
133
|
+
return [...unrefChosenCoupon];
|
134
|
+
};
|
126
135
|
return (0, import_vue.createVNode)(import_tab.Tab, {
|
127
136
|
"title": title
|
128
137
|
}, {
|
@@ -139,9 +148,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
139
148
|
"key": coupon.id,
|
140
149
|
"ref": setCouponRefs(index),
|
141
150
|
"coupon": coupon,
|
142
|
-
"chosen": index === props.chosenCoupon,
|
151
|
+
"chosen": Array.isArray(props.chosenCoupon) ? props.chosenCoupon.includes(index) : index === props.chosenCoupon,
|
143
152
|
"currency": props.currency,
|
144
|
-
"onClick": () => emit("change", index)
|
153
|
+
"onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? getChosenCoupon(props.chosenCoupon, index) : index)
|
145
154
|
}, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
146
155
|
}
|
147
156
|
});
|
@@ -194,13 +203,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
194
203
|
default: () => [renderCouponTab(), renderDisabledTab()]
|
195
204
|
}), (0, import_vue.createVNode)("div", {
|
196
205
|
"class": bem("bottom")
|
197
|
-
}, [(0, import_vue.withDirectives)((0, import_vue.createVNode)(import_button.Button, {
|
206
|
+
}, [slots["list-button"] ? slots["list-button"]() : (0, import_vue.withDirectives)((0, import_vue.createVNode)(import_button.Button, {
|
198
207
|
"round": true,
|
199
208
|
"block": true,
|
200
209
|
"type": "primary",
|
201
210
|
"class": bem("close"),
|
202
211
|
"text": props.closeButtonText || t("close"),
|
203
|
-
"onClick": () => emit("change", -1)
|
212
|
+
"onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? [] : -1)
|
204
213
|
}, null), [[import_vue.vShow, props.showCloseButton]])])]);
|
205
214
|
}
|
206
215
|
});
|