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
@@ -7,6 +7,7 @@ import { useExpose } from '../composables/use-expose'; // Components
|
|
7
7
|
|
8
8
|
import { Area } from '../area';
|
9
9
|
import { Cell } from '../cell';
|
10
|
+
import { Form } from '../form';
|
10
11
|
import { Field } from '../field';
|
11
12
|
import { Popup } from '../popup';
|
12
13
|
import { Toast } from '../toast';
|
@@ -74,18 +75,9 @@ export default defineComponent({
|
|
74
75
|
slots
|
75
76
|
} = _ref;
|
76
77
|
var areaRef = ref();
|
77
|
-
var
|
78
|
-
|
79
|
-
|
80
|
-
detailFocused: false,
|
81
|
-
errorInfo: {
|
82
|
-
tel: '',
|
83
|
-
name: '',
|
84
|
-
areaCode: '',
|
85
|
-
postalCode: '',
|
86
|
-
addressDetail: ''
|
87
|
-
}
|
88
|
-
});
|
78
|
+
var data = reactive({});
|
79
|
+
var showAreaPopup = ref(false);
|
80
|
+
var detailFocused = ref(false);
|
89
81
|
var areaListLoaded = computed(() => isObject(props.areaList) && Object.keys(props.areaList).length);
|
90
82
|
var areaText = computed(() => {
|
91
83
|
var {
|
@@ -94,7 +86,7 @@ export default defineComponent({
|
|
94
86
|
city,
|
95
87
|
county,
|
96
88
|
areaCode
|
97
|
-
} =
|
89
|
+
} = data;
|
98
90
|
|
99
91
|
if (areaCode) {
|
100
92
|
var arr = [country, province, city, county];
|
@@ -112,7 +104,7 @@ export default defineComponent({
|
|
112
104
|
var hideBottomFields = computed(() => {
|
113
105
|
var _props$searchResult;
|
114
106
|
|
115
|
-
return ((_props$searchResult = props.searchResult) == null ? void 0 : _props$searchResult.length) &&
|
107
|
+
return ((_props$searchResult = props.searchResult) == null ? void 0 : _props$searchResult.length) && detailFocused.value;
|
116
108
|
});
|
117
109
|
|
118
110
|
var assignAreaValues = () => {
|
@@ -120,77 +112,59 @@ export default defineComponent({
|
|
120
112
|
var detail = areaRef.value.getArea();
|
121
113
|
detail.areaCode = detail.code;
|
122
114
|
delete detail.code;
|
123
|
-
extend(
|
115
|
+
extend(data, detail);
|
124
116
|
}
|
125
117
|
};
|
126
118
|
|
127
119
|
var onFocus = key => {
|
128
|
-
|
129
|
-
state.detailFocused = key === 'addressDetail';
|
120
|
+
detailFocused.value = key === 'addressDetail';
|
130
121
|
emit('focus', key);
|
131
122
|
};
|
132
123
|
|
133
|
-
var
|
134
|
-
var
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
if (message) {
|
140
|
-
return message;
|
141
|
-
}
|
142
|
-
}
|
143
|
-
|
144
|
-
switch (key) {
|
145
|
-
case 'name':
|
146
|
-
return value ? '' : t('nameEmpty');
|
147
|
-
|
148
|
-
case 'tel':
|
149
|
-
return props.telValidator(value) ? '' : t('telInvalid');
|
150
|
-
|
151
|
-
case 'areaCode':
|
152
|
-
return value ? '' : t('areaEmpty');
|
153
|
-
|
154
|
-
case 'addressDetail':
|
155
|
-
return value ? '' : t('addressEmpty');
|
156
|
-
|
157
|
-
case 'postalCode':
|
158
|
-
return value && !props.postalValidator(value) ? t('postalEmpty') : '';
|
159
|
-
}
|
160
|
-
};
|
161
|
-
|
162
|
-
var onSave = () => {
|
163
|
-
var items = ['name', 'tel'];
|
164
|
-
|
165
|
-
if (props.showArea) {
|
166
|
-
items.push('areaCode');
|
167
|
-
}
|
124
|
+
var rules = computed(() => {
|
125
|
+
var {
|
126
|
+
validator,
|
127
|
+
telValidator,
|
128
|
+
postalValidator
|
129
|
+
} = props;
|
168
130
|
|
169
|
-
|
170
|
-
|
171
|
-
|
131
|
+
var makeRule = (name, emptyMessage) => ({
|
132
|
+
validator: value => {
|
133
|
+
if (validator) {
|
134
|
+
var message = validator(name, value);
|
172
135
|
|
173
|
-
|
174
|
-
|
175
|
-
|
136
|
+
if (message) {
|
137
|
+
return message;
|
138
|
+
}
|
139
|
+
}
|
176
140
|
|
177
|
-
|
178
|
-
|
141
|
+
if (!value) {
|
142
|
+
return emptyMessage;
|
143
|
+
}
|
179
144
|
|
180
|
-
|
181
|
-
state.errorInfo[item] = msg;
|
145
|
+
return true;
|
182
146
|
}
|
183
|
-
|
184
|
-
return !msg;
|
185
147
|
});
|
186
148
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
149
|
+
return {
|
150
|
+
name: [makeRule('name', t('nameEmpty'))],
|
151
|
+
tel: [makeRule('tel', t('telInvalid')), {
|
152
|
+
validator: telValidator,
|
153
|
+
message: t('telInvalid')
|
154
|
+
}],
|
155
|
+
areaCode: [makeRule('areaCode', t('areaEmpty'))],
|
156
|
+
addressDetail: [makeRule('addressDetail', t('addressEmpty'))],
|
157
|
+
postalCode: [makeRule('addressDetail', t('postalEmpty')), {
|
158
|
+
validator: postalValidator,
|
159
|
+
message: t('postalEmpty')
|
160
|
+
}]
|
161
|
+
};
|
162
|
+
});
|
163
|
+
|
164
|
+
var onSave = () => emit('save', data);
|
191
165
|
|
192
166
|
var onChangeDetail = val => {
|
193
|
-
|
167
|
+
data.addressDetail = val;
|
194
168
|
emit('change-detail', val);
|
195
169
|
};
|
196
170
|
|
@@ -199,22 +173,25 @@ export default defineComponent({
|
|
199
173
|
|
200
174
|
if (values.some(value => !value.code)) {
|
201
175
|
Toast(t('areaEmpty'));
|
202
|
-
|
176
|
+
} else {
|
177
|
+
showAreaPopup.value = false;
|
178
|
+
assignAreaValues();
|
179
|
+
emit('change-area', values);
|
203
180
|
}
|
204
|
-
|
205
|
-
state.showAreaPopup = false;
|
206
|
-
assignAreaValues();
|
207
|
-
emit('change-area', values);
|
208
181
|
};
|
209
182
|
|
210
|
-
var onDelete = () => emit('delete',
|
183
|
+
var onDelete = () => emit('delete', data); // get values of area component
|
184
|
+
|
211
185
|
|
186
|
+
var getArea = () => {
|
187
|
+
var _areaRef$value;
|
212
188
|
|
213
|
-
|
189
|
+
return ((_areaRef$value = areaRef.value) == null ? void 0 : _areaRef$value.getValues()) || [];
|
190
|
+
}; // set area code to area component
|
214
191
|
|
215
192
|
|
216
193
|
var setAreaCode = code => {
|
217
|
-
|
194
|
+
data.areaCode = code || '';
|
218
195
|
|
219
196
|
if (code) {
|
220
197
|
nextTick(assignAreaValues);
|
@@ -224,20 +201,20 @@ export default defineComponent({
|
|
224
201
|
var onDetailBlur = () => {
|
225
202
|
// await for click search event
|
226
203
|
setTimeout(() => {
|
227
|
-
|
204
|
+
detailFocused.value = false;
|
228
205
|
});
|
229
206
|
};
|
230
207
|
|
231
208
|
var setAddressDetail = value => {
|
232
|
-
|
209
|
+
data.addressDetail = value;
|
233
210
|
};
|
234
211
|
|
235
212
|
var renderSetDefaultCell = () => {
|
236
213
|
if (props.showSetDefault) {
|
237
214
|
var _slots = {
|
238
215
|
'right-icon': () => _createVNode(Switch, {
|
239
|
-
"modelValue":
|
240
|
-
"onUpdate:modelValue": $event =>
|
216
|
+
"modelValue": data.isDefault,
|
217
|
+
"onUpdate:modelValue": $event => data.isDefault = $event,
|
241
218
|
"size": "24",
|
242
219
|
"onChange": event => emit('change-default', event)
|
243
220
|
}, null)
|
@@ -248,8 +225,6 @@ export default defineComponent({
|
|
248
225
|
"class": bem('default')
|
249
226
|
}, _slots), [[_vShow, !hideBottomFields.value]]);
|
250
227
|
}
|
251
|
-
|
252
|
-
return null;
|
253
228
|
};
|
254
229
|
|
255
230
|
useExpose({
|
@@ -257,115 +232,114 @@ export default defineComponent({
|
|
257
232
|
setAreaCode,
|
258
233
|
setAddressDetail
|
259
234
|
});
|
260
|
-
watch(() => props.areaList, () => setAreaCode(
|
235
|
+
watch(() => props.areaList, () => setAreaCode(data.areaCode));
|
261
236
|
watch(() => props.addressInfo, value => {
|
262
|
-
|
237
|
+
extend(data, DEFAULT_DATA, value);
|
263
238
|
setAreaCode(value.areaCode);
|
264
239
|
}, {
|
265
240
|
deep: true,
|
266
241
|
immediate: true
|
267
242
|
});
|
268
243
|
return () => {
|
269
|
-
var {
|
270
|
-
data,
|
271
|
-
errorInfo
|
272
|
-
} = state;
|
273
244
|
var {
|
274
245
|
disableArea
|
275
246
|
} = props;
|
276
|
-
return _createVNode(
|
277
|
-
"class": bem()
|
278
|
-
|
279
|
-
"class": bem('fields')
|
280
|
-
}, [_createVNode(Field, {
|
281
|
-
"modelValue": data.name,
|
282
|
-
"onUpdate:modelValue": $event => data.name = $event,
|
283
|
-
"clearable": true,
|
284
|
-
"label": t('name'),
|
285
|
-
"placeholder": t('name'),
|
286
|
-
"errorMessage": errorInfo.name,
|
287
|
-
"onFocus": () => onFocus('name')
|
288
|
-
}, null), _createVNode(Field, {
|
289
|
-
"modelValue": data.tel,
|
290
|
-
"onUpdate:modelValue": $event => data.tel = $event,
|
291
|
-
"clearable": true,
|
292
|
-
"type": "tel",
|
293
|
-
"label": t('tel'),
|
294
|
-
"maxlength": props.telMaxlength,
|
295
|
-
"placeholder": t('tel'),
|
296
|
-
"errorMessage": errorInfo.tel,
|
297
|
-
"onFocus": () => onFocus('tel')
|
298
|
-
}, null), _withDirectives(_createVNode(Field, {
|
299
|
-
"readonly": true,
|
300
|
-
"label": t('area'),
|
301
|
-
"is-link": !disableArea,
|
302
|
-
"modelValue": areaText.value,
|
303
|
-
"placeholder": props.areaPlaceholder || t('area'),
|
304
|
-
"errorMessage": errorInfo.areaCode,
|
305
|
-
"onFocus": () => onFocus('areaCode'),
|
306
|
-
"onClick": () => {
|
307
|
-
emit('click-area');
|
308
|
-
state.showAreaPopup = !disableArea;
|
309
|
-
}
|
310
|
-
}, null), [[_vShow, props.showArea]]), _createVNode(AddressEditDetail, {
|
311
|
-
"show": props.showDetail,
|
312
|
-
"value": data.addressDetail,
|
313
|
-
"focused": state.detailFocused,
|
314
|
-
"detailRows": props.detailRows,
|
315
|
-
"errorMessage": errorInfo.addressDetail,
|
316
|
-
"searchResult": props.searchResult,
|
317
|
-
"detailMaxlength": props.detailMaxlength,
|
318
|
-
"showSearchResult": props.showSearchResult,
|
319
|
-
"onBlur": onDetailBlur,
|
320
|
-
"onFocus": () => onFocus('addressDetail'),
|
321
|
-
"onInput": onChangeDetail,
|
322
|
-
"onSelect-search": event => emit('select-search', event)
|
323
|
-
}, null), props.showPostal && _withDirectives(_createVNode(Field, {
|
324
|
-
"modelValue": data.postalCode,
|
325
|
-
"onUpdate:modelValue": $event => data.postalCode = $event,
|
326
|
-
"type": "tel",
|
327
|
-
"label": t('postal'),
|
328
|
-
"maxlength": "6",
|
329
|
-
"placeholder": t('postal'),
|
330
|
-
"errorMessage": errorInfo.postalCode,
|
331
|
-
"onFocus": () => onFocus('postalCode')
|
332
|
-
}, null), [[_vShow, !hideBottomFields.value]]), slots.default == null ? void 0 : slots.default()]), renderSetDefaultCell(), _withDirectives(_createVNode("div", {
|
333
|
-
"class": bem('buttons')
|
334
|
-
}, [_createVNode(Button, {
|
335
|
-
"block": true,
|
336
|
-
"round": true,
|
337
|
-
"type": "danger",
|
338
|
-
"text": props.saveButtonText || t('save'),
|
339
|
-
"class": bem('button'),
|
340
|
-
"loading": props.isSaving,
|
341
|
-
"onClick": onSave
|
342
|
-
}, null), props.showDelete && _createVNode(Button, {
|
343
|
-
"block": true,
|
344
|
-
"round": true,
|
345
|
-
"class": bem('button'),
|
346
|
-
"loading": props.isDeleting,
|
347
|
-
"text": props.deleteButtonText || t('delete'),
|
348
|
-
"onClick": onDelete
|
349
|
-
}, null)]), [[_vShow, !hideBottomFields.value]]), _createVNode(Popup, {
|
350
|
-
"show": state.showAreaPopup,
|
351
|
-
"onUpdate:show": $event => state.showAreaPopup = $event,
|
352
|
-
"round": true,
|
353
|
-
"teleport": "body",
|
354
|
-
"position": "bottom",
|
355
|
-
"lazyRender": false
|
247
|
+
return _createVNode(Form, {
|
248
|
+
"class": bem(),
|
249
|
+
"onSubmit": onSave
|
356
250
|
}, {
|
357
|
-
default: () => [_createVNode(
|
358
|
-
"
|
359
|
-
|
360
|
-
"
|
361
|
-
"
|
362
|
-
"
|
363
|
-
"
|
364
|
-
"
|
365
|
-
|
251
|
+
default: () => [_createVNode("div", {
|
252
|
+
"class": bem('fields')
|
253
|
+
}, [_createVNode(Field, {
|
254
|
+
"modelValue": data.name,
|
255
|
+
"onUpdate:modelValue": $event => data.name = $event,
|
256
|
+
"clearable": true,
|
257
|
+
"label": t('name'),
|
258
|
+
"rules": rules.value.name,
|
259
|
+
"placeholder": t('name'),
|
260
|
+
"onFocus": () => onFocus('name')
|
261
|
+
}, null), _createVNode(Field, {
|
262
|
+
"modelValue": data.tel,
|
263
|
+
"onUpdate:modelValue": $event => data.tel = $event,
|
264
|
+
"clearable": true,
|
265
|
+
"type": "tel",
|
266
|
+
"label": t('tel'),
|
267
|
+
"rules": rules.value.tel,
|
268
|
+
"maxlength": props.telMaxlength,
|
269
|
+
"placeholder": t('tel'),
|
270
|
+
"onFocus": () => onFocus('tel')
|
271
|
+
}, null), _withDirectives(_createVNode(Field, {
|
272
|
+
"readonly": true,
|
273
|
+
"label": t('area'),
|
274
|
+
"is-link": !disableArea,
|
275
|
+
"modelValue": areaText.value,
|
276
|
+
"rules": rules.value.areaCode,
|
277
|
+
"placeholder": props.areaPlaceholder || t('area'),
|
278
|
+
"onFocus": () => onFocus('areaCode'),
|
279
|
+
"onClick": () => {
|
280
|
+
emit('click-area');
|
281
|
+
showAreaPopup.value = !disableArea;
|
366
282
|
}
|
367
|
-
}, null)]
|
368
|
-
|
283
|
+
}, null), [[_vShow, props.showArea]]), _createVNode(AddressEditDetail, {
|
284
|
+
"show": props.showDetail,
|
285
|
+
"rows": props.detailRows,
|
286
|
+
"rules": rules.value.addressDetail,
|
287
|
+
"value": data.addressDetail,
|
288
|
+
"focused": detailFocused.value,
|
289
|
+
"maxlength": props.detailMaxlength,
|
290
|
+
"searchResult": props.searchResult,
|
291
|
+
"showSearchResult": props.showSearchResult,
|
292
|
+
"onBlur": onDetailBlur,
|
293
|
+
"onFocus": () => onFocus('addressDetail'),
|
294
|
+
"onInput": onChangeDetail,
|
295
|
+
"onSelect-search": event => emit('select-search', event)
|
296
|
+
}, null), props.showPostal && _withDirectives(_createVNode(Field, {
|
297
|
+
"modelValue": data.postalCode,
|
298
|
+
"onUpdate:modelValue": $event => data.postalCode = $event,
|
299
|
+
"type": "tel",
|
300
|
+
"rules": rules.value.postalCode,
|
301
|
+
"label": t('postal'),
|
302
|
+
"maxlength": "6",
|
303
|
+
"placeholder": t('postal'),
|
304
|
+
"onFocus": () => onFocus('postalCode')
|
305
|
+
}, null), [[_vShow, !hideBottomFields.value]]), slots.default == null ? void 0 : slots.default()]), renderSetDefaultCell(), _withDirectives(_createVNode("div", {
|
306
|
+
"class": bem('buttons')
|
307
|
+
}, [_createVNode(Button, {
|
308
|
+
"block": true,
|
309
|
+
"round": true,
|
310
|
+
"type": "danger",
|
311
|
+
"text": props.saveButtonText || t('save'),
|
312
|
+
"class": bem('button'),
|
313
|
+
"loading": props.isSaving,
|
314
|
+
"nativeType": "submit"
|
315
|
+
}, null), props.showDelete && _createVNode(Button, {
|
316
|
+
"block": true,
|
317
|
+
"round": true,
|
318
|
+
"class": bem('button'),
|
319
|
+
"loading": props.isDeleting,
|
320
|
+
"text": props.deleteButtonText || t('delete'),
|
321
|
+
"onClick": onDelete
|
322
|
+
}, null)]), [[_vShow, !hideBottomFields.value]]), _createVNode(Popup, {
|
323
|
+
"show": showAreaPopup.value,
|
324
|
+
"onUpdate:show": $event => showAreaPopup.value = $event,
|
325
|
+
"round": true,
|
326
|
+
"teleport": "body",
|
327
|
+
"position": "bottom",
|
328
|
+
"lazyRender": false
|
329
|
+
}, {
|
330
|
+
default: () => [_createVNode(Area, {
|
331
|
+
"ref": areaRef,
|
332
|
+
"value": data.areaCode,
|
333
|
+
"loading": !areaListLoaded.value,
|
334
|
+
"areaList": props.areaList,
|
335
|
+
"columnsPlaceholder": props.areaColumnsPlaceholder,
|
336
|
+
"onConfirm": onAreaConfirm,
|
337
|
+
"onCancel": () => {
|
338
|
+
showAreaPopup.value = false;
|
339
|
+
}
|
340
|
+
}, null)]
|
341
|
+
})]
|
342
|
+
});
|
369
343
|
};
|
370
344
|
}
|
371
345
|
|
@@ -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;
|
@@ -11,12 +11,12 @@ export default defineComponent({
|
|
11
11
|
name,
|
12
12
|
props: {
|
13
13
|
show: Boolean,
|
14
|
+
rows: numericProp,
|
14
15
|
value: String,
|
16
|
+
rules: Array,
|
15
17
|
focused: Boolean,
|
16
|
-
|
18
|
+
maxlength: numericProp,
|
17
19
|
searchResult: Array,
|
18
|
-
errorMessage: String,
|
19
|
-
detailMaxlength: numericProp,
|
20
20
|
showSearchResult: Boolean
|
21
21
|
},
|
22
22
|
emits: ['blur', 'focus', 'input', 'select-search'],
|
@@ -77,14 +77,14 @@ export default defineComponent({
|
|
77
77
|
"clearable": true,
|
78
78
|
"ref": field,
|
79
79
|
"class": bem(),
|
80
|
-
"rows": props.
|
80
|
+
"rows": props.rows,
|
81
81
|
"type": "textarea",
|
82
|
+
"rules": props.rules,
|
82
83
|
"label": t('label'),
|
83
84
|
"border": !showSearchResult(),
|
84
|
-
"maxlength": props.
|
85
|
+
"maxlength": props.maxlength,
|
85
86
|
"modelValue": props.value,
|
86
87
|
"placeholder": t('placeholder'),
|
87
|
-
"errorMessage": props.errorMessage,
|
88
88
|
"onBlur": onBlur,
|
89
89
|
"onFocus": onFocus,
|
90
90
|
"onUpdate:modelValue": onInput
|
package/es/button/Button.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
2
|
import { defineComponent } from 'vue'; // Utils
|
3
3
|
|
4
|
-
import { extend, numericProp, makeStringProp, createNamespace, BORDER_SURROUND } from '../utils';
|
4
|
+
import { extend, numericProp, preventDefault, makeStringProp, createNamespace, BORDER_SURROUND } from '../utils';
|
5
5
|
import { useRoute, routeProps } from '../composables/use-route'; // Components
|
6
6
|
|
7
7
|
import { Icon } from '../icon';
|
@@ -118,7 +118,7 @@ export default defineComponent({
|
|
118
118
|
|
119
119
|
var onClick = event => {
|
120
120
|
if (props.loading) {
|
121
|
-
|
121
|
+
preventDefault(event);
|
122
122
|
} else if (!props.disabled) {
|
123
123
|
emit('click', event);
|
124
124
|
route();
|
package/es/calendar/Calendar.js
CHANGED
@@ -220,7 +220,7 @@ export default defineComponent({
|
|
220
220
|
months.value.some((month, index) => {
|
221
221
|
if (compareMonth(month, targetDate) === 0) {
|
222
222
|
if (bodyRef.value) {
|
223
|
-
monthRefs.value[index].
|
223
|
+
monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
|
224
224
|
}
|
225
225
|
|
226
226
|
return true;
|
@@ -230,10 +230,9 @@ export default defineComponent({
|
|
230
230
|
});
|
231
231
|
onScroll();
|
232
232
|
});
|
233
|
-
};
|
234
|
-
|
233
|
+
};
|
235
234
|
|
236
|
-
var
|
235
|
+
var scrollToCurrentDate = () => {
|
237
236
|
if (props.poppable && !props.show) {
|
238
237
|
return;
|
239
238
|
}
|
@@ -255,7 +254,7 @@ export default defineComponent({
|
|
255
254
|
// add Math.floor to avoid decimal height issues
|
256
255
|
// https://github.com/youzan/vant/issues/5640
|
257
256
|
bodyHeight = Math.floor(useRect(bodyRef).height);
|
258
|
-
|
257
|
+
scrollToCurrentDate();
|
259
258
|
});
|
260
259
|
};
|
261
260
|
|
@@ -265,7 +264,7 @@ export default defineComponent({
|
|
265
264
|
}
|
266
265
|
|
267
266
|
currentDate.value = date;
|
268
|
-
|
267
|
+
scrollToCurrentDate();
|
269
268
|
};
|
270
269
|
|
271
270
|
var checkRange = date => {
|
@@ -303,13 +302,8 @@ export default defineComponent({
|
|
303
302
|
var valid = checkRange(date);
|
304
303
|
|
305
304
|
if (!valid) {
|
306
|
-
// auto selected to max range
|
307
|
-
|
308
|
-
setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
|
309
|
-
} else {
|
310
|
-
setCurrentDate(date);
|
311
|
-
}
|
312
|
-
|
305
|
+
// auto selected to max range
|
306
|
+
setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
|
313
307
|
return;
|
314
308
|
}
|
315
309
|
}
|
@@ -467,7 +461,7 @@ export default defineComponent({
|
|
467
461
|
}
|
468
462
|
|
469
463
|
currentDate.value = value;
|
470
|
-
|
464
|
+
scrollToCurrentDate();
|
471
465
|
});
|
472
466
|
useExpose({
|
473
467
|
reset,
|
@@ -58,15 +58,6 @@ export default defineComponent({
|
|
58
58
|
|
59
59
|
var getTitle = () => title.value;
|
60
60
|
|
61
|
-
var scrollIntoView = body => {
|
62
|
-
var el = props.showSubtitle ? daysRef.value : monthRef.value;
|
63
|
-
|
64
|
-
if (el) {
|
65
|
-
var scrollTop = useRect(el).top - useRect(body).top + body.scrollTop;
|
66
|
-
setScrollTop(body, scrollTop);
|
67
|
-
}
|
68
|
-
};
|
69
|
-
|
70
61
|
var getMultipleDayType = day => {
|
71
62
|
var isSelected = date => props.currentDate.some(item => compareDay(item, date) === 0);
|
72
63
|
|
@@ -219,6 +210,16 @@ export default defineComponent({
|
|
219
210
|
});
|
220
211
|
var disabledDays = computed(() => days.value.filter(day => day.type === 'disabled'));
|
221
212
|
|
213
|
+
var scrollToDate = (body, targetDate) => {
|
214
|
+
if (daysRef.value) {
|
215
|
+
var daysRect = useRect(daysRef.value);
|
216
|
+
var totalRows = placeholders.value.length;
|
217
|
+
var currentRow = Math.ceil((targetDate.getDate() + offset.value) / 7);
|
218
|
+
var rowOffset = (currentRow - 1) * daysRect.height / totalRows;
|
219
|
+
setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
|
220
|
+
}
|
221
|
+
};
|
222
|
+
|
222
223
|
var renderDay = (item, index) => _createVNode(CalendarDay, {
|
223
224
|
"item": item,
|
224
225
|
"index": index,
|
@@ -238,7 +239,7 @@ export default defineComponent({
|
|
238
239
|
getTitle,
|
239
240
|
getHeight: () => height.value,
|
240
241
|
setVisible,
|
241
|
-
|
242
|
+
scrollToDate,
|
242
243
|
disabledDays
|
243
244
|
});
|
244
245
|
return () => _createVNode("div", {
|
package/es/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
|
}>;
|