laif-ds 0.2.61 → 0.2.62
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.
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/components/AppDialog.md +271 -0
- package/dist/agent-docs/components/DataTable.md +73 -2
- package/dist/agent-docs/components-list.md +9 -0
- package/dist/components/ui/app-dialog.js +123 -0
- package/dist/components/ui/dialog.js +50 -46
- package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +87 -87
- package/dist/components/ui/tables/data-table/components/data-table-column-visibility.js +82 -77
- package/dist/components/ui/tables/data-table/components/data-table-filters.js +16 -16
- package/dist/components/ui/tables/data-table/components/data-table-sorting.js +14 -14
- package/dist/components/ui/tables/data-table/data-table.js +293 -288
- package/dist/components/ui/tables/data-table/data-table.service.js +43 -43
- package/dist/components/ui/tables/data-table/data-table.utils.js +95 -88
- package/dist/index.d.ts +68 -19
- package/dist/index.js +291 -288
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,86 +1,86 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as c, jsxs as
|
|
3
|
-
import { useReactTable as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { useRef as f, useState as u, useEffect as
|
|
6
|
-
import { Button as
|
|
2
|
+
import { jsx as c, jsxs as ie } from "react/jsx-runtime";
|
|
3
|
+
import { useReactTable as nt } from "../../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { cn as ot } from "../../../../lib/utils.js";
|
|
5
|
+
import { useRef as f, useState as u, useEffect as H, useMemo as F } from "react";
|
|
6
|
+
import { Button as at } from "../../button.js";
|
|
7
7
|
import { Checkbox as ye } from "../../checkbox.js";
|
|
8
|
-
import { DataTableBody as
|
|
9
|
-
import { DataTableColumnVisibility as
|
|
10
|
-
import { DataTableFilters as
|
|
11
|
-
import { DataTablePaginationComponent as
|
|
12
|
-
import { DataTableSearchbar as
|
|
13
|
-
import { DataTableSortingComponent as
|
|
14
|
-
import { applySearchFilterToRow as
|
|
15
|
-
import { DataTableActionsComponent as
|
|
16
|
-
import { defaultDataTableI18n as
|
|
17
|
-
import { getPaginationRowModel as
|
|
18
|
-
function
|
|
19
|
-
columns:
|
|
8
|
+
import { DataTableBody as it } from "./components/data-table-body.js";
|
|
9
|
+
import { DataTableColumnVisibility as st } from "./components/data-table-column-visibility.js";
|
|
10
|
+
import { DataTableFilters as lt } from "./components/data-table-filters.js";
|
|
11
|
+
import { DataTablePaginationComponent as ct } from "./components/data-table-pagination.js";
|
|
12
|
+
import { DataTableSearchbar as ut } from "./components/data-table-searchbar.js";
|
|
13
|
+
import { DataTableSortingComponent as dt } from "./components/data-table-sorting.js";
|
|
14
|
+
import { applySearchFilterToRow as we, debounce as gt, buildSearchFilter as mt, updatePageSizeFromContainer as pt, createDefaultAdvancedFilter as ft, createBadgeFilterFromHeader as ht } from "./data-table.service.js";
|
|
15
|
+
import { DataTableActionsComponent as St } from "./components/data-table-actions.js";
|
|
16
|
+
import { defaultDataTableI18n as bt } from "./data-table-i18n.js";
|
|
17
|
+
import { getPaginationRowModel as vt, getFilteredRowModel as Ft, getSortedRowModel as Ct, getCoreRowModel as xt } from "../../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
18
|
+
function Vt({
|
|
19
|
+
columns: Y,
|
|
20
20
|
data: j,
|
|
21
|
-
loading:
|
|
22
|
-
emptyComponent:
|
|
23
|
-
className:
|
|
21
|
+
loading: z = !1,
|
|
22
|
+
emptyComponent: Re,
|
|
23
|
+
className: Ie,
|
|
24
24
|
rowSelection: Te = {},
|
|
25
|
-
onRowSelectionChange:
|
|
25
|
+
onRowSelectionChange: se,
|
|
26
26
|
checkable: P = !1,
|
|
27
|
-
onCheckedRowsChange:
|
|
27
|
+
onCheckedRowsChange: Z,
|
|
28
28
|
actions: ze = [],
|
|
29
|
-
customComponentsLeft:
|
|
29
|
+
customComponentsLeft: De,
|
|
30
30
|
customComponentsRight: Be,
|
|
31
|
-
hidePagination:
|
|
32
|
-
hideActionsRow:
|
|
33
|
-
i18n: h =
|
|
34
|
-
maxSortedColumns:
|
|
31
|
+
hidePagination: _e = !1,
|
|
32
|
+
hideActionsRow: Me = !1,
|
|
33
|
+
i18n: h = bt,
|
|
34
|
+
maxSortedColumns: le = 2,
|
|
35
35
|
initialState: d,
|
|
36
36
|
// New mode-based API
|
|
37
|
-
serverMode:
|
|
38
|
-
serverConfig:
|
|
39
|
-
disableAutoPageSize:
|
|
37
|
+
serverMode: He = !1,
|
|
38
|
+
serverConfig: Ne,
|
|
39
|
+
disableAutoPageSize: b = !1
|
|
40
40
|
}) {
|
|
41
|
-
const q = f(null),
|
|
41
|
+
const q = f(null), a = He === !0, g = a ? Ne : void 0, ce = (e) => !e || !e.sort_by || !e.sort_order ? [] : e.sort_by.map((t, o) => ({
|
|
42
42
|
id: t,
|
|
43
43
|
desc: e.sort_order[o] === "desc"
|
|
44
|
-
})),
|
|
45
|
-
const t =
|
|
46
|
-
sort_by: t.map((
|
|
47
|
-
sort_order: t.map((
|
|
44
|
+
})), Oe = (e) => {
|
|
45
|
+
const t = ce(e?.sorting), o = {
|
|
46
|
+
sort_by: t.map((s) => s.id),
|
|
47
|
+
sort_order: t.map((s) => s.desc ? "desc" : "asc")
|
|
48
48
|
};
|
|
49
49
|
return {
|
|
50
50
|
computedSorting: t.length > 0 ? o : void 0,
|
|
51
51
|
computedFilter: e?.computedFilter
|
|
52
52
|
// Use provided value or undefined
|
|
53
53
|
};
|
|
54
|
-
}, [
|
|
54
|
+
}, [N, Le] = u(() => ce(d?.sorting)), [Ge] = u([]), [ke, Ae] = u(
|
|
55
55
|
() => d?.columnVisibility ?? {}
|
|
56
|
-
), [
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
56
|
+
), [m, Ve] = u(() => d?.filters?.searchbarFilter), [K, O] = u(() => d?.pagination ?? { pageIndex: 0, pageSize: 10 }), ue = f(g);
|
|
57
|
+
ue.current = g;
|
|
58
|
+
const E = f(g?.onStateChange);
|
|
59
|
+
E.current = g?.onStateChange;
|
|
60
|
+
const W = f(null), D = f(null), je = f(0), de = f(!1), ge = f(null), J = f({}), me = f(null), $ = f(z);
|
|
61
|
+
$.current = z;
|
|
62
62
|
const L = (e) => {
|
|
63
|
-
e.computedFilter && (
|
|
63
|
+
e.computedFilter && (J.current.computedFilter = e.computedFilter), e.computedSorting && (J.current.computedSorting = e.computedSorting);
|
|
64
64
|
const t = {
|
|
65
65
|
...e,
|
|
66
66
|
// Use new computed values if available, otherwise use last known values
|
|
67
|
-
computedFilter: e.computedFilter ||
|
|
68
|
-
computedSorting: e.computedSorting ||
|
|
67
|
+
computedFilter: e.computedFilter || J.current.computedFilter,
|
|
68
|
+
computedSorting: e.computedSorting || J.current.computedSorting
|
|
69
69
|
};
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
W.current = t, D.current && clearTimeout(D.current), D.current = setTimeout(() => {
|
|
71
|
+
W.current && E.current && (je.current = Date.now(), E.current(W.current), W.current = null, D.current = null);
|
|
72
72
|
}, 400);
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
H(() => {
|
|
75
75
|
const e = setTimeout(() => {
|
|
76
|
-
|
|
76
|
+
de.current = !0;
|
|
77
77
|
}, 100);
|
|
78
78
|
return () => {
|
|
79
|
-
clearTimeout(e),
|
|
79
|
+
clearTimeout(e), D.current && clearTimeout(D.current);
|
|
80
80
|
};
|
|
81
81
|
}, []);
|
|
82
|
-
const [
|
|
83
|
-
const { computedSorting: e, computedFilter: t } =
|
|
82
|
+
const [r, G] = u(() => {
|
|
83
|
+
const { computedSorting: e, computedFilter: t } = Oe(d);
|
|
84
84
|
return {
|
|
85
85
|
pagination: d?.pagination ?? { pageIndex: 0, pageSize: 10 },
|
|
86
86
|
sorting: d?.sorting,
|
|
@@ -89,10 +89,10 @@ function Gt({
|
|
|
89
89
|
computedSorting: d?.computedSorting ?? e
|
|
90
90
|
};
|
|
91
91
|
});
|
|
92
|
-
a && !
|
|
93
|
-
const [
|
|
92
|
+
a && !g && console.warn("DataTable: Server mode requires serverConfig");
|
|
93
|
+
const [Pe, pe] = u(0), [qe, fe] = u(0), [Ke, Ee] = u({}), he = se ? Te : Ke, We = se || Ee, [C, ee] = u(
|
|
94
94
|
() => d?.filters?.filterBadges ?? []
|
|
95
|
-
), [
|
|
95
|
+
), [x, te] = u(() => d?.filters?.advancedFilterBadge), [U, Je] = u(""), [Se, be] = u([]), ve = F(() => P ? [
|
|
96
96
|
{
|
|
97
97
|
id: "data-table-integrated-checkbox-column",
|
|
98
98
|
size: 24,
|
|
@@ -142,176 +142,181 @@ function Gt({
|
|
|
142
142
|
listOptions: []
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
|
-
...
|
|
146
|
-
] :
|
|
145
|
+
...Y
|
|
146
|
+
] : Y, [Y, P]), I = F(() => ve.map(
|
|
147
147
|
(e) => e
|
|
148
|
-
), [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
(e)
|
|
155
|
-
|
|
156
|
-
|
|
148
|
+
), [ve]), X = (e) => {
|
|
149
|
+
if (e.id) return e.id;
|
|
150
|
+
if ("accessorKey" in e && typeof e.accessorKey == "string")
|
|
151
|
+
return e.accessorKey;
|
|
152
|
+
}, Ue = (e) => {
|
|
153
|
+
const t = e.meta?.headerLabel;
|
|
154
|
+
return t || (typeof e.header == "string" ? e.header : X(e) ?? "-");
|
|
155
|
+
};
|
|
156
|
+
H(() => {
|
|
157
|
+
const e = (I ?? []).map(X).filter((l) => !!l), t = new Set(Se), o = new Set(e);
|
|
158
|
+
t.size === o.size && [...t].every((l) => o.has(l)) || be(e);
|
|
159
|
+
}, [I]);
|
|
160
|
+
const B = F(() => I.filter((e) => !!e.meta?.searchable), [I]), T = F(() => B.map((e) => "accessorKey" in e && typeof e.accessorKey == "string" ? e.accessorKey : e.id).filter((e) => !!e), [B]), [Q, Xe] = u(() => d?.computedFilter ?? {}), Qe = {
|
|
161
|
+
data: F(() => a || Object.keys(Q).length === 0 ? j : j.filter((e) => we({
|
|
157
162
|
original: e,
|
|
158
163
|
getValue: (o) => e[o]
|
|
159
|
-
},
|
|
160
|
-
columns:
|
|
161
|
-
getCoreRowModel:
|
|
164
|
+
}, Q)), [j, Q, a]),
|
|
165
|
+
columns: I,
|
|
166
|
+
getCoreRowModel: xt(),
|
|
162
167
|
onSortingChange: (e) => {
|
|
163
|
-
const t = typeof e == "function" ? e(
|
|
164
|
-
|
|
168
|
+
const t = typeof e == "function" ? e(N) : e;
|
|
169
|
+
Le(t);
|
|
165
170
|
},
|
|
166
|
-
getSortedRowModel:
|
|
171
|
+
getSortedRowModel: Ct(),
|
|
167
172
|
manualSorting: a,
|
|
168
|
-
onColumnVisibilityChange:
|
|
169
|
-
onRowSelectionChange:
|
|
173
|
+
onColumnVisibilityChange: Ae,
|
|
174
|
+
onRowSelectionChange: We,
|
|
170
175
|
onColumnOrderChange: be,
|
|
171
|
-
getFilteredRowModel:
|
|
176
|
+
getFilteredRowModel: Ft(),
|
|
172
177
|
manualFiltering: a,
|
|
173
|
-
globalFilterFn: (e, t, o) => a || !o ? !0 : (
|
|
174
|
-
const
|
|
175
|
-
return Array.isArray(
|
|
178
|
+
globalFilterFn: (e, t, o) => a || !o ? !0 : (T ?? []).some((s) => {
|
|
179
|
+
const l = e.getValue(s);
|
|
180
|
+
return Array.isArray(l) ? l.some(
|
|
176
181
|
(p) => String(p).toLowerCase().includes(o.toLowerCase())
|
|
177
|
-
) : String(
|
|
182
|
+
) : String(l).toLowerCase().includes(o.toLowerCase());
|
|
178
183
|
}) ?? !1,
|
|
179
184
|
filterFns: {
|
|
180
|
-
advancedFilter: (e) => a ? !0 :
|
|
185
|
+
advancedFilter: (e) => a ? !0 : we(e, Q)
|
|
181
186
|
},
|
|
182
187
|
onPaginationChange: (e) => {
|
|
183
|
-
if (a &&
|
|
188
|
+
if (a && g) {
|
|
184
189
|
if (typeof e == "object") {
|
|
185
|
-
const t =
|
|
186
|
-
...
|
|
190
|
+
const t = b ? {
|
|
191
|
+
...r.pagination,
|
|
187
192
|
pageIndex: e.pageIndex
|
|
188
193
|
} : {
|
|
189
|
-
...
|
|
194
|
+
...r.pagination,
|
|
190
195
|
pageIndex: e.pageIndex,
|
|
191
196
|
pageSize: e.pageSize
|
|
192
197
|
}, o = {
|
|
193
|
-
...
|
|
198
|
+
...r,
|
|
194
199
|
pagination: t,
|
|
195
200
|
// Preserve computed values if they exist
|
|
196
|
-
computedFilter:
|
|
197
|
-
computedSorting:
|
|
201
|
+
computedFilter: r.computedFilter,
|
|
202
|
+
computedSorting: r.computedSorting
|
|
198
203
|
};
|
|
199
|
-
|
|
204
|
+
G(o), L(o);
|
|
200
205
|
}
|
|
201
206
|
} else
|
|
202
|
-
|
|
203
|
-
typeof e == "object" ? (t) =>
|
|
207
|
+
O(
|
|
208
|
+
typeof e == "object" ? (t) => b ? { ...t, pageIndex: e.pageIndex } : {
|
|
204
209
|
pageIndex: e.pageIndex,
|
|
205
210
|
pageSize: e.pageSize
|
|
206
211
|
} : e
|
|
207
212
|
);
|
|
208
213
|
},
|
|
209
|
-
getPaginationRowModel:
|
|
214
|
+
getPaginationRowModel: vt(),
|
|
210
215
|
manualPagination: a,
|
|
211
|
-
pageCount: a &&
|
|
216
|
+
pageCount: a && z ? qe : Pe,
|
|
212
217
|
state: {
|
|
213
|
-
sorting:
|
|
214
|
-
columnFilters:
|
|
215
|
-
columnVisibility:
|
|
216
|
-
rowSelection:
|
|
217
|
-
globalFilter:
|
|
218
|
-
pagination: a ?
|
|
219
|
-
columnOrder:
|
|
218
|
+
sorting: N,
|
|
219
|
+
columnFilters: Ge,
|
|
220
|
+
columnVisibility: ke,
|
|
221
|
+
rowSelection: he,
|
|
222
|
+
globalFilter: m,
|
|
223
|
+
pagination: a ? r.pagination : K,
|
|
224
|
+
columnOrder: Se
|
|
220
225
|
},
|
|
221
226
|
// Prevent implicit resets on data/columns changes so filters/sorting persist
|
|
222
227
|
autoResetPageIndex: !1
|
|
223
|
-
}, i =
|
|
224
|
-
|
|
225
|
-
if (a &&
|
|
228
|
+
}, i = nt(Qe), re = i.getFilteredRowModel();
|
|
229
|
+
H(() => {
|
|
230
|
+
if (a && g) {
|
|
226
231
|
const e = Math.ceil(
|
|
227
|
-
|
|
232
|
+
g.totalItems / (r.pagination.pageSize || 10)
|
|
228
233
|
);
|
|
229
|
-
|
|
234
|
+
pe(e), !z && e > 0 && fe(e);
|
|
230
235
|
} else {
|
|
231
|
-
const e =
|
|
232
|
-
|
|
236
|
+
const e = re.rows.length, t = Math.ceil(e / K.pageSize);
|
|
237
|
+
pe(t), fe(t);
|
|
233
238
|
}
|
|
234
239
|
}, [
|
|
235
240
|
a,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
241
|
+
g?.totalItems,
|
|
242
|
+
r.pagination.pageSize,
|
|
243
|
+
r.pagination.pageIndex,
|
|
239
244
|
i,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
]),
|
|
244
|
-
if (
|
|
245
|
+
re,
|
|
246
|
+
K.pageSize,
|
|
247
|
+
z
|
|
248
|
+
]), H(() => {
|
|
249
|
+
if (b) return;
|
|
245
250
|
const e = () => {
|
|
246
|
-
const
|
|
247
|
-
if (!
|
|
248
|
-
const
|
|
251
|
+
const y = q.current;
|
|
252
|
+
if (!y) return;
|
|
253
|
+
const _ = y.querySelector(
|
|
249
254
|
"thead tr"
|
|
250
|
-
),
|
|
255
|
+
), n = y.querySelector(
|
|
251
256
|
"tbody tr"
|
|
252
|
-
),
|
|
253
|
-
if (!!!
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
rowHeight:
|
|
257
|
-
headerHeight:
|
|
258
|
-
onPageChange: a ? (
|
|
259
|
-
if (
|
|
260
|
-
const
|
|
261
|
-
...
|
|
262
|
-
pageIndex:
|
|
257
|
+
), w = _?.getBoundingClientRect().height ?? 40;
|
|
258
|
+
if (!!!n?.querySelector("td")) return;
|
|
259
|
+
const A = n?.getBoundingClientRect().height ?? 32.5;
|
|
260
|
+
pt(y, {
|
|
261
|
+
rowHeight: A,
|
|
262
|
+
headerHeight: w,
|
|
263
|
+
onPageChange: a ? (R, v) => {
|
|
264
|
+
if (g && de.current) {
|
|
265
|
+
const S = b ? {
|
|
266
|
+
...r.pagination,
|
|
267
|
+
pageIndex: R
|
|
263
268
|
} : {
|
|
264
|
-
...
|
|
265
|
-
pageIndex:
|
|
266
|
-
pageSize:
|
|
267
|
-
},
|
|
268
|
-
if (
|
|
269
|
+
...r.pagination,
|
|
270
|
+
pageIndex: R,
|
|
271
|
+
pageSize: v
|
|
272
|
+
}, oe = S.pageIndex === r.pagination.pageIndex, ae = b || S.pageSize === r.pagination.pageSize;
|
|
273
|
+
if (oe && ae)
|
|
269
274
|
return;
|
|
270
275
|
const V = {
|
|
271
|
-
...
|
|
272
|
-
pagination:
|
|
276
|
+
...r,
|
|
277
|
+
pagination: S,
|
|
273
278
|
// Preserve computed values if they exist
|
|
274
|
-
computedFilter:
|
|
275
|
-
computedSorting:
|
|
279
|
+
computedFilter: r.computedFilter,
|
|
280
|
+
computedSorting: r.computedSorting
|
|
276
281
|
};
|
|
277
|
-
|
|
282
|
+
G(V), $.current || L(V);
|
|
278
283
|
}
|
|
279
|
-
} : (
|
|
280
|
-
|
|
281
|
-
(
|
|
284
|
+
} : (R, v) => {
|
|
285
|
+
O(
|
|
286
|
+
(S) => b ? { ...S, pageIndex: R } : { pageIndex: R, pageSize: v }
|
|
282
287
|
);
|
|
283
288
|
},
|
|
284
|
-
setPagination: (
|
|
285
|
-
const
|
|
286
|
-
if (a &&
|
|
287
|
-
const
|
|
288
|
-
...
|
|
289
|
-
pageIndex:
|
|
289
|
+
setPagination: (R) => {
|
|
290
|
+
const v = typeof R == "function" ? R(r.pagination) : R;
|
|
291
|
+
if (a && g) {
|
|
292
|
+
const S = b ? {
|
|
293
|
+
...r.pagination,
|
|
294
|
+
pageIndex: v.pageIndex
|
|
290
295
|
} : {
|
|
291
|
-
...
|
|
292
|
-
pageIndex:
|
|
293
|
-
pageSize:
|
|
294
|
-
},
|
|
295
|
-
if (
|
|
296
|
+
...r.pagination,
|
|
297
|
+
pageIndex: v.pageIndex,
|
|
298
|
+
pageSize: v.pageSize
|
|
299
|
+
}, oe = S.pageIndex === r.pagination.pageIndex, ae = b || S.pageSize === r.pagination.pageSize;
|
|
300
|
+
if (oe && ae)
|
|
296
301
|
return;
|
|
297
302
|
const V = {
|
|
298
|
-
...
|
|
299
|
-
pagination:
|
|
303
|
+
...r,
|
|
304
|
+
pagination: S,
|
|
300
305
|
// Preserve computed values if they exist
|
|
301
|
-
computedFilter:
|
|
302
|
-
computedSorting:
|
|
306
|
+
computedFilter: r.computedFilter,
|
|
307
|
+
computedSorting: r.computedSorting
|
|
303
308
|
};
|
|
304
|
-
|
|
309
|
+
G(V), $.current || L(V);
|
|
305
310
|
} else
|
|
306
|
-
|
|
307
|
-
(
|
|
308
|
-
pageIndex:
|
|
309
|
-
pageSize:
|
|
311
|
+
O(
|
|
312
|
+
(S) => b ? { ...S, pageIndex: v.pageIndex } : {
|
|
313
|
+
pageIndex: v.pageIndex,
|
|
314
|
+
pageSize: v.pageSize
|
|
310
315
|
}
|
|
311
316
|
);
|
|
312
317
|
}
|
|
313
318
|
});
|
|
314
|
-
}, t =
|
|
319
|
+
}, t = gt(() => {
|
|
315
320
|
requestAnimationFrame(() => {
|
|
316
321
|
e();
|
|
317
322
|
});
|
|
@@ -321,240 +326,240 @@ function Gt({
|
|
|
321
326
|
e();
|
|
322
327
|
});
|
|
323
328
|
});
|
|
324
|
-
const o = setTimeout(e, 200),
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
329
|
-
const
|
|
330
|
-
(
|
|
329
|
+
const o = setTimeout(e, 200), s = document.fonts;
|
|
330
|
+
s && typeof s.ready?.then == "function" && s.ready.then(() => e()), window.addEventListener("resize", t);
|
|
331
|
+
const l = q.current, p = typeof ResizeObserver < "u" ? new ResizeObserver((y) => {
|
|
332
|
+
const _ = y[0];
|
|
333
|
+
if (!_) return;
|
|
334
|
+
const n = _.contentRect.height, w = me.current;
|
|
335
|
+
(w === null || Math.abs(n - w) > 0.5) && (me.current = n, t());
|
|
331
336
|
}) : null;
|
|
332
|
-
return
|
|
337
|
+
return l && p && p.observe(l), () => {
|
|
333
338
|
window.removeEventListener("resize", t), clearTimeout(o), p && p.disconnect(), clearTimeout(o);
|
|
334
339
|
};
|
|
335
340
|
}, [
|
|
336
341
|
a,
|
|
337
342
|
q,
|
|
338
|
-
|
|
343
|
+
b,
|
|
339
344
|
// Recalculate when the rendered rows count changes; helps when data arrives async
|
|
340
|
-
|
|
341
|
-
]),
|
|
342
|
-
if (
|
|
345
|
+
re.rows.length
|
|
346
|
+
]), H(() => {
|
|
347
|
+
if (Z && P) {
|
|
343
348
|
const e = i.getFilteredSelectedRowModel().rows.map((t) => t.original);
|
|
344
|
-
|
|
349
|
+
Z(e);
|
|
345
350
|
}
|
|
346
|
-
}, [i,
|
|
347
|
-
const
|
|
351
|
+
}, [i, Z, P, he]);
|
|
352
|
+
const Ye = F(() => {
|
|
348
353
|
const e = i.getHeaderGroups()[0], t = e ? e.headers : [];
|
|
349
|
-
return (i.getState().sorting || []).map((
|
|
354
|
+
return (i.getState().sorting || []).map((l) => t.find((p) => p.column.id === l.id)).filter(Boolean);
|
|
350
355
|
}, [
|
|
351
356
|
i.getHeaderGroups,
|
|
352
357
|
i.getState().sorting,
|
|
353
|
-
|
|
354
|
-
]), ne =
|
|
355
|
-
|
|
356
|
-
},
|
|
357
|
-
|
|
358
|
-
},
|
|
358
|
+
I
|
|
359
|
+
]), ne = F(() => i.getHeaderGroups()[0].headers.filter((e) => e.column.columnDef.meta?.sortable), [i.getHeaderGroups, I]), k = F(() => i.getHeaderGroups()[0].headers.filter((e) => e.column.columnDef.meta?.filterable), [i.getHeaderGroups, I]), Ze = F(() => U ? k.filter((e) => (e.column.columnDef.meta?.headerLabel ?? (typeof e.column.columnDef.header == "string" ? e.column.columnDef.header : void 0) ?? e.column.id).toLowerCase().includes(U.toLowerCase())) : k, [k, U]), Fe = (e) => {
|
|
360
|
+
ee((t) => [...t, ht(e)]);
|
|
361
|
+
}, $e = () => {
|
|
362
|
+
te(ft());
|
|
363
|
+
}, et = F(() => C.sort((e, t) => e.value === void 0 || e.value === "" ? 1 : t.value === void 0 || t.value === "" ? -1 : 1), [C]), Ce = f({
|
|
359
364
|
filterBadges: [],
|
|
360
365
|
advancedFilterBadge: void 0,
|
|
361
366
|
searchbarGlobalFilter: void 0
|
|
362
367
|
});
|
|
363
|
-
|
|
364
|
-
const e =
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
), t =
|
|
368
|
-
const
|
|
369
|
-
(
|
|
368
|
+
H(() => {
|
|
369
|
+
const e = mt(
|
|
370
|
+
C,
|
|
371
|
+
x ?? void 0
|
|
372
|
+
), t = m && T.length > 0 ? T.length === 1 ? (() => {
|
|
373
|
+
const n = T[0], M = B.find(
|
|
374
|
+
(A) => X(A) === n
|
|
370
375
|
)?.meta?.type;
|
|
371
|
-
return
|
|
372
|
-
[
|
|
376
|
+
return M === "list_multi_select" || M === "list_single_select" ? {
|
|
377
|
+
[n]: {
|
|
373
378
|
operator: "array_overlap",
|
|
374
|
-
value: [
|
|
379
|
+
value: [m]
|
|
375
380
|
}
|
|
376
381
|
} : {
|
|
377
|
-
[
|
|
382
|
+
[n]: {
|
|
378
383
|
operator: "like",
|
|
379
|
-
value:
|
|
384
|
+
value: m
|
|
380
385
|
}
|
|
381
386
|
};
|
|
382
387
|
})() : {
|
|
383
|
-
_or:
|
|
384
|
-
const
|
|
385
|
-
(
|
|
388
|
+
_or: T.map((n) => {
|
|
389
|
+
const M = B.find(
|
|
390
|
+
(A) => X(A) === n
|
|
386
391
|
)?.meta?.type;
|
|
387
|
-
return
|
|
388
|
-
[
|
|
392
|
+
return M === "list_multi_select" || M === "list_single_select" ? {
|
|
393
|
+
[n]: {
|
|
389
394
|
operator: "array_overlap",
|
|
390
|
-
value: [
|
|
395
|
+
value: [m]
|
|
391
396
|
}
|
|
392
397
|
} : {
|
|
393
|
-
[
|
|
398
|
+
[n]: {
|
|
394
399
|
operator: "like",
|
|
395
|
-
value:
|
|
400
|
+
value: m
|
|
396
401
|
}
|
|
397
402
|
};
|
|
398
403
|
})
|
|
399
404
|
} : null, o = [
|
|
400
405
|
...e && Object.keys(e).length > 0 ? [e] : [],
|
|
401
406
|
...t ? [t] : []
|
|
402
|
-
],
|
|
403
|
-
sort_by:
|
|
404
|
-
sort_order:
|
|
405
|
-
}, p = Ce.current,
|
|
407
|
+
], s = o.length === 0 ? {} : o.length === 1 ? o[0] : { _and: o }, l = {
|
|
408
|
+
sort_by: N.map((n) => n.id),
|
|
409
|
+
sort_order: N.map((n) => n.desc ? "desc" : "asc")
|
|
410
|
+
}, p = Ce.current, y = JSON.stringify(C) !== JSON.stringify(p.filterBadges) || JSON.stringify(x) !== JSON.stringify(p.advancedFilterBadge) || m !== p.searchbarGlobalFilter;
|
|
406
411
|
Ce.current = {
|
|
407
|
-
filterBadges: [...
|
|
408
|
-
advancedFilterBadge:
|
|
409
|
-
searchbarGlobalFilter:
|
|
412
|
+
filterBadges: [...C],
|
|
413
|
+
advancedFilterBadge: x ? { ...x } : void 0,
|
|
414
|
+
searchbarGlobalFilter: m
|
|
410
415
|
};
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
const
|
|
414
|
-
...
|
|
415
|
-
computedFilter:
|
|
416
|
+
const _ = ue.current;
|
|
417
|
+
if (Xe(s), a && E.current && _) {
|
|
418
|
+
const n = {
|
|
419
|
+
...r,
|
|
420
|
+
computedFilter: s,
|
|
416
421
|
// Emit only computedSorting. Use empty arrays to signal "no sorting" when cleared.
|
|
417
|
-
computedSorting:
|
|
422
|
+
computedSorting: l,
|
|
418
423
|
filters: {
|
|
419
|
-
filterBadges:
|
|
420
|
-
advancedFilterBadge:
|
|
421
|
-
searchbarFilter:
|
|
424
|
+
filterBadges: C,
|
|
425
|
+
advancedFilterBadge: x,
|
|
426
|
+
searchbarFilter: m
|
|
422
427
|
},
|
|
423
428
|
pagination: {
|
|
424
|
-
...
|
|
429
|
+
...r.pagination,
|
|
425
430
|
// Only reset pageIndex to 0 when filters actually changed, not when just sorting changed
|
|
426
|
-
pageIndex:
|
|
431
|
+
pageIndex: y ? 0 : r.pagination.pageIndex
|
|
427
432
|
}
|
|
428
433
|
};
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
computedFilter:
|
|
432
|
-
computedSorting:
|
|
433
|
-
filters:
|
|
434
|
-
pagination:
|
|
434
|
+
G(n);
|
|
435
|
+
const w = JSON.stringify({
|
|
436
|
+
computedFilter: n.computedFilter,
|
|
437
|
+
computedSorting: n.computedSorting,
|
|
438
|
+
filters: n.filters,
|
|
439
|
+
pagination: n.pagination
|
|
435
440
|
});
|
|
436
|
-
|
|
441
|
+
ge.current !== w && (ge.current = w, L(n));
|
|
437
442
|
} else
|
|
438
|
-
|
|
439
|
-
...
|
|
443
|
+
y && O((n) => ({
|
|
444
|
+
...n,
|
|
440
445
|
pageIndex: 0
|
|
441
446
|
}));
|
|
442
447
|
}, [
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
448
|
+
C,
|
|
449
|
+
x,
|
|
450
|
+
m,
|
|
451
|
+
T,
|
|
452
|
+
B,
|
|
453
|
+
N,
|
|
449
454
|
a
|
|
450
455
|
]);
|
|
451
|
-
const
|
|
452
|
-
return /* @__PURE__ */
|
|
456
|
+
const xe = i.getAllLeafColumns(), tt = xe.filter((e) => e.getIsVisible()), rt = xe.filter((e) => !e.getIsVisible());
|
|
457
|
+
return /* @__PURE__ */ ie(
|
|
453
458
|
"div",
|
|
454
459
|
{
|
|
455
|
-
className:
|
|
460
|
+
className: ot(
|
|
456
461
|
"flex h-full max-h-full min-h-[250px] w-full max-w-full min-w-0 flex-col gap-2",
|
|
457
|
-
|
|
462
|
+
Ie
|
|
458
463
|
),
|
|
459
464
|
children: [
|
|
460
|
-
!
|
|
461
|
-
/* @__PURE__ */
|
|
465
|
+
!Me && /* @__PURE__ */ ie("div", { className: "flex w-full items-center justify-between gap-1", children: [
|
|
466
|
+
/* @__PURE__ */ ie("div", { className: "flex min-w-0 flex-1 items-center gap-1 overflow-x-auto", children: [
|
|
462
467
|
ne.length > 0 && /* @__PURE__ */ c(
|
|
463
|
-
|
|
468
|
+
dt,
|
|
464
469
|
{
|
|
465
470
|
table: i,
|
|
466
|
-
sortedColumns:
|
|
471
|
+
sortedColumns: Ye,
|
|
467
472
|
sortableColumns: ne,
|
|
468
473
|
i18n: h,
|
|
469
|
-
maxSortedColumns:
|
|
474
|
+
maxSortedColumns: le
|
|
470
475
|
}
|
|
471
476
|
),
|
|
472
|
-
ne.length > 0 &&
|
|
473
|
-
|
|
477
|
+
ne.length > 0 && k.length > 0 && /* @__PURE__ */ c("div", { className: "border-d-border h-4 min-h-4 w-[1px] border-r" }),
|
|
478
|
+
De,
|
|
474
479
|
/* @__PURE__ */ c(
|
|
475
|
-
|
|
480
|
+
lt,
|
|
476
481
|
{
|
|
477
|
-
advancedFilterBadge:
|
|
478
|
-
setAdvancedFilterBadge:
|
|
479
|
-
filterableColumns:
|
|
480
|
-
sortedFilterBadges:
|
|
481
|
-
setFilterBadges:
|
|
482
|
+
advancedFilterBadge: x,
|
|
483
|
+
setAdvancedFilterBadge: te,
|
|
484
|
+
filterableColumns: k,
|
|
485
|
+
sortedFilterBadges: et,
|
|
486
|
+
setFilterBadges: ee,
|
|
482
487
|
filterSearch: U,
|
|
483
|
-
setFilterSearch:
|
|
484
|
-
filteredColumns:
|
|
485
|
-
handleAddFilter:
|
|
486
|
-
handleAddAdvancedFilter:
|
|
488
|
+
setFilterSearch: Je,
|
|
489
|
+
filteredColumns: Ze,
|
|
490
|
+
handleAddFilter: Fe,
|
|
491
|
+
handleAddAdvancedFilter: $e,
|
|
487
492
|
i18n: h
|
|
488
493
|
}
|
|
489
494
|
)
|
|
490
495
|
] }),
|
|
491
496
|
/* @__PURE__ */ c("div", { className: "border-d-border h-4 min-h-4 w-[1px] border-r" }),
|
|
492
497
|
Be,
|
|
493
|
-
(
|
|
494
|
-
|
|
498
|
+
(C.length || x) && /* @__PURE__ */ c(
|
|
499
|
+
at,
|
|
495
500
|
{
|
|
496
501
|
className: "h-6 text-xs",
|
|
497
502
|
iconLeft: "FunnelX",
|
|
498
503
|
size: "sm",
|
|
499
504
|
variant: "ghost-destructive",
|
|
500
505
|
onClick: () => {
|
|
501
|
-
|
|
506
|
+
ee([]), te(void 0);
|
|
502
507
|
},
|
|
503
508
|
children: h.reset
|
|
504
509
|
}
|
|
505
510
|
),
|
|
506
|
-
|
|
507
|
-
|
|
511
|
+
T.length > 0 && /* @__PURE__ */ c(
|
|
512
|
+
ut,
|
|
508
513
|
{
|
|
509
514
|
debounceMs: 300,
|
|
510
|
-
onSearch:
|
|
515
|
+
onSearch: Ve,
|
|
511
516
|
i18n: h,
|
|
512
|
-
initialValue:
|
|
513
|
-
searchableColumnsHeaders:
|
|
514
|
-
(e) =>
|
|
517
|
+
initialValue: m ?? "",
|
|
518
|
+
searchableColumnsHeaders: B.map(
|
|
519
|
+
(e) => Ue(e)
|
|
515
520
|
)
|
|
516
521
|
}
|
|
517
522
|
),
|
|
518
523
|
/* @__PURE__ */ c(
|
|
519
|
-
|
|
524
|
+
st,
|
|
520
525
|
{
|
|
521
526
|
table: i,
|
|
522
|
-
visibleColumns:
|
|
523
|
-
hiddenColumns:
|
|
527
|
+
visibleColumns: tt,
|
|
528
|
+
hiddenColumns: rt,
|
|
524
529
|
i18n: h
|
|
525
530
|
}
|
|
526
531
|
),
|
|
527
|
-
/* @__PURE__ */ c(
|
|
532
|
+
/* @__PURE__ */ c(St, { actions: ze, i18n: h })
|
|
528
533
|
] }),
|
|
529
534
|
/* @__PURE__ */ c(
|
|
530
|
-
|
|
535
|
+
it,
|
|
531
536
|
{
|
|
532
537
|
table: i,
|
|
533
538
|
tableContainerRef: q,
|
|
534
|
-
loading:
|
|
539
|
+
loading: z,
|
|
535
540
|
data: j,
|
|
536
|
-
emptyComponent:
|
|
541
|
+
emptyComponent: Re,
|
|
537
542
|
notFoundMessage: h?.notFoundMessage ?? "N/A",
|
|
538
|
-
onAddFilter:
|
|
539
|
-
maxSortedColumns:
|
|
543
|
+
onAddFilter: Fe,
|
|
544
|
+
maxSortedColumns: le,
|
|
540
545
|
i18n: h,
|
|
541
546
|
isServerSide: a,
|
|
542
|
-
filterBadges:
|
|
543
|
-
advancedFilterBadge:
|
|
544
|
-
searchbarGlobalFilter:
|
|
547
|
+
filterBadges: C,
|
|
548
|
+
advancedFilterBadge: x,
|
|
549
|
+
searchbarGlobalFilter: m
|
|
545
550
|
}
|
|
546
551
|
),
|
|
547
|
-
!
|
|
548
|
-
|
|
552
|
+
!_e && /* @__PURE__ */ c(
|
|
553
|
+
ct,
|
|
549
554
|
{
|
|
550
555
|
table: i,
|
|
551
556
|
isServerSide: a,
|
|
552
|
-
clientPagination:
|
|
553
|
-
serverState: a ?
|
|
554
|
-
onServerStateChange: a &&
|
|
555
|
-
|
|
557
|
+
clientPagination: K,
|
|
558
|
+
serverState: a ? r : void 0,
|
|
559
|
+
onServerStateChange: a && g ? (e) => {
|
|
560
|
+
G(e), L(e);
|
|
556
561
|
} : void 0,
|
|
557
|
-
totalItems:
|
|
562
|
+
totalItems: g?.totalItems,
|
|
558
563
|
i18n: h
|
|
559
564
|
}
|
|
560
565
|
)
|
|
@@ -563,5 +568,5 @@ function Gt({
|
|
|
563
568
|
);
|
|
564
569
|
}
|
|
565
570
|
export {
|
|
566
|
-
|
|
571
|
+
Vt as DataTable
|
|
567
572
|
};
|