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,196 +1,227 @@
1
- import { defineComponent as ne, computed as a, ref as b, reactive as le, onBeforeUnmount as oe, watch as L, createVNode as l, Teleport as ae, withDirectives as se, mergeProps as ie, Transition as P, vShow as ce, nextTick as re } from "vue";
2
- import { useLocale as de } from "../../locale/index.js";
3
- import { getComponentPrefix as ue, getClassNameMixin as V } from "../../_utils/config.js";
1
+ import { defineComponent as ie, computed as r, ref as h, reactive as se, onBeforeUnmount as ce, watch as V, createVNode as c, Teleport as re, withDirectives as de, mergeProps as ue, Transition as p, vShow as fe, nextTick as me } from "vue";
2
+ import { useLocale as be } from "../../locale/index.js";
3
+ import { getComponentPrefix as ve, getClassNameMixin as I } from "../../_utils/config.js";
4
4
  import { addUnit as R } from "../../_utils/helpers.js";
5
- import { isFunction as fe, isPromise as me } from "../../_utils/is.js";
6
- import ve from "../../_hooks/use-popup-manager.js";
7
- import { useOverflow as be } from "../../_hooks/use-overflow.js";
5
+ import { isFunction as ye, isPromise as he } from "../../_utils/is.js";
6
+ import ge from "../../_hooks/use-popup-manager.js";
7
+ import { useOverflow as Ce } from "../../_hooks/use-overflow.js";
8
8
  import { KEYBOARD_KEY as j } from "../../_utils/keyboard.js";
9
- import { getElement as ge, on as ye, off as he } from "../../_utils/dom.js";
10
- import { dialogProps as xe } from "./props.js";
11
- const Ce = ["width", "minWidth", "height", "minHeight"];
12
- let we = 0;
13
- const ke = ["a[href]", "button:not([disabled])", "textarea:not([disabled])", "input:not([disabled])", "select:not([disabled])", '[tabindex]:not([tabindex="-1"])'].join(","), I = (t) => Array.from(t.querySelectorAll(ke)).filter((c) => !c.hasAttribute("disabled") && c.getAttribute("aria-hidden") !== "true"), Ve = /* @__PURE__ */ ne({
14
- name: ue("Dialog"),
9
+ import { getElement as xe, on as we, off as Ee } from "../../_utils/dom.js";
10
+ import { dialogProps as ke } from "./props.js";
11
+ const De = ["width", "minWidth", "height", "minHeight"];
12
+ let Se = 0;
13
+ const Be = ["a[href]", "button:not([disabled])", "textarea:not([disabled])", 'input:not([disabled]):not([type="hidden"])', "select:not([disabled])", "[tabindex]"].join(","), G = (t) => Array.from(t.querySelectorAll(Be)).filter((o) => {
14
+ if (
15
+ // Native control selectors also match negative tabindex; those are programmatic targets only.
16
+ o.tabIndex < 0 || o.matches(':disabled, input[type="hidden"]') || o.closest('[hidden], [inert], [aria-hidden="true"]')
17
+ )
18
+ return !1;
19
+ for (let s = o; s; s = s.parentElement) {
20
+ if (s.matches("fieldset[disabled]") && o.matches("button, input, select, textarea")) {
21
+ const i = Array.from(s.children).find((g) => g.tagName === "LEGEND");
22
+ if (!(i != null && i.contains(o))) return !1;
23
+ }
24
+ const a = window.getComputedStyle(s);
25
+ if (a.display === "none" || a.visibility === "hidden" || a.visibility === "collapse")
26
+ return !1;
27
+ }
28
+ return !0;
29
+ }), Ie = /* @__PURE__ */ ie({
30
+ name: ve("Dialog"),
15
31
  inheritAttrs: !1,
16
- props: xe,
32
+ props: ke,
17
33
  slots: Object,
18
34
  emits: ["closed", "close", "open", "opened", "update:modelValue"],
19
35
  setup(t, {
20
- attrs: c,
21
- emit: u,
22
- slots: i
36
+ attrs: o,
37
+ emit: s,
38
+ slots: a
23
39
  }) {
24
- const s = V("dialog"), {
25
- t: M
26
- } = de(), N = s.block, f = V("message-box"), g = `x-dialog-title-${++we}`, _ = a(() => [N, t.messageBox && "is-message-box", t.messageBox && f.block, t.popupClass && t.popupClass, c.class]), z = a(() => {
40
+ const i = I("dialog"), {
41
+ t: g
42
+ } = be(), M = i.block, f = I("message-box"), C = `x-dialog-title-${++Se}`, z = r(() => [M, t.messageBox && "is-message-box", t.messageBox && f.block, t.popupClass && t.popupClass, o.class]), F = r(() => {
27
43
  const {
28
44
  class: e,
29
45
  style: n,
30
- id: o,
31
- ...d
32
- } = c;
33
- return d;
34
- }), y = a(() => {
46
+ id: l,
47
+ "aria-label": d,
48
+ "aria-labelledby": v,
49
+ "aria-describedby": y,
50
+ ...ae
51
+ } = o;
52
+ return ae;
53
+ }), x = r(() => {
35
54
  if (!(typeof document > "u"))
36
- return ge(t.renderTo) || document.body;
37
- }), E = b(), h = b(), F = a(() => t.disabled || !y.value), G = a(() => [{
38
- zIndex: q.value
39
- }, c.style]), H = a(() => {
55
+ return xe(t.renderTo) || document.body;
56
+ }), w = h(), E = h(), H = r(() => t.disabled || !x.value), U = r(() => [{
57
+ zIndex: $.value
58
+ }, o.style]), Y = r(() => {
40
59
  const e = {};
41
- return t.fullscreen || (!t.center && t.top && (e.top = R(t.top)), Ce.forEach((n) => {
60
+ return t.fullscreen || (!t.center && t.top && (e.top = R(t.top)), De.forEach((n) => {
42
61
  t[n] && (e[n] = R(t[n]));
43
62
  })), e;
44
- }), x = b(!1), r = a(() => t.modelValue), D = a(() => r.value || x.value), U = a(() => !t.destroyOnClosed || D.value), Y = a(() => D.value), {
45
- zIndex: q,
46
- isLastDialog: W
47
- } = ve("dialog", {
48
- visible: r
63
+ }), k = h(!1), u = r(() => t.modelValue), A = r(() => u.value || k.value), q = r(() => !t.destroyOnClosed || A.value), W = r(() => A.value), {
64
+ zIndex: $,
65
+ isLastDialog: D,
66
+ close: J
67
+ } = ge("dialog", {
68
+ visible: u
49
69
  }), {
50
- setOverflowHidden: $,
51
- resetOverflow: B
52
- } = be(y, E), S = (e, n) => {
53
- u("update:modelValue", !1), u("close", e, n);
54
- }, C = b(null), J = () => {
55
- typeof document > "u" || re(() => {
56
- const e = h.value;
57
- if (!e || !r.value) return;
58
- (I(e)[0] || e).focus({
70
+ setOverflowHidden: Q,
71
+ resetOverflow: L
72
+ } = Ce(x, w), O = (e, n) => {
73
+ s("update:modelValue", !1), s("close", e, n);
74
+ }, S = h(null);
75
+ let B = !1;
76
+ const P = () => {
77
+ var l, d;
78
+ const e = S.value;
79
+ if (S.value = null, !(e != null && e.isConnected) || typeof document > "u" || u.value && !D()) return;
80
+ const n = document.activeElement;
81
+ n != null && n.isConnected && n !== document.body && n !== document.documentElement && n !== e && !((l = w.value) != null && l.contains(n)) || (d = e.focus) == null || d.call(e, {
82
+ preventScroll: !0
83
+ });
84
+ }, X = () => {
85
+ typeof document > "u" || me(() => {
86
+ const e = E.value;
87
+ if (!e || !u.value || B || !D()) return;
88
+ (G(e)[0] || e).focus({
59
89
  preventScroll: !0
60
90
  });
61
91
  });
62
- }, Q = () => {
63
- var e, n;
64
- x.value = !1, B(), u("closed"), (n = (e = C.value) == null ? void 0 : e.focus) == null || n.call(e, {
65
- preventScroll: !0
66
- }), C.value = null;
67
- }, X = () => {
68
- u("opened"), J();
69
- }, m = le({
92
+ }, Z = () => {
93
+ B || (k.value = !1, L(), P(), s("closed"));
94
+ }, ee = () => {
95
+ s("opened"), X();
96
+ }, m = se({
70
97
  ok: !1,
71
98
  cancel: !1
72
- }), v = (e, n) => {
73
- let o = !0;
74
- if (m[e] = !0, fe(t.onBeforeCancel))
99
+ }), b = (e, n) => {
100
+ let l = !0;
101
+ if (m[e] = !0, ye(t.onBeforeCancel))
75
102
  try {
76
- o = t.onBeforeCancel(e) ?? !1;
103
+ l = t.onBeforeCancel(e) ?? !1;
77
104
  } catch {
78
- o = !1;
105
+ l = !1;
79
106
  }
80
- if (me(o)) {
81
- o.then((d) => {
82
- d && S(e, n);
107
+ if (he(l)) {
108
+ l.then((d) => {
109
+ d && O(e, n);
83
110
  }).catch(() => !1).finally(() => {
84
111
  m[e] = !1;
85
112
  });
86
113
  return;
87
114
  }
88
- m[e] = !1, o && S(e, n);
89
- }, Z = () => {
90
- t.maskToClose && t.mask && v("cancel");
91
- }, p = (e) => {
92
- v("cancel", e);
93
- }, ee = (e) => {
94
- v("ok", e);
115
+ m[e] = !1, l && O(e, n);
116
+ }, te = () => {
117
+ t.maskToClose && t.mask && b("cancel");
118
+ }, ne = (e) => {
119
+ b("cancel", e);
120
+ }, le = (e) => {
121
+ b("ok", e);
95
122
  };
96
- let w = !1;
97
- const T = (e) => {
98
- t.escToClose && e.key === j.ESC && W() && v("cancel", e);
99
- }, A = () => {
100
- typeof document > "u" || t.escToClose && !w && (w = !0, ye(document.documentElement, "keydown", T));
101
- }, k = () => {
102
- typeof document > "u" || (w = !1, he(document.documentElement, "keydown", T));
103
- }, te = (e) => {
123
+ let T = !1;
124
+ const _ = (e) => {
125
+ t.escToClose && e.key === j.ESC && D() && b("cancel", e);
126
+ }, N = () => {
127
+ typeof document > "u" || t.escToClose && !T && (T = !0, we(document.documentElement, "keydown", _));
128
+ }, K = () => {
129
+ typeof document > "u" || (T = !1, Ee(document.documentElement, "keydown", _));
130
+ }, oe = (e) => {
104
131
  if (e.key !== j.TAB) return;
105
- const n = h.value;
132
+ const n = E.value;
106
133
  if (!n) return;
107
- const o = I(n);
108
- if (!o.length) {
134
+ const l = G(n);
135
+ if (!l.length) {
109
136
  e.preventDefault(), n.focus({
110
137
  preventScroll: !0
111
138
  });
112
139
  return;
113
140
  }
114
- const d = o[0], K = o[o.length - 1], O = document.activeElement;
115
- e.shiftKey && O === d ? (e.preventDefault(), K.focus({
141
+ const d = l[0], v = l[l.length - 1], y = document.activeElement;
142
+ l.includes(y) ? e.shiftKey && y === d ? (e.preventDefault(), v.focus({
143
+ preventScroll: !0
144
+ })) : !e.shiftKey && y === v && (e.preventDefault(), d.focus({
116
145
  preventScroll: !0
117
- })) : !e.shiftKey && O === K && (e.preventDefault(), d.focus({
146
+ })) : (e.preventDefault(), (e.shiftKey ? v : d).focus({
118
147
  preventScroll: !0
119
148
  }));
120
149
  };
121
- return oe(() => {
122
- B(), k();
123
- }), L(() => r.value, (e) => {
124
- e ? (C.value = typeof document > "u" ? null : document.activeElement, u("open"), $(), x.value = !0, A()) : k();
150
+ return ce(() => {
151
+ B = !0, P(), J(), L(), K();
152
+ }), V(() => u.value, (e) => {
153
+ e ? (S.value = typeof document > "u" ? null : document.activeElement, s("open"), Q(), k.value = !0, N()) : K();
125
154
  }, {
126
155
  immediate: !0
127
- }), L(() => t.escToClose, (e) => {
128
- r.value && (e ? A() : k());
129
- }), () => l(ae, {
130
- to: y.value,
131
- disabled: F.value
156
+ }), V(() => t.escToClose, (e) => {
157
+ u.value && (e ? N() : K());
158
+ }), () => c(re, {
159
+ to: x.value,
160
+ disabled: H.value
132
161
  }, {
133
- default: () => [U.value && se(l("div", ie({
134
- ref: E,
135
- class: _.value,
136
- style: G.value,
137
- id: c.id
138
- }, z.value), [l(P, {
162
+ default: () => [q.value && de(c("div", ue({
163
+ ref: w,
164
+ class: z.value,
165
+ style: U.value,
166
+ id: o.id
167
+ }, F.value), [c(p, {
139
168
  name: "x-fade-in-standard",
140
169
  appear: !0
141
170
  }, {
142
- default: () => [t.mask && r.value && l("div", {
143
- class: s.element("mask")
171
+ default: () => [t.mask && u.value && c("div", {
172
+ class: i.element("mask")
144
173
  }, null)]
145
- }), l("div", {
146
- class: [s.element("wrapper"), {
174
+ }), c("div", {
175
+ class: [i.element("wrapper"), {
147
176
  "is-center": t.center
148
177
  }],
149
- onClick: (e) => e.target === e.currentTarget && Z()
150
- }, [l(P, {
178
+ onClick: (e) => e.target === e.currentTarget && te()
179
+ }, [c(p, {
151
180
  name: "x-zoom-in",
152
181
  appear: !0,
153
- onAfterEnter: X,
154
- onAfterLeave: Q
182
+ onAfterEnter: ee,
183
+ onAfterLeave: Z
155
184
  }, {
156
- default: () => [r.value && l("div", {
157
- ref: h,
158
- class: [s.element("container"), {
185
+ default: () => [u.value && c("div", {
186
+ ref: E,
187
+ class: [i.element("container"), {
159
188
  "is-fullscreen": t.fullscreen
160
189
  }],
161
- style: H.value,
190
+ style: Y.value,
162
191
  role: "dialog",
163
192
  "aria-modal": t.mask ? "true" : void 0,
164
- "aria-labelledby": t.title || i.title ? g : void 0,
193
+ "aria-label": t.title || a.title ? void 0 : o["aria-label"],
194
+ "aria-labelledby": t.title || a.title ? C : o["aria-labelledby"],
195
+ "aria-describedby": o["aria-describedby"],
165
196
  tabindex: -1,
166
- onKeydown: te
167
- }, [l("div", {
168
- class: [t.messageBox ? f.element("header") : s.element("header"), t.showHeaderBottomLine && "is-bottom-line"],
169
- id: i.title ? g : void 0
170
- }, [i.title ? i.title() : l("div", {
171
- id: t.title ? g : void 0,
172
- class: [s.element("header-title")]
173
- }, [t.title])]), l("div", {
174
- class: [t.messageBox ? f.element("body") : s.element("body")]
175
- }, [i.default && i.default()]), !t.hideFooter && i.footer && l("div", {
176
- class: [t.messageBox ? f.element("footer") : s.element("footer")]
177
- }, [i.footer({
178
- cancel: p,
179
- ok: ee,
197
+ onKeydown: oe
198
+ }, [c("div", {
199
+ class: [t.messageBox ? f.element("header") : i.element("header"), t.showHeaderBottomLine && "is-bottom-line"],
200
+ id: a.title ? C : void 0
201
+ }, [a.title ? a.title() : c("div", {
202
+ id: t.title ? C : void 0,
203
+ class: [i.element("header-title")]
204
+ }, [t.title])]), c("div", {
205
+ class: [t.messageBox ? f.element("body") : i.element("body")]
206
+ }, [a.default && a.default()]), !t.hideFooter && a.footer && c("div", {
207
+ class: [t.messageBox ? f.element("footer") : i.element("footer")]
208
+ }, [a.footer({
209
+ cancel: ne,
210
+ ok: le,
180
211
  loadingObj: m,
181
212
  "loading-obj": m
182
- })]), t.showClose && l("button", {
213
+ })]), t.showClose && c("button", {
183
214
  type: "button",
184
- class: [s.element("close-icon"), t.messageBox && f.element("close-icon")],
185
- "aria-label": M("common.closeTarget", {
215
+ class: [i.element("close-icon"), t.messageBox && f.element("close-icon")],
216
+ "aria-label": g("common.closeTarget", {
186
217
  target: "对话框"
187
218
  }),
188
- onClick: (e) => v("cancel", e)
219
+ onClick: (e) => b("cancel", e)
189
220
  }, null)])]
190
- })])]), [[ce, Y.value]])]
221
+ })])]), [[fe, W.value]])]
191
222
  });
192
223
  }
193
224
  });
194
225
  export {
195
- Ve as default
226
+ Ie as default
196
227
  };
@@ -1,9 +1,9 @@
1
- import r from "./Dropdown.vue2.js";
2
- import { resolveComponent as t, openBlock as s, createBlock as a, withCtx as e, renderSlot as n, createVNode as l, createSlots as m } from "vue";
1
+ import l from "./Dropdown.vue2.js";
2
+ import { resolveComponent as n, openBlock as a, createBlock as d, withCtx as e, createVNode as i, createSlots as m, renderSlot as t } from "vue";
3
3
  import f from "../../_virtual/_plugin-vue_export-helper.js";
4
- function d(o, g, u, c, h, $) {
5
- const i = t("DropdownPanel"), p = t("Trigger");
6
- return s(), a(p, {
4
+ function g(o, u, c, h, b, y) {
5
+ const p = n("RenderFunction"), r = n("DropdownPanel"), s = n("Trigger");
6
+ return a(), d(s, {
7
7
  "popup-visible": o.computedPopupVisible,
8
8
  "animation-name": "x-slide-dynamic-origin",
9
9
  "auto-fit-transform-origin": "",
@@ -13,10 +13,13 @@ function d(o, g, u, c, h, $) {
13
13
  "popup-offset": 4,
14
14
  "popup-container": o.popupContainer,
15
15
  "opened-class": o.className.modifier("open"),
16
- onPopupVisibleChange: o.handlePopupVisibleChange
16
+ onPopupVisibleChange: o.handlePopupVisibleChange,
17
+ onShow: o.handleShow
17
18
  }, {
18
19
  content: e(() => [
19
- l(i, {
20
+ i(r, {
21
+ ref: "panelRef",
22
+ onClose: o.handleClose,
20
23
  loading: o.loading,
21
24
  "is-empty": o.isEmpty,
22
25
  "bottom-offset": o.bottomOffset,
@@ -24,33 +27,33 @@ function d(o, g, u, c, h, $) {
24
27
  onReachBottom: o.handleReachBottom
25
28
  }, m({
26
29
  default: e(() => [
27
- n(o.$slots, "content")
30
+ t(o.$slots, "content")
28
31
  ]),
29
32
  _: 2
30
33
  }, [
31
34
  o.$slots.empty ? {
32
35
  name: "empty",
33
36
  fn: e(() => [
34
- n(o.$slots, "empty")
37
+ t(o.$slots, "empty")
35
38
  ]),
36
39
  key: "0"
37
40
  } : void 0,
38
41
  o.$slots.footer ? {
39
42
  name: "footer",
40
43
  fn: e(() => [
41
- n(o.$slots, "footer")
44
+ t(o.$slots, "footer")
42
45
  ]),
43
46
  key: "1"
44
47
  } : void 0
45
- ]), 1032, ["loading", "is-empty", "bottom-offset", "onScroll", "onReachBottom"])
48
+ ]), 1032, ["onClose", "loading", "is-empty", "bottom-offset", "onScroll", "onReachBottom"])
46
49
  ]),
47
50
  default: e(() => [
48
- n(o.$slots, "default")
51
+ i(p, { "render-func": o.renderTrigger }, null, 8, ["render-func"])
49
52
  ]),
50
53
  _: 3
51
- }, 8, ["popup-visible", "trigger", "position", "align-point", "popup-container", "opened-class", "onPopupVisibleChange"]);
54
+ }, 8, ["popup-visible", "trigger", "position", "align-point", "popup-container", "opened-class", "onPopupVisibleChange", "onShow"]);
52
55
  }
53
- const C = /* @__PURE__ */ f(r, [["render", d]]);
56
+ const w = /* @__PURE__ */ f(l, [["render", g]]);
54
57
  export {
55
- C as default
58
+ w as default
56
59
  };
@@ -1,14 +1,19 @@
1
- import { defineComponent as c, toRefs as m, provide as g, reactive as b } from "vue";
2
- import { Trigger as y } from "../trigger/index.js";
3
- import h from "./dropdown-panel.vue.js";
4
- import { useTrigger as B } from "../../_hooks/use-trigger.js";
5
- import { dropdownInjectionKey as v } from "./context.js";
6
- import { getClassNameMixin as V } from "../../_utils/config.js";
7
- const N = c({
1
+ import { defineComponent as v, toRefs as B, provide as C, reactive as w } from "vue";
2
+ import { Trigger as V } from "../trigger/index.js";
3
+ import F from "./dropdown-panel.vue.js";
4
+ import { useTrigger as S } from "../../_hooks/use-trigger.js";
5
+ import { dropdownInjectionKey as O } from "./context.js";
6
+ import { getClassNameMixin as P } from "../../_utils/config.js";
7
+ import T from "../../_container/render-function.js";
8
+ import { useFirstElement as k } from "../../_hooks/use-first-element.js";
9
+ import { mergeFirstChild as K } from "../../_utils/vue-eco.js";
10
+ import { useDropdownKeyboard as x } from "./use-keyboard.js";
11
+ const q = v({
8
12
  name: "Dropdown",
9
13
  components: {
10
- Trigger: y,
11
- DropdownPanel: h
14
+ Trigger: V,
15
+ DropdownPanel: F,
16
+ RenderFunction: T
12
17
  },
13
18
  props: {
14
19
  /**
@@ -113,7 +118,7 @@ const N = c({
113
118
  * @param {string | number | Record<string, any> | undefined } value
114
119
  * @param {Event} ev
115
120
  */
116
- select: (e, o) => !0,
121
+ select: (e, t) => !0,
117
122
  /**
118
123
  * @zh 下拉菜单滚动时触发
119
124
  * @en Triggered when the dropdown scrolls
@@ -143,33 +148,49 @@ const N = c({
143
148
  * @en Empty content
144
149
  * @slot empty
145
150
  */
146
- setup(e, { emit: o }) {
147
- const { defaultPopupVisible: l, popupVisible: i, popupMaxHeight: a } = m(e), n = V("dropdown"), { computedPopupVisible: r, handlePopupVisibleChange: p } = B({
148
- defaultPopupVisible: l,
149
- popupVisible: i,
150
- emit: o
151
- }), s = (t, f) => {
152
- o("select", t, f), e.hideOnSelect && p(!1);
153
- }, u = (t) => {
154
- o("scroll", t);
155
- }, d = (t) => {
156
- o("reachBottom", t);
151
+ setup(e, { emit: t, slots: n }) {
152
+ const { defaultPopupVisible: d, popupVisible: s, popupMaxHeight: c } = B(e), f = P("dropdown"), { computedPopupVisible: a, handlePopupVisibleChange: p } = S({
153
+ defaultPopupVisible: d,
154
+ popupVisible: s,
155
+ emit: t
156
+ }), { children: l, firstElement: m } = k(), r = x(
157
+ a,
158
+ p,
159
+ m
160
+ ), g = (o) => {
161
+ var i;
162
+ return l.value = ((i = n.default) == null ? void 0 : i.call(n)) ?? [], K(l.value, {
163
+ ...o,
164
+ onKeydown: (u) => {
165
+ u.key !== "ArrowRight" && r.handleTriggerKeydown(u);
166
+ },
167
+ onFocusinCapture: r.handleTriggerFocus,
168
+ onFocusoutCapture: r.handleTriggerFocus
169
+ }), l.value;
170
+ }, h = (o, i) => {
171
+ t("select", o, i), e.hideOnSelect && (r.handleKeyboardSelect(i), p(!1));
172
+ }, y = (o) => {
173
+ t("scroll", o);
174
+ }, b = (o) => {
175
+ t("reachBottom", o);
157
176
  };
158
- return g(
159
- v,
160
- b({
161
- popupMaxHeight: a,
162
- onOptionClick: s
177
+ return C(
178
+ O,
179
+ w({
180
+ popupMaxHeight: c,
181
+ onOptionClick: h
163
182
  })
164
183
  ), {
165
- className: n,
166
- computedPopupVisible: r,
184
+ ...r,
185
+ renderTrigger: g,
186
+ className: f,
187
+ computedPopupVisible: a,
167
188
  handlePopupVisibleChange: p,
168
- handleScroll: u,
169
- handleReachBottom: d
189
+ handleScroll: y,
190
+ handleReachBottom: b
170
191
  };
171
192
  }
172
193
  });
173
194
  export {
174
- N as default
195
+ q as default
175
196
  };
@@ -1,37 +1,38 @@
1
- import d from "./DropdownOption.vue2.js";
2
- import { openBlock as n, createElementBlock as a, normalizeClass as o, renderSlot as i, createCommentVNode as r, createElementVNode as t } from "vue";
3
- import f from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = ["aria-disabled", "tabindex"];
5
- function p(e, s, u, $, k, b) {
6
- return n(), a("li", {
1
+ import r from "./DropdownOption.vue2.js";
2
+ import { openBlock as l, createElementBlock as a, normalizeClass as n, renderSlot as i, createCommentVNode as d, createElementVNode as f } from "vue";
3
+ import m from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const t = ["aria-disabled", "tabindex"];
5
+ function u(e, s, p, $, k, b) {
6
+ return l(), a("li", {
7
7
  ref: "liRef",
8
- class: o([e.cls, { [e.className.modifier("has-suffix")]: !!e.$slots.suffix }]),
8
+ class: n([e.cls, { [e.className.modifier("has-suffix")]: !!e.$slots.suffix }]),
9
9
  role: "menuitem",
10
10
  "aria-disabled": e.disabled,
11
- tabindex: e.disabled ? -1 : 0,
12
- onClick: s[0] || (s[0] = (...l) => e.handleClick && e.handleClick(...l)),
13
- onKeydown: s[1] || (s[1] = (...l) => e.handleKeydown && e.handleKeydown(...l))
11
+ tabindex: e.tabIndex,
12
+ onFocus: s[0] || (s[0] = (...o) => e.handleFocus && e.handleFocus(...o)),
13
+ onClick: s[1] || (s[1] = (...o) => e.handleClick && e.handleClick(...o)),
14
+ onKeydown: s[2] || (s[2] = (...o) => e.handleKeydown && e.handleKeydown(...o))
14
15
  }, [
15
- e.$slots.icon ? (n(), a("span", {
16
+ e.$slots.icon ? (l(), a("span", {
16
17
  key: 0,
17
- class: o(e.className.element("icon"))
18
+ class: n(e.className.element("icon"))
18
19
  }, [
19
20
  i(e.$slots, "icon")
20
- ], 2)) : r("", !0),
21
- t("span", {
22
- class: o(e.className.element("content"))
21
+ ], 2)) : d("", !0),
22
+ f("span", {
23
+ class: n(e.className.element("content"))
23
24
  }, [
24
25
  i(e.$slots, "default")
25
26
  ], 2),
26
- e.$slots.suffix ? (n(), a("span", {
27
+ e.$slots.suffix ? (l(), a("span", {
27
28
  key: 1,
28
- class: o(e.className.element("suffix"))
29
+ class: n(e.className.element("suffix"))
29
30
  }, [
30
31
  i(e.$slots, "suffix")
31
- ], 2)) : r("", !0)
32
- ], 42, m);
32
+ ], 2)) : d("", !0)
33
+ ], 42, t);
33
34
  }
34
- const C = /* @__PURE__ */ f(d, [["render", p]]);
35
+ const w = /* @__PURE__ */ m(r, [["render", u]]);
35
36
  export {
36
- C as default
37
+ w as default
37
38
  };