vant 3.4.6 → 3.4.7
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/changelog.generated.md +39 -50
- package/es/address-list/AddressListItem.d.ts +3 -2
- package/es/address-list/AddressListItem.js +1 -1
- package/es/badge/Badge.d.ts +4 -3
- package/es/badge/index.d.ts +2 -2
- package/es/calendar/Calendar.js +1 -1
- package/es/calendar/types.d.ts +2 -1
- package/es/cascader/types.d.ts +2 -1
- package/es/checkbox/Checker.d.ts +2 -1
- package/es/collapse/Collapse.d.ts +7 -6
- package/es/collapse/index.d.ts +3 -3
- package/es/composables/use-touch.js +1 -1
- package/es/config-provider/ConfigProvider.d.ts +4 -3
- package/es/config-provider/index.d.ts +2 -2
- package/es/contact-list/ContactList.d.ts +3 -2
- package/es/coupon/Coupon.d.ts +2 -1
- package/es/coupon-list/CouponList.d.ts +3 -13
- package/es/coupon-list/CouponList.js +9 -7
- package/es/coupon-list/index.css +1 -1
- package/es/coupon-list/index.d.ts +2 -9
- package/es/coupon-list/index.less +4 -16
- package/es/coupon-list/style/index.js +1 -0
- package/es/coupon-list/style/less.js +1 -0
- package/es/coupon-list/var.less +0 -1
- package/es/datetime-picker/DatePicker.js +1 -2
- package/es/dialog/types.d.ts +2 -2
- package/es/dropdown-item/types.d.ts +2 -1
- package/es/index-bar/IndexBar.d.ts +5 -4
- package/es/index-bar/IndexBar.js +25 -4
- package/es/index-bar/index.d.ts +3 -3
- package/es/index-bar/types.d.ts +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/locale/lang/is-IS.d.ts +64 -0
- package/es/locale/lang/is-IS.js +74 -0
- package/es/locale/lang/la-LA.d.ts +64 -0
- package/es/locale/lang/la-LA.js +66 -0
- package/es/locale/lang/sv-SE.d.ts +64 -0
- package/es/locale/lang/sv-SE.js +66 -0
- package/es/notify/types.d.ts +2 -1
- package/es/number-keyboard/NumberKeyboard.js +10 -1
- package/es/picker/types.d.ts +3 -2
- package/es/progress/Progress.d.ts +4 -3
- package/es/progress/index.d.ts +2 -2
- package/es/skeleton/Skeleton.d.ts +5 -4
- package/es/skeleton/index.d.ts +3 -3
- package/es/tabbar/Tabbar.d.ts +2 -2
- package/es/tabs/Tabs.d.ts +1 -1
- package/es/tabs/Tabs.js +1 -0
- package/es/tabs/types.d.ts +5 -4
- package/es/toast/types.d.ts +3 -2
- package/es/tree-select/TreeSelect.d.ts +7 -6
- package/es/tree-select/index.d.ts +3 -3
- package/es/uploader/Uploader.d.ts +4 -4
- package/es/uploader/Uploader.js +2 -2
- package/es/uploader/UploaderPreviewItem.d.ts +3 -3
- package/es/uploader/UploaderPreviewItem.js +9 -6
- package/es/uploader/index.d.ts +2 -2
- package/es/uploader/types.d.ts +5 -5
- package/es/utils/basic.d.ts +1 -0
- package/es/utils/format.d.ts +7 -6
- package/es/utils/format.js +6 -0
- package/es/utils/validate.d.ts +2 -1
- package/lib/address-list/AddressListItem.d.ts +3 -2
- package/lib/badge/Badge.d.ts +4 -3
- package/lib/badge/index.d.ts +2 -2
- package/lib/calendar/Calendar.js +1 -1
- package/lib/calendar/types.d.ts +2 -1
- package/lib/cascader/types.d.ts +2 -1
- package/lib/checkbox/Checker.d.ts +2 -1
- package/lib/collapse/Collapse.d.ts +7 -6
- package/lib/collapse/index.d.ts +3 -3
- package/lib/composables/use-touch.js +1 -1
- package/lib/config-provider/ConfigProvider.d.ts +4 -3
- package/lib/config-provider/index.d.ts +2 -2
- package/lib/contact-list/ContactList.d.ts +3 -2
- package/lib/coupon/Coupon.d.ts +2 -1
- package/lib/coupon-list/CouponList.d.ts +3 -13
- package/lib/coupon-list/CouponList.js +9 -7
- package/lib/coupon-list/index.css +1 -1
- package/lib/coupon-list/index.d.ts +2 -9
- package/lib/coupon-list/index.less +4 -16
- package/lib/coupon-list/style/index.js +1 -0
- package/lib/coupon-list/style/less.js +1 -0
- package/lib/coupon-list/var.less +0 -1
- package/lib/datetime-picker/DatePicker.js +1 -2
- package/lib/dialog/types.d.ts +2 -2
- package/lib/dropdown-item/types.d.ts +2 -1
- package/lib/index-bar/IndexBar.d.ts +5 -4
- package/lib/index-bar/IndexBar.js +25 -4
- package/lib/index-bar/index.d.ts +3 -3
- package/lib/index-bar/types.d.ts +2 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.less +2 -2
- package/lib/locale/lang/is-IS.d.ts +64 -0
- package/lib/locale/lang/is-IS.js +98 -0
- package/lib/locale/lang/la-LA.d.ts +64 -0
- package/lib/locale/lang/la-LA.js +90 -0
- package/lib/locale/lang/sv-SE.d.ts +64 -0
- package/lib/locale/lang/sv-SE.js +90 -0
- package/lib/notify/types.d.ts +2 -1
- package/lib/number-keyboard/NumberKeyboard.js +10 -1
- package/lib/picker/types.d.ts +3 -2
- package/lib/progress/Progress.d.ts +4 -3
- package/lib/progress/index.d.ts +2 -2
- package/lib/skeleton/Skeleton.d.ts +5 -4
- package/lib/skeleton/index.d.ts +3 -3
- package/lib/tabbar/Tabbar.d.ts +2 -2
- package/lib/tabs/Tabs.d.ts +1 -1
- package/lib/tabs/Tabs.js +1 -0
- package/lib/tabs/types.d.ts +5 -4
- package/lib/toast/types.d.ts +3 -2
- package/lib/tree-select/TreeSelect.d.ts +7 -6
- package/lib/tree-select/index.d.ts +3 -3
- package/lib/uploader/Uploader.d.ts +4 -4
- package/lib/uploader/Uploader.js +1 -1
- package/lib/uploader/UploaderPreviewItem.d.ts +3 -3
- package/lib/uploader/UploaderPreviewItem.js +9 -6
- package/lib/uploader/index.d.ts +2 -2
- package/lib/uploader/types.d.ts +5 -5
- package/lib/utils/basic.d.ts +1 -0
- package/lib/utils/format.d.ts +7 -6
- package/lib/utils/format.js +6 -0
- package/lib/utils/validate.d.ts +2 -1
- package/lib/vant.cjs.js +269 -229
- package/lib/vant.cjs.min.js +1 -1
- package/lib/vant.es.js +269 -229
- package/lib/vant.es.min.js +269 -229
- package/lib/vant.js +269 -229
- package/lib/vant.min.js +1 -1
- package/package.json +1 -1
- package/vetur/attributes.json +641 -638
- package/vetur/tags.json +227 -227
- package/vetur/web-types.json +2160 -2158
@@ -58,7 +58,7 @@ function useTouch() {
|
|
58
58
|
};
|
59
59
|
const move = (event) => {
|
60
60
|
const touch = event.touches[0];
|
61
|
-
deltaX.value = touch.clientX < 0 ? 0 : touch.clientX - startX.value;
|
61
|
+
deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
|
62
62
|
deltaY.value = touch.clientY - startY.value;
|
63
63
|
offsetX.value = Math.abs(deltaX.value);
|
64
64
|
offsetY.value = Math.abs(deltaY.value);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { type PropType, type InjectionKey, type ExtractPropTypes } from 'vue';
|
2
|
+
import { type Numeric } from '../utils';
|
2
3
|
export declare type ConfigProviderProvide = {
|
3
4
|
iconPrefix?: string;
|
4
5
|
};
|
@@ -8,7 +9,7 @@ declare const configProviderProps: {
|
|
8
9
|
type: PropType<keyof HTMLElementTagNameMap>;
|
9
10
|
default: keyof HTMLElementTagNameMap;
|
10
11
|
};
|
11
|
-
themeVars: PropType<Record<string,
|
12
|
+
themeVars: PropType<Record<string, Numeric>>;
|
12
13
|
iconPrefix: StringConstructor;
|
13
14
|
};
|
14
15
|
export declare type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>;
|
@@ -17,14 +18,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
17
18
|
type: PropType<keyof HTMLElementTagNameMap>;
|
18
19
|
default: keyof HTMLElementTagNameMap;
|
19
20
|
};
|
20
|
-
themeVars: PropType<Record<string,
|
21
|
+
themeVars: PropType<Record<string, Numeric>>;
|
21
22
|
iconPrefix: StringConstructor;
|
22
23
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
23
24
|
tag: {
|
24
25
|
type: PropType<keyof HTMLElementTagNameMap>;
|
25
26
|
default: keyof HTMLElementTagNameMap;
|
26
27
|
};
|
27
|
-
themeVars: PropType<Record<string,
|
28
|
+
themeVars: PropType<Record<string, Numeric>>;
|
28
29
|
iconPrefix: StringConstructor;
|
29
30
|
}>>, {
|
30
31
|
tag: keyof HTMLElementTagNameMap;
|
@@ -3,14 +3,14 @@ export declare const ConfigProvider: import("../utils").WithInstall<import("vue"
|
|
3
3
|
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
4
4
|
default: keyof HTMLElementTagNameMap;
|
5
5
|
};
|
6
|
-
themeVars: import("vue").PropType<Record<string,
|
6
|
+
themeVars: import("vue").PropType<Record<string, import("../utils").Numeric>>;
|
7
7
|
iconPrefix: StringConstructor;
|
8
8
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
9
9
|
tag: {
|
10
10
|
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
11
11
|
default: keyof HTMLElementTagNameMap;
|
12
12
|
};
|
13
|
-
themeVars: import("vue").PropType<Record<string,
|
13
|
+
themeVars: import("vue").PropType<Record<string, import("../utils").Numeric>>;
|
14
14
|
iconPrefix: StringConstructor;
|
15
15
|
}>>, {
|
16
16
|
tag: keyof HTMLElementTagNameMap;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
|
+
import { type Numeric } from '../utils';
|
2
3
|
export declare type ContactListItem = {
|
3
|
-
id?:
|
4
|
-
tel:
|
4
|
+
id?: Numeric;
|
5
|
+
tel: Numeric;
|
5
6
|
name: string;
|
6
7
|
isDefault?: boolean;
|
7
8
|
};
|
package/lib/coupon/Coupon.d.ts
CHANGED
@@ -17,10 +17,7 @@ declare const couponListProps: {
|
|
17
17
|
type: BooleanConstructor;
|
18
18
|
default: true;
|
19
19
|
};
|
20
|
-
emptyImage:
|
21
|
-
type: import("vue").PropType<string>;
|
22
|
-
default: string;
|
23
|
-
};
|
20
|
+
emptyImage: StringConstructor;
|
24
21
|
chosenCoupon: {
|
25
22
|
type: NumberConstructor;
|
26
23
|
default: number;
|
@@ -71,10 +68,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
71
68
|
type: BooleanConstructor;
|
72
69
|
default: true;
|
73
70
|
};
|
74
|
-
emptyImage:
|
75
|
-
type: import("vue").PropType<string>;
|
76
|
-
default: string;
|
77
|
-
};
|
71
|
+
emptyImage: StringConstructor;
|
78
72
|
chosenCoupon: {
|
79
73
|
type: NumberConstructor;
|
80
74
|
default: number;
|
@@ -123,10 +117,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
123
117
|
type: BooleanConstructor;
|
124
118
|
default: true;
|
125
119
|
};
|
126
|
-
emptyImage:
|
127
|
-
type: import("vue").PropType<string>;
|
128
|
-
default: string;
|
129
|
-
};
|
120
|
+
emptyImage: StringConstructor;
|
130
121
|
chosenCoupon: {
|
131
122
|
type: NumberConstructor;
|
132
123
|
default: number;
|
@@ -168,7 +159,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
168
159
|
coupons: CouponInfo[];
|
169
160
|
chosenCoupon: number;
|
170
161
|
showCount: boolean;
|
171
|
-
emptyImage: string;
|
172
162
|
disabledCoupons: CouponInfo[];
|
173
163
|
showExchangeBar: boolean;
|
174
164
|
showCloseButton: boolean;
|
@@ -30,18 +30,18 @@ var import_utils = require("../utils");
|
|
30
30
|
var import_use_refs = require("../composables/use-refs");
|
31
31
|
var import_tab = require("../tab");
|
32
32
|
var import_tabs = require("../tabs");
|
33
|
+
var import_empty = require("../empty");
|
33
34
|
var import_field = require("../field");
|
34
35
|
var import_button = require("../button");
|
35
36
|
var import_coupon = require("../coupon");
|
36
37
|
var import_use = require("@vant/use");
|
37
38
|
const [name, bem, t] = (0, import_utils.createNamespace)("coupon-list");
|
38
|
-
const EMPTY_IMAGE = "https://img.yzcdn.cn/vant/coupon-empty.png";
|
39
39
|
const couponListProps = {
|
40
40
|
code: (0, import_utils.makeStringProp)(""),
|
41
41
|
coupons: (0, import_utils.makeArrayProp)(),
|
42
42
|
currency: (0, import_utils.makeStringProp)("\xA5"),
|
43
43
|
showCount: import_utils.truthProp,
|
44
|
-
emptyImage:
|
44
|
+
emptyImage: String,
|
45
45
|
chosenCoupon: (0, import_utils.makeNumberProp)(-1),
|
46
46
|
enabledTitle: String,
|
47
47
|
disabledTitle: String,
|
@@ -89,11 +89,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
89
89
|
return (_a = couponRefs.value[index]) == null ? void 0 : _a.scrollIntoView();
|
90
90
|
});
|
91
91
|
};
|
92
|
-
const renderEmpty = () => (0, import_vue.createVNode)(
|
93
|
-
"
|
94
|
-
},
|
95
|
-
"
|
96
|
-
|
92
|
+
const renderEmpty = () => (0, import_vue.createVNode)(import_empty.Empty, {
|
93
|
+
"image": props.emptyImage
|
94
|
+
}, {
|
95
|
+
default: () => [(0, import_vue.createVNode)("p", {
|
96
|
+
"class": bem("empty-tip")
|
97
|
+
}, [t("noCoupon")])]
|
98
|
+
});
|
97
99
|
const renderExchangeBar = () => {
|
98
100
|
if (props.showExchangeBar) {
|
99
101
|
return (0, import_vue.createVNode)("div", {
|
@@ -1 +1 @@
|
|
1
|
-
:root{--van-coupon-list-background-color: var(--van-background-color);--van-coupon-list-field-padding: 5px 0 5px var(--van-padding-md);--van-coupon-list-exchange-button-height: 32px;--van-coupon-list-close-button-height: 40px;--van-coupon-list-empty-
|
1
|
+
:root{--van-coupon-list-background-color: var(--van-background-color);--van-coupon-list-field-padding: 5px 0 5px var(--van-padding-md);--van-coupon-list-exchange-button-height: 32px;--van-coupon-list-close-button-height: 40px;--van-coupon-list-empty-tip-color: var(--van-text-color-2);--van-coupon-list-empty-tip-font-size: var(--van-font-size-md);--van-coupon-list-empty-tip-line-height: var(--van-line-height-md)}.van-coupon-list{position:relative;height:100%;background:var(--van-coupon-list-background-color)}.van-coupon-list__field{padding:var(--van-coupon-list-field-padding)}.van-coupon-list__field .van-field__body{height:34px;padding-left:var(--van-padding-sm);line-height:34px;background:var(--van-gray-1);border-radius:17px}.van-coupon-list__field .van-field__body::-webkit-input-placeholder{color:var(--van-text-color-3)}.van-coupon-list__field .van-field__body::placeholder{color:var(--van-text-color-3)}.van-coupon-list__field .van-field__clear{margin-right:0}.van-coupon-list__exchange-bar{display:flex;align-items:center;background-color:var(--van-background-color-light)}.van-coupon-list__exchange{flex:none;height:var(--van-coupon-list-exchange-button-height);font-size:var(--van-font-size-lg);line-height:calc(var(--van-coupon-list-exchange-button-height) - 2px);border:0}.van-coupon-list .van-tabs__wrap{box-shadow:0 6px 12px -12px var(--van-gray-6)}.van-coupon-list__list{box-sizing:border-box;padding:var(--van-padding-md) 0 var(--van-padding-lg);overflow-y:auto;-webkit-overflow-scrolling:touch}.van-coupon-list__list--with-bottom{padding-bottom:50px}.van-coupon-list__bottom{position:absolute;bottom:0;left:0;z-index:999;box-sizing:border-box;width:100%;padding:5px var(--van-padding-md);font-weight:var(--van-font-weight-bold);background-color:var(--van-background-color-light)}.van-coupon-list__close{height:var(--van-coupon-list-close-button-height)}.van-coupon-list__empty-tip{color:var(--van-coupon-list-empty-tip-color);font-size:var(--van-coupon-list-empty-tip-font-size);line-height:var(--van-coupon-list-empty-tip-line-height)}
|
@@ -15,10 +15,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
15
15
|
type: BooleanConstructor;
|
16
16
|
default: true;
|
17
17
|
};
|
18
|
-
emptyImage:
|
19
|
-
type: import("vue").PropType<string>;
|
20
|
-
default: string;
|
21
|
-
};
|
18
|
+
emptyImage: StringConstructor;
|
22
19
|
chosenCoupon: {
|
23
20
|
type: NumberConstructor;
|
24
21
|
default: number;
|
@@ -67,10 +64,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
67
64
|
type: BooleanConstructor;
|
68
65
|
default: true;
|
69
66
|
};
|
70
|
-
emptyImage:
|
71
|
-
type: import("vue").PropType<string>;
|
72
|
-
default: string;
|
73
|
-
};
|
67
|
+
emptyImage: StringConstructor;
|
74
68
|
chosenCoupon: {
|
75
69
|
type: NumberConstructor;
|
76
70
|
default: number;
|
@@ -112,7 +106,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
|
|
112
106
|
coupons: import("..").CouponInfo[];
|
113
107
|
chosenCoupon: number;
|
114
108
|
showCount: boolean;
|
115
|
-
emptyImage: string;
|
116
109
|
disabledCoupons: import("..").CouponInfo[];
|
117
110
|
showExchangeBar: boolean;
|
118
111
|
showCloseButton: boolean;
|
@@ -5,7 +5,6 @@
|
|
5
5
|
--van-coupon-list-field-padding: @coupon-list-field-padding;
|
6
6
|
--van-coupon-list-exchange-button-height: @coupon-list-exchange-button-height;
|
7
7
|
--van-coupon-list-close-button-height: @coupon-list-close-button-height;
|
8
|
-
--van-coupon-list-empty-image-size: @coupon-list-empty-image-size;
|
9
8
|
--van-coupon-list-empty-tip-color: @coupon-list-empty-tip-color;
|
10
9
|
--van-coupon-list-empty-tip-font-size: @coupon-list-empty-tip-font-size;
|
11
10
|
--van-coupon-list-empty-tip-line-height: @coupon-list-empty-tip-line-height;
|
@@ -81,20 +80,9 @@
|
|
81
80
|
height: var(--van-coupon-list-close-button-height);
|
82
81
|
}
|
83
82
|
|
84
|
-
&__empty {
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
p {
|
89
|
-
margin: var(--van-padding-md) 0;
|
90
|
-
color: var(--van-coupon-list-empty-tip-color);
|
91
|
-
font-size: var(--van-coupon-list-empty-tip-font-size);
|
92
|
-
line-height: var(--van-coupon-list-empty-tip-line-height);
|
93
|
-
}
|
94
|
-
|
95
|
-
img {
|
96
|
-
width: var(--van-coupon-list-empty-image-size);
|
97
|
-
height: var(--van-coupon-list-empty-image-size);
|
98
|
-
}
|
83
|
+
&__empty-tip {
|
84
|
+
color: var(--van-coupon-list-empty-tip-color);
|
85
|
+
font-size: var(--van-coupon-list-empty-tip-font-size);
|
86
|
+
line-height: var(--van-coupon-list-empty-tip-line-height);
|
99
87
|
}
|
100
88
|
}
|
package/lib/coupon-list/var.less
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
@coupon-list-field-padding: 5px 0 5px var(--van-padding-md);
|
5
5
|
@coupon-list-exchange-button-height: 32px;
|
6
6
|
@coupon-list-close-button-height: 40px;
|
7
|
-
@coupon-list-empty-image-size: 200px;
|
8
7
|
@coupon-list-empty-tip-color: var(--van-text-color-2);
|
9
8
|
@coupon-list-empty-tip-font-size: var(--van-font-size-md);
|
10
9
|
@coupon-list-empty-tip-line-height: var(--van-line-height-md);
|
@@ -248,8 +248,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
248
248
|
});
|
249
249
|
(0, import_vue2.watch)(columns, updateColumnValue);
|
250
250
|
(0, import_vue2.watch)(currentDate, (value, oldValue) => emit("update:modelValue", oldValue ? value : null));
|
251
|
-
(0, import_vue2.watch)(() => [props.filter, props.maxDate],
|
252
|
-
(0, import_vue2.watch)(() => props.minDate, () => {
|
251
|
+
(0, import_vue2.watch)(() => [props.filter, props.minDate, props.maxDate], () => {
|
253
252
|
(0, import_vue2.nextTick)(updateInnerValue);
|
254
253
|
});
|
255
254
|
(0, import_vue2.watch)(() => props.modelValue, (value) => {
|
package/lib/dialog/types.d.ts
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
import { Dialog } from './function-call';
|
2
2
|
import type { CSSProperties, TeleportProps } from 'vue';
|
3
|
-
import type { Interceptor } from '../utils';
|
3
|
+
import type { Interceptor, Numeric } from '../utils';
|
4
4
|
export declare type DialogTheme = 'default' | 'round-button';
|
5
5
|
export declare type DialogAction = 'confirm' | 'cancel';
|
6
6
|
export declare type DialogMessage = string | (() => JSX.Element);
|
7
7
|
export declare type DialogMessageAlign = 'left' | 'center' | 'right';
|
8
8
|
export declare type DialogOptions = {
|
9
9
|
title?: string;
|
10
|
-
width?:
|
10
|
+
width?: Numeric;
|
11
11
|
theme?: DialogTheme;
|
12
12
|
message?: DialogMessage;
|
13
13
|
overlay?: boolean;
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import type { DropdownItemProps } from './DropdownItem';
|
2
2
|
import type { VNode, ComponentPublicInstance } from 'vue';
|
3
|
+
import type { Numeric } from '../utils';
|
3
4
|
export declare type DropdownItemOption = {
|
4
5
|
text: string;
|
5
6
|
icon?: string;
|
6
|
-
value:
|
7
|
+
value: Numeric;
|
7
8
|
};
|
8
9
|
export declare type DropdownItemExpose = {
|
9
10
|
toggle: (show?: boolean, options?: {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { type PropType, type InjectionKey, type ExtractPropTypes } from 'vue';
|
2
|
+
import { type Numeric } from '../utils';
|
2
3
|
import { IndexBarProvide } from './types';
|
3
4
|
declare function genAlphabet(): string[];
|
4
5
|
declare const indexBarProps: {
|
@@ -14,7 +15,7 @@ declare const indexBarProps: {
|
|
14
15
|
default: number;
|
15
16
|
};
|
16
17
|
indexList: {
|
17
|
-
type: PropType<
|
18
|
+
type: PropType<Numeric[]>;
|
18
19
|
default: typeof genAlphabet;
|
19
20
|
};
|
20
21
|
};
|
@@ -33,7 +34,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
33
34
|
default: number;
|
34
35
|
};
|
35
36
|
indexList: {
|
36
|
-
type: PropType<
|
37
|
+
type: PropType<Numeric[]>;
|
37
38
|
default: typeof genAlphabet;
|
38
39
|
};
|
39
40
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "change")[], "select" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
@@ -49,7 +50,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
49
50
|
default: number;
|
50
51
|
};
|
51
52
|
indexList: {
|
52
|
-
type: PropType<
|
53
|
+
type: PropType<Numeric[]>;
|
53
54
|
default: typeof genAlphabet;
|
54
55
|
};
|
55
56
|
}>> & {
|
@@ -58,6 +59,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
58
59
|
}, {
|
59
60
|
sticky: boolean;
|
60
61
|
stickyOffsetTop: number;
|
61
|
-
indexList:
|
62
|
+
indexList: Numeric[];
|
62
63
|
}>;
|
63
64
|
export default _default;
|
@@ -65,6 +65,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
65
65
|
children,
|
66
66
|
linkChildren
|
67
67
|
} = (0, import_use.useChildren)(INDEX_BAR_KEY);
|
68
|
+
let selectActiveIndex;
|
68
69
|
linkChildren({
|
69
70
|
props
|
70
71
|
});
|
@@ -92,6 +93,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
92
93
|
}
|
93
94
|
return -1;
|
94
95
|
};
|
96
|
+
const getMatchAnchor = (index) => children.find((item) => String(item.index) === index);
|
95
97
|
const onScroll = () => {
|
96
98
|
if ((0, import_utils.isHidden)(root)) {
|
97
99
|
return;
|
@@ -103,7 +105,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
103
105
|
const scrollTop = (0, import_utils.getScrollTop)(scrollParent.value);
|
104
106
|
const scrollParentRect = (0, import_use.useRect)(scrollParent);
|
105
107
|
const rects = children.map((item) => item.getRect(scrollParent.value, scrollParentRect));
|
106
|
-
|
108
|
+
let active = -1;
|
109
|
+
if (selectActiveIndex) {
|
110
|
+
const match = getMatchAnchor(selectActiveIndex);
|
111
|
+
if (match) {
|
112
|
+
const rect = match.getRect(scrollParent.value, scrollParentRect);
|
113
|
+
active = getActiveAnchor(rect.top, rects);
|
114
|
+
}
|
115
|
+
} else {
|
116
|
+
active = getActiveAnchor(scrollTop, rects);
|
117
|
+
}
|
107
118
|
activeAnchor.value = indexList[active];
|
108
119
|
if (sticky) {
|
109
120
|
children.forEach((item, index) => {
|
@@ -122,7 +133,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
122
133
|
if (index === active) {
|
123
134
|
state.active = true;
|
124
135
|
state.top = Math.max(props.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top;
|
125
|
-
} else if (index === active - 1) {
|
136
|
+
} else if (index === active - 1 && selectActiveIndex === "") {
|
126
137
|
const activeItemTop = rects[active].top - scrollTop;
|
127
138
|
state.active = activeItemTop > 0;
|
128
139
|
state.top = activeItemTop + scrollParentRect.top - rects[index].height;
|
@@ -131,6 +142,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
131
142
|
}
|
132
143
|
});
|
133
144
|
}
|
145
|
+
selectActiveIndex = "";
|
134
146
|
};
|
135
147
|
const init = () => {
|
136
148
|
(0, import_vue2.nextTick)(onScroll);
|
@@ -156,9 +168,18 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
156
168
|
}, [index]);
|
157
169
|
});
|
158
170
|
const scrollTo = (index) => {
|
159
|
-
|
160
|
-
const match =
|
171
|
+
selectActiveIndex = String(index);
|
172
|
+
const match = getMatchAnchor(selectActiveIndex);
|
161
173
|
if (match) {
|
174
|
+
const scrollTop = (0, import_utils.getScrollTop)(scrollParent.value);
|
175
|
+
const scrollParentRect = (0, import_use.useRect)(scrollParent);
|
176
|
+
const {
|
177
|
+
offsetHeight
|
178
|
+
} = document.documentElement;
|
179
|
+
if (scrollTop === offsetHeight - scrollParentRect.height) {
|
180
|
+
onScroll();
|
181
|
+
return;
|
182
|
+
}
|
162
183
|
match.$el.scrollIntoView();
|
163
184
|
if (props.sticky && props.stickyOffsetTop) {
|
164
185
|
(0, import_utils.setRootScrollTop)((0, import_utils.getRootScrollTop)() - props.stickyOffsetTop);
|
package/lib/index-bar/index.d.ts
CHANGED
@@ -12,7 +12,7 @@ export declare const IndexBar: import("../utils").WithInstall<import("vue").Defi
|
|
12
12
|
default: number;
|
13
13
|
};
|
14
14
|
indexList: {
|
15
|
-
type: import("vue").PropType<(
|
15
|
+
type: import("vue").PropType<import("../utils").Numeric[]>;
|
16
16
|
default: () => string[];
|
17
17
|
};
|
18
18
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "change")[], "select" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
@@ -28,7 +28,7 @@ export declare const IndexBar: import("../utils").WithInstall<import("vue").Defi
|
|
28
28
|
default: number;
|
29
29
|
};
|
30
30
|
indexList: {
|
31
|
-
type: import("vue").PropType<(
|
31
|
+
type: import("vue").PropType<import("../utils").Numeric[]>;
|
32
32
|
default: () => string[];
|
33
33
|
};
|
34
34
|
}>> & {
|
@@ -37,7 +37,7 @@ export declare const IndexBar: import("../utils").WithInstall<import("vue").Defi
|
|
37
37
|
}, {
|
38
38
|
sticky: boolean;
|
39
39
|
stickyOffsetTop: number;
|
40
|
-
indexList: (
|
40
|
+
indexList: import("../utils").Numeric[];
|
41
41
|
}>>;
|
42
42
|
export default IndexBar;
|
43
43
|
export type { IndexBarProps };
|
package/lib/index-bar/types.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import type { ComponentPublicInstance } from 'vue';
|
2
|
+
import type { Numeric } from '../utils';
|
2
3
|
import type { IndexBarProps } from './IndexBar';
|
3
4
|
export declare type IndexBarProvide = {
|
4
5
|
props: IndexBarProps;
|
5
6
|
};
|
6
7
|
export declare type IndexBarExpose = {
|
7
|
-
scrollTo: (index:
|
8
|
+
scrollTo: (index: Numeric) => void;
|
8
9
|
};
|
9
10
|
export declare type IndexBarInstance = ComponentPublicInstance<IndexBarProps, IndexBarExpose>;
|