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,97 +1,89 @@
1
- import { defineComponent as a, inject as n, computed as D, unref as o, createElementBlock as Y, openBlock as J, withModifiers as u, normalizeStyle as G, normalizeClass as P, renderSlot as z } from "vue";
1
+ import { defineComponent as S, inject as t, computed as D, unref as F } from "vue";
2
+ import "@vueuse/core";
3
+ import "@vft/utils";
4
+ import { composeEventHandlers as Y } from "../../utils/event.js";
5
+ import "../config-provider/hooks/use-global-config.js";
6
+ import { EVENT_CODE as J } from "../../constants/aria.js";
7
+ import "lodash-es";
8
+ import { composeRefs as y } from "../../utils/vue/refs.js";
2
9
  import "../focus-trap/focus-trap.vue2.js";
3
- import { FOCUS_TRAP_INJECTION_KEY as B } from "../focus-trap/tokens.js";
10
+ import { FOCUS_TRAP_INJECTION_KEY as G } from "../focus-trap/tokens.js";
4
11
  import "../focus-trap/utils.js";
5
12
  import "../roving-focus-group/roving-focus-group.vue2.js";
6
13
  import "../roving-focus-group/roving-focus-group-impl.vue2.js";
7
14
  import "../roving-focus-group/roving-focus-item.vue2.js";
8
- import { ROVING_FOCUS_COLLECTION_INJECTION_KEY as M } from "../roving-focus-group/types.js";
9
- import { ROVING_FOCUS_GROUP_INJECTION_KEY as U } from "../roving-focus-group/tokens.js";
10
- import { focusFirst as V } from "../roving-focus-group/utils.js";
11
- import { EVENT_CODE as x } from "../../constants/aria.js";
12
- import "@vueuse/core";
13
- import "@vft/utils";
14
- import { composeEventHandlers as A } from "../../utils/event.js";
15
- import "../config-provider/hooks/use-global-config.js";
16
- import "lodash-es";
17
- import { composeRefs as W } from "../../utils/vue/refs.js";
18
- import { useNamespace as k } from "../../hooks/use-namespace/index.js";
15
+ import { ROVING_FOCUS_COLLECTION_INJECTION_KEY as P } from "../roving-focus-group/types.js";
16
+ import { ROVING_FOCUS_GROUP_INJECTION_KEY as b } from "../roving-focus-group/tokens.js";
17
+ import { focusFirst as U } from "../roving-focus-group/utils.js";
18
+ import { useNamespace as V } from "../../hooks/use-namespace/index.js";
19
19
  import "../../hooks/use-model-toggle/index.js";
20
20
  import "@popperjs/core";
21
21
  import "../../hooks/use-z-index/index.js";
22
- import { DROPDOWN_INJECTION_KEY as $ } from "./tokens.js";
23
- import { DROPDOWN_COLLECTION_INJECTION_KEY as j, FIRST_LAST_KEYS as H, LAST_KEYS as q } from "./types.js";
24
- import { useDropdown as Q } from "./useDropdown.js";
25
- const X = ["role", "aria-labelledby"], Z = a({
26
- name: "VftDropdownMenu"
27
- }), yo = /* @__PURE__ */ a({
28
- ...Z,
29
- props: {
30
- onKeydown: { type: Function }
31
- },
32
- setup(_) {
33
- const O = _, i = k("dropdown"), { _elDropdownSize: E } = Q(), I = E.value, { focusTrapRef: N, onKeydown: C } = n(
34
- B,
22
+ import { DROPDOWN_INJECTION_KEY as A } from "./tokens.js";
23
+ import { dropdownMenuProps as M, DROPDOWN_COLLECTION_INJECTION_KEY as W, FIRST_LAST_KEYS as h, LAST_KEYS as x } from "./dropdown.js";
24
+ import { useDropdown as z } from "./useDropdown.js";
25
+ const Eo = S({
26
+ name: "VftDropdownMenu",
27
+ props: M,
28
+ setup(c) {
29
+ const n = V("dropdown"), { _elDropdownSize: d } = z(), i = d.value, { focusTrapRef: f, onKeydown: u } = t(
30
+ G,
35
31
  void 0
36
- ), { contentRef: m, role: T, triggerId: R } = n(
37
- $,
32
+ ), { contentRef: m, role: a, triggerId: _ } = t(
33
+ A,
38
34
  void 0
39
- ), { collectionRef: w, getItems: K } = n(
40
- j,
35
+ ), { collectionRef: O, getItems: I } = t(
36
+ W,
41
37
  void 0
42
38
  ), {
43
- rovingFocusGroupRef: v,
44
- rovingFocusGroupRootStyle: y,
45
- tabIndex: h,
46
- onBlur: p,
47
- onFocus: l,
48
- onMousedown: d
49
- } = n(U, void 0), { collectionRef: S } = n(
50
- M,
39
+ rovingFocusGroupRef: l,
40
+ rovingFocusGroupRootStyle: E,
41
+ tabIndex: N,
42
+ onBlur: C,
43
+ onFocus: T,
44
+ onMousedown: R
45
+ } = t(b, void 0), { collectionRef: K } = t(
46
+ P,
51
47
  void 0
52
- ), F = D(() => [i.b("menu"), i.bm("menu", I?.value)]), L = W(
48
+ ), w = D(() => [n.b("menu"), n.bm("menu", i?.value)]), v = y(
53
49
  m,
54
- w,
55
- N,
56
- v,
57
- S
58
- ), b = A(
59
- (e) => {
60
- O.onKeydown?.(e);
50
+ O,
51
+ f,
52
+ l,
53
+ K
54
+ ), L = Y(
55
+ (o) => {
56
+ c.onKeydown?.(o);
61
57
  },
62
- (e) => {
63
- const { currentTarget: r, code: t, target: f } = e;
64
- if (r.contains(f), x.tab === t && e.stopImmediatePropagation(), e.preventDefault(), f !== o(m) || !H.includes(t)) return;
65
- const c = K().filter(
66
- (s) => !s.disabled
67
- ).map((s) => s.ref);
68
- q.includes(t) && c.reverse(), V(c);
58
+ (o) => {
59
+ const { currentTarget: g, code: r, target: p } = o;
60
+ if (g.contains(
61
+ p
62
+ ), J.tab === r && o.stopImmediatePropagation(), o.preventDefault(), p !== F(m) || !h.includes(r))
63
+ return;
64
+ const s = I().filter(
65
+ (e) => !e.disabled
66
+ ).map((e) => e.ref);
67
+ x.includes(r) && s.reverse(), U(s);
69
68
  }
70
- ), g = (e) => {
71
- b(e), C(e);
69
+ );
70
+ return {
71
+ size: i,
72
+ rovingFocusGroupRootStyle: E,
73
+ tabIndex: N,
74
+ dropdownKls: w,
75
+ role: a,
76
+ triggerId: _,
77
+ dropdownListWrapperRef: v,
78
+ handleKeydown: (o) => {
79
+ L(o), u(o);
80
+ },
81
+ onBlur: C,
82
+ onFocus: T,
83
+ onMousedown: R
72
84
  };
73
- return (e, r) => (J(), Y("ul", {
74
- ref: o(L),
75
- class: P(F.value),
76
- style: G(o(y)),
77
- tabindex: -1,
78
- role: o(T),
79
- "aria-labelledby": o(R),
80
- onBlur: r[0] || (r[0] = //@ts-ignore
81
- (...t) => o(p) && o(p)(...t)),
82
- onFocus: r[1] || (r[1] = //@ts-ignore
83
- (...t) => o(l) && o(l)(...t)),
84
- onKeydown: u(g, ["self"]),
85
- onMousedown: r[2] || (r[2] = u(
86
- //@ts-ignore
87
- (...t) => o(d) && o(d)(...t),
88
- ["self"]
89
- ))
90
- }, [
91
- z(e.$slots, "default")
92
- ], 46, X));
93
85
  }
94
86
  });
95
87
  export {
96
- yo as default
88
+ Eo as default
97
89
  };
@@ -0,0 +1,182 @@
1
+ import "@vueuse/core";
2
+ import "@vft/utils";
3
+ import "../config-provider/hooks/use-global-config.js";
4
+ import { EVENT_CODE as e } from "../../constants/aria.js";
5
+ import "vue";
6
+ import { buildProps as o, definePropType as t } from "../../utils/vue/props/runtime.js";
7
+ import { createCollectionWithScope as p } from "../collection/collection.js";
8
+ import "../popper/index.js";
9
+ const f = o({
10
+ /**
11
+ * @description how to trigger
12
+ */
13
+ trigger: {
14
+ type: t([String, Array]),
15
+ default: "hover"
16
+ },
17
+ triggerKeys: {
18
+ type: t(Array),
19
+ default: () => [
20
+ e.enter,
21
+ e.numpadEnter,
22
+ e.space,
23
+ e.down
24
+ ]
25
+ },
26
+ effect: {
27
+ type: String,
28
+ default: "light"
29
+ },
30
+ /**
31
+ * @description menu button type, refer to `Button` Component, only works when `split-button` is true
32
+ */
33
+ type: {
34
+ type: t(String)
35
+ },
36
+ /**
37
+ * @description placement of pop menu
38
+ */
39
+ placement: {
40
+ type: t(String),
41
+ default: "bottom"
42
+ },
43
+ /**
44
+ * @description [popper.js](https://popper.js.org/docs/v2/) parameters
45
+ */
46
+ popperOptions: {
47
+ type: t(Object),
48
+ default: () => ({})
49
+ },
50
+ id: String,
51
+ /**
52
+ * @description menu size, also works on the split button
53
+ */
54
+ size: {
55
+ type: String,
56
+ default: ""
57
+ },
58
+ /**
59
+ * @description whether a button group is displayed
60
+ */
61
+ splitButton: Boolean,
62
+ /**
63
+ * @description whether to hide menu after clicking menu-item
64
+ */
65
+ hideOnClick: {
66
+ type: Boolean,
67
+ default: !0
68
+ },
69
+ loop: {
70
+ type: Boolean,
71
+ default: !0
72
+ },
73
+ /**
74
+ * @description delay time before show a dropdown (only works when trigger is `hover`)
75
+ */
76
+ showTimeout: {
77
+ type: Number,
78
+ default: 150
79
+ },
80
+ /**
81
+ * @description delay time before hide a dropdown (only works when trigger is `hover`)
82
+ */
83
+ hideTimeout: {
84
+ type: Number,
85
+ default: 150
86
+ },
87
+ /**
88
+ * @description [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of Dropdown
89
+ */
90
+ tabindex: {
91
+ type: t([Number, String]),
92
+ default: 0
93
+ },
94
+ /**
95
+ * @description the max height of menu
96
+ */
97
+ maxHeight: {
98
+ type: t([Number, String]),
99
+ default: ""
100
+ },
101
+ /**
102
+ * @description custom class name for Dropdown's dropdown
103
+ */
104
+ popperClass: {
105
+ type: String,
106
+ default: ""
107
+ },
108
+ /**
109
+ * @description whether to disable
110
+ */
111
+ disabled: Boolean,
112
+ /**
113
+ * @description the ARIA role attribute for the dropdown menu. Depending on the use case, you may want to change this to 'navigation'
114
+ */
115
+ role: {
116
+ type: String,
117
+ default: "menu"
118
+ },
119
+ buttonProps: {
120
+ type: t(Object)
121
+ },
122
+ /**
123
+ * @description whether the dropdown popup is teleported to the body
124
+ */
125
+ teleported: {
126
+ type: Boolean,
127
+ default: !0
128
+ },
129
+ /**
130
+ * @description when dropdown inactive and `persistent` is `false` , dropdown menu will be destroyed
131
+ */
132
+ persistent: {
133
+ type: Boolean,
134
+ default: !0
135
+ }
136
+ }), c = o({
137
+ /**
138
+ * @description a command to be dispatched to Dropdown's `command` callback
139
+ */
140
+ command: {
141
+ type: [Object, String, Number],
142
+ default: () => ({})
143
+ },
144
+ /**
145
+ * @description whether the item is disabled
146
+ */
147
+ disabled: Boolean,
148
+ /**
149
+ * @description whether a divider is displayed
150
+ */
151
+ divided: Boolean,
152
+ textValue: String,
153
+ /**
154
+ * @description custom icon
155
+ */
156
+ icon: {
157
+ type: String
158
+ }
159
+ }), O = o({
160
+ onKeydown: { type: t(Function) }
161
+ }), r = [
162
+ e.down,
163
+ e.pageDown,
164
+ e.home
165
+ ], n = [e.up, e.pageUp, e.end], g = [...r, ...n], {
166
+ VftCollection: E,
167
+ VftCollectionItem: S,
168
+ COLLECTION_INJECTION_KEY: N,
169
+ COLLECTION_ITEM_INJECTION_KEY: C
170
+ } = p("Dropdown");
171
+ export {
172
+ N as DROPDOWN_COLLECTION_INJECTION_KEY,
173
+ C as DROPDOWN_COLLECTION_ITEM_INJECTION_KEY,
174
+ r as FIRST_KEYS,
175
+ g as FIRST_LAST_KEYS,
176
+ n as LAST_KEYS,
177
+ E as VftCollection,
178
+ S as VftCollectionItem,
179
+ c as dropdownItemProps,
180
+ O as dropdownMenuProps,
181
+ f as dropdownProps
182
+ };
@@ -1,4 +1,128 @@
1
- import f from "./dropdown.vue2.js";
1
+ import c from "./dropdown.vue2.js";
2
+ import { resolveComponent as r, createElementBlock as h, openBlock as i, normalizeClass as a, createVNode as n, createBlock as v, createCommentVNode as w, createSlots as y, withCtx as o, renderSlot as t, mergeProps as s } from "vue";
3
+ import C from "../../_virtual/_plugin-vue_export-helper.js";
4
+ function B(e, k, S, z, E, T) {
5
+ const p = r("dropdown-collection"), d = r("roving-focus-group"), f = r("vft-scrollbar"), u = r("only-child"), g = r("vft-tooltip"), l = r("vft-button"), b = r("vft-icon"), m = r("vft-button-group");
6
+ return i(), h("div", {
7
+ class: a([e.ns.b(), e.ns.is("disabled", e.disabled)])
8
+ }, [
9
+ n(g, {
10
+ ref: "popperRef",
11
+ role: e.role,
12
+ effect: e.effect,
13
+ "fallback-placements": ["bottom", "top"],
14
+ "popper-options": e.popperOptions,
15
+ "gpu-acceleration": !1,
16
+ "hide-after": e.trigger === "hover" ? e.hideTimeout : 0,
17
+ "manual-mode": !0,
18
+ placement: e.placement,
19
+ "popper-class": [e.ns.e("popper"), e.popperClass],
20
+ "reference-element": e.referenceElementRef?.$el,
21
+ trigger: e.trigger,
22
+ "trigger-keys": e.triggerKeys,
23
+ "trigger-target-el": e.contentRef,
24
+ "show-after": e.trigger === "hover" ? e.showTimeout : 0,
25
+ "stop-popper-mouse-event": !1,
26
+ "virtual-ref": e.triggeringElementRef,
27
+ "virtual-triggering": e.splitButton,
28
+ disabled: e.disabled,
29
+ transition: `${e.ns.namespace.value}-zoom-in-top`,
30
+ teleported: e.teleported,
31
+ pure: "",
32
+ persistent: e.persistent,
33
+ onBeforeShow: e.handleBeforeShowTooltip,
34
+ onShow: e.handleShowTooltip,
35
+ onBeforeHide: e.handleBeforeHideTooltip
36
+ }, y({
37
+ content: o(() => [
38
+ n(f, {
39
+ ref: "scrollbar",
40
+ "wrap-style": e.wrapStyle,
41
+ tag: "div",
42
+ "view-class": e.ns.e("list")
43
+ }, {
44
+ default: o(() => [
45
+ n(d, {
46
+ loop: e.loop,
47
+ "current-tab-id": e.currentTabId,
48
+ orientation: "horizontal",
49
+ onCurrentTabIdChange: e.handleCurrentTabIdChange,
50
+ onEntryFocus: e.handleEntryFocus
51
+ }, {
52
+ default: o(() => [
53
+ n(p, null, {
54
+ default: o(() => [
55
+ t(e.$slots, "dropdown")
56
+ ]),
57
+ _: 3
58
+ })
59
+ ]),
60
+ _: 3
61
+ }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
62
+ ]),
63
+ _: 3
64
+ }, 8, ["wrap-style", "view-class"])
65
+ ]),
66
+ _: 2
67
+ }, [
68
+ e.splitButton ? void 0 : {
69
+ name: "default",
70
+ fn: o(() => [
71
+ n(u, {
72
+ id: e.triggerId,
73
+ ref: "triggeringElementRef",
74
+ role: "button",
75
+ tabindex: e.tabindex
76
+ }, {
77
+ default: o(() => [
78
+ t(e.$slots, "default")
79
+ ]),
80
+ _: 3
81
+ }, 8, ["id", "tabindex"])
82
+ ]),
83
+ key: "0"
84
+ }
85
+ ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "persistent", "onBeforeShow", "onShow", "onBeforeHide"]),
86
+ e.splitButton ? (i(), v(m, { key: 0 }, {
87
+ default: o(() => [
88
+ n(l, s({ ref: "referenceElementRef" }, e.buttonProps, {
89
+ size: e.dropdownSize,
90
+ type: e.type,
91
+ disabled: e.disabled,
92
+ tabindex: e.tabindex,
93
+ onClick: e.handlerMainButtonClick
94
+ }), {
95
+ default: o(() => [
96
+ t(e.$slots, "default")
97
+ ]),
98
+ _: 3
99
+ }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
100
+ n(l, s({
101
+ id: e.triggerId,
102
+ ref: "triggeringElementRef"
103
+ }, e.buttonProps, {
104
+ role: "button",
105
+ size: e.dropdownSize,
106
+ type: e.type,
107
+ class: e.ns.e("caret-button"),
108
+ disabled: e.disabled,
109
+ tabindex: e.tabindex,
110
+ "aria-label": "切换下拉菜单"
111
+ }), {
112
+ default: o(() => [
113
+ n(b, {
114
+ class: a(e.ns.e("icon")),
115
+ icon: "icon-arrow-down"
116
+ }, null, 8, ["class"])
117
+ ]),
118
+ _: 1
119
+ }, 16, ["id", "size", "type", "class", "disabled", "tabindex"])
120
+ ]),
121
+ _: 3
122
+ })) : w("", !0)
123
+ ], 2);
124
+ }
125
+ const F = /* @__PURE__ */ C(c, [["render", B]]);
2
126
  export {
3
- f as default
127
+ F as default
4
128
  };