vlite3 1.4.4 → 1.4.5

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 (58) hide show
  1. package/components/AppShell/AppShellLayoutStorefront.vue.js +2 -2
  2. package/components/Cart/Cart.vue.js +242 -0
  3. package/components/Cart/Cart.vue2.js +4 -0
  4. package/components/Cart/CartCouponInput.vue.js +176 -0
  5. package/components/Cart/CartCouponInput.vue2.js +4 -0
  6. package/components/Cart/CartEmptyState.vue.js +48 -0
  7. package/components/Cart/CartEmptyState.vue2.js +4 -0
  8. package/components/Cart/CartLineItem.vue.js +341 -0
  9. package/components/Cart/CartLineItem.vue2.js +4 -0
  10. package/components/Cart/CartSummary.vue.js +157 -0
  11. package/components/Cart/CartSummary.vue2.js +4 -0
  12. package/components/Cart/CartVariant1.vue.js +156 -0
  13. package/components/Cart/CartVariant1.vue2.js +4 -0
  14. package/components/Cart/CartVariant2.vue.js +154 -0
  15. package/components/Cart/CartVariant2.vue2.js +4 -0
  16. package/components/Cart/CartVariant3.vue.js +192 -0
  17. package/components/Cart/CartVariant3.vue2.js +4 -0
  18. package/components/Cart/CartVariant4.vue.js +145 -0
  19. package/components/Cart/CartVariant4.vue2.js +4 -0
  20. package/components/Cart/composables/useCart.d.ts +46 -0
  21. package/components/Cart/composables/useCart.js +110 -0
  22. package/components/Cart/composables/useCartCalculation.js +145 -0
  23. package/components/Cart/index.d.ts +2 -0
  24. package/components/CategoryManager/CategoryManager.vue.js +3 -3
  25. package/components/CategoryManager/CategoryManager.vue2.js +224 -248
  26. package/components/CategoryManager/utils.d.ts +3 -0
  27. package/components/CategoryManager/utils.js +31 -0
  28. package/components/CategoryMenu/CategoryMenu.vue.d.ts +2 -0
  29. package/components/CategoryMenu/CategoryMenu.vue.js +46 -40
  30. package/components/CategoryMenu/CategoryMenuVariant1.vue.d.ts +5 -1
  31. package/components/CategoryMenu/CategoryMenuVariant1.vue.js +5 -144
  32. package/components/CategoryMenu/CategoryMenuVariant1.vue2.js +220 -2
  33. package/components/CategoryMenu/CategoryMenuVariant2.vue.d.ts +5 -1
  34. package/components/CategoryMenu/CategoryMenuVariant2.vue.js +5 -160
  35. package/components/CategoryMenu/CategoryMenuVariant2.vue2.js +235 -2
  36. package/components/CategoryMenu/types.d.ts +5 -2
  37. package/components/Dropdown/Dropdown.vue.d.ts +1 -0
  38. package/components/Dropdown/Dropdown.vue.js +31 -29
  39. package/components/FilePicker/FilePicker.vue.js +278 -202
  40. package/components/Form/CustomFields.vue.d.ts +4 -0
  41. package/components/Form/CustomFields.vue.js +2 -2
  42. package/components/Form/CustomFields.vue2.js +349 -145
  43. package/components/Form/FormField.vue.js +1 -1
  44. package/components/Form/types.d.ts +3 -0
  45. package/components/Modal.vue.d.ts +2 -0
  46. package/components/Modal.vue.js +1 -1
  47. package/components/Modal.vue2.js +30 -28
  48. package/components/Screen/ScreenFilter.vue.js +3 -2
  49. package/components/SidePanel.vue.d.ts +2 -0
  50. package/components/SidePanel.vue.js +1 -1
  51. package/components/SidePanel.vue2.js +25 -23
  52. package/components/SidebarMenu/SidebarMenu.vue.js +145 -128
  53. package/components/index.d.ts +1 -0
  54. package/core/config.d.ts +6 -6
  55. package/index.d.ts +1 -0
  56. package/index.js +327 -306
  57. package/package.json +1 -1
  58. package/style.css +1 -1
@@ -23,6 +23,8 @@ interface Props {
23
23
  /** Form Validation errors passed down */
24
24
  errors?: Record<string, string>;
25
25
  isUpdate?: boolean;
26
+ layout?: 'table' | 'accordion';
27
+ accordionTitleKey?: string;
26
28
  }
27
29
  declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
28
30
  change: (value: Record<string, any>[]) => any;
@@ -36,6 +38,7 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
36
38
  rounded: InputRounded;
37
39
  readonly: boolean;
38
40
  disabled: boolean;
41
+ layout: "table" | "accordion";
39
42
  isUpdate: boolean;
40
43
  modelValue: Record<string, any>[];
41
44
  draggable: boolean;
@@ -44,5 +47,6 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
44
47
  addButtonText: string;
45
48
  showRowNumbers: boolean;
46
49
  errors: Record<string, string>;
50
+ accordionTitleKey: string;
47
51
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
48
52
  export default _default;
@@ -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-58c4250f"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ffa944de"]]);
5
5
  export {
6
- s as default
6
+ p as default
7
7
  };
@@ -1,33 +1,61 @@
1
- import { defineComponent as I, computed as m, shallowRef as ee, watch as te, openBlock as n, createElementBlock as d, createElementVNode as p, createBlock as k, withCtx as N, createTextVNode as ae, toDisplayString as v, createCommentVNode as i, Fragment as V, renderList as C, normalizeClass as F, createVNode as $, unref as le, isMemoSame as re } from "vue";
2
- import { VueDraggable as se } from "vue-draggable-plus";
3
- import oe from "./FormField.vue.js";
4
- import E from "../Button.vue.js";
5
- import ne from "../Label.vue.js";
6
- import de from "../Icon.vue.js";
7
- import { $t as w } from "../../utils/i18n.js";
8
- import { setNestedValue as T, resolveFieldType as ue, evaluateConditional as U } from "./utils/form.utils.js";
9
- const ie = { class: "custom-fields-wrapper" }, ce = { class: "flex justify-between items-center mb-2" }, me = { class: "custom-fields-table border border-border rounded overflow-hidden bg-background" }, be = {
1
+ import { defineComponent as he, computed as p, shallowRef as ge, watch as re, ref as le, openBlock as n, createElementBlock as i, createElementVNode as b, createBlock as k, withCtx as R, createTextVNode as K, toDisplayString as v, createCommentVNode as d, Fragment as x, renderList as j, normalizeClass as $, createVNode as g, unref as N, isMemoSame as ne, resolveDynamicComponent as oe, withModifiers as ke, markRaw as xe } from "vue";
2
+ import { VueDraggable as ie } from "vue-draggable-plus";
3
+ import ue from "./FormField.vue.js";
4
+ import L from "../Button.vue.js";
5
+ import O from "../Label.vue.js";
6
+ import z from "../Icon.vue.js";
7
+ import we from "../Accordion/AccordionItem.vue.js";
8
+ import { $t as V } from "../../utils/i18n.js";
9
+ import { isComponent as M, setNestedValue as de, resolveFieldType as pe, evaluateConditional as W } from "./utils/form.utils.js";
10
+ const Re = { class: "custom-fields-wrapper" }, $e = { class: "flex justify-between items-center mb-2" }, Ve = {
11
+ key: 0,
12
+ class: "custom-fields-table border border-border rounded overflow-hidden bg-background"
13
+ }, Ce = {
10
14
  key: 0,
11
15
  class: "flex border-b border-border bg-muted/50 text-gray-800 text-xs font-semibold uppercase tracking-wider"
12
- }, fe = {
16
+ }, Ue = {
13
17
  key: 0,
14
18
  class: "w-10 flex-none p-3 border-r border-border"
15
- }, ve = {
19
+ }, Fe = {
16
20
  key: 1,
17
21
  class: "w-10 flex-none p-3 text-center border-r border-border"
18
- }, ye = {
22
+ }, je = {
19
23
  key: 2,
20
24
  class: "w-10 flex-none p-3"
21
- }, ge = {
25
+ }, Te = {
22
26
  key: 1,
23
27
  class: "w-10 flex-none flex items-center justify-center text-xs text-muted-foreground border-r border-border bg-muted/20"
24
- }, he = {
28
+ }, Ae = {
25
29
  key: 2,
26
30
  class: "w-10 flex-none flex items-center justify-center border-l border-border bg-muted/20"
27
- }, pe = {
31
+ }, Be = {
28
32
  key: 1,
29
33
  class: "flex flex-col items-center justify-center py-6 text-center bg-muted/5"
30
- }, we = { class: "text-sm font-medium text-foreground" }, xe = { class: "text-xs text-muted-foreground mt-1" }, je = /* @__PURE__ */ I({
34
+ }, Ne = { class: "text-sm font-medium text-foreground" }, ze = { class: "text-xs text-muted-foreground mt-1" }, De = {
35
+ key: 1,
36
+ class: "custom-fields-accordion"
37
+ }, Ee = ["onClick"], Se = { class: "flex items-center flex-1 py-3 px-4 min-w-0" }, Ke = { class: "font-medium flex-1 text-left truncate mr-4" }, Le = { class: "flex items-center gap-2 flex-none" }, Oe = {
38
+ key: 0,
39
+ class: "text-destructive flex items-center justify-center rounded-full bg-destructive/10 w-6 h-6"
40
+ }, Me = {
41
+ key: 0,
42
+ class: "grid gap-4"
43
+ }, We = {
44
+ key: 0,
45
+ class: "text-destructive ml-0.5"
46
+ }, qe = {
47
+ key: 0,
48
+ class: "text-destructive ml-0.5"
49
+ }, He = {
50
+ key: 1,
51
+ class: "mt-1 text-xs text-destructive"
52
+ }, Ge = {
53
+ key: 0,
54
+ class: "col-span-1 flex justify-end"
55
+ }, Je = {
56
+ key: 0,
57
+ class: "flex flex-col items-center justify-center py-6 text-center border border-border rounded bg-muted/5 mt-2"
58
+ }, Pe = { class: "text-sm font-medium text-foreground" }, Qe = { class: "text-xs text-muted-foreground mt-1" }, rt = /* @__PURE__ */ he({
31
59
  __name: "CustomFields",
32
60
  props: {
33
61
  name: {},
@@ -49,213 +77,389 @@ const ie = { class: "custom-fields-wrapper" }, ce = { class: "flex justify-betwe
49
77
  showRowNumbers: { type: Boolean, default: !1 },
50
78
  values: {},
51
79
  errors: { default: () => ({}) },
52
- isUpdate: { type: Boolean, default: !1 }
80
+ isUpdate: { type: Boolean, default: !1 },
81
+ layout: { default: "table" },
82
+ accordionTitleKey: { default: void 0 }
53
83
  },
54
84
  emits: ["update:modelValue", "change"],
55
- setup(r, { emit: S }) {
56
- const t = r, B = S, j = m(() => t.labelI18n ? w(t.labelI18n) : t.label), z = m(() => {
57
- const e = w("vlite.customFields.emptyTitle");
85
+ setup(s, { emit: ce }) {
86
+ const a = s, q = ce, H = p(() => a.labelI18n ? V(a.labelI18n) : a.label), G = p(() => {
87
+ const e = V("vlite.customFields.emptyTitle");
58
88
  return e !== "vlite.customFields.emptyTitle" ? e : "No items added";
59
- }), A = m(() => {
60
- const e = w("vlite.customFields.emptyDescription");
89
+ }), J = p(() => {
90
+ const e = V("vlite.customFields.emptyDescription");
61
91
  return e !== "vlite.customFields.emptyDescription" ? e : "Add a new item to get started";
62
- }), s = ee([]), D = () => `row_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
63
- te(
64
- () => t.modelValue,
92
+ }), u = ge([]), P = () => `row_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
93
+ re(
94
+ () => a.modelValue,
65
95
  (e) => {
66
- Array.isArray(e) ? s.value = e.map((a, o) => {
67
- const l = s.value[o];
96
+ Array.isArray(e) ? u.value = e.map((r, o) => {
97
+ const t = u.value[o];
68
98
  return {
69
- ...a,
70
- _id: l?._id || D()
99
+ ...r,
100
+ _id: t?._id || P()
71
101
  };
72
- }) : s.value = [];
102
+ }) : u.value = [];
73
103
  },
74
104
  { immediate: !0, deep: !0 }
75
105
  );
76
- const H = () => {
106
+ const me = () => {
77
107
  const e = {};
78
- for (const a of t.schema) {
79
- const o = typeof a.value == "function" ? a.value() : a.value;
80
- let l = null;
81
- (a.props?.multiple || a.type === "multiSelect" || a.type === "tags") && (l = []), e[a.name] = o ?? l;
108
+ for (const r of a.schema) {
109
+ const o = typeof r.value == "function" ? r.value() : r.value;
110
+ let t = null;
111
+ (r.props?.multiple || r.type === "multiSelect" || r.type === "tags") && (t = []), e[r.name] = o ?? t;
82
112
  }
83
- return { ...e, _id: D() };
84
- }, L = () => {
85
- if (t.disabled || t.readonly || t.maxRows && s.value.length >= t.maxRows) return;
86
- const e = [...s.value, H()];
87
- s.value = e, y(e);
88
- }, M = (e) => {
89
- if (t.disabled || t.readonly || s.value.length <= t.minRows) return;
90
- const a = [...s.value];
91
- a.splice(e, 1), s.value = a, y(a);
92
- }, G = async (e, a, o) => {
93
- const l = [...s.value];
94
- l[e] = {
95
- ...l[e],
96
- [a]: o.value
113
+ return { ...e, _id: P() };
114
+ }, ve = () => {
115
+ if (a.disabled || a.readonly || a.maxRows && u.value.length >= a.maxRows) return;
116
+ const e = [...u.value, me()];
117
+ u.value = e, T(e);
118
+ }, Q = (e) => {
119
+ if (a.disabled || a.readonly || u.value.length <= a.minRows) return;
120
+ const r = [...u.value];
121
+ r.splice(e, 1), u.value = r, T(r);
122
+ }, X = async (e, r, o) => {
123
+ const t = [...u.value];
124
+ t[e] = {
125
+ ...t[e],
126
+ [r]: o.value
97
127
  };
98
- const h = t.schema.find((c) => c.name === a);
99
- if (h && h.updateValues)
128
+ const U = a.schema.find((c) => c.name === r);
129
+ if (U && U.updateValues)
100
130
  try {
101
- const c = l[e];
102
- let b = { ...t.values || {} };
103
- t.name && (b = T(b, t.name, l));
104
- const f = await h.updateValues({
131
+ const c = t[e];
132
+ let y = { ...a.values || {} };
133
+ a.name && (y = de(y, a.name, t));
134
+ const h = await U.updateValues({
105
135
  value: o.value,
106
136
  values: c,
107
137
  // strictly local row scope
108
- globalValues: b,
138
+ globalValues: y,
109
139
  // strictly global root scope
110
140
  data: o.data,
111
- isUpdate: t.isUpdate
141
+ isUpdate: a.isUpdate
112
142
  });
113
- f && typeof f == "object" && (l[e] = { ...l[e], ...f });
143
+ h && typeof h == "object" && (t[e] = { ...t[e], ...h });
114
144
  } catch (c) {
115
- console.error(`[CustomFields] Error in updateValues for ${a}:`, c);
145
+ console.error(`[CustomFields] Error in updateValues for ${r}:`, c);
116
146
  }
117
- s.value = l, y(l);
118
- }, O = (e) => {
119
- s.value = e, y(e);
120
- }, y = (e) => {
121
- const a = e.map(({ _id: o, ...l }) => l);
122
- B("update:modelValue", a), B("change", a);
123
- }, W = (e, a) => s.value[e]?.[a], q = m(() => !(t.disabled || t.readonly || t.maxRows && s.value.length >= t.maxRows)), x = m(() => t.disabled || t.readonly ? !1 : s.value.length > t.minRows), R = m(() => t.headers && t.headers.length > 0 ? t.headers : t.schema.map((e) => e.labelI18n ? w(e.labelI18n) : e.label || e.name)), J = m(() => t.schema.slice(0, R.value.length)), g = (e) => {
124
- let a = { ...t.values || {} };
125
- return t.name && (a = T(a, t.name, s.value)), {
126
- values: s.value[e] || {},
127
- globalValues: a,
128
- isUpdate: t.isUpdate
147
+ u.value = t, T(t);
148
+ }, Y = (e) => {
149
+ u.value = e, T(e);
150
+ }, T = (e) => {
151
+ const r = e.map(({ _id: o, ...t }) => t);
152
+ q("update:modelValue", r), q("change", r);
153
+ }, Z = (e, r) => u.value[e]?.[r], be = p(() => !(a.disabled || a.readonly || a.maxRows && u.value.length >= a.maxRows)), A = p(() => a.disabled || a.readonly ? !1 : u.value.length > a.minRows), D = p(() => a.headers && a.headers.length > 0 ? a.headers : a.schema.map((e) => e.labelI18n ? V(e.labelI18n) : e.label || e.name)), fe = p(() => a.schema.slice(0, D.value.length)), B = (e) => {
154
+ let r = { ...a.values || {} };
155
+ return a.name && (r = de(r, a.name, u.value)), {
156
+ values: u.value[e] || {},
157
+ globalValues: r,
158
+ isUpdate: a.isUpdate
129
159
  };
130
- }, K = (e, a) => ue(e, g(a)), P = (e, a) => t.disabled ? !0 : U(a.disabled, g(e)), Q = (e, a) => t.readonly ? !0 : U(a.readonly, g(e)), X = (e, a) => a.when ? U(a.when, g(e)) : !0, Y = (e) => {
131
- if (!t.errors || !t.name) return "";
132
- const a = `${t.name}.${e}.`;
133
- return Object.keys(t.errors).filter((o) => o.startsWith(a)).map((o) => t.errors[o]).join(",");
160
+ }, m = (e, r) => pe(e, B(r)), _ = (e, r) => a.disabled ? !0 : W(r.disabled, B(e)), I = (e, r) => a.readonly ? !0 : W(r.readonly, B(e)), ee = (e, r) => r.when ? W(r.when, B(e)) : !0, te = (e) => {
161
+ if (!a.errors || !a.name) return "";
162
+ const r = `${a.name}.${e}.`;
163
+ return Object.keys(a.errors).filter((o) => o.startsWith(r)).map((o) => a.errors[o]).join(",");
164
+ }, ae = (e, r) => a.accordionTitleKey && e[a.accordionTitleKey] ? e[a.accordionTitleKey] : `${a.labelI18n ? V(a.labelI18n) : a.label || "Item"} #${r + 1}`, E = (e) => {
165
+ if (!a.errors || !a.name) return !1;
166
+ const r = `${a.name}.${e}.`;
167
+ return Object.keys(a.errors).some((o) => o.startsWith(r));
168
+ }, w = (e) => e.labelI18n ? V(e.labelI18n) : e.label || e.name, se = (e) => {
169
+ if (e)
170
+ return M(e) ? xe(e) : e;
171
+ }, f = le([]), C = le([]), ye = (e) => {
172
+ f.value.includes(e) ? f.value = f.value.filter((o) => o !== e) : (C.value.includes(e) || C.value.push(e), f.value = [...f.value, e]);
134
173
  };
135
- return (e, a) => (n(), d("div", ie, [
136
- p("div", ce, [
137
- j.value ? (n(), k(ne, {
174
+ return re(
175
+ () => a.errors,
176
+ (e) => {
177
+ if (a.layout !== "accordion" || !e || !a.name) return;
178
+ const r = u.value.filter((o, t) => E(t)).map((o) => o._id);
179
+ if (r.length > 0) {
180
+ const o = /* @__PURE__ */ new Set([...f.value, ...r]);
181
+ f.value = Array.from(o);
182
+ const t = /* @__PURE__ */ new Set([...C.value, ...r]);
183
+ C.value = Array.from(t);
184
+ }
185
+ },
186
+ { deep: !0, immediate: !0 }
187
+ ), (e, r) => (n(), i("div", Re, [
188
+ b("div", $e, [
189
+ H.value ? (n(), k(O, {
138
190
  key: 0,
139
191
  class: "text-sm font-medium text-foreground"
140
192
  }, {
141
- default: N(() => [
142
- ae(v(j.value), 1)
193
+ default: R(() => [
194
+ K(v(H.value), 1)
143
195
  ]),
144
196
  _: 1
145
- })) : i("", !0),
146
- r.readonly ? i("", !0) : (n(), k(E, {
197
+ })) : d("", !0),
198
+ s.readonly ? d("", !0) : (n(), k(L, {
147
199
  key: 1,
148
200
  type: "button",
149
201
  variant: "outline",
150
202
  size: "xs",
151
203
  rounded: "full",
204
+ "as-icon": "",
152
205
  icon: "lucide:plus",
153
- disabled: !q.value,
154
- onClick: L
206
+ disabled: !be.value,
207
+ onClick: ve
155
208
  }, null, 8, ["disabled"]))
156
209
  ]),
157
- p("div", me, [
158
- R.value.length > 1 ? (n(), d("div", be, [
159
- r.draggable && !r.disabled && !r.readonly ? (n(), d("div", fe)) : i("", !0),
160
- r.showRowNumbers ? (n(), d("div", ve, " # ")) : i("", !0),
161
- (n(!0), d(V, null, C(R.value, (o, l) => (n(), d("div", {
162
- key: l,
163
- class: F(["flex-1 p-3 min-w-0 truncate", { "border-l border-border": l > 0 }])
210
+ a.layout === "table" ? (n(), i("div", Ve, [
211
+ D.value.length > 1 ? (n(), i("div", Ce, [
212
+ s.draggable && !s.disabled && !s.readonly ? (n(), i("div", Ue)) : d("", !0),
213
+ s.showRowNumbers ? (n(), i("div", Fe, " # ")) : d("", !0),
214
+ (n(!0), i(x, null, j(D.value, (o, t) => (n(), i("div", {
215
+ key: t,
216
+ class: $(["flex-1 p-3 min-w-0 truncate", { "border-l border-border": t > 0 }])
164
217
  }, v(o), 3))), 128)),
165
- x.value ? (n(), d("div", ye)) : i("", !0)
166
- ])) : i("", !0),
167
- $(le(se), {
168
- "model-value": s.value,
169
- "onUpdate:modelValue": O,
170
- disabled: !r.draggable || r.disabled || r.readonly,
218
+ A.value ? (n(), i("div", je)) : d("", !0)
219
+ ])) : d("", !0),
220
+ g(N(ie), {
221
+ "model-value": u.value,
222
+ "onUpdate:modelValue": Y,
223
+ disabled: !s.draggable || s.disabled || s.readonly,
171
224
  animation: 150,
172
225
  handle: ".drag-handle",
173
226
  "ghost-class": "opacity-50",
174
227
  class: "divide-y divide-border"
175
228
  }, {
176
- default: N(() => [
177
- (n(!0), d(V, null, C(s.value, (o, l, h, c) => {
178
- const b = [
229
+ default: R(() => [
230
+ (n(!0), i(x, null, j(u.value, (o, t, U, c) => {
231
+ const y = [
179
232
  o,
180
- r.disabled,
181
- r.readonly,
182
- r.isUpdate,
183
- r.showRowNumbers,
184
- x.value,
185
- r.draggable,
186
- l,
187
- Y(l)
233
+ s.disabled,
234
+ s.readonly,
235
+ s.isUpdate,
236
+ s.showRowNumbers,
237
+ A.value,
238
+ s.draggable,
239
+ t,
240
+ te(t)
188
241
  ];
189
- if (c && c.key === o._id && re(c, b)) return c;
190
- const f = (n(), d("div", {
242
+ if (c && c.key === o._id && ne(c, y)) return c;
243
+ const h = (n(), i("div", {
191
244
  key: o._id,
192
245
  class: "flex group bg-white transition-colors"
193
246
  }, [
194
- r.draggable && !r.disabled && !r.readonly ? (n(), d("div", {
247
+ s.draggable && !s.disabled && !s.readonly ? (n(), i("div", {
195
248
  key: 0,
196
- class: F([
249
+ class: $([
197
250
  "w-10 flex-none flex items-center justify-center border-r border-border bg-muted/5 drag-handle transition-colors",
198
- r.disabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing hover:bg-muted/10 text-muted-foreground hover:text-foreground"
251
+ s.disabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing hover:bg-muted/10 text-muted-foreground hover:text-foreground"
199
252
  ])
200
253
  }, [
201
- $(de, {
254
+ g(z, {
202
255
  icon: "lucide:grip-vertical",
203
256
  class: "w-4 h-4"
204
257
  })
205
- ], 2)) : i("", !0),
206
- r.showRowNumbers ? (n(), d("div", ge, v(l + 1), 1)) : i("", !0),
207
- (n(!0), d(V, null, C(J.value, (u, Z) => (n(), d("div", {
208
- key: u.name,
209
- class: F(["flex-1 min-w-0 relative", { "border-l border-border": Z > 0 }])
258
+ ], 2)) : d("", !0),
259
+ s.showRowNumbers ? (n(), i("div", Te, v(t + 1), 1)) : d("", !0),
260
+ (n(!0), i(x, null, j(fe.value, (l, F) => (n(), i("div", {
261
+ key: l.name,
262
+ class: $(["flex-1 min-w-0 relative", { "border-l border-border": F > 0 }])
210
263
  }, [
211
- X(l, u) ? (n(), k(oe, {
264
+ ee(t, l) ? (n(), k(ue, {
212
265
  key: 0,
213
266
  field: {
214
- ...u,
267
+ ...l,
215
268
  props: {
216
- ...K(u, l) === "multiSelect" ? { showControls: !1, wrap: !1 } : {},
217
- ...u.props || {}
269
+ ...m(l, t) === "multiSelect" ? { showControls: !1, wrap: !1 } : {},
270
+ ...l.props || {},
271
+ ...m(l, t) === "file" || m(l, t) === "fileUploader" ? { variant: "input" } : {}
218
272
  },
219
273
  label: void 0
220
274
  },
221
- value: W(l, u.name),
222
- values: s.value[l] || {},
223
- errors: r.errors,
224
- error: r.name && r.errors ? r.errors[`${r.name}.${l}.${u.name}`] : "",
275
+ value: Z(t, l.name),
276
+ values: u.value[t] || {},
277
+ errors: s.errors,
278
+ error: s.name && s.errors ? s.errors[`${s.name}.${t}.${l.name}`] : "",
225
279
  variant: "transparent",
226
280
  size: "sm",
227
281
  rounded: "none",
228
- disabled: P(l, u),
229
- readonly: Q(l, u),
230
- isUpdate: r.isUpdate,
282
+ disabled: _(t, l),
283
+ readonly: I(t, l),
284
+ isUpdate: s.isUpdate,
231
285
  class: "w-full h-full min-h-[40px]",
232
- onChange: (_) => G(l, u.name, _)
233
- }, null, 8, ["field", "value", "values", "errors", "error", "disabled", "readonly", "isUpdate", "onChange"])) : i("", !0)
286
+ onChange: (S) => X(t, l.name, S)
287
+ }, null, 8, ["field", "value", "values", "errors", "error", "disabled", "readonly", "isUpdate", "onChange"])) : d("", !0)
234
288
  ], 2))), 128)),
235
- x.value ? (n(), d("div", he, [
236
- $(E, {
289
+ A.value ? (n(), i("div", Ae, [
290
+ g(L, {
237
291
  type: "button",
238
292
  variant: "ghost",
239
293
  size: "xs",
240
294
  icon: "lucide:trash-2",
241
- disabled: r.disabled || r.readonly,
242
- onClick: (u) => M(l)
295
+ disabled: s.disabled || s.readonly,
296
+ onClick: (l) => Q(t)
243
297
  }, null, 8, ["disabled", "onClick"])
244
- ])) : i("", !0)
298
+ ])) : d("", !0)
245
299
  ]));
246
- return f.memo = b, f;
247
- }, a, 0), 128))
300
+ return h.memo = y, h;
301
+ }, r, 0), 128))
302
+ ]),
303
+ _: 1
304
+ }, 8, ["model-value", "disabled"]),
305
+ u.value.length === 0 ? (n(), i("div", Be, [
306
+ b("p", Ne, v(G.value), 1),
307
+ b("p", ze, v(J.value), 1)
308
+ ])) : d("", !0)
309
+ ])) : a.layout === "accordion" ? (n(), i("div", De, [
310
+ g(N(ie), {
311
+ "model-value": u.value,
312
+ "onUpdate:modelValue": Y,
313
+ disabled: !s.draggable || s.disabled || s.readonly,
314
+ animation: 150,
315
+ handle: ".drag-handle",
316
+ "ghost-class": "opacity-50",
317
+ class: "space-y-2"
318
+ }, {
319
+ default: R(() => [
320
+ (n(!0), i(x, null, j(u.value, (o, t, U, c) => {
321
+ const y = [
322
+ o,
323
+ s.disabled,
324
+ s.readonly,
325
+ s.isUpdate,
326
+ s.draggable,
327
+ t,
328
+ te(t),
329
+ E(t),
330
+ f.value.includes(o._id)
331
+ ];
332
+ if (c && c.key === o._id && ne(c, y)) return c;
333
+ const h = (n(), k(we, {
334
+ key: o._id,
335
+ item: { id: o._id, title: ae(o, t) },
336
+ "is-open": f.value.includes(o._id),
337
+ variant: "solid",
338
+ onToggle: ye,
339
+ class: "bg-white"
340
+ }, {
341
+ trigger: R(({ open: l, toggle: F, triggerClass: S }) => [
342
+ b("div", {
343
+ class: $(["flex items-stretch w-full", [S, "!p-0 overflow-hidden"]]),
344
+ onClick: F
345
+ }, [
346
+ s.draggable && !s.disabled && !s.readonly ? (n(), i("div", {
347
+ key: 0,
348
+ class: $([
349
+ "w-12 flex-none flex items-center justify-center border-r border-border bg-muted/5 drag-handle transition-colors",
350
+ s.disabled ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing hover:bg-muted/10 text-muted-foreground hover:text-foreground"
351
+ ]),
352
+ onClick: r[2] || (r[2] = ke(() => {
353
+ }, ["stop"]))
354
+ }, [
355
+ g(z, {
356
+ icon: "lucide:grip-vertical",
357
+ class: "w-4 h-4"
358
+ })
359
+ ], 2)) : d("", !0),
360
+ b("div", Se, [
361
+ b("span", Ke, v(ae(o, t)), 1),
362
+ b("div", Le, [
363
+ E(t) ? (n(), i("div", Oe, [
364
+ g(z, {
365
+ icon: "lucide:alert-circle",
366
+ class: "w-4 h-4"
367
+ })
368
+ ])) : d("", !0),
369
+ g(z, {
370
+ icon: "lucide:chevron-down",
371
+ class: $(["w-4 h-4 transition-transform duration-200", { "rotate-180": l }])
372
+ }, null, 8, ["class"])
373
+ ])
374
+ ])
375
+ ], 10, Ee)
376
+ ]),
377
+ content: R(() => [
378
+ C.value.includes(o._id) ? (n(), i("div", Me, [
379
+ (n(!0), i(x, null, j(a.schema, (l) => (n(), i("div", {
380
+ key: l.name,
381
+ class: "col-span-1 flex flex-col"
382
+ }, [
383
+ ee(t, l) ? (n(), i(x, { key: 0 }, [
384
+ w(l) && m(l, t) !== "switch" && m(l, t) !== "check" && m(l, t) !== "customFields" && m(l, t) !== "choiceBox" ? (n(), k(O, {
385
+ key: 0,
386
+ class: "mb-2 block text-sm font-medium"
387
+ }, {
388
+ default: R(() => [
389
+ N(M)(w(l)) ? (n(), k(oe(se(w(l))), { key: 0 })) : (n(), i(x, { key: 1 }, [
390
+ K(v(w(l)) + " ", 1),
391
+ l.required ? (n(), i("span", We, "*")) : d("", !0)
392
+ ], 64))
393
+ ]),
394
+ _: 2
395
+ }, 1024)) : d("", !0),
396
+ b("div", {
397
+ class: $(["relative", [
398
+ m(l, t) === "check" || m(l, t) === "switch" && l.props?.switchVariant === "basic" ? "w-auto flex items-center" : "w-full"
399
+ ]])
400
+ }, [
401
+ g(ue, {
402
+ field: {
403
+ ...l,
404
+ props: {
405
+ ...l.props || {}
406
+ }
407
+ },
408
+ value: Z(t, l.name),
409
+ values: u.value[t] || {},
410
+ errors: s.errors,
411
+ error: s.name && s.errors ? s.errors[`${s.name}.${t}.${l.name}`] : "",
412
+ variant: s.variant,
413
+ size: s.size,
414
+ rounded: s.rounded,
415
+ disabled: _(t, l),
416
+ readonly: I(t, l),
417
+ isUpdate: s.isUpdate,
418
+ onChange: (F) => X(t, l.name, F)
419
+ }, null, 8, ["field", "value", "values", "errors", "error", "variant", "size", "rounded", "disabled", "readonly", "isUpdate", "onChange"]),
420
+ m(l, t) === "check" || m(l, t) === "switch" && l.props?.switchVariant === "basic" ? (n(), k(O, {
421
+ key: 0,
422
+ class: "ml-2 text-sm font-medium cursor-pointer"
423
+ }, {
424
+ default: R(() => [
425
+ N(M)(w(l)) ? (n(), k(oe(se(w(l))), { key: 0 })) : (n(), i(x, { key: 1 }, [
426
+ K(v(w(l)) + " ", 1),
427
+ l.required ? (n(), i("span", qe, "*")) : d("", !0)
428
+ ], 64))
429
+ ]),
430
+ _: 2
431
+ }, 1024)) : d("", !0)
432
+ ], 2),
433
+ s.name && s.errors && s.errors[`${s.name}.${t}.${l.name}`] ? (n(), i("p", He, v(s.errors[`${s.name}.${t}.${l.name}`]), 1)) : d("", !0)
434
+ ], 64)) : d("", !0)
435
+ ]))), 128)),
436
+ A.value ? (n(), i("div", Ge, [
437
+ g(L, {
438
+ type: "button",
439
+ variant: "secondary",
440
+ size: "xs",
441
+ icon: "lucide:trash-2",
442
+ disabled: s.disabled || s.readonly,
443
+ onClick: (l) => Q(t)
444
+ }, null, 8, ["disabled", "onClick"])
445
+ ])) : d("", !0)
446
+ ])) : d("", !0)
447
+ ]),
448
+ _: 2
449
+ }, 1032, ["item", "is-open"]));
450
+ return h.memo = y, h;
451
+ }, r, 3), 128))
248
452
  ]),
249
453
  _: 1
250
454
  }, 8, ["model-value", "disabled"]),
251
- s.value.length === 0 ? (n(), d("div", pe, [
252
- p("p", we, v(z.value), 1),
253
- p("p", xe, v(A.value), 1)
254
- ])) : i("", !0)
255
- ])
455
+ u.value.length === 0 ? (n(), i("div", Je, [
456
+ b("p", Pe, v(G.value), 1),
457
+ b("p", Qe, v(J.value), 1)
458
+ ])) : d("", !0)
459
+ ])) : d("", !0)
256
460
  ]));
257
461
  }
258
462
  });
259
463
  export {
260
- je as default
464
+ rt as default
261
465
  };
@@ -266,7 +266,7 @@ const Be = /* @__PURE__ */ E({
266
266
  maxFiles: e.field.maxFiles || e.field.props?.maxFiles,
267
267
  fileTypes: e.field.props?.accept ? e.field.props.accept.split(",") : [],
268
268
  returnFormat: "base64",
269
- variant: a === "file" ? "input" : "dropzone",
269
+ variant: e.field.props?.variant ?? (a === "file" ? "input" : "dropzone"),
270
270
  placeholder: o,
271
271
  size: e.size,
272
272
  rounded: e.rounded,