vant 3.2.8 → 3.3.0
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/address-edit/AddressEdit.js +155 -180
- package/es/address-edit/AddressEditDetail.d.ts +10 -9
- package/es/address-edit/AddressEditDetail.js +6 -6
- package/es/button/Button.js +2 -2
- package/es/calendar/CalendarHeader.js +1 -3
- package/es/cascader/Cascader.js +10 -2
- package/es/checkbox/Checker.js +1 -1
- package/es/checkbox/types.d.ts +2 -6
- package/es/composables/use-id.d.ts +1 -0
- package/es/composables/use-id.js +14 -0
- package/es/composables/use-route.d.ts +1 -1
- package/es/composables/use-route.js +4 -4
- package/es/count-down/CountDown.js +1 -0
- package/es/coupon-list/CouponList.js +40 -24
- package/es/coupon-list/index.css +1 -1
- package/es/coupon-list/index.less +0 -5
- package/es/dropdown-item/DropdownItem.js +7 -2
- package/es/dropdown-item/types.d.ts +2 -6
- package/es/dropdown-menu/DropdownMenu.js +7 -3
- package/es/dropdown-menu/types.d.ts +1 -0
- package/es/empty/Network.js +22 -34
- package/es/field/Field.d.ts +1 -1
- package/es/field/Field.js +13 -5
- package/es/field/index.d.ts +2 -2
- package/es/field/types.d.ts +7 -6
- package/es/form/Form.js +2 -2
- package/es/image/Image.js +4 -9
- package/es/image-preview/ImagePreview.js +3 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/lazyload/index.d.ts +1 -1
- package/es/lazyload/index.js +1 -1
- package/es/lazyload/vue-lazyload/index.d.ts +55 -0
- package/es/lazyload/vue-lazyload/index.js +46 -0
- package/es/lazyload/vue-lazyload/lazy-component.js +53 -0
- package/es/lazyload/vue-lazyload/lazy-container.js +98 -0
- package/es/lazyload/vue-lazyload/lazy-image.js +115 -0
- package/es/lazyload/vue-lazyload/lazy.js +507 -0
- package/es/lazyload/vue-lazyload/listener.js +241 -0
- package/es/lazyload/vue-lazyload/util.js +183 -0
- package/es/list/List.js +3 -1
- package/es/number-keyboard/NumberKeyboardKey.js +4 -4
- package/es/pagination/Pagination.js +67 -49
- package/es/pagination/index.css +1 -1
- package/es/pagination/index.less +32 -31
- package/es/password-input/PasswordInput.d.ts +1 -1
- package/es/password-input/index.d.ts +1 -1
- package/es/popover/Popover.js +2 -0
- package/es/popup/Popup.d.ts +1 -2
- package/es/popup/Popup.js +2 -5
- package/es/popup/index.d.ts +1 -2
- package/es/rate/Rate.js +5 -3
- package/es/search/Search.js +8 -2
- package/es/sidebar/Sidebar.js +1 -0
- package/es/sidebar-item/SidebarItem.js +4 -1
- package/es/slider/Slider.js +5 -3
- package/es/stepper/Stepper.js +11 -8
- package/es/swipe/Swipe.js +3 -4
- package/es/swipe/types.d.ts +1 -3
- package/es/switch/Switch.js +1 -0
- package/es/switch/index.css +1 -1
- package/es/switch/index.less +2 -0
- package/es/tab/Tab.js +17 -4
- package/es/tab/index.css +1 -1
- package/es/tab/index.less +1 -1
- package/es/tabbar/Tabbar.d.ts +1 -1
- package/es/tabbar/Tabbar.js +10 -10
- package/es/tabbar-item/TabbarItem.js +11 -4
- package/es/tabs/Tabs.js +10 -5
- package/es/tabs/TabsTitle.d.ts +6 -0
- package/es/tabs/TabsTitle.js +7 -1
- package/es/tabs/types.d.ts +1 -0
- package/es/uploader/UploaderPreviewItem.js +4 -1
- package/es/uploader/utils.d.ts +2 -2
- package/es/uploader/utils.js +2 -2
- package/es/utils/dom.d.ts +1 -0
- package/es/utils/dom.js +6 -2
- package/es/utils/format.js +6 -5
- package/es/vue-tsx-shim.d.ts +1 -0
- package/lib/address-edit/AddressEdit.js +156 -180
- package/lib/address-edit/AddressEditDetail.d.ts +10 -9
- package/lib/address-edit/AddressEditDetail.js +6 -6
- package/lib/button/Button.js +1 -1
- package/lib/calendar/CalendarHeader.js +1 -3
- package/lib/cascader/Cascader.js +10 -2
- package/lib/checkbox/Checker.js +1 -1
- package/lib/checkbox/types.d.ts +2 -6
- package/lib/composables/use-id.d.ts +1 -0
- package/lib/composables/use-id.js +21 -0
- package/lib/composables/use-route.d.ts +1 -1
- package/lib/composables/use-route.js +4 -4
- package/lib/count-down/CountDown.js +1 -0
- package/lib/coupon-list/CouponList.js +39 -22
- package/lib/coupon-list/index.css +1 -1
- package/lib/coupon-list/index.less +0 -5
- package/lib/dropdown-item/DropdownItem.js +7 -2
- package/lib/dropdown-item/types.d.ts +2 -6
- package/lib/dropdown-menu/DropdownMenu.js +7 -2
- package/lib/dropdown-menu/types.d.ts +1 -0
- package/lib/empty/Network.js +22 -34
- package/lib/field/Field.d.ts +1 -1
- package/lib/field/Field.js +14 -5
- package/lib/field/index.d.ts +2 -2
- package/lib/field/types.d.ts +7 -6
- package/lib/form/Form.js +1 -1
- package/lib/image/Image.js +4 -9
- package/lib/image-preview/ImagePreview.js +1 -2
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/lazyload/index.d.ts +1 -1
- package/lib/lazyload/index.js +3 -3
- package/lib/lazyload/vue-lazyload/index.d.ts +55 -0
- package/lib/lazyload/vue-lazyload/index.js +58 -0
- package/lib/lazyload/vue-lazyload/lazy-component.js +62 -0
- package/lib/lazyload/vue-lazyload/lazy-container.js +106 -0
- package/lib/lazyload/vue-lazyload/lazy-image.js +125 -0
- package/lib/lazyload/vue-lazyload/lazy.js +520 -0
- package/lib/lazyload/vue-lazyload/listener.js +251 -0
- package/lib/lazyload/vue-lazyload/util.js +213 -0
- package/lib/list/List.js +3 -1
- package/lib/number-keyboard/NumberKeyboardKey.js +3 -3
- package/lib/pagination/Pagination.js +65 -47
- package/lib/pagination/index.css +1 -1
- package/lib/pagination/index.less +32 -31
- package/lib/password-input/PasswordInput.d.ts +1 -1
- package/lib/password-input/index.d.ts +1 -1
- package/lib/popover/Popover.js +2 -0
- package/lib/popup/Popup.d.ts +1 -2
- package/lib/popup/Popup.js +2 -5
- package/lib/popup/index.d.ts +1 -2
- package/lib/rate/Rate.js +5 -3
- package/lib/search/Search.js +9 -2
- package/lib/sidebar/Sidebar.js +1 -0
- package/lib/sidebar-item/SidebarItem.js +4 -1
- package/lib/slider/Slider.js +5 -3
- package/lib/stepper/Stepper.js +11 -8
- package/lib/swipe/Swipe.js +1 -2
- package/lib/swipe/types.d.ts +1 -3
- package/lib/switch/Switch.js +1 -0
- package/lib/switch/index.css +1 -1
- package/lib/switch/index.less +2 -0
- package/lib/tab/Tab.js +19 -4
- package/lib/tab/index.css +1 -1
- package/lib/tab/index.less +1 -1
- package/lib/tabbar/Tabbar.d.ts +1 -1
- package/lib/tabbar/Tabbar.js +10 -10
- package/lib/tabbar-item/TabbarItem.js +11 -4
- package/lib/tabs/Tabs.js +9 -3
- package/lib/tabs/TabsTitle.d.ts +6 -0
- package/lib/tabs/TabsTitle.js +7 -1
- package/lib/tabs/types.d.ts +1 -0
- package/lib/uploader/UploaderPreviewItem.js +3 -0
- package/lib/uploader/utils.d.ts +2 -2
- package/lib/uploader/utils.js +3 -2
- package/lib/utils/dom.d.ts +1 -0
- package/lib/utils/dom.js +9 -2
- package/lib/utils/format.js +7 -5
- package/lib/vant.es.js +1086 -1068
- package/lib/vant.es.min.js +1086 -1068
- package/lib/vant.js +1085 -1067
- package/lib/vant.min.js +1 -1
- package/lib/vue-tsx-shim.d.ts +1 -0
- package/package.json +4 -4
- package/vetur/attributes.json +340 -340
- package/vetur/tags.json +119 -119
- package/vetur/web-types.json +1143 -1143
- package/es/composables/use-link-field.d.ts +0 -0
- package/es/composables/use-link-field.js +0 -0
- package/lib/composables/use-link-field.d.ts +0 -0
- package/lib/composables/use-link-field.js +0 -1
@@ -19,6 +19,8 @@ var _button = require("../button");
|
|
19
19
|
|
20
20
|
var _coupon = require("../coupon");
|
21
21
|
|
22
|
+
var _use = require("@vant/use");
|
23
|
+
|
22
24
|
// Utils
|
23
25
|
// Composables
|
24
26
|
// Components
|
@@ -56,25 +58,33 @@ var _default = (0, _vue.defineComponent)({
|
|
56
58
|
slots
|
57
59
|
} = _ref;
|
58
60
|
var [couponRefs, setCouponRefs] = (0, _useRefs.useRefs)();
|
59
|
-
var
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
var
|
61
|
+
var root = (0, _vue.ref)();
|
62
|
+
var barRef = (0, _vue.ref)();
|
63
|
+
var activeTab = (0, _vue.ref)(0);
|
64
|
+
var listHeight = (0, _vue.ref)(0);
|
65
|
+
var currentCode = (0, _vue.ref)(props.code);
|
66
|
+
var buttonDisabled = (0, _vue.computed)(() => !props.exchangeButtonLoading && (props.exchangeButtonDisabled || !currentCode.value || currentCode.value.length < props.exchangeMinLength));
|
67
|
+
|
68
|
+
var updateListHeight = () => {
|
69
|
+
var TABS_HEIGHT = 44;
|
70
|
+
var rootHeight = (0, _use.useRect)(root).height;
|
71
|
+
var headerHeight = (0, _use.useRect)(barRef).height + TABS_HEIGHT;
|
72
|
+
listHeight.value = (rootHeight > headerHeight ? rootHeight : _utils.windowHeight.value) - headerHeight;
|
73
|
+
};
|
64
74
|
|
65
75
|
var onExchange = () => {
|
66
|
-
emit('exchange',
|
76
|
+
emit('exchange', currentCode.value); // auto clear currentCode when not use v-model
|
67
77
|
|
68
78
|
if (!props.code) {
|
69
|
-
|
79
|
+
currentCode.value = '';
|
70
80
|
}
|
71
81
|
};
|
72
82
|
|
73
83
|
var scrollToCoupon = index => {
|
74
84
|
(0, _vue.nextTick)(() => {
|
75
|
-
|
76
|
-
|
77
|
-
|
85
|
+
var _couponRefs$value$ind;
|
86
|
+
|
87
|
+
return (_couponRefs$value$ind = couponRefs.value[index]) == null ? void 0 : _couponRefs$value$ind.scrollIntoView();
|
78
88
|
});
|
79
89
|
};
|
80
90
|
|
@@ -87,10 +97,11 @@ var _default = (0, _vue.defineComponent)({
|
|
87
97
|
var renderExchangeBar = () => {
|
88
98
|
if (props.showExchangeBar) {
|
89
99
|
return (0, _vue.createVNode)("div", {
|
100
|
+
"ref": barRef,
|
90
101
|
"class": bem('exchange-bar')
|
91
102
|
}, [(0, _vue.createVNode)(_field.Field, {
|
92
|
-
"modelValue":
|
93
|
-
"onUpdate:modelValue": $event =>
|
103
|
+
"modelValue": currentCode.value,
|
104
|
+
"onUpdate:modelValue": $event => currentCode.value = $event,
|
94
105
|
"clearable": true,
|
95
106
|
"border": false,
|
96
107
|
"class": bem('field'),
|
@@ -121,9 +132,11 @@ var _default = (0, _vue.defineComponent)({
|
|
121
132
|
}, {
|
122
133
|
default: () => [(0, _vue.createVNode)("div", {
|
123
134
|
"class": bem('list', {
|
124
|
-
'with-bar': props.showExchangeBar,
|
125
135
|
'with-bottom': props.showCloseButton
|
126
|
-
})
|
136
|
+
}),
|
137
|
+
"style": {
|
138
|
+
height: listHeight.value + "px"
|
139
|
+
}
|
127
140
|
}, [coupons.map((coupon, index) => (0, _vue.createVNode)(_coupon.Coupon, {
|
128
141
|
"key": coupon.id,
|
129
142
|
"ref": setCouponRefs(index),
|
@@ -148,9 +161,11 @@ var _default = (0, _vue.defineComponent)({
|
|
148
161
|
}, {
|
149
162
|
default: () => [(0, _vue.createVNode)("div", {
|
150
163
|
"class": bem('list', {
|
151
|
-
'with-bar': props.showExchangeBar,
|
152
164
|
'with-bottom': props.showCloseButton
|
153
|
-
})
|
165
|
+
}),
|
166
|
+
"style": {
|
167
|
+
height: listHeight.value + "px"
|
168
|
+
}
|
154
169
|
}, [disabledCoupons.map(coupon => (0, _vue.createVNode)(_coupon.Coupon, {
|
155
170
|
"disabled": true,
|
156
171
|
"key": coupon.id,
|
@@ -161,20 +176,22 @@ var _default = (0, _vue.defineComponent)({
|
|
161
176
|
};
|
162
177
|
|
163
178
|
(0, _vue.watch)(() => props.code, value => {
|
164
|
-
|
179
|
+
currentCode.value = value;
|
165
180
|
});
|
166
|
-
(0, _vue.watch)(
|
181
|
+
(0, _vue.watch)(_utils.windowHeight, updateListHeight);
|
182
|
+
(0, _vue.watch)(currentCode, value => emit('update:code', value));
|
167
183
|
(0, _vue.watch)(() => props.displayedCouponIndex, scrollToCoupon);
|
168
184
|
(0, _vue.onMounted)(() => {
|
185
|
+
updateListHeight();
|
169
186
|
scrollToCoupon(props.displayedCouponIndex);
|
170
187
|
});
|
171
188
|
return () => (0, _vue.createVNode)("div", {
|
189
|
+
"ref": root,
|
172
190
|
"class": bem()
|
173
191
|
}, [renderExchangeBar(), (0, _vue.createVNode)(_tabs.Tabs, {
|
174
|
-
"active":
|
175
|
-
"onUpdate:active": $event =>
|
176
|
-
"class": bem('tab')
|
177
|
-
"border": false
|
192
|
+
"active": activeTab.value,
|
193
|
+
"onUpdate:active": $event => activeTab.value = $event,
|
194
|
+
"class": bem('tab')
|
178
195
|
}, {
|
179
196
|
default: () => [renderCouponTab(), renderDisabledTab()]
|
180
197
|
}), (0, _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-image-size:200px;--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;
|
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-image-size:200px;--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{padding-top:60px;text-align:center}.van-coupon-list__empty p{margin:var(--van-padding-md) 0;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)}.van-coupon-list__empty img{width:var(--van-coupon-list-empty-image-size);height:var(--van-coupon-list-empty-image-size)}
|
@@ -56,15 +56,10 @@
|
|
56
56
|
|
57
57
|
&__list {
|
58
58
|
box-sizing: border-box;
|
59
|
-
height: calc(100vh - 108px);
|
60
59
|
padding: var(--van-padding-md) 0 var(--van-padding-lg);
|
61
60
|
overflow-y: auto;
|
62
61
|
-webkit-overflow-scrolling: touch;
|
63
62
|
|
64
|
-
&--with-bar {
|
65
|
-
height: calc(100vh - 152px);
|
66
|
-
}
|
67
|
-
|
68
63
|
&--with-bottom {
|
69
64
|
padding-bottom: 50px;
|
70
65
|
}
|
@@ -49,7 +49,8 @@ var _default = (0, _vue.defineComponent)({
|
|
49
49
|
showWrapper: false
|
50
50
|
});
|
51
51
|
var {
|
52
|
-
parent
|
52
|
+
parent,
|
53
|
+
index
|
53
54
|
} = (0, _use.useParent)(_DropdownMenu.DROPDOWN_KEY);
|
54
55
|
|
55
56
|
if (!parent) {
|
@@ -138,7 +139,7 @@ var _default = (0, _vue.defineComponent)({
|
|
138
139
|
};
|
139
140
|
|
140
141
|
return (0, _vue.createVNode)(_cell.Cell, {
|
141
|
-
"
|
142
|
+
"role": "menuitem",
|
142
143
|
"key": option.value,
|
143
144
|
"icon": option.icon,
|
144
145
|
"title": option.text,
|
@@ -148,6 +149,8 @@ var _default = (0, _vue.defineComponent)({
|
|
148
149
|
"style": {
|
149
150
|
color: active ? activeColor : ''
|
150
151
|
},
|
152
|
+
"tabindex": active ? 0 : -1,
|
153
|
+
"clickable": true,
|
151
154
|
"onClick": onClick
|
152
155
|
}, {
|
153
156
|
value: renderIcon
|
@@ -180,6 +183,7 @@ var _default = (0, _vue.defineComponent)({
|
|
180
183
|
}, [(0, _vue.createVNode)(_popup.Popup, {
|
181
184
|
"show": state.showPopup,
|
182
185
|
"onUpdate:show": $event => state.showPopup = $event,
|
186
|
+
"role": "menu",
|
183
187
|
"class": bem('content'),
|
184
188
|
"overlay": overlay,
|
185
189
|
"position": direction === 'down' ? 'top' : 'bottom',
|
@@ -188,6 +192,7 @@ var _default = (0, _vue.defineComponent)({
|
|
188
192
|
"overlayStyle": {
|
189
193
|
position: 'absolute'
|
190
194
|
},
|
195
|
+
"aria-labelledby": parent.id + "-" + index.value,
|
191
196
|
"closeOnClickOverlay": closeOnClickOverlay,
|
192
197
|
"onOpen": onOpen,
|
193
198
|
"onClose": onClose,
|
@@ -9,17 +9,13 @@ export declare type DropdownItemExpose = {
|
|
9
9
|
toggle: (show?: boolean, options?: {
|
10
10
|
immediate?: boolean;
|
11
11
|
}) => void;
|
12
|
-
/**
|
13
|
-
* @private
|
14
|
-
*/
|
12
|
+
/** @private */
|
15
13
|
state: {
|
16
14
|
showPopup: boolean;
|
17
15
|
transition: boolean;
|
18
16
|
showWrapper: boolean;
|
19
17
|
};
|
20
|
-
/**
|
21
|
-
* @private
|
22
|
-
*/
|
18
|
+
/** @private */
|
23
19
|
renderTitle: () => string | VNode[];
|
24
20
|
};
|
25
21
|
export declare type DropdownItemInstance = ComponentPublicInstance<DropdownItemProps, DropdownItemExpose>;
|
@@ -7,6 +7,8 @@ var _vue = require("vue");
|
|
7
7
|
|
8
8
|
var _utils = require("../utils");
|
9
9
|
|
10
|
+
var _useId = require("../composables/use-id");
|
11
|
+
|
10
12
|
var _use = require("@vant/use");
|
11
13
|
|
12
14
|
// Utils
|
@@ -32,6 +34,7 @@ var _default = (0, _vue.defineComponent)({
|
|
32
34
|
var {
|
33
35
|
slots
|
34
36
|
} = _ref;
|
37
|
+
var id = (0, _useId.useId)();
|
35
38
|
var root = (0, _vue.ref)();
|
36
39
|
var barRef = (0, _vue.ref)();
|
37
40
|
var offset = (0, _vue.ref)(0);
|
@@ -64,7 +67,7 @@ var _default = (0, _vue.defineComponent)({
|
|
64
67
|
if (props.direction === 'down') {
|
65
68
|
offset.value = rect.bottom;
|
66
69
|
} else {
|
67
|
-
offset.value =
|
70
|
+
offset.value = _utils.windowHeight.value - rect.top;
|
68
71
|
}
|
69
72
|
}
|
70
73
|
};
|
@@ -97,8 +100,9 @@ var _default = (0, _vue.defineComponent)({
|
|
97
100
|
titleClass
|
98
101
|
} = item;
|
99
102
|
return (0, _vue.createVNode)("div", {
|
103
|
+
"id": id + "-" + index,
|
100
104
|
"role": "button",
|
101
|
-
"tabindex": disabled ?
|
105
|
+
"tabindex": disabled ? undefined : 0,
|
102
106
|
"class": [bem('item', {
|
103
107
|
disabled
|
104
108
|
}), {
|
@@ -123,6 +127,7 @@ var _default = (0, _vue.defineComponent)({
|
|
123
127
|
};
|
124
128
|
|
125
129
|
linkChildren({
|
130
|
+
id,
|
126
131
|
props,
|
127
132
|
offset
|
128
133
|
});
|
package/lib/empty/Network.js
CHANGED
@@ -17,71 +17,59 @@ var Network = (0, _vue.createVNode)("svg", {
|
|
17
17
|
"viewBox": "0 0 160 160"
|
18
18
|
}, [(0, _vue.createVNode)("defs", null, [(0, _vue.createVNode)("linearGradient", {
|
19
19
|
"id": prefix + "1",
|
20
|
-
"x1": "64
|
20
|
+
"x1": "64%",
|
21
21
|
"y1": "100%",
|
22
|
-
"x2": "64
|
22
|
+
"x2": "64%"
|
23
23
|
}, [renderStop('#FFF', 0, 0.5), renderStop('#F2F3F5', 100)]), (0, _vue.createVNode)("linearGradient", {
|
24
24
|
"id": prefix + "2",
|
25
25
|
"x1": "50%",
|
26
26
|
"x2": "50%",
|
27
|
-
"y2": "84
|
27
|
+
"y2": "84%"
|
28
28
|
}, [renderStop('#EBEDF0', 0), renderStop('#DCDEE0', 100, 0)]), (0, _vue.createVNode)("linearGradient", {
|
29
29
|
"id": prefix + "3",
|
30
30
|
"x1": "100%",
|
31
31
|
"x2": "100%",
|
32
32
|
"y2": "100%"
|
33
|
-
}, [renderStop('#EAEDF0', 0), renderStop('#DCDEE0', 100)]), (0, _vue.createVNode)("linearGradient", {
|
34
|
-
"id": prefix + "4",
|
35
|
-
"x1": "100%",
|
36
|
-
"y1": "100%",
|
37
|
-
"x2": "100%"
|
38
33
|
}, [renderStop('#EAEDF0', 0), renderStop('#DCDEE0', 100)]), (0, _vue.createVNode)("radialGradient", {
|
39
|
-
"id": prefix + "
|
34
|
+
"id": prefix + "4",
|
40
35
|
"cx": "50%",
|
41
36
|
"cy": "0%",
|
42
37
|
"fx": "50%",
|
43
38
|
"fy": "0%",
|
44
39
|
"r": "100%",
|
45
|
-
"gradientTransform": "matrix(0 1 -.
|
40
|
+
"gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
|
46
41
|
}, [renderStop('#EBEDF0', 0), renderStop('#FFF', 100, 0)])]), (0, _vue.createVNode)("g", {
|
47
42
|
"fill": "none"
|
48
43
|
}, [(0, _vue.createVNode)("g", {
|
49
44
|
"opacity": ".8"
|
50
45
|
}, [(0, _vue.createVNode)("path", {
|
51
|
-
"d": "
|
52
|
-
"fill": "url(#" + prefix + "1)"
|
53
|
-
"transform": "matrix(-1 0 0 1 36 7)"
|
46
|
+
"d": "M36 131V53H16v20H2v58h34z",
|
47
|
+
"fill": "url(#" + prefix + "1)"
|
54
48
|
}, null), (0, _vue.createVNode)("path", {
|
55
|
-
"d": "
|
56
|
-
"fill": "url(#" + prefix + "1)"
|
57
|
-
"transform": "translate(2 7)"
|
49
|
+
"d": "M123 15h22v14h9v77h-31V15z",
|
50
|
+
"fill": "url(#" + prefix + "1)"
|
58
51
|
}, null)]), (0, _vue.createVNode)("path", {
|
59
|
-
"fill": "url(#" + prefix + "
|
52
|
+
"fill": "url(#" + prefix + "4)",
|
60
53
|
"d": "M0 139h160v21H0z"
|
61
54
|
}, null), (0, _vue.createVNode)("path", {
|
62
|
-
"d": "
|
63
|
-
"fill": "url(#" + prefix + "2)"
|
64
|
-
"transform": "translate(43 36)"
|
55
|
+
"d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
|
56
|
+
"fill": "url(#" + prefix + "2)"
|
65
57
|
}, null), (0, _vue.createVNode)("g", {
|
66
58
|
"opacity": ".6",
|
67
59
|
"stroke-linecap": "round",
|
68
60
|
"stroke-width": "7"
|
69
61
|
}, [(0, _vue.createVNode)("path", {
|
70
|
-
"d": "
|
71
|
-
"stroke": "url(#" + prefix + "3)"
|
72
|
-
"transform": "translate(43 36)"
|
62
|
+
"d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
|
63
|
+
"stroke": "url(#" + prefix + "3)"
|
73
64
|
}, null), (0, _vue.createVNode)("path", {
|
74
|
-
"d": "
|
75
|
-
"stroke": "url(#" + prefix + "3)"
|
76
|
-
"transform": "translate(43 36)"
|
65
|
+
"d": "M53 36a34 34 0 0 0 0 48",
|
66
|
+
"stroke": "url(#" + prefix + "3)"
|
77
67
|
}, null), (0, _vue.createVNode)("path", {
|
78
|
-
"d": "
|
79
|
-
"stroke": "url(#" + prefix + "
|
80
|
-
"transform": "rotate(-180 76.483 42.257)"
|
68
|
+
"d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
|
69
|
+
"stroke": "url(#" + prefix + "3)"
|
81
70
|
}, null), (0, _vue.createVNode)("path", {
|
82
|
-
"d": "
|
83
|
-
"stroke": "url(#" + prefix + "
|
84
|
-
"transform": "rotate(-180 89.791 42.146)"
|
71
|
+
"d": "M106 84a34 34 0 0 0 0-48",
|
72
|
+
"stroke": "url(#" + prefix + "3)"
|
85
73
|
}, null)]), (0, _vue.createVNode)("g", {
|
86
74
|
"transform": "translate(31 105)"
|
87
75
|
}, [(0, _vue.createVNode)("rect", {
|
@@ -95,13 +83,13 @@ var Network = (0, _vue.createVNode)("svg", {
|
|
95
83
|
"y": "8",
|
96
84
|
"width": "80",
|
97
85
|
"height": "18",
|
98
|
-
"rx": "1.
|
86
|
+
"rx": "1.1"
|
99
87
|
}, null), (0, _vue.createVNode)("rect", {
|
100
88
|
"fill": "#EBEDF0",
|
101
89
|
"x": "15",
|
102
90
|
"y": "12",
|
103
91
|
"width": "18",
|
104
92
|
"height": "6",
|
105
|
-
"rx": "1.
|
93
|
+
"rx": "1.1"
|
106
94
|
}, null)])])]);
|
107
95
|
exports.Network = Network;
|
package/lib/field/Field.d.ts
CHANGED
@@ -278,12 +278,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
278
278
|
value?: string | number | undefined;
|
279
279
|
icon?: string | undefined;
|
280
280
|
size?: import("../cell").CellSize | undefined;
|
281
|
+
id?: string | undefined;
|
281
282
|
valueClass?: unknown;
|
282
283
|
labelClass?: unknown;
|
283
284
|
titleClass?: unknown;
|
284
285
|
titleStyle?: string | import("vue").CSSProperties | undefined;
|
285
286
|
arrowDirection?: import("../cell").CellArrowDirection | undefined;
|
286
|
-
id?: string | undefined;
|
287
287
|
leftIcon?: string | undefined;
|
288
288
|
rightIcon?: string | undefined;
|
289
289
|
maxlength?: string | number | undefined;
|
package/lib/field/Field.js
CHANGED
@@ -13,6 +13,8 @@ var _Cell = require("../cell/Cell");
|
|
13
13
|
|
14
14
|
var _use = require("@vant/use");
|
15
15
|
|
16
|
+
var _useId = require("../composables/use-id");
|
17
|
+
|
16
18
|
var _useExpose = require("../composables/use-expose");
|
17
19
|
|
18
20
|
var _icon = require("../icon");
|
@@ -81,6 +83,7 @@ var _default = (0, _vue.defineComponent)({
|
|
81
83
|
emit,
|
82
84
|
slots
|
83
85
|
} = _ref;
|
86
|
+
var id = (0, _useId.useId)();
|
84
87
|
var state = (0, _vue.reactive)({
|
85
88
|
focused: false,
|
86
89
|
validateFailed: false,
|
@@ -285,14 +288,16 @@ var _default = (0, _vue.defineComponent)({
|
|
285
288
|
emit('focus', event);
|
286
289
|
(0, _vue.nextTick)(adjustTextareaSize); // readonly not work in legacy mobile safari
|
287
290
|
|
288
|
-
|
289
|
-
|
290
|
-
if (readonly) {
|
291
|
+
if (getProp('readonly')) {
|
291
292
|
blur();
|
292
293
|
}
|
293
294
|
};
|
294
295
|
|
295
296
|
var onBlur = event => {
|
297
|
+
if (getProp('readonly')) {
|
298
|
+
return;
|
299
|
+
}
|
300
|
+
|
296
301
|
state.focused = false;
|
297
302
|
updateValue(getModelValue(), 'onBlur');
|
298
303
|
emit('blur', event);
|
@@ -351,6 +356,8 @@ var _default = (0, _vue.defineComponent)({
|
|
351
356
|
emit('keypress', event);
|
352
357
|
};
|
353
358
|
|
359
|
+
var getInputId = () => props.id || id + "-input";
|
360
|
+
|
354
361
|
var renderInput = () => {
|
355
362
|
var controlClass = bem('control', [getProp('inputAlign'), {
|
356
363
|
error: showError.value,
|
@@ -366,7 +373,7 @@ var _default = (0, _vue.defineComponent)({
|
|
366
373
|
}
|
367
374
|
|
368
375
|
var inputAttrs = {
|
369
|
-
id:
|
376
|
+
id: getInputId(),
|
370
377
|
ref: inputRef,
|
371
378
|
name: props.name,
|
372
379
|
rows: props.rows !== undefined ? +props.rows : undefined,
|
@@ -377,6 +384,7 @@ var _default = (0, _vue.defineComponent)({
|
|
377
384
|
autofocus: props.autofocus,
|
378
385
|
placeholder: props.placeholder,
|
379
386
|
autocomplete: props.autocomplete,
|
387
|
+
'aria-labelledby': props.label ? id + "-label" : undefined,
|
380
388
|
onBlur,
|
381
389
|
onFocus,
|
382
390
|
onInput,
|
@@ -460,7 +468,8 @@ var _default = (0, _vue.defineComponent)({
|
|
460
468
|
|
461
469
|
if (props.label) {
|
462
470
|
return (0, _vue.createVNode)("label", {
|
463
|
-
"
|
471
|
+
"id": id + "-label",
|
472
|
+
"for": getInputId()
|
464
473
|
}, [props.label + colon]);
|
465
474
|
}
|
466
475
|
};
|
package/lib/field/index.d.ts
CHANGED
@@ -152,12 +152,12 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
|
|
152
152
|
value?: string | number | undefined;
|
153
153
|
icon?: string | undefined;
|
154
154
|
size?: import("..").CellSize | undefined;
|
155
|
+
id?: string | undefined;
|
155
156
|
valueClass?: unknown;
|
156
157
|
labelClass?: unknown;
|
157
158
|
titleClass?: unknown;
|
158
159
|
titleStyle?: string | import("vue").CSSProperties | undefined;
|
159
160
|
arrowDirection?: import("..").CellArrowDirection | undefined;
|
160
|
-
id?: string | undefined;
|
161
161
|
leftIcon?: string | undefined;
|
162
162
|
rightIcon?: string | undefined;
|
163
163
|
maxlength?: string | number | undefined;
|
@@ -201,4 +201,4 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
|
|
201
201
|
}>>;
|
202
202
|
export default Field;
|
203
203
|
export type { FieldProps };
|
204
|
-
export type { FieldType, FieldRule, FieldInstance, FieldTextAlign, FieldClearTrigger, FieldFormatTrigger, FieldValidateError, FieldAutosizeConfig, FieldValidateTrigger, } from './types';
|
204
|
+
export type { FieldType, FieldRule, FieldInstance, FieldTextAlign, FieldRuleMessage, FieldClearTrigger, FieldFormatTrigger, FieldRuleValidator, FiledRuleFormatter, FieldValidateError, FieldAutosizeConfig, FieldValidateTrigger, } from './types';
|
package/lib/field/types.d.ts
CHANGED
@@ -13,13 +13,16 @@ export declare type FieldValidateError = {
|
|
13
13
|
name?: string;
|
14
14
|
message: string;
|
15
15
|
};
|
16
|
+
export declare type FieldRuleMessage = string | ((value: any, rule: FieldRule) => string);
|
17
|
+
export declare type FieldRuleValidator = (value: any, rule: FieldRule) => boolean | string | Promise<boolean | string>;
|
18
|
+
export declare type FiledRuleFormatter = (value: any, rule: FieldRule) => string;
|
16
19
|
export declare type FieldRule = {
|
17
20
|
pattern?: RegExp;
|
18
21
|
trigger?: FieldValidateTrigger;
|
19
|
-
message?:
|
22
|
+
message?: FieldRuleMessage;
|
20
23
|
required?: boolean;
|
21
|
-
validator?:
|
22
|
-
formatter?:
|
24
|
+
validator?: FieldRuleValidator;
|
25
|
+
formatter?: FiledRuleFormatter;
|
23
26
|
};
|
24
27
|
export declare type FieldFormSharedProps = 'colon' | 'disabled' | 'readonly' | 'labelWidth' | 'labelAlign' | 'inputAlign' | 'errorMessageAlign';
|
25
28
|
export declare type FieldExpose = {
|
@@ -27,9 +30,7 @@ export declare type FieldExpose = {
|
|
27
30
|
focus: () => void | undefined;
|
28
31
|
validate: (rules?: FieldRule[] | undefined) => Promise<void | FieldValidateError>;
|
29
32
|
resetValidation: () => void;
|
30
|
-
/**
|
31
|
-
* @private
|
32
|
-
*/
|
33
|
+
/** @private */
|
33
34
|
formValue: ComputedRef<unknown>;
|
34
35
|
};
|
35
36
|
export declare type FieldInstance = ComponentPublicInstance<FieldProps, FieldExpose>;
|
package/lib/form/Form.js
CHANGED
package/lib/image/Image.js
CHANGED
@@ -46,15 +46,10 @@ var _default = (0, _vue.defineComponent)({
|
|
46
46
|
$Lazyload
|
47
47
|
} = (0, _vue.getCurrentInstance)().proxy;
|
48
48
|
var style = (0, _vue.computed)(() => {
|
49
|
-
var style = {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
if ((0, _utils.isDef)(props.height)) {
|
56
|
-
style.height = (0, _utils.addUnit)(props.height);
|
57
|
-
}
|
49
|
+
var style = {
|
50
|
+
width: (0, _utils.addUnit)(props.width),
|
51
|
+
height: (0, _utils.addUnit)(props.height)
|
52
|
+
};
|
58
53
|
|
59
54
|
if ((0, _utils.isDef)(props.radius)) {
|
60
55
|
style.overflow = 'hidden';
|
@@ -58,7 +58,6 @@ var _default = (0, _vue.defineComponent)({
|
|
58
58
|
slots
|
59
59
|
} = _ref;
|
60
60
|
var swipeRef = (0, _vue.ref)();
|
61
|
-
var windowSize = (0, _use.useWindowSize)();
|
62
61
|
var state = (0, _vue.reactive)({
|
63
62
|
active: 0,
|
64
63
|
rootWidth: 0,
|
@@ -157,7 +156,7 @@ var _default = (0, _vue.defineComponent)({
|
|
157
156
|
swipeTo
|
158
157
|
});
|
159
158
|
(0, _vue.onMounted)(resize);
|
160
|
-
(0, _vue.watch)([
|
159
|
+
(0, _vue.watch)([_utils.windowWidth, _utils.windowHeight], resize);
|
161
160
|
(0, _vue.watch)(() => props.startPosition, value => setActive(+value));
|
162
161
|
(0, _vue.watch)(() => props.show, value => {
|
163
162
|
var {
|