x-next 1.2.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 (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/dropdown/Dropdown.vue.d.ts +27 -1
  3. package/dist/components/dropdown/DropdownButton.vue.d.ts +27 -1
  4. package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
  5. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +158 -1
  6. package/dist/components/dropdown/context.d.ts +14 -1
  7. package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
  8. package/dist/components/dropdown/index.d.ts +588 -6
  9. package/dist/components/dropdown/use-keyboard.d.ts +10 -0
  10. package/dist/components/form-select/hooks/use-select.d.ts +2 -1
  11. package/dist/es/_hooks/use-overflow.js +45 -40
  12. package/dist/es/components/_components/select-view/select-view.js +49 -55
  13. package/dist/es/components/dialog/Dialog.js +106 -97
  14. package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
  15. package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
  16. package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
  17. package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
  18. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
  19. package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
  20. package/dist/es/components/dropdown/context.js +3 -2
  21. package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
  22. package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
  23. package/dist/es/components/dropdown/use-keyboard.js +45 -0
  24. package/dist/es/components/form-checkbox/Checkbox.js +49 -49
  25. package/dist/es/components/form-select/Select.js +25 -24
  26. package/dist/es/components/form-select/hooks/use-select.js +128 -128
  27. package/dist/es/style.css +1 -1
  28. package/dist/index.cjs +4 -4
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.umd.js +4 -4
  31. package/dist/style/base.css +1 -1
  32. package/dist/style.css +1 -1
  33. package/package.json +1 -1
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'vue';
2
+ import { DropdownPanelRef } from './context';
3
+ export declare const useDropdownKeyboard: (visible: Readonly<Ref<boolean>>, changeVisible: (visible: boolean) => void, triggerElement: Ref<HTMLElement | undefined>, disabled?: () => boolean) => {
4
+ panelRef: Ref<DropdownPanelRef | undefined, DropdownPanelRef | undefined>;
5
+ handleShow: () => void;
6
+ handleTriggerKeydown: (ev: KeyboardEvent) => void;
7
+ handleTriggerFocus: (ev: FocusEvent) => void;
8
+ handleClose: () => void;
9
+ handleKeyboardSelect: (ev: Event) => void;
10
+ };
@@ -1,7 +1,7 @@
1
1
  import { ComponentPublicInstance, Ref } from 'vue';
2
2
  import { FilterOption, SelectOption, SelectFieldNames } from '../interface';
3
3
  import { VirtualListRef } from '../../virtual-list-v2/interface';
4
- export declare const useSelect: ({ multiple, options, extraOptions, inputValue, filterOption, showExtraOptions, component, valueKey, fieldNames, loading, popupVisible, valueKeys, dropdownRef, optionRefs, virtualListRef, onSelect, onPopupVisibleChange, getOptionId, enterToOpen, defaultActiveFirstOption, }: {
4
+ export declare const useSelect: ({ multiple, options, extraOptions, inputValue, filterOption, showExtraOptions, component, valueKey, fieldNames, loading, disabled, popupVisible, valueKeys, dropdownRef, optionRefs, virtualListRef, onSelect, onPopupVisibleChange, getOptionId, enterToOpen, defaultActiveFirstOption, }: {
5
5
  multiple?: Ref<boolean>;
6
6
  options?: Ref<SelectOption[]>;
7
7
  extraOptions?: Ref<SelectOption[]>;
@@ -12,6 +12,7 @@ export declare const useSelect: ({ multiple, options, extraOptions, inputValue,
12
12
  valueKey?: Ref<string>;
13
13
  fieldNames?: Ref<SelectFieldNames | undefined>;
14
14
  loading?: Ref<boolean>;
15
+ disabled?: Ref<boolean>;
15
16
  popupVisible: Ref<boolean>;
16
17
  valueKeys: Ref<string[]>;
17
18
  dropdownRef?: Ref<ComponentPublicInstance | undefined>;
@@ -1,46 +1,51 @@
1
- import { watch as u } from "vue";
2
- import { setStyle as i, getStyle as h, getScrollBarWidth as c, isScroll as a } from "../_utils/dom.js";
3
- const y = (o, s) => {
4
- let t = !1;
5
- const e = {
6
- overflow: "",
7
- width: ""
8
- }, w = (l) => l.tagName === "BODY", r = () => {
9
- if (o.value) {
10
- const l = o.value;
11
- if (!t && l.style.overflow !== "hidden") {
12
- const v = c(l);
13
- if (v > 0 || a(l)) {
14
- e.overflow = l.style.overflow, e.width = l.style.width;
15
- let d = 0;
16
- w(l) && (d = l.getBoundingClientRect().left || 0), i(l, {
17
- width: `calc(100% - ${Math.ceil(v - d)}px)`,
18
- overflow: "hidden"
19
- }), t = !0;
20
- }
21
- }
22
- }
23
- }, f = () => {
24
- if (o.value && t) {
25
- const l = o.value;
26
- i(l, {
27
- overflow: e.overflow,
28
- width: e.width
29
- }), t = !1;
1
+ import { watch as h, onBeforeUnmount as P } from "vue";
2
+ import { setStyle as y, getScrollBarWidth as g, isScroll as k, getStyle as B } from "../_utils/dom.js";
3
+ const e = /* @__PURE__ */ new WeakMap(), d = (o) => o.tagName === "BODY", l = (o, t) => ({
4
+ value: o.style.getPropertyValue(t),
5
+ priority: o.style.getPropertyPriority(t)
6
+ }), p = (o, t, i) => {
7
+ i.value ? o.style.setProperty(t, i.value, i.priority) : o.style.removeProperty(t);
8
+ }, S = (o) => {
9
+ const t = e.get(o);
10
+ if (t) {
11
+ t.count++;
12
+ return;
13
+ }
14
+ const i = { count: 1, styles: /* @__PURE__ */ new Map() };
15
+ if (e.set(o, i), o.style.overflow !== "hidden") {
16
+ const s = g(o);
17
+ if (s > 0 || k(o)) {
18
+ i.styles.set("overflow", l(o, "overflow")), i.styles.set("width", l(o, "width"));
19
+ const r = d(o) && o.getBoundingClientRect().left || 0;
20
+ y(o, {
21
+ width: `calc(100% - ${Math.ceil(s - r)}px)`,
22
+ overflow: "hidden"
23
+ });
30
24
  }
25
+ }
26
+ !d(o) && B(o, "position") === "static" && (i.styles.set("position", l(o, "position")), y(o, { position: "relative" }));
27
+ }, C = (o) => {
28
+ const t = e.get(o);
29
+ !t || --t.count > 0 || (t.styles.forEach((i, s) => p(o, s, i)), e.delete(o));
30
+ }, M = (o, t) => {
31
+ let i = !1, s, r, n;
32
+ const u = () => {
33
+ r && n && p(r, "position", n), r = void 0, n = void 0;
34
+ }, a = () => {
35
+ const f = i ? o.value : void 0;
36
+ f !== s && (u(), s && C(s), s = f, s && S(s));
37
+ const c = s && !d(s) ? t == null ? void 0 : t.value : void 0;
38
+ c !== r && (u(), c && (r = c, n = l(c, "position"), y(c, { position: "absolute" })));
39
+ }, w = () => {
40
+ i = !0, a();
41
+ }, v = () => {
42
+ i = !1, a();
31
43
  };
32
- return u(
33
- () => s == null ? void 0 : s.value,
34
- (l) => {
35
- o.value && !w(o.value) && (l && i(l, {
36
- position: "absolute"
37
- }), h(o.value, "position") === "static" && i(o.value, { position: "relative" }));
38
- }
39
- ), {
40
- setOverflowHidden: r,
41
- resetOverflow: f
44
+ return h([o, () => t == null ? void 0 : t.value], a, { flush: "post" }), P(v), {
45
+ setOverflowHidden: w,
46
+ resetOverflow: v
42
47
  };
43
48
  };
44
49
  export {
45
- y as useOverflow
50
+ M as useOverflow
46
51
  };
@@ -1,18 +1,18 @@
1
- import { defineComponent as L, toRefs as B, ref as H, computed as i, watch as M, createVNode as o, Fragment as P } from "vue";
2
- import { isArray as q } from "../../../_utils/is.js";
3
- import O from "../feedback-icon/index.vue.js";
4
- import _ from "../input-label/input-label.js";
5
- import { InputTag as $ } from "../../form-input-tag/index.js";
6
- import G from "../icon-hover/index.vue.js";
7
- import J from "../../../icons/_self/down.js";
8
- import Q from "../../../icons/animation/animation-loading.js";
9
- import U from "../../../icons/default/close.js";
10
- import W from "../../../icons/_self/search.js";
11
- import { useFormItem as X, useFormItemControl as Y } from "../../../_hooks/use-form-item.js";
12
- import { useLocale as Z } from "../../../locale/index.js";
13
- import { useSize as ee } from "../../../_hooks/use-size.js";
14
- import { getClassNameMixin as le } from "../../../_utils/config.js";
15
- const he = /* @__PURE__ */ L({
1
+ import { defineComponent as E, toRefs as H, ref as B, computed as i, createVNode as o, Fragment as M } from "vue";
2
+ import { isArray as P } from "../../../_utils/is.js";
3
+ import q from "../feedback-icon/index.vue.js";
4
+ import O from "../input-label/input-label.js";
5
+ import { InputTag as _ } from "../../form-input-tag/index.js";
6
+ import $ from "../icon-hover/index.vue.js";
7
+ import G from "../../../icons/_self/down.js";
8
+ import J from "../../../icons/animation/animation-loading.js";
9
+ import Q from "../../../icons/default/close.js";
10
+ import U from "../../../icons/_self/search.js";
11
+ import { useFormItem as W, useFormItemControl as X } from "../../../_hooks/use-form-item.js";
12
+ import { useLocale as Y } from "../../../locale/index.js";
13
+ import { useSize as Z } from "../../../_hooks/use-size.js";
14
+ import { getClassNameMixin as ee } from "../../../_utils/config.js";
15
+ const be = /* @__PURE__ */ E({
16
16
  name: "SelectView",
17
17
  props: {
18
18
  modelValue: {
@@ -58,7 +58,7 @@ const he = /* @__PURE__ */ L({
58
58
  },
59
59
  allowSearch: {
60
60
  type: Boolean,
61
- default: (e) => q(e.modelValue)
61
+ default: (e) => P(e.modelValue)
62
62
  },
63
63
  maxTagCount: {
64
64
  type: Number,
@@ -90,118 +90,112 @@ const he = /* @__PURE__ */ L({
90
90
  size: S,
91
91
  disabled: x,
92
92
  error: F
93
- } = B(e), u = le("select--view"), {
93
+ } = H(e), u = ee("select--view"), {
94
94
  formItemCtx: R,
95
95
  feedback: p,
96
96
  eventHandlers: c,
97
97
  mergedDisabled: g,
98
98
  mergedSize: z,
99
99
  mergedError: b
100
- } = X({
100
+ } = W({
101
101
  size: S,
102
102
  disabled: x,
103
103
  error: F
104
- }), h = Y(R, () => e.inputAttrs ?? {}), {
104
+ }), v = X(R, () => e.inputAttrs ?? {}), {
105
105
  t: A
106
- } = Z(), {
107
- mergedSize: v
108
- } = ee(z), {
109
- opened: N
110
- } = B(e), m = H(), d = i(
106
+ } = Y(), {
107
+ mergedSize: h
108
+ } = Z(z), d = B(!1), f = B(), k = i(
111
109
  // @ts-ignore
112
110
  () => {
113
111
  var l;
114
- return (l = m.value) == null ? void 0 : l.inputRef;
112
+ return (l = f.value) == null ? void 0 : l.inputRef;
115
113
  }
116
- ), k = i(() => e.modelValue.length === 0), T = i(() => e.allowSearch || e.allowCreate), j = i(() => e.allowClear && !e.disabled && !k.value && e.modelValue.some((l) => l.closable !== !1)), f = (l) => {
114
+ ), N = i(() => e.modelValue.length === 0), T = i(() => e.allowSearch || e.allowCreate), j = i(() => e.allowClear && !e.disabled && !N.value && e.modelValue.some((l) => l.closable !== !1)), m = (l) => {
117
115
  var a, t;
118
- r("focus", l), (t = (a = c.value) == null ? void 0 : a.onFocus) == null || t.call(a, l);
116
+ d.value = !0, r("focus", l), (t = (a = c.value) == null ? void 0 : a.onFocus) == null || t.call(a, l);
119
117
  }, s = (l) => {
120
118
  var a, t;
121
- r("blur", l), (t = (a = c.value) == null ? void 0 : a.onBlur) == null || t.call(a, l);
119
+ d.value = !1, r("blur", l), (t = (a = c.value) == null ? void 0 : a.onBlur) == null || t.call(a, l);
122
120
  }, D = (l) => {
123
121
  r("remove", String(l));
124
- }, E = (l) => {
122
+ }, K = (l) => {
125
123
  l.stopPropagation(), r("clear", l);
126
124
  }, w = (l, a) => {
127
125
  var t, I;
128
126
  r("inputValueChange", l, a), (I = (t = c.value) == null ? void 0 : t.onInput) == null || I.call(t, a);
129
127
  }, C = (l) => {
130
128
  r("keydown", l);
131
- }, K = () => {
129
+ }, L = () => {
132
130
  var l, a;
133
- return e.loading ? ((l = n["loading-icon"]) == null ? void 0 : l.call(n)) ?? o(Q, null, null) : e.allowSearch && e.opened ? ((a = n["search-icon"]) == null ? void 0 : a.call(n)) ?? o(W, null, null) : n["arrow-icon"] ? n["arrow-icon"]() : o(J, {
131
+ return e.loading ? ((l = n["loading-icon"]) == null ? void 0 : l.call(n)) ?? o(J, null, null) : e.allowSearch && e.opened ? ((a = n["search-icon"]) == null ? void 0 : a.call(n)) ?? o(U, null, null) : n["arrow-icon"] ? n["arrow-icon"]() : o(G, {
134
132
  class: u.element("arrow-icon")
135
133
  }, null);
136
- }, V = () => o(P, null, [j.value && o(G, {
134
+ }, V = () => o(M, null, [j.value && o($, {
137
135
  as: "button",
138
136
  "aria-label": A("common.clearTarget", {
139
137
  target: "选择"
140
138
  }),
141
139
  class: u.element("clear-btn"),
142
- onClick: E,
140
+ onClick: K,
143
141
  onMousedown: (l) => l.stopPropagation()
144
142
  }, {
145
- default: () => [o(U, null, null)]
143
+ default: () => [o(Q, null, null)]
146
144
  }), o("span", {
147
145
  class: u.element("icon")
148
- }, [K()]), !!p.value && o(O, {
146
+ }, [L()]), !!p.value && o(q, {
149
147
  type: p.value
150
- }, null)]);
151
- M(N, (l) => {
152
- !l && d.value && d.value.isSameNode(document.activeElement) && d.value.blur();
153
- });
154
- const y = i(() => [u.modifier(`${e.multiple ? "multiple" : "single"}`), {
148
+ }, null)]), y = i(() => [u.modifier(`${e.multiple ? "multiple" : "single"}`), {
155
149
  [u.modifier("opened")]: e.opened,
156
150
  [u.modifier("borderless")]: !e.bordered
157
151
  }]);
158
152
  return {
159
- inputRef: d,
160
- handleFocus: f,
153
+ inputRef: k,
154
+ handleFocus: m,
161
155
  handleBlur: s,
162
- render: () => e.multiple ? o($, {
163
- ref: m,
156
+ render: () => e.multiple ? o(_, {
157
+ ref: f,
164
158
  baseCls: u.block,
165
159
  class: y.value,
166
160
  modelValue: e.modelValue,
167
161
  inputValue: e.inputValue,
168
- focused: e.opened,
162
+ focused: e.opened || d.value,
169
163
  placeholder: e.placeholder,
170
164
  disabled: g.value,
171
- size: v.value,
165
+ size: h.value,
172
166
  error: b.value,
173
167
  maxTagCount: e.maxTagCount,
174
168
  disabledInput: !e.allowSearch && !e.allowCreate,
175
169
  tagNowrap: e.tagNowrap,
176
170
  retainInputValue: !0,
177
- inputAttrs: h.value,
171
+ inputAttrs: v.value,
178
172
  uninjectFormItemContext: !0,
179
173
  onRemove: D,
180
174
  onInputValueChange: w,
181
175
  onKeydown: C,
182
- onFocus: f,
176
+ onFocus: m,
183
177
  onBlur: s
184
178
  }, {
185
179
  prefix: n.prefix,
186
180
  suffix: V,
187
181
  tag: n.label
188
- }) : o(_, {
189
- ref: m,
182
+ }) : o(O, {
183
+ ref: f,
190
184
  baseCls: u.block,
191
185
  class: y.value,
192
186
  modelValue: e.modelValue[0],
193
187
  inputValue: e.inputValue,
194
- focused: e.opened,
188
+ focused: e.opened || d.value,
195
189
  placeholder: e.placeholder,
196
190
  disabled: g.value,
197
- size: v.value,
191
+ size: h.value,
198
192
  error: b.value,
199
193
  enabledInput: T.value,
200
- inputAttrs: h.value,
194
+ inputAttrs: v.value,
201
195
  uninjectFormItemContext: !0,
202
196
  onInputValueChange: w,
203
197
  onKeydown: C,
204
- onFocus: f,
198
+ onFocus: m,
205
199
  onBlur: s
206
200
  }, {
207
201
  default: n.label,
@@ -223,5 +217,5 @@ const he = /* @__PURE__ */ L({
223
217
  }
224
218
  });
225
219
  export {
226
- he as default
220
+ be as default
227
221
  };
@@ -1,89 +1,96 @@
1
- import { defineComponent as ie, computed as c, ref as v, reactive as se, onBeforeUnmount as ce, watch as V, createVNode as a, Teleport as re, withDirectives as de, mergeProps as ue, Transition as R, vShow as fe, nextTick as me } from "vue";
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
2
  import { useLocale as be } from "../../locale/index.js";
3
- import { getComponentPrefix as ve, getClassNameMixin as j } from "../../_utils/config.js";
4
- import { addUnit as F } from "../../_utils/helpers.js";
5
- import { isFunction as ye, isPromise as ge } from "../../_utils/is.js";
6
- import he from "../../_hooks/use-popup-manager.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
7
  import { useOverflow as Ce } from "../../_hooks/use-overflow.js";
8
- import { KEYBOARD_KEY as I } from "../../_utils/keyboard.js";
8
+ import { KEYBOARD_KEY as j } from "../../_utils/keyboard.js";
9
9
  import { getElement as xe, on as we, off as Ee } from "../../_utils/dom.js";
10
10
  import { dialogProps as ke } from "./props.js";
11
11
  const De = ["width", "minWidth", "height", "minHeight"];
12
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]:not([tabindex="-1"])'].join(","), M = (t) => Array.from(t.querySelectorAll(Be)).filter((i) => {
14
- if (i.matches(':disabled, input[type="hidden"]') || i.closest('[hidden], [inert], [aria-hidden="true"]'))
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
+ )
15
18
  return !1;
16
- for (let s = i; s; s = s.parentElement) {
17
- const o = window.getComputedStyle(s);
18
- if (o.display === "none" || o.visibility === "hidden" || o.visibility === "collapse")
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")
19
26
  return !1;
20
27
  }
21
28
  return !0;
22
- }), Fe = /* @__PURE__ */ ie({
29
+ }), Ie = /* @__PURE__ */ ie({
23
30
  name: ve("Dialog"),
24
31
  inheritAttrs: !1,
25
32
  props: ke,
26
33
  slots: Object,
27
34
  emits: ["closed", "close", "open", "opened", "update:modelValue"],
28
35
  setup(t, {
29
- attrs: i,
36
+ attrs: o,
30
37
  emit: s,
31
- slots: o
38
+ slots: a
32
39
  }) {
33
- const r = j("dialog"), {
34
- t: N
35
- } = be(), z = r.block, f = j("message-box"), y = `x-dialog-title-${++Se}`, G = c(() => [z, t.messageBox && "is-message-box", t.messageBox && f.block, t.popupClass && t.popupClass, i.class]), H = c(() => {
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(() => {
36
43
  const {
37
44
  class: e,
38
45
  style: n,
39
46
  id: l,
40
- "aria-label": u,
41
- "aria-labelledby": B,
42
- "aria-describedby": T,
47
+ "aria-label": d,
48
+ "aria-labelledby": v,
49
+ "aria-describedby": y,
43
50
  ...ae
44
- } = i;
51
+ } = o;
45
52
  return ae;
46
- }), g = c(() => {
53
+ }), x = r(() => {
47
54
  if (!(typeof document > "u"))
48
55
  return xe(t.renderTo) || document.body;
49
- }), h = v(), C = v(), p = c(() => t.disabled || !g.value), U = c(() => [{
56
+ }), w = h(), E = h(), H = r(() => t.disabled || !x.value), U = r(() => [{
50
57
  zIndex: $.value
51
- }, i.style]), Y = c(() => {
58
+ }, o.style]), Y = r(() => {
52
59
  const e = {};
53
- return t.fullscreen || (!t.center && t.top && (e.top = F(t.top)), De.forEach((n) => {
54
- t[n] && (e[n] = F(t[n]));
60
+ return t.fullscreen || (!t.center && t.top && (e.top = R(t.top)), De.forEach((n) => {
61
+ t[n] && (e[n] = R(t[n]));
55
62
  })), e;
56
- }), x = v(!1), d = c(() => t.modelValue), K = c(() => d.value || x.value), q = c(() => !t.destroyOnClosed || K.value), W = c(() => K.value), {
63
+ }), k = h(!1), u = r(() => t.modelValue), A = r(() => u.value || k.value), q = r(() => !t.destroyOnClosed || A.value), W = r(() => A.value), {
57
64
  zIndex: $,
58
- isLastDialog: w,
65
+ isLastDialog: D,
59
66
  close: J
60
- } = he("dialog", {
61
- visible: d
67
+ } = ge("dialog", {
68
+ visible: u
62
69
  }), {
63
70
  setOverflowHidden: Q,
64
- resetOverflow: A
65
- } = Ce(g, h), O = (e, n) => {
71
+ resetOverflow: L
72
+ } = Ce(x, w), O = (e, n) => {
66
73
  s("update:modelValue", !1), s("close", e, n);
67
- }, E = v(null);
68
- let k = !1;
69
- const L = () => {
70
- var l, u;
71
- const e = E.value;
72
- if (E.value = null, !(e != null && e.isConnected) || typeof document > "u" || d.value && !w()) return;
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;
73
80
  const n = document.activeElement;
74
- n != null && n.isConnected && n !== document.body && n !== document.documentElement && n !== e && !((l = h.value) != null && l.contains(n)) || (u = e.focus) == null || u.call(e, {
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, {
75
82
  preventScroll: !0
76
83
  });
77
84
  }, X = () => {
78
85
  typeof document > "u" || me(() => {
79
- const e = C.value;
80
- if (!e || !d.value || k || !w()) return;
81
- (M(e)[0] || e).focus({
86
+ const e = E.value;
87
+ if (!e || !u.value || B || !D()) return;
88
+ (G(e)[0] || e).focus({
82
89
  preventScroll: !0
83
90
  });
84
91
  });
85
92
  }, Z = () => {
86
- k || (x.value = !1, A(), L(), s("closed"));
93
+ B || (k.value = !1, L(), P(), s("closed"));
87
94
  }, ee = () => {
88
95
  s("opened"), X();
89
96
  }, m = se({
@@ -97,9 +104,9 @@ const Be = ["a[href]", "button:not([disabled])", "textarea:not([disabled])", 'in
97
104
  } catch {
98
105
  l = !1;
99
106
  }
100
- if (ge(l)) {
101
- l.then((u) => {
102
- u && O(e, n);
107
+ if (he(l)) {
108
+ l.then((d) => {
109
+ d && O(e, n);
103
110
  }).catch(() => !1).finally(() => {
104
111
  m[e] = !1;
105
112
  });
@@ -113,98 +120,100 @@ const Be = ["a[href]", "button:not([disabled])", "textarea:not([disabled])", 'in
113
120
  }, le = (e) => {
114
121
  b("ok", e);
115
122
  };
116
- let D = !1;
117
- const P = (e) => {
118
- t.escToClose && e.key === I.ESC && w() && b("cancel", e);
119
- }, _ = () => {
120
- typeof document > "u" || t.escToClose && !D && (D = !0, we(document.documentElement, "keydown", P));
121
- }, S = () => {
122
- typeof document > "u" || (D = !1, Ee(document.documentElement, "keydown", P));
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", _));
123
130
  }, oe = (e) => {
124
- if (e.key !== I.TAB) return;
125
- const n = C.value;
131
+ if (e.key !== j.TAB) return;
132
+ const n = E.value;
126
133
  if (!n) return;
127
- const l = M(n);
134
+ const l = G(n);
128
135
  if (!l.length) {
129
136
  e.preventDefault(), n.focus({
130
137
  preventScroll: !0
131
138
  });
132
139
  return;
133
140
  }
134
- const u = l[0], B = l[l.length - 1], T = document.activeElement;
135
- e.shiftKey && T === u ? (e.preventDefault(), B.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({
136
143
  preventScroll: !0
137
- })) : !e.shiftKey && T === B && (e.preventDefault(), u.focus({
144
+ })) : !e.shiftKey && y === v && (e.preventDefault(), d.focus({
145
+ preventScroll: !0
146
+ })) : (e.preventDefault(), (e.shiftKey ? v : d).focus({
138
147
  preventScroll: !0
139
148
  }));
140
149
  };
141
150
  return ce(() => {
142
- k = !0, L(), J(), A(), S();
143
- }), V(() => d.value, (e) => {
144
- e ? (E.value = typeof document > "u" ? null : document.activeElement, s("open"), Q(), x.value = !0, _()) : S();
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();
145
154
  }, {
146
155
  immediate: !0
147
156
  }), V(() => t.escToClose, (e) => {
148
- d.value && (e ? _() : S());
149
- }), () => a(re, {
150
- to: g.value,
151
- disabled: p.value
157
+ u.value && (e ? N() : K());
158
+ }), () => c(re, {
159
+ to: x.value,
160
+ disabled: H.value
152
161
  }, {
153
- default: () => [q.value && de(a("div", ue({
154
- ref: h,
155
- class: G.value,
162
+ default: () => [q.value && de(c("div", ue({
163
+ ref: w,
164
+ class: z.value,
156
165
  style: U.value,
157
- id: i.id
158
- }, H.value), [a(R, {
166
+ id: o.id
167
+ }, F.value), [c(p, {
159
168
  name: "x-fade-in-standard",
160
169
  appear: !0
161
170
  }, {
162
- default: () => [t.mask && d.value && a("div", {
163
- class: r.element("mask")
171
+ default: () => [t.mask && u.value && c("div", {
172
+ class: i.element("mask")
164
173
  }, null)]
165
- }), a("div", {
166
- class: [r.element("wrapper"), {
174
+ }), c("div", {
175
+ class: [i.element("wrapper"), {
167
176
  "is-center": t.center
168
177
  }],
169
178
  onClick: (e) => e.target === e.currentTarget && te()
170
- }, [a(R, {
179
+ }, [c(p, {
171
180
  name: "x-zoom-in",
172
181
  appear: !0,
173
182
  onAfterEnter: ee,
174
183
  onAfterLeave: Z
175
184
  }, {
176
- default: () => [d.value && a("div", {
177
- ref: C,
178
- class: [r.element("container"), {
185
+ default: () => [u.value && c("div", {
186
+ ref: E,
187
+ class: [i.element("container"), {
179
188
  "is-fullscreen": t.fullscreen
180
189
  }],
181
190
  style: Y.value,
182
191
  role: "dialog",
183
192
  "aria-modal": t.mask ? "true" : void 0,
184
- "aria-label": t.title || o.title ? void 0 : i["aria-label"],
185
- "aria-labelledby": t.title || o.title ? y : i["aria-labelledby"],
186
- "aria-describedby": i["aria-describedby"],
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"],
187
196
  tabindex: -1,
188
197
  onKeydown: oe
189
- }, [a("div", {
190
- class: [t.messageBox ? f.element("header") : r.element("header"), t.showHeaderBottomLine && "is-bottom-line"],
191
- id: o.title ? y : void 0
192
- }, [o.title ? o.title() : a("div", {
193
- id: t.title ? y : void 0,
194
- class: [r.element("header-title")]
195
- }, [t.title])]), a("div", {
196
- class: [t.messageBox ? f.element("body") : r.element("body")]
197
- }, [o.default && o.default()]), !t.hideFooter && o.footer && a("div", {
198
- class: [t.messageBox ? f.element("footer") : r.element("footer")]
199
- }, [o.footer({
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({
200
209
  cancel: ne,
201
210
  ok: le,
202
211
  loadingObj: m,
203
212
  "loading-obj": m
204
- })]), t.showClose && a("button", {
213
+ })]), t.showClose && c("button", {
205
214
  type: "button",
206
- class: [r.element("close-icon"), t.messageBox && f.element("close-icon")],
207
- "aria-label": N("common.closeTarget", {
215
+ class: [i.element("close-icon"), t.messageBox && f.element("close-icon")],
216
+ "aria-label": g("common.closeTarget", {
208
217
  target: "对话框"
209
218
  }),
210
219
  onClick: (e) => b("cancel", e)
@@ -214,5 +223,5 @@ const Be = ["a[href]", "button:not([disabled])", "textarea:not([disabled])", 'in
214
223
  }
215
224
  });
216
225
  export {
217
- Fe as default
226
+ Ie as default
218
227
  };