vlite3 1.3.8 → 1.3.10
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/CategoryManager/CategoryManager.vue2.js +1 -1
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
- package/components/ImportData/ImportData.vue.js +112 -109
- package/components/ImportData/ImportStep1.vue.js +28 -28
- package/components/ImportData/ImportStep3.vue.js +25 -6
- package/components/ImportData/types.d.ts +1 -0
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/package.json +1 -1
- package/style.css +5 -0
- package/utils/functions.js +9 -5
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
|
@@ -6,8 +6,8 @@ import O from "../Input.vue.js";
|
|
|
6
6
|
import "../../core/config.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
import y from "../Button.vue.js";
|
|
9
|
-
import E from "./ColorIro.
|
|
10
|
-
/* empty css
|
|
9
|
+
import E from "./ColorIro.vue2.js";
|
|
10
|
+
/* empty css */
|
|
11
11
|
import { useEyeDropper as P } from "@vueuse/core";
|
|
12
12
|
const I = {
|
|
13
13
|
key: 0,
|
|
@@ -4,7 +4,7 @@ import k from "../Icon.vue.js";
|
|
|
4
4
|
import { $t as E } from "../../utils/i18n.js";
|
|
5
5
|
import { useCommandPaletteItems as Y } from "./useCommandPaletteItems.js";
|
|
6
6
|
import { useCommandPaletteNav as Z } from "./useCommandPaletteNav.js";
|
|
7
|
-
import ee from "./CommandPaletteItem.
|
|
7
|
+
import ee from "./CommandPaletteItem.vue2.js";
|
|
8
8
|
const te = { class: "command-palette-content flex flex-col w-full h-full max-h-[70vh]" }, oe = { class: "flex items-center gap-3 px-4 py-3 border-b border-border/80 shrink-0" }, se = ["placeholder"], ne = ["aria-label"], re = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "flex flex-col items-center justify-center py-14 px-6 text-center select-none",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as ne, computed as h, ref as
|
|
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
|
|
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
|
|
11
|
-
import
|
|
12
|
-
import { showToast as
|
|
13
|
-
const
|
|
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(
|
|
31
|
-
const
|
|
32
|
-
get: () =>
|
|
33
|
-
set: (e) =>
|
|
34
|
-
}), c = (e,
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
},
|
|
38
|
-
if (
|
|
39
|
-
const e =
|
|
40
|
-
if (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
|
|
43
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
},
|
|
56
|
-
|
|
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 = [],
|
|
59
|
-
for (const t in
|
|
60
|
-
const p =
|
|
61
|
-
p && (
|
|
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
|
|
64
|
-
|
|
65
|
-
`Field "${t}" is mapped to multiple headers: ${
|
|
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 =
|
|
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 (!
|
|
70
|
-
const p =
|
|
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
|
-
|
|
75
|
+
l.value === 2 && (x.value = G(), x.value.length > 0) || l.value < 4 && l.value++;
|
|
76
76
|
}, J = () => {
|
|
77
|
-
|
|
78
|
-
}, Q = (e,
|
|
79
|
-
const
|
|
80
|
-
for (const t in
|
|
81
|
-
const p =
|
|
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
|
|
84
|
-
const g =
|
|
85
|
-
if ((
|
|
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 =
|
|
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]] =
|
|
90
|
+
D[f[f.length - 1]] = s;
|
|
91
91
|
} else
|
|
92
|
-
|
|
92
|
+
a[p] = s;
|
|
93
93
|
}
|
|
94
|
-
return
|
|
94
|
+
return a;
|
|
95
95
|
}), W = async () => {
|
|
96
|
-
|
|
96
|
+
m.value = !0, z();
|
|
97
97
|
try {
|
|
98
|
-
const e = Q(
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
for (let
|
|
102
|
-
|
|
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
|
-
|
|
104
|
+
o.value.percentage < 90 && (o.value.percentage += Math.floor(Math.random() * 5) + 1);
|
|
105
105
|
}, 1e3);
|
|
106
|
-
for (const
|
|
107
|
-
const t = await
|
|
108
|
-
data:
|
|
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
|
-
|
|
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(
|
|
114
|
+
Math.floor(o.value.processed / o.value.total * 100)
|
|
114
115
|
);
|
|
115
116
|
}
|
|
116
|
-
clearInterval(u),
|
|
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),
|
|
121
|
+
console.error(e), j(c("vlite.importData.error", "A critical error occurred during import."), "error");
|
|
119
122
|
} finally {
|
|
120
|
-
|
|
123
|
+
m.value = !1;
|
|
121
124
|
}
|
|
122
|
-
}, X = 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
|
-
|
|
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
|
-
|
|
141
|
+
C.value = e;
|
|
139
142
|
};
|
|
140
|
-
return (e,
|
|
141
|
-
show:
|
|
142
|
-
"onUpdate:show":
|
|
143
|
-
title:
|
|
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": !
|
|
149
|
+
"close-outside": !m.value
|
|
147
150
|
}, {
|
|
148
|
-
trigger:
|
|
151
|
+
trigger: b(() => [
|
|
149
152
|
ve(e.$slots, "trigger", {}, () => [
|
|
150
|
-
|
|
153
|
+
w.show ? T("", !0) : (n(), d(I, {
|
|
151
154
|
key: 0,
|
|
152
|
-
text:
|
|
153
|
-
icon:
|
|
155
|
+
text: w.buttonText,
|
|
156
|
+
icon: w.buttonIcon,
|
|
154
157
|
variant: "outline"
|
|
155
158
|
}, null, 8, ["text", "icon"]))
|
|
156
159
|
])
|
|
157
160
|
]),
|
|
158
|
-
default:
|
|
159
|
-
B("div",
|
|
161
|
+
default: b(({ close: u }) => [
|
|
162
|
+
B("div", we, [
|
|
160
163
|
ue(pe(fe), {
|
|
161
164
|
steps: Y.value,
|
|
162
|
-
"active-step":
|
|
165
|
+
"active-step": l.value - 1,
|
|
163
166
|
class: "mb-8"
|
|
164
167
|
}, null, 8, ["steps", "active-step"]),
|
|
165
|
-
B("div",
|
|
166
|
-
|
|
168
|
+
B("div", xe, [
|
|
169
|
+
l.value === 1 ? (n(), d(he, {
|
|
167
170
|
key: 0,
|
|
168
|
-
importMethod:
|
|
171
|
+
importMethod: M.value,
|
|
169
172
|
csvFile: O.value,
|
|
170
|
-
mappings:
|
|
171
|
-
fields:
|
|
173
|
+
mappings: v.value,
|
|
174
|
+
fields: w.fields,
|
|
172
175
|
headers: S.value,
|
|
173
176
|
preview: F.value,
|
|
174
|
-
importData:
|
|
177
|
+
importData: C.value,
|
|
175
178
|
"onUpdate:importMethod": le,
|
|
176
|
-
"onUpdate:csvFile":
|
|
177
|
-
"onUpdate:mappings":
|
|
178
|
-
"onUpdate:headers":
|
|
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"])) :
|
|
185
|
+
}, null, 8, ["importMethod", "csvFile", "mappings", "fields", "headers", "preview", "importData"])) : l.value === 2 ? (n(), d(ge, {
|
|
183
186
|
key: 1,
|
|
184
|
-
mappings:
|
|
187
|
+
mappings: v.value,
|
|
185
188
|
headers: S.value,
|
|
186
189
|
preview: F.value,
|
|
187
190
|
availableFields: X.value,
|
|
188
|
-
"onUpdate:mappings":
|
|
189
|
-
}, null, 8, ["mappings", "headers", "preview", "availableFields"])) :
|
|
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"])) :
|
|
195
|
+
}, null, 8, ["importOptions"])) : l.value === 4 ? (n(), d(be, {
|
|
193
196
|
key: 3,
|
|
194
|
-
progress:
|
|
197
|
+
progress: o.value
|
|
195
198
|
}, null, 8, ["progress"])) : T("", !0)
|
|
196
199
|
]),
|
|
197
|
-
|
|
200
|
+
x.value.length > 0 && l.value === 2 ? (n(), N("div", De, [
|
|
198
201
|
B("ul", ke, [
|
|
199
|
-
(n(!0), N(ce, null, de(
|
|
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:
|
|
207
|
+
footer: b(({ close: u }) => [
|
|
205
208
|
B("div", _e, [
|
|
206
|
-
|
|
209
|
+
l.value > 1 && l.value < 4 ? (n(), d(I, {
|
|
207
210
|
key: 0,
|
|
208
211
|
variant: "outline",
|
|
209
212
|
onClick: J,
|
|
210
|
-
disabled:
|
|
213
|
+
disabled: m.value,
|
|
211
214
|
icon: "lucide:arrow-left"
|
|
212
215
|
}, {
|
|
213
|
-
default:
|
|
216
|
+
default: b(() => [
|
|
214
217
|
U(_(Z.value), 1)
|
|
215
218
|
]),
|
|
216
219
|
_: 1
|
|
217
220
|
}, 8, ["disabled"])) : (n(), N("div", Ie)),
|
|
218
|
-
|
|
221
|
+
l.value < 3 ? (n(), d(I, {
|
|
219
222
|
key: 2,
|
|
220
223
|
variant: "primary",
|
|
221
224
|
onClick: z,
|
|
222
|
-
disabled:
|
|
225
|
+
disabled: l.value === 1 && !M.value || m.value,
|
|
223
226
|
"icon-right": "lucide:arrow-right"
|
|
224
227
|
}, {
|
|
225
|
-
default:
|
|
228
|
+
default: b(() => [
|
|
226
229
|
U(_(ee.value), 1)
|
|
227
230
|
]),
|
|
228
231
|
_: 1
|
|
229
|
-
}, 8, ["disabled"])) :
|
|
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:
|
|
237
|
+
loading: m.value
|
|
235
238
|
}, {
|
|
236
|
-
default:
|
|
239
|
+
default: b(() => [
|
|
237
240
|
U(_(te.value), 1)
|
|
238
241
|
]),
|
|
239
242
|
_: 1
|
|
240
|
-
}, 8, ["loading"])) :
|
|
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:
|
|
248
|
+
default: b(() => [
|
|
246
249
|
U(_(ae.value), 1)
|
|
247
250
|
]),
|
|
248
251
|
_: 1
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as A, ref as
|
|
1
|
+
import { defineComponent as A, ref as b, computed as d, openBlock as w, createElementBlock as V, createElementVNode as r, toDisplayString as n, 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
6
|
import { showToast as h } from "../../composables/useNotifications.js";
|
|
7
7
|
import { $t as k } from "../../utils/i18n.js";
|
|
8
|
-
import { camelCase as
|
|
8
|
+
import { camelCase as g } from "../../utils/functions.js";
|
|
9
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"
|
|
@@ -28,14 +28,14 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
|
|
|
28
28
|
"update:importData",
|
|
29
29
|
"next"
|
|
30
30
|
],
|
|
31
|
-
setup(
|
|
32
|
-
const y =
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
}, D =
|
|
31
|
+
setup(l, { emit: P }) {
|
|
32
|
+
const y = l, i = P, s = (t, e, a) => {
|
|
33
|
+
const o = a ? k(t, a) : k(t);
|
|
34
|
+
return o !== t ? o : e;
|
|
35
|
+
}, D = b(null), m = b(!1), c = b(""), S = (t) => {
|
|
36
36
|
if (t.preventDefault(), m.value = !1, t.dataTransfer?.files && t.dataTransfer.files.length > 0) {
|
|
37
37
|
const e = t.dataTransfer.files[0];
|
|
38
|
-
e.type === "text/csv" || e.name.endsWith(".csv") ? _(e) : h(
|
|
38
|
+
e.type === "text/csv" || e.name.endsWith(".csv") ? _(e) : h(s("vlite.importData.csvOnly", "Please upload a CSV file"), "error");
|
|
39
39
|
}
|
|
40
40
|
}, _ = (t) => {
|
|
41
41
|
i("update:csvFile", t), i("update:importMethod", "file");
|
|
@@ -46,10 +46,10 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
|
|
|
46
46
|
}, T = () => {
|
|
47
47
|
i("update:importMethod", "paste"), c.value && C(c.value);
|
|
48
48
|
}, j = (t) => {
|
|
49
|
-
const e =
|
|
50
|
-
return y.fields.forEach((
|
|
51
|
-
a[
|
|
52
|
-
a[
|
|
49
|
+
const e = g(t), a = {};
|
|
50
|
+
return y.fields.forEach((o) => {
|
|
51
|
+
a[g(o.field)] = o.field, a[g(o.title)] = o.field, o.matchings?.forEach((u) => {
|
|
52
|
+
a[g(u)] = o.field;
|
|
53
53
|
});
|
|
54
54
|
}), a[e] || "";
|
|
55
55
|
}, C = (t) => {
|
|
@@ -59,18 +59,18 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
|
|
|
59
59
|
skipEmptyLines: !0,
|
|
60
60
|
complete: (e) => {
|
|
61
61
|
if (!e.data || e.data.length === 0) {
|
|
62
|
-
h(
|
|
62
|
+
h(s("vlite.importData.emptyCsv", "The CSV file is empty."), "warning");
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
const a = Object.keys(e.data[0]);
|
|
66
66
|
i("update:headers", a);
|
|
67
|
-
const
|
|
67
|
+
const o = e.data.map((p) => {
|
|
68
68
|
const f = {};
|
|
69
|
-
return Object.keys(p).forEach((
|
|
70
|
-
f[
|
|
69
|
+
return Object.keys(p).forEach((x) => {
|
|
70
|
+
f[x] = p[x] || y.fields.find((B) => B.field === x)?.defaultValue;
|
|
71
71
|
}), f;
|
|
72
72
|
});
|
|
73
|
-
i("update:importData",
|
|
73
|
+
i("update:importData", o), i("update:preview", e.data.slice(0, 3));
|
|
74
74
|
const u = {};
|
|
75
75
|
a.forEach((p) => {
|
|
76
76
|
const f = j(p);
|
|
@@ -78,25 +78,25 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
|
|
|
78
78
|
}), i("update:mappings", u), i("next");
|
|
79
79
|
},
|
|
80
80
|
error: (e) => h(
|
|
81
|
-
|
|
81
|
+
s("vlite.importData.parseError", "Failed to parse CSV: ") + e.message,
|
|
82
82
|
"error"
|
|
83
83
|
)
|
|
84
84
|
});
|
|
85
85
|
} catch (e) {
|
|
86
|
-
h(
|
|
86
|
+
h(s("vlite.importData.processError", "Error processing CSV data"), "error"), console.error(e);
|
|
87
87
|
}
|
|
88
88
|
}, O = (t) => {
|
|
89
89
|
const e = t.target;
|
|
90
90
|
e.files && e.files.length > 0 && _(e.files[0]);
|
|
91
|
-
}, $ = d(() =>
|
|
91
|
+
}, $ = d(() => s("vlite.importData.uploadData", "Upload Data")), I = d(() => s("vlite.importData.dragDrop", "Drag & drop a file here or click to browse")), z = d(() => s("vlite.importData.csvOnlyHint", "Only CSV files are supported")), H = d(() => s("vlite.importData.pasteData", "Or paste CSV/Excel data")), N = d(() => s("vlite.importData.process", "Process Data")), U = d(() => s("vlite.importData.pastePlaceholder", `id, name, email
|
|
92
92
|
1, John Doe, john@example.com`));
|
|
93
93
|
return (t, e) => (w(), V("div", G, [
|
|
94
|
-
r("h5", Q,
|
|
94
|
+
r("h5", Q, n($.value), 1),
|
|
95
95
|
r("div", X, [
|
|
96
96
|
r("div", {
|
|
97
97
|
class: E([
|
|
98
98
|
"relative border-2 border-dashed rounded-xl p-8 text-center cursor-pointer transition-colors",
|
|
99
|
-
|
|
99
|
+
l.importMethod === "file" ? "border-primary bg-primary/5" : "border-border hover:border-primary/50",
|
|
100
100
|
m.value ? "border-primary bg-primary/10 scale-[1.01]" : ""
|
|
101
101
|
]),
|
|
102
102
|
onClick: e[0] || (e[0] = (a) => D.value?.click()),
|
|
@@ -119,15 +119,15 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
|
|
|
119
119
|
class: "w-6 h-6"
|
|
120
120
|
})
|
|
121
121
|
]),
|
|
122
|
-
r("p", ee,
|
|
123
|
-
r("p", te,
|
|
124
|
-
|
|
122
|
+
r("p", ee, n(I.value), 1),
|
|
123
|
+
r("p", te, n(z.value), 1),
|
|
124
|
+
l.csvFile ? (w(), V("p", ae, n(l.csvFile.name) + " (" + n((l.csvFile.size / 1024).toFixed(2)) + " KB) ", 1)) : J("", !0)
|
|
125
125
|
])
|
|
126
126
|
], 34),
|
|
127
127
|
r("div", {
|
|
128
128
|
class: E([
|
|
129
129
|
"border rounded-xl p-6 transition-colors",
|
|
130
|
-
|
|
130
|
+
l.importMethod === "paste" ? "border-primary shadow-sm ring-1 ring-primary/20" : "border-border"
|
|
131
131
|
])
|
|
132
132
|
}, [
|
|
133
133
|
r("div", re, [
|
|
@@ -138,7 +138,7 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
|
|
|
138
138
|
})
|
|
139
139
|
]),
|
|
140
140
|
r("div", null, [
|
|
141
|
-
r("p", se,
|
|
141
|
+
r("p", se, n(H.value), 1)
|
|
142
142
|
])
|
|
143
143
|
]),
|
|
144
144
|
v(q, {
|
|
@@ -155,7 +155,7 @@ const G = { class: "space-y-2" }, Q = { class: "font-medium text-md" }, X = { cl
|
|
|
155
155
|
disabled: !c.value
|
|
156
156
|
}, {
|
|
157
157
|
default: K(() => [
|
|
158
|
-
L(
|
|
158
|
+
L(n(N.value), 1)
|
|
159
159
|
]),
|
|
160
160
|
_: 1
|
|
161
161
|
}, 8, ["disabled"])
|
|
@@ -2,7 +2,7 @@ import { defineComponent as _, computed as o, openBlock as g, createElementBlock
|
|
|
2
2
|
import c from "../Icon.vue.js";
|
|
3
3
|
import p from "../ChoiceBox/ChoiceBox.vue.js";
|
|
4
4
|
import { $t as b } from "../../utils/i18n.js";
|
|
5
|
-
const k = { class: "space-y-8" }, y = { class: "font-medium text-md mb-2" }, O = { class: "bg-card rounded-xl p-5 border border-border shadow-sm" }, N = { class: "flex items-center mb-6" }, S = { class: "bg-primary/10 p-2.5 rounded-lg mr-4 text-primary shrink-0" }, V = { class: "font-semibold text-foreground text-base" }, C = { class: "text-sm text-muted-foreground" }, M = { class: "bg-card rounded-xl p-5 border border-border shadow-sm" }, T = { class: "flex items-center mb-6" }, F = { class: "bg-primary/10 p-2.5 rounded-lg mr-4 text-primary shrink-0" }, A = { class: "font-semibold text-foreground text-base" }, I = { class: "text-sm text-muted-foreground" }, R = /* @__PURE__ */ _({
|
|
5
|
+
const k = { class: "space-y-8 -mt-2" }, y = { class: "font-medium text-md mb-2" }, O = { class: "bg-card rounded-xl p-5 border border-border shadow-sm" }, N = { class: "flex items-center mb-6" }, S = { class: "bg-primary/10 p-2.5 rounded-lg mr-4 text-primary shrink-0" }, V = { class: "font-semibold text-foreground text-base" }, C = { class: "text-sm text-muted-foreground" }, M = { class: "bg-card rounded-xl p-5 border border-border shadow-sm" }, T = { class: "flex items-center mb-6" }, F = { class: "bg-primary/10 p-2.5 rounded-lg mr-4 text-primary shrink-0" }, A = { class: "font-semibold text-foreground text-base" }, I = { class: "text-sm text-muted-foreground" }, R = /* @__PURE__ */ _({
|
|
6
6
|
__name: "ImportStep3",
|
|
7
7
|
props: {
|
|
8
8
|
importOptions: {}
|
|
@@ -11,17 +11,30 @@ const k = { class: "space-y-8" }, y = { class: "font-medium text-md mb-2" }, O =
|
|
|
11
11
|
const t = (d, i) => {
|
|
12
12
|
const s = b(d);
|
|
13
13
|
return s !== d ? s : i;
|
|
14
|
-
}, m = o(() => t("vlite.importData.options", "Import Options")), u = o(() => t("vlite.importData.matchFound", "When a match is found")), h = o(
|
|
14
|
+
}, m = o(() => t("vlite.importData.options", "Import Options")), u = o(() => t("vlite.importData.matchFound", "When a match is found")), h = o(
|
|
15
|
+
() => t(
|
|
16
|
+
"vlite.importData.matchFoundDesc",
|
|
17
|
+
"Determine how to handle records that already exist in the system."
|
|
18
|
+
)
|
|
19
|
+
), v = o(() => t("vlite.importData.noMatch", "When no match is found")), x = o(
|
|
20
|
+
() => t("vlite.importData.noMatchDesc", "Determine how to handle completely new records.")
|
|
21
|
+
), f = o(() => [
|
|
15
22
|
{
|
|
16
23
|
id: "add",
|
|
17
24
|
title: t("vlite.importData.optAddTitle", "Add New"),
|
|
18
|
-
description: t(
|
|
25
|
+
description: t(
|
|
26
|
+
"vlite.importData.optAddDesc",
|
|
27
|
+
"Creates a duplicate record instead of overwriting."
|
|
28
|
+
),
|
|
19
29
|
icon: "lucide:plus-circle"
|
|
20
30
|
},
|
|
21
31
|
{
|
|
22
32
|
id: "replace",
|
|
23
33
|
title: t("vlite.importData.optReplaceTitle", "Update"),
|
|
24
|
-
description: t(
|
|
34
|
+
description: t(
|
|
35
|
+
"vlite.importData.optReplaceDesc",
|
|
36
|
+
"Overwrites existing fields with the imported data."
|
|
37
|
+
),
|
|
25
38
|
icon: "lucide:refresh-cw"
|
|
26
39
|
},
|
|
27
40
|
{
|
|
@@ -34,13 +47,19 @@ const k = { class: "space-y-8" }, y = { class: "font-medium text-md mb-2" }, O =
|
|
|
34
47
|
{
|
|
35
48
|
id: "create",
|
|
36
49
|
title: t("vlite.importData.optCreateTitle", "Create New"),
|
|
37
|
-
description: t(
|
|
50
|
+
description: t(
|
|
51
|
+
"vlite.importData.optCreateDesc",
|
|
52
|
+
"Creates a completely new record in the system."
|
|
53
|
+
),
|
|
38
54
|
icon: "lucide:check-circle-2"
|
|
39
55
|
},
|
|
40
56
|
{
|
|
41
57
|
id: "skip",
|
|
42
58
|
title: t("vlite.importData.optSkipNewTitle", "Skip"),
|
|
43
|
-
description: t(
|
|
59
|
+
description: t(
|
|
60
|
+
"vlite.importData.optSkipNewDesc",
|
|
61
|
+
"Ignores the row if it does not already exist."
|
|
62
|
+
),
|
|
44
63
|
icon: "lucide:ban"
|
|
45
64
|
}
|
|
46
65
|
]);
|
|
@@ -3,7 +3,7 @@ import L from "./Icon.vue.js";
|
|
|
3
3
|
import v from "./Modal.vue.js";
|
|
4
4
|
import N from "./CommandPalette/CommandPaletteContent.vue.js";
|
|
5
5
|
import { $t as U } from "../utils/i18n.js";
|
|
6
|
-
/* empty css
|
|
6
|
+
/* empty css */
|
|
7
7
|
const V = { class: "block truncate -text-fs-1.5" }, S = { class: "ml-auto inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-mono font-medium border border-border/80 bg-background text-muted-foreground ml-1" }, A = /* @__PURE__ */ x({
|
|
8
8
|
__name: "NavbarCommandPalette",
|
|
9
9
|
props: {
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
--color-border: '';
|
|
18
18
|
--color-input: '';
|
|
19
19
|
--color-card: '';
|
|
20
|
+
--color-card-light: '';
|
|
20
21
|
--color-secondary: '';
|
|
21
22
|
--color-secondary-foreground: '';
|
|
22
23
|
--color-muted: '';
|
|
@@ -651,12 +652,16 @@
|
|
|
651
652
|
.dark .bg-card-light {
|
|
652
653
|
--color-body: #121212 !important;
|
|
653
654
|
--color-white: #121212 !important;
|
|
655
|
+
--color-mixture-1: #1b1b1b !important;
|
|
656
|
+
--color-mixture-2: #ffffff !important;
|
|
654
657
|
background-color: #121212 !important;
|
|
655
658
|
}
|
|
656
659
|
|
|
657
660
|
.dark .bg-card .bg-card-light {
|
|
658
661
|
--color-body: #1a1a1a !important;
|
|
659
662
|
--color-white: #1a1a1a !important;
|
|
663
|
+
--color-mixture-1: #232323 !important;
|
|
664
|
+
--color-mixture-2: #000000;
|
|
660
665
|
background-color: #1a1a1a !important;
|
|
661
666
|
}
|
|
662
667
|
|
package/utils/functions.js
CHANGED
|
@@ -34,7 +34,11 @@ function h(t) {
|
|
|
34
34
|
Object?.values(r)?.flatMap?.((n) => typeof n == "object" ? h([n]) : [n])
|
|
35
35
|
) : e.concat(r), []);
|
|
36
36
|
}
|
|
37
|
-
const F = (t) => typeof t == "string" ? t?.replace(/(^\w|[.!?]\s+\w)/g, (e) => e.toUpperCase()) : t, N = (t) =>
|
|
37
|
+
const F = (t) => typeof t == "string" ? t?.replace(/(^\w|[.!?]\s+\w)/g, (e) => e.toUpperCase()) : t, N = (t) => {
|
|
38
|
+
if (!t || typeof t != "string") return "";
|
|
39
|
+
const e = t.replace(/\s+/g, "");
|
|
40
|
+
return e[0]?.toLowerCase() + e.slice(1);
|
|
41
|
+
};
|
|
38
42
|
function D(t, e) {
|
|
39
43
|
let r = null, n = null, o = null;
|
|
40
44
|
const s = () => {
|
|
@@ -137,10 +141,10 @@ const E = (t, e = {}) => {
|
|
|
137
141
|
const n = m?.components?.datetime?.format || "MMM DD, YYYY", o = t ? c(t).format(n) : "";
|
|
138
142
|
let s = e;
|
|
139
143
|
if (e) {
|
|
140
|
-
const [i,
|
|
141
|
-
if (i &&
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
+
const [i, l] = e.split(":");
|
|
145
|
+
if (i && l) {
|
|
146
|
+
const d = c().hour(Number(i)).minute(Number(l));
|
|
147
|
+
d.isValid() && (s = d.format("hh:mm"));
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
let a = r;
|
|
File without changes
|