vlite3 0.4.4 → 0.4.7

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 (109) hide show
  1. package/components/Accordion/AccordionItem.vue.js +33 -32
  2. package/components/Accordion/types.d.ts +2 -0
  3. package/components/Alert.vue.d.ts +2 -0
  4. package/components/Alert.vue.js +38 -36
  5. package/components/AvatarUploader/AvatarUploader.vue.d.ts +1 -1
  6. package/components/AvatarUploader/AvatarUploader.vue.js +25 -24
  7. package/components/Button.vue.d.ts +1 -1
  8. package/components/Button.vue.js +37 -35
  9. package/components/CheckBox.vue.d.ts +1 -0
  10. package/components/CheckBox.vue.js +40 -40
  11. package/components/Chip/Chip.vue.js +55 -55
  12. package/components/Chip/types.d.ts +1 -0
  13. package/components/ChoiceBox/ChoiceBox.vue.d.ts +5 -0
  14. package/components/ChoiceBox/ChoiceBox.vue.js +61 -58
  15. package/components/ColorPicker/ColorPicker.vue.js +3 -2
  16. package/components/ConfirmationModal.vue.d.ts +4 -2
  17. package/components/ConfirmationModal.vue.js +48 -33
  18. package/components/DataList/DataList.vue.d.ts +0 -2
  19. package/components/DataList/DataList.vue.js +39 -35
  20. package/components/DataList/types.d.ts +2 -0
  21. package/components/DataTable/DataTable.vue.d.ts +0 -5
  22. package/components/DataTable/DataTable.vue.js +177 -158
  23. package/components/DataTable/DataTableHeader.vue.js +15 -14
  24. package/components/DataTable/DataTableToolbar.vue.d.ts +1 -1
  25. package/components/DataTable/DataTableToolbar.vue.js +30 -23
  26. package/components/DataTable/types.d.ts +4 -0
  27. package/components/DatePicker.vue.d.ts +1 -0
  28. package/components/DatePicker.vue.js +32 -25
  29. package/components/Dropdown/DropdownBooleanItem.vue.js +18 -17
  30. package/components/Dropdown/DropdownGroupedLayout.vue.js +28 -27
  31. package/components/Dropdown/DropdownItem.vue.js +24 -23
  32. package/components/Dropdown/DropdownMenu.vue.js +100 -91
  33. package/components/Dropdown/composables/useDropdownNavigation.js +24 -23
  34. package/components/Dropdown/composables/useDropdownSelection.js +19 -17
  35. package/components/Empty/Empty.vue.d.ts +2 -2
  36. package/components/Empty/Empty.vue.js +32 -18
  37. package/components/FilePicker/FilePicker.vue.d.ts +3 -1
  38. package/components/FilePicker/FilePicker.vue.js +140 -127
  39. package/components/FileTree/FileTree.vue.js +68 -58
  40. package/components/FileTree/FileTreeNode.vue.js +35 -34
  41. package/components/FileTree/types.d.ts +3 -0
  42. package/components/Form/CustomFields.vue.d.ts +3 -1
  43. package/components/Form/CustomFields.vue.js +2 -2
  44. package/components/Form/CustomFields.vue2.js +92 -80
  45. package/components/Form/Form.vue.d.ts +1 -1
  46. package/components/Form/FormField.vue.d.ts +1 -1
  47. package/components/Form/FormField.vue.js +60 -59
  48. package/components/Form/FormFields.vue.js +2 -2
  49. package/components/Form/FormFields.vue2.js +58 -57
  50. package/components/Form/composables/useForm.js +91 -88
  51. package/components/Form/types.d.ts +4 -0
  52. package/components/Form/utils/form.utils.js +104 -98
  53. package/components/GoogleLogin.vue.d.ts +1 -1
  54. package/components/GoogleLogin.vue.js +39 -32
  55. package/components/Heatmap/Heatmap.vue2.js +3 -2
  56. package/components/IconPicker.vue.d.ts +2 -0
  57. package/components/IconPicker.vue.js +37 -29
  58. package/components/Input.vue.d.ts +1 -1
  59. package/components/Input.vue.js +96 -98
  60. package/components/Kanban/KanbanBoard.vue.js +1 -1
  61. package/components/Kanban/KanbanBoard.vue2.js +55 -54
  62. package/components/Kanban/types.d.ts +1 -0
  63. package/components/Masonry/Masonry.vue2.js +3 -2
  64. package/components/Modal.vue.d.ts +2 -0
  65. package/components/Modal.vue.js +62 -57
  66. package/components/MultiSelect/MultiSelect.vue.d.ts +1 -1
  67. package/components/MultiSelect/MultiSelect.vue.js +61 -54
  68. package/components/Navbar/Navbar.vue.js +46 -46
  69. package/components/Pagination/Pagination.vue.js +116 -97
  70. package/components/PricingPlan/PricingPlanItem.vue.js +60 -47
  71. package/components/PricingPlan/types.d.ts +5 -0
  72. package/components/Screen/Screen.vue.d.ts +0 -4
  73. package/components/Screen/Screen.vue.js +231 -189
  74. package/components/Screen/ScreenFilter.vue.js +73 -63
  75. package/components/Screen/types.d.ts +5 -0
  76. package/components/SidePanel.vue.d.ts +2 -0
  77. package/components/SidePanel.vue.js +140 -5
  78. package/components/SidePanel.vue2.js +2 -135
  79. package/components/SidebarMenu/SidebarMenuItem.vue.js +131 -130
  80. package/components/SidebarMenu/types.d.ts +1 -0
  81. package/components/Slider.vue.d.ts +1 -0
  82. package/components/Slider.vue.js +71 -69
  83. package/components/Switch.vue.d.ts +1 -0
  84. package/components/Switch.vue.js +23 -18
  85. package/components/Tabes/Tabes.vue.js +20 -19
  86. package/components/Tabes/types.d.ts +1 -0
  87. package/components/Textarea.vue.d.ts +1 -0
  88. package/components/Textarea.vue.js +18 -16
  89. package/components/ThemeToggle.vue.js +24 -14
  90. package/components/Timeline.vue.js +68 -82
  91. package/components/ToastNotification.vue.js +2 -2
  92. package/components/Tooltip.vue.d.ts +4 -3
  93. package/components/Tooltip.vue.js +17 -15
  94. package/components/Workbook/Sheet.vue.js +80 -71
  95. package/components/Workbook/WorkbookAddButton.vue.js +14 -10
  96. package/components/Workbook/types.d.ts +1 -0
  97. package/core/config.d.ts +2 -0
  98. package/index.d.ts +1 -0
  99. package/index.js +28 -26
  100. package/package.json +1 -1
  101. package/style.css +1 -2
  102. package/types/button.d.ts +1 -0
  103. package/types/config.type.d.ts +10 -0
  104. package/types/form.type.d.ts +2 -0
  105. package/types/styles.d.ts +3 -0
  106. package/types/timeline.type.d.ts +2 -0
  107. package/utils/i18n.d.ts +8 -0
  108. package/utils/i18n.js +5 -0
  109. package/utils/index.d.ts +1 -0
@@ -1,19 +1,20 @@
1
- import { defineComponent as q, ref as F, useSlots as H, computed as y, openBlock as r, createElementBlock as c, createElementVNode as n, renderSlot as J, normalizeClass as S, createBlock as x, withModifiers as D, createVNode as k, createTextVNode as Q, toDisplayString as A, createCommentVNode as w, Fragment as X, renderList as Y } from "vue";
2
- import g from "../Icon.vue.js";
3
- import $ from "../Button.vue.js";
4
- const Z = { class: "w-full" }, _ = ["multiple", "accept"], ee = ["value", "placeholder", "disabled"], le = { class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center gap-2 bg-background" }, te = { class: "p-3 bg-muted rounded-full text-muted-foreground" }, ae = { class: "space-y-1" }, ie = {
1
+ import { defineComponent as Y, computed as f, ref as S, useSlots as Z, openBlock as o, createElementBlock as c, createElementVNode as n, renderSlot as _, normalizeClass as C, createBlock as y, withModifiers as M, createVNode as V, toDisplayString as b, createTextVNode as ee, createCommentVNode as F, Fragment as le, renderList as te } from "vue";
2
+ import p from "../Icon.vue.js";
3
+ import P from "../Button.vue.js";
4
+ import { $t as k } from "../../utils/i18n.js";
5
+ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "placeholder", "disabled"], oe = { class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center gap-2 bg-background" }, se = { class: "p-3 bg-muted rounded-full text-muted-foreground" }, ne = { class: "space-y-1" }, de = { class: "text-sm font-medium text-foreground" }, ue = { class: "text-primary hover:underline" }, ce = {
5
6
  key: 0,
6
7
  class: "text-xs text-muted-foreground"
7
- }, oe = {
8
+ }, fe = {
8
9
  key: 1,
9
10
  class: "space-y-2"
10
- }, re = { class: "shrink-0 mr-3" }, se = { class: "p-2 bg-primary-light rounded text-primary-fg-light" }, ne = { class: "flex-1 min-w-0" }, de = { class: "text-sm font-medium text-foreground truncate" }, ue = { class: "text-xs text-muted-foreground" }, ce = { class: "flex-shrink-0 ml-3 flex gap-2" }, fe = {
11
+ }, me = { class: "shrink-0 mr-3" }, ge = { class: "p-2 bg-primary-light rounded text-primary-fg-light" }, pe = { class: "flex-1 min-w-0" }, he = { class: "text-sm font-medium text-foreground truncate" }, ve = { class: "text-xs text-muted-foreground" }, xe = { class: "flex-shrink-0 ml-3 flex gap-2" }, ye = {
11
12
  key: 0,
12
13
  class: "flex gap-2"
13
- }, me = {
14
+ }, be = {
14
15
  key: 2,
15
16
  class: "absolute inset-0 bg-white/60 backdrop-blur-[1px] flex items-center justify-center rounded-lg z-10"
16
- }, ge = { class: "bg-white p-2 rounded-full shadow-lg" }, ye = /* @__PURE__ */ q({
17
+ }, ke = { class: "bg-white p-2 rounded-full shadow-lg" }, Se = /* @__PURE__ */ Y({
17
18
  name: "FilePicker",
18
19
  __name: "FilePicker",
19
20
  props: {
@@ -27,20 +28,32 @@ const Z = { class: "w-full" }, _ = ["multiple", "accept"], ee = ["value", "place
27
28
  maxFiles: {},
28
29
  variant: { default: "dropzone" },
29
30
  placeholder: {},
31
+ placeholderI18n: {},
32
+ textI18n: {},
30
33
  size: { default: "md" },
31
34
  rounded: { default: "md" }
32
35
  },
33
36
  emits: ["update:modelValue", "change", "error"],
34
- setup(a, { emit: M }) {
35
- const e = a, d = M, C = F(null), h = F(!1), u = F(!1);
36
- H();
37
- const N = y(() => e.fileTypes.join(",")), V = y(() => Array.isArray(e.modelValue) ? e.modelValue.length > 0 : e.modelValue !== null), b = y(() => {
37
+ setup(i, { emit: $ }) {
38
+ const e = i, d = $, I = f(() => e.placeholderI18n ? k(e.placeholderI18n) : e.placeholder || "Select file..."), N = f(() => {
39
+ if (e.textI18n) return k(e.textI18n);
40
+ const l = k("vlite.filePicker.clickToUpload");
41
+ return l !== "vlite.filePicker.clickToUpload" ? l : "Click to upload";
42
+ }), j = f(() => {
43
+ const l = k("vlite.filePicker.dragAndDrop");
44
+ return l !== "vlite.filePicker.dragAndDrop" ? l : "or drag and drop";
45
+ }), L = f(() => {
46
+ const l = k("vlite.filePicker.addMore");
47
+ return l !== "vlite.filePicker.addMore" ? l : "Add more";
48
+ }), z = S(null), h = S(!1), u = S(!1);
49
+ Z();
50
+ const U = f(() => e.fileTypes.join(",")), A = f(() => Array.isArray(e.modelValue) ? e.modelValue.length > 0 : e.modelValue !== null), w = f(() => {
38
51
  let l = [];
39
52
  return Array.isArray(e.modelValue) ? l = e.modelValue : e.modelValue && (l = [e.modelValue]), l.map((t) => {
40
53
  if (typeof t == "string") {
41
- const o = t.split("/").pop() || "Unknown File";
54
+ const r = t.split("/").pop() || "Unknown File";
42
55
  return {
43
- fileName: decodeURIComponent(o),
56
+ fileName: decodeURIComponent(r),
44
57
  fileType: "unknown",
45
58
  fileSize: 0,
46
59
  file: null,
@@ -50,100 +63,100 @@ const Z = { class: "w-full" }, _ = ["multiple", "accept"], ee = ["value", "place
50
63
  }
51
64
  return t;
52
65
  });
53
- }), p = () => {
66
+ }), v = () => {
54
67
  if (!(e.disabled || e.loading || u.value)) {
55
68
  if (e.multiSelect && e.maxFiles && (Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0) >= e.maxFiles) {
56
69
  d("error", `Maximum ${e.maxFiles} files allowed`);
57
70
  return;
58
71
  }
59
- C.value?.click();
72
+ z.value?.click();
60
73
  }
61
- }, j = (l) => {
74
+ }, E = (l) => {
62
75
  l.preventDefault(), !(e.disabled || e.loading) && (h.value = !0);
63
- }, L = (l) => {
76
+ }, W = (l) => {
64
77
  l.preventDefault(), h.value = !1;
65
- }, I = (l) => {
66
- l.preventDefault(), h.value = !1, !(e.disabled || e.loading || u.value) && l.dataTransfer?.files && z(l.dataTransfer.files);
67
- }, P = (l) => {
78
+ }, R = (l) => {
79
+ l.preventDefault(), h.value = !1, !(e.disabled || e.loading || u.value) && l.dataTransfer?.files && D(l.dataTransfer.files);
80
+ }, O = (l) => {
68
81
  const t = l.target;
69
- t.files && z(t.files), t.value = "";
70
- }, E = (l) => {
82
+ t.files && D(t.files), t.value = "";
83
+ }, G = (l) => {
71
84
  if (l === 0 || !l) return "";
72
- const t = 1024, o = ["Bytes", "KB", "MB", "GB", "TB"], s = Math.floor(Math.log(l) / Math.log(t));
73
- return parseFloat((l / Math.pow(t, s)).toFixed(2)) + " " + o[s];
74
- }, U = (l) => new Promise((t, o) => {
85
+ const t = 1024, r = ["Bytes", "KB", "MB", "GB", "TB"], s = Math.floor(Math.log(l) / Math.log(t));
86
+ return parseFloat((l / Math.pow(t, s)).toFixed(2)) + " " + r[s];
87
+ }, K = (l) => new Promise((t, r) => {
75
88
  const s = new FileReader();
76
89
  s.readAsDataURL(l), s.onload = () => {
77
- typeof s.result == "string" ? t(s.result) : o(new Error("Failed to read file as base64"));
78
- }, s.onerror = (f) => o(f);
79
- }), z = async (l) => {
90
+ typeof s.result == "string" ? t(s.result) : r(new Error("Failed to read file as base64"));
91
+ }, s.onerror = (m) => r(m);
92
+ }), D = async (l) => {
80
93
  if (l.length === 0) return;
81
94
  u.value = !0;
82
- const t = [], o = [], s = Array.from(l);
83
- let f = e.multiSelect ? s : [s[0]];
95
+ const t = [], r = [], s = Array.from(l);
96
+ let m = e.multiSelect ? s : [s[0]];
84
97
  if (e.multiSelect && e.maxFiles) {
85
- const i = Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0, m = e.maxFiles - i;
86
- if (m <= 0) {
98
+ const a = Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0, g = e.maxFiles - a;
99
+ if (g <= 0) {
87
100
  d("error", `Maximum ${e.maxFiles} files allowed`), u.value = !1;
88
101
  return;
89
102
  }
90
- f.length > m && (o.push(`Only ${m} more file(s) allowed. Maximum ${e.maxFiles} files.`), f = f.slice(0, m));
103
+ m.length > g && (r.push(`Only ${g} more file(s) allowed. Maximum ${e.maxFiles} files.`), m = m.slice(0, g));
91
104
  }
92
105
  try {
93
- for (const i of f) {
94
- if (e.fileTypes.length > 0 && !e.fileTypes.some((v) => {
95
- if (v.startsWith("."))
96
- return i.name.toLowerCase().endsWith(v.toLowerCase());
97
- if (v.endsWith("/*")) {
98
- const K = v.split("/")[0];
99
- return i.type.startsWith(K);
106
+ for (const a of m) {
107
+ if (e.fileTypes.length > 0 && !e.fileTypes.some((x) => {
108
+ if (x.startsWith("."))
109
+ return a.name.toLowerCase().endsWith(x.toLowerCase());
110
+ if (x.endsWith("/*")) {
111
+ const X = x.split("/")[0];
112
+ return a.type.startsWith(X);
100
113
  }
101
- return i.type === v;
114
+ return a.type === x;
102
115
  })) {
103
- o.push(`File type not allowed: ${i.name}`);
116
+ r.push(`File type not allowed: ${a.name}`);
104
117
  continue;
105
118
  }
106
- let m = !1;
107
- e.maxSize && i.size > e.maxSize && (o.push(`File too large: ${i.name}`), m = !0);
119
+ let g = !1;
120
+ e.maxSize && a.size > e.maxSize && (r.push(`File too large: ${a.name}`), g = !0);
108
121
  let T = "";
109
- if (e.returnFormat === "base64" && !m)
122
+ if (e.returnFormat === "base64" && !g)
110
123
  try {
111
- T = await U(i);
124
+ T = await K(a);
112
125
  } catch (B) {
113
126
  console.error("Base64 read failed", B);
114
127
  }
115
128
  t.push({
116
- fileName: i.name,
117
- fileType: i.type,
118
- fileSize: i.size,
119
- file: i,
129
+ fileName: a.name,
130
+ fileType: a.type,
131
+ fileSize: a.size,
132
+ file: a,
120
133
  base64: T
121
134
  });
122
135
  }
123
- if (o.length > 0 && d("error", o.join("; ")), t.length > 0) {
124
- let i;
125
- e.multiSelect ? i = [...Array.isArray(e.modelValue) ? e.modelValue : e.modelValue ? [e.modelValue] : [], ...t] : i = t[0], d("update:modelValue", i), d("change", i);
136
+ if (r.length > 0 && d("error", r.join("; ")), t.length > 0) {
137
+ let a;
138
+ e.multiSelect ? a = [...Array.isArray(e.modelValue) ? e.modelValue : e.modelValue ? [e.modelValue] : [], ...t] : a = t[0], d("update:modelValue", a), d("change", a);
126
139
  }
127
- } catch (i) {
128
- console.error("Error processing files:", i), d("error", "Failed to process files");
140
+ } catch (a) {
141
+ console.error("Error processing files:", a), d("error", "Failed to process files");
129
142
  } finally {
130
143
  u.value = !1;
131
144
  }
132
- }, W = (l) => {
145
+ }, q = (l) => {
133
146
  if (!(e.disabled || e.loading))
134
147
  if (e.multiSelect && Array.isArray(e.modelValue)) {
135
148
  const t = [...e.modelValue];
136
149
  t.splice(l, 1), d("update:modelValue", t), d("change", t);
137
150
  } else
138
151
  d("update:modelValue", null), d("change", null);
139
- }, R = () => {
152
+ }, H = () => {
140
153
  e.disabled || e.loading || (d("update:modelValue", null), d("change", null));
141
- }, O = y(() => V.value ? b.value.map((t) => t.fileName).join(", ") : ""), G = y(() => {
154
+ }, J = f(() => A.value ? w.value.map((t) => t.fileName).join(", ") : ""), Q = f(() => {
142
155
  const l = "block w-full bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 transition-all focus-visible:outline-none cursor-pointer", t = {
143
156
  sm: "h-8 text-xs",
144
157
  md: "h-10 text-sm",
145
158
  lg: "h-12 text-base"
146
- }, o = {
159
+ }, r = {
147
160
  none: "rounded-none",
148
161
  sm: "rounded-sm",
149
162
  md: "rounded-md",
@@ -157,149 +170,149 @@ const Z = { class: "w-full" }, _ = ["multiple", "accept"], ee = ["value", "place
157
170
  "border border-input focus-visible:border-primary",
158
171
  // Default outline style
159
172
  t[e.size],
160
- o[e.rounded],
173
+ r[e.rounded],
161
174
  "pr-10",
162
175
  // Space for icon
163
176
  e.disabled ? "cursor-not-allowed opacity-50" : ""
164
177
  ].join(" ");
165
178
  });
166
- return (l, t) => (r(), c("div", Z, [
179
+ return (l, t) => (o(), c("div", ie, [
167
180
  n("input", {
168
181
  ref_key: "fileInput",
169
- ref: C,
182
+ ref: z,
170
183
  type: "file",
171
- multiple: a.multiSelect,
172
- accept: N.value,
184
+ multiple: i.multiSelect,
185
+ accept: U.value,
173
186
  class: "hidden",
174
- onChange: P
175
- }, null, 40, _),
176
- J(l.$slots, "trigger", {
177
- trigger: p,
187
+ onChange: O
188
+ }, null, 40, ae),
189
+ _(l.$slots, "trigger", {
190
+ trigger: v,
178
191
  isDragging: h.value,
179
- isLoading: a.loading || u.value,
180
- files: b.value
192
+ isLoading: i.loading || u.value,
193
+ files: w.value
181
194
  }, () => [
182
- a.variant === "input" ? (r(), c("div", {
195
+ i.variant === "input" ? (o(), c("div", {
183
196
  key: 0,
184
197
  class: "relative",
185
- onClick: p
198
+ onClick: v
186
199
  }, [
187
200
  n("input", {
188
201
  type: "text",
189
- value: O.value,
190
- placeholder: a.placeholder || "Select file...",
202
+ value: J.value,
203
+ placeholder: I.value,
191
204
  readonly: "",
192
- class: S(G.value),
193
- disabled: a.disabled || a.loading || u.value
194
- }, null, 10, ee),
195
- n("div", le, [
196
- a.loading || u.value ? (r(), x(g, {
205
+ class: C(Q.value),
206
+ disabled: i.disabled || i.loading || u.value
207
+ }, null, 10, re),
208
+ n("div", oe, [
209
+ i.loading || u.value ? (o(), y(p, {
197
210
  key: 0,
198
211
  icon: "lucide:loader-2",
199
212
  class: "h-4 w-4 animate-spin text-muted-foreground"
200
- })) : V.value && !a.disabled ? (r(), c("button", {
213
+ })) : A.value && !i.disabled ? (o(), c("button", {
201
214
  key: 1,
202
215
  type: "button",
203
216
  class: "text-muted-foreground hover:text-foreground focus:outline-none",
204
- onClick: D(R, ["stop"])
217
+ onClick: M(H, ["stop"])
205
218
  }, [
206
- k(g, {
219
+ V(p, {
207
220
  icon: "lucide:x-circle",
208
221
  class: "h-4 w-4"
209
222
  })
210
- ])) : (r(), x(g, {
223
+ ])) : (o(), y(p, {
211
224
  key: 2,
212
225
  icon: "lucide:upload",
213
226
  class: "h-4 w-4 text-muted-foreground"
214
227
  }))
215
228
  ])
216
- ])) : (r(), c("div", {
229
+ ])) : (o(), c("div", {
217
230
  key: 1,
218
231
  class: "relative",
219
- onDragover: j,
220
- onDragleave: L,
221
- onDrop: I
232
+ onDragover: E,
233
+ onDragleave: W,
234
+ onDrop: R
222
235
  }, [
223
- V.value ? (r(), c("div", oe, [
224
- (r(!0), c(X, null, Y(b.value, (o, s) => (r(), c("div", {
236
+ A.value ? (o(), c("div", fe, [
237
+ (o(!0), c(le, null, te(w.value, (r, s) => (o(), c("div", {
225
238
  key: s,
226
- class: S(["relative flex items-center p-3 border border-border rounded-lg bg-card shadow-sm transition-colors group", [!a.multiSelect && !a.disabled ? "cursor-pointer hover:border-primary/50" : ""]]),
227
- onClick: t[0] || (t[0] = (f) => !a.multiSelect && !a.disabled ? p() : null)
239
+ class: C(["relative flex items-center p-3 border border-border rounded-lg bg-card shadow-sm transition-colors group", [!i.multiSelect && !i.disabled ? "cursor-pointer hover:border-primary/50" : ""]]),
240
+ onClick: t[0] || (t[0] = (m) => !i.multiSelect && !i.disabled ? v() : null)
228
241
  }, [
229
- n("div", re, [
230
- n("div", se, [
231
- k(g, {
242
+ n("div", me, [
243
+ n("div", ge, [
244
+ V(p, {
232
245
  icon: "lucide:file-text",
233
246
  class: "w-5 h-5"
234
247
  })
235
248
  ])
236
249
  ]),
237
- n("div", ne, [
238
- n("p", de, A(o.fileName), 1),
239
- n("p", ue, A(E(o.fileSize)), 1)
250
+ n("div", pe, [
251
+ n("p", he, b(r.fileName), 1),
252
+ n("p", ve, b(G(r.fileSize)), 1)
240
253
  ]),
241
- n("div", ce, [
242
- !a.disabled && !a.loading ? (r(), x($, {
254
+ n("div", xe, [
255
+ !i.disabled && !i.loading ? (o(), y(P, {
243
256
  key: 0,
244
257
  size: "xs",
245
258
  variant: "ghost",
246
259
  icon: "lucide:x",
247
260
  rounded: "full",
248
261
  class: "text-muted-foreground hover:text-destructive hover:bg-destructive/10",
249
- onClick: D((f) => W(s), ["stop"])
250
- }, null, 8, ["onClick"])) : w("", !0)
262
+ onClick: M((m) => q(s), ["stop"])
263
+ }, null, 8, ["onClick"])) : F("", !0)
251
264
  ])
252
265
  ], 2))), 128)),
253
- a.multiSelect && (!a.maxFiles || b.value.length < a.maxFiles) ? (r(), c("div", fe, [
254
- k($, {
266
+ i.multiSelect && (!i.maxFiles || w.value.length < i.maxFiles) ? (o(), c("div", ye, [
267
+ V(P, {
255
268
  size: "sm",
256
269
  variant: "outline",
257
270
  icon: "lucide:plus",
258
- text: "Add more",
259
- disabled: a.disabled || a.loading || u.value,
260
- onClick: p
261
- }, null, 8, ["disabled"])
262
- ])) : w("", !0)
263
- ])) : (r(), c("div", {
271
+ text: L.value,
272
+ disabled: i.disabled || i.loading || u.value,
273
+ onClick: v
274
+ }, null, 8, ["text", "disabled"])
275
+ ])) : F("", !0)
276
+ ])) : (o(), c("div", {
264
277
  key: 0,
265
- class: S(["border-2 border-dashed border-border rounded-lg p-6 transition-all duration-200 ease-in-out cursor-pointer flex flex-col items-center justify-center text-center gap-2", [
278
+ class: C(["border-2 border-dashed border-border rounded-lg p-6 transition-all duration-200 ease-in-out cursor-pointer flex flex-col items-center justify-center text-center gap-2", [
266
279
  h.value ? "border-primary bg-primary/5" : "hover:border-primary/50 hover:bg-muted/50",
267
- a.disabled || a.loading || u.value ? "opacity-50 cursor-not-allowed" : ""
280
+ i.disabled || i.loading || u.value ? "opacity-50 cursor-not-allowed" : ""
268
281
  ]]),
269
- onClick: p
282
+ onClick: v
270
283
  }, [
271
- n("div", te, [
272
- a.loading || u.value ? (r(), x(g, {
284
+ n("div", se, [
285
+ i.loading || u.value ? (o(), y(p, {
273
286
  key: 0,
274
287
  icon: "lucide:loader-2",
275
288
  class: "w-6 h-6 animate-spin"
276
- })) : (r(), x(g, {
289
+ })) : (o(), y(p, {
277
290
  key: 1,
278
291
  icon: "lucide:upload-cloud",
279
292
  class: "w-6 h-6"
280
293
  }))
281
294
  ]),
282
- n("div", ae, [
283
- t[1] || (t[1] = n("p", { class: "text-sm font-medium text-foreground" }, [
284
- n("span", { class: "text-primary hover:underline" }, "Click to upload"),
285
- Q(" or drag and drop ")
286
- ], -1)),
287
- a.fileTypes.length ? (r(), c("p", ie, A(a.fileTypes.join(", ")), 1)) : w("", !0)
295
+ n("div", ne, [
296
+ n("p", de, [
297
+ n("span", ue, b(N.value), 1),
298
+ ee(" " + b(j.value), 1)
299
+ ]),
300
+ i.fileTypes.length ? (o(), c("p", ce, b(i.fileTypes.join(", ")), 1)) : F("", !0)
288
301
  ])
289
302
  ], 2)),
290
- a.loading || u.value ? (r(), c("div", me, [
291
- n("div", ge, [
292
- k(g, {
303
+ i.loading || u.value ? (o(), c("div", be, [
304
+ n("div", ke, [
305
+ V(p, {
293
306
  icon: "lucide:loader-2",
294
307
  class: "w-6 h-6 animate-spin text-primary"
295
308
  })
296
309
  ])
297
- ])) : w("", !0)
310
+ ])) : F("", !0)
298
311
  ], 32))
299
312
  ])
300
313
  ]));
301
314
  }
302
315
  });
303
316
  export {
304
- ye as default
317
+ Se as default
305
318
  };
@@ -1,9 +1,10 @@
1
- import { defineComponent as N, ref as g, watch as E, computed as w, openBlock as p, createElementBlock as S, normalizeClass as T, Fragment as q, renderList as Q, createBlock as V } from "vue";
2
- import F from "./FileTreeNode.vue.js";
3
- const z = {
1
+ import { defineComponent as N, ref as p, watch as E, computed as y, openBlock as g, createElementBlock as S, normalizeClass as q, Fragment as Q, renderList as V, createBlock as F, toDisplayString as $ } from "vue";
2
+ import z from "./FileTreeNode.vue.js";
3
+ import { $t as k } from "../../utils/i18n.js";
4
+ const A = {
4
5
  key: 1,
5
6
  class: "text-sm text-muted-foreground p-4 text-center"
6
- }, $ = /* @__PURE__ */ N({
7
+ }, J = /* @__PURE__ */ N({
7
8
  __name: "FileTree",
8
9
  props: {
9
10
  modelValue: { default: () => [] },
@@ -14,126 +15,135 @@ const z = {
14
15
  loadData: {},
15
16
  highlightSearch: { type: Boolean, default: !1 },
16
17
  searchQuery: {},
17
- class: {}
18
+ class: {},
19
+ emptyText: {},
20
+ emptyTextI18n: {}
18
21
  },
19
22
  emits: ["update:modelValue", "select", "expand", "node-click"],
20
23
  setup(h, { emit: C }) {
21
- const l = h, f = C, u = g(new Set(l.defaultExpandedKeys)), y = g(/* @__PURE__ */ new Set()), m = g(/* @__PURE__ */ new Map()), k = g(/* @__PURE__ */ new Map()), M = (t, a) => {
24
+ const l = h, f = C, u = p(new Set(l.defaultExpandedKeys)), v = p(/* @__PURE__ */ new Set()), m = p(/* @__PURE__ */ new Map()), x = p(/* @__PURE__ */ new Map()), M = (t, a) => {
22
25
  for (const e of t)
23
- m.value.set(e.id, e), a && k.value.set(e.id, a), e.children && M(e.children, e.id);
26
+ m.value.set(e.id, e), a && x.value.set(e.id, a), e.children && M(e.children, e.id);
24
27
  };
25
28
  E(
26
29
  () => l.data,
27
30
  (t) => {
28
- m.value.clear(), k.value.clear(), M(t);
31
+ m.value.clear(), x.value.clear(), M(t);
29
32
  },
30
33
  { immediate: !0, deep: !0 }
31
34
  );
32
- const v = (t) => {
35
+ const b = (t) => {
33
36
  let a = [];
34
37
  if (t.children)
35
38
  for (const e of t.children)
36
- a.push(e.id), a = a.concat(v(e));
39
+ a.push(e.id), a = a.concat(b(e));
37
40
  return a;
38
- }, x = w(() => new Set(l.modelValue)), K = w(() => {
41
+ }, w = y(() => new Set(l.modelValue)), L = y(() => {
39
42
  const t = /* @__PURE__ */ new Set();
40
43
  if (l.selectionMode !== "multiple") return t;
41
44
  const a = (e) => {
42
45
  if (!e.children || e.children.length === 0)
43
- return x.value.has(e.id) ? { status: "checked" } : { status: "unchecked" };
44
- let c = !1, s = !1, i = !1;
45
- for (const d of e.children) {
46
- const n = a(d);
47
- n.status === "checked" && (c = !0), n.status === "unchecked" && (s = !0), n.status === "indeterminate" && (i = !0);
46
+ return w.value.has(e.id) ? { status: "checked" } : { status: "unchecked" };
47
+ let n = !1, s = !1, i = !1;
48
+ for (const r of e.children) {
49
+ const c = a(r);
50
+ c.status === "checked" && (n = !0), c.status === "unchecked" && (s = !0), c.status === "indeterminate" && (i = !0);
48
51
  }
49
- return i || c && s ? (t.add(e.id), { status: "indeterminate" }) : c ? { status: "checked" } : { status: "unchecked" };
52
+ return i || n && s ? (t.add(e.id), { status: "indeterminate" }) : n ? { status: "checked" } : { status: "unchecked" };
50
53
  };
51
54
  return l.data.forEach(a), t;
52
- }), L = async (t) => {
55
+ }), I = async (t) => {
53
56
  if (t.disabled) return;
54
57
  if (u.value.has(t.id)) {
55
58
  u.value.delete(t.id);
56
59
  const e = m.value.get(t.id) || t;
57
- v(e).forEach((s) => u.value.delete(s)), f("expand", t, !1);
60
+ b(e).forEach((s) => u.value.delete(s)), f("expand", t, !1);
58
61
  } else if (u.value.add(t.id), f("expand", t, !0), l.loadData && !t.isLoaded && (!t.children || t.children.length === 0)) {
59
- y.value.add(t.id);
62
+ v.value.add(t.id);
60
63
  try {
61
64
  await l.loadData(t);
62
65
  } finally {
63
- y.value.delete(t.id);
66
+ v.value.delete(t.id);
64
67
  }
65
68
  }
66
- }, B = (t) => {
69
+ }, D = (t) => {
67
70
  if (t.disabled) return;
68
71
  const a = m.value.get(t.id) || t;
69
- let e = new Set(x.value);
70
- const c = e.has(t.id);
72
+ let e = new Set(w.value);
73
+ const n = e.has(t.id);
71
74
  if (l.selectionMode === "single")
72
- e.clear(), c || e.add(t.id);
75
+ e.clear(), n || e.add(t.id);
73
76
  else if (l.selectionMode === "multiple") {
74
- const s = v(a), i = !c, d = (o, r) => {
75
- r ? e.add(o) : e.delete(o);
77
+ const s = b(a), i = !n, r = (d, o) => {
78
+ o ? e.add(d) : e.delete(d);
76
79
  };
77
- d(t.id, i), s.forEach((o) => d(o, i));
78
- let n = a;
80
+ r(t.id, i), s.forEach((d) => r(d, i));
81
+ let c = a;
79
82
  for (; ; ) {
80
- const o = k.value.get(n.id);
81
- if (!o) break;
82
- const r = m.value.get(o);
83
- if (!r || !r.children) break;
84
- r.children.every((D) => e.has(D.id)) ? e.add(r.id) : e.delete(r.id), n = r;
83
+ const d = x.value.get(c.id);
84
+ if (!d) break;
85
+ const o = m.value.get(d);
86
+ if (!o || !o.children) break;
87
+ o.children.every((B) => e.has(B.id)) ? e.add(o.id) : e.delete(o.id), c = o;
85
88
  }
86
89
  }
87
- f("update:modelValue", Array.from(e)), f("select", a, !c);
88
- }, b = w(() => {
90
+ f("update:modelValue", Array.from(e)), f("select", a, !n);
91
+ }, T = y(() => {
89
92
  if (!l.searchQuery) return l.data;
90
93
  const t = l.searchQuery.toLowerCase(), a = (e) => {
91
- const c = e.label.toLowerCase().includes(t), s = !!e.searchMatch;
92
- let i = [];
93
- return e.children && (i = e.children.map(a).filter((d) => d !== null)), c || s || i.length > 0 ? {
94
+ const s = (e.labelI18n ? k(e.labelI18n) : e.label).toLowerCase().includes(t), i = !!e.searchMatch;
95
+ let r = [];
96
+ return e.children && (r = e.children.map(a).filter((c) => c !== null)), s || i || r.length > 0 ? {
94
97
  ...e,
95
- children: i
98
+ children: r
96
99
  } : null;
97
100
  };
98
101
  return l.data.map(a).filter((e) => e !== null);
99
102
  });
100
- return E(
103
+ E(
101
104
  () => [l.searchQuery, l.data],
102
105
  ([t]) => {
103
106
  if (t) {
104
- const a = t.toLowerCase(), e = /* @__PURE__ */ new Set(), c = (s) => {
107
+ const a = t.toLowerCase(), e = /* @__PURE__ */ new Set(), n = (s) => {
105
108
  let i = !1;
106
109
  if (s.children)
107
- for (const n of s.children)
108
- c(n) && (i = !0);
109
- const d = s.label.toLowerCase().includes(a) || !!s.searchMatch;
110
- return i && e.add(s.id), d || i;
110
+ for (const d of s.children)
111
+ n(d) && (i = !0);
112
+ const c = (s.labelI18n ? k(s.labelI18n) : s.label).toLowerCase().includes(a) || !!s.searchMatch;
113
+ return i && e.add(s.id), c || i;
111
114
  };
112
- l.data.forEach(c), e.forEach((s) => u.value.add(s));
115
+ l.data.forEach(n), e.forEach((s) => u.value.add(s));
113
116
  }
114
117
  },
115
118
  { deep: !0 }
116
- ), (t, a) => (p(), S("div", {
117
- class: T(["w-full h-full overflow-y-auto", l.class])
119
+ );
120
+ const K = y(() => {
121
+ if (l.emptyTextI18n) return k(l.emptyTextI18n);
122
+ if (l.emptyText) return l.emptyText;
123
+ const t = k("vlite.fileTree.emptyText");
124
+ return t !== "vlite.fileTree.emptyText" ? t : "No results found.";
125
+ });
126
+ return (t, a) => (g(), S("div", {
127
+ class: q(["w-full h-full overflow-y-auto", l.class])
118
128
  }, [
119
- b.value.length > 0 ? (p(!0), S(q, { key: 0 }, Q(b.value, (e) => (p(), V(F, {
129
+ T.value.length > 0 ? (g(!0), S(Q, { key: 0 }, V(T.value, (e) => (g(), F(z, {
120
130
  key: e.id,
121
131
  node: e,
122
132
  "selection-mode": h.selectionMode,
123
- "selected-keys": x.value,
133
+ "selected-keys": w.value,
124
134
  "expanded-keys": u.value,
125
- "indeterminate-keys": K.value,
126
- "loading-keys": y.value,
135
+ "indeterminate-keys": L.value,
136
+ "loading-keys": v.value,
127
137
  "show-checkboxes": h.showCheckboxes,
128
138
  "highlight-search": h.highlightSearch,
129
139
  "search-query": h.searchQuery,
130
- onToggleExpand: L,
131
- onToggleSelect: B,
132
- onClickNode: a[0] || (a[0] = (c) => f("node-click", c))
133
- }, null, 8, ["node", "selection-mode", "selected-keys", "expanded-keys", "indeterminate-keys", "loading-keys", "show-checkboxes", "highlight-search", "search-query"]))), 128)) : (p(), S("div", z, "No results found."))
140
+ onToggleExpand: I,
141
+ onToggleSelect: D,
142
+ onClickNode: a[0] || (a[0] = (n) => f("node-click", n))
143
+ }, null, 8, ["node", "selection-mode", "selected-keys", "expanded-keys", "indeterminate-keys", "loading-keys", "show-checkboxes", "highlight-search", "search-query"]))), 128)) : (g(), S("div", A, $(K.value), 1))
134
144
  ], 2));
135
145
  }
136
146
  });
137
147
  export {
138
- $ as default
148
+ J as default
139
149
  };