x-next 1.1.0 → 1.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/CHANGELOG.md +38 -0
- package/dist/_hooks/use-form-item.d.ts +5 -0
- package/dist/_hooks/use-picker-focus.d.ts +17 -0
- package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
- package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
- package/dist/components/_components/picker/input.vue.d.ts +9 -5
- package/dist/components/alert/Alert.vue.d.ts +5 -5
- package/dist/components/alert/index.d.ts +10 -10
- package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
- package/dist/components/date-picker/index.d.ts +77 -33
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/drawer/index.d.ts +3 -3
- package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.vue.d.ts +30 -4
- package/dist/components/dropdown/DropdownButton.vue.d.ts +31 -5
- package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +162 -5
- package/dist/components/dropdown/context.d.ts +14 -1
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
- package/dist/components/dropdown/index.d.ts +610 -28
- package/dist/components/dropdown/use-keyboard.d.ts +10 -0
- package/dist/components/form/FormItem.vue.d.ts +12 -4
- package/dist/components/form/context.d.ts +6 -0
- package/dist/components/form/form-item-label.vue.d.ts +4 -4
- package/dist/components/form/form-item-message.vue.d.ts +2 -0
- package/dist/components/form/index.d.ts +30 -8
- package/dist/components/form/interface.d.ts +2 -2
- package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
- package/dist/components/form-input/index.d.ts +22 -4
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/hooks/use-select.d.ts +2 -1
- package/dist/components/form-select/index.d.ts +6 -6
- package/dist/components/form-slider/Slider.vue.d.ts +10 -3
- package/dist/components/form-slider/index.d.ts +26 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
- package/dist/components/form-switch/Switch.vue.d.ts +2 -1
- package/dist/components/form-switch/index.d.ts +5 -2
- package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
- package/dist/components/form-textarea/index.d.ts +5 -5
- package/dist/components/image/Image.vue.d.ts +10 -9
- package/dist/components/image/ImagePreview.vue.d.ts +8 -7
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
- package/dist/components/image/index.d.ts +59 -52
- package/dist/components/image/preview-arrow.vue.d.ts +2 -2
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
- package/dist/components/layout/index.d.ts +4 -4
- package/dist/components/link/Link.vue.d.ts +2 -2
- package/dist/components/link/index.d.ts +4 -4
- package/dist/components/menu/Menu.d.ts +2 -2
- package/dist/components/menu/base-menu.vue.d.ts +2 -2
- package/dist/components/menu/index.d.ts +4 -4
- package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
- package/dist/components/message/index.d.ts +17 -17
- package/dist/components/message/message.vue.d.ts +8 -8
- package/dist/components/notification/Notification.d.ts +1 -1
- package/dist/components/notification/index.d.ts +3 -3
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
- package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/progress/Progress.vue.d.ts +4 -4
- package/dist/components/progress/circle.vue.d.ts +2 -2
- package/dist/components/progress/index.d.ts +8 -8
- package/dist/components/progress/line.vue.d.ts +1 -1
- package/dist/components/progress/steps.vue.d.ts +1 -1
- package/dist/components/steps/Step.vue.d.ts +2 -2
- package/dist/components/steps/index.d.ts +4 -4
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
- package/dist/components/tag/Tag.vue.d.ts +2 -2
- package/dist/components/tag/index.d.ts +4 -4
- package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
- package/dist/components/time-picker/index.d.ts +73 -36
- package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
- package/dist/components/time-range-selector/index.d.ts +22 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/es/_hooks/use-form-item.js +36 -10
- package/dist/es/_hooks/use-overflow.js +45 -40
- package/dist/es/_hooks/use-picker-focus.js +57 -0
- package/dist/es/_utils/constant.js +17 -5
- package/dist/es/components/_components/picker/input-range.vue.js +45 -55
- package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
- package/dist/es/components/_components/picker/input.vue.js +22 -25
- package/dist/es/components/_components/picker/input.vue2.js +58 -43
- package/dist/es/components/_components/select-view/select-view.js +61 -66
- package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
- package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
- package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
- package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
- package/dist/es/components/dialog/Dialog.js +159 -128
- package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
- package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
- package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
- package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
- package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
- package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
- package/dist/es/components/dropdown/context.js +3 -2
- package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
- package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
- package/dist/es/components/dropdown/use-keyboard.js +45 -0
- package/dist/es/components/form/Form.vue2.js +113 -101
- package/dist/es/components/form/FormItem.vue.js +26 -22
- package/dist/es/components/form/FormItem.vue2.js +162 -125
- package/dist/es/components/form/form-item-message.vue.js +31 -24
- package/dist/es/components/form/form-item-message.vue2.js +4 -2
- package/dist/es/components/form-checkbox/Checkbox.js +80 -76
- package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
- package/dist/es/components/form-input/Input.js +83 -79
- package/dist/es/components/form-input/InputPassword.vue.js +19 -16
- package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
- package/dist/es/components/form-input/InputSearch.js +47 -37
- package/dist/es/components/form-input-number/InputNumber.js +134 -133
- package/dist/es/components/form-input-tag/InputTag.js +173 -162
- package/dist/es/components/form-radio/Radio.js +74 -71
- package/dist/es/components/form-radio/RadioGroup.js +55 -49
- package/dist/es/components/form-select/Select.js +116 -114
- package/dist/es/components/form-select/hooks/use-select.js +128 -128
- package/dist/es/components/form-slider/Slider.vue.js +28 -28
- package/dist/es/components/form-slider/Slider.vue2.js +139 -132
- package/dist/es/components/form-slider/slider-button.vue.js +6 -6
- package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
- package/dist/es/components/form-switch/Switch.vue.js +9 -9
- package/dist/es/components/form-switch/Switch.vue2.js +81 -74
- package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
- package/dist/es/components/image/Image.vue2.js +77 -76
- package/dist/es/components/image/ImagePreview.vue.js +13 -12
- package/dist/es/components/image/ImagePreview.vue2.js +141 -136
- package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
- package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
- package/dist/es/components/rate/Rate.js +106 -103
- package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
- package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
- package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
- package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
- package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
- package/dist/es/locale/en-US.js +6 -0
- package/dist/es/locale/zh-CN.js +6 -0
- package/dist/es/style.css +1 -1
- package/dist/icons/_self/down.d.ts +1 -1
- package/dist/icons/_self/dropdown/more.d.ts +1 -1
- package/dist/icons/_self/empty-better.d.ts +1 -1
- package/dist/icons/_self/empty.d.ts +1 -1
- package/dist/icons/_self/eye-invisible.d.ts +1 -1
- package/dist/icons/_self/eye.d.ts +1 -1
- package/dist/icons/_self/full-screen.d.ts +1 -1
- package/dist/icons/_self/left.d.ts +1 -1
- package/dist/icons/_self/menu/down.d.ts +1 -1
- package/dist/icons/_self/minus.d.ts +1 -1
- package/dist/icons/_self/more-dot.d.ts +1 -1
- package/dist/icons/_self/next.d.ts +1 -1
- package/dist/icons/_self/original-size.d.ts +1 -1
- package/dist/icons/_self/plus.d.ts +1 -1
- package/dist/icons/_self/prev.d.ts +1 -1
- package/dist/icons/_self/question-message.d.ts +1 -1
- package/dist/icons/_self/right.d.ts +1 -1
- package/dist/icons/_self/rotate-left.d.ts +1 -1
- package/dist/icons/_self/rotate-right.d.ts +1 -1
- package/dist/icons/_self/search.d.ts +1 -1
- package/dist/icons/_self/up.d.ts +1 -1
- package/dist/icons/_self/zoom-in.d.ts +1 -1
- package/dist/icons/_self/zoom-out.d.ts +1 -1
- package/dist/icons/_ui/alone-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
- package/dist/icons/_ui/alone-right.d.ts +1 -1
- package/dist/icons/_ui/calendar.d.ts +1 -1
- package/dist/icons/_ui/time.d.ts +1 -1
- package/dist/icons/animation/animation-loading.d.ts +1 -1
- package/dist/icons/default/check-circle-fill.d.ts +1 -1
- package/dist/icons/default/check.d.ts +1 -1
- package/dist/icons/default/close-circle-fill.d.ts +1 -1
- package/dist/icons/default/close.d.ts +1 -1
- package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
- package/dist/icons/default/exclamation.d.ts +1 -1
- package/dist/icons/default/filter.d.ts +1 -1
- package/dist/icons/default/info-circle-fill.d.ts +1 -1
- package/dist/icons/default/link.d.ts +1 -1
- package/dist/icons/default/logo-simple.d.ts +1 -1
- package/dist/icons/default/minus-circle-fill.d.ts +1 -1
- package/dist/icons/icon.d.ts +2 -2
- package/dist/icons/index.d.ts +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +6 -0
- package/dist/style/base.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/image.css +1 -1
- package/dist/style/time-range-selector.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { INPUT_EVENTS as
|
|
3
|
-
import { Enter as
|
|
4
|
-
import { getValueData as
|
|
5
|
-
import { Tag as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { omit as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useFormItem as
|
|
13
|
-
import { useLocale as
|
|
14
|
-
import { useSize as
|
|
15
|
-
import { isObject as
|
|
16
|
-
import { getClassNameMixin as
|
|
17
|
-
const
|
|
1
|
+
import { defineComponent as me, toRefs as pe, ref as v, computed as s, reactive as ge, watch as $, onMounted as be, createVNode as d, mergeProps as z, TransitionGroup as he, nextTick as U } from "vue";
|
|
2
|
+
import { INPUT_EVENTS as W } from "../../_utils/constant.js";
|
|
3
|
+
import { Enter as ye, Backspace as Ve } from "../../_utils/keycode.js";
|
|
4
|
+
import { getValueData as Ce } from "./utils.js";
|
|
5
|
+
import { Tag as Ie } from "../tag/index.js";
|
|
6
|
+
import we from "../_components/icon-hover/index.vue.js";
|
|
7
|
+
import xe from "../../icons/default/close.js";
|
|
8
|
+
import { omit as q } from "../../_utils/omit.js";
|
|
9
|
+
import Be from "../../_utils/pick.js";
|
|
10
|
+
import _e from "../../_container/resize-observer.js";
|
|
11
|
+
import Te from "../_components/feedback-icon/index.vue.js";
|
|
12
|
+
import { useFormItem as ke, useFormItemControl as Ne } from "../../_hooks/use-form-item.js";
|
|
13
|
+
import { useLocale as Ae } from "../../locale/index.js";
|
|
14
|
+
import { useSize as Ee } from "../../_hooks/use-size.js";
|
|
15
|
+
import { isObject as Se, isUndefined as ze, isNull as Fe } from "../../_utils/is.js";
|
|
16
|
+
import { getClassNameMixin as G, getRemovePrefixComponentName as Re } from "../../_utils/config.js";
|
|
17
|
+
const Pe = {
|
|
18
18
|
value: "value",
|
|
19
19
|
label: "label",
|
|
20
20
|
closable: "closable",
|
|
21
21
|
tagProps: "tagProps"
|
|
22
|
-
},
|
|
22
|
+
}, De = "__x_input_tag_more__", aa = /* @__PURE__ */ me({
|
|
23
23
|
name: "InputTag",
|
|
24
24
|
inheritAttrs: !1,
|
|
25
25
|
props: {
|
|
@@ -224,212 +224,223 @@ const ze = {
|
|
|
224
224
|
*/
|
|
225
225
|
setup(a, {
|
|
226
226
|
emit: o,
|
|
227
|
-
slots:
|
|
228
|
-
attrs:
|
|
227
|
+
slots: i,
|
|
228
|
+
attrs: I
|
|
229
229
|
}) {
|
|
230
230
|
const {
|
|
231
|
-
size:
|
|
232
|
-
disabled:
|
|
233
|
-
error:
|
|
234
|
-
uninjectFormItemContext:
|
|
235
|
-
modelValue:
|
|
236
|
-
} =
|
|
237
|
-
|
|
231
|
+
size: H,
|
|
232
|
+
disabled: K,
|
|
233
|
+
error: J,
|
|
234
|
+
uninjectFormItemContext: T,
|
|
235
|
+
modelValue: Q
|
|
236
|
+
} = pe(a), u = a.baseCls ? G(Re(a.baseCls)) : G("input-tag"), r = v(), p = v(), {
|
|
237
|
+
formItemCtx: X,
|
|
238
|
+
mergedSize: Y,
|
|
238
239
|
mergedDisabled: g,
|
|
239
|
-
mergedError:
|
|
240
|
-
feedback:
|
|
241
|
-
eventHandlers:
|
|
242
|
-
} =
|
|
243
|
-
size:
|
|
244
|
-
disabled:
|
|
245
|
-
error:
|
|
246
|
-
uninject:
|
|
240
|
+
mergedError: F,
|
|
241
|
+
feedback: w,
|
|
242
|
+
eventHandlers: x
|
|
243
|
+
} = ke({
|
|
244
|
+
size: H,
|
|
245
|
+
disabled: K,
|
|
246
|
+
error: J,
|
|
247
|
+
uninject: T == null ? void 0 : T.value
|
|
247
248
|
}), {
|
|
248
|
-
t:
|
|
249
|
-
} =
|
|
250
|
-
mergedSize:
|
|
251
|
-
} =
|
|
252
|
-
...
|
|
249
|
+
t: R
|
|
250
|
+
} = Ae(), {
|
|
251
|
+
mergedSize: Z
|
|
252
|
+
} = Ee(Y), ee = s(() => ({
|
|
253
|
+
...Pe,
|
|
253
254
|
...a.fieldNames
|
|
254
|
-
})),
|
|
255
|
+
})), k = v(!1), N = v(a.defaultValue), P = v(a.defaultInputValue), m = v(!1), B = v(""), D = s(() => Se(a.retainInputValue) ? {
|
|
255
256
|
create: !1,
|
|
256
257
|
blur: !1,
|
|
257
258
|
...a.retainInputValue
|
|
258
259
|
} : {
|
|
259
260
|
create: a.retainInputValue,
|
|
260
261
|
blur: a.retainInputValue
|
|
261
|
-
}),
|
|
262
|
+
}), A = ge({
|
|
262
263
|
width: "12px"
|
|
263
|
-
}),
|
|
264
|
-
|
|
265
|
-
},
|
|
264
|
+
}), ae = s(() => a.focused || k.value), b = (e, t) => {
|
|
265
|
+
P.value = e, o("update:inputValue", e), o("inputValueChange", e, t);
|
|
266
|
+
}, E = (e) => {
|
|
266
267
|
const {
|
|
267
|
-
value:
|
|
268
|
+
value: t
|
|
268
269
|
} = e.target;
|
|
269
|
-
e.type === "compositionend" ? (m.value = !1,
|
|
270
|
+
e.type === "compositionend" ? (m.value = !1, B.value = "", b(t, e), U(() => {
|
|
270
271
|
r.value && n.value !== r.value.value && (r.value.value = n.value);
|
|
271
|
-
})) : (m.value = !0,
|
|
272
|
-
},
|
|
273
|
-
|
|
274
|
-
(
|
|
272
|
+
})) : (m.value = !0, B.value = n.value + (e.data ?? ""));
|
|
273
|
+
}, h = s(() => a.modelValue ?? N.value), n = s(() => a.inputValue ?? P.value);
|
|
274
|
+
$(Q, (e) => {
|
|
275
|
+
(ze(e) || Fe(e)) && (N.value = []);
|
|
275
276
|
});
|
|
276
|
-
const
|
|
277
|
+
const le = (e) => {
|
|
277
278
|
r.value && e.target !== r.value && (e.preventDefault(), r.value.focus());
|
|
278
|
-
},
|
|
279
|
-
var
|
|
279
|
+
}, te = (e) => {
|
|
280
|
+
var l, f;
|
|
280
281
|
const {
|
|
281
|
-
value:
|
|
282
|
+
value: t
|
|
282
283
|
} = e.target;
|
|
283
|
-
m.value || (
|
|
284
|
+
m.value || (b(t, e), (f = (l = x.value) == null ? void 0 : l.onInput) == null || f.call(l, e), U(() => {
|
|
284
285
|
r.value && n.value !== r.value.value && (r.value.value = n.value);
|
|
285
286
|
}));
|
|
286
|
-
}, c =
|
|
287
|
+
}, c = s(() => Ce(h.value, ee.value)), y = s(() => {
|
|
287
288
|
if (a.maxTagCount > 0) {
|
|
288
289
|
const e = c.value.length - a.maxTagCount;
|
|
289
290
|
if (e > 0) {
|
|
290
|
-
const
|
|
291
|
-
value:
|
|
291
|
+
const t = c.value.slice(0, a.maxTagCount), l = {
|
|
292
|
+
value: De,
|
|
292
293
|
label: `+${e}...`,
|
|
293
294
|
closable: !1
|
|
294
295
|
};
|
|
295
|
-
return
|
|
296
|
-
raw:
|
|
297
|
-
...
|
|
298
|
-
}),
|
|
296
|
+
return t.push({
|
|
297
|
+
raw: l,
|
|
298
|
+
...l
|
|
299
|
+
}), t;
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
302
|
return c.value;
|
|
302
|
-
}),
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
},
|
|
303
|
+
}), S = (e, t) => {
|
|
304
|
+
var l, f;
|
|
305
|
+
N.value = e, o("update:modelValue", e), o("change", e, t), (f = (l = x.value) == null ? void 0 : l.onChange) == null || f.call(l, t);
|
|
306
|
+
}, M = (e, t, l) => {
|
|
306
307
|
var V;
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
},
|
|
310
|
-
e.stopPropagation(),
|
|
311
|
-
},
|
|
308
|
+
const f = (V = h.value) == null ? void 0 : V.filter((C, _) => _ !== t);
|
|
309
|
+
S(f, l), o("remove", e, l);
|
|
310
|
+
}, ue = (e) => {
|
|
311
|
+
e.stopPropagation(), S([], e), n.value && b("", e), o("clear", e);
|
|
312
|
+
}, O = s(() => !g.value && !a.readonly && a.allowClear && !!h.value.length), ne = (e) => {
|
|
312
313
|
if (n.value) {
|
|
313
|
-
if (e.preventDefault(), a.uniqueValue && c.value.some((
|
|
314
|
+
if (e.preventDefault(), a.uniqueValue && c.value.some((l) => l.value === n.value)) {
|
|
314
315
|
o("pressEnter", n.value, e);
|
|
315
316
|
return;
|
|
316
317
|
}
|
|
317
|
-
const
|
|
318
|
-
|
|
318
|
+
const t = h.value.concat(n.value);
|
|
319
|
+
S(t, e), o("pressEnter", n.value, e), D.value.create || b("", e);
|
|
319
320
|
}
|
|
320
|
-
},
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
},
|
|
321
|
+
}, oe = (e) => {
|
|
322
|
+
var t, l;
|
|
323
|
+
k.value = !0, o("focus", e), (l = (t = x.value) == null ? void 0 : t.onFocus) == null || l.call(t, e);
|
|
324
|
+
}, re = (e) => {
|
|
325
|
+
var t, l;
|
|
326
|
+
k.value = !1, !D.value.blur && n.value && b("", e), o("blur", e), (l = (t = x.value) == null ? void 0 : t.onBlur) == null || l.call(t, e);
|
|
327
|
+
}, ie = () => {
|
|
327
328
|
for (let e = c.value.length - 1; e >= 0; e--)
|
|
328
329
|
if (c.value[e].closable)
|
|
329
330
|
return e;
|
|
330
331
|
return -1;
|
|
331
|
-
},
|
|
332
|
+
}, se = (e) => {
|
|
332
333
|
if (g.value || a.readonly)
|
|
333
334
|
return;
|
|
334
|
-
const
|
|
335
|
-
if (!m.value && n.value &&
|
|
336
|
-
const
|
|
337
|
-
|
|
335
|
+
const t = e.key || e.code;
|
|
336
|
+
if (!m.value && n.value && t === ye.key && ne(e), !m.value && y.value.length > 0 && !n.value && t === Ve.key) {
|
|
337
|
+
const l = ie();
|
|
338
|
+
l >= 0 && (e.preventDefault(), M(c.value[l].value, l, e));
|
|
338
339
|
}
|
|
339
340
|
o("keydown", e);
|
|
340
|
-
},
|
|
341
|
-
e > 12 ?
|
|
341
|
+
}, j = (e) => {
|
|
342
|
+
e > 12 ? A.width = `${e}px` : A.width = "12px";
|
|
342
343
|
};
|
|
343
|
-
|
|
344
|
-
p.value &&
|
|
344
|
+
be(() => {
|
|
345
|
+
p.value && j(p.value.offsetWidth);
|
|
345
346
|
});
|
|
346
|
-
const
|
|
347
|
-
p.value &&
|
|
347
|
+
const de = () => {
|
|
348
|
+
p.value && j(p.value.offsetWidth);
|
|
348
349
|
};
|
|
349
|
-
|
|
350
|
+
$(n, (e) => {
|
|
350
351
|
r.value && !m.value && e !== r.value.value && (r.value.value = e);
|
|
351
352
|
});
|
|
352
|
-
const
|
|
353
|
-
[
|
|
354
|
-
[
|
|
355
|
-
[
|
|
356
|
-
[
|
|
357
|
-
[
|
|
358
|
-
[
|
|
359
|
-
[
|
|
360
|
-
[
|
|
361
|
-
[
|
|
362
|
-
}]),
|
|
353
|
+
const fe = s(() => [u.block, u.modifier(`size-${Z.value}`), {
|
|
354
|
+
[u.modifier("disabled")]: g.value,
|
|
355
|
+
[u.modifier("disabled-input")]: a.disabledInput,
|
|
356
|
+
[u.modifier("error")]: F.value,
|
|
357
|
+
[u.modifier("focus")]: ae.value,
|
|
358
|
+
[u.modifier("readonly")]: a.readonly,
|
|
359
|
+
[u.modifier("has-tag")]: y.value.length > 0,
|
|
360
|
+
[u.modifier("has-prefix")]: !!i.prefix,
|
|
361
|
+
[u.modifier("has-suffix")]: !!i.suffix || O.value || !!w.value,
|
|
362
|
+
[u.modifier("has-placeholder")]: !h.value.length
|
|
363
|
+
}]), ce = s(() => q(q(I, W), ["class", "style"])), L = s(() => Be(I, W)), ve = Ne(X, () => ({
|
|
364
|
+
...L.value,
|
|
365
|
+
...a.inputAttrs
|
|
366
|
+
}));
|
|
363
367
|
return {
|
|
364
368
|
inputRef: r,
|
|
365
369
|
render: () => {
|
|
366
370
|
var e;
|
|
367
|
-
return d("span",
|
|
368
|
-
class: [
|
|
369
|
-
style:
|
|
370
|
-
onMousedown:
|
|
371
|
-
},
|
|
372
|
-
onResize:
|
|
371
|
+
return d("span", z({
|
|
372
|
+
class: [fe.value, I.class],
|
|
373
|
+
style: I.style,
|
|
374
|
+
onMousedown: le
|
|
375
|
+
}, ce.value), [d(_e, {
|
|
376
|
+
onResize: de
|
|
373
377
|
}, {
|
|
374
378
|
default: () => [d("span", {
|
|
375
379
|
ref: p,
|
|
376
|
-
class:
|
|
377
|
-
}, [y.value.length > 0 ?
|
|
378
|
-
}),
|
|
379
|
-
class:
|
|
380
|
-
}, [
|
|
380
|
+
class: u.element("mirror")
|
|
381
|
+
}, [y.value.length > 0 ? B.value || n.value : B.value || n.value || a.placeholder])]
|
|
382
|
+
}), i.prefix && d("span", {
|
|
383
|
+
class: u.element("prefix")
|
|
384
|
+
}, [i.prefix()]), d(he, {
|
|
381
385
|
tag: "span",
|
|
382
386
|
name: "input-tag-zoom",
|
|
383
|
-
class: [
|
|
384
|
-
[
|
|
387
|
+
class: [u.element("inner"), {
|
|
388
|
+
[u.modifier("nowrap")]: a.tagNowrap
|
|
385
389
|
}]
|
|
386
390
|
}, {
|
|
387
|
-
default: () =>
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
391
|
+
default: () => {
|
|
392
|
+
var t;
|
|
393
|
+
return [y.value.map((l, f) => {
|
|
394
|
+
var V;
|
|
395
|
+
return d(Ie, z({
|
|
396
|
+
key: `tag-${l.value}-${f}`,
|
|
397
|
+
class: u.element("tag"),
|
|
398
|
+
visible: !0,
|
|
399
|
+
nowrap: a.tagNowrap
|
|
400
|
+
}, l.tagProps, {
|
|
401
|
+
closable: !g.value && !a.readonly && (((V = l.tagProps) == null ? void 0 : V.closable) ?? l.closable),
|
|
402
|
+
onClose: (C) => M(l.value, f, C)
|
|
403
|
+
}), {
|
|
404
|
+
default: () => {
|
|
405
|
+
var C, _;
|
|
406
|
+
return [((C = i.tag) == null ? void 0 : C.call(i, {
|
|
407
|
+
data: l.raw
|
|
408
|
+
})) ?? ((_ = a.formatTag) == null ? void 0 : _.call(a, l.raw)) ?? l.label];
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}), d("input", z(ve.value, {
|
|
412
|
+
ref: r,
|
|
413
|
+
key: "input-tag-input",
|
|
414
|
+
class: u.element("input"),
|
|
415
|
+
style: A,
|
|
416
|
+
value: n.value,
|
|
417
|
+
placeholder: y.value.length === 0 ? a.placeholder : void 0,
|
|
418
|
+
disabled: g.value,
|
|
419
|
+
readonly: a.readonly || a.disabledInput,
|
|
420
|
+
"aria-invalid": F.value ? !0 : ((t = a.inputAttrs) == null ? void 0 : t["aria-invalid"]) ?? L.value["aria-invalid"],
|
|
421
|
+
onInput: te,
|
|
422
|
+
onKeydown: se,
|
|
423
|
+
onFocus: oe,
|
|
424
|
+
onBlur: re,
|
|
425
|
+
onCompositionstart: E,
|
|
426
|
+
onCompositionupdate: E,
|
|
427
|
+
onCompositionend: E
|
|
428
|
+
}), null)];
|
|
429
|
+
}
|
|
430
|
+
}), O.value && d(we, {
|
|
420
431
|
as: "button",
|
|
421
|
-
"aria-label":
|
|
422
|
-
target:
|
|
432
|
+
"aria-label": R("common.clearTarget", {
|
|
433
|
+
target: R("common.tag")
|
|
423
434
|
}),
|
|
424
|
-
class:
|
|
425
|
-
onClick:
|
|
426
|
-
onMousedown: (
|
|
435
|
+
class: u.element("clear-btn"),
|
|
436
|
+
onClick: ue,
|
|
437
|
+
onMousedown: (t) => t.stopPropagation()
|
|
427
438
|
}, {
|
|
428
|
-
default: () => [d(
|
|
429
|
-
}), (
|
|
430
|
-
class:
|
|
431
|
-
}, [(e =
|
|
432
|
-
type:
|
|
439
|
+
default: () => [d(xe, null, null)]
|
|
440
|
+
}), (i.suffix || !!w.value) && d("span", {
|
|
441
|
+
class: u.element("suffix")
|
|
442
|
+
}, [(e = i.suffix) == null ? void 0 : e.call(i), !!w.value && d(Te, {
|
|
443
|
+
type: w.value
|
|
433
444
|
}, null)])]);
|
|
434
445
|
}
|
|
435
446
|
};
|
|
@@ -459,5 +470,5 @@ const ze = {
|
|
|
459
470
|
}
|
|
460
471
|
});
|
|
461
472
|
export {
|
|
462
|
-
|
|
473
|
+
aa as default
|
|
463
474
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { radioGroupKey as
|
|
4
|
-
import { isUndefined as
|
|
5
|
-
import { useFormItem as L } from "../../_hooks/use-form-item.js";
|
|
6
|
-
import { getClassNameMixin as
|
|
7
|
-
import { omit as
|
|
8
|
-
import { useSize as
|
|
9
|
-
const
|
|
1
|
+
import { defineComponent as P, toRefs as T, inject as W, toRef as y, ref as k, computed as d, watch as S, createVNode as o, mergeProps as z, nextTick as w, Fragment as E, resolveComponent as K } from "vue";
|
|
2
|
+
import U from "../_components/icon-hover/index.vue.js";
|
|
3
|
+
import { radioGroupKey as X } from "./context.js";
|
|
4
|
+
import { isUndefined as B, isNull as q } from "../../_utils/is.js";
|
|
5
|
+
import { useFormItem as J, useFormItemControl as L } from "../../_hooks/use-form-item.js";
|
|
6
|
+
import { getClassNameMixin as Q } from "../../_utils/config.js";
|
|
7
|
+
import { omit as Y } from "../../_utils/omit.js";
|
|
8
|
+
import { useSize as Z } from "../../_hooks/use-size.js";
|
|
9
|
+
const ie = /* @__PURE__ */ P({
|
|
10
10
|
name: "Radio",
|
|
11
11
|
inheritAttrs: !1,
|
|
12
12
|
components: {
|
|
13
|
-
IconHover:
|
|
13
|
+
IconHover: U
|
|
14
14
|
},
|
|
15
15
|
props: {
|
|
16
16
|
/**
|
|
@@ -84,14 +84,14 @@ const ne = /* @__PURE__ */ M({
|
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
emits: {
|
|
87
|
-
"update:modelValue": (
|
|
87
|
+
"update:modelValue": (t) => !0,
|
|
88
88
|
/**
|
|
89
89
|
* @zh 值改变时触发
|
|
90
90
|
* @en Trigger when the value changes
|
|
91
91
|
* @param { RadioValue } value
|
|
92
92
|
* @param {Event} ev
|
|
93
93
|
*/
|
|
94
|
-
change: (
|
|
94
|
+
change: (t, c) => !0
|
|
95
95
|
},
|
|
96
96
|
/**
|
|
97
97
|
* @zh 自定义单选框
|
|
@@ -101,82 +101,85 @@ const ne = /* @__PURE__ */ M({
|
|
|
101
101
|
* @binding {boolean} disabled
|
|
102
102
|
* @version 2.18.0
|
|
103
103
|
*/
|
|
104
|
-
setup(
|
|
105
|
-
attrs:
|
|
106
|
-
emit:
|
|
107
|
-
slots:
|
|
104
|
+
setup(t, {
|
|
105
|
+
attrs: c,
|
|
106
|
+
emit: h,
|
|
107
|
+
slots: m
|
|
108
108
|
}) {
|
|
109
|
-
const
|
|
110
|
-
modelValue:
|
|
111
|
-
} =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
const n = Q("radio"), {
|
|
110
|
+
modelValue: N
|
|
111
|
+
} = T(t), e = t.uninjectGroupContext ? void 0 : W(X, void 0), {
|
|
112
|
+
formItemCtx: R,
|
|
113
|
+
mergedDisabled: j,
|
|
114
|
+
mergedSize: F,
|
|
115
|
+
eventHandlers: v
|
|
116
|
+
} = J({
|
|
117
|
+
disabled: y(t, "disabled"),
|
|
118
|
+
size: y(t, "size")
|
|
118
119
|
}), {
|
|
119
|
-
mergedSize:
|
|
120
|
-
} =
|
|
121
|
-
|
|
122
|
-
(
|
|
120
|
+
mergedSize: V
|
|
121
|
+
} = Z(F), I = L(e ? {} : R, () => ({
|
|
122
|
+
id: t.id,
|
|
123
|
+
...Object.fromEntries(Object.entries(c).filter(([l]) => l.startsWith("aria-")))
|
|
124
|
+
})), s = k(null), f = k(t.defaultChecked), g = d(() => (e == null ? void 0 : e.name) === "XRadioGroup"), b = d(() => (e == null ? void 0 : e.type) ?? t.type), r = d(() => (e == null ? void 0 : e.disabled) || j.value), _ = d(() => (e == null ? void 0 : e.size) ?? V.value), $ = d(() => t.name ?? (e == null ? void 0 : e.inputName)), u = d(() => g.value ? (e == null ? void 0 : e.value) === (t.value ?? !0) : B(t.modelValue) ? f.value : t.modelValue === (t.value ?? !0));
|
|
125
|
+
S(N, (l) => {
|
|
126
|
+
(B(l) || q(l)) && (f.value = !1);
|
|
123
127
|
}), S(u, (l, a) => {
|
|
124
|
-
l !== a && (f.value = l,
|
|
128
|
+
l !== a && (f.value = l, s.value && (s.value.checked = l));
|
|
125
129
|
});
|
|
126
|
-
const
|
|
127
|
-
var a,
|
|
128
|
-
(
|
|
129
|
-
},
|
|
130
|
-
var a,
|
|
131
|
-
(
|
|
132
|
-
}, p = (l) => {
|
|
133
|
-
l.stopPropagation();
|
|
130
|
+
const p = (l) => {
|
|
131
|
+
var a, i;
|
|
132
|
+
(i = (a = v.value) == null ? void 0 : a.onFocus) == null || i.call(a, l);
|
|
133
|
+
}, A = (l) => {
|
|
134
|
+
var a, i;
|
|
135
|
+
(i = (a = v.value) == null ? void 0 : a.onBlur) == null || i.call(a, l);
|
|
134
136
|
}, D = (l) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
l.stopPropagation();
|
|
138
|
+
}, O = (l) => {
|
|
139
|
+
var a, i;
|
|
140
|
+
f.value = !0, g.value ? e == null || e.handleChange(t.value ?? !0, l) : (h("update:modelValue", t.value ?? !0), h("change", t.value ?? !0, l), (i = (a = v.value) == null ? void 0 : a.onChange) == null || i.call(a, l)), w(() => {
|
|
141
|
+
s.value && s.value.checked !== u.value && (s.value.checked = u.value);
|
|
138
142
|
});
|
|
139
|
-
},
|
|
140
|
-
[
|
|
141
|
-
[
|
|
142
|
-
}]), H =
|
|
143
|
-
class: `${
|
|
144
|
-
disabled:
|
|
143
|
+
}, C = d(() => [`${b.value === "button" ? n.element("button") : n.block}`, n.modifier(`size-${_.value}`), c.class, {
|
|
144
|
+
[n.modifier("checked")]: u.value,
|
|
145
|
+
[n.modifier("disabled")]: r.value
|
|
146
|
+
}]), H = d(() => Y(c, ["class", "style", ...Object.keys(c).filter((l) => l.startsWith("aria-"))])), M = () => o(E, null, [o(K("icon-hover"), {
|
|
147
|
+
class: `${n.block}-icon-hover`,
|
|
148
|
+
disabled: r.value || u.value
|
|
145
149
|
}, {
|
|
146
150
|
default: () => [o("span", {
|
|
147
|
-
class: `${
|
|
151
|
+
class: `${n.block}-icon`
|
|
148
152
|
}, null)]
|
|
149
|
-
}),
|
|
150
|
-
class:
|
|
151
|
-
}, [
|
|
153
|
+
}), m.default && o("span", {
|
|
154
|
+
class: n.element("label")
|
|
155
|
+
}, [m.default()])]);
|
|
152
156
|
return () => {
|
|
153
157
|
var l, a;
|
|
154
|
-
return o("label",
|
|
155
|
-
class:
|
|
156
|
-
style:
|
|
157
|
-
}, H.value), [o("input", {
|
|
158
|
-
|
|
159
|
-
ref: c,
|
|
158
|
+
return o("label", z({
|
|
159
|
+
class: C.value,
|
|
160
|
+
style: c.style
|
|
161
|
+
}, H.value), [o("input", z(I.value, {
|
|
162
|
+
ref: s,
|
|
160
163
|
type: "radio",
|
|
161
164
|
checked: u.value,
|
|
162
165
|
"aria-checked": u.value,
|
|
163
|
-
value:
|
|
164
|
-
name:
|
|
165
|
-
class:
|
|
166
|
-
disabled:
|
|
167
|
-
onClick:
|
|
168
|
-
onChange:
|
|
169
|
-
onFocus:
|
|
170
|
-
onBlur:
|
|
171
|
-
}, null), b.value === "radio" ? ((a =
|
|
166
|
+
value: t.value,
|
|
167
|
+
name: $.value,
|
|
168
|
+
class: n.element("target"),
|
|
169
|
+
disabled: r.value,
|
|
170
|
+
onClick: D,
|
|
171
|
+
onChange: O,
|
|
172
|
+
onFocus: p,
|
|
173
|
+
onBlur: A
|
|
174
|
+
}), null), b.value === "radio" ? ((a = m.radio ?? ((l = e == null ? void 0 : e.slots) == null ? void 0 : l.radio)) == null ? void 0 : a({
|
|
172
175
|
checked: u.value,
|
|
173
|
-
disabled:
|
|
174
|
-
})) ??
|
|
175
|
-
class:
|
|
176
|
-
}, [
|
|
176
|
+
disabled: r.value
|
|
177
|
+
})) ?? M() : o("span", {
|
|
178
|
+
class: n.element("button--content")
|
|
179
|
+
}, [m.default && m.default()])]);
|
|
177
180
|
};
|
|
178
181
|
}
|
|
179
182
|
});
|
|
180
183
|
export {
|
|
181
|
-
|
|
184
|
+
ie as default
|
|
182
185
|
};
|