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.
Files changed (171) hide show
  1. package/es/address-edit/AddressEdit.js +155 -180
  2. package/es/address-edit/AddressEditDetail.d.ts +10 -9
  3. package/es/address-edit/AddressEditDetail.js +6 -6
  4. package/es/button/Button.js +2 -2
  5. package/es/calendar/CalendarHeader.js +1 -3
  6. package/es/cascader/Cascader.js +10 -2
  7. package/es/checkbox/Checker.js +1 -1
  8. package/es/checkbox/types.d.ts +2 -6
  9. package/es/composables/use-id.d.ts +1 -0
  10. package/es/composables/use-id.js +14 -0
  11. package/es/composables/use-route.d.ts +1 -1
  12. package/es/composables/use-route.js +4 -4
  13. package/es/count-down/CountDown.js +1 -0
  14. package/es/coupon-list/CouponList.js +40 -24
  15. package/es/coupon-list/index.css +1 -1
  16. package/es/coupon-list/index.less +0 -5
  17. package/es/dropdown-item/DropdownItem.js +7 -2
  18. package/es/dropdown-item/types.d.ts +2 -6
  19. package/es/dropdown-menu/DropdownMenu.js +7 -3
  20. package/es/dropdown-menu/types.d.ts +1 -0
  21. package/es/empty/Network.js +22 -34
  22. package/es/field/Field.d.ts +1 -1
  23. package/es/field/Field.js +13 -5
  24. package/es/field/index.d.ts +2 -2
  25. package/es/field/types.d.ts +7 -6
  26. package/es/form/Form.js +2 -2
  27. package/es/image/Image.js +4 -9
  28. package/es/image-preview/ImagePreview.js +3 -4
  29. package/es/index.d.ts +1 -1
  30. package/es/index.js +1 -1
  31. package/es/lazyload/index.d.ts +1 -1
  32. package/es/lazyload/index.js +1 -1
  33. package/es/lazyload/vue-lazyload/index.d.ts +55 -0
  34. package/es/lazyload/vue-lazyload/index.js +46 -0
  35. package/es/lazyload/vue-lazyload/lazy-component.js +53 -0
  36. package/es/lazyload/vue-lazyload/lazy-container.js +98 -0
  37. package/es/lazyload/vue-lazyload/lazy-image.js +115 -0
  38. package/es/lazyload/vue-lazyload/lazy.js +507 -0
  39. package/es/lazyload/vue-lazyload/listener.js +241 -0
  40. package/es/lazyload/vue-lazyload/util.js +183 -0
  41. package/es/list/List.js +3 -1
  42. package/es/number-keyboard/NumberKeyboardKey.js +4 -4
  43. package/es/pagination/Pagination.js +67 -49
  44. package/es/pagination/index.css +1 -1
  45. package/es/pagination/index.less +32 -31
  46. package/es/password-input/PasswordInput.d.ts +1 -1
  47. package/es/password-input/index.d.ts +1 -1
  48. package/es/popover/Popover.js +2 -0
  49. package/es/popup/Popup.d.ts +1 -2
  50. package/es/popup/Popup.js +2 -5
  51. package/es/popup/index.d.ts +1 -2
  52. package/es/rate/Rate.js +5 -3
  53. package/es/search/Search.js +8 -2
  54. package/es/sidebar/Sidebar.js +1 -0
  55. package/es/sidebar-item/SidebarItem.js +4 -1
  56. package/es/slider/Slider.js +5 -3
  57. package/es/stepper/Stepper.js +11 -8
  58. package/es/swipe/Swipe.js +3 -4
  59. package/es/swipe/types.d.ts +1 -3
  60. package/es/switch/Switch.js +1 -0
  61. package/es/switch/index.css +1 -1
  62. package/es/switch/index.less +2 -0
  63. package/es/tab/Tab.js +17 -4
  64. package/es/tab/index.css +1 -1
  65. package/es/tab/index.less +1 -1
  66. package/es/tabbar/Tabbar.d.ts +1 -1
  67. package/es/tabbar/Tabbar.js +10 -10
  68. package/es/tabbar-item/TabbarItem.js +11 -4
  69. package/es/tabs/Tabs.js +10 -5
  70. package/es/tabs/TabsTitle.d.ts +6 -0
  71. package/es/tabs/TabsTitle.js +7 -1
  72. package/es/tabs/types.d.ts +1 -0
  73. package/es/uploader/UploaderPreviewItem.js +4 -1
  74. package/es/uploader/utils.d.ts +2 -2
  75. package/es/uploader/utils.js +2 -2
  76. package/es/utils/dom.d.ts +1 -0
  77. package/es/utils/dom.js +6 -2
  78. package/es/utils/format.js +6 -5
  79. package/es/vue-tsx-shim.d.ts +1 -0
  80. package/lib/address-edit/AddressEdit.js +156 -180
  81. package/lib/address-edit/AddressEditDetail.d.ts +10 -9
  82. package/lib/address-edit/AddressEditDetail.js +6 -6
  83. package/lib/button/Button.js +1 -1
  84. package/lib/calendar/CalendarHeader.js +1 -3
  85. package/lib/cascader/Cascader.js +10 -2
  86. package/lib/checkbox/Checker.js +1 -1
  87. package/lib/checkbox/types.d.ts +2 -6
  88. package/lib/composables/use-id.d.ts +1 -0
  89. package/lib/composables/use-id.js +21 -0
  90. package/lib/composables/use-route.d.ts +1 -1
  91. package/lib/composables/use-route.js +4 -4
  92. package/lib/count-down/CountDown.js +1 -0
  93. package/lib/coupon-list/CouponList.js +39 -22
  94. package/lib/coupon-list/index.css +1 -1
  95. package/lib/coupon-list/index.less +0 -5
  96. package/lib/dropdown-item/DropdownItem.js +7 -2
  97. package/lib/dropdown-item/types.d.ts +2 -6
  98. package/lib/dropdown-menu/DropdownMenu.js +7 -2
  99. package/lib/dropdown-menu/types.d.ts +1 -0
  100. package/lib/empty/Network.js +22 -34
  101. package/lib/field/Field.d.ts +1 -1
  102. package/lib/field/Field.js +14 -5
  103. package/lib/field/index.d.ts +2 -2
  104. package/lib/field/types.d.ts +7 -6
  105. package/lib/form/Form.js +1 -1
  106. package/lib/image/Image.js +4 -9
  107. package/lib/image-preview/ImagePreview.js +1 -2
  108. package/lib/index.css +1 -1
  109. package/lib/index.d.ts +1 -1
  110. package/lib/index.js +1 -1
  111. package/lib/lazyload/index.d.ts +1 -1
  112. package/lib/lazyload/index.js +3 -3
  113. package/lib/lazyload/vue-lazyload/index.d.ts +55 -0
  114. package/lib/lazyload/vue-lazyload/index.js +58 -0
  115. package/lib/lazyload/vue-lazyload/lazy-component.js +62 -0
  116. package/lib/lazyload/vue-lazyload/lazy-container.js +106 -0
  117. package/lib/lazyload/vue-lazyload/lazy-image.js +125 -0
  118. package/lib/lazyload/vue-lazyload/lazy.js +520 -0
  119. package/lib/lazyload/vue-lazyload/listener.js +251 -0
  120. package/lib/lazyload/vue-lazyload/util.js +213 -0
  121. package/lib/list/List.js +3 -1
  122. package/lib/number-keyboard/NumberKeyboardKey.js +3 -3
  123. package/lib/pagination/Pagination.js +65 -47
  124. package/lib/pagination/index.css +1 -1
  125. package/lib/pagination/index.less +32 -31
  126. package/lib/password-input/PasswordInput.d.ts +1 -1
  127. package/lib/password-input/index.d.ts +1 -1
  128. package/lib/popover/Popover.js +2 -0
  129. package/lib/popup/Popup.d.ts +1 -2
  130. package/lib/popup/Popup.js +2 -5
  131. package/lib/popup/index.d.ts +1 -2
  132. package/lib/rate/Rate.js +5 -3
  133. package/lib/search/Search.js +9 -2
  134. package/lib/sidebar/Sidebar.js +1 -0
  135. package/lib/sidebar-item/SidebarItem.js +4 -1
  136. package/lib/slider/Slider.js +5 -3
  137. package/lib/stepper/Stepper.js +11 -8
  138. package/lib/swipe/Swipe.js +1 -2
  139. package/lib/swipe/types.d.ts +1 -3
  140. package/lib/switch/Switch.js +1 -0
  141. package/lib/switch/index.css +1 -1
  142. package/lib/switch/index.less +2 -0
  143. package/lib/tab/Tab.js +19 -4
  144. package/lib/tab/index.css +1 -1
  145. package/lib/tab/index.less +1 -1
  146. package/lib/tabbar/Tabbar.d.ts +1 -1
  147. package/lib/tabbar/Tabbar.js +10 -10
  148. package/lib/tabbar-item/TabbarItem.js +11 -4
  149. package/lib/tabs/Tabs.js +9 -3
  150. package/lib/tabs/TabsTitle.d.ts +6 -0
  151. package/lib/tabs/TabsTitle.js +7 -1
  152. package/lib/tabs/types.d.ts +1 -0
  153. package/lib/uploader/UploaderPreviewItem.js +3 -0
  154. package/lib/uploader/utils.d.ts +2 -2
  155. package/lib/uploader/utils.js +3 -2
  156. package/lib/utils/dom.d.ts +1 -0
  157. package/lib/utils/dom.js +9 -2
  158. package/lib/utils/format.js +7 -5
  159. package/lib/vant.es.js +1086 -1068
  160. package/lib/vant.es.min.js +1086 -1068
  161. package/lib/vant.js +1085 -1067
  162. package/lib/vant.min.js +1 -1
  163. package/lib/vue-tsx-shim.d.ts +1 -0
  164. package/package.json +4 -4
  165. package/vetur/attributes.json +340 -340
  166. package/vetur/tags.json +119 -119
  167. package/vetur/web-types.json +1143 -1143
  168. package/es/composables/use-link-field.d.ts +0 -0
  169. package/es/composables/use-link-field.js +0 -0
  170. package/lib/composables/use-link-field.d.ts +0 -0
  171. package/lib/composables/use-link-field.js +0 -1
@@ -13,6 +13,8 @@ var _area = require("../area");
13
13
 
14
14
  var _cell = require("../cell");
15
15
 
16
+ var _form = require("../form");
17
+
16
18
  var _field = require("../field");
17
19
 
18
20
  var _popup = require("../popup");
@@ -91,18 +93,9 @@ var _default = (0, _vue.defineComponent)({
91
93
  slots
92
94
  } = _ref;
93
95
  var areaRef = (0, _vue.ref)();
94
- var state = (0, _vue.reactive)({
95
- data: {},
96
- showAreaPopup: false,
97
- detailFocused: false,
98
- errorInfo: {
99
- tel: '',
100
- name: '',
101
- areaCode: '',
102
- postalCode: '',
103
- addressDetail: ''
104
- }
105
- });
96
+ var data = (0, _vue.reactive)({});
97
+ var showAreaPopup = (0, _vue.ref)(false);
98
+ var detailFocused = (0, _vue.ref)(false);
106
99
  var areaListLoaded = (0, _vue.computed)(() => (0, _utils.isObject)(props.areaList) && Object.keys(props.areaList).length);
107
100
  var areaText = (0, _vue.computed)(() => {
108
101
  var {
@@ -111,7 +104,7 @@ var _default = (0, _vue.defineComponent)({
111
104
  city,
112
105
  county,
113
106
  areaCode
114
- } = state.data;
107
+ } = data;
115
108
 
116
109
  if (areaCode) {
117
110
  var arr = [country, province, city, county];
@@ -129,7 +122,7 @@ var _default = (0, _vue.defineComponent)({
129
122
  var hideBottomFields = (0, _vue.computed)(() => {
130
123
  var _props$searchResult;
131
124
 
132
- return ((_props$searchResult = props.searchResult) == null ? void 0 : _props$searchResult.length) && state.detailFocused;
125
+ return ((_props$searchResult = props.searchResult) == null ? void 0 : _props$searchResult.length) && detailFocused.value;
133
126
  });
134
127
 
135
128
  var assignAreaValues = () => {
@@ -137,77 +130,59 @@ var _default = (0, _vue.defineComponent)({
137
130
  var detail = areaRef.value.getArea();
138
131
  detail.areaCode = detail.code;
139
132
  delete detail.code;
140
- (0, _utils.extend)(state.data, detail);
133
+ (0, _utils.extend)(data, detail);
141
134
  }
142
135
  };
143
136
 
144
137
  var onFocus = key => {
145
- state.errorInfo[key] = '';
146
- state.detailFocused = key === 'addressDetail';
138
+ detailFocused.value = key === 'addressDetail';
147
139
  emit('focus', key);
148
140
  };
149
141
 
150
- var getErrorMessage = key => {
151
- var value = String(state.data[key] || '').trim();
152
-
153
- if (props.validator) {
154
- var message = props.validator(key, value);
155
-
156
- if (message) {
157
- return message;
158
- }
159
- }
160
-
161
- switch (key) {
162
- case 'name':
163
- return value ? '' : t('nameEmpty');
164
-
165
- case 'tel':
166
- return props.telValidator(value) ? '' : t('telInvalid');
167
-
168
- case 'areaCode':
169
- return value ? '' : t('areaEmpty');
170
-
171
- case 'addressDetail':
172
- return value ? '' : t('addressEmpty');
173
-
174
- case 'postalCode':
175
- return value && !props.postalValidator(value) ? t('postalEmpty') : '';
176
- }
177
- };
178
-
179
- var onSave = () => {
180
- var items = ['name', 'tel'];
181
-
182
- if (props.showArea) {
183
- items.push('areaCode');
184
- }
142
+ var rules = (0, _vue.computed)(() => {
143
+ var {
144
+ validator,
145
+ telValidator,
146
+ postalValidator
147
+ } = props;
185
148
 
186
- if (props.showDetail) {
187
- items.push('addressDetail');
188
- }
149
+ var makeRule = (name, emptyMessage) => ({
150
+ validator: value => {
151
+ if (validator) {
152
+ var message = validator(name, value);
189
153
 
190
- if (props.showPostal) {
191
- items.push('postalCode');
192
- }
154
+ if (message) {
155
+ return message;
156
+ }
157
+ }
193
158
 
194
- var isValid = items.every(item => {
195
- var msg = getErrorMessage(item);
159
+ if (!value) {
160
+ return emptyMessage;
161
+ }
196
162
 
197
- if (msg) {
198
- state.errorInfo[item] = msg;
163
+ return true;
199
164
  }
200
-
201
- return !msg;
202
165
  });
203
166
 
204
- if (isValid && !props.isSaving) {
205
- emit('save', state.data);
206
- }
207
- };
167
+ return {
168
+ name: [makeRule('name', t('nameEmpty'))],
169
+ tel: [makeRule('tel', t('telInvalid')), {
170
+ validator: telValidator,
171
+ message: t('telInvalid')
172
+ }],
173
+ areaCode: [makeRule('areaCode', t('areaEmpty'))],
174
+ addressDetail: [makeRule('addressDetail', t('addressEmpty'))],
175
+ postalCode: [makeRule('addressDetail', t('postalEmpty')), {
176
+ validator: postalValidator,
177
+ message: t('postalEmpty')
178
+ }]
179
+ };
180
+ });
181
+
182
+ var onSave = () => emit('save', data);
208
183
 
209
184
  var onChangeDetail = val => {
210
- state.data.addressDetail = val;
185
+ data.addressDetail = val;
211
186
  emit('change-detail', val);
212
187
  };
213
188
 
@@ -216,22 +191,25 @@ var _default = (0, _vue.defineComponent)({
216
191
 
217
192
  if (values.some(value => !value.code)) {
218
193
  (0, _toast.Toast)(t('areaEmpty'));
219
- return;
194
+ } else {
195
+ showAreaPopup.value = false;
196
+ assignAreaValues();
197
+ emit('change-area', values);
220
198
  }
221
-
222
- state.showAreaPopup = false;
223
- assignAreaValues();
224
- emit('change-area', values);
225
199
  };
226
200
 
227
- var onDelete = () => emit('delete', state.data); // get values of area component
201
+ var onDelete = () => emit('delete', data); // get values of area component
202
+
228
203
 
204
+ var getArea = () => {
205
+ var _areaRef$value;
229
206
 
230
- var getArea = () => areaRef.value ? areaRef.value.getValues() : []; // set area code to area component
207
+ return ((_areaRef$value = areaRef.value) == null ? void 0 : _areaRef$value.getValues()) || [];
208
+ }; // set area code to area component
231
209
 
232
210
 
233
211
  var setAreaCode = code => {
234
- state.data.areaCode = code || '';
212
+ data.areaCode = code || '';
235
213
 
236
214
  if (code) {
237
215
  (0, _vue.nextTick)(assignAreaValues);
@@ -241,20 +219,20 @@ var _default = (0, _vue.defineComponent)({
241
219
  var onDetailBlur = () => {
242
220
  // await for click search event
243
221
  setTimeout(() => {
244
- state.detailFocused = false;
222
+ detailFocused.value = false;
245
223
  });
246
224
  };
247
225
 
248
226
  var setAddressDetail = value => {
249
- state.data.addressDetail = value;
227
+ data.addressDetail = value;
250
228
  };
251
229
 
252
230
  var renderSetDefaultCell = () => {
253
231
  if (props.showSetDefault) {
254
232
  var _slots = {
255
233
  'right-icon': () => (0, _vue.createVNode)(_switch.Switch, {
256
- "modelValue": state.data.isDefault,
257
- "onUpdate:modelValue": $event => state.data.isDefault = $event,
234
+ "modelValue": data.isDefault,
235
+ "onUpdate:modelValue": $event => data.isDefault = $event,
258
236
  "size": "24",
259
237
  "onChange": event => emit('change-default', event)
260
238
  }, null)
@@ -265,8 +243,6 @@ var _default = (0, _vue.defineComponent)({
265
243
  "class": bem('default')
266
244
  }, _slots), [[_vue.vShow, !hideBottomFields.value]]);
267
245
  }
268
-
269
- return null;
270
246
  };
271
247
 
272
248
  (0, _useExpose.useExpose)({
@@ -274,115 +250,115 @@ var _default = (0, _vue.defineComponent)({
274
250
  setAreaCode,
275
251
  setAddressDetail
276
252
  });
277
- (0, _vue.watch)(() => props.areaList, () => setAreaCode(state.data.areaCode));
253
+ (0, _vue.watch)(() => props.areaList, () => setAreaCode(data.areaCode));
278
254
  (0, _vue.watch)(() => props.addressInfo, value => {
279
- state.data = (0, _utils.extend)({}, DEFAULT_DATA, value);
255
+ (0, _utils.extend)(data, DEFAULT_DATA, value);
280
256
  setAreaCode(value.areaCode);
281
257
  }, {
282
258
  deep: true,
283
259
  immediate: true
284
260
  });
285
261
  return () => {
286
- var {
287
- data,
288
- errorInfo
289
- } = state;
290
262
  var {
291
263
  disableArea
292
264
  } = props;
293
- return (0, _vue.createVNode)("div", {
294
- "class": bem()
295
- }, [(0, _vue.createVNode)("div", {
296
- "class": bem('fields')
297
- }, [(0, _vue.createVNode)(_field.Field, {
298
- "modelValue": data.name,
299
- "onUpdate:modelValue": $event => data.name = $event,
300
- "clearable": true,
301
- "label": t('name'),
302
- "placeholder": t('name'),
303
- "errorMessage": errorInfo.name,
304
- "onFocus": () => onFocus('name')
305
- }, null), (0, _vue.createVNode)(_field.Field, {
306
- "modelValue": data.tel,
307
- "onUpdate:modelValue": $event => data.tel = $event,
308
- "clearable": true,
309
- "type": "tel",
310
- "label": t('tel'),
311
- "maxlength": props.telMaxlength,
312
- "placeholder": t('tel'),
313
- "errorMessage": errorInfo.tel,
314
- "onFocus": () => onFocus('tel')
315
- }, null), (0, _vue.withDirectives)((0, _vue.createVNode)(_field.Field, {
316
- "readonly": true,
317
- "label": t('area'),
318
- "is-link": !disableArea,
319
- "modelValue": areaText.value,
320
- "placeholder": props.areaPlaceholder || t('area'),
321
- "errorMessage": errorInfo.areaCode,
322
- "onFocus": () => onFocus('areaCode'),
323
- "onClick": () => {
324
- emit('click-area');
325
- state.showAreaPopup = !disableArea;
326
- }
327
- }, null), [[_vue.vShow, props.showArea]]), (0, _vue.createVNode)(_AddressEditDetail.default, {
328
- "show": props.showDetail,
329
- "value": data.addressDetail,
330
- "focused": state.detailFocused,
331
- "detailRows": props.detailRows,
332
- "errorMessage": errorInfo.addressDetail,
333
- "searchResult": props.searchResult,
334
- "detailMaxlength": props.detailMaxlength,
335
- "showSearchResult": props.showSearchResult,
336
- "onBlur": onDetailBlur,
337
- "onFocus": () => onFocus('addressDetail'),
338
- "onInput": onChangeDetail,
339
- "onSelect-search": event => emit('select-search', event)
340
- }, null), props.showPostal && (0, _vue.withDirectives)((0, _vue.createVNode)(_field.Field, {
341
- "modelValue": data.postalCode,
342
- "onUpdate:modelValue": $event => data.postalCode = $event,
343
- "type": "tel",
344
- "label": t('postal'),
345
- "maxlength": "6",
346
- "placeholder": t('postal'),
347
- "errorMessage": errorInfo.postalCode,
348
- "onFocus": () => onFocus('postalCode')
349
- }, null), [[_vue.vShow, !hideBottomFields.value]]), slots.default == null ? void 0 : slots.default()]), renderSetDefaultCell(), (0, _vue.withDirectives)((0, _vue.createVNode)("div", {
350
- "class": bem('buttons')
351
- }, [(0, _vue.createVNode)(_button.Button, {
352
- "block": true,
353
- "round": true,
354
- "type": "danger",
355
- "text": props.saveButtonText || t('save'),
356
- "class": bem('button'),
357
- "loading": props.isSaving,
358
- "onClick": onSave
359
- }, null), props.showDelete && (0, _vue.createVNode)(_button.Button, {
360
- "block": true,
361
- "round": true,
362
- "class": bem('button'),
363
- "loading": props.isDeleting,
364
- "text": props.deleteButtonText || t('delete'),
365
- "onClick": onDelete
366
- }, null)]), [[_vue.vShow, !hideBottomFields.value]]), (0, _vue.createVNode)(_popup.Popup, {
367
- "show": state.showAreaPopup,
368
- "onUpdate:show": $event => state.showAreaPopup = $event,
369
- "round": true,
370
- "teleport": "body",
371
- "position": "bottom",
372
- "lazyRender": false
265
+ return (0, _vue.createVNode)(_form.Form, {
266
+ "class": bem(),
267
+ "onSubmit": onSave
373
268
  }, {
374
- default: () => [(0, _vue.createVNode)(_area.Area, {
375
- "ref": areaRef,
376
- "value": data.areaCode,
377
- "loading": !areaListLoaded.value,
378
- "areaList": props.areaList,
379
- "columnsPlaceholder": props.areaColumnsPlaceholder,
380
- "onConfirm": onAreaConfirm,
381
- "onCancel": () => {
382
- state.showAreaPopup = false;
269
+ default: () => [(0, _vue.createVNode)("div", {
270
+ "class": bem('fields')
271
+ }, [(0, _vue.createVNode)(_field.Field, {
272
+ "modelValue": data.name,
273
+ "onUpdate:modelValue": $event => data.name = $event,
274
+ "clearable": true,
275
+ "label": t('name'),
276
+ "rules": rules.value.name,
277
+ "placeholder": t('name'),
278
+ "onFocus": () => onFocus('name')
279
+ }, null), (0, _vue.createVNode)(_field.Field, {
280
+ "modelValue": data.tel,
281
+ "onUpdate:modelValue": $event => data.tel = $event,
282
+ "clearable": true,
283
+ "type": "tel",
284
+ "label": t('tel'),
285
+ "rules": rules.value.tel,
286
+ "maxlength": props.telMaxlength,
287
+ "placeholder": t('tel'),
288
+ "onFocus": () => onFocus('tel')
289
+ }, null), (0, _vue.withDirectives)((0, _vue.createVNode)(_field.Field, {
290
+ "readonly": true,
291
+ "label": t('area'),
292
+ "is-link": !disableArea,
293
+ "modelValue": areaText.value,
294
+ "rules": rules.value.areaCode,
295
+ "placeholder": props.areaPlaceholder || t('area'),
296
+ "onFocus": () => onFocus('areaCode'),
297
+ "onClick": () => {
298
+ emit('click-area');
299
+ showAreaPopup.value = !disableArea;
383
300
  }
384
- }, null)]
385
- })]);
301
+ }, null), [[_vue.vShow, props.showArea]]), (0, _vue.createVNode)(_AddressEditDetail.default, {
302
+ "show": props.showDetail,
303
+ "rows": props.detailRows,
304
+ "rules": rules.value.addressDetail,
305
+ "value": data.addressDetail,
306
+ "focused": detailFocused.value,
307
+ "maxlength": props.detailMaxlength,
308
+ "searchResult": props.searchResult,
309
+ "showSearchResult": props.showSearchResult,
310
+ "onBlur": onDetailBlur,
311
+ "onFocus": () => onFocus('addressDetail'),
312
+ "onInput": onChangeDetail,
313
+ "onSelect-search": event => emit('select-search', event)
314
+ }, null), props.showPostal && (0, _vue.withDirectives)((0, _vue.createVNode)(_field.Field, {
315
+ "modelValue": data.postalCode,
316
+ "onUpdate:modelValue": $event => data.postalCode = $event,
317
+ "type": "tel",
318
+ "rules": rules.value.postalCode,
319
+ "label": t('postal'),
320
+ "maxlength": "6",
321
+ "placeholder": t('postal'),
322
+ "onFocus": () => onFocus('postalCode')
323
+ }, null), [[_vue.vShow, !hideBottomFields.value]]), slots.default == null ? void 0 : slots.default()]), renderSetDefaultCell(), (0, _vue.withDirectives)((0, _vue.createVNode)("div", {
324
+ "class": bem('buttons')
325
+ }, [(0, _vue.createVNode)(_button.Button, {
326
+ "block": true,
327
+ "round": true,
328
+ "type": "danger",
329
+ "text": props.saveButtonText || t('save'),
330
+ "class": bem('button'),
331
+ "loading": props.isSaving,
332
+ "nativeType": "submit",
333
+ "onClick": onSave
334
+ }, null), props.showDelete && (0, _vue.createVNode)(_button.Button, {
335
+ "block": true,
336
+ "round": true,
337
+ "class": bem('button'),
338
+ "loading": props.isDeleting,
339
+ "text": props.deleteButtonText || t('delete'),
340
+ "onClick": onDelete
341
+ }, null)]), [[_vue.vShow, !hideBottomFields.value]]), (0, _vue.createVNode)(_popup.Popup, {
342
+ "show": showAreaPopup.value,
343
+ "onUpdate:show": $event => showAreaPopup.value = $event,
344
+ "round": true,
345
+ "teleport": "body",
346
+ "position": "bottom",
347
+ "lazyRender": false
348
+ }, {
349
+ default: () => [(0, _vue.createVNode)(_area.Area, {
350
+ "ref": areaRef,
351
+ "value": data.areaCode,
352
+ "loading": !areaListLoaded.value,
353
+ "areaList": props.areaList,
354
+ "columnsPlaceholder": props.areaColumnsPlaceholder,
355
+ "onConfirm": onAreaConfirm,
356
+ "onCancel": () => {
357
+ showAreaPopup.value = false;
358
+ }
359
+ }, null)]
360
+ })]
361
+ });
386
362
  };
387
363
  }
388
364
 
@@ -1,22 +1,23 @@
1
1
  import { PropType } from 'vue';
2
2
  import type { AddressEditSearchItem } from './types';
3
+ import type { FieldRule } from '../field/types';
3
4
  declare const _default: import("vue").DefineComponent<{
4
5
  show: BooleanConstructor;
6
+ rows: (NumberConstructor | StringConstructor)[];
5
7
  value: StringConstructor;
8
+ rules: PropType<FieldRule[]>;
6
9
  focused: BooleanConstructor;
7
- detailRows: (NumberConstructor | StringConstructor)[];
10
+ maxlength: (NumberConstructor | StringConstructor)[];
8
11
  searchResult: PropType<AddressEditSearchItem[]>;
9
- errorMessage: StringConstructor;
10
- detailMaxlength: (NumberConstructor | StringConstructor)[];
11
12
  showSearchResult: BooleanConstructor;
12
13
  }, () => JSX.Element | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("input" | "focus" | "blur" | "select-search")[], "input" | "focus" | "blur" | "select-search", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<{
13
14
  show?: unknown;
15
+ rows?: unknown;
14
16
  value?: unknown;
17
+ rules?: unknown;
15
18
  focused?: unknown;
16
- detailRows?: unknown;
19
+ maxlength?: unknown;
17
20
  searchResult?: unknown;
18
- errorMessage?: unknown;
19
- detailMaxlength?: unknown;
20
21
  showSearchResult?: unknown;
21
22
  } & {
22
23
  focused: boolean;
@@ -24,10 +25,10 @@ declare const _default: import("vue").DefineComponent<{
24
25
  showSearchResult: boolean;
25
26
  } & {
26
27
  value?: string | undefined;
27
- errorMessage?: string | undefined;
28
+ maxlength?: string | number | undefined;
29
+ rows?: string | number | undefined;
30
+ rules?: FieldRule[] | undefined;
28
31
  searchResult?: AddressEditSearchItem[] | undefined;
29
- detailRows?: string | number | undefined;
30
- detailMaxlength?: string | number | undefined;
31
32
  }> & {
32
33
  onFocus?: ((...args: any[]) => any) | undefined;
33
34
  onBlur?: ((...args: any[]) => any) | undefined;
@@ -19,12 +19,12 @@ var _default = (0, _vue.defineComponent)({
19
19
  name,
20
20
  props: {
21
21
  show: Boolean,
22
+ rows: _utils.numericProp,
22
23
  value: String,
24
+ rules: Array,
23
25
  focused: Boolean,
24
- detailRows: _utils.numericProp,
26
+ maxlength: _utils.numericProp,
25
27
  searchResult: Array,
26
- errorMessage: String,
27
- detailMaxlength: _utils.numericProp,
28
28
  showSearchResult: Boolean
29
29
  },
30
30
  emits: ['blur', 'focus', 'input', 'select-search'],
@@ -85,14 +85,14 @@ var _default = (0, _vue.defineComponent)({
85
85
  "clearable": true,
86
86
  "ref": field,
87
87
  "class": bem(),
88
- "rows": props.detailRows,
88
+ "rows": props.rows,
89
89
  "type": "textarea",
90
+ "rules": props.rules,
90
91
  "label": t('label'),
91
92
  "border": !showSearchResult(),
92
- "maxlength": props.detailMaxlength,
93
+ "maxlength": props.maxlength,
93
94
  "modelValue": props.value,
94
95
  "placeholder": t('placeholder'),
95
- "errorMessage": props.errorMessage,
96
96
  "onBlur": onBlur,
97
97
  "onFocus": onFocus,
98
98
  "onUpdate:modelValue": onInput
@@ -127,7 +127,7 @@ var _default = (0, _vue.defineComponent)({
127
127
 
128
128
  var onClick = event => {
129
129
  if (props.loading) {
130
- event.preventDefault();
130
+ (0, _utils.preventDefault)(event);
131
131
  } else if (!props.disabled) {
132
132
  emit('click', event);
133
133
  route();
@@ -38,9 +38,7 @@ var _default = (0, _vue.defineComponent)({
38
38
  }
39
39
  };
40
40
 
41
- var onClickSubtitle = event => {
42
- emit('click-subtitle', event);
43
- };
41
+ var onClickSubtitle = event => emit('click-subtitle', event);
44
42
 
45
43
  var renderSubtitle = () => {
46
44
  if (props.showSubtitle) {
@@ -173,20 +173,27 @@ var _default = (0, _vue.defineComponent)({
173
173
  }, null) : null]);
174
174
 
175
175
  var renderOption = (option, selectedOption, tabIndex) => {
176
- var selected = selectedOption && option[valueKey] === selectedOption[valueKey];
176
+ var {
177
+ disabled
178
+ } = option;
179
+ var selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
177
180
  var color = option.color || (selected ? props.activeColor : undefined);
178
181
  var Text = slots.option ? slots.option({
179
182
  option,
180
183
  selected
181
184
  }) : (0, _vue.createVNode)("span", null, [option[textKey]]);
182
185
  return (0, _vue.createVNode)("li", {
186
+ "role": "menuitemradio",
183
187
  "class": [bem('option', {
184
188
  selected,
185
- disabled: option.disabled
189
+ disabled
186
190
  }), option.className],
187
191
  "style": {
188
192
  color
189
193
  },
194
+ "tabindex": disabled ? undefined : selected ? 0 : -1,
195
+ "aria-checked": selected,
196
+ "aria-disabled": disabled || undefined,
190
197
  "onClick": () => onSelect(option, tabIndex)
191
198
  }, [Text, selected ? (0, _vue.createVNode)(_icon.Icon, {
192
199
  "name": "success",
@@ -195,6 +202,7 @@ var _default = (0, _vue.defineComponent)({
195
202
  };
196
203
 
197
204
  var renderOptions = (options, selectedOption, tabIndex) => (0, _vue.createVNode)("ul", {
205
+ "role": "menu",
198
206
  "class": bem('options')
199
207
  }, [options.map(option => renderOption(option, selectedOption, tabIndex))]);
200
208
 
@@ -114,7 +114,7 @@ var _default = (0, _vue.defineComponent)({
114
114
  disabled: disabled.value,
115
115
  'label-disabled': props.labelDisabled
116
116
  }, direction.value]),
117
- "tabindex": disabled.value ? -1 : 0,
117
+ "tabindex": disabled.value ? undefined : 0,
118
118
  "aria-checked": props.checked,
119
119
  "onClick": onClick
120
120
  }, [nodes]);
@@ -5,13 +5,9 @@ export declare type CheckboxShape = CheckerShape;
5
5
  export declare type CheckboxLabelPosition = CheckerLabelPosition;
6
6
  export declare type CheckboxExpose = {
7
7
  toggle: (newValue?: boolean) => void;
8
- /**
9
- * @private
10
- */
8
+ /** @private */
11
9
  props: CheckboxProps;
12
- /**
13
- * @private
14
- */
10
+ /** @private */
15
11
  checked: ComputedRef<boolean>;
16
12
  };
17
13
  export declare type CheckboxInstance = ComponentPublicInstance<CheckboxProps, CheckboxExpose>;
@@ -0,0 +1 @@
1
+ export declare function useId(): string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useId = useId;
5
+
6
+ var _vue = require("vue");
7
+
8
+ var current = 0;
9
+
10
+ function useId() {
11
+ var vm = (0, _vue.getCurrentInstance)();
12
+ var {
13
+ name = 'unknown'
14
+ } = (vm == null ? void 0 : vm.type) || {}; // keep jest snapshot stable
15
+
16
+ if (process.env.NODE_ENV === 'test') {
17
+ return name;
18
+ }
19
+
20
+ return name + "-" + ++current;
21
+ }
@@ -9,5 +9,5 @@ export declare const routeProps: {
9
9
  replace: BooleanConstructor;
10
10
  };
11
11
  export declare type RouteProps = ExtractPropTypes<typeof routeProps>;
12
- export declare function route(vm: ComponentPublicInstance<RouteProps>): void;
12
+ export declare function route({ to, url, replace, $router: router, }: ComponentPublicInstance<RouteProps>): void;
13
13
  export declare function useRoute(): () => void;
@@ -17,13 +17,13 @@ var routeProps = {
17
17
  };
18
18
  exports.routeProps = routeProps;
19
19
 
20
- function route(vm) {
21
- var router = vm.$router;
20
+ function route(_ref) {
22
21
  var {
23
22
  to,
24
23
  url,
25
- replace
26
- } = vm;
24
+ replace,
25
+ $router: router
26
+ } = _ref;
27
27
 
28
28
  if (to && router) {
29
29
  router[replace ? 'replace' : 'push'](to);
@@ -63,6 +63,7 @@ var _default = (0, _vue.defineComponent)({
63
63
  reset: resetTime
64
64
  });
65
65
  return () => (0, _vue.createVNode)("div", {
66
+ "role": "timer",
66
67
  "class": bem()
67
68
  }, [slots.default ? slots.default(current.value) : timeText.value]);
68
69
  }