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.
- package/components/Accordion/Accordion.vue.js +35 -22
- package/components/Accordion/AccordionContent.vue.js +2 -2
- package/components/Accordion/AccordionContent.vue2.js +1 -1
- package/components/Breadcrumb/Breadcrumb.vue.js +2 -2
- package/components/Breadcrumb/Breadcrumb.vue2.js +44 -44
- package/components/Carousel/Carousel.vue.js +1 -1
- package/components/Carousel/Carousel.vue2.js +3 -3
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent.vue.js +1 -1
- package/components/CommandPalette/CommandPaletteContent.vue2.js +2 -2
- package/components/Dropdown/DropdownTrigger.vue.js +1 -1
- package/components/FilePicker/FilePicker.vue.js +16 -16
- package/components/FileTree/FileTree.vue.js +5 -147
- package/components/FileTree/FileTree.vue2.js +164 -2
- package/components/FileTree/FileTreeNode.vue.js +89 -84
- package/components/Form/CustomFields.vue.js +2 -2
- package/components/Form/CustomFields.vue2.js +1 -1
- package/components/Form/Form.vue.js +1 -1
- package/components/Form/Form.vue2.js +133 -129
- package/components/Form/FormField.vue.d.ts +3 -0
- package/components/Form/FormField.vue.js +85 -82
- package/components/Form/FormFields.vue.d.ts +2 -0
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +55 -52
- package/components/Form/composables/useForm.d.ts +2 -0
- package/components/Form/composables/useForm.js +113 -107
- package/components/ImportData/ImportData.vue.js +157 -142
- package/components/ImportData/ImportStep1.vue.d.ts +6 -0
- package/components/ImportData/ImportStep1.vue.js +69 -61
- package/components/ImportData/ImportStep2.vue.js +5 -98
- package/components/ImportData/ImportStep2.vue2.js +105 -2
- package/components/Kanban/Kanban.vue.js +1 -1
- package/components/Kanban/Kanban.vue2.js +1 -1
- package/components/Kanban/KanbanBoard.vue.js +1 -1
- package/components/Kanban/KanbanBoard.vue2.js +92 -83
- package/components/Kanban/useKanbanBoard.d.ts +1 -1
- package/components/Kanban/useKanbanBoard.js +17 -17
- package/components/List/ListFieldRow.vue.js +4 -6
- package/components/MultiSelect/MultiSelect.vue.js +10 -4
- package/components/NavbarCommandPalette.vue.js +2 -2
- package/components/NumberInput.vue.js +2 -2
- package/components/NumberInput.vue2.js +1 -1
- package/components/PermissionMatrix/PermissionEditor.vue.d.ts +2 -0
- package/components/PermissionMatrix/PermissionEditor.vue.js +25 -23
- package/components/PermissionMatrix/PermissionEditorMatrix.vue.d.ts +4 -1
- package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +2 -2
- package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +48 -45
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Timeline/Timeline.vue.js +62 -57
- package/components/ToastNotification.vue.js +2 -2
- package/components/ToastNotification.vue2.js +103 -88
- package/components/Workbook/Workbook.vue.js +5 -152
- package/components/Workbook/Workbook.vue2.js +166 -2
- package/package.json +1 -1
- package/style.css +3 -3
- /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { showToast as
|
|
12
|
-
const
|
|
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
|
-
},
|
|
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(
|
|
30
|
-
const s =
|
|
29
|
+
setup(x, { emit: L }) {
|
|
30
|
+
const s = x, R = L, P = h({
|
|
31
31
|
get: () => s.show,
|
|
32
|
-
set: (e) =>
|
|
33
|
-
}),
|
|
34
|
-
const
|
|
35
|
-
return
|
|
36
|
-
},
|
|
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 =
|
|
38
|
+
const e = j(s.titleI18n);
|
|
39
39
|
if (e !== s.titleI18n) return e;
|
|
40
40
|
}
|
|
41
41
|
return s.title;
|
|
42
|
-
}),
|
|
42
|
+
}), a = b(1), v = b(!1), M = B([]), m = b({}), q = b({
|
|
43
43
|
existing: "replace",
|
|
44
44
|
new: "create"
|
|
45
|
-
}),
|
|
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
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
const e = [],
|
|
58
|
-
for (const
|
|
59
|
-
const p = m.value[
|
|
60
|
-
p && (
|
|
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
|
|
63
|
-
|
|
64
|
-
`Field "${
|
|
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((
|
|
67
|
-
for (const
|
|
68
|
-
if (!
|
|
69
|
-
const p = s.fields.find((r) => r.field ===
|
|
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
|
-
},
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
const
|
|
79
|
-
for (const
|
|
80
|
-
const p =
|
|
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[
|
|
83
|
-
const
|
|
84
|
-
if ((r == null || r === "") &&
|
|
85
|
-
const
|
|
86
|
-
let
|
|
87
|
-
for (let
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
91
|
+
o[p] = r;
|
|
92
92
|
}
|
|
93
|
-
return
|
|
94
|
-
}),
|
|
95
|
-
|
|
93
|
+
return o;
|
|
94
|
+
}), W = async () => {
|
|
95
|
+
v.value = !0, z();
|
|
96
96
|
try {
|
|
97
|
-
const e =
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
for (let
|
|
101
|
-
|
|
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
|
-
|
|
103
|
+
l.value.percentage < 90 && (l.value.percentage += Math.floor(Math.random() * 5) + 1);
|
|
104
104
|
}, 1e3);
|
|
105
|
-
for (const
|
|
106
|
-
const
|
|
107
|
-
data:
|
|
108
|
-
options:
|
|
105
|
+
for (const o of i) {
|
|
106
|
+
const t = await s.processBatch({
|
|
107
|
+
data: o,
|
|
108
|
+
options: q.value
|
|
109
109
|
});
|
|
110
|
-
|
|
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(
|
|
112
|
+
Math.floor(l.value.processed / l.value.total * 100)
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
|
-
clearInterval(u),
|
|
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),
|
|
117
|
+
console.error(e), E(c("vlite.importData.error", "A critical error occurred during import."), "error");
|
|
118
118
|
} finally {
|
|
119
|
-
|
|
119
|
+
v.value = !1;
|
|
120
120
|
}
|
|
121
|
-
},
|
|
122
|
-
{ id: 1, title:
|
|
123
|
-
{ id: 2, title:
|
|
124
|
-
{ id: 3, title:
|
|
125
|
-
{ id: 4, title:
|
|
126
|
-
]),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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:
|
|
133
|
-
"close-outside": !
|
|
144
|
+
onClose: H,
|
|
145
|
+
"close-outside": !v.value
|
|
134
146
|
}, {
|
|
135
|
-
trigger:
|
|
136
|
-
|
|
137
|
-
|
|
147
|
+
trigger: w(() => [
|
|
148
|
+
ve(e.$slots, "trigger", {}, () => [
|
|
149
|
+
x.show ? T("", !0) : (n(), d(I, {
|
|
138
150
|
key: 0,
|
|
139
|
-
text:
|
|
140
|
-
icon:
|
|
151
|
+
text: x.buttonText,
|
|
152
|
+
icon: x.buttonIcon,
|
|
141
153
|
variant: "outline"
|
|
142
154
|
}, null, 8, ["text", "icon"]))
|
|
143
155
|
])
|
|
144
156
|
]),
|
|
145
|
-
default:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
steps:
|
|
149
|
-
"active-step":
|
|
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
|
-
|
|
153
|
-
|
|
164
|
+
U("div", ye, [
|
|
165
|
+
a.value === 1 ? (n(), d(he, {
|
|
154
166
|
key: 0,
|
|
155
|
-
importMethod:
|
|
156
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}, null, 8, ["mappings", "headers", "preview", "availableFields"])) :
|
|
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:
|
|
176
|
-
}, null, 8, ["importOptions"])) :
|
|
190
|
+
importOptions: q.value
|
|
191
|
+
}, null, 8, ["importOptions"])) : a.value === 4 ? (n(), d(we, {
|
|
177
192
|
key: 3,
|
|
178
|
-
progress:
|
|
179
|
-
}, null, 8, ["progress"])) :
|
|
193
|
+
progress: l.value
|
|
194
|
+
}, null, 8, ["progress"])) : T("", !0)
|
|
180
195
|
]),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
(n(!0),
|
|
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
|
-
])) :
|
|
200
|
+
])) : T("", !0)
|
|
186
201
|
])
|
|
187
202
|
]),
|
|
188
|
-
footer:
|
|
189
|
-
|
|
190
|
-
|
|
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:
|
|
194
|
-
disabled:
|
|
208
|
+
onClick: J,
|
|
209
|
+
disabled: v.value,
|
|
195
210
|
icon: "lucide:arrow-left"
|
|
196
211
|
}, {
|
|
197
|
-
default:
|
|
198
|
-
|
|
212
|
+
default: w(() => [
|
|
213
|
+
$(_(Z.value), 1)
|
|
199
214
|
]),
|
|
200
215
|
_: 1
|
|
201
|
-
}, 8, ["disabled"])) : (n(),
|
|
202
|
-
|
|
216
|
+
}, 8, ["disabled"])) : (n(), N("div", Ie)),
|
|
217
|
+
a.value < 3 ? (n(), d(I, {
|
|
203
218
|
key: 2,
|
|
204
219
|
variant: "primary",
|
|
205
|
-
onClick:
|
|
206
|
-
disabled:
|
|
220
|
+
onClick: z,
|
|
221
|
+
disabled: a.value === 1 && !S.value || v.value,
|
|
207
222
|
"icon-right": "lucide:arrow-right"
|
|
208
223
|
}, {
|
|
209
|
-
default:
|
|
210
|
-
|
|
224
|
+
default: w(() => [
|
|
225
|
+
$(_(ee.value), 1)
|
|
211
226
|
]),
|
|
212
227
|
_: 1
|
|
213
|
-
}, 8, ["disabled"])) :
|
|
228
|
+
}, 8, ["disabled"])) : a.value === 3 ? (n(), d(I, {
|
|
214
229
|
key: 3,
|
|
215
230
|
variant: "primary",
|
|
216
231
|
icon: "lucide:play",
|
|
217
|
-
onClick:
|
|
218
|
-
loading:
|
|
232
|
+
onClick: W,
|
|
233
|
+
loading: v.value
|
|
219
234
|
}, {
|
|
220
|
-
default:
|
|
221
|
-
|
|
235
|
+
default: w(() => [
|
|
236
|
+
$(_(te.value), 1)
|
|
222
237
|
]),
|
|
223
238
|
_: 1
|
|
224
|
-
}, 8, ["loading"])) :
|
|
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:
|
|
230
|
-
|
|
244
|
+
default: w(() => [
|
|
245
|
+
$(_(ae.value), 1)
|
|
231
246
|
]),
|
|
232
247
|
_: 1
|
|
233
|
-
}, 8, ["onClick"])) :
|
|
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
|
-
|
|
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
|
|
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
|
|
6
|
+
import { showToast as h } from "../../composables/useNotifications.js";
|
|
7
7
|
import { $t as k } from "../../utils/i18n.js";
|
|
8
|
-
import { camelCase as
|
|
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" },
|
|
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
|
-
},
|
|
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: [
|
|
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
|
|
25
|
-
const s =
|
|
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 =
|
|
28
|
-
if (t.preventDefault(),
|
|
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) :
|
|
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
|
-
|
|
41
|
+
i("update:csvFile", t), i("update:importMethod", "file");
|
|
34
42
|
const e = new FileReader();
|
|
35
|
-
e.onload = (
|
|
36
|
-
|
|
43
|
+
e.onload = (a) => {
|
|
44
|
+
a.target?.result && C(a.target.result);
|
|
37
45
|
}, e.readAsText(t);
|
|
38
46
|
}, T = () => {
|
|
39
|
-
|
|
47
|
+
i("update:importMethod", "paste"), c.value && C(c.value);
|
|
40
48
|
}, j = (t) => {
|
|
41
|
-
const e =
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
}),
|
|
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
|
-
|
|
62
|
+
h(o("vlite.importData.emptyCsv", "The CSV file is empty."), "warning");
|
|
55
63
|
return;
|
|
56
64
|
}
|
|
57
|
-
const
|
|
58
|
-
i
|
|
59
|
-
const s = e.data.map((
|
|
60
|
-
const
|
|
61
|
-
return Object.keys(
|
|
62
|
-
|
|
63
|
-
}),
|
|
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
|
|
73
|
+
i("update:importData", s), i("update:preview", e.data.slice(0, 3));
|
|
66
74
|
const u = {};
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
u[
|
|
70
|
-
}),
|
|
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) =>
|
|
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
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
100
|
+
m.value ? "border-primary bg-primary/10 scale-[1.01]" : ""
|
|
93
101
|
]),
|
|
94
|
-
onClick: e[0] || (e[0] = (
|
|
95
|
-
onDragover: e[1] || (e[1] = F((
|
|
96
|
-
onDragleave: e[2] || (e[2] = F((
|
|
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
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
n.csvFile ? (w(), V("p",
|
|
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
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
133
|
-
|
|
140
|
+
r("div", null, [
|
|
141
|
+
r("p", se, l(H.value), 1)
|
|
134
142
|
])
|
|
135
143
|
]),
|
|
136
|
-
|
|
137
|
-
modelValue:
|
|
138
|
-
"onUpdate:modelValue": e[3] || (e[3] = (
|
|
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
|
-
|
|
143
|
-
|
|
150
|
+
r("div", ie, [
|
|
151
|
+
v(W, {
|
|
144
152
|
variant: "secondary",
|
|
145
153
|
size: "sm",
|
|
146
154
|
onClick: T,
|
|
147
|
-
disabled: !
|
|
155
|
+
disabled: !c.value
|
|
148
156
|
}, {
|
|
149
157
|
default: K(() => [
|
|
150
158
|
L(l(N.value), 1)
|