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
|
@@ -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,115 @@ 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
|
+
"onClick": onSave
|
|
316
|
+
}, null), props.showDelete && _createVNode(Button, {
|
|
317
|
+
"block": true,
|
|
318
|
+
"round": true,
|
|
319
|
+
"class": bem('button'),
|
|
320
|
+
"loading": props.isDeleting,
|
|
321
|
+
"text": props.deleteButtonText || t('delete'),
|
|
322
|
+
"onClick": onDelete
|
|
323
|
+
}, null)]), [[_vShow, !hideBottomFields.value]]), _createVNode(Popup, {
|
|
324
|
+
"show": showAreaPopup.value,
|
|
325
|
+
"onUpdate:show": $event => showAreaPopup.value = $event,
|
|
326
|
+
"round": true,
|
|
327
|
+
"teleport": "body",
|
|
328
|
+
"position": "bottom",
|
|
329
|
+
"lazyRender": false
|
|
330
|
+
}, {
|
|
331
|
+
default: () => [_createVNode(Area, {
|
|
332
|
+
"ref": areaRef,
|
|
333
|
+
"value": data.areaCode,
|
|
334
|
+
"loading": !areaListLoaded.value,
|
|
335
|
+
"areaList": props.areaList,
|
|
336
|
+
"columnsPlaceholder": props.areaColumnsPlaceholder,
|
|
337
|
+
"onConfirm": onAreaConfirm,
|
|
338
|
+
"onCancel": () => {
|
|
339
|
+
showAreaPopup.value = false;
|
|
340
|
+
}
|
|
341
|
+
}, null)]
|
|
342
|
+
})]
|
|
343
|
+
});
|
|
369
344
|
};
|
|
370
345
|
}
|
|
371
346
|
|
|
@@ -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/cascader/Cascader.js
CHANGED
|
@@ -164,20 +164,27 @@ export default defineComponent({
|
|
|
164
164
|
}, null) : null]);
|
|
165
165
|
|
|
166
166
|
var renderOption = (option, selectedOption, tabIndex) => {
|
|
167
|
-
var
|
|
167
|
+
var {
|
|
168
|
+
disabled
|
|
169
|
+
} = option;
|
|
170
|
+
var selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
|
|
168
171
|
var color = option.color || (selected ? props.activeColor : undefined);
|
|
169
172
|
var Text = slots.option ? slots.option({
|
|
170
173
|
option,
|
|
171
174
|
selected
|
|
172
175
|
}) : _createVNode("span", null, [option[textKey]]);
|
|
173
176
|
return _createVNode("li", {
|
|
177
|
+
"role": "menuitemradio",
|
|
174
178
|
"class": [bem('option', {
|
|
175
179
|
selected,
|
|
176
|
-
disabled
|
|
180
|
+
disabled
|
|
177
181
|
}), option.className],
|
|
178
182
|
"style": {
|
|
179
183
|
color
|
|
180
184
|
},
|
|
185
|
+
"tabindex": disabled ? undefined : selected ? 0 : -1,
|
|
186
|
+
"aria-checked": selected,
|
|
187
|
+
"aria-disabled": disabled || undefined,
|
|
181
188
|
"onClick": () => onSelect(option, tabIndex)
|
|
182
189
|
}, [Text, selected ? _createVNode(Icon, {
|
|
183
190
|
"name": "success",
|
|
@@ -186,6 +193,7 @@ export default defineComponent({
|
|
|
186
193
|
};
|
|
187
194
|
|
|
188
195
|
var renderOptions = (options, selectedOption, tabIndex) => _createVNode("ul", {
|
|
196
|
+
"role": "menu",
|
|
189
197
|
"class": bem('options')
|
|
190
198
|
}, [options.map(option => renderOption(option, selectedOption, tabIndex))]);
|
|
191
199
|
|
package/es/checkbox/Checker.js
CHANGED
|
@@ -105,7 +105,7 @@ export default defineComponent({
|
|
|
105
105
|
disabled: disabled.value,
|
|
106
106
|
'label-disabled': props.labelDisabled
|
|
107
107
|
}, direction.value]),
|
|
108
|
-
"tabindex": disabled.value ?
|
|
108
|
+
"tabindex": disabled.value ? undefined : 0,
|
|
109
109
|
"aria-checked": props.checked,
|
|
110
110
|
"onClick": onClick
|
|
111
111
|
}, [nodes]);
|
package/es/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,14 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue';
|
|
2
|
+
var current = 0;
|
|
3
|
+
export function useId() {
|
|
4
|
+
var vm = getCurrentInstance();
|
|
5
|
+
var {
|
|
6
|
+
name = 'unknown'
|
|
7
|
+
} = (vm == null ? void 0 : vm.type) || {}; // keep jest snapshot stable
|
|
8
|
+
|
|
9
|
+
if (process.env.NODE_ENV === 'test') {
|
|
10
|
+
return name;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return name + "-" + ++current;
|
|
14
|
+
}
|
|
@@ -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;
|
|
@@ -7,13 +7,13 @@ export var routeProps = {
|
|
|
7
7
|
url: String,
|
|
8
8
|
replace: Boolean
|
|
9
9
|
};
|
|
10
|
-
export function route(
|
|
11
|
-
var router = vm.$router;
|
|
10
|
+
export function route(_ref) {
|
|
12
11
|
var {
|
|
13
12
|
to,
|
|
14
13
|
url,
|
|
15
|
-
replace
|
|
16
|
-
|
|
14
|
+
replace,
|
|
15
|
+
$router: router
|
|
16
|
+
} = _ref;
|
|
17
17
|
|
|
18
18
|
if (to && router) {
|
|
19
19
|
router[replace ? 'replace' : 'push'](to);
|