x-next 1.10.0 → 1.11.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 (182) hide show
  1. package/AI_CODING.md +97 -0
  2. package/AI_USAGE/catalog.md +111 -0
  3. package/AI_USAGE/components/alert.md +33 -0
  4. package/AI_USAGE/components/bar-chart.md +46 -0
  5. package/AI_USAGE/components/button.md +35 -0
  6. package/AI_USAGE/components/checkbox.md +34 -0
  7. package/AI_USAGE/components/color-picker.md +36 -0
  8. package/AI_USAGE/components/config-provider.md +58 -0
  9. package/AI_USAGE/components/date-picker.md +34 -0
  10. package/AI_USAGE/components/dialog.md +37 -0
  11. package/AI_USAGE/components/dropdown.md +38 -0
  12. package/AI_USAGE/components/empty.md +30 -0
  13. package/AI_USAGE/components/input.md +32 -0
  14. package/AI_USAGE/components/line-chart.md +45 -0
  15. package/AI_USAGE/components/message-box.md +39 -0
  16. package/AI_USAGE/components/message.md +36 -0
  17. package/AI_USAGE/components/notification.md +37 -0
  18. package/AI_USAGE/components/pagination.md +32 -0
  19. package/AI_USAGE/components/pie-chart.md +55 -0
  20. package/AI_USAGE/components/popconfirm.md +33 -0
  21. package/AI_USAGE/components/popover.md +35 -0
  22. package/AI_USAGE/components/progress.md +32 -0
  23. package/AI_USAGE/components/radio.md +35 -0
  24. package/AI_USAGE/components/rate.md +30 -0
  25. package/AI_USAGE/components/select.md +38 -0
  26. package/AI_USAGE/components/slider.md +34 -0
  27. package/AI_USAGE/components/steps.md +33 -0
  28. package/AI_USAGE/components/switch.md +32 -0
  29. package/AI_USAGE/components/tabs.md +33 -0
  30. package/AI_USAGE/components/textarea.md +31 -0
  31. package/AI_USAGE/components/time-picker.md +34 -0
  32. package/AI_USAGE/components/upload.md +60 -0
  33. package/AI_USAGE/core.md +37 -0
  34. package/AI_USAGE/index.md +52 -0
  35. package/AI_USAGE/recipes/form-on-demand.md +42 -0
  36. package/AI_USAGE.md +173 -46
  37. package/CHANGELOG.md +36 -1
  38. package/README.md +15 -2
  39. package/dist/_container/resize-trigger.vue.d.ts +1 -1
  40. package/dist/_hooks/use-dialog-focus.d.ts +7 -0
  41. package/dist/_hooks/use-pointer-drag.d.ts +6 -0
  42. package/dist/_hooks/use-popup-close.d.ts +11 -0
  43. package/dist/_hooks/use-popup-theme.d.ts +5 -0
  44. package/dist/_utils/palette.d.ts +2 -0
  45. package/dist/components/_components/picker/input-range.vue.d.ts +1 -3
  46. package/dist/components/_components/picker/input.vue.d.ts +1 -3
  47. package/dist/components/_components/select-view/select-view.d.ts +9 -0
  48. package/dist/components/alert/Alert.vue.d.ts +1 -1
  49. package/dist/components/alert/index.d.ts +3 -3
  50. package/dist/components/bar-chart/BarChart.d.ts +3 -3
  51. package/dist/components/bar-chart/index.d.ts +9 -9
  52. package/dist/components/color-picker/ColorPicker.d.ts +2 -1
  53. package/dist/components/color-picker/index.d.ts +2 -0
  54. package/dist/components/color-picker/panel.d.ts +6 -0
  55. package/dist/components/config-provider/context.d.ts +7 -1
  56. package/dist/components/date-picker/DatePicker.vue.d.ts +9 -12
  57. package/dist/components/date-picker/index.d.ts +19 -27
  58. package/dist/components/drawer/index.d.ts +51 -9
  59. package/dist/components/drawer/src/Drawer.vue.d.ts +19 -4
  60. package/dist/components/dropdown/Dropdown.vue.d.ts +6 -3
  61. package/dist/components/dropdown/DropdownButton.vue.d.ts +6 -3
  62. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +6 -3
  63. package/dist/components/dropdown/dropdown-panel.vue.d.ts +6 -3
  64. package/dist/components/dropdown/index.d.ts +36 -18
  65. package/dist/components/form-select/Select.d.ts +18 -5
  66. package/dist/components/form-select/SelectDropdown.vue.d.ts +6 -3
  67. package/dist/components/form-select/SelectOption.vue.d.ts +1 -0
  68. package/dist/components/form-select/SelectOptionGroup.vue.d.ts +1 -0
  69. package/dist/components/form-select/hooks/use-options.d.ts +1 -1
  70. package/dist/components/form-select/hooks/use-select.d.ts +1 -1
  71. package/dist/components/form-select/index.d.ts +57 -17
  72. package/dist/components/form-select/interface.d.ts +8 -0
  73. package/dist/components/form-slider/Slider.vue.d.ts +1 -1
  74. package/dist/components/form-slider/index.d.ts +3 -3
  75. package/dist/components/form-textarea/Textarea.vue.d.ts +2 -4
  76. package/dist/components/form-textarea/index.d.ts +6 -12
  77. package/dist/components/image/Image.vue.d.ts +2 -4
  78. package/dist/components/image/index.d.ts +6 -12
  79. package/dist/components/layout/LayoutSidebar.vue.d.ts +5 -5
  80. package/dist/components/layout/index.d.ts +10 -10
  81. package/dist/components/line-chart/LineChart.d.ts +3 -3
  82. package/dist/components/line-chart/index.d.ts +9 -9
  83. package/dist/components/menu/Menu.d.ts +6 -3
  84. package/dist/components/menu/base-menu.vue.d.ts +6 -3
  85. package/dist/components/menu/index.d.ts +12 -6
  86. package/dist/components/menu/sub-menu-pop.vue.d.ts +6 -3
  87. package/dist/components/network/Network.vue.d.ts +1 -1
  88. package/dist/components/network/index.d.ts +3 -3
  89. package/dist/components/pagination/page-options.vue.d.ts +60 -32
  90. package/dist/components/pie-chart/PieChart.d.ts +1 -1
  91. package/dist/components/pie-chart/index.d.ts +3 -3
  92. package/dist/components/resize-box/ResizeBox.vue.d.ts +2 -2
  93. package/dist/components/resize-box/index.d.ts +5 -5
  94. package/dist/components/scrollbar-v2/Scrollbar.vue.d.ts +2 -1
  95. package/dist/components/scrollbar-v2/index.d.ts +6 -3
  96. package/dist/components/table/Table.d.ts +1 -1
  97. package/dist/components/table/index.d.ts +3 -3
  98. package/dist/components/tabs/Tabs.d.ts +1 -1
  99. package/dist/components/tabs/index.d.ts +3 -3
  100. package/dist/components/time-picker/TimeColumn.vue.d.ts +6 -3
  101. package/dist/components/time-picker/TimePanel.vue.d.ts +6 -3
  102. package/dist/components/time-picker/TimePicker.vue.d.ts +9 -12
  103. package/dist/components/time-picker/index.d.ts +19 -27
  104. package/dist/components/trend-chart/components/TrendChart.d.ts +5 -5
  105. package/dist/components/trend-chart/components/trend-chart-curve.d.ts +1 -1
  106. package/dist/components/trend-chart/index.d.ts +14 -14
  107. package/dist/components/trigger/interface.d.ts +2 -0
  108. package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +7 -4
  109. package/dist/es/_hooks/use-dialog-focus.js +69 -0
  110. package/dist/es/_hooks/use-pointer-drag.js +18 -0
  111. package/dist/es/_hooks/use-popup-close.js +27 -0
  112. package/dist/es/_hooks/use-popup-manager.js +26 -24
  113. package/dist/es/_hooks/use-popup-theme.js +18 -0
  114. package/dist/es/_hooks/use-teleport-container.js +9 -10
  115. package/dist/es/_utils/palette.js +57 -52
  116. package/dist/es/components/_components/select-view/select-view.js +89 -78
  117. package/dist/es/components/button/Button.js +1 -1
  118. package/dist/es/components/color-picker/ColorPicker.js +131 -102
  119. package/dist/es/components/color-picker/gradient-slider.js +38 -40
  120. package/dist/es/components/color-picker/panel.js +221 -192
  121. package/dist/es/components/color-picker/sv-panel.js +51 -50
  122. package/dist/es/components/config-provider/ConfigProvider.js +58 -41
  123. package/dist/es/components/dialog/Dialog.js +133 -186
  124. package/dist/es/components/drawer/src/Drawer.vue.js +59 -51
  125. package/dist/es/components/drawer/src/Drawer.vue2.js +117 -107
  126. package/dist/es/components/form/FormItem.vue.js +12 -12
  127. package/dist/es/components/form-input-tag/InputTag.js +1 -1
  128. package/dist/es/components/form-select/Select.js +348 -300
  129. package/dist/es/components/form-select/SelectDropdown.vue.js +7 -7
  130. package/dist/es/components/form-select/SelectOption.vue.js +22 -17
  131. package/dist/es/components/form-select/SelectOption.vue2.js +59 -51
  132. package/dist/es/components/form-select/SelectOptionGroup.vue.js +17 -13
  133. package/dist/es/components/form-select/SelectOptionGroup.vue2.js +8 -5
  134. package/dist/es/components/form-select/hooks/use-options.js +40 -40
  135. package/dist/es/components/form-select/hooks/use-select.js +76 -71
  136. package/dist/es/components/form-switch/Switch.vue.js +24 -24
  137. package/dist/es/components/image/Image.vue.js +12 -12
  138. package/dist/es/components/link/Link.vue.js +6 -6
  139. package/dist/es/components/menu/sub-menu-inline.vue.js +11 -11
  140. package/dist/es/components/menu/sub-menu-pop.vue.js +12 -12
  141. package/dist/es/components/notification/Notification.js +59 -59
  142. package/dist/es/components/resize-box/ResizeBox.vue.js +19 -22
  143. package/dist/es/components/skeleton/Skeleton.vue.js +9 -9
  144. package/dist/es/components/tag/Tag.vue.js +7 -7
  145. package/dist/es/components/trigger/Trigger.js +171 -163
  146. package/dist/es/style.css +1 -1
  147. package/dist/index.cjs +3 -3
  148. package/dist/index.umd.js +3 -3
  149. package/dist/style/bar-chart.js +1 -0
  150. package/dist/style/base.css +1 -1
  151. package/dist/style/button.css +1 -1
  152. package/dist/style/color-picker.css +1 -1
  153. package/dist/style/color-picker.js +4 -0
  154. package/dist/style/date-picker.js +4 -0
  155. package/dist/style/dependencies.json +296 -0
  156. package/dist/style/dialog.js +2 -0
  157. package/dist/style/drawer.js +3 -0
  158. package/dist/style/dropdown.js +5 -0
  159. package/dist/style/form-checkbox.css +1 -1
  160. package/dist/style/form-input-number.js +2 -0
  161. package/dist/style/form-input.css +1 -1
  162. package/dist/style/form-input.js +1 -0
  163. package/dist/style/form-select.js +5 -0
  164. package/dist/style/form-slider.js +5 -0
  165. package/dist/style/form.js +3 -0
  166. package/dist/style/heatmap.js +1 -0
  167. package/dist/style/image.js +2 -0
  168. package/dist/style/layout.js +1 -0
  169. package/dist/style/line-chart.js +1 -0
  170. package/dist/style/menu.js +3 -0
  171. package/dist/style/message-box.js +3 -0
  172. package/dist/style/pagination.js +9 -0
  173. package/dist/style/pie-chart.js +1 -0
  174. package/dist/style/popconfirm.js +3 -0
  175. package/dist/style/popover.js +1 -0
  176. package/dist/style/popup.js +2 -0
  177. package/dist/style/table.js +12 -0
  178. package/dist/style/time-picker.js +3 -0
  179. package/dist/style/tooltip.js +1 -0
  180. package/dist/style/upload.js +4 -0
  181. package/dist/style.css +1 -1
  182. package/package.json +17 -7
@@ -1,9 +1,9 @@
1
- import { defineComponent as y, ref as p, provide as c, toRefs as s, computed as C, watchPostEffect as v, onBeforeUnmount as h, createVNode as m, Fragment as P, mergeProps as k } from "vue";
2
- import { getClassNameMixin as S } from "../../_utils/config.js";
3
- import { applyThemeColor as j, getThemeColorProperties as N } from "../../_utils/palette.js";
4
- import { localeInjectionKey as T } from "../../locale/index.js";
5
- import { configProviderInjectionKey as b } from "./context.js";
6
- const R = /* @__PURE__ */ y({
1
+ import { defineComponent as z, inject as y, computed as i, provide as g, shallowRef as P, normalizeStyle as v, onBeforeUpdate as b, createVNode as C, Fragment as h, mergeProps as x } from "vue";
2
+ import { getClassNameMixin as N } from "../../_utils/config.js";
3
+ import { getThemeColorStyles as O } from "../../_utils/palette.js";
4
+ import { localeInjectionKey as k } from "../../locale/index.js";
5
+ import { configProviderInjectionKey as S } from "./context.js";
6
+ const K = /* @__PURE__ */ z({
7
7
  name: "ConfigProvider",
8
8
  inheritAttrs: !1,
9
9
  props: {
@@ -48,50 +48,67 @@ const R = /* @__PURE__ */ y({
48
48
  default: "div"
49
49
  }
50
50
  },
51
- setup(e, {
52
- slots: t,
53
- attrs: u
51
+ setup(l, {
52
+ slots: n,
53
+ attrs: d
54
54
  }) {
55
- const g = S("config-provider"), a = p(null);
56
- c(b, {
57
- ...s(e),
58
- slots: t
59
- }), e.locale && c(T, C(() => e.locale));
60
- let l = [];
61
- const f = () => {
62
- const r = a.value;
63
- if (r)
64
- for (const o of l)
65
- r.style.removeProperty(o);
66
- l = [];
67
- };
68
- return v(() => {
69
- const r = e.themeColor, o = e.dark, n = a.value;
70
- f(), !(!n || !r) && (j(r, {
71
- target: n,
72
- dark: o
73
- }), l = N("primary"));
74
- }), h(f), () => {
75
- var i;
55
+ const j = N("config-provider"), t = y(S, void 0), f = y(k, void 0), s = i(() => l.locale ?? (f == null ? void 0 : f.value));
56
+ g(k, s);
57
+ const m = P(v(d.style));
58
+ b(() => {
59
+ m.value = v(d.style);
60
+ });
61
+ const c = i(() => {
62
+ var r;
63
+ const e = (r = t == null ? void 0 : t.popupTheme) == null ? void 0 : r.value;
64
+ if (l.tag === null) return e ?? {
65
+ dark: !1,
66
+ style: {}
67
+ };
68
+ const o = l.dark || (e == null ? void 0 : e.dark) || !1, a = l.themeColor ?? (e == null ? void 0 : e.seed), u = Object.fromEntries(Object.entries(m.value ?? {}).filter(([p]) => p.startsWith("--")));
69
+ return {
70
+ dark: o,
71
+ seed: a,
72
+ style: {
73
+ ...e == null ? void 0 : e.style,
74
+ // An unchanged nested boundary inherits explicit parent overrides too.
75
+ ...a && (l.themeColor !== void 0 || o !== (e == null ? void 0 : e.dark)) ? O(a, o) : {},
76
+ ...u
77
+ }
78
+ };
79
+ });
80
+ return g(S, {
81
+ size: i(() => {
82
+ var e;
83
+ return l.size ?? ((e = t == null ? void 0 : t.size) == null ? void 0 : e.value);
84
+ }),
85
+ locale: s,
86
+ slots: new Proxy(n, {
87
+ get(e, o, a) {
88
+ return Reflect.get(e, o, a) ?? (t == null ? void 0 : t.slots[o]);
89
+ }
90
+ }),
91
+ popupTheme: c
92
+ }), () => {
93
+ var u;
76
94
  const {
77
- class: r,
78
- style: o,
79
- ...n
80
- } = u;
81
- return e.tag === null ? m(P, null, [(i = t.default) == null ? void 0 : i.call(t)]) : m(e.tag, k(n, {
82
- ref: a,
83
- class: [g.block, r],
95
+ class: e,
84
96
  style: o,
85
- "data-theme": e.dark ? "dark" : void 0
97
+ ...a
98
+ } = d;
99
+ return l.tag === null ? C(h, null, [(u = n.default) == null ? void 0 : u.call(n)]) : C(l.tag, x(a, {
100
+ class: [j.block, e],
101
+ style: [o, c.value.style],
102
+ "data-theme": c.value.dark ? "dark" : void 0
86
103
  }), {
87
104
  default: () => {
88
- var d;
89
- return [(d = t.default) == null ? void 0 : d.call(t)];
105
+ var r;
106
+ return [(r = n.default) == null ? void 0 : r.call(n)];
90
107
  }
91
108
  });
92
109
  };
93
110
  }
94
111
  });
95
112
  export {
96
- R as default
113
+ K as default
97
114
  };
@@ -1,224 +1,171 @@
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
- import { addUnit as R } from "../../_utils/helpers.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
- import { KEYBOARD_KEY as j } from "../../_utils/keyboard.js";
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"),
1
+ import { defineComponent as oe, computed as s, ref as C, onBeforeUnmount as le, watch as P, createVNode as l, Teleport as ne, withDirectives as ae, mergeProps as ie, Transition as L, vShow as se } from "vue";
2
+ import { useLocale as de } from "../../locale/index.js";
3
+ import { getComponentPrefix as re, getClassNameMixin as S } from "../../_utils/config.js";
4
+ import { addUnit as _ } from "../../_utils/helpers.js";
5
+ import { isFunction as ce } from "../../_utils/is.js";
6
+ import ue from "../../_hooks/use-popup-manager.js";
7
+ import { useOverflow as me } from "../../_hooks/use-overflow.js";
8
+ import { usePopupClose as fe } from "../../_hooks/use-popup-close.js";
9
+ import { useDialogFocus as be } from "../../_hooks/use-dialog-focus.js";
10
+ import { usePopupTheme as ge } from "../../_hooks/use-popup-theme.js";
11
+ import { KEYBOARD_KEY as ve } from "../../_utils/keyboard.js";
12
+ import { getElement as ye, on as he, off as Ce } from "../../_utils/dom.js";
13
+ import { dialogProps as we } from "./props.js";
14
+ const xe = ["width", "minWidth", "height", "minHeight"];
15
+ let ke = 0;
16
+ const Ie = /* @__PURE__ */ oe({
17
+ name: re("Dialog"),
31
18
  inheritAttrs: !1,
32
- props: ke,
19
+ props: we,
33
20
  slots: Object,
34
21
  emits: ["closed", "close", "open", "opened", "update:modelValue"],
35
- setup(t, {
36
- attrs: o,
37
- emit: s,
22
+ setup(e, {
23
+ attrs: d,
24
+ emit: r,
38
25
  slots: a
39
26
  }) {
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
+ const i = S("dialog"), {
28
+ t: V
29
+ } = de(), A = i.block, {
30
+ popupThemeStyle: N,
31
+ popupThemeName: R
32
+ } = ge(), c = S("message-box"), m = `x-dialog-title-${++ke}`, j = () => [A, e.messageBox && "is-message-box", e.messageBox && c.block, e.popupClass && e.popupClass, d.class], F = () => {
43
33
  const {
44
- class: e,
45
- style: n,
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(() => {
34
+ class: t,
35
+ style: o,
36
+ id: O,
37
+ "aria-label": Te,
38
+ "aria-labelledby": Be,
39
+ "aria-describedby": De,
40
+ ...te
41
+ } = d;
42
+ return te;
43
+ }, f = s(() => {
54
44
  if (!(typeof document > "u"))
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(() => {
59
- const e = {};
60
- return t.fullscreen || (!t.center && t.top && (e.top = R(t.top)), De.forEach((n) => {
61
- t[n] && (e[n] = R(t[n]));
62
- })), e;
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
45
+ return ye(e.renderTo) || document.body;
46
+ }), b = C(), w = C(), I = s(() => e.disabled || !f.value), M = s(() => [N.value, {
47
+ zIndex: U.value
48
+ }, d.style]), z = s(() => {
49
+ const t = {};
50
+ return e.fullscreen || (!e.center && e.top && (t.top = _(e.top)), xe.forEach((o) => {
51
+ e[o] && (t[o] = _(e[o]));
52
+ })), t;
53
+ }), g = C(!1), n = s(() => e.modelValue), x = s(() => n.value || g.value), G = s(() => !e.destroyOnClosed || x.value), H = s(() => x.value), {
54
+ zIndex: U,
55
+ isLastDialog: k,
56
+ close: Y
57
+ } = ue("dialog", {
58
+ visible: n
69
59
  }), {
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
- });
60
+ setOverflowHidden: q,
61
+ resetOverflow: T
62
+ } = me(f, b), W = (t, o) => {
63
+ r("update:modelValue", !1), r("close", t, o);
64
+ };
65
+ let v = !1;
66
+ const {
67
+ focus: $,
68
+ restore: B,
69
+ onKeydown: J
70
+ } = be(n, b, w, s(() => e.mask), k), Q = () => {
71
+ v || n.value || (g.value = !1, T(), B(), r("closed"));
84
72
  }, 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({
89
- preventScroll: !0
90
- });
91
- });
92
- }, Z = () => {
93
- B || (k.value = !1, L(), P(), s("closed"));
94
- }, ee = () => {
95
- s("opened"), X();
96
- }, m = se({
97
- ok: !1,
98
- cancel: !1
99
- }), b = (e, n) => {
100
- let l = !0;
101
- if (m[e] = !0, ye(t.onBeforeCancel))
102
- try {
103
- l = t.onBeforeCancel(e) ?? !1;
104
- } catch {
105
- l = !1;
106
- }
107
- if (he(l)) {
108
- l.then((d) => {
109
- d && O(e, n);
110
- }).catch(() => !1).finally(() => {
111
- m[e] = !1;
112
- });
113
- return;
114
- }
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);
73
+ v || !n.value || (r("opened"), $());
74
+ }, {
75
+ loading: D,
76
+ requestClose: u
77
+ } = fe(n, (t) => {
78
+ if (!ce(e.onBeforeCancel)) return !0;
79
+ const o = e.onBeforeCancel(t);
80
+ return o && typeof o == "object" && "then" in o ? Promise.resolve(o).then((O) => !!O) : !!o;
81
+ }, W), Z = () => {
82
+ e.maskToClose && e.mask && u("cancel");
83
+ }, p = (t) => {
84
+ u("cancel", t);
85
+ }, ee = (t) => {
86
+ u("ok", t);
122
87
  };
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", _));
88
+ let y = !1;
89
+ const E = (t) => {
90
+ e.escToClose && t.key === ve.ESC && k() && u("cancel", t);
128
91
  }, K = () => {
129
- typeof document > "u" || (T = !1, Ee(document.documentElement, "keydown", _));
130
- }, oe = (e) => {
131
- if (e.key !== j.TAB) return;
132
- const n = E.value;
133
- if (!n) return;
134
- const l = G(n);
135
- if (!l.length) {
136
- e.preventDefault(), n.focus({
137
- preventScroll: !0
138
- });
139
- return;
140
- }
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({
145
- preventScroll: !0
146
- })) : (e.preventDefault(), (e.shiftKey ? v : d).focus({
147
- preventScroll: !0
148
- }));
92
+ typeof document > "u" || e.escToClose && !y && (y = !0, he(document.documentElement, "keydown", E));
93
+ }, h = () => {
94
+ typeof document > "u" || (y = !1, Ce(document.documentElement, "keydown", E));
149
95
  };
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();
96
+ return le(() => {
97
+ v = !0, B(), Y(), T(), h();
98
+ }), P(() => n.value, (t) => {
99
+ t ? (r("open"), q(), g.value = !0, K()) : h();
154
100
  }, {
155
101
  immediate: !0
156
- }), V(() => t.escToClose, (e) => {
157
- u.value && (e ? N() : K());
158
- }), () => c(re, {
159
- to: x.value,
160
- disabled: H.value
102
+ }), P(() => e.escToClose, (t) => {
103
+ n.value && (t ? K() : h());
104
+ }), () => l(ne, {
105
+ to: f.value,
106
+ disabled: I.value
161
107
  }, {
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, {
108
+ default: () => [G.value && ae(l("div", ie({
109
+ ref: b,
110
+ "data-theme": R.value,
111
+ class: j(),
112
+ style: M.value,
113
+ id: d.id
114
+ }, F()), [l(L, {
168
115
  name: "x-fade-in-standard",
169
116
  appear: !0
170
117
  }, {
171
- default: () => [t.mask && u.value && c("div", {
118
+ default: () => [e.mask && n.value && l("div", {
172
119
  class: i.element("mask")
173
120
  }, null)]
174
- }), c("div", {
121
+ }), l("div", {
175
122
  class: [i.element("wrapper"), {
176
- "is-center": t.center
123
+ "is-center": e.center
177
124
  }],
178
- onClick: (e) => e.target === e.currentTarget && te()
179
- }, [c(p, {
125
+ onClick: (t) => t.target === t.currentTarget && Z()
126
+ }, [l(L, {
180
127
  name: "x-zoom-in",
181
128
  appear: !0,
182
- onAfterEnter: ee,
183
- onAfterLeave: Z
129
+ onAfterEnter: X,
130
+ onAfterLeave: Q
184
131
  }, {
185
- default: () => [u.value && c("div", {
186
- ref: E,
132
+ default: () => [n.value && l("div", {
133
+ ref: w,
187
134
  class: [i.element("container"), {
188
- "is-fullscreen": t.fullscreen
135
+ "is-fullscreen": e.fullscreen
189
136
  }],
190
- style: Y.value,
137
+ style: z.value,
191
138
  role: "dialog",
192
- "aria-modal": t.mask ? "true" : 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"],
139
+ "aria-modal": e.mask ? "true" : void 0,
140
+ "aria-label": e.title || a.title ? void 0 : d["aria-label"],
141
+ "aria-labelledby": e.title || a.title ? m : d["aria-labelledby"],
142
+ "aria-describedby": d["aria-describedby"],
196
143
  tabindex: -1,
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,
144
+ onKeydown: J
145
+ }, [l("div", {
146
+ class: [e.messageBox ? c.element("header") : i.element("header"), e.showHeaderBottomLine && "is-bottom-line"],
147
+ id: a.title ? m : void 0
148
+ }, [a.title ? a.title() : l("div", {
149
+ id: e.title ? m : void 0,
203
150
  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")]
151
+ }, [e.title])]), l("div", {
152
+ class: [e.messageBox ? c.element("body") : i.element("body")]
153
+ }, [a.default && a.default()]), !e.hideFooter && a.footer && l("div", {
154
+ class: [e.messageBox ? c.element("footer") : i.element("footer")]
208
155
  }, [a.footer({
209
- cancel: ne,
210
- ok: le,
211
- loadingObj: m,
212
- "loading-obj": m
213
- })]), t.showClose && c("button", {
156
+ cancel: p,
157
+ ok: ee,
158
+ loadingObj: D,
159
+ "loading-obj": D
160
+ })]), e.showClose && l("button", {
214
161
  type: "button",
215
- class: [i.element("close-icon"), t.messageBox && f.element("close-icon")],
216
- "aria-label": g("common.closeTarget", {
162
+ class: [i.element("close-icon"), e.messageBox && c.element("close-icon")],
163
+ "aria-label": V("common.closeTarget", {
217
164
  target: "对话框"
218
165
  }),
219
- onClick: (e) => b("cancel", e)
166
+ onClick: (t) => u("cancel", t)
220
167
  }, null)])]
221
- })])]), [[fe, W.value]])]
168
+ })])]), [[se, H.value]])]
222
169
  });
223
170
  }
224
171
  });