laif-ds 0.2.42 → 0.2.43

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,21 +1,21 @@
1
1
  "use client";
2
2
  import { jsx as c, jsxs as ae } from "react/jsx-runtime";
3
- import { useReactTable as Ye } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { cn as Ze } from "../../../../lib/utils.js";
5
- import { useRef as p, useState as u, useEffect as N, useMemo as C } from "react";
6
- import { Button as $e } from "../../button.js";
3
+ import { useReactTable as $e } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { cn as et } from "../../../../lib/utils.js";
5
+ import { useRef as f, useState as u, useEffect as N, useMemo as C } from "react";
6
+ import { Button as tt } from "../../button.js";
7
7
  import { Checkbox as ye } from "../../checkbox.js";
8
- import { DataTableBody as et } from "./components/data-table-body.js";
9
- import { DataTableColumnVisibility as tt } from "./components/data-table-column-visibility.js";
10
- import { DataTableFilters as nt } from "./components/data-table-filters.js";
11
- import { DataTablePaginationComponent as rt } from "./components/data-table-pagination.js";
12
- import { DataTableSearchbar as ot } from "./components/data-table-searchbar.js";
13
- import { DataTableSortingComponent as at } from "./components/data-table-sorting.js";
14
- import { applySearchFilterToRow as Re, debounce as it, buildSearchFilter as st, updatePageSizeFromContainer as lt, createDefaultAdvancedFilter as ct, createBadgeFilterFromHeader as ut } from "./data-table.service.js";
15
- import { DataTableActionsComponent as dt } from "./components/data-table-actions.js";
16
- import { defaultDataTableI18n as mt } from "./data-table-i18n.js";
17
- import { getPaginationRowModel as gt, getFilteredRowModel as pt, getSortedRowModel as ft, getCoreRowModel as ht } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
18
- function Nt({
8
+ import { DataTableBody as nt } from "./components/data-table-body.js";
9
+ import { DataTableColumnVisibility as rt } from "./components/data-table-column-visibility.js";
10
+ import { DataTableFilters as ot } from "./components/data-table-filters.js";
11
+ import { DataTablePaginationComponent as at } from "./components/data-table-pagination.js";
12
+ import { DataTableSearchbar as it } from "./components/data-table-searchbar.js";
13
+ import { DataTableSortingComponent as st } from "./components/data-table-sorting.js";
14
+ import { applySearchFilterToRow as Re, debounce as lt, buildSearchFilter as ct, updatePageSizeFromContainer as ut, createDefaultAdvancedFilter as dt, createBadgeFilterFromHeader as mt } from "./data-table.service.js";
15
+ import { DataTableActionsComponent as gt } from "./components/data-table-actions.js";
16
+ import { defaultDataTableI18n as pt } from "./data-table-i18n.js";
17
+ import { getPaginationRowModel as ft, getFilteredRowModel as ht, getSortedRowModel as bt, getCoreRowModel as Ft } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
18
+ function Gt({
19
19
  columns: Q,
20
20
  data: P,
21
21
  loading: B = !1,
@@ -26,9 +26,11 @@ function Nt({
26
26
  checkable: V = !1,
27
27
  onCheckedRowsChange: Y,
28
28
  actions: ze = [],
29
- hidePagination: ve = !1,
30
- hideActionsRow: Be = !1,
31
- i18n: f = mt,
29
+ customComponentsLeft: ve,
30
+ customComponentsRight: Be,
31
+ hidePagination: Me = !1,
32
+ hideActionsRow: _e = !1,
33
+ i18n: h = pt,
32
34
  maxSortedColumns: se = 2,
33
35
  initialState: m,
34
36
  // New mode-based API
@@ -36,10 +38,10 @@ function Nt({
36
38
  serverConfig: d,
37
39
  disableAutoPageSize: F = !1
38
40
  }) {
39
- const q = p(null), le = (e) => !e || !e.sort_by || !e.sort_order ? [] : e.sort_by.map((t, o) => ({
41
+ const q = f(null), le = (e) => !e || !e.sort_by || !e.sort_order ? [] : e.sort_by.map((t, o) => ({
40
42
  id: t,
41
43
  desc: e.sort_order[o] === "desc"
42
- })), Me = (e) => {
44
+ })), De = (e) => {
43
45
  const t = le(e?.sorting), o = {
44
46
  sort_by: t.map((l) => l.id),
45
47
  sort_order: t.map((l) => l.desc ? "desc" : "asc")
@@ -49,11 +51,11 @@ function Nt({
49
51
  computedFilter: e?.computedFilter
50
52
  // Use provided value or undefined
51
53
  };
52
- }, [O, _e] = u(() => le(m?.sorting)), [De] = u([]), [He, Ne] = u({}), [h, Oe] = u(() => m?.filters?.searchbarFilter), [E, G] = u(() => m?.pagination ?? { pageIndex: 0, pageSize: 10 }), ce = p(d);
54
+ }, [O, He] = u(() => le(m?.sorting)), [Ne] = u([]), [Oe, Ge] = u({}), [g, Le] = u(() => m?.filters?.searchbarFilter), [E, G] = u(() => m?.pagination ?? { pageIndex: 0, pageSize: 10 }), ce = f(d);
53
55
  ce.current = d;
54
- const W = p(d?.onStateChange);
56
+ const W = f(d?.onStateChange);
55
57
  W.current = d?.onStateChange;
56
- const J = p(null), M = p(null), Ge = p(0), ue = p(!1), de = p(null), K = p({}), me = p(null), Z = p(B);
58
+ const J = f(null), M = f(null), ke = f(0), ue = f(!1), de = f(null), K = f({}), me = f(null), Z = f(B);
57
59
  Z.current = B;
58
60
  const L = (e) => {
59
61
  e.computedFilter && (K.current.computedFilter = e.computedFilter), e.computedSorting && (K.current.computedSorting = e.computedSorting);
@@ -64,7 +66,7 @@ function Nt({
64
66
  computedSorting: e.computedSorting || K.current.computedSorting
65
67
  };
66
68
  J.current = t, M.current && clearTimeout(M.current), M.current = setTimeout(() => {
67
- J.current && W.current && (Ge.current = Date.now(), W.current(J.current), J.current = null, M.current = null);
69
+ J.current && W.current && (ke.current = Date.now(), W.current(J.current), J.current = null, M.current = null);
68
70
  }, 400);
69
71
  };
70
72
  N(() => {
@@ -76,7 +78,7 @@ function Nt({
76
78
  };
77
79
  }, []);
78
80
  const [n, k] = u(() => {
79
- const { computedSorting: e, computedFilter: t } = Me(m);
81
+ const { computedSorting: e, computedFilter: t } = De(m);
80
82
  return {
81
83
  pagination: m?.pagination ?? { pageIndex: 0, pageSize: 10 },
82
84
  sorting: m?.sorting,
@@ -86,9 +88,9 @@ function Nt({
86
88
  };
87
89
  });
88
90
  a && !d && console.warn("DataTable: Server mode requires serverConfig");
89
- const [Le, ge] = u(0), [ke, pe] = u(0), [Ae, je] = u({}), fe = ie ? Te : Ae, Pe = ie || je, [I, $] = u(
91
+ const [Ae, ge] = u(0), [je, pe] = u(0), [Pe, Ve] = u({}), fe = ie ? Te : Pe, qe = ie || Ve, [w, $] = u(
90
92
  () => m?.filters?.filterBadges ?? []
91
- ), [S, ee] = u(() => m?.filters?.advancedFilterBadge), [U, Ve] = u(""), [he, be] = u([]), Fe = C(() => V ? [
93
+ ), [y, ee] = u(() => m?.filters?.advancedFilterBadge), [U, Ee] = u(""), [he, be] = u([]), Fe = C(() => V ? [
92
94
  {
93
95
  id: "data-table-integrated-checkbox-column",
94
96
  size: 24,
@@ -105,7 +107,7 @@ function Nt({
105
107
  className: "cursor-pointer",
106
108
  checked: e.getIsAllPageRowsSelected(),
107
109
  onCheckedChange: (t) => e.toggleAllPageRowsSelected(!!t),
108
- "aria-label": f.selectAll
110
+ "aria-label": h.selectAll
109
111
  }
110
112
  )
111
113
  }
@@ -121,7 +123,7 @@ function Nt({
121
123
  className: "cursor-pointer",
122
124
  checked: e.getIsSelected(),
123
125
  onCheckedChange: (t) => e.toggleSelected(!!t),
124
- "aria-label": f.selectRow
126
+ "aria-label": h.selectRow
125
127
  }
126
128
  )
127
129
  }
@@ -148,28 +150,28 @@ function Nt({
148
150
  }, [T]);
149
151
  const _ = C(() => T.filter(
150
152
  (e) => !!e?.meta?.searchable
151
- ), [T]), z = C(() => _.map((e) => e.id ?? e.accessorKey).filter(Boolean), [_]), [X, qe] = u(() => m?.computedFilter ?? {}), Ee = {
153
+ ), [T]), z = C(() => _.map((e) => e.accessorKey ?? e.id).filter(Boolean), [_]), [X, We] = u(() => m?.computedFilter ?? {}), Je = {
152
154
  data: C(() => a || Object.keys(X).length === 0 ? P : P.filter((e) => Re({
153
155
  original: e,
154
156
  getValue: (o) => e[o]
155
157
  }, X)), [P, X, a]),
156
158
  columns: T,
157
- getCoreRowModel: ht(),
159
+ getCoreRowModel: Ft(),
158
160
  onSortingChange: (e) => {
159
161
  const t = typeof e == "function" ? e(O) : e;
160
- _e(t);
162
+ He(t);
161
163
  },
162
- getSortedRowModel: ft(),
164
+ getSortedRowModel: bt(),
163
165
  manualSorting: a,
164
- onColumnVisibilityChange: Ne,
165
- onRowSelectionChange: Pe,
166
+ onColumnVisibilityChange: Ge,
167
+ onRowSelectionChange: qe,
166
168
  onColumnOrderChange: be,
167
- getFilteredRowModel: pt(),
169
+ getFilteredRowModel: ht(),
168
170
  manualFiltering: a,
169
171
  globalFilterFn: (e, t, o) => a || !o ? !0 : (z ?? []).some((l) => {
170
172
  const s = e.getValue(l);
171
173
  return Array.isArray(s) ? s.some(
172
- (g) => String(g).toLowerCase().includes(o.toLowerCase())
174
+ (p) => String(p).toLowerCase().includes(o.toLowerCase())
173
175
  ) : String(s).toLowerCase().includes(o.toLowerCase());
174
176
  }) ?? !1,
175
177
  filterFns: {
@@ -202,21 +204,21 @@ function Nt({
202
204
  } : e
203
205
  );
204
206
  },
205
- getPaginationRowModel: gt(),
207
+ getPaginationRowModel: ft(),
206
208
  manualPagination: a,
207
- pageCount: a && B ? ke : Le,
209
+ pageCount: a && B ? je : Ae,
208
210
  state: {
209
211
  sorting: O,
210
- columnFilters: De,
211
- columnVisibility: He,
212
+ columnFilters: Ne,
213
+ columnVisibility: Oe,
212
214
  rowSelection: fe,
213
- globalFilter: h,
215
+ globalFilter: g,
214
216
  pagination: a ? n.pagination : E,
215
217
  columnOrder: he
216
218
  },
217
219
  // Prevent implicit resets on data/columns changes so filters/sorting persist
218
220
  autoResetPageIndex: !1
219
- }, i = Ye(Ee), te = i.getFilteredRowModel();
221
+ }, i = $e(Je), te = i.getFilteredRowModel();
220
222
  N(() => {
221
223
  if (a && d) {
222
224
  const e = Math.ceil(
@@ -239,26 +241,26 @@ function Nt({
239
241
  ]), N(() => {
240
242
  if (F) return;
241
243
  const e = () => {
242
- const w = q.current;
243
- if (!w) return;
244
- const D = w.querySelector(
244
+ const R = q.current;
245
+ if (!R) return;
246
+ const D = R.querySelector(
245
247
  "thead tr"
246
- ), r = w.querySelector(
248
+ ), r = R.querySelector(
247
249
  "tbody tr"
248
- ), y = D?.getBoundingClientRect().height ?? 40;
250
+ ), I = D?.getBoundingClientRect().height ?? 40;
249
251
  if (!!!r?.querySelector("td")) return;
250
252
  const v = r?.getBoundingClientRect().height ?? 32.5;
251
- lt(w, {
253
+ ut(R, {
252
254
  rowHeight: v,
253
- headerHeight: y,
254
- onPageChange: a ? (R, x) => {
255
+ headerHeight: I,
256
+ onPageChange: a ? (S, x) => {
255
257
  if (d && ue.current) {
256
258
  const b = F ? {
257
259
  ...n.pagination,
258
- pageIndex: R
260
+ pageIndex: S
259
261
  } : {
260
262
  ...n.pagination,
261
- pageIndex: R,
263
+ pageIndex: S,
262
264
  pageSize: x
263
265
  }, re = b.pageIndex === n.pagination.pageIndex, oe = F || b.pageSize === n.pagination.pageSize;
264
266
  if (re && oe)
@@ -272,13 +274,13 @@ function Nt({
272
274
  };
273
275
  k(j), Z.current || L(j);
274
276
  }
275
- } : (R, x) => {
277
+ } : (S, x) => {
276
278
  G(
277
- (b) => F ? { ...b, pageIndex: R } : { pageIndex: R, pageSize: x }
279
+ (b) => F ? { ...b, pageIndex: S } : { pageIndex: S, pageSize: x }
278
280
  );
279
281
  },
280
- setPagination: (R) => {
281
- const x = typeof R == "function" ? R(n.pagination) : R;
282
+ setPagination: (S) => {
283
+ const x = typeof S == "function" ? S(n.pagination) : S;
282
284
  if (a && d) {
283
285
  const b = F ? {
284
286
  ...n.pagination,
@@ -307,7 +309,7 @@ function Nt({
307
309
  );
308
310
  }
309
311
  });
310
- }, t = it(() => {
312
+ }, t = lt(() => {
311
313
  requestAnimationFrame(() => {
312
314
  e();
313
315
  });
@@ -319,14 +321,14 @@ function Nt({
319
321
  });
320
322
  const o = setTimeout(e, 200), l = document.fonts;
321
323
  l && typeof l.ready?.then == "function" && l.ready.then(() => e()), window.addEventListener("resize", t);
322
- const s = q.current, g = typeof ResizeObserver < "u" ? new ResizeObserver((w) => {
323
- const D = w[0];
324
+ const s = q.current, p = typeof ResizeObserver < "u" ? new ResizeObserver((R) => {
325
+ const D = R[0];
324
326
  if (!D) return;
325
- const r = D.contentRect.height, y = me.current;
326
- (y === null || Math.abs(r - y) > 0.5) && (me.current = r, t());
327
+ const r = D.contentRect.height, I = me.current;
328
+ (I === null || Math.abs(r - I) > 0.5) && (me.current = r, t());
327
329
  }) : null;
328
- return s && g && g.observe(s), () => {
329
- window.removeEventListener("resize", t), clearTimeout(o), g && g.disconnect(), clearTimeout(o);
330
+ return s && p && p.observe(s), () => {
331
+ window.removeEventListener("resize", t), clearTimeout(o), p && p.disconnect(), clearTimeout(o);
330
332
  };
331
333
  }, [
332
334
  a,
@@ -340,55 +342,55 @@ function Nt({
340
342
  Y(e);
341
343
  }
342
344
  }, [i, Y, V, fe]);
343
- const We = C(() => {
345
+ const Ke = C(() => {
344
346
  const e = i.getHeaderGroups()[0], t = e ? e.headers : [];
345
- return (i.getState().sorting || []).map((s) => t.find((g) => g.column.id === s.id)).filter(Boolean);
347
+ return (i.getState().sorting || []).map((s) => t.find((p) => p.column.id === s.id)).filter(Boolean);
346
348
  }, [
347
349
  i.getHeaderGroups,
348
350
  i.getState().sorting,
349
351
  T
350
- ]), ne = C(() => i.getHeaderGroups()[0].headers.filter((e) => e.column.columnDef.meta?.sortable), [i.getHeaderGroups, T]), A = C(() => i.getHeaderGroups()[0].headers.filter((e) => e.column.columnDef.meta?.filterable), [i.getHeaderGroups, T]), Je = C(() => U ? A.filter((e) => (e.column.columnDef.header?.toString().toLowerCase() || "").includes(U.toLowerCase())) : A, [A, U]), xe = (e) => {
351
- $((t) => [...t, ut(e)]);
352
- }, Ke = () => {
353
- ee(ct());
354
- }, Ue = C(() => I.sort((e, t) => e.value === void 0 || e.value === "" ? 1 : t.value === void 0 || t.value === "" ? -1 : 1), [I]), Ce = p({
352
+ ]), ne = C(() => i.getHeaderGroups()[0].headers.filter((e) => e.column.columnDef.meta?.sortable), [i.getHeaderGroups, T]), A = C(() => i.getHeaderGroups()[0].headers.filter((e) => e.column.columnDef.meta?.filterable), [i.getHeaderGroups, T]), Ue = C(() => U ? A.filter((e) => (e.column.columnDef.header?.toString().toLowerCase() || "").includes(U.toLowerCase())) : A, [A, U]), xe = (e) => {
353
+ $((t) => [...t, mt(e)]);
354
+ }, Xe = () => {
355
+ ee(dt());
356
+ }, Qe = C(() => w.sort((e, t) => e.value === void 0 || e.value === "" ? 1 : t.value === void 0 || t.value === "" ? -1 : 1), [w]), Ce = f({
355
357
  filterBadges: [],
356
358
  advancedFilterBadge: void 0,
357
359
  searchbarGlobalFilter: void 0
358
360
  });
359
361
  N(() => {
360
- const e = st(
361
- I,
362
- S ?? void 0
363
- ), t = h && z.length > 0 ? z.length === 1 ? (() => {
362
+ const e = ct(
363
+ w,
364
+ y ?? void 0
365
+ ), t = g && z.length > 0 ? z.length === 1 ? (() => {
364
366
  const r = z[0], H = _.find(
365
- (v) => (v.id ?? v.accessorKey) === r
367
+ (v) => (v.accessorKey ?? v.id) === r
366
368
  )?.meta?.type;
367
369
  return H === "list_multi_select" || H === "list_single_select" ? {
368
370
  [r]: {
369
371
  operator: "array_overlap",
370
- value: [h]
372
+ value: [g]
371
373
  }
372
374
  } : {
373
375
  [r]: {
374
376
  operator: "like",
375
- value: h
377
+ value: g
376
378
  }
377
379
  };
378
380
  })() : {
379
381
  _or: z.map((r) => {
380
382
  const H = _.find(
381
- (v) => (v.id ?? v.accessorKey) === r
383
+ (v) => (v.accessorKey ?? v.id) === r
382
384
  )?.meta?.type;
383
385
  return H === "list_multi_select" || H === "list_single_select" ? {
384
386
  [r]: {
385
387
  operator: "array_overlap",
386
- value: [h]
388
+ value: [g]
387
389
  }
388
390
  } : {
389
391
  [r]: {
390
392
  operator: "like",
391
- value: h
393
+ value: g
392
394
  }
393
395
  };
394
396
  })
@@ -398,94 +400,96 @@ function Nt({
398
400
  ], l = o.length === 0 ? {} : o.length === 1 ? o[0] : { _and: o }, s = {
399
401
  sort_by: O.map((r) => r.id),
400
402
  sort_order: O.map((r) => r.desc ? "desc" : "asc")
401
- }, g = Ce.current, w = JSON.stringify(I) !== JSON.stringify(g.filterBadges) || JSON.stringify(S) !== JSON.stringify(g.advancedFilterBadge) || h !== g.searchbarGlobalFilter;
403
+ }, p = Ce.current, R = JSON.stringify(w) !== JSON.stringify(p.filterBadges) || JSON.stringify(y) !== JSON.stringify(p.advancedFilterBadge) || g !== p.searchbarGlobalFilter;
402
404
  Ce.current = {
403
- filterBadges: [...I],
404
- advancedFilterBadge: S ? { ...S } : void 0,
405
- searchbarGlobalFilter: h
405
+ filterBadges: [...w],
406
+ advancedFilterBadge: y ? { ...y } : void 0,
407
+ searchbarGlobalFilter: g
406
408
  };
407
409
  const D = ce.current;
408
- if (qe(l), a && W.current && D) {
410
+ if (We(l), a && W.current && D) {
409
411
  const r = {
410
412
  ...n,
411
413
  computedFilter: l,
412
414
  // Emit only computedSorting. Use empty arrays to signal "no sorting" when cleared.
413
415
  computedSorting: s,
414
416
  filters: {
415
- filterBadges: I,
416
- advancedFilterBadge: S,
417
- searchbarFilter: h
417
+ filterBadges: w,
418
+ advancedFilterBadge: y,
419
+ searchbarFilter: g
418
420
  },
419
421
  pagination: {
420
422
  ...n.pagination,
421
423
  // Only reset pageIndex to 0 when filters actually changed, not when just sorting changed
422
- pageIndex: w ? 0 : n.pagination.pageIndex
424
+ pageIndex: R ? 0 : n.pagination.pageIndex
423
425
  }
424
426
  };
425
427
  k(r);
426
- const y = JSON.stringify({
428
+ const I = JSON.stringify({
427
429
  computedFilter: r.computedFilter,
428
430
  computedSorting: r.computedSorting,
429
431
  filters: r.filters,
430
432
  pagination: r.pagination
431
433
  });
432
- de.current !== y && (de.current = y, L(r));
434
+ de.current !== I && (de.current = I, L(r));
433
435
  } else
434
- w && G((r) => ({
436
+ R && G((r) => ({
435
437
  ...r,
436
438
  pageIndex: 0
437
439
  }));
438
440
  }, [
439
- I,
440
- S,
441
- h,
441
+ w,
442
+ y,
443
+ g,
442
444
  z,
443
445
  _,
444
446
  O,
445
447
  a
446
448
  ]);
447
- const we = i.getAllLeafColumns(), Xe = we.filter((e) => e.getIsVisible()), Qe = we.filter((e) => !e.getIsVisible());
449
+ const we = i.getAllLeafColumns(), Ye = we.filter((e) => e.getIsVisible()), Ze = we.filter((e) => !e.getIsVisible());
448
450
  return /* @__PURE__ */ ae(
449
451
  "div",
450
452
  {
451
- className: Ze(
453
+ className: et(
452
454
  "flex h-full max-h-full min-h-[250px] w-full max-w-full min-w-0 flex-col gap-2",
453
455
  Se
454
456
  ),
455
457
  children: [
456
- !Be && /* @__PURE__ */ ae("div", { className: "flex w-full items-center justify-between gap-1", children: [
458
+ !_e && /* @__PURE__ */ ae("div", { className: "flex w-full items-center justify-between gap-1", children: [
457
459
  /* @__PURE__ */ ae("div", { className: "flex min-w-0 flex-1 items-center gap-1 overflow-x-auto", children: [
458
460
  ne.length > 0 && /* @__PURE__ */ c(
459
- at,
461
+ st,
460
462
  {
461
463
  table: i,
462
- sortedColumns: We,
464
+ sortedColumns: Ke,
463
465
  sortableColumns: ne,
464
- i18n: f,
466
+ i18n: h,
465
467
  maxSortedColumns: se
466
468
  }
467
469
  ),
468
470
  ne.length > 0 && A.length > 0 && /* @__PURE__ */ c("div", { className: "border-d-border h-4 min-h-4 w-[1px] border-r" }),
471
+ ve,
469
472
  /* @__PURE__ */ c(
470
- nt,
473
+ ot,
471
474
  {
472
- advancedFilterBadge: S,
475
+ advancedFilterBadge: y,
473
476
  setAdvancedFilterBadge: ee,
474
477
  filterableColumns: A,
475
- sortedFilterBadges: Ue,
478
+ sortedFilterBadges: Qe,
476
479
  setFilterBadges: $,
477
480
  filterSearch: U,
478
- setFilterSearch: Ve,
479
- filteredColumns: Je,
481
+ setFilterSearch: Ee,
482
+ filteredColumns: Ue,
480
483
  handleAddFilter: xe,
481
- handleAddAdvancedFilter: Ke,
482
- i18n: f
484
+ handleAddAdvancedFilter: Xe,
485
+ i18n: h
483
486
  }
484
487
  )
485
488
  ] }),
486
489
  /* @__PURE__ */ c("div", { className: "border-d-border h-4 min-h-4 w-[1px] border-r" }),
487
- (I.length || S) && /* @__PURE__ */ c(
488
- $e,
490
+ Be,
491
+ (w.length || y) && /* @__PURE__ */ c(
492
+ tt,
489
493
  {
490
494
  className: "h-6 text-xs",
491
495
  iconLeft: "FunnelX",
@@ -494,49 +498,52 @@ function Nt({
494
498
  onClick: () => {
495
499
  $([]), ee(void 0);
496
500
  },
497
- children: f.reset
501
+ children: h.reset
498
502
  }
499
503
  ),
500
504
  z.length > 0 && /* @__PURE__ */ c(
501
- ot,
505
+ it,
502
506
  {
503
507
  debounceMs: 300,
504
- onSearch: Oe,
505
- i18n: f,
506
- initialValue: h ?? "",
508
+ onSearch: Le,
509
+ i18n: h,
510
+ initialValue: g ?? "",
507
511
  searchableColumnsHeaders: _.map(
508
512
  (e) => e.header ? e.header.toString() : e.id?.toString() ?? "-"
509
513
  )
510
514
  }
511
515
  ),
512
516
  /* @__PURE__ */ c(
513
- tt,
517
+ rt,
514
518
  {
515
519
  table: i,
516
- visibleColumns: Xe,
517
- hiddenColumns: Qe,
518
- i18n: f
520
+ visibleColumns: Ye,
521
+ hiddenColumns: Ze,
522
+ i18n: h
519
523
  }
520
524
  ),
521
- /* @__PURE__ */ c(dt, { actions: ze, i18n: f })
525
+ /* @__PURE__ */ c(gt, { actions: ze, i18n: h })
522
526
  ] }),
523
527
  /* @__PURE__ */ c(
524
- et,
528
+ nt,
525
529
  {
526
530
  table: i,
527
531
  tableContainerRef: q,
528
532
  loading: B,
529
533
  data: P,
530
534
  emptyComponent: Ie,
531
- notFoundMessage: f?.notFoundMessage ?? "N/A",
535
+ notFoundMessage: h?.notFoundMessage ?? "N/A",
532
536
  onAddFilter: xe,
533
537
  maxSortedColumns: se,
534
- i18n: f,
535
- isServerSide: a
538
+ i18n: h,
539
+ isServerSide: a,
540
+ filterBadges: w,
541
+ advancedFilterBadge: y,
542
+ searchbarGlobalFilter: g
536
543
  }
537
544
  ),
538
- !ve && /* @__PURE__ */ c(
539
- rt,
545
+ !Me && /* @__PURE__ */ c(
546
+ at,
540
547
  {
541
548
  table: i,
542
549
  isServerSide: a,
@@ -546,7 +553,7 @@ function Nt({
546
553
  k(e), L(e);
547
554
  } : void 0,
548
555
  totalItems: d?.totalItems,
549
- i18n: f
556
+ i18n: h
550
557
  }
551
558
  )
552
559
  ]
@@ -554,5 +561,5 @@ function Nt({
554
561
  );
555
562
  }
556
563
  export {
557
- Nt as DataTable
564
+ Gt as DataTable
558
565
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { getListMultiSelectFilterOptions as v, getListSingleSelectFilterOptions as D, getDateTimeFilterOptions as F, getDateFilterOptions as A, getBooleanFilterOptions as b, getNumberFilterOptions as T, getStringFilterOptions as q } from "./data-table-constants.js";
2
+ import { getListMultiSelectFilterOptions as v, getListSingleSelectFilterOptions as D, getDateTimeFilterOptions as A, getDateFilterOptions as F, getBooleanFilterOptions as b, getNumberFilterOptions as T, getStringFilterOptions as q } from "./data-table-constants.js";
3
3
  import { defaultDataTableI18n as m } from "./data-table-i18n.js";
4
- function L(e, a = "string") {
4
+ function O(e, a = "string") {
5
5
  const t = (s) => {
6
6
  switch (s) {
7
7
  case "string":
@@ -11,9 +11,9 @@ function L(e, a = "string") {
11
11
  case "boolean":
12
12
  return b(m)?.[0]?.value ?? "eq";
13
13
  case "date":
14
- return A(m)?.[0]?.value ?? "eq";
14
+ return F(m)?.[0]?.value ?? "eq";
15
15
  case "datetime":
16
- return F(m)?.[0]?.value ?? "date_time_before";
16
+ return A(m)?.[0]?.value ?? "date_time_before";
17
17
  case "list_single_select":
18
18
  return D(m)?.[0]?.value ?? "array_overlap";
19
19
  case "list_multi_select":
@@ -26,6 +26,7 @@ function L(e, a = "string") {
26
26
  id: crypto.randomUUID(),
27
27
  columnId: e?.id || "",
28
28
  columnLabel: e?.column.columnDef.header?.toString() || "",
29
+ columnAccessorKey: (e?.column.columnDef?.accessorKey ?? e?.id) || "",
29
30
  columnType: e?.column.columnDef.meta?.type || a,
30
31
  operator: t(
31
32
  e?.column.columnDef.meta?.type
@@ -33,7 +34,7 @@ function L(e, a = "string") {
33
34
  listOptions: e?.column.columnDef.meta?.listOptions
34
35
  };
35
36
  }
36
- function O() {
37
+ function I() {
37
38
  const e = () => crypto.randomUUID();
38
39
  return {
39
40
  id: e(),
@@ -44,6 +45,7 @@ function O() {
44
45
  {
45
46
  id: e(),
46
47
  columnId: "",
48
+ columnAccessorKey: "",
47
49
  columnLabel: "",
48
50
  columnType: "string",
49
51
  operator: "eq",
@@ -58,7 +60,7 @@ function k(e, a) {
58
60
  const t = e.filter((n) => n.operator === "eq_null" || n.operator === "n_eq_null" ? !0 : n.value === void 0 || n.value === "" ? !1 : n.columnType === "list_multi_select" ? (Array.isArray(n.value) ? n.value.filter((l) => l !== void 0) : [n.value].filter((l) => l !== void 0)).length > 0 : !0), u = a ? ((n) => {
59
61
  const p = (l) => {
60
62
  const _ = l.conditions.filter((o) => !o.columnId || !o.operator ? !1 : o.operator === "eq_null" || o.operator === "n_eq_null" ? !0 : o.value === void 0 ? !1 : o.columnType === "list_multi_select" ? (Array.isArray(o.value) ? o.value.filter((y) => y !== void 0) : [o.value].filter((y) => y !== void 0)).length > 0 : !0).map((o) => ({
61
- [o.columnId]: {
63
+ [o.columnAccessorKey]: {
62
64
  operator: o.operator,
63
65
  value: o.operator === "eq_null" || o.operator === "n_eq_null" ? "" : o.columnType === "list_single_select" ? Array.isArray(o.value) ? o.value.filter((f) => f !== void 0) : [o.value].filter((f) => f !== void 0) : o.value
64
66
  }
@@ -71,7 +73,7 @@ function k(e, a) {
71
73
  return p(n.rootGroup);
72
74
  })(a) : null, c = t.map(
73
75
  (n) => ({
74
- [n.columnId]: {
76
+ [n.columnAccessorKey]: {
75
77
  operator: n.operator,
76
78
  value: n.operator === "eq_null" || n.operator === "n_eq_null" ? "" : n.columnType === "list_single_select" ? Array.isArray(n.value) ? n.value.filter((p) => p !== void 0) : [n.value].filter((p) => p !== void 0) : n.value ?? ""
77
79
  }
@@ -246,8 +248,8 @@ export {
246
248
  C as applyClientSideFilter,
247
249
  h as applySearchFilterToRow,
248
250
  k as buildSearchFilter,
249
- L as createBadgeFilterFromHeader,
250
- O as createDefaultAdvancedFilter,
251
+ O as createBadgeFilterFromHeader,
252
+ I as createDefaultAdvancedFilter,
251
253
  M as debounce,
252
254
  x as getIconFromColumnType,
253
255
  H as updatePageSizeFromContainer