vlite3 0.9.6 → 0.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,36 @@
1
- import { defineComponent as Q, computed as c, shallowRef as W, watch as X, openBlock as s, createElementBlock as n, createElementVNode as v, createBlock as B, withCtx as D, createTextVNode as Y, toDisplayString as m, createCommentVNode as u, createVNode as g, Fragment as w, renderList as x, normalizeClass as R, unref as Z, isMemoSame as I } from "vue";
2
- import { VueDraggable as ee } from "vue-draggable-plus";
3
- import te from "./FormField.vue.js";
4
- import $ from "../Button.vue.js";
5
- import ae from "../Label.vue.js";
6
- import le from "../Icon.vue.js";
7
- import { $t as h } from "../../utils/i18n.js";
8
- import { evaluateConditional as k } from "./utils/form.utils.js";
9
- const re = { class: "custom-fields-wrapper" }, se = { class: "flex justify-between items-center mb-2" }, oe = { class: "custom-fields-table border border-border rounded overflow-hidden bg-background" }, ne = {
1
+ import { defineComponent as Y, computed as f, shallowRef as Z, watch as I, openBlock as n, createElementBlock as d, createElementVNode as y, createBlock as B, withCtx as D, createTextVNode as ee, toDisplayString as v, createCommentVNode as c, createVNode as p, Fragment as k, renderList as V, normalizeClass as C, unref as te, isMemoSame as ae } from "vue";
2
+ import { VueDraggable as re } from "vue-draggable-plus";
3
+ import le from "./FormField.vue.js";
4
+ import N from "../Button.vue.js";
5
+ import se from "../Label.vue.js";
6
+ import oe from "../Icon.vue.js";
7
+ import { $t as w } from "../../utils/i18n.js";
8
+ import { setNestedValue as E, evaluateConditional as $ } from "./utils/form.utils.js";
9
+ const ne = { class: "custom-fields-wrapper" }, de = { class: "flex justify-between items-center mb-2" }, ue = { class: "custom-fields-table border border-border rounded overflow-hidden bg-background" }, ie = {
10
10
  key: 0,
11
11
  class: "flex border-b border-border bg-muted/50 text-gray-800 text-xs font-semibold uppercase tracking-wider"
12
- }, de = {
12
+ }, ce = {
13
13
  key: 0,
14
14
  class: "w-10 flex-none p-3 border-r border-border"
15
- }, ie = {
15
+ }, me = {
16
16
  key: 1,
17
17
  class: "w-10 flex-none p-3 text-center border-r border-border"
18
- }, ue = {
18
+ }, be = {
19
19
  key: 2,
20
20
  class: "w-10 flex-none p-3"
21
- }, ce = {
21
+ }, fe = {
22
22
  key: 1,
23
23
  class: "w-10 flex-none flex items-center justify-center text-xs text-muted-foreground border-r border-border bg-muted/20"
24
- }, me = {
24
+ }, ve = {
25
25
  key: 2,
26
26
  class: "w-10 flex-none flex items-center justify-center border-l border-border bg-muted/20"
27
- }, be = {
27
+ }, ge = {
28
28
  key: 1,
29
29
  class: "flex flex-col items-center justify-center py-6 text-center bg-muted/5"
30
- }, fe = { class: "text-sm font-medium text-foreground" }, ve = { class: "text-xs text-muted-foreground mt-1" }, Ce = /* @__PURE__ */ Q({
30
+ }, he = { class: "text-sm font-medium text-foreground" }, ye = { class: "text-xs text-muted-foreground mt-1" }, Fe = /* @__PURE__ */ Y({
31
31
  __name: "CustomFields",
32
32
  props: {
33
+ name: {},
33
34
  modelValue: { default: () => [] },
34
35
  schema: {},
35
36
  headers: { default: () => [] },
@@ -46,168 +47,199 @@ const re = { class: "custom-fields-wrapper" }, se = { class: "flex justify-betwe
46
47
  labelI18n: {},
47
48
  showRowNumbers: { type: Boolean, default: !1 },
48
49
  values: {},
50
+ errors: { default: () => ({}) },
49
51
  isUpdate: { type: Boolean, default: !1 }
50
52
  },
51
53
  emits: ["update:modelValue", "change"],
52
- setup(o, { emit: j }) {
53
- const a = o, _ = j, C = c(() => a.labelI18n ? h(a.labelI18n) : a.label), z = c(() => {
54
- const e = h("vlite.customFields.emptyTitle");
54
+ setup(s, { emit: z }) {
55
+ const t = s, F = z, U = f(() => t.labelI18n ? w(t.labelI18n) : t.label), A = f(() => {
56
+ const e = w("vlite.customFields.emptyTitle");
55
57
  return e !== "vlite.customFields.emptyTitle" ? e : "No items added";
56
- }), A = c(() => {
57
- const e = h("vlite.customFields.emptyDescription");
58
+ }), T = f(() => {
59
+ const e = w("vlite.customFields.emptyDescription");
58
60
  return e !== "vlite.customFields.emptyDescription" ? e : "Add a new item to get started";
59
- }), r = W([]), V = () => `row_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
60
- X(
61
- () => a.modelValue,
61
+ }), l = Z([]), _ = () => `row_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
62
+ I(
63
+ () => t.modelValue,
62
64
  (e) => {
63
- Array.isArray(e) ? r.value = e.map((t, d) => {
64
- const l = r.value[d];
65
+ Array.isArray(e) ? l.value = e.map((a, o) => {
66
+ const r = l.value[o];
65
67
  return {
66
- ...t,
67
- _id: l?._id || V()
68
+ ...a,
69
+ _id: r?._id || _()
68
70
  };
69
- }) : r.value = [];
71
+ }) : l.value = [];
70
72
  },
71
73
  { immediate: !0, deep: !0 }
72
74
  );
73
- const E = () => {
75
+ const S = () => {
74
76
  const e = {};
75
- for (const t of a.schema) {
76
- const d = typeof t.value == "function" ? t.value() : t.value;
77
- e[t.name] = d ?? null;
77
+ for (const a of t.schema) {
78
+ const o = typeof a.value == "function" ? a.value() : a.value;
79
+ e[a.name] = o ?? null;
78
80
  }
79
- return { ...e, _id: V() };
80
- }, T = () => {
81
- if (a.disabled || a.maxRows && r.value.length >= a.maxRows) return;
82
- const e = [...r.value, E()];
83
- r.value = e, b(e);
84
- }, S = (e) => {
85
- if (a.disabled || r.value.length <= a.minRows) return;
86
- const t = [...r.value];
87
- t.splice(e, 1), r.value = t, b(t);
88
- }, L = (e, t, d) => {
89
- const l = [...r.value];
90
- l[e] = {
91
- ...l[e],
92
- [t]: d.value
93
- }, r.value = l, b(l);
94
- }, M = (e) => {
95
- r.value = e, b(e);
96
- }, b = (e) => {
97
- const t = e.map(({ _id: d, ...l }) => l);
98
- _("update:modelValue", t), _("change", t);
99
- }, H = (e, t) => r.value[e]?.[t], q = c(() => !(a.disabled || a.maxRows && r.value.length >= a.maxRows)), y = c(() => a.disabled ? !1 : r.value.length > a.minRows), F = c(() => a.headers && a.headers.length > 0 ? a.headers : a.schema.map((e) => e.labelI18n ? h(e.labelI18n) : e.label || e.name)), p = (e) => ({
100
- values: { ...a.values || {}, ...r.value[e] || {} },
101
- isUpdate: a.isUpdate
102
- }), G = (e, t) => a.disabled ? !0 : k(t.disabled, p(e)), J = (e, t) => k(t.readonly, p(e)), K = (e, t) => t.when ? k(t.when, p(e)) : !0;
103
- return (e, t) => (s(), n("div", re, [
104
- v("div", se, [
105
- C.value ? (s(), B(ae, {
81
+ return { ...e, _id: _() };
82
+ }, H = () => {
83
+ if (t.disabled || t.maxRows && l.value.length >= t.maxRows) return;
84
+ const e = [...l.value, S()];
85
+ l.value = e, g(e);
86
+ }, L = (e) => {
87
+ if (t.disabled || l.value.length <= t.minRows) return;
88
+ const a = [...l.value];
89
+ a.splice(e, 1), l.value = a, g(a);
90
+ }, M = async (e, a, o) => {
91
+ const r = [...l.value];
92
+ r[e] = {
93
+ ...r[e],
94
+ [a]: o.value
95
+ };
96
+ const h = t.schema.find((i) => i.name === a);
97
+ if (h && h.updateValues)
98
+ try {
99
+ const i = r[e];
100
+ let m = { ...t.values || {} };
101
+ t.name && (m = E(m, t.name, r));
102
+ const b = await h.updateValues({
103
+ value: o.value,
104
+ values: i,
105
+ // strictly local row scope
106
+ globalValues: m,
107
+ // strictly global root scope
108
+ data: o.data,
109
+ isUpdate: t.isUpdate
110
+ });
111
+ b && typeof b == "object" && (r[e] = { ...r[e], ...b });
112
+ } catch (i) {
113
+ console.error(`[CustomFields] Error in updateValues for ${a}:`, i);
114
+ }
115
+ l.value = r, g(r);
116
+ }, G = (e) => {
117
+ l.value = e, g(e);
118
+ }, g = (e) => {
119
+ const a = e.map(({ _id: o, ...r }) => r);
120
+ F("update:modelValue", a), F("change", a);
121
+ }, O = (e, a) => l.value[e]?.[a], W = f(() => !(t.disabled || t.maxRows && l.value.length >= t.maxRows)), x = f(() => t.disabled ? !1 : l.value.length > t.minRows), j = f(() => t.headers && t.headers.length > 0 ? t.headers : t.schema.map((e) => e.labelI18n ? w(e.labelI18n) : e.label || e.name)), R = (e) => {
122
+ let a = { ...t.values || {} };
123
+ return t.name && (a = E(a, t.name, l.value)), {
124
+ values: l.value[e] || {},
125
+ globalValues: a,
126
+ isUpdate: t.isUpdate
127
+ };
128
+ }, q = (e, a) => t.disabled ? !0 : $(a.disabled, R(e)), J = (e, a) => $(a.readonly, R(e)), K = (e, a) => a.when ? $(a.when, R(e)) : !0, P = (e) => {
129
+ if (!t.errors || !t.name) return "";
130
+ const a = `${t.name}.${e}.`;
131
+ return Object.keys(t.errors).filter((o) => o.startsWith(a)).map((o) => t.errors[o]).join(",");
132
+ };
133
+ return (e, a) => (n(), d("div", ne, [
134
+ y("div", de, [
135
+ U.value ? (n(), B(se, {
106
136
  key: 0,
107
137
  class: "text-sm font-medium text-foreground"
108
138
  }, {
109
139
  default: D(() => [
110
- Y(m(C.value), 1)
140
+ ee(v(U.value), 1)
111
141
  ]),
112
142
  _: 1
113
- })) : u("", !0),
114
- g($, {
143
+ })) : c("", !0),
144
+ p(N, {
115
145
  type: "button",
116
146
  variant: "outline",
117
147
  size: "xs",
118
148
  rounded: "full",
119
149
  icon: "lucide:plus",
120
- disabled: !q.value,
121
- onClick: T
150
+ disabled: !W.value,
151
+ onClick: H
122
152
  }, null, 8, ["disabled"])
123
153
  ]),
124
- v("div", oe, [
125
- F.value.length > 0 ? (s(), n("div", ne, [
126
- o.draggable ? (s(), n("div", de)) : u("", !0),
127
- o.showRowNumbers ? (s(), n("div", ie, " # ")) : u("", !0),
128
- (s(!0), n(w, null, x(F.value, (d, l) => (s(), n("div", {
129
- key: l,
130
- class: R(["flex-1 p-3 min-w-0 truncate", { "border-l border-border": l > 0 }])
131
- }, m(d), 3))), 128)),
132
- y.value ? (s(), n("div", ue)) : u("", !0)
133
- ])) : u("", !0),
134
- g(Z(ee), {
135
- "model-value": r.value,
136
- "onUpdate:modelValue": M,
137
- disabled: !o.draggable || o.disabled,
154
+ y("div", ue, [
155
+ j.value.length > 0 ? (n(), d("div", ie, [
156
+ s.draggable ? (n(), d("div", ce)) : c("", !0),
157
+ s.showRowNumbers ? (n(), d("div", me, " # ")) : c("", !0),
158
+ (n(!0), d(k, null, V(j.value, (o, r) => (n(), d("div", {
159
+ key: r,
160
+ class: C(["flex-1 p-3 min-w-0 truncate", { "border-l border-border": r > 0 }])
161
+ }, v(o), 3))), 128)),
162
+ x.value ? (n(), d("div", be)) : c("", !0)
163
+ ])) : c("", !0),
164
+ p(te(re), {
165
+ "model-value": l.value,
166
+ "onUpdate:modelValue": G,
167
+ disabled: !s.draggable || s.disabled,
138
168
  animation: 150,
139
169
  handle: ".drag-handle",
140
170
  "ghost-class": "opacity-50",
141
171
  class: "divide-y divide-border"
142
172
  }, {
143
173
  default: D(() => [
144
- (s(!0), n(w, null, x(r.value, (d, l, ge, f) => {
145
- const N = [d, o.disabled, o.isUpdate, o.showRowNumbers, y.value, o.draggable, l];
146
- if (f && f.key === d._id && I(f, N)) return f;
147
- const U = (s(), n("div", {
148
- key: d._id,
174
+ (n(!0), d(k, null, V(l.value, (o, r, h, i) => {
175
+ const m = [o, s.disabled, s.isUpdate, s.showRowNumbers, x.value, s.draggable, r, P(r)];
176
+ if (i && i.key === o._id && ae(i, m)) return i;
177
+ const b = (n(), d("div", {
178
+ key: o._id,
149
179
  class: "flex group bg-white transition-colors"
150
180
  }, [
151
- o.draggable ? (s(), n("div", {
181
+ s.draggable ? (n(), d("div", {
152
182
  key: 0,
153
- class: R(["w-10 flex-none flex items-center justify-center border-r border-border bg-muted/5 drag-handle transition-colors", o.disabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing hover:bg-muted/10 text-muted-foreground hover:text-foreground"])
183
+ class: C(["w-10 flex-none flex items-center justify-center border-r border-border bg-muted/5 drag-handle transition-colors", s.disabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing hover:bg-muted/10 text-muted-foreground hover:text-foreground"])
154
184
  }, [
155
- g(le, {
185
+ p(oe, {
156
186
  icon: "lucide:grip-vertical",
157
187
  class: "w-4 h-4"
158
188
  })
159
- ], 2)) : u("", !0),
160
- o.showRowNumbers ? (s(), n("div", ce, m(l + 1), 1)) : u("", !0),
161
- (s(!0), n(w, null, x(o.schema, (i, O) => (s(), n("div", {
162
- key: i.name,
163
- class: R(["flex-1 min-w-0 relative", { "border-l border-border": O > 0 }])
189
+ ], 2)) : c("", !0),
190
+ s.showRowNumbers ? (n(), d("div", fe, v(r + 1), 1)) : c("", !0),
191
+ (n(!0), d(k, null, V(s.schema, (u, Q) => (n(), d("div", {
192
+ key: u.name,
193
+ class: C(["flex-1 min-w-0 relative", { "border-l border-border": Q > 0 }])
164
194
  }, [
165
- K(l, i) ? (s(), B(te, {
195
+ K(r, u) ? (n(), B(le, {
166
196
  key: 0,
167
197
  field: {
168
- ...i,
198
+ ...u,
169
199
  props: {
170
- ...i.type === "multiSelect" ? { showControls: !1, wrap: !1 } : {},
171
- ...i.props || {}
200
+ ...u.type === "multiSelect" ? { showControls: !1, wrap: !1 } : {},
201
+ ...u.props || {}
172
202
  },
173
203
  label: void 0
174
204
  },
175
- value: H(l, i.name),
176
- values: o.values || {},
205
+ value: O(r, u.name),
206
+ values: l.value[r] || {},
207
+ errors: s.errors,
208
+ error: s.name && s.errors ? s.errors[`${s.name}.${r}.${u.name}`] : "",
177
209
  variant: "transparent",
178
210
  size: "sm",
179
211
  rounded: "none",
180
- disabled: G(l, i),
181
- readonly: J(l, i),
182
- isUpdate: o.isUpdate,
212
+ disabled: q(r, u),
213
+ readonly: J(r, u),
214
+ isUpdate: s.isUpdate,
183
215
  class: "w-full h-full min-h-[40px]",
184
- onChange: (P) => L(l, i.name, P)
185
- }, null, 8, ["field", "value", "values", "disabled", "readonly", "isUpdate", "onChange"])) : u("", !0)
216
+ onChange: (X) => M(r, u.name, X)
217
+ }, null, 8, ["field", "value", "values", "errors", "error", "disabled", "readonly", "isUpdate", "onChange"])) : c("", !0)
186
218
  ], 2))), 128)),
187
- y.value ? (s(), n("div", me, [
188
- g($, {
219
+ x.value ? (n(), d("div", ve, [
220
+ p(N, {
189
221
  type: "button",
190
222
  variant: "ghost",
191
223
  size: "xs",
192
224
  icon: "lucide:trash-2",
193
- disabled: o.disabled,
194
- onClick: (i) => S(l)
225
+ disabled: s.disabled,
226
+ onClick: (u) => L(r)
195
227
  }, null, 8, ["disabled", "onClick"])
196
- ])) : u("", !0)
228
+ ])) : c("", !0)
197
229
  ]));
198
- return U.memo = N, U;
199
- }, t, 0), 128))
230
+ return b.memo = m, b;
231
+ }, a, 0), 128))
200
232
  ]),
201
233
  _: 1
202
234
  }, 8, ["model-value", "disabled"]),
203
- r.value.length === 0 ? (s(), n("div", be, [
204
- v("p", fe, m(z.value), 1),
205
- v("p", ve, m(A.value), 1)
206
- ])) : u("", !0)
235
+ l.value.length === 0 ? (n(), d("div", ge, [
236
+ y("p", he, v(A.value), 1),
237
+ y("p", ye, v(T.value), 1)
238
+ ])) : c("", !0)
207
239
  ])
208
240
  ]));
209
241
  }
210
242
  });
211
243
  export {
212
- Ce as default
244
+ Fe as default
213
245
  };
@@ -4,6 +4,7 @@ interface Props {
4
4
  field: IForm;
5
5
  value: any;
6
6
  values: Record<string, any>;
7
+ errors?: Record<string, string>;
7
8
  variant?: InputVariant;
8
9
  size?: InputSize;
9
10
  rounded?: InputRounded;
@@ -21,6 +21,7 @@ const ge = /* @__PURE__ */ T({
21
21
  field: {},
22
22
  value: {},
23
23
  values: {},
24
+ errors: {},
24
25
  variant: { default: "outline" },
25
26
  size: { default: "md" },
26
27
  rounded: { default: "md" },
@@ -206,6 +207,7 @@ const ge = /* @__PURE__ */ T({
206
207
  value: e.value || "lucide:smile"
207
208
  } : a === "customFields" ? {
208
209
  ...i,
210
+ name: e.field.name,
209
211
  label: e?.field?.label,
210
212
  labelI18n: e?.field?.labelI18n,
211
213
  modelValue: Array.isArray(e.value) ? e.value : [],
@@ -213,6 +215,7 @@ const ge = /* @__PURE__ */ T({
213
215
  headers: e.field.props?.headers || [],
214
216
  draggable: e.field.props?.draggable || !1,
215
217
  values: e.values,
218
+ errors: e.errors,
216
219
  variant: e.variant,
217
220
  size: e.size,
218
221
  rounded: e.rounded,
@@ -1,7 +1,7 @@
1
1
  import o from "./FormFields.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const s = /* @__PURE__ */ r(o, [["__scopeId", "data-v-1139135c"]]);
4
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-e60dfb65"]]);
5
5
  export {
6
- s as default
6
+ f as default
7
7
  };
@@ -1,5 +1,5 @@
1
- import { defineComponent as M, computed as O, ref as j, openBlock as s, createElementBlock as r, normalizeClass as d, Fragment as y, renderList as G, withMemo as J, createBlock as h, withCtx as L, unref as R, resolveDynamicComponent as z, createTextVNode as k, toDisplayString as p, createCommentVNode as c, createElementVNode as K, createVNode as P, markRaw as Q } from "vue";
2
- import { isComponent as v, getNestedValue as W } from "./utils/form.utils.js";
1
+ import { defineComponent as M, computed as O, ref as j, openBlock as s, createElementBlock as o, normalizeClass as m, Fragment as y, renderList as G, withMemo as J, createBlock as h, withCtx as L, unref as R, resolveDynamicComponent as z, createTextVNode as k, toDisplayString as v, createCommentVNode as c, createElementVNode as K, createVNode as P, markRaw as Q } from "vue";
2
+ import { isComponent as p, getNestedValue as W } from "./utils/form.utils.js";
3
3
  import U from "../Label.vue.js";
4
4
  import X from "./FormField.vue.js";
5
5
  import { $t as Y } from "../../utils/i18n.js";
@@ -33,30 +33,30 @@ const Z = {
33
33
  isFieldReadonly: {}
34
34
  },
35
35
  emits: ["change", "addonAction"],
36
- setup(a, { emit: q }) {
37
- const o = a, g = q, D = O(() => {
38
- if (o.className) return o.className;
39
- }), F = (t) => W(o.values, t.name), l = (t) => o.errors[t.name] || "", $ = (t) => o.isFieldVisible ? o.isFieldVisible(t) : !0, x = (t) => o.isFieldDisabled ? o.isFieldDisabled(t) : t.disabled === !0, A = (t) => o.isFieldReadonly ? o.isFieldReadonly(t) : t.readonly === !0, u = (t) => t.labelI18n ? Y(t.labelI18n) : t.label, w = (t) => {
36
+ setup(a, { emit: f }) {
37
+ const r = a, g = f, q = O(() => {
38
+ if (r.className) return r.className;
39
+ }), F = (t) => W(r.values, t.name), l = (t) => r.errors[t.name] || "", D = (t) => r.isFieldVisible ? r.isFieldVisible(t) : !0, x = (t) => r.isFieldDisabled ? r.isFieldDisabled(t) : t.disabled === !0, A = (t) => r.isFieldReadonly ? r.isFieldReadonly(t) : t.readonly === !0, u = (t) => t.labelI18n ? Y(t.labelI18n) : t.label, w = (t) => {
40
40
  if (t)
41
- return v(t) ? Q(t) : t;
42
- }, f = (t, n) => {
41
+ return p(t) ? Q(t) : t;
42
+ }, $ = (t, n) => {
43
43
  g("change", t.name, n);
44
44
  }, B = (t) => t.itemClass || "", I = (t, n) => {
45
45
  g("change", t, n);
46
46
  }, E = (t) => {
47
47
  g("addonAction", t);
48
- }, m = j({}), T = (t) => {
49
- m.value[t] = !0;
48
+ }, d = j({}), T = (t) => {
49
+ d.value[t] = !0;
50
50
  }, S = (t) => {
51
- m.value[t] = !1;
51
+ d.value[t] = !1;
52
52
  }, C = (t) => {
53
53
  const n = F(t), e = n != null && n !== "" && !(Array.isArray(n) && n.length === 0), i = typeof n == "number" && !isNaN(n);
54
- return V(t) || t.type === "number" ? m.value[t.name] || e || i : e || i;
54
+ return V(t) || t.type === "number" ? d.value[t.name] || e || i : e || i;
55
55
  }, V = (t) => {
56
56
  const n = t.type || "text";
57
57
  return ["text", "email", "password", "tel", "url", "search", "textarea"].includes(n);
58
58
  }, H = (t) => t.type === "number" ? (t.props?.variant ?? "split") === "split" ? "left-4" : "left-3" : t.type === "date" || t.type === "time" || t.type === "color" ? "left-10" : "left-3", b = (t) => {
59
- if (o.variant !== "floating") return !1;
59
+ if (r.variant !== "floating") return !1;
60
60
  const n = t.type || "text";
61
61
  return ![
62
62
  "switch",
@@ -68,65 +68,65 @@ const Z = {
68
68
  ].includes(n);
69
69
  }, N = (t) => {
70
70
  const n = u(t);
71
- if (!(!n || v(n)))
71
+ if (!(!n || p(n)))
72
72
  return n;
73
73
  };
74
- return (t, n) => (s(), r("div", {
75
- class: d(["grid", a.variant === "floating" ? "gap-5 mt-1" : "gap-4", D.value])
74
+ return (t, n) => (s(), o("div", {
75
+ class: m(["grid", a.variant === "floating" ? "gap-5 mt-1" : "gap-4", q.value])
76
76
  }, [
77
- (s(!0), r(y, null, G(a.schema, (e) => (s(), r(y, {
77
+ (s(!0), o(y, null, G(a.schema, (e) => (s(), o(y, {
78
78
  key: e.name
79
79
  }, [
80
- $(e) ? J([
80
+ D(e) ? J([
81
81
  e,
82
82
  F(e),
83
83
  l(e),
84
84
  x(e),
85
85
  A(e),
86
- m.value[e.name],
86
+ d.value[e.name],
87
87
  a.variant,
88
88
  a.size,
89
89
  a.rounded,
90
90
  a.isUpdate,
91
91
  a.showRequiredAsterisk,
92
92
  a.fieldLoading[e.name]
93
- ], () => (s(), r("div", {
93
+ ], () => (s(), o("div", {
94
94
  key: 0,
95
- class: d(["max-md:col-span-full! form-field-item", B(e)])
95
+ class: m(["max-md:col-span-full! form-field-item", B(e)])
96
96
  }, [
97
97
  u(e) && e.type !== "switch" && e.type !== "check" && e.type !== "customFields" && !b(e) ? (s(), h(U, {
98
98
  key: 0,
99
99
  for: e.name,
100
- class: "mb-2 block text-sm font-medium"
100
+ class: "mb-2 block -text-fs-2! font-medium"
101
101
  }, {
102
102
  default: L(() => [
103
- R(v)(u(e)) ? (s(), h(z(w(u(e))), { key: 0 })) : (s(), r(y, { key: 1 }, [
104
- k(p(u(e)) + " ", 1),
105
- e.required && a.showRequiredAsterisk ? (s(), r("span", Z, "*")) : c("", !0)
103
+ R(p)(u(e)) ? (s(), h(z(w(u(e))), { key: 0 })) : (s(), o(y, { key: 1 }, [
104
+ k(v(u(e)) + " ", 1),
105
+ e.required && a.showRequiredAsterisk ? (s(), o("span", Z, "*")) : c("", !0)
106
106
  ], 64))
107
107
  ]),
108
108
  _: 2
109
109
  }, 1032, ["for"])) : c("", !0),
110
110
  K("div", {
111
- class: d(["relative", ["switch", "check"].includes(e.type) ? "w-auto" : "w-full"]),
111
+ class: m(["relative", ["switch", "check"].includes(e.type) ? "w-auto" : "w-full"]),
112
112
  onFocusin: (i) => T(e.name),
113
113
  onFocusout: (i) => S(e.name)
114
114
  }, [
115
- b(e) && N(e) && !V(e) ? (s(), r("label", {
115
+ b(e) && N(e) && !V(e) ? (s(), o("label", {
116
116
  key: 0,
117
117
  for: e.name,
118
- class: d([
118
+ class: m([
119
119
  "absolute transition-all duration-200 ease-in-out pointer-events-none z-20",
120
120
  C(e) ? "-top-2.5 left-3 text-xs bg-background px-1 text-black shadow-[0_4px_4px_-4px_bg-background]" : `top-1/2 -translate-y-1/2 text-sm text-muted-foreground/70 ${H(e)}`
121
121
  ])
122
122
  }, [
123
- R(v)(u(e)) ? (s(), h(z(w(u(e))), { key: 0 })) : (s(), r(y, { key: 1 }, [
124
- k(p(u(e)) + " ", 1),
125
- e.required ? (s(), r("span", te, "*")) : c("", !0)
123
+ R(p)(u(e)) ? (s(), h(z(w(u(e))), { key: 0 })) : (s(), o(y, { key: 1 }, [
124
+ k(v(u(e)) + " ", 1),
125
+ e.required ? (s(), o("span", te, "*")) : c("", !0)
126
126
  ], 64))
127
127
  ], 10, ee)) : c("", !0),
128
128
  P(X, {
129
- field: o.variant === "floating" ? {
129
+ field: r.variant === "floating" ? {
130
130
  ...e,
131
131
  placeholder: void 0,
132
132
  placeholderI18n: void 0,
@@ -136,6 +136,7 @@ const Z = {
136
136
  floatingActive: C(e),
137
137
  label: e.type === "customFields" ? void 0 : b(e) ? N(e) : void 0,
138
138
  values: a.values,
139
+ errors: a.errors,
139
140
  variant: a.variant,
140
141
  size: a.size,
141
142
  rounded: a.rounded,
@@ -144,10 +145,10 @@ const Z = {
144
145
  error: l(e),
145
146
  isUpdate: a.isUpdate,
146
147
  loading: a.fieldLoading[e.name],
147
- onChange: (i) => f(e, i),
148
+ onChange: (i) => $(e, i),
148
149
  onAddonChange: I,
149
150
  onAddonAction: E
150
- }, null, 8, ["field", "value", "floatingActive", "label", "values", "variant", "size", "rounded", "disabled", "readonly", "error", "isUpdate", "loading", "onChange"])
151
+ }, null, 8, ["field", "value", "floatingActive", "label", "values", "errors", "variant", "size", "rounded", "disabled", "readonly", "error", "isUpdate", "loading", "onChange"])
151
152
  ], 42, _),
152
153
  u(e) && (e.type === "switch" || e.type === "check") ? (s(), h(U, {
153
154
  key: 1,
@@ -155,12 +156,12 @@ const Z = {
155
156
  class: "ml-2 text-sm font-medium cursor-pointer"
156
157
  }, {
157
158
  default: L(() => [
158
- k(p(u(e)) + " ", 1),
159
- e.required ? (s(), r("span", ne, "*")) : c("", !0)
159
+ k(v(u(e)) + " ", 1),
160
+ e.required ? (s(), o("span", ne, "*")) : c("", !0)
160
161
  ]),
161
162
  _: 2
162
163
  }, 1032, ["for"])) : c("", !0),
163
- l(e) ? (s(), r("p", ae, p(l(e)), 1)) : c("", !0)
164
+ l(e) ? (s(), o("p", ae, v(l(e)), 1)) : c("", !0)
164
165
  ], 2)), n, 0) : c("", !0)
165
166
  ], 64))), 128))
166
167
  ], 2));
@@ -22,7 +22,7 @@ export interface UseFormReturn {
22
22
  /** Handle field value change */
23
23
  handleFieldChange: (name: string, value: any, data?: any) => Promise<void>;
24
24
  /** Validate a single field */
25
- validateField: (field: IForm) => Promise<string>;
25
+ validateField: (field: IForm, basePath?: string) => Promise<string>;
26
26
  /** Validate all fields */
27
27
  validateAll: () => Promise<boolean>;
28
28
  /** Check if field is visible */