@knime/jsonforms 0.1.4
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 +37 -0
- package/LICENSE +710 -0
- package/README.md +125 -0
- package/dist/AnyOfTwinlist-GJ6LGkM1.js +17 -0
- package/dist/ArrayLayout-CbpSgf0X.js +487 -0
- package/dist/ButtonControl-CVu36jz8.js +127 -0
- package/dist/CheckboxControl-DYFLb-qW.js +50 -0
- package/dist/Checkboxes-DlhdiWWA.js +103 -0
- package/dist/CheckboxesControl-DYV72Aua.js +39 -0
- package/dist/ColumnFilter-BbweAsmq.js +17 -0
- package/dist/ColumnSelect-aw7cYcWC.js +60 -0
- package/dist/ComboBoxControl-BqVUWz4q.js +600 -0
- package/dist/CredentialsControl-Ci6ZEuKM.js +20 -0
- package/dist/CredentialsControlBase-CxYOD3ne.js +110 -0
- package/dist/DateControl-ZyQ_vmOW.js +30 -0
- package/dist/DateTimeControl-anye7xvC.js +4 -0
- package/dist/DropdownControl-JX1LF5Tk.js +4 -0
- package/dist/DropdownControl.vue_vue_type_script_setup_true_lang-B5dPfH3x.js +171 -0
- package/dist/DynamicValuesControl-CFubOaRb.js +127 -0
- package/dist/FileChooserControl-Cf_UaWqV.js +605 -0
- package/dist/FileExplorerTab-Ba76jD3y.js +3951 -0
- package/dist/HorizontalLayout-5irQmhXp.js +39 -0
- package/dist/IntegerControl-CqHJWRgn.js +13 -0
- package/dist/IntervalControl-BUhs5_lc.js +549 -0
- package/dist/LayoutComponentWrapper-CDw9BDq5.js +36 -0
- package/dist/LegacyCredentialsControl-DxRZcRVo.js +62 -0
- package/dist/LocalFileChooserControl-DxSeiKxg.js +57 -0
- package/dist/MenuItems.vue_vue_type_style_index_0_lang-qMVpH9oC.js +464 -0
- package/dist/MultiselectListBox-C4ZnJvJJ.js +579 -0
- package/dist/NameFilter-D6EI_V08.js +17 -0
- package/dist/NodeDialog.vue.d.ts +8 -0
- package/dist/NumberControl-DLo0LCsi.js +13 -0
- package/dist/NumberControlBase.vue_vue_type_script_setup_true_lang-B69hrnY1.js +43 -0
- package/dist/NumberInput-BdL-jZ-i.js +219 -0
- package/dist/OneOfDropdown-BmbbuaZk.js +15 -0
- package/dist/RadioControl-GbwpOdAy.js +13 -0
- package/dist/RadioControlBase.vue_vue_type_script_setup_true_lang-BlImm9is.js +128 -0
- package/dist/RichTextControl-CGY3rdM7.js +16895 -0
- package/dist/SectionLayout-CqSFyj1K.js +54 -0
- package/dist/SimpleButtonControl-BgOrTGEP.js +59 -0
- package/dist/SimpleTwinlistControl-ByOlLGIN.js +68 -0
- package/dist/SortListControl-Dege54Dj.js +316 -0
- package/dist/TextAreaControl-CKviHabr.js +111 -0
- package/dist/TextControl-CPL48j4B.js +49 -0
- package/dist/TimeControl-CGsLRgR3.js +842 -0
- package/dist/TwinlistControl-C4XaH_Xc.js +587 -0
- package/dist/TwinlistLoadingInfo-CFlSBQXn.js +1057 -0
- package/dist/ValueSwitch-B9oWSkM_.js +138 -0
- package/dist/ValueSwitchControl-4ODpL58f.js +13 -0
- package/dist/VennDiagramLayout-CabCs-fX.js +104 -0
- package/dist/VerticalLayout-D5HeZyKY.js +39 -0
- package/dist/VerticalLayoutBase-C0PZ-y5d.js +20 -0
- package/dist/arrow-next-CvdR0-WC.js +17 -0
- package/dist/arrow-up-Dsq3EgtE.js +30 -0
- package/dist/createMissingItem-B00Kg95q.js +4 -0
- package/dist/floating-ui.vue.esm-CIFBDytk.js +94 -0
- package/dist/getFlattenedSettings-D64OwqpI.js +7 -0
- package/dist/index-ZDm2GXeD.js +32714 -0
- package/dist/index.d.ts +3 -0
- package/dist/knime-jsonforms.js +5 -0
- package/dist/layoutComponents/Form.vue.d.ts +2 -0
- package/dist/link-BA69Hfx6.js +17 -0
- package/dist/loading/LoadingDialog.vue.d.ts +2 -0
- package/dist/navigator-BYUFe-z3.js +8 -0
- package/dist/style.css +1 -0
- package/dist/useHideOnNull-CCfNP3O7.js +42 -0
- package/package.json +74 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineComponent as w, computed as n, openBlock as i, createBlock as s, unref as e, withCtx as r, createElementVNode as v, createVNode as d, createCommentVNode as V } from "vue";
|
|
2
|
+
import { r as F, a as g, L as y, I as L, _ as S } from "./index-ZDm2GXeD.js";
|
|
3
|
+
import { e as k, b as D, _ as E, c as A } from "./FileExplorerTab-Ba76jD3y.js";
|
|
4
|
+
const B = { class: "flex-row" }, I = /* @__PURE__ */ w({
|
|
5
|
+
__name: "LocalFileChooserControl",
|
|
6
|
+
props: F(),
|
|
7
|
+
setup(p) {
|
|
8
|
+
const c = p, { control: o, onChange: a, disabled: l } = g({ props: c }), t = n(
|
|
9
|
+
() => o.value.uischema.options
|
|
10
|
+
), { sideDrawerValue: u, updateSideDrawerValue: m, onApply: f } = k({
|
|
11
|
+
onChange: a,
|
|
12
|
+
initialValue: n(() => o.value.data)
|
|
13
|
+
}), { appendedExtension: _, filteredExtensions: h, isLoaded: C, isWriter: b } = D(t);
|
|
14
|
+
return (N, O) => (i(), s(y, {
|
|
15
|
+
control: e(o),
|
|
16
|
+
onControllingFlowVariableSet: e(a)
|
|
17
|
+
}, {
|
|
18
|
+
default: r(({ labelForId: x }) => [
|
|
19
|
+
v("div", B, [
|
|
20
|
+
d(e(L), {
|
|
21
|
+
id: x,
|
|
22
|
+
class: "flex-grow",
|
|
23
|
+
disabled: e(l),
|
|
24
|
+
"model-value": e(o).data,
|
|
25
|
+
placeholder: t.value.placeholder,
|
|
26
|
+
compact: "",
|
|
27
|
+
"onUpdate:modelValue": e(a)
|
|
28
|
+
}, null, 8, ["id", "disabled", "model-value", "placeholder", "onUpdate:modelValue"]),
|
|
29
|
+
d(E, {
|
|
30
|
+
disabled: e(l),
|
|
31
|
+
onApply: e(f)
|
|
32
|
+
}, {
|
|
33
|
+
default: r(() => [
|
|
34
|
+
e(C) ? (i(), s(A, {
|
|
35
|
+
key: 0,
|
|
36
|
+
"backend-type": "local",
|
|
37
|
+
disabled: e(l),
|
|
38
|
+
options: t.value,
|
|
39
|
+
"initial-value": e(o).data,
|
|
40
|
+
"is-writer": e(b),
|
|
41
|
+
"filtered-extensions": e(h),
|
|
42
|
+
"appended-extension": e(_),
|
|
43
|
+
"initial-file-path": e(u),
|
|
44
|
+
onChooseFile: e(m)
|
|
45
|
+
}, null, 8, ["disabled", "options", "initial-value", "is-writer", "filtered-extensions", "appended-extension", "initial-file-path", "onChooseFile"])) : V("", !0)
|
|
46
|
+
]),
|
|
47
|
+
_: 1
|
|
48
|
+
}, 8, ["disabled", "onApply"])
|
|
49
|
+
])
|
|
50
|
+
]),
|
|
51
|
+
_: 1
|
|
52
|
+
}, 8, ["control", "onControllingFlowVariableSet"]));
|
|
53
|
+
}
|
|
54
|
+
}), W = /* @__PURE__ */ S(I, [["__scopeId", "data-v-41938a5b"]]);
|
|
55
|
+
export {
|
|
56
|
+
W as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import { ref as k, defineComponent as L, openBlock as f, createElementBlock as I, Fragment as _, createElementVNode as N, normalizeClass as K, toDisplayString as F, createCommentVNode as g, createBlock as x, resolveDynamicComponent as R, mergeProps as j, withCtx as T, createVNode as v, renderSlot as z, toRef as X, onBeforeUpdate as Y, resolveComponent as G, normalizeStyle as q, renderList as Z, unref as V, nextTick as ee } from "vue";
|
|
2
|
+
import { A as te } from "./arrow-next-CvdR0-WC.js";
|
|
3
|
+
import { af as ne, _ as P, m as oe, f as se, d as ie, e as le } from "./index-ZDm2GXeD.js";
|
|
4
|
+
import { u as ae } from "./floating-ui.vue.esm-CIFBDytk.js";
|
|
5
|
+
var ue = 0;
|
|
6
|
+
function re(n) {
|
|
7
|
+
var e = ++ue;
|
|
8
|
+
return ne(n) + e;
|
|
9
|
+
}
|
|
10
|
+
const de = (n, e) => (n % e + e) % e, B = (n) => {
|
|
11
|
+
n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation();
|
|
12
|
+
}, me = ({
|
|
13
|
+
getNextElement: n,
|
|
14
|
+
getFirstElement: e,
|
|
15
|
+
getLastElement: s,
|
|
16
|
+
close: t,
|
|
17
|
+
disableSpaceToClick: p
|
|
18
|
+
}) => {
|
|
19
|
+
const a = k(null), h = () => {
|
|
20
|
+
};
|
|
21
|
+
let u = h;
|
|
22
|
+
const d = () => {
|
|
23
|
+
a.value = null, u = h;
|
|
24
|
+
}, m = (r) => {
|
|
25
|
+
a.value = r.index, u = r.onClick;
|
|
26
|
+
}, C = (r) => {
|
|
27
|
+
m(n(a.value, r));
|
|
28
|
+
}, w = () => {
|
|
29
|
+
d(), t();
|
|
30
|
+
};
|
|
31
|
+
return { onKeydown: (r) => {
|
|
32
|
+
switch (r.code) {
|
|
33
|
+
case "ArrowDown":
|
|
34
|
+
B(r), C(1);
|
|
35
|
+
break;
|
|
36
|
+
case "ArrowUp":
|
|
37
|
+
B(r), C(-1);
|
|
38
|
+
break;
|
|
39
|
+
case "Enter":
|
|
40
|
+
case "Space": {
|
|
41
|
+
const S = r.code === "Enter", E = r.code === "Space";
|
|
42
|
+
a.value !== null && (S || E && !p) && (B(r), u());
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "Home":
|
|
46
|
+
e && m(e());
|
|
47
|
+
break;
|
|
48
|
+
case "End":
|
|
49
|
+
s && m(s());
|
|
50
|
+
break;
|
|
51
|
+
case "Escape":
|
|
52
|
+
B(r), w();
|
|
53
|
+
break;
|
|
54
|
+
case "Tab":
|
|
55
|
+
w();
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}, currentIndex: a, resetNavigation: d };
|
|
59
|
+
}, ce = {
|
|
60
|
+
key: 0,
|
|
61
|
+
class: "hotkey"
|
|
62
|
+
}, fe = /* @__PURE__ */ L({
|
|
63
|
+
__name: "BaseMenuItemText",
|
|
64
|
+
props: {
|
|
65
|
+
text: {},
|
|
66
|
+
hotkeyText: {},
|
|
67
|
+
useMaxMenuWidth: { type: Boolean }
|
|
68
|
+
},
|
|
69
|
+
setup(n) {
|
|
70
|
+
return (e, s) => (f(), I(_, null, [
|
|
71
|
+
N("span", {
|
|
72
|
+
class: K(["text", { truncate: e.useMaxMenuWidth }])
|
|
73
|
+
}, F(e.text), 3),
|
|
74
|
+
e.hotkeyText ? (f(), I("span", ce, F(e.hotkeyText), 1)) : g("", !0)
|
|
75
|
+
], 64));
|
|
76
|
+
}
|
|
77
|
+
}), U = /* @__PURE__ */ P(fe, [["__scopeId", "data-v-ad4bf226"]]), pe = { class: "label" }, he = { class: "text-and-hotkey" }, Ie = {
|
|
78
|
+
key: 0,
|
|
79
|
+
class: "description"
|
|
80
|
+
}, be = /* @__PURE__ */ L({
|
|
81
|
+
__name: "BaseMenuItem",
|
|
82
|
+
props: {
|
|
83
|
+
item: {},
|
|
84
|
+
index: {},
|
|
85
|
+
hasFocus: { type: Boolean },
|
|
86
|
+
useMaxMenuWidth: { type: Boolean }
|
|
87
|
+
},
|
|
88
|
+
setup(n) {
|
|
89
|
+
const e = (t) => t.to ? "nuxt-link" : t.href ? "a" : "button", s = (t) => t.href && t.download ? {
|
|
90
|
+
download: typeof t.download == "boolean" ? "" : t.download
|
|
91
|
+
} : null;
|
|
92
|
+
return (t, p) => (f(), x(R(e(t.item)), j({
|
|
93
|
+
ref: "listItemComponent",
|
|
94
|
+
tabindex: "-1",
|
|
95
|
+
class: [
|
|
96
|
+
"list-item",
|
|
97
|
+
t.item.sectionHeadline ? "section-headline" : "clickable-item",
|
|
98
|
+
{
|
|
99
|
+
disabled: t.item.disabled,
|
|
100
|
+
selected: t.item.selected,
|
|
101
|
+
focused: t.hasFocus
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
to: t.item.to || void 0,
|
|
105
|
+
href: t.item.href || void 0
|
|
106
|
+
}, s(t.item)), {
|
|
107
|
+
default: T(() => [
|
|
108
|
+
t.item.icon ? (f(), x(R(t.item.icon), {
|
|
109
|
+
key: 0,
|
|
110
|
+
class: "item-icon"
|
|
111
|
+
})) : g("", !0),
|
|
112
|
+
N("div", pe, [
|
|
113
|
+
N("div", he, [
|
|
114
|
+
t.item.checkbox ? (f(), x(oe, {
|
|
115
|
+
key: 0,
|
|
116
|
+
"model-value": t.item.checkbox.checked,
|
|
117
|
+
class: "checkbox"
|
|
118
|
+
}, {
|
|
119
|
+
default: T(() => [
|
|
120
|
+
v(U, {
|
|
121
|
+
text: t.item.text,
|
|
122
|
+
"use-max-menu-width": t.useMaxMenuWidth,
|
|
123
|
+
"hotkey-text": t.item.hotkeyText
|
|
124
|
+
}, null, 8, ["text", "use-max-menu-width", "hotkey-text"])
|
|
125
|
+
]),
|
|
126
|
+
_: 1
|
|
127
|
+
}, 8, ["model-value"])) : (f(), I(_, { key: 1 }, [
|
|
128
|
+
v(U, {
|
|
129
|
+
text: t.item.text,
|
|
130
|
+
"use-max-menu-width": t.useMaxMenuWidth,
|
|
131
|
+
"hotkey-text": t.item.hotkeyText
|
|
132
|
+
}, null, 8, ["text", "use-max-menu-width", "hotkey-text"]),
|
|
133
|
+
z(t.$slots, "submenu", {
|
|
134
|
+
itemElement: t.$refs.listItemComponent
|
|
135
|
+
}, void 0, !0)
|
|
136
|
+
], 64))
|
|
137
|
+
]),
|
|
138
|
+
t.item.description ? (f(), I("div", Ie, F(t.item.description), 1)) : g("", !0)
|
|
139
|
+
])
|
|
140
|
+
]),
|
|
141
|
+
_: 3
|
|
142
|
+
}, 16, ["class", "to", "href"]));
|
|
143
|
+
}
|
|
144
|
+
}), J = /* @__PURE__ */ P(be, [["__scopeId", "data-v-6ba5ebbe"]]);
|
|
145
|
+
function ye(n) {
|
|
146
|
+
return !("$el" in n);
|
|
147
|
+
}
|
|
148
|
+
const ke = {
|
|
149
|
+
name: "BaseMenuItems",
|
|
150
|
+
components: { BaseMenuItem: J },
|
|
151
|
+
props: {
|
|
152
|
+
items: {
|
|
153
|
+
type: Array,
|
|
154
|
+
required: !0
|
|
155
|
+
},
|
|
156
|
+
focusedItemIndex: {
|
|
157
|
+
required: !1,
|
|
158
|
+
type: Number,
|
|
159
|
+
default: null
|
|
160
|
+
},
|
|
161
|
+
menuAriaLabel: {
|
|
162
|
+
type: String,
|
|
163
|
+
required: !0
|
|
164
|
+
},
|
|
165
|
+
/**
|
|
166
|
+
* Identifier for click handler. If left blank an id is generated.
|
|
167
|
+
* NOTE: Autogenerated IDs might break SSR.
|
|
168
|
+
*/
|
|
169
|
+
id: {
|
|
170
|
+
default: () => `__BaseMenuItems-${re()}__`,
|
|
171
|
+
type: String
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* Maximum width in px of the menu
|
|
175
|
+
*/
|
|
176
|
+
maxMenuWidth: {
|
|
177
|
+
type: Number,
|
|
178
|
+
default: null
|
|
179
|
+
},
|
|
180
|
+
positionRelativeToElement: {
|
|
181
|
+
type: Object,
|
|
182
|
+
default: null
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* Element used to detect when the MenuItem is near the edges of a clipping parent.
|
|
186
|
+
* This will then be used to automatically position opened floating submenus accordingly.
|
|
187
|
+
*
|
|
188
|
+
* Defaults to the document's body
|
|
189
|
+
*/
|
|
190
|
+
clippingBoundary: {
|
|
191
|
+
type: Object,
|
|
192
|
+
default: document == null ? void 0 : document.body
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
emits: ["item-click", "item-focused", "item-hovered"],
|
|
196
|
+
setup(n) {
|
|
197
|
+
const e = k([]), s = X(n, "positionRelativeToElement"), t = k(null);
|
|
198
|
+
Y(() => {
|
|
199
|
+
e.value = [];
|
|
200
|
+
});
|
|
201
|
+
const { floatingStyles: p } = s.value ? ae(s, t, {
|
|
202
|
+
strategy: "fixed",
|
|
203
|
+
placement: "right-start",
|
|
204
|
+
middleware: [
|
|
205
|
+
se({ boundary: n.clippingBoundary }),
|
|
206
|
+
ie({ boundary: n.clippingBoundary })
|
|
207
|
+
],
|
|
208
|
+
whileElementsMounted: le
|
|
209
|
+
}) : { floatingStyles: null };
|
|
210
|
+
return {
|
|
211
|
+
listContainerFloatingStyles: p,
|
|
212
|
+
listContainer: t,
|
|
213
|
+
listItems: e
|
|
214
|
+
};
|
|
215
|
+
},
|
|
216
|
+
computed: {
|
|
217
|
+
useMaxMenuWidth() {
|
|
218
|
+
return !!this.maxMenuWidth;
|
|
219
|
+
},
|
|
220
|
+
enabledItemsIndices() {
|
|
221
|
+
return this.items.map((n, e) => ({ item: n, index: e })).filter(({ item: n }) => !n.disabled).map(({ index: n }) => n);
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
watch: {
|
|
225
|
+
focusedItemIndex: {
|
|
226
|
+
immediate: !0,
|
|
227
|
+
handler() {
|
|
228
|
+
this.emitItemFocused();
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
items: {
|
|
232
|
+
deep: !0,
|
|
233
|
+
handler() {
|
|
234
|
+
this.emitItemFocused();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
expose: ["getEnabledListItems", "scrollTo"],
|
|
239
|
+
methods: {
|
|
240
|
+
updateItem(n, e) {
|
|
241
|
+
this.listItems[e] = n;
|
|
242
|
+
},
|
|
243
|
+
getEnabledListItems() {
|
|
244
|
+
return this.listItems.map((e, s) => {
|
|
245
|
+
const t = e.children[0];
|
|
246
|
+
return {
|
|
247
|
+
element: e,
|
|
248
|
+
index: s,
|
|
249
|
+
onClick: ye(t) ? () => t.click() : () => t.$el.click()
|
|
250
|
+
};
|
|
251
|
+
}).filter(({ index: e }) => this.enabledItemsIndices.includes(e));
|
|
252
|
+
},
|
|
253
|
+
scrollTo(n) {
|
|
254
|
+
const e = this.$refs.listContainer;
|
|
255
|
+
if (e && e.scrollHeight > e.clientHeight) {
|
|
256
|
+
const s = e.clientHeight + e.scrollTop, t = n.offsetTop + n.offsetHeight;
|
|
257
|
+
t > s ? e.scrollTop = t - e.clientHeight : n.offsetTop < e.scrollTop && (e.scrollTop = n.offsetTop);
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
menuItemId(n) {
|
|
261
|
+
return `menu-item-${this.id}-${n}`;
|
|
262
|
+
},
|
|
263
|
+
onPointerEnter(n, e, s) {
|
|
264
|
+
this.$emit(
|
|
265
|
+
"item-hovered",
|
|
266
|
+
e.disabled || e.sectionHeadline ? null : e,
|
|
267
|
+
this.id,
|
|
268
|
+
s
|
|
269
|
+
);
|
|
270
|
+
},
|
|
271
|
+
onItemClick(n, e, s) {
|
|
272
|
+
var p;
|
|
273
|
+
if (e.disabled || e.sectionHeadline || (p = e.children) != null && p.length)
|
|
274
|
+
return;
|
|
275
|
+
if (!(e.href || e.to) && (n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation()), e.checkbox) {
|
|
276
|
+
const a = !e.checkbox.checked;
|
|
277
|
+
e.checkbox.setBoolean(a);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
this.$emit("item-click", n, e, s);
|
|
281
|
+
},
|
|
282
|
+
emitItemFocused() {
|
|
283
|
+
if (this.focusedItemIndex === null) {
|
|
284
|
+
this.$emit("item-focused", null, null);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const n = this.focusedItemIndex;
|
|
288
|
+
this.$emit("item-focused", this.menuItemId(n), this.items[n]);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}, xe = ["aria-label"], ge = ["data-index", "title", "onClick", "onPointerenter"];
|
|
292
|
+
function ve(n, e, s, t, p, a) {
|
|
293
|
+
const h = G("BaseMenuItem");
|
|
294
|
+
return f(), I("ul", {
|
|
295
|
+
ref: "listContainer",
|
|
296
|
+
"aria-label": s.menuAriaLabel,
|
|
297
|
+
class: "base-menu-items",
|
|
298
|
+
style: q(t.listContainerFloatingStyles),
|
|
299
|
+
role: "menu",
|
|
300
|
+
tabindex: "-1",
|
|
301
|
+
onPointerleave: e[0] || (e[0] = (u) => n.$emit("item-hovered", null, s.id))
|
|
302
|
+
}, [
|
|
303
|
+
(f(!0), I(_, null, Z(s.items, (u, d) => (f(), I("li", {
|
|
304
|
+
key: d,
|
|
305
|
+
ref_for: !0,
|
|
306
|
+
ref: (m) => a.updateItem(m, d),
|
|
307
|
+
"data-index": d,
|
|
308
|
+
class: K([{ separator: u.separator }]),
|
|
309
|
+
style: q(a.useMaxMenuWidth ? { "max-width": `${s.maxMenuWidth}px` } : {}),
|
|
310
|
+
title: u.title,
|
|
311
|
+
onClick: (m) => a.onItemClick(m, u, s.id),
|
|
312
|
+
onPointerenter: (m) => a.onPointerEnter(m, u, d)
|
|
313
|
+
}, [
|
|
314
|
+
z(n.$slots, "item", {
|
|
315
|
+
item: u,
|
|
316
|
+
index: d,
|
|
317
|
+
menuId: s.id,
|
|
318
|
+
menuItemId: a.menuItemId,
|
|
319
|
+
maxMenuWidth: s.maxMenuWidth,
|
|
320
|
+
focusedItemIndex: s.focusedItemIndex
|
|
321
|
+
}, () => [
|
|
322
|
+
v(h, {
|
|
323
|
+
id: a.menuItemId(d),
|
|
324
|
+
item: u,
|
|
325
|
+
index: d,
|
|
326
|
+
"use-max-menu-width": !!s.maxMenuWidth,
|
|
327
|
+
"has-focus": d === s.focusedItemIndex
|
|
328
|
+
}, null, 8, ["id", "item", "index", "use-max-menu-width", "has-focus"])
|
|
329
|
+
], !0)
|
|
330
|
+
], 46, ge))), 128))
|
|
331
|
+
], 44, xe);
|
|
332
|
+
}
|
|
333
|
+
const Ce = /* @__PURE__ */ P(ke, [["render", ve], ["__scopeId", "data-v-815f537c"]]), Se = /* @__PURE__ */ L({
|
|
334
|
+
__name: "MenuItems",
|
|
335
|
+
props: {
|
|
336
|
+
items: {},
|
|
337
|
+
menuAriaLabel: {},
|
|
338
|
+
disableSpaceToClick: { type: Boolean, default: !1 },
|
|
339
|
+
registerKeydown: { type: Boolean, default: !1 },
|
|
340
|
+
clippingBoundary: { default: () => document.body }
|
|
341
|
+
},
|
|
342
|
+
emits: ["close", "item-click", "item-focused", "item-hovered", "close-submenu"],
|
|
343
|
+
setup(n, { expose: e, emit: s }) {
|
|
344
|
+
const t = n, p = s, a = k(null), h = k(-1), u = k(null), d = (i, o) => {
|
|
345
|
+
if (!a.value)
|
|
346
|
+
return {
|
|
347
|
+
onClick: () => {
|
|
348
|
+
},
|
|
349
|
+
index: -1
|
|
350
|
+
};
|
|
351
|
+
const c = a.value.getEnabledListItems();
|
|
352
|
+
let l = c.map(({ index: W }) => W).indexOf(i);
|
|
353
|
+
l === -1 && o === -1 && (l = 0);
|
|
354
|
+
const A = de(
|
|
355
|
+
l + o,
|
|
356
|
+
c.length
|
|
357
|
+
), { element: H, index: b, onClick: M } = c[A];
|
|
358
|
+
return a.value.scrollTo(H), { index: b, onClick: M };
|
|
359
|
+
}, {
|
|
360
|
+
currentIndex: m,
|
|
361
|
+
onKeydown: C,
|
|
362
|
+
resetNavigation: w
|
|
363
|
+
} = me({
|
|
364
|
+
disableSpaceToClick: t.disableSpaceToClick,
|
|
365
|
+
getNextElement: d,
|
|
366
|
+
close: () => p("close")
|
|
367
|
+
}), D = (i = 0) => {
|
|
368
|
+
m.value = i;
|
|
369
|
+
}, r = (i) => {
|
|
370
|
+
var l;
|
|
371
|
+
const o = t.items[i], c = o && !o.disabled && ((l = o.children) == null ? void 0 : l.length);
|
|
372
|
+
h.value = c ? i : -1;
|
|
373
|
+
}, S = (i) => {
|
|
374
|
+
switch (i.code) {
|
|
375
|
+
case "ArrowLeft":
|
|
376
|
+
p("close-submenu");
|
|
377
|
+
break;
|
|
378
|
+
case "ArrowRight":
|
|
379
|
+
r(m.value ?? 0), ee(() => {
|
|
380
|
+
var o;
|
|
381
|
+
(o = u.value) == null || o.focusIndex();
|
|
382
|
+
});
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
C(i);
|
|
386
|
+
}, E = (i, o, c) => {
|
|
387
|
+
i !== null && r(c), p("item-hovered", i, o, c);
|
|
388
|
+
}, $ = (i) => {
|
|
389
|
+
var c;
|
|
390
|
+
h.value !== -1 ? (c = u.value) == null || c.onKeydown(i) : S(i);
|
|
391
|
+
};
|
|
392
|
+
e({ onKeydown: $, resetNavigation: w, focusIndex: D });
|
|
393
|
+
const O = (i) => !i.children || i.children.length === 0 ? !1 : !!i.children.find(({ selected: o }) => o);
|
|
394
|
+
return (i, o) => {
|
|
395
|
+
const c = G("MenuItems", !0);
|
|
396
|
+
return f(), x(Ce, j({
|
|
397
|
+
ref_key: "baseMenuItems",
|
|
398
|
+
ref: a
|
|
399
|
+
}, i.$attrs, {
|
|
400
|
+
items: t.items,
|
|
401
|
+
"menu-aria-label": t.menuAriaLabel,
|
|
402
|
+
"focused-item-index": V(m),
|
|
403
|
+
"clipping-boundary": i.clippingBoundary,
|
|
404
|
+
onKeydown: o[5] || (o[5] = (l) => t.registerKeydown && $(l)),
|
|
405
|
+
onItemClick: o[6] || (o[6] = (...l) => i.$emit("item-click", ...l)),
|
|
406
|
+
onItemHovered: o[7] || (o[7] = (...l) => E(...l)),
|
|
407
|
+
onItemFocused: o[8] || (o[8] = (...l) => i.$emit("item-focused", ...l))
|
|
408
|
+
}), {
|
|
409
|
+
item: T(({
|
|
410
|
+
item: l,
|
|
411
|
+
menuId: A,
|
|
412
|
+
menuItemId: H,
|
|
413
|
+
index: b,
|
|
414
|
+
maxMenuWidth: M,
|
|
415
|
+
focusedItemIndex: W
|
|
416
|
+
}) => [
|
|
417
|
+
v(J, {
|
|
418
|
+
id: H(b),
|
|
419
|
+
item: l,
|
|
420
|
+
index: b,
|
|
421
|
+
"use-max-menu-width": !!M,
|
|
422
|
+
"has-focus": b === W,
|
|
423
|
+
class: "base-item"
|
|
424
|
+
}, {
|
|
425
|
+
submenu: T(({ itemElement: Q }) => [
|
|
426
|
+
l.children && l.children.length ? (f(), I("span", {
|
|
427
|
+
key: 0,
|
|
428
|
+
class: K([
|
|
429
|
+
"sub-menu-indicator",
|
|
430
|
+
{ highlight: O(l) }
|
|
431
|
+
])
|
|
432
|
+
}, [
|
|
433
|
+
v(V(te), { class: "icon" }),
|
|
434
|
+
h.value === b ? (f(), x(c, {
|
|
435
|
+
key: 0,
|
|
436
|
+
id: `${A}__sub${b}`,
|
|
437
|
+
ref_key: "subLevelItems",
|
|
438
|
+
ref: u,
|
|
439
|
+
class: "menu-items-sub-level",
|
|
440
|
+
"menu-aria-label": `${l.text} sub menu`,
|
|
441
|
+
items: l.children,
|
|
442
|
+
"max-menu-width": M,
|
|
443
|
+
"position-relative-to-element": Q,
|
|
444
|
+
"clipping-boundary": i.clippingBoundary,
|
|
445
|
+
"register-keydown": "",
|
|
446
|
+
onClose: o[0] || (o[0] = (y) => h.value = -1),
|
|
447
|
+
onCloseSubmenu: o[1] || (o[1] = (y) => h.value = -1),
|
|
448
|
+
onItemClick: o[2] || (o[2] = (...y) => i.$emit("item-click", ...y)),
|
|
449
|
+
onItemHovered: o[3] || (o[3] = (...y) => i.$emit("item-hovered", ...y)),
|
|
450
|
+
onItemFocused: o[4] || (o[4] = (...y) => i.$emit("item-focused", ...y))
|
|
451
|
+
}, null, 8, ["id", "menu-aria-label", "items", "max-menu-width", "position-relative-to-element", "clipping-boundary"])) : g("", !0)
|
|
452
|
+
], 2)) : g("", !0)
|
|
453
|
+
]),
|
|
454
|
+
_: 2
|
|
455
|
+
}, 1032, ["id", "item", "index", "use-max-menu-width", "has-focus"])
|
|
456
|
+
]),
|
|
457
|
+
_: 1
|
|
458
|
+
}, 16, ["items", "menu-aria-label", "focused-item-index", "clipping-boundary"]);
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
export {
|
|
463
|
+
Se as _
|
|
464
|
+
};
|