x-next 1.18.0 → 1.18.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/catalog.md +1 -1
- package/AI_USAGE/components/alert-api.md +1 -1
- package/AI_USAGE/components/alert.md +1 -1
- package/AI_USAGE/components/bar-chart-api.md +1 -1
- package/AI_USAGE/components/bar-chart.md +1 -1
- package/AI_USAGE/components/boxicons.md +1 -1
- package/AI_USAGE/components/button-api.md +1 -1
- package/AI_USAGE/components/button.md +4 -4
- package/AI_USAGE/components/charts.md +1 -1
- package/AI_USAGE/components/checkbox-api.md +1 -1
- package/AI_USAGE/components/checkbox.md +1 -1
- package/AI_USAGE/components/color-picker-api.md +1 -1
- package/AI_USAGE/components/color-picker.md +1 -1
- package/AI_USAGE/components/config-provider-api.md +1 -1
- package/AI_USAGE/components/config-provider.md +1 -1
- package/AI_USAGE/components/date-picker-api.md +44 -26
- package/AI_USAGE/components/date-picker.md +78 -3
- package/AI_USAGE/components/dialog-api.md +2 -2
- package/AI_USAGE/components/dialog.md +5 -1
- package/AI_USAGE/components/draggable-api.md +1 -1
- package/AI_USAGE/components/draggable.md +1 -1
- package/AI_USAGE/components/drawer-api.md +1 -1
- package/AI_USAGE/components/drawer.md +1 -1
- package/AI_USAGE/components/dropdown-api.md +6 -1
- package/AI_USAGE/components/dropdown.md +2 -2
- package/AI_USAGE/components/empty-api.md +1 -1
- package/AI_USAGE/components/empty.md +1 -1
- package/AI_USAGE/components/finicon.md +1 -1
- package/AI_USAGE/components/form-api.md +1 -1
- package/AI_USAGE/components/form.md +1 -1
- package/AI_USAGE/components/grid-api.md +1 -1
- package/AI_USAGE/components/grid.md +1 -1
- package/AI_USAGE/components/heatmap-api.md +1 -1
- package/AI_USAGE/components/heatmap.md +1 -1
- package/AI_USAGE/components/icon-api.md +1 -1
- package/AI_USAGE/components/icon.md +1 -1
- package/AI_USAGE/components/image-api.md +1 -1
- package/AI_USAGE/components/image.md +1 -1
- package/AI_USAGE/components/input-api.md +1 -1
- package/AI_USAGE/components/input-number-api.md +1 -1
- package/AI_USAGE/components/input-number.md +1 -1
- package/AI_USAGE/components/input-tag-api.md +1 -1
- package/AI_USAGE/components/input-tag.md +1 -1
- package/AI_USAGE/components/input.md +1 -1
- package/AI_USAGE/components/layout-api.md +1 -1
- package/AI_USAGE/components/layout.md +1 -1
- package/AI_USAGE/components/line-chart-api.md +1 -1
- package/AI_USAGE/components/line-chart.md +1 -1
- package/AI_USAGE/components/link-api.md +1 -1
- package/AI_USAGE/components/link.md +1 -1
- package/AI_USAGE/components/menu-api.md +1 -1
- package/AI_USAGE/components/menu.md +1 -1
- package/AI_USAGE/components/message-api.md +1 -1
- package/AI_USAGE/components/message-box-api.md +1 -1
- package/AI_USAGE/components/message-box.md +1 -1
- package/AI_USAGE/components/message.md +1 -1
- package/AI_USAGE/components/network-api.md +1 -1
- package/AI_USAGE/components/network.md +1 -1
- package/AI_USAGE/components/notification-api.md +1 -1
- package/AI_USAGE/components/notification.md +1 -1
- package/AI_USAGE/components/pagination-api.md +1 -1
- package/AI_USAGE/components/pagination.md +1 -1
- package/AI_USAGE/components/pie-chart-api.md +1 -1
- package/AI_USAGE/components/pie-chart.md +1 -1
- package/AI_USAGE/components/popconfirm-api.md +1 -1
- package/AI_USAGE/components/popconfirm.md +1 -1
- package/AI_USAGE/components/popover-api.md +1 -1
- package/AI_USAGE/components/popover.md +3 -1
- package/AI_USAGE/components/popup-api.md +1 -1
- package/AI_USAGE/components/popup.md +1 -1
- package/AI_USAGE/components/progress-api.md +1 -1
- package/AI_USAGE/components/progress.md +1 -1
- package/AI_USAGE/components/radio-api.md +1 -1
- package/AI_USAGE/components/radio.md +1 -1
- package/AI_USAGE/components/rate-api.md +1 -1
- package/AI_USAGE/components/rate.md +1 -1
- package/AI_USAGE/components/resize-box-api.md +1 -1
- package/AI_USAGE/components/resize-box.md +1 -1
- package/AI_USAGE/components/scrollbar-api.md +1 -1
- package/AI_USAGE/components/scrollbar.md +1 -1
- package/AI_USAGE/components/select-api.md +1 -1
- package/AI_USAGE/components/select.md +1 -1
- package/AI_USAGE/components/skeleton-api.md +1 -1
- package/AI_USAGE/components/skeleton.md +1 -1
- package/AI_USAGE/components/slider-api.md +1 -1
- package/AI_USAGE/components/slider.md +1 -1
- package/AI_USAGE/components/space-api.md +1 -1
- package/AI_USAGE/components/space.md +1 -1
- package/AI_USAGE/components/spin-api.md +1 -1
- package/AI_USAGE/components/spin.md +1 -1
- package/AI_USAGE/components/steps-api.md +1 -1
- package/AI_USAGE/components/steps.md +1 -1
- package/AI_USAGE/components/switch-api.md +1 -1
- package/AI_USAGE/components/switch.md +1 -1
- package/AI_USAGE/components/table-api.md +1 -1
- package/AI_USAGE/components/table.md +1 -1
- package/AI_USAGE/components/tabs-api.md +1 -1
- package/AI_USAGE/components/tabs.md +1 -1
- package/AI_USAGE/components/tag-api.md +1 -1
- package/AI_USAGE/components/tag.md +1 -1
- package/AI_USAGE/components/textarea-api.md +1 -1
- package/AI_USAGE/components/textarea.md +1 -1
- package/AI_USAGE/components/time-picker-api.md +1 -1
- package/AI_USAGE/components/time-picker.md +1 -1
- package/AI_USAGE/components/time-range-selector-api.md +1 -1
- package/AI_USAGE/components/time-range-selector.md +1 -1
- package/AI_USAGE/components/timeline-api.md +1 -1
- package/AI_USAGE/components/timeline.md +1 -1
- package/AI_USAGE/components/tooltip-api.md +1 -1
- package/AI_USAGE/components/tooltip.md +1 -1
- package/AI_USAGE/components/transfer-api.md +1 -1
- package/AI_USAGE/components/transfer.md +1 -1
- package/AI_USAGE/components/tree-select-api.md +1 -1
- package/AI_USAGE/components/tree-select.md +1 -1
- package/AI_USAGE/components/trend-chart-api.md +1 -1
- package/AI_USAGE/components/trend-chart.md +1 -1
- package/AI_USAGE/components/trigger-api.md +1 -1
- package/AI_USAGE/components/trigger.md +1 -1
- package/AI_USAGE/components/upload-api.md +1 -1
- package/AI_USAGE/components/upload.md +1 -1
- package/AI_USAGE/components/watermark-api.md +1 -1
- package/AI_USAGE/components/watermark.md +1 -1
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +1 -1
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +138 -34
- package/CHANGELOG.md +16 -0
- package/dist/_container/render-function.d.ts +2 -2
- package/dist/components/_components/picker/input-range.vue.d.ts +1 -1
- package/dist/components/date-picker/DatePanel.vue.d.ts +10 -1
- package/dist/components/date-picker/DatePicker.vue.d.ts +22 -10
- package/dist/components/date-picker/index.d.ts +156 -54
- package/dist/components/date-picker/utils.d.ts +4 -4
- package/dist/components/dropdown/Dropdown.vue.d.ts +1 -0
- package/dist/components/dropdown/DropdownButton.vue.d.ts +1 -0
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +1 -0
- package/dist/components/dropdown/context.d.ts +1 -0
- package/dist/components/dropdown/index.d.ts +8 -0
- package/dist/components/dropdown/use-keyboard.d.ts +1 -0
- package/dist/components/menu/MenuItem.d.ts +2 -2
- package/dist/components/menu/context.d.ts +3 -3
- package/dist/components/menu/index.d.ts +6 -6
- package/dist/components/menu/sub-menu-pop.vue.d.ts +2 -2
- package/dist/components/time-picker/TimePicker.vue.d.ts +1 -1
- package/dist/components/time-picker/index.d.ts +2 -2
- package/dist/es/components/_components/picker/input-range.vue.js +12 -12
- package/dist/es/components/_components/picker/input-range.vue2.js +45 -45
- package/dist/es/components/_components/picker/input.vue2.js +24 -24
- package/dist/es/components/date-picker/DatePanel.vue.js +47 -47
- package/dist/es/components/date-picker/DatePanel.vue2.js +68 -59
- package/dist/es/components/date-picker/DatePicker.vue.js +65 -59
- package/dist/es/components/date-picker/DatePicker.vue2.js +387 -284
- package/dist/es/components/date-picker/index.js +57 -36
- package/dist/es/components/date-picker/utils.js +132 -122
- package/dist/es/components/dialog/Dialog.js +43 -40
- package/dist/es/components/dialog/props.js +1 -1
- package/dist/es/components/dropdown/Dropdown.vue2.js +66 -50
- package/dist/es/components/dropdown/dropdown-panel.vue2.js +48 -43
- package/dist/es/components/dropdown/use-keyboard.js +36 -28
- package/dist/es/components/popover/Popover.js +72 -32
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/button.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/dialog.css +1 -1
- package/dist/style/message-box.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Trigger as
|
|
1
|
+
import { defineComponent as O, toRefs as T, watch as P, onBeforeUnmount as S, provide as v, reactive as V } from "vue";
|
|
2
|
+
import { Trigger as E } from "../trigger/index.js";
|
|
3
3
|
import F from "./dropdown-panel.vue.js";
|
|
4
|
-
import { useTrigger as
|
|
5
|
-
import { dropdownInjectionKey as
|
|
6
|
-
import { getClassNameMixin as
|
|
7
|
-
import
|
|
8
|
-
import { useFirstElement as
|
|
9
|
-
import { mergeFirstChild as
|
|
10
|
-
import { useDropdownKeyboard as
|
|
11
|
-
const
|
|
4
|
+
import { useTrigger as K } from "../../_hooks/use-trigger.js";
|
|
5
|
+
import { dropdownInjectionKey as D } from "./context.js";
|
|
6
|
+
import { getClassNameMixin as x } from "../../_utils/config.js";
|
|
7
|
+
import N from "../../_container/render-function.js";
|
|
8
|
+
import { useFirstElement as R } from "../../_hooks/use-first-element.js";
|
|
9
|
+
import { mergeFirstChild as A } from "../../_utils/vue-eco.js";
|
|
10
|
+
import { useDropdownKeyboard as M } from "./use-keyboard.js";
|
|
11
|
+
const l = /* @__PURE__ */ new Set(), Q = O({
|
|
12
12
|
name: "Dropdown",
|
|
13
13
|
components: {
|
|
14
|
-
Trigger:
|
|
14
|
+
Trigger: E,
|
|
15
15
|
DropdownPanel: F,
|
|
16
|
-
RenderFunction:
|
|
16
|
+
RenderFunction: N
|
|
17
17
|
},
|
|
18
18
|
props: {
|
|
19
19
|
/**
|
|
@@ -105,32 +105,32 @@ const q = v({
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
emits: {
|
|
108
|
-
"update:popupVisible": (
|
|
108
|
+
"update:popupVisible": (r) => !0,
|
|
109
109
|
/**
|
|
110
110
|
* @zh 下拉框显示状态发生改变时触发
|
|
111
111
|
* @en Triggered when the display status of the drop-down box changes
|
|
112
112
|
* @param {boolean} visible
|
|
113
113
|
*/
|
|
114
|
-
popupVisibleChange: (
|
|
114
|
+
popupVisibleChange: (r) => !0,
|
|
115
115
|
/**
|
|
116
116
|
* @zh 用户选择时触发
|
|
117
117
|
* @en Triggered when the user selects
|
|
118
118
|
* @param {string | number | Record<string, any> | undefined } value
|
|
119
119
|
* @param {Event} ev
|
|
120
120
|
*/
|
|
121
|
-
select: (
|
|
121
|
+
select: (r, n) => !0,
|
|
122
122
|
/**
|
|
123
123
|
* @zh 下拉菜单滚动时触发
|
|
124
124
|
* @en Triggered when the dropdown scrolls
|
|
125
125
|
* @param {Event} ev
|
|
126
126
|
*/
|
|
127
|
-
scroll: (
|
|
127
|
+
scroll: (r) => !0,
|
|
128
128
|
/**
|
|
129
129
|
* @zh 下拉菜单滚动到底部时触发
|
|
130
130
|
* @en Triggered when the dropdown reaches bottom
|
|
131
131
|
* @param {Event} ev
|
|
132
132
|
*/
|
|
133
|
-
reachBottom: (
|
|
133
|
+
reachBottom: (r) => !0
|
|
134
134
|
},
|
|
135
135
|
/**
|
|
136
136
|
* @zh 内容
|
|
@@ -148,19 +148,34 @@ const q = v({
|
|
|
148
148
|
* @en Empty content
|
|
149
149
|
* @slot empty
|
|
150
150
|
*/
|
|
151
|
-
setup(
|
|
152
|
-
const { defaultPopupVisible:
|
|
153
|
-
defaultPopupVisible:
|
|
154
|
-
popupVisible:
|
|
155
|
-
emit:
|
|
156
|
-
}), { children:
|
|
151
|
+
setup(r, { emit: n, slots: i }) {
|
|
152
|
+
const { defaultPopupVisible: y, popupVisible: g, popupMaxHeight: b } = T(r), h = x("dropdown"), { computedPopupVisible: a, handlePopupVisibleChange: p } = K({
|
|
153
|
+
defaultPopupVisible: y,
|
|
154
|
+
popupVisible: g,
|
|
155
|
+
emit: n
|
|
156
|
+
}), { children: u, firstElement: s } = R(), o = M(
|
|
157
157
|
a,
|
|
158
158
|
p,
|
|
159
|
-
|
|
160
|
-
),
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
s
|
|
160
|
+
), d = Symbol("dropdown"), m = (e) => {
|
|
161
|
+
var t;
|
|
162
|
+
if (!(e.isComposing || e.keyCode === 229 || e.defaultPrevented || Array.from(l).at(-1) !== d)) {
|
|
163
|
+
if (e.key === "Escape" && (e.target === document.body || e.target === document.documentElement || (t = s.value) != null && t.contains(e.target))) {
|
|
164
|
+
o.handleClose(), e.preventDefault(), e.stopPropagation();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
e.key === "Tab" && (o.handleTabOut(), e.stopPropagation());
|
|
168
|
+
}
|
|
169
|
+
}, c = () => {
|
|
170
|
+
l.delete(d), typeof document < "u" && document.removeEventListener("keydown", m, !0);
|
|
171
|
+
};
|
|
172
|
+
P(a, (e) => {
|
|
173
|
+
c(), e && typeof document < "u" && (l.add(d), document.addEventListener("keydown", m, !0));
|
|
174
|
+
}, { immediate: !0 }), S(c);
|
|
175
|
+
const w = (e) => {
|
|
176
|
+
var t;
|
|
177
|
+
return u.value = ((t = i.default) == null ? void 0 : t.call(i)) ?? [], A(u.value, {
|
|
178
|
+
...e,
|
|
164
179
|
/*
|
|
165
180
|
* 根触发器补菜单语义。子菜单的触发器已在 DropdownSubmenu 上声明
|
|
166
181
|
* aria-haspopup/aria-expanded,根触发器此前没有,读屏无法得知
|
|
@@ -168,36 +183,37 @@ const q = v({
|
|
|
168
183
|
*/
|
|
169
184
|
"aria-haspopup": "menu",
|
|
170
185
|
"aria-expanded": a.value ? "true" : "false",
|
|
171
|
-
onKeydown: (
|
|
172
|
-
|
|
186
|
+
onKeydown: (f) => {
|
|
187
|
+
f.key !== "ArrowRight" && o.handleTriggerKeydown(f);
|
|
173
188
|
},
|
|
174
|
-
onFocusinCapture:
|
|
175
|
-
onFocusoutCapture:
|
|
176
|
-
}),
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
|
|
189
|
+
onFocusinCapture: o.handleTriggerFocus,
|
|
190
|
+
onFocusoutCapture: o.handleTriggerFocus
|
|
191
|
+
}), u.value;
|
|
192
|
+
}, C = (e, t) => {
|
|
193
|
+
n("select", e, t), r.hideOnSelect && (o.handleKeyboardSelect(t), p(!1));
|
|
194
|
+
}, k = (e) => {
|
|
195
|
+
n("scroll", e);
|
|
196
|
+
}, B = (e) => {
|
|
197
|
+
n("reachBottom", e);
|
|
183
198
|
};
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
popupMaxHeight:
|
|
188
|
-
|
|
199
|
+
return v(
|
|
200
|
+
D,
|
|
201
|
+
V({
|
|
202
|
+
popupMaxHeight: b,
|
|
203
|
+
onTabOut: o.handleTabOut,
|
|
204
|
+
onOptionClick: C
|
|
189
205
|
})
|
|
190
206
|
), {
|
|
191
|
-
...
|
|
192
|
-
renderTrigger:
|
|
193
|
-
className:
|
|
207
|
+
...o,
|
|
208
|
+
renderTrigger: w,
|
|
209
|
+
className: h,
|
|
194
210
|
computedPopupVisible: a,
|
|
195
211
|
handlePopupVisibleChange: p,
|
|
196
|
-
handleScroll:
|
|
197
|
-
handleReachBottom:
|
|
212
|
+
handleScroll: k,
|
|
213
|
+
handleReachBottom: B
|
|
198
214
|
};
|
|
199
215
|
}
|
|
200
216
|
});
|
|
201
217
|
export {
|
|
202
|
-
|
|
218
|
+
Q as default
|
|
203
219
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Empty as
|
|
3
|
-
import { dropdownInjectionKey as
|
|
4
|
-
import { isNumber as
|
|
1
|
+
import { defineComponent as k, inject as D, ref as h, shallowRef as y, provide as H, watchPostEffect as P, computed as g } from "vue";
|
|
2
|
+
import { Empty as B } from "../empty/index.js";
|
|
3
|
+
import { dropdownInjectionKey as M, dropdownMenuInjectionKey as T } from "./context.js";
|
|
4
|
+
import { isNumber as C } from "../../_utils/is.js";
|
|
5
5
|
import { Scrollbar as L } from "../scrollbar-v2/index.js";
|
|
6
6
|
import { Spin as S } from "../spin/index.js";
|
|
7
7
|
import { getClassNameMixin as _ } from "../../_utils/config.js";
|
|
8
|
-
import { useLocale as
|
|
9
|
-
const
|
|
8
|
+
import { useLocale as F } from "../../locale/index.js";
|
|
9
|
+
const z = k({
|
|
10
10
|
name: "DropdownPanel",
|
|
11
11
|
components: {
|
|
12
12
|
Scrollbar: L,
|
|
13
|
-
Empty:
|
|
13
|
+
Empty: B,
|
|
14
14
|
Spin: S
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
@@ -36,86 +36,91 @@ const q = A({
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
emits: ["scroll", "reachBottom", "close"],
|
|
39
|
-
setup(
|
|
40
|
-
const
|
|
39
|
+
setup(d, { emit: u, slots: v, expose: w }) {
|
|
40
|
+
const i = _("dropdown"), { t: b } = F(), r = D(M, {}), I = h(), f = h(), l = y([]), n = y(), m = () => l.value.filter((e) => {
|
|
41
41
|
var o;
|
|
42
42
|
return !e.disabled.value && ((o = e.element.value) == null ? void 0 : o.isConnected);
|
|
43
43
|
}).sort((e, o) => {
|
|
44
44
|
const t = e.element.value.compareDocumentPosition(o.element.value);
|
|
45
45
|
return t & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : t & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
46
|
-
}),
|
|
46
|
+
}), E = (e) => {
|
|
47
47
|
e.disabled.value || (n.value = e);
|
|
48
48
|
}, a = (e) => {
|
|
49
49
|
n.value = e;
|
|
50
50
|
const o = (e == null ? void 0 : e.element.value) ?? f.value;
|
|
51
51
|
return o == null || o.focus(), !!(o && document.activeElement === o);
|
|
52
52
|
};
|
|
53
|
-
|
|
54
|
-
const o =
|
|
53
|
+
w({ focus: (e = "first") => {
|
|
54
|
+
const o = m();
|
|
55
55
|
return a(e === "last" ? o.at(-1) : o[0]);
|
|
56
|
-
} }), H(
|
|
56
|
+
} }), H(T, {
|
|
57
57
|
activeItem: n,
|
|
58
|
-
setActiveItem:
|
|
59
|
-
registerItem: (e) => (
|
|
60
|
-
|
|
58
|
+
setActiveItem: E,
|
|
59
|
+
registerItem: (e) => (l.value = [...l.value, e], () => {
|
|
60
|
+
l.value = l.value.filter((o) => o !== e);
|
|
61
61
|
})
|
|
62
62
|
}), P(() => {
|
|
63
63
|
var o;
|
|
64
|
-
const e =
|
|
64
|
+
const e = m();
|
|
65
65
|
if (!n.value || !e.includes(n.value)) {
|
|
66
66
|
const t = ((o = n.value) == null ? void 0 : o.element.value) === document.activeElement;
|
|
67
67
|
n.value = e[0], t && a(n.value);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
const
|
|
70
|
+
const O = (e) => {
|
|
71
|
+
var p;
|
|
71
72
|
if (e.defaultPrevented || e.isComposing) return;
|
|
72
|
-
if (e.key === "
|
|
73
|
-
|
|
73
|
+
if (e.key === "Tab") {
|
|
74
|
+
(p = r.onTabOut) == null || p.call(r);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (e.key === "Escape" || d.closeOnArrowLeft && e.key === "ArrowLeft") {
|
|
78
|
+
e.preventDefault(), e.stopPropagation(), u("close");
|
|
74
79
|
return;
|
|
75
80
|
}
|
|
76
81
|
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
|
|
77
|
-
const o =
|
|
78
|
-
if (t !== f.value && !
|
|
82
|
+
const o = m(), t = e.target;
|
|
83
|
+
if (t !== f.value && !l.value.some((s) => s.element.value === t))
|
|
79
84
|
return;
|
|
80
85
|
e.preventDefault(), e.stopPropagation();
|
|
81
|
-
const
|
|
86
|
+
const c = o.findIndex((s) => s.element.value === t);
|
|
82
87
|
if (e.key === "Home") a(o[0]);
|
|
83
88
|
else if (e.key === "End") a(o.at(-1));
|
|
84
89
|
else if (o.length) {
|
|
85
|
-
const
|
|
86
|
-
a(o[
|
|
90
|
+
const s = c < 0 ? e.key === "ArrowUp" ? o.length - 1 : 0 : (c + (e.key === "ArrowDown" ? 1 : -1) + o.length) % o.length;
|
|
91
|
+
a(o[s]);
|
|
87
92
|
}
|
|
88
|
-
},
|
|
89
|
-
const { scrollTop: o, scrollHeight: t, offsetHeight:
|
|
90
|
-
t - (o +
|
|
91
|
-
},
|
|
92
|
-
if (
|
|
93
|
+
}, N = (e) => {
|
|
94
|
+
const { scrollTop: o, scrollHeight: t, offsetHeight: c } = e.target;
|
|
95
|
+
t - (o + c) <= d.bottomOffset && u("reachBottom", e), u("scroll", e);
|
|
96
|
+
}, x = g(() => {
|
|
97
|
+
if (C(r.popupMaxHeight))
|
|
93
98
|
return {
|
|
94
|
-
maxHeight: `${
|
|
99
|
+
maxHeight: `${r.popupMaxHeight}px`
|
|
95
100
|
};
|
|
96
|
-
if (!
|
|
101
|
+
if (!r.popupMaxHeight)
|
|
97
102
|
return {
|
|
98
103
|
maxHeight: "none",
|
|
99
104
|
overflowY: "hidden"
|
|
100
105
|
};
|
|
101
|
-
}),
|
|
102
|
-
|
|
106
|
+
}), A = g(() => [
|
|
107
|
+
i.block,
|
|
103
108
|
{
|
|
104
|
-
[
|
|
109
|
+
[i.modifier("has-footer")]: !!v.footer
|
|
105
110
|
}
|
|
106
111
|
]);
|
|
107
112
|
return {
|
|
108
|
-
className:
|
|
109
|
-
cls:
|
|
110
|
-
style:
|
|
111
|
-
wrapperRef:
|
|
113
|
+
className: i,
|
|
114
|
+
cls: A,
|
|
115
|
+
style: x,
|
|
116
|
+
wrapperRef: I,
|
|
112
117
|
panelElement: f,
|
|
113
|
-
handleKeydown:
|
|
114
|
-
handleScroll:
|
|
115
|
-
t:
|
|
118
|
+
handleKeydown: O,
|
|
119
|
+
handleScroll: N,
|
|
120
|
+
t: b
|
|
116
121
|
};
|
|
117
122
|
}
|
|
118
123
|
});
|
|
119
124
|
export {
|
|
120
|
-
|
|
125
|
+
z as default
|
|
121
126
|
};
|
|
@@ -1,45 +1,53 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
let t,
|
|
5
|
-
const
|
|
6
|
-
!n.value || !t || !
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
if (
|
|
1
|
+
import { ref as g, watch as v, nextTick as d } from "vue";
|
|
2
|
+
const k = (n, s, u, p = () => !1) => {
|
|
3
|
+
const l = g();
|
|
4
|
+
let t, o = !1, r = !1;
|
|
5
|
+
const f = () => {
|
|
6
|
+
!n.value || !t || !l.value || (r = !0, l.value.focus(t) && (t = void 0), r = !1);
|
|
7
|
+
}, m = () => {
|
|
8
|
+
f(), t = void 0;
|
|
9
|
+
}, w = (e) => {
|
|
10
|
+
if (p() || e.defaultPrevented || e.isComposing) return;
|
|
11
11
|
const a = e.currentTarget;
|
|
12
12
|
if (!a.matches(':disabled, [aria-disabled="true"]')) {
|
|
13
|
+
if (e.key === "Tab" && n.value) {
|
|
14
|
+
i();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
13
17
|
if (e.key === "Escape" && n.value)
|
|
14
|
-
|
|
18
|
+
c();
|
|
15
19
|
else if (["Enter", " ", "ArrowDown", "ArrowUp", "ArrowRight"].includes(e.key)) {
|
|
16
20
|
if (e.preventDefault(), e.repeat) return;
|
|
17
|
-
|
|
21
|
+
u.value = a, o = !1, t = e.key === "ArrowUp" ? "last" : "first", s(!0), d(f);
|
|
18
22
|
} else
|
|
19
23
|
return;
|
|
20
24
|
e.preventDefault(), e.stopImmediatePropagation();
|
|
21
25
|
}
|
|
22
|
-
},
|
|
23
|
-
t = void 0,
|
|
24
|
-
},
|
|
25
|
-
e
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
}, c = () => {
|
|
27
|
+
t = void 0, o = !0, s(!1);
|
|
28
|
+
}, i = () => {
|
|
29
|
+
var e;
|
|
30
|
+
t = void 0, o = !1, s(!1), r = !0, (e = u.value) == null || e.focus({ preventScroll: !0 }), r = !1;
|
|
31
|
+
}, h = (e) => {
|
|
32
|
+
e instanceof KeyboardEvent && (o = !0);
|
|
33
|
+
}, y = (e) => {
|
|
34
|
+
r && e.stopImmediatePropagation();
|
|
28
35
|
};
|
|
29
|
-
return
|
|
30
|
-
e ?
|
|
36
|
+
return v(n, (e) => {
|
|
37
|
+
e ? d(f) : (t = void 0, o && (o = !1, d(() => {
|
|
31
38
|
var a;
|
|
32
|
-
|
|
39
|
+
r = !0, (a = u.value) == null || a.focus(), r = !1;
|
|
33
40
|
})));
|
|
34
41
|
}), {
|
|
35
|
-
panelRef:
|
|
36
|
-
handleShow:
|
|
37
|
-
handleTriggerKeydown:
|
|
38
|
-
handleTriggerFocus:
|
|
39
|
-
handleClose:
|
|
40
|
-
|
|
42
|
+
panelRef: l,
|
|
43
|
+
handleShow: m,
|
|
44
|
+
handleTriggerKeydown: w,
|
|
45
|
+
handleTriggerFocus: y,
|
|
46
|
+
handleClose: c,
|
|
47
|
+
handleTabOut: i,
|
|
48
|
+
handleKeyboardSelect: h
|
|
41
49
|
};
|
|
42
50
|
};
|
|
43
51
|
export {
|
|
44
|
-
|
|
52
|
+
k as useDropdownKeyboard
|
|
45
53
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Trigger as
|
|
3
|
-
import { getComponentPrefix as
|
|
4
|
-
import { popoverProps as
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { defineComponent as x, ref as F, computed as u, watch as A, onBeforeUnmount as B, createVNode as l, mergeProps as K, nextTick as N } from "vue";
|
|
2
|
+
import { Trigger as L } from "../trigger/index.js";
|
|
3
|
+
import { getComponentPrefix as W, getClassNameMixin as H } from "../../_utils/config.js";
|
|
4
|
+
import { popoverProps as M } from "./props.js";
|
|
5
|
+
import { useFirstElement as I } from "../../_hooks/use-first-element.js";
|
|
6
|
+
import { mergeFirstChild as j } from "../../_utils/vue-eco.js";
|
|
7
|
+
import R from "../../_container/render-function.js";
|
|
8
|
+
const p = /* @__PURE__ */ new Set(), Y = /* @__PURE__ */ x({
|
|
9
|
+
name: W("Popover"),
|
|
7
10
|
inheritAttrs: !1,
|
|
8
|
-
props:
|
|
11
|
+
props: M,
|
|
9
12
|
slots: Object,
|
|
10
13
|
emits: {
|
|
11
14
|
"update:popupVisible": (e) => !0,
|
|
@@ -14,23 +17,58 @@ const k = /* @__PURE__ */ P({
|
|
|
14
17
|
hide: () => !0
|
|
15
18
|
},
|
|
16
19
|
setup(e, {
|
|
17
|
-
emit:
|
|
20
|
+
emit: r,
|
|
18
21
|
slots: o,
|
|
19
|
-
attrs:
|
|
22
|
+
attrs: y
|
|
20
23
|
}) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const i = H("popover"), C = F(e.defaultPopupVisible), d = u(() => e.popupVisible ?? C.value), {
|
|
25
|
+
children: s,
|
|
26
|
+
firstElement: v
|
|
27
|
+
} = I(), g = F(), m = Symbol("popover");
|
|
28
|
+
let c = !1;
|
|
29
|
+
const h = u(() => !!(o.title || e.title !== void 0)), S = u(() => !!(o.content || e.content !== void 0)), V = u(() => [i.element("content"), {
|
|
30
|
+
[i.element("content-has-title")]: h.value
|
|
31
|
+
}, e.contentClass]), k = u(() => [i.element("arrow"), e.arrowClass]), P = (t) => {
|
|
32
|
+
C.value = t, r("update:popupVisible", t), r("popupVisibleChange", t);
|
|
33
|
+
}, D = () => {
|
|
26
34
|
var t;
|
|
27
35
|
return ((t = o.title) == null ? void 0 : t.call(o)) ?? e.title;
|
|
28
|
-
},
|
|
36
|
+
}, E = () => {
|
|
29
37
|
var t;
|
|
30
38
|
return ((t = o.content) == null ? void 0 : t.call(o)) ?? e.content;
|
|
39
|
+
}, f = (t) => {
|
|
40
|
+
!d.value || t.defaultPrevented || t.isComposing || t.keyCode === 229 || t.key !== "Escape" || (t.preventDefault(), t.stopPropagation(), P(!1), N(() => {
|
|
41
|
+
var n;
|
|
42
|
+
c = !0, (n = v.value) == null || n.focus({
|
|
43
|
+
preventScroll: !0
|
|
44
|
+
}), c = !1;
|
|
45
|
+
}));
|
|
46
|
+
}, O = (t) => {
|
|
47
|
+
var n;
|
|
48
|
+
return s.value = ((n = o.default) == null ? void 0 : n.call(o)) ?? [], j(s.value, {
|
|
49
|
+
...t,
|
|
50
|
+
onKeydown: f,
|
|
51
|
+
onFocusinCapture: (a) => {
|
|
52
|
+
c && a.stopImmediatePropagation();
|
|
53
|
+
},
|
|
54
|
+
onFocusoutCapture: (a) => {
|
|
55
|
+
c && a.stopImmediatePropagation();
|
|
56
|
+
}
|
|
57
|
+
}), s.value;
|
|
58
|
+
}, b = (t) => {
|
|
59
|
+
var a, T;
|
|
60
|
+
if (Array.from(p).at(-1) !== m) return;
|
|
61
|
+
const n = t.target;
|
|
62
|
+
n !== document.body && n !== document.documentElement && !((a = v.value) != null && a.contains(n)) && !((T = g.value) != null && T.contains(n)) || f(t);
|
|
63
|
+
}, w = () => {
|
|
64
|
+
p.delete(m), typeof document < "u" && document.removeEventListener("keydown", b, !0);
|
|
31
65
|
};
|
|
32
|
-
return () =>
|
|
33
|
-
|
|
66
|
+
return A(d, (t) => {
|
|
67
|
+
w(), t && typeof document < "u" && (p.add(m), document.addEventListener("keydown", b, !0));
|
|
68
|
+
}, {
|
|
69
|
+
immediate: !0
|
|
70
|
+
}), B(w), () => l(L, K(y, {
|
|
71
|
+
class: [i.block, y.class],
|
|
34
72
|
popupVisible: d.value,
|
|
35
73
|
trigger: e.trigger,
|
|
36
74
|
position: e.position,
|
|
@@ -44,9 +82,9 @@ const k = /* @__PURE__ */ P({
|
|
|
44
82
|
clickToClose: e.clickToClose,
|
|
45
83
|
clickOutsideToClose: e.clickOutsideToClose,
|
|
46
84
|
unmountOnClose: e.unmountOnClose,
|
|
47
|
-
contentClass:
|
|
85
|
+
contentClass: V.value,
|
|
48
86
|
contentStyle: e.contentStyle,
|
|
49
|
-
arrowClass:
|
|
87
|
+
arrowClass: k.value,
|
|
50
88
|
arrowStyle: e.arrowStyle,
|
|
51
89
|
popupStyle: e.popupStyle,
|
|
52
90
|
animationName: e.animationName,
|
|
@@ -65,22 +103,24 @@ const k = /* @__PURE__ */ P({
|
|
|
65
103
|
scrollToClose: e.scrollToClose,
|
|
66
104
|
scrollToCloseDistance: e.scrollToCloseDistance,
|
|
67
105
|
autoFitTransformOrigin: !0,
|
|
68
|
-
onPopupVisibleChange:
|
|
69
|
-
onShow: () =>
|
|
70
|
-
onHide: () =>
|
|
106
|
+
onPopupVisibleChange: P,
|
|
107
|
+
onShow: () => r("show"),
|
|
108
|
+
onHide: () => r("hide")
|
|
71
109
|
}), {
|
|
72
|
-
default: () => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, [h
|
|
79
|
-
class:
|
|
80
|
-
}, [
|
|
110
|
+
default: () => l(R, {
|
|
111
|
+
renderFunc: O
|
|
112
|
+
}, null),
|
|
113
|
+
content: () => l("div", {
|
|
114
|
+
ref: g,
|
|
115
|
+
onKeydown: f
|
|
116
|
+
}, [h.value && l("div", {
|
|
117
|
+
class: i.element("title")
|
|
118
|
+
}, [D()]), S.value && l("div", {
|
|
119
|
+
class: i.element("body")
|
|
120
|
+
}, [E()])])
|
|
81
121
|
});
|
|
82
122
|
}
|
|
83
123
|
});
|
|
84
124
|
export {
|
|
85
|
-
|
|
125
|
+
Y as default
|
|
86
126
|
};
|