vlite3 1.5.50 → 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.
Files changed (31) hide show
  1. package/components/CategoryManager/CategoryManager2.vue.js +2 -2
  2. package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
  3. package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
  4. package/components/Form/Form.vue.d.ts +3 -0
  5. package/components/Form/Form.vue.js +1 -1
  6. package/components/Form/Form2.vue.js +292 -276
  7. package/components/Form/composables/useCustomFieldRows.d.ts +3 -0
  8. package/components/Form/composables/useCustomFieldRows.js +109 -58
  9. package/components/Form/composables/useForm.d.ts +4 -1
  10. package/components/Form/composables/useForm.js +249 -187
  11. package/components/Form/index.vue.d.ts +2 -0
  12. package/components/Form/index.vue.js +2 -2
  13. package/components/Form/index2.vue.js +12 -8
  14. package/components/Form/types.d.ts +2 -0
  15. package/components/NavbarCommandPalette.vue.js +1 -1
  16. package/components/RichTextEditor/RichTextEditor.vue.d.ts +58 -0
  17. package/components/RichTextEditor/RichTextEditor.vue.js +309 -180
  18. package/components/RichTextEditor/RichTextLinkPopover.vue.d.ts +3 -8
  19. package/components/RichTextEditor/RichTextLinkPopover3.vue.js +2 -2
  20. package/components/RichTextEditor/RichTextToolbar3.vue.js +2 -2
  21. package/components/RichTextEditor/index.d.ts +1 -1
  22. package/components/RichTextEditor/types.d.ts +22 -0
  23. package/components/Screen/ScreenFilter.vue.js +2 -2
  24. package/components/Screen/components/ScreenToolbar.vue.d.ts +2 -2
  25. package/directives/ScrollReveal/ScrollRevealPager.js +76 -76
  26. package/docs/components/rich-text-editor.md +33 -2
  27. package/docs-manifest.json +3 -3
  28. package/package.json +1 -1
  29. package/style.css +1 -1
  30. /package/components/RichTextEditor/{RichTextLinkPopover2.vue.js → RichTextLinkPopover.vue.js} +0 -0
  31. /package/components/RichTextEditor/{RichTextToolbar2.vue.js → RichTextToolbar.vue.js} +0 -0
@@ -1,272 +1,334 @@
1
- import { shallowRef as V, computed as ae, watch as le } from "vue";
2
- import { deepClone as A, initializeFormValues as se, cleanSubmitValues as ie, getNestedValue as Q, evaluateConditional as j, setNestedValue as I, collectFileFields as re, filterNullCustomFields as oe } from "../utils/form.utils.js";
3
- import { useFileUpload as ne } from "./useFileUpload.js";
4
- import { resolveI18nText as ue } from "../../../utils/i18n.js";
5
- function he(M) {
6
- let { schema: X, values: F, isUpdate: h = !1, folderId: C, onSubmit: R } = M;
7
- const { handleUploadFile: O } = ne(), i = V(F ? A(F) : {}), y = V({}), D = V(!1), z = V(!1), E = V({}), x = V(X), N = V(
8
- F ? A(F) : {}
9
- ), S = (e, t) => {
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 (y.value[e] === t) return;
12
- y.value = { ...y.value, [e]: t };
20
+ if (j.value[e] === t) return;
21
+ j.value = { ...j.value, [e]: t };
13
22
  return;
14
23
  }
15
- if (!(e in y.value)) return;
16
- const n = { ...y.value };
17
- delete n[e], y.value = n;
18
- }, w = (e, t) => {
19
- E.value[e] !== t && (E.value = { ...E.value, [e]: t });
20
- }, U = ae(() => {
21
- const e = x.value;
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
- }), P = async (e) => {
24
- try {
25
- const t = await se(x.value, e, i.value, h);
26
- i.value = t, N.value = A(t), z.value = !1;
27
- } catch (t) {
28
- console.error("[useForm] Initialization error:", t);
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
- P(F), le(
32
- () => F,
33
- (e) => {
34
- e && P(e);
65
+ _(v), Fe(
66
+ se,
67
+ (e, t) => {
68
+ e && e === t && _(e);
35
69
  },
36
70
  { deep: !0 }
37
71
  );
38
- const T = () => ({
39
- values: i.value,
40
- globalValues: i.value,
41
- isUpdate: h
42
- }), W = (e) => Q(i.value, e), Y = (e) => y.value[e] || "", H = (e, t) => {
43
- S(e, t);
44
- }, k = () => {
45
- Object.keys(y.value).length !== 0 && (y.value = {});
46
- }, $ = (e) => e.when ? j(e.when, T()) : !0, L = (e) => j(e.disabled, T()), G = (e) => j(e.readonly, T()), B = async (e, t = "", n = i.value) => {
47
- const u = t ? `${t}.${e.name}` : e.name, l = W(u);
48
- let a = "";
49
- const d = typeof e.label == "string" ? e.label : e.name, s = ue(e.labelI18n, d) ?? d;
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 c = typeof l == "string" && /<\/?[a-z][^>]*>/i.test(l) && l.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").trim() === "";
52
- (l == null || l === "" || Array.isArray(l) && l.length === 0 || c) && (a = `${s} is required`);
88
+ const p = typeof s == "string" && /<\/?[a-z][^>]*>/i.test(s) && s.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").trim() === "";
89
+ (s == null || s === "" || Array.isArray(s) && s.length === 0 || p) && (l = `${i} is required`);
53
90
  }
54
- if (!a && e.maxFileSize) {
55
- const c = e.maxFileSize * 1024 * 1024;
56
- if (l != null && l !== "") {
57
- const g = Array.isArray(l) ? l : [l];
58
- for (const p of g) {
59
- const r = p instanceof File ? p.size : p?.fileSize || p?.file?.size || p?.size;
60
- if (r !== void 0 && r > c) {
61
- a = `${s} size must be less than ${e.maxFileSize}MB`;
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 (!a && (e.type === "file" || e.type === "fileUploader") && (e.props?.multiple || e.maxFiles)) {
68
- const c = e.maxFiles || e.props?.maxFiles;
69
- c && Array.isArray(l) && l.length > c && (a = `Maximum ${c} files allowed`);
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 (!a && e.validation) {
72
- w(u, !0);
108
+ if (!l && e.validation) {
109
+ V(u, !0);
73
110
  try {
74
- a = await e.validation({
75
- value: l,
111
+ l = await e.validation({
112
+ value: s,
76
113
  values: n,
77
- globalValues: i.value,
78
- isUpdate: h
114
+ globalValues: a.value,
115
+ isUpdate: b
79
116
  });
80
- } catch (c) {
81
- console.error(`[useForm] Validation error in field ${u}:`, c), a = "Validation failed";
117
+ } catch (p) {
118
+ console.error(`[useForm] Validation error in field ${u}:`, p), l = "Validation failed";
82
119
  } finally {
83
- w(u, !1);
120
+ V(u, !1);
84
121
  }
85
122
  }
86
- if (S(u, a), e.type === "customFields" && e.props?.schema) {
87
- const c = e.props.schema, g = Array.isArray(l) ? l : [];
88
- let p = !1;
89
- for (let r = 0; r < g.length; r++) {
90
- const f = g[r] || {}, o = { values: f, globalValues: i.value, isUpdate: h };
91
- for (const m of c) {
92
- const v = !m.when || j(m.when, o), K = j(m.disabled, o);
93
- v && !K ? await B(
94
- m,
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
- f
97
- ) && (p = !0) : S(`${u}.${r}.${m.name}`, "");
133
+ c
134
+ ) && (m = !0) : k(`${u}.${r}.${h.name}`, "");
98
135
  }
99
136
  }
100
- p && !a && (a = "Please fix errors in the list.", S(u, a));
137
+ m && !l && (l = "Please fix errors in the list.", k(u, l));
101
138
  }
102
- return a;
103
- }, J = async () => {
104
- k();
139
+ return l;
140
+ }, re = async () => {
141
+ for (; q; ) await q;
142
+ G();
105
143
  let e = !0;
106
- for (const t of U.value) {
107
- if (!$(t) || L(t)) continue;
108
- await B(t) && (e = !1);
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
- }, Z = async (e, t, n) => {
112
- const u = U.value.filter((a) => a.name === e);
113
- let l = u.find((a) => $(a));
114
- if (!l && u.length > 0 && (l = u[0]), l && (!$(l) || L(l) || G(l))) {
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
- if (i.value = I(i.value, e, t), z.value = !0, S(e, ""), l?.updateValues) {
119
- w(e, !0);
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 a = await l.updateValues({
167
+ const c = s.updateValues({
122
168
  value: t,
123
169
  // Exposing the explicitly requested value
124
- values: i.value,
125
- globalValues: i.value,
170
+ values: a.value,
171
+ globalValues: a.value,
126
172
  data: n,
127
- isUpdate: h,
128
- updateError: H
129
- });
130
- a && typeof a == "object" && (i.value = { ...i.value, ...a });
131
- } catch (a) {
132
- console.error(`[useForm] Error in updateValues for ${e}:`, a);
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
- w(e, !1);
190
+ m() && (D.delete(e), V(e, !1));
135
191
  }
136
192
  }
137
- }, _ = async () => {
138
- const e = A(i.value), t = re(x.value, e, i.value, h), n = (a, d) => {
139
- let s = null;
140
- a instanceof File ? s = a : a && typeof a == "object" && a.file instanceof File && (s = a.file);
141
- const c = {
142
- ...typeof a == "object" ? a : {},
143
- fileName: a?.fileName || s?.name || d.split("/").pop() || "unknown",
144
- fileUrl: d,
145
- fileType: a?.fileType || s?.type || "application/octet-stream",
146
- fileSize: a?.fileSize || s?.size || 0
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 c.file, delete c.base64, c;
149
- }, u = t.map(async (a) => {
150
- const { name: d, value: s, field: c } = a;
151
- if (a.type === "thumbnailSelector") {
152
- const r = s, f = Array.isArray(r.images) ? r.images : [], o = r.thumbnail;
153
- w(d, !0);
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 m = await Promise.all(
156
- f.map(async (b) => {
157
- if (b.startsWith("data:image/")) {
158
- const q = await (await fetch(b)).blob(), te = new File([q], `thumbnail-${Date.now()}.${q.type.split("/")[1] || "jpg"}`, { type: q.type });
159
- return await O(te, C) || b;
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 b;
217
+ return S;
162
218
  })
163
219
  );
164
- let v = o;
165
- if (o && o.startsWith("data:image/")) {
166
- const b = f.indexOf(o);
167
- b !== -1 && m[b] && (v = m[b]);
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: d, value: { images: m, thumbnail: v } };
225
+ return { name: o, value: { images: h, thumbnail: d } };
170
226
  } finally {
171
- w(d, !1);
227
+ V(o, !1);
172
228
  }
173
229
  }
174
- const g = c.returnFileObject === !0, p = Array.isArray(s) ? s.some(
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
- ) : s instanceof File || s && typeof s == "object" && s.file instanceof File;
177
- p && w(d, !0);
232
+ ) : i instanceof File || i && typeof i == "object" && i.file instanceof File;
233
+ m && V(o, !0);
178
234
  try {
179
- if (Array.isArray(s)) {
180
- const r = s.map(async (o) => {
181
- if (o instanceof File || o && typeof o == "object" && o.file instanceof File) {
182
- const v = await O(o, C);
183
- return v ? g ? n(o, v) : v : null;
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 (o && typeof o == "object") {
186
- const v = { ...o };
187
- return delete v.file, delete v.base64, v;
241
+ if (f && typeof f == "object") {
242
+ const d = { ...f };
243
+ return delete d.file, delete d.base64, d;
188
244
  }
189
- return o;
190
- }), f = await Promise.all(r);
191
- return { name: d, value: f };
245
+ return f;
246
+ }), c = await Promise.all(r);
247
+ return { name: o, value: c };
192
248
  } else {
193
- if (s instanceof File || s && typeof s == "object" && s.file instanceof File) {
194
- const f = await O(s, C);
195
- if (f)
196
- return { name: d, value: g ? n(s, f) : f };
197
- } else if (s && typeof s == "object") {
198
- const f = { ...s };
199
- return delete f.file, delete f.base64, { name: d, value: f };
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
- p && w(d, !1);
260
+ m && V(o, !1);
205
261
  }
206
262
  });
207
- return (await Promise.all(u)).forEach((a) => {
208
- a && (Object.assign(e, I(e, a.name, a.value)), i.value = I(i.value, a.name, a.value));
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
- }, ee = (e) => {
266
+ }, pe = (e) => {
211
267
  const t = { ...e };
212
- for (const n of U.value)
213
- if ($(n) && n.type === "customFields" && n.props?.schema) {
214
- const u = Q(t, n.name);
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 l = oe(u, n.props.schema);
217
- Object.assign(t, I(t, n.name, l));
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: i,
224
- errors: y,
225
- isSubmitting: D,
226
- isDirty: z,
227
- fieldLoading: E,
228
- handleFieldChange: Z,
229
- validateField: B,
230
- validateAll: J,
231
- isFieldVisible: $,
232
- isFieldDisabled: L,
233
- isFieldReadonly: G,
234
- getFieldValue: W,
235
- getFieldError: Y,
236
- setFieldError: H,
237
- clearErrors: k,
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
- i.value = A(N.value), k(), z.value = !1;
295
+ W(), Z(), a.value = x(L.value), N = a.value, G(), $.value = !1;
240
296
  },
241
297
  handleSubmit: async () => {
242
- if (await J()) {
243
- D.value = !0;
298
+ if (await re()) {
299
+ Q.value = !0;
244
300
  try {
245
- let t = await _();
246
- t = ee(t), t = await ie(
301
+ let t = await ve();
302
+ t = pe(t), t = await we(
247
303
  t,
248
- x.value,
249
- M.emitFields,
304
+ U.value,
305
+ O.emitFields,
250
306
  void 0,
251
- i.value,
252
- h
253
- ), R && await R({
307
+ a.value,
308
+ b
309
+ ), y && await y({
254
310
  values: t,
255
- isUpdate: h
256
- }), z.value = !1, N.value = A(t);
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
- D.value = !1;
316
+ Q.value = !1;
261
317
  }
262
318
  }
263
319
  },
264
- flatSchema: U,
265
- reinitialize: async (e, t) => {
266
- e !== void 0 && (x.value = e), t !== void 0 && (F = t), await P(t !== void 0 ? t : F);
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
- he as useForm
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 s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-63b24d19"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5faae7a2"]]);
5
5
  export {
6
- s as default
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 N } from "./composables/useCustomFieldRows.js";
7
- import { createRowHelpers as V } from "./rowHelpers.js";
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 A = { class: "custom-fields-wrapper min-w-0 w-full" }, F = { class: "flex justify-between items-center mb-2" }, q = /* @__PURE__ */ g({
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 = N(
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
- () => V({
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, D) => (n(), R("div", A, [
80
- x("div", F, [
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: {