vlite3 1.5.51 → 1.5.52
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/CategoryManager/CategoryManager2.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/Dropdown/DropdownMenu.vue.js +1 -1
- package/components/Form/Form.vue.d.ts +3 -0
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form2.vue.js +292 -276
- package/components/Form/composables/useCustomFieldRows.d.ts +3 -0
- package/components/Form/composables/useCustomFieldRows.js +109 -58
- package/components/Form/composables/useForm.d.ts +4 -1
- package/components/Form/composables/useForm.js +249 -187
- package/components/Form/index.vue.d.ts +2 -0
- package/components/Form/index.vue.js +2 -2
- package/components/Form/index2.vue.js +12 -8
- package/components/Form/types.d.ts +2 -0
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/RichTextEditor/RichTextEditor.vue.d.ts +58 -0
- package/components/RichTextEditor/RichTextEditor.vue.js +309 -180
- package/components/RichTextEditor/RichTextLinkPopover.vue.d.ts +3 -8
- package/components/RichTextEditor/RichTextLinkPopover3.vue.js +2 -2
- package/components/RichTextEditor/RichTextToolbar3.vue.js +2 -2
- package/components/RichTextEditor/index.d.ts +1 -1
- package/components/RichTextEditor/types.d.ts +22 -0
- package/components/Screen/ScreenFilter.vue.js +2 -2
- package/components/Screen/components/ScreenToolbar.vue.d.ts +2 -2
- package/docs/components/rich-text-editor.md +33 -2
- package/docs-manifest.json +3 -3
- package/package.json +1 -1
- package/style.css +1 -1
- /package/components/Dropdown/{DropdownMenu3.vue.js → DropdownMenu2.vue.js} +0 -0
- /package/components/RichTextEditor/{RichTextLinkPopover2.vue.js → RichTextLinkPopover.vue.js} +0 -0
- /package/components/RichTextEditor/{RichTextToolbar2.vue.js → RichTextToolbar.vue.js} +0 -0
|
@@ -1,272 +1,334 @@
|
|
|
1
|
-
import { shallowRef as
|
|
2
|
-
import { deepClone as
|
|
3
|
-
import { useFileUpload as
|
|
4
|
-
import { resolveI18nText as
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { shallowRef as z, computed as be, getCurrentScope as me, onScopeDispose as he, watch as Fe } from "vue";
|
|
2
|
+
import { deepClone as x, initializeFormValues as ge, cleanSubmitValues as we, getNestedValue as ae, evaluateConditional as B, resolveFieldType as ce, setNestedValue as J, collectFileFields as je, filterNullCustomFields as Oe } from "../utils/form.utils.js";
|
|
3
|
+
import { useFileUpload as Ve } from "./useFileUpload.js";
|
|
4
|
+
import { resolveI18nText as Se } from "../../../utils/i18n.js";
|
|
5
|
+
function ue(O, w, v) {
|
|
6
|
+
if (Object.is(w, v)) return O;
|
|
7
|
+
const b = (y) => y != null && (Object.getPrototypeOf(y) === Object.prototype || Object.getPrototypeOf(y) === null);
|
|
8
|
+
if (w === void 0 && b(O) && b(v) && (w = {}), !b(O) || !b(w) || !b(v)) return v;
|
|
9
|
+
const E = { ...O };
|
|
10
|
+
for (const y of /* @__PURE__ */ new Set([...Object.keys(w), ...Object.keys(v)]))
|
|
11
|
+
Object.is(w[y], v[y]) && y in w == y in v || (Object.prototype.hasOwnProperty.call(v, y) ? E[y] = ue(O[y], w[y], v[y]) : delete E[y]);
|
|
12
|
+
return E;
|
|
13
|
+
}
|
|
14
|
+
function qe(O) {
|
|
15
|
+
let { schema: w, values: v, isUpdate: b = !1, folderId: E, onSubmit: y } = O;
|
|
16
|
+
const se = z(v), { handleUploadFile: K } = Ve(), a = z(v ? x(v) : {}), j = z({}), Q = z(!1), $ = z(!1), I = z({}), U = z(w), L = z(
|
|
17
|
+
v ? x(v) : {}
|
|
18
|
+
), k = (e, t) => {
|
|
10
19
|
if (t) {
|
|
11
|
-
if (
|
|
12
|
-
|
|
20
|
+
if (j.value[e] === t) return;
|
|
21
|
+
j.value = { ...j.value, [e]: t };
|
|
13
22
|
return;
|
|
14
23
|
}
|
|
15
|
-
if (!(e in
|
|
16
|
-
const n = { ...
|
|
17
|
-
delete n[e],
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
const e =
|
|
24
|
+
if (!(e in j.value)) return;
|
|
25
|
+
const n = { ...j.value };
|
|
26
|
+
delete n[e], j.value = n;
|
|
27
|
+
}, V = (e, t) => {
|
|
28
|
+
I.value[e] !== t && (I.value = { ...I.value, [e]: t });
|
|
29
|
+
}, C = be(() => {
|
|
30
|
+
const e = U.value;
|
|
22
31
|
return e ? Array.isArray(e[0]) ? e.flat() : e : [];
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
});
|
|
33
|
+
let P = 0, X = 0, q, R;
|
|
34
|
+
const T = z(!1), D = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
|
|
35
|
+
let Y = 0, N = a.value;
|
|
36
|
+
const Z = () => {
|
|
37
|
+
X++, D.clear(), A.clear(), I.value = {};
|
|
38
|
+
}, W = () => {
|
|
39
|
+
P++, R?.(), R = void 0, q = void 0, T.value = !1;
|
|
40
|
+
};
|
|
41
|
+
me() && he(() => {
|
|
42
|
+
W(), Z();
|
|
43
|
+
});
|
|
44
|
+
const _ = (e, t = a.value) => {
|
|
45
|
+
W();
|
|
46
|
+
const n = ++P;
|
|
47
|
+
T.value = !0;
|
|
48
|
+
let u;
|
|
49
|
+
const s = new Promise((l) => {
|
|
50
|
+
u = l;
|
|
51
|
+
});
|
|
52
|
+
return R = u, q = s, (async () => {
|
|
53
|
+
try {
|
|
54
|
+
const l = await ge(U.value, e, a.value, b);
|
|
55
|
+
if (n !== P) return;
|
|
56
|
+
const o = a.value !== t;
|
|
57
|
+
N = l, L.value = x(l), a.value = o ? ue(l, t, a.value) : l, $.value = o;
|
|
58
|
+
} catch (l) {
|
|
59
|
+
n === P && console.error("[useForm] Initialization error:", l);
|
|
60
|
+
} finally {
|
|
61
|
+
n === P && (T.value = !1, q = void 0, R = void 0), u();
|
|
62
|
+
}
|
|
63
|
+
})(), s;
|
|
30
64
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(e) => {
|
|
34
|
-
e &&
|
|
65
|
+
_(v), Fe(
|
|
66
|
+
se,
|
|
67
|
+
(e, t) => {
|
|
68
|
+
e && e === t && _(e);
|
|
35
69
|
},
|
|
36
70
|
{ deep: !0 }
|
|
37
71
|
);
|
|
38
|
-
const
|
|
39
|
-
values:
|
|
40
|
-
globalValues:
|
|
41
|
-
isUpdate:
|
|
42
|
-
}),
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
Object.keys(
|
|
46
|
-
},
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
const H = () => ({
|
|
73
|
+
values: a.value,
|
|
74
|
+
globalValues: a.value,
|
|
75
|
+
isUpdate: b
|
|
76
|
+
}), ie = (e) => ae(a.value, e), fe = (e) => j.value[e] || "", oe = (e, t) => {
|
|
77
|
+
k(e, t);
|
|
78
|
+
}, G = () => {
|
|
79
|
+
Object.keys(j.value).length !== 0 && (j.value = {});
|
|
80
|
+
}, M = (e) => e.when ? B(e.when, H()) : !0, ee = (e) => {
|
|
81
|
+
const t = H();
|
|
82
|
+
return T.value && ce(e, t) === "customFields" || B(e.disabled, t);
|
|
83
|
+
}, ne = (e) => B(e.readonly, H()), te = async (e, t = "", n = a.value) => {
|
|
84
|
+
const u = t ? `${t}.${e.name}` : e.name, s = ie(u);
|
|
85
|
+
let l = "";
|
|
86
|
+
const o = typeof e.label == "string" ? e.label : e.name, i = Se(e.labelI18n, o) ?? o;
|
|
50
87
|
if (e.required) {
|
|
51
|
-
const
|
|
52
|
-
(
|
|
88
|
+
const p = typeof s == "string" && /<\/?[a-z][^>]*>/i.test(s) && s.replace(/<[^>]*>/g, "").replace(/ /gi, " ").trim() === "";
|
|
89
|
+
(s == null || s === "" || Array.isArray(s) && s.length === 0 || p) && (l = `${i} is required`);
|
|
53
90
|
}
|
|
54
|
-
if (!
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
for (const
|
|
59
|
-
const r =
|
|
60
|
-
if (r !== void 0 && r >
|
|
61
|
-
|
|
91
|
+
if (!l && e.maxFileSize) {
|
|
92
|
+
const p = e.maxFileSize * 1024 * 1024;
|
|
93
|
+
if (s != null && s !== "") {
|
|
94
|
+
const F = Array.isArray(s) ? s : [s];
|
|
95
|
+
for (const m of F) {
|
|
96
|
+
const r = m instanceof File ? m.size : m?.fileSize || m?.file?.size || m?.size;
|
|
97
|
+
if (r !== void 0 && r > p) {
|
|
98
|
+
l = `${i} size must be less than ${e.maxFileSize}MB`;
|
|
62
99
|
break;
|
|
63
100
|
}
|
|
64
101
|
}
|
|
65
102
|
}
|
|
66
103
|
}
|
|
67
|
-
if (!
|
|
68
|
-
const
|
|
69
|
-
|
|
104
|
+
if (!l && (e.type === "file" || e.type === "fileUploader") && (e.props?.multiple || e.maxFiles)) {
|
|
105
|
+
const p = e.maxFiles || e.props?.maxFiles;
|
|
106
|
+
p && Array.isArray(s) && s.length > p && (l = `Maximum ${p} files allowed`);
|
|
70
107
|
}
|
|
71
|
-
if (!
|
|
72
|
-
|
|
108
|
+
if (!l && e.validation) {
|
|
109
|
+
V(u, !0);
|
|
73
110
|
try {
|
|
74
|
-
|
|
75
|
-
value:
|
|
111
|
+
l = await e.validation({
|
|
112
|
+
value: s,
|
|
76
113
|
values: n,
|
|
77
|
-
globalValues:
|
|
78
|
-
isUpdate:
|
|
114
|
+
globalValues: a.value,
|
|
115
|
+
isUpdate: b
|
|
79
116
|
});
|
|
80
|
-
} catch (
|
|
81
|
-
console.error(`[useForm] Validation error in field ${u}:`,
|
|
117
|
+
} catch (p) {
|
|
118
|
+
console.error(`[useForm] Validation error in field ${u}:`, p), l = "Validation failed";
|
|
82
119
|
} finally {
|
|
83
|
-
|
|
120
|
+
V(u, !1);
|
|
84
121
|
}
|
|
85
122
|
}
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
let
|
|
89
|
-
for (let r = 0; r <
|
|
90
|
-
const
|
|
91
|
-
for (const
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
if (k(u, l), e.type === "customFields" && e.props?.schema) {
|
|
124
|
+
const p = e.props.schema, F = Array.isArray(s) ? s : [];
|
|
125
|
+
let m = !1;
|
|
126
|
+
for (let r = 0; r < F.length; r++) {
|
|
127
|
+
const c = F[r] || {}, f = { values: c, globalValues: a.value, isUpdate: b };
|
|
128
|
+
for (const h of p) {
|
|
129
|
+
const d = !h.when || B(h.when, f), g = B(h.disabled, f);
|
|
130
|
+
d && !g ? await te(
|
|
131
|
+
h,
|
|
95
132
|
`${u}.${r}`,
|
|
96
|
-
|
|
97
|
-
) && (
|
|
133
|
+
c
|
|
134
|
+
) && (m = !0) : k(`${u}.${r}.${h.name}`, "");
|
|
98
135
|
}
|
|
99
136
|
}
|
|
100
|
-
|
|
137
|
+
m && !l && (l = "Please fix errors in the list.", k(u, l));
|
|
101
138
|
}
|
|
102
|
-
return
|
|
103
|
-
},
|
|
104
|
-
|
|
139
|
+
return l;
|
|
140
|
+
}, re = async () => {
|
|
141
|
+
for (; q; ) await q;
|
|
142
|
+
G();
|
|
105
143
|
let e = !0;
|
|
106
|
-
for (const t of
|
|
107
|
-
if (
|
|
108
|
-
await
|
|
144
|
+
for (const t of C.value) {
|
|
145
|
+
if (!M(t) || ee(t)) continue;
|
|
146
|
+
await te(t) && (e = !1);
|
|
109
147
|
}
|
|
110
148
|
return e;
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
149
|
+
}, de = async (e, t, n) => {
|
|
150
|
+
if (T.value && C.value.some(
|
|
151
|
+
(o) => (e === o.name || e.startsWith(o.name + ".")) && ce(o, H()) === "customFields"
|
|
152
|
+
)) return;
|
|
153
|
+
const u = C.value.filter((o) => o.name === e);
|
|
154
|
+
let s = u.find((o) => M(o));
|
|
155
|
+
if (!s && u.length > 0 && (s = u[0]), s && (!M(s) || ee(s) || ne(s))) {
|
|
115
156
|
console.warn(`[vlite3/useForm] Blocked attempted update to disabled/readonly/hidden field: ${e}`);
|
|
116
157
|
return;
|
|
117
158
|
}
|
|
118
|
-
|
|
119
|
-
|
|
159
|
+
D.delete(e) && V(e, !1);
|
|
160
|
+
const l = e.split(".")[0];
|
|
161
|
+
if (A.set(l, ++Y), a.value = J(a.value, e, t), $.value = !0, k(e, ""), s?.updateValues) {
|
|
162
|
+
const o = X, i = /* @__PURE__ */ Symbol();
|
|
163
|
+
D.set(e, i);
|
|
164
|
+
const p = a.value, F = new Map(A), m = () => o === X && D.get(e) === i, r = () => m() && Object.is(ae(a.value, e), t) && A.get(l) === F.get(l);
|
|
165
|
+
V(e, !0);
|
|
120
166
|
try {
|
|
121
|
-
const
|
|
167
|
+
const c = s.updateValues({
|
|
122
168
|
value: t,
|
|
123
169
|
// Exposing the explicitly requested value
|
|
124
|
-
values:
|
|
125
|
-
globalValues:
|
|
170
|
+
values: a.value,
|
|
171
|
+
globalValues: a.value,
|
|
126
172
|
data: n,
|
|
127
|
-
isUpdate:
|
|
128
|
-
updateError:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
173
|
+
isUpdate: b,
|
|
174
|
+
updateError: (d, g) => {
|
|
175
|
+
r() && A.get(d.split(".")[0]) === F.get(d.split(".")[0]) && oe(d, g);
|
|
176
|
+
}
|
|
177
|
+
}), f = !!c && typeof c.then == "function", h = f ? await c : c;
|
|
178
|
+
if (r() && h && typeof h == "object") {
|
|
179
|
+
const d = Object.fromEntries(Object.entries(h).filter(
|
|
180
|
+
([g]) => Object.is(a.value[g], p[g]) && A.get(g) === F.get(g)
|
|
181
|
+
));
|
|
182
|
+
if (Object.keys(d).length) {
|
|
183
|
+
for (const g of Object.keys(d)) A.set(g, ++Y);
|
|
184
|
+
a.value = { ...a.value, ...d }, f && O.onAsyncChange?.(a.value);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} catch (c) {
|
|
188
|
+
console.error(`[useForm] Error in updateValues for ${e}:`, c);
|
|
133
189
|
} finally {
|
|
134
|
-
|
|
190
|
+
m() && (D.delete(e), V(e, !1));
|
|
135
191
|
}
|
|
136
192
|
}
|
|
137
|
-
},
|
|
138
|
-
const e =
|
|
139
|
-
let
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
...typeof
|
|
143
|
-
fileName:
|
|
144
|
-
fileUrl:
|
|
145
|
-
fileType:
|
|
146
|
-
fileSize:
|
|
193
|
+
}, ve = async () => {
|
|
194
|
+
const e = x(a.value), t = je(U.value, e, a.value, b), n = (l, o) => {
|
|
195
|
+
let i = null;
|
|
196
|
+
l instanceof File ? i = l : l && typeof l == "object" && l.file instanceof File && (i = l.file);
|
|
197
|
+
const p = {
|
|
198
|
+
...typeof l == "object" ? l : {},
|
|
199
|
+
fileName: l?.fileName || i?.name || o.split("/").pop() || "unknown",
|
|
200
|
+
fileUrl: o,
|
|
201
|
+
fileType: l?.fileType || i?.type || "application/octet-stream",
|
|
202
|
+
fileSize: l?.fileSize || i?.size || 0
|
|
147
203
|
};
|
|
148
|
-
return delete
|
|
149
|
-
}, u = t.map(async (
|
|
150
|
-
const { name:
|
|
151
|
-
if (
|
|
152
|
-
const r =
|
|
153
|
-
|
|
204
|
+
return delete p.file, delete p.base64, p;
|
|
205
|
+
}, u = t.map(async (l) => {
|
|
206
|
+
const { name: o, value: i, field: p } = l;
|
|
207
|
+
if (l.type === "thumbnailSelector") {
|
|
208
|
+
const r = i, c = Array.isArray(r.images) ? r.images : [], f = r.thumbnail;
|
|
209
|
+
V(o, !0);
|
|
154
210
|
try {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
return await
|
|
211
|
+
const h = await Promise.all(
|
|
212
|
+
c.map(async (S) => {
|
|
213
|
+
if (S.startsWith("data:image/")) {
|
|
214
|
+
const le = await (await fetch(S)).blob(), ye = new File([le], `thumbnail-${Date.now()}.${le.type.split("/")[1] || "jpg"}`, { type: le.type });
|
|
215
|
+
return await K(ye, E) || S;
|
|
160
216
|
}
|
|
161
|
-
return
|
|
217
|
+
return S;
|
|
162
218
|
})
|
|
163
219
|
);
|
|
164
|
-
let
|
|
165
|
-
if (
|
|
166
|
-
const
|
|
167
|
-
|
|
220
|
+
let d = f;
|
|
221
|
+
if (f && f.startsWith("data:image/")) {
|
|
222
|
+
const S = c.indexOf(f);
|
|
223
|
+
S !== -1 && h[S] && (d = h[S]);
|
|
168
224
|
}
|
|
169
|
-
return { name:
|
|
225
|
+
return { name: o, value: { images: h, thumbnail: d } };
|
|
170
226
|
} finally {
|
|
171
|
-
|
|
227
|
+
V(o, !1);
|
|
172
228
|
}
|
|
173
229
|
}
|
|
174
|
-
const
|
|
230
|
+
const F = p.returnFileObject === !0, m = Array.isArray(i) ? i.some(
|
|
175
231
|
(r) => r instanceof File || r && typeof r == "object" && r.file instanceof File
|
|
176
|
-
) :
|
|
177
|
-
|
|
232
|
+
) : i instanceof File || i && typeof i == "object" && i.file instanceof File;
|
|
233
|
+
m && V(o, !0);
|
|
178
234
|
try {
|
|
179
|
-
if (Array.isArray(
|
|
180
|
-
const r =
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
return
|
|
235
|
+
if (Array.isArray(i)) {
|
|
236
|
+
const r = i.map(async (f) => {
|
|
237
|
+
if (f instanceof File || f && typeof f == "object" && f.file instanceof File) {
|
|
238
|
+
const d = await K(f, E);
|
|
239
|
+
return d ? F ? n(f, d) : d : null;
|
|
184
240
|
}
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
187
|
-
return delete
|
|
241
|
+
if (f && typeof f == "object") {
|
|
242
|
+
const d = { ...f };
|
|
243
|
+
return delete d.file, delete d.base64, d;
|
|
188
244
|
}
|
|
189
|
-
return
|
|
190
|
-
}),
|
|
191
|
-
return { name:
|
|
245
|
+
return f;
|
|
246
|
+
}), c = await Promise.all(r);
|
|
247
|
+
return { name: o, value: c };
|
|
192
248
|
} else {
|
|
193
|
-
if (
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
return { name:
|
|
197
|
-
} else if (
|
|
198
|
-
const
|
|
199
|
-
return delete
|
|
249
|
+
if (i instanceof File || i && typeof i == "object" && i.file instanceof File) {
|
|
250
|
+
const c = await K(i, E);
|
|
251
|
+
if (c)
|
|
252
|
+
return { name: o, value: F ? n(i, c) : c };
|
|
253
|
+
} else if (i && typeof i == "object") {
|
|
254
|
+
const c = { ...i };
|
|
255
|
+
return delete c.file, delete c.base64, { name: o, value: c };
|
|
200
256
|
}
|
|
201
257
|
return null;
|
|
202
258
|
}
|
|
203
259
|
} finally {
|
|
204
|
-
|
|
260
|
+
m && V(o, !1);
|
|
205
261
|
}
|
|
206
262
|
});
|
|
207
|
-
return (await Promise.all(u)).forEach((
|
|
208
|
-
|
|
263
|
+
return (await Promise.all(u)).forEach((l) => {
|
|
264
|
+
l && (Object.assign(e, J(e, l.name, l.value)), a.value = J(a.value, l.name, l.value));
|
|
209
265
|
}), e;
|
|
210
|
-
},
|
|
266
|
+
}, pe = (e) => {
|
|
211
267
|
const t = { ...e };
|
|
212
|
-
for (const n of
|
|
213
|
-
if (
|
|
214
|
-
const u =
|
|
268
|
+
for (const n of C.value)
|
|
269
|
+
if (M(n) && n.type === "customFields" && n.props?.schema) {
|
|
270
|
+
const u = ae(t, n.name);
|
|
215
271
|
if (Array.isArray(u)) {
|
|
216
|
-
const
|
|
217
|
-
Object.assign(t,
|
|
272
|
+
const s = Oe(u, n.props.schema);
|
|
273
|
+
Object.assign(t, J(t, n.name, s));
|
|
218
274
|
}
|
|
219
275
|
}
|
|
220
276
|
return t;
|
|
221
277
|
};
|
|
222
278
|
return {
|
|
223
|
-
formValues:
|
|
224
|
-
errors:
|
|
225
|
-
isSubmitting:
|
|
226
|
-
isDirty:
|
|
227
|
-
fieldLoading:
|
|
228
|
-
handleFieldChange:
|
|
229
|
-
validateField:
|
|
230
|
-
validateAll:
|
|
231
|
-
isFieldVisible:
|
|
232
|
-
isFieldDisabled:
|
|
233
|
-
isFieldReadonly:
|
|
234
|
-
getFieldValue:
|
|
235
|
-
getFieldError:
|
|
236
|
-
setFieldError:
|
|
237
|
-
clearErrors:
|
|
279
|
+
formValues: a,
|
|
280
|
+
errors: j,
|
|
281
|
+
isSubmitting: Q,
|
|
282
|
+
isDirty: $,
|
|
283
|
+
fieldLoading: I,
|
|
284
|
+
handleFieldChange: de,
|
|
285
|
+
validateField: te,
|
|
286
|
+
validateAll: re,
|
|
287
|
+
isFieldVisible: M,
|
|
288
|
+
isFieldDisabled: ee,
|
|
289
|
+
isFieldReadonly: ne,
|
|
290
|
+
getFieldValue: ie,
|
|
291
|
+
getFieldError: fe,
|
|
292
|
+
setFieldError: oe,
|
|
293
|
+
clearErrors: G,
|
|
238
294
|
resetForm: () => {
|
|
239
|
-
|
|
295
|
+
W(), Z(), a.value = x(L.value), N = a.value, G(), $.value = !1;
|
|
240
296
|
},
|
|
241
297
|
handleSubmit: async () => {
|
|
242
|
-
if (await
|
|
243
|
-
|
|
298
|
+
if (await re()) {
|
|
299
|
+
Q.value = !0;
|
|
244
300
|
try {
|
|
245
|
-
let t = await
|
|
246
|
-
t =
|
|
301
|
+
let t = await ve();
|
|
302
|
+
t = pe(t), t = await we(
|
|
247
303
|
t,
|
|
248
|
-
|
|
249
|
-
|
|
304
|
+
U.value,
|
|
305
|
+
O.emitFields,
|
|
250
306
|
void 0,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
),
|
|
307
|
+
a.value,
|
|
308
|
+
b
|
|
309
|
+
), y && await y({
|
|
254
310
|
values: t,
|
|
255
|
-
isUpdate:
|
|
256
|
-
}),
|
|
311
|
+
isUpdate: b
|
|
312
|
+
}), $.value = !1, L.value = x(t), N = a.value;
|
|
257
313
|
} catch (t) {
|
|
258
314
|
throw console.error("[useForm] Submit error:", t), t;
|
|
259
315
|
} finally {
|
|
260
|
-
|
|
316
|
+
Q.value = !1;
|
|
261
317
|
}
|
|
262
318
|
}
|
|
263
319
|
},
|
|
264
|
-
flatSchema:
|
|
265
|
-
reinitialize: async (e, t) => {
|
|
266
|
-
e !== void 0 && (
|
|
320
|
+
flatSchema: C,
|
|
321
|
+
reinitialize: async (e, t, n = "refresh") => {
|
|
322
|
+
(n === "replace" || e !== void 0 && e !== U.value || t !== void 0 && t !== v) && Z(), e !== void 0 && (U.value = e), (n === "replace" || t !== void 0) && (v = t, se.value = t), n === "replace" && (a.value = x(t ?? {}), N = a.value, L.value = x(a.value), I.value = {}, G(), $.value = !1), await _(v, n === "schema" ? N : void 0);
|
|
323
|
+
},
|
|
324
|
+
replaceValues: (e) => {
|
|
325
|
+
W();
|
|
326
|
+
for (const t of /* @__PURE__ */ new Set([...Object.keys(a.value), ...Object.keys(e)]))
|
|
327
|
+
Object.is(a.value[t], e[t]) || A.set(t, ++Y);
|
|
328
|
+
a.value = e;
|
|
267
329
|
}
|
|
268
330
|
};
|
|
269
331
|
}
|
|
270
332
|
export {
|
|
271
|
-
|
|
333
|
+
qe as useForm
|
|
272
334
|
};
|
|
@@ -24,6 +24,8 @@ interface Props {
|
|
|
24
24
|
layout?: 'table' | 'accordion';
|
|
25
25
|
/** Row key for accordion + stacked-mobile card titles (e.g. `'label'`). */
|
|
26
26
|
rowTitleKey?: string;
|
|
27
|
+
rowKey?: string;
|
|
28
|
+
rowDefaults?: () => Record<string, any>;
|
|
27
29
|
/** @deprecated Use `rowTitleKey`. Alias kept for backward compatibility. */
|
|
28
30
|
accordionTitleKey?: string;
|
|
29
31
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./index2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5faae7a2"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -3,10 +3,10 @@ import T from "./TableView.vue.js";
|
|
|
3
3
|
import C from "./AccordionView2.vue.js";
|
|
4
4
|
import U from "../Label.vue.js";
|
|
5
5
|
import z from "../Button.vue.js";
|
|
6
|
-
import { useCustomFieldRows as
|
|
7
|
-
import { createRowHelpers as
|
|
6
|
+
import { useCustomFieldRows as D } from "./composables/useCustomFieldRows.js";
|
|
7
|
+
import { createRowHelpers as K } from "./rowHelpers.js";
|
|
8
8
|
import { resolveI18nText as r } from "../../utils/i18n.js";
|
|
9
|
-
const
|
|
9
|
+
const N = { class: "custom-fields-wrapper min-w-0 w-full" }, V = { class: "flex justify-between items-center mb-2" }, q = /* @__PURE__ */ g({
|
|
10
10
|
name: "CustomFields",
|
|
11
11
|
__name: "index",
|
|
12
12
|
props: {
|
|
@@ -32,6 +32,8 @@ const A = { class: "custom-fields-wrapper min-w-0 w-full" }, F = { class: "flex
|
|
|
32
32
|
isUpdate: { type: Boolean, default: !1 },
|
|
33
33
|
layout: { default: "table" },
|
|
34
34
|
rowTitleKey: { default: void 0 },
|
|
35
|
+
rowKey: {},
|
|
36
|
+
rowDefaults: {},
|
|
35
37
|
accordionTitleKey: { default: void 0 }
|
|
36
38
|
},
|
|
37
39
|
emits: ["update:modelValue", "change"],
|
|
@@ -45,7 +47,7 @@ const A = { class: "custom-fields-wrapper min-w-0 w-full" }, F = { class: "flex
|
|
|
45
47
|
"vlite.customFields.emptyDescription",
|
|
46
48
|
"Add a new item to get started"
|
|
47
49
|
) ?? "Add a new item to get started"
|
|
48
|
-
), t =
|
|
50
|
+
), t = D(
|
|
49
51
|
{
|
|
50
52
|
// Getters (not snapshots) — see the long-form note in the composable
|
|
51
53
|
// file. The `watch(() => options.modelValue, ...)` source must
|
|
@@ -60,14 +62,16 @@ const A = { class: "custom-fields-wrapper min-w-0 w-full" }, F = { class: "flex
|
|
|
60
62
|
disabled: () => e.disabled,
|
|
61
63
|
readonly: () => e.readonly,
|
|
62
64
|
minRows: () => e.minRows,
|
|
63
|
-
maxRows: () => e.maxRows
|
|
65
|
+
maxRows: () => e.maxRows,
|
|
66
|
+
rowKey: () => e.rowKey,
|
|
67
|
+
rowDefaults: () => e.rowDefaults?.() ?? {}
|
|
64
68
|
},
|
|
65
69
|
h
|
|
66
70
|
), w = d(() => e.headers && e.headers.length > 0 ? e.headers : e.schema.map((o) => o.labelI18n ? r(
|
|
67
71
|
o.labelI18n,
|
|
68
72
|
typeof o.label == "string" ? o.label : o.name
|
|
69
73
|
) ?? o.name : typeof o.label == "string" ? o.label : o.name)), b = d(() => e.schema.slice(0, w.value.length)), v = d(
|
|
70
|
-
() =>
|
|
74
|
+
() => K({
|
|
71
75
|
rows: t.rows.value,
|
|
72
76
|
schema: e.schema,
|
|
73
77
|
name: e.name,
|
|
@@ -76,8 +80,8 @@ const A = { class: "custom-fields-wrapper min-w-0 w-full" }, F = { class: "flex
|
|
|
76
80
|
errors: e.errors
|
|
77
81
|
})
|
|
78
82
|
), p = d(() => r(e.labelI18n, e.label ?? "Item") ?? "Item");
|
|
79
|
-
return (o,
|
|
80
|
-
x("div",
|
|
83
|
+
return (o, A) => (n(), R("div", N, [
|
|
84
|
+
x("div", V, [
|
|
81
85
|
m.value ? (n(), s(U, {
|
|
82
86
|
key: 0,
|
|
83
87
|
class: "text-sm font-medium text-foreground"
|
|
@@ -86,6 +86,8 @@ export type IFormGroupsHeadings = string[] | ((context: IFormContext) => string[
|
|
|
86
86
|
*/
|
|
87
87
|
export interface IFormCustomFieldsProps {
|
|
88
88
|
schema: IForm[];
|
|
89
|
+
rowKey?: string;
|
|
90
|
+
rowDefaults?: () => Record<string, any>;
|
|
89
91
|
headers?: string[];
|
|
90
92
|
draggable?: boolean;
|
|
91
93
|
layout?: 'table' | 'accordion';
|
|
@@ -3,7 +3,7 @@ import L from "./Icon.vue.js";
|
|
|
3
3
|
import v from "./Modal.vue.js";
|
|
4
4
|
import N from "./CommandPalette/CommandPaletteContent.vue.js";
|
|
5
5
|
import { $t as U } from "../utils/i18n.js";
|
|
6
|
-
/* empty css
|
|
6
|
+
/* empty css */
|
|
7
7
|
const V = { class: "block truncate -text-fs-1.5" }, S = { class: "ms-auto inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-mono font-medium border border-border/80 bg-background text-muted-foreground ms-1" }, A = /* @__PURE__ */ x({
|
|
8
8
|
__name: "NavbarCommandPalette",
|
|
9
9
|
props: {
|