vlite3 1.4.32 → 1.4.34
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/README.md +7 -0
- package/components/Alert.vue.js +45 -40
- package/components/Barcode/Barcode.vue.js +34 -21
- package/components/CategoryManager/CategoryNode.vue.js +30 -30
- package/components/CategoryMenu/CategoryMenu.vue.js +9 -11
- package/components/Chart/GanttChart.vue.d.ts +5 -1
- package/components/Chart/GanttChart.vue.js +2 -2
- package/components/Chart/GanttChart.vue2.js +977 -812
- package/components/Chart/GanttChartConnectorRouting.d.ts +83 -0
- package/components/Chart/GanttChartConnectorRouting.js +405 -0
- package/components/Chart/GanttChartDependencyUtils.js +43 -47
- package/components/Chart/types.d.ts +16 -1
- package/components/ColorPicker/ColorIro.vue2.js +78 -64
- package/components/ColorPicker/ColorPicker.vue.d.ts +5 -0
- package/components/ColorPicker/ColorPicker.vue.js +110 -64
- package/components/ColorPicker/constants.d.ts +2 -0
- package/components/ColorPicker/constants.js +4 -0
- package/components/ColorPicker/index.d.ts +1 -0
- package/components/Dropdown/Dropdown.vue.js +100 -97
- package/components/ExportData/ExportData.vue.js +85 -63
- package/components/FilePreview/FilePreview.vue.js +31 -13
- package/components/Form/FormField.vue.js +9 -8
- package/components/ImportData/ImportStep1.vue.js +80 -75
- package/components/Kanban/Kanban.vue.d.ts +16 -2
- package/components/Kanban/Kanban.vue.js +2 -2
- package/components/Kanban/Kanban.vue2.js +150 -86
- package/components/Kanban/types.d.ts +37 -0
- package/components/QRCode/QRCode.vue.js +31 -26
- package/components/ToastNotification.vue.js +1 -1
- package/components/ToastNotification.vue2.js +3 -3
- package/components/index.d.ts +1 -1
- package/composables/useKeyStroke.d.ts +18 -0
- package/composables/useKeyStroke.js +103 -77
- package/composables/useTheme.js +1 -1
- package/directives/vScrollReveal.js +23 -18
- package/index.d.ts +1 -0
- package/index.js +235 -233
- package/package.json +11 -4
- package/style.css +1 -1
- package/utils/UtilsModuleInterop.d.ts +6 -0
- package/utils/UtilsModuleInterop.js +9 -0
- package/utils/environment.d.ts +29 -0
- package/utils/environment.js +4 -0
- package/utils/functions.js +14 -13
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as re, ref as a, computed as u, inject as de, onMounted as ue, onUnmounted as ce, watch as x, provide as L, reactive as fe, toRefs as me, openBlock as N, createElementBlock as ve, normalizeStyle as ye, createVNode as R, unref as c, withCtx as m, createBlock as j, normalizeClass as he, createSlots as ge, renderSlot as v, normalizeProps as z, guardReactiveProps as U, createCommentVNode as q, createElementVNode as be } from "vue";
|
|
2
|
+
import Ce from "v-tooltip-lite";
|
|
3
3
|
import "v-tooltip-lite/style.css";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { useDropdownIds as
|
|
8
|
-
import { useDropdownSelection as
|
|
9
|
-
import { useDropdownHydration as
|
|
10
|
-
const
|
|
4
|
+
import pe from "./DropdownMenu.vue.js";
|
|
5
|
+
import Se from "./DropdownTrigger.vue.js";
|
|
6
|
+
import we from "../ConfirmationModal.vue.js";
|
|
7
|
+
import { useDropdownIds as Oe } from "./composables/useDropdownIds.js";
|
|
8
|
+
import { useDropdownSelection as $e } from "./composables/useDropdownSelection.js";
|
|
9
|
+
import { useDropdownHydration as Ie } from "./composables/useDropdownHydration.js";
|
|
10
|
+
const Ve = /* @__PURE__ */ re({
|
|
11
11
|
__name: "Dropdown",
|
|
12
12
|
props: {
|
|
13
13
|
selected: {},
|
|
@@ -54,63 +54,65 @@ const He = /* @__PURE__ */ ae({
|
|
|
54
54
|
trigger: { default: "click" }
|
|
55
55
|
},
|
|
56
56
|
emits: ["onSelect", "update:modelValue", "onOpen", "onClose", "update:isOpen", "load-more", "search"],
|
|
57
|
-
setup(t, { emit:
|
|
58
|
-
const
|
|
57
|
+
setup(t, { emit: F }) {
|
|
58
|
+
const n = t, y = F, h = a(!1), g = a(null), G = u(() => n.doubleConfirmation || h.value ? !0 : (n.options ?? []).some(
|
|
59
|
+
(e) => typeof e == "object" && e !== null && !!e.confirmation
|
|
60
|
+
)), r = a({
|
|
59
61
|
title: "Confirm Selection",
|
|
60
62
|
description: "Are you sure you want to select this option?",
|
|
61
63
|
confirmText: "Confirm",
|
|
62
64
|
cancelText: "Cancel",
|
|
63
65
|
variant: "primary"
|
|
64
|
-
}),
|
|
66
|
+
}), J = u(() => n.position ? n.position : n.direction === "rtl" ? "bottom-end" : "bottom-start"), K = u(() => n.nestedPosition ? n.nestedPosition : n.direction === "rtl" ? "left-start" : "right-start"), C = a(n.isOpen || !1), p = a(0), Q = a(null), O = a(null), $ = () => {
|
|
65
67
|
O.value && setTimeout(() => {
|
|
66
68
|
O.value?.focus({ preventScroll: !0 });
|
|
67
69
|
}, 10);
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
|
|
70
|
+
}, X = `dropdown-${Math.random().toString(36).substring(2, 9)}`, I = u(() => n.menuId || X), b = a([]), s = de("dropdown-context", null), Y = (e) => {
|
|
71
|
+
b.value.includes(e) || b.value.push(e), s?.registerChildId?.(e);
|
|
72
|
+
}, Z = (e) => {
|
|
73
|
+
b.value = b.value.filter((o) => o !== e), s?.unregisterChildId?.(e);
|
|
72
74
|
};
|
|
73
|
-
|
|
75
|
+
ue(() => {
|
|
74
76
|
s?.registerChildId && s.registerChildId(`#${I.value}`);
|
|
75
|
-
}),
|
|
77
|
+
}), ce(() => {
|
|
76
78
|
s?.unregisterChildId && s.unregisterChildId(`#${I.value}`);
|
|
77
79
|
}), x(
|
|
78
|
-
() =>
|
|
80
|
+
() => n.isOpen,
|
|
79
81
|
(e) => {
|
|
80
82
|
if (e !== void 0) {
|
|
81
|
-
if ((
|
|
83
|
+
if ((n.disabled || n.readonly) && e) return;
|
|
82
84
|
C.value = e;
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
);
|
|
86
88
|
const A = (e) => {
|
|
87
|
-
if (
|
|
88
|
-
C.value = !1,
|
|
89
|
+
if (n.disabled || n.readonly) {
|
|
90
|
+
C.value = !1, y("update:isOpen", !1);
|
|
89
91
|
return;
|
|
90
92
|
}
|
|
91
|
-
C.value = e,
|
|
93
|
+
C.value = e, y("update:isOpen", e), y(e ? "onOpen" : "onClose"), s?.onChildToggle?.(e);
|
|
92
94
|
}, S = () => {
|
|
93
95
|
A(!1);
|
|
94
|
-
},
|
|
96
|
+
}, _ = (e) => {
|
|
95
97
|
e ? p.value++ : p.value = Math.max(0, p.value - 1);
|
|
96
98
|
};
|
|
97
99
|
L("dropdown-context", {
|
|
98
100
|
close: S,
|
|
99
101
|
onChildToggle: (e) => {
|
|
100
|
-
|
|
102
|
+
_(e), s?.onChildToggle?.(e);
|
|
101
103
|
},
|
|
102
|
-
registerChildId:
|
|
103
|
-
unregisterChildId:
|
|
104
|
+
registerChildId: Y,
|
|
105
|
+
unregisterChildId: Z
|
|
104
106
|
}), L("modal-context", null);
|
|
105
|
-
const k =
|
|
107
|
+
const k = u(() => n.options ? n.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []), w = a([]), E = a(!1), T = a(!1);
|
|
106
108
|
x(
|
|
107
109
|
k,
|
|
108
110
|
(e) => {
|
|
109
111
|
if (e) {
|
|
110
|
-
if (
|
|
112
|
+
if (n.remote) {
|
|
111
113
|
const o = [...w.value];
|
|
112
|
-
e.forEach((
|
|
113
|
-
o.some((i) => i.value !== void 0 &&
|
|
114
|
+
e.forEach((l) => {
|
|
115
|
+
o.some((i) => i.value !== void 0 && l.value !== void 0 ? typeof i.value == "object" && i.key && l.key ? i.key === l.key && i.value[i.key] === l.value[l.key] : i.value === l.value : i.label === l.label) || o.push(l);
|
|
114
116
|
}), w.value = o;
|
|
115
117
|
} else
|
|
116
118
|
w.value = e;
|
|
@@ -121,24 +123,24 @@ const He = /* @__PURE__ */ ae({
|
|
|
121
123
|
},
|
|
122
124
|
{ immediate: !0 }
|
|
123
125
|
);
|
|
124
|
-
const
|
|
125
|
-
const e = [...w.value], o = new Set(e.map((
|
|
126
|
-
return B.value.forEach((
|
|
127
|
-
o.has(d) || (e.unshift(
|
|
126
|
+
const f = u(() => {
|
|
127
|
+
const e = [...w.value], o = new Set(e.map((l) => l.value ?? l.label));
|
|
128
|
+
return B.value.forEach((l, d) => {
|
|
129
|
+
o.has(d) || (e.unshift(l), o.add(d));
|
|
128
130
|
}), e;
|
|
129
|
-
}), { selectedBuffer: B, isHydrating:
|
|
130
|
-
fetchSelected:
|
|
131
|
-
getAvailableOptions: () =>
|
|
131
|
+
}), { selectedBuffer: B, isHydrating: ee, hydrateSelected: H } = Ie({
|
|
132
|
+
fetchSelected: n.fetchSelected,
|
|
133
|
+
getAvailableOptions: () => f.value,
|
|
132
134
|
isReady: () => T.value
|
|
133
|
-
}), { getAllRecursiveIds:
|
|
134
|
-
...
|
|
135
|
-
options:
|
|
136
|
-
}), { currentValue: M, selectedLabel: V, selectedIcon: W, selectOption:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
),
|
|
140
|
-
const e =
|
|
141
|
-
return [.../* @__PURE__ */ new Set([...e, ...o, ...
|
|
135
|
+
}), { getAllRecursiveIds: te } = Oe(), ne = fe({
|
|
136
|
+
...me(n),
|
|
137
|
+
options: f
|
|
138
|
+
}), { currentValue: M, selectedLabel: V, selectedIcon: W, selectOption: le } = $e(
|
|
139
|
+
ne,
|
|
140
|
+
y
|
|
141
|
+
), oe = u(() => {
|
|
142
|
+
const e = n.ignoreClickOutside || [], o = te(f.value);
|
|
143
|
+
return [.../* @__PURE__ */ new Set([...e, ...o, ...b.value])];
|
|
142
144
|
});
|
|
143
145
|
x(
|
|
144
146
|
() => M.value,
|
|
@@ -147,9 +149,9 @@ const He = /* @__PURE__ */ ae({
|
|
|
147
149
|
},
|
|
148
150
|
{ deep: !0 }
|
|
149
151
|
);
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
|
|
152
|
+
const ae = (e) => {
|
|
153
|
+
if (n.disabled || n.readonly || e.disabled) return;
|
|
154
|
+
n.doubleConfirmation || !!e.confirmation ? (g.value = e, typeof e.confirmation == "object" ? r.value = {
|
|
153
155
|
title: e.confirmation.title || "Confirm Selection",
|
|
154
156
|
description: e.confirmation.description || "Are you sure you want to select this option?",
|
|
155
157
|
confirmText: e.confirmation.confirmText || "Confirm",
|
|
@@ -161,50 +163,50 @@ const He = /* @__PURE__ */ ae({
|
|
|
161
163
|
confirmText: "Confirm",
|
|
162
164
|
cancelText: "Cancel",
|
|
163
165
|
variant: "primary"
|
|
164
|
-
},
|
|
166
|
+
}, h.value = !0, S()) : (D(e), n.closeOnSelect && (S(), $()));
|
|
165
167
|
}, D = (e) => {
|
|
166
|
-
if (
|
|
168
|
+
if (n.disabled || n.readonly || e.disabled) return;
|
|
167
169
|
const o = e.value ?? e.label;
|
|
168
170
|
B.value.has(o) || B.value.set(o, e);
|
|
169
|
-
const
|
|
170
|
-
if (!
|
|
171
|
+
const l = le(e);
|
|
172
|
+
if (!n.isNested) {
|
|
171
173
|
const d = e._originalOption || e, i = d.value ?? d.label;
|
|
172
174
|
(e._path || [d]).forEach((P) => {
|
|
173
175
|
typeof P.onSelect == "function" && P.onSelect({
|
|
174
176
|
value: i,
|
|
175
177
|
option: P,
|
|
176
|
-
data:
|
|
177
|
-
values:
|
|
178
|
+
data: f.value || [],
|
|
179
|
+
values: l
|
|
178
180
|
});
|
|
179
181
|
});
|
|
180
182
|
}
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
|
|
183
|
+
}, ie = () => {
|
|
184
|
+
g.value && (D(g.value), g.value = null, h.value = !1, $());
|
|
185
|
+
}, se = () => {
|
|
186
|
+
g.value = null, h.value = !1, $();
|
|
185
187
|
};
|
|
186
|
-
return (e, o) => (
|
|
188
|
+
return (e, o) => (N(), ve("div", {
|
|
187
189
|
class: "relative inline-block text-left",
|
|
188
|
-
style:
|
|
190
|
+
style: ye({ direction: t.direction }),
|
|
189
191
|
ref_key: "dropdownWrapper",
|
|
190
|
-
ref:
|
|
192
|
+
ref: Q
|
|
191
193
|
}, [
|
|
192
|
-
|
|
194
|
+
R(c(Ce), {
|
|
193
195
|
content: "",
|
|
194
196
|
trigger: t.trigger,
|
|
195
197
|
arrow: !1,
|
|
196
198
|
disabled: t.disabled || t.readonly,
|
|
197
199
|
teleport: t.teleport,
|
|
198
200
|
offset: t.offset,
|
|
199
|
-
placement:
|
|
201
|
+
placement: J.value,
|
|
200
202
|
isOpen: C.value,
|
|
201
203
|
keepAlive: p.value > 0,
|
|
202
204
|
menuId: I.value,
|
|
203
|
-
ignoreClickOutside:
|
|
205
|
+
ignoreClickOutside: oe.value,
|
|
204
206
|
class: "w-full flex!",
|
|
205
207
|
className: "dropdown " + (t.className || "") + (t.variant === "transparent" ? " unstyled-dropdown" : "") + (t.variant === "secondary" ? " dropdown-secondary" : ""),
|
|
206
|
-
onOnShow: o[2] || (o[2] = (
|
|
207
|
-
onOnHide: o[3] || (o[3] = (
|
|
208
|
+
onOnShow: o[2] || (o[2] = (l) => e.$emit("onOpen")),
|
|
209
|
+
onOnHide: o[3] || (o[3] = (l) => e.$emit("onClose")),
|
|
208
210
|
"onUpdate:isOpen": A,
|
|
209
211
|
triggerClass: "w-full flex items-center",
|
|
210
212
|
styles: {
|
|
@@ -215,16 +217,16 @@ const He = /* @__PURE__ */ ae({
|
|
|
215
217
|
...t.variant === "transparent" ? { background: "transparent", border: "none", boxShadow: "none" } : {}
|
|
216
218
|
}
|
|
217
219
|
}, {
|
|
218
|
-
trigger: m(({ isOpen:
|
|
219
|
-
v(e.$slots, "trigger", z(
|
|
220
|
-
selectedLabel:
|
|
221
|
-
selectedIcon: t.showSelectedIcon ?
|
|
222
|
-
isOpen:
|
|
220
|
+
trigger: m(({ isOpen: l }) => [
|
|
221
|
+
v(e.$slots, "trigger", z(U({
|
|
222
|
+
selectedLabel: c(V),
|
|
223
|
+
selectedIcon: t.showSelectedIcon ? c(W) : void 0,
|
|
224
|
+
isOpen: l
|
|
223
225
|
})), () => [
|
|
224
|
-
|
|
225
|
-
"selected-label":
|
|
226
|
-
"selected-icon": t.showSelectedIcon ?
|
|
227
|
-
"is-open":
|
|
226
|
+
R(Se, {
|
|
227
|
+
"selected-label": c(V),
|
|
228
|
+
"selected-icon": t.showSelectedIcon ? c(W) : void 0,
|
|
229
|
+
"is-open": l,
|
|
228
230
|
direction: t.direction,
|
|
229
231
|
disabled: t.disabled,
|
|
230
232
|
readonly: t.readonly,
|
|
@@ -234,34 +236,34 @@ const He = /* @__PURE__ */ ae({
|
|
|
234
236
|
])
|
|
235
237
|
]),
|
|
236
238
|
default: m(() => [
|
|
237
|
-
!(t.disabled || t.readonly) && (k.value.length ||
|
|
239
|
+
!(t.disabled || t.readonly) && (k.value.length || f.value.length || e.$slots.menu || e.$slots.item || e.$slots.default || t.remote || t.searchable) ? (N(), j(pe, {
|
|
238
240
|
key: 0,
|
|
239
241
|
options: k.value,
|
|
240
|
-
cachedOptions:
|
|
241
|
-
class:
|
|
242
|
+
cachedOptions: f.value,
|
|
243
|
+
class: he(t.className),
|
|
242
244
|
emptyMessage: t.emptyMessage,
|
|
243
245
|
searchEmptyMessage: t.searchEmptyMessage,
|
|
244
|
-
selected:
|
|
246
|
+
selected: c(M),
|
|
245
247
|
selectedIndex: t.selectedIndex,
|
|
246
248
|
maxHeight: t.maxHeight,
|
|
247
|
-
nestedPosition:
|
|
249
|
+
nestedPosition: K.value,
|
|
248
250
|
nestedOffset: t.nestedOffset,
|
|
249
251
|
selectable: t.selectable,
|
|
250
252
|
direction: t.direction,
|
|
251
253
|
isCustomSlotMenu: !!e.$slots?.default || !!e.$slots?.menu,
|
|
252
254
|
layout: t.layout,
|
|
253
255
|
columns: t.columns,
|
|
254
|
-
loading: t.loading ||
|
|
256
|
+
loading: t.loading || c(ee),
|
|
255
257
|
hasMore: t.hasMore,
|
|
256
258
|
searchable: t.searchable,
|
|
257
259
|
remote: t.remote,
|
|
258
260
|
debounceTime: t.debounceTime,
|
|
259
261
|
trigger: t.trigger,
|
|
260
|
-
onSelect:
|
|
262
|
+
onSelect: ae,
|
|
261
263
|
onClose: S,
|
|
262
|
-
onLoadMore: o[0] || (o[0] = (
|
|
263
|
-
onSearch: o[1] || (o[1] = (
|
|
264
|
-
},
|
|
264
|
+
onLoadMore: o[0] || (o[0] = (l) => e.$emit("load-more")),
|
|
265
|
+
onSearch: o[1] || (o[1] = (l) => e.$emit("search", l))
|
|
266
|
+
}, ge({ _: 2 }, [
|
|
265
267
|
e.$slots.menu || e.$slots?.default ? {
|
|
266
268
|
name: "menu",
|
|
267
269
|
fn: m(() => [
|
|
@@ -272,8 +274,8 @@ const He = /* @__PURE__ */ ae({
|
|
|
272
274
|
} : void 0,
|
|
273
275
|
e.$slots.item ? {
|
|
274
276
|
name: "item",
|
|
275
|
-
fn: m((
|
|
276
|
-
v(e.$slots, "item", z(
|
|
277
|
+
fn: m((l) => [
|
|
278
|
+
v(e.$slots, "item", z(U(l)))
|
|
277
279
|
]),
|
|
278
280
|
key: "1"
|
|
279
281
|
} : void 0,
|
|
@@ -291,21 +293,22 @@ const He = /* @__PURE__ */ ae({
|
|
|
291
293
|
]),
|
|
292
294
|
key: "3"
|
|
293
295
|
} : void 0
|
|
294
|
-
]), 1032, ["options", "cachedOptions", "class", "emptyMessage", "searchEmptyMessage", "selected", "selectedIndex", "maxHeight", "nestedPosition", "nestedOffset", "selectable", "direction", "isCustomSlotMenu", "layout", "columns", "loading", "hasMore", "searchable", "remote", "debounceTime", "trigger"])) :
|
|
296
|
+
]), 1032, ["options", "cachedOptions", "class", "emptyMessage", "searchEmptyMessage", "selected", "selectedIndex", "maxHeight", "nestedPosition", "nestedOffset", "selectable", "direction", "isCustomSlotMenu", "layout", "columns", "loading", "hasMore", "searchable", "remote", "debounceTime", "trigger"])) : q("", !0)
|
|
295
297
|
]),
|
|
296
298
|
_: 3
|
|
297
299
|
}, 8, ["trigger", "disabled", "teleport", "offset", "placement", "isOpen", "keepAlive", "menuId", "ignoreClickOutside", "className", "styles"]),
|
|
298
|
-
N(
|
|
299
|
-
|
|
300
|
+
G.value ? (N(), j(we, {
|
|
301
|
+
key: 0,
|
|
302
|
+
show: h.value,
|
|
300
303
|
title: r.value.title,
|
|
301
304
|
description: r.value.description,
|
|
302
305
|
"confirm-text": r.value.confirmText,
|
|
303
306
|
"cancel-text": r.value.cancelText,
|
|
304
307
|
variant: r.value.variant,
|
|
305
|
-
onConfirm:
|
|
306
|
-
onCancel:
|
|
307
|
-
}, null, 8, ["show", "title", "description", "confirm-text", "cancel-text", "variant"]),
|
|
308
|
-
|
|
308
|
+
onConfirm: ie,
|
|
309
|
+
onCancel: se
|
|
310
|
+
}, null, 8, ["show", "title", "description", "confirm-text", "cancel-text", "variant"])) : q("", !0),
|
|
311
|
+
be("span", {
|
|
309
312
|
ref_key: "focusTrapAfter",
|
|
310
313
|
ref: O,
|
|
311
314
|
tabindex: "-1",
|
|
@@ -316,5 +319,5 @@ const He = /* @__PURE__ */ ae({
|
|
|
316
319
|
}
|
|
317
320
|
});
|
|
318
321
|
export {
|
|
319
|
-
|
|
322
|
+
Ve as default
|
|
320
323
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import N from "papaparse";
|
|
4
|
-
import { saveAs as b } from "file-saver";
|
|
5
|
-
import w from "../Button.vue.js";
|
|
1
|
+
import { defineComponent as N, computed as k, openBlock as c, createElementBlock as E, createBlock as v, withCtx as w, createElementVNode as u, toDisplayString as g, Fragment as V, renderList as A, createVNode as D } from "vue";
|
|
2
|
+
import b from "../Button.vue.js";
|
|
6
3
|
import I from "../Modal.vue.js";
|
|
7
4
|
import O from "../Icon.vue.js";
|
|
8
5
|
import { showToast as p } from "../../composables/useNotifications.js";
|
|
9
|
-
import { $t as
|
|
10
|
-
|
|
6
|
+
import { $t as F } from "../../utils/i18n.js";
|
|
7
|
+
import { resolveModuleRuntime as h } from "../../utils/UtilsModuleInterop.js";
|
|
8
|
+
const R = { class: "px-1 py-1 text-sm" }, L = { class: "font-medium mb-3 text-muted-foreground" }, M = { class: "space-y-3" }, H = /* @__PURE__ */ N({
|
|
11
9
|
__name: "ExportData",
|
|
12
10
|
props: {
|
|
13
11
|
data: {},
|
|
@@ -20,105 +18,129 @@ const V = { class: "px-1 py-1 text-sm" }, U = { class: "font-medium mb-3 text-mu
|
|
|
20
18
|
mode: { default: "frontend" },
|
|
21
19
|
onExport: {}
|
|
22
20
|
},
|
|
23
|
-
setup(
|
|
24
|
-
const
|
|
25
|
-
const o =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
setup(s, { expose: B }) {
|
|
22
|
+
const S = async () => {
|
|
23
|
+
const o = await import("xlsx"), e = h(
|
|
24
|
+
o,
|
|
25
|
+
(t) => !!(t && typeof t == "object" && "utils" in t && "write" in t && typeof t.write == "function")
|
|
26
|
+
);
|
|
27
|
+
if (!e)
|
|
28
|
+
throw new Error("The spreadsheet export runtime is unavailable.");
|
|
29
|
+
return e;
|
|
30
|
+
}, C = async () => {
|
|
31
|
+
const o = await import("papaparse"), e = h(
|
|
32
|
+
o,
|
|
33
|
+
(t) => !!(t && typeof t == "object" && "unparse" in t && typeof t.unparse == "function")
|
|
34
|
+
);
|
|
35
|
+
if (!e)
|
|
36
|
+
throw new Error("The CSV export runtime is unavailable.");
|
|
37
|
+
return e;
|
|
38
|
+
}, m = async (o, e) => {
|
|
39
|
+
const t = await import("file-saver"), r = t, a = h(
|
|
40
|
+
t,
|
|
41
|
+
(l) => typeof l == "function"
|
|
42
|
+
) || r.saveAs || r.default?.saveAs;
|
|
43
|
+
if (!a)
|
|
44
|
+
throw new Error("The file download runtime is unavailable.");
|
|
45
|
+
a(o, e);
|
|
46
|
+
}, n = s, i = (o, e, t) => {
|
|
47
|
+
const r = t ? F(o, t) : F(o);
|
|
48
|
+
return r !== o ? r : e;
|
|
49
|
+
}, $ = (o, e) => {
|
|
50
|
+
if (!(!o || !e))
|
|
51
|
+
return e.includes(".") ? e.split(".").reduce((t, r) => t?.[r], o) : o[e];
|
|
52
|
+
}, y = k(() => [
|
|
31
53
|
{ label: "Excel (.xlsx)", value: "excel", icon: "lucide:file-spreadsheet" },
|
|
32
54
|
{ label: "CSV (.csv)", value: "csv", icon: "lucide:file-text" },
|
|
33
55
|
{ label: "JSON (.json)", value: "json", icon: "lucide:file-json" }
|
|
34
|
-
].filter((e) =>
|
|
56
|
+
].filter((e) => n.formats.includes(e.value))), j = () => n.data.map((o) => {
|
|
35
57
|
const e = {};
|
|
36
|
-
return
|
|
37
|
-
const
|
|
38
|
-
t.format ? e[t.title] = t.format(
|
|
58
|
+
return n.fields.forEach((t) => {
|
|
59
|
+
const r = $(o, t.field);
|
|
60
|
+
t.format ? e[t.title] = t.format(r, o) : e[t.title] = r ?? "";
|
|
39
61
|
}), e;
|
|
40
|
-
}),
|
|
41
|
-
if (
|
|
62
|
+
}), f = async (o, e) => {
|
|
63
|
+
if (n.mode === "backend" && n.onExport)
|
|
42
64
|
try {
|
|
43
|
-
await
|
|
65
|
+
await n.onExport(o), e && e();
|
|
44
66
|
return;
|
|
45
67
|
} catch (t) {
|
|
46
|
-
console.error("Backend export error:", t), p(
|
|
68
|
+
console.error("Backend export error:", t), p(i("vlite.exportData.error", "An error occurred while exporting data."), "error");
|
|
47
69
|
return;
|
|
48
70
|
}
|
|
49
|
-
if (!
|
|
50
|
-
p(
|
|
71
|
+
if (!n.data || n.data.length === 0) {
|
|
72
|
+
p(i("vlite.exportData.noData", "No data available to export."), "warning");
|
|
51
73
|
return;
|
|
52
74
|
}
|
|
53
75
|
try {
|
|
54
|
-
const t =
|
|
55
|
-
switch (
|
|
76
|
+
const t = n.filename ? n.filename : `${n.title.toLowerCase().replace(/\s+/g, "-")}-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`, r = j();
|
|
77
|
+
switch (o) {
|
|
56
78
|
case "excel": {
|
|
57
|
-
const l =
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
79
|
+
const a = await S(), l = a.utils.book_new(), x = a.utils.json_to_sheet(r);
|
|
80
|
+
a.utils.book_append_sheet(l, x, n.title.substring(0, 31));
|
|
81
|
+
const d = a.write(l, { bookType: "xlsx", type: "array" }), _ = new Blob([d], { type: "application/octet-stream" });
|
|
82
|
+
await m(_, `${t}.xlsx`);
|
|
61
83
|
break;
|
|
62
84
|
}
|
|
63
85
|
case "csv": {
|
|
64
|
-
const
|
|
65
|
-
|
|
86
|
+
const a = await C(), l = "\uFEFF", x = a.unparse(r), d = new Blob([l + x], { type: "text/csv;charset=utf-8;" });
|
|
87
|
+
await m(d, `${t}.csv`);
|
|
66
88
|
break;
|
|
67
89
|
}
|
|
68
90
|
case "json": {
|
|
69
|
-
const
|
|
70
|
-
|
|
91
|
+
const a = JSON.stringify(r, null, 2), l = new Blob([a], { type: "application/json" });
|
|
92
|
+
await m(l, `${t}.json`);
|
|
71
93
|
break;
|
|
72
94
|
}
|
|
73
95
|
}
|
|
74
96
|
p(
|
|
75
|
-
|
|
76
|
-
format:
|
|
97
|
+
i("vlite.exportData.success", `Data exported successfully as ${o.toUpperCase()}`, {
|
|
98
|
+
format: o.toUpperCase()
|
|
77
99
|
}),
|
|
78
100
|
"success"
|
|
79
101
|
), e && e();
|
|
80
102
|
} catch (t) {
|
|
81
|
-
console.error("Export error:", t), p(
|
|
103
|
+
console.error("Export error:", t), p(i("vlite.exportData.error", "An error occurred while exporting data."), "error");
|
|
82
104
|
}
|
|
83
|
-
},
|
|
84
|
-
return
|
|
85
|
-
exportData:
|
|
86
|
-
availableFormats:
|
|
87
|
-
}), (
|
|
88
|
-
|
|
105
|
+
}, T = k(() => i("vlite.exportData.selectFormat", "Select Export Format"));
|
|
106
|
+
return B({
|
|
107
|
+
exportData: f,
|
|
108
|
+
availableFormats: y
|
|
109
|
+
}), (o, e) => (c(), E("div", null, [
|
|
110
|
+
s.formats.length === 1 ? (c(), v(b, {
|
|
89
111
|
key: 0,
|
|
90
|
-
text:
|
|
91
|
-
icon:
|
|
112
|
+
text: s.buttonText,
|
|
113
|
+
icon: s.buttonIcon,
|
|
92
114
|
variant: "outline",
|
|
93
|
-
onClick: e[0] || (e[0] = (t) =>
|
|
94
|
-
}, null, 8, ["text", "icon"])) : (
|
|
115
|
+
onClick: e[0] || (e[0] = (t) => f(s.formats[0]))
|
|
116
|
+
}, null, 8, ["text", "icon"])) : (c(), v(I, {
|
|
95
117
|
key: 1,
|
|
96
|
-
title:
|
|
118
|
+
title: s.title,
|
|
97
119
|
"max-width": "sm:max-w-[400px]"
|
|
98
120
|
}, {
|
|
99
|
-
trigger:
|
|
100
|
-
D(
|
|
101
|
-
text:
|
|
102
|
-
icon:
|
|
121
|
+
trigger: w(() => [
|
|
122
|
+
D(b, {
|
|
123
|
+
text: s.buttonText,
|
|
124
|
+
icon: s.buttonIcon,
|
|
103
125
|
variant: "outline"
|
|
104
126
|
}, null, 8, ["text", "icon"])
|
|
105
127
|
]),
|
|
106
|
-
default:
|
|
107
|
-
u("div",
|
|
108
|
-
u("h6",
|
|
109
|
-
u("div",
|
|
110
|
-
(
|
|
111
|
-
key:
|
|
128
|
+
default: w(({ close: t }) => [
|
|
129
|
+
u("div", R, [
|
|
130
|
+
u("h6", L, g(T.value), 1),
|
|
131
|
+
u("div", M, [
|
|
132
|
+
(c(!0), E(V, null, A(y.value, (r) => (c(), v(b, {
|
|
133
|
+
key: r.value,
|
|
112
134
|
variant: "outline",
|
|
113
135
|
class: "w-full flex items-center justify-start gap-3 h-12",
|
|
114
|
-
onClick: (
|
|
136
|
+
onClick: (a) => f(r.value, t)
|
|
115
137
|
}, {
|
|
116
|
-
default:
|
|
138
|
+
default: w(() => [
|
|
117
139
|
D(O, {
|
|
118
|
-
icon:
|
|
140
|
+
icon: r.icon,
|
|
119
141
|
class: "text-muted-foreground h-5 w-5"
|
|
120
142
|
}, null, 8, ["icon"]),
|
|
121
|
-
u("span", null,
|
|
143
|
+
u("span", null, g(r.label), 1)
|
|
122
144
|
]),
|
|
123
145
|
_: 2
|
|
124
146
|
}, 1032, ["onClick"]))), 128))
|
|
@@ -1,27 +1,45 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { VFileViewer as d } from "v-file-preview";
|
|
1
|
+
import { defineComponent as c, shallowRef as n, onMounted as s, openBlock as l, createElementBlock as a, createElementVNode as i, createBlock as d, resolveDynamicComponent as u } from "vue";
|
|
3
2
|
import "v-file-preview/dist/style.css";
|
|
4
|
-
const
|
|
3
|
+
const m = { class: "flex flex-col h-[70vh] w-full min-h-[400px]" }, v = { class: "flex-1 relative bg-muted/10 rounded-lg border border-border overflow-hidden flex items-center justify-center" }, f = { class: "w-full h-full overflow-auto" }, w = {
|
|
4
|
+
key: 1,
|
|
5
|
+
class: "p-6 text-center text-sm text-muted",
|
|
6
|
+
role: "alert"
|
|
7
|
+
}, p = {
|
|
8
|
+
key: 2,
|
|
9
|
+
class: "p-6 text-center text-sm text-muted",
|
|
10
|
+
role: "status",
|
|
11
|
+
"aria-live": "polite"
|
|
12
|
+
}, y = /* @__PURE__ */ c({
|
|
5
13
|
__name: "FilePreview",
|
|
6
14
|
props: {
|
|
7
15
|
url: {},
|
|
8
16
|
name: {},
|
|
9
17
|
canDownload: { type: Boolean, default: !0 }
|
|
10
18
|
},
|
|
11
|
-
setup(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
setup(o) {
|
|
20
|
+
const r = n(null), t = n("loading");
|
|
21
|
+
return s(async () => {
|
|
22
|
+
try {
|
|
23
|
+
const e = await import("v-file-preview");
|
|
24
|
+
if (!e.VFileViewer) throw new Error("The file viewer component is unavailable.");
|
|
25
|
+
r.value = e.VFileViewer, t.value = "ready";
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error("File preview runtime failed to load.", e), t.value = "error";
|
|
28
|
+
}
|
|
29
|
+
}), (e, h) => (l(), a("div", m, [
|
|
30
|
+
i("div", v, [
|
|
31
|
+
i("div", f, [
|
|
32
|
+
t.value === "ready" && r.value ? (l(), d(u(r.value), {
|
|
33
|
+
key: 0,
|
|
34
|
+
url: o.url,
|
|
35
|
+
name: o.name,
|
|
36
|
+
"can-download": o.canDownload
|
|
37
|
+
}, null, 8, ["url", "name", "can-download"])) : t.value === "error" ? (l(), a("p", w, " This file preview is unavailable. ")) : (l(), a("p", p, " Loading file preview… "))
|
|
20
38
|
])
|
|
21
39
|
])
|
|
22
40
|
]));
|
|
23
41
|
}
|
|
24
42
|
});
|
|
25
43
|
export {
|
|
26
|
-
|
|
44
|
+
y as default
|
|
27
45
|
};
|