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.
Files changed (44) hide show
  1. package/README.md +7 -0
  2. package/components/Alert.vue.js +45 -40
  3. package/components/Barcode/Barcode.vue.js +34 -21
  4. package/components/CategoryManager/CategoryNode.vue.js +30 -30
  5. package/components/CategoryMenu/CategoryMenu.vue.js +9 -11
  6. package/components/Chart/GanttChart.vue.d.ts +5 -1
  7. package/components/Chart/GanttChart.vue.js +2 -2
  8. package/components/Chart/GanttChart.vue2.js +977 -812
  9. package/components/Chart/GanttChartConnectorRouting.d.ts +83 -0
  10. package/components/Chart/GanttChartConnectorRouting.js +405 -0
  11. package/components/Chart/GanttChartDependencyUtils.js +43 -47
  12. package/components/Chart/types.d.ts +16 -1
  13. package/components/ColorPicker/ColorIro.vue2.js +78 -64
  14. package/components/ColorPicker/ColorPicker.vue.d.ts +5 -0
  15. package/components/ColorPicker/ColorPicker.vue.js +110 -64
  16. package/components/ColorPicker/constants.d.ts +2 -0
  17. package/components/ColorPicker/constants.js +4 -0
  18. package/components/ColorPicker/index.d.ts +1 -0
  19. package/components/Dropdown/Dropdown.vue.js +100 -97
  20. package/components/ExportData/ExportData.vue.js +85 -63
  21. package/components/FilePreview/FilePreview.vue.js +31 -13
  22. package/components/Form/FormField.vue.js +9 -8
  23. package/components/ImportData/ImportStep1.vue.js +80 -75
  24. package/components/Kanban/Kanban.vue.d.ts +16 -2
  25. package/components/Kanban/Kanban.vue.js +2 -2
  26. package/components/Kanban/Kanban.vue2.js +150 -86
  27. package/components/Kanban/types.d.ts +37 -0
  28. package/components/QRCode/QRCode.vue.js +31 -26
  29. package/components/ToastNotification.vue.js +1 -1
  30. package/components/ToastNotification.vue2.js +3 -3
  31. package/components/index.d.ts +1 -1
  32. package/composables/useKeyStroke.d.ts +18 -0
  33. package/composables/useKeyStroke.js +103 -77
  34. package/composables/useTheme.js +1 -1
  35. package/directives/vScrollReveal.js +23 -18
  36. package/index.d.ts +1 -0
  37. package/index.js +235 -233
  38. package/package.json +11 -4
  39. package/style.css +1 -1
  40. package/utils/UtilsModuleInterop.d.ts +6 -0
  41. package/utils/UtilsModuleInterop.js +9 -0
  42. package/utils/environment.d.ts +29 -0
  43. package/utils/environment.js +4 -0
  44. package/utils/functions.js +14 -13
@@ -1,13 +1,13 @@
1
- import { defineComponent as ae, ref as a, computed as f, inject as ie, onMounted as se, onUnmounted as re, watch as x, provide as L, reactive as de, toRefs as ue, openBlock as R, createElementBlock as ce, normalizeStyle as fe, createVNode as N, unref as u, withCtx as m, createBlock as me, normalizeClass as ve, createSlots as he, renderSlot as v, normalizeProps as z, guardReactiveProps as j, createCommentVNode as ye, createElementVNode as ge } from "vue";
2
- import be from "v-tooltip-lite";
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 Ce from "./DropdownMenu.vue.js";
5
- import pe from "./DropdownTrigger.vue.js";
6
- import Se from "../ConfirmationModal.vue.js";
7
- import { useDropdownIds as we } from "./composables/useDropdownIds.js";
8
- import { useDropdownSelection as Oe } from "./composables/useDropdownSelection.js";
9
- import { useDropdownHydration as $e } from "./composables/useDropdownHydration.js";
10
- const He = /* @__PURE__ */ ae({
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: U }) {
58
- const l = t, h = U, b = a(!1), y = a(null), r = a({
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
- }), q = f(() => l.position ? l.position : l.direction === "rtl" ? "bottom-end" : "bottom-start"), F = f(() => l.nestedPosition ? l.nestedPosition : l.direction === "rtl" ? "left-start" : "right-start"), C = a(l.isOpen || !1), p = a(0), G = a(null), O = a(null), $ = () => {
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
- }, J = `dropdown-${Math.random().toString(36).substring(2, 9)}`, I = f(() => l.menuId || J), g = a([]), s = ie("dropdown-context", null), K = (e) => {
69
- g.value.includes(e) || g.value.push(e), s?.registerChildId?.(e);
70
- }, Q = (e) => {
71
- g.value = g.value.filter((o) => o !== e), s?.unregisterChildId?.(e);
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
- se(() => {
75
+ ue(() => {
74
76
  s?.registerChildId && s.registerChildId(`#${I.value}`);
75
- }), re(() => {
77
+ }), ce(() => {
76
78
  s?.unregisterChildId && s.unregisterChildId(`#${I.value}`);
77
79
  }), x(
78
- () => l.isOpen,
80
+ () => n.isOpen,
79
81
  (e) => {
80
82
  if (e !== void 0) {
81
- if ((l.disabled || l.readonly) && e) return;
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 (l.disabled || l.readonly) {
88
- C.value = !1, h("update:isOpen", !1);
89
+ if (n.disabled || n.readonly) {
90
+ C.value = !1, y("update:isOpen", !1);
89
91
  return;
90
92
  }
91
- C.value = e, h("update:isOpen", e), h(e ? "onOpen" : "onClose"), s?.onChildToggle?.(e);
93
+ C.value = e, y("update:isOpen", e), y(e ? "onOpen" : "onClose"), s?.onChildToggle?.(e);
92
94
  }, S = () => {
93
95
  A(!1);
94
- }, X = (e) => {
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
- X(e), s?.onChildToggle?.(e);
102
+ _(e), s?.onChildToggle?.(e);
101
103
  },
102
- registerChildId: K,
103
- unregisterChildId: Q
104
+ registerChildId: Y,
105
+ unregisterChildId: Z
104
106
  }), L("modal-context", null);
105
- const k = f(() => l.options ? l.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []), w = a([]), E = a(!1), T = a(!1);
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 (l.remote) {
112
+ if (n.remote) {
111
113
  const o = [...w.value];
112
- e.forEach((n) => {
113
- o.some((i) => i.value !== void 0 && n.value !== void 0 ? typeof i.value == "object" && i.key && n.key ? i.key === n.key && i.value[i.key] === n.value[n.key] : i.value === n.value : i.label === n.label) || o.push(n);
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 c = f(() => {
125
- const e = [...w.value], o = new Set(e.map((n) => n.value ?? n.label));
126
- return B.value.forEach((n, d) => {
127
- o.has(d) || (e.unshift(n), o.add(d));
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: Y, hydrateSelected: H } = $e({
130
- fetchSelected: l.fetchSelected,
131
- getAvailableOptions: () => c.value,
131
+ }), { selectedBuffer: B, isHydrating: ee, hydrateSelected: H } = Ie({
132
+ fetchSelected: n.fetchSelected,
133
+ getAvailableOptions: () => f.value,
132
134
  isReady: () => T.value
133
- }), { getAllRecursiveIds: Z } = we(), _ = de({
134
- ...ue(l),
135
- options: c
136
- }), { currentValue: M, selectedLabel: V, selectedIcon: W, selectOption: ee } = Oe(
137
- _,
138
- h
139
- ), te = f(() => {
140
- const e = l.ignoreClickOutside || [], o = Z(c.value);
141
- return [.../* @__PURE__ */ new Set([...e, ...o, ...g.value])];
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 le = (e) => {
151
- if (l.disabled || l.readonly || e.disabled) return;
152
- l.doubleConfirmation || !!e.confirmation ? (y.value = e, typeof e.confirmation == "object" ? r.value = {
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
- }, b.value = !0, S()) : (D(e), l.closeOnSelect && (S(), $()));
166
+ }, h.value = !0, S()) : (D(e), n.closeOnSelect && (S(), $()));
165
167
  }, D = (e) => {
166
- if (l.disabled || l.readonly || e.disabled) return;
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 n = ee(e);
170
- if (!l.isNested) {
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: c.value || [],
177
- values: n
178
+ data: f.value || [],
179
+ values: l
178
180
  });
179
181
  });
180
182
  }
181
- }, ne = () => {
182
- y.value && (D(y.value), y.value = null, b.value = !1, $());
183
- }, oe = () => {
184
- y.value = null, b.value = !1, $();
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) => (R(), ce("div", {
188
+ return (e, o) => (N(), ve("div", {
187
189
  class: "relative inline-block text-left",
188
- style: fe({ direction: t.direction }),
190
+ style: ye({ direction: t.direction }),
189
191
  ref_key: "dropdownWrapper",
190
- ref: G
192
+ ref: Q
191
193
  }, [
192
- N(u(be), {
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: q.value,
201
+ placement: J.value,
200
202
  isOpen: C.value,
201
203
  keepAlive: p.value > 0,
202
204
  menuId: I.value,
203
- ignoreClickOutside: te.value,
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] = (n) => e.$emit("onOpen")),
207
- onOnHide: o[3] || (o[3] = (n) => e.$emit("onClose")),
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: n }) => [
219
- v(e.$slots, "trigger", z(j({
220
- selectedLabel: u(V),
221
- selectedIcon: t.showSelectedIcon ? u(W) : void 0,
222
- isOpen: n
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
- N(pe, {
225
- "selected-label": u(V),
226
- "selected-icon": t.showSelectedIcon ? u(W) : void 0,
227
- "is-open": n,
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 || c.value.length || e.$slots.menu || e.$slots.item || e.$slots.default || t.remote || t.searchable) ? (R(), me(Ce, {
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: c.value,
241
- class: ve(t.className),
242
+ cachedOptions: f.value,
243
+ class: he(t.className),
242
244
  emptyMessage: t.emptyMessage,
243
245
  searchEmptyMessage: t.searchEmptyMessage,
244
- selected: u(M),
246
+ selected: c(M),
245
247
  selectedIndex: t.selectedIndex,
246
248
  maxHeight: t.maxHeight,
247
- nestedPosition: F.value,
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 || u(Y),
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: le,
262
+ onSelect: ae,
261
263
  onClose: S,
262
- onLoadMore: o[0] || (o[0] = (n) => e.$emit("load-more")),
263
- onSearch: o[1] || (o[1] = (n) => e.$emit("search", n))
264
- }, he({ _: 2 }, [
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((n) => [
276
- v(e.$slots, "item", z(j(n)))
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"])) : ye("", !0)
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(Se, {
299
- show: b.value,
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: ne,
306
- onCancel: oe
307
- }, null, 8, ["show", "title", "description", "confirm-text", "cancel-text", "variant"]),
308
- ge("span", {
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
- He as default
322
+ Ve as default
320
323
  };
@@ -1,13 +1,11 @@
1
- import { defineComponent as _, computed as k, openBlock as i, createElementBlock as g, createBlock as f, withCtx as v, createElementVNode as u, toDisplayString as y, Fragment as j, renderList as T, createVNode as D } from "vue";
2
- import * as d from "xlsx";
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 E } from "../../utils/i18n.js";
10
- const V = { class: "px-1 py-1 text-sm" }, U = { class: "font-medium mb-3 text-muted-foreground" }, A = { class: "space-y-3" }, H = /* @__PURE__ */ _({
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(n, { expose: F }) {
24
- const a = n, s = (r, e, t) => {
25
- const o = t ? E(r, t) : E(r);
26
- return o !== r ? o : e;
27
- }, $ = (r, e) => {
28
- if (!(!r || !e))
29
- return e.includes(".") ? e.split(".").reduce((t, o) => t?.[o], r) : r[e];
30
- }, h = k(() => [
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) => a.formats.includes(e.value))), B = () => a.data.map((r) => {
56
+ ].filter((e) => n.formats.includes(e.value))), j = () => n.data.map((o) => {
35
57
  const e = {};
36
- return a.fields.forEach((t) => {
37
- const o = $(r, t.field);
38
- t.format ? e[t.title] = t.format(o, r) : e[t.title] = o ?? "";
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
- }), x = async (r, e) => {
41
- if (a.mode === "backend" && a.onExport)
62
+ }), f = async (o, e) => {
63
+ if (n.mode === "backend" && n.onExport)
42
64
  try {
43
- await a.onExport(r), e && e();
65
+ await n.onExport(o), e && e();
44
66
  return;
45
67
  } catch (t) {
46
- console.error("Backend export error:", t), p(s("vlite.exportData.error", "An error occurred while exporting data."), "error");
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 (!a.data || a.data.length === 0) {
50
- p(s("vlite.exportData.noData", "No data available to export."), "warning");
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 = a.filename ? a.filename : `${a.title.toLowerCase().replace(/\s+/g, "-")}-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`, o = B();
55
- switch (r) {
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 = d.utils.book_new(), c = d.utils.json_to_sheet(o);
58
- d.utils.book_append_sheet(l, c, a.title.substring(0, 31));
59
- const m = d.write(l, { bookType: "xlsx", type: "array" }), C = new Blob([m], { type: "application/octet-stream" });
60
- b(C, `${t}.xlsx`);
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 c = N.unparse(o), m = new Blob(["\uFEFF" + c], { type: "text/csv;charset=utf-8;" });
65
- b(m, `${t}.csv`);
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 l = JSON.stringify(o, null, 2), c = new Blob([l], { type: "application/json" });
70
- b(c, `${t}.json`);
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
- s("vlite.exportData.success", `Data exported successfully as ${r.toUpperCase()}`, {
76
- format: r.toUpperCase()
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(s("vlite.exportData.error", "An error occurred while exporting data."), "error");
103
+ console.error("Export error:", t), p(i("vlite.exportData.error", "An error occurred while exporting data."), "error");
82
104
  }
83
- }, S = k(() => s("vlite.exportData.selectFormat", "Select Export Format"));
84
- return F({
85
- exportData: x,
86
- availableFormats: h
87
- }), (r, e) => (i(), g("div", null, [
88
- n.formats.length === 1 ? (i(), f(w, {
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: n.buttonText,
91
- icon: n.buttonIcon,
112
+ text: s.buttonText,
113
+ icon: s.buttonIcon,
92
114
  variant: "outline",
93
- onClick: e[0] || (e[0] = (t) => x(n.formats[0]))
94
- }, null, 8, ["text", "icon"])) : (i(), f(I, {
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: n.title,
118
+ title: s.title,
97
119
  "max-width": "sm:max-w-[400px]"
98
120
  }, {
99
- trigger: v(() => [
100
- D(w, {
101
- text: n.buttonText,
102
- icon: n.buttonIcon,
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: v(({ close: t }) => [
107
- u("div", V, [
108
- u("h6", U, y(S.value), 1),
109
- u("div", A, [
110
- (i(!0), g(j, null, T(h.value, (o) => (i(), f(w, {
111
- key: o.value,
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: (l) => x(o.value, t)
136
+ onClick: (a) => f(r.value, t)
115
137
  }, {
116
- default: v(() => [
138
+ default: w(() => [
117
139
  D(O, {
118
- icon: o.icon,
140
+ icon: r.icon,
119
141
  class: "text-muted-foreground h-5 w-5"
120
142
  }, null, 8, ["icon"]),
121
- u("span", null, y(o.label), 1)
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 l, openBlock as n, createElementBlock as r, createElementVNode as o, createVNode as t, unref as a } from "vue";
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 c = { class: "flex flex-col h-[70vh] w-full min-h-[400px]" }, i = { class: "flex-1 relative bg-muted/10 rounded-lg border border-border overflow-hidden flex items-center justify-center" }, u = { class: "w-full h-full overflow-auto" }, v = /* @__PURE__ */ l({
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(e) {
12
- return (f, m) => (n(), r("div", c, [
13
- o("div", i, [
14
- o("div", u, [
15
- t(a(d), {
16
- url: e.url,
17
- name: e.name,
18
- "can-download": e.canDownload
19
- }, null, 8, ["url", "name", "can-download"])
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
- v as default
44
+ y as default
27
45
  };