@septkit/ui 0.0.89 → 0.0.91
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/dist/dropdown/combobox.vue_vue_type_script_setup_true_lang.js +35 -29
- package/dist/explorer/explorer-search.js +25 -21
- package/dist/explorer/explorer.js +1 -1
- package/dist/explorer/explorer.vue_vue_type_script_setup_true_lang.js +70 -79
- package/dist/index.d.ts +13 -4
- package/dist/index.js +39 -39
- package/dist/library-browser/library-browser.js +1 -1
- package/dist/library-browser/library-browser.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/tree/collect-expandable-node-ids.js +10 -4
- package/dist/tree/expansion.js +24 -0
- package/dist/tree/flatten-tree.js +36 -0
- package/dist/tree/tree-index.js +38 -0
- package/dist/tree/tree.js +1 -1
- package/dist/tree/tree.vue_vue_type_script_setup_true_lang.js +115 -67
- package/dist/tree/use-tree-virtualization.js +54 -0
- package/dist/ui.css +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
//#region lib/tree/collect-expandable-node-ids.ts
|
|
2
|
-
function e(
|
|
3
|
-
let n = [];
|
|
4
|
-
for (
|
|
5
|
-
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = [], n = [...e].reverse();
|
|
4
|
+
for (; n.length;) {
|
|
5
|
+
let e = n.pop();
|
|
6
|
+
if (e.children?.length) {
|
|
7
|
+
t.push(e.id);
|
|
8
|
+
for (let t = e.children.length - 1; t >= 0; t--) n.push(e.children[t]);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
6
12
|
}
|
|
7
13
|
//#endregion
|
|
8
14
|
export { e as collectExpandableNodeIds };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region lib/tree/expansion.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return e.all ? t : e.scoped;
|
|
4
|
+
}
|
|
5
|
+
function t(e, t) {
|
|
6
|
+
return {
|
|
7
|
+
scoped: e.includes(t) ? e.filter((e) => e !== t) : [...e, t],
|
|
8
|
+
all: !1
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function n(e, t) {
|
|
12
|
+
return {
|
|
13
|
+
scoped: [.../* @__PURE__ */ new Set([...e.scoped, ...t])],
|
|
14
|
+
all: !1
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function r(e, t) {
|
|
18
|
+
if (!t.length) return !1;
|
|
19
|
+
if (e.all) return !0;
|
|
20
|
+
let n = new Set(e.scoped);
|
|
21
|
+
return t.every((e) => n.has(e));
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { e as expandedIdsOf, r as isAllExpanded, n as revealIds, t as toggleExpandedId };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region lib/tree/flatten-tree.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = [], r = [{
|
|
4
|
+
nodes: e,
|
|
5
|
+
index: 0,
|
|
6
|
+
depth: 1,
|
|
7
|
+
parentIndex: void 0
|
|
8
|
+
}];
|
|
9
|
+
for (; r.length;) {
|
|
10
|
+
let e = r[r.length - 1];
|
|
11
|
+
if (e.index >= e.nodes.length) {
|
|
12
|
+
r.pop();
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
let i = e.nodes[e.index++], a = n.length, o = !!i.children?.length, s = o && t.has(i.id);
|
|
16
|
+
n.push({
|
|
17
|
+
id: i.id,
|
|
18
|
+
index: a,
|
|
19
|
+
node: i,
|
|
20
|
+
depth: e.depth,
|
|
21
|
+
posInSet: e.index,
|
|
22
|
+
setSize: e.nodes.length,
|
|
23
|
+
parentIndex: e.parentIndex,
|
|
24
|
+
hasChildren: o,
|
|
25
|
+
expanded: s
|
|
26
|
+
}), s && r.push({
|
|
27
|
+
nodes: i.children,
|
|
28
|
+
index: 0,
|
|
29
|
+
depth: e.depth + 1,
|
|
30
|
+
parentIndex: a
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return n;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { e as flattenTree };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region lib/tree/tree-index.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = [], n = /* @__PURE__ */ new Map(), r = [], i = [];
|
|
4
|
+
for (let t = e.length - 1; t >= 0; t--) i.push({
|
|
5
|
+
node: e[t],
|
|
6
|
+
parentId: void 0,
|
|
7
|
+
lowerName: e[t].name.toLowerCase()
|
|
8
|
+
});
|
|
9
|
+
for (; i.length;) {
|
|
10
|
+
let e = i.pop(), { node: a } = e;
|
|
11
|
+
if (t.push(e), n.set(a.id, e), a.children?.length) {
|
|
12
|
+
r.push(a.id);
|
|
13
|
+
for (let e = a.children.length - 1; e >= 0; e--) {
|
|
14
|
+
let t = a.children[e];
|
|
15
|
+
i.push({
|
|
16
|
+
node: t,
|
|
17
|
+
parentId: a.id,
|
|
18
|
+
lowerName: t.name.toLowerCase()
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
items: e,
|
|
25
|
+
nodes: t,
|
|
26
|
+
byId: n,
|
|
27
|
+
expandableIds: r
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function t(e, t) {
|
|
31
|
+
let n = e.byId.get(t);
|
|
32
|
+
if (!n) return;
|
|
33
|
+
let r = [];
|
|
34
|
+
for (; n.parentId !== void 0;) r.push(n.parentId), n = e.byId.get(n.parentId);
|
|
35
|
+
return r.reverse();
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { e as buildTreeIndex, t as findAncestorIds };
|
package/dist/tree/tree.js
CHANGED
|
@@ -2,6 +2,6 @@ import e from "./tree.vue_vue_type_script_setup_true_lang.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
//#region lib/tree/tree.vue
|
|
5
|
-
var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-
|
|
5
|
+
var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-ec248e32"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { n as default };
|
|
@@ -4,9 +4,12 @@ import n from "../external/.pnpm/@lucide_vue@1.23.0_vue@3.5.39_typescript@5.8.3_
|
|
|
4
4
|
import r from "../icons/element-badge.js";
|
|
5
5
|
import "../icons/index.js";
|
|
6
6
|
import { collectExpandableNodeIds as i } from "./collect-expandable-node-ids.js";
|
|
7
|
-
import {
|
|
7
|
+
import { expandedIdsOf as a, toggleExpandedId as o } from "./expansion.js";
|
|
8
|
+
import { flattenTree as s } from "./flatten-tree.js";
|
|
9
|
+
import { useTreeVirtualization as c } from "./use-tree-virtualization.js";
|
|
10
|
+
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, mergeProps as _, normalizeClass as v, normalizeStyle as y, openBlock as b, ref as x, renderList as S, renderSlot as C, toDisplayString as w, unref as T, withCtx as E, withModifiers as D } from "vue";
|
|
8
11
|
//#region lib/tree/tree.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var
|
|
12
|
+
var O = ["onClick", "onContextmenu"], k = { class: "flex flex-1 items-center min-w-0" }, A = { class: "pl-2 truncate" }, j = { class: "shrink-0 ml-auto pl-2" }, M = /*@__PURE__*/ g({
|
|
10
13
|
__name: "tree",
|
|
11
14
|
props: {
|
|
12
15
|
items: {},
|
|
@@ -16,7 +19,8 @@ var C = ["onClick", "onContextmenu"], w = { class: "flex flex-1 items-center min
|
|
|
16
19
|
}) },
|
|
17
20
|
ariaLabel: { default: "SCL Tree" },
|
|
18
21
|
selected: {},
|
|
19
|
-
rowLabel: {}
|
|
22
|
+
rowLabel: {},
|
|
23
|
+
rowHeight: { default: 32 }
|
|
20
24
|
},
|
|
21
25
|
emits: [
|
|
22
26
|
"select",
|
|
@@ -24,82 +28,126 @@ var C = ["onClick", "onContextmenu"], w = { class: "flex flex-1 items-center min
|
|
|
24
28
|
"row-click",
|
|
25
29
|
"update:expanded"
|
|
26
30
|
],
|
|
27
|
-
setup(
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
setup(g, { emit: M }) {
|
|
32
|
+
let N = g, P = M, F = x(), I = u(() => i(N.items)), L = u(() => a(N.expanded, I.value)), R = u(() => s(N.items, new Set(L.value))), z = u(() => N.selected === void 0 ? void 0 : { id: N.selected }), { spacers: B, windowOf: V, focusRow: H } = c({
|
|
33
|
+
root: F,
|
|
34
|
+
rows: R,
|
|
35
|
+
rowHeight: u(() => N.rowHeight),
|
|
36
|
+
selected: () => N.selected
|
|
37
|
+
});
|
|
38
|
+
function U(e) {
|
|
39
|
+
P("update:expanded", o(L.value, e.id));
|
|
35
40
|
}
|
|
36
|
-
|
|
41
|
+
function W(e) {
|
|
42
|
+
R.value[e.index + 1]?.depth === e.depth + 1 && H(e.index + 1);
|
|
43
|
+
}
|
|
44
|
+
function G(e, t) {
|
|
45
|
+
if (e.key === "ArrowRight") {
|
|
46
|
+
if (!t.hasChildren) return;
|
|
47
|
+
t.expanded ? W(t) : U(t);
|
|
48
|
+
} else if (e.key === "ArrowLeft") if (t.hasChildren && t.expanded) U(t);
|
|
49
|
+
else if (t.parentIndex !== void 0) H(t.parentIndex);
|
|
50
|
+
else return;
|
|
51
|
+
else return;
|
|
52
|
+
e.stopImmediatePropagation();
|
|
53
|
+
}
|
|
54
|
+
return (i, a) => (b(), d(T(e), {
|
|
55
|
+
ref_key: "root",
|
|
56
|
+
ref: F,
|
|
37
57
|
class: "explorer-tree list-none select-none w-full text-stone-700 text-sm font-medium",
|
|
38
|
-
items:
|
|
58
|
+
items: R.value,
|
|
39
59
|
"get-key": (e) => e.id,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
scoped: e,
|
|
45
|
-
all: !1
|
|
46
|
-
})
|
|
60
|
+
"get-children": (e) => e.hasChildren ? [] : void 0,
|
|
61
|
+
expanded: [],
|
|
62
|
+
"model-value": z.value,
|
|
63
|
+
"aria-label": N.ariaLabel
|
|
47
64
|
}, {
|
|
48
|
-
default:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
e.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
default: E(({ flattenItems: e }) => [
|
|
66
|
+
T(B).before > 0 ? (b(), p("li", {
|
|
67
|
+
key: 0,
|
|
68
|
+
role: "presentation",
|
|
69
|
+
style: y({ height: `${T(B).before}px` })
|
|
70
|
+
}, null, 4)) : f("", !0),
|
|
71
|
+
(b(!0), p(l, null, S(T(V)(e), (e) => (b(), d(T(t), _({
|
|
72
|
+
key: e.value.id,
|
|
73
|
+
"data-index": e.value.index
|
|
74
|
+
}, { ref_for: !0 }, e.bind, {
|
|
75
|
+
level: e.value.depth,
|
|
76
|
+
"aria-setsize": e.value.setSize,
|
|
77
|
+
"aria-posinset": e.value.posInSet,
|
|
78
|
+
"aria-expanded": e.value.hasChildren ? e.value.expanded : void 0,
|
|
79
|
+
"aria-label": N.rowLabel?.(e.value.node),
|
|
80
|
+
class: ["explorer-tree__item flex items-center px-2 rounded outline-none", e.value.node.selectable === !1 ? "" : "explorer-tree__item--selectable"],
|
|
81
|
+
style: {
|
|
82
|
+
height: `${N.rowHeight}px`,
|
|
83
|
+
boxSizing: "border-box"
|
|
84
|
+
},
|
|
85
|
+
onKeydownCapture: (t) => G(t, e.value),
|
|
86
|
+
onSelect: (t) => {
|
|
87
|
+
t.detail.originalEvent.type === "click" || e.value.node.selectable === !1 ? t.preventDefault() : P("select", e.value.node);
|
|
63
88
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
onToggle: a[0] ||= (e) => {
|
|
90
|
+
e.detail.originalEvent.type === "click" && e.preventDefault();
|
|
91
|
+
}
|
|
92
|
+
}), {
|
|
93
|
+
default: E(({ handleSelect: t }) => [m("div", {
|
|
94
|
+
class: v(["flex w-full items-center", e.value.node.selectable === !1 ? "cursor-default" : "cursor-pointer"]),
|
|
95
|
+
style: y({ "padding-left": e.value.depth === 1 ? "0rem" : `${e.value.depth - 1.5}rem` }),
|
|
96
|
+
onClick: () => {
|
|
97
|
+
e.value.node.selectable !== !1 && (t(), P("select", e.value.node)), P("row-click", e.value.node);
|
|
98
|
+
},
|
|
99
|
+
onContextmenu: D((t) => P("contextmenu", {
|
|
100
|
+
node: e.value.node,
|
|
101
|
+
event: t
|
|
102
|
+
}), ["prevent"])
|
|
103
|
+
}, [
|
|
104
|
+
C(i.$slots, "node-toggle", {
|
|
105
|
+
node: e.value.node,
|
|
106
|
+
hasChildren: e.value.hasChildren,
|
|
107
|
+
expanded: e.value.expanded
|
|
108
|
+
}, () => [h(T(n), {
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
class: "shrink-0 invisible",
|
|
111
|
+
size: 16
|
|
112
|
+
})], !0),
|
|
113
|
+
m("div", k, [
|
|
114
|
+
C(i.$slots, "node-prefix", { node: e.value.node }, void 0, !0),
|
|
115
|
+
e.value.node.tag ? (b(), d(T(r), {
|
|
116
|
+
key: 0,
|
|
117
|
+
"tag-name": e.value.node.tag
|
|
118
|
+
}, null, 8, ["tag-name"])) : f("", !0),
|
|
119
|
+
C(i.$slots, "node-label", { node: e.value.node }, () => [m("span", A, w(e.value.node.name), 1)], !0)
|
|
120
|
+
]),
|
|
121
|
+
m("div", j, [C(i.$slots, "node-suffix", { node: e.value.node }, void 0, !0)])
|
|
122
|
+
], 46, O)]),
|
|
123
|
+
_: 2
|
|
124
|
+
}, 1040, [
|
|
125
|
+
"data-index",
|
|
126
|
+
"level",
|
|
127
|
+
"aria-setsize",
|
|
128
|
+
"aria-posinset",
|
|
129
|
+
"aria-expanded",
|
|
130
|
+
"aria-label",
|
|
131
|
+
"class",
|
|
132
|
+
"style",
|
|
133
|
+
"onKeydownCapture",
|
|
134
|
+
"onSelect"
|
|
135
|
+
]))), 128)),
|
|
136
|
+
T(B).after > 0 ? (b(), p("li", {
|
|
137
|
+
key: 1,
|
|
138
|
+
role: "presentation",
|
|
139
|
+
style: y({ height: `${T(B).after}px` })
|
|
140
|
+
}, null, 4)) : f("", !0)
|
|
141
|
+
]),
|
|
94
142
|
_: 3
|
|
95
143
|
}, 8, [
|
|
96
144
|
"items",
|
|
97
145
|
"get-key",
|
|
98
|
-
"
|
|
146
|
+
"get-children",
|
|
99
147
|
"model-value",
|
|
100
148
|
"aria-label"
|
|
101
149
|
]));
|
|
102
150
|
}
|
|
103
151
|
});
|
|
104
152
|
//#endregion
|
|
105
|
-
export {
|
|
153
|
+
export { M as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useVirtualScroller as e } from "../virtual/use-virtual-scroller.js";
|
|
2
|
+
import "../virtual/index.js";
|
|
3
|
+
import { computed as t, nextTick as n, onMounted as r, ref as i, watch as a } from "vue";
|
|
4
|
+
//#region lib/tree/use-tree-virtualization.ts
|
|
5
|
+
var o = 10, s = 800;
|
|
6
|
+
function c(e) {
|
|
7
|
+
for (let t = e?.parentElement; t; t = t.parentElement) if (/auto|scroll|overlay/.test(getComputedStyle(t).overflowY)) return t;
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
function l({ root: l, rows: u, rowHeight: d, selected: f }) {
|
|
11
|
+
let p = i(null), m = i(0), h = f() !== void 0, g = t(() => {
|
|
12
|
+
let e = f();
|
|
13
|
+
return e === void 0 ? -1 : u.value.findIndex((t) => t.id === e);
|
|
14
|
+
}), _ = e({
|
|
15
|
+
scrollElement: p,
|
|
16
|
+
rows: {
|
|
17
|
+
count: () => u.value.length,
|
|
18
|
+
size: d,
|
|
19
|
+
overscan: o,
|
|
20
|
+
paddingStart: () => m.value,
|
|
21
|
+
getKey: (e) => u.value[e]?.id ?? e,
|
|
22
|
+
keep: () => g.value >= 0 ? [g.value] : []
|
|
23
|
+
},
|
|
24
|
+
initialRect: {
|
|
25
|
+
width: 0,
|
|
26
|
+
height: s
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
r(() => {
|
|
30
|
+
p.value = c(l.value?.$el ?? null), v(), n(y);
|
|
31
|
+
}), a(u, () => n(v)), a(f, () => {
|
|
32
|
+
h = !0, n(y);
|
|
33
|
+
}), a(g, () => void n(y));
|
|
34
|
+
function v() {
|
|
35
|
+
let e = l.value?.$el, t = p.value;
|
|
36
|
+
!e || !t || (m.value = e.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop);
|
|
37
|
+
}
|
|
38
|
+
function y() {
|
|
39
|
+
!h || g.value < 0 || (h = !1, _.scrollToIndex({ index: g.value }));
|
|
40
|
+
}
|
|
41
|
+
function b(e) {
|
|
42
|
+
return _.rows.value.flatMap((t) => e[t.index] ?? []);
|
|
43
|
+
}
|
|
44
|
+
async function x(e) {
|
|
45
|
+
_.scrollToIndex({ index: e }), await n(), l.value?.$el.querySelector(`[data-index="${e}"]`)?.focus();
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
spacers: _.spacers,
|
|
49
|
+
windowOf: b,
|
|
50
|
+
focusRow: x
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { l as useTreeVirtualization };
|