vlite3 0.7.4 → 0.7.7

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