vft 0.0.345 → 0.0.346

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/dropdown/dropdown-item-impl.vue.d.ts +106 -60
  3. package/es/components/dropdown/dropdown-item-impl.vue.js +34 -2
  4. package/es/components/dropdown/dropdown-item-impl.vue2.js +50 -72
  5. package/es/components/dropdown/dropdown-item.vue.js +33 -2
  6. package/es/components/dropdown/dropdown-item.vue2.js +40 -61
  7. package/es/components/dropdown/dropdown-menu.vue.d.ts +26 -21
  8. package/es/components/dropdown/dropdown-menu.vue.js +22 -2
  9. package/es/components/dropdown/dropdown-menu.vue2.js +68 -76
  10. package/es/components/dropdown/dropdown.js +182 -0
  11. package/es/components/dropdown/dropdown.vue.js +126 -2
  12. package/es/components/dropdown/dropdown.vue2.js +112 -231
  13. package/es/components/dropdown/index.js +13 -12
  14. package/es/components/dropdown/instance.d.ts +2 -0
  15. package/es/components/dropdown/instance.js +1 -0
  16. package/es/components/dropdown/tokens.d.ts +5 -4
  17. package/es/components/dropdown/tokens.js +3 -2
  18. package/es/components/dropdown/useDropdown.d.ts +1 -2
  19. package/es/components/dropdown/useDropdown.js +10 -51
  20. package/es/components/index.js +179 -178
  21. package/es/components/roving-focus-group/index.js +14 -14
  22. package/es/components/roving-focus-group/roving-focus-group.vue.js +19 -2
  23. package/es/components/roving-focus-group/roving-focus-group.vue2.js +7 -21
  24. package/es/index.js +247 -246
  25. package/es/package.json.d.ts +1 -1
  26. package/es/package.json.js +1 -1
  27. package/lib/components/dropdown/dropdown-item-impl.vue.cjs +1 -1
  28. package/lib/components/dropdown/dropdown-item-impl.vue.d.ts +106 -60
  29. package/lib/components/dropdown/dropdown-item-impl.vue2.cjs +1 -1
  30. package/lib/components/dropdown/dropdown-item.vue.cjs +1 -1
  31. package/lib/components/dropdown/dropdown-item.vue2.cjs +1 -1
  32. package/lib/components/dropdown/dropdown-menu.vue.cjs +1 -1
  33. package/lib/components/dropdown/dropdown-menu.vue.d.ts +26 -21
  34. package/lib/components/dropdown/dropdown-menu.vue2.cjs +1 -1
  35. package/lib/components/dropdown/dropdown.cjs +1 -0
  36. package/lib/components/dropdown/dropdown.vue.cjs +1 -1
  37. package/lib/components/dropdown/dropdown.vue2.cjs +1 -1
  38. package/lib/components/dropdown/index.cjs +1 -1
  39. package/lib/components/dropdown/instance.cjs +1 -0
  40. package/lib/components/dropdown/instance.d.ts +2 -0
  41. package/lib/components/dropdown/tokens.cjs +1 -1
  42. package/lib/components/dropdown/tokens.d.ts +5 -4
  43. package/lib/components/dropdown/useDropdown.cjs +1 -1
  44. package/lib/components/dropdown/useDropdown.d.ts +1 -2
  45. package/lib/components/index.cjs +1 -1
  46. package/lib/components/roving-focus-group/index.cjs +1 -1
  47. package/lib/components/roving-focus-group/roving-focus-group.vue.cjs +1 -1
  48. package/lib/components/roving-focus-group/roving-focus-group.vue2.cjs +1 -1
  49. package/lib/index.cjs +1 -1
  50. package/lib/package.json.cjs +1 -1
  51. package/lib/package.json.d.ts +1 -1
  52. package/package.json +3 -3
  53. package/theme-style/index.css +1 -1
  54. package/theme-style/src/dropdown.scss +49 -45
  55. package/theme-style/vft-dropdown.css +1 -1
  56. package/web-types.json +1 -1
  57. package/es/components/dropdown/dropdown-item.vue.d.ts +0 -61
  58. package/es/components/dropdown/dropdown.vue.d.ts +0 -86
  59. package/es/components/dropdown/index.d.ts +0 -596
  60. package/es/components/dropdown/types.js +0 -21
  61. package/es/components/roving-focus-group/roving-focus-group.vue.d.ts +0 -11
  62. package/lib/components/dropdown/dropdown-item.vue.d.ts +0 -61
  63. package/lib/components/dropdown/dropdown.vue.d.ts +0 -86
  64. package/lib/components/dropdown/index.d.ts +0 -596
  65. package/lib/components/dropdown/types.cjs +0 -1
  66. package/lib/components/roving-focus-group/roving-focus-group.vue.d.ts +0 -11
@@ -1,269 +1,150 @@
1
- import { defineComponent as S, getCurrentInstance as Z, ref as i, computed as g, watch as _, toRef as b, onBeforeUnmount as x, provide as B, createElementBlock as ee, openBlock as T, normalizeClass as $, unref as t, createVNode as r, createBlock as te, createCommentVNode as oe, createSlots as re, withCtx as o, renderSlot as h, mergeProps as I } from "vue";
2
- import { VftButtonGroup as ne, VftButton as O } from "../button/index.js";
3
- import "../form/index.js";
4
- import { VftIcon as le } from "../icon/index.js";
5
- import ie from "../roving-focus-group/roving-focus-group.vue2.js";
1
+ import { defineComponent as A, getCurrentInstance as G, ref as o, computed as i, watch as H, onBeforeUnmount as K, provide as g, toRef as C, unref as P } from "vue";
2
+ import { VftButton as E } from "../button/index.js";
3
+ import { VftTooltip as x } from "../tooltip/index.js";
4
+ import { VftScrollbar as U } from "../scrollbar/index.js";
5
+ import { VftIcon as z } from "../icon/index.js";
6
+ import J from "../roving-focus-group/roving-focus-group.vue.js";
6
7
  import "../roving-focus-group/roving-focus-group-impl.vue2.js";
7
8
  import "../roving-focus-group/roving-focus-item.vue2.js";
8
9
  import "../roving-focus-group/types.js";
9
- import { EVENT_CODE as y } from "../../constants/aria.js";
10
- import { VftScrollbar as ae } from "../scrollbar/index.js";
11
- import { OnlyChild as se } from "../slot/only-child.js";
12
- import { VftTooltip as pe } from "../tooltip/index.js";
10
+ import { OnlyChild as M } from "../slot/only-child.js";
11
+ import "../form/index.js";
13
12
  import "@vueuse/core";
14
- import { isArray as de } from "@vft/utils";
15
- import { addUnit as fe } from "../../utils/helper.js";
13
+ import "@vft/utils";
14
+ import { addUnit as W, castArray as Y } from "../../utils/helper.js";
16
15
  import "lodash-es";
17
- import { useId as ue } from "../../hooks/use-id/index.js";
18
- import { useNamespace as me } from "../../hooks/use-namespace/index.js";
16
+ import { useId as j } from "../../hooks/use-id/index.js";
17
+ import { useNamespace as q } from "../../hooks/use-namespace/index.js";
19
18
  import "../../hooks/use-model-toggle/index.js";
20
19
  import "@popperjs/core";
21
20
  import "../../hooks/use-z-index/index.js";
22
- import { DROPDOWN_INJECTION_KEY as ce } from "./tokens.js";
23
- import { VftCollection as ve } from "./types.js";
24
- import { useFormSize as ge } from "../form/hooks/use-form-common-props.js";
25
- const be = S({
26
- name: "vft-dropdown"
27
- }), Ge = /* @__PURE__ */ S({
28
- ...be,
29
- props: {
30
- trigger: { default: "hover" },
31
- effect: { default: "light" },
32
- type: {},
33
- placement: { default: "bottom" },
34
- popperOptions: {},
35
- id: {},
36
- size: {},
37
- splitButton: { type: Boolean },
38
- hideOnClick: { type: Boolean, default: !0 },
39
- loop: { type: Boolean, default: !0 },
40
- showTimeout: { default: 150 },
41
- hideTimeout: { default: 150 },
42
- tabindex: { default: 0 },
43
- maxHeight: { default: "" },
44
- popperClass: { default: "" },
45
- disabled: { type: Boolean, default: !1 },
46
- role: { default: "menu" },
47
- buttonProps: {},
48
- teleported: { type: Boolean, default: !0 }
21
+ import { dropdownProps as Q, VftCollection as X } from "./dropdown.js";
22
+ import { DROPDOWN_INJECTION_KEY as Z, DROPDOWN_INSTANCE_INJECTION_KEY as ee } from "./tokens.js";
23
+ import { useFormSize as oe } from "../form/hooks/use-form-common-props.js";
24
+ const { ButtonGroup: ne } = E, $e = A({
25
+ name: "VftDropdown",
26
+ components: {
27
+ VftButton: E,
28
+ VftButtonGroup: ne,
29
+ VftScrollbar: U,
30
+ DropdownCollection: X,
31
+ VftTooltip: x,
32
+ RovingFocusGroup: J,
33
+ OnlyChild: M,
34
+ VftIcon: z
49
35
  },
50
- emits: ["visible-change", "command", "click"],
51
- setup(z, { expose: R, emit: L }) {
52
- const n = me("dropdown"), a = z, p = L, V = Z(), l = i(), w = i(), u = i(null), s = i(null), N = i(null), m = i(null), C = i(!1), D = [y.enter, y.space, y.down], H = g(() => ({
53
- maxHeight: fe(a.maxHeight)
54
- })), P = ue().value, c = g(() => a.id || P);
55
- _(
56
- [l, b(a, "trigger")],
57
- ([e, f], [E]) => {
58
- const X = de(f) ? f : [f];
59
- E?.$el?.removeEventListener && E.$el.removeEventListener(
36
+ props: Q,
37
+ emits: ["visible-change", "click", "command"],
38
+ setup(n, { emit: l }) {
39
+ const I = G(), s = q("dropdown"), t = o(), T = o(), u = o(), r = o(), w = o(null), a = o(null), m = o(!1), O = i(() => ({
40
+ maxHeight: W(n.maxHeight)
41
+ })), S = i(() => [s.m(f.value)]), p = i(() => Y(n.trigger)), L = j().value, d = i(() => n.id || L);
42
+ H(
43
+ [t, p],
44
+ ([e, F], [h]) => {
45
+ h?.$el?.removeEventListener && h.$el.removeEventListener(
60
46
  "pointerenter",
61
- d
47
+ c
62
48
  ), e?.$el?.removeEventListener && e.$el.removeEventListener(
63
49
  "pointerenter",
64
- d
65
- ), e?.$el?.addEventListener && X.includes("hover") && e.$el.addEventListener(
50
+ c
51
+ ), e?.$el?.addEventListener && F.includes("hover") && e.$el.addEventListener(
66
52
  "pointerenter",
67
- d
53
+ c
68
54
  );
69
55
  },
70
56
  { immediate: !0 }
71
- ), x(() => {
72
- l.value?.$el?.removeEventListener && l.value.$el.removeEventListener(
57
+ ), K(() => {
58
+ t.value?.$el?.removeEventListener && t.value.$el.removeEventListener(
73
59
  "pointerenter",
74
- d
60
+ c
75
61
  );
76
62
  });
77
- function A() {
78
- k();
63
+ function N() {
64
+ v();
79
65
  }
80
- function k() {
66
+ function v() {
81
67
  u.value?.onClose();
82
68
  }
83
- function F() {
69
+ function R() {
84
70
  u.value?.onOpen();
85
71
  }
86
- const v = ge();
87
- function K(...e) {
88
- p("command", ...e);
72
+ const f = oe();
73
+ function $(...e) {
74
+ l("command", ...e);
89
75
  }
90
- function d() {
91
- l.value?.$el?.focus();
76
+ function c() {
77
+ t.value?.$el?.focus({
78
+ preventScroll: !0
79
+ });
92
80
  }
93
- function U() {
81
+ function b() {
94
82
  }
95
- function G() {
96
- t(s)?.focus(), m.value = null;
83
+ function k() {
84
+ const e = P(r);
85
+ p.value.includes("hover") && e?.focus({
86
+ preventScroll: !0
87
+ }), a.value = null;
97
88
  }
98
- function J(e) {
99
- m.value = e;
89
+ function B(e) {
90
+ a.value = e;
100
91
  }
101
- function M(e) {
102
- C.value || (e.preventDefault(), e.stopImmediatePropagation());
92
+ function D(e) {
93
+ m.value || (e.preventDefault(), e.stopImmediatePropagation());
103
94
  }
104
- function W() {
105
- p("visible-change", !0);
95
+ function V() {
96
+ l("visible-change", !0);
106
97
  }
107
- function Y(e) {
108
- e?.type === "keydown" && s.value?.focus();
98
+ function _(e) {
99
+ e?.type === "keydown" && r.value?.focus();
109
100
  }
110
- function j() {
111
- p("visible-change", !1);
101
+ function y() {
102
+ l("visible-change", !1);
112
103
  }
113
- B(ce, {
114
- contentRef: s,
115
- role: g(() => a.role),
116
- triggerId: c,
117
- isUsingKeyboard: C,
118
- onItemEnter: U,
119
- onItemLeave: G
120
- }), B("elDropdown", {
121
- instance: V,
122
- dropdownSize: v,
123
- handleClick: A,
124
- commandHandler: K,
125
- trigger: b(a, "trigger"),
126
- hideOnClick: b(a, "hideOnClick")
127
- });
128
- const q = (e) => {
129
- e.preventDefault(), s.value?.focus?.({
130
- preventScroll: !0
131
- });
132
- }, Q = (e) => {
133
- p("click", e);
104
+ return g(Z, {
105
+ contentRef: r,
106
+ role: i(() => n.role),
107
+ triggerId: d,
108
+ isUsingKeyboard: m,
109
+ onItemEnter: b,
110
+ onItemLeave: k
111
+ }), g(ee, {
112
+ instance: I,
113
+ dropdownSize: f,
114
+ handleClick: N,
115
+ commandHandler: $,
116
+ trigger: C(n, "trigger"),
117
+ hideOnClick: C(n, "hideOnClick")
118
+ }), {
119
+ ns: s,
120
+ scrollbar: w,
121
+ wrapStyle: O,
122
+ dropdownTriggerKls: S,
123
+ dropdownSize: f,
124
+ triggerId: d,
125
+ currentTabId: a,
126
+ handleCurrentTabIdChange: B,
127
+ handlerMainButtonClick: (e) => {
128
+ l("click", e);
129
+ },
130
+ handleEntryFocus: D,
131
+ handleClose: v,
132
+ handleOpen: R,
133
+ handleBeforeShowTooltip: V,
134
+ handleShowTooltip: _,
135
+ handleBeforeHideTooltip: y,
136
+ onFocusAfterTrapped: (e) => {
137
+ e.preventDefault(), r.value?.focus?.({
138
+ preventScroll: !0
139
+ });
140
+ },
141
+ popperRef: u,
142
+ contentRef: r,
143
+ triggeringElementRef: t,
144
+ referenceElementRef: T
134
145
  };
135
- return R({
136
- handleClose: k,
137
- handleOpen: F,
138
- // Todo
139
- onFocusAfterTrapped: q
140
- }), (e, f) => (T(), ee("div", {
141
- class: $([t(n).b(), t(n).is("disabled", e.disabled)])
142
- }, [
143
- r(t(pe), {
144
- ref_key: "popperRef",
145
- ref: u,
146
- role: e.role,
147
- effect: e.effect,
148
- "fallback-placements": ["bottom", "top"],
149
- "popper-options": e.popperOptions,
150
- "gpu-acceleration": !1,
151
- "hide-after": e.trigger === "hover" ? e.hideTimeout : 0,
152
- "manual-mode": !0,
153
- placement: e.placement,
154
- "popper-class": [t(n).e("popper"), e.popperClass],
155
- "reference-element": w.value?.$el,
156
- trigger: e.trigger,
157
- "trigger-keys": D,
158
- "trigger-target-el": s.value,
159
- "show-after": e.trigger === "hover" ? e.showTimeout : 0,
160
- "stop-popper-mouse-event": !1,
161
- "virtual-ref": l.value,
162
- "virtual-triggering": e.splitButton,
163
- disabled: e.disabled,
164
- transition: `${t(n).namespace.value}-zoom-in-top`,
165
- teleported: e.teleported,
166
- pure: "",
167
- persistent: "",
168
- onBeforeShow: W,
169
- onShow: Y,
170
- onBeforeHide: j
171
- }, re({
172
- content: o(() => [
173
- r(t(ae), {
174
- ref_key: "scrollbar",
175
- ref: N,
176
- "wrap-style": H.value,
177
- tag: "div",
178
- "view-class": [t(n).e("list"), "test"]
179
- }, {
180
- default: o(() => [
181
- r(t(ie), {
182
- loop: e.loop,
183
- "current-tab-id": m.value,
184
- orientation: "horizontal",
185
- onCurrentTabIdChange: J,
186
- onEntryFocus: M
187
- }, {
188
- default: o(() => [
189
- r(t(ve), null, {
190
- default: o(() => [
191
- h(e.$slots, "dropdown")
192
- ]),
193
- _: 3
194
- })
195
- ]),
196
- _: 3
197
- }, 8, ["loop", "current-tab-id"])
198
- ]),
199
- _: 3
200
- }, 8, ["wrap-style", "view-class"])
201
- ]),
202
- _: 2
203
- }, [
204
- e.splitButton ? void 0 : {
205
- name: "default",
206
- fn: o(() => [
207
- r(t(se), {
208
- id: c.value,
209
- ref_key: "triggeringElementRef",
210
- ref: l,
211
- role: "button",
212
- tabindex: e.tabindex
213
- }, {
214
- default: o(() => [
215
- h(e.$slots, "default")
216
- ]),
217
- _: 3
218
- }, 8, ["id", "tabindex"])
219
- ]),
220
- key: "0"
221
- }
222
- ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported"]),
223
- e.splitButton ? (T(), te(t(ne), { key: 0 }, {
224
- default: o(() => [
225
- r(t(O), I({
226
- ref_key: "referenceElementRef",
227
- ref: w
228
- }, e.buttonProps, {
229
- size: t(v),
230
- type: e.type,
231
- disabled: e.disabled,
232
- tabindex: e.tabindex,
233
- onClick: Q
234
- }), {
235
- default: o(() => [
236
- h(e.$slots, "default")
237
- ]),
238
- _: 3
239
- }, 16, ["size", "type", "disabled", "tabindex"]),
240
- r(t(O), I({
241
- id: c.value,
242
- ref_key: "triggeringElementRef",
243
- ref: l
244
- }, e.buttonProps, {
245
- role: "button",
246
- size: t(v),
247
- type: e.type,
248
- class: t(n).e("caret-button"),
249
- disabled: e.disabled,
250
- tabindex: e.tabindex,
251
- "aria-label": "切换下拉菜单"
252
- }), {
253
- default: o(() => [
254
- r(t(le), {
255
- class: $(t(n).e("icon")),
256
- icon: "icon-arrow-down"
257
- }, null, 8, ["class"])
258
- ]),
259
- _: 1
260
- }, 16, ["id", "size", "type", "class", "disabled", "tabindex"])
261
- ]),
262
- _: 3
263
- })) : oe("", !0)
264
- ], 2));
265
146
  }
266
147
  });
267
148
  export {
268
- Ge as default
149
+ $e as default
269
150
  };
@@ -2,20 +2,21 @@ import "@vueuse/core";
2
2
  import "@vft/utils";
3
3
  import "../config-provider/hooks/use-global-config.js";
4
4
  import "vue";
5
- import { withInstall as m, withNoopInstall as o } from "../../utils/vue/install.js";
5
+ import { withInstall as p, withNoopInstall as o } from "../../utils/vue/install.js";
6
6
  import "lodash-es";
7
- import p from "./dropdown.vue2.js";
8
- import t from "./dropdown-item.vue2.js";
9
- import r from "./dropdown-menu.vue2.js";
10
- import { DROPDOWN_INJECTION_KEY as u } from "./tokens.js";
11
- const c = m(p, {
7
+ import m from "./dropdown.vue.js";
8
+ import t from "./dropdown-item.vue.js";
9
+ import r from "./dropdown-menu.vue.js";
10
+ import { DROPDOWN_INJECTION_KEY as a, DROPDOWN_INSTANCE_INJECTION_KEY as c } from "./tokens.js";
11
+ const s = p(m, {
12
12
  DropdownItem: t,
13
13
  DropdownMenu: r
14
- }), d = o(t), I = o(r);
14
+ }), O = o(t), l = o(r);
15
15
  export {
16
- u as DROPDOWN_INJECTION_KEY,
17
- c as VftDropdown,
18
- d as VftDropdownItem,
19
- I as VftDropdownMenu,
20
- c as default
16
+ a as DROPDOWN_INJECTION_KEY,
17
+ c as DROPDOWN_INSTANCE_INJECTION_KEY,
18
+ s as VftDropdown,
19
+ O as VftDropdownItem,
20
+ l as VftDropdownMenu,
21
+ s as default
21
22
  };
@@ -0,0 +1,2 @@
1
+ import type Dropdown from './dropdown.vue';
2
+ export type DropdownInstance = InstanceType<typeof Dropdown> & unknown;
@@ -0,0 +1 @@
1
+
@@ -1,10 +1,11 @@
1
1
  import type { ComputedRef, InjectionKey, Ref } from 'vue';
2
- export type VftDropdownInjectionContext = {
3
- contentRef: Ref<HTMLElement | null>;
4
- role: ComputedRef<string>;
2
+ export type ElDropdownInjectionContext = {
3
+ contentRef: Ref<HTMLElement | undefined>;
4
+ role: any;
5
5
  triggerId: ComputedRef<string>;
6
6
  isUsingKeyboard: Ref<boolean>;
7
7
  onItemLeave: (e: PointerEvent) => void;
8
8
  onItemEnter: (e: PointerEvent) => void;
9
9
  };
10
- export declare const DROPDOWN_INJECTION_KEY: InjectionKey<VftDropdownInjectionContext>;
10
+ export declare const DROPDOWN_INJECTION_KEY: InjectionKey<ElDropdownInjectionContext>;
11
+ export declare const DROPDOWN_INSTANCE_INJECTION_KEY = "vftDropdown";
@@ -1,4 +1,5 @@
1
- const o = Symbol("VftDropdown");
1
+ const o = Symbol("vftDropdown"), N = "vftDropdown";
2
2
  export {
3
- o as DROPDOWN_INJECTION_KEY
3
+ o as DROPDOWN_INJECTION_KEY,
4
+ N as DROPDOWN_INSTANCE_INJECTION_KEY
4
5
  };
@@ -1,6 +1,5 @@
1
- import type { IElDropdownInstance } from './types';
1
+ import type { IElDropdownInstance } from './dropdown';
2
2
  export declare const useDropdown: () => {
3
3
  elDropdown: IElDropdownInstance;
4
4
  _elDropdownSize: import("vue").ComputedRef<import("vue").ComputedRef<string> | undefined>;
5
5
  };
6
- export declare const initDropdownDomEvent: (dropdownChildren: any, triggerElm: any, _instance: any) => void;
@@ -1,56 +1,15 @@
1
- import { buildShortUUID as k, addClass as T } from "@vft/utils";
2
- import { EVENT_CODE as t } from "../../constants/aria.js";
3
- import "@vueuse/core";
4
- import "../config-provider/hooks/use-global-config.js";
5
- import { inject as C, computed as O, ref as p } from "vue";
6
- import "lodash-es";
7
- import { useNamespace as S } from "../../hooks/use-namespace/index.js";
8
- import "../../hooks/use-model-toggle/index.js";
9
- import "@popperjs/core";
10
- import "../../hooks/use-z-index/index.js";
11
- const F = () => {
12
- const r = C("elDropdown", {}), o = O(() => r?.dropdownSize);
1
+ import { inject as e, computed as n } from "vue";
2
+ import { DROPDOWN_INSTANCE_INJECTION_KEY as t } from "./tokens.js";
3
+ const c = () => {
4
+ const o = e(
5
+ t,
6
+ {}
7
+ ), r = n(() => o?.dropdownSize);
13
8
  return {
14
- elDropdown: r,
15
- _elDropdownSize: o
9
+ elDropdown: o,
10
+ _elDropdownSize: r
16
11
  };
17
- }, V = (r, o, i) => {
18
- const x = S("dropdown"), u = p(null), d = p(null), s = p(null), f = p(`dropdown-menu-${k()}`);
19
- s.value = r?.subTree.el;
20
- function c() {
21
- o.setAttribute("tabindex", "-1"), d.value?.forEach((e) => {
22
- e.setAttribute("tabindex", "-1");
23
- });
24
- }
25
- function b(e) {
26
- c(), e?.setAttribute("tabindex", "0");
27
- }
28
- function D(e) {
29
- const n = e.code;
30
- [t.up, t.down].includes(n) ? (c(), b(u.value[0]), u.value[0].focus(), e.preventDefault(), e.stopPropagation()) : n === t.enter ? i.handleClick() : [t.tab, t.esc].includes(n) && i.hide();
31
- }
32
- function A(e) {
33
- const n = e.code, v = e.target, l = d.value.indexOf(v), w = d.value.length - 1;
34
- let a;
35
- [t.up, t.down].includes(n) ? (n === t.up ? a = l !== 0 ? l - 1 : 0 : a = l < w ? l + 1 : w, c(), b(u.value[a]), u.value[a].focus(), e.preventDefault(), e.stopPropagation()) : n === t.enter ? (m(), v.click(), i.props.hideOnClick && i.hide()) : [t.tab, t.esc].includes(n) && (i.hide(), m());
36
- }
37
- function h() {
38
- s.value.setAttribute("id", f.value), o.setAttribute("aria-haspopup", "list"), o.setAttribute("aria-controls", f.value), i.props.splitButton || (o.setAttribute("role", "button"), o.setAttribute("tabindex", i.props.tabindex), T(o, x.b("selfdefine")));
39
- }
40
- function y() {
41
- o?.addEventListener("keydown", D), s.value?.addEventListener("keydown", A, !0);
42
- }
43
- function I() {
44
- u.value = s.value.querySelectorAll(
45
- "[tabindex='-1']"
46
- ), d.value = Array.from(u.value), y(), h();
47
- }
48
- function m() {
49
- o.focus();
50
- }
51
- I();
52
12
  };
53
13
  export {
54
- V as initDropdownDomEvent,
55
- F as useDropdown
14
+ c as useDropdown
56
15
  };