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.
- package/components/Accordion/AccordionItem.vue.js +33 -32
- package/components/Accordion/types.d.ts +2 -0
- package/components/Alert.vue.d.ts +2 -0
- package/components/Alert.vue.js +38 -36
- package/components/AvatarUploader/AvatarUploader.vue.d.ts +1 -1
- package/components/AvatarUploader/AvatarUploader.vue.js +25 -24
- package/components/Button.vue.d.ts +1 -1
- package/components/Button.vue.js +37 -35
- package/components/CheckBox.vue.d.ts +1 -0
- package/components/CheckBox.vue.js +40 -40
- package/components/Chip/Chip.vue.js +55 -55
- package/components/Chip/types.d.ts +1 -0
- package/components/ChoiceBox/ChoiceBox.vue.d.ts +5 -0
- package/components/ChoiceBox/ChoiceBox.vue.js +61 -58
- package/components/ColorPicker/ColorPicker.vue.js +3 -2
- package/components/ConfirmationModal.vue.d.ts +4 -2
- package/components/ConfirmationModal.vue.js +48 -33
- package/components/DataList/DataList.vue.d.ts +0 -2
- package/components/DataList/DataList.vue.js +39 -35
- package/components/DataList/types.d.ts +2 -0
- package/components/DataTable/DataTable.vue.d.ts +0 -5
- package/components/DataTable/DataTable.vue.js +177 -158
- package/components/DataTable/DataTableHeader.vue.js +15 -14
- package/components/DataTable/DataTableToolbar.vue.d.ts +1 -1
- package/components/DataTable/DataTableToolbar.vue.js +30 -23
- package/components/DataTable/types.d.ts +4 -0
- package/components/DatePicker.vue.d.ts +1 -0
- package/components/DatePicker.vue.js +32 -25
- package/components/Dropdown/DropdownBooleanItem.vue.js +18 -17
- package/components/Dropdown/DropdownGroupedLayout.vue.js +28 -27
- package/components/Dropdown/DropdownItem.vue.js +24 -23
- package/components/Dropdown/DropdownMenu.vue.js +100 -91
- package/components/Dropdown/composables/useDropdownNavigation.js +24 -23
- package/components/Dropdown/composables/useDropdownSelection.js +19 -17
- package/components/Empty/Empty.vue.d.ts +2 -2
- package/components/Empty/Empty.vue.js +32 -18
- package/components/FilePicker/FilePicker.vue.d.ts +3 -1
- package/components/FilePicker/FilePicker.vue.js +140 -127
- package/components/FileTree/FileTree.vue.js +68 -58
- package/components/FileTree/FileTreeNode.vue.js +35 -34
- package/components/FileTree/types.d.ts +3 -0
- package/components/Form/CustomFields.vue.d.ts +3 -1
- package/components/Form/CustomFields.vue.js +2 -2
- package/components/Form/CustomFields.vue2.js +92 -80
- package/components/Form/Form.vue.d.ts +1 -1
- package/components/Form/FormField.vue.d.ts +1 -1
- package/components/Form/FormField.vue.js +60 -59
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +58 -57
- package/components/Form/composables/useForm.js +91 -88
- package/components/Form/types.d.ts +4 -0
- package/components/Form/utils/form.utils.js +104 -98
- package/components/GoogleLogin.vue.d.ts +1 -1
- package/components/GoogleLogin.vue.js +39 -32
- package/components/Heatmap/Heatmap.vue2.js +3 -2
- package/components/IconPicker.vue.d.ts +2 -0
- package/components/IconPicker.vue.js +37 -29
- package/components/Input.vue.d.ts +1 -1
- package/components/Input.vue.js +96 -98
- package/components/Kanban/KanbanBoard.vue.js +1 -1
- package/components/Kanban/KanbanBoard.vue2.js +55 -54
- package/components/Kanban/types.d.ts +1 -0
- package/components/Masonry/Masonry.vue2.js +3 -2
- package/components/Modal.vue.d.ts +2 -0
- package/components/Modal.vue.js +62 -57
- package/components/MultiSelect/MultiSelect.vue.d.ts +1 -1
- package/components/MultiSelect/MultiSelect.vue.js +61 -54
- package/components/Navbar/Navbar.vue.js +46 -46
- package/components/Pagination/Pagination.vue.js +116 -97
- package/components/PricingPlan/PricingPlanItem.vue.js +60 -47
- package/components/PricingPlan/types.d.ts +5 -0
- package/components/Screen/Screen.vue.d.ts +0 -4
- package/components/Screen/Screen.vue.js +231 -189
- package/components/Screen/ScreenFilter.vue.js +73 -63
- package/components/Screen/types.d.ts +5 -0
- package/components/SidePanel.vue.d.ts +2 -0
- package/components/SidePanel.vue.js +140 -5
- package/components/SidePanel.vue2.js +2 -135
- package/components/SidebarMenu/SidebarMenuItem.vue.js +131 -130
- package/components/SidebarMenu/types.d.ts +1 -0
- package/components/Slider.vue.d.ts +1 -0
- package/components/Slider.vue.js +71 -69
- package/components/Switch.vue.d.ts +1 -0
- package/components/Switch.vue.js +23 -18
- package/components/Tabes/Tabes.vue.js +20 -19
- package/components/Tabes/types.d.ts +1 -0
- package/components/Textarea.vue.d.ts +1 -0
- package/components/Textarea.vue.js +18 -16
- package/components/ThemeToggle.vue.js +24 -14
- package/components/Timeline.vue.js +68 -82
- package/components/ToastNotification.vue.js +2 -2
- package/components/Tooltip.vue.d.ts +4 -3
- package/components/Tooltip.vue.js +17 -15
- package/components/Workbook/Sheet.vue.js +80 -71
- package/components/Workbook/WorkbookAddButton.vue.js +14 -10
- package/components/Workbook/types.d.ts +1 -0
- package/core/config.d.ts +2 -0
- package/index.d.ts +1 -0
- package/index.js +28 -26
- package/package.json +1 -1
- package/style.css +1 -2
- package/types/button.d.ts +1 -0
- package/types/config.type.d.ts +10 -0
- package/types/form.type.d.ts +2 -0
- package/types/styles.d.ts +3 -0
- package/types/timeline.type.d.ts +2 -0
- package/utils/i18n.d.ts +8 -0
- package/utils/i18n.js +5 -0
- package/utils/index.d.ts +1 -0
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
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
|
-
},
|
|
8
|
+
}, fe = {
|
|
8
9
|
key: 1,
|
|
9
10
|
class: "space-y-2"
|
|
10
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
35
|
-
const e =
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
54
|
+
const r = t.split("/").pop() || "Unknown File";
|
|
42
55
|
return {
|
|
43
|
-
fileName: decodeURIComponent(
|
|
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
|
-
}),
|
|
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
|
-
|
|
72
|
+
z.value?.click();
|
|
60
73
|
}
|
|
61
|
-
},
|
|
74
|
+
}, E = (l) => {
|
|
62
75
|
l.preventDefault(), !(e.disabled || e.loading) && (h.value = !0);
|
|
63
|
-
},
|
|
76
|
+
}, W = (l) => {
|
|
64
77
|
l.preventDefault(), h.value = !1;
|
|
65
|
-
},
|
|
66
|
-
l.preventDefault(), h.value = !1, !(e.disabled || e.loading || u.value) && l.dataTransfer?.files &&
|
|
67
|
-
},
|
|
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 &&
|
|
70
|
-
},
|
|
82
|
+
t.files && D(t.files), t.value = "";
|
|
83
|
+
}, G = (l) => {
|
|
71
84
|
if (l === 0 || !l) return "";
|
|
72
|
-
const t = 1024,
|
|
73
|
-
return parseFloat((l / Math.pow(t, s)).toFixed(2)) + " " +
|
|
74
|
-
},
|
|
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) :
|
|
78
|
-
}, s.onerror = (
|
|
79
|
-
}),
|
|
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 = [],
|
|
83
|
-
let
|
|
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
|
|
86
|
-
if (
|
|
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
|
-
|
|
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
|
|
94
|
-
if (e.fileTypes.length > 0 && !e.fileTypes.some((
|
|
95
|
-
if (
|
|
96
|
-
return
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
return
|
|
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
|
|
114
|
+
return a.type === x;
|
|
102
115
|
})) {
|
|
103
|
-
|
|
116
|
+
r.push(`File type not allowed: ${a.name}`);
|
|
104
117
|
continue;
|
|
105
118
|
}
|
|
106
|
-
let
|
|
107
|
-
e.maxSize &&
|
|
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" && !
|
|
122
|
+
if (e.returnFormat === "base64" && !g)
|
|
110
123
|
try {
|
|
111
|
-
T = await
|
|
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:
|
|
117
|
-
fileType:
|
|
118
|
-
fileSize:
|
|
119
|
-
file:
|
|
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 (
|
|
124
|
-
let
|
|
125
|
-
e.multiSelect ?
|
|
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 (
|
|
128
|
-
console.error("Error processing 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
|
-
},
|
|
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
|
-
},
|
|
152
|
+
}, H = () => {
|
|
140
153
|
e.disabled || e.loading || (d("update:modelValue", null), d("change", null));
|
|
141
|
-
},
|
|
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
|
-
},
|
|
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
|
-
|
|
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) => (
|
|
179
|
+
return (l, t) => (o(), c("div", ie, [
|
|
167
180
|
n("input", {
|
|
168
181
|
ref_key: "fileInput",
|
|
169
|
-
ref:
|
|
182
|
+
ref: z,
|
|
170
183
|
type: "file",
|
|
171
|
-
multiple:
|
|
172
|
-
accept:
|
|
184
|
+
multiple: i.multiSelect,
|
|
185
|
+
accept: U.value,
|
|
173
186
|
class: "hidden",
|
|
174
|
-
onChange:
|
|
175
|
-
}, null, 40,
|
|
176
|
-
|
|
177
|
-
trigger:
|
|
187
|
+
onChange: O
|
|
188
|
+
}, null, 40, ae),
|
|
189
|
+
_(l.$slots, "trigger", {
|
|
190
|
+
trigger: v,
|
|
178
191
|
isDragging: h.value,
|
|
179
|
-
isLoading:
|
|
180
|
-
files:
|
|
192
|
+
isLoading: i.loading || u.value,
|
|
193
|
+
files: w.value
|
|
181
194
|
}, () => [
|
|
182
|
-
|
|
195
|
+
i.variant === "input" ? (o(), c("div", {
|
|
183
196
|
key: 0,
|
|
184
197
|
class: "relative",
|
|
185
|
-
onClick:
|
|
198
|
+
onClick: v
|
|
186
199
|
}, [
|
|
187
200
|
n("input", {
|
|
188
201
|
type: "text",
|
|
189
|
-
value:
|
|
190
|
-
placeholder:
|
|
202
|
+
value: J.value,
|
|
203
|
+
placeholder: I.value,
|
|
191
204
|
readonly: "",
|
|
192
|
-
class:
|
|
193
|
-
disabled:
|
|
194
|
-
}, null, 10,
|
|
195
|
-
n("div",
|
|
196
|
-
|
|
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
|
-
})) :
|
|
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:
|
|
217
|
+
onClick: M(H, ["stop"])
|
|
205
218
|
}, [
|
|
206
|
-
|
|
219
|
+
V(p, {
|
|
207
220
|
icon: "lucide:x-circle",
|
|
208
221
|
class: "h-4 w-4"
|
|
209
222
|
})
|
|
210
|
-
])) : (
|
|
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
|
-
])) : (
|
|
229
|
+
])) : (o(), c("div", {
|
|
217
230
|
key: 1,
|
|
218
231
|
class: "relative",
|
|
219
|
-
onDragover:
|
|
220
|
-
onDragleave:
|
|
221
|
-
onDrop:
|
|
232
|
+
onDragover: E,
|
|
233
|
+
onDragleave: W,
|
|
234
|
+
onDrop: R
|
|
222
235
|
}, [
|
|
223
|
-
|
|
224
|
-
(
|
|
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:
|
|
227
|
-
onClick: t[0] || (t[0] = (
|
|
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",
|
|
230
|
-
n("div",
|
|
231
|
-
|
|
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",
|
|
238
|
-
n("p",
|
|
239
|
-
n("p",
|
|
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",
|
|
242
|
-
!
|
|
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:
|
|
250
|
-
}, null, 8, ["onClick"])) :
|
|
262
|
+
onClick: M((m) => q(s), ["stop"])
|
|
263
|
+
}, null, 8, ["onClick"])) : F("", !0)
|
|
251
264
|
])
|
|
252
265
|
], 2))), 128)),
|
|
253
|
-
|
|
254
|
-
|
|
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:
|
|
259
|
-
disabled:
|
|
260
|
-
onClick:
|
|
261
|
-
}, null, 8, ["disabled"])
|
|
262
|
-
])) :
|
|
263
|
-
])) : (
|
|
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:
|
|
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
|
-
|
|
280
|
+
i.disabled || i.loading || u.value ? "opacity-50 cursor-not-allowed" : ""
|
|
268
281
|
]]),
|
|
269
|
-
onClick:
|
|
282
|
+
onClick: v
|
|
270
283
|
}, [
|
|
271
|
-
n("div",
|
|
272
|
-
|
|
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
|
-
})) : (
|
|
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",
|
|
283
|
-
|
|
284
|
-
n("span",
|
|
285
|
-
|
|
286
|
-
]
|
|
287
|
-
|
|
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
|
-
|
|
291
|
-
n("div",
|
|
292
|
-
|
|
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
|
-
])) :
|
|
310
|
+
])) : F("", !0)
|
|
298
311
|
], 32))
|
|
299
312
|
])
|
|
300
313
|
]));
|
|
301
314
|
}
|
|
302
315
|
});
|
|
303
316
|
export {
|
|
304
|
-
|
|
317
|
+
Se as default
|
|
305
318
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent as N, ref as
|
|
2
|
-
import
|
|
3
|
-
|
|
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
|
-
},
|
|
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 =
|
|
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 &&
|
|
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(),
|
|
31
|
+
m.value.clear(), x.value.clear(), M(t);
|
|
29
32
|
},
|
|
30
33
|
{ immediate: !0, deep: !0 }
|
|
31
34
|
);
|
|
32
|
-
const
|
|
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(
|
|
39
|
+
a.push(e.id), a = a.concat(b(e));
|
|
37
40
|
return a;
|
|
38
|
-
},
|
|
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
|
|
44
|
-
let
|
|
45
|
-
for (const
|
|
46
|
-
const
|
|
47
|
-
|
|
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 ||
|
|
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
|
-
}),
|
|
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
|
-
|
|
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
|
-
|
|
62
|
+
v.value.add(t.id);
|
|
60
63
|
try {
|
|
61
64
|
await l.loadData(t);
|
|
62
65
|
} finally {
|
|
63
|
-
|
|
66
|
+
v.value.delete(t.id);
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
|
-
},
|
|
69
|
+
}, D = (t) => {
|
|
67
70
|
if (t.disabled) return;
|
|
68
71
|
const a = m.value.get(t.id) || t;
|
|
69
|
-
let e = new Set(
|
|
70
|
-
const
|
|
72
|
+
let e = new Set(w.value);
|
|
73
|
+
const n = e.has(t.id);
|
|
71
74
|
if (l.selectionMode === "single")
|
|
72
|
-
e.clear(),
|
|
75
|
+
e.clear(), n || e.add(t.id);
|
|
73
76
|
else if (l.selectionMode === "multiple") {
|
|
74
|
-
const s =
|
|
75
|
-
|
|
77
|
+
const s = b(a), i = !n, r = (d, o) => {
|
|
78
|
+
o ? e.add(d) : e.delete(d);
|
|
76
79
|
};
|
|
77
|
-
|
|
78
|
-
let
|
|
80
|
+
r(t.id, i), s.forEach((d) => r(d, i));
|
|
81
|
+
let c = a;
|
|
79
82
|
for (; ; ) {
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
|
|
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, !
|
|
88
|
-
},
|
|
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
|
|
92
|
-
let
|
|
93
|
-
return e.children && (
|
|
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:
|
|
98
|
+
children: r
|
|
96
99
|
} : null;
|
|
97
100
|
};
|
|
98
101
|
return l.data.map(a).filter((e) => e !== null);
|
|
99
102
|
});
|
|
100
|
-
|
|
103
|
+
E(
|
|
101
104
|
() => [l.searchQuery, l.data],
|
|
102
105
|
([t]) => {
|
|
103
106
|
if (t) {
|
|
104
|
-
const a = t.toLowerCase(), e = /* @__PURE__ */ new Set(),
|
|
107
|
+
const a = t.toLowerCase(), e = /* @__PURE__ */ new Set(), n = (s) => {
|
|
105
108
|
let i = !1;
|
|
106
109
|
if (s.children)
|
|
107
|
-
for (const
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
return i && e.add(s.id),
|
|
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(
|
|
115
|
+
l.data.forEach(n), e.forEach((s) => u.value.add(s));
|
|
113
116
|
}
|
|
114
117
|
},
|
|
115
118
|
{ deep: !0 }
|
|
116
|
-
)
|
|
117
|
-
|
|
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
|
-
|
|
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":
|
|
133
|
+
"selected-keys": w.value,
|
|
124
134
|
"expanded-keys": u.value,
|
|
125
|
-
"indeterminate-keys":
|
|
126
|
-
"loading-keys":
|
|
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:
|
|
131
|
-
onToggleSelect:
|
|
132
|
-
onClickNode: a[0] || (a[0] = (
|
|
133
|
-
}, null, 8, ["node", "selection-mode", "selected-keys", "expanded-keys", "indeterminate-keys", "loading-keys", "show-checkboxes", "highlight-search", "search-query"]))), 128)) : (
|
|
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
|
-
|
|
148
|
+
J as default
|
|
139
149
|
};
|