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.
- package/CHANGELOG.md +38 -0
- package/dist/_hooks/use-form-item.d.ts +5 -0
- package/dist/_hooks/use-picker-focus.d.ts +17 -0
- package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
- package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
- package/dist/components/_components/picker/input.vue.d.ts +9 -5
- package/dist/components/alert/Alert.vue.d.ts +5 -5
- package/dist/components/alert/index.d.ts +10 -10
- package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
- package/dist/components/date-picker/index.d.ts +77 -33
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/drawer/index.d.ts +3 -3
- package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.vue.d.ts +30 -4
- package/dist/components/dropdown/DropdownButton.vue.d.ts +31 -5
- package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +162 -5
- 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 +610 -28
- package/dist/components/dropdown/use-keyboard.d.ts +10 -0
- package/dist/components/form/FormItem.vue.d.ts +12 -4
- package/dist/components/form/context.d.ts +6 -0
- package/dist/components/form/form-item-label.vue.d.ts +4 -4
- package/dist/components/form/form-item-message.vue.d.ts +2 -0
- package/dist/components/form/index.d.ts +30 -8
- package/dist/components/form/interface.d.ts +2 -2
- package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
- package/dist/components/form-input/index.d.ts +22 -4
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/hooks/use-select.d.ts +2 -1
- package/dist/components/form-select/index.d.ts +6 -6
- package/dist/components/form-slider/Slider.vue.d.ts +10 -3
- package/dist/components/form-slider/index.d.ts +26 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
- package/dist/components/form-switch/Switch.vue.d.ts +2 -1
- package/dist/components/form-switch/index.d.ts +5 -2
- package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
- package/dist/components/form-textarea/index.d.ts +5 -5
- package/dist/components/image/Image.vue.d.ts +10 -9
- package/dist/components/image/ImagePreview.vue.d.ts +8 -7
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
- package/dist/components/image/index.d.ts +59 -52
- package/dist/components/image/preview-arrow.vue.d.ts +2 -2
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
- package/dist/components/layout/index.d.ts +4 -4
- package/dist/components/link/Link.vue.d.ts +2 -2
- package/dist/components/link/index.d.ts +4 -4
- package/dist/components/menu/Menu.d.ts +2 -2
- package/dist/components/menu/base-menu.vue.d.ts +2 -2
- package/dist/components/menu/index.d.ts +4 -4
- package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
- package/dist/components/message/index.d.ts +17 -17
- package/dist/components/message/message.vue.d.ts +8 -8
- package/dist/components/notification/Notification.d.ts +1 -1
- package/dist/components/notification/index.d.ts +3 -3
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
- package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/progress/Progress.vue.d.ts +4 -4
- package/dist/components/progress/circle.vue.d.ts +2 -2
- package/dist/components/progress/index.d.ts +8 -8
- package/dist/components/progress/line.vue.d.ts +1 -1
- package/dist/components/progress/steps.vue.d.ts +1 -1
- package/dist/components/steps/Step.vue.d.ts +2 -2
- package/dist/components/steps/index.d.ts +4 -4
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
- package/dist/components/tag/Tag.vue.d.ts +2 -2
- package/dist/components/tag/index.d.ts +4 -4
- package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
- package/dist/components/time-picker/index.d.ts +73 -36
- package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
- package/dist/components/time-range-selector/index.d.ts +22 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/es/_hooks/use-form-item.js +36 -10
- package/dist/es/_hooks/use-overflow.js +45 -40
- package/dist/es/_hooks/use-picker-focus.js +57 -0
- package/dist/es/_utils/constant.js +17 -5
- package/dist/es/components/_components/picker/input-range.vue.js +45 -55
- package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
- package/dist/es/components/_components/picker/input.vue.js +22 -25
- package/dist/es/components/_components/picker/input.vue2.js +58 -43
- package/dist/es/components/_components/select-view/select-view.js +61 -66
- package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
- package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
- package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
- package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
- package/dist/es/components/dialog/Dialog.js +159 -128
- 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/Form.vue2.js +113 -101
- package/dist/es/components/form/FormItem.vue.js +26 -22
- package/dist/es/components/form/FormItem.vue2.js +162 -125
- package/dist/es/components/form/form-item-message.vue.js +31 -24
- package/dist/es/components/form/form-item-message.vue2.js +4 -2
- package/dist/es/components/form-checkbox/Checkbox.js +80 -76
- package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
- package/dist/es/components/form-input/Input.js +83 -79
- package/dist/es/components/form-input/InputPassword.vue.js +19 -16
- package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
- package/dist/es/components/form-input/InputSearch.js +47 -37
- package/dist/es/components/form-input-number/InputNumber.js +134 -133
- package/dist/es/components/form-input-tag/InputTag.js +173 -162
- package/dist/es/components/form-radio/Radio.js +74 -71
- package/dist/es/components/form-radio/RadioGroup.js +55 -49
- package/dist/es/components/form-select/Select.js +116 -114
- package/dist/es/components/form-select/hooks/use-select.js +128 -128
- package/dist/es/components/form-slider/Slider.vue.js +28 -28
- package/dist/es/components/form-slider/Slider.vue2.js +139 -132
- package/dist/es/components/form-slider/slider-button.vue.js +6 -6
- package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
- package/dist/es/components/form-switch/Switch.vue.js +9 -9
- package/dist/es/components/form-switch/Switch.vue2.js +81 -74
- package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
- package/dist/es/components/image/Image.vue2.js +77 -76
- package/dist/es/components/image/ImagePreview.vue.js +13 -12
- package/dist/es/components/image/ImagePreview.vue2.js +141 -136
- package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
- package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
- package/dist/es/components/rate/Rate.js +106 -103
- package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
- package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
- package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
- package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
- package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
- package/dist/es/locale/en-US.js +6 -0
- package/dist/es/locale/zh-CN.js +6 -0
- package/dist/es/style.css +1 -1
- package/dist/icons/_self/down.d.ts +1 -1
- package/dist/icons/_self/dropdown/more.d.ts +1 -1
- package/dist/icons/_self/empty-better.d.ts +1 -1
- package/dist/icons/_self/empty.d.ts +1 -1
- package/dist/icons/_self/eye-invisible.d.ts +1 -1
- package/dist/icons/_self/eye.d.ts +1 -1
- package/dist/icons/_self/full-screen.d.ts +1 -1
- package/dist/icons/_self/left.d.ts +1 -1
- package/dist/icons/_self/menu/down.d.ts +1 -1
- package/dist/icons/_self/minus.d.ts +1 -1
- package/dist/icons/_self/more-dot.d.ts +1 -1
- package/dist/icons/_self/next.d.ts +1 -1
- package/dist/icons/_self/original-size.d.ts +1 -1
- package/dist/icons/_self/plus.d.ts +1 -1
- package/dist/icons/_self/prev.d.ts +1 -1
- package/dist/icons/_self/question-message.d.ts +1 -1
- package/dist/icons/_self/right.d.ts +1 -1
- package/dist/icons/_self/rotate-left.d.ts +1 -1
- package/dist/icons/_self/rotate-right.d.ts +1 -1
- package/dist/icons/_self/search.d.ts +1 -1
- package/dist/icons/_self/up.d.ts +1 -1
- package/dist/icons/_self/zoom-in.d.ts +1 -1
- package/dist/icons/_self/zoom-out.d.ts +1 -1
- package/dist/icons/_ui/alone-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
- package/dist/icons/_ui/alone-right.d.ts +1 -1
- package/dist/icons/_ui/calendar.d.ts +1 -1
- package/dist/icons/_ui/time.d.ts +1 -1
- package/dist/icons/animation/animation-loading.d.ts +1 -1
- package/dist/icons/default/check-circle-fill.d.ts +1 -1
- package/dist/icons/default/check.d.ts +1 -1
- package/dist/icons/default/close-circle-fill.d.ts +1 -1
- package/dist/icons/default/close.d.ts +1 -1
- package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
- package/dist/icons/default/exclamation.d.ts +1 -1
- package/dist/icons/default/filter.d.ts +1 -1
- package/dist/icons/default/info-circle-fill.d.ts +1 -1
- package/dist/icons/default/link.d.ts +1 -1
- package/dist/icons/default/logo-simple.d.ts +1 -1
- package/dist/icons/default/minus-circle-fill.d.ts +1 -1
- package/dist/icons/icon.d.ts +2 -2
- package/dist/icons/index.d.ts +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +6 -0
- package/dist/style/base.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/image.css +1 -1
- package/dist/style/time-range-selector.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,196 +1,227 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLocale as
|
|
3
|
-
import { getComponentPrefix 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
|
+
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
|
|
6
|
-
import
|
|
7
|
-
import { useOverflow as
|
|
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
|
|
10
|
-
import { dialogProps as
|
|
11
|
-
const
|
|
12
|
-
let
|
|
13
|
-
const
|
|
14
|
-
|
|
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:
|
|
32
|
+
props: ke,
|
|
17
33
|
slots: Object,
|
|
18
34
|
emits: ["closed", "close", "open", "opened", "update:modelValue"],
|
|
19
35
|
setup(t, {
|
|
20
|
-
attrs:
|
|
21
|
-
emit:
|
|
22
|
-
slots:
|
|
36
|
+
attrs: o,
|
|
37
|
+
emit: s,
|
|
38
|
+
slots: a
|
|
23
39
|
}) {
|
|
24
|
-
const
|
|
25
|
-
t:
|
|
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
43
|
const {
|
|
28
44
|
class: e,
|
|
29
45
|
style: n,
|
|
30
|
-
id:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
37
|
-
}),
|
|
38
|
-
zIndex:
|
|
39
|
-
},
|
|
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)),
|
|
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
|
-
}),
|
|
45
|
-
zIndex:
|
|
46
|
-
isLastDialog:
|
|
47
|
-
|
|
48
|
-
|
|
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:
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
}),
|
|
73
|
-
let
|
|
74
|
-
if (m[e] = !0,
|
|
99
|
+
}), b = (e, n) => {
|
|
100
|
+
let l = !0;
|
|
101
|
+
if (m[e] = !0, ye(t.onBeforeCancel))
|
|
75
102
|
try {
|
|
76
|
-
|
|
103
|
+
l = t.onBeforeCancel(e) ?? !1;
|
|
77
104
|
} catch {
|
|
78
|
-
|
|
105
|
+
l = !1;
|
|
79
106
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
d &&
|
|
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,
|
|
89
|
-
},
|
|
90
|
-
t.maskToClose && t.mask &&
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
|
|
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
|
|
97
|
-
const
|
|
98
|
-
t.escToClose && e.key === j.ESC &&
|
|
99
|
-
},
|
|
100
|
-
typeof document > "u" || t.escToClose && !
|
|
101
|
-
},
|
|
102
|
-
typeof document > "u" || (
|
|
103
|
-
},
|
|
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 =
|
|
132
|
+
const n = E.value;
|
|
106
133
|
if (!n) return;
|
|
107
|
-
const
|
|
108
|
-
if (!
|
|
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 =
|
|
115
|
-
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({
|
|
143
|
+
preventScroll: !0
|
|
144
|
+
})) : !e.shiftKey && y === v && (e.preventDefault(), d.focus({
|
|
116
145
|
preventScroll: !0
|
|
117
|
-
})) :
|
|
146
|
+
})) : (e.preventDefault(), (e.shiftKey ? v : d).focus({
|
|
118
147
|
preventScroll: !0
|
|
119
148
|
}));
|
|
120
149
|
};
|
|
121
|
-
return
|
|
122
|
-
B(),
|
|
123
|
-
}),
|
|
124
|
-
e ? (
|
|
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
|
-
}),
|
|
128
|
-
|
|
129
|
-
}), () =>
|
|
130
|
-
to:
|
|
131
|
-
disabled:
|
|
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: () => [
|
|
134
|
-
ref:
|
|
135
|
-
class:
|
|
136
|
-
style:
|
|
137
|
-
id:
|
|
138
|
-
},
|
|
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 &&
|
|
143
|
-
class:
|
|
171
|
+
default: () => [t.mask && u.value && c("div", {
|
|
172
|
+
class: i.element("mask")
|
|
144
173
|
}, null)]
|
|
145
|
-
}),
|
|
146
|
-
class: [
|
|
174
|
+
}), c("div", {
|
|
175
|
+
class: [i.element("wrapper"), {
|
|
147
176
|
"is-center": t.center
|
|
148
177
|
}],
|
|
149
|
-
onClick: (e) => e.target === e.currentTarget &&
|
|
150
|
-
}, [
|
|
178
|
+
onClick: (e) => e.target === e.currentTarget && te()
|
|
179
|
+
}, [c(p, {
|
|
151
180
|
name: "x-zoom-in",
|
|
152
181
|
appear: !0,
|
|
153
|
-
onAfterEnter:
|
|
154
|
-
onAfterLeave:
|
|
182
|
+
onAfterEnter: ee,
|
|
183
|
+
onAfterLeave: Z
|
|
155
184
|
}, {
|
|
156
|
-
default: () => [
|
|
157
|
-
ref:
|
|
158
|
-
class: [
|
|
185
|
+
default: () => [u.value && c("div", {
|
|
186
|
+
ref: E,
|
|
187
|
+
class: [i.element("container"), {
|
|
159
188
|
"is-fullscreen": t.fullscreen
|
|
160
189
|
}],
|
|
161
|
-
style:
|
|
190
|
+
style: Y.value,
|
|
162
191
|
role: "dialog",
|
|
163
192
|
"aria-modal": t.mask ? "true" : void 0,
|
|
164
|
-
"aria-
|
|
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:
|
|
167
|
-
}, [
|
|
168
|
-
class: [t.messageBox ? f.element("header") :
|
|
169
|
-
id:
|
|
170
|
-
}, [
|
|
171
|
-
id: t.title ?
|
|
172
|
-
class: [
|
|
173
|
-
}, [t.title])]),
|
|
174
|
-
class: [t.messageBox ? f.element("body") :
|
|
175
|
-
}, [
|
|
176
|
-
class: [t.messageBox ? f.element("footer") :
|
|
177
|
-
}, [
|
|
178
|
-
cancel:
|
|
179
|
-
ok:
|
|
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 &&
|
|
213
|
+
})]), t.showClose && c("button", {
|
|
183
214
|
type: "button",
|
|
184
|
-
class: [
|
|
185
|
-
"aria-label":
|
|
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) =>
|
|
219
|
+
onClick: (e) => b("cancel", e)
|
|
189
220
|
}, null)])]
|
|
190
|
-
})])]), [[
|
|
221
|
+
})])]), [[fe, W.value]])]
|
|
191
222
|
});
|
|
192
223
|
}
|
|
193
224
|
});
|
|
194
225
|
export {
|
|
195
|
-
|
|
226
|
+
Ie as default
|
|
196
227
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { resolveComponent as
|
|
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
|
|
5
|
-
const
|
|
6
|
-
return
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
56
|
+
const w = /* @__PURE__ */ f(l, [["render", g]]);
|
|
54
57
|
export {
|
|
55
|
-
|
|
58
|
+
w as default
|
|
56
59
|
};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Trigger as
|
|
3
|
-
import
|
|
4
|
-
import { useTrigger as
|
|
5
|
-
import { dropdownInjectionKey as
|
|
6
|
-
import { getClassNameMixin as
|
|
7
|
-
|
|
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:
|
|
11
|
-
DropdownPanel:
|
|
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,
|
|
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:
|
|
147
|
-
const { defaultPopupVisible:
|
|
148
|
-
defaultPopupVisible:
|
|
149
|
-
popupVisible:
|
|
150
|
-
emit:
|
|
151
|
-
}),
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
popupMaxHeight:
|
|
162
|
-
onOptionClick:
|
|
177
|
+
return C(
|
|
178
|
+
O,
|
|
179
|
+
w({
|
|
180
|
+
popupMaxHeight: c,
|
|
181
|
+
onOptionClick: h
|
|
163
182
|
})
|
|
164
183
|
), {
|
|
165
|
-
|
|
166
|
-
|
|
184
|
+
...r,
|
|
185
|
+
renderTrigger: g,
|
|
186
|
+
className: f,
|
|
187
|
+
computedPopupVisible: a,
|
|
167
188
|
handlePopupVisibleChange: p,
|
|
168
|
-
handleScroll:
|
|
169
|
-
handleReachBottom:
|
|
189
|
+
handleScroll: y,
|
|
190
|
+
handleReachBottom: b
|
|
170
191
|
};
|
|
171
192
|
}
|
|
172
193
|
});
|
|
173
194
|
export {
|
|
174
|
-
|
|
195
|
+
q as default
|
|
175
196
|
};
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { openBlock as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return
|
|
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:
|
|
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.
|
|
12
|
-
|
|
13
|
-
|
|
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 ? (
|
|
16
|
+
e.$slots.icon ? (l(), a("span", {
|
|
16
17
|
key: 0,
|
|
17
|
-
class:
|
|
18
|
+
class: n(e.className.element("icon"))
|
|
18
19
|
}, [
|
|
19
20
|
i(e.$slots, "icon")
|
|
20
|
-
], 2)) :
|
|
21
|
-
|
|
22
|
-
class:
|
|
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 ? (
|
|
27
|
+
e.$slots.suffix ? (l(), a("span", {
|
|
27
28
|
key: 1,
|
|
28
|
-
class:
|
|
29
|
+
class: n(e.className.element("suffix"))
|
|
29
30
|
}, [
|
|
30
31
|
i(e.$slots, "suffix")
|
|
31
|
-
], 2)) :
|
|
32
|
-
], 42,
|
|
32
|
+
], 2)) : d("", !0)
|
|
33
|
+
], 42, t);
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
+
const w = /* @__PURE__ */ m(r, [["render", u]]);
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
w as default
|
|
37
38
|
};
|