vlite3 0.8.11 → 0.9.2

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 (84) hide show
  1. package/components/AttachmentsList/AttachmentsList.vue.d.ts +6 -0
  2. package/components/AttachmentsList/AttachmentsList.vue.js +82 -0
  3. package/components/AttachmentsList/AttachmentsList.vue2.js +4 -0
  4. package/components/AttachmentsList/index.d.ts +2 -0
  5. package/components/AttachmentsList/types.d.ts +11 -0
  6. package/components/Button.vue.js +6 -6
  7. package/components/Chat/ChatBubble.vue.d.ts +18 -0
  8. package/components/Chat/ChatInterface.vue.d.ts +45 -0
  9. package/components/Chat/index.d.ts +2 -0
  10. package/components/DataList/DataList.vue.d.ts +1 -1
  11. package/components/DataTable/DataTable.vue.d.ts +3 -3
  12. package/components/DataTable/DataTable.vue.js +22 -22
  13. package/components/DataTable/types.d.ts +1 -1
  14. package/components/DatePicker.vue.d.ts +3 -2
  15. package/components/DatePicker.vue.js +1 -1
  16. package/components/Dropdown/Dropdown.vue.d.ts +2 -0
  17. package/components/Dropdown/Dropdown.vue.js +106 -90
  18. package/components/Dropdown/DropdownItem.vue.js +8 -8
  19. package/components/Dropdown/DropdownMenu.vue.js +2 -2
  20. package/components/Dropdown/DropdownMenu.vue2.js +1 -1
  21. package/components/ExportData/ExportData.vue.d.ts +1 -1
  22. package/components/FilePicker/FilePicker.vue.d.ts +4 -1
  23. package/components/FilePicker/FilePicker.vue.js +189 -139
  24. package/components/FilePreview/FilePreview.vue.d.ts +5 -0
  25. package/components/FilePreview/FilePreview.vue.js +27 -0
  26. package/components/FilePreview/FilePreview.vue2.js +4 -0
  27. package/components/FilePreview/index.d.ts +2 -0
  28. package/components/FilePreview/types.d.ts +5 -0
  29. package/components/Form/FormField.vue.js +3 -1
  30. package/components/Form/composables/useForm.js +50 -47
  31. package/components/Input.vue.d.ts +1 -0
  32. package/components/Input.vue.js +18 -15
  33. package/components/Modal.vue.js +2 -2
  34. package/components/Modal.vue2.js +31 -31
  35. package/components/MultiSelect/MultiSelect.vue.js +92 -84
  36. package/components/Navbar/Navbar.vue.js +61 -60
  37. package/components/Screen/Screen.vue.d.ts +200 -7
  38. package/components/Screen/Screen.vue.js +306 -502
  39. package/components/Screen/ScreenFilter.vue.js +45 -42
  40. package/components/Screen/components/ScreenAddAction.vue.d.ts +15 -0
  41. package/components/Screen/components/ScreenAddAction.vue.js +107 -0
  42. package/components/Screen/components/ScreenAddAction.vue2.js +4 -0
  43. package/components/Screen/components/ScreenEmptyState.vue.d.ts +14 -0
  44. package/components/Screen/components/ScreenEmptyState.vue.js +105 -0
  45. package/components/Screen/components/ScreenEmptyState.vue2.js +4 -0
  46. package/components/Screen/components/ScreenExportModal.vue.d.ts +49 -0
  47. package/components/Screen/components/ScreenExportModal.vue.js +83 -0
  48. package/components/Screen/components/ScreenExportModal.vue2.js +4 -0
  49. package/components/Screen/components/ScreenHeaderTitle.vue.d.ts +28 -0
  50. package/components/Screen/components/ScreenHeaderTitle.vue.js +57 -0
  51. package/components/Screen/components/ScreenHeaderTitle.vue2.js +4 -0
  52. package/components/Screen/components/ScreenOptionsDropdown.vue.d.ts +10 -0
  53. package/components/Screen/components/ScreenOptionsDropdown.vue.js +43 -0
  54. package/components/Screen/components/ScreenOptionsDropdown.vue2.js +4 -0
  55. package/components/Screen/components/ScreenQuickFilters.vue.d.ts +15 -0
  56. package/components/Screen/components/ScreenQuickFilters.vue.js +36 -0
  57. package/components/Screen/components/ScreenQuickFilters.vue2.js +4 -0
  58. package/components/Screen/components/ScreenViewToggle.vue.d.ts +9 -0
  59. package/components/Screen/components/ScreenViewToggle.vue.js +48 -0
  60. package/components/Screen/components/ScreenViewToggle.vue2.js +4 -0
  61. package/components/Screen/index.d.ts +1 -0
  62. package/components/Screen/types.d.ts +41 -2
  63. package/components/SidePanel.vue.js +1 -1
  64. package/components/SidePanel.vue2.js +7 -7
  65. package/components/SidebarMenu/SidebarMenu.vue.js +1 -1
  66. package/components/Stats/Stats.vue.js +50 -49
  67. package/components/StatusChip/StatusChip.vue.d.ts +2 -2
  68. package/components/StatusChip/StatusChip.vue.js +15 -14
  69. package/components/StatusChip/status-map.d.ts +2 -1
  70. package/components/StatusChip/status-map.js +16 -6
  71. package/components/Tabes/Tabes.vue.d.ts +1 -1
  72. package/components/Tabes/Tabes.vue.js +5 -143
  73. package/components/Tabes/Tabes.vue2.js +144 -2
  74. package/components/Timeline/TimelineIndicator.vue.js +6 -6
  75. package/components/Workbook/Sheet.vue.d.ts +1 -1
  76. package/core/config.d.ts +8 -0
  77. package/core/config.js +10 -6
  78. package/core/index.js +28 -20
  79. package/index.d.ts +2 -0
  80. package/index.js +209 -203
  81. package/package.json +3 -2
  82. package/style.css +80 -6
  83. package/types/config.type.d.ts +10 -0
  84. package/types/form.type.d.ts +1 -0
@@ -1,20 +1,26 @@
1
- import { defineComponent as Y, computed as f, ref as S, useSlots as Z, openBlock as r, createElementBlock as c, createElementVNode as n, renderSlot as _, normalizeClass as C, createBlock as x, withModifiers as M, createVNode as w, toDisplayString as b, createTextVNode as ee, createCommentVNode as F, Fragment as le, renderList as te } from "vue";
1
+ import { defineComponent as Z, computed as m, ref as C, useSlots as _, openBlock as a, createElementBlock as u, createElementVNode as s, renderSlot as ee, normalizeClass as T, createBlock as b, withModifiers as F, createVNode as k, toDisplayString as h, createTextVNode as le, createCommentVNode as S, Fragment as te, renderList as ie } from "vue";
2
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" }, oe = ["multiple", "accept"], ae = ["value", "placeholder", "disabled"], re = { 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 = {
3
+ import N from "../Button.vue.js";
4
+ import { $t as w } from "../../utils/i18n.js";
5
+ const oe = { class: "w-full" }, re = ["multiple", "accept"], ae = ["value", "placeholder", "disabled"], se = { class: "absolute right-3 top-1/2 -translate-y-1/2 flex items-center justify-center gap-2 bg-background" }, ne = { class: "p-3 bg-muted rounded-full text-muted-foreground" }, de = { class: "space-y-1" }, ue = { class: "text-sm font-medium text-foreground" }, ce = { class: "text-primary hover:underline" }, fe = {
6
6
  key: 0,
7
7
  class: "text-xs text-muted-foreground"
8
- }, fe = {
8
+ }, me = {
9
9
  key: 1,
10
10
  class: "space-y-2"
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" }, ye = { class: "flex-shrink-0 ml-3 flex gap-2" }, xe = {
11
+ }, ge = { class: "shrink-0 mr-3" }, pe = { class: "p-2 bg-primary-light rounded text-primary-fg-light" }, he = { class: "flex-1 min-w-0 flex flex-col items-start overflow-hidden" }, ve = {
12
+ key: 0,
13
+ class: "inline-flex items-center group/rename w-fit max-w-full mb-0.5"
14
+ }, ye = { class: "grid relative w-fit max-w-full items-center -ml-1" }, xe = { class: "invisible whitespace-pre col-start-1 row-start-1 text-sm font-medium px-1 py-0.5 max-w-full overflow-hidden text-ellipsis" }, be = ["value", "onInput"], ke = {
15
+ key: 1,
16
+ class: "text-sm font-medium text-foreground truncate w-full"
17
+ }, we = { class: "text-xs text-muted-foreground" }, Ve = { class: "flex-shrink-0 ml-3 flex gap-2" }, Fe = {
12
18
  key: 0,
13
19
  class: "flex gap-2"
14
- }, be = {
20
+ }, Se = {
15
21
  key: 2,
16
22
  class: "absolute inset-0 bg-white/80 flex items-center justify-center rounded-lg z-10"
17
- }, ke = { class: "bg-white p-2 rounded-full" }, Se = /* @__PURE__ */ Y({
23
+ }, Ae = { class: "bg-white p-2 rounded-full" }, Be = /* @__PURE__ */ Z({
18
24
  name: "FilePicker",
19
25
  __name: "FilePicker",
20
26
  props: {
@@ -31,31 +37,32 @@ const ie = { class: "w-full" }, oe = ["multiple", "accept"], ae = ["value", "pla
31
37
  placeholderI18n: {},
32
38
  textI18n: {},
33
39
  size: { default: "md" },
34
- rounded: { default: "md" }
40
+ rounded: { default: "md" },
41
+ allowRename: { type: Boolean, default: !1 }
35
42
  },
36
43
  emits: ["update:modelValue", "change", "error"],
37
- setup(i, { emit: $ }) {
38
- const e = i, d = $, I = f(
39
- () => e.placeholderI18n ? k(e.placeholderI18n) : e.placeholder !== void 0 ? e.placeholder : "Select file..."
40
- ), N = f(() => {
41
- if (e.textI18n) return k(e.textI18n);
42
- const l = k("vlite.filePicker.clickToUpload");
44
+ setup(o, { emit: M }) {
45
+ const e = o, d = M, P = m(
46
+ () => e.placeholderI18n ? w(e.placeholderI18n) : e.placeholder !== void 0 ? e.placeholder : "Select file..."
47
+ ), $ = m(() => {
48
+ if (e.textI18n) return w(e.textI18n);
49
+ const l = w("vlite.filePicker.clickToUpload");
43
50
  return l !== "vlite.filePicker.clickToUpload" ? l : "Click to upload";
44
- }), j = f(() => {
45
- const l = k("vlite.filePicker.dragAndDrop");
51
+ }), j = m(() => {
52
+ const l = w("vlite.filePicker.dragAndDrop");
46
53
  return l !== "vlite.filePicker.dragAndDrop" ? l : "or drag and drop";
47
- }), L = f(() => {
48
- const l = k("vlite.filePicker.addMore");
54
+ }), U = m(() => {
55
+ const l = w("vlite.filePicker.addMore");
49
56
  return l !== "vlite.filePicker.addMore" ? l : "Add more";
50
- }), z = S(null), h = S(!1), u = S(!1);
51
- Z();
52
- const U = f(() => e.fileTypes.join(",")), A = f(() => Array.isArray(e.modelValue) ? e.modelValue.length > 0 : e.modelValue !== null), V = f(() => {
57
+ }), z = C(null), v = C(!1), c = C(!1);
58
+ _();
59
+ const E = m(() => e.fileTypes.join(",")), A = m(() => Array.isArray(e.modelValue) ? e.modelValue.length > 0 : e.modelValue !== null), V = m(() => {
53
60
  let l = [];
54
61
  return Array.isArray(e.modelValue) ? l = e.modelValue : e.modelValue && (l = [e.modelValue]), l.map((t) => {
55
62
  if (typeof t == "string") {
56
- const a = t.split("/").pop() || "Unknown File";
63
+ const i = t.split("/").pop() || "Unknown File";
57
64
  return {
58
- fileName: decodeURIComponent(a),
65
+ fileName: decodeURIComponent(i),
59
66
  fileType: "unknown",
60
67
  fileSize: 0,
61
68
  file: null,
@@ -65,86 +72,86 @@ const ie = { class: "w-full" }, oe = ["multiple", "accept"], ae = ["value", "pla
65
72
  }
66
73
  return t;
67
74
  });
68
- }), v = () => {
69
- if (!(e.disabled || e.loading || u.value)) {
75
+ }), y = () => {
76
+ if (!(e.disabled || e.loading || c.value)) {
70
77
  if (e.multiSelect && e.maxFiles && (Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0) >= e.maxFiles) {
71
78
  d("error", `Maximum ${e.maxFiles} files allowed`);
72
79
  return;
73
80
  }
74
81
  z.value?.click();
75
82
  }
76
- }, E = (l) => {
77
- l.preventDefault(), !(e.disabled || e.loading) && (h.value = !0);
78
- }, W = (l) => {
79
- l.preventDefault(), h.value = !1;
83
+ }, L = (l) => {
84
+ l.preventDefault(), !(e.disabled || e.loading) && (v.value = !0);
80
85
  }, R = (l) => {
81
- l.preventDefault(), h.value = !1, !(e.disabled || e.loading || u.value) && l.dataTransfer?.files && D(l.dataTransfer.files);
86
+ l.preventDefault(), v.value = !1;
87
+ }, W = (l) => {
88
+ l.preventDefault(), v.value = !1, !(e.disabled || e.loading || c.value) && l.dataTransfer?.files && D(l.dataTransfer.files);
82
89
  }, O = (l) => {
83
90
  const t = l.target;
84
91
  t.files && D(t.files), t.value = "";
85
- }, G = (l) => {
92
+ }, q = (l) => {
86
93
  if (l === 0 || !l) return "";
87
- const t = 1024, a = ["Bytes", "KB", "MB", "GB", "TB"], s = Math.floor(Math.log(l) / Math.log(t));
88
- return parseFloat((l / Math.pow(t, s)).toFixed(2)) + " " + a[s];
89
- }, K = (l) => new Promise((t, a) => {
90
- const s = new FileReader();
91
- s.readAsDataURL(l), s.onload = () => {
92
- typeof s.result == "string" ? t(s.result) : a(new Error("Failed to read file as base64"));
93
- }, s.onerror = (m) => a(m);
94
+ const t = 1024, i = ["Bytes", "KB", "MB", "GB", "TB"], n = Math.floor(Math.log(l) / Math.log(t));
95
+ return parseFloat((l / Math.pow(t, n)).toFixed(2)) + " " + i[n];
96
+ }, G = (l) => new Promise((t, i) => {
97
+ const n = new FileReader();
98
+ n.readAsDataURL(l), n.onload = () => {
99
+ typeof n.result == "string" ? t(n.result) : i(new Error("Failed to read file as base64"));
100
+ }, n.onerror = (f) => i(f);
94
101
  }), D = async (l) => {
95
102
  if (l.length === 0) return;
96
- u.value = !0;
97
- const t = [], a = [], s = Array.from(l);
98
- let m = e.multiSelect ? s : [s[0]];
103
+ c.value = !0;
104
+ const t = [], i = [], n = Array.from(l);
105
+ let f = e.multiSelect ? n : [n[0]];
99
106
  if (e.multiSelect && e.maxFiles) {
100
- const o = Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0, g = e.maxFiles - o;
107
+ const r = Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0, g = e.maxFiles - r;
101
108
  if (g <= 0) {
102
- d("error", `Maximum ${e.maxFiles} files allowed`), u.value = !1;
109
+ d("error", `Maximum ${e.maxFiles} files allowed`), c.value = !1;
103
110
  return;
104
111
  }
105
- m.length > g && (a.push(`Only ${g} more file(s) allowed. Maximum ${e.maxFiles} files.`), m = m.slice(0, g));
112
+ f.length > g && (i.push(`Only ${g} more file(s) allowed. Maximum ${e.maxFiles} files.`), f = f.slice(0, g));
106
113
  }
107
114
  try {
108
- for (const o of m) {
109
- if (e.fileTypes.length > 0 && !e.fileTypes.some((y) => {
110
- if (y.startsWith("."))
111
- return o.name.toLowerCase().endsWith(y.toLowerCase());
112
- if (y.endsWith("/*")) {
113
- const X = y.split("/")[0];
114
- return o.type.startsWith(X);
115
+ for (const r of f) {
116
+ if (e.fileTypes.length > 0 && !e.fileTypes.some((x) => {
117
+ if (x.startsWith("."))
118
+ return r.name.toLowerCase().endsWith(x.toLowerCase());
119
+ if (x.endsWith("/*")) {
120
+ const Y = x.split("/")[0];
121
+ return r.type.startsWith(Y);
115
122
  }
116
- return o.type === y;
123
+ return r.type === x;
117
124
  })) {
118
- a.push(`File type not allowed: ${o.name}`);
125
+ i.push(`File type not allowed: ${r.name}`);
119
126
  continue;
120
127
  }
121
128
  let g = !1;
122
- e.maxSize && o.size > e.maxSize && (a.push(`File too large: ${o.name}`), g = !0);
123
- let T = "";
129
+ e.maxSize && r.size > e.maxSize && (i.push(`File too large: ${r.name}`), g = !0);
130
+ let B = "";
124
131
  if (e.returnFormat === "base64" && !g)
125
132
  try {
126
- T = await K(o);
127
- } catch (B) {
128
- console.error("Base64 read failed", B);
133
+ B = await G(r);
134
+ } catch (I) {
135
+ console.error("Base64 read failed", I);
129
136
  }
130
137
  t.push({
131
- fileName: o.name,
132
- fileType: o.type,
133
- fileSize: o.size,
134
- file: o,
135
- base64: T
138
+ fileName: r.name,
139
+ fileType: r.type,
140
+ fileSize: r.size,
141
+ file: r,
142
+ base64: B
136
143
  });
137
144
  }
138
- if (a.length > 0 && d("error", a.join("; ")), t.length > 0) {
139
- let o;
140
- e.multiSelect ? o = [...Array.isArray(e.modelValue) ? e.modelValue : e.modelValue ? [e.modelValue] : [], ...t] : o = t[0], d("update:modelValue", o), d("change", o);
145
+ if (i.length > 0 && d("error", i.join("; ")), t.length > 0) {
146
+ let r;
147
+ e.multiSelect ? r = [...Array.isArray(e.modelValue) ? e.modelValue : e.modelValue ? [e.modelValue] : [], ...t] : r = t[0], d("update:modelValue", r), d("change", r);
141
148
  }
142
- } catch (o) {
143
- console.error("Error processing files:", o), d("error", "Failed to process files");
149
+ } catch (r) {
150
+ console.error("Error processing files:", r), d("error", "Failed to process files");
144
151
  } finally {
145
- u.value = !1;
152
+ c.value = !1;
146
153
  }
147
- }, q = (l) => {
154
+ }, K = (l) => {
148
155
  if (!(e.disabled || e.loading))
149
156
  if (e.multiSelect && Array.isArray(e.modelValue)) {
150
157
  const t = [...e.modelValue];
@@ -153,12 +160,30 @@ const ie = { class: "w-full" }, oe = ["multiple", "accept"], ae = ["value", "pla
153
160
  d("update:modelValue", null), d("change", null);
154
161
  }, H = () => {
155
162
  e.disabled || e.loading || (d("update:modelValue", null), d("change", null));
156
- }, J = f(() => A.value ? V.value.map((t) => t.fileName).join(", ") : ""), Q = f(() => {
163
+ }, J = (l, t) => {
164
+ if (e.disabled || e.loading) return;
165
+ let i;
166
+ e.multiSelect && Array.isArray(e.modelValue) ? (i = [...e.modelValue], typeof i[l] == "object" && i[l] !== null ? i[l] = { ...i[l], fileName: t } : typeof i[l] == "string" && (i[l] = {
167
+ fileName: t,
168
+ fileType: "unknown",
169
+ fileSize: 0,
170
+ file: null,
171
+ base64: i[l],
172
+ isUrl: !0
173
+ })) : e.modelValue && typeof e.modelValue == "object" && !Array.isArray(e.modelValue) ? i = { ...e.modelValue, fileName: t } : typeof e.modelValue == "string" && (i = {
174
+ fileName: t,
175
+ fileType: "unknown",
176
+ fileSize: 0,
177
+ file: null,
178
+ base64: e.modelValue,
179
+ isUrl: !0
180
+ }), i !== void 0 && (d("update:modelValue", i), d("change", i));
181
+ }, Q = m(() => A.value ? V.value.map((t) => t.fileName).join(", ") : ""), X = m(() => {
157
182
  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 = {
158
183
  sm: "h-8 text-xs",
159
184
  md: "h-10 text-sm",
160
185
  lg: "h-12 text-base"
161
- }, a = {
186
+ }, i = {
162
187
  none: "rounded-none",
163
188
  sm: "rounded-sm",
164
189
  md: "rounded-md",
@@ -172,149 +197,174 @@ const ie = { class: "w-full" }, oe = ["multiple", "accept"], ae = ["value", "pla
172
197
  "border border-input focus-visible:border-primary",
173
198
  // Default outline style
174
199
  t[e.size],
175
- a[e.rounded],
200
+ i[e.rounded],
176
201
  "pr-10",
177
202
  // Space for icon
178
203
  e.disabled ? "cursor-not-allowed opacity-50" : ""
179
204
  ].join(" ");
180
205
  });
181
- return (l, t) => (r(), c("div", ie, [
182
- n("input", {
206
+ return (l, t) => (a(), u("div", oe, [
207
+ s("input", {
183
208
  ref_key: "fileInput",
184
209
  ref: z,
185
210
  type: "file",
186
- multiple: i.multiSelect,
187
- accept: U.value,
211
+ multiple: o.multiSelect,
212
+ accept: E.value,
188
213
  class: "hidden",
189
214
  onChange: O
190
- }, null, 40, oe),
191
- _(l.$slots, "trigger", {
192
- trigger: v,
193
- isDragging: h.value,
194
- isLoading: i.loading || u.value,
215
+ }, null, 40, re),
216
+ ee(l.$slots, "trigger", {
217
+ trigger: y,
218
+ isDragging: v.value,
219
+ isLoading: o.loading || c.value,
195
220
  files: V.value
196
221
  }, () => [
197
- i.variant === "input" ? (r(), c("div", {
222
+ o.variant === "input" ? (a(), u("div", {
198
223
  key: 0,
199
224
  class: "relative",
200
- onClick: v
225
+ onClick: y
201
226
  }, [
202
- n("input", {
227
+ s("input", {
203
228
  type: "text",
204
- value: J.value,
205
- placeholder: I.value,
229
+ value: Q.value,
230
+ placeholder: P.value,
206
231
  readonly: "",
207
- class: C(Q.value),
208
- disabled: i.disabled || i.loading || u.value
232
+ class: T(X.value),
233
+ disabled: o.disabled || o.loading || c.value
209
234
  }, null, 10, ae),
210
- n("div", re, [
211
- i.loading || u.value ? (r(), x(p, {
235
+ s("div", se, [
236
+ o.loading || c.value ? (a(), b(p, {
212
237
  key: 0,
213
238
  icon: "lucide:loader-2",
214
239
  class: "h-4 w-4 animate-spin text-muted-foreground"
215
- })) : A.value && !i.disabled ? (r(), c("button", {
240
+ })) : A.value && !o.disabled ? (a(), u("button", {
216
241
  key: 1,
217
242
  type: "button",
218
243
  class: "text-muted-foreground hover:text-foreground focus:outline-none",
219
- onClick: M(H, ["stop"])
244
+ onClick: F(H, ["stop"])
220
245
  }, [
221
- w(p, {
246
+ k(p, {
222
247
  icon: "lucide:x-circle",
223
248
  class: "h-4 w-4"
224
249
  })
225
- ])) : (r(), x(p, {
250
+ ])) : (a(), b(p, {
226
251
  key: 2,
227
252
  icon: "lucide:upload",
228
253
  class: "h-4 w-4 text-muted-foreground"
229
254
  }))
230
255
  ])
231
- ])) : (r(), c("div", {
256
+ ])) : (a(), u("div", {
232
257
  key: 1,
233
258
  class: "relative",
234
- onDragover: E,
235
- onDragleave: W,
236
- onDrop: R
259
+ onDragover: L,
260
+ onDragleave: R,
261
+ onDrop: W
237
262
  }, [
238
- A.value ? (r(), c("div", fe, [
239
- (r(!0), c(le, null, te(V.value, (a, s) => (r(), c("div", {
240
- key: s,
241
- class: C(["relative flex items-center p-3 border border-border rounded-lg bg-body transition-colors group", [!i.multiSelect && !i.disabled ? "cursor-pointer hover:border-primary/50" : ""]]),
242
- onClick: t[0] || (t[0] = (m) => !i.multiSelect && !i.disabled ? v() : null)
263
+ A.value ? (a(), u("div", me, [
264
+ (a(!0), u(te, null, ie(V.value, (i, n) => (a(), u("div", {
265
+ key: n,
266
+ class: T(["relative flex items-center p-3 border border-border rounded-lg bg-body transition-colors group", [!o.multiSelect && !o.disabled ? "cursor-pointer hover:border-primary/50" : ""]]),
267
+ onClick: t[2] || (t[2] = (f) => !o.multiSelect && !o.disabled ? y() : null)
243
268
  }, [
244
- n("div", me, [
245
- n("div", ge, [
246
- w(p, {
269
+ s("div", ge, [
270
+ s("div", pe, [
271
+ k(p, {
247
272
  icon: "lucide:file-text",
248
273
  class: "w-5 h-5"
249
274
  })
250
275
  ])
251
276
  ]),
252
- n("div", pe, [
253
- n("p", he, b(a.fileName), 1),
254
- n("p", ve, b(G(a.fileSize)), 1)
277
+ s("div", he, [
278
+ o.allowRename && !o.disabled ? (a(), u("div", ve, [
279
+ s("div", ye, [
280
+ s("span", xe, h(i.fileName || "Enter file name"), 1),
281
+ s("input", {
282
+ value: i.fileName,
283
+ onClick: t[0] || (t[0] = F(() => {
284
+ }, ["stop"])),
285
+ onInput: (f) => J(n, f.target.value),
286
+ class: "col-start-1 row-start-1 w-auto min-w-[2ch] text-sm font-medium text-foreground bg-transparent border-b border-transparent hover:border-border focus:border-primary outline-none transition-colors py-0.5 px-1",
287
+ placeholder: "Enter file name"
288
+ }, null, 40, be)
289
+ ]),
290
+ s("div", {
291
+ class: "flex-shrink-0 ml-1 text-muted-foreground/50 group-hover/rename:text-foreground transition-colors cursor-text",
292
+ onClick: t[1] || (t[1] = F(
293
+ (f) => f.currentTarget.previousElementSibling?.querySelector("input")?.focus(),
294
+ ["stop"]
295
+ )),
296
+ title: "Rename file"
297
+ }, [
298
+ k(p, {
299
+ icon: "lucide:pencil",
300
+ class: "w-3.5 h-3.5"
301
+ })
302
+ ])
303
+ ])) : (a(), u("p", ke, h(i.fileName), 1)),
304
+ s("p", we, h(q(i.fileSize)), 1)
255
305
  ]),
256
- n("div", ye, [
257
- !i.disabled && !i.loading ? (r(), x(P, {
306
+ s("div", Ve, [
307
+ !o.disabled && !o.loading ? (a(), b(N, {
258
308
  key: 0,
259
309
  size: "xs",
260
310
  variant: "ghost",
261
311
  icon: "lucide:x",
262
312
  rounded: "full",
263
313
  class: "text-muted-foreground hover:text-destructive hover:bg-destructive/10",
264
- onClick: M((m) => q(s), ["stop"])
265
- }, null, 8, ["onClick"])) : F("", !0)
314
+ onClick: F((f) => K(n), ["stop"])
315
+ }, null, 8, ["onClick"])) : S("", !0)
266
316
  ])
267
317
  ], 2))), 128)),
268
- i.multiSelect && (!i.maxFiles || V.value.length < i.maxFiles) ? (r(), c("div", xe, [
269
- w(P, {
318
+ o.multiSelect && (!o.maxFiles || V.value.length < o.maxFiles) ? (a(), u("div", Fe, [
319
+ k(N, {
270
320
  size: "sm",
271
321
  variant: "outline",
272
322
  icon: "lucide:plus",
273
- text: L.value,
274
- disabled: i.disabled || i.loading || u.value,
275
- onClick: v
323
+ text: U.value,
324
+ disabled: o.disabled || o.loading || c.value,
325
+ onClick: y
276
326
  }, null, 8, ["text", "disabled"])
277
- ])) : F("", !0)
278
- ])) : (r(), c("div", {
327
+ ])) : S("", !0)
328
+ ])) : (a(), u("div", {
279
329
  key: 0,
280
- class: C(["border-2 bg-body 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", [
281
- h.value ? "border-primary bg-primary/5" : "hover:border-primary/50 ",
282
- i.disabled || i.loading || u.value ? "opacity-50 cursor-not-allowed" : ""
330
+ class: T(["border-2 bg-body 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", [
331
+ v.value ? "border-primary bg-primary/5" : "hover:border-primary/50 ",
332
+ o.disabled || o.loading || c.value ? "opacity-50 cursor-not-allowed" : ""
283
333
  ]]),
284
- onClick: v
334
+ onClick: y
285
335
  }, [
286
- n("div", se, [
287
- i.loading || u.value ? (r(), x(p, {
336
+ s("div", ne, [
337
+ o.loading || c.value ? (a(), b(p, {
288
338
  key: 0,
289
339
  icon: "lucide:loader-2",
290
340
  class: "w-6 h-6 animate-spin"
291
- })) : (r(), x(p, {
341
+ })) : (a(), b(p, {
292
342
  key: 1,
293
343
  icon: "lucide:upload-cloud",
294
344
  class: "w-6 h-6"
295
345
  }))
296
346
  ]),
297
- n("div", ne, [
298
- n("p", de, [
299
- n("span", ue, b(N.value), 1),
300
- ee(" " + b(j.value), 1)
347
+ s("div", de, [
348
+ s("p", ue, [
349
+ s("span", ce, h($.value), 1),
350
+ le(" " + h(j.value), 1)
301
351
  ]),
302
- i.fileTypes.length ? (r(), c("p", ce, b(i.fileTypes.join(", ")), 1)) : F("", !0)
352
+ o.fileTypes.length ? (a(), u("p", fe, h(o.fileTypes.join(", ")), 1)) : S("", !0)
303
353
  ])
304
354
  ], 2)),
305
- i.loading || u.value ? (r(), c("div", be, [
306
- n("div", ke, [
307
- w(p, {
355
+ o.loading || c.value ? (a(), u("div", Se, [
356
+ s("div", Ae, [
357
+ k(p, {
308
358
  icon: "lucide:loader-2",
309
359
  class: "w-6 h-6 animate-spin text-primary"
310
360
  })
311
361
  ])
312
- ])) : F("", !0)
362
+ ])) : S("", !0)
313
363
  ], 32))
314
364
  ])
315
365
  ]));
316
366
  }
317
367
  });
318
368
  export {
319
- Se as default
369
+ Be as default
320
370
  };
@@ -0,0 +1,5 @@
1
+ import { FilePreviewProps } from './types';
2
+ declare const _default: import('vue').DefineComponent<FilePreviewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FilePreviewProps> & Readonly<{}>, {
3
+ canDownload: boolean;
4
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
5
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import { defineComponent as l, openBlock as n, createElementBlock as r, createElementVNode as o, createVNode as t, unref as a } from "vue";
2
+ import { VFileViewer as d } from "v-file-preview";
3
+ import "v-file-preview/dist/style.css";
4
+ const c = { class: "flex flex-col h-[70vh] w-full min-h-[400px]" }, i = { class: "flex-1 relative bg-muted/10 rounded-lg border border-border overflow-hidden flex items-center justify-center" }, u = { class: "w-full h-full overflow-auto" }, v = /* @__PURE__ */ l({
5
+ __name: "FilePreview",
6
+ props: {
7
+ url: {},
8
+ name: {},
9
+ canDownload: { type: Boolean, default: !0 }
10
+ },
11
+ setup(e) {
12
+ return (f, m) => (n(), r("div", c, [
13
+ o("div", i, [
14
+ o("div", u, [
15
+ t(a(d), {
16
+ url: e.url,
17
+ name: e.name,
18
+ "can-download": e.canDownload
19
+ }, null, 8, ["url", "name", "can-download"])
20
+ ])
21
+ ])
22
+ ]));
23
+ }
24
+ });
25
+ export {
26
+ v as default
27
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./FilePreview.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,2 @@
1
+ export { default as FilePreview } from './FilePreview.vue';
2
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ export interface FilePreviewProps {
2
+ url: string;
3
+ name?: string;
4
+ canDownload?: boolean;
5
+ }
@@ -83,6 +83,7 @@ const pe = /* @__PURE__ */ I({
83
83
  }), S = o(() => {
84
84
  const a = e.field.type, l = {
85
85
  disabled: e.disabled || e.field.disabled === !0,
86
+ readonly: e.readonly || e.field.readonly === !0,
86
87
  ...e?.field || {},
87
88
  ...e.field.props || {},
88
89
  label: "",
@@ -188,7 +189,8 @@ const pe = /* @__PURE__ */ I({
188
189
  size: e.size,
189
190
  rounded: e.rounded,
190
191
  maxSize: e.field.maxFileSize ? e.field.maxFileSize * 1024 * 1024 : void 0,
191
- loading: e.loading
192
+ loading: e.loading,
193
+ allowRename: e.field.props?.allowRename ?? !0
192
194
  } : a === "avatarUpload" ? {
193
195
  size: "2xl",
194
196
  ...l,