vlite3 0.7.11 → 0.7.13
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/Badge.vue.d.ts +6 -2
- package/components/Badge.vue.js +16 -9
- package/components/Button.vue.js +1 -1
- package/components/DatePicker.vue.js +1 -1
- package/components/FilePicker/FilePicker.vue.js +56 -54
- package/components/Form/CustomFields.vue.js +1 -1
- package/components/Form/CustomFields.vue2.js +60 -53
- package/components/Form/Form.vue.d.ts +12 -2
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form.vue2.js +228 -191
- package/components/Form/FormField.vue.d.ts +3 -0
- package/components/Form/FormField.vue.js +90 -82
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +59 -51
- package/components/List/ListFieldRow.vue.d.ts +4 -0
- package/components/List/ListFieldRow.vue.js +198 -113
- package/components/MultiSelect/MultiSelect.vue.d.ts +6 -0
- package/components/MultiSelect/MultiSelect.vue.js +116 -98
- package/components/NumberInput.vue.js +2 -2
- package/components/NumberInput.vue2.js +36 -35
- package/components/PermissionMatrix/PermissionEditor.vue.js +72 -129
- package/components/PermissionMatrix/PermissionEditorList.vue.js +1 -1
- package/components/PermissionMatrix/PermissionEditorList.vue2.js +101 -111
- package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +1 -1
- package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +129 -133
- package/components/PermissionMatrix/PermissionMatrix.vue.js +1 -1
- package/components/PermissionMatrix/PermissionMatrix.vue2.js +171 -156
- package/components/PermissionMatrix/usePermissionSearch.d.ts +13 -0
- package/components/PermissionMatrix/usePermissionSearch.js +71 -0
- package/components/PermissionMatrix/usePermissionState.d.ts +22 -0
- package/components/PermissionMatrix/usePermissionState.js +77 -0
- package/components/Screen/ScreenFilter.vue.js +32 -32
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type BadgeVariant = 'default' | 'secondary' | 'danger' | 'outline' | 'warning' | 'info' | 'success' | 'purple' | 'teal' | 'indigo' | 'orange' | 'pink' | 'cyan';
|
|
2
2
|
interface Props {
|
|
3
3
|
variant?: BadgeVariant | string;
|
|
4
|
-
|
|
4
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
5
|
+
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | string;
|
|
6
|
+
class?: any;
|
|
5
7
|
}
|
|
6
8
|
declare function __VLS_template(): {
|
|
7
9
|
attrs: Partial<{}>;
|
|
@@ -14,7 +16,9 @@ declare function __VLS_template(): {
|
|
|
14
16
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
15
17
|
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
16
18
|
variant: BadgeVariant | string;
|
|
17
|
-
|
|
19
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
20
|
+
rounded: "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "full" | string;
|
|
21
|
+
class: any;
|
|
18
22
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
19
23
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
24
|
export default _default;
|
package/components/Badge.vue.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { defineComponent as b, computed as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as b, computed as d, openBlock as a, createElementBlock as u, normalizeClass as i, renderSlot as c } from "vue";
|
|
2
|
+
const p = /* @__PURE__ */ b({
|
|
3
3
|
__name: "Badge",
|
|
4
4
|
props: {
|
|
5
5
|
variant: { default: "default" },
|
|
6
|
+
size: { default: "md" },
|
|
7
|
+
rounded: { default: "full" },
|
|
6
8
|
class: { default: "" }
|
|
7
9
|
},
|
|
8
10
|
setup(o) {
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
+
const e = o, s = d(() => {
|
|
12
|
+
const r = {
|
|
13
|
+
xs: "px-1.5 h-5 text-[10.5px] leading-none",
|
|
14
|
+
sm: "px-2 h-6 text-xs font-medium",
|
|
15
|
+
md: "px-2.5 h-7 text-xs font-semibold",
|
|
16
|
+
lg: "px-3 h-8 text-sm font-semibold"
|
|
17
|
+
}, l = `inline-flex items-center ${e.rounded === "none" ? "rounded-none" : `rounded-${e.rounded}`} border ${r[e.size] || r.md} focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`, t = {
|
|
11
18
|
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
12
19
|
outline: "text-foreground border-border",
|
|
13
20
|
/* Base Semantics */
|
|
@@ -24,15 +31,15 @@ const c = /* @__PURE__ */ b({
|
|
|
24
31
|
pink: "border-pink-subtle-border bg-pink-subtle text-pink-subtle-fg hover:opacity-80",
|
|
25
32
|
cyan: "border-cyan-subtle-border bg-cyan-subtle text-cyan-subtle-fg hover:opacity-80"
|
|
26
33
|
};
|
|
27
|
-
return [
|
|
34
|
+
return [l, t[e.variant] || t.default, e.class].join(" ");
|
|
28
35
|
});
|
|
29
|
-
return (
|
|
30
|
-
class:
|
|
36
|
+
return (r, n) => (a(), u("div", {
|
|
37
|
+
class: i(s.value)
|
|
31
38
|
}, [
|
|
32
|
-
|
|
39
|
+
c(r.$slots, "default")
|
|
33
40
|
], 2));
|
|
34
41
|
}
|
|
35
42
|
});
|
|
36
43
|
export {
|
|
37
|
-
|
|
44
|
+
p as default
|
|
38
45
|
};
|
package/components/Button.vue.js
CHANGED
|
@@ -38,7 +38,7 @@ const D = ["type", "disabled"], q = /* @__PURE__ */ B({
|
|
|
38
38
|
success: "bg-success text-success-fg hover:bg-success/80",
|
|
39
39
|
"success-light": "bg-success-light text-success-fg-light hover:bg-success/20",
|
|
40
40
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground text-foreground",
|
|
41
|
-
"outline-floating": "border border-input bg-transparent hover:bg-transparent text-foreground border-input",
|
|
41
|
+
"outline-floating": "border px-3.5! border-input bg-transparent hover:bg-transparent text-foreground border-input active:scale-100!",
|
|
42
42
|
"outline-primary": "border border-primary text-primary hover:bg-primary/10",
|
|
43
43
|
"outline-danger": "border border-destructive text-destructive hover:bg-destructive/10",
|
|
44
44
|
"outline-warning": "border border-warning text-warning hover:bg-warning/10",
|
|
@@ -52,7 +52,7 @@ const S = { class: "overflow-hidden min-w-[300px]" }, U = /* @__PURE__ */ P({
|
|
|
52
52
|
}
|
|
53
53
|
}), s = n(() => {
|
|
54
54
|
if (l.placeholderI18n) return y(l.placeholderI18n);
|
|
55
|
-
if (l.placeholder) return l.placeholder;
|
|
55
|
+
if (l.placeholder !== void 0) return l.placeholder;
|
|
56
56
|
const t = y("vlite.datePicker.placeholder");
|
|
57
57
|
return t !== "vlite.datePicker.placeholder" ? t : "Select date";
|
|
58
58
|
}), c = (t) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as Y, computed as f, ref as S, useSlots as Z, openBlock as
|
|
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 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
2
|
import p from "../Icon.vue.js";
|
|
3
3
|
import P from "../Button.vue.js";
|
|
4
4
|
import { $t as k } from "../../utils/i18n.js";
|
|
5
|
-
const ie = { class: "w-full" },
|
|
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 = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "text-xs text-muted-foreground"
|
|
8
8
|
}, fe = {
|
|
@@ -35,7 +35,9 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
35
35
|
},
|
|
36
36
|
emits: ["update:modelValue", "change", "error"],
|
|
37
37
|
setup(i, { emit: $ }) {
|
|
38
|
-
const e = i, d = $, I = f(
|
|
38
|
+
const e = i, d = $, I = f(
|
|
39
|
+
() => e.placeholderI18n ? k(e.placeholderI18n) : e.placeholder !== void 0 ? e.placeholder : "Select file..."
|
|
40
|
+
), N = f(() => {
|
|
39
41
|
if (e.textI18n) return k(e.textI18n);
|
|
40
42
|
const l = k("vlite.filePicker.clickToUpload");
|
|
41
43
|
return l !== "vlite.filePicker.clickToUpload" ? l : "Click to upload";
|
|
@@ -51,9 +53,9 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
51
53
|
let l = [];
|
|
52
54
|
return Array.isArray(e.modelValue) ? l = e.modelValue : e.modelValue && (l = [e.modelValue]), l.map((t) => {
|
|
53
55
|
if (typeof t == "string") {
|
|
54
|
-
const
|
|
56
|
+
const a = t.split("/").pop() || "Unknown File";
|
|
55
57
|
return {
|
|
56
|
-
fileName: decodeURIComponent(
|
|
58
|
+
fileName: decodeURIComponent(a),
|
|
57
59
|
fileType: "unknown",
|
|
58
60
|
fileSize: 0,
|
|
59
61
|
file: null,
|
|
@@ -82,63 +84,63 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
82
84
|
t.files && D(t.files), t.value = "";
|
|
83
85
|
}, G = (l) => {
|
|
84
86
|
if (l === 0 || !l) return "";
|
|
85
|
-
const t = 1024,
|
|
86
|
-
return parseFloat((l / Math.pow(t, s)).toFixed(2)) + " " +
|
|
87
|
-
}, K = (l) => new Promise((t,
|
|
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) => {
|
|
88
90
|
const s = new FileReader();
|
|
89
91
|
s.readAsDataURL(l), s.onload = () => {
|
|
90
|
-
typeof s.result == "string" ? t(s.result) :
|
|
91
|
-
}, s.onerror = (m) =>
|
|
92
|
+
typeof s.result == "string" ? t(s.result) : a(new Error("Failed to read file as base64"));
|
|
93
|
+
}, s.onerror = (m) => a(m);
|
|
92
94
|
}), D = async (l) => {
|
|
93
95
|
if (l.length === 0) return;
|
|
94
96
|
u.value = !0;
|
|
95
|
-
const t = [],
|
|
97
|
+
const t = [], a = [], s = Array.from(l);
|
|
96
98
|
let m = e.multiSelect ? s : [s[0]];
|
|
97
99
|
if (e.multiSelect && e.maxFiles) {
|
|
98
|
-
const
|
|
100
|
+
const o = Array.isArray(e.modelValue) ? e.modelValue.length : e.modelValue ? 1 : 0, g = e.maxFiles - o;
|
|
99
101
|
if (g <= 0) {
|
|
100
102
|
d("error", `Maximum ${e.maxFiles} files allowed`), u.value = !1;
|
|
101
103
|
return;
|
|
102
104
|
}
|
|
103
|
-
m.length > g && (
|
|
105
|
+
m.length > g && (a.push(`Only ${g} more file(s) allowed. Maximum ${e.maxFiles} files.`), m = m.slice(0, g));
|
|
104
106
|
}
|
|
105
107
|
try {
|
|
106
|
-
for (const
|
|
108
|
+
for (const o of m) {
|
|
107
109
|
if (e.fileTypes.length > 0 && !e.fileTypes.some((x) => {
|
|
108
110
|
if (x.startsWith("."))
|
|
109
|
-
return
|
|
111
|
+
return o.name.toLowerCase().endsWith(x.toLowerCase());
|
|
110
112
|
if (x.endsWith("/*")) {
|
|
111
113
|
const X = x.split("/")[0];
|
|
112
|
-
return
|
|
114
|
+
return o.type.startsWith(X);
|
|
113
115
|
}
|
|
114
|
-
return
|
|
116
|
+
return o.type === x;
|
|
115
117
|
})) {
|
|
116
|
-
|
|
118
|
+
a.push(`File type not allowed: ${o.name}`);
|
|
117
119
|
continue;
|
|
118
120
|
}
|
|
119
121
|
let g = !1;
|
|
120
|
-
e.maxSize &&
|
|
122
|
+
e.maxSize && o.size > e.maxSize && (a.push(`File too large: ${o.name}`), g = !0);
|
|
121
123
|
let T = "";
|
|
122
124
|
if (e.returnFormat === "base64" && !g)
|
|
123
125
|
try {
|
|
124
|
-
T = await K(
|
|
126
|
+
T = await K(o);
|
|
125
127
|
} catch (B) {
|
|
126
128
|
console.error("Base64 read failed", B);
|
|
127
129
|
}
|
|
128
130
|
t.push({
|
|
129
|
-
fileName:
|
|
130
|
-
fileType:
|
|
131
|
-
fileSize:
|
|
132
|
-
file:
|
|
131
|
+
fileName: o.name,
|
|
132
|
+
fileType: o.type,
|
|
133
|
+
fileSize: o.size,
|
|
134
|
+
file: o,
|
|
133
135
|
base64: T
|
|
134
136
|
});
|
|
135
137
|
}
|
|
136
|
-
if (
|
|
137
|
-
let
|
|
138
|
-
e.multiSelect ?
|
|
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);
|
|
139
141
|
}
|
|
140
|
-
} catch (
|
|
141
|
-
console.error("Error processing files:",
|
|
142
|
+
} catch (o) {
|
|
143
|
+
console.error("Error processing files:", o), d("error", "Failed to process files");
|
|
142
144
|
} finally {
|
|
143
145
|
u.value = !1;
|
|
144
146
|
}
|
|
@@ -156,7 +158,7 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
156
158
|
sm: "h-8 text-xs",
|
|
157
159
|
md: "h-10 text-sm",
|
|
158
160
|
lg: "h-12 text-base"
|
|
159
|
-
},
|
|
161
|
+
}, a = {
|
|
160
162
|
none: "rounded-none",
|
|
161
163
|
sm: "rounded-sm",
|
|
162
164
|
md: "rounded-md",
|
|
@@ -170,13 +172,13 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
170
172
|
"border border-input focus-visible:border-primary",
|
|
171
173
|
// Default outline style
|
|
172
174
|
t[e.size],
|
|
173
|
-
|
|
175
|
+
a[e.rounded],
|
|
174
176
|
"pr-10",
|
|
175
177
|
// Space for icon
|
|
176
178
|
e.disabled ? "cursor-not-allowed opacity-50" : ""
|
|
177
179
|
].join(" ");
|
|
178
180
|
});
|
|
179
|
-
return (l, t) => (
|
|
181
|
+
return (l, t) => (r(), c("div", ie, [
|
|
180
182
|
n("input", {
|
|
181
183
|
ref_key: "fileInput",
|
|
182
184
|
ref: z,
|
|
@@ -185,14 +187,14 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
185
187
|
accept: U.value,
|
|
186
188
|
class: "hidden",
|
|
187
189
|
onChange: O
|
|
188
|
-
}, null, 40,
|
|
190
|
+
}, null, 40, oe),
|
|
189
191
|
_(l.$slots, "trigger", {
|
|
190
192
|
trigger: v,
|
|
191
193
|
isDragging: h.value,
|
|
192
194
|
isLoading: i.loading || u.value,
|
|
193
195
|
files: w.value
|
|
194
196
|
}, () => [
|
|
195
|
-
i.variant === "input" ? (
|
|
197
|
+
i.variant === "input" ? (r(), c("div", {
|
|
196
198
|
key: 0,
|
|
197
199
|
class: "relative",
|
|
198
200
|
onClick: v
|
|
@@ -204,13 +206,13 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
204
206
|
readonly: "",
|
|
205
207
|
class: C(Q.value),
|
|
206
208
|
disabled: i.disabled || i.loading || u.value
|
|
207
|
-
}, null, 10,
|
|
208
|
-
n("div",
|
|
209
|
-
i.loading || u.value ? (
|
|
209
|
+
}, null, 10, ae),
|
|
210
|
+
n("div", re, [
|
|
211
|
+
i.loading || u.value ? (r(), y(p, {
|
|
210
212
|
key: 0,
|
|
211
213
|
icon: "lucide:loader-2",
|
|
212
214
|
class: "h-4 w-4 animate-spin text-muted-foreground"
|
|
213
|
-
})) : A.value && !i.disabled ? (
|
|
215
|
+
})) : A.value && !i.disabled ? (r(), c("button", {
|
|
214
216
|
key: 1,
|
|
215
217
|
type: "button",
|
|
216
218
|
class: "text-muted-foreground hover:text-foreground focus:outline-none",
|
|
@@ -220,23 +222,23 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
220
222
|
icon: "lucide:x-circle",
|
|
221
223
|
class: "h-4 w-4"
|
|
222
224
|
})
|
|
223
|
-
])) : (
|
|
225
|
+
])) : (r(), y(p, {
|
|
224
226
|
key: 2,
|
|
225
227
|
icon: "lucide:upload",
|
|
226
228
|
class: "h-4 w-4 text-muted-foreground"
|
|
227
229
|
}))
|
|
228
230
|
])
|
|
229
|
-
])) : (
|
|
231
|
+
])) : (r(), c("div", {
|
|
230
232
|
key: 1,
|
|
231
233
|
class: "relative",
|
|
232
234
|
onDragover: E,
|
|
233
235
|
onDragleave: W,
|
|
234
236
|
onDrop: R
|
|
235
237
|
}, [
|
|
236
|
-
A.value ? (
|
|
237
|
-
(
|
|
238
|
+
A.value ? (r(), c("div", fe, [
|
|
239
|
+
(r(!0), c(le, null, te(w.value, (a, s) => (r(), c("div", {
|
|
238
240
|
key: s,
|
|
239
|
-
class: C(["relative flex items-center p-3 border border-border rounded-lg bg-
|
|
241
|
+
class: C(["relative flex items-center p-3 border border-border rounded-lg bg-body shadow-sm transition-colors group", [!i.multiSelect && !i.disabled ? "cursor-pointer hover:border-primary/50" : ""]]),
|
|
240
242
|
onClick: t[0] || (t[0] = (m) => !i.multiSelect && !i.disabled ? v() : null)
|
|
241
243
|
}, [
|
|
242
244
|
n("div", me, [
|
|
@@ -248,11 +250,11 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
248
250
|
])
|
|
249
251
|
]),
|
|
250
252
|
n("div", pe, [
|
|
251
|
-
n("p", he, b(
|
|
252
|
-
n("p", ve, b(G(
|
|
253
|
+
n("p", he, b(a.fileName), 1),
|
|
254
|
+
n("p", ve, b(G(a.fileSize)), 1)
|
|
253
255
|
]),
|
|
254
256
|
n("div", xe, [
|
|
255
|
-
!i.disabled && !i.loading ? (
|
|
257
|
+
!i.disabled && !i.loading ? (r(), y(P, {
|
|
256
258
|
key: 0,
|
|
257
259
|
size: "xs",
|
|
258
260
|
variant: "ghost",
|
|
@@ -263,7 +265,7 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
263
265
|
}, null, 8, ["onClick"])) : F("", !0)
|
|
264
266
|
])
|
|
265
267
|
], 2))), 128)),
|
|
266
|
-
i.multiSelect && (!i.maxFiles || w.value.length < i.maxFiles) ? (
|
|
268
|
+
i.multiSelect && (!i.maxFiles || w.value.length < i.maxFiles) ? (r(), c("div", ye, [
|
|
267
269
|
V(P, {
|
|
268
270
|
size: "sm",
|
|
269
271
|
variant: "outline",
|
|
@@ -273,20 +275,20 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
273
275
|
onClick: v
|
|
274
276
|
}, null, 8, ["text", "disabled"])
|
|
275
277
|
])) : F("", !0)
|
|
276
|
-
])) : (
|
|
278
|
+
])) : (r(), c("div", {
|
|
277
279
|
key: 0,
|
|
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", [
|
|
279
|
-
h.value ? "border-primary bg-primary/5" : "hover:border-primary/50
|
|
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 ",
|
|
280
282
|
i.disabled || i.loading || u.value ? "opacity-50 cursor-not-allowed" : ""
|
|
281
283
|
]]),
|
|
282
284
|
onClick: v
|
|
283
285
|
}, [
|
|
284
286
|
n("div", se, [
|
|
285
|
-
i.loading || u.value ? (
|
|
287
|
+
i.loading || u.value ? (r(), y(p, {
|
|
286
288
|
key: 0,
|
|
287
289
|
icon: "lucide:loader-2",
|
|
288
290
|
class: "w-6 h-6 animate-spin"
|
|
289
|
-
})) : (
|
|
291
|
+
})) : (r(), y(p, {
|
|
290
292
|
key: 1,
|
|
291
293
|
icon: "lucide:upload-cloud",
|
|
292
294
|
class: "w-6 h-6"
|
|
@@ -297,10 +299,10 @@ const ie = { class: "w-full" }, ae = ["multiple", "accept"], re = ["value", "pla
|
|
|
297
299
|
n("span", ue, b(N.value), 1),
|
|
298
300
|
ee(" " + b(j.value), 1)
|
|
299
301
|
]),
|
|
300
|
-
i.fileTypes.length ? (
|
|
302
|
+
i.fileTypes.length ? (r(), c("p", ce, b(i.fileTypes.join(", ")), 1)) : F("", !0)
|
|
301
303
|
])
|
|
302
304
|
], 2)),
|
|
303
|
-
i.loading || u.value ? (
|
|
305
|
+
i.loading || u.value ? (r(), c("div", be, [
|
|
304
306
|
n("div", ke, [
|
|
305
307
|
V(p, {
|
|
306
308
|
icon: "lucide:loader-2",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./CustomFields.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-112b16b5"]]);
|
|
5
5
|
export {
|
|
6
6
|
s as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as I, computed as
|
|
1
|
+
import { defineComponent as I, computed as c, ref as S, watch as L, openBlock as o, createElementBlock as r, createElementVNode as f, createBlock as G, withCtx as k, createTextVNode as H, toDisplayString as m, createCommentVNode as u, createVNode as v, Fragment as h, renderList as w, normalizeClass as C, TransitionGroup as M } from "vue";
|
|
2
2
|
import q from "./FormField.vue.js";
|
|
3
3
|
import V from "../Button.vue.js";
|
|
4
4
|
import J from "../Label.vue.js";
|
|
@@ -21,7 +21,7 @@ const K = { class: "custom-fields-wrapper" }, O = { class: "flex justify-between
|
|
|
21
21
|
}, ee = {
|
|
22
22
|
key: 1,
|
|
23
23
|
class: "flex flex-col items-center justify-center py-6 text-center bg-muted/5"
|
|
24
|
-
}, te = { class: "text-sm font-medium text-foreground" },
|
|
24
|
+
}, te = { class: "text-sm font-medium text-foreground" }, se = { class: "text-xs text-muted-foreground mt-1" }, de = /* @__PURE__ */ I({
|
|
25
25
|
__name: "CustomFields",
|
|
26
26
|
props: {
|
|
27
27
|
modelValue: { default: () => [] },
|
|
@@ -43,62 +43,62 @@ const K = { class: "custom-fields-wrapper" }, O = { class: "flex justify-between
|
|
|
43
43
|
},
|
|
44
44
|
emits: ["update:modelValue", "change"],
|
|
45
45
|
setup(d, { emit: F }) {
|
|
46
|
-
const t = d, x = F,
|
|
46
|
+
const t = d, x = F, y = c(() => t.labelI18n ? b(t.labelI18n) : t.label), N = c(() => {
|
|
47
47
|
const e = b("vlite.customFields.emptyTitle");
|
|
48
48
|
return e !== "vlite.customFields.emptyTitle" ? e : "No items added";
|
|
49
|
-
}), B =
|
|
49
|
+
}), B = c(() => {
|
|
50
50
|
const e = b("vlite.customFields.emptyDescription");
|
|
51
51
|
return e !== "vlite.customFields.emptyDescription" ? e : "Add a new item to get started";
|
|
52
|
-
}),
|
|
53
|
-
|
|
52
|
+
}), l = S([]), g = () => `row_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
53
|
+
L(
|
|
54
54
|
() => t.modelValue,
|
|
55
55
|
(e) => {
|
|
56
|
-
Array.isArray(e) ?
|
|
57
|
-
const a =
|
|
56
|
+
Array.isArray(e) ? l.value = e.map((s, n) => {
|
|
57
|
+
const a = l.value[n];
|
|
58
58
|
return {
|
|
59
|
-
...
|
|
60
|
-
_id: a?._id ||
|
|
59
|
+
...s,
|
|
60
|
+
_id: a?._id || g()
|
|
61
61
|
};
|
|
62
|
-
}) :
|
|
62
|
+
}) : l.value = [];
|
|
63
63
|
},
|
|
64
64
|
{ immediate: !0, deep: !0 }
|
|
65
65
|
);
|
|
66
66
|
const $ = () => {
|
|
67
67
|
const e = {};
|
|
68
|
-
for (const
|
|
69
|
-
const
|
|
70
|
-
e[
|
|
68
|
+
for (const s of t.schema) {
|
|
69
|
+
const n = typeof s.value == "function" ? s.value() : s.value;
|
|
70
|
+
e[s.name] = n ?? null;
|
|
71
71
|
}
|
|
72
|
-
return { ...e, _id:
|
|
72
|
+
return { ...e, _id: g() };
|
|
73
73
|
}, T = () => {
|
|
74
|
-
if (t.disabled || t.maxRows &&
|
|
75
|
-
const e = [...
|
|
76
|
-
|
|
74
|
+
if (t.disabled || t.maxRows && l.value.length >= t.maxRows) return;
|
|
75
|
+
const e = [...l.value, $()];
|
|
76
|
+
l.value = e, p(e);
|
|
77
77
|
}, z = (e) => {
|
|
78
|
-
if (t.disabled ||
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
}, A = (e,
|
|
82
|
-
const a = [...
|
|
78
|
+
if (t.disabled || l.value.length <= t.minRows) return;
|
|
79
|
+
const s = [...l.value];
|
|
80
|
+
s.splice(e, 1), l.value = s, p(s);
|
|
81
|
+
}, A = (e, s, n) => {
|
|
82
|
+
const a = [...l.value];
|
|
83
83
|
a[e] = {
|
|
84
84
|
...a[e],
|
|
85
|
-
[
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
const
|
|
89
|
-
x("update:modelValue",
|
|
90
|
-
}, D = (e,
|
|
91
|
-
return (e,
|
|
85
|
+
[s]: n.value
|
|
86
|
+
}, l.value = a, p(a);
|
|
87
|
+
}, p = (e) => {
|
|
88
|
+
const s = e.map(({ _id: n, ...a }) => a);
|
|
89
|
+
x("update:modelValue", s), x("change", s);
|
|
90
|
+
}, D = (e, s) => l.value[e]?.[s], E = c(() => !(t.disabled || t.maxRows && l.value.length >= t.maxRows)), _ = c(() => t.disabled ? !1 : l.value.length > t.minRows), R = c(() => t.headers && t.headers.length > 0 ? t.headers : t.schema.map((e) => e.labelI18n ? b(e.labelI18n) : e.label || e.name));
|
|
91
|
+
return (e, s) => (o(), r("div", K, [
|
|
92
92
|
f("div", O, [
|
|
93
|
-
|
|
93
|
+
y.value ? (o(), G(J, {
|
|
94
94
|
key: 0,
|
|
95
95
|
class: "text-sm font-medium text-foreground"
|
|
96
96
|
}, {
|
|
97
97
|
default: k(() => [
|
|
98
|
-
H(m(
|
|
98
|
+
H(m(y.value), 1)
|
|
99
99
|
]),
|
|
100
100
|
_: 1
|
|
101
|
-
})) :
|
|
101
|
+
})) : u("", !0),
|
|
102
102
|
v(V, {
|
|
103
103
|
type: "button",
|
|
104
104
|
variant: "outline",
|
|
@@ -110,32 +110,39 @@ const K = { class: "custom-fields-wrapper" }, O = { class: "flex justify-between
|
|
|
110
110
|
}, null, 8, ["disabled"])
|
|
111
111
|
]),
|
|
112
112
|
f("div", P, [
|
|
113
|
-
R.value.length > 0 ? (o(),
|
|
114
|
-
d.showRowNumbers ? (o(),
|
|
115
|
-
(o(!0),
|
|
113
|
+
R.value.length > 0 ? (o(), r("div", Q, [
|
|
114
|
+
d.showRowNumbers ? (o(), r("div", W, " # ")) : u("", !0),
|
|
115
|
+
(o(!0), r(h, null, w(R.value, (n, a) => (o(), r("div", {
|
|
116
116
|
key: a,
|
|
117
117
|
class: C(["flex-1 p-3 min-w-0 truncate", { "border-l border-border": a > 0 }])
|
|
118
|
-
}, m(
|
|
119
|
-
_.value ? (o(),
|
|
120
|
-
])) :
|
|
118
|
+
}, m(n), 3))), 128)),
|
|
119
|
+
_.value ? (o(), r("div", X)) : u("", !0)
|
|
120
|
+
])) : u("", !0),
|
|
121
121
|
v(M, {
|
|
122
122
|
name: "list",
|
|
123
123
|
tag: "div",
|
|
124
124
|
class: "divide-y divide-border"
|
|
125
125
|
}, {
|
|
126
126
|
default: k(() => [
|
|
127
|
-
(o(!0),
|
|
128
|
-
key:
|
|
127
|
+
(o(!0), r(h, null, w(l.value, (n, a) => (o(), r("div", {
|
|
128
|
+
key: n._id,
|
|
129
129
|
class: "flex group bg-white transition-colors"
|
|
130
130
|
}, [
|
|
131
|
-
d.showRowNumbers ? (o(),
|
|
132
|
-
(o(!0),
|
|
133
|
-
key:
|
|
131
|
+
d.showRowNumbers ? (o(), r("div", Y, m(a + 1), 1)) : u("", !0),
|
|
132
|
+
(o(!0), r(h, null, w(d.schema, (i, j) => (o(), r("div", {
|
|
133
|
+
key: i.name,
|
|
134
134
|
class: C(["flex-1 min-w-0 relative", { "border-l border-border": j > 0 }])
|
|
135
135
|
}, [
|
|
136
136
|
v(q, {
|
|
137
|
-
field: {
|
|
138
|
-
|
|
137
|
+
field: {
|
|
138
|
+
...i,
|
|
139
|
+
props: {
|
|
140
|
+
...i.type === "multiSelect" ? { showControls: !1, wrap: !1 } : {},
|
|
141
|
+
...i.props || {}
|
|
142
|
+
},
|
|
143
|
+
label: void 0
|
|
144
|
+
},
|
|
145
|
+
value: D(a, i.name),
|
|
139
146
|
values: d.values || {},
|
|
140
147
|
variant: "transparent",
|
|
141
148
|
size: "sm",
|
|
@@ -143,27 +150,27 @@ const K = { class: "custom-fields-wrapper" }, O = { class: "flex justify-between
|
|
|
143
150
|
disabled: d.disabled,
|
|
144
151
|
isUpdate: d.isUpdate,
|
|
145
152
|
class: "w-full h-full min-h-[40px]",
|
|
146
|
-
onChange: (U) => A(a,
|
|
153
|
+
onChange: (U) => A(a, i.name, U)
|
|
147
154
|
}, null, 8, ["field", "value", "values", "disabled", "isUpdate", "onChange"])
|
|
148
155
|
], 2))), 128)),
|
|
149
|
-
_.value ? (o(),
|
|
156
|
+
_.value ? (o(), r("div", Z, [
|
|
150
157
|
v(V, {
|
|
151
158
|
type: "button",
|
|
152
159
|
variant: "ghost",
|
|
153
160
|
size: "xs",
|
|
154
161
|
icon: "lucide:trash-2",
|
|
155
162
|
disabled: d.disabled,
|
|
156
|
-
onClick: (
|
|
163
|
+
onClick: (i) => z(a)
|
|
157
164
|
}, null, 8, ["disabled", "onClick"])
|
|
158
|
-
])) :
|
|
165
|
+
])) : u("", !0)
|
|
159
166
|
]))), 128))
|
|
160
167
|
]),
|
|
161
168
|
_: 1
|
|
162
169
|
}),
|
|
163
|
-
|
|
170
|
+
l.value.length === 0 ? (o(), r("div", ee, [
|
|
164
171
|
f("p", te, m(N.value), 1),
|
|
165
|
-
f("p",
|
|
166
|
-
])) :
|
|
172
|
+
f("p", se, m(B.value), 1)
|
|
173
|
+
])) : u("", !0)
|
|
167
174
|
])
|
|
168
175
|
]));
|
|
169
176
|
}
|
|
@@ -25,6 +25,8 @@ interface Props {
|
|
|
25
25
|
timelineTextPosition?: TimelineTextPosition;
|
|
26
26
|
emitFields?: string[];
|
|
27
27
|
showRequiredAsterisk?: boolean;
|
|
28
|
+
/** Pin footer to bottom of viewport/container */
|
|
29
|
+
stickyFooter?: boolean;
|
|
28
30
|
}
|
|
29
31
|
declare function __VLS_template(): {
|
|
30
32
|
attrs: Partial<{}>;
|
|
@@ -36,7 +38,10 @@ declare function __VLS_template(): {
|
|
|
36
38
|
handleSubmit: () => Promise<void>;
|
|
37
39
|
}): any;
|
|
38
40
|
};
|
|
39
|
-
refs: {
|
|
41
|
+
refs: {
|
|
42
|
+
sentinelRef: HTMLDivElement;
|
|
43
|
+
footerRef: HTMLDivElement;
|
|
44
|
+
};
|
|
40
45
|
rootEl: HTMLFormElement;
|
|
41
46
|
};
|
|
42
47
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
@@ -53,6 +58,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
53
58
|
}>, {
|
|
54
59
|
values: Record<string, any>;
|
|
55
60
|
footer: boolean;
|
|
61
|
+
size: InputSize;
|
|
56
62
|
class: string;
|
|
57
63
|
loading: boolean;
|
|
58
64
|
isUpdate: boolean;
|
|
@@ -68,7 +74,11 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
68
74
|
groupClass: string;
|
|
69
75
|
timelineTextPosition: TimelineTextPosition;
|
|
70
76
|
emitFields: string[];
|
|
71
|
-
|
|
77
|
+
stickyFooter: boolean;
|
|
78
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
79
|
+
sentinelRef: HTMLDivElement;
|
|
80
|
+
footerRef: HTMLDivElement;
|
|
81
|
+
}, HTMLFormElement>;
|
|
72
82
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
73
83
|
export default _default;
|
|
74
84
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Form.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-1a2b21d0"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|