vlite3 1.3.9 → 1.3.11

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,12 +1,12 @@
1
- import { ref as z, shallowRef as H, computed as ee, watch as ae } from "vue";
2
- import { deepClone as V, initializeFormValues as le, cleanSubmitValues as te, getNestedValue as J, evaluateConditional as S, setNestedValue as j, collectFileFields as se, filterNullCustomFields as ie } from "../utils/form.utils.js";
1
+ import { ref as S, shallowRef as H, computed as ee, watch as ae } from "vue";
2
+ import { deepClone as V, initializeFormValues as le, cleanSubmitValues as te, getNestedValue as J, evaluateConditional as $, setNestedValue as j, collectFileFields as se, filterNullCustomFields as ie } from "../utils/form.utils.js";
3
3
  import { useFileUpload as oe } from "./useFileUpload.js";
4
4
  import { $t as re } from "../../../utils/i18n.js";
5
5
  function Fe(q) {
6
6
  let { schema: K, values: b, isUpdate: F = !1, folderId: U, onSubmit: L } = q;
7
- const { handleUploadFile: E } = oe(), n = z(b ? V(b) : {}), y = z({}), I = z(!1), g = z(!1), m = z({}), A = H(K), C = H(
7
+ const { handleUploadFile: E } = oe(), n = S(b ? V(b) : {}), y = S({}), I = S(!1), g = S(!1), m = S({}), A = H(K), C = H(
8
8
  b ? V(b) : {}
9
- ), $ = ee(() => {
9
+ ), x = ee(() => {
10
10
  const e = A.value;
11
11
  return e ? Array.isArray(e[0]) ? e.flat() : e : [];
12
12
  }), D = async (e) => {
@@ -32,18 +32,18 @@ function Fe(q) {
32
32
  a ? y.value[e] = a : delete y.value[e];
33
33
  }, O = () => {
34
34
  y.value = {};
35
- }, x = (e) => e.when ? S(e.when, N()) : !0, P = (e) => S(e.disabled, N()), W = (e) => S(e.readonly, N()), T = async (e, a = "") => {
36
- const o = a ? `${a}.${e.name}` : e.name, t = M(o);
35
+ }, z = (e) => e.when ? $(e.when, N()) : !0, P = (e) => $(e.disabled, N()), W = (e) => $(e.readonly, N()), T = async (e, a = "") => {
36
+ const o = a ? `${a}.${e.name}` : e.name, i = M(o);
37
37
  let s = "";
38
- const i = e.labelI18n ? re(e.labelI18n) : typeof e.label == "string" ? e.label : e.name;
39
- if (e.required && (t == null || t === "" || Array.isArray(t) && t.length === 0) && (s = `${i} is required`), !s && e.maxFileSize) {
38
+ const l = e.labelI18n ? re(e.labelI18n) : typeof e.label == "string" ? e.label : e.name;
39
+ if (e.required && (i == null || i === "" || Array.isArray(i) && i.length === 0) && (s = `${l} is required`), !s && e.maxFileSize) {
40
40
  const r = e.maxFileSize * 1024 * 1024;
41
- if (t != null && t !== "") {
42
- const l = Array.isArray(t) ? t : [t];
43
- for (const f of l) {
41
+ if (i != null && i !== "") {
42
+ const t = Array.isArray(i) ? i : [i];
43
+ for (const f of t) {
44
44
  const v = f instanceof File ? f.size : f?.fileSize || f?.file?.size || f?.size;
45
45
  if (v !== void 0 && v > r) {
46
- s = `${i} size must be less than ${e.maxFileSize}MB`;
46
+ s = `${l} size must be less than ${e.maxFileSize}MB`;
47
47
  break;
48
48
  }
49
49
  }
@@ -51,13 +51,13 @@ function Fe(q) {
51
51
  }
52
52
  if (!s && (e.type === "file" || e.type === "fileUploader") && (e.props?.multiple || e.maxFiles)) {
53
53
  const r = e.maxFiles || e.props?.maxFiles;
54
- r && Array.isArray(t) && t.length > r && (s = `Maximum ${r} files allowed`);
54
+ r && Array.isArray(i) && i.length > r && (s = `Maximum ${r} files allowed`);
55
55
  }
56
56
  if (!s && e.validation) {
57
57
  m.value[o] = !0;
58
58
  try {
59
59
  s = await e.validation({
60
- value: t,
60
+ value: i,
61
61
  values: n.value,
62
62
  globalValues: n.value,
63
63
  isUpdate: F
@@ -69,12 +69,12 @@ function Fe(q) {
69
69
  }
70
70
  }
71
71
  if (s ? y.value[o] = s : delete y.value[o], e.type === "customFields" && e.props?.schema) {
72
- const r = e.props.schema, l = Array.isArray(t) ? t : [];
72
+ const r = e.props.schema, t = Array.isArray(i) ? i : [];
73
73
  let f = !1;
74
- for (let v = 0; v < l.length; v++) {
75
- const d = { values: l[v] || {}, globalValues: n.value, isUpdate: F };
74
+ for (let v = 0; v < t.length; v++) {
75
+ const d = { values: t[v] || {}, globalValues: n.value, isUpdate: F };
76
76
  for (const u of r) {
77
- const c = !u.when || S(u.when, d), w = S(u.disabled, d);
77
+ const c = !u.when || $(u.when, d), w = $(u.disabled, d);
78
78
  c && !w ? await T(u, `${o}.${v}`) && (f = !0) : delete y.value[`${o}.${v}.${u.name}`];
79
79
  }
80
80
  }
@@ -84,21 +84,22 @@ function Fe(q) {
84
84
  }, G = async () => {
85
85
  O();
86
86
  let e = !0;
87
- for (const a of $.value) {
88
- if (!x(a) || P(a)) continue;
87
+ for (const a of x.value) {
88
+ if (!z(a) || P(a)) continue;
89
89
  await T(a) && (e = !1);
90
90
  }
91
91
  return e;
92
92
  }, X = async (e, a, o) => {
93
- const t = $.value.find((s) => s.name === e);
94
- if (t && (!x(t) || P(t) || W(t))) {
93
+ const i = x.value.filter((l) => l.name === e);
94
+ let s = i.find((l) => z(l));
95
+ if (!s && i.length > 0 && (s = i[0]), s && (!z(s) || P(s) || W(s))) {
95
96
  console.warn(`[vlite3/useForm] Blocked attempted update to disabled/readonly/hidden field: ${e}`);
96
97
  return;
97
98
  }
98
- if (n.value = j(n.value, e, a), g.value = !0, delete y.value[e], t?.updateValues) {
99
+ if (n.value = j(n.value, e, a), g.value = !0, delete y.value[e], s?.updateValues) {
99
100
  m.value[e] = !0;
100
101
  try {
101
- const s = await t.updateValues({
102
+ const l = await s.updateValues({
102
103
  value: a,
103
104
  // Exposing the explicitly requested value
104
105
  values: n.value,
@@ -107,29 +108,29 @@ function Fe(q) {
107
108
  isUpdate: F,
108
109
  updateError: R
109
110
  });
110
- s && typeof s == "object" && (n.value = { ...n.value, ...s });
111
- } catch (s) {
112
- console.error(`[useForm] Error in updateValues for ${e}:`, s);
111
+ l && typeof l == "object" && (n.value = { ...n.value, ...l });
112
+ } catch (l) {
113
+ console.error(`[useForm] Error in updateValues for ${e}:`, l);
113
114
  } finally {
114
115
  m.value[e] = !1;
115
116
  }
116
117
  }
117
118
  }, Y = async () => {
118
- const e = V(n.value), a = se(A.value, e, n.value, F), o = (i, r) => {
119
- let l = null;
120
- i instanceof File ? l = i : i && typeof i == "object" && i.file instanceof File && (l = i.file);
119
+ const e = V(n.value), a = se(A.value, e, n.value, F), o = (l, r) => {
120
+ let t = null;
121
+ l instanceof File ? t = l : l && typeof l == "object" && l.file instanceof File && (t = l.file);
121
122
  const f = {
122
- ...typeof i == "object" ? i : {},
123
- fileName: i?.fileName || l?.name || r.split("/").pop() || "unknown",
123
+ ...typeof l == "object" ? l : {},
124
+ fileName: l?.fileName || t?.name || r.split("/").pop() || "unknown",
124
125
  fileUrl: r,
125
- fileType: i?.fileType || l?.type || "application/octet-stream",
126
- fileSize: i?.fileSize || l?.size || 0
126
+ fileType: l?.fileType || t?.type || "application/octet-stream",
127
+ fileSize: l?.fileSize || t?.size || 0
127
128
  };
128
129
  return delete f.file, delete f.base64, f;
129
- }, t = a.map(async (i) => {
130
- const { name: r, value: l, field: f } = i;
131
- if (i.type === "thumbnailSelector") {
132
- const d = l, u = Array.isArray(d.images) ? d.images : [], c = d.thumbnail;
130
+ }, i = a.map(async (l) => {
131
+ const { name: r, value: t, field: f } = l;
132
+ if (l.type === "thumbnailSelector") {
133
+ const d = t, u = Array.isArray(d.images) ? d.images : [], c = d.thumbnail;
133
134
  m.value[r] = !0;
134
135
  try {
135
136
  const w = await Promise.all(
@@ -151,13 +152,13 @@ function Fe(q) {
151
152
  m.value[r] = !1;
152
153
  }
153
154
  }
154
- const v = f.returnFileObject === !0, k = Array.isArray(l) ? l.some(
155
+ const v = f.returnFileObject === !0, k = Array.isArray(t) ? t.some(
155
156
  (d) => d instanceof File || d && typeof d == "object" && d.file instanceof File
156
- ) : l instanceof File || l && typeof l == "object" && l.file instanceof File;
157
+ ) : t instanceof File || t && typeof t == "object" && t.file instanceof File;
157
158
  k && (m.value[r] = !0);
158
159
  try {
159
- if (Array.isArray(l)) {
160
- const d = l.map(async (c) => {
160
+ if (Array.isArray(t)) {
161
+ const d = t.map(async (c) => {
161
162
  if (c instanceof File || c && typeof c == "object" && c.file instanceof File) {
162
163
  const p = await E(c, U);
163
164
  return p ? v ? o(c, p) : p : null;
@@ -170,12 +171,12 @@ function Fe(q) {
170
171
  }), u = await Promise.all(d);
171
172
  return { name: r, value: u };
172
173
  } else {
173
- if (l instanceof File || l && typeof l == "object" && l.file instanceof File) {
174
- const u = await E(l, U);
174
+ if (t instanceof File || t && typeof t == "object" && t.file instanceof File) {
175
+ const u = await E(t, U);
175
176
  if (u)
176
- return { name: r, value: v ? o(l, u) : u };
177
- } else if (l && typeof l == "object") {
178
- const u = { ...l };
177
+ return { name: r, value: v ? o(t, u) : u };
178
+ } else if (t && typeof t == "object") {
179
+ const u = { ...t };
179
180
  return delete u.file, delete u.base64, { name: r, value: u };
180
181
  }
181
182
  return null;
@@ -184,16 +185,16 @@ function Fe(q) {
184
185
  k && (m.value[r] = !1);
185
186
  }
186
187
  });
187
- return (await Promise.all(t)).forEach((i) => {
188
- i && (Object.assign(e, j(e, i.name, i.value)), n.value = j(n.value, i.name, i.value));
188
+ return (await Promise.all(i)).forEach((l) => {
189
+ l && (Object.assign(e, j(e, l.name, l.value)), n.value = j(n.value, l.name, l.value));
189
190
  }), e;
190
191
  }, Z = (e) => {
191
192
  const a = { ...e };
192
- for (const o of $.value)
193
- if (x(o) && o.type === "customFields" && o.props?.schema) {
194
- const t = J(a, o.name);
195
- if (Array.isArray(t)) {
196
- const s = ie(t, o.props.schema);
193
+ for (const o of x.value)
194
+ if (z(o) && o.type === "customFields" && o.props?.schema) {
195
+ const i = J(a, o.name);
196
+ if (Array.isArray(i)) {
197
+ const s = ie(i, o.props.schema);
197
198
  Object.assign(a, j(a, o.name, s));
198
199
  }
199
200
  }
@@ -208,7 +209,7 @@ function Fe(q) {
208
209
  handleFieldChange: X,
209
210
  validateField: T,
210
211
  validateAll: G,
211
- isFieldVisible: x,
212
+ isFieldVisible: z,
212
213
  isFieldDisabled: P,
213
214
  isFieldReadonly: W,
214
215
  getFieldValue: M,
@@ -241,7 +242,7 @@ function Fe(q) {
241
242
  }
242
243
  }
243
244
  },
244
- flatSchema: $,
245
+ flatSchema: x,
245
246
  reinitialize: async (e, a) => {
246
247
  e !== void 0 && (A.value = e), a !== void 0 && (b = a), await D(a !== void 0 ? a : b);
247
248
  }
@@ -68,6 +68,14 @@ export type IFormUpdateValues = (context: IFormUpdateContext) => Record<string,
68
68
  * When condition - controls field visibility
69
69
  */
70
70
  export type IFormWhen = (context: IFormContext) => boolean;
71
+ /**
72
+ * Group headings/description for grouped schemas.
73
+ * Accepts either a static `string[]` aligned to the schema groups,
74
+ * or a function that derives the strings from the current form context.
75
+ * The function form lets you react to form values (e.g. localize, pluralize,
76
+ * swap "Edit" vs "Create" labels based on `isUpdate`).
77
+ */
78
+ export type IFormGroupsHeadings = string[] | ((context: IFormContext) => string[] | undefined | null);
71
79
  /**
72
80
  * CustomFields schema props
73
81
  */
@@ -178,10 +186,10 @@ export interface IFormProps {
178
186
  footer?: boolean;
179
187
  /** Grid columns (number or tailwind class) */
180
188
  columns?: number | string;
181
- /** Headings for grouped schemas */
182
- groupsHeadings?: string[];
183
- /** Descriptions for grouped schemas */
184
- groupHeadingsDescription?: string[];
189
+ /** Headings for grouped schemas — static array or `(ctx) => string[]` */
190
+ groupsHeadings?: IFormGroupsHeadings;
191
+ /** Descriptions for grouped schemas — static array or `(ctx) => string[]` */
192
+ groupHeadingsDescription?: IFormGroupsHeadings;
185
193
  /** Timeline steps for multi-step form mode */
186
194
  tabs?: IFormStep[];
187
195
  /** Submit button text */
@@ -1,16 +1,16 @@
1
- import { defineComponent as ne, computed as h, ref as b, shallowRef as $, openBlock as n, createBlock as d, withCtx as w, createElementVNode as B, createTextVNode as U, toDisplayString as _, createElementBlock as N, createCommentVNode as T, createVNode as ue, unref as pe, Fragment as ce, renderList as de, renderSlot as ve } from "vue";
1
+ import { defineComponent as ne, computed as h, ref as y, shallowRef as $, openBlock as n, createBlock as d, withCtx as b, createElementVNode as B, createTextVNode as U, toDisplayString as _, createElementBlock as N, createCommentVNode as T, createVNode as ue, unref as pe, Fragment as ce, renderList as de, renderSlot as ve } from "vue";
2
2
  import me from "../Modal.vue.js";
3
3
  import I from "../Button.vue.js";
4
4
  import fe from "../Timeline/Timeline.vue.js";
5
5
  import "@iconify/vue";
6
- import { $t as j } from "../../utils/i18n.js";
6
+ import { $t as E } from "../../utils/i18n.js";
7
7
  import "../../core/config.js";
8
8
  import he from "./ImportStep1.vue.js";
9
9
  import ge from "./ImportStep2.vue.js";
10
- import be from "./ImportStep3.vue.js";
11
- import we from "./ImportStep4.vue.js";
12
- import { showToast as E } from "../../composables/useNotifications.js";
13
- const xe = { class: "px-2" }, ye = { class: "min-h-[300px]" }, De = {
10
+ import ye from "./ImportStep3.vue.js";
11
+ import be from "./ImportStep4.vue.js";
12
+ import { showToast as j } from "../../composables/useNotifications.js";
13
+ const we = { class: "px-2" }, xe = { class: "min-h-[300px]" }, De = {
14
14
  key: 0,
15
15
  class: "mt-4 p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-sm text-destructive"
16
16
  }, ke = { class: "list-disc pl-5 space-y-1" }, _e = { class: "flex items-center justify-between w-full" }, Ie = { key: 1 }, ze = /* @__PURE__ */ ne({
@@ -27,23 +27,23 @@ const xe = { class: "px-2" }, ye = { class: "min-h-[300px]" }, De = {
27
27
  show: { type: Boolean, default: !1 }
28
28
  },
29
29
  emits: ["update:show"],
30
- setup(x, { emit: L }) {
31
- const s = x, R = L, P = h({
32
- get: () => s.show,
33
- set: (e) => R("update:show", e)
34
- }), c = (e, o, u) => {
35
- const i = u ? j(e, u) : j(e);
36
- return i !== e ? i : o;
37
- }, A = h(() => {
38
- if (s.titleI18n) {
39
- const e = j(s.titleI18n);
40
- if (e !== s.titleI18n) return e;
30
+ setup(w, { emit: K }) {
31
+ const i = w, L = K, A = h({
32
+ get: () => i.show,
33
+ set: (e) => L("update:show", e)
34
+ }), c = (e, r, u) => {
35
+ const a = u ? E(e, u) : E(e);
36
+ return a !== e ? a : r;
37
+ }, R = h(() => {
38
+ if (i.titleI18n) {
39
+ const e = E(i.titleI18n);
40
+ if (e !== i.titleI18n) return e;
41
41
  }
42
- return s.title;
43
- }), a = b(1), v = b(!1), M = $([]), m = b({}), q = b({
42
+ return i.title;
43
+ }), l = y(1), m = y(!1), C = $([]), v = y({}), q = y({
44
44
  existing: "replace",
45
45
  new: "create"
46
- }), C = b(""), O = $(null), S = $([]), F = $([]), y = b([]), V = {
46
+ }), M = y(""), O = $(null), S = $([]), F = $([]), x = y([]), V = {
47
47
  total: 0,
48
48
  processed: 0,
49
49
  created: 0,
@@ -52,197 +52,200 @@ const xe = { class: "px-2" }, ye = { class: "min-h-[300px]" }, De = {
52
52
  failed: 0,
53
53
  percentage: 0,
54
54
  errors: []
55
- }, l = b({ ...V }), H = () => {
56
- a.value = 1, v.value = !1, M.value = [], m.value = {}, q.value = { existing: "replace", new: "create" }, C.value = "", O.value = null, S.value = [], F.value = [], y.value = [], l.value = { ...V };
55
+ }, o = y({ ...V }), H = () => {
56
+ l.value = 1, m.value = !1, C.value = [], v.value = {}, q.value = { existing: "replace", new: "create" }, M.value = "", O.value = null, S.value = [], F.value = [], x.value = [], o.value = { ...V };
57
57
  }, G = () => {
58
- const e = [], o = {};
59
- for (const t in m.value) {
60
- const p = m.value[t];
61
- p && (o[p] || (o[p] = []), o[p].push(t));
58
+ const e = [], r = {};
59
+ for (const t in v.value) {
60
+ const p = v.value[t];
61
+ p && (r[p] || (r[p] = []), r[p].push(t));
62
62
  }
63
- for (const t in o)
64
- o[t].length > 1 && e.push(
65
- `Field "${t}" is mapped to multiple headers: ${o[t].join(", ")}`
63
+ for (const t in r)
64
+ r[t].length > 1 && e.push(
65
+ `Field "${t}" is mapped to multiple headers: ${r[t].join(", ")}`
66
66
  );
67
- const u = s.fields.filter((t) => t.required).map((t) => t.field), i = Object.values(m.value);
67
+ const u = i.fields.filter((t) => t.required).map((t) => t.field), a = Object.values(v.value);
68
68
  for (const t of u)
69
- if (!i.includes(t)) {
70
- const p = s.fields.find((r) => r.field === t)?.title || t;
69
+ if (!a.includes(t)) {
70
+ const p = i.fields.find((s) => s.field === t)?.title || t;
71
71
  e.push(`Required field "${p}" is not mapped.`);
72
72
  }
73
73
  return e;
74
74
  }, z = () => {
75
- a.value === 2 && (y.value = G(), y.value.length > 0) || a.value < 4 && a.value++;
75
+ l.value === 2 && (x.value = G(), x.value.length > 0) || l.value < 4 && l.value++;
76
76
  }, J = () => {
77
- a.value > 1 && !v.value && a.value--;
78
- }, Q = (e, o) => e.map((u) => {
79
- const i = {};
80
- for (const t in o) {
81
- const p = o[t];
77
+ l.value > 1 && !m.value && l.value--;
78
+ }, Q = (e, r) => e.map((u) => {
79
+ const a = {};
80
+ for (const t in r) {
81
+ const p = r[t];
82
82
  if (!p) continue;
83
- let r = u[t];
84
- const g = s.fields.find((f) => f.field === p);
85
- if ((r == null || r === "") && g?.defaultValue !== void 0 && (r = g.defaultValue), g?.expectedType && (g.expectedType === "number" && (r = Number(r) || 0), g.expectedType === "boolean" && (r = !!(r && r.toString().toLowerCase() !== "false" && r !== "0"))), g?.onMatch && (r = g.onMatch(r)), p.includes(".")) {
83
+ let s = u[t];
84
+ const g = i.fields.find((f) => f.field === p);
85
+ if ((s == null || s === "") && g?.defaultValue !== void 0 && (s = g.defaultValue), g?.expectedType && (g.expectedType === "number" && (s = Number(s) || 0), g.expectedType === "boolean" && (s = !!(s && s.toString().toLowerCase() !== "false" && s !== "0"))), g?.onMatch && (s = g.onMatch(s)), p.includes(".")) {
86
86
  const f = p.split(".");
87
- let D = i;
87
+ let D = a;
88
88
  for (let k = 0; k < f.length - 1; k++)
89
89
  D[f[k]] || (D[f[k]] = {}), D = D[f[k]];
90
- D[f[f.length - 1]] = r;
90
+ D[f[f.length - 1]] = s;
91
91
  } else
92
- i[p] = r;
92
+ a[p] = s;
93
93
  }
94
- return i;
94
+ return a;
95
95
  }), W = async () => {
96
- v.value = !0, z();
96
+ m.value = !0, z();
97
97
  try {
98
- const e = Q(M.value, m.value);
99
- l.value = { ...V, total: e.length };
100
- const o = [];
101
- for (let i = 0; i < e.length; i += s.batchSize)
102
- o.push(e.slice(i, i + s.batchSize));
98
+ const e = Q(C.value, v.value);
99
+ o.value = { ...V, total: e.length };
100
+ const r = [];
101
+ for (let a = 0; a < e.length; a += i.batchSize)
102
+ r.push(e.slice(a, a + i.batchSize));
103
103
  const u = setInterval(() => {
104
- l.value.percentage < 90 && (l.value.percentage += Math.floor(Math.random() * 5) + 1);
104
+ o.value.percentage < 90 && (o.value.percentage += Math.floor(Math.random() * 5) + 1);
105
105
  }, 1e3);
106
- for (const i of o) {
107
- const t = await s.processBatch({
108
- data: i,
109
- options: q.value
106
+ for (const a of r) {
107
+ const t = await i.processBatch({
108
+ data: a,
109
+ options: q.value,
110
+ mappings: v.value
110
111
  });
111
- l.value.processed += t.processed, l.value.created += t.created, l.value.updated += t.updated, l.value.skipped += t.skipped, l.value.failed += t.failed, l.value.errors = [...l.value.errors, ...t.errors || []], l.value.percentage = Math.min(
112
+ o.value.processed += t.processed, o.value.created += t.created, o.value.updated += t.updated, o.value.skipped += t.skipped, o.value.failed += t.failed, o.value.errors = [...o.value.errors, ...t.errors || []], o.value.percentage = Math.min(
112
113
  99,
113
- Math.floor(l.value.processed / l.value.total * 100)
114
+ Math.floor(o.value.processed / o.value.total * 100)
114
115
  );
115
116
  }
116
- clearInterval(u), l.value.percentage = 100, l.value.failed === 0 ? E(c("vlite.importData.success", "Data imported successfully."), "success") : E(c("vlite.importData.partial", "Import completed with some errors."), "warning"), s.onComplete && s.onComplete();
117
+ clearInterval(u), o.value.percentage = 100, o.value.failed === 0 ? j(c("vlite.importData.success", "Data imported successfully."), "success") : j(c("vlite.importData.partial", "Import completed with some errors."), "warning"), i?.onComplete && (typeof i.onComplete == "function" ? i.onComplete() : Array.isArray(i.onComplete) && i.onComplete.forEach((a) => {
118
+ typeof a == "function" && a();
119
+ }));
117
120
  } catch (e) {
118
- console.error(e), E(c("vlite.importData.error", "A critical error occurred during import."), "error");
121
+ console.error(e), j(c("vlite.importData.error", "A critical error occurred during import."), "error");
119
122
  } finally {
120
- v.value = !1;
123
+ m.value = !1;
121
124
  }
122
- }, X = h(() => s.fields.map((e) => ({ value: e.field, label: e.title, required: e.required }))), Y = h(() => [
125
+ }, X = h(() => i.fields.map((e) => ({ value: e.field, label: e.title, required: e.required }))), Y = h(() => [
123
126
  { id: 1, title: c("vlite.importData.stepUpload", "Upload"), icon: "lucide:upload" },
124
127
  { id: 2, title: c("vlite.importData.stepMapping", "Mapping"), icon: "lucide:git-pull-request" },
125
128
  { id: 3, title: c("vlite.importData.stepOptions", "Options"), icon: "lucide:settings-2" },
126
129
  { id: 4, title: c("vlite.importData.stepImport", "Import"), icon: "lucide:loader" }
127
130
  ]), Z = h(() => c("vlite.importData.btnBack", "Back")), ee = h(() => c("vlite.importData.btnNext", "Next")), te = h(() => c("vlite.importData.btnStart", "Start Import")), ae = h(() => c("vlite.importData.btnDone", "Done")), le = (e) => {
128
- C.value = e;
129
- }, ie = (e) => {
130
- O.value = e;
131
- }, K = (e) => {
132
- m.value = e;
131
+ M.value = e;
133
132
  }, oe = (e) => {
133
+ O.value = e;
134
+ }, P = (e) => {
135
+ v.value = e;
136
+ }, ie = (e) => {
134
137
  S.value = e;
135
138
  }, re = (e) => {
136
139
  F.value = e;
137
140
  }, se = (e) => {
138
- M.value = e;
141
+ C.value = e;
139
142
  };
140
- return (e, o) => (n(), d(me, {
141
- show: P.value,
142
- "onUpdate:show": o[0] || (o[0] = (u) => P.value = u),
143
- title: A.value,
143
+ return (e, r) => (n(), d(me, {
144
+ show: A.value,
145
+ "onUpdate:show": r[0] || (r[0] = (u) => A.value = u),
146
+ title: R.value,
144
147
  "max-width": "sm:max-w-4xl",
145
148
  onClose: H,
146
- "close-outside": !v.value
149
+ "close-outside": !m.value
147
150
  }, {
148
- trigger: w(() => [
151
+ trigger: b(() => [
149
152
  ve(e.$slots, "trigger", {}, () => [
150
- x.show ? T("", !0) : (n(), d(I, {
153
+ w.show ? T("", !0) : (n(), d(I, {
151
154
  key: 0,
152
- text: x.buttonText,
153
- icon: x.buttonIcon,
155
+ text: w.buttonText,
156
+ icon: w.buttonIcon,
154
157
  variant: "outline"
155
158
  }, null, 8, ["text", "icon"]))
156
159
  ])
157
160
  ]),
158
- default: w(({ close: u }) => [
159
- B("div", xe, [
161
+ default: b(({ close: u }) => [
162
+ B("div", we, [
160
163
  ue(pe(fe), {
161
164
  steps: Y.value,
162
- "active-step": a.value - 1,
165
+ "active-step": l.value - 1,
163
166
  class: "mb-8"
164
167
  }, null, 8, ["steps", "active-step"]),
165
- B("div", ye, [
166
- a.value === 1 ? (n(), d(he, {
168
+ B("div", xe, [
169
+ l.value === 1 ? (n(), d(he, {
167
170
  key: 0,
168
- importMethod: C.value,
171
+ importMethod: M.value,
169
172
  csvFile: O.value,
170
- mappings: m.value,
171
- fields: x.fields,
173
+ mappings: v.value,
174
+ fields: w.fields,
172
175
  headers: S.value,
173
176
  preview: F.value,
174
- importData: M.value,
177
+ importData: C.value,
175
178
  "onUpdate:importMethod": le,
176
- "onUpdate:csvFile": ie,
177
- "onUpdate:mappings": K,
178
- "onUpdate:headers": oe,
179
+ "onUpdate:csvFile": oe,
180
+ "onUpdate:mappings": P,
181
+ "onUpdate:headers": ie,
179
182
  "onUpdate:preview": re,
180
183
  "onUpdate:importData": se,
181
184
  onNext: z
182
- }, null, 8, ["importMethod", "csvFile", "mappings", "fields", "headers", "preview", "importData"])) : a.value === 2 ? (n(), d(ge, {
185
+ }, null, 8, ["importMethod", "csvFile", "mappings", "fields", "headers", "preview", "importData"])) : l.value === 2 ? (n(), d(ge, {
183
186
  key: 1,
184
- mappings: m.value,
187
+ mappings: v.value,
185
188
  headers: S.value,
186
189
  preview: F.value,
187
190
  availableFields: X.value,
188
- "onUpdate:mappings": K
189
- }, null, 8, ["mappings", "headers", "preview", "availableFields"])) : a.value === 3 ? (n(), d(be, {
191
+ "onUpdate:mappings": P
192
+ }, null, 8, ["mappings", "headers", "preview", "availableFields"])) : l.value === 3 ? (n(), d(ye, {
190
193
  key: 2,
191
194
  importOptions: q.value
192
- }, null, 8, ["importOptions"])) : a.value === 4 ? (n(), d(we, {
195
+ }, null, 8, ["importOptions"])) : l.value === 4 ? (n(), d(be, {
193
196
  key: 3,
194
- progress: l.value
197
+ progress: o.value
195
198
  }, null, 8, ["progress"])) : T("", !0)
196
199
  ]),
197
- y.value.length > 0 && a.value === 2 ? (n(), N("div", De, [
200
+ x.value.length > 0 && l.value === 2 ? (n(), N("div", De, [
198
201
  B("ul", ke, [
199
- (n(!0), N(ce, null, de(y.value, (i) => (n(), N("li", { key: i }, _(i), 1))), 128))
202
+ (n(!0), N(ce, null, de(x.value, (a) => (n(), N("li", { key: a }, _(a), 1))), 128))
200
203
  ])
201
204
  ])) : T("", !0)
202
205
  ])
203
206
  ]),
204
- footer: w(({ close: u }) => [
207
+ footer: b(({ close: u }) => [
205
208
  B("div", _e, [
206
- a.value > 1 && a.value < 4 ? (n(), d(I, {
209
+ l.value > 1 && l.value < 4 ? (n(), d(I, {
207
210
  key: 0,
208
211
  variant: "outline",
209
212
  onClick: J,
210
- disabled: v.value,
213
+ disabled: m.value,
211
214
  icon: "lucide:arrow-left"
212
215
  }, {
213
- default: w(() => [
216
+ default: b(() => [
214
217
  U(_(Z.value), 1)
215
218
  ]),
216
219
  _: 1
217
220
  }, 8, ["disabled"])) : (n(), N("div", Ie)),
218
- a.value < 3 ? (n(), d(I, {
221
+ l.value < 3 ? (n(), d(I, {
219
222
  key: 2,
220
223
  variant: "primary",
221
224
  onClick: z,
222
- disabled: a.value === 1 && !C.value || v.value,
225
+ disabled: l.value === 1 && !M.value || m.value,
223
226
  "icon-right": "lucide:arrow-right"
224
227
  }, {
225
- default: w(() => [
228
+ default: b(() => [
226
229
  U(_(ee.value), 1)
227
230
  ]),
228
231
  _: 1
229
- }, 8, ["disabled"])) : a.value === 3 ? (n(), d(I, {
232
+ }, 8, ["disabled"])) : l.value === 3 ? (n(), d(I, {
230
233
  key: 3,
231
234
  variant: "primary",
232
235
  icon: "lucide:play",
233
236
  onClick: W,
234
- loading: v.value
237
+ loading: m.value
235
238
  }, {
236
- default: w(() => [
239
+ default: b(() => [
237
240
  U(_(te.value), 1)
238
241
  ]),
239
242
  _: 1
240
- }, 8, ["loading"])) : a.value === 4 && l.value.percentage >= 100 ? (n(), d(I, {
243
+ }, 8, ["loading"])) : l.value === 4 && o.value.percentage >= 100 ? (n(), d(I, {
241
244
  key: 4,
242
245
  variant: "primary",
243
246
  onClick: u
244
247
  }, {
245
- default: w(() => [
248
+ default: b(() => [
246
249
  U(_(ae.value), 1)
247
250
  ]),
248
251
  _: 1