vlite3 0.7.15 → 0.8.2

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 (57) hide show
  1. package/components/Accordion/Accordion.vue.js +35 -22
  2. package/components/Accordion/AccordionContent.vue.js +2 -2
  3. package/components/Accordion/AccordionContent.vue2.js +1 -1
  4. package/components/Breadcrumb/Breadcrumb.vue.js +2 -2
  5. package/components/Breadcrumb/Breadcrumb.vue2.js +44 -44
  6. package/components/Carousel/Carousel.vue.js +1 -1
  7. package/components/Carousel/Carousel.vue2.js +3 -3
  8. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  9. package/components/ColorPicker/ColorPicker.vue.js +2 -2
  10. package/components/CommandPalette/CommandPaletteContent.vue.js +1 -1
  11. package/components/CommandPalette/CommandPaletteContent.vue2.js +2 -2
  12. package/components/Dropdown/DropdownTrigger.vue.js +1 -1
  13. package/components/FilePicker/FilePicker.vue.js +16 -16
  14. package/components/FileTree/FileTree.vue.js +5 -147
  15. package/components/FileTree/FileTree.vue2.js +164 -2
  16. package/components/FileTree/FileTreeNode.vue.js +89 -84
  17. package/components/Form/CustomFields.vue.js +2 -2
  18. package/components/Form/CustomFields.vue2.js +1 -1
  19. package/components/Form/Form.vue.js +1 -1
  20. package/components/Form/Form.vue2.js +133 -129
  21. package/components/Form/FormField.vue.d.ts +3 -0
  22. package/components/Form/FormField.vue.js +85 -82
  23. package/components/Form/FormFields.vue.d.ts +2 -0
  24. package/components/Form/FormFields.vue.js +2 -2
  25. package/components/Form/FormFields.vue2.js +55 -52
  26. package/components/Form/composables/useForm.d.ts +2 -0
  27. package/components/Form/composables/useForm.js +113 -107
  28. package/components/ImportData/ImportData.vue.js +157 -142
  29. package/components/ImportData/ImportStep1.vue.d.ts +6 -0
  30. package/components/ImportData/ImportStep1.vue.js +69 -61
  31. package/components/ImportData/ImportStep2.vue.js +5 -98
  32. package/components/ImportData/ImportStep2.vue2.js +105 -2
  33. package/components/Kanban/Kanban.vue.js +1 -1
  34. package/components/Kanban/Kanban.vue2.js +1 -1
  35. package/components/Kanban/KanbanBoard.vue.js +1 -1
  36. package/components/Kanban/KanbanBoard.vue2.js +92 -83
  37. package/components/Kanban/useKanbanBoard.d.ts +1 -1
  38. package/components/Kanban/useKanbanBoard.js +17 -17
  39. package/components/List/ListFieldRow.vue.js +4 -6
  40. package/components/MultiSelect/MultiSelect.vue.js +10 -4
  41. package/components/NavbarCommandPalette.vue.js +2 -2
  42. package/components/NumberInput.vue.js +2 -2
  43. package/components/NumberInput.vue2.js +1 -1
  44. package/components/PermissionMatrix/PermissionEditor.vue.d.ts +2 -0
  45. package/components/PermissionMatrix/PermissionEditor.vue.js +25 -23
  46. package/components/PermissionMatrix/PermissionEditorMatrix.vue.d.ts +4 -1
  47. package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +2 -2
  48. package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +48 -45
  49. package/components/Screen/ScreenFilter.vue.js +1 -1
  50. package/components/Timeline/Timeline.vue.js +62 -57
  51. package/components/ToastNotification.vue.js +2 -2
  52. package/components/ToastNotification.vue2.js +103 -88
  53. package/components/Workbook/Workbook.vue.js +5 -152
  54. package/components/Workbook/Workbook.vue2.js +166 -2
  55. package/package.json +1 -1
  56. package/style.css +3 -3
  57. /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
@@ -1,18 +1,18 @@
1
- import { defineComponent as te, computed as h, ref as c, openBlock as n, createBlock as v, withCtx as x, createElementVNode as S, createTextVNode as C, toDisplayString as I, createElementBlock as F, createCommentVNode as $, createVNode as ae, unref as le, Fragment as ie, renderList as oe, renderSlot as re } from "vue";
2
- import se from "../Modal.vue.js";
3
- import _ from "../Button.vue.js";
4
- import ne from "../Timeline/Timeline.vue.js";
1
+ import { defineComponent as ne, computed as h, ref as b, shallowRef as B, openBlock as n, createBlock as d, withCtx as w, createElementVNode as U, createTextVNode as $, 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
+ import me from "../Modal.vue.js";
3
+ import I from "../Button.vue.js";
4
+ import fe from "../Timeline/Timeline.vue.js";
5
5
  import "@iconify/vue";
6
- import { $t as z } from "../../utils/i18n.js";
7
- import ue from "./ImportStep1.vue.js";
8
- import pe from "./ImportStep2.vue.js";
9
- import de from "./ImportStep3.vue.js";
10
- import ce from "./ImportStep4.vue.js";
11
- import { showToast as j } from "../../composables/useNotifications.js";
12
- const ve = { class: "px-2 sm:px-4 py-2" }, me = { class: "min-h-[300px]" }, fe = {
6
+ import { $t as j } from "../../utils/i18n.js";
7
+ import he from "./ImportStep1.vue.js";
8
+ import ge from "./ImportStep2.vue.js";
9
+ import be from "./ImportStep3.vue.js";
10
+ import we from "./ImportStep4.vue.js";
11
+ import { showToast as E } from "../../composables/useNotifications.js";
12
+ const xe = { class: "px-2 sm:px-4 py-2" }, ye = { class: "min-h-[300px]" }, De = {
13
13
  key: 0,
14
14
  class: "mt-4 p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-sm text-destructive"
15
- }, ge = { class: "list-disc pl-5 space-y-1" }, he = { class: "flex items-center justify-between w-full" }, be = { key: 1 }, $e = /* @__PURE__ */ te({
15
+ }, ke = { class: "list-disc pl-5 space-y-1" }, _e = { class: "flex items-center justify-between w-full" }, Ie = { key: 1 }, Ve = /* @__PURE__ */ ne({
16
16
  __name: "ImportData",
17
17
  props: {
18
18
  title: { default: "Import Data" },
@@ -26,23 +26,23 @@ const ve = { class: "px-2 sm:px-4 py-2" }, me = { class: "min-h-[300px]" }, fe =
26
26
  show: { type: Boolean, default: !1 }
27
27
  },
28
28
  emits: ["update:show"],
29
- setup(y, { emit: K }) {
30
- const s = y, L = K, E = h({
29
+ setup(x, { emit: L }) {
30
+ const s = x, R = L, P = h({
31
31
  get: () => s.show,
32
- set: (e) => L("update:show", e)
33
- }), d = (e, a, u) => {
34
- const t = u ? z(e, u) : z(e);
35
- return t !== e ? t : a;
36
- }, P = h(() => {
32
+ set: (e) => R("update:show", e)
33
+ }), c = (e, i, u) => {
34
+ const o = u ? j(e, u) : j(e);
35
+ return o !== e ? o : i;
36
+ }, A = h(() => {
37
37
  if (s.titleI18n) {
38
- const e = z(s.titleI18n);
38
+ const e = j(s.titleI18n);
39
39
  if (e !== s.titleI18n) return e;
40
40
  }
41
41
  return s.title;
42
- }), i = c(1), f = c(!1), B = c([]), m = c({}), N = c({
42
+ }), a = b(1), v = b(!1), M = B([]), m = b({}), q = b({
43
43
  existing: "replace",
44
44
  new: "create"
45
- }), M = c(""), T = c(null), q = c([]), O = c([]), w = c([]), U = {
45
+ }), S = b(""), O = B(null), C = B([]), F = B([]), y = b([]), V = {
46
46
  total: 0,
47
47
  processed: 0,
48
48
  created: 0,
@@ -51,186 +51,201 @@ const ve = { class: "px-2 sm:px-4 py-2" }, me = { class: "min-h-[300px]" }, fe =
51
51
  failed: 0,
52
52
  percentage: 0,
53
53
  errors: []
54
- }, o = c({ ...U }), A = () => {
55
- i.value = 1, f.value = !1, B.value = [], m.value = {}, N.value = { existing: "replace", new: "create" }, M.value = "", T.value = null, q.value = [], O.value = [], w.value = [], o.value = { ...U };
56
- }, R = () => {
57
- const e = [], a = {};
58
- for (const l in m.value) {
59
- const p = m.value[l];
60
- p && (a[p] || (a[p] = []), a[p].push(l));
54
+ }, l = b({ ...V }), H = () => {
55
+ a.value = 1, v.value = !1, M.value = [], m.value = {}, q.value = { existing: "replace", new: "create" }, S.value = "", O.value = null, C.value = [], F.value = [], y.value = [], l.value = { ...V };
56
+ }, G = () => {
57
+ const e = [], i = {};
58
+ for (const t in m.value) {
59
+ const p = m.value[t];
60
+ p && (i[p] || (i[p] = []), i[p].push(t));
61
61
  }
62
- for (const l in a)
63
- a[l].length > 1 && e.push(
64
- `Field "${l}" is mapped to multiple headers: ${a[l].join(", ")}`
62
+ for (const t in i)
63
+ i[t].length > 1 && e.push(
64
+ `Field "${t}" is mapped to multiple headers: ${i[t].join(", ")}`
65
65
  );
66
- const u = s.fields.filter((l) => l.required).map((l) => l.field), t = Object.values(m.value);
67
- for (const l of u)
68
- if (!t.includes(l)) {
69
- const p = s.fields.find((r) => r.field === l)?.title || l;
66
+ const u = s.fields.filter((t) => t.required).map((t) => t.field), o = Object.values(m.value);
67
+ for (const t of u)
68
+ if (!o.includes(t)) {
69
+ const p = s.fields.find((r) => r.field === t)?.title || t;
70
70
  e.push(`Required field "${p}" is not mapped.`);
71
71
  }
72
72
  return e;
73
- }, V = () => {
74
- i.value === 2 && (w.value = R(), w.value.length > 0) || i.value < 4 && i.value++;
75
- }, G = () => {
76
- i.value > 1 && !f.value && i.value--;
77
- }, H = (e, a) => e.map((u) => {
78
- const t = {};
79
- for (const l in a) {
80
- const p = a[l];
73
+ }, z = () => {
74
+ a.value === 2 && (y.value = G(), y.value.length > 0) || a.value < 4 && a.value++;
75
+ }, J = () => {
76
+ a.value > 1 && !v.value && a.value--;
77
+ }, Q = (e, i) => e.map((u) => {
78
+ const o = {};
79
+ for (const t in i) {
80
+ const p = i[t];
81
81
  if (!p) continue;
82
- let r = u[l];
83
- const b = s.fields.find((g) => g.field === p);
84
- if ((r == null || r === "") && b?.defaultValue !== void 0 && (r = b.defaultValue), b?.expectedType && (b.expectedType === "number" && (r = Number(r) || 0), b.expectedType === "boolean" && (r = !!(r && r.toString().toLowerCase() !== "false" && r !== "0"))), b?.onMatch && (r = b.onMatch(r)), p.includes(".")) {
85
- const g = p.split(".");
86
- let k = t;
87
- for (let D = 0; D < g.length - 1; D++)
88
- k[g[D]] || (k[g[D]] = {}), k = k[g[D]];
89
- k[g[g.length - 1]] = r;
82
+ let r = u[t];
83
+ const g = s.fields.find((f) => f.field === p);
84
+ 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(".")) {
85
+ const f = p.split(".");
86
+ let D = o;
87
+ for (let k = 0; k < f.length - 1; k++)
88
+ D[f[k]] || (D[f[k]] = {}), D = D[f[k]];
89
+ D[f[f.length - 1]] = r;
90
90
  } else
91
- t[p] = r;
91
+ o[p] = r;
92
92
  }
93
- return t;
94
- }), J = async () => {
95
- f.value = !0, V();
93
+ return o;
94
+ }), W = async () => {
95
+ v.value = !0, z();
96
96
  try {
97
- const e = H(B.value, m.value);
98
- o.value = { ...U, total: e.length };
99
- const a = [];
100
- for (let t = 0; t < e.length; t += s.batchSize)
101
- a.push(e.slice(t, t + s.batchSize));
97
+ const e = Q(M.value, m.value);
98
+ l.value = { ...V, total: e.length };
99
+ const i = [];
100
+ for (let o = 0; o < e.length; o += s.batchSize)
101
+ i.push(e.slice(o, o + s.batchSize));
102
102
  const u = setInterval(() => {
103
- o.value.percentage < 90 && (o.value.percentage += Math.floor(Math.random() * 5) + 1);
103
+ l.value.percentage < 90 && (l.value.percentage += Math.floor(Math.random() * 5) + 1);
104
104
  }, 1e3);
105
- for (const t of a) {
106
- const l = await s.processBatch({
107
- data: t,
108
- options: N.value
105
+ for (const o of i) {
106
+ const t = await s.processBatch({
107
+ data: o,
108
+ options: q.value
109
109
  });
110
- o.value.processed += l.processed, o.value.created += l.created, o.value.updated += l.updated, o.value.skipped += l.skipped, o.value.failed += l.failed, o.value.errors = [...o.value.errors, ...l.errors || []], o.value.percentage = Math.min(
110
+ 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(
111
111
  99,
112
- Math.floor(o.value.processed / o.value.total * 100)
112
+ Math.floor(l.value.processed / l.value.total * 100)
113
113
  );
114
114
  }
115
- clearInterval(u), o.value.percentage = 100, o.value.failed === 0 ? j(d("vlite.importData.success", "Data imported successfully."), "success") : j(d("vlite.importData.partial", "Import completed with some errors."), "warning"), s.onComplete && s.onComplete();
115
+ 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();
116
116
  } catch (e) {
117
- console.error(e), j(d("vlite.importData.error", "A critical error occurred during import."), "error");
117
+ console.error(e), E(c("vlite.importData.error", "A critical error occurred during import."), "error");
118
118
  } finally {
119
- f.value = !1;
119
+ v.value = !1;
120
120
  }
121
- }, Q = h(() => s.fields.map((e) => ({ value: e.field, label: e.title, required: e.required }))), W = h(() => [
122
- { id: 1, title: d("vlite.importData.stepUpload", "Upload"), icon: "lucide:upload" },
123
- { id: 2, title: d("vlite.importData.stepMapping", "Mapping"), icon: "lucide:git-pull-request" },
124
- { id: 3, title: d("vlite.importData.stepOptions", "Options"), icon: "lucide:settings-2" },
125
- { id: 4, title: d("vlite.importData.stepImport", "Import"), icon: "lucide:loader" }
126
- ]), X = h(() => d("vlite.importData.btnBack", "Back")), Y = h(() => d("vlite.importData.btnNext", "Next")), Z = h(() => d("vlite.importData.btnStart", "Start Import")), ee = h(() => d("vlite.importData.btnDone", "Done"));
127
- return (e, a) => (n(), v(se, {
128
- show: E.value,
129
- "onUpdate:show": a[4] || (a[4] = (u) => E.value = u),
130
- title: P.value,
121
+ }, X = h(() => s.fields.map((e) => ({ value: e.field, label: e.title, required: e.required }))), Y = h(() => [
122
+ { id: 1, title: c("vlite.importData.stepUpload", "Upload"), icon: "lucide:upload" },
123
+ { id: 2, title: c("vlite.importData.stepMapping", "Mapping"), icon: "lucide:git-pull-request" },
124
+ { id: 3, title: c("vlite.importData.stepOptions", "Options"), icon: "lucide:settings-2" },
125
+ { id: 4, title: c("vlite.importData.stepImport", "Import"), icon: "lucide:loader" }
126
+ ]), 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) => {
127
+ S.value = e;
128
+ }, oe = (e) => {
129
+ O.value = e;
130
+ }, K = (e) => {
131
+ m.value = e;
132
+ }, ie = (e) => {
133
+ C.value = e;
134
+ }, re = (e) => {
135
+ F.value = e;
136
+ }, se = (e) => {
137
+ M.value = e;
138
+ };
139
+ return (e, i) => (n(), d(me, {
140
+ show: P.value,
141
+ "onUpdate:show": i[0] || (i[0] = (u) => P.value = u),
142
+ title: A.value,
131
143
  "max-width": "sm:max-w-4xl",
132
- onClose: A,
133
- "close-outside": !f.value
144
+ onClose: H,
145
+ "close-outside": !v.value
134
146
  }, {
135
- trigger: x(() => [
136
- re(e.$slots, "trigger", {}, () => [
137
- y.show ? $("", !0) : (n(), v(_, {
147
+ trigger: w(() => [
148
+ ve(e.$slots, "trigger", {}, () => [
149
+ x.show ? T("", !0) : (n(), d(I, {
138
150
  key: 0,
139
- text: y.buttonText,
140
- icon: y.buttonIcon,
151
+ text: x.buttonText,
152
+ icon: x.buttonIcon,
141
153
  variant: "outline"
142
154
  }, null, 8, ["text", "icon"]))
143
155
  ])
144
156
  ]),
145
- default: x(({ close: u }) => [
146
- S("div", ve, [
147
- ae(le(ne), {
148
- steps: W.value,
149
- "active-step": i.value - 1,
157
+ default: w(({ close: u }) => [
158
+ U("div", xe, [
159
+ ue(pe(fe), {
160
+ steps: Y.value,
161
+ "active-step": a.value - 1,
150
162
  class: "mb-13"
151
163
  }, null, 8, ["steps", "active-step"]),
152
- S("div", me, [
153
- i.value === 1 ? (n(), v(ue, {
164
+ U("div", ye, [
165
+ a.value === 1 ? (n(), d(he, {
154
166
  key: 0,
155
- importMethod: M.value,
156
- "onUpdate:importMethod": a[0] || (a[0] = (t) => M.value = t),
157
- csvFile: T.value,
158
- "onUpdate:csvFile": a[1] || (a[1] = (t) => T.value = t),
167
+ importMethod: S.value,
168
+ csvFile: O.value,
159
169
  mappings: m.value,
160
- "onUpdate:mappings": a[2] || (a[2] = (t) => m.value = t),
161
- fields: y.fields,
162
- headers: q.value,
163
- preview: O.value,
164
- importData: B.value,
165
- onNext: V
166
- }, null, 8, ["importMethod", "csvFile", "mappings", "fields", "headers", "preview", "importData"])) : i.value === 2 ? (n(), v(pe, {
170
+ fields: x.fields,
171
+ headers: C.value,
172
+ preview: F.value,
173
+ importData: M.value,
174
+ "onUpdate:importMethod": le,
175
+ "onUpdate:csvFile": oe,
176
+ "onUpdate:mappings": K,
177
+ "onUpdate:headers": ie,
178
+ "onUpdate:preview": re,
179
+ "onUpdate:importData": se,
180
+ onNext: z
181
+ }, null, 8, ["importMethod", "csvFile", "mappings", "fields", "headers", "preview", "importData"])) : a.value === 2 ? (n(), d(ge, {
167
182
  key: 1,
168
183
  mappings: m.value,
169
- "onUpdate:mappings": a[3] || (a[3] = (t) => m.value = t),
170
- headers: q.value,
171
- preview: O.value,
172
- availableFields: Q.value
173
- }, null, 8, ["mappings", "headers", "preview", "availableFields"])) : i.value === 3 ? (n(), v(de, {
184
+ headers: C.value,
185
+ preview: F.value,
186
+ availableFields: X.value,
187
+ "onUpdate:mappings": K
188
+ }, null, 8, ["mappings", "headers", "preview", "availableFields"])) : a.value === 3 ? (n(), d(be, {
174
189
  key: 2,
175
- importOptions: N.value
176
- }, null, 8, ["importOptions"])) : i.value === 4 ? (n(), v(ce, {
190
+ importOptions: q.value
191
+ }, null, 8, ["importOptions"])) : a.value === 4 ? (n(), d(we, {
177
192
  key: 3,
178
- progress: o.value
179
- }, null, 8, ["progress"])) : $("", !0)
193
+ progress: l.value
194
+ }, null, 8, ["progress"])) : T("", !0)
180
195
  ]),
181
- w.value.length > 0 && i.value === 2 ? (n(), F("div", fe, [
182
- S("ul", ge, [
183
- (n(!0), F(ie, null, oe(w.value, (t) => (n(), F("li", { key: t }, I(t), 1))), 128))
196
+ y.value.length > 0 && a.value === 2 ? (n(), N("div", De, [
197
+ U("ul", ke, [
198
+ (n(!0), N(ce, null, de(y.value, (o) => (n(), N("li", { key: o }, _(o), 1))), 128))
184
199
  ])
185
- ])) : $("", !0)
200
+ ])) : T("", !0)
186
201
  ])
187
202
  ]),
188
- footer: x(({ close: u }) => [
189
- S("div", he, [
190
- i.value > 1 && i.value < 4 ? (n(), v(_, {
203
+ footer: w(({ close: u }) => [
204
+ U("div", _e, [
205
+ a.value > 1 && a.value < 4 ? (n(), d(I, {
191
206
  key: 0,
192
207
  variant: "outline",
193
- onClick: G,
194
- disabled: f.value,
208
+ onClick: J,
209
+ disabled: v.value,
195
210
  icon: "lucide:arrow-left"
196
211
  }, {
197
- default: x(() => [
198
- C(I(X.value), 1)
212
+ default: w(() => [
213
+ $(_(Z.value), 1)
199
214
  ]),
200
215
  _: 1
201
- }, 8, ["disabled"])) : (n(), F("div", be)),
202
- i.value < 3 ? (n(), v(_, {
216
+ }, 8, ["disabled"])) : (n(), N("div", Ie)),
217
+ a.value < 3 ? (n(), d(I, {
203
218
  key: 2,
204
219
  variant: "primary",
205
- onClick: V,
206
- disabled: i.value === 1 && !M.value || f.value,
220
+ onClick: z,
221
+ disabled: a.value === 1 && !S.value || v.value,
207
222
  "icon-right": "lucide:arrow-right"
208
223
  }, {
209
- default: x(() => [
210
- C(I(Y.value), 1)
224
+ default: w(() => [
225
+ $(_(ee.value), 1)
211
226
  ]),
212
227
  _: 1
213
- }, 8, ["disabled"])) : i.value === 3 ? (n(), v(_, {
228
+ }, 8, ["disabled"])) : a.value === 3 ? (n(), d(I, {
214
229
  key: 3,
215
230
  variant: "primary",
216
231
  icon: "lucide:play",
217
- onClick: J,
218
- loading: f.value
232
+ onClick: W,
233
+ loading: v.value
219
234
  }, {
220
- default: x(() => [
221
- C(I(Z.value), 1)
235
+ default: w(() => [
236
+ $(_(te.value), 1)
222
237
  ]),
223
238
  _: 1
224
- }, 8, ["loading"])) : i.value === 4 && o.value.percentage >= 100 ? (n(), v(_, {
239
+ }, 8, ["loading"])) : a.value === 4 && l.value.percentage >= 100 ? (n(), d(I, {
225
240
  key: 4,
226
241
  variant: "primary",
227
242
  onClick: u
228
243
  }, {
229
- default: x(() => [
230
- C(I(ee.value), 1)
244
+ default: w(() => [
245
+ $(_(ae.value), 1)
231
246
  ]),
232
247
  _: 1
233
- }, 8, ["onClick"])) : $("", !0)
248
+ }, 8, ["onClick"])) : T("", !0)
234
249
  ])
235
250
  ]),
236
251
  _: 3
@@ -238,5 +253,5 @@ const ve = { class: "px-2 sm:px-4 py-2" }, me = { class: "min-h-[300px]" }, fe =
238
253
  }
239
254
  });
240
255
  export {
241
- $e as default
256
+ Ve as default
242
257
  };
@@ -12,11 +12,17 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
12
12
  "update:importMethod": (...args: any[]) => void;
13
13
  "update:csvFile": (...args: any[]) => void;
14
14
  "update:mappings": (...args: any[]) => void;
15
+ "update:headers": (...args: any[]) => void;
16
+ "update:preview": (...args: any[]) => void;
17
+ "update:importData": (...args: any[]) => void;
15
18
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
16
19
  onNext?: (...args: any[]) => any;
17
20
  "onUpdate:importMethod"?: (...args: any[]) => any;
18
21
  "onUpdate:csvFile"?: (...args: any[]) => any;
19
22
  "onUpdate:mappings"?: (...args: any[]) => any;
23
+ "onUpdate:headers"?: (...args: any[]) => any;
24
+ "onUpdate:preview"?: (...args: any[]) => any;
25
+ "onUpdate:importData"?: (...args: any[]) => any;
20
26
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
21
27
  fileInput: HTMLInputElement;
22
28
  }, HTMLDivElement>;
@@ -1,15 +1,15 @@
1
- import { defineComponent as A, ref as b, computed as d, openBlock as w, createElementBlock as V, createElementVNode as a, toDisplayString as l, withModifiers as F, normalizeClass as E, createVNode as h, createCommentVNode as J, withCtx as K, createTextVNode as L } from "vue";
1
+ import { defineComponent as A, ref as x, computed as d, openBlock as w, createElementBlock as V, createElementVNode as r, toDisplayString as l, withModifiers as F, normalizeClass as E, createVNode as v, createCommentVNode as J, withCtx as K, createTextVNode as L } from "vue";
2
2
  import R from "papaparse";
3
3
  import M from "../Icon.vue.js";
4
4
  import W from "../Button.vue.js";
5
5
  import q from "../Textarea.vue.js";
6
- import { showToast as g } from "../../composables/useNotifications.js";
6
+ import { showToast as h } from "../../composables/useNotifications.js";
7
7
  import { $t as k } from "../../utils/i18n.js";
8
- import { camelCase as y } from "../../utils/functions.js";
9
- const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { class: "space-y-6" }, Y = { class: "flex flex-col items-center justify-center pointer-events-none" }, Z = { class: "w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mb-4 text-primary" }, ee = { class: "font-medium text-foreground mb-1" }, te = { class: "text-sm text-muted-foreground" }, re = {
8
+ import { camelCase as b } from "../../utils/functions.js";
9
+ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { class: "space-y-6" }, Y = { class: "flex flex-col items-center justify-center pointer-events-none" }, Z = { class: "w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mb-4 text-primary" }, ee = { class: "font-medium text-foreground mb-1" }, te = { class: "text-sm text-muted-foreground" }, ae = {
10
10
  key: 0,
11
11
  class: "mt-4 text-sm font-semibold text-primary bg-background px-3 py-1 rounded-md border border-border shadow-sm inline-block"
12
- }, ae = { class: "flex items-center gap-3 mb-4" }, oe = { class: "w-8 h-8 rounded-lg bg-secondary flex items-center justify-center text-secondary-foreground" }, se = { class: "font-medium text-foreground leading-none" }, ie = { class: "flex justify-end mt-3" }, ve = /* @__PURE__ */ A({
12
+ }, re = { class: "flex items-center gap-3 mb-4" }, oe = { class: "w-8 h-8 rounded-lg bg-secondary flex items-center justify-center text-secondary-foreground" }, se = { class: "font-medium text-foreground leading-none" }, ie = { class: "flex justify-end mt-3" }, ve = /* @__PURE__ */ A({
13
13
  __name: "ImportStep1",
14
14
  props: {
15
15
  importMethod: {},
@@ -19,31 +19,39 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
19
19
  preview: {},
20
20
  importData: {}
21
21
  },
22
- emits: ["update:importMethod", "update:csvFile", "update:mappings", "next"],
22
+ emits: [
23
+ "update:importMethod",
24
+ "update:csvFile",
25
+ "update:mappings",
26
+ "update:headers",
27
+ "update:preview",
28
+ "update:importData",
29
+ "next"
30
+ ],
23
31
  setup(n, { emit: P }) {
24
- const i = n, c = P, o = (t, e, r) => {
25
- const s = r ? k(t, r) : k(t);
32
+ const y = n, i = P, o = (t, e, a) => {
33
+ const s = a ? k(t, a) : k(t);
26
34
  return s !== t ? s : e;
27
- }, D = b(null), f = b(!1), p = b(""), S = (t) => {
28
- if (t.preventDefault(), f.value = !1, t.dataTransfer?.files && t.dataTransfer.files.length > 0) {
35
+ }, D = x(null), m = x(!1), c = x(""), S = (t) => {
36
+ if (t.preventDefault(), m.value = !1, t.dataTransfer?.files && t.dataTransfer.files.length > 0) {
29
37
  const e = t.dataTransfer.files[0];
30
- e.type === "text/csv" || e.name.endsWith(".csv") ? _(e) : g(o("vlite.importData.csvOnly", "Please upload a CSV file"), "error");
38
+ e.type === "text/csv" || e.name.endsWith(".csv") ? _(e) : h(o("vlite.importData.csvOnly", "Please upload a CSV file"), "error");
31
39
  }
32
40
  }, _ = (t) => {
33
- c("update:csvFile", t), c("update:importMethod", "file");
41
+ i("update:csvFile", t), i("update:importMethod", "file");
34
42
  const e = new FileReader();
35
- e.onload = (r) => {
36
- r.target?.result && C(r.target.result);
43
+ e.onload = (a) => {
44
+ a.target?.result && C(a.target.result);
37
45
  }, e.readAsText(t);
38
46
  }, T = () => {
39
- c("update:importMethod", "paste"), p.value && C(p.value);
47
+ i("update:importMethod", "paste"), c.value && C(c.value);
40
48
  }, j = (t) => {
41
- const e = y(t).replace(/\s+/g, ""), r = {};
42
- return i.fields.forEach((s) => {
43
- r[y(s.field)] = s.field, s.matchings?.forEach((u) => {
44
- r[y(u)] = s.field;
49
+ const e = b(t).replace(/\s+/g, ""), a = {};
50
+ return y.fields.forEach((s) => {
51
+ a[b(s.field)] = s.field, s.matchings?.forEach((u) => {
52
+ a[b(u)] = s.field;
45
53
  });
46
- }), r[e] || "";
54
+ }), a[e] || "";
47
55
  }, C = (t) => {
48
56
  try {
49
57
  R.parse(t, {
@@ -51,31 +59,31 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
51
59
  skipEmptyLines: !0,
52
60
  complete: (e) => {
53
61
  if (!e.data || e.data.length === 0) {
54
- g(o("vlite.importData.emptyCsv", "The CSV file is empty."), "warning");
62
+ h(o("vlite.importData.emptyCsv", "The CSV file is empty."), "warning");
55
63
  return;
56
64
  }
57
- const r = Object.keys(e.data[0]);
58
- i.headers.splice(0, i.headers.length, ...r);
59
- const s = e.data.map((m) => {
60
- const v = {};
61
- return Object.keys(m).forEach((x) => {
62
- v[x] = m[x] || i.fields.find((B) => B.field === x)?.defaultValue;
63
- }), v;
65
+ const a = Object.keys(e.data[0]);
66
+ i("update:headers", a);
67
+ const s = e.data.map((p) => {
68
+ const f = {};
69
+ return Object.keys(p).forEach((g) => {
70
+ f[g] = p[g] || y.fields.find((B) => B.field === g)?.defaultValue;
71
+ }), f;
64
72
  });
65
- i.importData.splice(0, i.importData.length, ...s), i.preview.splice(0, i.preview.length, ...e.data.slice(0, 3));
73
+ i("update:importData", s), i("update:preview", e.data.slice(0, 3));
66
74
  const u = {};
67
- r.forEach((m) => {
68
- const v = j(m);
69
- u[m] = v || "";
70
- }), c("update:mappings", u), c("next");
75
+ a.forEach((p) => {
76
+ const f = j(p);
77
+ u[p] = f || "";
78
+ }), i("update:mappings", u), i("next");
71
79
  },
72
- error: (e) => g(
80
+ error: (e) => h(
73
81
  o("vlite.importData.parseError", "Failed to parse CSV: ") + e.message,
74
82
  "error"
75
83
  )
76
84
  });
77
85
  } catch (e) {
78
- g(o("vlite.importData.processError", "Error processing CSV data"), "error"), console.error(e);
86
+ h(o("vlite.importData.processError", "Error processing CSV data"), "error"), console.error(e);
79
87
  }
80
88
  }, O = (t) => {
81
89
  const e = t.target;
@@ -83,20 +91,20 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
83
91
  }, $ = d(() => o("vlite.importData.uploadData", "Upload Data")), I = d(() => o("vlite.importData.dragDrop", "Drag & drop a file here or click to browse")), z = d(() => o("vlite.importData.csvOnlyHint", "Only CSV files are supported")), H = d(() => o("vlite.importData.pasteData", "Or paste CSV/Excel data")), N = d(() => o("vlite.importData.process", "Process Data")), U = d(() => o("vlite.importData.pastePlaceholder", `id, name, email
84
92
  1, John Doe, john@example.com`));
85
93
  return (t, e) => (w(), V("div", G, [
86
- a("h5", Q, l($.value), 1),
87
- a("div", X, [
88
- a("div", {
94
+ r("h5", Q, l($.value), 1),
95
+ r("div", X, [
96
+ r("div", {
89
97
  class: E([
90
98
  "relative border-2 border-dashed rounded-xl p-8 text-center cursor-pointer transition-colors",
91
99
  n.importMethod === "file" ? "border-primary bg-primary/5" : "border-border hover:border-primary/50",
92
- f.value ? "border-primary bg-primary/10 scale-[1.01]" : ""
100
+ m.value ? "border-primary bg-primary/10 scale-[1.01]" : ""
93
101
  ]),
94
- onClick: e[0] || (e[0] = (r) => D.value?.click()),
95
- onDragover: e[1] || (e[1] = F((r) => f.value = !0, ["prevent"])),
96
- onDragleave: e[2] || (e[2] = F((r) => f.value = !1, ["prevent"])),
102
+ onClick: e[0] || (e[0] = (a) => D.value?.click()),
103
+ onDragover: e[1] || (e[1] = F((a) => m.value = !0, ["prevent"])),
104
+ onDragleave: e[2] || (e[2] = F((a) => m.value = !1, ["prevent"])),
97
105
  onDrop: S
98
106
  }, [
99
- a("input", {
107
+ r("input", {
100
108
  type: "file",
101
109
  ref_key: "fileInput",
102
110
  ref: D,
@@ -104,47 +112,47 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
104
112
  accept: ".csv",
105
113
  onChange: O
106
114
  }, null, 544),
107
- a("div", Y, [
108
- a("div", Z, [
109
- h(M, {
115
+ r("div", Y, [
116
+ r("div", Z, [
117
+ v(M, {
110
118
  icon: "lucide:upload-cloud",
111
119
  class: "w-6 h-6"
112
120
  })
113
121
  ]),
114
- a("p", ee, l(I.value), 1),
115
- a("p", te, l(z.value), 1),
116
- n.csvFile ? (w(), V("p", re, l(n.csvFile.name) + " (" + l((n.csvFile.size / 1024).toFixed(2)) + " KB) ", 1)) : J("", !0)
122
+ r("p", ee, l(I.value), 1),
123
+ r("p", te, l(z.value), 1),
124
+ n.csvFile ? (w(), V("p", ae, l(n.csvFile.name) + " (" + l((n.csvFile.size / 1024).toFixed(2)) + " KB) ", 1)) : J("", !0)
117
125
  ])
118
126
  ], 34),
119
- a("div", {
127
+ r("div", {
120
128
  class: E([
121
129
  "border rounded-xl p-6 transition-colors",
122
130
  n.importMethod === "paste" ? "border-primary shadow-sm ring-1 ring-primary/20" : "border-border"
123
131
  ])
124
132
  }, [
125
- a("div", ae, [
126
- a("div", oe, [
127
- h(M, {
133
+ r("div", re, [
134
+ r("div", oe, [
135
+ v(M, {
128
136
  icon: "lucide:clipboard-paste",
129
137
  class: "w-4 h-4"
130
138
  })
131
139
  ]),
132
- a("div", null, [
133
- a("p", se, l(H.value), 1)
140
+ r("div", null, [
141
+ r("p", se, l(H.value), 1)
134
142
  ])
135
143
  ]),
136
- h(q, {
137
- modelValue: p.value,
138
- "onUpdate:modelValue": e[3] || (e[3] = (r) => p.value = r),
144
+ v(q, {
145
+ modelValue: c.value,
146
+ "onUpdate:modelValue": e[3] || (e[3] = (a) => c.value = a),
139
147
  class: "w-full h-32",
140
148
  placeholder: U.value
141
149
  }, null, 8, ["modelValue", "placeholder"]),
142
- a("div", ie, [
143
- h(W, {
150
+ r("div", ie, [
151
+ v(W, {
144
152
  variant: "secondary",
145
153
  size: "sm",
146
154
  onClick: T,
147
- disabled: !p.value
155
+ disabled: !c.value
148
156
  }, {
149
157
  default: K(() => [
150
158
  L(l(N.value), 1)