@ethanhann/mantine-dataview 0.4.2 → 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 +38 -1
- package/dist/core/colBuilder.d.ts +2 -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 +368 -360
- 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,26 +511,27 @@ 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
|
})
|
|
523
523
|
}) }) });
|
|
524
524
|
}
|
|
525
525
|
function Oe({ header: e, disabled: t }) {
|
|
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;
|
|
527
|
-
return /* @__PURE__ */
|
|
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__ */ P(j.Th, {
|
|
528
528
|
style: {
|
|
529
529
|
...we(n),
|
|
530
|
-
...r ? { textAlign: r } : void 0
|
|
530
|
+
...r ? { textAlign: r } : void 0,
|
|
531
|
+
...u == null ? void 0 : { width: u }
|
|
531
532
|
},
|
|
532
533
|
"aria-sort": i === "asc" ? "ascending" : i === "desc" ? "descending" : void 0,
|
|
533
|
-
children: l ? /* @__PURE__ */
|
|
534
|
+
children: l ? /* @__PURE__ */ F(ae, {
|
|
534
535
|
onClick: n.getToggleSortingHandler(),
|
|
535
536
|
style: {
|
|
536
537
|
display: "inline-flex",
|
|
@@ -540,8 +541,8 @@ function Oe({ header: e, disabled: t }) {
|
|
|
540
541
|
},
|
|
541
542
|
children: [
|
|
542
543
|
c,
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
o && /* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ P(_e, { direction: i }),
|
|
545
|
+
o && /* @__PURE__ */ P("span", {
|
|
545
546
|
role: "note",
|
|
546
547
|
style: {
|
|
547
548
|
fontSize: "0.7em",
|
|
@@ -551,14 +552,14 @@ function Oe({ header: e, disabled: t }) {
|
|
|
551
552
|
children: a + 1
|
|
552
553
|
})
|
|
553
554
|
]
|
|
554
|
-
}) : /* @__PURE__ */
|
|
555
|
+
}) : /* @__PURE__ */ F("span", {
|
|
555
556
|
style: {
|
|
556
557
|
display: "inline-flex",
|
|
557
558
|
alignItems: "center",
|
|
558
559
|
gap: 4,
|
|
559
560
|
...t ? { opacity: .5 } : {}
|
|
560
561
|
},
|
|
561
|
-
children: [c, i && /* @__PURE__ */
|
|
562
|
+
children: [c, i && /* @__PURE__ */ P(_e, { direction: i })]
|
|
562
563
|
})
|
|
563
564
|
});
|
|
564
565
|
}
|
|
@@ -572,7 +573,7 @@ function Ae(e) {
|
|
|
572
573
|
return `(max-width: ${n - (r === "em" || r === "rem" ? .01 : .1)}${r})`;
|
|
573
574
|
}
|
|
574
575
|
function je(e) {
|
|
575
|
-
let t =
|
|
576
|
+
let t = oe(), n = e?.forceCardsBelow, r = n ? t.breakpoints[n] : void 0, i = W(r ? Ae(r) : ke, !1);
|
|
576
577
|
return !!r && !!i;
|
|
577
578
|
}
|
|
578
579
|
//#endregion
|
|
@@ -609,33 +610,33 @@ function Ne(e, t) {
|
|
|
609
610
|
}
|
|
610
611
|
return Me[e];
|
|
611
612
|
}
|
|
612
|
-
function
|
|
613
|
+
function Pe(e, t, n) {
|
|
613
614
|
let r = t ?? n?.[e];
|
|
614
615
|
return r ? typeof r == "function" ? r : Ne(e, r) : Me[e];
|
|
615
616
|
}
|
|
616
617
|
//#endregion
|
|
617
618
|
//#region src/components/DataToolbar/FacetBuckets.tsx
|
|
618
|
-
function
|
|
619
|
+
function Fe({ facet: e, value: t, onChange: n }) {
|
|
619
620
|
let r = Array.isArray(t) ? t : null;
|
|
620
|
-
return /* @__PURE__ */
|
|
621
|
+
return /* @__PURE__ */ P(A, {
|
|
621
622
|
gap: 4,
|
|
622
623
|
children: e.ranges.map((e) => {
|
|
623
624
|
let t = r != null && r[0] === e.from && r[1] === e.to;
|
|
624
|
-
return /* @__PURE__ */
|
|
625
|
+
return /* @__PURE__ */ P(ae, {
|
|
625
626
|
onClick: () => n(t ? void 0 : [e.from, e.to]),
|
|
626
627
|
style: {
|
|
627
628
|
padding: "4px 8px",
|
|
628
629
|
borderRadius: 4,
|
|
629
630
|
background: t ? "var(--mantine-color-blue-light)" : void 0
|
|
630
631
|
},
|
|
631
|
-
children: /* @__PURE__ */
|
|
632
|
+
children: /* @__PURE__ */ F(b, {
|
|
632
633
|
gap: "xs",
|
|
633
634
|
justify: "space-between",
|
|
634
635
|
wrap: "nowrap",
|
|
635
|
-
children: [/* @__PURE__ */
|
|
636
|
+
children: [/* @__PURE__ */ P(M, {
|
|
636
637
|
size: "sm",
|
|
637
638
|
children: e.label
|
|
638
|
-
}), /* @__PURE__ */
|
|
639
|
+
}), /* @__PURE__ */ P(p, {
|
|
639
640
|
size: "sm",
|
|
640
641
|
variant: "light",
|
|
641
642
|
color: e.count === 0 ? "gray" : "blue",
|
|
@@ -648,15 +649,15 @@ function Pe({ facet: e, value: t, onChange: n }) {
|
|
|
648
649
|
}
|
|
649
650
|
//#endregion
|
|
650
651
|
//#region src/components/DataToolbar/FilterControl.tsx
|
|
651
|
-
function
|
|
652
|
-
return /* @__PURE__ */
|
|
652
|
+
function Ie({ label: e, onClear: t }) {
|
|
653
|
+
return /* @__PURE__ */ F(b, {
|
|
653
654
|
justify: "space-between",
|
|
654
655
|
wrap: "nowrap",
|
|
655
|
-
children: [/* @__PURE__ */
|
|
656
|
+
children: [/* @__PURE__ */ P(M, {
|
|
656
657
|
size: "sm",
|
|
657
658
|
fw: 500,
|
|
658
659
|
children: e
|
|
659
|
-
}), /* @__PURE__ */
|
|
660
|
+
}), /* @__PURE__ */ P(f, {
|
|
660
661
|
component: "button",
|
|
661
662
|
type: "button",
|
|
662
663
|
size: "xs",
|
|
@@ -666,28 +667,28 @@ function Fe({ label: e, onClear: t }) {
|
|
|
666
667
|
})]
|
|
667
668
|
});
|
|
668
669
|
}
|
|
669
|
-
function
|
|
670
|
+
function Le(e) {
|
|
670
671
|
return e ? typeof e == "string" ? e : e.toISOString().split("T")[0] ?? null : null;
|
|
671
672
|
}
|
|
672
|
-
function
|
|
673
|
+
function Re(e) {
|
|
673
674
|
return Array.isArray(e) ? [e[0], e[1]] : [null, null];
|
|
674
675
|
}
|
|
675
|
-
function
|
|
676
|
+
function ze(e, t) {
|
|
676
677
|
return e.values.length > 0 ? e.values.map((e) => ({
|
|
677
678
|
value: e.value,
|
|
678
679
|
label: `${e.label ?? e.value} (${e.count})`,
|
|
679
680
|
disabled: e.count === 0
|
|
680
681
|
})) : t ?? [];
|
|
681
682
|
}
|
|
682
|
-
function
|
|
683
|
+
function Be({ column: e, facet: t }) {
|
|
683
684
|
let n = e.columnDef.meta?.filter;
|
|
684
685
|
if (!n) return null;
|
|
685
686
|
let r = K(e), i = n.placeholder ?? r, a = e.getFilterValue(), o = (t) => e.setFilterValue(t);
|
|
686
687
|
if (n.component) {
|
|
687
688
|
let t = n.component;
|
|
688
|
-
return /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
689
690
|
label: r,
|
|
690
|
-
children: /* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ P(t, {
|
|
691
692
|
value: a,
|
|
692
693
|
onChange: o,
|
|
693
694
|
column: e
|
|
@@ -696,26 +697,26 @@ function ze({ column: e, facet: t }) {
|
|
|
696
697
|
}
|
|
697
698
|
let s = t?.type === "values" ? t : void 0, c = t?.type === "ranges" ? t : void 0;
|
|
698
699
|
switch (n.variant) {
|
|
699
|
-
case "select": return /* @__PURE__ */
|
|
700
|
+
case "select": return /* @__PURE__ */ P(D, {
|
|
700
701
|
label: r,
|
|
701
702
|
placeholder: i,
|
|
702
703
|
clearable: !0,
|
|
703
|
-
data: s ?
|
|
704
|
+
data: s ? ze(s, n.options) : n.options ?? [],
|
|
704
705
|
value: a ?? null,
|
|
705
706
|
onChange: (e) => o(e ?? void 0)
|
|
706
707
|
});
|
|
707
|
-
case "multiselect": return /* @__PURE__ */
|
|
708
|
+
case "multiselect": return /* @__PURE__ */ P(te, {
|
|
708
709
|
label: r,
|
|
709
710
|
placeholder: i,
|
|
710
|
-
data: s ?
|
|
711
|
+
data: s ? ze(s, n.options) : n.options ?? [],
|
|
711
712
|
value: a ?? [],
|
|
712
713
|
onChange: (e) => o(e.length > 0 ? e : void 0)
|
|
713
714
|
});
|
|
714
715
|
case "boolean": {
|
|
715
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";
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
717
718
|
label: r,
|
|
718
|
-
children: /* @__PURE__ */
|
|
719
|
+
children: /* @__PURE__ */ P(E, {
|
|
719
720
|
fullWidth: !0,
|
|
720
721
|
size: "xs",
|
|
721
722
|
data: [
|
|
@@ -740,21 +741,21 @@ function ze({ column: e, facet: t }) {
|
|
|
740
741
|
});
|
|
741
742
|
}
|
|
742
743
|
case "numberRange": {
|
|
743
|
-
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, {
|
|
744
745
|
facet: c,
|
|
745
746
|
value: a,
|
|
746
747
|
onChange: o
|
|
747
|
-
}) : null, p = d ? /* @__PURE__ */
|
|
748
|
+
}) : null, p = d ? /* @__PURE__ */ P(Ie, {
|
|
748
749
|
label: r,
|
|
749
750
|
onClear: () => o(void 0)
|
|
750
751
|
}) : r;
|
|
751
752
|
if (u) {
|
|
752
|
-
let a = [t ?? s, i ?? l], c = e.columnDef.meta?.dataType, u = c ?
|
|
753
|
-
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, {
|
|
754
755
|
label: p,
|
|
755
|
-
children: /* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ F(A, {
|
|
756
757
|
gap: "xs",
|
|
757
|
-
children: [f, /* @__PURE__ */
|
|
758
|
+
children: [f, /* @__PURE__ */ P(T, {
|
|
758
759
|
min: s,
|
|
759
760
|
max: l,
|
|
760
761
|
step: n.step ?? 1,
|
|
@@ -769,23 +770,23 @@ function ze({ column: e, facet: t }) {
|
|
|
769
770
|
})
|
|
770
771
|
});
|
|
771
772
|
}
|
|
772
|
-
if (f) return /* @__PURE__ */
|
|
773
|
+
if (f) return /* @__PURE__ */ P(x.Wrapper, {
|
|
773
774
|
label: p,
|
|
774
775
|
children: f
|
|
775
776
|
});
|
|
776
777
|
let m = (e) => o(e[0] == null && e[1] == null ? void 0 : e), h = (e) => e === "" || e == null ? null : Number(e);
|
|
777
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
778
779
|
label: r,
|
|
779
|
-
children: /* @__PURE__ */
|
|
780
|
+
children: /* @__PURE__ */ F(b, {
|
|
780
781
|
gap: 4,
|
|
781
782
|
wrap: "nowrap",
|
|
782
|
-
children: [/* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ P(C, {
|
|
783
784
|
"aria-label": `${r} minimum`,
|
|
784
785
|
placeholder: "Min",
|
|
785
786
|
value: t ?? "",
|
|
786
787
|
onChange: (e) => m([h(e), i]),
|
|
787
788
|
w: 90
|
|
788
|
-
}), /* @__PURE__ */
|
|
789
|
+
}), /* @__PURE__ */ P(C, {
|
|
789
790
|
"aria-label": `${r} maximum`,
|
|
790
791
|
placeholder: "Max",
|
|
791
792
|
value: i ?? "",
|
|
@@ -795,42 +796,42 @@ function ze({ column: e, facet: t }) {
|
|
|
795
796
|
})
|
|
796
797
|
});
|
|
797
798
|
}
|
|
798
|
-
case "date": return /* @__PURE__ */
|
|
799
|
+
case "date": return /* @__PURE__ */ P(G, {
|
|
799
800
|
label: r,
|
|
800
801
|
placeholder: i,
|
|
801
802
|
clearable: !0,
|
|
802
803
|
popoverProps: { withinPortal: !1 },
|
|
803
804
|
value: a ? new Date(a) : null,
|
|
804
|
-
onChange: (e) => o(
|
|
805
|
+
onChange: (e) => o(Le(e) ?? void 0)
|
|
805
806
|
});
|
|
806
807
|
case "dateRange": {
|
|
807
|
-
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, {
|
|
808
809
|
label: r,
|
|
809
810
|
onClear: () => o(void 0)
|
|
810
811
|
});
|
|
811
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ P(x.Wrapper, {
|
|
812
813
|
label: s,
|
|
813
|
-
children: /* @__PURE__ */
|
|
814
|
+
children: /* @__PURE__ */ F(A, {
|
|
814
815
|
gap: "xs",
|
|
815
|
-
children: [c && /* @__PURE__ */
|
|
816
|
+
children: [c && /* @__PURE__ */ P(Fe, {
|
|
816
817
|
facet: c,
|
|
817
818
|
value: a,
|
|
818
819
|
onChange: o
|
|
819
|
-
}), /* @__PURE__ */
|
|
820
|
+
}), /* @__PURE__ */ P(G, {
|
|
820
821
|
type: "range",
|
|
821
822
|
popoverProps: { withinPortal: !1 },
|
|
822
823
|
placeholder: i,
|
|
823
824
|
clearable: !0,
|
|
824
825
|
value: n,
|
|
825
826
|
onChange: ([e, t]) => {
|
|
826
|
-
let n =
|
|
827
|
+
let n = Le(e), r = Le(t);
|
|
827
828
|
o(n == null && r == null ? void 0 : [n, r]);
|
|
828
829
|
}
|
|
829
830
|
})]
|
|
830
831
|
})
|
|
831
832
|
});
|
|
832
833
|
}
|
|
833
|
-
default: return /* @__PURE__ */
|
|
834
|
+
default: return /* @__PURE__ */ P(ie, {
|
|
834
835
|
label: r,
|
|
835
836
|
placeholder: i,
|
|
836
837
|
value: a ?? "",
|
|
@@ -840,59 +841,59 @@ function ze({ column: e, facet: t }) {
|
|
|
840
841
|
}
|
|
841
842
|
//#endregion
|
|
842
843
|
//#region src/components/DataToolbar/FilterControls.tsx
|
|
843
|
-
function
|
|
844
|
-
return e.state.columnFilters.length > 0 ? /* @__PURE__ */
|
|
844
|
+
function Ve({ view: e }) {
|
|
845
|
+
return e.state.columnFilters.length > 0 ? /* @__PURE__ */ P(h, {
|
|
845
846
|
variant: "subtle",
|
|
846
847
|
size: "compact-sm",
|
|
847
848
|
color: "gray",
|
|
848
|
-
leftSection: /* @__PURE__ */
|
|
849
|
+
leftSection: /* @__PURE__ */ P(xe, {}),
|
|
849
850
|
onClick: () => e.table.resetColumnFilters(),
|
|
850
851
|
children: "Reset filters"
|
|
851
852
|
}) : null;
|
|
852
853
|
}
|
|
853
|
-
function
|
|
854
|
+
function He(e) {
|
|
854
855
|
return e > 0 ? `Filters (${e})` : "Filters";
|
|
855
856
|
}
|
|
856
|
-
function
|
|
857
|
-
return /* @__PURE__ */
|
|
857
|
+
function Ue({ view: e, controls: t }) {
|
|
858
|
+
return /* @__PURE__ */ F(A, {
|
|
858
859
|
gap: "sm",
|
|
859
860
|
style: { minWidth: 240 },
|
|
860
|
-
children: [t, /* @__PURE__ */
|
|
861
|
+
children: [t, /* @__PURE__ */ P(b, {
|
|
861
862
|
justify: "flex-end",
|
|
862
|
-
children: /* @__PURE__ */
|
|
863
|
+
children: /* @__PURE__ */ P(Ve, { view: e })
|
|
863
864
|
})]
|
|
864
865
|
});
|
|
865
866
|
}
|
|
866
|
-
function
|
|
867
|
-
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);
|
|
868
869
|
if (n.length === 0) return null;
|
|
869
|
-
let s = n.map((t) => /* @__PURE__ */
|
|
870
|
+
let s = n.map((t) => /* @__PURE__ */ P(Be, {
|
|
870
871
|
column: t,
|
|
871
872
|
facet: e.facets[t.id]
|
|
872
873
|
}, t.id)), c = e.state.columnFilters.length;
|
|
873
|
-
return r ? /* @__PURE__ */
|
|
874
|
+
return r ? /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(h, {
|
|
874
875
|
variant: "default",
|
|
875
|
-
leftSection: /* @__PURE__ */
|
|
876
|
+
leftSection: /* @__PURE__ */ P(ye, {}),
|
|
876
877
|
onClick: a,
|
|
877
|
-
children:
|
|
878
|
-
}), /* @__PURE__ */
|
|
878
|
+
children: He(c)
|
|
879
|
+
}), /* @__PURE__ */ P(ee, {
|
|
879
880
|
opened: i,
|
|
880
881
|
onClose: o,
|
|
881
882
|
title: "Filters",
|
|
882
883
|
position: "bottom",
|
|
883
884
|
size: "auto",
|
|
884
|
-
children: /* @__PURE__ */
|
|
885
|
+
children: /* @__PURE__ */ P(Ue, {
|
|
885
886
|
view: e,
|
|
886
887
|
controls: s
|
|
887
888
|
})
|
|
888
|
-
})] }) : n.length <= t ? /* @__PURE__ */
|
|
889
|
+
})] }) : n.length <= t ? /* @__PURE__ */ F(N, { children: [s, /* @__PURE__ */ P(Ve, { view: e })] }) : /* @__PURE__ */ F(w, {
|
|
889
890
|
position: "bottom-start",
|
|
890
891
|
closeOnClickOutside: !1,
|
|
891
|
-
children: [/* @__PURE__ */
|
|
892
|
+
children: [/* @__PURE__ */ P(w.Target, { children: /* @__PURE__ */ P(h, {
|
|
892
893
|
variant: "default",
|
|
893
|
-
leftSection: /* @__PURE__ */
|
|
894
|
-
children:
|
|
895
|
-
}) }), /* @__PURE__ */
|
|
894
|
+
leftSection: /* @__PURE__ */ P(ye, {}),
|
|
895
|
+
children: He(c)
|
|
896
|
+
}) }), /* @__PURE__ */ P(w.Dropdown, { children: /* @__PURE__ */ P(Ue, {
|
|
896
897
|
view: e,
|
|
897
898
|
controls: s
|
|
898
899
|
}) })]
|
|
@@ -900,12 +901,12 @@ function Ue({ view: e, inlineThreshold: t }) {
|
|
|
900
901
|
}
|
|
901
902
|
//#endregion
|
|
902
903
|
//#region src/components/DataToolbar/SortControl.tsx
|
|
903
|
-
function
|
|
904
|
+
function Ge({ view: e }) {
|
|
904
905
|
let { sortableColumns: t, state: n, table: r } = e, i = n.sorting[0];
|
|
905
|
-
return /* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */ F(b, {
|
|
906
907
|
gap: 4,
|
|
907
908
|
wrap: "nowrap",
|
|
908
|
-
children: [/* @__PURE__ */
|
|
909
|
+
children: [/* @__PURE__ */ P(D, {
|
|
909
910
|
"aria-label": "Sort by",
|
|
910
911
|
placeholder: "Sort by",
|
|
911
912
|
clearable: !0,
|
|
@@ -918,7 +919,7 @@ function We({ view: e }) {
|
|
|
918
919
|
id: e,
|
|
919
920
|
desc: i?.desc ?? !1
|
|
920
921
|
}] : [])
|
|
921
|
-
}), /* @__PURE__ */
|
|
922
|
+
}), /* @__PURE__ */ P(d, {
|
|
922
923
|
"aria-label": "Toggle sort direction",
|
|
923
924
|
variant: "default",
|
|
924
925
|
size: "lg",
|
|
@@ -927,14 +928,14 @@ function We({ view: e }) {
|
|
|
927
928
|
id: i.id,
|
|
928
929
|
desc: !i.desc
|
|
929
930
|
}]),
|
|
930
|
-
children: /* @__PURE__ */
|
|
931
|
+
children: /* @__PURE__ */ P(_e, { direction: i ? i.desc ? "desc" : "asc" : !1 })
|
|
931
932
|
})]
|
|
932
933
|
});
|
|
933
934
|
}
|
|
934
935
|
//#endregion
|
|
935
936
|
//#region src/components/DataToolbar/ViewSwitcher.tsx
|
|
936
|
-
function
|
|
937
|
-
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, {
|
|
938
939
|
"aria-label": "View",
|
|
939
940
|
value: e.view,
|
|
940
941
|
disabled: e.isMobileForced,
|
|
@@ -952,81 +953,81 @@ function Ge({ view: e, lockSwitcherOnMobile: t, tableLabel: n = "Table", cardsLa
|
|
|
952
953
|
}
|
|
953
954
|
//#endregion
|
|
954
955
|
//#region src/components/DataToolbar/VisibilityMenu.tsx
|
|
955
|
-
function
|
|
956
|
+
function qe({ column: e }) {
|
|
956
957
|
if (!e.getCanPin()) return null;
|
|
957
958
|
let t = e.getIsPinned();
|
|
958
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ F(b, {
|
|
959
960
|
gap: 2,
|
|
960
|
-
children: [/* @__PURE__ */
|
|
961
|
+
children: [/* @__PURE__ */ P(d, {
|
|
961
962
|
size: "xs",
|
|
962
963
|
variant: t === "left" ? "filled" : "subtle",
|
|
963
964
|
color: t === "left" ? "blue" : "gray",
|
|
964
965
|
"aria-label": `Pin ${K(e)} left`,
|
|
965
966
|
onClick: () => e.pin(t === "left" ? !1 : "left"),
|
|
966
|
-
children: /* @__PURE__ */
|
|
967
|
-
}), /* @__PURE__ */
|
|
967
|
+
children: /* @__PURE__ */ P(Se, {})
|
|
968
|
+
}), /* @__PURE__ */ P(d, {
|
|
968
969
|
size: "xs",
|
|
969
970
|
variant: t === "right" ? "filled" : "subtle",
|
|
970
971
|
color: t === "right" ? "blue" : "gray",
|
|
971
972
|
"aria-label": `Pin ${K(e)} right`,
|
|
972
973
|
onClick: () => e.pin(t === "right" ? !1 : "right"),
|
|
973
|
-
children: /* @__PURE__ */
|
|
974
|
+
children: /* @__PURE__ */ P(Ce, {})
|
|
974
975
|
})]
|
|
975
976
|
});
|
|
976
977
|
}
|
|
977
|
-
function
|
|
978
|
+
function Je({ view: e }) {
|
|
978
979
|
let t = e.table.getAllLeafColumns().filter((e) => e.getCanHide());
|
|
979
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
|
980
|
+
return t.length === 0 ? null : /* @__PURE__ */ F(S, {
|
|
980
981
|
closeOnItemClick: !1,
|
|
981
982
|
withinPortal: !0,
|
|
982
983
|
position: "bottom-end",
|
|
983
|
-
children: [/* @__PURE__ */
|
|
984
|
+
children: [/* @__PURE__ */ P(S.Target, { children: /* @__PURE__ */ P(h, {
|
|
984
985
|
variant: "default",
|
|
985
|
-
rightSection: /* @__PURE__ */
|
|
986
|
+
rightSection: /* @__PURE__ */ P(be, {}),
|
|
986
987
|
children: "Columns"
|
|
987
|
-
}) }), /* @__PURE__ */
|
|
988
|
+
}) }), /* @__PURE__ */ P(S.Dropdown, { children: /* @__PURE__ */ P(A, {
|
|
988
989
|
gap: "xs",
|
|
989
990
|
p: "xs",
|
|
990
|
-
children: t.map((e) => /* @__PURE__ */
|
|
991
|
+
children: t.map((e) => /* @__PURE__ */ F(b, {
|
|
991
992
|
gap: "xs",
|
|
992
993
|
justify: "space-between",
|
|
993
994
|
wrap: "nowrap",
|
|
994
|
-
children: [/* @__PURE__ */
|
|
995
|
+
children: [/* @__PURE__ */ P(v, {
|
|
995
996
|
label: K(e),
|
|
996
997
|
checked: e.getIsVisible(),
|
|
997
998
|
onChange: (t) => e.toggleVisibility(t.currentTarget.checked)
|
|
998
|
-
}), /* @__PURE__ */
|
|
999
|
+
}), /* @__PURE__ */ P(qe, { column: e })]
|
|
999
1000
|
}, e.id))
|
|
1000
1001
|
}) })]
|
|
1001
1002
|
});
|
|
1002
1003
|
}
|
|
1003
1004
|
//#endregion
|
|
1004
1005
|
//#region src/components/DataToolbar/DataToolbar.tsx
|
|
1005
|
-
function
|
|
1006
|
-
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,
|
|
1007
|
-
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, {
|
|
1008
1009
|
justify: "space-between",
|
|
1009
1010
|
wrap: "wrap",
|
|
1010
1011
|
gap: "sm",
|
|
1011
1012
|
...f,
|
|
1012
|
-
children: [/* @__PURE__ */
|
|
1013
|
+
children: [/* @__PURE__ */ F(b, {
|
|
1013
1014
|
wrap: "wrap",
|
|
1014
1015
|
gap: "sm",
|
|
1015
1016
|
children: [
|
|
1016
1017
|
u,
|
|
1017
|
-
g && /* @__PURE__ */
|
|
1018
|
+
g && /* @__PURE__ */ P(ie, {
|
|
1018
1019
|
"aria-label": "Search",
|
|
1019
1020
|
placeholder: t,
|
|
1020
|
-
leftSection: /* @__PURE__ */
|
|
1021
|
+
leftSection: /* @__PURE__ */ P(ve, {}),
|
|
1021
1022
|
value: m.globalFilter,
|
|
1022
1023
|
onChange: (e) => p.setGlobalFilter(e.currentTarget.value),
|
|
1023
|
-
rightSection: m.globalFilter ? /* @__PURE__ */
|
|
1024
|
+
rightSection: m.globalFilter ? /* @__PURE__ */ P(y, {
|
|
1024
1025
|
size: "sm",
|
|
1025
1026
|
"aria-label": "Clear search",
|
|
1026
1027
|
onClick: () => p.setGlobalFilter("")
|
|
1027
1028
|
}) : void 0
|
|
1028
1029
|
}),
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ F("fieldset", {
|
|
1030
1031
|
disabled: h,
|
|
1031
1032
|
style: {
|
|
1032
1033
|
display: "contents",
|
|
@@ -1034,13 +1035,13 @@ function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1034
1035
|
padding: 0,
|
|
1035
1036
|
margin: 0
|
|
1036
1037
|
},
|
|
1037
|
-
children: [_ && /* @__PURE__ */
|
|
1038
|
+
children: [_ && /* @__PURE__ */ P(We, {
|
|
1038
1039
|
view: e,
|
|
1039
1040
|
inlineThreshold: n
|
|
1040
|
-
}), v && /* @__PURE__ */
|
|
1041
|
+
}), v && /* @__PURE__ */ P(Ge, { view: e })]
|
|
1041
1042
|
})
|
|
1042
1043
|
]
|
|
1043
|
-
}), /* @__PURE__ */
|
|
1044
|
+
}), /* @__PURE__ */ P("fieldset", {
|
|
1044
1045
|
disabled: h,
|
|
1045
1046
|
style: {
|
|
1046
1047
|
display: "contents",
|
|
@@ -1048,12 +1049,12 @@ function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1048
1049
|
padding: 0,
|
|
1049
1050
|
margin: 0
|
|
1050
1051
|
},
|
|
1051
|
-
children: /* @__PURE__ */
|
|
1052
|
+
children: /* @__PURE__ */ F(b, {
|
|
1052
1053
|
wrap: "wrap",
|
|
1053
1054
|
gap: "sm",
|
|
1054
1055
|
children: [
|
|
1055
|
-
|
|
1056
|
-
|
|
1056
|
+
ee && /* @__PURE__ */ P(Je, { view: e }),
|
|
1057
|
+
x && /* @__PURE__ */ P(Ke, {
|
|
1057
1058
|
view: e,
|
|
1058
1059
|
lockSwitcherOnMobile: r
|
|
1059
1060
|
}),
|
|
@@ -1065,17 +1066,17 @@ function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1065
1066
|
}
|
|
1066
1067
|
//#endregion
|
|
1067
1068
|
//#region src/components/DataViewer/context.tsx
|
|
1068
|
-
var
|
|
1069
|
-
function
|
|
1070
|
-
let e =
|
|
1069
|
+
var Xe = L(null), Ze = Xe.Provider;
|
|
1070
|
+
function X() {
|
|
1071
|
+
let e = z(Xe);
|
|
1071
1072
|
if (!e) throw Error("DataViewer.Toolbar / DataViewer.Body / DataViewer.Pagination must be rendered inside <DataViewer>.");
|
|
1072
1073
|
return e;
|
|
1073
1074
|
}
|
|
1074
1075
|
//#endregion
|
|
1075
1076
|
//#region src/components/DataViewer/DataViewer.tsx
|
|
1076
|
-
function
|
|
1077
|
-
return /* @__PURE__ */
|
|
1078
|
-
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(() => ({
|
|
1079
1080
|
view: e,
|
|
1080
1081
|
slots: t,
|
|
1081
1082
|
renderCard: n,
|
|
@@ -1090,63 +1091,63 @@ function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMo
|
|
|
1090
1091
|
i,
|
|
1091
1092
|
a
|
|
1092
1093
|
]),
|
|
1093
|
-
children: /* @__PURE__ */
|
|
1094
|
+
children: /* @__PURE__ */ P(A, {
|
|
1094
1095
|
...s,
|
|
1095
|
-
children: o ?? /* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1096
|
+
children: o ?? /* @__PURE__ */ F(N, { children: [
|
|
1097
|
+
/* @__PURE__ */ P(Qe, {}),
|
|
1098
|
+
/* @__PURE__ */ P(tt, {}),
|
|
1099
|
+
/* @__PURE__ */ P($e, {}),
|
|
1100
|
+
/* @__PURE__ */ P(et, {})
|
|
1100
1101
|
] })
|
|
1101
1102
|
})
|
|
1102
1103
|
});
|
|
1103
1104
|
}
|
|
1104
|
-
function
|
|
1105
|
-
let { view: t, lockSwitcherOnMobile: n } =
|
|
1106
|
-
return /* @__PURE__ */
|
|
1105
|
+
function Qe(e) {
|
|
1106
|
+
let { view: t, lockSwitcherOnMobile: n } = X();
|
|
1107
|
+
return /* @__PURE__ */ P(Ye, {
|
|
1107
1108
|
view: t,
|
|
1108
1109
|
lockSwitcherOnMobile: n,
|
|
1109
1110
|
...e
|
|
1110
1111
|
});
|
|
1111
1112
|
}
|
|
1112
|
-
function
|
|
1113
|
-
let { view: n, slots: r, renderCard: i, fallbackRole: a, animateRows: o } =
|
|
1114
|
-
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, {
|
|
1115
1116
|
view: n,
|
|
1116
1117
|
slots: r,
|
|
1117
1118
|
renderCard: i,
|
|
1118
1119
|
fallbackRole: a,
|
|
1119
1120
|
animateRows: o,
|
|
1120
1121
|
...t
|
|
1121
|
-
}) : /* @__PURE__ */
|
|
1122
|
+
}) : /* @__PURE__ */ P(Te, {
|
|
1122
1123
|
view: n,
|
|
1123
1124
|
slots: r,
|
|
1124
1125
|
animateRows: o,
|
|
1125
1126
|
...e
|
|
1126
1127
|
});
|
|
1127
1128
|
}
|
|
1128
|
-
function
|
|
1129
|
-
let { view: t } =
|
|
1130
|
-
return /* @__PURE__ */
|
|
1129
|
+
function et(e) {
|
|
1130
|
+
let { view: t } = X();
|
|
1131
|
+
return /* @__PURE__ */ P(ge, {
|
|
1131
1132
|
view: t,
|
|
1132
1133
|
...e
|
|
1133
1134
|
});
|
|
1134
1135
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let { view: t, slots: n } =
|
|
1137
|
-
return /* @__PURE__ */
|
|
1136
|
+
function tt(e) {
|
|
1137
|
+
let { view: t, slots: n } = X();
|
|
1138
|
+
return /* @__PURE__ */ P(ce, {
|
|
1138
1139
|
view: t,
|
|
1139
1140
|
slots: n,
|
|
1140
1141
|
...e
|
|
1141
1142
|
});
|
|
1142
1143
|
}
|
|
1143
|
-
|
|
1144
|
+
Z.Toolbar = Qe, Z.BulkActions = tt, Z.Body = $e, Z.Pagination = et;
|
|
1144
1145
|
//#endregion
|
|
1145
1146
|
//#region src/core/colBuilder.ts
|
|
1146
|
-
function
|
|
1147
|
+
function nt(e) {
|
|
1147
1148
|
return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
1148
1149
|
}
|
|
1149
|
-
var
|
|
1150
|
+
var rt = {
|
|
1150
1151
|
text: {
|
|
1151
1152
|
dataType: "text",
|
|
1152
1153
|
filterVariant: "text"
|
|
@@ -1171,13 +1172,13 @@ var nt = {
|
|
|
1171
1172
|
},
|
|
1172
1173
|
select: { filterVariant: "select" },
|
|
1173
1174
|
multiselect: { filterVariant: "multiselect" }
|
|
1174
|
-
},
|
|
1175
|
+
}, it = class {
|
|
1175
1176
|
cols = [];
|
|
1176
1177
|
helper = o();
|
|
1177
1178
|
add(e, t, n) {
|
|
1178
|
-
let r =
|
|
1179
|
+
let r = rt[e];
|
|
1179
1180
|
if (!r) throw Error(`Unknown preset: ${e}`);
|
|
1180
|
-
let i = n?.header ??
|
|
1181
|
+
let i = n?.header ?? nt(t), a = n?.align ?? r.align, o;
|
|
1181
1182
|
if (n?.filter === !1) o = void 0;
|
|
1182
1183
|
else {
|
|
1183
1184
|
let e = {
|
|
@@ -1193,6 +1194,7 @@ var nt = {
|
|
|
1193
1194
|
header: i,
|
|
1194
1195
|
...n?.cell ? { cell: n.cell } : {},
|
|
1195
1196
|
...n?.enableSorting === !1 ? { enableSorting: !1 } : {},
|
|
1197
|
+
...n?.width == null ? {} : { size: n.width },
|
|
1196
1198
|
meta: {
|
|
1197
1199
|
label: i,
|
|
1198
1200
|
...r.dataType ? { dataType: r.dataType } : {},
|
|
@@ -1235,25 +1237,30 @@ var nt = {
|
|
|
1235
1237
|
return this.cols;
|
|
1236
1238
|
}
|
|
1237
1239
|
};
|
|
1238
|
-
function
|
|
1239
|
-
return new
|
|
1240
|
+
function at() {
|
|
1241
|
+
return new it();
|
|
1240
1242
|
}
|
|
1241
1243
|
//#endregion
|
|
1242
1244
|
//#region src/core/exportCsv.ts
|
|
1243
|
-
function
|
|
1245
|
+
function Q(e) {
|
|
1244
1246
|
let t = e == null ? "" : String(e);
|
|
1245
1247
|
return t.includes(",") || t.includes("\"") || t.includes("\n") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1246
1248
|
}
|
|
1247
1249
|
function ot(e, t) {
|
|
1248
|
-
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) => {
|
|
1249
1251
|
let n = e.getAllCells().find((e) => e.column.id === t.id)?.getValue();
|
|
1250
|
-
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);
|
|
1251
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");
|
|
1252
1254
|
u.href = l, u.download = n, u.click(), URL.revokeObjectURL(l);
|
|
1253
1255
|
}
|
|
1254
1256
|
//#endregion
|
|
1255
|
-
//#region src/
|
|
1257
|
+
//#region src/core/getViewMode.ts
|
|
1256
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) {
|
|
1257
1264
|
return e ? {
|
|
1258
1265
|
adapter: e.adapter,
|
|
1259
1266
|
serializer: {
|
|
@@ -1263,7 +1270,7 @@ function st(e) {
|
|
|
1263
1270
|
include: r(e.include)
|
|
1264
1271
|
} : null;
|
|
1265
1272
|
}
|
|
1266
|
-
function
|
|
1273
|
+
function lt(e, t, r) {
|
|
1267
1274
|
if (!e) return {};
|
|
1268
1275
|
try {
|
|
1269
1276
|
return n(e.adapter.read(), {
|
|
@@ -1276,21 +1283,21 @@ function ct(e, t, r) {
|
|
|
1276
1283
|
return {};
|
|
1277
1284
|
}
|
|
1278
1285
|
}
|
|
1279
|
-
function
|
|
1280
|
-
let s =
|
|
1286
|
+
function ut({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
1287
|
+
let s = H(i);
|
|
1281
1288
|
s.current = i;
|
|
1282
|
-
let c =
|
|
1289
|
+
let c = H(a);
|
|
1283
1290
|
c.current = a;
|
|
1284
|
-
let l =
|
|
1291
|
+
let l = H(o);
|
|
1285
1292
|
l.current = o;
|
|
1286
|
-
let u =
|
|
1293
|
+
let u = H(r);
|
|
1287
1294
|
u.current = r;
|
|
1288
1295
|
let d = r ? t(i, {
|
|
1289
1296
|
serializer: r.serializer,
|
|
1290
1297
|
include: r.include,
|
|
1291
1298
|
getFilterMeta: o
|
|
1292
1299
|
}) : null;
|
|
1293
|
-
|
|
1300
|
+
B(() => {
|
|
1294
1301
|
let t = u.current;
|
|
1295
1302
|
if (!t || !d) return;
|
|
1296
1303
|
let n = e(t.adapter.read(), t.serializer, t.include);
|
|
@@ -1298,7 +1305,7 @@ function lt({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1298
1305
|
...n,
|
|
1299
1306
|
...d
|
|
1300
1307
|
}, { replace: !0 });
|
|
1301
|
-
}, [d ? JSON.stringify(d) : ""]),
|
|
1308
|
+
}, [d ? JSON.stringify(d) : ""]), B(() => {
|
|
1302
1309
|
if (!r) return;
|
|
1303
1310
|
let { adapter: e, serializer: t, include: i } = r;
|
|
1304
1311
|
return e.subscribe?.(() => {
|
|
@@ -1314,24 +1321,24 @@ function lt({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1314
1321
|
}
|
|
1315
1322
|
//#endregion
|
|
1316
1323
|
//#region src/core/resolveStatus.ts
|
|
1317
|
-
function
|
|
1324
|
+
function dt(e) {
|
|
1318
1325
|
return e.columnFilters.length > 0 || e.globalFilter.trim() !== "";
|
|
1319
1326
|
}
|
|
1320
|
-
function
|
|
1327
|
+
function ft({ status: e, error: t, pageRowCount: n, state: r }) {
|
|
1321
1328
|
return e === "error" ? {
|
|
1322
1329
|
phase: "error",
|
|
1323
1330
|
error: t
|
|
1324
|
-
} : 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" };
|
|
1325
1332
|
}
|
|
1326
1333
|
//#endregion
|
|
1327
1334
|
//#region src/core/useDataView.ts
|
|
1328
|
-
var $ = 300,
|
|
1335
|
+
var $ = 300, pt = [
|
|
1329
1336
|
10,
|
|
1330
1337
|
25,
|
|
1331
1338
|
50,
|
|
1332
1339
|
100
|
|
1333
|
-
],
|
|
1334
|
-
function
|
|
1340
|
+
], mt = 10;
|
|
1341
|
+
function ht(e) {
|
|
1335
1342
|
return e == null ? {
|
|
1336
1343
|
globalFilter: $,
|
|
1337
1344
|
columnFilters: $
|
|
@@ -1343,23 +1350,23 @@ function mt(e) {
|
|
|
1343
1350
|
columnFilters: e.columnFilters ?? $
|
|
1344
1351
|
};
|
|
1345
1352
|
}
|
|
1346
|
-
function
|
|
1353
|
+
function gt(e) {
|
|
1347
1354
|
if (e.id) return e.id;
|
|
1348
1355
|
if ("accessorKey" in e && e.accessorKey != null) return String(e.accessorKey);
|
|
1349
1356
|
}
|
|
1350
|
-
function
|
|
1357
|
+
function _t(e) {
|
|
1351
1358
|
let t = /* @__PURE__ */ new Map();
|
|
1352
1359
|
for (let n of e) {
|
|
1353
|
-
let e =
|
|
1360
|
+
let e = gt(n), r = n.meta?.filter;
|
|
1354
1361
|
e && r && t.set(e, r);
|
|
1355
1362
|
}
|
|
1356
1363
|
return (e) => t.get(e);
|
|
1357
1364
|
}
|
|
1358
|
-
function
|
|
1365
|
+
function vt(e) {
|
|
1359
1366
|
return {
|
|
1360
1367
|
pagination: {
|
|
1361
1368
|
pageIndex: 0,
|
|
1362
|
-
pageSize: e.pageSizeOptions?.[0] ??
|
|
1369
|
+
pageSize: e.pageSizeOptions?.[0] ?? mt
|
|
1363
1370
|
},
|
|
1364
1371
|
sorting: [],
|
|
1365
1372
|
columnFilters: [],
|
|
@@ -1374,74 +1381,75 @@ function _t(e) {
|
|
|
1374
1381
|
...e.initialState
|
|
1375
1382
|
};
|
|
1376
1383
|
}
|
|
1377
|
-
function
|
|
1378
|
-
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) => {
|
|
1379
1386
|
let t = e.meta?.dataType;
|
|
1380
1387
|
if (!t || e.cell) return e;
|
|
1381
|
-
let n =
|
|
1388
|
+
let n = Pe(t, e.meta?.format, _);
|
|
1382
1389
|
return {
|
|
1383
1390
|
...e,
|
|
1384
1391
|
cell: (e) => n(e.getValue())
|
|
1385
1392
|
};
|
|
1386
|
-
}), [t, _]),
|
|
1387
|
-
let t =
|
|
1393
|
+
}), [t, _]), te = V(() => _t(S), [S]), C = V(() => ct(e.urlSync), [e.urlSync]), [ne, re] = U(() => {
|
|
1394
|
+
let t = vt(e);
|
|
1388
1395
|
return {
|
|
1389
1396
|
...t,
|
|
1390
|
-
...
|
|
1397
|
+
...lt(C, t, te)
|
|
1391
1398
|
};
|
|
1392
|
-
}),
|
|
1393
|
-
...
|
|
1399
|
+
}), w = V(() => ({
|
|
1400
|
+
...ne,
|
|
1394
1401
|
...d
|
|
1395
|
-
}), [
|
|
1396
|
-
|
|
1397
|
-
let
|
|
1398
|
-
|
|
1402
|
+
}), [ne, d]), T = H(w);
|
|
1403
|
+
T.current = w;
|
|
1404
|
+
let E = R((e) => {
|
|
1405
|
+
re((t) => ({
|
|
1399
1406
|
...t,
|
|
1400
1407
|
...e
|
|
1401
1408
|
})), f?.({
|
|
1402
|
-
...
|
|
1409
|
+
...T.current,
|
|
1403
1410
|
...e
|
|
1404
1411
|
});
|
|
1405
1412
|
}, [f]);
|
|
1406
|
-
|
|
1407
|
-
config:
|
|
1408
|
-
state:
|
|
1409
|
-
applyPatch:
|
|
1410
|
-
getFilterMeta:
|
|
1413
|
+
ut({
|
|
1414
|
+
config: C,
|
|
1415
|
+
state: w,
|
|
1416
|
+
applyPatch: E,
|
|
1417
|
+
getFilterMeta: te
|
|
1411
1418
|
});
|
|
1412
|
-
let
|
|
1413
|
-
...
|
|
1419
|
+
let D = R(() => ({
|
|
1420
|
+
...T.current.pagination,
|
|
1414
1421
|
pageIndex: 0
|
|
1415
|
-
}), []),
|
|
1416
|
-
|
|
1417
|
-
|
|
1422
|
+
}), []), O = H(b);
|
|
1423
|
+
B(() => {
|
|
1424
|
+
O.current !== b && (O.current = b, E({ pagination: D() }));
|
|
1418
1425
|
});
|
|
1419
|
-
let
|
|
1420
|
-
|
|
1421
|
-
}, [
|
|
1422
|
-
|
|
1423
|
-
sorting: c(e,
|
|
1424
|
-
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()
|
|
1425
1432
|
});
|
|
1426
|
-
}, [
|
|
1427
|
-
|
|
1428
|
-
columnFilters: c(e,
|
|
1429
|
-
pagination:
|
|
1433
|
+
}, [E, D]), j = R((e) => {
|
|
1434
|
+
E({
|
|
1435
|
+
columnFilters: c(e, T.current.columnFilters),
|
|
1436
|
+
pagination: D()
|
|
1430
1437
|
});
|
|
1431
|
-
}, [
|
|
1432
|
-
|
|
1433
|
-
globalFilter: c(e,
|
|
1434
|
-
pagination:
|
|
1438
|
+
}, [E, D]), M = R((e) => {
|
|
1439
|
+
E({
|
|
1440
|
+
globalFilter: c(e, T.current.globalFilter),
|
|
1441
|
+
pagination: D()
|
|
1435
1442
|
});
|
|
1436
|
-
}, [
|
|
1437
|
-
|
|
1438
|
-
}, [
|
|
1439
|
-
|
|
1440
|
-
}, [
|
|
1441
|
-
|
|
1442
|
-
}, [
|
|
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({
|
|
1443
1450
|
data: n,
|
|
1444
|
-
|
|
1451
|
+
meta: { viewMode: P },
|
|
1452
|
+
columns: S,
|
|
1445
1453
|
getCoreRowModel: l(),
|
|
1446
1454
|
manualPagination: !0,
|
|
1447
1455
|
manualSorting: !0,
|
|
@@ -1452,77 +1460,77 @@ function vt(e) {
|
|
|
1452
1460
|
enableRowSelection: typeof p == "function" ? (e) => p(e.original) : p ?? !0,
|
|
1453
1461
|
enableGlobalFilter: m,
|
|
1454
1462
|
state: {
|
|
1455
|
-
pagination:
|
|
1456
|
-
sorting:
|
|
1457
|
-
columnFilters:
|
|
1458
|
-
globalFilter:
|
|
1459
|
-
rowSelection:
|
|
1460
|
-
columnVisibility:
|
|
1461
|
-
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
|
|
1462
1470
|
},
|
|
1463
|
-
onPaginationChange:
|
|
1464
|
-
onSortingChange:
|
|
1465
|
-
onColumnFiltersChange:
|
|
1466
|
-
onGlobalFilterChange:
|
|
1467
|
-
onRowSelectionChange:
|
|
1468
|
-
onColumnVisibilityChange:
|
|
1469
|
-
onColumnPinningChange:
|
|
1470
|
-
}), I =
|
|
1471
|
-
pagination:
|
|
1472
|
-
sorting:
|
|
1473
|
-
filters:
|
|
1474
|
-
globalFilter:
|
|
1475
|
-
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
|
|
1476
1484
|
}), [
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
]), L =
|
|
1485
|
+
w.pagination,
|
|
1486
|
+
w.sorting,
|
|
1487
|
+
w.columnFilters,
|
|
1488
|
+
w.globalFilter,
|
|
1489
|
+
b
|
|
1490
|
+
]), L = H(s);
|
|
1483
1491
|
L.current = s;
|
|
1484
|
-
let
|
|
1485
|
-
|
|
1486
|
-
let
|
|
1487
|
-
|
|
1488
|
-
let e =
|
|
1489
|
-
|
|
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);
|
|
1490
1498
|
}, a = 0;
|
|
1491
|
-
n && (a = Math.max(a,
|
|
1499
|
+
n && (a = Math.max(a, z.current.globalFilter)), r && (a = Math.max(a, z.current.columnFilters));
|
|
1492
1500
|
let o = !t && (n || r) && a > 0;
|
|
1493
|
-
return clearTimeout(
|
|
1501
|
+
return clearTimeout(W.current), o ? W.current = setTimeout(i, a) : i(), () => clearTimeout(W.current);
|
|
1494
1502
|
}, [I]);
|
|
1495
|
-
let
|
|
1496
|
-
|
|
1497
|
-
let
|
|
1498
|
-
L.current?.(
|
|
1499
|
-
}, []),
|
|
1503
|
+
let G = H(I);
|
|
1504
|
+
G.current = I;
|
|
1505
|
+
let ce = R(() => {
|
|
1506
|
+
L.current?.(G.current);
|
|
1507
|
+
}, []), K = V(() => ft({
|
|
1500
1508
|
status: i,
|
|
1501
1509
|
error: a,
|
|
1502
1510
|
pageRowCount: n.length,
|
|
1503
|
-
state:
|
|
1511
|
+
state: w
|
|
1504
1512
|
}), [
|
|
1505
1513
|
i,
|
|
1506
1514
|
a,
|
|
1507
1515
|
n.length,
|
|
1508
|
-
|
|
1509
|
-
]),
|
|
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]);
|
|
1510
1518
|
return {
|
|
1511
1519
|
table: F,
|
|
1512
1520
|
request: I,
|
|
1513
|
-
state:
|
|
1514
|
-
view:
|
|
1521
|
+
state: w,
|
|
1522
|
+
view: P,
|
|
1515
1523
|
setView: le,
|
|
1516
|
-
isMobileForced:
|
|
1524
|
+
isMobileForced: N,
|
|
1517
1525
|
status: i,
|
|
1518
1526
|
error: a,
|
|
1519
|
-
renderStatus:
|
|
1520
|
-
refetch:
|
|
1527
|
+
renderStatus: K,
|
|
1528
|
+
refetch: ce,
|
|
1521
1529
|
pageSizeOptions: ue,
|
|
1522
1530
|
sortableColumns: de,
|
|
1523
1531
|
filterableColumns: fe,
|
|
1524
|
-
selection:
|
|
1525
|
-
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);
|
|
1526
1534
|
return {
|
|
1527
1535
|
count: t.length,
|
|
1528
1536
|
ids: t,
|
|
@@ -1530,26 +1538,26 @@ function vt(e) {
|
|
|
1530
1538
|
clear: J
|
|
1531
1539
|
};
|
|
1532
1540
|
}, [
|
|
1533
|
-
|
|
1541
|
+
w.rowSelection,
|
|
1534
1542
|
n,
|
|
1535
1543
|
o,
|
|
1536
1544
|
J
|
|
1537
1545
|
]),
|
|
1538
|
-
exportCsv:
|
|
1539
|
-
facets:
|
|
1540
|
-
resetFilter:
|
|
1541
|
-
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])
|
|
1542
1550
|
};
|
|
1543
1551
|
}
|
|
1544
1552
|
//#endregion
|
|
1545
1553
|
//#region src/core/useDataViewFetcher.ts
|
|
1546
|
-
function
|
|
1547
|
-
let [r, i] =
|
|
1554
|
+
function bt({ fetcher: e, deps: t, ...n }) {
|
|
1555
|
+
let [r, i] = U({
|
|
1548
1556
|
rows: [],
|
|
1549
1557
|
rowCount: 0
|
|
1550
|
-
}), [a, o] =
|
|
1558
|
+
}), [a, o] = U("idle"), [s, c] = U(void 0), l = H(e);
|
|
1551
1559
|
l.current = e;
|
|
1552
|
-
let u =
|
|
1560
|
+
let u = H(0), d = H(null), f = R(async (e) => {
|
|
1553
1561
|
d.current = e;
|
|
1554
1562
|
let t = ++u.current;
|
|
1555
1563
|
o("loading");
|
|
@@ -1559,10 +1567,10 @@ function yt({ fetcher: e, deps: t, ...n }) {
|
|
|
1559
1567
|
} catch (e) {
|
|
1560
1568
|
t === u.current && (c(e), o("error"));
|
|
1561
1569
|
}
|
|
1562
|
-
}, []), p = t ? JSON.stringify(t) : "", m =
|
|
1563
|
-
return
|
|
1570
|
+
}, []), p = t ? JSON.stringify(t) : "", m = H(p);
|
|
1571
|
+
return B(() => {
|
|
1564
1572
|
m.current !== p && (m.current = p, d.current && f(d.current));
|
|
1565
|
-
}),
|
|
1573
|
+
}), yt({
|
|
1566
1574
|
...n,
|
|
1567
1575
|
rows: r.rows,
|
|
1568
1576
|
rowCount: r.rowCount,
|
|
@@ -1573,6 +1581,6 @@ function yt({ fetcher: e, deps: t, ...n }) {
|
|
|
1573
1581
|
});
|
|
1574
1582
|
}
|
|
1575
1583
|
//#endregion
|
|
1576
|
-
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 };
|
|
1577
1585
|
|
|
1578
1586
|
//# sourceMappingURL=index.js.map
|