vlite3 1.0.4 → 1.0.6
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 +19 -3
- package/components/AttachmentsList/AttachmentsList.vue.js +274 -111
- package/components/AttachmentsList/fileTypeIcon.d.ts +16 -0
- package/components/AttachmentsList/fileTypeIcon.js +127 -0
- package/components/AttachmentsList/index.d.ts +1 -0
- package/components/AttachmentsList/types.d.ts +74 -2
- package/components/Avatar.vue.js +2 -2
- package/components/Badge.vue.js +7 -7
- package/components/Button.vue.js +36 -43
- package/components/ButtonGroup.vue.js +2 -2
- package/components/ButtonGroup.vue2.js +8 -8
- package/components/CategoryManager/CategoryManager.vue.d.ts +36 -0
- package/components/CategoryManager/CategoryNode.vue.d.ts +15 -0
- package/components/CategoryManager/index.d.ts +2 -0
- package/components/CategoryManager/types.d.ts +43 -0
- package/components/Chat/ChatBubble.vue.js +70 -56
- package/components/Chat/ChatInterface.vue.js +182 -142
- package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
- package/components/Dropdown/DropdownMenu.vue.js +2 -2
- package/components/Dropdown/DropdownMenu.vue2.js +1 -0
- package/components/FilePicker/FilePicker.vue.js +117 -122
- package/components/Input.vue.js +28 -26
- package/components/Kanban/Kanban.vue.d.ts +7 -16
- package/components/Kanban/Kanban.vue.js +1 -1
- package/components/Kanban/Kanban.vue2.js +79 -47
- package/components/Kanban/KanbanBoard.vue.js +2 -2
- package/components/Kanban/KanbanBoard.vue2.js +21 -21
- package/components/Kanban/types.d.ts +3 -0
- package/components/List/List.vue.js +89 -85
- package/components/Navbar/Navbar.vue.d.ts +4 -0
- package/components/Navbar/Navbar.vue.js +196 -173
- package/components/Navbar/NavbarTabs.vue.js +72 -66
- package/components/NavbarCommandPalette.vue.js +11 -11
- package/components/NumberInput.vue.js +2 -2
- package/components/NumberInput.vue2.js +144 -104
- package/components/Screen/Screen.vue.d.ts +12 -29
- package/components/Screen/Screen.vue.js +228 -195
- package/components/Screen/components/ScreenViewToggle.vue.d.ts +6 -3
- package/components/Screen/components/ScreenViewToggle.vue.js +29 -34
- package/components/Screen/types.d.ts +59 -7
- package/components/Stats/Stats.vue.d.ts +1 -0
- package/components/Stats/Stats.vue.js +184 -156
- package/components/Stats/types.d.ts +1 -0
- package/components/Workbook/Sheet.vue.d.ts +1 -1
- package/directives/vRipple.js +28 -9
- package/index.js +87 -85
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import { defineComponent as Z, computed as m, ref as
|
|
1
|
+
import { defineComponent as Z, computed as m, ref as A, useSlots as _, openBlock as r, createElementBlock as f, createElementVNode as s, renderSlot as ee, normalizeClass as C, createBlock as v, withModifiers as V, createVNode as F, toDisplayString as h, createTextVNode as le, createCommentVNode as T, Fragment as te, renderList as ie } from "vue";
|
|
2
2
|
import p from "../Icon.vue.js";
|
|
3
3
|
import N from "../Button.vue.js";
|
|
4
|
-
import { $t as
|
|
5
|
-
const oe = { class: "w-full" },
|
|
4
|
+
import { $t as k } from "../../utils/i18n.js";
|
|
5
|
+
const oe = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "placeholder", "disabled"], ne = { 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" }, 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
|
-
}, ge = { class: "shrink-0 mr-3" }, pe = { class: "p-2 bg-primary-light rounded text-primary-fg-light" },
|
|
11
|
+
}, ge = { class: "shrink-0 mr-3" }, pe = { class: "p-2 bg-primary-light rounded text-primary-fg-light" }, ve = { class: "flex-1 min-w-0 flex flex-col items-start overflow-hidden" }, he = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "inline-flex items-center group/rename w-fit max-w-full mb-0.5"
|
|
14
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
15
|
key: 1,
|
|
16
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 = {
|
|
17
|
+
}, we = { class: "text-xs text-muted-foreground -mt-1" }, Ve = { class: "flex-shrink-0 ml-3 flex gap-2 items-center" }, Fe = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "flex gap-2"
|
|
20
|
-
},
|
|
21
|
-
key: 2,
|
|
22
|
-
class: "absolute inset-0 bg-white/80 flex items-center justify-center rounded-lg z-10"
|
|
23
|
-
}, Ae = { class: "bg-white p-2 rounded-full" }, Be = /* @__PURE__ */ Z({
|
|
20
|
+
}, ze = /* @__PURE__ */ Z({
|
|
24
21
|
name: "FilePicker",
|
|
25
22
|
__name: "FilePicker",
|
|
26
23
|
props: {
|
|
@@ -42,21 +39,21 @@ const oe = { class: "w-full" }, re = ["multiple", "accept"], ae = ["value", "pla
|
|
|
42
39
|
},
|
|
43
40
|
emits: ["update:modelValue", "change", "error"],
|
|
44
41
|
setup(o, { emit: M }) {
|
|
45
|
-
const e = o,
|
|
46
|
-
() => e.placeholderI18n ?
|
|
42
|
+
const e = o, u = M, P = m(
|
|
43
|
+
() => e.placeholderI18n ? k(e.placeholderI18n) : e.placeholder !== void 0 ? e.placeholder : "Select file..."
|
|
47
44
|
), $ = m(() => {
|
|
48
|
-
if (e.textI18n) return
|
|
49
|
-
const l =
|
|
45
|
+
if (e.textI18n) return k(e.textI18n);
|
|
46
|
+
const l = k("vlite.filePicker.clickToUpload");
|
|
50
47
|
return l !== "vlite.filePicker.clickToUpload" ? l : "Click to upload";
|
|
51
48
|
}), j = m(() => {
|
|
52
|
-
const l =
|
|
49
|
+
const l = k("vlite.filePicker.dragAndDrop");
|
|
53
50
|
return l !== "vlite.filePicker.dragAndDrop" ? l : "or drag and drop";
|
|
54
51
|
}), U = m(() => {
|
|
55
|
-
const l =
|
|
52
|
+
const l = k("vlite.filePicker.addMore");
|
|
56
53
|
return l !== "vlite.filePicker.addMore" ? l : "Add more";
|
|
57
|
-
}), z =
|
|
54
|
+
}), z = A(null), y = A(!1), n = A(!1);
|
|
58
55
|
_();
|
|
59
|
-
const E = m(() => e.fileTypes.join(",")),
|
|
56
|
+
const E = m(() => e.fileTypes.join(",")), S = m(() => Array.isArray(e.modelValue) ? e.modelValue.length > 0 : e.modelValue !== null), w = m(() => {
|
|
60
57
|
let l = [];
|
|
61
58
|
return Array.isArray(e.modelValue) ? l = e.modelValue : e.modelValue && (l = [e.modelValue]), l.map((t) => {
|
|
62
59
|
if (typeof t == "string") {
|
|
@@ -72,96 +69,96 @@ const oe = { class: "w-full" }, re = ["multiple", "accept"], ae = ["value", "pla
|
|
|
72
69
|
}
|
|
73
70
|
return t;
|
|
74
71
|
});
|
|
75
|
-
}),
|
|
76
|
-
if (!(e.disabled || e.loading ||
|
|
72
|
+
}), x = () => {
|
|
73
|
+
if (!(e.disabled || e.loading || n.value)) {
|
|
77
74
|
if (e.multiSelect && e.maxFiles && (Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0) >= e.maxFiles) {
|
|
78
|
-
|
|
75
|
+
u("error", `Maximum ${e.maxFiles} files allowed`);
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
78
|
z.value?.click();
|
|
82
79
|
}
|
|
83
80
|
}, L = (l) => {
|
|
84
|
-
l.preventDefault(), !(e.disabled || e.loading) && (
|
|
81
|
+
l.preventDefault(), !(e.disabled || e.loading) && (y.value = !0);
|
|
85
82
|
}, R = (l) => {
|
|
86
|
-
l.preventDefault(),
|
|
83
|
+
l.preventDefault(), y.value = !1;
|
|
87
84
|
}, W = (l) => {
|
|
88
|
-
l.preventDefault(),
|
|
85
|
+
l.preventDefault(), y.value = !1, !(e.disabled || e.loading || n.value) && l.dataTransfer?.files && D(l.dataTransfer.files);
|
|
89
86
|
}, O = (l) => {
|
|
90
87
|
const t = l.target;
|
|
91
88
|
t.files && D(t.files), t.value = "";
|
|
92
89
|
}, q = (l) => {
|
|
93
90
|
if (l === 0 || !l) return "";
|
|
94
|
-
const t = 1024, i = ["Bytes", "KB", "MB", "GB", "TB"],
|
|
95
|
-
return parseFloat((l / Math.pow(t,
|
|
91
|
+
const t = 1024, i = ["Bytes", "KB", "MB", "GB", "TB"], d = Math.floor(Math.log(l) / Math.log(t));
|
|
92
|
+
return parseFloat((l / Math.pow(t, d)).toFixed(2)) + " " + i[d];
|
|
96
93
|
}, G = (l) => new Promise((t, i) => {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
typeof
|
|
100
|
-
},
|
|
94
|
+
const d = new FileReader();
|
|
95
|
+
d.readAsDataURL(l), d.onload = () => {
|
|
96
|
+
typeof d.result == "string" ? t(d.result) : i(new Error("Failed to read file as base64"));
|
|
97
|
+
}, d.onerror = (c) => i(c);
|
|
101
98
|
}), D = async (l) => {
|
|
102
99
|
if (l.length === 0) return;
|
|
103
|
-
|
|
104
|
-
const t = [], i = [],
|
|
105
|
-
let
|
|
100
|
+
n.value = !0;
|
|
101
|
+
const t = [], i = [], d = Array.from(l);
|
|
102
|
+
let c = e.multiSelect ? d : [d[0]];
|
|
106
103
|
if (e.multiSelect && e.maxFiles) {
|
|
107
|
-
const
|
|
104
|
+
const a = Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0, g = e.maxFiles - a;
|
|
108
105
|
if (g <= 0) {
|
|
109
|
-
|
|
106
|
+
u("error", `Maximum ${e.maxFiles} files allowed`), n.value = !1;
|
|
110
107
|
return;
|
|
111
108
|
}
|
|
112
|
-
|
|
109
|
+
c.length > g && (i.push(`Only ${g} more file(s) allowed. Maximum ${e.maxFiles} files.`), c = c.slice(0, g));
|
|
113
110
|
}
|
|
114
111
|
try {
|
|
115
|
-
for (const
|
|
116
|
-
if (e.fileTypes.length > 0 && !e.fileTypes.some((
|
|
117
|
-
if (
|
|
118
|
-
return
|
|
119
|
-
if (
|
|
120
|
-
const Y =
|
|
121
|
-
return
|
|
112
|
+
for (const a of c) {
|
|
113
|
+
if (e.fileTypes.length > 0 && !e.fileTypes.some((b) => {
|
|
114
|
+
if (b.startsWith("."))
|
|
115
|
+
return a.name.toLowerCase().endsWith(b.toLowerCase());
|
|
116
|
+
if (b.endsWith("/*")) {
|
|
117
|
+
const Y = b.split("/")[0];
|
|
118
|
+
return a.type.startsWith(Y);
|
|
122
119
|
}
|
|
123
|
-
return
|
|
120
|
+
return a.type === b;
|
|
124
121
|
})) {
|
|
125
|
-
i.push(`File type not allowed: ${
|
|
122
|
+
i.push(`File type not allowed: ${a.name}`);
|
|
126
123
|
continue;
|
|
127
124
|
}
|
|
128
125
|
let g = !1;
|
|
129
|
-
e.maxSize &&
|
|
126
|
+
e.maxSize && a.size > e.maxSize && (i.push(`File too large: ${a.name}`), g = !0);
|
|
130
127
|
let B = "";
|
|
131
128
|
if (e.returnFormat === "base64" && !g)
|
|
132
129
|
try {
|
|
133
|
-
B = await G(
|
|
130
|
+
B = await G(a);
|
|
134
131
|
} catch (I) {
|
|
135
132
|
console.error("Base64 read failed", I);
|
|
136
133
|
}
|
|
137
134
|
t.push({
|
|
138
|
-
fileName:
|
|
139
|
-
fileType:
|
|
140
|
-
fileSize:
|
|
141
|
-
file:
|
|
135
|
+
fileName: a.name,
|
|
136
|
+
fileType: a.type,
|
|
137
|
+
fileSize: a.size,
|
|
138
|
+
file: a,
|
|
142
139
|
base64: B
|
|
143
140
|
});
|
|
144
141
|
}
|
|
145
|
-
if (i.length > 0 &&
|
|
146
|
-
let
|
|
147
|
-
e.multiSelect ?
|
|
142
|
+
if (i.length > 0 && u("error", i.join("; ")), t.length > 0) {
|
|
143
|
+
let a;
|
|
144
|
+
e.multiSelect ? a = [...Array.isArray(e.modelValue) ? e.modelValue : e.modelValue ? [e.modelValue] : [], ...t] : a = t[0], u("update:modelValue", a), u("change", a);
|
|
148
145
|
}
|
|
149
|
-
} catch (
|
|
150
|
-
console.error("Error processing files:",
|
|
146
|
+
} catch (a) {
|
|
147
|
+
console.error("Error processing files:", a), u("error", "Failed to process files");
|
|
151
148
|
} finally {
|
|
152
|
-
|
|
149
|
+
n.value = !1;
|
|
153
150
|
}
|
|
154
151
|
}, K = (l) => {
|
|
155
152
|
if (!(e.disabled || e.loading))
|
|
156
153
|
if (e.multiSelect && Array.isArray(e.modelValue)) {
|
|
157
154
|
const t = [...e.modelValue];
|
|
158
|
-
t.splice(l, 1),
|
|
155
|
+
t.splice(l, 1), u("update:modelValue", t), u("change", t);
|
|
159
156
|
} else
|
|
160
|
-
|
|
157
|
+
u("update:modelValue", null), u("change", null);
|
|
161
158
|
}, H = () => {
|
|
162
|
-
e.disabled || e.loading || (
|
|
159
|
+
e.disabled || e.loading || (u("update:modelValue", null), u("change", null));
|
|
163
160
|
}, J = (l, t) => {
|
|
164
|
-
if (e.disabled || e.loading) return;
|
|
161
|
+
if (e.disabled || e.loading || n.value) return;
|
|
165
162
|
let i;
|
|
166
163
|
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
164
|
fileName: t,
|
|
@@ -177,8 +174,8 @@ const oe = { class: "w-full" }, re = ["multiple", "accept"], ae = ["value", "pla
|
|
|
177
174
|
file: null,
|
|
178
175
|
base64: e.modelValue,
|
|
179
176
|
isUrl: !0
|
|
180
|
-
}), i !== void 0 && (
|
|
181
|
-
}, Q = m(() =>
|
|
177
|
+
}), i !== void 0 && (u("update:modelValue", i), u("change", i));
|
|
178
|
+
}, Q = m(() => S.value ? w.value.map((t) => t.fileName).join(", ") : ""), X = m(() => {
|
|
182
179
|
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 = {
|
|
183
180
|
sm: "h-8 text-xs",
|
|
184
181
|
md: "h-10 text-sm",
|
|
@@ -203,7 +200,7 @@ const oe = { class: "w-full" }, re = ["multiple", "accept"], ae = ["value", "pla
|
|
|
203
200
|
e.disabled ? "cursor-not-allowed opacity-50" : ""
|
|
204
201
|
].join(" ");
|
|
205
202
|
});
|
|
206
|
-
return (l, t) => (
|
|
203
|
+
return (l, t) => (r(), f("div", oe, [
|
|
207
204
|
s("input", {
|
|
208
205
|
ref_key: "fileInput",
|
|
209
206
|
ref: z,
|
|
@@ -212,133 +209,139 @@ const oe = { class: "w-full" }, re = ["multiple", "accept"], ae = ["value", "pla
|
|
|
212
209
|
accept: E.value,
|
|
213
210
|
class: "hidden",
|
|
214
211
|
onChange: O
|
|
215
|
-
}, null, 40,
|
|
212
|
+
}, null, 40, ae),
|
|
216
213
|
ee(l.$slots, "trigger", {
|
|
217
|
-
trigger:
|
|
218
|
-
isDragging:
|
|
219
|
-
isLoading: o.loading ||
|
|
220
|
-
files:
|
|
214
|
+
trigger: x,
|
|
215
|
+
isDragging: y.value,
|
|
216
|
+
isLoading: o.loading || n.value,
|
|
217
|
+
files: w.value
|
|
221
218
|
}, () => [
|
|
222
|
-
o.variant === "input" ? (
|
|
219
|
+
o.variant === "input" ? (r(), f("div", {
|
|
223
220
|
key: 0,
|
|
224
221
|
class: "relative",
|
|
225
|
-
onClick:
|
|
222
|
+
onClick: x
|
|
226
223
|
}, [
|
|
227
224
|
s("input", {
|
|
228
225
|
type: "text",
|
|
229
226
|
value: Q.value,
|
|
230
227
|
placeholder: P.value,
|
|
231
228
|
readonly: "",
|
|
232
|
-
class:
|
|
233
|
-
disabled: o.disabled || o.loading ||
|
|
234
|
-
}, null, 10,
|
|
235
|
-
s("div",
|
|
236
|
-
o.loading ||
|
|
229
|
+
class: C(X.value),
|
|
230
|
+
disabled: o.disabled || o.loading || n.value
|
|
231
|
+
}, null, 10, re),
|
|
232
|
+
s("div", ne, [
|
|
233
|
+
o.loading || n.value ? (r(), v(p, {
|
|
237
234
|
key: 0,
|
|
238
235
|
icon: "lucide:loader-2",
|
|
239
236
|
class: "h-4 w-4 animate-spin text-muted-foreground"
|
|
240
|
-
})) :
|
|
237
|
+
})) : S.value && !o.disabled ? (r(), f("button", {
|
|
241
238
|
key: 1,
|
|
242
239
|
type: "button",
|
|
243
240
|
class: "text-muted-foreground hover:text-foreground focus:outline-none",
|
|
244
|
-
onClick:
|
|
241
|
+
onClick: V(H, ["stop"])
|
|
245
242
|
}, [
|
|
246
|
-
|
|
243
|
+
F(p, {
|
|
247
244
|
icon: "lucide:x-circle",
|
|
248
245
|
class: "h-4 w-4"
|
|
249
246
|
})
|
|
250
|
-
])) : (
|
|
247
|
+
])) : (r(), v(p, {
|
|
251
248
|
key: 2,
|
|
252
249
|
icon: "lucide:upload",
|
|
253
250
|
class: "h-4 w-4 text-muted-foreground"
|
|
254
251
|
}))
|
|
255
252
|
])
|
|
256
|
-
])) : (
|
|
253
|
+
])) : (r(), f("div", {
|
|
257
254
|
key: 1,
|
|
258
255
|
class: "relative",
|
|
259
256
|
onDragover: L,
|
|
260
257
|
onDragleave: R,
|
|
261
258
|
onDrop: W
|
|
262
259
|
}, [
|
|
263
|
-
|
|
264
|
-
(
|
|
265
|
-
key:
|
|
266
|
-
class:
|
|
267
|
-
|
|
260
|
+
S.value ? (r(), f("div", me, [
|
|
261
|
+
(r(!0), f(te, null, ie(w.value, (i, d) => (r(), f("div", {
|
|
262
|
+
key: d,
|
|
263
|
+
class: C(["relative flex items-center p-3 border border-border rounded-lg bg-body transition-colors group", [
|
|
264
|
+
!o.multiSelect && !o.disabled && !o.loading && !n.value ? "cursor-pointer hover:border-primary/50" : ""
|
|
265
|
+
]]),
|
|
266
|
+
onClick: t[2] || (t[2] = (c) => !o.multiSelect && !o.disabled && !o.loading && !n.value ? x() : null)
|
|
268
267
|
}, [
|
|
269
268
|
s("div", ge, [
|
|
270
269
|
s("div", pe, [
|
|
271
|
-
|
|
270
|
+
F(p, {
|
|
272
271
|
icon: "lucide:file-text",
|
|
273
272
|
class: "w-5 h-5"
|
|
274
273
|
})
|
|
275
274
|
])
|
|
276
275
|
]),
|
|
277
|
-
s("div",
|
|
278
|
-
o.allowRename && !o.disabled ? (
|
|
276
|
+
s("div", ve, [
|
|
277
|
+
o.allowRename && !o.disabled && !o.loading && !n.value ? (r(), f("div", he, [
|
|
279
278
|
s("div", ye, [
|
|
280
279
|
s("span", xe, h(i.fileName || "Enter file name"), 1),
|
|
281
280
|
s("input", {
|
|
282
281
|
value: i.fileName,
|
|
283
|
-
onClick: t[0] || (t[0] =
|
|
282
|
+
onClick: t[0] || (t[0] = V(() => {
|
|
284
283
|
}, ["stop"])),
|
|
285
|
-
onInput: (
|
|
284
|
+
onInput: (c) => J(d, c.target.value),
|
|
286
285
|
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
286
|
placeholder: "Enter file name"
|
|
288
287
|
}, null, 40, be)
|
|
289
288
|
]),
|
|
290
289
|
s("div", {
|
|
291
290
|
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] =
|
|
293
|
-
(
|
|
291
|
+
onClick: t[1] || (t[1] = V(
|
|
292
|
+
(c) => c.currentTarget.previousElementSibling?.querySelector("input")?.focus(),
|
|
294
293
|
["stop"]
|
|
295
294
|
)),
|
|
296
295
|
title: "Rename file"
|
|
297
296
|
}, [
|
|
298
|
-
|
|
297
|
+
F(p, {
|
|
299
298
|
icon: "lucide:pencil",
|
|
300
|
-
class: "w-3
|
|
299
|
+
class: "w-3 h-3"
|
|
301
300
|
})
|
|
302
301
|
])
|
|
303
|
-
])) : (
|
|
302
|
+
])) : (r(), f("p", ke, h(i.fileName), 1)),
|
|
304
303
|
s("p", we, h(q(i.fileSize)), 1)
|
|
305
304
|
]),
|
|
306
305
|
s("div", Ve, [
|
|
307
|
-
|
|
306
|
+
o.loading || n.value ? (r(), v(p, {
|
|
308
307
|
key: 0,
|
|
308
|
+
icon: "lucide:loader-2",
|
|
309
|
+
class: "w-4 h-4 animate-spin text-primary"
|
|
310
|
+
})) : o.disabled ? T("", !0) : (r(), v(N, {
|
|
311
|
+
key: 1,
|
|
309
312
|
size: "xs",
|
|
310
313
|
variant: "ghost",
|
|
311
314
|
icon: "lucide:x",
|
|
312
315
|
rounded: "full",
|
|
313
316
|
class: "text-muted-foreground hover:text-destructive hover:bg-destructive/10",
|
|
314
|
-
onClick:
|
|
315
|
-
}, null, 8, ["onClick"]))
|
|
317
|
+
onClick: V((c) => K(d), ["stop"])
|
|
318
|
+
}, null, 8, ["onClick"]))
|
|
316
319
|
])
|
|
317
320
|
], 2))), 128)),
|
|
318
|
-
o.multiSelect && (!o.maxFiles ||
|
|
319
|
-
|
|
321
|
+
o.multiSelect && (!o.maxFiles || w.value.length < o.maxFiles) ? (r(), f("div", Fe, [
|
|
322
|
+
F(N, {
|
|
320
323
|
size: "sm",
|
|
321
324
|
variant: "outline",
|
|
322
325
|
icon: "lucide:plus",
|
|
323
326
|
text: U.value,
|
|
324
|
-
disabled: o.disabled || o.loading ||
|
|
325
|
-
onClick:
|
|
327
|
+
disabled: o.disabled || o.loading || n.value,
|
|
328
|
+
onClick: x
|
|
326
329
|
}, null, 8, ["text", "disabled"])
|
|
327
|
-
])) :
|
|
328
|
-
])) : (
|
|
330
|
+
])) : T("", !0)
|
|
331
|
+
])) : (r(), f("div", {
|
|
329
332
|
key: 0,
|
|
330
|
-
class:
|
|
331
|
-
|
|
332
|
-
o.disabled || o.loading ||
|
|
333
|
+
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", [
|
|
334
|
+
y.value ? "border-primary bg-primary/5" : "hover:border-primary/50 ",
|
|
335
|
+
o.disabled || o.loading || n.value ? "opacity-50 cursor-not-allowed" : ""
|
|
333
336
|
]]),
|
|
334
|
-
onClick:
|
|
337
|
+
onClick: x
|
|
335
338
|
}, [
|
|
336
|
-
s("div",
|
|
337
|
-
o.loading ||
|
|
339
|
+
s("div", se, [
|
|
340
|
+
o.loading || n.value ? (r(), v(p, {
|
|
338
341
|
key: 0,
|
|
339
342
|
icon: "lucide:loader-2",
|
|
340
343
|
class: "w-6 h-6 animate-spin"
|
|
341
|
-
})) : (
|
|
344
|
+
})) : (r(), v(p, {
|
|
342
345
|
key: 1,
|
|
343
346
|
icon: "lucide:upload-cloud",
|
|
344
347
|
class: "w-6 h-6"
|
|
@@ -349,22 +352,14 @@ const oe = { class: "w-full" }, re = ["multiple", "accept"], ae = ["value", "pla
|
|
|
349
352
|
s("span", ce, h($.value), 1),
|
|
350
353
|
le(" " + h(j.value), 1)
|
|
351
354
|
]),
|
|
352
|
-
o.fileTypes.length ? (
|
|
355
|
+
o.fileTypes.length ? (r(), f("p", fe, h(o.fileTypes.join(", ")), 1)) : T("", !0)
|
|
353
356
|
])
|
|
354
|
-
], 2))
|
|
355
|
-
o.loading || c.value ? (a(), u("div", Se, [
|
|
356
|
-
s("div", Ae, [
|
|
357
|
-
k(p, {
|
|
358
|
-
icon: "lucide:loader-2",
|
|
359
|
-
class: "w-6 h-6 animate-spin text-primary"
|
|
360
|
-
})
|
|
361
|
-
])
|
|
362
|
-
])) : S("", !0)
|
|
357
|
+
], 2))
|
|
363
358
|
], 32))
|
|
364
359
|
])
|
|
365
360
|
]));
|
|
366
361
|
}
|
|
367
362
|
});
|
|
368
363
|
export {
|
|
369
|
-
|
|
364
|
+
ze as default
|
|
370
365
|
};
|
package/components/Input.vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as Y, computed as a, useSlots as Z, ref as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as Y, computed as a, useSlots as Z, ref as v, onMounted as _, nextTick as z, openBlock as d, createElementBlock as u, normalizeClass as r, createBlock as R, withCtx as ee, createTextVNode as $, toDisplayString as w, createCommentVNode as i, createElementVNode as A, renderSlot as M, createVNode as k } from "vue";
|
|
2
|
+
import g from "./Icon.vue.js";
|
|
3
3
|
import te from "./Label.vue.js";
|
|
4
4
|
import le from "./Textarea.vue.js";
|
|
5
5
|
import { $t as E } from "../utils/i18n.js";
|
|
@@ -41,7 +41,7 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
41
41
|
setup(t, { emit: D }) {
|
|
42
42
|
const e = t, c = D, s = a(() => e.labelI18n ? E(e.labelI18n) : e.label), I = a(
|
|
43
43
|
() => e.placeholderI18n ? E(e.placeholderI18n) : e.placeholder
|
|
44
|
-
),
|
|
44
|
+
), x = Z(), m = v(null), y = v(!1), h = v(!1), H = a(() => e.type === "password" && y.value ? "text" : e.type), C = a(() => e.modelValue !== "" && e.modelValue !== null && e.modelValue !== void 0), V = a(() => b.value || C.value || h.value), p = a(() => !!e.addonLeft || !!x["addon-left"]), B = a(() => !!e.addonRight || !!x["addon-right"]), U = a(() => [
|
|
45
45
|
"relative w-full",
|
|
46
46
|
e.class,
|
|
47
47
|
e.labelPosition === "left" ? "flex items-center gap-4" : "",
|
|
@@ -69,16 +69,16 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
69
69
|
"2xl": "rounded-2xl",
|
|
70
70
|
full: "rounded-full"
|
|
71
71
|
}[e.rounded];
|
|
72
|
-
|
|
73
|
-
const
|
|
72
|
+
p.value && (e.rounded === "md" ? o = "rounded-r-md rounded-l-none" : e.rounded === "sm" ? o = "rounded-r-sm rounded-l-none" : e.rounded === "lg" ? o = "rounded-r-lg rounded-l-none" : e.rounded === "full" ? o = "rounded-r-full rounded-l-none" : e.rounded !== "none" && (o = o.replace("rounded-", "rounded-r-").replace("rounded-l-", ""))), B.value && (p.value ? o = "rounded-none" : e.rounded === "md" ? o = "rounded-l-md rounded-r-none" : e.rounded === "sm" ? o = "rounded-l-sm rounded-r-none" : e.rounded === "lg" ? o = "rounded-l-lg rounded-r-none" : e.rounded === "full" ? o = "rounded-l-full rounded-r-none" : e.rounded !== "none" && (o = o.replace("rounded-", "rounded-l-").replace("rounded-r-", ""))), e.variant === "outline-b" && (o = "rounded-none");
|
|
73
|
+
const T = e.variant === "outline-b" || e.variant === "transparent";
|
|
74
74
|
return e.variant, [
|
|
75
75
|
l,
|
|
76
76
|
n[e.variant],
|
|
77
77
|
e.type === "textarea" ? "" : f[e.size],
|
|
78
78
|
o,
|
|
79
79
|
e.error ? "border-destructive focus-visible:ring-destructive" : "",
|
|
80
|
-
e.icon ? "pl-9" :
|
|
81
|
-
e.showClearButton && C.value || e.type === "password" || e.loading || e.iconRight ? "pr-9" :
|
|
80
|
+
e.icon ? "pl-9" : T && !p.value ? "pl-0" : "",
|
|
81
|
+
e.showClearButton && C.value || e.type === "password" || e.loading || e.iconRight ? "pr-9" : T && !B.value ? "pr-0" : "",
|
|
82
82
|
// Keyframe name used to detect browser autofill via animationstart event
|
|
83
83
|
e.variant === "floating" ? "autofill-detect" : "",
|
|
84
84
|
e.inputClass
|
|
@@ -97,7 +97,7 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
97
97
|
"z-10"
|
|
98
98
|
].join(" ");
|
|
99
99
|
}, q = a(() => {
|
|
100
|
-
const l = !!
|
|
100
|
+
const l = !!x["addon-left"];
|
|
101
101
|
return [
|
|
102
102
|
"flex items-center justify-center whitespace-nowrap",
|
|
103
103
|
l ? `border-none ${P("left")}` : `bg-muted border border-input border-r-0! px-3 text-muted-foreground ${{
|
|
@@ -114,7 +114,7 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
114
114
|
e.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
115
115
|
].join(" ");
|
|
116
116
|
}), G = a(() => {
|
|
117
|
-
const l = !!
|
|
117
|
+
const l = !!x["addon-right"];
|
|
118
118
|
return [
|
|
119
119
|
"flex items-center justify-center whitespace-nowrap",
|
|
120
120
|
l ? `border-none ${P("right")}` : `bg-muted border border-input border-l-0! px-3 text-muted-foreground ${{
|
|
@@ -137,23 +137,25 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
137
137
|
const n = l.target;
|
|
138
138
|
c("change", n.value);
|
|
139
139
|
}, O = () => {
|
|
140
|
-
e.disabled || e.readonly || (
|
|
140
|
+
e.disabled || e.readonly || (y.value = !y.value);
|
|
141
141
|
}, Q = () => {
|
|
142
142
|
e.disabled || e.readonly || (c("update:modelValue", ""), z(() => {
|
|
143
143
|
m.value?.focus();
|
|
144
144
|
}));
|
|
145
|
-
},
|
|
146
|
-
|
|
145
|
+
}, b = v(!1), j = v(!1), F = (l) => {
|
|
146
|
+
b.value = !0, c("focus", l);
|
|
147
147
|
}, N = (l) => {
|
|
148
|
-
|
|
148
|
+
b.value = !1, c("blur", l);
|
|
149
149
|
}, X = (l) => {
|
|
150
|
-
l.animationName === "onAutoFillStart" ?
|
|
150
|
+
l.animationName === "onAutoFillStart" ? h.value = !0 : l.animationName === "onAutoFillCancel" && (h.value = !1);
|
|
151
151
|
};
|
|
152
152
|
return _(() => {
|
|
153
153
|
e.autofocus && z(() => {
|
|
154
|
-
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
m.value?.focus(), b.value = !0;
|
|
156
|
+
}, 100);
|
|
155
157
|
}), z(() => {
|
|
156
|
-
m.value && m.value.value && !e.modelValue && (
|
|
158
|
+
m.value && m.value.value && !e.modelValue && (h.value = !0);
|
|
157
159
|
});
|
|
158
160
|
}), (l, n) => (d(), u("div", {
|
|
159
161
|
class: r(U.value)
|
|
@@ -171,11 +173,11 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
171
173
|
A("div", {
|
|
172
174
|
class: r(W.value)
|
|
173
175
|
}, [
|
|
174
|
-
|
|
176
|
+
p.value ? (d(), u("div", {
|
|
175
177
|
key: 0,
|
|
176
178
|
class: r(q.value)
|
|
177
179
|
}, [
|
|
178
|
-
|
|
180
|
+
M(l.$slots, "addon-left", {}, () => [
|
|
179
181
|
$(w(t.addonLeft), 1)
|
|
180
182
|
])
|
|
181
183
|
], 2)) : i("", !0),
|
|
@@ -229,13 +231,13 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
229
231
|
t.disabled ? "opacity-50" : ""
|
|
230
232
|
])
|
|
231
233
|
}, [
|
|
232
|
-
k(
|
|
234
|
+
k(g, {
|
|
233
235
|
icon: t.icon,
|
|
234
236
|
class: r(["h-4 w-4", t.iconClass])
|
|
235
237
|
}, null, 8, ["icon", "class"])
|
|
236
238
|
], 2)) : i("", !0),
|
|
237
239
|
A("div", ae, [
|
|
238
|
-
t.loading ? (d(), R(
|
|
240
|
+
t.loading ? (d(), R(g, {
|
|
239
241
|
key: 0,
|
|
240
242
|
icon: "lucide:loader-2",
|
|
241
243
|
class: "h-4 w-4 animate-spin text-muted-foreground"
|
|
@@ -248,7 +250,7 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
248
250
|
]),
|
|
249
251
|
onClick: n[1] || (n[1] = (f) => !t.disabled && !t.readonly && c("click:icon-right", f))
|
|
250
252
|
}, [
|
|
251
|
-
k(
|
|
253
|
+
k(g, {
|
|
252
254
|
icon: t.iconRight,
|
|
253
255
|
class: r(["h-4 w-4", t.iconRightClass])
|
|
254
256
|
}, null, 8, ["icon", "class"])
|
|
@@ -260,19 +262,19 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
260
262
|
class: "flex items-center justify-center text-muted-foreground hover:text-foreground focus:outline-none",
|
|
261
263
|
onClick: O
|
|
262
264
|
}, [
|
|
263
|
-
k(
|
|
264
|
-
icon:
|
|
265
|
+
k(g, {
|
|
266
|
+
icon: y.value ? "lucide:eye-off" : "lucide:eye",
|
|
265
267
|
class: "h-4 w-4"
|
|
266
268
|
}, null, 8, ["icon"])
|
|
267
269
|
])) : i("", !0),
|
|
268
|
-
t.showClearButton && C.value && !t.disabled && !t.readonly && !t.loading && t.type !== "textarea" && t.type !== "password" && (
|
|
270
|
+
t.showClearButton && C.value && !t.disabled && !t.readonly && !t.loading && t.type !== "textarea" && t.type !== "password" && (b.value || j.value) ? (d(), u("button", {
|
|
269
271
|
key: 3,
|
|
270
272
|
type: "button",
|
|
271
273
|
tabindex: "-1",
|
|
272
274
|
class: "flex items-center justify-center text-muted-foreground hover:text-foreground focus:outline-none transition-opacity duration-200",
|
|
273
275
|
onClick: Q
|
|
274
276
|
}, [
|
|
275
|
-
k(
|
|
277
|
+
k(g, {
|
|
276
278
|
icon: "lucide:x-circle",
|
|
277
279
|
class: "h-4 w-4"
|
|
278
280
|
})
|
|
@@ -283,7 +285,7 @@ const ne = ["for"], oe = ["type", "value", "placeholder", "disabled", "readonly"
|
|
|
283
285
|
key: 1,
|
|
284
286
|
class: r(G.value)
|
|
285
287
|
}, [
|
|
286
|
-
|
|
288
|
+
M(l.$slots, "addon-right", {}, () => [
|
|
287
289
|
$(w(t.addonRight), 1)
|
|
288
290
|
])
|
|
289
291
|
], 2)) : i("", !0)
|