vant 4.8.9 → 4.8.11
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 +22 -29
- package/es/coupon-cell/index.d.ts +3 -3
- package/es/coupon-list/CouponList.d.ts +26 -16
- package/es/coupon-list/CouponList.mjs +14 -13
- package/es/coupon-list/index.d.ts +9 -2
- package/es/dropdown-item/DropdownItem.mjs +10 -3
- package/es/dropdown-item/index.css +1 -1
- package/es/dropdown-item/types.d.ts +1 -0
- package/es/dropdown-menu/index.css +1 -1
- package/es/dropdown-menu/types.d.ts +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/lib/coupon-cell/CouponCell.d.ts +11 -11
- package/lib/coupon-cell/CouponCell.js +22 -29
- package/lib/coupon-cell/index.d.ts +3 -3
- package/lib/coupon-list/CouponList.d.ts +26 -16
- package/lib/coupon-list/CouponList.js +13 -12
- package/lib/coupon-list/index.d.ts +9 -2
- package/lib/dropdown-item/DropdownItem.js +10 -3
- package/lib/dropdown-item/index.css +1 -1
- package/lib/dropdown-item/types.d.ts +1 -0
- package/lib/dropdown-menu/index.css +1 -1
- package/lib/dropdown-menu/types.d.ts +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/vant.cjs.js +50 -49
- package/lib/vant.es.js +50 -49
- package/lib/vant.js +50 -49
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +6 -6
@@ -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: number |
|
76
|
+
chosenCoupon: number | number[];
|
77
77
|
}, {}>;
|
78
78
|
export default _default;
|
@@ -14,44 +14,37 @@ const couponCellProps = {
|
|
14
14
|
default: -1
|
15
15
|
}
|
16
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;
|
29
|
+
};
|
17
30
|
function formatValue({
|
18
31
|
coupons,
|
19
32
|
chosenCoupon,
|
20
33
|
currency
|
21
34
|
}) {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
denominations
|
27
|
-
} = coupon;
|
28
|
-
if (isDef(coupon.value)) {
|
29
|
-
value2 = couponValue;
|
30
|
-
} else if (isDef(coupon.denominations)) {
|
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];
|
35
|
+
let value = 0;
|
36
|
+
let isExist = false;
|
37
|
+
(Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
|
38
|
+
const coupon = coupons[+i];
|
46
39
|
if (coupon) {
|
47
40
|
isExist = true;
|
48
|
-
value
|
41
|
+
value += getValue(coupon);
|
49
42
|
}
|
43
|
+
});
|
44
|
+
if (isExist) {
|
45
|
+
return `-${currency} ${(value / 100).toFixed(2)}`;
|
50
46
|
}
|
51
|
-
|
52
|
-
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
53
|
-
}
|
54
|
-
return `-${currency} ${(value / 100).toFixed(2)}`;
|
47
|
+
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
55
48
|
}
|
56
49
|
var stdin_default = defineComponent({
|
57
50
|
name,
|
@@ -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: number |
|
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,11 +18,10 @@ export declare const couponListProps: {
|
|
18
18
|
default: true;
|
19
19
|
};
|
20
20
|
emptyImage: StringConstructor;
|
21
|
-
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
22
21
|
enabledTitle: StringConstructor;
|
23
22
|
disabledTitle: StringConstructor;
|
24
23
|
disabledCoupons: {
|
25
|
-
type:
|
24
|
+
type: PropType<CouponInfo[]>;
|
26
25
|
default: () => never[];
|
27
26
|
};
|
28
27
|
showExchangeBar: {
|
@@ -46,19 +45,23 @@ export declare const couponListProps: {
|
|
46
45
|
};
|
47
46
|
exchangeButtonLoading: BooleanConstructor;
|
48
47
|
exchangeButtonDisabled: BooleanConstructor;
|
48
|
+
chosenCoupon: {
|
49
|
+
type: PropType<number | number[]>;
|
50
|
+
default: number;
|
51
|
+
};
|
49
52
|
};
|
50
53
|
export type CouponListProps = ExtractPropTypes<typeof couponListProps>;
|
51
54
|
declare const _default: import("vue").DefineComponent<{
|
52
55
|
code: {
|
53
|
-
type:
|
56
|
+
type: PropType<string>;
|
54
57
|
default: string;
|
55
58
|
};
|
56
59
|
coupons: {
|
57
|
-
type:
|
60
|
+
type: PropType<CouponInfo[]>;
|
58
61
|
default: () => never[];
|
59
62
|
};
|
60
63
|
currency: {
|
61
|
-
type:
|
64
|
+
type: PropType<string>;
|
62
65
|
default: string;
|
63
66
|
};
|
64
67
|
showCount: {
|
@@ -66,11 +69,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
66
69
|
default: true;
|
67
70
|
};
|
68
71
|
emptyImage: StringConstructor;
|
69
|
-
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
70
72
|
enabledTitle: StringConstructor;
|
71
73
|
disabledTitle: StringConstructor;
|
72
74
|
disabledCoupons: {
|
73
|
-
type:
|
75
|
+
type: PropType<CouponInfo[]>;
|
74
76
|
default: () => never[];
|
75
77
|
};
|
76
78
|
showExchangeBar: {
|
@@ -94,17 +96,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
94
96
|
};
|
95
97
|
exchangeButtonLoading: BooleanConstructor;
|
96
98
|
exchangeButtonDisabled: BooleanConstructor;
|
99
|
+
chosenCoupon: {
|
100
|
+
type: PropType<number | number[]>;
|
101
|
+
default: number;
|
102
|
+
};
|
97
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<{
|
98
104
|
code: {
|
99
|
-
type:
|
105
|
+
type: PropType<string>;
|
100
106
|
default: string;
|
101
107
|
};
|
102
108
|
coupons: {
|
103
|
-
type:
|
109
|
+
type: PropType<CouponInfo[]>;
|
104
110
|
default: () => never[];
|
105
111
|
};
|
106
112
|
currency: {
|
107
|
-
type:
|
113
|
+
type: PropType<string>;
|
108
114
|
default: string;
|
109
115
|
};
|
110
116
|
showCount: {
|
@@ -112,11 +118,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
112
118
|
default: true;
|
113
119
|
};
|
114
120
|
emptyImage: StringConstructor;
|
115
|
-
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
116
121
|
enabledTitle: StringConstructor;
|
117
122
|
disabledTitle: StringConstructor;
|
118
123
|
disabledCoupons: {
|
119
|
-
type:
|
124
|
+
type: PropType<CouponInfo[]>;
|
120
125
|
default: () => never[];
|
121
126
|
};
|
122
127
|
showExchangeBar: {
|
@@ -140,6 +145,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
140
145
|
};
|
141
146
|
exchangeButtonLoading: BooleanConstructor;
|
142
147
|
exchangeButtonDisabled: BooleanConstructor;
|
148
|
+
chosenCoupon: {
|
149
|
+
type: PropType<number | number[]>;
|
150
|
+
default: number;
|
151
|
+
};
|
143
152
|
}>> & {
|
144
153
|
onChange?: ((...args: any[]) => any) | undefined;
|
145
154
|
onExchange?: ((...args: any[]) => any) | undefined;
|
@@ -148,6 +157,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
148
157
|
code: string;
|
149
158
|
currency: string;
|
150
159
|
coupons: CouponInfo[];
|
160
|
+
chosenCoupon: number | number[];
|
151
161
|
showCount: boolean;
|
152
162
|
disabledCoupons: CouponInfo[];
|
153
163
|
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,
|
2
|
+
import { ref, watch, computed, nextTick, onMounted, 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,6 @@ const couponListProps = {
|
|
16
16
|
currency: makeStringProp("\xA5"),
|
17
17
|
showCount: truthProp,
|
18
18
|
emptyImage: String,
|
19
|
-
chosenCoupon: [Number, Array],
|
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,18 +99,16 @@ 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;
|
103
|
-
const
|
104
|
-
|
105
|
-
|
106
|
-
if (index === -1) {
|
107
|
-
return [...unrefChosenCoupon, value];
|
107
|
+
const updateChosenCoupon = (currentValues = [], value = 0) => {
|
108
|
+
if (currentValues.includes(value)) {
|
109
|
+
return currentValues.filter((item) => item !== value);
|
108
110
|
}
|
109
|
-
|
110
|
-
return [...unrefChosenCoupon];
|
111
|
+
return [...currentValues, value];
|
111
112
|
};
|
112
113
|
return _createVNode(Tab, {
|
113
114
|
"title": title
|
@@ -125,9 +126,9 @@ var stdin_default = defineComponent({
|
|
125
126
|
"key": coupon.id,
|
126
127
|
"ref": setCouponRefs(index),
|
127
128
|
"coupon": coupon,
|
128
|
-
"chosen": Array.isArray(
|
129
|
+
"chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
|
129
130
|
"currency": props.currency,
|
130
|
-
"onClick": () => emit("change", Array.isArray(
|
131
|
+
"onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
|
131
132
|
}, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
132
133
|
}
|
133
134
|
});
|
@@ -16,7 +16,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
16
16
|
default: true;
|
17
17
|
};
|
18
18
|
emptyImage: StringConstructor;
|
19
|
-
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
20
19
|
enabledTitle: StringConstructor;
|
21
20
|
disabledTitle: StringConstructor;
|
22
21
|
disabledCoupons: {
|
@@ -44,6 +43,10 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
44
43
|
};
|
45
44
|
exchangeButtonLoading: BooleanConstructor;
|
46
45
|
exchangeButtonDisabled: BooleanConstructor;
|
46
|
+
chosenCoupon: {
|
47
|
+
type: import("vue").PropType<number | number[]>;
|
48
|
+
default: number;
|
49
|
+
};
|
47
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<{
|
48
51
|
code: {
|
49
52
|
type: import("vue").PropType<string>;
|
@@ -62,7 +65,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
62
65
|
default: true;
|
63
66
|
};
|
64
67
|
emptyImage: StringConstructor;
|
65
|
-
chosenCoupon: (NumberConstructor | ArrayConstructor)[];
|
66
68
|
enabledTitle: StringConstructor;
|
67
69
|
disabledTitle: StringConstructor;
|
68
70
|
disabledCoupons: {
|
@@ -90,6 +92,10 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
90
92
|
};
|
91
93
|
exchangeButtonLoading: BooleanConstructor;
|
92
94
|
exchangeButtonDisabled: BooleanConstructor;
|
95
|
+
chosenCoupon: {
|
96
|
+
type: import("vue").PropType<number | number[]>;
|
97
|
+
default: number;
|
98
|
+
};
|
93
99
|
}>> & {
|
94
100
|
onChange?: ((...args: any[]) => any) | undefined;
|
95
101
|
onExchange?: ((...args: any[]) => any) | undefined;
|
@@ -98,6 +104,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
98
104
|
code: string;
|
99
105
|
currency: string;
|
100
106
|
coupons: import("..").CouponInfo[];
|
107
|
+
chosenCoupon: number | number[];
|
101
108
|
showCount: boolean;
|
102
109
|
disabledCoupons: import("..").CouponInfo[];
|
103
110
|
showExchangeBar: boolean;
|
@@ -81,8 +81,14 @@ var stdin_default = defineComponent({
|
|
81
81
|
const {
|
82
82
|
activeColor
|
83
83
|
} = parent.props;
|
84
|
+
const {
|
85
|
+
disabled
|
86
|
+
} = option;
|
84
87
|
const active = option.value === props.modelValue;
|
85
88
|
const onClick = () => {
|
89
|
+
if (disabled) {
|
90
|
+
return;
|
91
|
+
}
|
86
92
|
state.showPopup = false;
|
87
93
|
if (option.value !== props.modelValue) {
|
88
94
|
emit("update:modelValue", option.value);
|
@@ -93,7 +99,7 @@ var stdin_default = defineComponent({
|
|
93
99
|
if (active) {
|
94
100
|
return _createVNode(Icon, {
|
95
101
|
"class": bem("icon"),
|
96
|
-
"color": activeColor,
|
102
|
+
"color": disabled ? void 0 : activeColor,
|
97
103
|
"name": "success"
|
98
104
|
}, null);
|
99
105
|
}
|
@@ -104,13 +110,14 @@ var stdin_default = defineComponent({
|
|
104
110
|
"icon": option.icon,
|
105
111
|
"title": option.text,
|
106
112
|
"class": bem("option", {
|
107
|
-
active
|
113
|
+
active,
|
114
|
+
disabled
|
108
115
|
}),
|
109
116
|
"style": {
|
110
117
|
color: active ? activeColor : ""
|
111
118
|
},
|
112
119
|
"tabindex": active ? 0 : -1,
|
113
|
-
"clickable":
|
120
|
+
"clickable": !disabled,
|
114
121
|
"onClick": onClick
|
115
122
|
}, {
|
116
123
|
value: renderIcon
|
@@ -1 +1 @@
|
|
1
|
-
:root,:host{--van-dropdown-item-z-index: 10}.van-dropdown-item{position:fixed;right:0;left:0;z-index:var(--van-dropdown-item-z-index);overflow:hidden}.van-dropdown-item__icon{display:block;line-height:inherit}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active,.van-dropdown-item__option--active .van-dropdown-item__icon{color:var(--van-dropdown-menu-option-active-color)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__content{position:absolute;max-height:var(--van-dropdown-menu-content-max-height)}
|
1
|
+
:root,:host{--van-dropdown-item-z-index: 10}.van-dropdown-item{position:fixed;right:0;left:0;z-index:var(--van-dropdown-item-z-index);overflow:hidden}.van-dropdown-item__icon{display:block;line-height:inherit}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active,.van-dropdown-item__option--active .van-dropdown-item__icon{color:var(--van-dropdown-menu-option-active-color)}.van-dropdown-item__option--disabled,.van-dropdown-item__option--disabled .van-dropdown-item__icon{color:var(--van-dropdown-menu-option-disabled-color)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__content{position:absolute;max-height:var(--van-dropdown-menu-content-max-height)}
|
@@ -3,6 +3,7 @@ import type { VNode, ComponentPublicInstance } from 'vue';
|
|
3
3
|
import type { Numeric } from '../utils';
|
4
4
|
export type DropdownItemOptionValue = Numeric | boolean;
|
5
5
|
export type DropdownItemOption = {
|
6
|
+
disabled?: boolean;
|
6
7
|
text: string;
|
7
8
|
icon?: string;
|
8
9
|
value: DropdownItemOptionValue;
|
@@ -1 +1 @@
|
|
1
|
-
:root,:host{--van-dropdown-menu-height: 48px;--van-dropdown-menu-background: var(--van-background-2);--van-dropdown-menu-shadow: 0 2px 12px rgba(100, 101, 102, .12);--van-dropdown-menu-title-font-size: 15px;--van-dropdown-menu-title-text-color: var(--van-text-color);--van-dropdown-menu-title-active-text-color: var(--van-primary-color);--van-dropdown-menu-title-disabled-text-color: var(--van-text-color-2);--van-dropdown-menu-title-padding: 0 var(--van-padding-xs);--van-dropdown-menu-title-line-height: var(--van-line-height-lg);--van-dropdown-menu-option-active-color: var(--van-primary-color);--van-dropdown-menu-content-max-height: 80%}.van-dropdown-menu{-webkit-user-select:none;user-select:none}.van-dropdown-menu__bar{position:relative;display:flex;height:var(--van-dropdown-menu-height);background:var(--van-dropdown-menu-background);box-shadow:var(--van-dropdown-menu-shadow)}.van-dropdown-menu__bar--opened{z-index:calc(var(--van-dropdown-item-z-index) + 1)}.van-dropdown-menu__bar--scrollable{padding-left:var(--van-padding-base);padding-right:var(--van-padding-xs);overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-dropdown-menu__bar--scrollable::-webkit-scrollbar{display:none}.van-dropdown-menu__item{display:flex;flex:1;align-items:center;justify-content:center;min-width:0}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:var(--van-dropdown-menu-title-disabled-text-color)}.van-dropdown-menu__item--grow{flex:1 0 auto;padding-left:var(--van-padding-base);padding-right:var(--van-padding-sm)}.van-dropdown-menu__title{position:relative;box-sizing:border-box;max-width:100%;padding:var(--van-dropdown-menu-title-padding);color:var(--van-dropdown-menu-title-text-color);font-size:var(--van-dropdown-menu-title-font-size);line-height:var(--van-dropdown-menu-title-line-height)}.van-dropdown-menu__title:after{position:absolute;top:50%;right:-4px;margin-top:-5px;border:3px solid;border-color:transparent transparent var(--van-gray-4) var(--van-gray-4);transform:rotate(-45deg);opacity:.8;content:""}.van-dropdown-menu__title--active{color:var(--van-dropdown-menu-title-active-text-color)}.van-dropdown-menu__title--active:after{border-color:transparent transparent currentColor currentColor}.van-dropdown-menu__title--down:after{margin-top:-1px;transform:rotate(135deg)}
|
1
|
+
:root,:host{--van-dropdown-menu-height: 48px;--van-dropdown-menu-background: var(--van-background-2);--van-dropdown-menu-shadow: 0 2px 12px rgba(100, 101, 102, .12);--van-dropdown-menu-title-font-size: 15px;--van-dropdown-menu-title-text-color: var(--van-text-color);--van-dropdown-menu-title-active-text-color: var(--van-primary-color);--van-dropdown-menu-title-disabled-text-color: var(--van-text-color-2);--van-dropdown-menu-title-padding: 0 var(--van-padding-xs);--van-dropdown-menu-title-line-height: var(--van-line-height-lg);--van-dropdown-menu-option-active-color: var(--van-primary-color);--van-dropdown-menu-option-disabled-color: var(--van-text-color-3);--van-dropdown-menu-content-max-height: 80%}.van-dropdown-menu{-webkit-user-select:none;user-select:none}.van-dropdown-menu__bar{position:relative;display:flex;height:var(--van-dropdown-menu-height);background:var(--van-dropdown-menu-background);box-shadow:var(--van-dropdown-menu-shadow)}.van-dropdown-menu__bar--opened{z-index:calc(var(--van-dropdown-item-z-index) + 1)}.van-dropdown-menu__bar--scrollable{padding-left:var(--van-padding-base);padding-right:var(--van-padding-xs);overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-dropdown-menu__bar--scrollable::-webkit-scrollbar{display:none}.van-dropdown-menu__item{display:flex;flex:1;align-items:center;justify-content:center;min-width:0}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:var(--van-dropdown-menu-title-disabled-text-color)}.van-dropdown-menu__item--grow{flex:1 0 auto;padding-left:var(--van-padding-base);padding-right:var(--van-padding-sm)}.van-dropdown-menu__title{position:relative;box-sizing:border-box;max-width:100%;padding:var(--van-dropdown-menu-title-padding);color:var(--van-dropdown-menu-title-text-color);font-size:var(--van-dropdown-menu-title-font-size);line-height:var(--van-dropdown-menu-title-line-height)}.van-dropdown-menu__title:after{position:absolute;top:50%;right:-4px;margin-top:-5px;border:3px solid;border-color:transparent transparent var(--van-gray-4) var(--van-gray-4);transform:rotate(-45deg);opacity:.8;content:""}.van-dropdown-menu__title--active{color:var(--van-dropdown-menu-title-active-text-color)}.van-dropdown-menu__title--active:after{border-color:transparent transparent currentColor currentColor}.van-dropdown-menu__title--down:after{margin-top:-1px;transform:rotate(135deg)}
|
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.11";
|
103
103
|
function install(app) {
|
104
104
|
const components = [
|
105
105
|
ActionBar,
|
@@ -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: number |
|
76
|
+
chosenCoupon: number | number[];
|
77
77
|
}, {}>;
|
78
78
|
export default _default;
|
@@ -37,44 +37,37 @@ const couponCellProps = {
|
|
37
37
|
default: -1
|
38
38
|
}
|
39
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;
|
52
|
+
};
|
40
53
|
function formatValue({
|
41
54
|
coupons,
|
42
55
|
chosenCoupon,
|
43
56
|
currency
|
44
57
|
}) {
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
denominations
|
50
|
-
} = coupon;
|
51
|
-
if ((0, import_utils.isDef)(coupon.value)) {
|
52
|
-
value2 = couponValue;
|
53
|
-
} else if ((0, import_utils.isDef)(coupon.denominations)) {
|
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];
|
58
|
+
let value = 0;
|
59
|
+
let isExist = false;
|
60
|
+
(Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
|
61
|
+
const coupon = coupons[+i];
|
69
62
|
if (coupon) {
|
70
63
|
isExist = true;
|
71
|
-
value
|
64
|
+
value += getValue(coupon);
|
72
65
|
}
|
66
|
+
});
|
67
|
+
if (isExist) {
|
68
|
+
return `-${currency} ${(value / 100).toFixed(2)}`;
|
73
69
|
}
|
74
|
-
|
75
|
-
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
76
|
-
}
|
77
|
-
return `-${currency} ${(value / 100).toFixed(2)}`;
|
70
|
+
return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
|
78
71
|
}
|
79
72
|
var stdin_default = (0, import_vue2.defineComponent)({
|
80
73
|
name,
|
@@ -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: number |
|
50
|
+
chosenCoupon: number | number[];
|
51
51
|
}, {}>>;
|
52
52
|
export default CouponCell;
|
53
53
|
export { couponCellProps } from './CouponCell';
|