@ethanhann/mantine-dataview 0.5.0 → 0.6.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 +18 -0
- package/dist/core/getViewMode.d.ts +4 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +364 -358
- package/dist/index.js.map +1 -1
- package/dist/types/column.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
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 y, Drawer as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { useDisclosure as
|
|
7
|
-
import { DatePickerInput as
|
|
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 y, Drawer as ee, Group as b, Input as x, Menu as S, MultiSelect as te, NumberInput as C, Pagination as ne, Paper as re, Popover as w, RangeSlider as T, SegmentedControl as E, Select as D, SimpleGrid as O, Skeleton as k, Stack as A, Table as j, Text as M, TextInput as ie, UnstyledButton as ae, useMantineTheme as oe } from "@mantine/core";
|
|
4
|
+
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as I, createContext as L, useCallback as R, useContext as z, useEffect as B, useMemo as V, useRef as H, useState as U } from "react";
|
|
6
|
+
import { useDisclosure as se, useMediaQuery as W } from "@mantine/hooks";
|
|
7
|
+
import { DatePickerInput as G } from "@mantine/dates";
|
|
8
8
|
import "@mantine/dates/styles.css";
|
|
9
9
|
//#region src/components/DataBulkActions/DataBulkActions.tsx
|
|
10
|
-
function
|
|
10
|
+
function ce({ view: e, slots: t, ...n }) {
|
|
11
11
|
let { selection: r } = e;
|
|
12
|
-
return r.count === 0 ? null : /* @__PURE__ */
|
|
12
|
+
return r.count === 0 ? null : /* @__PURE__ */ P(re, {
|
|
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__ */
|
|
19
|
+
children: /* @__PURE__ */ F(b, {
|
|
20
20
|
justify: "space-between",
|
|
21
21
|
wrap: "wrap",
|
|
22
22
|
gap: "sm",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ F(b, {
|
|
24
24
|
gap: "sm",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
25
|
+
children: [/* @__PURE__ */ F(M, {
|
|
26
26
|
size: "sm",
|
|
27
27
|
fw: 500,
|
|
28
28
|
children: [r.count, " selected"]
|
|
29
|
-
}), /* @__PURE__ */
|
|
29
|
+
}), /* @__PURE__ */ P(h, {
|
|
30
30
|
variant: "subtle",
|
|
31
31
|
size: "xs",
|
|
32
32
|
onClick: r.clear,
|
|
33
33
|
children: "Clear"
|
|
34
34
|
})]
|
|
35
|
-
}), t?.BulkActions && /* @__PURE__ */
|
|
35
|
+
}), t?.BulkActions && /* @__PURE__ */ P(b, {
|
|
36
36
|
gap: "xs",
|
|
37
37
|
children: t.BulkActions(r)
|
|
38
38
|
})]
|
|
@@ -81,8 +81,8 @@ function ue(e, t = {}) {
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/core/useRowTransition.ts
|
|
83
83
|
function q(e, t) {
|
|
84
|
-
let n =
|
|
85
|
-
|
|
84
|
+
let n = H([]), r = H(!1), i = H(0), a = H(!1);
|
|
85
|
+
B(() => {
|
|
86
86
|
t && !a.current && typeof document < "u" && process.env.NODE_ENV !== "production" && (Array.from(document.styleSheets).some((e) => {
|
|
87
87
|
try {
|
|
88
88
|
return Array.from(e.cssRules).some((e) => e instanceof CSSKeyframesRule && e.name === "dataview-row-enter");
|
|
@@ -97,7 +97,7 @@ function q(e, t) {
|
|
|
97
97
|
if (o.length !== e.length || o.some((t, n) => t !== e[n])) if (c = i.current + 1, o.length === e.length && o.every((e) => t.has(e))) for (let e of o) s.add(e);
|
|
98
98
|
else for (let e of o) t.has(e) || s.add(e);
|
|
99
99
|
}
|
|
100
|
-
return
|
|
100
|
+
return B(() => {
|
|
101
101
|
n.current = o, r.current = !0, i.current = c;
|
|
102
102
|
}), {
|
|
103
103
|
rows: e,
|
|
@@ -111,16 +111,16 @@ function de(e) {
|
|
|
111
111
|
e.resetColumnFilters(), e.setGlobalFilter("");
|
|
112
112
|
}
|
|
113
113
|
function fe({ view: e, slots: t }) {
|
|
114
|
-
return t?.ErrorState ? /* @__PURE__ */
|
|
114
|
+
return t?.ErrorState ? /* @__PURE__ */ P(N, { children: t.ErrorState({
|
|
115
115
|
error: e.error,
|
|
116
116
|
retry: e.refetch
|
|
117
|
-
}) }) : /* @__PURE__ */
|
|
117
|
+
}) }) : /* @__PURE__ */ F(A, {
|
|
118
118
|
align: "center",
|
|
119
119
|
gap: "xs",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ P(M, {
|
|
121
121
|
c: "red",
|
|
122
122
|
children: "Something went wrong."
|
|
123
|
-
}), /* @__PURE__ */
|
|
123
|
+
}), /* @__PURE__ */ P(h, {
|
|
124
124
|
variant: "light",
|
|
125
125
|
size: "xs",
|
|
126
126
|
onClick: e.refetch,
|
|
@@ -130,22 +130,22 @@ function fe({ view: e, slots: t }) {
|
|
|
130
130
|
}
|
|
131
131
|
function J({ view: e, slots: t }) {
|
|
132
132
|
let n = e.renderStatus.phase === "empty-filtered", r = () => de(e.table);
|
|
133
|
-
return t?.Empty ? /* @__PURE__ */
|
|
133
|
+
return t?.Empty ? /* @__PURE__ */ P(N, { children: t.Empty({
|
|
134
134
|
filtered: n,
|
|
135
135
|
clearFilters: r
|
|
136
|
-
}) }) : n ? /* @__PURE__ */
|
|
136
|
+
}) }) : n ? /* @__PURE__ */ F(A, {
|
|
137
137
|
align: "center",
|
|
138
138
|
gap: "xs",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ P(M, {
|
|
140
140
|
c: "dimmed",
|
|
141
141
|
children: "No matches."
|
|
142
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ P(h, {
|
|
143
143
|
variant: "subtle",
|
|
144
144
|
size: "xs",
|
|
145
145
|
onClick: r,
|
|
146
146
|
children: "Clear filters"
|
|
147
147
|
})]
|
|
148
|
-
}) : /* @__PURE__ */
|
|
148
|
+
}) : /* @__PURE__ */ P(M, {
|
|
149
149
|
c: "dimmed",
|
|
150
150
|
children: "No results."
|
|
151
151
|
});
|
|
@@ -163,7 +163,7 @@ function me({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection
|
|
|
163
163
|
...c
|
|
164
164
|
}, m = q(l.getRowModel().rows, o), h = (e) => {
|
|
165
165
|
let i = ue(l, { fallbackRole: r });
|
|
166
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ P(O, {
|
|
167
167
|
"data-changed": o || void 0,
|
|
168
168
|
...p,
|
|
169
169
|
children: e.map((e) => {
|
|
@@ -173,22 +173,22 @@ function me({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection
|
|
|
173
173
|
selected: r,
|
|
174
174
|
toggleSelected: () => e.toggleSelected()
|
|
175
175
|
}, o = m.entering.has(e.id) || void 0;
|
|
176
|
-
if (n) return /* @__PURE__ */
|
|
176
|
+
if (n) return /* @__PURE__ */ P("div", {
|
|
177
177
|
"data-entering": o,
|
|
178
178
|
children: n(a)
|
|
179
179
|
}, e.id);
|
|
180
|
-
let s = /* @__PURE__ */
|
|
180
|
+
let s = /* @__PURE__ */ P(he, {
|
|
181
181
|
row: e,
|
|
182
182
|
layout: i,
|
|
183
183
|
selectionEnabled: d
|
|
184
184
|
});
|
|
185
|
-
return t?.Card ? /* @__PURE__ */
|
|
185
|
+
return t?.Card ? /* @__PURE__ */ P("div", {
|
|
186
186
|
"data-entering": o,
|
|
187
187
|
children: t.Card({
|
|
188
188
|
...a,
|
|
189
189
|
children: s
|
|
190
190
|
})
|
|
191
|
-
}, e.id) : /* @__PURE__ */
|
|
191
|
+
}, e.id) : /* @__PURE__ */ P(g, {
|
|
192
192
|
withBorder: !0,
|
|
193
193
|
padding: "lg",
|
|
194
194
|
pos: "relative",
|
|
@@ -201,38 +201,38 @@ function me({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection
|
|
|
201
201
|
};
|
|
202
202
|
if (o && u.phase === "loading" && m.rows.length > 0) return h(m.rows);
|
|
203
203
|
switch (u.phase) {
|
|
204
|
-
case "loading": return t?.LoadingCards ? t.LoadingCards() : /* @__PURE__ */
|
|
204
|
+
case "loading": return t?.LoadingCards ? t.LoadingCards() : /* @__PURE__ */ P(O, {
|
|
205
205
|
...p,
|
|
206
|
-
children: Array.from({ length: f }, (e, t) => /* @__PURE__ */
|
|
206
|
+
children: Array.from({ length: f }, (e, t) => /* @__PURE__ */ P(g, {
|
|
207
207
|
withBorder: !0,
|
|
208
208
|
padding: "md",
|
|
209
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ F(A, {
|
|
210
210
|
gap: "xs",
|
|
211
211
|
children: [
|
|
212
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ P(k, {
|
|
213
213
|
height: 20,
|
|
214
214
|
width: "60%"
|
|
215
215
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ P(k, {
|
|
217
217
|
height: 12,
|
|
218
218
|
width: "40%"
|
|
219
219
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ P(k, { height: 12 })
|
|
221
221
|
]
|
|
222
222
|
})
|
|
223
223
|
}, t))
|
|
224
224
|
});
|
|
225
|
-
case "error": return /* @__PURE__ */
|
|
225
|
+
case "error": return /* @__PURE__ */ P(_, {
|
|
226
226
|
p: "xl",
|
|
227
|
-
children: /* @__PURE__ */
|
|
227
|
+
children: /* @__PURE__ */ P(fe, {
|
|
228
228
|
view: e,
|
|
229
229
|
slots: t
|
|
230
230
|
})
|
|
231
231
|
});
|
|
232
232
|
case "empty":
|
|
233
|
-
case "empty-filtered": return /* @__PURE__ */
|
|
233
|
+
case "empty-filtered": return /* @__PURE__ */ P(_, {
|
|
234
234
|
p: "xl",
|
|
235
|
-
children: /* @__PURE__ */
|
|
235
|
+
children: /* @__PURE__ */ P(J, {
|
|
236
236
|
view: e,
|
|
237
237
|
slots: t
|
|
238
238
|
})
|
|
@@ -245,8 +245,8 @@ function he({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
245
245
|
let t = r.get(e.id);
|
|
246
246
|
return t ? s(t.column.columnDef.cell, t.getContext()) : null;
|
|
247
247
|
};
|
|
248
|
-
return /* @__PURE__ */
|
|
249
|
-
n && /* @__PURE__ */
|
|
248
|
+
return /* @__PURE__ */ F(N, { children: [
|
|
249
|
+
n && /* @__PURE__ */ P(v, {
|
|
250
250
|
"aria-label": "Select card",
|
|
251
251
|
checked: e.getIsSelected(),
|
|
252
252
|
disabled: !e.getCanSelect(),
|
|
@@ -258,42 +258,42 @@ function he({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
258
258
|
zIndex: 1
|
|
259
259
|
}
|
|
260
260
|
}),
|
|
261
|
-
t.media.length > 0 && /* @__PURE__ */
|
|
261
|
+
t.media.length > 0 && /* @__PURE__ */ P(g.Section, {
|
|
262
262
|
mb: "xs",
|
|
263
|
-
children: t.media.map((e) => /* @__PURE__ */
|
|
263
|
+
children: t.media.map((e) => /* @__PURE__ */ P(m, { children: i(e) }, e.id))
|
|
264
264
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ F(A, {
|
|
266
266
|
gap: "md",
|
|
267
267
|
children: [
|
|
268
|
-
(t.title.length > 0 || t.subtitle.length > 0) && /* @__PURE__ */
|
|
268
|
+
(t.title.length > 0 || t.subtitle.length > 0) && /* @__PURE__ */ F(A, {
|
|
269
269
|
gap: 4,
|
|
270
|
-
children: [t.title.map((e) => /* @__PURE__ */
|
|
270
|
+
children: [t.title.map((e) => /* @__PURE__ */ P(M, {
|
|
271
271
|
fw: 600,
|
|
272
272
|
size: "lg",
|
|
273
273
|
lh: 1.2,
|
|
274
274
|
pr: n ? 28 : 0,
|
|
275
275
|
children: i(e)
|
|
276
|
-
}, e.id)), t.subtitle.map((e) => /* @__PURE__ */
|
|
276
|
+
}, e.id)), t.subtitle.map((e) => /* @__PURE__ */ P(M, {
|
|
277
277
|
size: "sm",
|
|
278
278
|
c: "dimmed",
|
|
279
279
|
children: i(e)
|
|
280
280
|
}, e.id))]
|
|
281
281
|
}),
|
|
282
|
-
t.badge.length > 0 && /* @__PURE__ */
|
|
282
|
+
t.badge.length > 0 && /* @__PURE__ */ P(b, {
|
|
283
283
|
gap: "xs",
|
|
284
|
-
children: t.badge.map((e) => /* @__PURE__ */ I
|
|
284
|
+
children: t.badge.map((e) => /* @__PURE__ */ P(I, { children: i(e) }, e.id))
|
|
285
285
|
}),
|
|
286
|
-
t.meta.length > 0 && /* @__PURE__ */
|
|
286
|
+
t.meta.length > 0 && /* @__PURE__ */ P(A, {
|
|
287
287
|
gap: 4,
|
|
288
|
-
children: t.meta.map((e) => /* @__PURE__ */
|
|
288
|
+
children: t.meta.map((e) => /* @__PURE__ */ F(b, {
|
|
289
289
|
justify: "space-between",
|
|
290
290
|
gap: "xs",
|
|
291
291
|
wrap: "nowrap",
|
|
292
|
-
children: [e.showLabel && /* @__PURE__ */
|
|
292
|
+
children: [e.showLabel && /* @__PURE__ */ P(M, {
|
|
293
293
|
size: "sm",
|
|
294
294
|
c: "dimmed",
|
|
295
295
|
children: e.label
|
|
296
|
-
}), /* @__PURE__ */
|
|
296
|
+
}), /* @__PURE__ */ P(M, {
|
|
297
297
|
size: "sm",
|
|
298
298
|
children: i(e)
|
|
299
299
|
})]
|
|
@@ -307,22 +307,22 @@ function he({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
307
307
|
//#region src/components/DataPagination/DataPagination.tsx
|
|
308
308
|
function ge({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r = !0, pageSizeLabel: i = "Rows per page", ...a }) {
|
|
309
309
|
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);
|
|
310
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ F(b, {
|
|
311
311
|
justify: "space-between",
|
|
312
312
|
wrap: "wrap",
|
|
313
313
|
gap: "sm",
|
|
314
314
|
...a,
|
|
315
|
-
children: [/* @__PURE__ */
|
|
315
|
+
children: [/* @__PURE__ */ F(b, {
|
|
316
316
|
gap: "sm",
|
|
317
317
|
wrap: "wrap",
|
|
318
|
-
children: [n && /* @__PURE__ */
|
|
318
|
+
children: [n && /* @__PURE__ */ P(D, {
|
|
319
319
|
"aria-label": i,
|
|
320
320
|
data: d.map(String),
|
|
321
321
|
value: String(c),
|
|
322
322
|
onChange: (e) => e && o.setPageSize(Number(e)),
|
|
323
323
|
w: 80,
|
|
324
324
|
comboboxProps: { withinPortal: !0 }
|
|
325
|
-
}), r && /* @__PURE__ */
|
|
325
|
+
}), r && /* @__PURE__ */ F(M, {
|
|
326
326
|
size: "sm",
|
|
327
327
|
c: "dimmed",
|
|
328
328
|
children: [
|
|
@@ -333,7 +333,7 @@ function ge({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r =
|
|
|
333
333
|
l
|
|
334
334
|
]
|
|
335
335
|
})]
|
|
336
|
-
}), /* @__PURE__ */
|
|
336
|
+
}), /* @__PURE__ */ P(ne, {
|
|
337
337
|
value: s + 1,
|
|
338
338
|
total: Math.max(u, 1),
|
|
339
339
|
onChange: (e) => o.setPageIndex(e - 1),
|
|
@@ -344,7 +344,7 @@ function ge({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r =
|
|
|
344
344
|
//#endregion
|
|
345
345
|
//#region src/components/icons.tsx
|
|
346
346
|
function _e({ direction: e }) {
|
|
347
|
-
return /* @__PURE__ */
|
|
347
|
+
return /* @__PURE__ */ F("svg", {
|
|
348
348
|
width: "14",
|
|
349
349
|
height: "14",
|
|
350
350
|
viewBox: "0 0 24 24",
|
|
@@ -353,8 +353,8 @@ function _e({ direction: e }) {
|
|
|
353
353
|
focusable: "false",
|
|
354
354
|
style: { flexShrink: 0 },
|
|
355
355
|
children: [
|
|
356
|
-
/* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ P("title", { children: "sort" }),
|
|
357
|
+
/* @__PURE__ */ P("path", {
|
|
358
358
|
d: "M8 10l4-4 4 4",
|
|
359
359
|
stroke: "currentColor",
|
|
360
360
|
strokeWidth: "2",
|
|
@@ -362,7 +362,7 @@ function _e({ direction: e }) {
|
|
|
362
362
|
strokeLinejoin: "round",
|
|
363
363
|
opacity: e === "asc" ? 1 : .35
|
|
364
364
|
}),
|
|
365
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ P("path", {
|
|
366
366
|
d: "M8 14l4 4 4-4",
|
|
367
367
|
stroke: "currentColor",
|
|
368
368
|
strokeWidth: "2",
|
|
@@ -374,7 +374,7 @@ function _e({ direction: e }) {
|
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
function Y({ d: e, title: t }) {
|
|
377
|
-
return /* @__PURE__ */
|
|
377
|
+
return /* @__PURE__ */ F("svg", {
|
|
378
378
|
width: "16",
|
|
379
379
|
height: "16",
|
|
380
380
|
viewBox: "0 0 24 24",
|
|
@@ -386,41 +386,41 @@ function Y({ d: e, title: t }) {
|
|
|
386
386
|
"aria-hidden": "true",
|
|
387
387
|
focusable: "false",
|
|
388
388
|
style: { flexShrink: 0 },
|
|
389
|
-
children: [/* @__PURE__ */
|
|
389
|
+
children: [/* @__PURE__ */ P("title", { children: t }), /* @__PURE__ */ P("path", { d: e })]
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
392
|
function ve() {
|
|
393
|
-
return /* @__PURE__ */
|
|
393
|
+
return /* @__PURE__ */ P(Y, {
|
|
394
394
|
title: "search",
|
|
395
395
|
d: "M21 21l-4.3-4.3M11 19a8 8 0 110-16 8 8 0 010 16z"
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
function ye() {
|
|
399
|
-
return /* @__PURE__ */
|
|
399
|
+
return /* @__PURE__ */ P(Y, {
|
|
400
400
|
title: "filter",
|
|
401
401
|
d: "M3 5h18M7 12h10M10 19h4"
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
function be() {
|
|
405
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ P(Y, {
|
|
406
406
|
title: "open",
|
|
407
407
|
d: "M6 9l6 6 6-6"
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
function xe() {
|
|
411
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ P(Y, {
|
|
412
412
|
title: "close",
|
|
413
413
|
d: "M18 6L6 18M6 6l12 12"
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
function Se() {
|
|
417
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ P(Y, {
|
|
418
418
|
title: "pin left",
|
|
419
419
|
d: "M4 4v16M9 8h8M9 12h6M9 16h8"
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
422
|
function Ce() {
|
|
423
|
-
return /* @__PURE__ */
|
|
423
|
+
return /* @__PURE__ */ P(Y, {
|
|
424
424
|
title: "pin right",
|
|
425
425
|
d: "M20 4v16M7 8h8M9 12h6M7 16h8"
|
|
426
426
|
});
|
|
@@ -437,10 +437,10 @@ function we(e) {
|
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
439
|
function Te({ view: e, slots: t, enableSelection: n, loadingRowCount: r, disableWhileLoading: i = !0, animateRows: a = !1, ...o }) {
|
|
440
|
-
let { table: c, renderStatus: l } = e, u = i && e.status === "loading", d = q(c.getRowModel().rows, a), f = c.getVisibleLeafColumns(), p = n ?? c.options.enableRowSelection !== !1, m = f.length + +!!p, h = r ?? Math.min(e.state.pagination.pageSize, 8), g = (e) => /* @__PURE__ */
|
|
440
|
+
let { table: c, renderStatus: l } = e, u = i && e.status === "loading", d = q(c.getRowModel().rows, a), f = c.getVisibleLeafColumns(), p = n ?? c.options.enableRowSelection !== !1, m = f.length + +!!p, h = r ?? Math.min(e.state.pagination.pageSize, 8), g = (e) => /* @__PURE__ */ P(j.Tbody, {
|
|
441
441
|
"data-changed": a || void 0,
|
|
442
442
|
children: e.map((e) => {
|
|
443
|
-
let n = d.entering.has(e.id) || void 0, r = /* @__PURE__ */
|
|
443
|
+
let n = d.entering.has(e.id) || void 0, r = /* @__PURE__ */ F(N, { children: [p && /* @__PURE__ */ P(j.Td, { children: /* @__PURE__ */ P(v, {
|
|
444
444
|
"aria-label": "Select row",
|
|
445
445
|
checked: e.getIsSelected(),
|
|
446
446
|
disabled: !e.getCanSelect(),
|
|
@@ -448,7 +448,7 @@ function Te({ view: e, slots: t, enableSelection: n, loadingRowCount: r, disable
|
|
|
448
448
|
onChange: e.getToggleSelectedHandler()
|
|
449
449
|
}) }), e.getVisibleCells().map((e) => {
|
|
450
450
|
let t = e.column.columnDef.meta?.align;
|
|
451
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ P(j.Td, {
|
|
452
452
|
style: {
|
|
453
453
|
...we(e.column),
|
|
454
454
|
...t ? { textAlign: t } : void 0
|
|
@@ -456,10 +456,10 @@ function Te({ view: e, slots: t, enableSelection: n, loadingRowCount: r, disable
|
|
|
456
456
|
children: s(e.column.columnDef.cell, e.getContext())
|
|
457
457
|
}, e.id);
|
|
458
458
|
})] });
|
|
459
|
-
return t?.Row ? /* @__PURE__ */
|
|
459
|
+
return t?.Row ? /* @__PURE__ */ P(Ee, { children: t.Row({
|
|
460
460
|
row: e,
|
|
461
461
|
cells: r
|
|
462
|
-
}) }, e.id) : /* @__PURE__ */
|
|
462
|
+
}) }, e.id) : /* @__PURE__ */ P(j.Tr, {
|
|
463
463
|
"data-selected": e.getIsSelected() || void 0,
|
|
464
464
|
"data-entering": n,
|
|
465
465
|
children: r
|
|
@@ -468,21 +468,21 @@ function Te({ view: e, slots: t, enableSelection: n, loadingRowCount: r, disable
|
|
|
468
468
|
}, d.generation), _ = () => {
|
|
469
469
|
if (a && l.phase === "loading" && d.rows.length > 0) return g(d.rows);
|
|
470
470
|
switch (l.phase) {
|
|
471
|
-
case "loading": return t?.LoadingTable ? t.LoadingTable() : /* @__PURE__ */
|
|
471
|
+
case "loading": return t?.LoadingTable ? t.LoadingTable() : /* @__PURE__ */ P(j.Tbody, { children: Array.from({ length: h }, (e, t) => /* @__PURE__ */ F(j.Tr, { children: [p && /* @__PURE__ */ P(j.Td, { children: /* @__PURE__ */ P(k, {
|
|
472
472
|
height: 16,
|
|
473
473
|
width: 16
|
|
474
|
-
}) }), f.map((e) => /* @__PURE__ */
|
|
475
|
-
case "error": return /* @__PURE__ */
|
|
474
|
+
}) }), f.map((e) => /* @__PURE__ */ P(j.Td, { children: /* @__PURE__ */ P(k, { height: 12 }) }, e.id))] }, t)) });
|
|
475
|
+
case "error": return /* @__PURE__ */ P(De, {
|
|
476
476
|
colSpan: m,
|
|
477
|
-
children: /* @__PURE__ */
|
|
477
|
+
children: /* @__PURE__ */ P(fe, {
|
|
478
478
|
view: e,
|
|
479
479
|
slots: t
|
|
480
480
|
})
|
|
481
481
|
});
|
|
482
482
|
case "empty":
|
|
483
|
-
case "empty-filtered": return /* @__PURE__ */
|
|
483
|
+
case "empty-filtered": return /* @__PURE__ */ P(De, {
|
|
484
484
|
colSpan: m,
|
|
485
|
-
children: /* @__PURE__ */
|
|
485
|
+
children: /* @__PURE__ */ P(J, {
|
|
486
486
|
view: e,
|
|
487
487
|
slots: t
|
|
488
488
|
})
|
|
@@ -490,20 +490,20 @@ function Te({ view: e, slots: t, enableSelection: n, loadingRowCount: r, disable
|
|
|
490
490
|
default: return g(d.rows);
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
|
-
return /* @__PURE__ */
|
|
493
|
+
return /* @__PURE__ */ P("div", {
|
|
494
494
|
style: c.getIsSomeColumnsPinned() ? { overflowX: "auto" } : void 0,
|
|
495
|
-
children: /* @__PURE__ */
|
|
495
|
+
children: /* @__PURE__ */ F(j, {
|
|
496
496
|
layout: "fixed",
|
|
497
497
|
...o,
|
|
498
|
-
children: [/* @__PURE__ */
|
|
498
|
+
children: [/* @__PURE__ */ P(j.Thead, { children: c.getHeaderGroups().map((e) => /* @__PURE__ */ F(j.Tr, { children: [p && /* @__PURE__ */ P(j.Th, {
|
|
499
499
|
style: { width: 40 },
|
|
500
|
-
children: /* @__PURE__ */
|
|
500
|
+
children: /* @__PURE__ */ P(v, {
|
|
501
501
|
"aria-label": "Select all rows on this page",
|
|
502
502
|
checked: c.getIsAllPageRowsSelected(),
|
|
503
503
|
indeterminate: c.getIsSomePageRowsSelected() && !c.getIsAllPageRowsSelected(),
|
|
504
504
|
onChange: c.getToggleAllPageRowsSelectedHandler()
|
|
505
505
|
})
|
|
506
|
-
}), e.headers.map((e) => /* @__PURE__ */
|
|
506
|
+
}), e.headers.map((e) => /* @__PURE__ */ P(Oe, {
|
|
507
507
|
header: e,
|
|
508
508
|
disabled: u
|
|
509
509
|
}, e.id))] }, e.id)) }), _()]
|
|
@@ -511,12 +511,12 @@ function Te({ view: e, slots: t, enableSelection: n, loadingRowCount: r, disable
|
|
|
511
511
|
});
|
|
512
512
|
}
|
|
513
513
|
function Ee({ children: e }) {
|
|
514
|
-
return /* @__PURE__ */
|
|
514
|
+
return /* @__PURE__ */ P(N, { children: e });
|
|
515
515
|
}
|
|
516
516
|
function De({ colSpan: e, children: t }) {
|
|
517
|
-
return /* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ P(j.Tbody, { children: /* @__PURE__ */ P(j.Tr, { children: /* @__PURE__ */ P(j.Td, {
|
|
518
518
|
colSpan: e,
|
|
519
|
-
children: /* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ P(_, {
|
|
520
520
|
p: "xl",
|
|
521
521
|
children: t
|
|
522
522
|
})
|
|
@@ -524,14 +524,14 @@ function De({ colSpan: e, children: t }) {
|
|
|
524
524
|
}
|
|
525
525
|
function Oe({ header: e, disabled: t }) {
|
|
526
526
|
let { column: n } = e, r = n.columnDef.meta?.align, i = n.getIsSorted(), a = n.getSortIndex(), o = a > 0, c = e.isPlaceholder ? null : s(n.columnDef.header, e.getContext()), l = n.getCanSort() && !t, u = n.columnDef.size;
|
|
527
|
-
return /* @__PURE__ */
|
|
527
|
+
return /* @__PURE__ */ P(j.Th, {
|
|
528
528
|
style: {
|
|
529
529
|
...we(n),
|
|
530
530
|
...r ? { textAlign: r } : void 0,
|
|
531
531
|
...u == null ? void 0 : { width: u }
|
|
532
532
|
},
|
|
533
533
|
"aria-sort": i === "asc" ? "ascending" : i === "desc" ? "descending" : void 0,
|
|
534
|
-
children: l ? /* @__PURE__ */
|
|
534
|
+
children: l ? /* @__PURE__ */ F(ae, {
|
|
535
535
|
onClick: n.getToggleSortingHandler(),
|
|
536
536
|
style: {
|
|
537
537
|
display: "inline-flex",
|
|
@@ -541,8 +541,8 @@ function Oe({ header: e, disabled: t }) {
|
|
|
541
541
|
},
|
|
542
542
|
children: [
|
|
543
543
|
c,
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
o && /* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ P(_e, { direction: i }),
|
|
545
|
+
o && /* @__PURE__ */ P("span", {
|
|
546
546
|
role: "note",
|
|
547
547
|
style: {
|
|
548
548
|
fontSize: "0.7em",
|
|
@@ -552,14 +552,14 @@ function Oe({ header: e, disabled: t }) {
|
|
|
552
552
|
children: a + 1
|
|
553
553
|
})
|
|
554
554
|
]
|
|
555
|
-
}) : /* @__PURE__ */
|
|
555
|
+
}) : /* @__PURE__ */ F("span", {
|
|
556
556
|
style: {
|
|
557
557
|
display: "inline-flex",
|
|
558
558
|
alignItems: "center",
|
|
559
559
|
gap: 4,
|
|
560
560
|
...t ? { opacity: .5 } : {}
|
|
561
561
|
},
|
|
562
|
-
children: [c, i && /* @__PURE__ */
|
|
562
|
+
children: [c, i && /* @__PURE__ */ P(_e, { direction: i })]
|
|
563
563
|
})
|
|
564
564
|
});
|
|
565
565
|
}
|
|
@@ -573,7 +573,7 @@ function Ae(e) {
|
|
|
573
573
|
return `(max-width: ${n - (r === "em" || r === "rem" ? .01 : .1)}${r})`;
|
|
574
574
|
}
|
|
575
575
|
function je(e) {
|
|
576
|
-
let t =
|
|
576
|
+
let t = oe(), n = e?.forceCardsBelow, r = n ? t.breakpoints[n] : void 0, i = W(r ? Ae(r) : ke, !1);
|
|
577
577
|
return !!r && !!i;
|
|
578
578
|
}
|
|
579
579
|
//#endregion
|
|
@@ -610,33 +610,33 @@ function Ne(e, t) {
|
|
|
610
610
|
}
|
|
611
611
|
return Me[e];
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function Pe(e, t, n) {
|
|
614
614
|
let r = t ?? n?.[e];
|
|
615
615
|
return r ? typeof r == "function" ? r : Ne(e, r) : Me[e];
|
|
616
616
|
}
|
|
617
617
|
//#endregion
|
|
618
618
|
//#region src/components/DataToolbar/FacetBuckets.tsx
|
|
619
|
-
function
|
|
619
|
+
function Fe({ facet: e, value: t, onChange: n }) {
|
|
620
620
|
let r = Array.isArray(t) ? t : null;
|
|
621
|
-
return /* @__PURE__ */
|
|
621
|
+
return /* @__PURE__ */ P(A, {
|
|
622
622
|
gap: 4,
|
|
623
623
|
children: e.ranges.map((e) => {
|
|
624
624
|
let t = r != null && r[0] === e.from && r[1] === e.to;
|
|
625
|
-
return /* @__PURE__ */
|
|
625
|
+
return /* @__PURE__ */ P(ae, {
|
|
626
626
|
onClick: () => n(t ? void 0 : [e.from, e.to]),
|
|
627
627
|
style: {
|
|
628
628
|
padding: "4px 8px",
|
|
629
629
|
borderRadius: 4,
|
|
630
630
|
background: t ? "var(--mantine-color-blue-light)" : void 0
|
|
631
631
|
},
|
|
632
|
-
children: /* @__PURE__ */
|
|
632
|
+
children: /* @__PURE__ */ F(b, {
|
|
633
633
|
gap: "xs",
|
|
634
634
|
justify: "space-between",
|
|
635
635
|
wrap: "nowrap",
|
|
636
|
-
children: [/* @__PURE__ */
|
|
636
|
+
children: [/* @__PURE__ */ P(M, {
|
|
637
637
|
size: "sm",
|
|
638
638
|
children: e.label
|
|
639
|
-
}), /* @__PURE__ */
|
|
639
|
+
}), /* @__PURE__ */ P(p, {
|
|
640
640
|
size: "sm",
|
|
641
641
|
variant: "light",
|
|
642
642
|
color: e.count === 0 ? "gray" : "blue",
|
|
@@ -649,15 +649,15 @@ function Pe({ facet: e, value: t, onChange: n }) {
|
|
|
649
649
|
}
|
|
650
650
|
//#endregion
|
|
651
651
|
//#region src/components/DataToolbar/FilterControl.tsx
|
|
652
|
-
function
|
|
653
|
-
return /* @__PURE__ */
|
|
652
|
+
function Ie({ label: e, onClear: t }) {
|
|
653
|
+
return /* @__PURE__ */ F(b, {
|
|
654
654
|
justify: "space-between",
|
|
655
655
|
wrap: "nowrap",
|
|
656
|
-
children: [/* @__PURE__ */
|
|
656
|
+
children: [/* @__PURE__ */ P(M, {
|
|
657
657
|
size: "sm",
|
|
658
658
|
fw: 500,
|
|
659
659
|
children: e
|
|
660
|
-
}), /* @__PURE__ */
|
|
660
|
+
}), /* @__PURE__ */ P(f, {
|
|
661
661
|
component: "button",
|
|
662
662
|
type: "button",
|
|
663
663
|
size: "xs",
|
|
@@ -667,28 +667,28 @@ function Fe({ label: e, onClear: t }) {
|
|
|
667
667
|
})]
|
|
668
668
|
});
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function Le(e) {
|
|
671
671
|
return e ? typeof e == "string" ? e : e.toISOString().split("T")[0] ?? null : null;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function Re(e) {
|
|
674
674
|
return Array.isArray(e) ? [e[0], e[1]] : [null, null];
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function ze(e, t) {
|
|
677
677
|
return e.values.length > 0 ? e.values.map((e) => ({
|
|
678
678
|
value: e.value,
|
|
679
679
|
label: `${e.label ?? e.value} (${e.count})`,
|
|
680
680
|
disabled: e.count === 0
|
|
681
681
|
})) : t ?? [];
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function Be({ column: e, facet: t }) {
|
|
684
684
|
let n = e.columnDef.meta?.filter;
|
|
685
685
|
if (!n) return null;
|
|
686
686
|
let r = K(e), i = n.placeholder ?? r, a = e.getFilterValue(), o = (t) => e.setFilterValue(t);
|
|
687
687
|
if (n.component) {
|
|
688
688
|
let t = n.component;
|
|
689
|
-
return /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
690
690
|
label: r,
|
|
691
|
-
children: /* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ P(t, {
|
|
692
692
|
value: a,
|
|
693
693
|
onChange: o,
|
|
694
694
|
column: e
|
|
@@ -697,26 +697,26 @@ function ze({ column: e, facet: t }) {
|
|
|
697
697
|
}
|
|
698
698
|
let s = t?.type === "values" ? t : void 0, c = t?.type === "ranges" ? t : void 0;
|
|
699
699
|
switch (n.variant) {
|
|
700
|
-
case "select": return /* @__PURE__ */
|
|
700
|
+
case "select": return /* @__PURE__ */ P(D, {
|
|
701
701
|
label: r,
|
|
702
702
|
placeholder: i,
|
|
703
703
|
clearable: !0,
|
|
704
|
-
data: s ?
|
|
704
|
+
data: s ? ze(s, n.options) : n.options ?? [],
|
|
705
705
|
value: a ?? null,
|
|
706
706
|
onChange: (e) => o(e ?? void 0)
|
|
707
707
|
});
|
|
708
|
-
case "multiselect": return /* @__PURE__ */
|
|
708
|
+
case "multiselect": return /* @__PURE__ */ P(te, {
|
|
709
709
|
label: r,
|
|
710
710
|
placeholder: i,
|
|
711
|
-
data: s ?
|
|
711
|
+
data: s ? ze(s, n.options) : n.options ?? [],
|
|
712
712
|
value: a ?? [],
|
|
713
713
|
onChange: (e) => o(e.length > 0 ? e : void 0)
|
|
714
714
|
});
|
|
715
715
|
case "boolean": {
|
|
716
716
|
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";
|
|
717
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
718
718
|
label: r,
|
|
719
|
-
children: /* @__PURE__ */
|
|
719
|
+
children: /* @__PURE__ */ P(E, {
|
|
720
720
|
fullWidth: !0,
|
|
721
721
|
size: "xs",
|
|
722
722
|
data: [
|
|
@@ -741,21 +741,21 @@ function ze({ column: e, facet: t }) {
|
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
case "numberRange": {
|
|
744
|
-
let [t, i] =
|
|
744
|
+
let [t, i] = Re(a), s = n.min ?? c?.min, l = n.max ?? c?.max, u = s != null && l != null, d = a != null, f = c ? /* @__PURE__ */ P(Fe, {
|
|
745
745
|
facet: c,
|
|
746
746
|
value: a,
|
|
747
747
|
onChange: o
|
|
748
|
-
}) : null, p = d ? /* @__PURE__ */
|
|
748
|
+
}) : null, p = d ? /* @__PURE__ */ P(Ie, {
|
|
749
749
|
label: r,
|
|
750
750
|
onClear: () => o(void 0)
|
|
751
751
|
}) : r;
|
|
752
752
|
if (u) {
|
|
753
|
-
let a = [t ?? s, i ?? l], c = e.columnDef.meta?.dataType, u = c ?
|
|
754
|
-
return /* @__PURE__ */
|
|
753
|
+
let a = [t ?? s, i ?? l], c = e.columnDef.meta?.dataType, u = c ? Pe(c, e.columnDef.meta?.format, void 0) : (e) => String(e);
|
|
754
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
755
755
|
label: p,
|
|
756
|
-
children: /* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ F(A, {
|
|
757
757
|
gap: "xs",
|
|
758
|
-
children: [f, /* @__PURE__ */
|
|
758
|
+
children: [f, /* @__PURE__ */ P(T, {
|
|
759
759
|
min: s,
|
|
760
760
|
max: l,
|
|
761
761
|
step: n.step ?? 1,
|
|
@@ -770,23 +770,23 @@ function ze({ column: e, facet: t }) {
|
|
|
770
770
|
})
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
|
-
if (f) return /* @__PURE__ */
|
|
773
|
+
if (f) return /* @__PURE__ */ P(x.Wrapper, {
|
|
774
774
|
label: p,
|
|
775
775
|
children: f
|
|
776
776
|
});
|
|
777
777
|
let m = (e) => o(e[0] == null && e[1] == null ? void 0 : e), h = (e) => e === "" || e == null ? null : Number(e);
|
|
778
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
779
779
|
label: r,
|
|
780
|
-
children: /* @__PURE__ */
|
|
780
|
+
children: /* @__PURE__ */ F(b, {
|
|
781
781
|
gap: 4,
|
|
782
782
|
wrap: "nowrap",
|
|
783
|
-
children: [/* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ P(C, {
|
|
784
784
|
"aria-label": `${r} minimum`,
|
|
785
785
|
placeholder: "Min",
|
|
786
786
|
value: t ?? "",
|
|
787
787
|
onChange: (e) => m([h(e), i]),
|
|
788
788
|
w: 90
|
|
789
|
-
}), /* @__PURE__ */
|
|
789
|
+
}), /* @__PURE__ */ P(C, {
|
|
790
790
|
"aria-label": `${r} maximum`,
|
|
791
791
|
placeholder: "Max",
|
|
792
792
|
value: i ?? "",
|
|
@@ -796,42 +796,42 @@ function ze({ column: e, facet: t }) {
|
|
|
796
796
|
})
|
|
797
797
|
});
|
|
798
798
|
}
|
|
799
|
-
case "date": return /* @__PURE__ */
|
|
799
|
+
case "date": return /* @__PURE__ */ P(G, {
|
|
800
800
|
label: r,
|
|
801
801
|
placeholder: i,
|
|
802
802
|
clearable: !0,
|
|
803
803
|
popoverProps: { withinPortal: !1 },
|
|
804
804
|
value: a ? new Date(a) : null,
|
|
805
|
-
onChange: (e) => o(
|
|
805
|
+
onChange: (e) => o(Le(e) ?? void 0)
|
|
806
806
|
});
|
|
807
807
|
case "dateRange": {
|
|
808
|
-
let [e, t] =
|
|
808
|
+
let [e, t] = Re(a), n = [e ? new Date(e) : null, t ? new Date(t) : null], s = a == null ? r : /* @__PURE__ */ P(Ie, {
|
|
809
809
|
label: r,
|
|
810
810
|
onClear: () => o(void 0)
|
|
811
811
|
});
|
|
812
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
813
813
|
label: s,
|
|
814
|
-
children: /* @__PURE__ */
|
|
814
|
+
children: /* @__PURE__ */ F(A, {
|
|
815
815
|
gap: "xs",
|
|
816
|
-
children: [c && /* @__PURE__ */
|
|
816
|
+
children: [c && /* @__PURE__ */ P(Fe, {
|
|
817
817
|
facet: c,
|
|
818
818
|
value: a,
|
|
819
819
|
onChange: o
|
|
820
|
-
}), /* @__PURE__ */
|
|
820
|
+
}), /* @__PURE__ */ P(G, {
|
|
821
821
|
type: "range",
|
|
822
822
|
popoverProps: { withinPortal: !1 },
|
|
823
823
|
placeholder: i,
|
|
824
824
|
clearable: !0,
|
|
825
825
|
value: n,
|
|
826
826
|
onChange: ([e, t]) => {
|
|
827
|
-
let n =
|
|
827
|
+
let n = Le(e), r = Le(t);
|
|
828
828
|
o(n == null && r == null ? void 0 : [n, r]);
|
|
829
829
|
}
|
|
830
830
|
})]
|
|
831
831
|
})
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
|
-
default: return /* @__PURE__ */
|
|
834
|
+
default: return /* @__PURE__ */ P(ie, {
|
|
835
835
|
label: r,
|
|
836
836
|
placeholder: i,
|
|
837
837
|
value: a ?? "",
|
|
@@ -841,59 +841,59 @@ function ze({ column: e, facet: t }) {
|
|
|
841
841
|
}
|
|
842
842
|
//#endregion
|
|
843
843
|
//#region src/components/DataToolbar/FilterControls.tsx
|
|
844
|
-
function
|
|
845
|
-
return e.state.columnFilters.length > 0 ? /* @__PURE__ */
|
|
844
|
+
function Ve({ view: e }) {
|
|
845
|
+
return e.state.columnFilters.length > 0 ? /* @__PURE__ */ P(h, {
|
|
846
846
|
variant: "subtle",
|
|
847
847
|
size: "compact-sm",
|
|
848
848
|
color: "gray",
|
|
849
|
-
leftSection: /* @__PURE__ */
|
|
849
|
+
leftSection: /* @__PURE__ */ P(xe, {}),
|
|
850
850
|
onClick: () => e.table.resetColumnFilters(),
|
|
851
851
|
children: "Reset filters"
|
|
852
852
|
}) : null;
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function He(e) {
|
|
855
855
|
return e > 0 ? `Filters (${e})` : "Filters";
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return /* @__PURE__ */
|
|
857
|
+
function Ue({ view: e, controls: t }) {
|
|
858
|
+
return /* @__PURE__ */ F(A, {
|
|
859
859
|
gap: "sm",
|
|
860
860
|
style: { minWidth: 240 },
|
|
861
|
-
children: [t, /* @__PURE__ */
|
|
861
|
+
children: [t, /* @__PURE__ */ P(b, {
|
|
862
862
|
justify: "flex-end",
|
|
863
|
-
children: /* @__PURE__ */
|
|
863
|
+
children: /* @__PURE__ */ P(Ve, { view: e })
|
|
864
864
|
})]
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
|
-
function
|
|
868
|
-
let n = e.filterableColumns, r =
|
|
867
|
+
function We({ view: e, inlineThreshold: t }) {
|
|
868
|
+
let n = e.filterableColumns, r = W(Ae(oe().breakpoints.sm), !1), [i, { open: a, close: o }] = se(!1);
|
|
869
869
|
if (n.length === 0) return null;
|
|
870
|
-
let s = n.map((t) => /* @__PURE__ */
|
|
870
|
+
let s = n.map((t) => /* @__PURE__ */ P(Be, {
|
|
871
871
|
column: t,
|
|
872
872
|
facet: e.facets[t.id]
|
|
873
873
|
}, t.id)), c = e.state.columnFilters.length;
|
|
874
|
-
return r ? /* @__PURE__ */
|
|
874
|
+
return r ? /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(h, {
|
|
875
875
|
variant: "default",
|
|
876
|
-
leftSection: /* @__PURE__ */
|
|
876
|
+
leftSection: /* @__PURE__ */ P(ye, {}),
|
|
877
877
|
onClick: a,
|
|
878
|
-
children:
|
|
879
|
-
}), /* @__PURE__ */
|
|
878
|
+
children: He(c)
|
|
879
|
+
}), /* @__PURE__ */ P(ee, {
|
|
880
880
|
opened: i,
|
|
881
881
|
onClose: o,
|
|
882
882
|
title: "Filters",
|
|
883
883
|
position: "bottom",
|
|
884
884
|
size: "auto",
|
|
885
|
-
children: /* @__PURE__ */
|
|
885
|
+
children: /* @__PURE__ */ P(Ue, {
|
|
886
886
|
view: e,
|
|
887
887
|
controls: s
|
|
888
888
|
})
|
|
889
|
-
})] }) : n.length <= t ? /* @__PURE__ */
|
|
889
|
+
})] }) : n.length <= t ? /* @__PURE__ */ F(N, { children: [s, /* @__PURE__ */ P(Ve, { view: e })] }) : /* @__PURE__ */ F(w, {
|
|
890
890
|
position: "bottom-start",
|
|
891
891
|
closeOnClickOutside: !1,
|
|
892
|
-
children: [/* @__PURE__ */
|
|
892
|
+
children: [/* @__PURE__ */ P(w.Target, { children: /* @__PURE__ */ P(h, {
|
|
893
893
|
variant: "default",
|
|
894
|
-
leftSection: /* @__PURE__ */
|
|
895
|
-
children:
|
|
896
|
-
}) }), /* @__PURE__ */
|
|
894
|
+
leftSection: /* @__PURE__ */ P(ye, {}),
|
|
895
|
+
children: He(c)
|
|
896
|
+
}) }), /* @__PURE__ */ P(w.Dropdown, { children: /* @__PURE__ */ P(Ue, {
|
|
897
897
|
view: e,
|
|
898
898
|
controls: s
|
|
899
899
|
}) })]
|
|
@@ -901,12 +901,12 @@ function Ue({ view: e, inlineThreshold: t }) {
|
|
|
901
901
|
}
|
|
902
902
|
//#endregion
|
|
903
903
|
//#region src/components/DataToolbar/SortControl.tsx
|
|
904
|
-
function
|
|
904
|
+
function Ge({ view: e }) {
|
|
905
905
|
let { sortableColumns: t, state: n, table: r } = e, i = n.sorting[0];
|
|
906
|
-
return /* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */ F(b, {
|
|
907
907
|
gap: 4,
|
|
908
908
|
wrap: "nowrap",
|
|
909
|
-
children: [/* @__PURE__ */
|
|
909
|
+
children: [/* @__PURE__ */ P(D, {
|
|
910
910
|
"aria-label": "Sort by",
|
|
911
911
|
placeholder: "Sort by",
|
|
912
912
|
clearable: !0,
|
|
@@ -919,7 +919,7 @@ function We({ view: e }) {
|
|
|
919
919
|
id: e,
|
|
920
920
|
desc: i?.desc ?? !1
|
|
921
921
|
}] : [])
|
|
922
|
-
}), /* @__PURE__ */
|
|
922
|
+
}), /* @__PURE__ */ P(d, {
|
|
923
923
|
"aria-label": "Toggle sort direction",
|
|
924
924
|
variant: "default",
|
|
925
925
|
size: "lg",
|
|
@@ -928,14 +928,14 @@ function We({ view: e }) {
|
|
|
928
928
|
id: i.id,
|
|
929
929
|
desc: !i.desc
|
|
930
930
|
}]),
|
|
931
|
-
children: /* @__PURE__ */
|
|
931
|
+
children: /* @__PURE__ */ P(_e, { direction: i ? i.desc ? "desc" : "asc" : !1 })
|
|
932
932
|
})]
|
|
933
933
|
});
|
|
934
934
|
}
|
|
935
935
|
//#endregion
|
|
936
936
|
//#region src/components/DataToolbar/ViewSwitcher.tsx
|
|
937
|
-
function
|
|
938
|
-
return e.isMobileForced && t ? null : /* @__PURE__ */
|
|
937
|
+
function Ke({ view: e, lockSwitcherOnMobile: t, tableLabel: n = "Table", cardsLabel: r = "Cards" }) {
|
|
938
|
+
return e.isMobileForced && t ? null : /* @__PURE__ */ P(E, {
|
|
939
939
|
"aria-label": "View",
|
|
940
940
|
value: e.view,
|
|
941
941
|
disabled: e.isMobileForced,
|
|
@@ -953,81 +953,81 @@ function Ge({ view: e, lockSwitcherOnMobile: t, tableLabel: n = "Table", cardsLa
|
|
|
953
953
|
}
|
|
954
954
|
//#endregion
|
|
955
955
|
//#region src/components/DataToolbar/VisibilityMenu.tsx
|
|
956
|
-
function
|
|
956
|
+
function qe({ column: e }) {
|
|
957
957
|
if (!e.getCanPin()) return null;
|
|
958
958
|
let t = e.getIsPinned();
|
|
959
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ F(b, {
|
|
960
960
|
gap: 2,
|
|
961
|
-
children: [/* @__PURE__ */
|
|
961
|
+
children: [/* @__PURE__ */ P(d, {
|
|
962
962
|
size: "xs",
|
|
963
963
|
variant: t === "left" ? "filled" : "subtle",
|
|
964
964
|
color: t === "left" ? "blue" : "gray",
|
|
965
965
|
"aria-label": `Pin ${K(e)} left`,
|
|
966
966
|
onClick: () => e.pin(t === "left" ? !1 : "left"),
|
|
967
|
-
children: /* @__PURE__ */
|
|
968
|
-
}), /* @__PURE__ */
|
|
967
|
+
children: /* @__PURE__ */ P(Se, {})
|
|
968
|
+
}), /* @__PURE__ */ P(d, {
|
|
969
969
|
size: "xs",
|
|
970
970
|
variant: t === "right" ? "filled" : "subtle",
|
|
971
971
|
color: t === "right" ? "blue" : "gray",
|
|
972
972
|
"aria-label": `Pin ${K(e)} right`,
|
|
973
973
|
onClick: () => e.pin(t === "right" ? !1 : "right"),
|
|
974
|
-
children: /* @__PURE__ */
|
|
974
|
+
children: /* @__PURE__ */ P(Ce, {})
|
|
975
975
|
})]
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Je({ view: e }) {
|
|
979
979
|
let t = e.table.getAllLeafColumns().filter((e) => e.getCanHide());
|
|
980
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
|
980
|
+
return t.length === 0 ? null : /* @__PURE__ */ F(S, {
|
|
981
981
|
closeOnItemClick: !1,
|
|
982
982
|
withinPortal: !0,
|
|
983
983
|
position: "bottom-end",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
984
|
+
children: [/* @__PURE__ */ P(S.Target, { children: /* @__PURE__ */ P(h, {
|
|
985
985
|
variant: "default",
|
|
986
|
-
rightSection: /* @__PURE__ */
|
|
986
|
+
rightSection: /* @__PURE__ */ P(be, {}),
|
|
987
987
|
children: "Columns"
|
|
988
|
-
}) }), /* @__PURE__ */
|
|
988
|
+
}) }), /* @__PURE__ */ P(S.Dropdown, { children: /* @__PURE__ */ P(A, {
|
|
989
989
|
gap: "xs",
|
|
990
990
|
p: "xs",
|
|
991
|
-
children: t.map((e) => /* @__PURE__ */
|
|
991
|
+
children: t.map((e) => /* @__PURE__ */ F(b, {
|
|
992
992
|
gap: "xs",
|
|
993
993
|
justify: "space-between",
|
|
994
994
|
wrap: "nowrap",
|
|
995
|
-
children: [/* @__PURE__ */
|
|
995
|
+
children: [/* @__PURE__ */ P(v, {
|
|
996
996
|
label: K(e),
|
|
997
997
|
checked: e.getIsVisible(),
|
|
998
998
|
onChange: (t) => e.toggleVisibility(t.currentTarget.checked)
|
|
999
|
-
}), /* @__PURE__ */
|
|
999
|
+
}), /* @__PURE__ */ P(qe, { column: e })]
|
|
1000
1000
|
}, e.id))
|
|
1001
1001
|
}) })]
|
|
1002
1002
|
});
|
|
1003
1003
|
}
|
|
1004
1004
|
//#endregion
|
|
1005
1005
|
//#region src/components/DataToolbar/DataToolbar.tsx
|
|
1006
|
-
function
|
|
1007
|
-
let { table: p, state: m } = e, h = l && e.status === "loading", g = i ?? p.options.enableGlobalFilter !== !1, _ = a ?? e.filterableColumns.length > 0, v = o ?? e.sortableColumns.length > 0,
|
|
1008
|
-
return /* @__PURE__ */
|
|
1006
|
+
function Ye({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold: n = 3, lockSwitcherOnMobile: r, showSearch: i, showFilters: a, showSort: o, showVisibility: s, showViewSwitcher: c, disableWhileLoading: l = !0, leftSection: u, rightSection: d, ...f }) {
|
|
1007
|
+
let { table: p, state: m } = e, h = l && e.status === "loading", g = i ?? p.options.enableGlobalFilter !== !1, _ = a ?? e.filterableColumns.length > 0, v = o ?? e.sortableColumns.length > 0, ee = s ?? !0, x = c ?? !0;
|
|
1008
|
+
return /* @__PURE__ */ F(b, {
|
|
1009
1009
|
justify: "space-between",
|
|
1010
1010
|
wrap: "wrap",
|
|
1011
1011
|
gap: "sm",
|
|
1012
1012
|
...f,
|
|
1013
|
-
children: [/* @__PURE__ */
|
|
1013
|
+
children: [/* @__PURE__ */ F(b, {
|
|
1014
1014
|
wrap: "wrap",
|
|
1015
1015
|
gap: "sm",
|
|
1016
1016
|
children: [
|
|
1017
1017
|
u,
|
|
1018
|
-
g && /* @__PURE__ */
|
|
1018
|
+
g && /* @__PURE__ */ P(ie, {
|
|
1019
1019
|
"aria-label": "Search",
|
|
1020
1020
|
placeholder: t,
|
|
1021
|
-
leftSection: /* @__PURE__ */
|
|
1021
|
+
leftSection: /* @__PURE__ */ P(ve, {}),
|
|
1022
1022
|
value: m.globalFilter,
|
|
1023
1023
|
onChange: (e) => p.setGlobalFilter(e.currentTarget.value),
|
|
1024
|
-
rightSection: m.globalFilter ? /* @__PURE__ */
|
|
1024
|
+
rightSection: m.globalFilter ? /* @__PURE__ */ P(y, {
|
|
1025
1025
|
size: "sm",
|
|
1026
1026
|
"aria-label": "Clear search",
|
|
1027
1027
|
onClick: () => p.setGlobalFilter("")
|
|
1028
1028
|
}) : void 0
|
|
1029
1029
|
}),
|
|
1030
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ F("fieldset", {
|
|
1031
1031
|
disabled: h,
|
|
1032
1032
|
style: {
|
|
1033
1033
|
display: "contents",
|
|
@@ -1035,13 +1035,13 @@ function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1035
1035
|
padding: 0,
|
|
1036
1036
|
margin: 0
|
|
1037
1037
|
},
|
|
1038
|
-
children: [_ && /* @__PURE__ */
|
|
1038
|
+
children: [_ && /* @__PURE__ */ P(We, {
|
|
1039
1039
|
view: e,
|
|
1040
1040
|
inlineThreshold: n
|
|
1041
|
-
}), v && /* @__PURE__ */
|
|
1041
|
+
}), v && /* @__PURE__ */ P(Ge, { view: e })]
|
|
1042
1042
|
})
|
|
1043
1043
|
]
|
|
1044
|
-
}), /* @__PURE__ */
|
|
1044
|
+
}), /* @__PURE__ */ P("fieldset", {
|
|
1045
1045
|
disabled: h,
|
|
1046
1046
|
style: {
|
|
1047
1047
|
display: "contents",
|
|
@@ -1049,12 +1049,12 @@ function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1049
1049
|
padding: 0,
|
|
1050
1050
|
margin: 0
|
|
1051
1051
|
},
|
|
1052
|
-
children: /* @__PURE__ */
|
|
1052
|
+
children: /* @__PURE__ */ F(b, {
|
|
1053
1053
|
wrap: "wrap",
|
|
1054
1054
|
gap: "sm",
|
|
1055
1055
|
children: [
|
|
1056
|
-
|
|
1057
|
-
|
|
1056
|
+
ee && /* @__PURE__ */ P(Je, { view: e }),
|
|
1057
|
+
x && /* @__PURE__ */ P(Ke, {
|
|
1058
1058
|
view: e,
|
|
1059
1059
|
lockSwitcherOnMobile: r
|
|
1060
1060
|
}),
|
|
@@ -1066,17 +1066,17 @@ function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1066
1066
|
}
|
|
1067
1067
|
//#endregion
|
|
1068
1068
|
//#region src/components/DataViewer/context.tsx
|
|
1069
|
-
var
|
|
1070
|
-
function
|
|
1071
|
-
let e =
|
|
1069
|
+
var Xe = L(null), Ze = Xe.Provider;
|
|
1070
|
+
function X() {
|
|
1071
|
+
let e = z(Xe);
|
|
1072
1072
|
if (!e) throw Error("DataViewer.Toolbar / DataViewer.Body / DataViewer.Pagination must be rendered inside <DataViewer>.");
|
|
1073
1073
|
return e;
|
|
1074
1074
|
}
|
|
1075
1075
|
//#endregion
|
|
1076
1076
|
//#region src/components/DataViewer/DataViewer.tsx
|
|
1077
|
-
function
|
|
1078
|
-
return /* @__PURE__ */
|
|
1079
|
-
value:
|
|
1077
|
+
function Z({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMobile: i, animateRows: a, children: o, ...s }) {
|
|
1078
|
+
return /* @__PURE__ */ P(Ze, {
|
|
1079
|
+
value: V(() => ({
|
|
1080
1080
|
view: e,
|
|
1081
1081
|
slots: t,
|
|
1082
1082
|
renderCard: n,
|
|
@@ -1091,63 +1091,63 @@ function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMo
|
|
|
1091
1091
|
i,
|
|
1092
1092
|
a
|
|
1093
1093
|
]),
|
|
1094
|
-
children: /* @__PURE__ */
|
|
1094
|
+
children: /* @__PURE__ */ P(A, {
|
|
1095
1095
|
...s,
|
|
1096
|
-
children: o ?? /* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1096
|
+
children: o ?? /* @__PURE__ */ F(N, { children: [
|
|
1097
|
+
/* @__PURE__ */ P(Qe, {}),
|
|
1098
|
+
/* @__PURE__ */ P(tt, {}),
|
|
1099
|
+
/* @__PURE__ */ P($e, {}),
|
|
1100
|
+
/* @__PURE__ */ P(et, {})
|
|
1101
1101
|
] })
|
|
1102
1102
|
})
|
|
1103
1103
|
});
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1106
|
-
let { view: t, lockSwitcherOnMobile: n } =
|
|
1107
|
-
return /* @__PURE__ */
|
|
1105
|
+
function Qe(e) {
|
|
1106
|
+
let { view: t, lockSwitcherOnMobile: n } = X();
|
|
1107
|
+
return /* @__PURE__ */ P(Ye, {
|
|
1108
1108
|
view: t,
|
|
1109
1109
|
lockSwitcherOnMobile: n,
|
|
1110
1110
|
...e
|
|
1111
1111
|
});
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1114
|
-
let { view: n, slots: r, renderCard: i, fallbackRole: a, animateRows: o } =
|
|
1115
|
-
return n.view === "cards" ? /* @__PURE__ */
|
|
1113
|
+
function $e({ tableProps: e, cardsProps: t }) {
|
|
1114
|
+
let { view: n, slots: r, renderCard: i, fallbackRole: a, animateRows: o } = X();
|
|
1115
|
+
return n.view === "cards" ? /* @__PURE__ */ P(me, {
|
|
1116
1116
|
view: n,
|
|
1117
1117
|
slots: r,
|
|
1118
1118
|
renderCard: i,
|
|
1119
1119
|
fallbackRole: a,
|
|
1120
1120
|
animateRows: o,
|
|
1121
1121
|
...t
|
|
1122
|
-
}) : /* @__PURE__ */
|
|
1122
|
+
}) : /* @__PURE__ */ P(Te, {
|
|
1123
1123
|
view: n,
|
|
1124
1124
|
slots: r,
|
|
1125
1125
|
animateRows: o,
|
|
1126
1126
|
...e
|
|
1127
1127
|
});
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
let { view: t } =
|
|
1131
|
-
return /* @__PURE__ */
|
|
1129
|
+
function et(e) {
|
|
1130
|
+
let { view: t } = X();
|
|
1131
|
+
return /* @__PURE__ */ P(ge, {
|
|
1132
1132
|
view: t,
|
|
1133
1133
|
...e
|
|
1134
1134
|
});
|
|
1135
1135
|
}
|
|
1136
|
-
function
|
|
1137
|
-
let { view: t, slots: n } =
|
|
1138
|
-
return /* @__PURE__ */
|
|
1136
|
+
function tt(e) {
|
|
1137
|
+
let { view: t, slots: n } = X();
|
|
1138
|
+
return /* @__PURE__ */ P(ce, {
|
|
1139
1139
|
view: t,
|
|
1140
1140
|
slots: n,
|
|
1141
1141
|
...e
|
|
1142
1142
|
});
|
|
1143
1143
|
}
|
|
1144
|
-
|
|
1144
|
+
Z.Toolbar = Qe, Z.BulkActions = tt, Z.Body = $e, Z.Pagination = et;
|
|
1145
1145
|
//#endregion
|
|
1146
1146
|
//#region src/core/colBuilder.ts
|
|
1147
|
-
function
|
|
1147
|
+
function nt(e) {
|
|
1148
1148
|
return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
1149
1149
|
}
|
|
1150
|
-
var
|
|
1150
|
+
var rt = {
|
|
1151
1151
|
text: {
|
|
1152
1152
|
dataType: "text",
|
|
1153
1153
|
filterVariant: "text"
|
|
@@ -1172,13 +1172,13 @@ var nt = {
|
|
|
1172
1172
|
},
|
|
1173
1173
|
select: { filterVariant: "select" },
|
|
1174
1174
|
multiselect: { filterVariant: "multiselect" }
|
|
1175
|
-
},
|
|
1175
|
+
}, it = class {
|
|
1176
1176
|
cols = [];
|
|
1177
1177
|
helper = o();
|
|
1178
1178
|
add(e, t, n) {
|
|
1179
|
-
let r =
|
|
1179
|
+
let r = rt[e];
|
|
1180
1180
|
if (!r) throw Error(`Unknown preset: ${e}`);
|
|
1181
|
-
let i = n?.header ??
|
|
1181
|
+
let i = n?.header ?? nt(t), a = n?.align ?? r.align, o;
|
|
1182
1182
|
if (n?.filter === !1) o = void 0;
|
|
1183
1183
|
else {
|
|
1184
1184
|
let e = {
|
|
@@ -1237,25 +1237,30 @@ var nt = {
|
|
|
1237
1237
|
return this.cols;
|
|
1238
1238
|
}
|
|
1239
1239
|
};
|
|
1240
|
-
function
|
|
1241
|
-
return new
|
|
1240
|
+
function at() {
|
|
1241
|
+
return new it();
|
|
1242
1242
|
}
|
|
1243
1243
|
//#endregion
|
|
1244
1244
|
//#region src/core/exportCsv.ts
|
|
1245
|
-
function
|
|
1245
|
+
function Q(e) {
|
|
1246
1246
|
let t = e == null ? "" : String(e);
|
|
1247
1247
|
return t.includes(",") || t.includes("\"") || t.includes("\n") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1248
1248
|
}
|
|
1249
1249
|
function ot(e, t) {
|
|
1250
|
-
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) =>
|
|
1250
|
+
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) => Q(K(e))), ...e.getRowModel().rows.map((e) => o.map((t) => {
|
|
1251
1251
|
let n = e.getAllCells().find((e) => e.column.id === t.id)?.getValue();
|
|
1252
|
-
return i && t.columnDef.meta?.dataType ?
|
|
1252
|
+
return i && t.columnDef.meta?.dataType ? Q(Pe(t.columnDef.meta.dataType, t.columnDef.meta.format, a)(n)) : Q(n);
|
|
1253
1253
|
}))].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");
|
|
1254
1254
|
u.href = l, u.download = n, u.click(), URL.revokeObjectURL(l);
|
|
1255
1255
|
}
|
|
1256
1256
|
//#endregion
|
|
1257
|
-
//#region src/
|
|
1257
|
+
//#region src/core/getViewMode.ts
|
|
1258
1258
|
function st(e) {
|
|
1259
|
+
return ("table" in e ? e.table : e).options.meta?.viewMode ?? "table";
|
|
1260
|
+
}
|
|
1261
|
+
//#endregion
|
|
1262
|
+
//#region src/url/useUrlSync.ts
|
|
1263
|
+
function ct(e) {
|
|
1259
1264
|
return e ? {
|
|
1260
1265
|
adapter: e.adapter,
|
|
1261
1266
|
serializer: {
|
|
@@ -1265,7 +1270,7 @@ function st(e) {
|
|
|
1265
1270
|
include: r(e.include)
|
|
1266
1271
|
} : null;
|
|
1267
1272
|
}
|
|
1268
|
-
function
|
|
1273
|
+
function lt(e, t, r) {
|
|
1269
1274
|
if (!e) return {};
|
|
1270
1275
|
try {
|
|
1271
1276
|
return n(e.adapter.read(), {
|
|
@@ -1278,21 +1283,21 @@ function ct(e, t, r) {
|
|
|
1278
1283
|
return {};
|
|
1279
1284
|
}
|
|
1280
1285
|
}
|
|
1281
|
-
function
|
|
1282
|
-
let s =
|
|
1286
|
+
function ut({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
1287
|
+
let s = H(i);
|
|
1283
1288
|
s.current = i;
|
|
1284
|
-
let c =
|
|
1289
|
+
let c = H(a);
|
|
1285
1290
|
c.current = a;
|
|
1286
|
-
let l =
|
|
1291
|
+
let l = H(o);
|
|
1287
1292
|
l.current = o;
|
|
1288
|
-
let u =
|
|
1293
|
+
let u = H(r);
|
|
1289
1294
|
u.current = r;
|
|
1290
1295
|
let d = r ? t(i, {
|
|
1291
1296
|
serializer: r.serializer,
|
|
1292
1297
|
include: r.include,
|
|
1293
1298
|
getFilterMeta: o
|
|
1294
1299
|
}) : null;
|
|
1295
|
-
|
|
1300
|
+
B(() => {
|
|
1296
1301
|
let t = u.current;
|
|
1297
1302
|
if (!t || !d) return;
|
|
1298
1303
|
let n = e(t.adapter.read(), t.serializer, t.include);
|
|
@@ -1300,7 +1305,7 @@ function lt({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1300
1305
|
...n,
|
|
1301
1306
|
...d
|
|
1302
1307
|
}, { replace: !0 });
|
|
1303
|
-
}, [d ? JSON.stringify(d) : ""]),
|
|
1308
|
+
}, [d ? JSON.stringify(d) : ""]), B(() => {
|
|
1304
1309
|
if (!r) return;
|
|
1305
1310
|
let { adapter: e, serializer: t, include: i } = r;
|
|
1306
1311
|
return e.subscribe?.(() => {
|
|
@@ -1316,24 +1321,24 @@ function lt({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1316
1321
|
}
|
|
1317
1322
|
//#endregion
|
|
1318
1323
|
//#region src/core/resolveStatus.ts
|
|
1319
|
-
function
|
|
1324
|
+
function dt(e) {
|
|
1320
1325
|
return e.columnFilters.length > 0 || e.globalFilter.trim() !== "";
|
|
1321
1326
|
}
|
|
1322
|
-
function
|
|
1327
|
+
function ft({ status: e, error: t, pageRowCount: n, state: r }) {
|
|
1323
1328
|
return e === "error" ? {
|
|
1324
1329
|
phase: "error",
|
|
1325
1330
|
error: t
|
|
1326
|
-
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ?
|
|
1331
|
+
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ? dt(r) ? { phase: "empty-filtered" } : { phase: "empty" } : { phase: "ready" };
|
|
1327
1332
|
}
|
|
1328
1333
|
//#endregion
|
|
1329
1334
|
//#region src/core/useDataView.ts
|
|
1330
|
-
var $ = 300,
|
|
1335
|
+
var $ = 300, pt = [
|
|
1331
1336
|
10,
|
|
1332
1337
|
25,
|
|
1333
1338
|
50,
|
|
1334
1339
|
100
|
|
1335
|
-
],
|
|
1336
|
-
function
|
|
1340
|
+
], mt = 10;
|
|
1341
|
+
function ht(e) {
|
|
1337
1342
|
return e == null ? {
|
|
1338
1343
|
globalFilter: $,
|
|
1339
1344
|
columnFilters: $
|
|
@@ -1345,23 +1350,23 @@ function mt(e) {
|
|
|
1345
1350
|
columnFilters: e.columnFilters ?? $
|
|
1346
1351
|
};
|
|
1347
1352
|
}
|
|
1348
|
-
function
|
|
1353
|
+
function gt(e) {
|
|
1349
1354
|
if (e.id) return e.id;
|
|
1350
1355
|
if ("accessorKey" in e && e.accessorKey != null) return String(e.accessorKey);
|
|
1351
1356
|
}
|
|
1352
|
-
function
|
|
1357
|
+
function _t(e) {
|
|
1353
1358
|
let t = /* @__PURE__ */ new Map();
|
|
1354
1359
|
for (let n of e) {
|
|
1355
|
-
let e =
|
|
1360
|
+
let e = gt(n), r = n.meta?.filter;
|
|
1356
1361
|
e && r && t.set(e, r);
|
|
1357
1362
|
}
|
|
1358
1363
|
return (e) => t.get(e);
|
|
1359
1364
|
}
|
|
1360
|
-
function
|
|
1365
|
+
function vt(e) {
|
|
1361
1366
|
return {
|
|
1362
1367
|
pagination: {
|
|
1363
1368
|
pageIndex: 0,
|
|
1364
|
-
pageSize: e.pageSizeOptions?.[0] ??
|
|
1369
|
+
pageSize: e.pageSizeOptions?.[0] ?? mt
|
|
1365
1370
|
},
|
|
1366
1371
|
sorting: [],
|
|
1367
1372
|
columnFilters: [],
|
|
@@ -1376,74 +1381,75 @@ function _t(e) {
|
|
|
1376
1381
|
...e.initialState
|
|
1377
1382
|
};
|
|
1378
1383
|
}
|
|
1379
|
-
function
|
|
1380
|
-
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, params: y } = e,
|
|
1384
|
+
function yt(e) {
|
|
1385
|
+
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, params: y } = e, ee = v ?? {}, b = y ? JSON.stringify(y) : "", x = y ?? {}, S = V(() => t.map((e) => {
|
|
1381
1386
|
let t = e.meta?.dataType;
|
|
1382
1387
|
if (!t || e.cell) return e;
|
|
1383
|
-
let n =
|
|
1388
|
+
let n = Pe(t, e.meta?.format, _);
|
|
1384
1389
|
return {
|
|
1385
1390
|
...e,
|
|
1386
1391
|
cell: (e) => n(e.getValue())
|
|
1387
1392
|
};
|
|
1388
|
-
}), [t, _]),
|
|
1389
|
-
let t =
|
|
1393
|
+
}), [t, _]), te = V(() => _t(S), [S]), C = V(() => ct(e.urlSync), [e.urlSync]), [ne, re] = U(() => {
|
|
1394
|
+
let t = vt(e);
|
|
1390
1395
|
return {
|
|
1391
1396
|
...t,
|
|
1392
|
-
...
|
|
1397
|
+
...lt(C, t, te)
|
|
1393
1398
|
};
|
|
1394
|
-
}),
|
|
1395
|
-
...
|
|
1399
|
+
}), w = V(() => ({
|
|
1400
|
+
...ne,
|
|
1396
1401
|
...d
|
|
1397
|
-
}), [
|
|
1398
|
-
|
|
1399
|
-
let
|
|
1400
|
-
|
|
1402
|
+
}), [ne, d]), T = H(w);
|
|
1403
|
+
T.current = w;
|
|
1404
|
+
let E = R((e) => {
|
|
1405
|
+
re((t) => ({
|
|
1401
1406
|
...t,
|
|
1402
1407
|
...e
|
|
1403
1408
|
})), f?.({
|
|
1404
|
-
...
|
|
1409
|
+
...T.current,
|
|
1405
1410
|
...e
|
|
1406
1411
|
});
|
|
1407
1412
|
}, [f]);
|
|
1408
|
-
|
|
1409
|
-
config:
|
|
1410
|
-
state:
|
|
1411
|
-
applyPatch:
|
|
1412
|
-
getFilterMeta:
|
|
1413
|
+
ut({
|
|
1414
|
+
config: C,
|
|
1415
|
+
state: w,
|
|
1416
|
+
applyPatch: E,
|
|
1417
|
+
getFilterMeta: te
|
|
1413
1418
|
});
|
|
1414
|
-
let
|
|
1415
|
-
...
|
|
1419
|
+
let D = R(() => ({
|
|
1420
|
+
...T.current.pagination,
|
|
1416
1421
|
pageIndex: 0
|
|
1417
|
-
}), []),
|
|
1418
|
-
|
|
1419
|
-
|
|
1422
|
+
}), []), O = H(b);
|
|
1423
|
+
B(() => {
|
|
1424
|
+
O.current !== b && (O.current = b, E({ pagination: D() }));
|
|
1420
1425
|
});
|
|
1421
|
-
let
|
|
1422
|
-
|
|
1423
|
-
}, [
|
|
1424
|
-
|
|
1425
|
-
sorting: c(e,
|
|
1426
|
-
pagination:
|
|
1426
|
+
let k = R((e) => {
|
|
1427
|
+
E({ pagination: c(e, T.current.pagination) });
|
|
1428
|
+
}, [E]), A = R((e) => {
|
|
1429
|
+
E({
|
|
1430
|
+
sorting: c(e, T.current.sorting),
|
|
1431
|
+
pagination: D()
|
|
1427
1432
|
});
|
|
1428
|
-
}, [
|
|
1429
|
-
|
|
1430
|
-
columnFilters: c(e,
|
|
1431
|
-
pagination:
|
|
1433
|
+
}, [E, D]), j = R((e) => {
|
|
1434
|
+
E({
|
|
1435
|
+
columnFilters: c(e, T.current.columnFilters),
|
|
1436
|
+
pagination: D()
|
|
1432
1437
|
});
|
|
1433
|
-
}, [
|
|
1434
|
-
|
|
1435
|
-
globalFilter: c(e,
|
|
1436
|
-
pagination:
|
|
1438
|
+
}, [E, D]), M = R((e) => {
|
|
1439
|
+
E({
|
|
1440
|
+
globalFilter: c(e, T.current.globalFilter),
|
|
1441
|
+
pagination: D()
|
|
1437
1442
|
});
|
|
1438
|
-
}, [
|
|
1439
|
-
|
|
1440
|
-
}, [
|
|
1441
|
-
|
|
1442
|
-
}, [
|
|
1443
|
-
|
|
1444
|
-
}, [
|
|
1443
|
+
}, [E, D]), ie = R((e) => {
|
|
1444
|
+
E({ rowSelection: c(e, T.current.rowSelection) });
|
|
1445
|
+
}, [E]), ae = R((e) => {
|
|
1446
|
+
E({ columnVisibility: c(e, T.current.columnVisibility) });
|
|
1447
|
+
}, [E]), oe = R((e) => {
|
|
1448
|
+
E({ columnPinning: c(e, T.current.columnPinning) });
|
|
1449
|
+
}, [E]), N = je(g), P = N ? "cards" : w.view, F = u({
|
|
1445
1450
|
data: n,
|
|
1446
|
-
|
|
1451
|
+
meta: { viewMode: P },
|
|
1452
|
+
columns: S,
|
|
1447
1453
|
getCoreRowModel: l(),
|
|
1448
1454
|
manualPagination: !0,
|
|
1449
1455
|
manualSorting: !0,
|
|
@@ -1454,77 +1460,77 @@ function vt(e) {
|
|
|
1454
1460
|
enableRowSelection: typeof p == "function" ? (e) => p(e.original) : p ?? !0,
|
|
1455
1461
|
enableGlobalFilter: m,
|
|
1456
1462
|
state: {
|
|
1457
|
-
pagination:
|
|
1458
|
-
sorting:
|
|
1459
|
-
columnFilters:
|
|
1460
|
-
globalFilter:
|
|
1461
|
-
rowSelection:
|
|
1462
|
-
columnVisibility:
|
|
1463
|
-
columnPinning:
|
|
1463
|
+
pagination: w.pagination,
|
|
1464
|
+
sorting: w.sorting,
|
|
1465
|
+
columnFilters: w.columnFilters,
|
|
1466
|
+
globalFilter: w.globalFilter,
|
|
1467
|
+
rowSelection: w.rowSelection,
|
|
1468
|
+
columnVisibility: w.columnVisibility,
|
|
1469
|
+
columnPinning: w.columnPinning
|
|
1464
1470
|
},
|
|
1465
|
-
onPaginationChange:
|
|
1466
|
-
onSortingChange:
|
|
1467
|
-
onColumnFiltersChange:
|
|
1468
|
-
onGlobalFilterChange:
|
|
1469
|
-
onRowSelectionChange:
|
|
1470
|
-
onColumnVisibilityChange:
|
|
1471
|
-
onColumnPinningChange:
|
|
1472
|
-
}), I =
|
|
1473
|
-
pagination:
|
|
1474
|
-
sorting:
|
|
1475
|
-
filters:
|
|
1476
|
-
globalFilter:
|
|
1477
|
-
params:
|
|
1471
|
+
onPaginationChange: k,
|
|
1472
|
+
onSortingChange: A,
|
|
1473
|
+
onColumnFiltersChange: j,
|
|
1474
|
+
onGlobalFilterChange: M,
|
|
1475
|
+
onRowSelectionChange: ie,
|
|
1476
|
+
onColumnVisibilityChange: ae,
|
|
1477
|
+
onColumnPinningChange: oe
|
|
1478
|
+
}), I = V(() => ({
|
|
1479
|
+
pagination: w.pagination,
|
|
1480
|
+
sorting: w.sorting,
|
|
1481
|
+
filters: w.columnFilters,
|
|
1482
|
+
globalFilter: w.globalFilter,
|
|
1483
|
+
params: x
|
|
1478
1484
|
}), [
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
]), L =
|
|
1485
|
+
w.pagination,
|
|
1486
|
+
w.sorting,
|
|
1487
|
+
w.columnFilters,
|
|
1488
|
+
w.globalFilter,
|
|
1489
|
+
b
|
|
1490
|
+
]), L = H(s);
|
|
1485
1491
|
L.current = s;
|
|
1486
|
-
let
|
|
1487
|
-
|
|
1488
|
-
let
|
|
1489
|
-
|
|
1490
|
-
let e =
|
|
1491
|
-
|
|
1492
|
+
let z = H(ht(h));
|
|
1493
|
+
z.current = ht(h);
|
|
1494
|
+
let se = H(null), W = H(void 0);
|
|
1495
|
+
B(() => {
|
|
1496
|
+
let e = se.current, t = e === null, n = !e || e.globalFilter !== I.globalFilter, r = !e || e.filters !== I.filters, i = () => {
|
|
1497
|
+
se.current = I, L.current?.(I);
|
|
1492
1498
|
}, a = 0;
|
|
1493
|
-
n && (a = Math.max(a,
|
|
1499
|
+
n && (a = Math.max(a, z.current.globalFilter)), r && (a = Math.max(a, z.current.columnFilters));
|
|
1494
1500
|
let o = !t && (n || r) && a > 0;
|
|
1495
|
-
return clearTimeout(
|
|
1501
|
+
return clearTimeout(W.current), o ? W.current = setTimeout(i, a) : i(), () => clearTimeout(W.current);
|
|
1496
1502
|
}, [I]);
|
|
1497
|
-
let
|
|
1498
|
-
|
|
1499
|
-
let
|
|
1500
|
-
L.current?.(
|
|
1501
|
-
}, []),
|
|
1503
|
+
let G = H(I);
|
|
1504
|
+
G.current = I;
|
|
1505
|
+
let ce = R(() => {
|
|
1506
|
+
L.current?.(G.current);
|
|
1507
|
+
}, []), K = V(() => ft({
|
|
1502
1508
|
status: i,
|
|
1503
1509
|
error: a,
|
|
1504
1510
|
pageRowCount: n.length,
|
|
1505
|
-
state:
|
|
1511
|
+
state: w
|
|
1506
1512
|
}), [
|
|
1507
1513
|
i,
|
|
1508
1514
|
a,
|
|
1509
1515
|
n.length,
|
|
1510
|
-
|
|
1511
|
-
]),
|
|
1516
|
+
w
|
|
1517
|
+
]), le = R((e) => E({ view: e }), [E]), ue = e.pageSizeOptions ?? pt, q = F.getAllColumns(), de = q.filter((e) => e.getCanSort()), fe = q.filter((e) => e.columnDef.meta?.filter != null), J = R(() => E({ rowSelection: {} }), [E]);
|
|
1512
1518
|
return {
|
|
1513
1519
|
table: F,
|
|
1514
1520
|
request: I,
|
|
1515
|
-
state:
|
|
1516
|
-
view:
|
|
1521
|
+
state: w,
|
|
1522
|
+
view: P,
|
|
1517
1523
|
setView: le,
|
|
1518
|
-
isMobileForced:
|
|
1524
|
+
isMobileForced: N,
|
|
1519
1525
|
status: i,
|
|
1520
1526
|
error: a,
|
|
1521
|
-
renderStatus:
|
|
1522
|
-
refetch:
|
|
1527
|
+
renderStatus: K,
|
|
1528
|
+
refetch: ce,
|
|
1523
1529
|
pageSizeOptions: ue,
|
|
1524
1530
|
sortableColumns: de,
|
|
1525
1531
|
filterableColumns: fe,
|
|
1526
|
-
selection:
|
|
1527
|
-
let e =
|
|
1532
|
+
selection: V(() => {
|
|
1533
|
+
let e = w.rowSelection, t = Object.keys(e).filter((t) => e[t]), r = n.filter((t) => e[o(t)] === !0);
|
|
1528
1534
|
return {
|
|
1529
1535
|
count: t.length,
|
|
1530
1536
|
ids: t,
|
|
@@ -1532,26 +1538,26 @@ function vt(e) {
|
|
|
1532
1538
|
clear: J
|
|
1533
1539
|
};
|
|
1534
1540
|
}, [
|
|
1535
|
-
|
|
1541
|
+
w.rowSelection,
|
|
1536
1542
|
n,
|
|
1537
1543
|
o,
|
|
1538
1544
|
J
|
|
1539
1545
|
]),
|
|
1540
|
-
exportCsv:
|
|
1541
|
-
facets:
|
|
1542
|
-
resetFilter:
|
|
1543
|
-
resetAllFilters:
|
|
1546
|
+
exportCsv: R((e) => ot(F, e), [F]),
|
|
1547
|
+
facets: ee,
|
|
1548
|
+
resetFilter: R((e) => F.getColumn(e)?.setFilterValue(void 0), [F]),
|
|
1549
|
+
resetAllFilters: R(() => F.resetColumnFilters(), [F])
|
|
1544
1550
|
};
|
|
1545
1551
|
}
|
|
1546
1552
|
//#endregion
|
|
1547
1553
|
//#region src/core/useDataViewFetcher.ts
|
|
1548
|
-
function
|
|
1549
|
-
let [r, i] =
|
|
1554
|
+
function bt({ fetcher: e, deps: t, ...n }) {
|
|
1555
|
+
let [r, i] = U({
|
|
1550
1556
|
rows: [],
|
|
1551
1557
|
rowCount: 0
|
|
1552
|
-
}), [a, o] =
|
|
1558
|
+
}), [a, o] = U("idle"), [s, c] = U(void 0), l = H(e);
|
|
1553
1559
|
l.current = e;
|
|
1554
|
-
let u =
|
|
1560
|
+
let u = H(0), d = H(null), f = R(async (e) => {
|
|
1555
1561
|
d.current = e;
|
|
1556
1562
|
let t = ++u.current;
|
|
1557
1563
|
o("loading");
|
|
@@ -1561,10 +1567,10 @@ function yt({ fetcher: e, deps: t, ...n }) {
|
|
|
1561
1567
|
} catch (e) {
|
|
1562
1568
|
t === u.current && (c(e), o("error"));
|
|
1563
1569
|
}
|
|
1564
|
-
}, []), p = t ? JSON.stringify(t) : "", m =
|
|
1565
|
-
return
|
|
1570
|
+
}, []), p = t ? JSON.stringify(t) : "", m = H(p);
|
|
1571
|
+
return B(() => {
|
|
1566
1572
|
m.current !== p && (m.current = p, d.current && f(d.current));
|
|
1567
|
-
}),
|
|
1573
|
+
}), yt({
|
|
1568
1574
|
...n,
|
|
1569
1575
|
rows: r.rows,
|
|
1570
1576
|
rowCount: r.rowCount,
|
|
@@ -1575,6 +1581,6 @@ function yt({ fetcher: e, deps: t, ...n }) {
|
|
|
1575
1581
|
});
|
|
1576
1582
|
}
|
|
1577
1583
|
//#endregion
|
|
1578
|
-
export {
|
|
1584
|
+
export { it as ColumnBuilder, ce as DataBulkActions, me as DataCards, ge as DataPagination, Te as DataTable, Ye as DataToolbar, Z as DataViewer, Be as FilterControl, Ke as ViewSwitcher, at as col, ue as composeCardLayout, a as createColumnHelper, ot as exportCsv, st as getViewMode, K as resolveColumnLabel, yt as useDataView, X as useDataViewContext, bt as useDataViewFetcher };
|
|
1579
1585
|
|
|
1580
1586
|
//# sourceMappingURL=index.js.map
|