vant 3.2.8 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/address-edit/AddressEdit.js +155 -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/CalendarHeader.js +1 -3
- 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/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 +3 -4
- 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 +17 -4
- 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 +11 -4
- 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 +156 -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/CalendarHeader.js +1 -3
- 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/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/stepper/Stepper.js +11 -8
- package/lib/swipe/Swipe.js +1 -2
- 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 +19 -4
- 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 +11 -4
- 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.es.js +1086 -1068
- package/lib/vant.es.min.js +1086 -1068
- package/lib/vant.js +1085 -1067
- package/lib/vant.min.js +1 -1
- package/lib/vue-tsx-shim.d.ts +1 -0
- package/package.json +4 -4
- package/vetur/attributes.json +340 -340
- package/vetur/tags.json +119 -119
- package/vetur/web-types.json +1143 -1143
- 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,115 @@ 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
|
+
"onClick": onSave
|
334
|
+
}, null), props.showDelete && (0, _vue.createVNode)(_button.Button, {
|
335
|
+
"block": true,
|
336
|
+
"round": true,
|
337
|
+
"class": bem('button'),
|
338
|
+
"loading": props.isDeleting,
|
339
|
+
"text": props.deleteButtonText || t('delete'),
|
340
|
+
"onClick": onDelete
|
341
|
+
}, null)]), [[_vue.vShow, !hideBottomFields.value]]), (0, _vue.createVNode)(_popup.Popup, {
|
342
|
+
"show": showAreaPopup.value,
|
343
|
+
"onUpdate:show": $event => showAreaPopup.value = $event,
|
344
|
+
"round": true,
|
345
|
+
"teleport": "body",
|
346
|
+
"position": "bottom",
|
347
|
+
"lazyRender": false
|
348
|
+
}, {
|
349
|
+
default: () => [(0, _vue.createVNode)(_area.Area, {
|
350
|
+
"ref": areaRef,
|
351
|
+
"value": data.areaCode,
|
352
|
+
"loading": !areaListLoaded.value,
|
353
|
+
"areaList": props.areaList,
|
354
|
+
"columnsPlaceholder": props.areaColumnsPlaceholder,
|
355
|
+
"onConfirm": onAreaConfirm,
|
356
|
+
"onCancel": () => {
|
357
|
+
showAreaPopup.value = false;
|
358
|
+
}
|
359
|
+
}, null)]
|
360
|
+
})]
|
361
|
+
});
|
386
362
|
};
|
387
363
|
}
|
388
364
|
|
@@ -1,22 +1,23 @@
|
|
1
1
|
import { PropType } from 'vue';
|
2
2
|
import type { AddressEditSearchItem } from './types';
|
3
|
+
import type { FieldRule } from '../field/types';
|
3
4
|
declare const _default: import("vue").DefineComponent<{
|
4
5
|
show: BooleanConstructor;
|
6
|
+
rows: (NumberConstructor | StringConstructor)[];
|
5
7
|
value: StringConstructor;
|
8
|
+
rules: PropType<FieldRule[]>;
|
6
9
|
focused: BooleanConstructor;
|
7
|
-
|
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
@@ -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) {
|
package/lib/cascader/Cascader.js
CHANGED
@@ -173,20 +173,27 @@ var _default = (0, _vue.defineComponent)({
|
|
173
173
|
}, null) : null]);
|
174
174
|
|
175
175
|
var renderOption = (option, selectedOption, tabIndex) => {
|
176
|
-
var
|
176
|
+
var {
|
177
|
+
disabled
|
178
|
+
} = option;
|
179
|
+
var selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
|
177
180
|
var color = option.color || (selected ? props.activeColor : undefined);
|
178
181
|
var Text = slots.option ? slots.option({
|
179
182
|
option,
|
180
183
|
selected
|
181
184
|
}) : (0, _vue.createVNode)("span", null, [option[textKey]]);
|
182
185
|
return (0, _vue.createVNode)("li", {
|
186
|
+
"role": "menuitemradio",
|
183
187
|
"class": [bem('option', {
|
184
188
|
selected,
|
185
|
-
disabled
|
189
|
+
disabled
|
186
190
|
}), option.className],
|
187
191
|
"style": {
|
188
192
|
color
|
189
193
|
},
|
194
|
+
"tabindex": disabled ? undefined : selected ? 0 : -1,
|
195
|
+
"aria-checked": selected,
|
196
|
+
"aria-disabled": disabled || undefined,
|
190
197
|
"onClick": () => onSelect(option, tabIndex)
|
191
198
|
}, [Text, selected ? (0, _vue.createVNode)(_icon.Icon, {
|
192
199
|
"name": "success",
|
@@ -195,6 +202,7 @@ var _default = (0, _vue.defineComponent)({
|
|
195
202
|
};
|
196
203
|
|
197
204
|
var renderOptions = (options, selectedOption, tabIndex) => (0, _vue.createVNode)("ul", {
|
205
|
+
"role": "menu",
|
198
206
|
"class": bem('options')
|
199
207
|
}, [options.map(option => renderOption(option, selectedOption, tabIndex))]);
|
200
208
|
|
package/lib/checkbox/Checker.js
CHANGED
@@ -114,7 +114,7 @@ var _default = (0, _vue.defineComponent)({
|
|
114
114
|
disabled: disabled.value,
|
115
115
|
'label-disabled': props.labelDisabled
|
116
116
|
}, direction.value]),
|
117
|
-
"tabindex": disabled.value ?
|
117
|
+
"tabindex": disabled.value ? undefined : 0,
|
118
118
|
"aria-checked": props.checked,
|
119
119
|
"onClick": onClick
|
120
120
|
}, [nodes]);
|
package/lib/checkbox/types.d.ts
CHANGED
@@ -5,13 +5,9 @@ export declare type CheckboxShape = CheckerShape;
|
|
5
5
|
export declare type CheckboxLabelPosition = CheckerLabelPosition;
|
6
6
|
export declare type CheckboxExpose = {
|
7
7
|
toggle: (newValue?: boolean) => void;
|
8
|
-
/**
|
9
|
-
* @private
|
10
|
-
*/
|
8
|
+
/** @private */
|
11
9
|
props: CheckboxProps;
|
12
|
-
/**
|
13
|
-
* @private
|
14
|
-
*/
|
10
|
+
/** @private */
|
15
11
|
checked: ComputedRef<boolean>;
|
16
12
|
};
|
17
13
|
export declare type CheckboxInstance = ComponentPublicInstance<CheckboxProps, CheckboxExpose>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function useId(): string;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.useId = useId;
|
5
|
+
|
6
|
+
var _vue = require("vue");
|
7
|
+
|
8
|
+
var current = 0;
|
9
|
+
|
10
|
+
function useId() {
|
11
|
+
var vm = (0, _vue.getCurrentInstance)();
|
12
|
+
var {
|
13
|
+
name = 'unknown'
|
14
|
+
} = (vm == null ? void 0 : vm.type) || {}; // keep jest snapshot stable
|
15
|
+
|
16
|
+
if (process.env.NODE_ENV === 'test') {
|
17
|
+
return name;
|
18
|
+
}
|
19
|
+
|
20
|
+
return name + "-" + ++current;
|
21
|
+
}
|
@@ -9,5 +9,5 @@ export declare const routeProps: {
|
|
9
9
|
replace: BooleanConstructor;
|
10
10
|
};
|
11
11
|
export declare type RouteProps = ExtractPropTypes<typeof routeProps>;
|
12
|
-
export declare function route(
|
12
|
+
export declare function route({ to, url, replace, $router: router, }: ComponentPublicInstance<RouteProps>): void;
|
13
13
|
export declare function useRoute(): () => void;
|
@@ -17,13 +17,13 @@ var routeProps = {
|
|
17
17
|
};
|
18
18
|
exports.routeProps = routeProps;
|
19
19
|
|
20
|
-
function route(
|
21
|
-
var router = vm.$router;
|
20
|
+
function route(_ref) {
|
22
21
|
var {
|
23
22
|
to,
|
24
23
|
url,
|
25
|
-
replace
|
26
|
-
|
24
|
+
replace,
|
25
|
+
$router: router
|
26
|
+
} = _ref;
|
27
27
|
|
28
28
|
if (to && router) {
|
29
29
|
router[replace ? 'replace' : 'push'](to);
|