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.
- package/es/address-edit/AddressEdit.js +154 -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/Calendar.js +8 -14
- package/es/calendar/CalendarHeader.js +1 -3
- package/es/calendar/CalendarMonth.js +11 -10
- package/es/calendar/types.d.ts +1 -1
- 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/locale/lang/pt-BR.d.ts +73 -0
- package/es/locale/lang/pt-BR.js +72 -0
- 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 +11 -6
- package/es/swipe/index.css +1 -1
- package/es/swipe/index.less +2 -0
- 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 +18 -5
- 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 +16 -7
- 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 +155 -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/Calendar.js +8 -14
- package/lib/calendar/CalendarHeader.js +1 -3
- package/lib/calendar/CalendarMonth.js +11 -10
- package/lib/calendar/types.d.ts +1 -1
- 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/locale/lang/pt-BR.d.ts +73 -0
- package/lib/locale/lang/pt-BR.js +77 -0
- 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/ssr.js +7 -0
- package/lib/ssr.mjs +1 -0
- package/lib/stepper/Stepper.js +11 -8
- package/lib/swipe/Swipe.js +9 -4
- package/lib/swipe/index.css +1 -1
- package/lib/swipe/index.less +2 -0
- 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 +20 -5
- 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 +16 -7
- 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.cjs.js +14407 -0
- package/lib/vant.cjs.min.js +1 -0
- package/lib/vant.es.js +1125 -2186
- package/lib/vant.es.min.js +1125 -2186
- package/lib/vant.js +1109 -1089
- package/lib/vant.min.js +1 -1
- package/lib/vue-tsx-shim.d.ts +1 -0
- package/package.json +26 -11
- package/vetur/attributes.json +557 -557
- package/vetur/tags.json +183 -183
- package/vetur/web-types.json +1577 -1577
- 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
@@ -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
|
95
|
-
|
96
|
-
|
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
|
-
} =
|
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) &&
|
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)(
|
133
|
+
(0, _utils.extend)(data, detail);
|
141
134
|
}
|
142
135
|
};
|
143
136
|
|
144
137
|
var onFocus = key => {
|
145
|
-
|
146
|
-
state.detailFocused = key === 'addressDetail';
|
138
|
+
detailFocused.value = key === 'addressDetail';
|
147
139
|
emit('focus', key);
|
148
140
|
};
|
149
141
|
|
150
|
-
var
|
151
|
-
var
|
152
|
-
|
153
|
-
|
154
|
-
|
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
|
-
|
187
|
-
|
188
|
-
|
149
|
+
var makeRule = (name, emptyMessage) => ({
|
150
|
+
validator: value => {
|
151
|
+
if (validator) {
|
152
|
+
var message = validator(name, value);
|
189
153
|
|
190
|
-
|
191
|
-
|
192
|
-
|
154
|
+
if (message) {
|
155
|
+
return message;
|
156
|
+
}
|
157
|
+
}
|
193
158
|
|
194
|
-
|
195
|
-
|
159
|
+
if (!value) {
|
160
|
+
return emptyMessage;
|
161
|
+
}
|
196
162
|
|
197
|
-
|
198
|
-
state.errorInfo[item] = msg;
|
163
|
+
return true;
|
199
164
|
}
|
200
|
-
|
201
|
-
return !msg;
|
202
165
|
});
|
203
166
|
|
204
|
-
|
205
|
-
|
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
|
-
|
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
|
-
|
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',
|
201
|
+
var onDelete = () => emit('delete', data); // get values of area component
|
202
|
+
|
228
203
|
|
204
|
+
var getArea = () => {
|
205
|
+
var _areaRef$value;
|
229
206
|
|
230
|
-
|
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
|
-
|
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
|
-
|
222
|
+
detailFocused.value = false;
|
245
223
|
});
|
246
224
|
};
|
247
225
|
|
248
226
|
var setAddressDetail = value => {
|
249
|
-
|
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":
|
257
|
-
"onUpdate:modelValue": $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(
|
253
|
+
(0, _vue.watch)(() => props.areaList, () => setAreaCode(data.areaCode));
|
278
254
|
(0, _vue.watch)(() => props.addressInfo, value => {
|
279
|
-
|
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)(
|
294
|
-
"class": bem()
|
295
|
-
|
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)(
|
375
|
-
"
|
376
|
-
|
377
|
-
"
|
378
|
-
"
|
379
|
-
"
|
380
|
-
"
|
381
|
-
"
|
382
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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.
|
88
|
+
"rows": props.rows,
|
89
89
|
"type": "textarea",
|
90
|
+
"rules": props.rules,
|
90
91
|
"label": t('label'),
|
91
92
|
"border": !showSearchResult(),
|
92
|
-
"maxlength": props.
|
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
|
package/lib/button/Button.js
CHANGED
package/lib/calendar/Calendar.js
CHANGED
@@ -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].
|
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
|
-
};
|
251
|
-
|
250
|
+
};
|
252
251
|
|
253
|
-
var
|
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
|
-
|
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
|
-
|
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
|
324
|
-
|
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
|
-
|
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
|
-
|
256
|
+
scrollToDate,
|
256
257
|
disabledDays
|
257
258
|
});
|
258
259
|
return () => (0, _vue.createVNode)("div", {
|
package/lib/calendar/types.d.ts
CHANGED
@@ -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
|
-
|
24
|
+
scrollToDate: (body: Element, targetDate: Date) => void;
|
25
25
|
disabledDays: Ref<ComputedRef<CalendarDayItem[]>>;
|
26
26
|
}>;
|