vlite3 1.0.7 → 1.0.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.
Files changed (61) hide show
  1. package/components/Accordion/Accordion.vue.d.ts +1 -1
  2. package/components/ButtonGroup.vue.js +1 -1
  3. package/components/Chat/ChatBubble.vue.js +22 -22
  4. package/components/Chat/ChatInterface.vue.js +35 -34
  5. package/components/CommandPalette/CommandPaletteContent.vue2.js +1 -1
  6. package/components/CommandPalette/{CommandPaletteItem.vue.js → CommandPaletteItem.vue2.js} +1 -1
  7. package/components/DataTable/DataTable.vue.js +55 -52
  8. package/components/DataTable/DataTableRow.vue.js +21 -21
  9. package/components/FilePicker/FilePicker.vue.js +133 -140
  10. package/components/Form/Form.vue.d.ts +2 -0
  11. package/components/Form/Form.vue.js +2 -2
  12. package/components/Form/Form.vue2.js +288 -234
  13. package/components/Form/FormField.vue.js +281 -226
  14. package/components/Form/FormFields.vue.d.ts +8 -0
  15. package/components/Form/FormFields.vue.js +2 -2
  16. package/components/Form/FormFields.vue2.js +112 -104
  17. package/components/Form/FormSkeleton.vue.d.ts +9 -0
  18. package/components/Form/FormSkeleton.vue.js +50 -0
  19. package/components/Form/FormSkeleton.vue2.js +4 -0
  20. package/components/Form/composables/useForm.js +174 -150
  21. package/components/Form/index.d.ts +1 -0
  22. package/components/Form/types.d.ts +3 -1
  23. package/components/Form/utils/form.utils.d.ts +6 -1
  24. package/components/Form/utils/form.utils.js +73 -61
  25. package/components/List/ListFieldRow.vue.js +144 -173
  26. package/components/List/utils.d.ts +0 -2
  27. package/components/List/utils.js +22 -43
  28. package/components/NavbarCommandPalette.vue.js +1 -1
  29. package/components/NumberInput.vue.js +1 -1
  30. package/components/NumberInput.vue2.js +87 -81
  31. package/components/Screen/Screen.vue.d.ts +223 -11
  32. package/components/Screen/Screen.vue.js +245 -210
  33. package/components/Screen/ScreenFilter.vue.js +17 -16
  34. package/components/Screen/types.d.ts +8 -0
  35. package/components/SidePanel.vue.js +2 -2
  36. package/components/SidePanel.vue2.js +1 -1
  37. package/components/SidebarMenu/SidebarMenu.vue.d.ts +1 -1
  38. package/components/Slider.vue.js +54 -54
  39. package/components/Stats/StatItem.vue.d.ts +25 -0
  40. package/components/Stats/StatItem.vue.js +251 -0
  41. package/components/Stats/StatItem.vue2.js +4 -0
  42. package/components/Stats/Stats.vue.d.ts +3 -3
  43. package/components/Stats/Stats.vue.js +32 -351
  44. package/components/Stats/components/StatIconBox.vue.d.ts +13 -0
  45. package/components/Stats/components/StatIconBox.vue.js +82 -0
  46. package/components/Stats/components/StatIconBox.vue2.js +4 -0
  47. package/components/Stats/components/StatTrend.vue.d.ts +7 -0
  48. package/components/Stats/components/StatTrend.vue.js +48 -0
  49. package/components/Stats/components/StatTrend.vue2.js +4 -0
  50. package/components/StatusChip/status-map.js +36 -0
  51. package/components/ThumbnailSelector/ThumbnailSelector.vue.d.ts +35 -0
  52. package/components/ThumbnailSelector/ThumbnailSelector.vue.js +7 -0
  53. package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +158 -0
  54. package/components/ThumbnailSelector/index.d.ts +2 -0
  55. package/components/Workbook/Sheet.vue.d.ts +1 -1
  56. package/index.d.ts +1 -0
  57. package/index.js +284 -265
  58. package/package.json +1 -1
  59. package/style.css +7 -7
  60. package/utils/functions.d.ts +59 -1
  61. package/utils/functions.js +157 -81
@@ -29,8 +29,8 @@ declare const __VLS_component: import('vue').DefineComponent<AccordionProps, {},
29
29
  variant: import('./types').AccordionVariant;
30
30
  size: import('./types').AccordionSize;
31
31
  disabled: boolean;
32
- items: import('./types').AccordionItemSchema[];
33
32
  attached: boolean;
33
+ items: import('./types').AccordionItemSchema[];
34
34
  showIndex: boolean;
35
35
  iconVariant: import('./types').IconVariant;
36
36
  allowMultiple: boolean;
@@ -1,7 +1,7 @@
1
1
  import o from "./ButtonGroup.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c990b8da"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-298c3d8a"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as S, computed as x, ref as T, openBlock as t, createElementBlock as i, normalizeClass as l, createVNode as f, createCommentVNode as a, createElementVNode as d, toDisplayString as u, unref as B, createBlock as E, withModifiers as C } from "vue";
1
+ import { defineComponent as S, computed as x, ref as T, openBlock as t, createElementBlock as a, normalizeClass as l, createVNode as f, createCommentVNode as i, createElementVNode as d, toDisplayString as u, unref as B, createBlock as E, withModifiers as C } from "vue";
2
2
  import D from "../Avatar.vue.js";
3
3
  import g from "../Button.vue.js";
4
4
  import I from "../AttachmentsList/AttachmentsList.vue.js";
@@ -53,16 +53,16 @@ const z = {
53
53
  }, k = () => {
54
54
  n.value = !1, r && (clearTimeout(r), r = null);
55
55
  };
56
- return (m, o) => (t(), i("div", {
56
+ return (m, o) => (t(), a("div", {
57
57
  class: l(["flex w-full min-w-0 gap-3 group", e.isSender ? "flex-row-reverse" : "flex-row"])
58
58
  }, [
59
- e.showAvatar ? (t(), i("div", z, [
59
+ e.showAvatar ? (t(), a("div", z, [
60
60
  f(D, {
61
61
  src: e.message.avatar,
62
62
  alt: e.message.senderName,
63
63
  size: "sm"
64
64
  }, null, 8, ["src", "alt"])
65
- ])) : a("", !0),
65
+ ])) : i("", !0),
66
66
  d("div", {
67
67
  class: l(["flex flex-col min-w-0 overflow-hidden max-w-[85%]", e.isSender ? "items-end" : "items-start"])
68
68
  }, [
@@ -74,9 +74,9 @@ const z = {
74
74
  e.isSender ? "bg-primary text-primary-foreground rounded-br-sm" : "bg-muted text-foreground rounded-bl-sm"
75
75
  ]])
76
76
  }, [
77
- e.showUserInfo && e.message.senderName && !e.isSender ? (t(), i("div", A, u(e.message.senderName), 1)) : a("", !0),
78
- e.message.text ? (t(), i("p", N, u(e.message.text), 1)) : a("", !0),
79
- e.message.attachments && e.message.attachments.length > 0 ? (t(), i("div", {
77
+ e.showUserInfo && e.message.senderName && !e.isSender ? (t(), a("div", A, u(e.message.senderName), 1)) : i("", !0),
78
+ e.message.text ? (t(), a("p", N, u(e.message.text), 1)) : i("", !0),
79
+ e.message.attachments && e.message.attachments.length > 0 ? (t(), a("div", {
80
80
  key: 2,
81
81
  class: l({ "mt-2": e.message.text || e.showUserInfo && !e.isSender })
82
82
  }, [
@@ -89,27 +89,27 @@ const z = {
89
89
  "click-to-preview": !0,
90
90
  "show-download-in-list": !1
91
91
  }, null, 8, ["attachments"])
92
- ], 2)) : a("", !0),
93
- e.showTimestamp && (e.message.timestamp || e.message.isEdited) ? (t(), i("div", {
92
+ ], 2)) : i("", !0),
93
+ e.showTimestamp && (e.message.timestamp || e.message.isEdited) ? (t(), a("div", {
94
94
  key: 3,
95
95
  class: l(["mt-1 flex items-center gap-1", e.isSender ? "justify-end" : "justify-start"])
96
96
  }, [
97
- e.message.isEdited && e.showEditedStatus !== !1 ? (t(), i("span", {
97
+ e.message.isEdited && e.showEditedStatus !== !1 ? (t(), a("span", {
98
98
  key: 0,
99
99
  class: l(["text-[10px] opacity-60", e.isSender ? "text-primary-foreground" : "text-muted-foreground"])
100
- }, u(y.value), 3)) : a("", !0),
101
- e.message.isEdited && e.showEditedStatus !== !1 && e.message.timestamp ? (t(), i("span", {
100
+ }, u(y.value), 3)) : i("", !0),
101
+ e.message.isEdited && e.showEditedStatus !== !1 && e.message.timestamp ? (t(), a("span", {
102
102
  key: 1,
103
103
  class: l(["text-[10px] opacity-40", e.isSender ? "text-primary-foreground" : "text-muted-foreground"])
104
- }, " · ", 2)) : a("", !0),
105
- e.message.timestamp ? (t(), i("span", {
104
+ }, " · ", 2)) : i("", !0),
105
+ e.message.timestamp ? (t(), a("span", {
106
106
  key: 2,
107
107
  class: l(["text-[10px] opacity-60 tabular-nums", e.isSender ? "text-primary-foreground" : "text-muted-foreground"])
108
- }, u(h.value), 3)) : a("", !0)
109
- ], 2)) : a("", !0)
108
+ }, u(h.value), 3)) : i("", !0)
109
+ ], 2)) : i("", !0)
110
110
  ], 2),
111
111
  d("div", {
112
- class: l(["opacity-0 group-hover/bubble:opacity-100 focus-within:opacity-100 transition-opacity flex gap-0 pointer-events-none group-hover/bubble:pointer-events-auto focus-within:pointer-events-auto z-10", e.isSender ? "right-full pr-1" : "left-full pl-1"])
112
+ class: l(["absolute top-1/2 -translate-y-1/2 opacity-0 group-hover/bubble:opacity-100 focus-within:opacity-100 transition-opacity flex gap-0 pointer-events-none group-hover/bubble:pointer-events-auto focus-within:pointer-events-auto z-10", e.isSender ? "right-full pr-1" : "left-full pl-1"])
113
113
  }, [
114
114
  (e.isSender || e.allowEditAll) && e.message.text?.trim() ? (t(), E(g, {
115
115
  key: 0,
@@ -120,8 +120,8 @@ const z = {
120
120
  class: "text-muted-foreground hover:text-foreground h-7 w-7",
121
121
  onClick: o[0] || (o[0] = ($) => c("edit", e.message)),
122
122
  "aria-label": "Edit message"
123
- })) : a("", !0),
124
- e.isSender || e.allowDeleteAll ? (t(), i("div", j, [
123
+ })) : i("", !0),
124
+ e.isSender || e.allowDeleteAll ? (t(), a("div", j, [
125
125
  f(g, {
126
126
  variant: "ghost",
127
127
  size: "xs",
@@ -131,7 +131,7 @@ const z = {
131
131
  onClick: b,
132
132
  "aria-label": n.value ? "Confirm delete" : "Delete message"
133
133
  }, null, 8, ["icon", "aria-label"]),
134
- n.value ? (t(), i("button", {
134
+ n.value ? (t(), a("button", {
135
135
  key: 0,
136
136
  class: "absolute -top-1.5 -right-1.5 w-3.5 h-3.5 rounded-full bg-muted border border-border flex items-center justify-center text-muted-foreground hover:text-foreground transition-colors",
137
137
  onClick: C(k, ["stop"]),
@@ -160,8 +160,8 @@ const z = {
160
160
  y2: "18"
161
161
  })
162
162
  ], -1)
163
- ])])) : a("", !0)
164
- ])) : a("", !0)
163
+ ])])) : i("", !0)
164
+ ])) : i("", !0)
165
165
  ], 2)
166
166
  ], 2)
167
167
  ], 2)
@@ -1,4 +1,4 @@
1
- import { defineComponent as te, ref as p, computed as w, onMounted as le, onUnmounted as ae, watch as oe, nextTick as U, openBlock as c, createElementBlock as f, createElementVNode as o, createTextVNode as se, toDisplayString as b, createCommentVNode as k, Fragment as _, renderList as N, createBlock as re, createVNode as I, unref as E, withCtx as ne, withDirectives as ie, vModelText as de } from "vue";
1
+ import { defineComponent as te, ref as p, computed as w, onMounted as le, onUnmounted as ae, watch as oe, nextTick as U, openBlock as c, createElementBlock as f, createElementVNode as o, createTextVNode as re, toDisplayString as b, createCommentVNode as k, Fragment as _, renderList as N, createBlock as se, createVNode as I, unref as E, withCtx as ne, withDirectives as ie, vModelText as de } from "vue";
2
2
  import ce from "./ChatBubble.vue.js";
3
3
  import V from "../Button.vue.js";
4
4
  import K from "../Icon.vue.js";
@@ -10,8 +10,8 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
10
10
  class: "py-2 mb-2 text-center text-xs text-muted-foreground flex justify-center items-center gap-2"
11
11
  }, he = {
12
12
  key: 1,
13
- class: "flex items-center justify-center h-full text-muted-foreground text-sm"
14
- }, xe = { class: "flex flex-col gap-2 pb-2" }, ge = {
13
+ class: "flex items-center justify-center flex-1 h-full text-muted-foreground text-sm"
14
+ }, xe = { class: "flex flex-col gap-2 pb-2 mt-auto" }, ge = {
15
15
  key: 0,
16
16
  class: "flex items-center gap-3 py-1 select-none",
17
17
  role: "separator"
@@ -54,8 +54,8 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
54
54
  maxFileSize: {}
55
55
  },
56
56
  emits: ["add", "delete", "edit", "refetch"],
57
- setup(s, { emit: j }) {
58
- const a = s, C = j, v = p(null), B = p(null), i = p(null), h = p(""), F = p(0), M = p(!1), d = p(null), r = p([]), { handleUploadFiles: Y, loading: x } = fe(), P = w(() => {
57
+ setup(r, { emit: j }) {
58
+ const a = r, C = j, v = p(null), B = p(null), i = p(null), h = p(""), F = p(0), M = p(!1), d = p(null), s = p([]), { handleUploadFiles: Y, loading: x } = fe(), P = w(() => {
59
59
  if (a.placeholderI18n) {
60
60
  const t = u(a.placeholderI18n);
61
61
  if (t !== a.placeholderI18n) return t;
@@ -139,22 +139,22 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
139
139
  }, z = () => {
140
140
  d.value = null, h.value = "", i.value && (i.value.style.height = "auto", i.value.focus());
141
141
  }, $ = w(() => {
142
- const e = !!h.value.trim(), t = Array.isArray(r.value) && r.value.length > 0;
142
+ const e = !!h.value.trim(), t = Array.isArray(s.value) && s.value.length > 0;
143
143
  return (e || t) && !x.value;
144
144
  }), X = (e) => {
145
- x.value || Array.isArray(r.value) && (r.value.splice(e, 1), r.value.length === 0 && (r.value = []));
145
+ x.value || Array.isArray(s.value) && (s.value.splice(e, 1), s.value.length === 0 && (s.value = []));
146
146
  }, L = async () => {
147
147
  if (!$.value) return;
148
- const e = h.value.trim(), t = Array.isArray(r.value) && r.value.length > 0, l = !!d.value;
148
+ const e = h.value.trim(), t = Array.isArray(s.value) && s.value.length > 0, l = !!d.value;
149
149
  if (l && d.value)
150
150
  e !== d.value.text && C("edit", { ...d.value, text: e, isEdited: !0 }), d.value = null, h.value = "";
151
151
  else {
152
152
  let n = [];
153
153
  if (t) {
154
- const m = r.value.map((T) => T.file).filter(Boolean);
154
+ const m = s.value.map((T) => T.file).filter(Boolean);
155
155
  if (m.length > 0) {
156
156
  const T = await Y(m, a.folderId);
157
- n = r.value.map((g, y) => ({
157
+ n = s.value.map((g, y) => ({
158
158
  fileUrl: T[y] || "",
159
159
  fileName: g.fileName,
160
160
  fileType: g.fileType,
@@ -162,7 +162,7 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
162
162
  })).filter((g) => g.fileUrl !== null && g.fileUrl !== "");
163
163
  }
164
164
  }
165
- C("add", e, n.length > 0 ? n : void 0), r.value = [], h.value = "";
165
+ C("add", e, n.length > 0 ? n : void 0), s.value = [], h.value = "";
166
166
  }
167
167
  i.value && (i.value.style.height = "auto", i.value.focus()), l || A();
168
168
  }, D = (e) => {
@@ -204,18 +204,19 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
204
204
  o("div", {
205
205
  ref_key: "messageListRef",
206
206
  ref: v,
207
- class: "flex-1 overflow-y-auto px-4 py-4 scrollbar-thin scrollbar-stable",
207
+ class: "flex-1 overflow-y-auto px-4 py-4 scrollbar-thin scrollbar-stable flex flex-col",
208
208
  role: "log",
209
209
  "aria-live": "polite",
210
210
  "aria-label": "Chat messages",
211
- style: { "will-change": "transform", contain: "layout style" }
211
+ style: { "will-change": "transform", contain: "layout style", "overflow-anchor": "auto" }
212
212
  }, [
213
213
  o("div", {
214
214
  ref_key: "observerTargetRef",
215
215
  ref: B,
216
- class: "h-1 w-full shrink-0"
216
+ class: "h-1 w-full shrink-0",
217
+ style: { "overflow-anchor": "none" }
217
218
  }, null, 512),
218
- s.isLoadingMore ? (c(), f("div", ve, [
219
+ r.isLoadingMore ? (c(), f("div", ve, [
219
220
  t[3] || (t[3] = o("svg", {
220
221
  class: "animate-spin h-4 w-4 text-primary",
221
222
  xmlns: "http://www.w3.org/2000/svg",
@@ -236,9 +237,9 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
236
237
  d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
237
238
  })
238
239
  ], -1)),
239
- se(" " + b(O.value), 1)
240
+ re(" " + b(O.value), 1)
240
241
  ])) : k("", !0),
241
- !s.data.length && !s.isLoadingMore ? (c(), f("div", he, b(q.value), 1)) : k("", !0),
242
+ !r.data.length && !r.isLoadingMore ? (c(), f("div", he, b(q.value), 1)) : k("", !0),
242
243
  o("div", xe, [
243
244
  (c(!0), f(_, null, N(ee.value, (l) => (c(), f(_, {
244
245
  key: H(l) ? l._key : l.id
@@ -247,19 +248,19 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
247
248
  t[4] || (t[4] = o("div", { class: "flex-1 h-px bg-border/60" }, null, -1)),
248
249
  o("span", pe, b(l.label), 1),
249
250
  t[5] || (t[5] = o("div", { class: "flex-1 h-px bg-border/60" }, null, -1))
250
- ])) : (c(), re(ce, {
251
+ ])) : (c(), se(ce, {
251
252
  key: 1,
252
253
  message: l,
253
- "is-sender": l.senderId === s.currentUserId,
254
- "show-avatar": s.showAvatar,
255
- "show-user-info": s.showUserInfo,
256
- "show-timestamp": s.showTimestamp,
257
- "allow-delete-all": s.allowDeleteAll,
258
- "allow-edit-all": s.allowEditAll,
259
- "confirm-delete": s.confirmDelete,
260
- "show-edited-status": s.showEditedStatus,
261
- "edited-text": s.editedText,
262
- "edited-text-i18n": s.editedTextI18n,
254
+ "is-sender": l.senderId === r.currentUserId,
255
+ "show-avatar": r.showAvatar,
256
+ "show-user-info": r.showUserInfo,
257
+ "show-timestamp": r.showTimestamp,
258
+ "allow-delete-all": r.allowDeleteAll,
259
+ "allow-edit-all": r.allowEditAll,
260
+ "confirm-delete": r.confirmDelete,
261
+ "show-edited-status": r.showEditedStatus,
262
+ "edited-text": r.editedText,
263
+ "edited-text-i18n": r.editedTextI18n,
263
264
  onDelete: t[0] || (t[0] = (n) => e.$emit("delete", n)),
264
265
  onEdit: W
265
266
  }, null, 8, ["message", "is-sender", "show-avatar", "show-user-info", "show-timestamp", "allow-delete-all", "allow-edit-all", "confirm-delete", "show-edited-status", "edited-text", "edited-text-i18n"]))
@@ -317,8 +318,8 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
317
318
  ])
318
319
  ])) : k("", !0),
319
320
  o("div", Ee, [
320
- Array.isArray(r.value) && r.value.length > 0 ? (c(), f("div", Me, [
321
- (c(!0), f(_, null, N(r.value, (l, n) => (c(), f("div", {
321
+ Array.isArray(s.value) && s.value.length > 0 ? (c(), f("div", Me, [
322
+ (c(!0), f(_, null, N(s.value, (l, n) => (c(), f("div", {
322
323
  key: n,
323
324
  class: "relative flex items-center gap-2 bg-background border border-border rounded-md p-1.5 pr-8 max-w-[200px] shadow-sm"
324
325
  }, [
@@ -343,12 +344,12 @@ const me = { class: "flex flex-col w-full h-full flex-1 min-h-0 bg-transparent"
343
344
  ]))), 128))
344
345
  ])) : k("", !0),
345
346
  o("div", Ce, [
346
- s.allowFileUpload ? (c(), f("div", Be, [
347
+ r.allowFileUpload ? (c(), f("div", Be, [
347
348
  I(ue, {
348
- modelValue: r.value,
349
- "onUpdate:modelValue": t[1] || (t[1] = (l) => r.value = l),
349
+ modelValue: s.value,
350
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => s.value = l),
350
351
  "multi-select": !0,
351
- "max-size": s.maxFileSize,
352
+ "max-size": r.maxFileSize,
352
353
  "return-format": "file"
353
354
  }, {
354
355
  trigger: ne(({ trigger: l }) => [
@@ -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.vue.js";
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/60 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,5 +1,5 @@
1
1
  import t from "./CommandPaletteItem.vue3.js";
2
- /* empty css */
2
+ /* empty css */
3
3
  import o from "../../_virtual/_plugin-vue_export-helper.js";
4
4
  const r = /* @__PURE__ */ o(t, [["__scopeId", "data-v-66b1ae06"]]);
5
5
  export {
@@ -1,4 +1,4 @@
1
- import { defineComponent as ye, inject as we, computed as r, ref as y, watch as g, openBlock as i, createElementBlock as m, createBlock as F, normalizeClass as w, createSlots as K, withCtx as x, renderSlot as $, createVNode as B, createCommentVNode as A, createElementVNode as f, Fragment as N, renderList as E, normalizeStyle as L, isMemoSame as Y, mergeProps as X, unref as q } from "vue";
1
+ import { defineComponent as ye, inject as we, computed as i, ref as y, watch as g, openBlock as r, createElementBlock as m, createBlock as U, normalizeClass as w, createSlots as j, withCtx as x, renderSlot as $, createVNode as B, createCommentVNode as W, createElementVNode as f, Fragment as A, renderList as E, normalizeStyle as L, isMemoSame as Y, mergeProps as X, unref as q } from "vue";
2
2
  import Pe from "../CheckBox.vue.js";
3
3
  import Ce from "../Button.vue.js";
4
4
  import Se from "../ConfirmationModal.vue.js";
@@ -14,11 +14,11 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
14
14
  scope: "col",
15
15
  class: "w-[40px] px-0 text-center font-medium text-muted-foreground",
16
16
  style: { width: "40px" }
17
- }, Ae = { class: "flex items-center justify-center" }, Ne = { class: "[&_tr:last-child]:border-0" }, Ve = {
17
+ }, We = { class: "flex items-center justify-center" }, Ae = { class: "[&_tr:last-child]:border-0" }, Ne = {
18
18
  key: 0,
19
19
  class: "w-[48px] px-0 py-4 align-middle text-center",
20
20
  style: { width: "48px" }
21
- }, Me = { key: 2 }, Ue = ["colspan"], Fe = { key: 1 }, Qe = /* @__PURE__ */ ye({
21
+ }, Ve = { key: 2 }, Me = ["colspan"], Ue = { key: 1 }, Qe = /* @__PURE__ */ ye({
22
22
  __name: "DataTable",
23
23
  props: {
24
24
  rows: { default: () => [] },
@@ -69,18 +69,18 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
69
69
  if (n in e[0]) return n;
70
70
  }
71
71
  return "_id";
72
- }, Q = (e) => e.sortKey || e.field, a = o, b = G, R = we($e, null), j = r(() => R?.disableSearch ? !1 : a.showSearch), C = r(() => a.hideSelectable ? !1 : R ? R.forceSelectable : !0), d = r(() => J(a.rows, a.keyField)), u = y({ field: "", order: "" }), S = y(
72
+ }, Q = (e) => e.sortKey || e.field, a = o, b = G, R = we($e, null), F = i(() => R?.disableSearch ? !1 : a.showSearch), C = i(() => a.hideSelectable ? !1 : R ? R.forceSelectable : !0), d = i(() => J(a.rows, a.keyField)), u = y({ field: "", order: "" }), S = y(
73
73
  a.pageInfo?.itemsPerPage || a.paginationProps?.itemsPerPage || 10
74
- ), h = y(a.pageInfo?.currentPage || 1), p = y(a.search || ""), k = y(!1), Z = r(() => a.loading);
74
+ ), h = y(a.pageInfo?.currentPage || 1), p = y(a.search || ""), k = y(!1), Z = i(() => a.loading);
75
75
  g(
76
76
  () => a.search,
77
77
  (e) => {
78
78
  e !== void 0 && e !== p.value && (p.value = e);
79
79
  }
80
80
  );
81
- let V = null;
81
+ let N = null;
82
82
  g(p, () => {
83
- V && clearTimeout(V), V = setTimeout(() => {
83
+ N && clearTimeout(N), N = setTimeout(() => {
84
84
  h.value = 1, z();
85
85
  }, 300);
86
86
  }), g(
@@ -108,18 +108,18 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
108
108
  },
109
109
  { immediate: !0, deep: !0 }
110
110
  );
111
- const M = r(
111
+ const V = i(
112
112
  () => a.rows.length > 0 && a.rows.every((e) => s.value.has(c(e, d.value)))
113
- ), O = r(() => s.value.size > 0 && !M.value), _ = r(() => {
113
+ ), K = i(() => s.value.size > 0 && !V.value), _ = i(() => {
114
114
  const e = [...a.selectedRows || [], ...a.rows], t = /* @__PURE__ */ new Map();
115
115
  return e.forEach((l) => t.set(c(l, d.value), l)), Array.from(s.value).map((l) => t.get(l)).filter(Boolean);
116
116
  }), ee = (e) => {
117
117
  const t = new Set(s.value);
118
- e ? a.rows.forEach((l) => t.add(c(l, d.value))) : a.rows.forEach((l) => t.delete(c(l, d.value))), s.value = t, W();
118
+ e ? a.rows.forEach((l) => t.add(c(l, d.value))) : a.rows.forEach((l) => t.delete(c(l, d.value))), s.value = t, O();
119
119
  }, te = (e) => {
120
120
  const t = new Set(s.value);
121
- t.has(e) ? t.delete(e) : t.add(e), s.value = t, W();
122
- }, W = () => {
121
+ t.has(e) ? t.delete(e) : t.add(e), s.value = t, O();
122
+ }, O = () => {
123
123
  const e = /* @__PURE__ */ new Set(), t = [];
124
124
  a.rows.forEach((l) => {
125
125
  const n = c(l, d.value);
@@ -129,8 +129,8 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
129
129
  !e.has(n) && s.value.has(n) && (t.push(l), e.add(n));
130
130
  }), b("select", {
131
131
  selected: t,
132
- all: M.value,
133
- indeterminate: O.value
132
+ all: V.value,
133
+ indeterminate: K.value
134
134
  }), b("update:selectedRows", t);
135
135
  }, le = (e) => {
136
136
  const t = a.headers.find((n) => n.field === e), l = t ? Q(t) : e;
@@ -142,9 +142,9 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
142
142
  }, se = (e) => b("rowClick", e), ne = () => {
143
143
  b("delete", _.value), k.value = !1;
144
144
  };
145
- let U = null;
145
+ let M = null;
146
146
  const z = () => {
147
- U && clearTimeout(U), U = setTimeout(() => {
147
+ M && clearTimeout(M), M = setTimeout(() => {
148
148
  const e = {
149
149
  pagination: { page: h.value, limit: S.value },
150
150
  sort: { ...u.value },
@@ -161,43 +161,46 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
161
161
  s.value = new Set([...s.value].filter((t) => e.has(t)));
162
162
  }
163
163
  );
164
- const re = r(() => [
164
+ const ie = i(() => [
165
165
  "w-full flex flex-col",
166
166
  a.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
167
167
  "overflow-hidden",
168
168
  a.bordered ? "border border-border" : "",
169
169
  a.class
170
- ].join(" ")), ie = r(() => ["w-full caption-bottom -text-fs-1", a.tableClass].join(" ")), de = (e) => {
170
+ ].join(" ")), re = i(() => ["w-full caption-bottom -text-fs-1", a.tableClass].join(" ")), de = (e) => {
171
171
  const t = {};
172
- return e.width && !/^w-/.test(e.width) && (t.width = e.width), e.minWidth && (t.minWidth = e.minWidth), t;
173
- }, ce = (e) => e.width && /^w-/.test(e.width) ? e.width : "", ue = r(
172
+ return e.width && !/(?:^|\s|:)w-/.test(e.width) && (t.width = e.width), e.minWidth && !/(?:^|\s|:)min-w-/.test(e.minWidth) && (t.minWidth = e.minWidth), t;
173
+ }, ce = (e) => {
174
+ const t = [];
175
+ return e.width && /(?:^|\s|:)w-/.test(e.width) && t.push(e.width), e.minWidth && /(?:^|\s|:)min-w-/.test(e.minWidth) && t.push(e.minWidth), t.join(" ");
176
+ }, ue = i(
174
177
  () => a.emptyTitleI18n ? P(a.emptyTitleI18n) : a.emptyTitle
175
- ), me = r(
178
+ ), me = i(
176
179
  () => a.emptyDescriptionI18n ? P(a.emptyDescriptionI18n) : a.emptyDescription
177
- ), fe = r(() => {
180
+ ), fe = i(() => {
178
181
  const e = P("vlite.dataTable.confirmDeleteTitle");
179
182
  return e !== "vlite.dataTable.confirmDeleteTitle" ? e : "Confirm Deletion";
180
- }), ve = r(() => {
183
+ }), ve = i(() => {
181
184
  const e = P("vlite.dataTable.confirmDeleteDesc");
182
185
  return e !== "vlite.dataTable.confirmDeleteDesc" ? e : "Are you sure you want to delete the selected items?";
183
- }), he = r(() => {
186
+ }), he = i(() => {
184
187
  const e = P("vlite.dataTable.deleteBtn");
185
188
  return e !== "vlite.dataTable.deleteBtn" ? e : "Delete";
186
- }), ge = r(() => {
189
+ }), ge = i(() => {
187
190
  const e = P("vlite.dataTable.cancelBtn");
188
191
  return e !== "vlite.dataTable.cancelBtn" ? e : "Cancel";
189
192
  });
190
- return (e, t) => (i(), m("div", Be, [
191
- j.value || e.$slots?.["toolbar-left"] || e.$slots?.["toolbar-right"] ? (i(), F(xe, {
193
+ return (e, t) => (r(), m("div", Be, [
194
+ F.value || e.$slots?.["toolbar-left"] || e.$slots?.["toolbar-right"] ? (r(), U(xe, {
192
195
  key: 0,
193
196
  modelValue: p.value,
194
197
  "onUpdate:modelValue": t[1] || (t[1] = (l) => p.value = l),
195
- "show-search": j.value,
198
+ "show-search": F.value,
196
199
  placeholder: o.searchPlaceholder,
197
200
  placeholderI18n: o.searchPlaceholderI18n,
198
201
  class: w(o.toolbarClass),
199
202
  "search-class": o.toolbarSearchClass
200
- }, K({ _: 2 }, [
203
+ }, j({ _: 2 }, [
201
204
  e.$slots?.["toolbar-left"] ? {
202
205
  name: "left",
203
206
  fn: x(() => [
@@ -225,13 +228,13 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
225
228
  ]),
226
229
  key: "2"
227
230
  } : void 0
228
- ]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) : A("", !0),
231
+ ]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) : W("", !0),
229
232
  f("div", {
230
- class: w(re.value)
233
+ class: w(ie.value)
231
234
  }, [
232
235
  f("div", Ee, [
233
236
  f("table", {
234
- class: w([ie.value, "data-table"])
237
+ class: w([re.value, "data-table"])
235
238
  }, [
236
239
  f("thead", {
237
240
  class: w([
@@ -240,17 +243,17 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
240
243
  ])
241
244
  }, [
242
245
  f("tr", Re, [
243
- C.value ? (i(), m("th", ze, [
244
- f("div", Ae, [
246
+ C.value ? (r(), m("th", ze, [
247
+ f("div", We, [
245
248
  B(Pe, {
246
- "model-value": M.value,
247
- indeterminate: O.value,
249
+ "model-value": V.value,
250
+ indeterminate: K.value,
248
251
  size: "xs",
249
252
  "onUpdate:modelValue": ee
250
253
  }, null, 8, ["model-value", "indeterminate"])
251
254
  ])
252
- ])) : A("", !0),
253
- (i(!0), m(N, null, E(o.headers, (l) => (i(), F(Te, {
255
+ ])) : W("", !0),
256
+ (r(!0), m(A, null, E(o.headers, (l) => (r(), U(Te, {
254
257
  key: l.field,
255
258
  header: l,
256
259
  "sort-config": u.value,
@@ -262,20 +265,20 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
262
265
  }, null, 8, ["header", "sort-config", "compact", "table-sortable", "class", "style"]))), 128))
263
266
  ])
264
267
  ], 2),
265
- f("tbody", Ne, [
266
- Z.value ? (i(!0), m(N, { key: 0 }, E(Math.min(S.value, 15), (l, n, be, v) => {
268
+ f("tbody", Ae, [
269
+ Z.value ? (r(!0), m(A, { key: 0 }, E(Math.min(S.value, 15), (l, n, be, v) => {
267
270
  const I = [];
268
271
  if (v && v.key === "skeleton-" + l && Y(v, I)) return v;
269
- const T = (i(), m("tr", {
272
+ const T = (r(), m("tr", {
270
273
  key: "skeleton-" + l,
271
274
  class: "border-b border-border/70 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
272
275
  }, [
273
- C.value ? (i(), m("td", Ve, [...t[8] || (t[8] = [
276
+ C.value ? (r(), m("td", Ne, [...t[8] || (t[8] = [
274
277
  f("div", { class: "flex items-center justify-center" }, [
275
278
  f("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
276
279
  ], -1)
277
- ])])) : A("", !0),
278
- (i(!0), m(N, null, E(o.headers, (D) => (i(), m("td", {
280
+ ])])) : W("", !0),
281
+ (r(!0), m(A, null, E(o.headers, (D) => (r(), m("td", {
279
282
  key: D.field,
280
283
  class: w(["p-5! align-middle last:pr-6!", [D.hideOnMobile ? "hidden md:table-cell" : ""]])
281
284
  }, [
@@ -286,7 +289,7 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
286
289
  ], 2))), 128))
287
290
  ]));
288
291
  return T.memo = I, T;
289
- }, t, 2), 128)) : o.rows.length > 0 ? (i(!0), m(N, { key: 1 }, E(o.rows, (l, n, be, v) => {
292
+ }, t, 2), 128)) : o.rows.length > 0 ? (r(!0), m(A, { key: 1 }, E(o.rows, (l, n, be, v) => {
290
293
  const I = [
291
294
  l,
292
295
  s.value.has(c(l, d.value)),
@@ -296,7 +299,7 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
296
299
  o.hoverable
297
300
  ];
298
301
  if (v && v.key === c(l, d.value) && Y(v, I)) return v;
299
- const T = (i(), F(De, {
302
+ const T = (r(), U(De, {
300
303
  key: c(l, d.value),
301
304
  row: l,
302
305
  headers: o.headers,
@@ -310,7 +313,7 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
310
313
  onSelect: te,
311
314
  onRowClick: se,
312
315
  class: "[&_td:last-child]:pr-3.5!"
313
- }, K({ _: 2 }, [
316
+ }, j({ _: 2 }, [
314
317
  E(o.headers, (D) => ({
315
318
  name: D.field,
316
319
  fn: x((pe) => [
@@ -319,7 +322,7 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
319
322
  }))
320
323
  ]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]));
321
324
  return T.memo = I, T;
322
- }, t, 4), 128)) : (i(), m("tr", Me, [
325
+ }, t, 4), 128)) : (r(), m("tr", Ve, [
323
326
  f("td", {
324
327
  colspan: C.value ? o.headers.length + 1 : o.headers.length,
325
328
  class: "align-middle hover:bg-transparent"
@@ -330,7 +333,7 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
330
333
  description: me.value,
331
334
  icon: o.emptyIcon,
332
335
  class: "border-none! bg-transparent! py-16!"
333
- }, K({ _: 2 }, [
336
+ }, j({ _: 2 }, [
334
337
  e.$slots["empty-action"] ? {
335
338
  name: "action",
336
339
  fn: x(() => [
@@ -340,13 +343,13 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
340
343
  } : void 0
341
344
  ]), 1032, ["title", "description", "icon"])
342
345
  ])
343
- ], 8, Ue)
346
+ ], 8, Me)
344
347
  ]))
345
348
  ])
346
349
  ], 2)
347
350
  ])
348
351
  ], 2),
349
- o.showPagination && o.pageInfo && o.pageInfo.totalPages > 1 ? (i(), m("div", Fe, [
352
+ o.showPagination && o.pageInfo && o.pageInfo.totalPages > 1 ? (r(), m("div", Ue, [
350
353
  B(q(ke), X({
351
354
  "current-page": h.value,
352
355
  "total-pages": o.pageInfo.totalPages,
@@ -355,7 +358,7 @@ const Be = { class: "space-y-6.5" }, Ee = { class: "overflow-x-auto w-full" }, R
355
358
  onChange: ae,
356
359
  "onUpdate:itemsPerPage": oe
357
360
  }), null, 16, ["current-page", "total-pages", "total-items"])
358
- ])) : A("", !0),
361
+ ])) : W("", !0),
359
362
  B(Se, {
360
363
  show: k.value,
361
364
  "onUpdate:show": t[6] || (t[6] = (l) => k.value = l),