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.
- package/components/AttachmentsList/AttachmentsList.vue.d.ts +6 -0
- package/components/AttachmentsList/AttachmentsList.vue.js +82 -0
- package/components/AttachmentsList/AttachmentsList.vue2.js +4 -0
- package/components/AttachmentsList/index.d.ts +2 -0
- package/components/AttachmentsList/types.d.ts +11 -0
- package/components/Button.vue.js +6 -6
- package/components/Chat/ChatBubble.vue.d.ts +18 -0
- package/components/Chat/ChatInterface.vue.d.ts +45 -0
- package/components/Chat/index.d.ts +2 -0
- package/components/DataList/DataList.vue.d.ts +1 -1
- package/components/DataTable/DataTable.vue.d.ts +3 -3
- package/components/DataTable/DataTable.vue.js +22 -22
- package/components/DataTable/types.d.ts +1 -1
- package/components/DatePicker.vue.d.ts +3 -2
- package/components/DatePicker.vue.js +1 -1
- package/components/Dropdown/Dropdown.vue.d.ts +2 -0
- package/components/Dropdown/Dropdown.vue.js +106 -90
- package/components/Dropdown/DropdownItem.vue.js +8 -8
- package/components/Dropdown/DropdownMenu.vue.js +2 -2
- package/components/Dropdown/DropdownMenu.vue2.js +1 -1
- package/components/ExportData/ExportData.vue.d.ts +1 -1
- package/components/FilePicker/FilePicker.vue.d.ts +4 -1
- package/components/FilePicker/FilePicker.vue.js +189 -139
- package/components/FilePreview/FilePreview.vue.d.ts +5 -0
- package/components/FilePreview/FilePreview.vue.js +27 -0
- package/components/FilePreview/FilePreview.vue2.js +4 -0
- package/components/FilePreview/index.d.ts +2 -0
- package/components/FilePreview/types.d.ts +5 -0
- package/components/Form/FormField.vue.js +3 -1
- package/components/Form/composables/useForm.js +50 -47
- package/components/Input.vue.d.ts +1 -0
- package/components/Input.vue.js +18 -15
- package/components/Modal.vue.js +2 -2
- package/components/Modal.vue2.js +31 -31
- package/components/MultiSelect/MultiSelect.vue.js +92 -84
- package/components/Navbar/Navbar.vue.js +61 -60
- package/components/Screen/Screen.vue.d.ts +200 -7
- package/components/Screen/Screen.vue.js +306 -502
- package/components/Screen/ScreenFilter.vue.js +45 -42
- package/components/Screen/components/ScreenAddAction.vue.d.ts +15 -0
- package/components/Screen/components/ScreenAddAction.vue.js +107 -0
- package/components/Screen/components/ScreenAddAction.vue2.js +4 -0
- package/components/Screen/components/ScreenEmptyState.vue.d.ts +14 -0
- package/components/Screen/components/ScreenEmptyState.vue.js +105 -0
- package/components/Screen/components/ScreenEmptyState.vue2.js +4 -0
- package/components/Screen/components/ScreenExportModal.vue.d.ts +49 -0
- package/components/Screen/components/ScreenExportModal.vue.js +83 -0
- package/components/Screen/components/ScreenExportModal.vue2.js +4 -0
- package/components/Screen/components/ScreenHeaderTitle.vue.d.ts +28 -0
- package/components/Screen/components/ScreenHeaderTitle.vue.js +57 -0
- package/components/Screen/components/ScreenHeaderTitle.vue2.js +4 -0
- package/components/Screen/components/ScreenOptionsDropdown.vue.d.ts +10 -0
- package/components/Screen/components/ScreenOptionsDropdown.vue.js +43 -0
- package/components/Screen/components/ScreenOptionsDropdown.vue2.js +4 -0
- package/components/Screen/components/ScreenQuickFilters.vue.d.ts +15 -0
- package/components/Screen/components/ScreenQuickFilters.vue.js +36 -0
- package/components/Screen/components/ScreenQuickFilters.vue2.js +4 -0
- package/components/Screen/components/ScreenViewToggle.vue.d.ts +9 -0
- package/components/Screen/components/ScreenViewToggle.vue.js +48 -0
- package/components/Screen/components/ScreenViewToggle.vue2.js +4 -0
- package/components/Screen/index.d.ts +1 -0
- package/components/Screen/types.d.ts +41 -2
- package/components/SidePanel.vue.js +1 -1
- package/components/SidePanel.vue2.js +7 -7
- package/components/SidebarMenu/SidebarMenu.vue.js +1 -1
- package/components/Stats/Stats.vue.js +50 -49
- package/components/StatusChip/StatusChip.vue.d.ts +2 -2
- package/components/StatusChip/StatusChip.vue.js +15 -14
- package/components/StatusChip/status-map.d.ts +2 -1
- package/components/StatusChip/status-map.js +16 -6
- package/components/Tabes/Tabes.vue.d.ts +1 -1
- package/components/Tabes/Tabes.vue.js +5 -143
- package/components/Tabes/Tabes.vue2.js +144 -2
- package/components/Timeline/TimelineIndicator.vue.js +6 -6
- package/components/Workbook/Sheet.vue.d.ts +1 -1
- package/core/config.d.ts +8 -0
- package/core/config.js +10 -6
- package/core/index.js +28 -20
- package/index.d.ts +2 -0
- package/index.js +209 -203
- package/package.json +3 -2
- package/style.css +80 -6
- package/types/config.type.d.ts +10 -0
- package/types/form.type.d.ts +1 -0
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { defineComponent as
|
|
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
|
|
4
|
-
import { $t as
|
|
5
|
-
const
|
|
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
|
-
},
|
|
8
|
+
}, me = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "space-y-2"
|
|
11
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
38
|
-
const e =
|
|
39
|
-
() => e.placeholderI18n ?
|
|
40
|
-
),
|
|
41
|
-
if (e.textI18n) return
|
|
42
|
-
const l =
|
|
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 =
|
|
45
|
-
const l =
|
|
51
|
+
}), j = m(() => {
|
|
52
|
+
const l = w("vlite.filePicker.dragAndDrop");
|
|
46
53
|
return l !== "vlite.filePicker.dragAndDrop" ? l : "or drag and drop";
|
|
47
|
-
}),
|
|
48
|
-
const l =
|
|
54
|
+
}), U = m(() => {
|
|
55
|
+
const l = w("vlite.filePicker.addMore");
|
|
49
56
|
return l !== "vlite.filePicker.addMore" ? l : "Add more";
|
|
50
|
-
}), z =
|
|
51
|
-
|
|
52
|
-
const
|
|
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
|
|
63
|
+
const i = t.split("/").pop() || "Unknown File";
|
|
57
64
|
return {
|
|
58
|
-
fileName: decodeURIComponent(
|
|
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
|
-
}),
|
|
69
|
-
if (!(e.disabled || e.loading ||
|
|
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
|
-
},
|
|
77
|
-
l.preventDefault(), !(e.disabled || e.loading) && (
|
|
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(),
|
|
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
|
-
},
|
|
92
|
+
}, q = (l) => {
|
|
86
93
|
if (l === 0 || !l) return "";
|
|
87
|
-
const t = 1024,
|
|
88
|
-
return parseFloat((l / Math.pow(t,
|
|
89
|
-
},
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
typeof
|
|
93
|
-
},
|
|
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
|
-
|
|
97
|
-
const t = [],
|
|
98
|
-
let
|
|
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
|
|
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`),
|
|
109
|
+
d("error", `Maximum ${e.maxFiles} files allowed`), c.value = !1;
|
|
103
110
|
return;
|
|
104
111
|
}
|
|
105
|
-
|
|
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
|
|
109
|
-
if (e.fileTypes.length > 0 && !e.fileTypes.some((
|
|
110
|
-
if (
|
|
111
|
-
return
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
return
|
|
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
|
|
123
|
+
return r.type === x;
|
|
117
124
|
})) {
|
|
118
|
-
|
|
125
|
+
i.push(`File type not allowed: ${r.name}`);
|
|
119
126
|
continue;
|
|
120
127
|
}
|
|
121
128
|
let g = !1;
|
|
122
|
-
e.maxSize &&
|
|
123
|
-
let
|
|
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
|
-
|
|
127
|
-
} catch (
|
|
128
|
-
console.error("Base64 read failed",
|
|
133
|
+
B = await G(r);
|
|
134
|
+
} catch (I) {
|
|
135
|
+
console.error("Base64 read failed", I);
|
|
129
136
|
}
|
|
130
137
|
t.push({
|
|
131
|
-
fileName:
|
|
132
|
-
fileType:
|
|
133
|
-
fileSize:
|
|
134
|
-
file:
|
|
135
|
-
base64:
|
|
138
|
+
fileName: r.name,
|
|
139
|
+
fileType: r.type,
|
|
140
|
+
fileSize: r.size,
|
|
141
|
+
file: r,
|
|
142
|
+
base64: B
|
|
136
143
|
});
|
|
137
144
|
}
|
|
138
|
-
if (
|
|
139
|
-
let
|
|
140
|
-
e.multiSelect ?
|
|
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 (
|
|
143
|
-
console.error("Error processing files:",
|
|
149
|
+
} catch (r) {
|
|
150
|
+
console.error("Error processing files:", r), d("error", "Failed to process files");
|
|
144
151
|
} finally {
|
|
145
|
-
|
|
152
|
+
c.value = !1;
|
|
146
153
|
}
|
|
147
|
-
},
|
|
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 =
|
|
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
|
-
},
|
|
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
|
-
|
|
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) => (
|
|
182
|
-
|
|
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:
|
|
187
|
-
accept:
|
|
211
|
+
multiple: o.multiSelect,
|
|
212
|
+
accept: E.value,
|
|
188
213
|
class: "hidden",
|
|
189
214
|
onChange: O
|
|
190
|
-
}, null, 40,
|
|
191
|
-
|
|
192
|
-
trigger:
|
|
193
|
-
isDragging:
|
|
194
|
-
isLoading:
|
|
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
|
-
|
|
222
|
+
o.variant === "input" ? (a(), u("div", {
|
|
198
223
|
key: 0,
|
|
199
224
|
class: "relative",
|
|
200
|
-
onClick:
|
|
225
|
+
onClick: y
|
|
201
226
|
}, [
|
|
202
|
-
|
|
227
|
+
s("input", {
|
|
203
228
|
type: "text",
|
|
204
|
-
value:
|
|
205
|
-
placeholder:
|
|
229
|
+
value: Q.value,
|
|
230
|
+
placeholder: P.value,
|
|
206
231
|
readonly: "",
|
|
207
|
-
class:
|
|
208
|
-
disabled:
|
|
232
|
+
class: T(X.value),
|
|
233
|
+
disabled: o.disabled || o.loading || c.value
|
|
209
234
|
}, null, 10, ae),
|
|
210
|
-
|
|
211
|
-
|
|
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 && !
|
|
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:
|
|
244
|
+
onClick: F(H, ["stop"])
|
|
220
245
|
}, [
|
|
221
|
-
|
|
246
|
+
k(p, {
|
|
222
247
|
icon: "lucide:x-circle",
|
|
223
248
|
class: "h-4 w-4"
|
|
224
249
|
})
|
|
225
|
-
])) : (
|
|
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
|
-
])) : (
|
|
256
|
+
])) : (a(), u("div", {
|
|
232
257
|
key: 1,
|
|
233
258
|
class: "relative",
|
|
234
|
-
onDragover:
|
|
235
|
-
onDragleave:
|
|
236
|
-
onDrop:
|
|
259
|
+
onDragover: L,
|
|
260
|
+
onDragleave: R,
|
|
261
|
+
onDrop: W
|
|
237
262
|
}, [
|
|
238
|
-
A.value ? (
|
|
239
|
-
(
|
|
240
|
-
key:
|
|
241
|
-
class:
|
|
242
|
-
onClick: t[
|
|
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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
|
-
|
|
257
|
-
!
|
|
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:
|
|
265
|
-
}, null, 8, ["onClick"])) :
|
|
314
|
+
onClick: F((f) => K(n), ["stop"])
|
|
315
|
+
}, null, 8, ["onClick"])) : S("", !0)
|
|
266
316
|
])
|
|
267
317
|
], 2))), 128)),
|
|
268
|
-
|
|
269
|
-
|
|
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:
|
|
274
|
-
disabled:
|
|
275
|
-
onClick:
|
|
323
|
+
text: U.value,
|
|
324
|
+
disabled: o.disabled || o.loading || c.value,
|
|
325
|
+
onClick: y
|
|
276
326
|
}, null, 8, ["text", "disabled"])
|
|
277
|
-
])) :
|
|
278
|
-
])) : (
|
|
327
|
+
])) : S("", !0)
|
|
328
|
+
])) : (a(), u("div", {
|
|
279
329
|
key: 0,
|
|
280
|
-
class:
|
|
281
|
-
|
|
282
|
-
|
|
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:
|
|
334
|
+
onClick: y
|
|
285
335
|
}, [
|
|
286
|
-
|
|
287
|
-
|
|
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
|
-
})) : (
|
|
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
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
347
|
+
s("div", de, [
|
|
348
|
+
s("p", ue, [
|
|
349
|
+
s("span", ce, h($.value), 1),
|
|
350
|
+
le(" " + h(j.value), 1)
|
|
301
351
|
]),
|
|
302
|
-
|
|
352
|
+
o.fileTypes.length ? (a(), u("p", fe, h(o.fileTypes.join(", ")), 1)) : S("", !0)
|
|
303
353
|
])
|
|
304
354
|
], 2)),
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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
|
-
])) :
|
|
362
|
+
])) : S("", !0)
|
|
313
363
|
], 32))
|
|
314
364
|
])
|
|
315
365
|
]));
|
|
316
366
|
}
|
|
317
367
|
});
|
|
318
368
|
export {
|
|
319
|
-
|
|
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
|
+
};
|
|
@@ -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,
|