x-next 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI_USAGE.md +647 -0
- package/CHANGELOG.md +22 -0
- package/README.md +8 -0
- package/dist/components/dropdown/Dropdown.vue.d.ts +27 -1
- package/dist/components/dropdown/DropdownButton.vue.d.ts +27 -1
- package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +158 -1
- package/dist/components/dropdown/context.d.ts +14 -1
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
- package/dist/components/dropdown/index.d.ts +588 -6
- package/dist/components/dropdown/use-keyboard.d.ts +10 -0
- package/dist/components/form-select/hooks/use-select.d.ts +2 -1
- package/dist/es/_hooks/use-overflow.js +45 -40
- package/dist/es/components/_components/select-view/select-view.js +49 -55
- package/dist/es/components/dialog/Dialog.js +106 -97
- package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
- package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
- package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
- package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
- package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
- package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
- package/dist/es/components/dropdown/context.js +3 -2
- package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
- package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
- package/dist/es/components/dropdown/use-keyboard.js +45 -0
- package/dist/es/components/form-checkbox/Checkbox.js +49 -49
- package/dist/es/components/form-select/Select.js +25 -24
- package/dist/es/components/form-select/hooks/use-select.js +128 -128
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/style/base.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +9 -3
|
@@ -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
|
|
2
|
-
import { setStyle as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
50
|
+
M as useOverflow
|
|
46
51
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isArray as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { InputTag as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { useFormItem as
|
|
12
|
-
import { useLocale as
|
|
13
|
-
import { useSize as
|
|
14
|
-
import { getClassNameMixin as
|
|
15
|
-
const
|
|
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) =>
|
|
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
|
-
} =
|
|
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
|
-
} =
|
|
100
|
+
} = W({
|
|
101
101
|
size: S,
|
|
102
102
|
disabled: x,
|
|
103
103
|
error: F
|
|
104
|
-
}),
|
|
104
|
+
}), v = X(R, () => e.inputAttrs ?? {}), {
|
|
105
105
|
t: A
|
|
106
|
-
} =
|
|
107
|
-
mergedSize:
|
|
108
|
-
} =
|
|
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 =
|
|
112
|
+
return (l = f.value) == null ? void 0 : l.inputRef;
|
|
115
113
|
}
|
|
116
|
-
),
|
|
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
|
-
},
|
|
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
|
-
},
|
|
129
|
+
}, L = () => {
|
|
132
130
|
var l, a;
|
|
133
|
-
return e.loading ? ((l = n["loading-icon"]) == null ? void 0 : l.call(n)) ?? o(
|
|
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(
|
|
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:
|
|
140
|
+
onClick: K,
|
|
143
141
|
onMousedown: (l) => l.stopPropagation()
|
|
144
142
|
}, {
|
|
145
|
-
default: () => [o(
|
|
143
|
+
default: () => [o(Q, null, null)]
|
|
146
144
|
}), o("span", {
|
|
147
145
|
class: u.element("icon")
|
|
148
|
-
}, [
|
|
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:
|
|
160
|
-
handleFocus:
|
|
153
|
+
inputRef: k,
|
|
154
|
+
handleFocus: m,
|
|
161
155
|
handleBlur: s,
|
|
162
|
-
render: () => e.multiple ? o(
|
|
163
|
-
ref:
|
|
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:
|
|
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:
|
|
171
|
+
inputAttrs: v.value,
|
|
178
172
|
uninjectFormItemContext: !0,
|
|
179
173
|
onRemove: D,
|
|
180
174
|
onInputValueChange: w,
|
|
181
175
|
onKeydown: C,
|
|
182
|
-
onFocus:
|
|
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:
|
|
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:
|
|
191
|
+
size: h.value,
|
|
198
192
|
error: b.value,
|
|
199
193
|
enabledInput: T.value,
|
|
200
|
-
inputAttrs:
|
|
194
|
+
inputAttrs: v.value,
|
|
201
195
|
uninjectFormItemContext: !0,
|
|
202
196
|
onInputValueChange: w,
|
|
203
197
|
onKeydown: C,
|
|
204
|
-
onFocus:
|
|
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
|
-
|
|
220
|
+
be as default
|
|
227
221
|
};
|
|
@@ -1,89 +1,96 @@
|
|
|
1
|
-
import { defineComponent as ie, computed as
|
|
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
|
|
4
|
-
import { addUnit as
|
|
5
|
-
import { isFunction as ye, isPromise as
|
|
6
|
-
import
|
|
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
|
|
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])",
|
|
14
|
-
if (
|
|
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 =
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
}),
|
|
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:
|
|
36
|
+
attrs: o,
|
|
30
37
|
emit: s,
|
|
31
|
-
slots:
|
|
38
|
+
slots: a
|
|
32
39
|
}) {
|
|
33
|
-
const
|
|
34
|
-
t:
|
|
35
|
-
} = be(),
|
|
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":
|
|
41
|
-
"aria-labelledby":
|
|
42
|
-
"aria-describedby":
|
|
47
|
+
"aria-label": d,
|
|
48
|
+
"aria-labelledby": v,
|
|
49
|
+
"aria-describedby": y,
|
|
43
50
|
...ae
|
|
44
|
-
} =
|
|
51
|
+
} = o;
|
|
45
52
|
return ae;
|
|
46
|
-
}),
|
|
53
|
+
}), x = r(() => {
|
|
47
54
|
if (!(typeof document > "u"))
|
|
48
55
|
return xe(t.renderTo) || document.body;
|
|
49
|
-
}),
|
|
56
|
+
}), w = h(), E = h(), H = r(() => t.disabled || !x.value), U = r(() => [{
|
|
50
57
|
zIndex: $.value
|
|
51
|
-
},
|
|
58
|
+
}, o.style]), Y = r(() => {
|
|
52
59
|
const e = {};
|
|
53
|
-
return t.fullscreen || (!t.center && t.top && (e.top =
|
|
54
|
-
t[n] && (e[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
|
-
}),
|
|
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:
|
|
65
|
+
isLastDialog: D,
|
|
59
66
|
close: J
|
|
60
|
-
} =
|
|
61
|
-
visible:
|
|
67
|
+
} = ge("dialog", {
|
|
68
|
+
visible: u
|
|
62
69
|
}), {
|
|
63
70
|
setOverflowHidden: Q,
|
|
64
|
-
resetOverflow:
|
|
65
|
-
} = Ce(
|
|
71
|
+
resetOverflow: L
|
|
72
|
+
} = Ce(x, w), O = (e, n) => {
|
|
66
73
|
s("update:modelValue", !1), s("close", e, n);
|
|
67
|
-
},
|
|
68
|
-
let
|
|
69
|
-
const
|
|
70
|
-
var l,
|
|
71
|
-
const e =
|
|
72
|
-
if (
|
|
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 =
|
|
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 =
|
|
80
|
-
if (!e || !
|
|
81
|
-
(
|
|
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
|
-
|
|
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 (
|
|
101
|
-
l.then((
|
|
102
|
-
|
|
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
|
|
117
|
-
const
|
|
118
|
-
t.escToClose && e.key ===
|
|
119
|
-
},
|
|
120
|
-
typeof document > "u" || t.escToClose && !
|
|
121
|
-
},
|
|
122
|
-
typeof document > "u" || (
|
|
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 !==
|
|
125
|
-
const n =
|
|
131
|
+
if (e.key !== j.TAB) return;
|
|
132
|
+
const n = E.value;
|
|
126
133
|
if (!n) return;
|
|
127
|
-
const l =
|
|
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
|
|
135
|
-
e.shiftKey &&
|
|
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 &&
|
|
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
|
-
|
|
143
|
-
}), V(() =>
|
|
144
|
-
e ? (
|
|
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
|
-
|
|
149
|
-
}), () =>
|
|
150
|
-
to:
|
|
151
|
-
disabled:
|
|
157
|
+
u.value && (e ? N() : K());
|
|
158
|
+
}), () => c(re, {
|
|
159
|
+
to: x.value,
|
|
160
|
+
disabled: H.value
|
|
152
161
|
}, {
|
|
153
|
-
default: () => [q.value && de(
|
|
154
|
-
ref:
|
|
155
|
-
class:
|
|
162
|
+
default: () => [q.value && de(c("div", ue({
|
|
163
|
+
ref: w,
|
|
164
|
+
class: z.value,
|
|
156
165
|
style: U.value,
|
|
157
|
-
id:
|
|
158
|
-
},
|
|
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 &&
|
|
163
|
-
class:
|
|
171
|
+
default: () => [t.mask && u.value && c("div", {
|
|
172
|
+
class: i.element("mask")
|
|
164
173
|
}, null)]
|
|
165
|
-
}),
|
|
166
|
-
class: [
|
|
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
|
-
}, [
|
|
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: () => [
|
|
177
|
-
ref:
|
|
178
|
-
class: [
|
|
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 ||
|
|
185
|
-
"aria-labelledby": t.title ||
|
|
186
|
-
"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
|
-
}, [
|
|
190
|
-
class: [t.messageBox ? f.element("header") :
|
|
191
|
-
id:
|
|
192
|
-
}, [
|
|
193
|
-
id: t.title ?
|
|
194
|
-
class: [
|
|
195
|
-
}, [t.title])]),
|
|
196
|
-
class: [t.messageBox ? f.element("body") :
|
|
197
|
-
}, [
|
|
198
|
-
class: [t.messageBox ? f.element("footer") :
|
|
199
|
-
}, [
|
|
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 &&
|
|
213
|
+
})]), t.showClose && c("button", {
|
|
205
214
|
type: "button",
|
|
206
|
-
class: [
|
|
207
|
-
"aria-label":
|
|
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
|
-
|
|
226
|
+
Ie as default
|
|
218
227
|
};
|