vlite3 1.5.25 → 1.5.28
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/components/Accordion/Accordion.vue.d.ts +8 -1
- package/components/Accordion/AccordionContent.vue.d.ts +8 -2
- package/components/Accordion/AccordionContent.vue.js +2 -2
- package/components/Accordion/AccordionContent2.vue.js +28 -40
- package/components/Accordion/AccordionItem.vue.d.ts +8 -1
- package/components/Accordion/AccordionItem.vue.js +86 -70
- package/components/Accordion/AccordionTrigger.vue.js +13 -12
- package/components/Badge.vue.d.ts +1 -1
- package/components/Beacon.vue.d.ts +1 -1
- package/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/components/Breadcrumb/BreadcrumbItem.vue.d.ts +1 -1
- package/components/Button.vue.d.ts +1 -1
- package/components/Button.vue.js +2 -2
- package/components/Button2.vue.js +1 -1
- package/components/Carousel/Carousel.vue.d.ts +4 -4
- package/components/CategoryManager/CategoryManager2.vue.js +1 -1
- package/components/Chart/CircleChart.vue.d.ts +1 -1
- package/components/Chart/GaugeChart.vue.d.ts +1 -1
- package/components/Chart/SpeedometerChart.vue.d.ts +1 -1
- package/components/Chip/Chip.vue.d.ts +1 -1
- package/components/ChoiceBox/ChoiceBox.vue.d.ts +1 -1
- package/components/Clipboard.vue.d.ts +1 -1
- package/components/ColorPicker/ColorPicker.vue.d.ts +1 -1
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/DataList/DataList.vue.d.ts +1 -1
- package/components/DataTable/DataTable.vue.d.ts +1 -1
- package/components/DataTable/DataTable.vue.js +2 -2
- package/components/DataTable/DataTable2.vue.js +48 -50
- package/components/EditableTitle/EditableTitle.vue.d.ts +11 -11
- package/components/Empty/Empty.vue.d.ts +11 -2
- package/components/Empty/Empty.vue.js +57 -49
- package/components/Empty/index.d.ts +1 -1
- package/components/Empty/types.d.ts +13 -0
- package/components/Empty/types.js +8 -0
- package/components/Empty/variants/Variant1.vue.d.ts +4 -6
- package/components/Empty/variants/Variant1.vue.js +56 -20
- package/components/Empty/variants/Variant10.vue.d.ts +4 -6
- package/components/Empty/variants/Variant10.vue.js +68 -26
- package/components/Empty/variants/Variant11.vue.d.ts +4 -6
- package/components/Empty/variants/Variant11.vue.js +66 -18
- package/components/Empty/variants/Variant12.vue.d.ts +4 -6
- package/components/Empty/variants/Variant12.vue.js +67 -25
- package/components/Empty/variants/Variant2.vue.d.ts +4 -6
- package/components/Empty/variants/Variant2.vue.js +56 -20
- package/components/Empty/variants/Variant3.vue.d.ts +4 -6
- package/components/Empty/variants/Variant3.vue.js +41 -13
- package/components/Empty/variants/Variant4.vue.d.ts +4 -6
- package/components/Empty/variants/Variant4.vue.js +65 -21
- package/components/Empty/variants/Variant5.vue.d.ts +4 -6
- package/components/Empty/variants/Variant5.vue.js +55 -17
- package/components/Empty/variants/Variant6.vue.d.ts +4 -6
- package/components/Empty/variants/Variant6.vue.js +67 -23
- package/components/Empty/variants/Variant7.vue.d.ts +4 -6
- package/components/Empty/variants/Variant7.vue.js +81 -25
- package/components/Empty/variants/Variant8.vue.d.ts +4 -6
- package/components/Empty/variants/Variant8.vue.js +59 -23
- package/components/Empty/variants/Variant9.vue.d.ts +4 -6
- package/components/Empty/variants/Variant9.vue.js +64 -20
- package/components/FilePicker/index.vue.d.ts +1 -1
- package/components/FileTree/FileTree.vue.d.ts +2 -0
- package/components/FileTree/FileTree.vue.js +4 -4
- package/components/FileTree/FileTree2.vue.js +72 -66
- package/components/FileTree/FileTreeNode.vue.d.ts +9 -0
- package/components/FileTree/FileTreeNode.vue.js +100 -92
- package/components/FileTree/types.d.ts +12 -0
- package/components/Form/{AccordionView.vue.js → AccordionView2.vue.js} +1 -1
- package/components/Form/Form.vue.d.ts +1 -1
- package/components/Form/FormField.vue.d.ts +1 -1
- package/components/Form/FormFields.vue.d.ts +1 -1
- package/components/Form/TableView.vue.d.ts +1 -1
- package/components/Form/index.vue.d.ts +1 -1
- package/components/Form/index2.vue.js +1 -1
- package/components/GoogleLogin.vue.d.ts +1 -1
- package/components/Input.vue.d.ts +1 -1
- package/components/Input.vue.js +2 -4
- package/components/MultiSelect/MultiSelect.vue.d.ts +1 -1
- package/components/Navbar/NavbarTabs.vue.d.ts +1 -1
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/NumberInput.vue.d.ts +1 -1
- package/components/OTPInput/OTPInput.vue.d.ts +1 -1
- package/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Screen/components/ScreenEmptyState.vue.js +12 -12
- package/components/Slider.vue.d.ts +1 -1
- package/components/Spinner/Spinner.vue.d.ts +1 -1
- package/components/Splitter/Splitter.vue.d.ts +9 -16
- package/components/Splitter/Splitter.vue.js +72 -41
- package/components/Switch.vue.d.ts +1 -1
- package/components/Tabes/Tabes.vue.d.ts +1 -1
- package/components/TagInput/TagInput.vue.d.ts +6 -6
- package/components/Tooltip.vue.d.ts +1 -1
- package/core/config.d.ts +2 -2
- package/docs/components/accordion.md +35 -0
- package/docs/components/empty.md +38 -4
- package/docs/components/file-tree.md +67 -16
- package/docs-manifest.json +5 -5
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as $, shallowRef as x, watch as F, computed as p, openBlock as m, createElementBlock as w, normalizeClass as q, Fragment as I, renderList as O, withMemo as N, normalizeStyle as z, createBlock as G, createSlots as U, withCtx as Y, renderSlot as j, mergeProps as H, toDisplayString as J } from "vue";
|
|
2
2
|
import W from "./FileTreeNode.vue.js";
|
|
3
|
-
import { appendAncestorLastFlag as
|
|
3
|
+
import { appendAncestorLastFlag as B, EMPTY_ANCESTOR_LAST_FLAGS as X } from "../TreeConnectors/geometry.js";
|
|
4
4
|
import { $t as k } from "../../utils/i18n.js";
|
|
5
5
|
const Z = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "text-sm text-muted-foreground p-4 text-center"
|
|
8
|
-
}, ne = /* @__PURE__ */
|
|
8
|
+
}, ne = /* @__PURE__ */ $({
|
|
9
9
|
__name: "FileTree",
|
|
10
10
|
props: {
|
|
11
11
|
modelValue: { default: () => [] },
|
|
@@ -20,16 +20,18 @@ const Z = {
|
|
|
20
20
|
emptyText: {},
|
|
21
21
|
emptyTextI18n: {},
|
|
22
22
|
variant: { default: "default" },
|
|
23
|
-
maxLabelLength: { default: 35 }
|
|
23
|
+
maxLabelLength: { default: 35 },
|
|
24
|
+
showTreeLines: { type: Boolean, default: !0 },
|
|
25
|
+
selectOnRowClick: { type: Boolean, default: !0 }
|
|
24
26
|
},
|
|
25
27
|
emits: ["update:modelValue", "select", "expand", "node-click"],
|
|
26
|
-
setup(
|
|
27
|
-
const s =
|
|
28
|
+
setup(r, { emit: D }) {
|
|
29
|
+
const s = r, g = D, h = x(new Set(s.defaultExpandedKeys)), f = x(/* @__PURE__ */ new Set()), v = x(/* @__PURE__ */ new Map()), b = x(/* @__PURE__ */ new Map()), K = (t) => !!(t.isFolder || t.children && t.children.length > 0), E = (t) => {
|
|
28
30
|
const l = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), a = (n, d) => {
|
|
29
31
|
for (const i of n)
|
|
30
32
|
l.set(i.id, i), d && e.set(i.id, d), i.children && a(i.children, i.id);
|
|
31
33
|
};
|
|
32
|
-
a(t),
|
|
34
|
+
a(t), v.value = l, b.value = e;
|
|
33
35
|
};
|
|
34
36
|
F(
|
|
35
37
|
() => s.data,
|
|
@@ -47,31 +49,31 @@ const Z = {
|
|
|
47
49
|
e.push(a.children[n]);
|
|
48
50
|
}
|
|
49
51
|
return l;
|
|
50
|
-
},
|
|
52
|
+
}, y = p(() => new Set(s.modelValue)), T = p(() => {
|
|
51
53
|
const t = /* @__PURE__ */ new Set();
|
|
52
54
|
if (s.selectionMode !== "multiple") return t;
|
|
53
55
|
const l = (e) => {
|
|
54
56
|
if (!e.children || e.children.length === 0)
|
|
55
|
-
return
|
|
57
|
+
return y.value.has(e.id) ? "checked" : "unchecked";
|
|
56
58
|
let a = !1, n = !1, d = !1;
|
|
57
59
|
for (const i of e.children) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
+
const c = l(i);
|
|
61
|
+
c === "checked" ? a = !0 : c === "unchecked" ? n = !0 : d = !0;
|
|
60
62
|
}
|
|
61
63
|
return d || a && n ? (t.add(e.id), "indeterminate") : a ? "checked" : "unchecked";
|
|
62
64
|
};
|
|
63
65
|
return s.data.forEach(l), t;
|
|
64
|
-
}),
|
|
66
|
+
}), P = async (t) => {
|
|
65
67
|
if (t.disabled) return;
|
|
66
68
|
if (h.value.has(t.id)) {
|
|
67
69
|
const a = new Set(h.value);
|
|
68
70
|
a.delete(t.id);
|
|
69
|
-
const n =
|
|
70
|
-
M(n).forEach((d) => a.delete(d)), h.value = a,
|
|
71
|
+
const n = v.value.get(t.id) || t;
|
|
72
|
+
M(n).forEach((d) => a.delete(d)), h.value = a, g("expand", t, !1);
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
const e = new Set(h.value);
|
|
74
|
-
if (e.add(t.id), h.value = e,
|
|
76
|
+
if (e.add(t.id), h.value = e, g("expand", t, !0), s.loadData && !t.isLoaded && (!t.children || t.children.length === 0)) {
|
|
75
77
|
const a = new Set(f.value);
|
|
76
78
|
a.add(t.id), f.value = a;
|
|
77
79
|
try {
|
|
@@ -81,52 +83,52 @@ const Z = {
|
|
|
81
83
|
n.delete(t.id), f.value = n;
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
|
-
},
|
|
86
|
+
}, A = (t) => {
|
|
85
87
|
if (t.disabled) return;
|
|
86
|
-
const l =
|
|
88
|
+
const l = v.value.get(t.id) || t, e = new Set(y.value), a = e.has(t.id);
|
|
87
89
|
if (s.selectionMode === "single")
|
|
88
90
|
e.clear(), a || e.add(t.id);
|
|
89
91
|
else if (s.selectionMode === "multiple") {
|
|
90
|
-
const n = M(l), d = !a, i = (
|
|
91
|
-
u ? e.add(
|
|
92
|
+
const n = M(l), d = !a, i = (o, u) => {
|
|
93
|
+
u ? e.add(o) : e.delete(o);
|
|
92
94
|
};
|
|
93
|
-
i(t.id, d), n.forEach((
|
|
94
|
-
let
|
|
95
|
+
i(t.id, d), n.forEach((o) => i(o, d));
|
|
96
|
+
let c = l;
|
|
95
97
|
for (; ; ) {
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
98
|
-
const u =
|
|
98
|
+
const o = b.value.get(c.id);
|
|
99
|
+
if (!o) break;
|
|
100
|
+
const u = v.value.get(o);
|
|
99
101
|
if (!u?.children) break;
|
|
100
|
-
u.children.every((
|
|
102
|
+
u.children.every((L) => e.has(L.id)) ? e.add(u.id) : e.delete(u.id), c = u;
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
|
-
|
|
104
|
-
}, Q =
|
|
105
|
+
g("update:modelValue", Array.from(e)), g("select", l, !a);
|
|
106
|
+
}, Q = p(() => {
|
|
105
107
|
if (!s.searchQuery) return s.data;
|
|
106
108
|
const t = s.searchQuery.toLowerCase(), l = (e) => {
|
|
107
109
|
const n = (e.labelI18n ? k(e.labelI18n) : e.label).toLowerCase().includes(t), d = !!e.searchMatch;
|
|
108
110
|
let i = [];
|
|
109
|
-
return e.children && (i = e.children.map(l).filter((
|
|
111
|
+
return e.children && (i = e.children.map(l).filter((c) => c !== null)), n || d || i.length > 0 ? { ...e, children: i } : null;
|
|
110
112
|
};
|
|
111
113
|
return s.data.map(l).filter((e) => e !== null);
|
|
112
|
-
}), C =
|
|
114
|
+
}), C = p(() => {
|
|
113
115
|
const t = [], l = (e, a, n) => {
|
|
114
116
|
const d = e.length - 1;
|
|
115
117
|
for (let i = 0; i < e.length; i++) {
|
|
116
|
-
const
|
|
118
|
+
const c = e[i], o = i === d, u = K(c), L = h.value.has(c.id), V = f.value.has(c.id);
|
|
117
119
|
if (t.push({
|
|
118
|
-
node:
|
|
120
|
+
node: c,
|
|
119
121
|
depth: a,
|
|
120
|
-
isLast:
|
|
122
|
+
isLast: o,
|
|
121
123
|
ancestorLastFlags: n,
|
|
122
124
|
isFolder: u
|
|
123
|
-
}),
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
node:
|
|
125
|
+
}), L && u && !V) {
|
|
126
|
+
const S = c.children;
|
|
127
|
+
S && S.length > 0 ? l(S, a + 1, B(n, o)) : t.push({
|
|
128
|
+
node: c,
|
|
127
129
|
depth: a + 1,
|
|
128
130
|
isLast: !0,
|
|
129
|
-
ancestorLastFlags:
|
|
131
|
+
ancestorLastFlags: B(n, o),
|
|
130
132
|
isFolder: !1,
|
|
131
133
|
showEmptyPlaceholder: !0
|
|
132
134
|
});
|
|
@@ -142,10 +144,10 @@ const Z = {
|
|
|
142
144
|
const l = t.toLowerCase(), e = /* @__PURE__ */ new Set(), a = (n) => {
|
|
143
145
|
let d = !1;
|
|
144
146
|
if (n.children)
|
|
145
|
-
for (const
|
|
146
|
-
a(
|
|
147
|
-
const
|
|
148
|
-
return d && e.add(n.id),
|
|
147
|
+
for (const o of n.children)
|
|
148
|
+
a(o) && (d = !0);
|
|
149
|
+
const c = (n.labelI18n ? k(n.labelI18n) : n.label).toLowerCase().includes(l) || !!n.searchMatch;
|
|
150
|
+
return d && e.add(n.id), c || d;
|
|
149
151
|
};
|
|
150
152
|
if (s.data.forEach(a), e.size > 0) {
|
|
151
153
|
const n = new Set(h.value);
|
|
@@ -153,56 +155,60 @@ const Z = {
|
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
);
|
|
156
|
-
const
|
|
158
|
+
const R = p(() => {
|
|
157
159
|
if (s.emptyTextI18n) return k(s.emptyTextI18n);
|
|
158
160
|
if (s.emptyText) return s.emptyText;
|
|
159
161
|
const t = k("vlite.fileTree.emptyText");
|
|
160
162
|
return t !== "vlite.fileTree.emptyText" ? t : "No results found.";
|
|
161
163
|
});
|
|
162
|
-
return (t, l) => (m(),
|
|
163
|
-
class:
|
|
164
|
+
return (t, l) => (m(), w("div", {
|
|
165
|
+
class: q(["w-full h-full overflow-y-auto file-tree-container", s.class])
|
|
164
166
|
}, [
|
|
165
|
-
C.value.length > 0 ? (m(!0),
|
|
167
|
+
C.value.length > 0 ? (m(!0), w(I, { key: 0 }, O(C.value, (e) => (m(), w(I, {
|
|
166
168
|
key: e.showEmptyPlaceholder ? e.node.id + "-empty" : e.node.id
|
|
167
169
|
}, [
|
|
168
|
-
e.showEmptyPlaceholder ? N([e.depth, e.node.id], () => (m(),
|
|
170
|
+
e.showEmptyPlaceholder ? N([e.depth, e.node.id], () => (m(), w("div", {
|
|
169
171
|
key: 0,
|
|
170
172
|
class: "py-0.5 text-xs text-muted-foreground italic",
|
|
171
|
-
style:
|
|
173
|
+
style: z({ paddingInlineStart: e.depth * 20 + 26 + "px" })
|
|
172
174
|
}, null, 4)), l, 0) : N([
|
|
173
175
|
e.node,
|
|
174
|
-
|
|
176
|
+
y.value.has(e.node.id),
|
|
175
177
|
T.value.has(e.node.id),
|
|
176
178
|
h.value.has(e.node.id),
|
|
177
179
|
f.value.has(e.node.id),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
r.highlightSearch,
|
|
181
|
+
r.searchQuery,
|
|
182
|
+
r.showCheckboxes,
|
|
183
|
+
r.variant,
|
|
184
|
+
r.maxLabelLength,
|
|
185
|
+
r.showTreeLines,
|
|
186
|
+
r.selectOnRowClick,
|
|
183
187
|
e.depth,
|
|
184
188
|
e.isLast,
|
|
185
189
|
e.ancestorLastFlags,
|
|
186
190
|
!!t.$slots.actions
|
|
187
|
-
], () => (m(),
|
|
191
|
+
], () => (m(), G(W, {
|
|
188
192
|
key: 1,
|
|
189
193
|
node: e.node,
|
|
190
194
|
depth: e.depth,
|
|
191
195
|
"is-last": e.isLast,
|
|
192
196
|
"ancestor-last-flags": e.ancestorLastFlags,
|
|
193
|
-
"selection-mode":
|
|
194
|
-
"is-selected":
|
|
197
|
+
"selection-mode": r.selectionMode,
|
|
198
|
+
"is-selected": y.value.has(e.node.id),
|
|
195
199
|
"is-indeterminate": T.value.has(e.node.id),
|
|
196
200
|
"is-expanded": h.value.has(e.node.id),
|
|
197
201
|
"is-loading": f.value.has(e.node.id),
|
|
198
|
-
"show-checkboxes":
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
"show-checkboxes": r.showCheckboxes,
|
|
203
|
+
"show-tree-lines": r.showTreeLines,
|
|
204
|
+
"select-on-row-click": r.selectOnRowClick,
|
|
205
|
+
"highlight-search": r.highlightSearch,
|
|
206
|
+
"search-query": r.searchQuery,
|
|
207
|
+
variant: r.variant,
|
|
208
|
+
"max-label-length": r.maxLabelLength,
|
|
209
|
+
onToggleExpand: P,
|
|
210
|
+
onToggleSelect: A,
|
|
211
|
+
onClickNode: l[1] || (l[1] = (a) => g("node-click", a))
|
|
206
212
|
}, U({ _: 2 }, [
|
|
207
213
|
t.$slots.actions ? {
|
|
208
214
|
name: "actions",
|
|
@@ -211,8 +217,8 @@ const Z = {
|
|
|
211
217
|
]),
|
|
212
218
|
key: "0"
|
|
213
219
|
} : void 0
|
|
214
|
-
]), 1032, ["node", "depth", "is-last", "ancestor-last-flags", "selection-mode", "is-selected", "is-indeterminate", "is-expanded", "is-loading", "show-checkboxes", "highlight-search", "search-query", "variant", "max-label-length"])), l, 2)
|
|
215
|
-
], 64))), 128)) : (m(),
|
|
220
|
+
]), 1032, ["node", "depth", "is-last", "ancestor-last-flags", "selection-mode", "is-selected", "is-indeterminate", "is-expanded", "is-loading", "show-checkboxes", "show-tree-lines", "select-on-row-click", "highlight-search", "search-query", "variant", "max-label-length"])), l, 2)
|
|
221
|
+
], 64))), 128)) : (m(), w("div", Z, J(R.value), 1))
|
|
216
222
|
], 2));
|
|
217
223
|
}
|
|
218
224
|
});
|
|
@@ -17,6 +17,13 @@ interface Props {
|
|
|
17
17
|
isLast?: boolean;
|
|
18
18
|
/** `isLast` of every ancestor, ordered root → immediate parent. */
|
|
19
19
|
ancestorLastFlags?: boolean[];
|
|
20
|
+
/** Whether to render tree connector (indent guide) lines. */
|
|
21
|
+
showTreeLines?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* When `false`, parent/folder row clicks only expand/collapse.
|
|
24
|
+
* Leaf/file rows remain selectable via the row. Checkboxes always select.
|
|
25
|
+
*/
|
|
26
|
+
selectOnRowClick?: boolean;
|
|
20
27
|
}
|
|
21
28
|
declare function __VLS_template(): {
|
|
22
29
|
attrs: Partial<{}>;
|
|
@@ -50,6 +57,8 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
50
57
|
showCheckboxes: boolean;
|
|
51
58
|
highlightSearch: boolean;
|
|
52
59
|
maxLabelLength: number;
|
|
60
|
+
showTreeLines: boolean;
|
|
61
|
+
selectOnRowClick: boolean;
|
|
53
62
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
54
63
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
55
64
|
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { EMPTY_ANCESTOR_LAST_FLAGS as
|
|
6
|
-
import { $t as
|
|
7
|
-
import { useRtl as
|
|
8
|
-
const
|
|
9
|
-
key:
|
|
1
|
+
import { defineComponent as R, computed as d, openBlock as s, createElementBlock as i, createElementVNode as c, normalizeClass as m, normalizeStyle as v, createCommentVNode as r, createBlock as h, unref as A, withModifiers as x, createVNode as w, Fragment as C, renderList as L, toDisplayString as y, renderSlot as D } from "vue";
|
|
2
|
+
import u from "../Icon.vue.js";
|
|
3
|
+
import G from "../CheckBox.vue.js";
|
|
4
|
+
import H from "../TreeConnectors/TreeConnectors.vue.js";
|
|
5
|
+
import { EMPTY_ANCESTOR_LAST_FLAGS as Q } from "../TreeConnectors/geometry.js";
|
|
6
|
+
import { $t as V } from "../../utils/i18n.js";
|
|
7
|
+
import { useRtl as K } from "../../composables/useRtl.js";
|
|
8
|
+
const W = { class: "flex flex-col select-none" }, X = ["title"], j = ["aria-expanded"], q = {
|
|
9
|
+
key: 2,
|
|
10
10
|
class: "relative z-20 w-6 me-1 shrink-0"
|
|
11
|
-
},
|
|
11
|
+
}, U = { class: "relative z-20 me-2 text-muted-foreground shrink-0" }, Y = { class: "relative z-20 flex-1 truncate text-sm font-medium min-w-0" }, Z = { class: "me-2 text-gray-400 select-none shrink-0" }, J = { class: "truncate" }, b = 20, _ = 28, ee = 16, te = 11, ce = /* @__PURE__ */ R({
|
|
12
12
|
name: "FileTreeNode",
|
|
13
13
|
__name: "FileTreeNode",
|
|
14
14
|
props: {
|
|
@@ -25,164 +25,172 @@ const G = { class: "flex flex-col select-none" }, U = ["title"], Y = ["aria-expa
|
|
|
25
25
|
variant: { default: "default" },
|
|
26
26
|
maxLabelLength: { default: 35 },
|
|
27
27
|
isLast: { type: Boolean, default: !0 },
|
|
28
|
-
ancestorLastFlags: { default: () =>
|
|
28
|
+
ancestorLastFlags: { default: () => Q },
|
|
29
|
+
showTreeLines: { type: Boolean, default: !0 },
|
|
30
|
+
selectOnRowClick: { type: Boolean, default: !0 }
|
|
29
31
|
},
|
|
30
32
|
emits: ["toggle-expand", "toggle-select", "click-node"],
|
|
31
|
-
setup(e, { emit:
|
|
32
|
-
const E =
|
|
33
|
-
() => !!(
|
|
34
|
-
), I = d(() => `${
|
|
35
|
-
|
|
33
|
+
setup(e, { emit: S }) {
|
|
34
|
+
const E = K(), l = e, g = S, f = d(
|
|
35
|
+
() => !!(l.node.isFolder || l.node.children && l.node.children.length > 0)
|
|
36
|
+
), I = d(() => `${l.depth * b}px`), B = d(() => {
|
|
37
|
+
const t = l.showCheckboxes && l.selectionMode !== "none" ? ee + te : 0;
|
|
38
|
+
return `${l.depth * b + _ + t}px`;
|
|
39
|
+
}), k = d(
|
|
40
|
+
() => l.node.labelI18n ? V(l.node.labelI18n) : l.node.label
|
|
36
41
|
), M = d(() => {
|
|
37
|
-
const t =
|
|
38
|
-
if (t.length <=
|
|
42
|
+
const t = k.value, o = l.maxLabelLength;
|
|
43
|
+
if (t.length <= o) return t;
|
|
39
44
|
const n = t.lastIndexOf(".");
|
|
40
45
|
if (n === -1 || t.length - n > 10)
|
|
41
|
-
return t.substring(0,
|
|
42
|
-
const
|
|
43
|
-
return $.substring(0, P) + "..." +
|
|
44
|
-
}),
|
|
46
|
+
return t.substring(0, o) + "...";
|
|
47
|
+
const a = t.substring(n), $ = t.substring(0, n), P = Math.max(0, o - a.length - 3);
|
|
48
|
+
return $.substring(0, P) + "..." + a;
|
|
49
|
+
}), T = d(() => {
|
|
45
50
|
const t = M.value;
|
|
46
|
-
if (!
|
|
51
|
+
if (!l.highlightSearch || !l.searchQuery)
|
|
47
52
|
return [{ text: t, highlight: !1 }];
|
|
48
|
-
const
|
|
53
|
+
const o = l.searchQuery.toLowerCase(), n = t.toLowerCase().indexOf(o);
|
|
49
54
|
return n === -1 ? [{ text: t, highlight: !1 }] : [
|
|
50
55
|
{ text: t.slice(0, n), highlight: !1 },
|
|
51
56
|
{
|
|
52
|
-
text: t.slice(n, n +
|
|
57
|
+
text: t.slice(n, n + o.length),
|
|
53
58
|
highlight: !0
|
|
54
59
|
},
|
|
55
|
-
{ text: t.slice(n +
|
|
60
|
+
{ text: t.slice(n + o.length), highlight: !1 }
|
|
56
61
|
];
|
|
57
|
-
}),
|
|
58
|
-
const t =
|
|
62
|
+
}), z = d(() => {
|
|
63
|
+
const t = l.node.searchMatch;
|
|
59
64
|
if (!t) return [];
|
|
60
|
-
const
|
|
61
|
-
return n < 0 || n >=
|
|
62
|
-
{ text:
|
|
63
|
-
{ text:
|
|
64
|
-
{ text:
|
|
65
|
+
const o = t.line_content, n = t.match_start, a = t.match_length;
|
|
66
|
+
return n < 0 || n >= o.length ? [{ text: o, highlight: !1 }] : [
|
|
67
|
+
{ text: o.substring(0, n), highlight: !1 },
|
|
68
|
+
{ text: o.substring(n, n + a), highlight: !0 },
|
|
69
|
+
{ text: o.substring(n + a), highlight: !1 }
|
|
65
70
|
];
|
|
66
|
-
}),
|
|
67
|
-
t?.stopPropagation(), t?.preventDefault(),
|
|
68
|
-
},
|
|
71
|
+
}), p = (t) => {
|
|
72
|
+
t?.stopPropagation(), t?.preventDefault(), g("toggle-expand", l.node);
|
|
73
|
+
}, N = d(
|
|
69
74
|
() => E.value ? "lucide:chevron-left" : "lucide:chevron-right"
|
|
70
|
-
),
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
t.stopPropagation(),
|
|
75
|
+
), F = () => {
|
|
76
|
+
g("toggle-select", l.node);
|
|
77
|
+
}, O = (t) => {
|
|
78
|
+
t.stopPropagation(), f.value ? p() : l.selectionMode !== "none" && g("toggle-select", l.node), g("click-node", l.node);
|
|
74
79
|
};
|
|
75
|
-
return (t,
|
|
80
|
+
return (t, o) => (s(), i("div", W, [
|
|
76
81
|
c("div", {
|
|
77
|
-
class:
|
|
82
|
+
class: m(["group flex flex-col transition-colors cursor-pointer relative", {
|
|
78
83
|
"bg-accent/50 text-accent-foreground": e.isSelected && e.selectionMode === "single" && !e.showCheckboxes,
|
|
79
84
|
"hover:bg-accent/50": !e.isSelected || e.selectionMode !== "single",
|
|
80
85
|
"opacity-50 pointer-events-none": e.node.disabled,
|
|
81
86
|
"rounded-none": e.variant === "bordered",
|
|
82
87
|
"rounded-md": e.variant === "default"
|
|
83
88
|
}]),
|
|
84
|
-
title:
|
|
85
|
-
onClick:
|
|
89
|
+
title: k.value,
|
|
90
|
+
onClick: O
|
|
86
91
|
}, [
|
|
87
|
-
e.variant === "bordered" ? (
|
|
92
|
+
e.variant === "bordered" ? (s(), i("div", {
|
|
88
93
|
key: 0,
|
|
89
94
|
class: "absolute bottom-0 h-[1px] bg-border pointer-events-none",
|
|
90
|
-
style:
|
|
91
|
-
}, null, 4)) :
|
|
95
|
+
style: v({ insetInlineStart: e.depth * b + "px", insetInlineEnd: "0" })
|
|
96
|
+
}, null, 4)) : r("", !0),
|
|
92
97
|
c("div", {
|
|
93
|
-
class:
|
|
94
|
-
style:
|
|
98
|
+
class: m(["tree-row-content relative z-10 flex items-center pe-2", e.variant === "bordered" ? "py-2 min-h-[40px]" : "py-1 min-h-[32px]"]),
|
|
99
|
+
style: v({ paddingInlineStart: I.value })
|
|
95
100
|
}, [
|
|
96
|
-
|
|
101
|
+
e.showTreeLines ? (s(), h(A(H), {
|
|
102
|
+
key: 0,
|
|
97
103
|
depth: e.depth,
|
|
98
104
|
"is-last-sibling": e.isLast,
|
|
99
105
|
"ancestor-last-flags": e.ancestorLastFlags,
|
|
100
|
-
"has-toggle":
|
|
101
|
-
indent:
|
|
106
|
+
"has-toggle": f.value,
|
|
107
|
+
indent: b,
|
|
102
108
|
"line-class": "bg-border"
|
|
103
|
-
}, null, 8, ["depth", "is-last-sibling", "ancestor-last-flags", "has-toggle"]),
|
|
104
|
-
|
|
105
|
-
key:
|
|
109
|
+
}, null, 8, ["depth", "is-last-sibling", "ancestor-last-flags", "has-toggle"])) : r("", !0),
|
|
110
|
+
f.value ? (s(), i("button", {
|
|
111
|
+
key: 1,
|
|
106
112
|
type: "button",
|
|
107
113
|
class: "tree-expand-toggle relative z-20 p-1 me-1 rounded-sm hover:bg-muted text-muted-foreground transition-colors focus:outline-none shrink-0",
|
|
108
114
|
"aria-expanded": e.isExpanded,
|
|
109
|
-
onClick:
|
|
115
|
+
onClick: x(p, ["stop"])
|
|
110
116
|
}, [
|
|
111
|
-
|
|
112
|
-
icon: e.isExpanded ? "lucide:chevron-down" :
|
|
117
|
+
w(u, {
|
|
118
|
+
icon: e.isExpanded ? "lucide:chevron-down" : N.value,
|
|
113
119
|
class: "w-4 h-4"
|
|
114
120
|
}, null, 8, ["icon"])
|
|
115
|
-
], 8,
|
|
116
|
-
e.showCheckboxes && e.selectionMode !== "none" ? (
|
|
117
|
-
key:
|
|
118
|
-
class: "relative z-20 me-
|
|
119
|
-
onClick:
|
|
121
|
+
], 8, j)) : (s(), i("div", q)),
|
|
122
|
+
e.showCheckboxes && e.selectionMode !== "none" ? (s(), i("div", {
|
|
123
|
+
key: 3,
|
|
124
|
+
class: "relative z-20 me-3 flex items-center justify-center bg-transparent shrink-0",
|
|
125
|
+
onClick: o[1] || (o[1] = x(() => {
|
|
120
126
|
}, ["stop"]))
|
|
121
127
|
}, [
|
|
122
|
-
|
|
128
|
+
w(G, {
|
|
123
129
|
checked: e.isSelected,
|
|
124
130
|
indeterminate: e.isIndeterminate,
|
|
125
131
|
disabled: e.node.disabled,
|
|
126
132
|
rounded: "sm",
|
|
127
133
|
size: "sm",
|
|
128
|
-
|
|
134
|
+
onClick: o[0] || (o[0] = x(() => {
|
|
135
|
+
}, ["stop"])),
|
|
136
|
+
"onUpdate:checked": F
|
|
129
137
|
}, null, 8, ["checked", "indeterminate", "disabled"])
|
|
130
|
-
])) :
|
|
131
|
-
c("div",
|
|
132
|
-
e.isLoading ? (
|
|
138
|
+
])) : r("", !0),
|
|
139
|
+
c("div", U, [
|
|
140
|
+
e.isLoading ? (s(), h(u, {
|
|
133
141
|
key: 0,
|
|
134
142
|
icon: "lucide:loader-2",
|
|
135
143
|
class: "w-4 h-4 animate-spin"
|
|
136
|
-
})) : e.node.icon ? (
|
|
144
|
+
})) : e.node.icon ? (s(), h(u, {
|
|
137
145
|
key: 1,
|
|
138
146
|
icon: e.node.icon,
|
|
139
147
|
class: "w-4 h-4"
|
|
140
|
-
}, null, 8, ["icon"])) :
|
|
148
|
+
}, null, 8, ["icon"])) : f.value ? (s(), h(u, {
|
|
141
149
|
key: 2,
|
|
142
150
|
icon: e.isExpanded ? "lucide:folder-open" : "lucide:folder",
|
|
143
151
|
class: "w-4 h-4"
|
|
144
|
-
}, null, 8, ["icon"])) : (
|
|
152
|
+
}, null, 8, ["icon"])) : (s(), h(u, {
|
|
145
153
|
key: 3,
|
|
146
154
|
icon: "lucide:file",
|
|
147
155
|
class: "w-4 h-4"
|
|
148
156
|
}))
|
|
149
157
|
]),
|
|
150
|
-
c("div",
|
|
151
|
-
(
|
|
152
|
-
key:
|
|
153
|
-
class:
|
|
158
|
+
c("div", Y, [
|
|
159
|
+
(s(!0), i(C, null, L(T.value, (n, a) => (s(), i("span", {
|
|
160
|
+
key: a,
|
|
161
|
+
class: m({
|
|
154
162
|
"bg-yellow-100 text-yellow-900 rounded-sm px-0.5": n.highlight
|
|
155
163
|
})
|
|
156
|
-
},
|
|
164
|
+
}, y(n.text), 3))), 128))
|
|
157
165
|
]),
|
|
158
|
-
t.$slots.actions ? (
|
|
159
|
-
key:
|
|
166
|
+
t.$slots.actions ? (s(), i("div", {
|
|
167
|
+
key: 4,
|
|
160
168
|
class: "relative z-20 ms-2 flex items-center shrink-0",
|
|
161
|
-
onClick:
|
|
169
|
+
onClick: o[2] || (o[2] = x(() => {
|
|
162
170
|
}, ["stop"]))
|
|
163
171
|
}, [
|
|
164
|
-
|
|
165
|
-
])) :
|
|
172
|
+
D(t.$slots, "actions", { node: e.node })
|
|
173
|
+
])) : r("", !0)
|
|
166
174
|
], 6),
|
|
167
|
-
e.node.searchMatch ? (
|
|
175
|
+
e.node.searchMatch ? (s(), i("div", {
|
|
168
176
|
key: 1,
|
|
169
177
|
class: "flex items-center text-[11px] text-gray-500 font-mono pe-2 pb-1.5 truncate",
|
|
170
|
-
style:
|
|
178
|
+
style: v({ paddingInlineStart: B.value })
|
|
171
179
|
}, [
|
|
172
|
-
c("span",
|
|
173
|
-
c("div",
|
|
174
|
-
(
|
|
175
|
-
key:
|
|
176
|
-
class:
|
|
180
|
+
c("span", Z, "L" + y(e.node.searchMatch.line_number), 1),
|
|
181
|
+
c("div", J, [
|
|
182
|
+
(s(!0), i(C, null, L(z.value, (n, a) => (s(), i("span", {
|
|
183
|
+
key: a,
|
|
184
|
+
class: m({
|
|
177
185
|
"bg-yellow-500/20 text-gray-900 px-0.5 rounded-[1px] font-medium border border-yellow-600/30": n.highlight
|
|
178
186
|
})
|
|
179
|
-
},
|
|
187
|
+
}, y(n.text), 3))), 128))
|
|
180
188
|
])
|
|
181
|
-
], 4)) :
|
|
182
|
-
], 10,
|
|
189
|
+
], 4)) : r("", !0)
|
|
190
|
+
], 10, X)
|
|
183
191
|
]));
|
|
184
192
|
}
|
|
185
193
|
});
|
|
186
194
|
export {
|
|
187
|
-
|
|
195
|
+
ce as default
|
|
188
196
|
};
|
|
@@ -33,6 +33,18 @@ export interface FileTreeProps {
|
|
|
33
33
|
emptyTextI18n?: string;
|
|
34
34
|
variant?: FileTreeVariant;
|
|
35
35
|
maxLabelLength?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to render parent-to-child tree connector (indent guide) lines.
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
showTreeLines?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* When `false`, parent/folder row clicks only expand/collapse and never
|
|
43
|
+
* change selection. Leaf/file rows remain selectable by clicking the row.
|
|
44
|
+
* Checkboxes continue to select both folders and files.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
selectOnRowClick?: boolean;
|
|
36
48
|
}
|
|
37
49
|
export interface FileTreeEvents {
|
|
38
50
|
(e: 'update:modelValue', keys: string[]): void;
|
|
@@ -96,11 +96,11 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {
|
|
|
96
96
|
values: Record<string, any>;
|
|
97
97
|
footer: boolean;
|
|
98
98
|
class: string;
|
|
99
|
+
className: string;
|
|
99
100
|
loading: boolean;
|
|
100
101
|
layout: "vertical" | "inline";
|
|
101
102
|
isUpdate: boolean;
|
|
102
103
|
folderId: string;
|
|
103
|
-
className: string;
|
|
104
104
|
headerClass: string;
|
|
105
105
|
footerClass: string;
|
|
106
106
|
cancelText: string;
|
|
@@ -27,8 +27,8 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
27
27
|
onAddonAction?: (action: string) => any;
|
|
28
28
|
onAddonChange?: (name: string, payload: IFormFieldChangePayload) => any;
|
|
29
29
|
}>, {
|
|
30
|
-
variant: InputVariant;
|
|
31
30
|
size: InputSize;
|
|
31
|
+
variant: InputVariant;
|
|
32
32
|
rounded: InputRounded;
|
|
33
33
|
loading: boolean;
|
|
34
34
|
error: string;
|
|
@@ -42,8 +42,8 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
42
42
|
onChange?: (name: string, payload: IFormFieldChangePayload) => any;
|
|
43
43
|
onAddonAction?: (action: string) => any;
|
|
44
44
|
}>, {
|
|
45
|
-
variant: InputVariant;
|
|
46
45
|
size: InputSize;
|
|
46
|
+
variant: InputVariant;
|
|
47
47
|
rounded: InputRounded;
|
|
48
48
|
showRequiredAsterisk: boolean;
|
|
49
49
|
layout: "vertical" | "inline";
|