vlite3 0.6.6 → 0.6.8

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 (26) hide show
  1. package/components/DataTable/DataTable.vue.js +232 -209
  2. package/components/DataTable/types.d.ts +15 -0
  3. package/components/DataTable/types.js +4 -0
  4. package/components/Dropdown/Dropdown.vue.js +13 -21
  5. package/components/Modal.vue.js +2 -2
  6. package/components/Modal.vue2.js +58 -56
  7. package/components/PermissionMatrix/PermissionEditor.vue.d.ts +0 -12
  8. package/components/PermissionMatrix/PermissionEditor.vue.js +120 -524
  9. package/components/PermissionMatrix/PermissionEditorList.vue.d.ts +18 -0
  10. package/components/PermissionMatrix/PermissionEditorList.vue.js +7 -0
  11. package/components/PermissionMatrix/PermissionEditorList.vue2.js +162 -0
  12. package/components/PermissionMatrix/PermissionEditorMatrix.vue.d.ts +18 -0
  13. package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +7 -0
  14. package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +206 -0
  15. package/components/PermissionMatrix/PermissionMatrix.vue.js +1 -1
  16. package/components/PermissionMatrix/PermissionMatrix.vue2.js +115 -126
  17. package/components/PermissionMatrix/PermissionTopBar.vue.d.ts +28 -0
  18. package/components/PermissionMatrix/PermissionTopBar.vue.js +132 -0
  19. package/components/PermissionMatrix/PermissionTopBar.vue2.js +4 -0
  20. package/components/PermissionMatrix/utils.d.ts +11 -0
  21. package/components/PermissionMatrix/utils.js +20 -0
  22. package/components/Screen/Screen.vue.js +113 -107
  23. package/components/SidePanel.vue.js +57 -53
  24. package/index.js +179 -177
  25. package/package.json +1 -1
  26. package/style.css +1 -1
@@ -1,23 +1,24 @@
1
- import { defineComponent as de, ref as b, computed as r, watch as h, openBlock as n, createElementBlock as d, createBlock as B, normalizeClass as I, createSlots as M, withCtx as S, renderSlot as T, createCommentVNode as D, createElementVNode as c, createVNode as R, Fragment as F, renderList as x, normalizeStyle as j, mergeProps as O, unref as L } from "vue";
2
- import ce from "../CheckBox.vue.js";
3
- import ue from "../Button.vue.js";
4
- import me from "../ConfirmationModal.vue.js";
5
- import fe from "../Pagination/Pagination.vue.js";
6
- import ve from "../Empty/Empty.vue.js";
7
- import he from "./DataTableHeader.vue.js";
8
- import ge from "./DataTableRow.vue.js";
9
- import be from "./DataTableToolbar.vue.js";
10
- import { $t as w } from "../../utils/i18n.js";
11
- const pe = { class: "space-y-6.5" }, ye = { class: "overflow-x-auto w-full" }, we = { class: "hover:bg-transparent" }, ke = {
1
+ import { defineComponent as me, inject as ve, computed as n, ref as b, watch as g, openBlock as r, createElementBlock as u, createBlock as R, normalizeClass as S, createSlots as M, withCtx as T, renderSlot as D, createCommentVNode as x, createElementVNode as f, createVNode as z, Fragment as A, renderList as $, normalizeStyle as L, mergeProps as Y, unref as W } from "vue";
2
+ import he from "../CheckBox.vue.js";
3
+ import ge from "../Button.vue.js";
4
+ import pe from "../ConfirmationModal.vue.js";
5
+ import be from "../Pagination/Pagination.vue.js";
6
+ import ye from "../Empty/Empty.vue.js";
7
+ import we from "./DataTableHeader.vue.js";
8
+ import Pe from "./DataTableRow.vue.js";
9
+ import Ce from "./DataTableToolbar.vue.js";
10
+ import { $t as P } from "../../utils/i18n.js";
11
+ import { SCREEN_CONTEXT_KEY as ke } from "./types.js";
12
+ const Ie = { class: "space-y-6.5" }, Se = { class: "overflow-x-auto w-full" }, Te = { class: "hover:bg-transparent" }, De = {
12
13
  key: 0,
13
14
  scope: "col",
14
15
  class: "w-[48px] px-0 text-center font-medium text-muted-foreground",
15
16
  style: { width: "48px" }
16
- }, Pe = { class: "flex items-center justify-center" }, Ce = { class: "[&_tr:last-child]:border-0" }, Ie = {
17
+ }, xe = { class: "flex items-center justify-center" }, $e = { class: "[&_tr:last-child]:border-0" }, Be = {
17
18
  key: 0,
18
19
  class: "w-[48px] px-0 py-4 align-middle text-center",
19
20
  style: { width: "48px" }
20
- }, Se = { key: 2 }, Te = ["colspan"], De = { key: 1 }, Ue = /* @__PURE__ */ de({
21
+ }, Ee = { key: 2 }, Re = ["colspan"], ze = { key: 1 }, We = /* @__PURE__ */ me({
21
22
  __name: "DataTable",
22
23
  props: {
23
24
  rows: { default: () => [] },
@@ -29,7 +30,7 @@ const pe = { class: "space-y-6.5" }, ye = { class: "overflow-x-auto w-full" }, w
29
30
  toolbarClass: {},
30
31
  toolbarSearchClass: {},
31
32
  headers: { default: () => [] },
32
- keyField: { default: "_id" },
33
+ keyField: { default: "auto" },
33
34
  loading: { type: Boolean, default: !1 },
34
35
  selectable: { type: Boolean, default: !1 },
35
36
  emptyTitle: {},
@@ -56,298 +57,320 @@ const pe = { class: "space-y-6.5" }, ye = { class: "overflow-x-auto w-full" }, w
56
57
  variant: { default: "default" }
57
58
  },
58
59
  emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
59
- setup(a, { emit: W }) {
60
- const q = (e, l) => {
61
- if (!(!e || !l))
62
- return l.includes(".") ? l.split(".").reduce((o, m) => o?.[m], e) : e[l];
63
- }, u = (e, l) => q(e, l), t = a, p = W, i = b({ field: "", order: "" }), k = b(
64
- t.pageInfo?.itemsPerPage || t.paginationProps?.itemsPerPage || 10
65
- ), g = b(t.pageInfo?.currentPage || 1), y = b(t.search || ""), P = b(!1), C = b("initial"), G = r(() => t.loading);
66
- h(
67
- () => t.loading,
68
- (e, l) => {
69
- !e && l && (C.value = "idle");
60
+ setup(o, { emit: X }) {
61
+ const q = (e, t) => {
62
+ if (!(!e || !t))
63
+ return t.includes(".") ? t.split(".").reduce((a, c) => a?.[c], e) : e[t];
64
+ }, m = (e, t) => q(e, t), G = (e, t) => {
65
+ const a = ["id", "_id"];
66
+ if (t && t !== "auto") return t;
67
+ if (e && e.length > 0) {
68
+ for (const c of a)
69
+ if (c in e[0]) return c;
70
70
  }
71
- ), h(
72
- () => t.search,
71
+ return "_id";
72
+ }, l = o, y = X, j = ve(ke, null), O = n(() => j?.disableSearch ? !1 : l.showSearch), B = n(() => !!(l.selectable || j?.forceSelectable)), i = n(() => G(l.rows, l.keyField)), d = b({ field: "", order: "" }), C = b(
73
+ l.pageInfo?.itemsPerPage || l.paginationProps?.itemsPerPage || 10
74
+ ), p = b(l.pageInfo?.currentPage || 1), w = b(l.search || ""), k = b(!1), I = b("initial"), H = n(() => l.loading);
75
+ g(
76
+ () => l.loading,
77
+ (e, t) => {
78
+ !e && t && (I.value = "idle");
79
+ }
80
+ ), g(
81
+ () => l.search,
73
82
  (e) => {
74
- e !== void 0 && e !== y.value && (y.value = e);
83
+ e !== void 0 && e !== w.value && (w.value = e);
75
84
  }
76
85
  );
77
- let z = null;
78
- h(y, (e) => {
79
- z && clearTimeout(z), z = setTimeout(() => {
80
- g.value = 1, C.value = "search", $();
86
+ let N = null;
87
+ g(w, () => {
88
+ N && clearTimeout(N), N = setTimeout(() => {
89
+ p.value = 1, I.value = "search", E();
81
90
  }, 300);
82
- }), h(
83
- () => t.pageInfo?.itemsPerPage,
91
+ }), g(
92
+ () => l.pageInfo?.itemsPerPage,
84
93
  (e) => {
85
- e !== void 0 && (k.value = e);
94
+ e !== void 0 && (C.value = e);
86
95
  }
87
- ), h(
88
- () => t.paginationProps?.itemsPerPage,
96
+ ), g(
97
+ () => l.paginationProps?.itemsPerPage,
89
98
  (e) => {
90
- e !== void 0 && (k.value = e);
99
+ e !== void 0 && (C.value = e);
91
100
  }
92
- ), h(
93
- () => t.pageInfo?.currentPage,
101
+ ), g(
102
+ () => l.pageInfo?.currentPage,
94
103
  (e) => {
95
- e && (g.value = e);
104
+ e && (p.value = e);
96
105
  }
97
106
  );
98
- const N = (e) => u(e, t.keyField), s = b(/* @__PURE__ */ new Set());
99
- h(
100
- () => t.selectedRows,
107
+ const s = b(/* @__PURE__ */ new Set());
108
+ g(
109
+ () => l.selectedRows,
101
110
  (e) => {
102
- const l = new Set((e || []).map((o) => u(o, t.keyField)));
103
- (l.size !== s.value.size || [...l].some((o) => !s.value.has(o))) && (s.value = l);
111
+ const t = new Set(
112
+ (e || []).map((a) => m(a, i.value))
113
+ );
114
+ (t.size !== s.value.size || [...t].some((a) => !s.value.has(a))) && (s.value = t);
104
115
  },
105
116
  { immediate: !0, deep: !0 }
106
117
  );
107
- const E = r(() => t.rows.length === 0 ? !1 : t.rows.every((e) => s.value.has(u(e, t.keyField)))), U = r(() => s.value.size > 0 && !E.value), H = r(() => {
108
- const e = [...t.selectedRows || [], ...t.rows], l = /* @__PURE__ */ new Map();
109
- return e.forEach((o) => l.set(u(o, t.keyField), o)), Array.from(s.value).map((o) => l.get(o)).filter(Boolean);
110
- }), J = (e) => {
111
- e ? t.rows.forEach((l) => s.value.add(u(l, t.keyField))) : s.value.size > 0 && t.rows.forEach((l) => s.value.delete(u(l, t.keyField))), V();
112
- }, K = (e) => {
113
- s.value.has(e) ? s.value.delete(e) : s.value.add(e), V();
114
- }, V = () => {
115
- const e = t.selectedRows || [], l = /* @__PURE__ */ new Set(), o = [];
116
- t.rows.forEach((f) => {
117
- const v = u(f, t.keyField);
118
- s.value.has(v) && (o.push(f), l.add(v));
119
- }), e.forEach((f) => {
120
- const v = u(f, t.keyField);
121
- !l.has(v) && s.value.has(v) && (o.push(f), l.add(v));
118
+ const U = n(() => l.rows.length === 0 ? !1 : l.rows.every(
119
+ (e) => s.value.has(m(e, i.value))
120
+ )), V = n(
121
+ () => s.value.size > 0 && !U.value
122
+ ), J = n(() => {
123
+ const e = [...l.selectedRows || [], ...l.rows], t = /* @__PURE__ */ new Map();
124
+ return e.forEach((a) => t.set(m(a, i.value), a)), Array.from(s.value).map((a) => t.get(a)).filter(Boolean);
125
+ }), Q = (e) => {
126
+ e ? l.rows.forEach(
127
+ (t) => s.value.add(m(t, i.value))
128
+ ) : s.value.size > 0 && l.rows.forEach(
129
+ (t) => s.value.delete(m(t, i.value))
130
+ ), K();
131
+ }, Z = (e) => {
132
+ s.value.has(e) ? s.value.delete(e) : s.value.add(e), K();
133
+ }, K = () => {
134
+ const e = l.selectedRows || [], t = /* @__PURE__ */ new Set(), a = [];
135
+ l.rows.forEach((v) => {
136
+ const h = m(v, i.value);
137
+ s.value.has(h) && (a.push(v), t.add(h));
138
+ }), e.forEach((v) => {
139
+ const h = m(v, i.value);
140
+ !t.has(h) && s.value.has(h) && (a.push(v), t.add(h));
122
141
  });
123
- const m = {
124
- selected: o,
125
- all: E.value,
126
- indeterminate: U.value
142
+ const c = {
143
+ selected: a,
144
+ all: U.value,
145
+ indeterminate: V.value
127
146
  };
128
- p("select", m), p("update:selectedRows", o);
129
- }, Q = (e) => {
130
- 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"), g.value = 1, C.value = "sort", $();
131
- }, X = (e) => {
132
- g.value = e, C.value = "page", $();
133
- }, Y = (e) => {
134
- k.value = e, g.value = 1, C.value = "limit", p("update:itemsPerPage", e), $();
135
- }, Z = (e) => {
136
- p("rowClick", e);
137
- }, _ = () => {
138
- const e = H.value;
139
- p("delete", e), P.value = !1;
147
+ y("select", c), y("update:selectedRows", a);
148
+ }, _ = (e) => {
149
+ 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"), p.value = 1, I.value = "sort", E();
150
+ }, ee = (e) => {
151
+ p.value = e, I.value = "page", E();
152
+ }, te = (e) => {
153
+ C.value = e, p.value = 1, I.value = "limit", y("update:itemsPerPage", e), E();
154
+ }, le = (e) => {
155
+ y("rowClick", e);
156
+ }, ae = () => {
157
+ const e = J.value;
158
+ y("delete", e), k.value = !1;
140
159
  };
141
- let A = null;
142
- const $ = () => {
143
- A && clearTimeout(A), A = setTimeout(() => {
144
- p("change", {
160
+ let F = null;
161
+ const E = () => {
162
+ F && clearTimeout(F), F = setTimeout(() => {
163
+ y("change", {
145
164
  pagination: {
146
- page: g.value,
147
- limit: k.value
165
+ page: p.value,
166
+ limit: C.value
148
167
  },
149
- sorting: { ...i.value },
150
- search: y.value
168
+ sorting: { ...d.value },
169
+ search: w.value
151
170
  });
152
171
  }, 10);
153
- }, ee = r(() => [
154
- "w-full flex flex-col",
155
- t.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
156
- "overflow-hidden",
157
- t.bordered ? "border border-border" : "",
158
- t.class
159
- ].join(" ")), te = r(() => ["w-full caption-bottom -text-fs-1", t.tableClass].join(" ")), le = (e) => e.width ? e.width : "auto";
160
- h(
161
- () => t.rows,
172
+ };
173
+ g(
174
+ () => l.rows,
162
175
  () => {
163
- const e = new Set(t.rows.map((l) => u(l, t.keyField)));
164
- s.value = new Set([...s.value].filter((l) => e.has(l)));
176
+ const e = new Set(
177
+ l.rows.map((t) => m(t, i.value))
178
+ );
179
+ s.value = new Set([...s.value].filter((t) => e.has(t)));
165
180
  }
166
181
  );
167
- const ae = r(() => t.emptyTitleI18n ? w(t.emptyTitleI18n) : t.emptyTitle), oe = r(() => t.emptyDescriptionI18n ? w(t.emptyDescriptionI18n) : t.emptyDescription), se = r(() => {
168
- const e = w("vlite.dataTable.confirmDeleteTitle");
182
+ const oe = n(() => [
183
+ "w-full flex flex-col",
184
+ l.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
185
+ "overflow-hidden",
186
+ l.bordered ? "border border-border" : "",
187
+ l.class
188
+ ].join(" ")), se = n(
189
+ () => ["w-full caption-bottom -text-fs-1", l.tableClass].join(" ")
190
+ ), ne = (e) => e.width || "auto", re = n(
191
+ () => l.emptyTitleI18n ? P(l.emptyTitleI18n) : l.emptyTitle
192
+ ), ie = n(
193
+ () => l.emptyDescriptionI18n ? P(l.emptyDescriptionI18n) : l.emptyDescription
194
+ ), de = n(() => {
195
+ const e = P("vlite.dataTable.confirmDeleteTitle");
169
196
  return e !== "vlite.dataTable.confirmDeleteTitle" ? e : "Confirm Deletion";
170
- }), ne = r(() => {
171
- const e = w("vlite.dataTable.confirmDeleteDesc");
197
+ }), ce = n(() => {
198
+ const e = P("vlite.dataTable.confirmDeleteDesc");
172
199
  return e !== "vlite.dataTable.confirmDeleteDesc" ? e : "Are you sure you want to delete the selected items?";
173
- }), re = r(() => {
174
- const e = w("vlite.dataTable.deleteBtn");
200
+ }), ue = n(() => {
201
+ const e = P("vlite.dataTable.deleteBtn");
175
202
  return e !== "vlite.dataTable.deleteBtn" ? e : "Delete";
176
- }), ie = r(() => {
177
- const e = w("vlite.dataTable.cancelBtn");
203
+ }), fe = n(() => {
204
+ const e = P("vlite.dataTable.cancelBtn");
178
205
  return e !== "vlite.dataTable.cancelBtn" ? e : "Cancel";
179
206
  });
180
- return (e, l) => (n(), d("div", pe, [
181
- a.showSearch || e.$slots?.["toolbar-left"] || e.$slots?.["toolbar-right"] ? (n(), B(be, {
207
+ return (e, t) => (r(), u("div", Ie, [
208
+ O.value || e.$slots?.["toolbar-left"] || e.$slots?.["toolbar-right"] ? (r(), R(Ce, {
182
209
  key: 0,
183
- modelValue: y.value,
184
- "onUpdate:modelValue": l[1] || (l[1] = (o) => y.value = o),
185
- "show-search": a.showSearch,
186
- placeholder: a.searchPlaceholder,
187
- placeholderI18n: a.searchPlaceholderI18n,
188
- class: I(a.toolbarClass),
189
- "search-class": a.toolbarSearchClass
210
+ modelValue: w.value,
211
+ "onUpdate:modelValue": t[1] || (t[1] = (a) => w.value = a),
212
+ "show-search": O.value,
213
+ placeholder: o.searchPlaceholder,
214
+ placeholderI18n: o.searchPlaceholderI18n,
215
+ class: S(o.toolbarClass),
216
+ "search-class": o.toolbarSearchClass
190
217
  }, M({ _: 2 }, [
191
218
  e.$slots?.["toolbar-left"] ? {
192
219
  name: "left",
193
- fn: S(() => [
194
- T(e.$slots, "toolbar-left")
220
+ fn: T(() => [
221
+ D(e.$slots, "toolbar-left")
195
222
  ]),
196
223
  key: "0"
197
224
  } : void 0,
198
225
  s.value.size > 0 ? {
199
226
  name: "delete",
200
- fn: S(() => [
201
- s.value.size > 0 ? (n(), B(ue, {
227
+ fn: T(() => [
228
+ s.value.size > 0 ? (r(), R(ge, {
202
229
  key: 0,
203
230
  rounded: "full",
204
231
  variant: "outline",
205
232
  size: "lg",
206
233
  icon: "lucide:trash-2",
207
- onClick: l[0] || (l[0] = (o) => P.value = !0)
208
- })) : D("", !0)
234
+ onClick: t[0] || (t[0] = (a) => k.value = !0)
235
+ })) : x("", !0)
209
236
  ]),
210
237
  key: "1"
211
238
  } : void 0,
212
239
  e.$slots?.["toolbar-right"] ? {
213
240
  name: "right",
214
- fn: S(() => [
215
- T(e.$slots, "toolbar-right")
241
+ fn: T(() => [
242
+ D(e.$slots, "toolbar-right")
216
243
  ]),
217
244
  key: "2"
218
245
  } : void 0
219
- ]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) : D("", !0),
220
- c("div", {
221
- class: I(ee.value)
246
+ ]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) : x("", !0),
247
+ f("div", {
248
+ class: S(oe.value)
222
249
  }, [
223
- c("div", ye, [
224
- c("table", {
225
- class: I([te.value, "data-table"])
250
+ f("div", Se, [
251
+ f("table", {
252
+ class: S([se.value, "data-table"])
226
253
  }, [
227
- c("thead", {
228
- class: I([
254
+ f("thead", {
255
+ class: S([
229
256
  "[&_tr]:border-b [&_tr]:border-border bg-muted",
230
- a.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
257
+ o.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
231
258
  ])
232
259
  }, [
233
- c("tr", we, [
234
- a.selectable ? (n(), d("th", ke, [
235
- c("div", Pe, [
236
- R(ce, {
237
- "model-value": E.value,
238
- indeterminate: U.value,
260
+ f("tr", Te, [
261
+ B.value ? (r(), u("th", De, [
262
+ f("div", xe, [
263
+ z(he, {
264
+ "model-value": U.value,
265
+ indeterminate: V.value,
239
266
  size: "xs",
240
- "onUpdate:modelValue": J
267
+ "onUpdate:modelValue": Q
241
268
  }, null, 8, ["model-value", "indeterminate"])
242
269
  ])
243
- ])) : D("", !0),
244
- (n(!0), d(F, null, x(a.headers, (o) => (n(), B(he, {
245
- key: o.field,
246
- header: o,
247
- "sort-config": i.value,
248
- compact: a.compact,
249
- "table-sortable": a.sortable,
250
- onSort: Q,
270
+ ])) : x("", !0),
271
+ (r(!0), u(A, null, $(o.headers, (a) => (r(), R(we, {
272
+ key: a.field,
273
+ header: a,
274
+ "sort-config": d.value,
275
+ compact: o.compact,
276
+ "table-sortable": o.sortable,
277
+ onSort: _,
251
278
  class: "last:pr-5!",
252
- style: j({
253
- width: le(o)
254
- })
279
+ style: L({ width: ne(a) })
255
280
  }, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
256
281
  ])
257
282
  ], 2),
258
- c("tbody", Ce, [
259
- G.value ? (n(!0), d(F, { key: 0 }, x(Math.min(k.value, 15), (o) => (n(), d("tr", {
260
- key: "skeleton-" + o,
283
+ f("tbody", $e, [
284
+ H.value ? (r(!0), u(A, { key: 0 }, $(Math.min(C.value, 15), (a) => (r(), u("tr", {
285
+ key: "skeleton-" + a,
261
286
  class: "border-b border-border/70 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
262
287
  }, [
263
- a.selectable ? (n(), d("td", Ie, [...l[4] || (l[4] = [
264
- c("div", { class: "flex items-center justify-center" }, [
265
- c("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
288
+ B.value ? (r(), u("td", Be, [...t[4] || (t[4] = [
289
+ f("div", { class: "flex items-center justify-center" }, [
290
+ f("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
266
291
  ], -1)
267
- ])])) : D("", !0),
268
- (n(!0), d(F, null, x(a.headers, (m) => (n(), d("td", {
269
- key: m.field,
270
- class: I(["p-5! align-middle last:pr-6!", [m.hideOnMobile ? "hidden md:table-cell" : ""]])
292
+ ])])) : x("", !0),
293
+ (r(!0), u(A, null, $(o.headers, (c) => (r(), u("td", {
294
+ key: c.field,
295
+ class: S(["p-5! align-middle last:pr-6!", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
271
296
  }, [
272
- c("div", {
297
+ f("div", {
273
298
  class: "rounded-md bg-muted/50 animate-pulse h-4 w-full",
274
- style: j({
275
- width: `${50 + Math.random() * 40}%`
276
- })
299
+ style: L({ width: `${50 + Math.random() * 40}%` })
277
300
  }, null, 4)
278
301
  ], 2))), 128))
279
- ]))), 128)) : a.rows.length > 0 ? (n(!0), d(F, { key: 1 }, x(a.rows, (o, m) => (n(), B(ge, {
280
- key: N(o),
281
- row: o,
282
- headers: a.headers,
283
- index: m,
284
- "key-field": a.keyField,
285
- selectable: a.selectable,
286
- "is-selected": s.value.has(N(o)),
287
- hoverable: a.hoverable,
288
- striped: a.striped,
289
- compact: a.compact,
290
- onSelect: K,
291
- onRowClick: Z,
302
+ ]))), 128)) : o.rows.length > 0 ? (r(!0), u(A, { key: 1 }, $(o.rows, (a, c) => (r(), R(Pe, {
303
+ key: m(a, i.value),
304
+ row: a,
305
+ headers: o.headers,
306
+ index: c,
307
+ "key-field": i.value,
308
+ selectable: B.value,
309
+ "is-selected": s.value.has(m(a, i.value)),
310
+ hoverable: o.hoverable,
311
+ striped: o.striped,
312
+ compact: o.compact,
313
+ onSelect: Z,
314
+ onRowClick: le,
292
315
  class: "[&_td:last-child]:pr-3.5!"
293
316
  }, M({ _: 2 }, [
294
- x(a.headers, (f) => ({
295
- name: f.field,
296
- fn: S((v) => [
297
- T(e.$slots, f.field, O({ ref_for: !0 }, v))
317
+ $(o.headers, (v) => ({
318
+ name: v.field,
319
+ fn: T((h) => [
320
+ D(e.$slots, v.field, Y({ ref_for: !0 }, h))
298
321
  ])
299
322
  }))
300
- ]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (n(), d("tr", Se, [
301
- c("td", {
302
- colspan: a.selectable ? a.headers.length + 1 : a.headers.length,
323
+ ]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (r(), u("tr", Ee, [
324
+ f("td", {
325
+ colspan: B.value ? o.headers.length + 1 : o.headers.length,
303
326
  class: "align-middle hover:bg-transparent"
304
327
  }, [
305
- T(e.$slots, "empty", {}, () => [
306
- R(L(ve), {
307
- title: ae.value,
308
- description: oe.value,
309
- icon: a.emptyIcon,
328
+ D(e.$slots, "empty", {}, () => [
329
+ z(W(ye), {
330
+ title: re.value,
331
+ description: ie.value,
332
+ icon: o.emptyIcon,
310
333
  class: "border-none! bg-transparent! py-16!"
311
334
  }, M({ _: 2 }, [
312
335
  e.$slots["empty-action"] ? {
313
336
  name: "action",
314
- fn: S(() => [
315
- T(e.$slots, "empty-action")
337
+ fn: T(() => [
338
+ D(e.$slots, "empty-action")
316
339
  ]),
317
340
  key: "0"
318
341
  } : void 0
319
342
  ]), 1032, ["title", "description", "icon"])
320
343
  ])
321
- ], 8, Te)
344
+ ], 8, Re)
322
345
  ]))
323
346
  ])
324
347
  ], 2)
325
348
  ])
326
349
  ], 2),
327
- a.showPagination && a.pageInfo && a.pageInfo.totalPages > 1 ? (n(), d("div", De, [
328
- R(L(fe), O({
329
- "current-page": g.value,
330
- "total-pages": a.pageInfo.totalPages,
331
- "total-items": a.pageInfo.totalItems
332
- }, a.paginationProps, {
333
- onChange: X,
334
- "onUpdate:itemsPerPage": Y
350
+ o.showPagination && o.pageInfo && o.pageInfo.totalPages > 1 ? (r(), u("div", ze, [
351
+ z(W(be), Y({
352
+ "current-page": p.value,
353
+ "total-pages": o.pageInfo.totalPages,
354
+ "total-items": o.pageInfo.totalItems
355
+ }, o.paginationProps, {
356
+ onChange: ee,
357
+ "onUpdate:itemsPerPage": te
335
358
  }), null, 16, ["current-page", "total-pages", "total-items"])
336
- ])) : D("", !0),
337
- R(me, {
338
- show: P.value,
339
- "onUpdate:show": l[2] || (l[2] = (o) => P.value = o),
340
- title: se.value,
341
- description: ne.value,
342
- "confirm-text": re.value,
343
- "cancel-text": ie.value,
359
+ ])) : x("", !0),
360
+ z(pe, {
361
+ show: k.value,
362
+ "onUpdate:show": t[2] || (t[2] = (a) => k.value = a),
363
+ title: de.value,
364
+ description: ce.value,
365
+ "confirm-text": ue.value,
366
+ "cancel-text": fe.value,
344
367
  variant: "danger",
345
- onConfirm: _,
346
- onCancel: l[3] || (l[3] = (o) => P.value = !1)
368
+ onConfirm: ae,
369
+ onCancel: t[3] || (t[3] = (a) => k.value = !1)
347
370
  }, null, 8, ["show", "title", "description", "confirm-text", "cancel-text"])
348
371
  ]));
349
372
  }
350
373
  });
351
374
  export {
352
- Ue as default
375
+ We as default
353
376
  };
@@ -47,6 +47,13 @@ export interface DataTableProps {
47
47
  toolbarClass?: string;
48
48
  toolbarSearchClass?: string;
49
49
  headers: TableHeader[];
50
+ /**
51
+ * Unique row identifier field.
52
+ * When set to the sentinel value 'auto' (the internal default), DataTable will
53
+ * automatically pick the first matching key from ['id', '_id'] found on the
54
+ * first row. Explicitly passing 'id' or '_id' (or any other string) pins the
55
+ * field to that exact value.
56
+ */
50
57
  keyField?: string;
51
58
  loading?: boolean;
52
59
  selectable?: boolean;
@@ -76,3 +83,11 @@ export interface RowClickPayload {
76
83
  row: any;
77
84
  index: number;
78
85
  }
86
+ /** Shape provided by Screen to deeply nested components */
87
+ export interface ScreenContext {
88
+ /** When true, DataTable should hide its own search toolbar */
89
+ disableSearch: boolean;
90
+ /** When true, DataTable should enable row selection */
91
+ forceSelectable: boolean;
92
+ }
93
+ export declare const SCREEN_CONTEXT_KEY: unique symbol;
@@ -0,0 +1,4 @@
1
+ const e = /* @__PURE__ */ Symbol("screen-context");
2
+ export {
3
+ e as SCREEN_CONTEXT_KEY
4
+ };