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,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { dropdownInjectionKey as
|
|
3
|
-
import { getClassNameMixin as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as y, ref as j, computed as a, inject as m, onBeforeUnmount as p } from "vue";
|
|
2
|
+
import { dropdownInjectionKey as I, dropdownMenuInjectionKey as g } from "./context.js";
|
|
3
|
+
import { getClassNameMixin as w } from "../../_utils/config.js";
|
|
4
|
+
const K = y({
|
|
5
5
|
name: "DropdownOption",
|
|
6
6
|
props: {
|
|
7
7
|
/**
|
|
@@ -36,30 +36,34 @@ const C = r({
|
|
|
36
36
|
* @en Icon
|
|
37
37
|
* @slot icon
|
|
38
38
|
*/
|
|
39
|
-
setup(t, { emit:
|
|
40
|
-
const
|
|
39
|
+
setup(t, { emit: r }) {
|
|
40
|
+
const o = w("dropdown--option"), i = j(), u = a(() => {
|
|
41
41
|
var e;
|
|
42
42
|
return t.value ?? ((e = i.value) == null ? void 0 : e.textContent) ?? void 0;
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
t.disabled || (
|
|
47
|
-
},
|
|
48
|
-
|
|
43
|
+
}), d = t.uninjectContext ? void 0 : m(I, void 0), n = m(g, void 0), c = { element: i, disabled: a(() => t.disabled) }, l = n == null ? void 0 : n.registerItem(c);
|
|
44
|
+
p(() => l == null ? void 0 : l());
|
|
45
|
+
const f = a(() => t.disabled ? -1 : !n || n.activeItem.value === c ? 0 : -1), b = () => n == null ? void 0 : n.setActiveItem(c), s = (e) => {
|
|
46
|
+
t.disabled || (r("click", e), d == null || d.onOptionClick(u.value, e));
|
|
47
|
+
}, v = (e) => {
|
|
48
|
+
t.disabled || e.defaultPrevented || e.isComposing || e.target !== i.value || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s(e));
|
|
49
|
+
}, k = a(() => [
|
|
50
|
+
o.block,
|
|
49
51
|
{
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
+
[o.modifier("disabled")]: t.disabled,
|
|
53
|
+
[o.modifier("active")]: t.active
|
|
52
54
|
}
|
|
53
55
|
]);
|
|
54
56
|
return {
|
|
55
|
-
className:
|
|
56
|
-
cls:
|
|
57
|
+
className: o,
|
|
58
|
+
cls: k,
|
|
57
59
|
liRef: i,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
tabIndex: f,
|
|
61
|
+
handleFocus: b,
|
|
62
|
+
handleClick: s,
|
|
63
|
+
handleKeydown: v
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
66
|
});
|
|
63
67
|
export {
|
|
64
|
-
|
|
68
|
+
K as default
|
|
65
69
|
};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { resolveComponent as s, openBlock as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
return
|
|
1
|
+
import u from "./DropdownSubmenu.vue2.js";
|
|
2
|
+
import { resolveComponent as s, openBlock as f, createBlock as c, withCtx as e, createVNode as p, mergeProps as g, createSlots as r, renderSlot as n, normalizeClass as m } from "vue";
|
|
3
|
+
import b from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
function h(o, C, w, $, P, v) {
|
|
5
|
+
const a = s("IconRight"), t = s("dropdown-option"), l = s("dropdown-panel"), d = s("Trigger");
|
|
6
|
+
return f(), c(d, {
|
|
7
7
|
"popup-visible": o.computedPopupVisible,
|
|
8
8
|
trigger: o.trigger,
|
|
9
9
|
position: o.position,
|
|
10
10
|
disabled: o.disabled,
|
|
11
11
|
"popup-offset": 4,
|
|
12
|
-
onPopupVisibleChange: o.handlePopupVisibleChange
|
|
12
|
+
onPopupVisibleChange: o.handlePopupVisibleChange,
|
|
13
|
+
onShow: o.handleShow
|
|
13
14
|
}, {
|
|
14
15
|
content: e(() => [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
p(l, {
|
|
17
|
+
ref: "panelRef",
|
|
18
|
+
class: m(o.className.block),
|
|
19
|
+
"close-on-arrow-left": "",
|
|
20
|
+
onClose: o.handleClose
|
|
21
|
+
}, r({
|
|
18
22
|
default: e(() => [
|
|
19
23
|
n(o.$slots, "content")
|
|
20
24
|
]),
|
|
@@ -27,36 +31,45 @@ function b(o, $, h, v, P, _) {
|
|
|
27
31
|
]),
|
|
28
32
|
key: "0"
|
|
29
33
|
} : void 0
|
|
30
|
-
]), 1032, ["class"])
|
|
34
|
+
]), 1032, ["class", "onClose"])
|
|
31
35
|
]),
|
|
32
|
-
default: e(() =>
|
|
33
|
-
i
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
fn: e(() => [
|
|
50
|
-
n(o.$slots, "icon")
|
|
36
|
+
default: e(() => {
|
|
37
|
+
var i;
|
|
38
|
+
return [
|
|
39
|
+
p(t, g({ ref: "optionRef" }, o.optionProps, {
|
|
40
|
+
disabled: o.disabled || ((i = o.optionProps) == null ? void 0 : i.disabled),
|
|
41
|
+
active: o.computedPopupVisible,
|
|
42
|
+
"uninject-context": "",
|
|
43
|
+
"aria-haspopup": "menu",
|
|
44
|
+
"aria-expanded": o.computedPopupVisible,
|
|
45
|
+
onKeydownCapture: o.handleTriggerKeydown,
|
|
46
|
+
onFocusinCapture: o.handleTriggerFocus,
|
|
47
|
+
onFocusoutCapture: o.handleTriggerFocus
|
|
48
|
+
}), r({
|
|
49
|
+
suffix: e(() => [
|
|
50
|
+
n(o.$slots, "suffix", {}, () => [
|
|
51
|
+
p(a)
|
|
52
|
+
])
|
|
51
53
|
]),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
default: e(() => [
|
|
55
|
+
n(o.$slots, "default")
|
|
56
|
+
]),
|
|
57
|
+
_: 2
|
|
58
|
+
}, [
|
|
59
|
+
o.$slots.icon ? {
|
|
60
|
+
name: "icon",
|
|
61
|
+
fn: e(() => [
|
|
62
|
+
n(o.$slots, "icon")
|
|
63
|
+
]),
|
|
64
|
+
key: "0"
|
|
65
|
+
} : void 0
|
|
66
|
+
]), 1040, ["disabled", "active", "aria-expanded", "onKeydownCapture", "onFocusinCapture", "onFocusoutCapture"])
|
|
67
|
+
];
|
|
68
|
+
}),
|
|
56
69
|
_: 3
|
|
57
|
-
}, 8, ["popup-visible", "trigger", "position", "disabled", "onPopupVisibleChange"]);
|
|
70
|
+
}, 8, ["popup-visible", "trigger", "position", "disabled", "onPopupVisibleChange", "onShow"]);
|
|
58
71
|
}
|
|
59
|
-
const k = /* @__PURE__ */
|
|
72
|
+
const k = /* @__PURE__ */ b(u, [["render", h]]);
|
|
60
73
|
export {
|
|
61
74
|
k as default
|
|
62
75
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Trigger as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useTrigger as
|
|
7
|
-
import { getClassNameMixin as
|
|
8
|
-
|
|
1
|
+
import { defineComponent as u, toRefs as m, ref as f, computed as g } from "vue";
|
|
2
|
+
import { Trigger as b } from "../trigger/index.js";
|
|
3
|
+
import c from "./dropdown-panel.vue.js";
|
|
4
|
+
import y from "./DropdownOption.vue.js";
|
|
5
|
+
import w from "../../icons/_self/dropdown/more.js";
|
|
6
|
+
import { useTrigger as V } from "../../_hooks/use-trigger.js";
|
|
7
|
+
import { getClassNameMixin as P } from "../../_utils/config.js";
|
|
8
|
+
import { useDropdownKeyboard as h } from "./use-keyboard.js";
|
|
9
|
+
const K = u({
|
|
9
10
|
name: "DropdownSubmenu",
|
|
10
11
|
components: {
|
|
11
|
-
Trigger:
|
|
12
|
-
DropdownPanel:
|
|
13
|
-
DropdownOption:
|
|
14
|
-
IconRight:
|
|
12
|
+
Trigger: b,
|
|
13
|
+
DropdownPanel: c,
|
|
14
|
+
DropdownOption: y,
|
|
15
|
+
IconRight: w
|
|
15
16
|
},
|
|
16
17
|
props: {
|
|
17
18
|
/**
|
|
@@ -77,13 +78,13 @@ const v = s({
|
|
|
77
78
|
}
|
|
78
79
|
},
|
|
79
80
|
emits: {
|
|
80
|
-
"update:popupVisible": (
|
|
81
|
+
"update:popupVisible": (o) => !0,
|
|
81
82
|
/**
|
|
82
83
|
* @zh 下拉框显示状态发生改变时触发
|
|
83
84
|
* @en Triggered when the display status of the drop-down box changes
|
|
84
85
|
* @property {boolean} visible
|
|
85
86
|
*/
|
|
86
|
-
popupVisibleChange: (
|
|
87
|
+
popupVisibleChange: (o) => !0
|
|
87
88
|
},
|
|
88
89
|
/**
|
|
89
90
|
* @zh 子菜单内容
|
|
@@ -102,19 +103,39 @@ const v = s({
|
|
|
102
103
|
* @slot icon
|
|
103
104
|
* @version 2.29.0
|
|
104
105
|
*/
|
|
105
|
-
setup(
|
|
106
|
-
const { defaultPopupVisible:
|
|
107
|
-
defaultPopupVisible:
|
|
108
|
-
popupVisible:
|
|
109
|
-
emit:
|
|
110
|
-
})
|
|
106
|
+
setup(o, { emit: n }) {
|
|
107
|
+
const { defaultPopupVisible: l, popupVisible: s } = m(o), a = P("dropdown--submenu"), { computedPopupVisible: t, handlePopupVisibleChange: i } = V({
|
|
108
|
+
defaultPopupVisible: l,
|
|
109
|
+
popupVisible: s,
|
|
110
|
+
emit: n
|
|
111
|
+
}), p = f(), d = g({
|
|
112
|
+
get: () => {
|
|
113
|
+
var e;
|
|
114
|
+
return (e = p.value) == null ? void 0 : e.$el;
|
|
115
|
+
},
|
|
116
|
+
set: () => {
|
|
117
|
+
}
|
|
118
|
+
}), r = h(
|
|
119
|
+
t,
|
|
120
|
+
i,
|
|
121
|
+
d,
|
|
122
|
+
() => {
|
|
123
|
+
var e;
|
|
124
|
+
return o.disabled || !!((e = o.optionProps) != null && e.disabled);
|
|
125
|
+
}
|
|
126
|
+
);
|
|
111
127
|
return {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
128
|
+
...r,
|
|
129
|
+
optionRef: p,
|
|
130
|
+
className: a,
|
|
131
|
+
computedPopupVisible: t,
|
|
132
|
+
handlePopupVisibleChange: i,
|
|
133
|
+
handleTriggerKeydown: (e) => {
|
|
134
|
+
e.key !== "ArrowDown" && e.key !== "ArrowUp" && r.handleTriggerKeydown(e);
|
|
135
|
+
}
|
|
115
136
|
};
|
|
116
137
|
}
|
|
117
138
|
});
|
|
118
139
|
export {
|
|
119
|
-
|
|
140
|
+
K as default
|
|
120
141
|
};
|
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
import c from "./dropdown-panel.vue2.js";
|
|
2
|
-
import { resolveComponent as s, openBlock as o, createElementBlock as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
return o(),
|
|
7
|
-
|
|
2
|
+
import { resolveComponent as s, openBlock as o, createElementBlock as n, normalizeClass as l, createBlock as t, renderSlot as a, createVNode as y, normalizeStyle as f, withCtx as u, createElementVNode as k, createCommentVNode as N } from "vue";
|
|
3
|
+
import $ from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
function w(e, r, S, E, b, g) {
|
|
5
|
+
const m = s("spin"), p = s("empty"), d = s("Scrollbar");
|
|
6
|
+
return o(), n("div", {
|
|
7
|
+
ref: "panelElement",
|
|
8
|
+
class: l(e.cls),
|
|
9
|
+
tabindex: "-1",
|
|
10
|
+
onKeydown: r[0] || (r[0] = (...i) => e.handleKeydown && e.handleKeydown(...i))
|
|
8
11
|
}, [
|
|
9
|
-
e.loading ? (o(), t(
|
|
12
|
+
e.loading ? (o(), t(m, {
|
|
10
13
|
key: 0,
|
|
11
14
|
class: l(e.className.element("loading")),
|
|
12
15
|
display: "block",
|
|
13
16
|
tip: e.t("common.loading")
|
|
14
|
-
}, null, 8, ["class", "tip"])) : e.isEmpty ? (o(),
|
|
17
|
+
}, null, 8, ["class", "tip"])) : e.isEmpty ? (o(), n("div", {
|
|
15
18
|
key: 1,
|
|
16
19
|
class: l(e.className.element("empty"))
|
|
17
20
|
}, [
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
a(e.$slots, "empty", {}, () => [
|
|
22
|
+
y(p)
|
|
20
23
|
])
|
|
21
|
-
], 2)) : (o(), t(
|
|
24
|
+
], 2)) : (o(), t(d, {
|
|
22
25
|
key: 2,
|
|
23
26
|
ref: "wrapperRef",
|
|
24
27
|
class: l(e.className.element("list--wrapper")),
|
|
25
|
-
style:
|
|
28
|
+
style: f(e.style),
|
|
26
29
|
onScroll: e.handleScroll
|
|
27
30
|
}, {
|
|
28
|
-
default:
|
|
29
|
-
|
|
31
|
+
default: u(() => [
|
|
32
|
+
k("ul", {
|
|
30
33
|
class: l(e.className.element("list")),
|
|
31
34
|
role: "menu"
|
|
32
35
|
}, [
|
|
33
|
-
|
|
36
|
+
a(e.$slots, "default")
|
|
34
37
|
], 2)
|
|
35
38
|
]),
|
|
36
39
|
_: 3
|
|
37
40
|
}, 8, ["class", "style", "onScroll"])),
|
|
38
|
-
e.$slots.footer && !e.loading && !e.isEmpty ? (o(),
|
|
41
|
+
e.$slots.footer && !e.loading && !e.isEmpty ? (o(), n("div", {
|
|
39
42
|
key: 3,
|
|
40
43
|
class: l(e.className.element("footer"))
|
|
41
44
|
}, [
|
|
42
|
-
|
|
43
|
-
], 2)) :
|
|
44
|
-
],
|
|
45
|
+
a(e.$slots, "footer")
|
|
46
|
+
], 2)) : N("", !0)
|
|
47
|
+
], 34);
|
|
45
48
|
}
|
|
46
|
-
const
|
|
49
|
+
const B = /* @__PURE__ */ $(c, [["render", w]]);
|
|
47
50
|
export {
|
|
48
|
-
|
|
51
|
+
B as default
|
|
49
52
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Empty as
|
|
3
|
-
import { dropdownInjectionKey as
|
|
4
|
-
import { isNumber as
|
|
5
|
-
import { Scrollbar as
|
|
6
|
-
import { Spin as
|
|
7
|
-
import { getClassNameMixin as
|
|
8
|
-
import { useLocale as
|
|
9
|
-
const
|
|
1
|
+
import { defineComponent as A, inject as D, ref as d, shallowRef as h, provide as H, watchPostEffect as P, computed as v } from "vue";
|
|
2
|
+
import { Empty as k } from "../empty/index.js";
|
|
3
|
+
import { dropdownInjectionKey as B, dropdownMenuInjectionKey as C } from "./context.js";
|
|
4
|
+
import { isNumber as M } from "../../_utils/is.js";
|
|
5
|
+
import { Scrollbar as L } from "../scrollbar-v2/index.js";
|
|
6
|
+
import { Spin as S } from "../spin/index.js";
|
|
7
|
+
import { getClassNameMixin as _ } from "../../_utils/config.js";
|
|
8
|
+
import { useLocale as T } from "../../locale/index.js";
|
|
9
|
+
const q = A({
|
|
10
10
|
name: "DropdownPanel",
|
|
11
11
|
components: {
|
|
12
|
-
Scrollbar:
|
|
13
|
-
Empty:
|
|
14
|
-
Spin:
|
|
12
|
+
Scrollbar: L,
|
|
13
|
+
Empty: k,
|
|
14
|
+
Spin: S
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
|
+
// private: only submenu panels return to their parent on ArrowLeft.
|
|
18
|
+
closeOnArrowLeft: Boolean,
|
|
17
19
|
loading: {
|
|
18
20
|
type: Boolean,
|
|
19
21
|
default: !1
|
|
@@ -33,37 +35,87 @@ const _ = h({
|
|
|
33
35
|
type: [Function, Array]
|
|
34
36
|
}
|
|
35
37
|
},
|
|
36
|
-
emits: ["scroll", "reachBottom"],
|
|
37
|
-
setup(
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
38
|
+
emits: ["scroll", "reachBottom", "close"],
|
|
39
|
+
setup(m, { emit: c, slots: g, expose: y }) {
|
|
40
|
+
const u = _("dropdown"), { t: w } = T(), i = D(B, {}), b = d(), f = d(), r = h([]), n = h(), p = () => r.value.filter((e) => {
|
|
41
|
+
var o;
|
|
42
|
+
return !e.disabled.value && ((o = e.element.value) == null ? void 0 : o.isConnected);
|
|
43
|
+
}).sort((e, o) => {
|
|
44
|
+
const t = e.element.value.compareDocumentPosition(o.element.value);
|
|
45
|
+
return t & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : t & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
46
|
+
}), I = (e) => {
|
|
47
|
+
e.disabled.value || (n.value = e);
|
|
48
|
+
}, a = (e) => {
|
|
49
|
+
n.value = e;
|
|
50
|
+
const o = (e == null ? void 0 : e.element.value) ?? f.value;
|
|
51
|
+
return o == null || o.focus(), !!(o && document.activeElement === o);
|
|
52
|
+
};
|
|
53
|
+
y({ focus: (e = "first") => {
|
|
54
|
+
const o = p();
|
|
55
|
+
return a(e === "last" ? o.at(-1) : o[0]);
|
|
56
|
+
} }), H(C, {
|
|
57
|
+
activeItem: n,
|
|
58
|
+
setActiveItem: I,
|
|
59
|
+
registerItem: (e) => (r.value = [...r.value, e], () => {
|
|
60
|
+
r.value = r.value.filter((o) => o !== e);
|
|
61
|
+
})
|
|
62
|
+
}), P(() => {
|
|
63
|
+
var o;
|
|
64
|
+
const e = p();
|
|
65
|
+
if (!n.value || !e.includes(n.value)) {
|
|
66
|
+
const t = ((o = n.value) == null ? void 0 : o.element.value) === document.activeElement;
|
|
67
|
+
n.value = e[0], t && a(n.value);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const E = (e) => {
|
|
71
|
+
if (e.defaultPrevented || e.isComposing) return;
|
|
72
|
+
if (e.key === "Escape" || m.closeOnArrowLeft && e.key === "ArrowLeft") {
|
|
73
|
+
e.preventDefault(), e.stopPropagation(), c("close");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
|
|
77
|
+
const o = p(), t = e.target;
|
|
78
|
+
if (t !== f.value && !r.value.some((l) => l.element.value === t))
|
|
79
|
+
return;
|
|
80
|
+
e.preventDefault(), e.stopPropagation();
|
|
81
|
+
const s = o.findIndex((l) => l.element.value === t);
|
|
82
|
+
if (e.key === "Home") a(o[0]);
|
|
83
|
+
else if (e.key === "End") a(o.at(-1));
|
|
84
|
+
else if (o.length) {
|
|
85
|
+
const l = s < 0 ? e.key === "ArrowUp" ? o.length - 1 : 0 : (s + (e.key === "ArrowDown" ? 1 : -1) + o.length) % o.length;
|
|
86
|
+
a(o[l]);
|
|
87
|
+
}
|
|
88
|
+
}, x = (e) => {
|
|
89
|
+
const { scrollTop: o, scrollHeight: t, offsetHeight: s } = e.target;
|
|
90
|
+
t - (o + s) <= m.bottomOffset && c("reachBottom", e), c("scroll", e);
|
|
91
|
+
}, N = v(() => {
|
|
92
|
+
if (M(i.popupMaxHeight))
|
|
43
93
|
return {
|
|
44
|
-
maxHeight: `${
|
|
94
|
+
maxHeight: `${i.popupMaxHeight}px`
|
|
45
95
|
};
|
|
46
|
-
if (!
|
|
96
|
+
if (!i.popupMaxHeight)
|
|
47
97
|
return {
|
|
48
98
|
maxHeight: "none",
|
|
49
99
|
overflowY: "hidden"
|
|
50
100
|
};
|
|
51
|
-
}),
|
|
52
|
-
|
|
101
|
+
}), O = v(() => [
|
|
102
|
+
u.block,
|
|
53
103
|
{
|
|
54
|
-
[
|
|
104
|
+
[u.modifier("has-footer")]: !!g.footer
|
|
55
105
|
}
|
|
56
106
|
]);
|
|
57
107
|
return {
|
|
58
|
-
className:
|
|
59
|
-
cls:
|
|
60
|
-
style:
|
|
61
|
-
wrapperRef:
|
|
62
|
-
|
|
63
|
-
|
|
108
|
+
className: u,
|
|
109
|
+
cls: O,
|
|
110
|
+
style: N,
|
|
111
|
+
wrapperRef: b,
|
|
112
|
+
panelElement: f,
|
|
113
|
+
handleKeydown: E,
|
|
114
|
+
handleScroll: x,
|
|
115
|
+
t: w
|
|
64
116
|
};
|
|
65
117
|
}
|
|
66
118
|
});
|
|
67
119
|
export {
|
|
68
|
-
|
|
120
|
+
q as default
|
|
69
121
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ref as h, watch as y, nextTick as u } from "vue";
|
|
2
|
+
const v = (n, f, i, c = () => !1) => {
|
|
3
|
+
const s = h();
|
|
4
|
+
let t, r = !1, o = !1;
|
|
5
|
+
const l = () => {
|
|
6
|
+
!n.value || !t || !s.value || (o = !0, s.value.focus(t) && (t = void 0), o = !1);
|
|
7
|
+
}, p = () => {
|
|
8
|
+
l(), t = void 0;
|
|
9
|
+
}, m = (e) => {
|
|
10
|
+
if (c() || e.defaultPrevented || e.isComposing) return;
|
|
11
|
+
const a = e.currentTarget;
|
|
12
|
+
if (!a.matches(':disabled, [aria-disabled="true"]')) {
|
|
13
|
+
if (e.key === "Escape" && n.value)
|
|
14
|
+
d();
|
|
15
|
+
else if (["Enter", " ", "ArrowDown", "ArrowUp", "ArrowRight"].includes(e.key)) {
|
|
16
|
+
if (e.preventDefault(), e.repeat) return;
|
|
17
|
+
i.value = a, r = !1, t = e.key === "ArrowUp" ? "last" : "first", f(!0), u(l);
|
|
18
|
+
} else
|
|
19
|
+
return;
|
|
20
|
+
e.preventDefault(), e.stopImmediatePropagation();
|
|
21
|
+
}
|
|
22
|
+
}, d = () => {
|
|
23
|
+
t = void 0, r = !0, f(!1);
|
|
24
|
+
}, g = (e) => {
|
|
25
|
+
e instanceof KeyboardEvent && (r = !0);
|
|
26
|
+
}, w = (e) => {
|
|
27
|
+
o && e.stopImmediatePropagation();
|
|
28
|
+
};
|
|
29
|
+
return y(n, (e) => {
|
|
30
|
+
e ? u(l) : (t = void 0, r && (r = !1, u(() => {
|
|
31
|
+
var a;
|
|
32
|
+
o = !0, (a = i.value) == null || a.focus(), o = !1;
|
|
33
|
+
})));
|
|
34
|
+
}), {
|
|
35
|
+
panelRef: s,
|
|
36
|
+
handleShow: p,
|
|
37
|
+
handleTriggerKeydown: m,
|
|
38
|
+
handleTriggerFocus: w,
|
|
39
|
+
handleClose: d,
|
|
40
|
+
handleKeyboardSelect: g
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
v as useDropdownKeyboard
|
|
45
|
+
};
|