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