vlite3 0.1.3 → 0.1.6

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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as v, useSlots as x, computed as s, withDirectives as y, openBlock as r, createElementBlock as w, normalizeClass as i, createBlock as a, createCommentVNode as u, renderSlot as p, createTextVNode as k, toDisplayString as z, unref as B } from "vue";
2
- import l from "./Icon.vue.js";
2
+ import c from "./Icon.vue.js";
3
3
  import { vRipple as C } from "../directives/vRipple.js";
4
4
  const R = ["type", "disabled"], D = /* @__PURE__ */ v({
5
5
  __name: "Button",
@@ -16,8 +16,8 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
16
16
  rounded: { default: "md" }
17
17
  },
18
18
  setup(e) {
19
- const t = e, g = x(), c = s(() => t.icon && !t.text && !g.default), h = s(() => {
20
- const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-95 cursor-pointer gap-2", d = {
19
+ const t = e, g = x(), l = s(() => t.icon && !t.text && !g.default), h = s(() => {
20
+ const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-95 cursor-pointer gap-2", d = {
21
21
  primary: "bg-primary text-primary-foreground hover:bg-primary/90",
22
22
  "primary-light": "bg-primary-light text-primary-fg-light hover:bg-primary/20",
23
23
  secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
@@ -62,7 +62,7 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
62
62
  n,
63
63
  d[t.variant],
64
64
  m[t.rounded],
65
- c.value ? b[t.size] : f[t.size],
65
+ l.value ? b[t.size] : f[t.size],
66
66
  t.class
67
67
  ].join(" ");
68
68
  }), o = s(() => ({
@@ -77,22 +77,22 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
77
77
  class: i(h.value),
78
78
  disabled: e.disabled || e.loading
79
79
  }, [
80
- e.loading ? (r(), a(l, {
80
+ e.loading ? (r(), a(c, {
81
81
  key: 0,
82
82
  icon: "lucide:loader-2",
83
83
  class: i(["animate-spin", { [o.value]: !0 }])
84
- }, null, 8, ["class"])) : e.icon ? (r(), a(l, {
84
+ }, null, 8, ["class"])) : e.icon ? (r(), a(c, {
85
85
  key: 1,
86
86
  icon: e.icon,
87
87
  class: i({
88
- "mx-auto": c.value,
88
+ "mx-auto": l.value,
89
89
  [o.value]: !0
90
90
  })
91
91
  }, null, 8, ["icon", "class"])) : u("", !0),
92
92
  p(n.$slots, "default", {}, () => [
93
93
  k(z(e.text), 1)
94
94
  ]),
95
- e.iconRight && !e.loading ? (r(), a(l, {
95
+ e.iconRight && !e.loading ? (r(), a(c, {
96
96
  key: 2,
97
97
  icon: e.iconRight,
98
98
  class: i([o.value, "h-4 w-4"])
@@ -32,10 +32,10 @@ declare const __VLS_component: import('vue').DefineComponent<DataTableProps, {},
32
32
  "onUpdate:selectedRows"?: (value: any[]) => any;
33
33
  }>, {
34
34
  search: string;
35
+ variant: "default" | "raised";
35
36
  loading: boolean;
36
37
  rows: any[];
37
38
  selectable: boolean;
38
- emptyMessage: string;
39
39
  showSearch: boolean;
40
40
  showItemsPerPage: boolean;
41
41
  itemsPerPage: number;
@@ -47,9 +47,12 @@ declare const __VLS_component: import('vue').DefineComponent<DataTableProps, {},
47
47
  striped: boolean;
48
48
  selectedRows: any[];
49
49
  searchPlaceholder: string;
50
+ emptyTitle: string;
51
+ emptyDescription: string;
50
52
  emptyIcon: string;
51
53
  showPagination: boolean;
52
54
  bordered: boolean;
55
+ sortable: boolean;
53
56
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
54
57
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
55
58
  export default _default;
@@ -1,7 +1,7 @@
1
- import a from "./DataTable.vue2.js";
1
+ import o from "./DataTable.vue2.js";
2
2
  /* empty css */
3
- import o from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ o(a, [["__scopeId", "data-v-45a246be"]]);
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-896cd72f"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,28 +1,25 @@
1
- import { defineComponent as _, ref as g, computed as b, watch as p, onMounted as ee, openBlock as n, createElementBlock as i, createVNode as $, createSlots as V, withCtx as z, renderSlot as I, createBlock as j, createCommentVNode as k, createElementVNode as r, normalizeClass as E, Fragment as B, renderList as P, normalizeStyle as D, mergeProps as te, toDisplayString as le, createTextVNode as ae, unref as se } from "vue";
1
+ import { defineComponent as ee, ref as g, computed as b, watch as p, onMounted as te, openBlock as r, createElementBlock as d, createVNode as C, createSlots as V, withCtx as T, renderSlot as S, createBlock as D, createCommentVNode as I, createElementVNode as n, normalizeClass as B, Fragment as R, renderList as $, normalizeStyle as A, mergeProps as le, toDisplayString as M, createTextVNode as ae, unref as se } from "vue";
2
2
  import oe from "../Icon.vue.js";
3
- import ne from "../CheckBox.vue.js";
4
- import re from "../Button.vue.js";
5
- import ie from "../ConfirmationModal.vue.js";
6
- import de from "../Pagination/Pagination.vue.js";
3
+ import re from "../CheckBox.vue.js";
4
+ import ne from "../Button.vue.js";
5
+ import de from "../ConfirmationModal.vue.js";
6
+ import ie from "../Pagination/Pagination.vue.js";
7
7
  import ue from "./DataTableHeader.vue.js";
8
8
  import ce from "./DataTableRow.vue.js";
9
9
  import me from "./DataTableToolbar.vue.js";
10
- const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve = {
11
- key: 0,
12
- style: { width: "48px" }
13
- }, ge = { class: "[&_tr]:border-b [&_tr]:border-border/70! bg-muted" }, pe = { class: "hover:bg-transparent" }, we = {
10
+ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve = { class: "hover:bg-transparent" }, ge = {
14
11
  key: 0,
15
12
  scope: "col",
16
13
  class: "w-[48px] px-0 text-center font-medium text-muted-foreground",
17
14
  style: { width: "48px" }
18
- }, ye = { class: "flex items-center justify-center" }, be = { class: "[&_tr:last-child]:border-0" }, ke = {
15
+ }, pe = { class: "flex items-center justify-center" }, we = { class: "[&_tr:last-child]:border-0" }, ye = {
19
16
  key: 0,
20
17
  class: "w-[48px] px-0 py-4 align-middle text-center",
21
18
  style: { width: "48px" }
22
- }, Pe = { key: 2 }, xe = ["colspan"], Ce = { class: "flex flex-col items-center justify-center gap-2 text-muted-foreground p-8" }, Se = { class: "flex h-12 w-12 items-center justify-center rounded-full bg-muted/20" }, $e = { class: "mt-2 text-base font-semibold text-foreground" }, Ie = { class: "text-sm max-w-sm mx-auto" }, Be = {
19
+ }, be = { key: 2 }, ke = ["colspan"], Pe = { class: "flex flex-col items-center justify-center gap-2 text-muted-foreground p-8" }, xe = { class: "flex h-12 w-12 items-center justify-center rounded-full bg-muted" }, Ce = { class: "mt-1 text-base font-semibold text-foreground" }, Se = { class: "text-sm max-w-sm mx-auto" }, Ie = {
23
20
  key: 0,
24
21
  class: "mt-4"
25
- }, Fe = { key: 0 }, Ae = /* @__PURE__ */ _({
22
+ }, $e = { key: 0 }, Ve = /* @__PURE__ */ ee({
26
23
  __name: "DataTable",
27
24
  props: {
28
25
  rows: { default: () => [] },
@@ -34,7 +31,8 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
34
31
  keyField: { default: "_id" },
35
32
  loading: { type: Boolean, default: !1 },
36
33
  selectable: { type: Boolean, default: !1 },
37
- emptyMessage: { default: "No data available" },
34
+ emptyTitle: { default: "No data available" },
35
+ emptyDescription: { default: "No results found. Try adjusting your filters or search terms." },
38
36
  emptyIcon: { default: "lucide:inbox" },
39
37
  showPagination: { type: Boolean, default: !0 },
40
38
  pageInfo: {},
@@ -46,18 +44,20 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
46
44
  bordered: { type: Boolean, default: !0 },
47
45
  compact: { type: Boolean, default: !1 },
48
46
  tableClass: {},
49
- class: {}
47
+ class: {},
48
+ sortable: { type: Boolean, default: !1 },
49
+ variant: { default: "default" }
50
50
  },
51
51
  emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
52
- setup(s, { emit: A }) {
53
- const U = (e, t) => t.split(".").reduce((l, c) => l?.[c], e), u = (e, t) => U(e, t), a = s, w = A, d = g({ field: "", order: "" }), x = g(a.itemsPerPage), h = g(a.pageInfo?.currentPage || 1), y = g(a.search || ""), C = g(!1), v = g("initial"), O = b(() => a.loading && (v.value === "initial" || v.value === "page"));
52
+ setup(a, { emit: U }) {
53
+ const O = (e, t) => t.split(".").reduce((s, c) => s?.[c], e), u = (e, t) => O(e, t), l = a, w = U, i = g({ field: "", order: "" }), k = g(l.itemsPerPage), h = g(l.pageInfo?.currentPage || 1), y = g(l.search || ""), P = g(!1), v = g("initial"), L = b(() => l.loading && (v.value === "initial" || v.value === "page"));
54
54
  p(
55
- () => a.loading,
55
+ () => l.loading,
56
56
  (e, t) => {
57
57
  !e && t && (v.value = "idle");
58
58
  }
59
59
  ), p(
60
- () => a.search,
60
+ () => l.search,
61
61
  (e) => {
62
62
  e !== void 0 && e !== y.value && (y.value = e);
63
63
  }
@@ -65,246 +65,250 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
65
65
  let F = null;
66
66
  p(y, (e) => {
67
67
  F && clearTimeout(F), F = setTimeout(() => {
68
- h.value = 1, v.value = "search", S();
68
+ h.value = 1, v.value = "search", x();
69
69
  }, 300);
70
70
  }), p(
71
- () => a.itemsPerPage,
71
+ () => l.itemsPerPage,
72
72
  (e) => {
73
- x.value = e;
73
+ k.value = e;
74
74
  }
75
75
  ), p(
76
- () => a.pageInfo?.currentPage,
76
+ () => l.pageInfo?.currentPage,
77
77
  (e) => {
78
78
  e && (h.value = e);
79
79
  }
80
80
  );
81
- const M = (e) => u(e, a.keyField), o = g(/* @__PURE__ */ new Set());
81
+ const j = (e) => u(e, l.keyField), o = g(/* @__PURE__ */ new Set());
82
82
  p(
83
- () => a.selectedRows,
83
+ () => l.selectedRows,
84
84
  (e) => {
85
- const t = new Set((e || []).map((l) => u(l, a.keyField)));
86
- (t.size !== o.value.size || [...t].some((l) => !o.value.has(l))) && (o.value = t);
85
+ const t = new Set((e || []).map((s) => u(s, l.keyField)));
86
+ (t.size !== o.value.size || [...t].some((s) => !o.value.has(s))) && (o.value = t);
87
87
  },
88
88
  { immediate: !0, deep: !0 }
89
89
  );
90
- const R = b(() => a.rows.length === 0 ? !1 : a.rows.every((e) => o.value.has(u(e, a.keyField)))), N = b(() => o.value.size > 0 && !R.value), L = b(() => {
91
- const e = [...a.selectedRows || [], ...a.rows], t = /* @__PURE__ */ new Map();
92
- return e.forEach((l) => t.set(u(l, a.keyField), l)), Array.from(o.value).map((l) => t.get(l)).filter(Boolean);
93
- }), W = (e) => {
94
- e ? a.rows.forEach((t) => o.value.add(u(t, a.keyField))) : o.value.size > 0 && a.rows.forEach((t) => o.value.delete(u(t, a.keyField))), T();
95
- }, q = (e) => {
96
- o.value.has(e) ? o.value.delete(e) : o.value.add(e), T();
97
- }, T = () => {
98
- const e = a.selectedRows || [], t = /* @__PURE__ */ new Set(), l = [];
99
- a.rows.forEach((m) => {
100
- const f = u(m, a.keyField);
101
- o.value.has(f) && (l.push(m), t.add(f));
90
+ const z = b(() => l.rows.length === 0 ? !1 : l.rows.every((e) => o.value.has(u(e, l.keyField)))), E = b(() => o.value.size > 0 && !z.value), W = b(() => {
91
+ const e = [...l.selectedRows || [], ...l.rows], t = /* @__PURE__ */ new Map();
92
+ return e.forEach((s) => t.set(u(s, l.keyField), s)), Array.from(o.value).map((s) => t.get(s)).filter(Boolean);
93
+ }), q = (e) => {
94
+ e ? l.rows.forEach((t) => o.value.add(u(t, l.keyField))) : o.value.size > 0 && l.rows.forEach((t) => o.value.delete(u(t, l.keyField))), N();
95
+ }, G = (e) => {
96
+ o.value.has(e) ? o.value.delete(e) : o.value.add(e), N();
97
+ }, N = () => {
98
+ const e = l.selectedRows || [], t = /* @__PURE__ */ new Set(), s = [];
99
+ l.rows.forEach((m) => {
100
+ const f = u(m, l.keyField);
101
+ o.value.has(f) && (s.push(m), t.add(f));
102
102
  }), e.forEach((m) => {
103
- const f = u(m, a.keyField);
104
- !t.has(f) && o.value.has(f) && (l.push(m), t.add(f));
103
+ const f = u(m, l.keyField);
104
+ !t.has(f) && o.value.has(f) && (s.push(m), t.add(f));
105
105
  });
106
106
  const c = {
107
- selected: l,
108
- all: R.value,
109
- indeterminate: N.value
107
+ selected: s,
108
+ all: z.value,
109
+ indeterminate: E.value
110
110
  };
111
- w("select", c), w("update:selectedRows", l);
112
- }, G = (e) => {
113
- d.value.field === e ? d.value.order === "asc" ? d.value.order = "desc" : d.value.order === "desc" ? (d.value.order = "", d.value.field = "") : d.value.order = "asc" : (d.value.field = e, d.value.order = "asc"), h.value = 1, v.value = "sort", S();
111
+ w("select", c), w("update:selectedRows", s);
114
112
  }, H = (e) => {
115
- h.value = e, v.value = "page", S();
113
+ i.value.field === e ? i.value.order === "asc" ? i.value.order = "desc" : i.value.order === "desc" ? (i.value.order = "", i.value.field = "") : i.value.order = "asc" : (i.value.field = e, i.value.order = "asc"), h.value = 1, v.value = "sort", x();
116
114
  }, J = (e) => {
117
- x.value = e, h.value = 1, v.value = "limit", w("update:itemsPerPage", e), S();
115
+ h.value = e, v.value = "page", x();
118
116
  }, K = (e) => {
117
+ k.value = e, h.value = 1, v.value = "limit", w("update:itemsPerPage", e), x();
118
+ }, Q = (e) => {
119
119
  w("rowClick", e);
120
- }, Q = () => {
121
- const e = L.value;
122
- w("delete", e), C.value = !1;
123
- }, S = () => {
120
+ }, X = () => {
121
+ const e = W.value;
122
+ w("delete", e), P.value = !1;
123
+ }, x = () => {
124
124
  w("change", {
125
125
  pagination: {
126
126
  page: h.value,
127
- limit: x.value
127
+ limit: k.value
128
128
  },
129
- sorting: { ...d.value },
129
+ sorting: { ...i.value },
130
130
  search: y.value
131
131
  });
132
- }, X = b(() => [
133
- "w-full bg-background rounded border border-border/60 flex flex-col",
132
+ }, Y = b(() => [
133
+ "w-full flex flex-col",
134
+ l.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
134
135
  "overflow-hidden",
135
- a.class
136
- ].join(" ")), Y = b(() => ["w-full caption-bottom text-sm", a.tableClass].join(" ")), Z = (e) => e.width ? e.width : "auto";
136
+ l.bordered ? "border border-border/60" : "",
137
+ l.class
138
+ ].join(" ")), Z = b(() => ["w-full caption-bottom text-sm", l.tableClass].join(" ")), _ = (e) => e.width ? e.width : "auto";
137
139
  return p(
138
- () => a.rows,
140
+ () => l.rows,
139
141
  () => {
140
- const e = new Set(a.rows.map((t) => u(t, a.keyField)));
142
+ const e = new Set(l.rows.map((t) => u(t, l.keyField)));
141
143
  o.value = new Set([...o.value].filter((t) => e.has(t)));
142
144
  }
143
- ), ee(() => {
144
- S();
145
- }), (e, t) => (n(), i("div", fe, [
146
- $(me, {
145
+ ), te(() => {
146
+ x();
147
+ }), (e, t) => (r(), d("div", fe, [
148
+ C(me, {
147
149
  modelValue: y.value,
148
- "onUpdate:modelValue": t[1] || (t[1] = (l) => y.value = l),
149
- "show-search": s.showSearch,
150
- placeholder: s.searchPlaceholder
150
+ "onUpdate:modelValue": t[1] || (t[1] = (s) => y.value = s),
151
+ "show-search": a.showSearch,
152
+ placeholder: a.searchPlaceholder
151
153
  }, V({ _: 2 }, [
152
154
  e.$slots?.["toolbar-left"] ? {
153
155
  name: "left",
154
- fn: z(() => [
155
- I(e.$slots, "toolbar-left", {}, void 0, !0)
156
+ fn: T(() => [
157
+ S(e.$slots, "toolbar-left", {}, void 0, !0)
156
158
  ]),
157
159
  key: "0"
158
160
  } : void 0,
159
161
  e.$slots?.["toolbar-right"] || o.value.size > 0 ? {
160
162
  name: "right",
161
- fn: z(() => [
162
- o.value.size > 0 ? (n(), j(re, {
163
+ fn: T(() => [
164
+ o.value.size > 0 ? (r(), D(ne, {
163
165
  key: 0,
164
166
  rounded: "full",
165
167
  variant: "ghost",
166
168
  icon: "lucide:trash-2",
167
169
  class: "text-destructive! bg-destructive/10 hover:bg-destructive/15",
168
- onClick: t[0] || (t[0] = (l) => C.value = !0)
169
- })) : k("", !0),
170
- I(e.$slots, "toolbar-right", {}, void 0, !0)
170
+ onClick: t[0] || (t[0] = (s) => P.value = !0)
171
+ })) : I("", !0),
172
+ S(e.$slots, "toolbar-right", {}, void 0, !0)
171
173
  ]),
172
174
  key: "1"
173
175
  } : void 0
174
176
  ]), 1032, ["modelValue", "show-search", "placeholder"]),
175
- r("div", {
176
- class: E(X.value)
177
+ n("div", {
178
+ class: B(Y.value)
177
179
  }, [
178
- r("div", he, [
179
- r("table", {
180
- class: E(Y.value)
180
+ n("div", he, [
181
+ n("table", {
182
+ class: B([Z.value, ""])
181
183
  }, [
182
- r("colgroup", null, [
183
- s.selectable ? (n(), i("col", ve)) : k("", !0),
184
- (n(!0), i(B, null, P(s.headers, (l) => (n(), i("col", {
185
- key: l.field,
186
- style: D({
187
- width: Z(l)
188
- })
189
- }, null, 4))), 128))
190
- ]),
191
- r("thead", ge, [
192
- r("tr", pe, [
193
- s.selectable ? (n(), i("th", we, [
194
- r("div", ye, [
195
- $(ne, {
196
- "model-value": R.value,
197
- indeterminate: N.value,
184
+ n("thead", {
185
+ class: B([
186
+ "[&_tr]:border-b [&_tr]:border-border/70! bg-muted",
187
+ a.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
188
+ ])
189
+ }, [
190
+ n("tr", ve, [
191
+ a.selectable ? (r(), d("th", ge, [
192
+ n("div", pe, [
193
+ C(re, {
194
+ "model-value": z.value,
195
+ indeterminate: E.value,
198
196
  size: "xs",
199
- "onUpdate:modelValue": W
197
+ "onUpdate:modelValue": q
200
198
  }, null, 8, ["model-value", "indeterminate"])
201
199
  ])
202
- ])) : k("", !0),
203
- (n(!0), i(B, null, P(s.headers, (l) => (n(), j(ue, {
204
- key: l.field,
205
- header: l,
206
- "sort-config": d.value,
207
- compact: s.compact,
208
- onSort: G
209
- }, null, 8, ["header", "sort-config", "compact"]))), 128))
200
+ ])) : I("", !0),
201
+ (r(!0), d(R, null, $(a.headers, (s) => (r(), D(ue, {
202
+ key: s.field,
203
+ header: s,
204
+ "sort-config": i.value,
205
+ compact: a.compact,
206
+ "table-sortable": a.sortable,
207
+ onSort: H,
208
+ class: "last:pr-5!",
209
+ style: A({
210
+ width: _(s)
211
+ })
212
+ }, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
210
213
  ])
211
- ]),
212
- r("tbody", be, [
213
- O.value ? (n(!0), i(B, { key: 0 }, P(Math.min(x.value, 15), (l) => (n(), i("tr", {
214
- key: "skeleton-" + l,
214
+ ], 2),
215
+ n("tbody", we, [
216
+ L.value ? (r(!0), d(R, { key: 0 }, $(Math.min(k.value, 15), (s) => (r(), d("tr", {
217
+ key: "skeleton-" + s,
215
218
  class: "border-b border-border/50 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
216
219
  }, [
217
- s.selectable ? (n(), i("td", ke, [...t[4] || (t[4] = [
218
- r("div", { class: "flex items-center justify-center" }, [
219
- r("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
220
+ a.selectable ? (r(), d("td", ye, [...t[4] || (t[4] = [
221
+ n("div", { class: "flex items-center justify-center" }, [
222
+ n("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
220
223
  ], -1)
221
- ])])) : k("", !0),
222
- (n(!0), i(B, null, P(s.headers, (c) => (n(), i("td", {
224
+ ])])) : I("", !0),
225
+ (r(!0), d(R, null, $(a.headers, (c) => (r(), d("td", {
223
226
  key: c.field,
224
- class: E(["p-5! align-middle", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
227
+ class: B(["p-5! align-middle last:pr-6!", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
225
228
  }, [
226
- r("div", {
229
+ n("div", {
227
230
  class: "rounded-md bg-muted/50 animate-pulse h-4 w-full",
228
- style: D({
231
+ style: A({
229
232
  width: `${50 + Math.random() * 40}%`
230
233
  })
231
234
  }, null, 4)
232
235
  ], 2))), 128))
233
- ]))), 128)) : s.rows.length > 0 ? (n(!0), i(B, { key: 1 }, P(s.rows, (l, c) => (n(), j(ce, {
234
- key: M(l),
235
- row: l,
236
- headers: s.headers,
236
+ ]))), 128)) : a.rows.length > 0 ? (r(!0), d(R, { key: 1 }, $(a.rows, (s, c) => (r(), D(ce, {
237
+ key: j(s),
238
+ row: s,
239
+ headers: a.headers,
237
240
  index: c,
238
- "key-field": s.keyField,
239
- selectable: s.selectable,
240
- "is-selected": o.value.has(M(l)),
241
- hoverable: s.hoverable,
242
- striped: s.striped,
243
- compact: s.compact,
244
- onSelect: q,
245
- onRowClick: K
241
+ "key-field": a.keyField,
242
+ selectable: a.selectable,
243
+ "is-selected": o.value.has(j(s)),
244
+ hoverable: a.hoverable,
245
+ striped: a.striped,
246
+ compact: a.compact,
247
+ onSelect: G,
248
+ onRowClick: Q,
249
+ class: "[&_td:last-child]:pr-3.5!"
246
250
  }, V({ _: 2 }, [
247
- P(s.headers, (m) => ({
251
+ $(a.headers, (m) => ({
248
252
  name: m.field,
249
- fn: z((f) => [
250
- I(e.$slots, m.field, te({ ref_for: !0 }, f), void 0, !0)
253
+ fn: T((f) => [
254
+ S(e.$slots, m.field, le({ ref_for: !0 }, f), void 0, !0)
251
255
  ])
252
256
  }))
253
- ]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (n(), i("tr", Pe, [
254
- r("td", {
255
- colspan: s.selectable ? s.headers.length + 1 : s.headers.length,
257
+ ]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (r(), d("tr", be, [
258
+ n("td", {
259
+ colspan: a.selectable ? a.headers.length + 1 : a.headers.length,
256
260
  class: "h-96 text-center align-middle hover:bg-transparent"
257
261
  }, [
258
- r("div", Ce, [
259
- r("div", Se, [
260
- $(oe, {
261
- icon: s.emptyIcon,
262
+ n("div", Pe, [
263
+ n("div", xe, [
264
+ C(oe, {
265
+ icon: a.emptyIcon,
262
266
  class: "h-6 w-6 text-muted-foreground/80"
263
267
  }, null, 8, ["icon"])
264
268
  ]),
265
- r("h3", $e, le(s.emptyMessage), 1),
266
- r("p", Ie, [
267
- I(e.$slots, "empty-description", {}, () => [
268
- t[5] || (t[5] = ae(" No results found. Try adjusting your filters or search terms. ", -1))
269
+ n("h3", Ce, M(a.emptyTitle), 1),
270
+ n("p", Se, [
271
+ S(e.$slots, "empty-description", {}, () => [
272
+ ae(M(a.emptyDescription), 1)
269
273
  ], !0)
270
274
  ]),
271
- e.$slots["empty-action"] ? (n(), i("div", Be, [
272
- I(e.$slots, "empty-action", {}, void 0, !0)
273
- ])) : k("", !0)
275
+ e.$slots["empty-action"] ? (r(), d("div", Ie, [
276
+ S(e.$slots, "empty-action", {}, void 0, !0)
277
+ ])) : I("", !0)
274
278
  ])
275
- ], 8, xe)
279
+ ], 8, ke)
276
280
  ]))
277
281
  ])
278
282
  ], 2)
279
283
  ])
280
284
  ], 2),
281
- s.showPagination && s.pageInfo ? (n(), i("div", Fe, [
282
- $(se(de), {
285
+ a.showPagination && a.pageInfo && a.pageInfo.totalItems > 0 ? (r(), d("div", $e, [
286
+ C(se(ie), {
283
287
  "current-page": h.value,
284
- "total-pages": s.pageInfo.totalPages,
288
+ "total-pages": a.pageInfo.totalPages,
285
289
  "show-page-info": !1,
286
- "show-items-per-page": s.showItemsPerPage,
287
- "items-per-page": x.value,
288
- "items-per-page-options": s.itemsPerPageOptions,
290
+ "show-items-per-page": a.showItemsPerPage,
291
+ "items-per-page": k.value,
292
+ "items-per-page-options": a.itemsPerPageOptions,
289
293
  "nav-type": "icon",
290
- onChange: H,
291
- "onUpdate:itemsPerPage": J
294
+ onChange: J,
295
+ "onUpdate:itemsPerPage": K
292
296
  }, null, 8, ["current-page", "total-pages", "show-items-per-page", "items-per-page", "items-per-page-options"])
293
- ])) : k("", !0),
294
- $(ie, {
295
- show: C.value,
296
- "onUpdate:show": t[2] || (t[2] = (l) => C.value = l),
297
+ ])) : I("", !0),
298
+ C(de, {
299
+ show: P.value,
300
+ "onUpdate:show": t[2] || (t[2] = (s) => P.value = s),
297
301
  title: "Confirm Deletion",
298
302
  description: "Are you sure you want to delete the selected items?",
299
303
  "confirm-text": "Delete",
300
304
  "cancel-text": "Cancel",
301
305
  variant: "danger",
302
- onConfirm: Q,
303
- onCancel: t[3] || (t[3] = (l) => C.value = !1)
306
+ onConfirm: X,
307
+ onCancel: t[3] || (t[3] = (s) => P.value = !1)
304
308
  }, null, 8, ["show"])
305
309
  ]));
306
310
  }
307
311
  });
308
312
  export {
309
- Ae as default
313
+ Ve as default
310
314
  };
@@ -3,6 +3,7 @@ interface Props {
3
3
  header: TableHeader;
4
4
  sortConfig?: SortConfig;
5
5
  compact?: boolean;
6
+ tableSortable?: boolean;
6
7
  }
7
8
  declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
8
9
  sort: (field: string) => any;
@@ -10,5 +11,6 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
10
11
  onSort?: (field: string) => any;
11
12
  }>, {
12
13
  compact: boolean;
14
+ tableSortable: boolean;
13
15
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLTableCellElement>;
14
16
  export default _default;
@@ -1,25 +1,26 @@
1
- import { defineComponent as m, computed as o, openBlock as n, createElementBlock as a, normalizeClass as r, createElementVNode as s, toDisplayString as p, createVNode as g, createCommentVNode as x } from "vue";
2
- import y from "../Icon.vue.js";
3
- const C = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 truncate" }, b = {
1
+ import { defineComponent as m, computed as o, openBlock as a, createElementBlock as n, normalizeClass as r, createElementVNode as l, toDisplayString as p, createVNode as g, createCommentVNode as x } from "vue";
2
+ import b from "../Icon.vue.js";
3
+ const y = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 truncate" }, C = {
4
4
  key: 0,
5
5
  class: "w-4 h-4 shrink-0"
6
- }, j = /* @__PURE__ */ m({
6
+ }, S = /* @__PURE__ */ m({
7
7
  __name: "DataTableHeader",
8
8
  props: {
9
9
  header: {},
10
10
  sortConfig: {},
11
- compact: { type: Boolean, default: !1 }
11
+ compact: { type: Boolean, default: !1 },
12
+ tableSortable: { type: Boolean, default: !0 }
12
13
  },
13
14
  emits: ["sort"],
14
- setup(t, { emit: i }) {
15
- const e = t, l = i, c = o(() => e.sortConfig?.field === e.header.field && e.sortConfig?.order), d = o(() => !e.sortConfig || e.sortConfig.field !== e.header.field ? "lucide:chevrons-up-down" : e.sortConfig.order === "asc" ? "lucide:arrow-up" : e.sortConfig.order === "desc" ? "lucide:arrow-down" : "lucide:chevrons-up-down"), f = () => {
16
- e.header.sortable !== !1 && l("sort", e.header.field);
15
+ setup(t, { emit: s }) {
16
+ const e = t, i = s, c = o(() => e.sortConfig?.field === e.header.field && e.sortConfig?.order), d = o(() => !e.sortConfig || e.sortConfig.field !== e.header.field ? "lucide:chevrons-up-down" : e.sortConfig.order === "asc" ? "lucide:arrow-up" : e.sortConfig.order === "desc" ? "lucide:arrow-down" : "lucide:chevrons-up-down"), f = () => {
17
+ e.tableSortable && e.header.sortable !== !1 && i("sort", e.header.field);
17
18
  }, u = o(() => ({
18
19
  left: "justify-start text-left",
19
20
  center: "justify-center text-center",
20
21
  right: "justify-end text-right"
21
22
  })[e.header.align || "left"]);
22
- return (h, v) => (n(), a("th", {
23
+ return (h, v) => (a(), n("th", {
23
24
  scope: "col",
24
25
  class: r(["h-10 px-3 text-left align-middle font-medium text-muted-foreground transition-colors [&:has([role=checkbox])]:pr-0 overflow-hidden", [
25
26
  t.compact ? "py-2" : "py-3!",
@@ -28,12 +29,12 @@ const C = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 tr
28
29
  ]]),
29
30
  onClick: f
30
31
  }, [
31
- s("div", {
32
+ l("div", {
32
33
  class: r(["flex items-center gap-2 space-x-2", u.value])
33
34
  }, [
34
- s("span", C, p(t.header.title), 1),
35
- t.header.sortable !== !1 ? (n(), a("span", b, [
36
- g(y, {
35
+ l("span", y, p(t.header.title), 1),
36
+ t.tableSortable && t.header.sortable !== !1 ? (a(), n("span", C, [
37
+ g(b, {
37
38
  icon: d.value,
38
39
  class: r(["w-3.5 h-3.5 transition-all text-muted-foreground mt-0.5", [
39
40
  c.value ? "opacity-100 text-foreground" : "opacity-0 group-hover:opacity-100"
@@ -45,5 +46,5 @@ const C = { class: "text-xs font-bold! uppercase tracking-wider text-gray-900 tr
45
46
  }
46
47
  });
47
48
  export {
48
- j as default
49
+ S as default
49
50
  };