vlite3 1.4.37 → 1.4.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/components/Badge.vue.js +5 -5
  2. package/components/Badge.vue3.js +5 -0
  3. package/components/CategoryManager/CategoryManager.vue2.js +5 -4
  4. package/components/Chip/Chip.vue.js +21 -21
  5. package/components/Chip/Chip.vue3.js +5 -0
  6. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  7. package/components/ColorPicker/ColorPicker.vue.js +2 -2
  8. package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
  9. package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
  10. package/components/Comment/CommentItem.vue2.js +3 -2
  11. package/components/DataTable/DataTable.vue.d.ts +1 -0
  12. package/components/DataTable/DataTable.vue.js +204 -203
  13. package/components/DataTable/DataTableRow.vue.js +54 -51
  14. package/components/DataTable/types.d.ts +5 -0
  15. package/components/DataTable/useDataTableTree.d.ts +4 -3
  16. package/components/DataTable/useDataTableTree.js +102 -92
  17. package/components/FileTree/FileTree.vue.d.ts +3 -1
  18. package/components/FileTree/FileTree.vue.js +1 -1
  19. package/components/FileTree/FileTree.vue2.js +157 -116
  20. package/components/FileTree/FileTreeNode.vue.d.ts +9 -5
  21. package/components/FileTree/FileTreeNode.vue.js +147 -189
  22. package/components/Form/{AccordionView.vue2.js → AccordionView.vue.js} +1 -1
  23. package/components/Form/Form.vue2.js +45 -43
  24. package/components/Form/index.vue2.js +1 -1
  25. package/components/ImportData/ImportData.vue.js +4 -2
  26. package/components/Invoice/InvoiceVariant1.vue.js +3 -2
  27. package/components/Invoice/InvoiceVariant2.vue.js +3 -2
  28. package/components/Invoice/InvoiceVariant3.vue.js +3 -2
  29. package/components/Invoice/InvoiceVariant4.vue.js +3 -2
  30. package/components/MultiSelect/MultiSelect.vue.js +3 -2
  31. package/components/NavbarCommandPalette.vue.js +1 -1
  32. package/components/PricingPlan/PricingPlanItem.vue.js +10 -9
  33. package/components/Screen/ScreenFilter.vue.js +20 -19
  34. package/components/StatusChip/StatusChip.vue.js +8 -7
  35. package/components/StatusChip/StatusChip.vue3.js +5 -0
  36. package/components/Timeline/TimelineItem.vue.js +3 -2
  37. package/components/TreeConnectors/TreeConnectors.vue.d.ts +1 -1
  38. package/components/TreeConnectors/TreeConnectors.vue.js +26 -17
  39. package/components/TreeConnectors/geometry.d.ts +29 -3
  40. package/components/TreeConnectors/geometry.js +128 -46
  41. package/components/TreeConnectors/index.d.ts +1 -1
  42. package/index.js +473 -470
  43. package/package.json +1 -1
  44. package/style.css +15 -1
  45. package/components/Badge.vue2.js +0 -4
  46. package/components/Chip/Chip.vue2.js +0 -4
  47. package/components/StatusChip/StatusChip.vue2.js +0 -4
  48. /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
@@ -1,10 +1,11 @@
1
- import { defineComponent as Q, ref as L, shallowRef as E, watch as T, computed as p, openBlock as w, createElementBlock as b, normalizeClass as $, Fragment as q, renderList as V, isMemoSame as z, createBlock as F, createSlots as P, withCtx as A, renderSlot as R, mergeProps as U, toDisplayString as j } from "vue";
2
- import G from "./FileTreeNode.vue.js";
3
- import { $t as x } from "../../utils/i18n.js";
4
- const H = {
1
+ import { defineComponent as q, shallowRef as x, watch as F, computed as g, openBlock as m, createElementBlock as v, normalizeClass as z, Fragment as I, renderList as R, withMemo as N, normalizeStyle as G, createBlock as O, createSlots as U, withCtx as Y, renderSlot as j, mergeProps as H, toDisplayString as J } from "vue";
2
+ import W from "./FileTreeNode.vue.js";
3
+ import { appendAncestorLastFlag as D, EMPTY_ANCESTOR_LAST_FLAGS as X } from "../TreeConnectors/geometry.js";
4
+ import { $t as k } from "../../utils/i18n.js";
5
+ const Z = {
5
6
  key: 1,
6
7
  class: "text-sm text-muted-foreground p-4 text-center"
7
- }, Y = /* @__PURE__ */ Q({
8
+ }, ne = /* @__PURE__ */ q({
8
9
  __name: "FileTree",
9
10
  props: {
10
11
  modelValue: { default: () => [] },
@@ -22,159 +23,199 @@ const H = {
22
23
  maxLabelLength: { default: 35 }
23
24
  },
24
25
  emits: ["update:modelValue", "select", "expand", "node-click"],
25
- setup(o, { emit: C }) {
26
- const i = o, m = C, u = L(new Set(i.defaultExpandedKeys)), f = L(/* @__PURE__ */ new Set()), g = E(/* @__PURE__ */ new Map()), S = E(/* @__PURE__ */ new Map()), I = (t, l) => {
27
- const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), a = (s, c) => {
28
- for (const r of s)
29
- e.set(r.id, r), c && n.set(r.id, c), r.children && a(r.children, r.id);
26
+ setup(o, { emit: K }) {
27
+ const s = o, p = K, h = x(new Set(s.defaultExpandedKeys)), f = x(/* @__PURE__ */ new Set()), y = x(/* @__PURE__ */ new Map()), b = x(/* @__PURE__ */ new Map()), P = (t) => !!(t.isFolder || t.children && t.children.length > 0), E = (t) => {
28
+ const l = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), a = (n, d) => {
29
+ for (const i of n)
30
+ l.set(i.id, i), d && e.set(i.id, d), i.children && a(i.children, i.id);
30
31
  };
31
- a(t, l), g.value = e, S.value = n;
32
+ a(t), y.value = l, b.value = e;
32
33
  };
33
- T(
34
- () => i.data,
34
+ F(
35
+ () => s.data,
35
36
  (t) => {
36
- I(t);
37
+ E(t);
37
38
  },
38
- { immediate: !0, deep: !0 }
39
+ { immediate: !0 }
39
40
  );
40
- const k = (t) => {
41
- let l = [];
42
- if (t.children)
43
- for (const e of t.children)
44
- l.push(e.id), l = l.concat(k(e));
41
+ const M = (t) => {
42
+ const l = [], e = t.children ? [...t.children] : [];
43
+ for (; e.length; ) {
44
+ const a = e.pop();
45
+ if (l.push(a.id), a.children?.length)
46
+ for (let n = 0; n < a.children.length; n++)
47
+ e.push(a.children[n]);
48
+ }
45
49
  return l;
46
- }, v = p(() => new Set(i.modelValue)), M = p(() => {
50
+ }, w = g(() => new Set(s.modelValue)), T = g(() => {
47
51
  const t = /* @__PURE__ */ new Set();
48
- if (i.selectionMode !== "multiple") return t;
52
+ if (s.selectionMode !== "multiple") return t;
49
53
  const l = (e) => {
50
54
  if (!e.children || e.children.length === 0)
51
- return v.value.has(e.id) ? { status: "checked" } : { status: "unchecked" };
52
- let n = !1, a = !1, s = !1;
53
- for (const c of e.children) {
54
- const r = l(c);
55
- r.status === "checked" && (n = !0), r.status === "unchecked" && (a = !0), r.status === "indeterminate" && (s = !0);
55
+ return w.value.has(e.id) ? "checked" : "unchecked";
56
+ let a = !1, n = !1, d = !1;
57
+ for (const i of e.children) {
58
+ const r = l(i);
59
+ r === "checked" ? a = !0 : r === "unchecked" ? n = !0 : d = !0;
56
60
  }
57
- return s || n && a ? (t.add(e.id), { status: "indeterminate" }) : n ? { status: "checked" } : { status: "unchecked" };
61
+ return d || a && n ? (t.add(e.id), "indeterminate") : a ? "checked" : "unchecked";
58
62
  };
59
- return i.data.forEach(l), t;
60
- }), D = async (t) => {
63
+ return s.data.forEach(l), t;
64
+ }), A = async (t) => {
61
65
  if (t.disabled) return;
62
- if (u.value.has(t.id)) {
63
- const e = new Set(u.value);
64
- e.delete(t.id);
65
- const n = g.value.get(t.id) || t;
66
- k(n).forEach((s) => e.delete(s)), u.value = e, m("expand", t, !1);
67
- } else {
68
- const e = new Set(u.value);
69
- if (e.add(t.id), u.value = e, m("expand", t, !0), i.loadData && !t.isLoaded && (!t.children || t.children.length === 0)) {
66
+ if (h.value.has(t.id)) {
67
+ const a = new Set(h.value);
68
+ a.delete(t.id);
69
+ const n = y.value.get(t.id) || t;
70
+ M(n).forEach((d) => a.delete(d)), h.value = a, p("expand", t, !1);
71
+ return;
72
+ }
73
+ const e = new Set(h.value);
74
+ if (e.add(t.id), h.value = e, p("expand", t, !0), s.loadData && !t.isLoaded && (!t.children || t.children.length === 0)) {
75
+ const a = new Set(f.value);
76
+ a.add(t.id), f.value = a;
77
+ try {
78
+ await s.loadData(t), E(s.data);
79
+ } finally {
70
80
  const n = new Set(f.value);
71
- n.add(t.id), f.value = n;
72
- try {
73
- await i.loadData(t);
74
- } finally {
75
- const a = new Set(f.value);
76
- a.delete(t.id), f.value = a;
77
- }
81
+ n.delete(t.id), f.value = n;
78
82
  }
79
83
  }
80
- }, K = (t) => {
84
+ }, B = (t) => {
81
85
  if (t.disabled) return;
82
- const l = g.value.get(t.id) || t;
83
- let e = new Set(v.value);
84
- const n = e.has(t.id);
85
- if (i.selectionMode === "single")
86
- e.clear(), n || e.add(t.id);
87
- else if (i.selectionMode === "multiple") {
88
- const a = k(l), s = !n, c = (d, h) => {
89
- h ? e.add(d) : e.delete(d);
86
+ const l = y.value.get(t.id) || t, e = new Set(w.value), a = e.has(t.id);
87
+ if (s.selectionMode === "single")
88
+ e.clear(), a || e.add(t.id);
89
+ else if (s.selectionMode === "multiple") {
90
+ const n = M(l), d = !a, i = (c, u) => {
91
+ u ? e.add(c) : e.delete(c);
90
92
  };
91
- c(t.id, s), a.forEach((d) => c(d, s));
93
+ i(t.id, d), n.forEach((c) => i(c, d));
92
94
  let r = l;
93
95
  for (; ; ) {
94
- const d = S.value.get(r.id);
95
- if (!d) break;
96
- const h = g.value.get(d);
97
- if (!h || !h.children) break;
98
- h.children.every((N) => e.has(N.id)) ? e.add(h.id) : e.delete(h.id), r = h;
96
+ const c = b.value.get(r.id);
97
+ if (!c) break;
98
+ const u = y.value.get(c);
99
+ if (!u?.children) break;
100
+ u.children.every((L) => e.has(L.id)) ? e.add(u.id) : e.delete(u.id), r = u;
99
101
  }
100
102
  }
101
- m("update:modelValue", Array.from(e)), m("select", l, !n);
102
- }, y = p(() => {
103
- if (!i.searchQuery) return i.data;
104
- const t = i.searchQuery.toLowerCase(), l = (e) => {
105
- const a = (e.labelI18n ? x(e.labelI18n) : e.label).toLowerCase().includes(t), s = !!e.searchMatch;
106
- let c = [];
107
- return e.children && (c = e.children.map(l).filter((r) => r !== null)), a || s || c.length > 0 ? {
108
- ...e,
109
- children: c
110
- } : null;
103
+ p("update:modelValue", Array.from(e)), p("select", l, !a);
104
+ }, Q = g(() => {
105
+ if (!s.searchQuery) return s.data;
106
+ const t = s.searchQuery.toLowerCase(), l = (e) => {
107
+ const n = (e.labelI18n ? k(e.labelI18n) : e.label).toLowerCase().includes(t), d = !!e.searchMatch;
108
+ let i = [];
109
+ return e.children && (i = e.children.map(l).filter((r) => r !== null)), n || d || i.length > 0 ? { ...e, children: i } : null;
110
+ };
111
+ return s.data.map(l).filter((e) => e !== null);
112
+ }), C = g(() => {
113
+ const t = [], l = (e, a, n) => {
114
+ const d = e.length - 1;
115
+ for (let i = 0; i < e.length; i++) {
116
+ const r = e[i], c = i === d, u = P(r), L = h.value.has(r.id), $ = f.value.has(r.id);
117
+ if (t.push({
118
+ node: r,
119
+ depth: a,
120
+ isLast: c,
121
+ ancestorLastFlags: n,
122
+ isFolder: u
123
+ }), L && u && !$) {
124
+ const S = r.children;
125
+ S && S.length > 0 ? l(S, a + 1, D(n, c)) : t.push({
126
+ node: r,
127
+ depth: a + 1,
128
+ isLast: !0,
129
+ ancestorLastFlags: D(n, c),
130
+ isFolder: !1,
131
+ showEmptyPlaceholder: !0
132
+ });
133
+ }
134
+ }
111
135
  };
112
- return i.data.map(l).filter((e) => e !== null);
136
+ return l(Q.value, 0, X), t;
113
137
  });
114
- T(
115
- () => [i.searchQuery, i.data],
138
+ F(
139
+ () => [s.searchQuery, s.data],
116
140
  ([t]) => {
117
- if (t) {
118
- const l = t.toLowerCase(), e = /* @__PURE__ */ new Set(), n = (a) => {
119
- let s = !1;
120
- if (a.children)
121
- for (const d of a.children)
122
- n(d) && (s = !0);
123
- const r = (a.labelI18n ? x(a.labelI18n) : a.label).toLowerCase().includes(l) || !!a.searchMatch;
124
- return s && e.add(a.id), r || s;
125
- };
126
- if (i.data.forEach(n), e.size > 0) {
127
- const a = new Set(u.value);
128
- e.forEach((s) => a.add(s)), u.value = a;
129
- }
141
+ if (!t) return;
142
+ const l = t.toLowerCase(), e = /* @__PURE__ */ new Set(), a = (n) => {
143
+ let d = !1;
144
+ if (n.children)
145
+ for (const c of n.children)
146
+ a(c) && (d = !0);
147
+ const r = (n.labelI18n ? k(n.labelI18n) : n.label).toLowerCase().includes(l) || !!n.searchMatch;
148
+ return d && e.add(n.id), r || d;
149
+ };
150
+ if (s.data.forEach(a), e.size > 0) {
151
+ const n = new Set(h.value);
152
+ e.forEach((d) => n.add(d)), h.value = n;
130
153
  }
131
- },
132
- { deep: !0 }
154
+ }
133
155
  );
134
- const B = p(() => {
135
- if (i.emptyTextI18n) return x(i.emptyTextI18n);
136
- if (i.emptyText) return i.emptyText;
137
- const t = x("vlite.fileTree.emptyText");
156
+ const V = g(() => {
157
+ if (s.emptyTextI18n) return k(s.emptyTextI18n);
158
+ if (s.emptyText) return s.emptyText;
159
+ const t = k("vlite.fileTree.emptyText");
138
160
  return t !== "vlite.fileTree.emptyText" ? t : "No results found.";
139
161
  });
140
- return (t, l) => (w(), b("div", {
141
- class: $(["w-full h-full overflow-y-auto file-tree-container", i.class])
162
+ return (t, l) => (m(), v("div", {
163
+ class: z(["w-full h-full overflow-y-auto file-tree-container", s.class])
142
164
  }, [
143
- y.value.length > 0 ? (w(!0), b(q, { key: 0 }, V(y.value, (e, n, a, s) => {
144
- const c = [e, v.value, u.value, M.value, f.value, o.highlightSearch, o.searchQuery, o.showCheckboxes, o.variant, o.maxLabelLength, n === y.value.length - 1, !!t.$slots.actions];
145
- if (s && s.key === e.id && z(s, c)) return s;
146
- const r = (w(), F(G, {
147
- key: e.id,
148
- node: e,
149
- "is-last": n === y.value.length - 1,
150
- "ancestor-last-flags": [],
165
+ C.value.length > 0 ? (m(!0), v(I, { key: 0 }, R(C.value, (e) => (m(), v(I, {
166
+ key: e.showEmptyPlaceholder ? e.node.id + "-empty" : e.node.id
167
+ }, [
168
+ e.showEmptyPlaceholder ? N([e.depth, e.node.id], () => (m(), v("div", {
169
+ key: 0,
170
+ class: "py-0.5 text-xs text-muted-foreground italic",
171
+ style: G({ paddingLeft: e.depth * 20 + 26 + "px" })
172
+ }, null, 4)), l, 0) : N([
173
+ e.node,
174
+ w.value.has(e.node.id),
175
+ T.value.has(e.node.id),
176
+ h.value.has(e.node.id),
177
+ f.value.has(e.node.id),
178
+ o.highlightSearch,
179
+ o.searchQuery,
180
+ o.showCheckboxes,
181
+ o.variant,
182
+ o.maxLabelLength,
183
+ e.depth,
184
+ e.isLast,
185
+ e.ancestorLastFlags,
186
+ !!t.$slots.actions
187
+ ], () => (m(), O(W, {
188
+ key: 1,
189
+ node: e.node,
190
+ depth: e.depth,
191
+ "is-last": e.isLast,
192
+ "ancestor-last-flags": e.ancestorLastFlags,
151
193
  "selection-mode": o.selectionMode,
152
- "selected-keys": v.value,
153
- "expanded-keys": u.value,
154
- "indeterminate-keys": M.value,
155
- "loading-keys": f.value,
194
+ "is-selected": w.value.has(e.node.id),
195
+ "is-indeterminate": T.value.has(e.node.id),
196
+ "is-expanded": h.value.has(e.node.id),
197
+ "is-loading": f.value.has(e.node.id),
156
198
  "show-checkboxes": o.showCheckboxes,
157
199
  "highlight-search": o.highlightSearch,
158
200
  "search-query": o.searchQuery,
159
201
  variant: o.variant,
160
202
  "max-label-length": o.maxLabelLength,
161
- onToggleExpand: D,
162
- onToggleSelect: K,
163
- onClickNode: l[0] || (l[0] = (d) => m("node-click", d))
164
- }, P({ _: 2 }, [
203
+ onToggleExpand: A,
204
+ onToggleSelect: B,
205
+ onClickNode: l[1] || (l[1] = (a) => p("node-click", a))
206
+ }, U({ _: 2 }, [
165
207
  t.$slots.actions ? {
166
208
  name: "actions",
167
- fn: A((d) => [
168
- R(t.$slots, "actions", U({ ref_for: !0 }, d), void 0, !0)
209
+ fn: Y((a) => [
210
+ j(t.$slots, "actions", H({ ref_for: !0 }, a), void 0, !0)
169
211
  ]),
170
212
  key: "0"
171
213
  } : void 0
172
- ]), 1032, ["node", "is-last", "selection-mode", "selected-keys", "expanded-keys", "indeterminate-keys", "loading-keys", "show-checkboxes", "highlight-search", "search-query", "variant", "max-label-length"]));
173
- return r.memo = c, r;
174
- }, l, 1), 128)) : (w(), b("div", H, j(B.value), 1))
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(), v("div", Z, J(V.value), 1))
175
216
  ], 2));
176
217
  }
177
218
  });
178
219
  export {
179
- Y as default
220
+ ne as default
180
221
  };
@@ -3,10 +3,11 @@ interface Props {
3
3
  node: FileNode;
4
4
  depth?: number;
5
5
  selectionMode?: FileTreeSelectionMode;
6
- selectedKeys: Set<string>;
7
- indeterminateKeys: Set<string>;
8
- expandedKeys: Set<string>;
9
- loadingKeys: Set<string>;
6
+ /** Precomputed row state — avoids each node re-deriving from whole Sets. */
7
+ isSelected?: boolean;
8
+ isIndeterminate?: boolean;
9
+ isExpanded?: boolean;
10
+ isLoading?: boolean;
10
11
  showCheckboxes?: boolean;
11
12
  highlightSearch?: boolean;
12
13
  searchQuery?: string;
@@ -23,7 +24,6 @@ declare function __VLS_template(): {
23
24
  actions?(_: {
24
25
  node: FileNode;
25
26
  }): any;
26
- actions?(_: any): any;
27
27
  };
28
28
  refs: {};
29
29
  rootEl: HTMLDivElement;
@@ -39,10 +39,14 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
39
39
  "onClick-node"?: (node: FileNode) => any;
40
40
  }>, {
41
41
  variant: FileTreeVariant;
42
+ isLoading: boolean;
43
+ isSelected: boolean;
42
44
  isLast: boolean;
43
45
  depth: number;
44
46
  ancestorLastFlags: boolean[];
45
47
  selectionMode: FileTreeSelectionMode;
48
+ isIndeterminate: boolean;
49
+ isExpanded: boolean;
46
50
  showCheckboxes: boolean;
47
51
  highlightSearch: boolean;
48
52
  maxLabelLength: number;