vant 2.12.44 → 2.12.45
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/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/changelog.generated.md +17 -0
- package/es/dialog/Dialog.js +41 -8
- package/es/index.js +1 -1
- package/es/sku/utils/sku-helper.js +2 -2
- package/lib/dialog/Dialog.js +40 -7
- package/lib/index.js +1 -1
- package/lib/sku/utils/sku-helper.js +2 -2
- package/lib/vant.js +43 -10
- package/lib/vant.min.js +1 -1
- package/package.json +1 -1
- package/vetur/attributes.json +304 -304
- package/vetur/tags.json +92 -92
- package/vetur/web-types.json +853 -853
package/README.md
CHANGED
@@ -93,6 +93,7 @@ Vant 3 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3).
|
|
93
93
|
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro |
|
94
94
|
| [vant-theme](https://github.com/Aisen60/vant-theme) | Online theme preview built on Vant UI |
|
95
95
|
| [@antmjs/vantui](https://github.com/antmjs/vantui) | Mobile UI Components based on Vant, supporting Taro and React |
|
96
|
+
| [@formily/vant](https://github.com/formilyjs/vant) | Form solution based on Vant and Formily |
|
96
97
|
|
97
98
|
## Links
|
98
99
|
|
package/README.zh-CN.md
CHANGED
@@ -102,6 +102,7 @@ Vant 3 支持现代浏览器以及 Chrome >= 51、iOS >= 10.0(与 Vue 3 一致
|
|
102
102
|
| [taroify](https://gitee.com/mallfoundry/taroify) | Vant Taro 版 |
|
103
103
|
| [vant-theme](https://github.com/Aisen60/vant-theme) | Vant 在线主题预览工具 |
|
104
104
|
| [@antmjs/vantui](https://github.com/antmjs/vantui) | 基于 Vant Weapp 开发的多端组件库,同时支持 Taro 和 React |
|
105
|
+
| [@formily/vant](https://github.com/formilyjs/vant) | 基于 Vant 和 Formily 开发的表单解决方案 |
|
105
106
|
|
106
107
|
## 链接
|
107
108
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
### [v2.12.45](https://github.com/youzan/vant/compare/v2.12.44...v2.12.45)
|
2
|
+
|
3
|
+
`2022-03-18`
|
4
|
+
|
5
|
+
**Bug Fixes**
|
6
|
+
|
7
|
+
- Sku: 修复特殊情况下 skuTree 为空数组时导致的语法报错问题 [#10390](https://github.com/youzan/vant/issues/10390)
|
8
|
+
|
9
|
+
**Document**
|
10
|
+
|
11
|
+
- add @formily/vant to README.md and home.md [#10323](https://github.com/youzan/vant/issues/10323)
|
12
|
+
- fix [167e99](https://github.com/youzan/vant/commit/167e99cef84b25fdd46929e4fc0324c37c6a135c)
|
13
|
+
- changelog: 2.12.44 [b9035d](https://github.com/youzan/vant/commit/b9035d69f0d72aace66e5fb6890a9d0097552de9)
|
14
|
+
|
15
|
+
**Feature**
|
16
|
+
|
17
|
+
- Dialog: support keyboard events [#10359](https://github.com/youzan/vant/issues/10359)
|
package/es/dialog/Dialog.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
2
|
-
import { createNamespace, addUnit } from '../utils';
|
2
|
+
import { createNamespace, addUnit, noop } from '../utils';
|
3
3
|
import { BORDER_TOP, BORDER_LEFT } from '../utils/constant';
|
4
4
|
import { PopupMixin } from '../mixins/popup';
|
5
5
|
import Button from '../button';
|
@@ -95,13 +95,41 @@ export default createComponent({
|
|
95
95
|
}
|
96
96
|
},
|
97
97
|
onOpened: function onOpened() {
|
98
|
+
var _this2 = this;
|
99
|
+
|
98
100
|
this.$emit('opened');
|
101
|
+
this.$nextTick(function () {
|
102
|
+
var _this2$$refs$dialog;
|
103
|
+
|
104
|
+
(_this2$$refs$dialog = _this2.$refs.dialog) == null ? void 0 : _this2$$refs$dialog.focus();
|
105
|
+
});
|
99
106
|
},
|
100
107
|
onClosed: function onClosed() {
|
101
108
|
this.$emit('closed');
|
102
109
|
},
|
110
|
+
onKeydown: function onKeydown(event) {
|
111
|
+
var _this3 = this;
|
112
|
+
|
113
|
+
if (event.key === 'Escape' || event.key === 'Enter') {
|
114
|
+
// skip keyboard events of child elements
|
115
|
+
if (event.target !== this.$refs.dialog) {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
|
119
|
+
var onEventType = {
|
120
|
+
Enter: this.showConfirmButton ? function () {
|
121
|
+
return _this3.handleAction('confirm');
|
122
|
+
} : noop,
|
123
|
+
Escape: this.showCancelButton ? function () {
|
124
|
+
return _this3.handleAction('cancel');
|
125
|
+
} : noop
|
126
|
+
};
|
127
|
+
onEventType[event.key]();
|
128
|
+
this.$emit('keydown', event);
|
129
|
+
}
|
130
|
+
},
|
103
131
|
genRoundButtons: function genRoundButtons() {
|
104
|
-
var
|
132
|
+
var _this4 = this;
|
105
133
|
|
106
134
|
var h = this.$createElement;
|
107
135
|
return h(GoodsAction, {
|
@@ -117,7 +145,7 @@ export default createComponent({
|
|
117
145
|
"class": bem('cancel'),
|
118
146
|
"on": {
|
119
147
|
"click": function click() {
|
120
|
-
|
148
|
+
_this4.handleAction('cancel');
|
121
149
|
}
|
122
150
|
}
|
123
151
|
}), this.showConfirmButton && h(GoodsActionButton, {
|
@@ -131,13 +159,13 @@ export default createComponent({
|
|
131
159
|
"class": bem('confirm'),
|
132
160
|
"on": {
|
133
161
|
"click": function click() {
|
134
|
-
|
162
|
+
_this4.handleAction('confirm');
|
135
163
|
}
|
136
164
|
}
|
137
165
|
})]);
|
138
166
|
},
|
139
167
|
genButtons: function genButtons() {
|
140
|
-
var
|
168
|
+
var _this5 = this,
|
141
169
|
_ref;
|
142
170
|
|
143
171
|
var h = this.$createElement;
|
@@ -156,7 +184,7 @@ export default createComponent({
|
|
156
184
|
},
|
157
185
|
"on": {
|
158
186
|
"click": function click() {
|
159
|
-
|
187
|
+
_this5.handleAction('cancel');
|
160
188
|
}
|
161
189
|
}
|
162
190
|
}), this.showConfirmButton && h(Button, {
|
@@ -171,7 +199,7 @@ export default createComponent({
|
|
171
199
|
},
|
172
200
|
"on": {
|
173
201
|
"click": function click() {
|
174
|
-
|
202
|
+
_this5.handleAction('confirm');
|
175
203
|
}
|
176
204
|
}
|
177
205
|
})]);
|
@@ -235,11 +263,16 @@ export default createComponent({
|
|
235
263
|
}],
|
236
264
|
"attrs": {
|
237
265
|
"role": "dialog",
|
238
|
-
"aria-labelledby": this.title || message
|
266
|
+
"aria-labelledby": this.title || message,
|
267
|
+
"tabIndex": 0
|
239
268
|
},
|
240
269
|
"class": [bem([this.theme]), this.className],
|
241
270
|
"style": {
|
242
271
|
width: addUnit(this.width)
|
272
|
+
},
|
273
|
+
"ref": "dialog",
|
274
|
+
"on": {
|
275
|
+
"keydown": this.onKeydown
|
243
276
|
}
|
244
277
|
}, [Title, this.genContent(title, messageSlot), this.theme === 'round-button' ? this.genRoundButtons() : this.genButtons()])]);
|
245
278
|
}
|
package/es/index.js
CHANGED
@@ -87,7 +87,7 @@ import Tag from './tag';
|
|
87
87
|
import Toast from './toast';
|
88
88
|
import TreeSelect from './tree-select';
|
89
89
|
import Uploader from './uploader';
|
90
|
-
var version = '2.12.
|
90
|
+
var version = '2.12.45';
|
91
91
|
|
92
92
|
function install(Vue) {
|
93
93
|
var components = [ActionSheet, AddressEdit, AddressList, Area, Badge, Button, Calendar, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, ContactCard, ContactEdit, ContactList, CountDown, Coupon, CouponCell, CouponList, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, GoodsAction, GoodsActionButton, GoodsActionIcon, Grid, GridItem, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, List, Loading, Locale, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Panel, PasswordInput, Picker, Popover, Popup, Progress, PullRefresh, Radio, RadioGroup, Rate, Row, Search, ShareSheet, Sidebar, SidebarItem, Skeleton, Sku, Slider, Step, Stepper, Steps, Sticky, SubmitBar, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, TreeSelect, Uploader];
|
@@ -74,10 +74,10 @@ export var getSkuComb = function getSkuComb(skuList, selectedSku) {
|
|
74
74
|
export var getSelectedSkuValues = function getSelectedSkuValues(skuTree, selectedSku) {
|
75
75
|
var normalizedTree = normalizeSkuTree(skuTree);
|
76
76
|
return Object.keys(selectedSku).reduce(function (selectedValues, skuKeyStr) {
|
77
|
-
var skuValues = normalizedTree[skuKeyStr];
|
77
|
+
var skuValues = normalizedTree[skuKeyStr] || [];
|
78
78
|
var skuValueId = selectedSku[skuKeyStr];
|
79
79
|
|
80
|
-
if (skuValueId !== UNSELECTED_SKU_VALUE_ID) {
|
80
|
+
if (skuValueId !== UNSELECTED_SKU_VALUE_ID && skuValues.length > 0) {
|
81
81
|
var skuValue = skuValues.filter(function (value) {
|
82
82
|
return value.id === skuValueId;
|
83
83
|
})[0];
|
package/lib/dialog/Dialog.js
CHANGED
@@ -108,13 +108,41 @@ var _default = createComponent({
|
|
108
108
|
}
|
109
109
|
},
|
110
110
|
onOpened: function onOpened() {
|
111
|
+
var _this2 = this;
|
112
|
+
|
111
113
|
this.$emit('opened');
|
114
|
+
this.$nextTick(function () {
|
115
|
+
var _this2$$refs$dialog;
|
116
|
+
|
117
|
+
(_this2$$refs$dialog = _this2.$refs.dialog) == null ? void 0 : _this2$$refs$dialog.focus();
|
118
|
+
});
|
112
119
|
},
|
113
120
|
onClosed: function onClosed() {
|
114
121
|
this.$emit('closed');
|
115
122
|
},
|
123
|
+
onKeydown: function onKeydown(event) {
|
124
|
+
var _this3 = this;
|
125
|
+
|
126
|
+
if (event.key === 'Escape' || event.key === 'Enter') {
|
127
|
+
// skip keyboard events of child elements
|
128
|
+
if (event.target !== this.$refs.dialog) {
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
|
132
|
+
var onEventType = {
|
133
|
+
Enter: this.showConfirmButton ? function () {
|
134
|
+
return _this3.handleAction('confirm');
|
135
|
+
} : _utils.noop,
|
136
|
+
Escape: this.showCancelButton ? function () {
|
137
|
+
return _this3.handleAction('cancel');
|
138
|
+
} : _utils.noop
|
139
|
+
};
|
140
|
+
onEventType[event.key]();
|
141
|
+
this.$emit('keydown', event);
|
142
|
+
}
|
143
|
+
},
|
116
144
|
genRoundButtons: function genRoundButtons() {
|
117
|
-
var
|
145
|
+
var _this4 = this;
|
118
146
|
|
119
147
|
var h = this.$createElement;
|
120
148
|
return h(_goodsAction.default, {
|
@@ -130,7 +158,7 @@ var _default = createComponent({
|
|
130
158
|
"class": bem('cancel'),
|
131
159
|
"on": {
|
132
160
|
"click": function click() {
|
133
|
-
|
161
|
+
_this4.handleAction('cancel');
|
134
162
|
}
|
135
163
|
}
|
136
164
|
}), this.showConfirmButton && h(_goodsActionButton.default, {
|
@@ -144,13 +172,13 @@ var _default = createComponent({
|
|
144
172
|
"class": bem('confirm'),
|
145
173
|
"on": {
|
146
174
|
"click": function click() {
|
147
|
-
|
175
|
+
_this4.handleAction('confirm');
|
148
176
|
}
|
149
177
|
}
|
150
178
|
})]);
|
151
179
|
},
|
152
180
|
genButtons: function genButtons() {
|
153
|
-
var
|
181
|
+
var _this5 = this,
|
154
182
|
_ref;
|
155
183
|
|
156
184
|
var h = this.$createElement;
|
@@ -169,7 +197,7 @@ var _default = createComponent({
|
|
169
197
|
},
|
170
198
|
"on": {
|
171
199
|
"click": function click() {
|
172
|
-
|
200
|
+
_this5.handleAction('cancel');
|
173
201
|
}
|
174
202
|
}
|
175
203
|
}), this.showConfirmButton && h(_button.default, {
|
@@ -184,7 +212,7 @@ var _default = createComponent({
|
|
184
212
|
},
|
185
213
|
"on": {
|
186
214
|
"click": function click() {
|
187
|
-
|
215
|
+
_this5.handleAction('confirm');
|
188
216
|
}
|
189
217
|
}
|
190
218
|
})]);
|
@@ -248,11 +276,16 @@ var _default = createComponent({
|
|
248
276
|
}],
|
249
277
|
"attrs": {
|
250
278
|
"role": "dialog",
|
251
|
-
"aria-labelledby": this.title || message
|
279
|
+
"aria-labelledby": this.title || message,
|
280
|
+
"tabIndex": 0
|
252
281
|
},
|
253
282
|
"class": [bem([this.theme]), this.className],
|
254
283
|
"style": {
|
255
284
|
width: (0, _utils.addUnit)(this.width)
|
285
|
+
},
|
286
|
+
"ref": "dialog",
|
287
|
+
"on": {
|
288
|
+
"keydown": this.onKeydown
|
256
289
|
}
|
257
290
|
}, [Title, this.genContent(title, messageSlot), this.theme === 'round-button' ? this.genRoundButtons() : this.genButtons()])]);
|
258
291
|
}
|
package/lib/index.js
CHANGED
@@ -361,7 +361,7 @@ exports.TreeSelect = _treeSelect.default;
|
|
361
361
|
var _uploader = _interopRequireDefault(require("./uploader"));
|
362
362
|
|
363
363
|
exports.Uploader = _uploader.default;
|
364
|
-
var version = '2.12.
|
364
|
+
var version = '2.12.45';
|
365
365
|
exports.version = version;
|
366
366
|
|
367
367
|
function install(Vue) {
|
@@ -94,10 +94,10 @@ exports.getSkuComb = getSkuComb;
|
|
94
94
|
var getSelectedSkuValues = function getSelectedSkuValues(skuTree, selectedSku) {
|
95
95
|
var normalizedTree = normalizeSkuTree(skuTree);
|
96
96
|
return Object.keys(selectedSku).reduce(function (selectedValues, skuKeyStr) {
|
97
|
-
var skuValues = normalizedTree[skuKeyStr];
|
97
|
+
var skuValues = normalizedTree[skuKeyStr] || [];
|
98
98
|
var skuValueId = selectedSku[skuKeyStr];
|
99
99
|
|
100
|
-
if (skuValueId !== _constants.UNSELECTED_SKU_VALUE_ID) {
|
100
|
+
if (skuValueId !== _constants.UNSELECTED_SKU_VALUE_ID && skuValues.length > 0) {
|
101
101
|
var skuValue = skuValues.filter(function (value) {
|
102
102
|
return value.id === skuValueId;
|
103
103
|
})[0];
|
package/lib/vant.js
CHANGED
@@ -4936,13 +4936,41 @@ var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog')
|
|
4936
4936
|
}
|
4937
4937
|
},
|
4938
4938
|
onOpened: function onOpened() {
|
4939
|
+
var _this2 = this;
|
4940
|
+
|
4939
4941
|
this.$emit('opened');
|
4942
|
+
this.$nextTick(function () {
|
4943
|
+
var _this2$$refs$dialog;
|
4944
|
+
|
4945
|
+
(_this2$$refs$dialog = _this2.$refs.dialog) == null ? void 0 : _this2$$refs$dialog.focus();
|
4946
|
+
});
|
4940
4947
|
},
|
4941
4948
|
onClosed: function onClosed() {
|
4942
4949
|
this.$emit('closed');
|
4943
4950
|
},
|
4951
|
+
onKeydown: function onKeydown(event) {
|
4952
|
+
var _this3 = this;
|
4953
|
+
|
4954
|
+
if (event.key === 'Escape' || event.key === 'Enter') {
|
4955
|
+
// skip keyboard events of child elements
|
4956
|
+
if (event.target !== this.$refs.dialog) {
|
4957
|
+
return;
|
4958
|
+
}
|
4959
|
+
|
4960
|
+
var onEventType = {
|
4961
|
+
Enter: this.showConfirmButton ? function () {
|
4962
|
+
return _this3.handleAction('confirm');
|
4963
|
+
} : utils["i" /* noop */],
|
4964
|
+
Escape: this.showCancelButton ? function () {
|
4965
|
+
return _this3.handleAction('cancel');
|
4966
|
+
} : utils["i" /* noop */]
|
4967
|
+
};
|
4968
|
+
onEventType[event.key]();
|
4969
|
+
this.$emit('keydown', event);
|
4970
|
+
}
|
4971
|
+
},
|
4944
4972
|
genRoundButtons: function genRoundButtons() {
|
4945
|
-
var
|
4973
|
+
var _this4 = this;
|
4946
4974
|
|
4947
4975
|
var h = this.$createElement;
|
4948
4976
|
return h(goods_action, {
|
@@ -4958,7 +4986,7 @@ var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog')
|
|
4958
4986
|
"class": Dialog_bem('cancel'),
|
4959
4987
|
"on": {
|
4960
4988
|
"click": function click() {
|
4961
|
-
|
4989
|
+
_this4.handleAction('cancel');
|
4962
4990
|
}
|
4963
4991
|
}
|
4964
4992
|
}), this.showConfirmButton && h(goods_action_button, {
|
@@ -4972,13 +5000,13 @@ var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog')
|
|
4972
5000
|
"class": Dialog_bem('confirm'),
|
4973
5001
|
"on": {
|
4974
5002
|
"click": function click() {
|
4975
|
-
|
5003
|
+
_this4.handleAction('confirm');
|
4976
5004
|
}
|
4977
5005
|
}
|
4978
5006
|
})]);
|
4979
5007
|
},
|
4980
5008
|
genButtons: function genButtons() {
|
4981
|
-
var
|
5009
|
+
var _this5 = this,
|
4982
5010
|
_ref;
|
4983
5011
|
|
4984
5012
|
var h = this.$createElement;
|
@@ -4997,7 +5025,7 @@ var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog')
|
|
4997
5025
|
},
|
4998
5026
|
"on": {
|
4999
5027
|
"click": function click() {
|
5000
|
-
|
5028
|
+
_this5.handleAction('cancel');
|
5001
5029
|
}
|
5002
5030
|
}
|
5003
5031
|
}), this.showConfirmButton && h(es_button, {
|
@@ -5012,7 +5040,7 @@ var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog')
|
|
5012
5040
|
},
|
5013
5041
|
"on": {
|
5014
5042
|
"click": function click() {
|
5015
|
-
|
5043
|
+
_this5.handleAction('confirm');
|
5016
5044
|
}
|
5017
5045
|
}
|
5018
5046
|
})]);
|
@@ -5076,11 +5104,16 @@ var Dialog_createNamespace = Object(create["a" /* createNamespace */])('dialog')
|
|
5076
5104
|
}],
|
5077
5105
|
"attrs": {
|
5078
5106
|
"role": "dialog",
|
5079
|
-
"aria-labelledby": this.title || message
|
5107
|
+
"aria-labelledby": this.title || message,
|
5108
|
+
"tabIndex": 0
|
5080
5109
|
},
|
5081
5110
|
"class": [Dialog_bem([this.theme]), this.className],
|
5082
5111
|
"style": {
|
5083
5112
|
width: Object(unit["a" /* addUnit */])(this.width)
|
5113
|
+
},
|
5114
|
+
"ref": "dialog",
|
5115
|
+
"on": {
|
5116
|
+
"keydown": this.onKeydown
|
5084
5117
|
}
|
5085
5118
|
}, [Title, this.genContent(title, messageSlot), this.theme === 'round-button' ? this.genRoundButtons() : this.genButtons()])]);
|
5086
5119
|
}
|
@@ -18064,10 +18097,10 @@ var getSkuComb = function getSkuComb(skuList, selectedSku) {
|
|
18064
18097
|
var sku_helper_getSelectedSkuValues = function getSelectedSkuValues(skuTree, selectedSku) {
|
18065
18098
|
var normalizedTree = normalizeSkuTree(skuTree);
|
18066
18099
|
return Object.keys(selectedSku).reduce(function (selectedValues, skuKeyStr) {
|
18067
|
-
var skuValues = normalizedTree[skuKeyStr];
|
18100
|
+
var skuValues = normalizedTree[skuKeyStr] || [];
|
18068
18101
|
var skuValueId = selectedSku[skuKeyStr];
|
18069
18102
|
|
18070
|
-
if (skuValueId !== UNSELECTED_SKU_VALUE_ID) {
|
18103
|
+
if (skuValueId !== UNSELECTED_SKU_VALUE_ID && skuValues.length > 0) {
|
18071
18104
|
var skuValue = skuValues.filter(function (value) {
|
18072
18105
|
return value.id === skuValueId;
|
18073
18106
|
})[0];
|
@@ -22226,7 +22259,7 @@ TreeSelect.props = {
|
|
22226
22259
|
|
22227
22260
|
|
22228
22261
|
|
22229
|
-
var version = '2.12.
|
22262
|
+
var version = '2.12.45';
|
22230
22263
|
|
22231
22264
|
function install(Vue) {
|
22232
22265
|
var components = [action_sheet, address_edit, address_list, es_area, badge, es_button, calendar, card, cascader, cell, cell_group, es_checkbox, checkbox_group, circle, col, collapse, collapse_item, contact_card, contact_edit, contact_list, count_down, es_coupon, coupon_cell, coupon_list, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, es_form, goods_action, goods_action_button, goods_action_icon, grid, grid_item, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, es_list, es_loading, locale["a" /* default */], nav_bar, notice_bar, notify, number_keyboard, es_overlay, pagination, panel, password_input, es_picker, popover, popup, es_progress, pull_refresh, es_radio, radio_group, es_rate, row, search, share_sheet, sidebar, sidebar_item, skeleton, es_sku, slider, es_step, stepper, steps, es_sticky, submit_bar, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, tabs, es_tag, es_toast, tree_select, uploader];
|