vant 3.2.8 → 3.3.3-beta.nuxt3

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 (189) hide show
  1. package/es/address-edit/AddressEdit.js +154 -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/Calendar.js +8 -14
  6. package/es/calendar/CalendarHeader.js +1 -3
  7. package/es/calendar/CalendarMonth.js +11 -10
  8. package/es/calendar/types.d.ts +1 -1
  9. package/es/cascader/Cascader.js +10 -2
  10. package/es/checkbox/Checker.js +1 -1
  11. package/es/checkbox/types.d.ts +2 -6
  12. package/es/composables/use-id.d.ts +1 -0
  13. package/es/composables/use-id.js +14 -0
  14. package/es/composables/use-route.d.ts +1 -1
  15. package/es/composables/use-route.js +4 -4
  16. package/es/count-down/CountDown.js +1 -0
  17. package/es/coupon-list/CouponList.js +40 -24
  18. package/es/coupon-list/index.css +1 -1
  19. package/es/coupon-list/index.less +0 -5
  20. package/es/dropdown-item/DropdownItem.js +7 -2
  21. package/es/dropdown-item/types.d.ts +2 -6
  22. package/es/dropdown-menu/DropdownMenu.js +7 -3
  23. package/es/dropdown-menu/types.d.ts +1 -0
  24. package/es/empty/Network.js +22 -34
  25. package/es/field/Field.d.ts +1 -1
  26. package/es/field/Field.js +13 -5
  27. package/es/field/index.d.ts +2 -2
  28. package/es/field/types.d.ts +7 -6
  29. package/es/form/Form.js +2 -2
  30. package/es/image/Image.js +4 -9
  31. package/es/image-preview/ImagePreview.js +3 -4
  32. package/es/index.d.ts +1 -1
  33. package/es/index.js +1 -1
  34. package/es/lazyload/index.d.ts +1 -1
  35. package/es/lazyload/index.js +1 -1
  36. package/es/lazyload/vue-lazyload/index.d.ts +55 -0
  37. package/es/lazyload/vue-lazyload/index.js +46 -0
  38. package/es/lazyload/vue-lazyload/lazy-component.js +53 -0
  39. package/es/lazyload/vue-lazyload/lazy-container.js +98 -0
  40. package/es/lazyload/vue-lazyload/lazy-image.js +115 -0
  41. package/es/lazyload/vue-lazyload/lazy.js +507 -0
  42. package/es/lazyload/vue-lazyload/listener.js +241 -0
  43. package/es/lazyload/vue-lazyload/util.js +183 -0
  44. package/es/list/List.js +3 -1
  45. package/es/locale/lang/pt-BR.d.ts +73 -0
  46. package/es/locale/lang/pt-BR.js +72 -0
  47. package/es/number-keyboard/NumberKeyboardKey.js +4 -4
  48. package/es/pagination/Pagination.js +67 -49
  49. package/es/pagination/index.css +1 -1
  50. package/es/pagination/index.less +32 -31
  51. package/es/password-input/PasswordInput.d.ts +1 -1
  52. package/es/password-input/index.d.ts +1 -1
  53. package/es/popover/Popover.js +2 -0
  54. package/es/popup/Popup.d.ts +1 -2
  55. package/es/popup/Popup.js +2 -5
  56. package/es/popup/index.d.ts +1 -2
  57. package/es/rate/Rate.js +5 -3
  58. package/es/search/Search.js +8 -2
  59. package/es/sidebar/Sidebar.js +1 -0
  60. package/es/sidebar-item/SidebarItem.js +4 -1
  61. package/es/slider/Slider.js +5 -3
  62. package/es/stepper/Stepper.js +11 -8
  63. package/es/swipe/Swipe.js +11 -6
  64. package/es/swipe/index.css +1 -1
  65. package/es/swipe/index.less +2 -0
  66. package/es/swipe/types.d.ts +1 -3
  67. package/es/switch/Switch.js +1 -0
  68. package/es/switch/index.css +1 -1
  69. package/es/switch/index.less +2 -0
  70. package/es/tab/Tab.js +18 -5
  71. package/es/tab/index.css +1 -1
  72. package/es/tab/index.less +1 -1
  73. package/es/tabbar/Tabbar.d.ts +1 -1
  74. package/es/tabbar/Tabbar.js +10 -10
  75. package/es/tabbar-item/TabbarItem.js +16 -7
  76. package/es/tabs/Tabs.js +10 -5
  77. package/es/tabs/TabsTitle.d.ts +6 -0
  78. package/es/tabs/TabsTitle.js +7 -1
  79. package/es/tabs/types.d.ts +1 -0
  80. package/es/uploader/UploaderPreviewItem.js +4 -1
  81. package/es/uploader/utils.d.ts +2 -2
  82. package/es/uploader/utils.js +2 -2
  83. package/es/utils/dom.d.ts +1 -0
  84. package/es/utils/dom.js +6 -2
  85. package/es/utils/format.js +6 -5
  86. package/es/vue-tsx-shim.d.ts +1 -0
  87. package/lib/address-edit/AddressEdit.js +155 -180
  88. package/lib/address-edit/AddressEditDetail.d.ts +10 -9
  89. package/lib/address-edit/AddressEditDetail.js +6 -6
  90. package/lib/button/Button.js +1 -1
  91. package/lib/calendar/Calendar.js +8 -14
  92. package/lib/calendar/CalendarHeader.js +1 -3
  93. package/lib/calendar/CalendarMonth.js +11 -10
  94. package/lib/calendar/types.d.ts +1 -1
  95. package/lib/cascader/Cascader.js +10 -2
  96. package/lib/checkbox/Checker.js +1 -1
  97. package/lib/checkbox/types.d.ts +2 -6
  98. package/lib/composables/use-id.d.ts +1 -0
  99. package/lib/composables/use-id.js +21 -0
  100. package/lib/composables/use-route.d.ts +1 -1
  101. package/lib/composables/use-route.js +4 -4
  102. package/lib/count-down/CountDown.js +1 -0
  103. package/lib/coupon-list/CouponList.js +39 -22
  104. package/lib/coupon-list/index.css +1 -1
  105. package/lib/coupon-list/index.less +0 -5
  106. package/lib/dropdown-item/DropdownItem.js +7 -2
  107. package/lib/dropdown-item/types.d.ts +2 -6
  108. package/lib/dropdown-menu/DropdownMenu.js +7 -2
  109. package/lib/dropdown-menu/types.d.ts +1 -0
  110. package/lib/empty/Network.js +22 -34
  111. package/lib/field/Field.d.ts +1 -1
  112. package/lib/field/Field.js +14 -5
  113. package/lib/field/index.d.ts +2 -2
  114. package/lib/field/types.d.ts +7 -6
  115. package/lib/form/Form.js +1 -1
  116. package/lib/image/Image.js +4 -9
  117. package/lib/image-preview/ImagePreview.js +1 -2
  118. package/lib/index.css +1 -1
  119. package/lib/index.d.ts +1 -1
  120. package/lib/index.js +1 -1
  121. package/lib/lazyload/index.d.ts +1 -1
  122. package/lib/lazyload/index.js +3 -3
  123. package/lib/lazyload/vue-lazyload/index.d.ts +55 -0
  124. package/lib/lazyload/vue-lazyload/index.js +58 -0
  125. package/lib/lazyload/vue-lazyload/lazy-component.js +62 -0
  126. package/lib/lazyload/vue-lazyload/lazy-container.js +106 -0
  127. package/lib/lazyload/vue-lazyload/lazy-image.js +125 -0
  128. package/lib/lazyload/vue-lazyload/lazy.js +520 -0
  129. package/lib/lazyload/vue-lazyload/listener.js +251 -0
  130. package/lib/lazyload/vue-lazyload/util.js +213 -0
  131. package/lib/list/List.js +3 -1
  132. package/lib/locale/lang/pt-BR.d.ts +73 -0
  133. package/lib/locale/lang/pt-BR.js +77 -0
  134. package/lib/number-keyboard/NumberKeyboardKey.js +3 -3
  135. package/lib/pagination/Pagination.js +65 -47
  136. package/lib/pagination/index.css +1 -1
  137. package/lib/pagination/index.less +32 -31
  138. package/lib/password-input/PasswordInput.d.ts +1 -1
  139. package/lib/password-input/index.d.ts +1 -1
  140. package/lib/popover/Popover.js +2 -0
  141. package/lib/popup/Popup.d.ts +1 -2
  142. package/lib/popup/Popup.js +2 -5
  143. package/lib/popup/index.d.ts +1 -2
  144. package/lib/rate/Rate.js +5 -3
  145. package/lib/search/Search.js +9 -2
  146. package/lib/sidebar/Sidebar.js +1 -0
  147. package/lib/sidebar-item/SidebarItem.js +4 -1
  148. package/lib/slider/Slider.js +5 -3
  149. package/lib/ssr.js +7 -0
  150. package/lib/ssr.mjs +1 -0
  151. package/lib/stepper/Stepper.js +11 -8
  152. package/lib/swipe/Swipe.js +9 -4
  153. package/lib/swipe/index.css +1 -1
  154. package/lib/swipe/index.less +2 -0
  155. package/lib/swipe/types.d.ts +1 -3
  156. package/lib/switch/Switch.js +1 -0
  157. package/lib/switch/index.css +1 -1
  158. package/lib/switch/index.less +2 -0
  159. package/lib/tab/Tab.js +20 -5
  160. package/lib/tab/index.css +1 -1
  161. package/lib/tab/index.less +1 -1
  162. package/lib/tabbar/Tabbar.d.ts +1 -1
  163. package/lib/tabbar/Tabbar.js +10 -10
  164. package/lib/tabbar-item/TabbarItem.js +16 -7
  165. package/lib/tabs/Tabs.js +9 -3
  166. package/lib/tabs/TabsTitle.d.ts +6 -0
  167. package/lib/tabs/TabsTitle.js +7 -1
  168. package/lib/tabs/types.d.ts +1 -0
  169. package/lib/uploader/UploaderPreviewItem.js +3 -0
  170. package/lib/uploader/utils.d.ts +2 -2
  171. package/lib/uploader/utils.js +3 -2
  172. package/lib/utils/dom.d.ts +1 -0
  173. package/lib/utils/dom.js +9 -2
  174. package/lib/utils/format.js +7 -5
  175. package/lib/vant.cjs.js +14407 -0
  176. package/lib/vant.cjs.min.js +1 -0
  177. package/lib/vant.es.js +1125 -2186
  178. package/lib/vant.es.min.js +1125 -2186
  179. package/lib/vant.js +1109 -1089
  180. package/lib/vant.min.js +1 -1
  181. package/lib/vue-tsx-shim.d.ts +1 -0
  182. package/package.json +26 -11
  183. package/vetur/attributes.json +557 -557
  184. package/vetur/tags.json +183 -183
  185. package/vetur/web-types.json +1577 -1577
  186. package/es/composables/use-link-field.d.ts +0 -0
  187. package/es/composables/use-link-field.js +0 -0
  188. package/lib/composables/use-link-field.d.ts +0 -0
  189. 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,114 @@ 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
+ }, null), props.showDelete && (0, _vue.createVNode)(_button.Button, {
334
+ "block": true,
335
+ "round": true,
336
+ "class": bem('button'),
337
+ "loading": props.isDeleting,
338
+ "text": props.deleteButtonText || t('delete'),
339
+ "onClick": onDelete
340
+ }, null)]), [[_vue.vShow, !hideBottomFields.value]]), (0, _vue.createVNode)(_popup.Popup, {
341
+ "show": showAreaPopup.value,
342
+ "onUpdate:show": $event => showAreaPopup.value = $event,
343
+ "round": true,
344
+ "teleport": "body",
345
+ "position": "bottom",
346
+ "lazyRender": false
347
+ }, {
348
+ default: () => [(0, _vue.createVNode)(_area.Area, {
349
+ "ref": areaRef,
350
+ "value": data.areaCode,
351
+ "loading": !areaListLoaded.value,
352
+ "areaList": props.areaList,
353
+ "columnsPlaceholder": props.areaColumnsPlaceholder,
354
+ "onConfirm": onAreaConfirm,
355
+ "onCancel": () => {
356
+ showAreaPopup.value = false;
357
+ }
358
+ }, null)]
359
+ })]
360
+ });
386
361
  };
387
362
  }
388
363
 
@@ -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();
@@ -237,7 +237,7 @@ var _default = (0, _vue.defineComponent)({
237
237
  months.value.some((month, index) => {
238
238
  if ((0, _utils2.compareMonth)(month, targetDate) === 0) {
239
239
  if (bodyRef.value) {
240
- monthRefs.value[index].scrollIntoView(bodyRef.value);
240
+ monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
241
241
  }
242
242
 
243
243
  return true;
@@ -247,10 +247,9 @@ var _default = (0, _vue.defineComponent)({
247
247
  });
248
248
  onScroll();
249
249
  });
250
- }; // scroll to current month
251
-
250
+ };
252
251
 
253
- var scrollIntoView = () => {
252
+ var scrollToCurrentDate = () => {
254
253
  if (props.poppable && !props.show) {
255
254
  return;
256
255
  }
@@ -272,7 +271,7 @@ var _default = (0, _vue.defineComponent)({
272
271
  // add Math.floor to avoid decimal height issues
273
272
  // https://github.com/youzan/vant/issues/5640
274
273
  bodyHeight = Math.floor((0, _use.useRect)(bodyRef).height);
275
- scrollIntoView();
274
+ scrollToCurrentDate();
276
275
  });
277
276
  };
278
277
 
@@ -282,7 +281,7 @@ var _default = (0, _vue.defineComponent)({
282
281
  }
283
282
 
284
283
  currentDate.value = date;
285
- scrollIntoView();
284
+ scrollToCurrentDate();
286
285
  };
287
286
 
288
287
  var checkRange = date => {
@@ -320,13 +319,8 @@ var _default = (0, _vue.defineComponent)({
320
319
  var valid = checkRange(date);
321
320
 
322
321
  if (!valid) {
323
- // auto selected to max range if showConfirm
324
- if (props.showConfirm) {
325
- setCurrentDate([date[0], (0, _utils2.getDayByOffset)(date[0], +props.maxRange - 1)]);
326
- } else {
327
- setCurrentDate(date);
328
- }
329
-
322
+ // auto selected to max range
323
+ setCurrentDate([date[0], (0, _utils2.getDayByOffset)(date[0], +props.maxRange - 1)]);
330
324
  return;
331
325
  }
332
326
  }
@@ -484,7 +478,7 @@ var _default = (0, _vue.defineComponent)({
484
478
  }
485
479
 
486
480
  currentDate.value = value;
487
- scrollIntoView();
481
+ scrollToCurrentDate();
488
482
  });
489
483
  (0, _useExpose.useExpose)({
490
484
  reset,
@@ -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) {
@@ -72,15 +72,6 @@ var _default = (0, _vue.defineComponent)({
72
72
 
73
73
  var getTitle = () => title.value;
74
74
 
75
- var scrollIntoView = body => {
76
- var el = props.showSubtitle ? daysRef.value : monthRef.value;
77
-
78
- if (el) {
79
- var scrollTop = (0, _use.useRect)(el).top - (0, _use.useRect)(body).top + body.scrollTop;
80
- (0, _utils.setScrollTop)(body, scrollTop);
81
- }
82
- };
83
-
84
75
  var getMultipleDayType = day => {
85
76
  var isSelected = date => props.currentDate.some(item => (0, _utils3.compareDay)(item, date) === 0);
86
77
 
@@ -233,6 +224,16 @@ var _default = (0, _vue.defineComponent)({
233
224
  });
234
225
  var disabledDays = (0, _vue.computed)(() => days.value.filter(day => day.type === 'disabled'));
235
226
 
227
+ var scrollToDate = (body, targetDate) => {
228
+ if (daysRef.value) {
229
+ var daysRect = (0, _use.useRect)(daysRef.value);
230
+ var totalRows = placeholders.value.length;
231
+ var currentRow = Math.ceil((targetDate.getDate() + offset.value) / 7);
232
+ var rowOffset = (currentRow - 1) * daysRect.height / totalRows;
233
+ (0, _utils.setScrollTop)(body, daysRect.top + rowOffset + body.scrollTop - (0, _use.useRect)(body).top);
234
+ }
235
+ };
236
+
236
237
  var renderDay = (item, index) => (0, _vue.createVNode)(_CalendarDay.default, {
237
238
  "item": item,
238
239
  "index": index,
@@ -252,7 +253,7 @@ var _default = (0, _vue.defineComponent)({
252
253
  getTitle,
253
254
  getHeight: () => height.value,
254
255
  setVisible,
255
- scrollIntoView,
256
+ scrollToDate,
256
257
  disabledDays
257
258
  });
258
259
  return () => (0, _vue.createVNode)("div", {
@@ -21,6 +21,6 @@ export declare type CalendarMonthInstance = ComponentPublicInstance<CalendarMont
21
21
  getTitle: () => string;
22
22
  getHeight: () => number;
23
23
  setVisible: (value?: boolean | undefined) => void;
24
- scrollIntoView: (body: Element) => void;
24
+ scrollToDate: (body: Element, targetDate: Date) => void;
25
25
  disabledDays: Ref<ComputedRef<CalendarDayItem[]>>;
26
26
  }>;