@ethanhann/mantine-dataview 0.1.2 → 0.2.0
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/README.md +363 -242
- package/dist/core/colBuilder.d.ts +37 -0
- package/dist/core/useDataViewFetcher.d.ts +3 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +387 -285
- package/dist/index.js.map +1 -1
- package/dist/types/options.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { a as e, i as t, n, r, t as i } from "./serializer-u2zq_sU7.js";
|
|
2
|
-
import { createColumnHelper as a,
|
|
3
|
-
import { ActionIcon as
|
|
2
|
+
import { createColumnHelper as a, createColumnHelper as o, flexRender as s, functionalUpdate as c, getCoreRowModel as l, useReactTable as u } from "@tanstack/react-table";
|
|
3
|
+
import { ActionIcon as d, Anchor as f, Badge as p, Box as m, Button as h, Card as g, Center as _, Checkbox as v, CloseButton as ee, Drawer as y, Group as b, Input as x, Menu as S, MultiSelect as te, NumberInput as C, Pagination as w, Paper as T, Popover as E, RangeSlider as ne, SegmentedControl as D, Select as O, SimpleGrid as re, Skeleton as k, Stack as A, Table as j, Text as M, TextInput as N, UnstyledButton as P, useMantineTheme as F } from "@mantine/core";
|
|
4
4
|
import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { useDisclosure as
|
|
5
|
+
import { Fragment as ie, createContext as ae, useCallback as z, useContext as B, useEffect as V, useMemo as H, useRef as U, useState as W } from "react";
|
|
6
|
+
import { useDisclosure as oe, useMediaQuery as G } from "@mantine/hooks";
|
|
7
7
|
import { DatePickerInput as K } from "@mantine/dates";
|
|
8
8
|
import "@mantine/dates/styles.css";
|
|
9
9
|
//#region src/components/DataBulkActions/DataBulkActions.tsx
|
|
10
10
|
function q({ view: e, slots: t, ...n }) {
|
|
11
11
|
let { selection: r } = e;
|
|
12
|
-
return r.count === 0 ? null : /* @__PURE__ */ L(
|
|
12
|
+
return r.count === 0 ? null : /* @__PURE__ */ L(T, {
|
|
13
13
|
withBorder: !0,
|
|
14
14
|
p: "xs",
|
|
15
15
|
radius: "sm",
|
|
16
16
|
role: "region",
|
|
17
17
|
"aria-label": "Bulk actions",
|
|
18
18
|
...n,
|
|
19
|
-
children: /* @__PURE__ */ R(
|
|
19
|
+
children: /* @__PURE__ */ R(b, {
|
|
20
20
|
justify: "space-between",
|
|
21
21
|
wrap: "wrap",
|
|
22
22
|
gap: "sm",
|
|
23
|
-
children: [/* @__PURE__ */ R(
|
|
23
|
+
children: [/* @__PURE__ */ R(b, {
|
|
24
24
|
gap: "sm",
|
|
25
25
|
children: [/* @__PURE__ */ R(M, {
|
|
26
26
|
size: "sm",
|
|
27
27
|
fw: 500,
|
|
28
28
|
children: [r.count, " selected"]
|
|
29
|
-
}), /* @__PURE__ */ L(
|
|
29
|
+
}), /* @__PURE__ */ L(h, {
|
|
30
30
|
variant: "subtle",
|
|
31
31
|
size: "xs",
|
|
32
32
|
onClick: r.clear,
|
|
33
33
|
children: "Clear"
|
|
34
34
|
})]
|
|
35
|
-
}), t?.BulkActions && /* @__PURE__ */ L(
|
|
35
|
+
}), t?.BulkActions && /* @__PURE__ */ L(b, {
|
|
36
36
|
gap: "xs",
|
|
37
37
|
children: t.BulkActions(r)
|
|
38
38
|
})]
|
|
@@ -45,7 +45,7 @@ function J(e) {
|
|
|
45
45
|
let { meta: t, header: n } = e.columnDef;
|
|
46
46
|
return t?.label ? t.label : typeof n == "string" ? n : e.id;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function se(e, t, n) {
|
|
49
49
|
return t ? t === "hidden" ? null : t : e.accessorFn == null || n === "hidden" ? null : n;
|
|
50
50
|
}
|
|
51
51
|
function Y(e, t = {}) {
|
|
@@ -57,7 +57,7 @@ function Y(e, t = {}) {
|
|
|
57
57
|
meta: []
|
|
58
58
|
};
|
|
59
59
|
e.getVisibleLeafColumns().forEach((e, t) => {
|
|
60
|
-
let i = e.columnDef.meta?.card, a =
|
|
60
|
+
let i = e.columnDef.meta?.card, a = se(e, i?.role, n);
|
|
61
61
|
a && r[a].push({
|
|
62
62
|
order: i?.order ?? t,
|
|
63
63
|
index: t,
|
|
@@ -80,10 +80,10 @@ function Y(e, t = {}) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/components/StateMessage.tsx
|
|
83
|
-
function
|
|
83
|
+
function ce(e) {
|
|
84
84
|
e.resetColumnFilters(), e.setGlobalFilter("");
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function le({ view: e, slots: t }) {
|
|
87
87
|
return t?.ErrorState ? /* @__PURE__ */ L(I, { children: t.ErrorState({
|
|
88
88
|
error: e.error,
|
|
89
89
|
retry: e.refetch
|
|
@@ -93,7 +93,7 @@ function ce({ view: e, slots: t }) {
|
|
|
93
93
|
children: [/* @__PURE__ */ L(M, {
|
|
94
94
|
c: "red",
|
|
95
95
|
children: "Something went wrong."
|
|
96
|
-
}), /* @__PURE__ */ L(
|
|
96
|
+
}), /* @__PURE__ */ L(h, {
|
|
97
97
|
variant: "light",
|
|
98
98
|
size: "xs",
|
|
99
99
|
onClick: e.refetch,
|
|
@@ -101,8 +101,8 @@ function ce({ view: e, slots: t }) {
|
|
|
101
101
|
})]
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
let n = e.renderStatus.phase === "empty-filtered", r = () =>
|
|
104
|
+
function ue({ view: e, slots: t }) {
|
|
105
|
+
let n = e.renderStatus.phase === "empty-filtered", r = () => ce(e.table);
|
|
106
106
|
return t?.Empty ? /* @__PURE__ */ L(I, { children: t.Empty({
|
|
107
107
|
filtered: n,
|
|
108
108
|
clearFilters: r
|
|
@@ -112,7 +112,7 @@ function le({ view: e, slots: t }) {
|
|
|
112
112
|
children: [/* @__PURE__ */ L(M, {
|
|
113
113
|
c: "dimmed",
|
|
114
114
|
children: "No matches."
|
|
115
|
-
}), /* @__PURE__ */ L(
|
|
115
|
+
}), /* @__PURE__ */ L(h, {
|
|
116
116
|
variant: "subtle",
|
|
117
117
|
size: "xs",
|
|
118
118
|
onClick: r,
|
|
@@ -125,20 +125,20 @@ function le({ view: e, slots: t }) {
|
|
|
125
125
|
}
|
|
126
126
|
//#endregion
|
|
127
127
|
//#region src/components/DataCards/DataCards.tsx
|
|
128
|
-
var
|
|
128
|
+
var de = {
|
|
129
129
|
base: 1,
|
|
130
130
|
sm: 2,
|
|
131
131
|
lg: 3
|
|
132
132
|
};
|
|
133
|
-
function
|
|
133
|
+
function fe({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection: i, loadingCardCount: a, cols: o = de, ...s }) {
|
|
134
134
|
let { table: c, renderStatus: l } = e, u = i ?? c.options.enableRowSelection !== !1, d = a ?? Math.min(e.state.pagination.pageSize, 6), f = {
|
|
135
135
|
cols: o,
|
|
136
136
|
...s
|
|
137
137
|
};
|
|
138
138
|
switch (l.phase) {
|
|
139
|
-
case "loading": return t?.LoadingCards ? t.LoadingCards() : /* @__PURE__ */ L(
|
|
139
|
+
case "loading": return t?.LoadingCards ? t.LoadingCards() : /* @__PURE__ */ L(re, {
|
|
140
140
|
...f,
|
|
141
|
-
children: Array.from({ length: d }, (e, t) => /* @__PURE__ */ L(
|
|
141
|
+
children: Array.from({ length: d }, (e, t) => /* @__PURE__ */ L(g, {
|
|
142
142
|
withBorder: !0,
|
|
143
143
|
padding: "md",
|
|
144
144
|
children: /* @__PURE__ */ R(A, {
|
|
@@ -157,24 +157,24 @@ function de({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection
|
|
|
157
157
|
})
|
|
158
158
|
}, t))
|
|
159
159
|
});
|
|
160
|
-
case "error": return /* @__PURE__ */ L(
|
|
160
|
+
case "error": return /* @__PURE__ */ L(_, {
|
|
161
161
|
p: "xl",
|
|
162
|
-
children: /* @__PURE__ */ L(
|
|
162
|
+
children: /* @__PURE__ */ L(le, {
|
|
163
163
|
view: e,
|
|
164
164
|
slots: t
|
|
165
165
|
})
|
|
166
166
|
});
|
|
167
167
|
case "empty":
|
|
168
|
-
case "empty-filtered": return /* @__PURE__ */ L(
|
|
168
|
+
case "empty-filtered": return /* @__PURE__ */ L(_, {
|
|
169
169
|
p: "xl",
|
|
170
|
-
children: /* @__PURE__ */ L(
|
|
170
|
+
children: /* @__PURE__ */ L(ue, {
|
|
171
171
|
view: e,
|
|
172
172
|
slots: t
|
|
173
173
|
})
|
|
174
174
|
});
|
|
175
175
|
default: {
|
|
176
176
|
let e = Y(c, { fallbackRole: r });
|
|
177
|
-
return /* @__PURE__ */ L(
|
|
177
|
+
return /* @__PURE__ */ L(re, {
|
|
178
178
|
...f,
|
|
179
179
|
children: c.getRowModel().rows.map((r) => {
|
|
180
180
|
let i = r.getIsSelected(), a = {
|
|
@@ -183,16 +183,16 @@ function de({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection
|
|
|
183
183
|
selected: i,
|
|
184
184
|
toggleSelected: () => r.toggleSelected()
|
|
185
185
|
};
|
|
186
|
-
if (n) return /* @__PURE__ */ L(
|
|
187
|
-
let o = /* @__PURE__ */ L(
|
|
186
|
+
if (n) return /* @__PURE__ */ L(pe, { children: n(a) }, r.id);
|
|
187
|
+
let o = /* @__PURE__ */ L(me, {
|
|
188
188
|
row: r,
|
|
189
189
|
layout: e,
|
|
190
190
|
selectionEnabled: u
|
|
191
191
|
});
|
|
192
|
-
return t?.Card ? /* @__PURE__ */ L(
|
|
192
|
+
return t?.Card ? /* @__PURE__ */ L(pe, { children: t.Card({
|
|
193
193
|
...a,
|
|
194
194
|
children: o
|
|
195
|
-
}) }, r.id) : /* @__PURE__ */ L(
|
|
195
|
+
}) }, r.id) : /* @__PURE__ */ L(g, {
|
|
196
196
|
withBorder: !0,
|
|
197
197
|
padding: "lg",
|
|
198
198
|
pos: "relative",
|
|
@@ -204,16 +204,16 @@ function de({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function pe({ children: e }) {
|
|
208
208
|
return /* @__PURE__ */ L(I, { children: e });
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function me({ row: e, layout: t, selectionEnabled: n }) {
|
|
211
211
|
let r = new Map(e.getAllCells().map((e) => [e.column.id, e])), i = (e) => {
|
|
212
212
|
let t = r.get(e.id);
|
|
213
|
-
return t ?
|
|
213
|
+
return t ? s(t.column.columnDef.cell, t.getContext()) : null;
|
|
214
214
|
};
|
|
215
215
|
return /* @__PURE__ */ R(I, { children: [
|
|
216
|
-
n && /* @__PURE__ */ L(
|
|
216
|
+
n && /* @__PURE__ */ L(v, {
|
|
217
217
|
"aria-label": "Select card",
|
|
218
218
|
checked: e.getIsSelected(),
|
|
219
219
|
disabled: !e.getCanSelect(),
|
|
@@ -225,9 +225,9 @@ function pe({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
225
225
|
zIndex: 1
|
|
226
226
|
}
|
|
227
227
|
}),
|
|
228
|
-
t.media.length > 0 && /* @__PURE__ */ L(
|
|
228
|
+
t.media.length > 0 && /* @__PURE__ */ L(g.Section, {
|
|
229
229
|
mb: "xs",
|
|
230
|
-
children: t.media.map((e) => /* @__PURE__ */ L(
|
|
230
|
+
children: t.media.map((e) => /* @__PURE__ */ L(m, { children: i(e) }, e.id))
|
|
231
231
|
}),
|
|
232
232
|
/* @__PURE__ */ R(A, {
|
|
233
233
|
gap: "md",
|
|
@@ -246,13 +246,13 @@ function pe({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
246
246
|
children: i(e)
|
|
247
247
|
}, e.id))]
|
|
248
248
|
}),
|
|
249
|
-
t.badge.length > 0 && /* @__PURE__ */ L(
|
|
249
|
+
t.badge.length > 0 && /* @__PURE__ */ L(b, {
|
|
250
250
|
gap: "xs",
|
|
251
|
-
children: t.badge.map((e) => /* @__PURE__ */ L(
|
|
251
|
+
children: t.badge.map((e) => /* @__PURE__ */ L(ie, { children: i(e) }, e.id))
|
|
252
252
|
}),
|
|
253
253
|
t.meta.length > 0 && /* @__PURE__ */ L(A, {
|
|
254
254
|
gap: 4,
|
|
255
|
-
children: t.meta.map((e) => /* @__PURE__ */ R(
|
|
255
|
+
children: t.meta.map((e) => /* @__PURE__ */ R(b, {
|
|
256
256
|
justify: "space-between",
|
|
257
257
|
gap: "xs",
|
|
258
258
|
wrap: "nowrap",
|
|
@@ -272,14 +272,14 @@ function pe({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
272
272
|
}
|
|
273
273
|
//#endregion
|
|
274
274
|
//#region src/components/DataPagination/DataPagination.tsx
|
|
275
|
-
function
|
|
275
|
+
function he({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r = !0, pageSizeLabel: i = "Rows per page", ...a }) {
|
|
276
276
|
let { table: o } = e, { pageIndex: s, pageSize: c } = e.state.pagination, l = o.getRowCount(), u = o.getPageCount(), d = t ?? e.pageSizeOptions, f = l === 0 ? 0 : s * c + 1, p = Math.min((s + 1) * c, l);
|
|
277
|
-
return /* @__PURE__ */ R(
|
|
277
|
+
return /* @__PURE__ */ R(b, {
|
|
278
278
|
justify: "space-between",
|
|
279
279
|
wrap: "wrap",
|
|
280
280
|
gap: "sm",
|
|
281
281
|
...a,
|
|
282
|
-
children: [/* @__PURE__ */ R(
|
|
282
|
+
children: [/* @__PURE__ */ R(b, {
|
|
283
283
|
gap: "sm",
|
|
284
284
|
wrap: "wrap",
|
|
285
285
|
children: [n && /* @__PURE__ */ L(O, {
|
|
@@ -300,7 +300,7 @@ function me({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r =
|
|
|
300
300
|
l
|
|
301
301
|
]
|
|
302
302
|
})]
|
|
303
|
-
}), /* @__PURE__ */ L(
|
|
303
|
+
}), /* @__PURE__ */ L(w, {
|
|
304
304
|
value: s + 1,
|
|
305
305
|
total: Math.max(u, 1),
|
|
306
306
|
onChange: (e) => o.setPageIndex(e - 1),
|
|
@@ -310,7 +310,7 @@ function me({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r =
|
|
|
310
310
|
}
|
|
311
311
|
//#endregion
|
|
312
312
|
//#region src/components/icons.tsx
|
|
313
|
-
function
|
|
313
|
+
function ge({ direction: e }) {
|
|
314
314
|
return /* @__PURE__ */ R("svg", {
|
|
315
315
|
width: "14",
|
|
316
316
|
height: "14",
|
|
@@ -356,37 +356,37 @@ function X({ d: e, title: t }) {
|
|
|
356
356
|
children: [/* @__PURE__ */ L("title", { children: t }), /* @__PURE__ */ L("path", { d: e })]
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function _e() {
|
|
360
360
|
return /* @__PURE__ */ L(X, {
|
|
361
361
|
title: "search",
|
|
362
362
|
d: "M21 21l-4.3-4.3M11 19a8 8 0 110-16 8 8 0 010 16z"
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function ve() {
|
|
366
366
|
return /* @__PURE__ */ L(X, {
|
|
367
367
|
title: "filter",
|
|
368
368
|
d: "M3 5h18M7 12h10M10 19h4"
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function ye() {
|
|
372
372
|
return /* @__PURE__ */ L(X, {
|
|
373
373
|
title: "open",
|
|
374
374
|
d: "M6 9l6 6 6-6"
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function be() {
|
|
378
378
|
return /* @__PURE__ */ L(X, {
|
|
379
379
|
title: "close",
|
|
380
380
|
d: "M18 6L6 18M6 6l12 12"
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function xe() {
|
|
384
384
|
return /* @__PURE__ */ L(X, {
|
|
385
385
|
title: "pin left",
|
|
386
386
|
d: "M4 4v16M9 8h8M9 12h6M9 16h8"
|
|
387
387
|
});
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function Se() {
|
|
390
390
|
return /* @__PURE__ */ L(X, {
|
|
391
391
|
title: "pin right",
|
|
392
392
|
d: "M20 4v16M7 8h8M9 12h6M7 16h8"
|
|
@@ -394,7 +394,7 @@ function xe() {
|
|
|
394
394
|
}
|
|
395
395
|
//#endregion
|
|
396
396
|
//#region src/components/DataTable/DataTable.tsx
|
|
397
|
-
function
|
|
397
|
+
function Ce(e) {
|
|
398
398
|
let t = e.getIsPinned();
|
|
399
399
|
if (t) return {
|
|
400
400
|
position: "sticky",
|
|
@@ -403,30 +403,30 @@ function Se(e) {
|
|
|
403
403
|
backgroundColor: "var(--mantine-color-body)"
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
let { table: a, renderStatus:
|
|
408
|
-
switch (
|
|
406
|
+
function we({ view: e, slots: t, enableSelection: n, loadingRowCount: r, ...i }) {
|
|
407
|
+
let { table: a, renderStatus: o } = e, c = a.getVisibleLeafColumns(), l = n ?? a.options.enableRowSelection !== !1, u = c.length + +!!l, d = r ?? Math.min(e.state.pagination.pageSize, 8), f = () => {
|
|
408
|
+
switch (o.phase) {
|
|
409
409
|
case "loading": return t?.LoadingTable ? t.LoadingTable() : /* @__PURE__ */ L(j.Tbody, { children: Array.from({ length: d }, (e, t) => /* @__PURE__ */ R(j.Tr, { children: [l && /* @__PURE__ */ L(j.Td, { children: /* @__PURE__ */ L(k, {
|
|
410
410
|
height: 16,
|
|
411
411
|
width: 16
|
|
412
412
|
}) }), c.map((e) => /* @__PURE__ */ L(j.Td, { children: /* @__PURE__ */ L(k, { height: 12 }) }, e.id))] }, t)) });
|
|
413
|
-
case "error": return /* @__PURE__ */ L(
|
|
413
|
+
case "error": return /* @__PURE__ */ L(Ee, {
|
|
414
414
|
colSpan: u,
|
|
415
|
-
children: /* @__PURE__ */ L(
|
|
415
|
+
children: /* @__PURE__ */ L(le, {
|
|
416
416
|
view: e,
|
|
417
417
|
slots: t
|
|
418
418
|
})
|
|
419
419
|
});
|
|
420
420
|
case "empty":
|
|
421
|
-
case "empty-filtered": return /* @__PURE__ */ L(
|
|
421
|
+
case "empty-filtered": return /* @__PURE__ */ L(Ee, {
|
|
422
422
|
colSpan: u,
|
|
423
|
-
children: /* @__PURE__ */ L(
|
|
423
|
+
children: /* @__PURE__ */ L(ue, {
|
|
424
424
|
view: e,
|
|
425
425
|
slots: t
|
|
426
426
|
})
|
|
427
427
|
});
|
|
428
428
|
default: return /* @__PURE__ */ L(j.Tbody, { children: a.getRowModel().rows.map((e) => {
|
|
429
|
-
let n = /* @__PURE__ */ R(I, { children: [l && /* @__PURE__ */ L(j.Td, { children: /* @__PURE__ */ L(
|
|
429
|
+
let n = /* @__PURE__ */ R(I, { children: [l && /* @__PURE__ */ L(j.Td, { children: /* @__PURE__ */ L(v, {
|
|
430
430
|
"aria-label": "Select row",
|
|
431
431
|
checked: e.getIsSelected(),
|
|
432
432
|
disabled: !e.getCanSelect(),
|
|
@@ -436,13 +436,13 @@ function Ce({ view: e, slots: t, enableSelection: n, loadingRowCount: r, ...i })
|
|
|
436
436
|
let t = e.column.columnDef.meta?.align;
|
|
437
437
|
return /* @__PURE__ */ L(j.Td, {
|
|
438
438
|
style: {
|
|
439
|
-
...
|
|
439
|
+
...Ce(e.column),
|
|
440
440
|
...t ? { textAlign: t } : void 0
|
|
441
441
|
},
|
|
442
|
-
children:
|
|
442
|
+
children: s(e.column.columnDef.cell, e.getContext())
|
|
443
443
|
}, e.id);
|
|
444
444
|
})] });
|
|
445
|
-
return t?.Row ? /* @__PURE__ */ L(
|
|
445
|
+
return t?.Row ? /* @__PURE__ */ L(Te, { children: t.Row({
|
|
446
446
|
row: e,
|
|
447
447
|
cells: n
|
|
448
448
|
}) }, e.id) : /* @__PURE__ */ L(j.Tr, {
|
|
@@ -459,33 +459,33 @@ function Ce({ view: e, slots: t, enableSelection: n, loadingRowCount: r, ...i })
|
|
|
459
459
|
...i,
|
|
460
460
|
children: [/* @__PURE__ */ L(j.Thead, { children: a.getHeaderGroups().map((e) => /* @__PURE__ */ R(j.Tr, { children: [l && /* @__PURE__ */ L(j.Th, {
|
|
461
461
|
style: { width: 40 },
|
|
462
|
-
children: /* @__PURE__ */ L(
|
|
462
|
+
children: /* @__PURE__ */ L(v, {
|
|
463
463
|
"aria-label": "Select all rows on this page",
|
|
464
464
|
checked: a.getIsAllPageRowsSelected(),
|
|
465
465
|
indeterminate: a.getIsSomePageRowsSelected() && !a.getIsAllPageRowsSelected(),
|
|
466
466
|
onChange: a.getToggleAllPageRowsSelectedHandler()
|
|
467
467
|
})
|
|
468
|
-
}), e.headers.map((e) => /* @__PURE__ */ L(
|
|
468
|
+
}), e.headers.map((e) => /* @__PURE__ */ L(De, { header: e }, e.id))] }, e.id)) }), f()]
|
|
469
469
|
})
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Te({ children: e }) {
|
|
473
473
|
return /* @__PURE__ */ L(I, { children: e });
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function Ee({ colSpan: e, children: t }) {
|
|
476
476
|
return /* @__PURE__ */ L(j.Tbody, { children: /* @__PURE__ */ L(j.Tr, { children: /* @__PURE__ */ L(j.Td, {
|
|
477
477
|
colSpan: e,
|
|
478
|
-
children: /* @__PURE__ */ L(
|
|
478
|
+
children: /* @__PURE__ */ L(_, {
|
|
479
479
|
p: "xl",
|
|
480
480
|
children: t
|
|
481
481
|
})
|
|
482
482
|
}) }) });
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
let { column: t } = e, n = t.columnDef.meta?.align, r = t.getIsSorted(), i = t.getSortIndex(), a = i > 0,
|
|
484
|
+
function De({ header: e }) {
|
|
485
|
+
let { column: t } = e, n = t.columnDef.meta?.align, r = t.getIsSorted(), i = t.getSortIndex(), a = i > 0, o = e.isPlaceholder ? null : s(t.columnDef.header, e.getContext());
|
|
486
486
|
return /* @__PURE__ */ L(j.Th, {
|
|
487
487
|
style: {
|
|
488
|
-
...
|
|
488
|
+
...Ce(t),
|
|
489
489
|
...n ? { textAlign: n } : void 0
|
|
490
490
|
},
|
|
491
491
|
"aria-sort": r === "asc" ? "ascending" : r === "desc" ? "descending" : void 0,
|
|
@@ -498,8 +498,8 @@ function Ee({ header: e }) {
|
|
|
498
498
|
font: "inherit"
|
|
499
499
|
},
|
|
500
500
|
children: [
|
|
501
|
-
|
|
502
|
-
/* @__PURE__ */ L(
|
|
501
|
+
o,
|
|
502
|
+
/* @__PURE__ */ L(ge, { direction: r }),
|
|
503
503
|
a && /* @__PURE__ */ L("span", {
|
|
504
504
|
role: "note",
|
|
505
505
|
style: {
|
|
@@ -510,25 +510,25 @@ function Ee({ header: e }) {
|
|
|
510
510
|
children: i + 1
|
|
511
511
|
})
|
|
512
512
|
]
|
|
513
|
-
}) :
|
|
513
|
+
}) : o
|
|
514
514
|
});
|
|
515
515
|
}
|
|
516
516
|
//#endregion
|
|
517
517
|
//#region src/core/useForceCards.ts
|
|
518
|
-
var
|
|
519
|
-
function
|
|
518
|
+
var Oe = "(max-width: 0px)";
|
|
519
|
+
function ke(e) {
|
|
520
520
|
let t = /^([\d.]+)(\D*)$/.exec(e.trim());
|
|
521
521
|
if (!t) return `(max-width: ${e})`;
|
|
522
522
|
let n = Number(t[1]), r = t[2] || "px";
|
|
523
523
|
return `(max-width: ${n - (r === "em" || r === "rem" ? .01 : .1)}${r})`;
|
|
524
524
|
}
|
|
525
|
-
function
|
|
526
|
-
let t = F(), n = e?.forceCardsBelow, r = n ? t.breakpoints[n] : void 0, i = G(r ?
|
|
525
|
+
function Ae(e) {
|
|
526
|
+
let t = F(), n = e?.forceCardsBelow, r = n ? t.breakpoints[n] : void 0, i = G(r ? ke(r) : Oe, !1);
|
|
527
527
|
return !!r && !!i;
|
|
528
528
|
}
|
|
529
529
|
//#endregion
|
|
530
530
|
//#region src/core/formatValue.ts
|
|
531
|
-
var
|
|
531
|
+
var je = {
|
|
532
532
|
text: (e) => e == null ? "" : String(e),
|
|
533
533
|
number: (e) => e == null ? "" : new Intl.NumberFormat().format(Number(e)),
|
|
534
534
|
currency: (e) => e == null ? "" : new Intl.NumberFormat(void 0, {
|
|
@@ -542,7 +542,7 @@ var Ae = {
|
|
|
542
542
|
},
|
|
543
543
|
boolean: (e) => e == null ? "" : e ? "Yes" : "No"
|
|
544
544
|
};
|
|
545
|
-
function
|
|
545
|
+
function Me(e, t) {
|
|
546
546
|
if (e === "number" || e === "currency") {
|
|
547
547
|
let n = new Intl.NumberFormat(void 0, e === "currency" ? {
|
|
548
548
|
style: "currency",
|
|
@@ -558,15 +558,15 @@ function je(e, t) {
|
|
|
558
558
|
return Number.isNaN(n.getTime()) ? String(t) : e.format(n);
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
|
-
return
|
|
561
|
+
return je[e];
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Ne(e, t, n) {
|
|
564
564
|
let r = t ?? n?.[e];
|
|
565
|
-
return r ? typeof r == "function" ? r :
|
|
565
|
+
return r ? typeof r == "function" ? r : Me(e, r) : je[e];
|
|
566
566
|
}
|
|
567
567
|
//#endregion
|
|
568
568
|
//#region src/components/DataToolbar/FacetBuckets.tsx
|
|
569
|
-
function
|
|
569
|
+
function Pe({ facet: e, value: t, onChange: n }) {
|
|
570
570
|
let r = Array.isArray(t) ? t : null;
|
|
571
571
|
return /* @__PURE__ */ L(A, {
|
|
572
572
|
gap: 4,
|
|
@@ -579,14 +579,14 @@ function Ne({ facet: e, value: t, onChange: n }) {
|
|
|
579
579
|
borderRadius: 4,
|
|
580
580
|
background: t ? "var(--mantine-color-blue-light)" : void 0
|
|
581
581
|
},
|
|
582
|
-
children: /* @__PURE__ */ R(
|
|
582
|
+
children: /* @__PURE__ */ R(b, {
|
|
583
583
|
gap: "xs",
|
|
584
584
|
justify: "space-between",
|
|
585
585
|
wrap: "nowrap",
|
|
586
586
|
children: [/* @__PURE__ */ L(M, {
|
|
587
587
|
size: "sm",
|
|
588
588
|
children: e.label
|
|
589
|
-
}), /* @__PURE__ */ L(
|
|
589
|
+
}), /* @__PURE__ */ L(p, {
|
|
590
590
|
size: "sm",
|
|
591
591
|
variant: "light",
|
|
592
592
|
color: e.count === 0 ? "gray" : "blue",
|
|
@@ -599,15 +599,15 @@ function Ne({ facet: e, value: t, onChange: n }) {
|
|
|
599
599
|
}
|
|
600
600
|
//#endregion
|
|
601
601
|
//#region src/components/DataToolbar/FilterControl.tsx
|
|
602
|
-
function
|
|
603
|
-
return /* @__PURE__ */ R(
|
|
602
|
+
function Fe({ label: e, onClear: t }) {
|
|
603
|
+
return /* @__PURE__ */ R(b, {
|
|
604
604
|
justify: "space-between",
|
|
605
605
|
wrap: "nowrap",
|
|
606
606
|
children: [/* @__PURE__ */ L(M, {
|
|
607
607
|
size: "sm",
|
|
608
608
|
fw: 500,
|
|
609
609
|
children: e
|
|
610
|
-
}), /* @__PURE__ */ L(
|
|
610
|
+
}), /* @__PURE__ */ L(f, {
|
|
611
611
|
component: "button",
|
|
612
612
|
type: "button",
|
|
613
613
|
size: "xs",
|
|
@@ -617,26 +617,26 @@ function Pe({ label: e, onClear: t }) {
|
|
|
617
617
|
})]
|
|
618
618
|
});
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function Ie(e) {
|
|
621
621
|
return e ? typeof e == "string" ? e : e.toISOString().split("T")[0] ?? null : null;
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function Le(e) {
|
|
624
624
|
return Array.isArray(e) ? [e[0], e[1]] : [null, null];
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function Re(e, t) {
|
|
627
627
|
return e.values.length > 0 ? e.values.map((e) => ({
|
|
628
628
|
value: e.value,
|
|
629
629
|
label: `${e.label ?? e.value} (${e.count})`,
|
|
630
630
|
disabled: e.count === 0
|
|
631
631
|
})) : t ?? [];
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function ze({ column: e, facet: t }) {
|
|
634
634
|
let n = e.columnDef.meta?.filter;
|
|
635
635
|
if (!n) return null;
|
|
636
636
|
let r = J(e), i = n.placeholder ?? r, a = e.getFilterValue(), o = (t) => e.setFilterValue(t);
|
|
637
637
|
if (n.component) {
|
|
638
638
|
let t = n.component;
|
|
639
|
-
return /* @__PURE__ */ L(
|
|
639
|
+
return /* @__PURE__ */ L(x.Wrapper, {
|
|
640
640
|
label: r,
|
|
641
641
|
children: /* @__PURE__ */ L(t, {
|
|
642
642
|
value: a,
|
|
@@ -651,20 +651,20 @@ function Re({ column: e, facet: t }) {
|
|
|
651
651
|
label: r,
|
|
652
652
|
placeholder: i,
|
|
653
653
|
clearable: !0,
|
|
654
|
-
data: s ?
|
|
654
|
+
data: s ? Re(s, n.options) : n.options ?? [],
|
|
655
655
|
value: a ?? null,
|
|
656
656
|
onChange: (e) => o(e ?? void 0)
|
|
657
657
|
});
|
|
658
|
-
case "multiselect": return /* @__PURE__ */ L(
|
|
658
|
+
case "multiselect": return /* @__PURE__ */ L(te, {
|
|
659
659
|
label: r,
|
|
660
660
|
placeholder: i,
|
|
661
|
-
data: s ?
|
|
661
|
+
data: s ? Re(s, n.options) : n.options ?? [],
|
|
662
662
|
value: a ?? [],
|
|
663
663
|
onChange: (e) => o(e.length > 0 ? e : void 0)
|
|
664
664
|
});
|
|
665
665
|
case "boolean": {
|
|
666
666
|
let e = a == null ? "all" : a ? "yes" : "no", t = s?.values.find((e) => e.value === "true"), n = s?.values.find((e) => e.value === "false"), i = t ? `Yes (${t.count})` : "Yes", c = n ? `No (${n.count})` : "No";
|
|
667
|
-
return /* @__PURE__ */ L(
|
|
667
|
+
return /* @__PURE__ */ L(x.Wrapper, {
|
|
668
668
|
label: r,
|
|
669
669
|
children: /* @__PURE__ */ L(D, {
|
|
670
670
|
fullWidth: !0,
|
|
@@ -691,21 +691,21 @@ function Re({ column: e, facet: t }) {
|
|
|
691
691
|
});
|
|
692
692
|
}
|
|
693
693
|
case "numberRange": {
|
|
694
|
-
let [t, i] =
|
|
694
|
+
let [t, i] = Le(a), s = n.min ?? c?.min, l = n.max ?? c?.max, u = s != null && l != null, d = a != null, f = c ? /* @__PURE__ */ L(Pe, {
|
|
695
695
|
facet: c,
|
|
696
696
|
value: a,
|
|
697
697
|
onChange: o
|
|
698
|
-
}) : null, p = d ? /* @__PURE__ */ L(
|
|
698
|
+
}) : null, p = d ? /* @__PURE__ */ L(Fe, {
|
|
699
699
|
label: r,
|
|
700
700
|
onClear: () => o(void 0)
|
|
701
701
|
}) : r;
|
|
702
702
|
if (u) {
|
|
703
|
-
let a = [t ?? s, i ?? l], c = e.columnDef.meta?.dataType, u = c ?
|
|
704
|
-
return /* @__PURE__ */ L(
|
|
703
|
+
let a = [t ?? s, i ?? l], c = e.columnDef.meta?.dataType, u = c ? Ne(c, e.columnDef.meta?.format, void 0) : (e) => String(e);
|
|
704
|
+
return /* @__PURE__ */ L(x.Wrapper, {
|
|
705
705
|
label: p,
|
|
706
706
|
children: /* @__PURE__ */ R(A, {
|
|
707
707
|
gap: "xs",
|
|
708
|
-
children: [f, /* @__PURE__ */ L(
|
|
708
|
+
children: [f, /* @__PURE__ */ L(ne, {
|
|
709
709
|
min: s,
|
|
710
710
|
max: l,
|
|
711
711
|
step: n.step ?? 1,
|
|
@@ -720,23 +720,23 @@ function Re({ column: e, facet: t }) {
|
|
|
720
720
|
})
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
if (f) return /* @__PURE__ */ L(
|
|
723
|
+
if (f) return /* @__PURE__ */ L(x.Wrapper, {
|
|
724
724
|
label: p,
|
|
725
725
|
children: f
|
|
726
726
|
});
|
|
727
727
|
let m = (e) => o(e[0] == null && e[1] == null ? void 0 : e), h = (e) => e === "" || e == null ? null : Number(e);
|
|
728
|
-
return /* @__PURE__ */ L(
|
|
728
|
+
return /* @__PURE__ */ L(x.Wrapper, {
|
|
729
729
|
label: r,
|
|
730
|
-
children: /* @__PURE__ */ R(
|
|
730
|
+
children: /* @__PURE__ */ R(b, {
|
|
731
731
|
gap: 4,
|
|
732
732
|
wrap: "nowrap",
|
|
733
|
-
children: [/* @__PURE__ */ L(
|
|
733
|
+
children: [/* @__PURE__ */ L(C, {
|
|
734
734
|
"aria-label": `${r} minimum`,
|
|
735
735
|
placeholder: "Min",
|
|
736
736
|
value: t ?? "",
|
|
737
737
|
onChange: (e) => m([h(e), i]),
|
|
738
738
|
w: 90
|
|
739
|
-
}), /* @__PURE__ */ L(
|
|
739
|
+
}), /* @__PURE__ */ L(C, {
|
|
740
740
|
"aria-label": `${r} maximum`,
|
|
741
741
|
placeholder: "Max",
|
|
742
742
|
value: i ?? "",
|
|
@@ -752,18 +752,18 @@ function Re({ column: e, facet: t }) {
|
|
|
752
752
|
clearable: !0,
|
|
753
753
|
popoverProps: { withinPortal: !1 },
|
|
754
754
|
value: a ? new Date(a) : null,
|
|
755
|
-
onChange: (e) => o(
|
|
755
|
+
onChange: (e) => o(Ie(e) ?? void 0)
|
|
756
756
|
});
|
|
757
757
|
case "dateRange": {
|
|
758
|
-
let [e, t] =
|
|
758
|
+
let [e, t] = Le(a), n = [e ? new Date(e) : null, t ? new Date(t) : null], s = a == null ? r : /* @__PURE__ */ L(Fe, {
|
|
759
759
|
label: r,
|
|
760
760
|
onClear: () => o(void 0)
|
|
761
761
|
});
|
|
762
|
-
return /* @__PURE__ */ L(
|
|
762
|
+
return /* @__PURE__ */ L(x.Wrapper, {
|
|
763
763
|
label: s,
|
|
764
764
|
children: /* @__PURE__ */ R(A, {
|
|
765
765
|
gap: "xs",
|
|
766
|
-
children: [c && /* @__PURE__ */ L(
|
|
766
|
+
children: [c && /* @__PURE__ */ L(Pe, {
|
|
767
767
|
facet: c,
|
|
768
768
|
value: a,
|
|
769
769
|
onChange: o
|
|
@@ -774,7 +774,7 @@ function Re({ column: e, facet: t }) {
|
|
|
774
774
|
clearable: !0,
|
|
775
775
|
value: n,
|
|
776
776
|
onChange: ([e, t]) => {
|
|
777
|
-
let n =
|
|
777
|
+
let n = Ie(e), r = Ie(t);
|
|
778
778
|
o(n == null && r == null ? void 0 : [n, r]);
|
|
779
779
|
}
|
|
780
780
|
})]
|
|
@@ -791,59 +791,59 @@ function Re({ column: e, facet: t }) {
|
|
|
791
791
|
}
|
|
792
792
|
//#endregion
|
|
793
793
|
//#region src/components/DataToolbar/FilterControls.tsx
|
|
794
|
-
function
|
|
795
|
-
return e.state.columnFilters.length > 0 ? /* @__PURE__ */ L(
|
|
794
|
+
function Be({ view: e }) {
|
|
795
|
+
return e.state.columnFilters.length > 0 ? /* @__PURE__ */ L(h, {
|
|
796
796
|
variant: "subtle",
|
|
797
797
|
size: "compact-sm",
|
|
798
798
|
color: "gray",
|
|
799
|
-
leftSection: /* @__PURE__ */ L(
|
|
799
|
+
leftSection: /* @__PURE__ */ L(be, {}),
|
|
800
800
|
onClick: () => e.table.resetColumnFilters(),
|
|
801
801
|
children: "Reset filters"
|
|
802
802
|
}) : null;
|
|
803
803
|
}
|
|
804
|
-
function
|
|
804
|
+
function Ve(e) {
|
|
805
805
|
return e > 0 ? `Filters (${e})` : "Filters";
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function He({ view: e, controls: t }) {
|
|
808
808
|
return /* @__PURE__ */ R(A, {
|
|
809
809
|
gap: "sm",
|
|
810
810
|
style: { minWidth: 240 },
|
|
811
|
-
children: [t, /* @__PURE__ */ L(
|
|
811
|
+
children: [t, /* @__PURE__ */ L(b, {
|
|
812
812
|
justify: "flex-end",
|
|
813
|
-
children: /* @__PURE__ */ L(
|
|
813
|
+
children: /* @__PURE__ */ L(Be, { view: e })
|
|
814
814
|
})]
|
|
815
815
|
});
|
|
816
816
|
}
|
|
817
|
-
function
|
|
818
|
-
let n = e.filterableColumns, r = G(
|
|
817
|
+
function Ue({ view: e, inlineThreshold: t }) {
|
|
818
|
+
let n = e.filterableColumns, r = G(ke(F().breakpoints.sm), !1), [i, { open: a, close: o }] = oe(!1);
|
|
819
819
|
if (n.length === 0) return null;
|
|
820
|
-
let s = n.map((t) => /* @__PURE__ */ L(
|
|
820
|
+
let s = n.map((t) => /* @__PURE__ */ L(ze, {
|
|
821
821
|
column: t,
|
|
822
822
|
facet: e.facets[t.id]
|
|
823
823
|
}, t.id)), c = e.state.columnFilters.length;
|
|
824
|
-
return r ? /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(
|
|
824
|
+
return r ? /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L(h, {
|
|
825
825
|
variant: "default",
|
|
826
|
-
leftSection: /* @__PURE__ */ L(
|
|
826
|
+
leftSection: /* @__PURE__ */ L(ve, {}),
|
|
827
827
|
onClick: a,
|
|
828
|
-
children:
|
|
829
|
-
}), /* @__PURE__ */ L(
|
|
828
|
+
children: Ve(c)
|
|
829
|
+
}), /* @__PURE__ */ L(y, {
|
|
830
830
|
opened: i,
|
|
831
831
|
onClose: o,
|
|
832
832
|
title: "Filters",
|
|
833
833
|
position: "bottom",
|
|
834
834
|
size: "auto",
|
|
835
|
-
children: /* @__PURE__ */ L(
|
|
835
|
+
children: /* @__PURE__ */ L(He, {
|
|
836
836
|
view: e,
|
|
837
837
|
controls: s
|
|
838
838
|
})
|
|
839
|
-
})] }) : n.length <= t ? /* @__PURE__ */ R(I, { children: [s, /* @__PURE__ */ L(
|
|
839
|
+
})] }) : n.length <= t ? /* @__PURE__ */ R(I, { children: [s, /* @__PURE__ */ L(Be, { view: e })] }) : /* @__PURE__ */ R(E, {
|
|
840
840
|
position: "bottom-start",
|
|
841
841
|
closeOnClickOutside: !1,
|
|
842
|
-
children: [/* @__PURE__ */ L(
|
|
842
|
+
children: [/* @__PURE__ */ L(E.Target, { children: /* @__PURE__ */ L(h, {
|
|
843
843
|
variant: "default",
|
|
844
|
-
leftSection: /* @__PURE__ */ L(
|
|
845
|
-
children:
|
|
846
|
-
}) }), /* @__PURE__ */ L(
|
|
844
|
+
leftSection: /* @__PURE__ */ L(ve, {}),
|
|
845
|
+
children: Ve(c)
|
|
846
|
+
}) }), /* @__PURE__ */ L(E.Dropdown, { children: /* @__PURE__ */ L(He, {
|
|
847
847
|
view: e,
|
|
848
848
|
controls: s
|
|
849
849
|
}) })]
|
|
@@ -851,9 +851,9 @@ function He({ view: e, inlineThreshold: t }) {
|
|
|
851
851
|
}
|
|
852
852
|
//#endregion
|
|
853
853
|
//#region src/components/DataToolbar/SortControl.tsx
|
|
854
|
-
function
|
|
854
|
+
function We({ view: e }) {
|
|
855
855
|
let { sortableColumns: t, state: n, table: r } = e, i = n.sorting[0];
|
|
856
|
-
return /* @__PURE__ */ R(
|
|
856
|
+
return /* @__PURE__ */ R(b, {
|
|
857
857
|
gap: 4,
|
|
858
858
|
wrap: "nowrap",
|
|
859
859
|
children: [/* @__PURE__ */ L(O, {
|
|
@@ -869,7 +869,7 @@ function Ue({ view: e }) {
|
|
|
869
869
|
id: e,
|
|
870
870
|
desc: i?.desc ?? !1
|
|
871
871
|
}] : [])
|
|
872
|
-
}), /* @__PURE__ */ L(
|
|
872
|
+
}), /* @__PURE__ */ L(d, {
|
|
873
873
|
"aria-label": "Toggle sort direction",
|
|
874
874
|
variant: "default",
|
|
875
875
|
size: "lg",
|
|
@@ -878,13 +878,13 @@ function Ue({ view: e }) {
|
|
|
878
878
|
id: i.id,
|
|
879
879
|
desc: !i.desc
|
|
880
880
|
}]),
|
|
881
|
-
children: /* @__PURE__ */ L(
|
|
881
|
+
children: /* @__PURE__ */ L(ge, { direction: i ? i.desc ? "desc" : "asc" : !1 })
|
|
882
882
|
})]
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
885
|
//#endregion
|
|
886
886
|
//#region src/components/DataToolbar/ViewSwitcher.tsx
|
|
887
|
-
function
|
|
887
|
+
function Ge({ view: e, lockSwitcherOnMobile: t }) {
|
|
888
888
|
return e.isMobileForced && t ? null : /* @__PURE__ */ L(D, {
|
|
889
889
|
"aria-label": "View",
|
|
890
890
|
value: e.view,
|
|
@@ -903,71 +903,71 @@ function We({ view: e, lockSwitcherOnMobile: t }) {
|
|
|
903
903
|
}
|
|
904
904
|
//#endregion
|
|
905
905
|
//#region src/components/DataToolbar/VisibilityMenu.tsx
|
|
906
|
-
function
|
|
906
|
+
function Ke({ column: e }) {
|
|
907
907
|
if (!e.getCanPin()) return null;
|
|
908
908
|
let t = e.getIsPinned();
|
|
909
|
-
return /* @__PURE__ */ R(
|
|
909
|
+
return /* @__PURE__ */ R(b, {
|
|
910
910
|
gap: 2,
|
|
911
|
-
children: [/* @__PURE__ */ L(
|
|
911
|
+
children: [/* @__PURE__ */ L(d, {
|
|
912
912
|
size: "xs",
|
|
913
913
|
variant: t === "left" ? "filled" : "subtle",
|
|
914
914
|
color: t === "left" ? "blue" : "gray",
|
|
915
915
|
"aria-label": `Pin ${J(e)} left`,
|
|
916
916
|
onClick: () => e.pin(t === "left" ? !1 : "left"),
|
|
917
|
-
children: /* @__PURE__ */ L(
|
|
918
|
-
}), /* @__PURE__ */ L(
|
|
917
|
+
children: /* @__PURE__ */ L(xe, {})
|
|
918
|
+
}), /* @__PURE__ */ L(d, {
|
|
919
919
|
size: "xs",
|
|
920
920
|
variant: t === "right" ? "filled" : "subtle",
|
|
921
921
|
color: t === "right" ? "blue" : "gray",
|
|
922
922
|
"aria-label": `Pin ${J(e)} right`,
|
|
923
923
|
onClick: () => e.pin(t === "right" ? !1 : "right"),
|
|
924
|
-
children: /* @__PURE__ */ L(
|
|
924
|
+
children: /* @__PURE__ */ L(Se, {})
|
|
925
925
|
})]
|
|
926
926
|
});
|
|
927
927
|
}
|
|
928
|
-
function
|
|
928
|
+
function qe({ view: e }) {
|
|
929
929
|
let t = e.table.getAllLeafColumns().filter((e) => e.getCanHide());
|
|
930
|
-
return t.length === 0 ? null : /* @__PURE__ */ R(
|
|
930
|
+
return t.length === 0 ? null : /* @__PURE__ */ R(S, {
|
|
931
931
|
closeOnItemClick: !1,
|
|
932
932
|
withinPortal: !0,
|
|
933
933
|
position: "bottom-end",
|
|
934
|
-
children: [/* @__PURE__ */ L(
|
|
934
|
+
children: [/* @__PURE__ */ L(S.Target, { children: /* @__PURE__ */ L(h, {
|
|
935
935
|
variant: "default",
|
|
936
|
-
rightSection: /* @__PURE__ */ L(
|
|
936
|
+
rightSection: /* @__PURE__ */ L(ye, {}),
|
|
937
937
|
children: "Columns"
|
|
938
|
-
}) }), /* @__PURE__ */ L(
|
|
938
|
+
}) }), /* @__PURE__ */ L(S.Dropdown, { children: /* @__PURE__ */ L(A, {
|
|
939
939
|
gap: "xs",
|
|
940
940
|
p: "xs",
|
|
941
|
-
children: t.map((e) => /* @__PURE__ */ R(
|
|
941
|
+
children: t.map((e) => /* @__PURE__ */ R(b, {
|
|
942
942
|
gap: "xs",
|
|
943
943
|
justify: "space-between",
|
|
944
944
|
wrap: "nowrap",
|
|
945
|
-
children: [/* @__PURE__ */ L(
|
|
945
|
+
children: [/* @__PURE__ */ L(v, {
|
|
946
946
|
label: J(e),
|
|
947
947
|
checked: e.getIsVisible(),
|
|
948
948
|
onChange: (t) => e.toggleVisibility(t.currentTarget.checked)
|
|
949
|
-
}), /* @__PURE__ */ L(
|
|
949
|
+
}), /* @__PURE__ */ L(Ke, { column: e })]
|
|
950
950
|
}, e.id))
|
|
951
951
|
}) })]
|
|
952
952
|
});
|
|
953
953
|
}
|
|
954
954
|
//#endregion
|
|
955
955
|
//#region src/components/DataToolbar/DataToolbar.tsx
|
|
956
|
-
function
|
|
956
|
+
function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold: n = 3, lockSwitcherOnMobile: r, showSearch: i, showFilters: a, showSort: o, showVisibility: s, showViewSwitcher: c, ...l }) {
|
|
957
957
|
let { table: u, state: d } = e, f = i ?? u.options.enableGlobalFilter !== !1, p = a ?? e.filterableColumns.length > 0, m = o ?? e.sortableColumns.length > 0, h = s ?? !0, g = c ?? !0;
|
|
958
|
-
return /* @__PURE__ */ R(
|
|
958
|
+
return /* @__PURE__ */ R(b, {
|
|
959
959
|
justify: "space-between",
|
|
960
960
|
wrap: "wrap",
|
|
961
961
|
gap: "sm",
|
|
962
962
|
...l,
|
|
963
|
-
children: [/* @__PURE__ */ R(
|
|
963
|
+
children: [/* @__PURE__ */ R(b, {
|
|
964
964
|
wrap: "wrap",
|
|
965
965
|
gap: "sm",
|
|
966
966
|
children: [
|
|
967
967
|
f && /* @__PURE__ */ L(N, {
|
|
968
968
|
"aria-label": "Search",
|
|
969
969
|
placeholder: t,
|
|
970
|
-
leftSection: /* @__PURE__ */ L(
|
|
970
|
+
leftSection: /* @__PURE__ */ L(_e, {}),
|
|
971
971
|
value: d.globalFilter,
|
|
972
972
|
onChange: (e) => u.setGlobalFilter(e.currentTarget.value),
|
|
973
973
|
rightSection: d.globalFilter ? /* @__PURE__ */ L(ee, {
|
|
@@ -976,16 +976,16 @@ function qe({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
976
976
|
onClick: () => u.setGlobalFilter("")
|
|
977
977
|
}) : void 0
|
|
978
978
|
}),
|
|
979
|
-
p && /* @__PURE__ */ L(
|
|
979
|
+
p && /* @__PURE__ */ L(Ue, {
|
|
980
980
|
view: e,
|
|
981
981
|
inlineThreshold: n
|
|
982
982
|
}),
|
|
983
|
-
m && /* @__PURE__ */ L(
|
|
983
|
+
m && /* @__PURE__ */ L(We, { view: e })
|
|
984
984
|
]
|
|
985
|
-
}), /* @__PURE__ */ R(
|
|
985
|
+
}), /* @__PURE__ */ R(b, {
|
|
986
986
|
wrap: "wrap",
|
|
987
987
|
gap: "sm",
|
|
988
|
-
children: [h && /* @__PURE__ */ L(
|
|
988
|
+
children: [h && /* @__PURE__ */ L(qe, { view: e }), g && /* @__PURE__ */ L(Ge, {
|
|
989
989
|
view: e,
|
|
990
990
|
lockSwitcherOnMobile: r
|
|
991
991
|
})]
|
|
@@ -994,17 +994,17 @@ function qe({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
994
994
|
}
|
|
995
995
|
//#endregion
|
|
996
996
|
//#region src/components/DataView/context.tsx
|
|
997
|
-
var
|
|
997
|
+
var Ye = ae(null), Xe = Ye.Provider;
|
|
998
998
|
function Z() {
|
|
999
|
-
let e =
|
|
999
|
+
let e = B(Ye);
|
|
1000
1000
|
if (!e) throw Error("DataView.Toolbar / DataView.Body / DataView.Pagination must be rendered inside <DataView>.");
|
|
1001
1001
|
return e;
|
|
1002
1002
|
}
|
|
1003
1003
|
//#endregion
|
|
1004
1004
|
//#region src/components/DataView/DataView.tsx
|
|
1005
1005
|
function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMobile: i, children: a, ...o }) {
|
|
1006
|
-
return /* @__PURE__ */ L(
|
|
1007
|
-
value:
|
|
1006
|
+
return /* @__PURE__ */ L(Xe, {
|
|
1007
|
+
value: H(() => ({
|
|
1008
1008
|
view: e,
|
|
1009
1009
|
slots: t,
|
|
1010
1010
|
renderCard: n,
|
|
@@ -1020,44 +1020,44 @@ function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMo
|
|
|
1020
1020
|
children: /* @__PURE__ */ L(A, {
|
|
1021
1021
|
...o,
|
|
1022
1022
|
children: a ?? /* @__PURE__ */ R(I, { children: [
|
|
1023
|
-
/* @__PURE__ */ L(Xe, {}),
|
|
1024
|
-
/* @__PURE__ */ L($e, {}),
|
|
1025
1023
|
/* @__PURE__ */ L(Ze, {}),
|
|
1026
|
-
/* @__PURE__ */ L(
|
|
1024
|
+
/* @__PURE__ */ L(et, {}),
|
|
1025
|
+
/* @__PURE__ */ L(Qe, {}),
|
|
1026
|
+
/* @__PURE__ */ L($e, {})
|
|
1027
1027
|
] })
|
|
1028
1028
|
})
|
|
1029
1029
|
});
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function Ze(e) {
|
|
1032
1032
|
let { view: t, lockSwitcherOnMobile: n } = Z();
|
|
1033
|
-
return /* @__PURE__ */ L(
|
|
1033
|
+
return /* @__PURE__ */ L(Je, {
|
|
1034
1034
|
view: t,
|
|
1035
1035
|
lockSwitcherOnMobile: n,
|
|
1036
1036
|
...e
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function Qe({ tableProps: e, cardsProps: t }) {
|
|
1040
1040
|
let { view: n, slots: r, renderCard: i, fallbackRole: a } = Z();
|
|
1041
|
-
return n.view === "cards" ? /* @__PURE__ */ L(
|
|
1041
|
+
return n.view === "cards" ? /* @__PURE__ */ L(fe, {
|
|
1042
1042
|
view: n,
|
|
1043
1043
|
slots: r,
|
|
1044
1044
|
renderCard: i,
|
|
1045
1045
|
fallbackRole: a,
|
|
1046
1046
|
...t
|
|
1047
|
-
}) : /* @__PURE__ */ L(
|
|
1047
|
+
}) : /* @__PURE__ */ L(we, {
|
|
1048
1048
|
view: n,
|
|
1049
1049
|
slots: r,
|
|
1050
1050
|
...e
|
|
1051
1051
|
});
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1053
|
+
function $e(e) {
|
|
1054
1054
|
let { view: t } = Z();
|
|
1055
|
-
return /* @__PURE__ */ L(
|
|
1055
|
+
return /* @__PURE__ */ L(he, {
|
|
1056
1056
|
view: t,
|
|
1057
1057
|
...e
|
|
1058
1058
|
});
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function et(e) {
|
|
1061
1061
|
let { view: t, slots: n } = Z();
|
|
1062
1062
|
return /* @__PURE__ */ L(q, {
|
|
1063
1063
|
view: t,
|
|
@@ -1065,23 +1065,120 @@ function $e(e) {
|
|
|
1065
1065
|
...e
|
|
1066
1066
|
});
|
|
1067
1067
|
}
|
|
1068
|
-
Q.Toolbar =
|
|
1068
|
+
Q.Toolbar = Ze, Q.BulkActions = et, Q.Body = Qe, Q.Pagination = $e;
|
|
1069
|
+
//#endregion
|
|
1070
|
+
//#region src/core/colBuilder.ts
|
|
1071
|
+
function tt(e) {
|
|
1072
|
+
return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
1073
|
+
}
|
|
1074
|
+
var nt = {
|
|
1075
|
+
text: {
|
|
1076
|
+
dataType: "text",
|
|
1077
|
+
filterVariant: "text"
|
|
1078
|
+
},
|
|
1079
|
+
number: {
|
|
1080
|
+
dataType: "number",
|
|
1081
|
+
filterVariant: "numberRange",
|
|
1082
|
+
align: "right"
|
|
1083
|
+
},
|
|
1084
|
+
currency: {
|
|
1085
|
+
dataType: "currency",
|
|
1086
|
+
filterVariant: "numberRange",
|
|
1087
|
+
align: "right"
|
|
1088
|
+
},
|
|
1089
|
+
date: {
|
|
1090
|
+
dataType: "date",
|
|
1091
|
+
filterVariant: "dateRange"
|
|
1092
|
+
},
|
|
1093
|
+
boolean: {
|
|
1094
|
+
dataType: "boolean",
|
|
1095
|
+
filterVariant: "boolean"
|
|
1096
|
+
},
|
|
1097
|
+
select: { filterVariant: "select" },
|
|
1098
|
+
multiselect: { filterVariant: "multiselect" }
|
|
1099
|
+
}, rt = class {
|
|
1100
|
+
cols = [];
|
|
1101
|
+
helper = o();
|
|
1102
|
+
add(e, t, n) {
|
|
1103
|
+
let r = nt[e];
|
|
1104
|
+
if (!r) throw Error(`Unknown preset: ${e}`);
|
|
1105
|
+
let i = n?.header ?? tt(t), a = n?.align ?? r.align, o;
|
|
1106
|
+
if (n?.filter === !1) o = void 0;
|
|
1107
|
+
else {
|
|
1108
|
+
let e = {
|
|
1109
|
+
variant: r.filterVariant,
|
|
1110
|
+
...n?.options ? { options: n.options } : {}
|
|
1111
|
+
};
|
|
1112
|
+
o = n?.filter ? {
|
|
1113
|
+
...e,
|
|
1114
|
+
...n.filter
|
|
1115
|
+
} : e;
|
|
1116
|
+
}
|
|
1117
|
+
let s = this.helper.accessor(t, {
|
|
1118
|
+
header: i,
|
|
1119
|
+
...n?.cell ? { cell: n.cell } : {},
|
|
1120
|
+
...n?.enableSorting === !1 ? { enableSorting: !1 } : {},
|
|
1121
|
+
meta: {
|
|
1122
|
+
label: i,
|
|
1123
|
+
...r.dataType ? { dataType: r.dataType } : {},
|
|
1124
|
+
...a ? { align: a } : {},
|
|
1125
|
+
...o ? { filter: o } : {},
|
|
1126
|
+
...n?.format ? { format: n.format } : {},
|
|
1127
|
+
...n?.card ? { card: {
|
|
1128
|
+
role: n.card,
|
|
1129
|
+
...n.cardOrder == null ? {} : { order: n.cardOrder }
|
|
1130
|
+
} } : {}
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
return this.cols.push(s), this;
|
|
1134
|
+
}
|
|
1135
|
+
text(e, t) {
|
|
1136
|
+
return this.add("text", e, t);
|
|
1137
|
+
}
|
|
1138
|
+
number(e, t) {
|
|
1139
|
+
return this.add("number", e, t);
|
|
1140
|
+
}
|
|
1141
|
+
currency(e, t) {
|
|
1142
|
+
return this.add("currency", e, t);
|
|
1143
|
+
}
|
|
1144
|
+
date(e, t) {
|
|
1145
|
+
return this.add("date", e, t);
|
|
1146
|
+
}
|
|
1147
|
+
boolean(e, t) {
|
|
1148
|
+
return this.add("boolean", e, t);
|
|
1149
|
+
}
|
|
1150
|
+
select(e, t) {
|
|
1151
|
+
return this.add("select", e, t);
|
|
1152
|
+
}
|
|
1153
|
+
multiselect(e, t) {
|
|
1154
|
+
return this.add("multiselect", e, t);
|
|
1155
|
+
}
|
|
1156
|
+
custom(e) {
|
|
1157
|
+
return this.cols.push(e), this;
|
|
1158
|
+
}
|
|
1159
|
+
build() {
|
|
1160
|
+
return this.cols;
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
function it() {
|
|
1164
|
+
return new rt();
|
|
1165
|
+
}
|
|
1069
1166
|
//#endregion
|
|
1070
1167
|
//#region src/core/exportCsv.ts
|
|
1071
|
-
function
|
|
1168
|
+
function at(e) {
|
|
1072
1169
|
let t = e == null ? "" : String(e);
|
|
1073
1170
|
return t.includes(",") || t.includes("\"") || t.includes("\n") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1074
1171
|
}
|
|
1075
|
-
function
|
|
1076
|
-
let { filename: n = "export.csv", separator: r = ",", formatted: i = !1, formatDefaults: a } = t ?? {}, o = e.getVisibleLeafColumns().filter((e) => e.id !== "_select"), s = [o.map((e) =>
|
|
1172
|
+
function ot(e, t) {
|
|
1173
|
+
let { filename: n = "export.csv", separator: r = ",", formatted: i = !1, formatDefaults: a } = t ?? {}, o = e.getVisibleLeafColumns().filter((e) => e.id !== "_select"), s = [o.map((e) => at(J(e))), ...e.getRowModel().rows.map((e) => o.map((t) => {
|
|
1077
1174
|
let n = e.getAllCells().find((e) => e.column.id === t.id)?.getValue();
|
|
1078
|
-
return i && t.columnDef.meta?.dataType ?
|
|
1175
|
+
return i && t.columnDef.meta?.dataType ? at(Ne(t.columnDef.meta.dataType, t.columnDef.meta.format, a)(n)) : at(n);
|
|
1079
1176
|
}))].map((e) => e.join(r)).join("\n"), c = new Blob([s], { type: "text/csv;charset=utf-8;" }), l = URL.createObjectURL(c), u = document.createElement("a");
|
|
1080
1177
|
u.href = l, u.download = n, u.click(), URL.revokeObjectURL(l);
|
|
1081
1178
|
}
|
|
1082
1179
|
//#endregion
|
|
1083
1180
|
//#region src/url/useUrlSync.ts
|
|
1084
|
-
function
|
|
1181
|
+
function st(e) {
|
|
1085
1182
|
return e ? {
|
|
1086
1183
|
adapter: e.adapter,
|
|
1087
1184
|
serializer: {
|
|
@@ -1091,7 +1188,7 @@ function nt(e) {
|
|
|
1091
1188
|
include: r(e.include)
|
|
1092
1189
|
} : null;
|
|
1093
1190
|
}
|
|
1094
|
-
function
|
|
1191
|
+
function ct(e, t, r) {
|
|
1095
1192
|
if (!e) return {};
|
|
1096
1193
|
try {
|
|
1097
1194
|
return n(e.adapter.read(), {
|
|
@@ -1104,21 +1201,21 @@ function rt(e, t, r) {
|
|
|
1104
1201
|
return {};
|
|
1105
1202
|
}
|
|
1106
1203
|
}
|
|
1107
|
-
function
|
|
1108
|
-
let s =
|
|
1204
|
+
function lt({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
1205
|
+
let s = U(i);
|
|
1109
1206
|
s.current = i;
|
|
1110
|
-
let c =
|
|
1207
|
+
let c = U(a);
|
|
1111
1208
|
c.current = a;
|
|
1112
|
-
let l =
|
|
1209
|
+
let l = U(o);
|
|
1113
1210
|
l.current = o;
|
|
1114
|
-
let u =
|
|
1211
|
+
let u = U(r);
|
|
1115
1212
|
u.current = r;
|
|
1116
1213
|
let d = r ? t(i, {
|
|
1117
1214
|
serializer: r.serializer,
|
|
1118
1215
|
include: r.include,
|
|
1119
1216
|
getFilterMeta: o
|
|
1120
1217
|
}) : null;
|
|
1121
|
-
|
|
1218
|
+
V(() => {
|
|
1122
1219
|
let t = u.current;
|
|
1123
1220
|
if (!t || !d) return;
|
|
1124
1221
|
let n = e(t.adapter.read(), t.serializer, t.include);
|
|
@@ -1126,7 +1223,7 @@ function it({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1126
1223
|
...n,
|
|
1127
1224
|
...d
|
|
1128
1225
|
}, { replace: !0 });
|
|
1129
|
-
}, [d ? JSON.stringify(d) : ""]),
|
|
1226
|
+
}, [d ? JSON.stringify(d) : ""]), V(() => {
|
|
1130
1227
|
if (!r) return;
|
|
1131
1228
|
let { adapter: e, serializer: t, include: i } = r;
|
|
1132
1229
|
return e.subscribe?.(() => {
|
|
@@ -1142,24 +1239,24 @@ function it({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1142
1239
|
}
|
|
1143
1240
|
//#endregion
|
|
1144
1241
|
//#region src/core/resolveStatus.ts
|
|
1145
|
-
function
|
|
1242
|
+
function ut(e) {
|
|
1146
1243
|
return e.columnFilters.length > 0 || e.globalFilter.trim() !== "";
|
|
1147
1244
|
}
|
|
1148
|
-
function
|
|
1245
|
+
function dt({ status: e, error: t, pageRowCount: n, state: r }) {
|
|
1149
1246
|
return e === "error" ? {
|
|
1150
1247
|
phase: "error",
|
|
1151
1248
|
error: t
|
|
1152
|
-
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ?
|
|
1249
|
+
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ? ut(r) ? { phase: "empty-filtered" } : { phase: "empty" } : { phase: "ready" };
|
|
1153
1250
|
}
|
|
1154
1251
|
//#endregion
|
|
1155
1252
|
//#region src/core/useDataView.ts
|
|
1156
|
-
var $ = 300,
|
|
1253
|
+
var $ = 300, ft = [
|
|
1157
1254
|
10,
|
|
1158
1255
|
25,
|
|
1159
1256
|
50,
|
|
1160
1257
|
100
|
|
1161
|
-
],
|
|
1162
|
-
function
|
|
1258
|
+
], pt = 10;
|
|
1259
|
+
function mt(e) {
|
|
1163
1260
|
return e == null ? {
|
|
1164
1261
|
globalFilter: $,
|
|
1165
1262
|
columnFilters: $
|
|
@@ -1171,23 +1268,23 @@ function lt(e) {
|
|
|
1171
1268
|
columnFilters: e.columnFilters ?? $
|
|
1172
1269
|
};
|
|
1173
1270
|
}
|
|
1174
|
-
function
|
|
1271
|
+
function ht(e) {
|
|
1175
1272
|
if (e.id) return e.id;
|
|
1176
1273
|
if ("accessorKey" in e && e.accessorKey != null) return String(e.accessorKey);
|
|
1177
1274
|
}
|
|
1178
|
-
function
|
|
1275
|
+
function gt(e) {
|
|
1179
1276
|
let t = /* @__PURE__ */ new Map();
|
|
1180
1277
|
for (let n of e) {
|
|
1181
|
-
let e =
|
|
1278
|
+
let e = ht(n), r = n.meta?.filter;
|
|
1182
1279
|
e && r && t.set(e, r);
|
|
1183
1280
|
}
|
|
1184
1281
|
return (e) => t.get(e);
|
|
1185
1282
|
}
|
|
1186
|
-
function
|
|
1283
|
+
function _t(e) {
|
|
1187
1284
|
return {
|
|
1188
1285
|
pagination: {
|
|
1189
1286
|
pageIndex: 0,
|
|
1190
|
-
pageSize: e.pageSizeOptions?.[0] ??
|
|
1287
|
+
pageSize: e.pageSizeOptions?.[0] ?? pt
|
|
1191
1288
|
},
|
|
1192
1289
|
sorting: [],
|
|
1193
1290
|
columnFilters: [],
|
|
@@ -1202,28 +1299,28 @@ function ft(e) {
|
|
|
1202
1299
|
...e.initialState
|
|
1203
1300
|
};
|
|
1204
1301
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let { columns: t, rows: n, rowCount: r, status: i, error: a, getRowId: o, onRequestChange:
|
|
1302
|
+
function vt(e) {
|
|
1303
|
+
let { columns: t, rows: n, rowCount: r, status: i, error: a, getRowId: o, onRequestChange: s, state: d, onStateChange: f, enableRowSelection: p, enableGlobalFilter: m = !0, debounce: h, responsive: g, formatDefaults: _, facets: v } = e, ee = v ?? {}, y = H(() => t.map((e) => {
|
|
1207
1304
|
let t = e.meta?.dataType;
|
|
1208
1305
|
if (!t || e.cell) return e;
|
|
1209
|
-
let n =
|
|
1306
|
+
let n = Ne(t, e.meta?.format, _);
|
|
1210
1307
|
return {
|
|
1211
1308
|
...e,
|
|
1212
1309
|
cell: (e) => n(e.getValue())
|
|
1213
1310
|
};
|
|
1214
|
-
}), [t, _]),
|
|
1215
|
-
let t =
|
|
1311
|
+
}), [t, _]), b = H(() => gt(y), [y]), x = H(() => st(e.urlSync), [e.urlSync]), [S, te] = W(() => {
|
|
1312
|
+
let t = _t(e);
|
|
1216
1313
|
return {
|
|
1217
1314
|
...t,
|
|
1218
|
-
...
|
|
1315
|
+
...ct(x, t, b)
|
|
1219
1316
|
};
|
|
1220
|
-
}), C =
|
|
1221
|
-
...
|
|
1317
|
+
}), C = H(() => ({
|
|
1318
|
+
...S,
|
|
1222
1319
|
...d
|
|
1223
|
-
}), [
|
|
1320
|
+
}), [S, d]), w = U(C);
|
|
1224
1321
|
w.current = C;
|
|
1225
1322
|
let T = z((e) => {
|
|
1226
|
-
|
|
1323
|
+
te((t) => ({
|
|
1227
1324
|
...t,
|
|
1228
1325
|
...e
|
|
1229
1326
|
})), f?.({
|
|
@@ -1231,42 +1328,42 @@ function pt(e) {
|
|
|
1231
1328
|
...e
|
|
1232
1329
|
});
|
|
1233
1330
|
}, [f]);
|
|
1234
|
-
|
|
1235
|
-
config:
|
|
1331
|
+
lt({
|
|
1332
|
+
config: x,
|
|
1236
1333
|
state: C,
|
|
1237
1334
|
applyPatch: T,
|
|
1238
|
-
getFilterMeta:
|
|
1335
|
+
getFilterMeta: b
|
|
1239
1336
|
});
|
|
1240
1337
|
let E = z(() => ({
|
|
1241
1338
|
...w.current.pagination,
|
|
1242
1339
|
pageIndex: 0
|
|
1243
|
-
}), []),
|
|
1244
|
-
T({ pagination:
|
|
1245
|
-
}, [T]),
|
|
1340
|
+
}), []), ne = z((e) => {
|
|
1341
|
+
T({ pagination: c(e, w.current.pagination) });
|
|
1342
|
+
}, [T]), D = z((e) => {
|
|
1246
1343
|
T({
|
|
1247
|
-
sorting:
|
|
1344
|
+
sorting: c(e, w.current.sorting),
|
|
1248
1345
|
pagination: E()
|
|
1249
1346
|
});
|
|
1250
|
-
}, [T, E]),
|
|
1347
|
+
}, [T, E]), O = z((e) => {
|
|
1251
1348
|
T({
|
|
1252
|
-
columnFilters:
|
|
1349
|
+
columnFilters: c(e, w.current.columnFilters),
|
|
1253
1350
|
pagination: E()
|
|
1254
1351
|
});
|
|
1255
|
-
}, [T, E]),
|
|
1352
|
+
}, [T, E]), re = z((e) => {
|
|
1256
1353
|
T({
|
|
1257
|
-
globalFilter:
|
|
1354
|
+
globalFilter: c(e, w.current.globalFilter),
|
|
1258
1355
|
pagination: E()
|
|
1259
1356
|
});
|
|
1260
|
-
}, [T, E]),
|
|
1261
|
-
T({ rowSelection:
|
|
1357
|
+
}, [T, E]), k = z((e) => {
|
|
1358
|
+
T({ rowSelection: c(e, w.current.rowSelection) });
|
|
1359
|
+
}, [T]), A = z((e) => {
|
|
1360
|
+
T({ columnVisibility: c(e, w.current.columnVisibility) });
|
|
1262
1361
|
}, [T]), j = z((e) => {
|
|
1263
|
-
T({
|
|
1264
|
-
}, [T]), M =
|
|
1265
|
-
T({ columnPinning: s(e, w.current.columnPinning) });
|
|
1266
|
-
}, [T]), N = l({
|
|
1362
|
+
T({ columnPinning: c(e, w.current.columnPinning) });
|
|
1363
|
+
}, [T]), M = u({
|
|
1267
1364
|
data: n,
|
|
1268
|
-
columns:
|
|
1269
|
-
getCoreRowModel:
|
|
1365
|
+
columns: y,
|
|
1366
|
+
getCoreRowModel: l(),
|
|
1270
1367
|
manualPagination: !0,
|
|
1271
1368
|
manualSorting: !0,
|
|
1272
1369
|
manualFiltering: !0,
|
|
@@ -1284,14 +1381,14 @@ function pt(e) {
|
|
|
1284
1381
|
columnVisibility: C.columnVisibility,
|
|
1285
1382
|
columnPinning: C.columnPinning
|
|
1286
1383
|
},
|
|
1287
|
-
onPaginationChange:
|
|
1288
|
-
onSortingChange:
|
|
1289
|
-
onColumnFiltersChange:
|
|
1290
|
-
onGlobalFilterChange:
|
|
1291
|
-
onRowSelectionChange:
|
|
1292
|
-
onColumnVisibilityChange:
|
|
1293
|
-
onColumnPinningChange:
|
|
1294
|
-
}),
|
|
1384
|
+
onPaginationChange: ne,
|
|
1385
|
+
onSortingChange: D,
|
|
1386
|
+
onColumnFiltersChange: O,
|
|
1387
|
+
onGlobalFilterChange: re,
|
|
1388
|
+
onRowSelectionChange: k,
|
|
1389
|
+
onColumnVisibilityChange: A,
|
|
1390
|
+
onColumnPinningChange: j
|
|
1391
|
+
}), N = H(() => ({
|
|
1295
1392
|
pagination: C.pagination,
|
|
1296
1393
|
sorting: C.sorting,
|
|
1297
1394
|
filters: C.columnFilters,
|
|
@@ -1301,24 +1398,24 @@ function pt(e) {
|
|
|
1301
1398
|
C.sorting,
|
|
1302
1399
|
C.columnFilters,
|
|
1303
1400
|
C.globalFilter
|
|
1304
|
-
]),
|
|
1305
|
-
|
|
1306
|
-
let
|
|
1307
|
-
|
|
1308
|
-
let
|
|
1309
|
-
|
|
1310
|
-
let e =
|
|
1311
|
-
|
|
1401
|
+
]), P = U(s);
|
|
1402
|
+
P.current = s;
|
|
1403
|
+
let F = U(mt(h));
|
|
1404
|
+
F.current = mt(h);
|
|
1405
|
+
let I = U(null), L = U(void 0);
|
|
1406
|
+
V(() => {
|
|
1407
|
+
let e = I.current, t = e === null, n = !e || e.globalFilter !== N.globalFilter, r = !e || e.filters !== N.filters, i = () => {
|
|
1408
|
+
I.current = N, P.current?.(N);
|
|
1312
1409
|
}, a = 0;
|
|
1313
|
-
n && (a = Math.max(a,
|
|
1410
|
+
n && (a = Math.max(a, F.current.globalFilter)), r && (a = Math.max(a, F.current.columnFilters));
|
|
1314
1411
|
let o = !t && (n || r) && a > 0;
|
|
1315
|
-
return clearTimeout(
|
|
1316
|
-
}, [
|
|
1317
|
-
let
|
|
1318
|
-
|
|
1412
|
+
return clearTimeout(L.current), o ? L.current = setTimeout(i, a) : i(), () => clearTimeout(L.current);
|
|
1413
|
+
}, [N]);
|
|
1414
|
+
let R = U(N);
|
|
1415
|
+
R.current = N;
|
|
1319
1416
|
let ie = z(() => {
|
|
1320
|
-
|
|
1321
|
-
}, []), ae =
|
|
1417
|
+
P.current?.(R.current);
|
|
1418
|
+
}, []), ae = H(() => dt({
|
|
1322
1419
|
status: i,
|
|
1323
1420
|
error: a,
|
|
1324
1421
|
pageRowCount: n.length,
|
|
@@ -1328,68 +1425,73 @@ function pt(e) {
|
|
|
1328
1425
|
a,
|
|
1329
1426
|
n.length,
|
|
1330
1427
|
C
|
|
1331
|
-
]),
|
|
1428
|
+
]), B = Ae(g), oe = B ? "cards" : C.view, G = z((e) => T({ view: e }), [T]), K = e.pageSizeOptions ?? ft, q = M.getAllColumns(), J = q.filter((e) => e.getCanSort()), se = q.filter((e) => e.columnDef.meta?.filter != null), Y = z(() => T({ rowSelection: {} }), [T]);
|
|
1332
1429
|
return {
|
|
1333
|
-
table:
|
|
1334
|
-
request:
|
|
1430
|
+
table: M,
|
|
1431
|
+
request: N,
|
|
1335
1432
|
state: C,
|
|
1336
|
-
view:
|
|
1337
|
-
setView:
|
|
1338
|
-
isMobileForced:
|
|
1433
|
+
view: oe,
|
|
1434
|
+
setView: G,
|
|
1435
|
+
isMobileForced: B,
|
|
1339
1436
|
status: i,
|
|
1340
1437
|
error: a,
|
|
1341
1438
|
renderStatus: ae,
|
|
1342
1439
|
refetch: ie,
|
|
1343
|
-
pageSizeOptions:
|
|
1344
|
-
sortableColumns:
|
|
1345
|
-
filterableColumns:
|
|
1346
|
-
selection:
|
|
1440
|
+
pageSizeOptions: K,
|
|
1441
|
+
sortableColumns: J,
|
|
1442
|
+
filterableColumns: se,
|
|
1443
|
+
selection: H(() => {
|
|
1347
1444
|
let e = C.rowSelection, t = Object.keys(e).filter((t) => e[t]), r = n.filter((t) => e[o(t)] === !0);
|
|
1348
1445
|
return {
|
|
1349
1446
|
count: t.length,
|
|
1350
1447
|
ids: t,
|
|
1351
1448
|
rows: r,
|
|
1352
|
-
clear:
|
|
1449
|
+
clear: Y
|
|
1353
1450
|
};
|
|
1354
1451
|
}, [
|
|
1355
1452
|
C.rowSelection,
|
|
1356
1453
|
n,
|
|
1357
1454
|
o,
|
|
1358
|
-
|
|
1455
|
+
Y
|
|
1359
1456
|
]),
|
|
1360
|
-
exportCsv: z((e) =>
|
|
1361
|
-
facets:
|
|
1457
|
+
exportCsv: z((e) => ot(M, e), [M]),
|
|
1458
|
+
facets: ee,
|
|
1459
|
+
resetFilter: z((e) => M.getColumn(e)?.setFilterValue(void 0), [M]),
|
|
1460
|
+
resetAllFilters: z(() => M.resetColumnFilters(), [M])
|
|
1362
1461
|
};
|
|
1363
1462
|
}
|
|
1364
1463
|
//#endregion
|
|
1365
1464
|
//#region src/core/useDataViewFetcher.ts
|
|
1366
|
-
function
|
|
1367
|
-
let [
|
|
1465
|
+
function yt({ fetcher: e, deps: t, ...n }) {
|
|
1466
|
+
let [r, i] = W({
|
|
1368
1467
|
rows: [],
|
|
1369
1468
|
rowCount: 0
|
|
1370
|
-
}), [
|
|
1371
|
-
|
|
1372
|
-
let
|
|
1373
|
-
|
|
1374
|
-
|
|
1469
|
+
}), [a, o] = W("idle"), [s, c] = W(void 0), l = U(e);
|
|
1470
|
+
l.current = e;
|
|
1471
|
+
let u = U(0), d = U(null), f = z(async (e) => {
|
|
1472
|
+
d.current = e;
|
|
1473
|
+
let t = ++u.current;
|
|
1474
|
+
o("loading");
|
|
1375
1475
|
try {
|
|
1376
|
-
let n = await
|
|
1377
|
-
t ===
|
|
1476
|
+
let n = await l.current(e);
|
|
1477
|
+
t === u.current && (i(n), c(void 0), o("success"));
|
|
1378
1478
|
} catch (e) {
|
|
1379
|
-
t ===
|
|
1479
|
+
t === u.current && (c(e), o("error"));
|
|
1380
1480
|
}
|
|
1381
|
-
}, []);
|
|
1382
|
-
return
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1481
|
+
}, []), p = t ? JSON.stringify(t) : "", m = U(p);
|
|
1482
|
+
return V(() => {
|
|
1483
|
+
m.current !== p && (m.current = p, d.current && f(d.current));
|
|
1484
|
+
}), vt({
|
|
1485
|
+
...n,
|
|
1486
|
+
rows: r.rows,
|
|
1487
|
+
rowCount: r.rowCount,
|
|
1488
|
+
facets: r.facets,
|
|
1489
|
+
status: a,
|
|
1490
|
+
error: s,
|
|
1491
|
+
onRequestChange: f
|
|
1390
1492
|
});
|
|
1391
1493
|
}
|
|
1392
1494
|
//#endregion
|
|
1393
|
-
export { q as DataBulkActions,
|
|
1495
|
+
export { rt as ColumnBuilder, q as DataBulkActions, fe as DataCards, he as DataPagination, we as DataTable, Je as DataToolbar, Q as DataView, ze as FilterControl, it as col, Y as composeCardLayout, a as createColumnHelper, ot as exportCsv, J as resolveColumnLabel, vt as useDataView, Z as useDataViewContext, yt as useDataViewFetcher };
|
|
1394
1496
|
|
|
1395
1497
|
//# sourceMappingURL=index.js.map
|