@vokril/ui-solid 0.19.1 → 0.20.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/CHANGELOG.md +14 -0
- package/README.md +38 -2
- package/dist/createResizableSidebar-CeksJQ9Q.cjs +1 -0
- package/dist/createResizableSidebar-DnHgvr7P.js +472 -0
- package/dist/createVirtualWindow-C8_UuF7B.cjs +1 -0
- package/dist/createVirtualWindow-CGPw2jm_.js +121 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +108 -104
- package/dist/layout/createVirtualScroller.d.cts +8 -31
- package/dist/layout/createVirtualScroller.d.ts +8 -31
- package/dist/layout/createVirtualWindow.d.cts +66 -0
- package/dist/layout/createVirtualWindow.d.ts +66 -0
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.d.cts +2 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +7 -6
- package/dist/layout/virtualScrollerUtils.d.cts +58 -22
- package/dist/layout/virtualScrollerUtils.d.ts +58 -22
- package/dist/rowSource-CfGSdY64.js +1236 -0
- package/dist/rowSource-D0MM14Bu.cjs +1 -0
- package/dist/server/createResizableSidebar-B0NDaq7D.cjs +1 -0
- package/dist/server/createResizableSidebar-Dn9UMUf_.js +310 -0
- package/dist/server/createVirtualWindow-C8_UuF7B.cjs +1 -0
- package/dist/server/createVirtualWindow-CGPw2jm_.js +121 -0
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +110 -106
- package/dist/server/layout/index.cjs +1 -1
- package/dist/server/layout/index.js +7 -6
- package/dist/server/rowSource-BGuQROhJ.js +1122 -0
- package/dist/server/rowSource-IX742JOS.cjs +1 -0
- package/dist/server/tree/index.cjs +1 -1
- package/dist/server/tree/index.js +11 -8
- package/dist/solid/layout/createVirtualScroller.js +17 -100
- package/dist/solid/layout/createVirtualWindow.js +142 -0
- package/dist/solid/layout/index.js +1 -0
- package/dist/solid/layout/virtualScrollerUtils.js +31 -32
- package/dist/solid/tree/TreeSurface.jsx +20 -13
- package/dist/solid/tree/createTreeController.js +110 -62
- package/dist/solid/tree/createTreeSurface.js +29 -12
- package/dist/solid/tree/index.js +1 -0
- package/dist/solid/tree/rowSource.js +93 -0
- package/dist/solid/tree/selectAllInScope.js +31 -25
- package/dist/solid/tree/stickyScroll.js +12 -10
- package/dist/solid/tree/treeAria.js +11 -30
- package/dist/solid/tree/treeKeymap.js +2 -24
- package/dist/solid/tree/viewportAnchor.js +23 -0
- package/dist/style.css +1 -1
- package/dist/tree/TreeStickyHeader.d.cts +1 -1
- package/dist/tree/TreeStickyHeader.d.ts +1 -1
- package/dist/tree/TreeSurface.d.cts +1 -1
- package/dist/tree/TreeSurface.d.ts +1 -1
- package/dist/tree/createTreeController.d.cts +19 -8
- package/dist/tree/createTreeController.d.ts +19 -8
- package/dist/tree/createTreeSurface.d.cts +8 -3
- package/dist/tree/createTreeSurface.d.ts +8 -3
- package/dist/tree/descriptor.d.cts +8 -9
- package/dist/tree/descriptor.d.ts +8 -9
- package/dist/tree/index.cjs +1 -1
- package/dist/tree/index.d.cts +1 -0
- package/dist/tree/index.d.ts +1 -0
- package/dist/tree/index.js +11 -8
- package/dist/tree/rowSource.d.cts +41 -0
- package/dist/tree/rowSource.d.ts +41 -0
- package/dist/tree/selectAllInScope.d.cts +20 -2
- package/dist/tree/selectAllInScope.d.ts +20 -2
- package/dist/tree/stickyScroll.d.cts +32 -5
- package/dist/tree/stickyScroll.d.ts +32 -5
- package/dist/tree/treeAria.d.cts +26 -10
- package/dist/tree/treeAria.d.ts +26 -10
- package/dist/tree/treeKeymap.d.cts +2 -16
- package/dist/tree/treeKeymap.d.ts +2 -16
- package/dist/tree/viewportAnchor.d.cts +21 -0
- package/dist/tree/viewportAnchor.d.ts +21 -0
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/createResizableSidebar-Dau7TIuH.cjs +0 -1
- package/dist/createResizableSidebar-gvf9me4K.js +0 -449
- package/dist/createVirtualScroller-CL49JE2P.cjs +0 -1
- package/dist/createVirtualScroller-vu-l4rVv.js +0 -93
- package/dist/descriptor-CaHgh9N_.cjs +0 -1
- package/dist/descriptor-eGtcBtpI.js +0 -1106
- package/dist/server/createResizableSidebar-BQG5elmd.js +0 -287
- package/dist/server/createResizableSidebar-tU8FO2MK.cjs +0 -1
- package/dist/server/createVirtualScroller-CL49JE2P.cjs +0 -1
- package/dist/server/createVirtualScroller-vu-l4rVv.js +0 -93
- package/dist/server/descriptor-CEGvvJZh.cjs +0 -1
- package/dist/server/descriptor-GLoKPx6x.js +0 -992
|
@@ -0,0 +1,1122 @@
|
|
|
1
|
+
import { createComponent as b, ssr as E, ssrAttribute as A, escape as d, ssrElement as de, mergeProps as he, memo as X, ssrStyleProperty as V } from "solid-js/web";
|
|
2
|
+
import { createMemo as O, Show as H, For as ke, createEffect as Y, Index as fe, createSelector as xe, createSignal as Q, onCleanup as Ce, useContext as be, untrack as Ie, on as Re } from "solid-js";
|
|
3
|
+
import { O as Ae } from "./OverlayScrollArea-221dfKyz.js";
|
|
4
|
+
import { t as Te } from "./i18n-DW9kcu0G.js";
|
|
5
|
+
import { c as _e } from "./errorHandler-BvPGW-Nm.js";
|
|
6
|
+
import { V as Me } from "./VpLoader2-DO0zkwpY.js";
|
|
7
|
+
import { V as Ee } from "./VpChevronRight-CwRCE60O.js";
|
|
8
|
+
import { a as De } from "./useListCommands-BO_XrRHj.js";
|
|
9
|
+
import { a as $e } from "./builtins-XOM9gfIx.js";
|
|
10
|
+
import { V as Ke } from "./VpSearch-CzVlR0ue.js";
|
|
11
|
+
import { S as ne, c as Ge } from "./createVirtualWindow-CGPw2jm_.js";
|
|
12
|
+
import { D as Oe } from "./DesktopContextMenuContext-DJ3PnqAv.js";
|
|
13
|
+
import { n as He, i as pe } from "./keys-B2nlkpqc.js";
|
|
14
|
+
import { B as Z } from "./bugIndicatingError-h3J5qkL6.js";
|
|
15
|
+
const ge = {
|
|
16
|
+
canExpand: !0,
|
|
17
|
+
canMultiSelect: !0,
|
|
18
|
+
canTypeAhead: !0,
|
|
19
|
+
canRename: !1,
|
|
20
|
+
canDestroy: !1,
|
|
21
|
+
expandAll: !1
|
|
22
|
+
};
|
|
23
|
+
function ye(e, t) {
|
|
24
|
+
return `${e}-row-${t}`;
|
|
25
|
+
}
|
|
26
|
+
function Le(e) {
|
|
27
|
+
const { treeId: t, label: n, multiSelectable: r, focusMode: o, cursorKey: a } = e;
|
|
28
|
+
return {
|
|
29
|
+
role: e.flat === !0 ? "listbox" : "tree",
|
|
30
|
+
// With roving tabindex the container yields its tab stop to the cursor row
|
|
31
|
+
// once there is one; with active-descendant the container IS the tab stop.
|
|
32
|
+
tabIndex: o === "active-descendant" || a === null ? 0 : -1,
|
|
33
|
+
"aria-label": n,
|
|
34
|
+
"aria-multiselectable": r ? !0 : void 0,
|
|
35
|
+
"aria-activedescendant": o === "active-descendant" && a !== null ? ye(t, a) : void 0
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function Fe(e) {
|
|
39
|
+
const { treeId: t, rows: n, index: r } = e, o = n.at(r), a = e.flat === !0, { posInSet: l, setSize: y } = n.siblingPosition(r);
|
|
40
|
+
return {
|
|
41
|
+
role: a ? "option" : "treeitem",
|
|
42
|
+
id: ye(t, o.key),
|
|
43
|
+
// A listbox option has no level, and no expanded state to advertise.
|
|
44
|
+
"aria-level": a ? void 0 : o.depth + 1,
|
|
45
|
+
"aria-setsize": y,
|
|
46
|
+
"aria-posinset": l,
|
|
47
|
+
"aria-expanded": !a && o.expandable ? o.expanded : void 0,
|
|
48
|
+
// Announced while the row is fetching its children — silence is what a
|
|
49
|
+
// screen-reader user got before, for as long as the query took.
|
|
50
|
+
"aria-busy": o.busy === !0 ? !0 : void 0
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function Pe(e) {
|
|
54
|
+
return {
|
|
55
|
+
...e.structure,
|
|
56
|
+
tabIndex: e.focusMode === "roving-tabindex" && e.isCursor ? 0 : -1,
|
|
57
|
+
"aria-selected": e.isSelected
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const Be = /[\^$.*+?(){}|[\]\\]/;
|
|
61
|
+
function Ne(e) {
|
|
62
|
+
const t = e.trim();
|
|
63
|
+
if (t.length === 0) return null;
|
|
64
|
+
if (Be.test(t))
|
|
65
|
+
try {
|
|
66
|
+
const r = new RegExp(t, "gi");
|
|
67
|
+
return (o) => Ve(o, r);
|
|
68
|
+
} catch (r) {
|
|
69
|
+
_e("fall through to substring", r);
|
|
70
|
+
}
|
|
71
|
+
const n = t.toLowerCase();
|
|
72
|
+
return (r) => Ue(r, n, t.length);
|
|
73
|
+
}
|
|
74
|
+
function Ve(e, t) {
|
|
75
|
+
t.lastIndex = 0;
|
|
76
|
+
const n = [];
|
|
77
|
+
let r = 0, o;
|
|
78
|
+
for (; (o = t.exec(e)) !== null; )
|
|
79
|
+
o.index > r && n.push({ text: e.slice(r, o.index), match: !1 }), n.push({ text: o[0], match: !0 }), r = o.index + o[0].length, o[0].length === 0 && (t.lastIndex += 1);
|
|
80
|
+
return r < e.length && n.push({ text: e.slice(r), match: !1 }), n.length > 0 ? n : [{ text: e, match: !1 }];
|
|
81
|
+
}
|
|
82
|
+
function Ue(e, t, n) {
|
|
83
|
+
if (n === 0) return [{ text: e, match: !1 }];
|
|
84
|
+
const r = e.toLowerCase(), o = [];
|
|
85
|
+
let a = 0;
|
|
86
|
+
for (; a <= e.length; ) {
|
|
87
|
+
const l = r.indexOf(t, a);
|
|
88
|
+
if (l === -1) {
|
|
89
|
+
a < e.length && o.push({ text: e.slice(a), match: !1 });
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
l > a && o.push({ text: e.slice(a, l), match: !1 }), o.push({ text: e.slice(l, l + n), match: !0 }), a = l + n;
|
|
93
|
+
}
|
|
94
|
+
return o.length > 0 ? o : [{ text: e, match: !1 }];
|
|
95
|
+
}
|
|
96
|
+
const Qe = "vk_treeStickyHost_6aT7a", We = "vk_treeViewport_Ku3yB", Ye = "vk_treeContainer_iMrOQ", qe = "vk_treeSlice_homAf", ze = "vk_treeRow_Hh9r0", Xe = "vk_treeRowCursor_QlUrp", Ze = "vk_treeRowSelected_UdZj-", je = "vk_treeIndentGuides_W4J04", Je = "vk_treeIndentGuideActive_9m4l3", et = "vk_treeRowChevron_6WMjE", tt = "vk_treeRowChevronSpacer_Jbp-q", nt = "vk_treeRowChevronIcon_KP24Y", rt = "vk_treeRowChevronIconOpen_fRKNn", ot = "vk_treeRowContent_RR7pP", at = "vk_treeRowActions_LYQUv", ct = "vk_treeEmpty_s8RQ-", lt = "vk_treeRowChevronBusy_lZT8a", ut = "vk_treeSpeedSearchBadge_9GHNi", st = "vk_treeSpeedSearchIcon_48Ae2", it = "vk_treeSpeedSearchText_F4SZ8", dt = "vk_treeMatchHighlight_NY75y", C = {
|
|
97
|
+
treeStickyHost: Qe,
|
|
98
|
+
treeViewport: We,
|
|
99
|
+
treeContainer: Ye,
|
|
100
|
+
treeSlice: qe,
|
|
101
|
+
treeRow: ze,
|
|
102
|
+
treeRowCursor: Xe,
|
|
103
|
+
treeRowSelected: Ze,
|
|
104
|
+
treeIndentGuides: je,
|
|
105
|
+
treeIndentGuideActive: Je,
|
|
106
|
+
treeRowChevron: et,
|
|
107
|
+
treeRowChevronSpacer: tt,
|
|
108
|
+
treeRowChevronIcon: nt,
|
|
109
|
+
treeRowChevronIconOpen: rt,
|
|
110
|
+
treeRowContent: ot,
|
|
111
|
+
treeRowActions: at,
|
|
112
|
+
treeEmpty: ct,
|
|
113
|
+
treeRowChevronBusy: lt,
|
|
114
|
+
treeSpeedSearchBadge: ut,
|
|
115
|
+
treeSpeedSearchIcon: st,
|
|
116
|
+
treeSpeedSearchText: it,
|
|
117
|
+
treeMatchHighlight: dt
|
|
118
|
+
};
|
|
119
|
+
var ht = ["<span", ' aria-hidden="true" tabindex="-1">', "</span>"], re = ["<span", ' aria-hidden="true"></span>'], ft = ["<span", ' style="', '" aria-hidden="true"></span>'], gt = ["<span", ">", "</span>"], yt = ["<span", ' tabindex="-1">', "</span>"], wt = ["<mark", ">", "</mark>"];
|
|
120
|
+
function we(e) {
|
|
121
|
+
Y(() => {
|
|
122
|
+
e.sticky === !0 || !e.isCursor || e.treeHasFocus();
|
|
123
|
+
});
|
|
124
|
+
const t = () => b(H, {
|
|
125
|
+
get when() {
|
|
126
|
+
return e.row.expandable;
|
|
127
|
+
},
|
|
128
|
+
get fallback() {
|
|
129
|
+
return E(re, A("class", d(C.treeRowChevronSpacer, !0), !1));
|
|
130
|
+
},
|
|
131
|
+
get children() {
|
|
132
|
+
return E(ht, A("class", d(C.treeRowChevron, !0), !1), d(b(H, {
|
|
133
|
+
get when() {
|
|
134
|
+
return e.row.busy;
|
|
135
|
+
},
|
|
136
|
+
get fallback() {
|
|
137
|
+
return b(Ee, {
|
|
138
|
+
get class() {
|
|
139
|
+
return `${C.treeRowChevronIcon} ${e.row.expanded ? C.treeRowChevronIconOpen : ""}`;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
get children() {
|
|
144
|
+
return b(Me, {
|
|
145
|
+
"data-motion-exempt": "true",
|
|
146
|
+
get class() {
|
|
147
|
+
return `${C.treeRowChevronIcon} ${C.treeRowChevronBusy}`;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
})));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return de("div", he({
|
|
155
|
+
get tabIndex() {
|
|
156
|
+
return e.sticky === !0 ? -1 : 0;
|
|
157
|
+
}
|
|
158
|
+
}, () => e.sticky === !0 ? {
|
|
159
|
+
tabIndex: -1
|
|
160
|
+
} : e.aria, {
|
|
161
|
+
get class() {
|
|
162
|
+
var n;
|
|
163
|
+
return `${`${C.treeRow} ${((n = e.dom) == null ? void 0 : n.class) ?? ""}` || ""} ${e.isCursor ? d(C.treeRowCursor, !0) : ""} ${e.isSelected ? d(C.treeRowSelected, !0) : ""}`;
|
|
164
|
+
},
|
|
165
|
+
get style() {
|
|
166
|
+
return {
|
|
167
|
+
height: `${e.rowHeight}px`,
|
|
168
|
+
// Depth travels as a CSS variable so indent stays ONE formula in the
|
|
169
|
+
// stylesheet. Four surfaces used to hardcode it four different ways.
|
|
170
|
+
"--tree-depth": String(e.row.depth)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}, () => e.sticky === !0 ? {
|
|
174
|
+
"data-tree-sticky-key": e.row.key
|
|
175
|
+
} : {
|
|
176
|
+
"data-tree-row-key": e.row.key
|
|
177
|
+
}, () => {
|
|
178
|
+
var n;
|
|
179
|
+
return ((n = e.dom) == null ? void 0 : n.title) !== void 0 ? {
|
|
180
|
+
title: e.dom.title
|
|
181
|
+
} : {};
|
|
182
|
+
}, () => {
|
|
183
|
+
var n;
|
|
184
|
+
return ((n = e.dom) == null ? void 0 : n.draggable) !== void 0 ? {
|
|
185
|
+
draggable: e.dom.draggable
|
|
186
|
+
} : {};
|
|
187
|
+
}, () => {
|
|
188
|
+
var n;
|
|
189
|
+
return (n = e.dom) != null && n.onDragStart ? {
|
|
190
|
+
onDragStart: e.dom.onDragStart
|
|
191
|
+
} : {};
|
|
192
|
+
}, () => {
|
|
193
|
+
var n;
|
|
194
|
+
return (n = e.dom) != null && n.onDragOver ? {
|
|
195
|
+
onDragOver: e.dom.onDragOver
|
|
196
|
+
} : {};
|
|
197
|
+
}, () => {
|
|
198
|
+
var n;
|
|
199
|
+
return (n = e.dom) != null && n.onDragLeave ? {
|
|
200
|
+
onDragLeave: e.dom.onDragLeave
|
|
201
|
+
} : {};
|
|
202
|
+
}, () => {
|
|
203
|
+
var n;
|
|
204
|
+
return (n = e.dom) != null && n.onDrop ? {
|
|
205
|
+
onDrop: e.dom.onDrop
|
|
206
|
+
} : {};
|
|
207
|
+
}, () => {
|
|
208
|
+
var n;
|
|
209
|
+
return (n = e.dom) != null && n.onDragEnd ? {
|
|
210
|
+
onDragEnd: e.dom.onDragEnd
|
|
211
|
+
} : {};
|
|
212
|
+
}, () => {
|
|
213
|
+
var n;
|
|
214
|
+
return (n = e.dom) != null && n.onMouseEnter ? {
|
|
215
|
+
onMouseEnter: e.dom.onMouseEnter
|
|
216
|
+
} : {};
|
|
217
|
+
}, () => {
|
|
218
|
+
var n;
|
|
219
|
+
return (n = e.dom) != null && n.onMouseLeave ? {
|
|
220
|
+
onMouseLeave: e.dom.onMouseLeave
|
|
221
|
+
} : {};
|
|
222
|
+
}), [d(b(H, {
|
|
223
|
+
get when() {
|
|
224
|
+
return X(() => e.indentGuide !== "none")() && e.row.depth > 0;
|
|
225
|
+
},
|
|
226
|
+
get children() {
|
|
227
|
+
return E(re, A("class", d(C.treeIndentGuides, !0), !1));
|
|
228
|
+
}
|
|
229
|
+
})), d(b(H, {
|
|
230
|
+
get when() {
|
|
231
|
+
return X(() => e.indentGuide === "active" && e.activeGuideDepth >= 0)() && e.row.depth > e.activeGuideDepth;
|
|
232
|
+
},
|
|
233
|
+
get children() {
|
|
234
|
+
return E(ft, A("class", d(C.treeIndentGuideActive, !0), !1), V("--tree-active-col:", `${d(e.activeGuideDepth, !0)}`));
|
|
235
|
+
}
|
|
236
|
+
})), d(b(H, {
|
|
237
|
+
get when() {
|
|
238
|
+
return e.showChevronGutter;
|
|
239
|
+
},
|
|
240
|
+
get children() {
|
|
241
|
+
return t();
|
|
242
|
+
}
|
|
243
|
+
})), E(gt, A("class", d(C.treeRowContent, !0), !1), d(e.content)), d(b(H, {
|
|
244
|
+
get when() {
|
|
245
|
+
return e.actions;
|
|
246
|
+
},
|
|
247
|
+
get children() {
|
|
248
|
+
return E(yt, A("class", d(C.treeRowActions, !0), !1), d(e.actions));
|
|
249
|
+
}
|
|
250
|
+
}))], !1);
|
|
251
|
+
}
|
|
252
|
+
function hn(e) {
|
|
253
|
+
const t = () => e.query ? typeof e.query == "function" ? e.query() : e.query : "", n = O(() => {
|
|
254
|
+
const r = t().trim();
|
|
255
|
+
if (r.length === 0) return null;
|
|
256
|
+
const o = Ne(r);
|
|
257
|
+
return o ? o(e.text) : null;
|
|
258
|
+
});
|
|
259
|
+
return b(H, {
|
|
260
|
+
get when() {
|
|
261
|
+
return n();
|
|
262
|
+
},
|
|
263
|
+
get fallback() {
|
|
264
|
+
return e.text;
|
|
265
|
+
},
|
|
266
|
+
get children() {
|
|
267
|
+
return b(ke, {
|
|
268
|
+
get each() {
|
|
269
|
+
return n();
|
|
270
|
+
},
|
|
271
|
+
children: (r) => b(H, {
|
|
272
|
+
get when() {
|
|
273
|
+
return r.match;
|
|
274
|
+
},
|
|
275
|
+
get fallback() {
|
|
276
|
+
return r.text;
|
|
277
|
+
},
|
|
278
|
+
get children() {
|
|
279
|
+
return E(wt, A("class", d(e.class ?? C.treeMatchHighlight, !0), !1), d(r.text));
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
const mt = "vk_treeStickyWidget_Q-8QQ", vt = "vk_treeStickyRow_7gWG2", oe = {
|
|
287
|
+
treeStickyWidget: mt,
|
|
288
|
+
treeStickyRow: vt
|
|
289
|
+
};
|
|
290
|
+
var St = ["<div", ' role="list"', ' style="', '">', "</div>"], kt = ["<div", ' role="listitem" style="', '">', "</div>"];
|
|
291
|
+
function xt(e) {
|
|
292
|
+
return E(St, A("class", d(oe.treeStickyWidget, !0), !1), A("aria-label", d(e.label, !0), !1), V("height:", `${d(e.height, !0)}px`), d(b(fe, {
|
|
293
|
+
get each() {
|
|
294
|
+
return e.rows;
|
|
295
|
+
},
|
|
296
|
+
children: (t, n) => E(kt, A("class", d(oe.treeStickyRow, !0), !1), V("top:", `${d(t().top, !0)}px`) + V(";z-index:", `${d(e.rows.length, !0) - d(n, !0)}`), d(b(we, {
|
|
297
|
+
sticky: !0,
|
|
298
|
+
get row() {
|
|
299
|
+
return t().row;
|
|
300
|
+
},
|
|
301
|
+
get index() {
|
|
302
|
+
return t().index;
|
|
303
|
+
},
|
|
304
|
+
get rowHeight() {
|
|
305
|
+
return e.descriptor.rowHeight;
|
|
306
|
+
},
|
|
307
|
+
get isCursor() {
|
|
308
|
+
return e.isCursor(t().index);
|
|
309
|
+
},
|
|
310
|
+
get isSelected() {
|
|
311
|
+
return e.isSelected(t().row);
|
|
312
|
+
},
|
|
313
|
+
treeHasFocus: () => !1,
|
|
314
|
+
get showChevronGutter() {
|
|
315
|
+
return e.showChevronGutter;
|
|
316
|
+
},
|
|
317
|
+
get indentGuide() {
|
|
318
|
+
return e.indentGuide;
|
|
319
|
+
},
|
|
320
|
+
get activeGuideDepth() {
|
|
321
|
+
return e.activeGuideDepth;
|
|
322
|
+
},
|
|
323
|
+
get dom() {
|
|
324
|
+
var r, o;
|
|
325
|
+
return (o = (r = e.descriptor).rowProps) == null ? void 0 : o.call(r, t().row);
|
|
326
|
+
},
|
|
327
|
+
get content() {
|
|
328
|
+
return e.descriptor.renderContent(t().row);
|
|
329
|
+
},
|
|
330
|
+
get actions() {
|
|
331
|
+
var r, o;
|
|
332
|
+
return (o = (r = e.descriptor).renderActions) == null ? void 0 : o.call(r, t().row);
|
|
333
|
+
},
|
|
334
|
+
get onSelect() {
|
|
335
|
+
return e.onSelect;
|
|
336
|
+
},
|
|
337
|
+
get onFocusRow() {
|
|
338
|
+
return e.onFocusRow;
|
|
339
|
+
},
|
|
340
|
+
get onToggle() {
|
|
341
|
+
return e.onToggle;
|
|
342
|
+
},
|
|
343
|
+
onActivateClick: () => e.onReveal(t().index),
|
|
344
|
+
get onOpenMenu() {
|
|
345
|
+
return e.onOpenMenu;
|
|
346
|
+
}
|
|
347
|
+
})))
|
|
348
|
+
})));
|
|
349
|
+
}
|
|
350
|
+
var Ct = ["<div", ' role="status" aria-live="polite" aria-atomic="true">', "<span", ">", "</span></div>"], bt = ["<div", ' style="', '">', "</div>"], It = ["<p", ">", "</p>"], Rt = ["<div", ' style="', '">', "", "", "</div>"];
|
|
351
|
+
const ae = "roving-tabindex";
|
|
352
|
+
function fn(e) {
|
|
353
|
+
const t = () => e.surface.descriptor, n = () => e.surface.controller;
|
|
354
|
+
let r;
|
|
355
|
+
const o = O(() => ({
|
|
356
|
+
...ge,
|
|
357
|
+
...t().capabilities
|
|
358
|
+
})), a = () => o().canExpand && (t().chevronGutter ?? !0), l = O(() => {
|
|
359
|
+
if ((t().indentGuide ?? "none") !== "active") return -1;
|
|
360
|
+
const g = e.surface.cursorRow();
|
|
361
|
+
return g ? g.depth - 1 : -1;
|
|
362
|
+
}), y = O(() => {
|
|
363
|
+
const {
|
|
364
|
+
start: g,
|
|
365
|
+
end: m
|
|
366
|
+
} = e.surface.scroller.range();
|
|
367
|
+
return Array.from({
|
|
368
|
+
length: m - g
|
|
369
|
+
}, (T, _) => g + _);
|
|
370
|
+
}), w = xe(() => n().cursorIndex());
|
|
371
|
+
De({
|
|
372
|
+
container: () => r,
|
|
373
|
+
supportsMultiselect: () => o().canMultiSelect,
|
|
374
|
+
verbs: {
|
|
375
|
+
selectAll: () => n().selectAll()
|
|
376
|
+
}
|
|
377
|
+
}), $e();
|
|
378
|
+
const v = O(() => Le({
|
|
379
|
+
treeId: t().id,
|
|
380
|
+
label: t().ariaLabel,
|
|
381
|
+
multiSelectable: o().canMultiSelect,
|
|
382
|
+
focusMode: ae,
|
|
383
|
+
cursorKey: n().cursorKey(),
|
|
384
|
+
flat: !o().canExpand
|
|
385
|
+
})), u = () => r !== void 0, h = (g, m) => {
|
|
386
|
+
n().selectIndex(g, m);
|
|
387
|
+
}, k = (g, m, T) => {
|
|
388
|
+
var _, D;
|
|
389
|
+
(D = (_ = t()).onActivate) == null || D.call(_, g, m, T);
|
|
390
|
+
}, I = (g, m) => {
|
|
391
|
+
e.surface.openMenu(g, {
|
|
392
|
+
x: m.clientX,
|
|
393
|
+
y: m.clientY
|
|
394
|
+
}, m);
|
|
395
|
+
}, x = (g) => {
|
|
396
|
+
e.surface.scroller.scrollToIndex(g, "auto", e.surface.stickyInsetFor(g));
|
|
397
|
+
};
|
|
398
|
+
return E(Rt, A("class", d(C.treeStickyHost, !0), !1), V("--tree-indent-base:", `${d(t().indentBaseRem ?? 0, !0)}rem`), d(b(H, {
|
|
399
|
+
get when() {
|
|
400
|
+
return n().typeAheadQuery().length > 0;
|
|
401
|
+
},
|
|
402
|
+
get children() {
|
|
403
|
+
return E(Ct, A("class", d(C.treeSpeedSearchBadge, !0), !1), d(b(Ke, {
|
|
404
|
+
get class() {
|
|
405
|
+
return C.treeSpeedSearchIcon;
|
|
406
|
+
}
|
|
407
|
+
})), A("class", d(C.treeSpeedSearchText, !0), !1), d(n().typeAheadQuery()));
|
|
408
|
+
}
|
|
409
|
+
})), d(b(Ae, {
|
|
410
|
+
viewportRef: (g) => {
|
|
411
|
+
var m;
|
|
412
|
+
e.surface.scroller.containerRef(g), (m = e.viewportRef) == null || m.call(e, g);
|
|
413
|
+
},
|
|
414
|
+
get viewportClass() {
|
|
415
|
+
return `${C.treeViewport} ${e.viewportClass ?? ""}`.trim();
|
|
416
|
+
},
|
|
417
|
+
get children() {
|
|
418
|
+
return [de("div", he(v, {
|
|
419
|
+
get class() {
|
|
420
|
+
return C.treeContainer;
|
|
421
|
+
},
|
|
422
|
+
get style() {
|
|
423
|
+
return {
|
|
424
|
+
height: `${e.surface.scroller.totalHeight()}px`
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}), E(bt, A("class", d(C.treeSlice, !0), !1), V("transform:", `translate3d(0, ${d(e.surface.scroller.offsetY(), !0)}px, 0)`), d(b(fe, {
|
|
428
|
+
get each() {
|
|
429
|
+
return y();
|
|
430
|
+
},
|
|
431
|
+
children: (g) => {
|
|
432
|
+
const m = O(() => e.surface.source().at(g())), T = () => w(g()), _ = () => n().selectedKeys().has(m().key), D = O(() => Fe({
|
|
433
|
+
treeId: t().id,
|
|
434
|
+
rows: e.surface.source(),
|
|
435
|
+
index: g(),
|
|
436
|
+
flat: !o().canExpand
|
|
437
|
+
}));
|
|
438
|
+
return b(we, {
|
|
439
|
+
get row() {
|
|
440
|
+
return m();
|
|
441
|
+
},
|
|
442
|
+
get index() {
|
|
443
|
+
return g();
|
|
444
|
+
},
|
|
445
|
+
get aria() {
|
|
446
|
+
return Pe({
|
|
447
|
+
structure: D(),
|
|
448
|
+
focusMode: ae,
|
|
449
|
+
isCursor: T(),
|
|
450
|
+
isSelected: _()
|
|
451
|
+
});
|
|
452
|
+
},
|
|
453
|
+
get rowHeight() {
|
|
454
|
+
return t().rowHeight;
|
|
455
|
+
},
|
|
456
|
+
get isCursor() {
|
|
457
|
+
return T();
|
|
458
|
+
},
|
|
459
|
+
get isSelected() {
|
|
460
|
+
return _();
|
|
461
|
+
},
|
|
462
|
+
treeHasFocus: u,
|
|
463
|
+
get showChevronGutter() {
|
|
464
|
+
return a();
|
|
465
|
+
},
|
|
466
|
+
get indentGuide() {
|
|
467
|
+
return t().indentGuide ?? "none";
|
|
468
|
+
},
|
|
469
|
+
get activeGuideDepth() {
|
|
470
|
+
return l();
|
|
471
|
+
},
|
|
472
|
+
get dom() {
|
|
473
|
+
var K, G;
|
|
474
|
+
return (G = (K = t()).rowProps) == null ? void 0 : G.call(K, m());
|
|
475
|
+
},
|
|
476
|
+
get content() {
|
|
477
|
+
return t().renderContent(m());
|
|
478
|
+
},
|
|
479
|
+
get actions() {
|
|
480
|
+
var K, G;
|
|
481
|
+
return (G = (K = t()).renderActions) == null ? void 0 : G.call(K, m());
|
|
482
|
+
},
|
|
483
|
+
onSelect: h,
|
|
484
|
+
onFocusRow: (K) => n().focusIndex(K),
|
|
485
|
+
onToggle: (K) => {
|
|
486
|
+
var G, U;
|
|
487
|
+
return (U = (G = t()).onToggle) == null ? void 0 : U.call(G, K);
|
|
488
|
+
},
|
|
489
|
+
onActivateClick: k,
|
|
490
|
+
onOpenMenu: I
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
}))), !1), b(H, {
|
|
494
|
+
get when() {
|
|
495
|
+
return X(() => e.surface.source().length === 0)() && t().emptyLabel;
|
|
496
|
+
},
|
|
497
|
+
get children() {
|
|
498
|
+
return E(It, A("class", d(C.treeEmpty, !0), !1), d(t().emptyLabel));
|
|
499
|
+
}
|
|
500
|
+
})];
|
|
501
|
+
}
|
|
502
|
+
})), d(b(H, {
|
|
503
|
+
get when() {
|
|
504
|
+
return e.surface.stickyState().rows.length > 0;
|
|
505
|
+
},
|
|
506
|
+
get children() {
|
|
507
|
+
return b(xt, {
|
|
508
|
+
get rows() {
|
|
509
|
+
return e.surface.stickyState().rows;
|
|
510
|
+
},
|
|
511
|
+
get height() {
|
|
512
|
+
return e.surface.stickyState().height;
|
|
513
|
+
},
|
|
514
|
+
get label() {
|
|
515
|
+
return Te("Sticky parent rows");
|
|
516
|
+
},
|
|
517
|
+
get descriptor() {
|
|
518
|
+
return t();
|
|
519
|
+
},
|
|
520
|
+
get showChevronGutter() {
|
|
521
|
+
return a();
|
|
522
|
+
},
|
|
523
|
+
get indentGuide() {
|
|
524
|
+
return t().indentGuide ?? "none";
|
|
525
|
+
},
|
|
526
|
+
get activeGuideDepth() {
|
|
527
|
+
return l();
|
|
528
|
+
},
|
|
529
|
+
isCursor: (g) => n().cursorIndex() === g,
|
|
530
|
+
isSelected: (g) => n().selectedKeys().has(g.key),
|
|
531
|
+
onSelect: h,
|
|
532
|
+
onFocusRow: (g) => n().focusIndex(g),
|
|
533
|
+
onToggle: (g) => {
|
|
534
|
+
var m, T;
|
|
535
|
+
return (T = (m = t()).onToggle) == null ? void 0 : T.call(m, g);
|
|
536
|
+
},
|
|
537
|
+
onReveal: x,
|
|
538
|
+
onOpenMenu: I
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
})));
|
|
542
|
+
}
|
|
543
|
+
const ce = 10, N = (e, t) => Math.max(0, Math.min(e, t - 1));
|
|
544
|
+
function At(e) {
|
|
545
|
+
return e.key.length === 1 && e.key !== " " && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
546
|
+
}
|
|
547
|
+
function Tt(e, t) {
|
|
548
|
+
const { index: n, rowCount: r, capabilities: o } = t;
|
|
549
|
+
if (r === 0) return null;
|
|
550
|
+
const a = n < 0 ? -1 : n;
|
|
551
|
+
switch (He(e)) {
|
|
552
|
+
case "ArrowDown":
|
|
553
|
+
return e.shiftKey && o.canMultiSelect ? { type: "extend", to: N(a + 1, r) } : { type: "move", to: N(a + 1, r) };
|
|
554
|
+
case "ArrowUp":
|
|
555
|
+
return a < 0 ? { type: "move", to: r - 1 } : e.shiftKey && o.canMultiSelect ? { type: "extend", to: N(a - 1, r) } : { type: "move", to: N(a - 1, r) };
|
|
556
|
+
case "Home":
|
|
557
|
+
return { type: "move", to: 0 };
|
|
558
|
+
case "End":
|
|
559
|
+
return { type: "move", to: r - 1 };
|
|
560
|
+
case "PageDown":
|
|
561
|
+
return {
|
|
562
|
+
type: "move",
|
|
563
|
+
to: N(Math.max(a, 0) + ce, r)
|
|
564
|
+
};
|
|
565
|
+
case "PageUp":
|
|
566
|
+
return {
|
|
567
|
+
type: "move",
|
|
568
|
+
to: N(Math.max(a, 0) - ce, r)
|
|
569
|
+
};
|
|
570
|
+
case "ArrowRight":
|
|
571
|
+
return o.canExpand ? { type: "expandOrDescend" } : { type: "flatNavigate", direction: "in" };
|
|
572
|
+
case "ArrowLeft":
|
|
573
|
+
return e.ctrlKey || e.metaKey ? null : o.canExpand ? { type: "collapseOrAscend" } : { type: "flatNavigate", direction: "out" };
|
|
574
|
+
case "Enter":
|
|
575
|
+
return { type: "activate" };
|
|
576
|
+
case "ContextMenu":
|
|
577
|
+
return { type: "openMenu" };
|
|
578
|
+
case "F10":
|
|
579
|
+
return e.shiftKey ? { type: "openMenu" } : null;
|
|
580
|
+
}
|
|
581
|
+
return e.key === " " ? o.canExpand ? { type: "toggle" } : null : o.canTypeAhead && At(e) ? { type: "typeAhead", char: e.key } : null;
|
|
582
|
+
}
|
|
583
|
+
function _t(e, t, n, r = !1) {
|
|
584
|
+
const o = n.toLowerCase();
|
|
585
|
+
if (o.length === 0) return -1;
|
|
586
|
+
const a = e.length;
|
|
587
|
+
if (a === 0) return -1;
|
|
588
|
+
const l = r ? 0 : 1;
|
|
589
|
+
for (let y = l; y <= a; y++) {
|
|
590
|
+
const w = (t + y + a) % a;
|
|
591
|
+
if (e.at(w).label.toLowerCase().startsWith(o)) return w;
|
|
592
|
+
}
|
|
593
|
+
for (let y = l; y <= a; y++) {
|
|
594
|
+
const w = (t + y + a) % a;
|
|
595
|
+
if (e.at(w).label.toLowerCase().includes(o)) return w;
|
|
596
|
+
}
|
|
597
|
+
return -1;
|
|
598
|
+
}
|
|
599
|
+
function Mt(e, t, n) {
|
|
600
|
+
const r = [...n].filter((v) => e.indexOfKey(v) >= 0), o = Et(e, t, r), a = Dt(e, o), l = (v) => v.selectable !== !1 && (a === void 0 || v.kind === a), y = new Set(r);
|
|
601
|
+
let w = o < 0 ? -1 : e.parentIndex(o);
|
|
602
|
+
for (; ; ) {
|
|
603
|
+
const v = $t(e, w, l);
|
|
604
|
+
if (w < 0) return v;
|
|
605
|
+
const u = v.length === y.size && v.every((k) => y.has(k));
|
|
606
|
+
if (v.length > 0 && !u) return v;
|
|
607
|
+
const h = e.at(w);
|
|
608
|
+
if (v.length > 0 && l(h))
|
|
609
|
+
return [h.key, ...v];
|
|
610
|
+
w = e.parentIndex(w);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
function Et(e, t, n) {
|
|
614
|
+
const r = t >= 0 && t < e.length ? e.at(t).key : void 0;
|
|
615
|
+
if (r !== void 0 && !n.includes(r)) return t;
|
|
616
|
+
const o = n[0];
|
|
617
|
+
return o === void 0 ? -1 : e.indexOfKey(o);
|
|
618
|
+
}
|
|
619
|
+
function Dt(e, t) {
|
|
620
|
+
if (t >= 0) {
|
|
621
|
+
const r = e.at(t);
|
|
622
|
+
if (r.selectable !== !1) return r.kind;
|
|
623
|
+
}
|
|
624
|
+
const n = Math.max(t, 0);
|
|
625
|
+
for (let r = 0; r < e.length; r++) {
|
|
626
|
+
const o = e.at((n + r) % e.length);
|
|
627
|
+
if (o.selectable !== !1) return o.kind;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
function $t(e, t, n) {
|
|
631
|
+
const r = t < 0 ? 0 : t + 1, o = t < 0 ? e.length - 1 : e.subtreeEnd(t), a = [];
|
|
632
|
+
for (let l = r; l <= o; l++) {
|
|
633
|
+
const y = e.at(l);
|
|
634
|
+
n(y) && a.push(y.key);
|
|
635
|
+
}
|
|
636
|
+
return a;
|
|
637
|
+
}
|
|
638
|
+
const le = 1e3;
|
|
639
|
+
function z(e, t) {
|
|
640
|
+
const n = [];
|
|
641
|
+
for (let r = e.parentIndex(t); r !== -1; r = e.parentIndex(r))
|
|
642
|
+
n.push(e.at(r).key);
|
|
643
|
+
return { key: e.at(t).key, ancestors: n, index: t };
|
|
644
|
+
}
|
|
645
|
+
function ue(e, t) {
|
|
646
|
+
if (t === null || e.length === 0) return -1;
|
|
647
|
+
if (t.index < e.length && e.at(t.index).key === t.key)
|
|
648
|
+
return t.index;
|
|
649
|
+
const n = e.indexOfKey(t.key);
|
|
650
|
+
if (n >= 0) return n;
|
|
651
|
+
for (const r of t.ancestors) {
|
|
652
|
+
const o = e.indexOfKey(r);
|
|
653
|
+
if (o >= 0) return o;
|
|
654
|
+
}
|
|
655
|
+
return Math.min(t.index, e.length - 1);
|
|
656
|
+
}
|
|
657
|
+
function Kt(e) {
|
|
658
|
+
const t = () => ({
|
|
659
|
+
...ge,
|
|
660
|
+
...e.capabilities,
|
|
661
|
+
expandAll: !1
|
|
662
|
+
}), [n, r] = Q(null), [o, a] = Q(
|
|
663
|
+
/* @__PURE__ */ new Set()
|
|
664
|
+
), [l, y] = Q(null), w = O(
|
|
665
|
+
() => ue(e.rows(), n())
|
|
666
|
+
), v = () => ue(e.rows(), l()), u = O(() => {
|
|
667
|
+
const c = w();
|
|
668
|
+
return c < 0 ? null : e.rows().at(c).key;
|
|
669
|
+
});
|
|
670
|
+
Y(() => {
|
|
671
|
+
const c = n(), s = w();
|
|
672
|
+
if (c === null || s < 0) return;
|
|
673
|
+
const i = e.rows(), f = i.at(s).key;
|
|
674
|
+
if (f === c.key) {
|
|
675
|
+
s !== c.index && r(z(i, s));
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
c.ancestors.includes(f) && r(z(i, s));
|
|
679
|
+
});
|
|
680
|
+
const [h, k] = Q("");
|
|
681
|
+
let I = 0, x;
|
|
682
|
+
const g = () => {
|
|
683
|
+
x !== void 0 && (clearTimeout(x), x = void 0), h().length > 0 && k("");
|
|
684
|
+
}, m = () => {
|
|
685
|
+
x !== void 0 && (clearTimeout(x), x = void 0), x = setTimeout(() => {
|
|
686
|
+
k(""), x = void 0;
|
|
687
|
+
}, le);
|
|
688
|
+
};
|
|
689
|
+
Ce(() => {
|
|
690
|
+
x !== void 0 && (clearTimeout(x), x = void 0);
|
|
691
|
+
});
|
|
692
|
+
const T = (c) => {
|
|
693
|
+
const s = e.rows();
|
|
694
|
+
return c >= 0 && c < s.length ? s.at(c) : void 0;
|
|
695
|
+
}, _ = (c, s) => {
|
|
696
|
+
var f;
|
|
697
|
+
const i = z(e.rows(), c);
|
|
698
|
+
r(i), s && y(i), (f = e.onScrollToIndex) == null || f.call(e, c);
|
|
699
|
+
}, D = (c) => {
|
|
700
|
+
const s = e.rows();
|
|
701
|
+
c < 0 || c >= s.length || c === w() || _(c, !0);
|
|
702
|
+
}, K = (c) => {
|
|
703
|
+
var i;
|
|
704
|
+
const s = e.rows().indexOfKey(c);
|
|
705
|
+
s < 0 || (s === w() ? (i = e.onScrollToIndex) == null || i.call(e, s) : D(s));
|
|
706
|
+
}, G = (c, s) => {
|
|
707
|
+
var L;
|
|
708
|
+
const i = e.rows(), f = (L = T(c)) == null ? void 0 : L.kind, [S, R] = c <= s ? [c, s] : [s, c], M = /* @__PURE__ */ new Set();
|
|
709
|
+
for (let F = Math.max(S, 0); F <= Math.min(R, i.length - 1); F++) {
|
|
710
|
+
const P = i.at(F);
|
|
711
|
+
P.selectable !== !1 && (f !== void 0 && P.kind !== f || M.add(P.key));
|
|
712
|
+
}
|
|
713
|
+
return M;
|
|
714
|
+
}, U = (c, s) => {
|
|
715
|
+
g();
|
|
716
|
+
const i = T(c);
|
|
717
|
+
if (i) {
|
|
718
|
+
if (i.selectable === !1 && s !== "range") {
|
|
719
|
+
D(c);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
if (s === "toggle" && t().canMultiSelect) {
|
|
723
|
+
const f = new Set(o());
|
|
724
|
+
f.has(i.key) ? f.delete(i.key) : f.add(i.key), a(f), _(c, !0);
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
if (s === "range" && t().canMultiSelect) {
|
|
728
|
+
const f = v();
|
|
729
|
+
a(G(f >= 0 ? f : c, c)), _(c, !1);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
a(/* @__PURE__ */ new Set([i.key])), _(c, !0);
|
|
733
|
+
}
|
|
734
|
+
}, ve = (c, s) => {
|
|
735
|
+
const i = e.rows().indexOfKey(c);
|
|
736
|
+
i >= 0 && U(i, s);
|
|
737
|
+
}, Se = () => {
|
|
738
|
+
g(), o().size > 0 && a(/* @__PURE__ */ new Set());
|
|
739
|
+
}, j = (c, s) => {
|
|
740
|
+
const i = e.rows(), f = T(c);
|
|
741
|
+
if (!f) return;
|
|
742
|
+
const S = f.depth + 1, R = i.subtreeEnd(c);
|
|
743
|
+
for (let M = c + 1; M <= R; M = i.subtreeEnd(M) + 1) {
|
|
744
|
+
const L = i.at(M);
|
|
745
|
+
L.depth === S && s(L, M);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
return {
|
|
749
|
+
cursorIndex: w,
|
|
750
|
+
cursorKey: u,
|
|
751
|
+
selectedKeys: o,
|
|
752
|
+
typeAheadQuery: h,
|
|
753
|
+
get capabilities() {
|
|
754
|
+
return t();
|
|
755
|
+
},
|
|
756
|
+
focusIndex: D,
|
|
757
|
+
focusKey: K,
|
|
758
|
+
selectIndex: U,
|
|
759
|
+
selectKey: ve,
|
|
760
|
+
clearSelection: Se,
|
|
761
|
+
selectChildren: (c) => {
|
|
762
|
+
const s = /* @__PURE__ */ new Set();
|
|
763
|
+
let i, f = !1, S = -1;
|
|
764
|
+
j(c, (R, M) => {
|
|
765
|
+
if (R.selectable !== !1) {
|
|
766
|
+
if (!f)
|
|
767
|
+
i = R.kind, S = M, f = !0;
|
|
768
|
+
else if (i !== void 0 && R.kind !== i) return;
|
|
769
|
+
s.add(R.key);
|
|
770
|
+
}
|
|
771
|
+
}), s.size !== 0 && (a(s), S >= 0 && _(S, !0));
|
|
772
|
+
},
|
|
773
|
+
selectAll: () => {
|
|
774
|
+
t().canMultiSelect && a(
|
|
775
|
+
new Set(Mt(e.rows(), w(), o()))
|
|
776
|
+
);
|
|
777
|
+
},
|
|
778
|
+
childKindsHomogeneous: (c) => {
|
|
779
|
+
let s, i = !1, f = 0, S = 0;
|
|
780
|
+
return j(c, (R) => {
|
|
781
|
+
R.selectable !== !1 && (f++, i ? (s === void 0 || R.kind === s) && S++ : (s = R.kind, i = !0, S++));
|
|
782
|
+
}), {
|
|
783
|
+
homogeneous: f > 0 && f === S,
|
|
784
|
+
total: f,
|
|
785
|
+
selectable: S
|
|
786
|
+
};
|
|
787
|
+
},
|
|
788
|
+
handleKeyDown: (c) => {
|
|
789
|
+
var R, M, L, F, P, J, ee;
|
|
790
|
+
if (pe(c, "Escape") && h().length > 0) {
|
|
791
|
+
c.preventDefault(), c.stopPropagation(), g();
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
const s = e.rows(), i = w(), f = Tt(c, {
|
|
795
|
+
index: i,
|
|
796
|
+
rowCount: s.length,
|
|
797
|
+
capabilities: t()
|
|
798
|
+
});
|
|
799
|
+
if (!f) return;
|
|
800
|
+
const S = T(i);
|
|
801
|
+
switch (f.type) {
|
|
802
|
+
case "move":
|
|
803
|
+
c.preventDefault(), D(f.to);
|
|
804
|
+
return;
|
|
805
|
+
case "extend": {
|
|
806
|
+
c.preventDefault();
|
|
807
|
+
const $ = v();
|
|
808
|
+
a(G($ >= 0 ? $ : i, f.to)), _(f.to, !1);
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
case "expandOrDescend":
|
|
812
|
+
if (!S) return;
|
|
813
|
+
if (c.preventDefault(), S.expandable && !S.expanded) {
|
|
814
|
+
(R = e.onToggle) == null || R.call(e, S);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
D(i + 1);
|
|
818
|
+
return;
|
|
819
|
+
case "collapseOrAscend": {
|
|
820
|
+
if (!S) return;
|
|
821
|
+
if (c.preventDefault(), S.expandable && S.expanded) {
|
|
822
|
+
(M = e.onToggle) == null || M.call(e, S);
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
const $ = s.parentIndex(i);
|
|
826
|
+
$ >= 0 && D($);
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
case "toggle":
|
|
830
|
+
if (!(S != null && S.expandable)) return;
|
|
831
|
+
c.preventDefault(), (L = e.onToggle) == null || L.call(e, S);
|
|
832
|
+
return;
|
|
833
|
+
case "flatNavigate":
|
|
834
|
+
c.preventDefault(), (F = e.onFlatNavigate) == null || F.call(e, f.direction, S);
|
|
835
|
+
return;
|
|
836
|
+
case "activate":
|
|
837
|
+
if (!S) return;
|
|
838
|
+
c.preventDefault(), (P = e.onActivate) == null || P.call(e, S);
|
|
839
|
+
return;
|
|
840
|
+
case "openMenu": {
|
|
841
|
+
if (!S) return;
|
|
842
|
+
c.preventDefault();
|
|
843
|
+
const $ = c.target, p = $ == null ? void 0 : $.getBoundingClientRect();
|
|
844
|
+
(J = e.onOpenMenu) == null || J.call(e, S, {
|
|
845
|
+
x: Math.round((p == null ? void 0 : p.left) ?? 0),
|
|
846
|
+
y: Math.round((p == null ? void 0 : p.bottom) ?? 0)
|
|
847
|
+
});
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
case "typeAhead": {
|
|
851
|
+
const $ = ((ee = e.now) == null ? void 0 : ee.call(e)) ?? Date.now(), p = $ - I > le, B = p ? "" : h(), q = B.length === 1 && B.toLowerCase() === f.char.toLowerCase() ? B : `${B}${f.char}`, te = _t(
|
|
852
|
+
s,
|
|
853
|
+
i,
|
|
854
|
+
q,
|
|
855
|
+
q.length > 1 && !p
|
|
856
|
+
);
|
|
857
|
+
if (I = $, te < 0) {
|
|
858
|
+
k(B), B.length > 0 ? m() : g();
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
k(q), m(), c.preventDefault(), D(te);
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
openMenuAt: (c, s) => {
|
|
867
|
+
var f;
|
|
868
|
+
const i = T(c);
|
|
869
|
+
i && ((f = e.onOpenMenu) == null || f.call(e, i, s));
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
const Gt = 0.4, Ot = { rows: [], height: 0 };
|
|
874
|
+
function me(e) {
|
|
875
|
+
return Math.max(Math.floor(e), 1);
|
|
876
|
+
}
|
|
877
|
+
function Ht(e, t, n) {
|
|
878
|
+
let r = t, o = e.parentIndex(r);
|
|
879
|
+
for (; o !== -1; ) {
|
|
880
|
+
if (o === n) return r;
|
|
881
|
+
r = o, o = e.parentIndex(r);
|
|
882
|
+
}
|
|
883
|
+
return n === -1 ? r : -1;
|
|
884
|
+
}
|
|
885
|
+
function pt(e, t, n, r) {
|
|
886
|
+
let o = e;
|
|
887
|
+
for (let l = 0; l < e.length; l++)
|
|
888
|
+
if (e[l].top + r > n || l >= t) {
|
|
889
|
+
o = e.slice(0, l);
|
|
890
|
+
break;
|
|
891
|
+
}
|
|
892
|
+
const a = o[o.length - 1];
|
|
893
|
+
return a ? { rows: o, height: a.top + r } : { rows: [], height: 0 };
|
|
894
|
+
}
|
|
895
|
+
function Lt(e) {
|
|
896
|
+
const { rows: t, scrollTop: n, rowHeight: r, viewportHeight: o } = e;
|
|
897
|
+
if (t.length === 0 || r <= 0) return Ot;
|
|
898
|
+
const a = me(e.maxCount), l = [];
|
|
899
|
+
let y = 0, w = -1;
|
|
900
|
+
for (; ; ) {
|
|
901
|
+
const v = Math.floor((n + y) / r);
|
|
902
|
+
if (v < 0 || v >= t.length) break;
|
|
903
|
+
const u = Ht(t, v, w);
|
|
904
|
+
if (u === -1) break;
|
|
905
|
+
const h = t.subtreeEnd(u);
|
|
906
|
+
if (h === u || u === v && n === u * r - y) break;
|
|
907
|
+
const k = (h + 1) * r - n, I = y, x = I + r > k && I <= k ? k - r : I;
|
|
908
|
+
if (l.push({ index: u, row: t.at(u), top: x }), y = x + r, w = u, l.length >= a) break;
|
|
909
|
+
}
|
|
910
|
+
return pt(
|
|
911
|
+
l,
|
|
912
|
+
a,
|
|
913
|
+
o * Gt,
|
|
914
|
+
r
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
function Ft(e, t, n, r) {
|
|
918
|
+
if (t < 0 || t >= e.length) return 0;
|
|
919
|
+
const o = me(r);
|
|
920
|
+
let a = 0, l = e.parentIndex(t);
|
|
921
|
+
for (; l !== -1 && (a++, a !== o); )
|
|
922
|
+
l = e.parentIndex(l);
|
|
923
|
+
return a * n;
|
|
924
|
+
}
|
|
925
|
+
function se(e, t, n) {
|
|
926
|
+
if (t <= 0 || e.length === 0 || n <= 0) return null;
|
|
927
|
+
const r = Math.min(e.length - 1, Math.floor(t / n));
|
|
928
|
+
return {
|
|
929
|
+
key: e.at(r).key,
|
|
930
|
+
offset: t - r * n,
|
|
931
|
+
contentTop: t
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
function Pt(e, t, n, r) {
|
|
935
|
+
if (t === null || Math.abs(n - t.contentTop) >= ne)
|
|
936
|
+
return null;
|
|
937
|
+
const o = e.indexOfKey(t.key);
|
|
938
|
+
if (o < 0) return null;
|
|
939
|
+
const a = o * r + t.offset;
|
|
940
|
+
return Math.abs(a - t.contentTop) >= ne ? a : null;
|
|
941
|
+
}
|
|
942
|
+
const Bt = 8, ie = 7, Nt = { rows: [], height: 0 };
|
|
943
|
+
function gn(e) {
|
|
944
|
+
const t = be(Oe), n = O(() => e.rows()), r = Ge({
|
|
945
|
+
count: () => n().length,
|
|
946
|
+
itemHeight: e.rowHeight,
|
|
947
|
+
overscan: e.overscan ?? Bt
|
|
948
|
+
}), o = O(() => e.stickyScroll !== !0 ? Nt : Lt({
|
|
949
|
+
rows: n(),
|
|
950
|
+
scrollTop: r.scrollTop(),
|
|
951
|
+
rowHeight: e.rowHeight,
|
|
952
|
+
viewportHeight: r.viewportHeight(),
|
|
953
|
+
maxCount: e.stickyScrollMaxCount ?? ie
|
|
954
|
+
})), a = (u) => e.stickyScroll === !0 ? Ft(
|
|
955
|
+
n(),
|
|
956
|
+
u,
|
|
957
|
+
e.rowHeight,
|
|
958
|
+
e.stickyScrollMaxCount ?? ie
|
|
959
|
+
) : 0, l = Kt({
|
|
960
|
+
rows: n,
|
|
961
|
+
...e.capabilities ? { capabilities: e.capabilities } : {},
|
|
962
|
+
onToggle: (u) => {
|
|
963
|
+
var h;
|
|
964
|
+
return (h = e.onToggle) == null ? void 0 : h.call(e, u);
|
|
965
|
+
},
|
|
966
|
+
onActivate: (u) => {
|
|
967
|
+
var h;
|
|
968
|
+
return (h = e.onActivate) == null ? void 0 : h.call(e, u, "keyboard");
|
|
969
|
+
},
|
|
970
|
+
onOpenMenu: (u, h) => v(u, h),
|
|
971
|
+
onCollapseAll: () => {
|
|
972
|
+
var u;
|
|
973
|
+
return (u = e.onCollapseAll) == null ? void 0 : u.call(e);
|
|
974
|
+
},
|
|
975
|
+
onFlatNavigate: (u, h) => {
|
|
976
|
+
var k;
|
|
977
|
+
return (k = e.onFlatNavigate) == null ? void 0 : k.call(
|
|
978
|
+
e,
|
|
979
|
+
u,
|
|
980
|
+
h
|
|
981
|
+
);
|
|
982
|
+
},
|
|
983
|
+
onRename: (u) => {
|
|
984
|
+
var h;
|
|
985
|
+
return (h = e.onRename) == null ? void 0 : h.call(e, u);
|
|
986
|
+
},
|
|
987
|
+
onDestroy: (u) => {
|
|
988
|
+
var h;
|
|
989
|
+
return (h = e.onDestroy) == null ? void 0 : h.call(e, u);
|
|
990
|
+
},
|
|
991
|
+
// Arrow keys in a virtualized list are a lie without this: the row the
|
|
992
|
+
// cursor lands on may not be mounted yet.
|
|
993
|
+
//
|
|
994
|
+
// The inset is what keeps them honest once rows are pinned on top: "scroll
|
|
995
|
+
// just enough" would otherwise stop the moment the cursor row reached the
|
|
996
|
+
// viewport's top edge — which is now underneath the widget. Arrowing UP into
|
|
997
|
+
// a parent would walk the cursor into a row nobody can see. Every scroll the
|
|
998
|
+
// controller does — focus, the three selects, select-children, extend —
|
|
999
|
+
// comes through this one call, so this is the only place it has to be said.
|
|
1000
|
+
onScrollToIndex: (u) => r.scrollToIndex(u, "auto", a(u))
|
|
1001
|
+
}), y = () => {
|
|
1002
|
+
const u = l.cursorIndex();
|
|
1003
|
+
return u < 0 ? void 0 : n().at(u);
|
|
1004
|
+
};
|
|
1005
|
+
let w = null;
|
|
1006
|
+
Y(() => {
|
|
1007
|
+
const u = r.scrollTop();
|
|
1008
|
+
w = se(
|
|
1009
|
+
Ie(n),
|
|
1010
|
+
u,
|
|
1011
|
+
e.rowHeight
|
|
1012
|
+
);
|
|
1013
|
+
}), Y(
|
|
1014
|
+
Re(
|
|
1015
|
+
n,
|
|
1016
|
+
(u) => {
|
|
1017
|
+
const h = Pt(
|
|
1018
|
+
u,
|
|
1019
|
+
w,
|
|
1020
|
+
r.readScrollTop(),
|
|
1021
|
+
e.rowHeight
|
|
1022
|
+
);
|
|
1023
|
+
h !== null && r.scrollToContentTop(h), w = se(
|
|
1024
|
+
u,
|
|
1025
|
+
r.readScrollTop(),
|
|
1026
|
+
e.rowHeight
|
|
1027
|
+
);
|
|
1028
|
+
},
|
|
1029
|
+
{ defer: !0 }
|
|
1030
|
+
)
|
|
1031
|
+
);
|
|
1032
|
+
function v(u, h, k) {
|
|
1033
|
+
if (e.openMenu) {
|
|
1034
|
+
e.openMenu(u, h, k);
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (!e.buildMenu) return;
|
|
1038
|
+
const I = e.buildMenu(u, l.selectedKeys());
|
|
1039
|
+
if (I.length !== 0) {
|
|
1040
|
+
if (!t)
|
|
1041
|
+
throw new Z(
|
|
1042
|
+
"createTreeSurface: descriptor builds a context menu but no DesktopContextMenuProvider is mounted"
|
|
1043
|
+
);
|
|
1044
|
+
t.open(h.x, h.y, I, k);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return {
|
|
1048
|
+
descriptor: e,
|
|
1049
|
+
controller: l,
|
|
1050
|
+
scroller: r,
|
|
1051
|
+
source: n,
|
|
1052
|
+
cursorRow: y,
|
|
1053
|
+
stickyState: o,
|
|
1054
|
+
stickyInsetFor: a,
|
|
1055
|
+
openMenu: v
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
const yn = 0.85;
|
|
1059
|
+
function W(e, t) {
|
|
1060
|
+
if (!Number.isInteger(t) || t < 0 || t >= e.length)
|
|
1061
|
+
throw new Z(
|
|
1062
|
+
`tree row source: index ${t} is outside 0..${e.length - 1}`
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
function Vt(e) {
|
|
1066
|
+
const t = e.length, n = new Int32Array(t), r = new Int32Array(t), o = new Int32Array(t), a = new Int32Array(t), l = [], y = [], w = [], v = [];
|
|
1067
|
+
let u = -1, h = -1;
|
|
1068
|
+
for (let k = 0; k < t; k++) {
|
|
1069
|
+
const I = e[k].depth;
|
|
1070
|
+
for (; y.length > 0 && e[y[y.length - 1]].depth >= I; )
|
|
1071
|
+
r[y.pop()] = k - 1, w.pop(), v.pop();
|
|
1072
|
+
const x = y.length - 1;
|
|
1073
|
+
n[k] = x < 0 ? -1 : y[x];
|
|
1074
|
+
const g = x < 0 ? u : w[x];
|
|
1075
|
+
let m = x < 0 ? h : v[x];
|
|
1076
|
+
g !== I && (m = l.length, l.push(0), x < 0 ? (u = I, h = m) : (w[x] = I, v[x] = m)), l[m] = l[m] + 1, a[k] = m, o[k] = l[m], y.push(k), w.push(-1), v.push(-1);
|
|
1077
|
+
}
|
|
1078
|
+
for (const k of y) r[k] = t - 1;
|
|
1079
|
+
return { parent: n, subtreeEnd: r, posInSet: o, group: a, groupSizes: l };
|
|
1080
|
+
}
|
|
1081
|
+
function Ut(e) {
|
|
1082
|
+
const t = /* @__PURE__ */ new Map();
|
|
1083
|
+
for (let n = 0; n < e.length; n++) {
|
|
1084
|
+
const r = e[n].key, o = t.get(r);
|
|
1085
|
+
if (o !== void 0)
|
|
1086
|
+
throw new Z(
|
|
1087
|
+
`tree row source: key "${r}" occurs at rows ${o} and ${n}`
|
|
1088
|
+
);
|
|
1089
|
+
t.set(r, n);
|
|
1090
|
+
}
|
|
1091
|
+
return t;
|
|
1092
|
+
}
|
|
1093
|
+
function wn(e) {
|
|
1094
|
+
const t = e.slice(), n = Vt(t), r = Ut(t), o = {
|
|
1095
|
+
length: t.length,
|
|
1096
|
+
at: (a) => (W(o, a), t[a]),
|
|
1097
|
+
parentIndex: (a) => (W(o, a), n.parent[a]),
|
|
1098
|
+
subtreeEnd: (a) => (W(o, a), n.subtreeEnd[a]),
|
|
1099
|
+
siblingPosition: (a) => (W(o, a), {
|
|
1100
|
+
posInSet: n.posInSet[a],
|
|
1101
|
+
setSize: n.groupSizes[n.group[a]]
|
|
1102
|
+
}),
|
|
1103
|
+
indexOfKey: (a) => r.get(a) ?? -1
|
|
1104
|
+
};
|
|
1105
|
+
return o;
|
|
1106
|
+
}
|
|
1107
|
+
export {
|
|
1108
|
+
ge as D,
|
|
1109
|
+
yn as T,
|
|
1110
|
+
hn as a,
|
|
1111
|
+
we as b,
|
|
1112
|
+
fn as c,
|
|
1113
|
+
W as d,
|
|
1114
|
+
Le as e,
|
|
1115
|
+
Pe as f,
|
|
1116
|
+
Fe as g,
|
|
1117
|
+
Kt as h,
|
|
1118
|
+
gn as i,
|
|
1119
|
+
wn as j,
|
|
1120
|
+
Mt as s,
|
|
1121
|
+
ye as t
|
|
1122
|
+
};
|