@ethanhann/mantine-dataview 0.7.0 → 0.8.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 +61 -0
- package/dist/core/useDataViewFetcher.d.ts +6 -1
- package/dist/index.js +483 -424
- package/dist/index.js.map +1 -1
- package/dist/types/options.d.ts +21 -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 b, Group as x, Input as S, Menu as C, MultiSelect as ee, NumberInput as w, Pagination as te, Paper as ne, Popover as T, RangeSlider as E, SegmentedControl as D, Select as O, SimpleGrid as k, Skeleton as A, Stack as j, Table as M, Text as N, TextInput as re, UnstyledButton as ie, useMantineTheme as ae } from "@mantine/core";
|
|
4
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as L, createContext as R, useCallback as z, useContext as B, useEffect as V, useMemo as H, useRef as U, useState as W } from "react";
|
|
6
|
+
import { useDisclosure as oe, useMediaQuery as G } from "@mantine/hooks";
|
|
7
|
+
import { DatePickerInput as K } from "@mantine/dates";
|
|
8
8
|
import "@mantine/dates/styles.css";
|
|
9
9
|
//#region src/components/DataBulkActions/DataBulkActions.tsx
|
|
10
|
-
function
|
|
10
|
+
function q({ 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__ */ F(ne, {
|
|
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__ */ I(x, {
|
|
20
20
|
justify: "space-between",
|
|
21
21
|
wrap: "wrap",
|
|
22
22
|
gap: "sm",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ I(x, {
|
|
24
24
|
gap: "sm",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
25
|
+
children: [/* @__PURE__ */ I(N, {
|
|
26
26
|
size: "sm",
|
|
27
27
|
fw: 500,
|
|
28
28
|
children: [r.count, " selected"]
|
|
29
|
-
}), /* @__PURE__ */
|
|
29
|
+
}), /* @__PURE__ */ F(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__ */ F(x, {
|
|
36
36
|
gap: "xs",
|
|
37
37
|
children: t.BulkActions(r)
|
|
38
38
|
})]
|
|
@@ -41,14 +41,14 @@ function ce({ view: e, slots: t, ...n }) {
|
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/core/cardComposition.ts
|
|
44
|
-
function
|
|
44
|
+
function J(e) {
|
|
45
45
|
let { meta: t, header: n } = e.columnDef;
|
|
46
46
|
return t?.label ? t.label : typeof n == "string" ? n : e.id;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function se(e, t, n) {
|
|
49
49
|
return t ? t === "hidden" ? null : t : e.accessorFn == null || n === "hidden" ? null : n;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function ce(e, t = {}) {
|
|
52
52
|
let n = t.fallbackRole ?? "meta", r = {
|
|
53
53
|
title: [],
|
|
54
54
|
subtitle: [],
|
|
@@ -57,14 +57,14 @@ function ue(e, t = {}) {
|
|
|
57
57
|
meta: []
|
|
58
58
|
};
|
|
59
59
|
e.getVisibleLeafColumns().forEach((e, t) => {
|
|
60
|
-
let i = e.columnDef.meta?.card, a =
|
|
60
|
+
let i = e.columnDef.meta?.card, a = se(e, i?.role, n);
|
|
61
61
|
a && r[a].push({
|
|
62
62
|
order: i?.order ?? t,
|
|
63
63
|
index: t,
|
|
64
64
|
field: {
|
|
65
65
|
id: e.id,
|
|
66
66
|
column: e,
|
|
67
|
-
label:
|
|
67
|
+
label: J(e),
|
|
68
68
|
showLabel: i?.showLabel ?? a === "meta"
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -80,9 +80,9 @@ function ue(e, t = {}) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/core/useRowTransition.ts
|
|
83
|
-
function
|
|
84
|
-
let n =
|
|
85
|
-
|
|
83
|
+
function Y(e, t) {
|
|
84
|
+
let n = U([]), r = U(!1), i = U(0), a = U(!1);
|
|
85
|
+
V(() => {
|
|
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 V(() => {
|
|
101
101
|
n.current = o, r.current = !0, i.current = c;
|
|
102
102
|
}), {
|
|
103
103
|
rows: e,
|
|
@@ -107,20 +107,20 @@ function q(e, t) {
|
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
109
|
//#region src/components/StateMessage.tsx
|
|
110
|
-
function
|
|
110
|
+
function le(e) {
|
|
111
111
|
e.resetColumnFilters(), e.setGlobalFilter("");
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
return t?.ErrorState ? /* @__PURE__ */ P
|
|
113
|
+
function ue({ view: e, slots: t }) {
|
|
114
|
+
return t?.ErrorState ? /* @__PURE__ */ F(P, { children: t.ErrorState({
|
|
115
115
|
error: e.error,
|
|
116
116
|
retry: e.refetch
|
|
117
|
-
}) }) : /* @__PURE__ */
|
|
117
|
+
}) }) : /* @__PURE__ */ I(j, {
|
|
118
118
|
align: "center",
|
|
119
119
|
gap: "xs",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ F(N, {
|
|
121
121
|
c: "red",
|
|
122
122
|
children: "Something went wrong."
|
|
123
|
-
}), /* @__PURE__ */
|
|
123
|
+
}), /* @__PURE__ */ F(h, {
|
|
124
124
|
variant: "light",
|
|
125
125
|
size: "xs",
|
|
126
126
|
onClick: e.refetch,
|
|
@@ -128,42 +128,42 @@ function fe({ view: e, slots: t }) {
|
|
|
128
128
|
})]
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
let n = e.renderStatus.phase === "empty-filtered", r = () =>
|
|
133
|
-
return t?.Empty ? /* @__PURE__ */ P
|
|
131
|
+
function X({ view: e, slots: t }) {
|
|
132
|
+
let n = e.renderStatus.phase === "empty-filtered", r = () => le(e.table);
|
|
133
|
+
return t?.Empty ? /* @__PURE__ */ F(P, { children: t.Empty({
|
|
134
134
|
filtered: n,
|
|
135
135
|
clearFilters: r
|
|
136
|
-
}) }) : n ? /* @__PURE__ */
|
|
136
|
+
}) }) : n ? /* @__PURE__ */ I(j, {
|
|
137
137
|
align: "center",
|
|
138
138
|
gap: "xs",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ F(N, {
|
|
140
140
|
c: "dimmed",
|
|
141
141
|
children: "No matches."
|
|
142
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ F(h, {
|
|
143
143
|
variant: "subtle",
|
|
144
144
|
size: "xs",
|
|
145
145
|
onClick: r,
|
|
146
146
|
children: "Clear filters"
|
|
147
147
|
})]
|
|
148
|
-
}) : /* @__PURE__ */
|
|
148
|
+
}) : /* @__PURE__ */ F(N, {
|
|
149
149
|
c: "dimmed",
|
|
150
150
|
children: "No results."
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region src/components/DataCards/DataCards.tsx
|
|
155
|
-
var
|
|
155
|
+
var de = {
|
|
156
156
|
base: 1,
|
|
157
157
|
sm: 2,
|
|
158
158
|
lg: 3
|
|
159
159
|
};
|
|
160
|
-
function
|
|
160
|
+
function fe({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection: i, loadingCardCount: a, animateRows: o = !1, cols: s = de, ...c }) {
|
|
161
161
|
let { table: l, renderStatus: u } = e, d = i ?? l.options.enableRowSelection !== !1, f = a ?? Math.min(e.state.pagination.pageSize, 6), p = {
|
|
162
162
|
cols: s,
|
|
163
163
|
...c
|
|
164
|
-
}, m =
|
|
165
|
-
let i =
|
|
166
|
-
return /* @__PURE__ */
|
|
164
|
+
}, m = Y(l.getRowModel().rows, o), h = (e) => {
|
|
165
|
+
let i = ce(l, { fallbackRole: r });
|
|
166
|
+
return /* @__PURE__ */ F(k, {
|
|
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__ */ F("div", {
|
|
177
177
|
"data-entering": o,
|
|
178
178
|
children: n(a)
|
|
179
179
|
}, e.id);
|
|
180
|
-
let s = /* @__PURE__ */
|
|
180
|
+
let s = /* @__PURE__ */ F(pe, {
|
|
181
181
|
row: e,
|
|
182
182
|
layout: i,
|
|
183
183
|
selectionEnabled: d
|
|
184
184
|
});
|
|
185
|
-
return t?.Card ? /* @__PURE__ */
|
|
185
|
+
return t?.Card ? /* @__PURE__ */ F("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__ */ F(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__ */ F(k, {
|
|
205
205
|
...p,
|
|
206
|
-
children: Array.from({ length: f }, (e, t) => /* @__PURE__ */
|
|
206
|
+
children: Array.from({ length: f }, (e, t) => /* @__PURE__ */ F(g, {
|
|
207
207
|
withBorder: !0,
|
|
208
208
|
padding: "md",
|
|
209
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ I(j, {
|
|
210
210
|
gap: "xs",
|
|
211
211
|
children: [
|
|
212
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ F(A, {
|
|
213
213
|
height: 20,
|
|
214
214
|
width: "60%"
|
|
215
215
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ F(A, {
|
|
217
217
|
height: 12,
|
|
218
218
|
width: "40%"
|
|
219
219
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ F(A, { height: 12 })
|
|
221
221
|
]
|
|
222
222
|
})
|
|
223
223
|
}, t))
|
|
224
224
|
});
|
|
225
|
-
case "error": return /* @__PURE__ */
|
|
225
|
+
case "error": return /* @__PURE__ */ F(_, {
|
|
226
226
|
p: "xl",
|
|
227
|
-
children: /* @__PURE__ */
|
|
227
|
+
children: /* @__PURE__ */ F(ue, {
|
|
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__ */ F(_, {
|
|
234
234
|
p: "xl",
|
|
235
|
-
children: /* @__PURE__ */
|
|
235
|
+
children: /* @__PURE__ */ F(X, {
|
|
236
236
|
view: e,
|
|
237
237
|
slots: t
|
|
238
238
|
})
|
|
@@ -240,13 +240,13 @@ function me({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection
|
|
|
240
240
|
default: return h(m.rows);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function pe({ row: e, layout: t, selectionEnabled: n }) {
|
|
244
244
|
let r = new Map(e.getAllCells().map((e) => [e.column.id, e])), i = (e) => {
|
|
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__ */ I(P, { children: [
|
|
249
|
+
n && /* @__PURE__ */ F(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__ */ F(g.Section, {
|
|
262
262
|
mb: "xs",
|
|
263
|
-
children: t.media.map((e) => /* @__PURE__ */
|
|
263
|
+
children: t.media.map((e) => /* @__PURE__ */ F(m, { children: i(e) }, e.id))
|
|
264
264
|
}),
|
|
265
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ I(j, {
|
|
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__ */ I(j, {
|
|
269
269
|
gap: 4,
|
|
270
|
-
children: [t.title.map((e) => /* @__PURE__ */
|
|
270
|
+
children: [t.title.map((e) => /* @__PURE__ */ F(N, {
|
|
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__ */ F(N, {
|
|
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__ */ F(x, {
|
|
283
283
|
gap: "xs",
|
|
284
|
-
children: t.badge.map((e) => /* @__PURE__ */
|
|
284
|
+
children: t.badge.map((e) => /* @__PURE__ */ F(L, { children: i(e) }, e.id))
|
|
285
285
|
}),
|
|
286
|
-
t.meta.length > 0 && /* @__PURE__ */
|
|
286
|
+
t.meta.length > 0 && /* @__PURE__ */ F(j, {
|
|
287
287
|
gap: 4,
|
|
288
|
-
children: t.meta.map((e) => /* @__PURE__ */
|
|
288
|
+
children: t.meta.map((e) => /* @__PURE__ */ I(x, {
|
|
289
289
|
justify: "space-between",
|
|
290
290
|
gap: "xs",
|
|
291
291
|
wrap: "nowrap",
|
|
292
|
-
children: [e.showLabel && /* @__PURE__ */
|
|
292
|
+
children: [e.showLabel && /* @__PURE__ */ F(N, {
|
|
293
293
|
size: "sm",
|
|
294
294
|
c: "dimmed",
|
|
295
295
|
children: e.label
|
|
296
|
-
}), /* @__PURE__ */
|
|
296
|
+
}), /* @__PURE__ */ F(N, {
|
|
297
297
|
size: "sm",
|
|
298
298
|
children: i(e)
|
|
299
299
|
})]
|
|
@@ -305,24 +305,24 @@ function he({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
305
305
|
}
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/components/DataPagination/DataPagination.tsx
|
|
308
|
-
function
|
|
308
|
+
function me({ 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__ */ I(x, {
|
|
311
311
|
justify: "space-between",
|
|
312
312
|
wrap: "wrap",
|
|
313
313
|
gap: "sm",
|
|
314
314
|
...a,
|
|
315
|
-
children: [/* @__PURE__ */
|
|
315
|
+
children: [/* @__PURE__ */ I(x, {
|
|
316
316
|
gap: "sm",
|
|
317
317
|
wrap: "wrap",
|
|
318
|
-
children: [n && /* @__PURE__ */
|
|
318
|
+
children: [n && /* @__PURE__ */ F(O, {
|
|
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__ */ I(N, {
|
|
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__ */ F(te, {
|
|
337
337
|
value: s + 1,
|
|
338
338
|
total: Math.max(u, 1),
|
|
339
339
|
onChange: (e) => o.setPageIndex(e - 1),
|
|
@@ -343,8 +343,8 @@ function ge({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r =
|
|
|
343
343
|
}
|
|
344
344
|
//#endregion
|
|
345
345
|
//#region src/components/icons.tsx
|
|
346
|
-
function
|
|
347
|
-
return /* @__PURE__ */
|
|
346
|
+
function he({ direction: e }) {
|
|
347
|
+
return /* @__PURE__ */ I("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__ */ F("title", { children: "sort" }),
|
|
357
|
+
/* @__PURE__ */ F("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__ */ F("path", {
|
|
366
366
|
d: "M8 14l4 4 4-4",
|
|
367
367
|
stroke: "currentColor",
|
|
368
368
|
strokeWidth: "2",
|
|
@@ -373,8 +373,8 @@ function _e({ direction: e }) {
|
|
|
373
373
|
]
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
return /* @__PURE__ */
|
|
376
|
+
function Z({ d: e, title: t }) {
|
|
377
|
+
return /* @__PURE__ */ I("svg", {
|
|
378
378
|
width: "16",
|
|
379
379
|
height: "16",
|
|
380
380
|
viewBox: "0 0 24 24",
|
|
@@ -386,48 +386,48 @@ 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__ */ F("title", { children: t }), /* @__PURE__ */ F("path", { d: e })]
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
return /* @__PURE__ */
|
|
392
|
+
function ge() {
|
|
393
|
+
return /* @__PURE__ */ F(Z, {
|
|
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
|
-
function
|
|
399
|
-
return /* @__PURE__ */
|
|
398
|
+
function _e() {
|
|
399
|
+
return /* @__PURE__ */ F(Z, {
|
|
400
400
|
title: "filter",
|
|
401
401
|
d: "M3 5h18M7 12h10M10 19h4"
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
function
|
|
405
|
-
return /* @__PURE__ */
|
|
404
|
+
function ve() {
|
|
405
|
+
return /* @__PURE__ */ F(Z, {
|
|
406
406
|
title: "open",
|
|
407
407
|
d: "M6 9l6 6 6-6"
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
|
-
function
|
|
411
|
-
return /* @__PURE__ */
|
|
410
|
+
function ye() {
|
|
411
|
+
return /* @__PURE__ */ F(Z, {
|
|
412
412
|
title: "close",
|
|
413
413
|
d: "M18 6L6 18M6 6l12 12"
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
|
-
function
|
|
417
|
-
return /* @__PURE__ */
|
|
416
|
+
function be() {
|
|
417
|
+
return /* @__PURE__ */ F(Z, {
|
|
418
418
|
title: "pin left",
|
|
419
419
|
d: "M4 4v16M9 8h8M9 12h6M9 16h8"
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
-
function
|
|
423
|
-
return /* @__PURE__ */
|
|
422
|
+
function xe() {
|
|
423
|
+
return /* @__PURE__ */ F(Z, {
|
|
424
424
|
title: "pin right",
|
|
425
425
|
d: "M20 4v16M7 8h8M9 12h6M7 16h8"
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
//#endregion
|
|
429
429
|
//#region src/components/DataTable/DataTable.tsx
|
|
430
|
-
function
|
|
430
|
+
function Se(e) {
|
|
431
431
|
let t = e.getIsPinned();
|
|
432
432
|
if (t) return {
|
|
433
433
|
position: "sticky",
|
|
@@ -436,11 +436,11 @@ function we(e) {
|
|
|
436
436
|
backgroundColor: "var(--mantine-color-body)"
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
let { table: c, renderStatus: l } = e, u = i && e.status === "loading", d =
|
|
439
|
+
function Ce({ 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 = Y(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__ */ F(M.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__ */ I(P, { children: [p && /* @__PURE__ */ F(M.Td, { children: /* @__PURE__ */ F(v, {
|
|
444
444
|
"aria-label": "Select row",
|
|
445
445
|
checked: e.getIsSelected(),
|
|
446
446
|
disabled: !e.getCanSelect(),
|
|
@@ -448,18 +448,18 @@ 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__ */ F(M.Td, {
|
|
452
452
|
style: {
|
|
453
|
-
...
|
|
453
|
+
...Se(e.column),
|
|
454
454
|
...t ? { textAlign: t } : void 0
|
|
455
455
|
},
|
|
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__ */ F(we, { children: t.Row({
|
|
460
460
|
row: e,
|
|
461
461
|
cells: r
|
|
462
|
-
}) }, e.id) : /* @__PURE__ */
|
|
462
|
+
}) }, e.id) : /* @__PURE__ */ F(M.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__ */ F(M.Tbody, { children: Array.from({ length: h }, (e, t) => /* @__PURE__ */ I(M.Tr, { children: [p && /* @__PURE__ */ F(M.Td, { children: /* @__PURE__ */ F(A, {
|
|
472
472
|
height: 16,
|
|
473
473
|
width: 16
|
|
474
|
-
}) }), f.map((e) => /* @__PURE__ */
|
|
475
|
-
case "error": return /* @__PURE__ */
|
|
474
|
+
}) }), f.map((e) => /* @__PURE__ */ F(M.Td, { children: /* @__PURE__ */ F(A, { height: 12 }) }, e.id))] }, t)) });
|
|
475
|
+
case "error": return /* @__PURE__ */ F(Te, {
|
|
476
476
|
colSpan: m,
|
|
477
|
-
children: /* @__PURE__ */
|
|
477
|
+
children: /* @__PURE__ */ F(ue, {
|
|
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__ */ F(Te, {
|
|
484
484
|
colSpan: m,
|
|
485
|
-
children: /* @__PURE__ */
|
|
485
|
+
children: /* @__PURE__ */ F(X, {
|
|
486
486
|
view: e,
|
|
487
487
|
slots: t
|
|
488
488
|
})
|
|
@@ -490,48 +490,48 @@ 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__ */ F("div", {
|
|
494
494
|
style: c.getIsSomeColumnsPinned() ? { overflowX: "auto" } : void 0,
|
|
495
|
-
children: /* @__PURE__ */
|
|
495
|
+
children: /* @__PURE__ */ I(M, {
|
|
496
496
|
layout: "fixed",
|
|
497
497
|
...o,
|
|
498
|
-
children: [/* @__PURE__ */
|
|
498
|
+
children: [/* @__PURE__ */ F(M.Thead, { children: c.getHeaderGroups().map((e) => /* @__PURE__ */ I(M.Tr, { children: [p && /* @__PURE__ */ F(M.Th, {
|
|
499
499
|
style: { width: 40 },
|
|
500
|
-
children: /* @__PURE__ */
|
|
500
|
+
children: /* @__PURE__ */ F(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__ */ F(Ee, {
|
|
507
507
|
header: e,
|
|
508
508
|
disabled: u
|
|
509
509
|
}, e.id))] }, e.id)) }), _()]
|
|
510
510
|
})
|
|
511
511
|
});
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
return /* @__PURE__ */ P
|
|
513
|
+
function we({ children: e }) {
|
|
514
|
+
return /* @__PURE__ */ F(P, { children: e });
|
|
515
515
|
}
|
|
516
|
-
function
|
|
517
|
-
return /* @__PURE__ */
|
|
516
|
+
function Te({ colSpan: e, children: t }) {
|
|
517
|
+
return /* @__PURE__ */ F(M.Tbody, { children: /* @__PURE__ */ F(M.Tr, { children: /* @__PURE__ */ F(M.Td, {
|
|
518
518
|
colSpan: e,
|
|
519
|
-
children: /* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ F(_, {
|
|
520
520
|
p: "xl",
|
|
521
521
|
children: t
|
|
522
522
|
})
|
|
523
523
|
}) }) });
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function Ee({ 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__ */ F(M.Th, {
|
|
528
528
|
style: {
|
|
529
|
-
...
|
|
529
|
+
...Se(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__ */ I(ie, {
|
|
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__ */ F(he, { direction: i }),
|
|
545
|
+
o && /* @__PURE__ */ F("span", {
|
|
546
546
|
role: "note",
|
|
547
547
|
style: {
|
|
548
548
|
fontSize: "0.7em",
|
|
@@ -552,33 +552,33 @@ function Oe({ header: e, disabled: t }) {
|
|
|
552
552
|
children: a + 1
|
|
553
553
|
})
|
|
554
554
|
]
|
|
555
|
-
}) : /* @__PURE__ */
|
|
555
|
+
}) : /* @__PURE__ */ I("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__ */ F(he, { direction: i })]
|
|
563
563
|
})
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
//#endregion
|
|
567
567
|
//#region src/core/useForceCards.ts
|
|
568
|
-
var
|
|
569
|
-
function
|
|
568
|
+
var De = "(max-width: 0px)";
|
|
569
|
+
function Oe(e) {
|
|
570
570
|
let t = /^([\d.]+)(\D*)$/.exec(e.trim());
|
|
571
571
|
if (!t) return `(max-width: ${e})`;
|
|
572
572
|
let n = Number(t[1]), r = t[2] || "px";
|
|
573
573
|
return `(max-width: ${n - (r === "em" || r === "rem" ? .01 : .1)}${r})`;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
let t =
|
|
575
|
+
function ke(e) {
|
|
576
|
+
let t = ae(), n = e?.forceCardsBelow, r = n ? t.breakpoints[n] : void 0, i = G(r ? Oe(r) : De, !1);
|
|
577
577
|
return !!r && !!i;
|
|
578
578
|
}
|
|
579
579
|
//#endregion
|
|
580
580
|
//#region src/core/formatValue.ts
|
|
581
|
-
var
|
|
581
|
+
var Ae = {
|
|
582
582
|
text: (e) => e == null ? "" : String(e),
|
|
583
583
|
number: (e) => e == null ? "" : new Intl.NumberFormat().format(Number(e)),
|
|
584
584
|
currency: (e) => e == null ? "" : new Intl.NumberFormat(void 0, {
|
|
@@ -592,7 +592,7 @@ var Me = {
|
|
|
592
592
|
},
|
|
593
593
|
boolean: (e) => e == null ? "" : e ? "Yes" : "No"
|
|
594
594
|
};
|
|
595
|
-
function
|
|
595
|
+
function je(e, t) {
|
|
596
596
|
if (e === "number" || e === "currency") {
|
|
597
597
|
let n = new Intl.NumberFormat(void 0, e === "currency" ? {
|
|
598
598
|
style: "currency",
|
|
@@ -608,35 +608,35 @@ function Ne(e, t) {
|
|
|
608
608
|
return Number.isNaN(n.getTime()) ? String(t) : e.format(n);
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
|
-
return
|
|
611
|
+
return Ae[e];
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function Me(e, t, n) {
|
|
614
614
|
let r = t ?? n?.[e];
|
|
615
|
-
return r ? typeof r == "function" ? r :
|
|
615
|
+
return r ? typeof r == "function" ? r : je(e, r) : Ae[e];
|
|
616
616
|
}
|
|
617
617
|
//#endregion
|
|
618
618
|
//#region src/components/DataToolbar/FacetBuckets.tsx
|
|
619
|
-
function
|
|
619
|
+
function Ne({ facet: e, value: t, onChange: n }) {
|
|
620
620
|
let r = Array.isArray(t) ? t : null;
|
|
621
|
-
return /* @__PURE__ */
|
|
621
|
+
return /* @__PURE__ */ F(j, {
|
|
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__ */ F(ie, {
|
|
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__ */ I(x, {
|
|
633
633
|
gap: "xs",
|
|
634
634
|
justify: "space-between",
|
|
635
635
|
wrap: "nowrap",
|
|
636
|
-
children: [/* @__PURE__ */
|
|
636
|
+
children: [/* @__PURE__ */ F(N, {
|
|
637
637
|
size: "sm",
|
|
638
638
|
children: e.label
|
|
639
|
-
}), /* @__PURE__ */
|
|
639
|
+
}), /* @__PURE__ */ F(p, {
|
|
640
640
|
size: "sm",
|
|
641
641
|
variant: "light",
|
|
642
642
|
color: e.count === 0 ? "gray" : "blue",
|
|
@@ -649,15 +649,15 @@ function Fe({ 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 Pe({ label: e, onClear: t }) {
|
|
653
|
+
return /* @__PURE__ */ I(x, {
|
|
654
654
|
justify: "space-between",
|
|
655
655
|
wrap: "nowrap",
|
|
656
|
-
children: [/* @__PURE__ */
|
|
656
|
+
children: [/* @__PURE__ */ F(N, {
|
|
657
657
|
size: "sm",
|
|
658
658
|
fw: 500,
|
|
659
659
|
children: e
|
|
660
|
-
}), /* @__PURE__ */
|
|
660
|
+
}), /* @__PURE__ */ F(f, {
|
|
661
661
|
component: "button",
|
|
662
662
|
type: "button",
|
|
663
663
|
size: "xs",
|
|
@@ -667,28 +667,28 @@ function Ie({ label: e, onClear: t }) {
|
|
|
667
667
|
})]
|
|
668
668
|
});
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function Fe(e) {
|
|
671
671
|
return e ? typeof e == "string" ? e : e.toISOString().split("T")[0] ?? null : null;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function Ie(e) {
|
|
674
674
|
return Array.isArray(e) ? [e[0], e[1]] : [null, null];
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function Le(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 Re({ column: e, facet: t }) {
|
|
684
684
|
let n = e.columnDef.meta?.filter;
|
|
685
685
|
if (!n) return null;
|
|
686
|
-
let r =
|
|
686
|
+
let r = J(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__ */ F(S.Wrapper, {
|
|
690
690
|
label: r,
|
|
691
|
-
children: /* @__PURE__ */
|
|
691
|
+
children: /* @__PURE__ */ F(t, {
|
|
692
692
|
value: a,
|
|
693
693
|
onChange: o,
|
|
694
694
|
column: e
|
|
@@ -697,26 +697,26 @@ function Be({ 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__ */ F(O, {
|
|
701
701
|
label: r,
|
|
702
702
|
placeholder: i,
|
|
703
703
|
clearable: !0,
|
|
704
|
-
data: s ?
|
|
704
|
+
data: s ? Le(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__ */ F(ee, {
|
|
709
709
|
label: r,
|
|
710
710
|
placeholder: i,
|
|
711
|
-
data: s ?
|
|
711
|
+
data: s ? Le(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__ */ F(S.Wrapper, {
|
|
718
718
|
label: r,
|
|
719
|
-
children: /* @__PURE__ */
|
|
719
|
+
children: /* @__PURE__ */ F(D, {
|
|
720
720
|
fullWidth: !0,
|
|
721
721
|
size: "xs",
|
|
722
722
|
data: [
|
|
@@ -741,21 +741,21 @@ function Be({ column: e, facet: t }) {
|
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
case "numberRange": {
|
|
744
|
-
let [t, i] =
|
|
744
|
+
let [t, i] = Ie(a), s = n.min ?? c?.min, l = n.max ?? c?.max, u = s != null && l != null, d = a != null, f = c ? /* @__PURE__ */ F(Ne, {
|
|
745
745
|
facet: c,
|
|
746
746
|
value: a,
|
|
747
747
|
onChange: o
|
|
748
|
-
}) : null, p = d ? /* @__PURE__ */
|
|
748
|
+
}) : null, p = d ? /* @__PURE__ */ F(Pe, {
|
|
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 ? Me(c, e.columnDef.meta?.format, void 0) : (e) => String(e);
|
|
754
|
+
return /* @__PURE__ */ F(S.Wrapper, {
|
|
755
755
|
label: p,
|
|
756
|
-
children: /* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ I(j, {
|
|
757
757
|
gap: "xs",
|
|
758
|
-
children: [f, /* @__PURE__ */
|
|
758
|
+
children: [f, /* @__PURE__ */ F(E, {
|
|
759
759
|
min: s,
|
|
760
760
|
max: l,
|
|
761
761
|
step: n.step ?? 1,
|
|
@@ -770,23 +770,23 @@ function Be({ column: e, facet: t }) {
|
|
|
770
770
|
})
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
|
-
if (f) return /* @__PURE__ */
|
|
773
|
+
if (f) return /* @__PURE__ */ F(S.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__ */ F(S.Wrapper, {
|
|
779
779
|
label: r,
|
|
780
|
-
children: /* @__PURE__ */
|
|
780
|
+
children: /* @__PURE__ */ I(x, {
|
|
781
781
|
gap: 4,
|
|
782
782
|
wrap: "nowrap",
|
|
783
|
-
children: [/* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ F(w, {
|
|
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__ */ F(w, {
|
|
790
790
|
"aria-label": `${r} maximum`,
|
|
791
791
|
placeholder: "Max",
|
|
792
792
|
value: i ?? "",
|
|
@@ -796,42 +796,42 @@ function Be({ column: e, facet: t }) {
|
|
|
796
796
|
})
|
|
797
797
|
});
|
|
798
798
|
}
|
|
799
|
-
case "date": return /* @__PURE__ */
|
|
799
|
+
case "date": return /* @__PURE__ */ F(K, {
|
|
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(Fe(e) ?? void 0)
|
|
806
806
|
});
|
|
807
807
|
case "dateRange": {
|
|
808
|
-
let [e, t] =
|
|
808
|
+
let [e, t] = Ie(a), n = [e ? new Date(e) : null, t ? new Date(t) : null], s = a == null ? r : /* @__PURE__ */ F(Pe, {
|
|
809
809
|
label: r,
|
|
810
810
|
onClear: () => o(void 0)
|
|
811
811
|
});
|
|
812
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ F(S.Wrapper, {
|
|
813
813
|
label: s,
|
|
814
|
-
children: /* @__PURE__ */
|
|
814
|
+
children: /* @__PURE__ */ I(j, {
|
|
815
815
|
gap: "xs",
|
|
816
|
-
children: [c && /* @__PURE__ */
|
|
816
|
+
children: [c && /* @__PURE__ */ F(Ne, {
|
|
817
817
|
facet: c,
|
|
818
818
|
value: a,
|
|
819
819
|
onChange: o
|
|
820
|
-
}), /* @__PURE__ */
|
|
820
|
+
}), /* @__PURE__ */ F(K, {
|
|
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 = Fe(e), r = Fe(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__ */ F(re, {
|
|
835
835
|
label: r,
|
|
836
836
|
placeholder: i,
|
|
837
837
|
value: a ?? "",
|
|
@@ -841,59 +841,59 @@ function Be({ 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 ze({ view: e }) {
|
|
845
|
+
return e.state.columnFilters.length > 0 ? /* @__PURE__ */ F(h, {
|
|
846
846
|
variant: "subtle",
|
|
847
847
|
size: "compact-sm",
|
|
848
848
|
color: "gray",
|
|
849
|
-
leftSection: /* @__PURE__ */
|
|
849
|
+
leftSection: /* @__PURE__ */ F(ye, {}),
|
|
850
850
|
onClick: () => e.table.resetColumnFilters(),
|
|
851
851
|
children: "Reset filters"
|
|
852
852
|
}) : null;
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function Be(e) {
|
|
855
855
|
return e > 0 ? `Filters (${e})` : "Filters";
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return /* @__PURE__ */
|
|
857
|
+
function Ve({ view: e, controls: t }) {
|
|
858
|
+
return /* @__PURE__ */ I(j, {
|
|
859
859
|
gap: "sm",
|
|
860
860
|
style: { minWidth: 240 },
|
|
861
|
-
children: [t, /* @__PURE__ */
|
|
861
|
+
children: [t, /* @__PURE__ */ F(x, {
|
|
862
862
|
justify: "flex-end",
|
|
863
|
-
children: /* @__PURE__ */
|
|
863
|
+
children: /* @__PURE__ */ F(ze, { view: e })
|
|
864
864
|
})]
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
|
-
function
|
|
868
|
-
let n = e.filterableColumns, r =
|
|
867
|
+
function He({ view: e, inlineThreshold: t }) {
|
|
868
|
+
let n = e.filterableColumns, r = G(Oe(ae().breakpoints.sm), !1), [i, { open: a, close: o }] = oe(!1);
|
|
869
869
|
if (n.length === 0) return null;
|
|
870
|
-
let s = n.map((t) => /* @__PURE__ */
|
|
870
|
+
let s = n.map((t) => /* @__PURE__ */ F(Re, {
|
|
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__ */ I(P, { children: [/* @__PURE__ */ F(h, {
|
|
875
875
|
variant: "default",
|
|
876
|
-
leftSection: /* @__PURE__ */
|
|
876
|
+
leftSection: /* @__PURE__ */ F(_e, {}),
|
|
877
877
|
onClick: a,
|
|
878
|
-
children:
|
|
879
|
-
}), /* @__PURE__ */
|
|
878
|
+
children: Be(c)
|
|
879
|
+
}), /* @__PURE__ */ F(b, {
|
|
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__ */ F(Ve, {
|
|
886
886
|
view: e,
|
|
887
887
|
controls: s
|
|
888
888
|
})
|
|
889
|
-
})] }) : n.length <= t ? /* @__PURE__ */
|
|
889
|
+
})] }) : n.length <= t ? /* @__PURE__ */ I(P, { children: [s, /* @__PURE__ */ F(ze, { view: e })] }) : /* @__PURE__ */ I(T, {
|
|
890
890
|
position: "bottom-start",
|
|
891
891
|
closeOnClickOutside: !1,
|
|
892
|
-
children: [/* @__PURE__ */
|
|
892
|
+
children: [/* @__PURE__ */ F(T.Target, { children: /* @__PURE__ */ F(h, {
|
|
893
893
|
variant: "default",
|
|
894
|
-
leftSection: /* @__PURE__ */
|
|
895
|
-
children:
|
|
896
|
-
}) }), /* @__PURE__ */
|
|
894
|
+
leftSection: /* @__PURE__ */ F(_e, {}),
|
|
895
|
+
children: Be(c)
|
|
896
|
+
}) }), /* @__PURE__ */ F(T.Dropdown, { children: /* @__PURE__ */ F(Ve, {
|
|
897
897
|
view: e,
|
|
898
898
|
controls: s
|
|
899
899
|
}) })]
|
|
@@ -901,25 +901,25 @@ function We({ view: e, inlineThreshold: t }) {
|
|
|
901
901
|
}
|
|
902
902
|
//#endregion
|
|
903
903
|
//#region src/components/DataToolbar/SortControl.tsx
|
|
904
|
-
function
|
|
904
|
+
function Ue({ view: e }) {
|
|
905
905
|
let { sortableColumns: t, state: n, table: r } = e, i = n.sorting[0];
|
|
906
|
-
return /* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */ I(x, {
|
|
907
907
|
gap: 4,
|
|
908
908
|
wrap: "nowrap",
|
|
909
|
-
children: [/* @__PURE__ */
|
|
909
|
+
children: [/* @__PURE__ */ F(O, {
|
|
910
910
|
"aria-label": "Sort by",
|
|
911
911
|
placeholder: "Sort by",
|
|
912
912
|
clearable: !0,
|
|
913
913
|
data: t.map((e) => ({
|
|
914
914
|
value: e.id,
|
|
915
|
-
label:
|
|
915
|
+
label: J(e)
|
|
916
916
|
})),
|
|
917
917
|
value: i?.id ?? null,
|
|
918
918
|
onChange: (e) => r.setSorting(e ? [{
|
|
919
919
|
id: e,
|
|
920
920
|
desc: i?.desc ?? !1
|
|
921
921
|
}] : [])
|
|
922
|
-
}), /* @__PURE__ */
|
|
922
|
+
}), /* @__PURE__ */ F(d, {
|
|
923
923
|
"aria-label": "Toggle sort direction",
|
|
924
924
|
variant: "default",
|
|
925
925
|
size: "lg",
|
|
@@ -928,14 +928,14 @@ function Ge({ view: e }) {
|
|
|
928
928
|
id: i.id,
|
|
929
929
|
desc: !i.desc
|
|
930
930
|
}]),
|
|
931
|
-
children: /* @__PURE__ */
|
|
931
|
+
children: /* @__PURE__ */ F(he, { 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 We({ view: e, lockSwitcherOnMobile: t, tableLabel: n = "Table", cardsLabel: r = "Cards" }) {
|
|
938
|
+
return e.isMobileForced && t ? null : /* @__PURE__ */ F(D, {
|
|
939
939
|
"aria-label": "View",
|
|
940
940
|
value: e.view,
|
|
941
941
|
disabled: e.isMobileForced,
|
|
@@ -953,81 +953,81 @@ function Ke({ 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 Ge({ column: e }) {
|
|
957
957
|
if (!e.getCanPin()) return null;
|
|
958
958
|
let t = e.getIsPinned();
|
|
959
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ I(x, {
|
|
960
960
|
gap: 2,
|
|
961
|
-
children: [/* @__PURE__ */
|
|
961
|
+
children: [/* @__PURE__ */ F(d, {
|
|
962
962
|
size: "xs",
|
|
963
963
|
variant: t === "left" ? "filled" : "subtle",
|
|
964
964
|
color: t === "left" ? "blue" : "gray",
|
|
965
|
-
"aria-label": `Pin ${
|
|
965
|
+
"aria-label": `Pin ${J(e)} left`,
|
|
966
966
|
onClick: () => e.pin(t === "left" ? !1 : "left"),
|
|
967
|
-
children: /* @__PURE__ */
|
|
968
|
-
}), /* @__PURE__ */
|
|
967
|
+
children: /* @__PURE__ */ F(be, {})
|
|
968
|
+
}), /* @__PURE__ */ F(d, {
|
|
969
969
|
size: "xs",
|
|
970
970
|
variant: t === "right" ? "filled" : "subtle",
|
|
971
971
|
color: t === "right" ? "blue" : "gray",
|
|
972
|
-
"aria-label": `Pin ${
|
|
972
|
+
"aria-label": `Pin ${J(e)} right`,
|
|
973
973
|
onClick: () => e.pin(t === "right" ? !1 : "right"),
|
|
974
|
-
children: /* @__PURE__ */
|
|
974
|
+
children: /* @__PURE__ */ F(xe, {})
|
|
975
975
|
})]
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Ke({ 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__ */ I(C, {
|
|
981
981
|
closeOnItemClick: !1,
|
|
982
982
|
withinPortal: !0,
|
|
983
983
|
position: "bottom-end",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
984
|
+
children: [/* @__PURE__ */ F(C.Target, { children: /* @__PURE__ */ F(h, {
|
|
985
985
|
variant: "default",
|
|
986
|
-
rightSection: /* @__PURE__ */
|
|
986
|
+
rightSection: /* @__PURE__ */ F(ve, {}),
|
|
987
987
|
children: "Columns"
|
|
988
|
-
}) }), /* @__PURE__ */
|
|
988
|
+
}) }), /* @__PURE__ */ F(C.Dropdown, { children: /* @__PURE__ */ F(j, {
|
|
989
989
|
gap: "xs",
|
|
990
990
|
p: "xs",
|
|
991
|
-
children: t.map((e) => /* @__PURE__ */
|
|
991
|
+
children: t.map((e) => /* @__PURE__ */ I(x, {
|
|
992
992
|
gap: "xs",
|
|
993
993
|
justify: "space-between",
|
|
994
994
|
wrap: "nowrap",
|
|
995
|
-
children: [/* @__PURE__ */
|
|
996
|
-
label:
|
|
995
|
+
children: [/* @__PURE__ */ F(v, {
|
|
996
|
+
label: J(e),
|
|
997
997
|
checked: e.getIsVisible(),
|
|
998
998
|
onChange: (t) => e.toggleVisibility(t.currentTarget.checked)
|
|
999
|
-
}), /* @__PURE__ */
|
|
999
|
+
}), /* @__PURE__ */ F(Ge, { 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 qe({ 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, b = s ?? !0, S = c ?? !0;
|
|
1008
|
+
return /* @__PURE__ */ I(x, {
|
|
1009
1009
|
justify: "space-between",
|
|
1010
1010
|
wrap: "wrap",
|
|
1011
1011
|
gap: "sm",
|
|
1012
1012
|
...f,
|
|
1013
|
-
children: [/* @__PURE__ */
|
|
1013
|
+
children: [/* @__PURE__ */ I(x, {
|
|
1014
1014
|
wrap: "wrap",
|
|
1015
1015
|
gap: "sm",
|
|
1016
1016
|
children: [
|
|
1017
1017
|
u,
|
|
1018
|
-
g && /* @__PURE__ */
|
|
1018
|
+
g && /* @__PURE__ */ F(re, {
|
|
1019
1019
|
"aria-label": "Search",
|
|
1020
1020
|
placeholder: t,
|
|
1021
|
-
leftSection: /* @__PURE__ */
|
|
1021
|
+
leftSection: /* @__PURE__ */ F(ge, {}),
|
|
1022
1022
|
value: m.globalFilter,
|
|
1023
1023
|
onChange: (e) => p.setGlobalFilter(e.currentTarget.value),
|
|
1024
|
-
rightSection: m.globalFilter ? /* @__PURE__ */
|
|
1024
|
+
rightSection: m.globalFilter ? /* @__PURE__ */ F(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__ */ I("fieldset", {
|
|
1031
1031
|
disabled: h,
|
|
1032
1032
|
style: {
|
|
1033
1033
|
display: "contents",
|
|
@@ -1035,13 +1035,13 @@ function Ye({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1035
1035
|
padding: 0,
|
|
1036
1036
|
margin: 0
|
|
1037
1037
|
},
|
|
1038
|
-
children: [_ && /* @__PURE__ */
|
|
1038
|
+
children: [_ && /* @__PURE__ */ F(He, {
|
|
1039
1039
|
view: e,
|
|
1040
1040
|
inlineThreshold: n
|
|
1041
|
-
}), v && /* @__PURE__ */
|
|
1041
|
+
}), v && /* @__PURE__ */ F(Ue, { view: e })]
|
|
1042
1042
|
})
|
|
1043
1043
|
]
|
|
1044
|
-
}), /* @__PURE__ */
|
|
1044
|
+
}), /* @__PURE__ */ F("fieldset", {
|
|
1045
1045
|
disabled: h,
|
|
1046
1046
|
style: {
|
|
1047
1047
|
display: "contents",
|
|
@@ -1049,12 +1049,12 @@ function Ye({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold
|
|
|
1049
1049
|
padding: 0,
|
|
1050
1050
|
margin: 0
|
|
1051
1051
|
},
|
|
1052
|
-
children: /* @__PURE__ */
|
|
1052
|
+
children: /* @__PURE__ */ I(x, {
|
|
1053
1053
|
wrap: "wrap",
|
|
1054
1054
|
gap: "sm",
|
|
1055
1055
|
children: [
|
|
1056
|
-
|
|
1057
|
-
|
|
1056
|
+
b && /* @__PURE__ */ F(Ke, { view: e }),
|
|
1057
|
+
S && /* @__PURE__ */ F(We, {
|
|
1058
1058
|
view: e,
|
|
1059
1059
|
lockSwitcherOnMobile: r
|
|
1060
1060
|
}),
|
|
@@ -1066,17 +1066,17 @@ function Ye({ 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 Je = R(null), Ye = Je.Provider;
|
|
1070
|
+
function Q() {
|
|
1071
|
+
let e = B(Je);
|
|
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 $({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMobile: i, animateRows: a, children: o, ...s }) {
|
|
1078
|
+
return /* @__PURE__ */ F(Ye, {
|
|
1079
|
+
value: H(() => ({
|
|
1080
1080
|
view: e,
|
|
1081
1081
|
slots: t,
|
|
1082
1082
|
renderCard: n,
|
|
@@ -1091,63 +1091,63 @@ function Z({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMo
|
|
|
1091
1091
|
i,
|
|
1092
1092
|
a
|
|
1093
1093
|
]),
|
|
1094
|
-
children: /* @__PURE__ */
|
|
1094
|
+
children: /* @__PURE__ */ F(j, {
|
|
1095
1095
|
...s,
|
|
1096
|
-
children: o ?? /* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1096
|
+
children: o ?? /* @__PURE__ */ I(P, { children: [
|
|
1097
|
+
/* @__PURE__ */ F(Xe, {}),
|
|
1098
|
+
/* @__PURE__ */ F($e, {}),
|
|
1099
|
+
/* @__PURE__ */ F(Ze, {}),
|
|
1100
|
+
/* @__PURE__ */ F(Qe, {})
|
|
1101
1101
|
] })
|
|
1102
1102
|
})
|
|
1103
1103
|
});
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1106
|
-
let { view: t, lockSwitcherOnMobile: n } =
|
|
1107
|
-
return /* @__PURE__ */
|
|
1105
|
+
function Xe(e) {
|
|
1106
|
+
let { view: t, lockSwitcherOnMobile: n } = Q();
|
|
1107
|
+
return /* @__PURE__ */ F(qe, {
|
|
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 Ze({ tableProps: e, cardsProps: t }) {
|
|
1114
|
+
let { view: n, slots: r, renderCard: i, fallbackRole: a, animateRows: o } = Q();
|
|
1115
|
+
return n.view === "cards" ? /* @__PURE__ */ F(fe, {
|
|
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__ */ F(Ce, {
|
|
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 Qe(e) {
|
|
1130
|
+
let { view: t } = Q();
|
|
1131
|
+
return /* @__PURE__ */ F(me, {
|
|
1132
1132
|
view: t,
|
|
1133
1133
|
...e
|
|
1134
1134
|
});
|
|
1135
1135
|
}
|
|
1136
|
-
function
|
|
1137
|
-
let { view: t, slots: n } =
|
|
1138
|
-
return /* @__PURE__ */
|
|
1136
|
+
function $e(e) {
|
|
1137
|
+
let { view: t, slots: n } = Q();
|
|
1138
|
+
return /* @__PURE__ */ F(q, {
|
|
1139
1139
|
view: t,
|
|
1140
1140
|
slots: n,
|
|
1141
1141
|
...e
|
|
1142
1142
|
});
|
|
1143
1143
|
}
|
|
1144
|
-
|
|
1144
|
+
$.Toolbar = Xe, $.BulkActions = $e, $.Body = Ze, $.Pagination = Qe;
|
|
1145
1145
|
//#endregion
|
|
1146
1146
|
//#region src/core/colBuilder.ts
|
|
1147
|
-
function
|
|
1147
|
+
function et(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 tt = {
|
|
1151
1151
|
text: {
|
|
1152
1152
|
dataType: "text",
|
|
1153
1153
|
filterVariant: "text"
|
|
@@ -1172,13 +1172,13 @@ var rt = {
|
|
|
1172
1172
|
},
|
|
1173
1173
|
select: { filterVariant: "select" },
|
|
1174
1174
|
multiselect: { filterVariant: "multiselect" }
|
|
1175
|
-
},
|
|
1175
|
+
}, nt = class {
|
|
1176
1176
|
cols = [];
|
|
1177
1177
|
helper = o();
|
|
1178
1178
|
add(e, t, n) {
|
|
1179
|
-
let r =
|
|
1179
|
+
let r = tt[e];
|
|
1180
1180
|
if (!r) throw Error(`Unknown preset: ${e}`);
|
|
1181
|
-
let i = n?.header ??
|
|
1181
|
+
let i = n?.header ?? et(t), a = n?.align ?? r.align, o;
|
|
1182
1182
|
if (n?.filter === !1) o = void 0;
|
|
1183
1183
|
else {
|
|
1184
1184
|
let e = {
|
|
@@ -1237,30 +1237,30 @@ var rt = {
|
|
|
1237
1237
|
return this.cols;
|
|
1238
1238
|
}
|
|
1239
1239
|
};
|
|
1240
|
-
function
|
|
1241
|
-
return new
|
|
1240
|
+
function rt() {
|
|
1241
|
+
return new nt();
|
|
1242
1242
|
}
|
|
1243
1243
|
//#endregion
|
|
1244
1244
|
//#region src/core/exportCsv.ts
|
|
1245
|
-
function
|
|
1245
|
+
function it(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
|
-
function
|
|
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) =>
|
|
1249
|
+
function at(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) => it(J(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 ? it(Me(t.columnDef.meta.dataType, t.columnDef.meta.format, a)(n)) : it(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
1257
|
//#region src/core/getViewMode.ts
|
|
1258
|
-
function
|
|
1258
|
+
function ot(e) {
|
|
1259
1259
|
return ("table" in e ? e.table : e).options.meta?.viewMode ?? "table";
|
|
1260
1260
|
}
|
|
1261
1261
|
//#endregion
|
|
1262
1262
|
//#region src/url/useUrlSync.ts
|
|
1263
|
-
function
|
|
1263
|
+
function st(e) {
|
|
1264
1264
|
return e ? {
|
|
1265
1265
|
adapter: e.adapter,
|
|
1266
1266
|
serializer: {
|
|
@@ -1270,7 +1270,7 @@ function ct(e) {
|
|
|
1270
1270
|
include: r(e.include)
|
|
1271
1271
|
} : null;
|
|
1272
1272
|
}
|
|
1273
|
-
function
|
|
1273
|
+
function ct(e, t, r) {
|
|
1274
1274
|
if (!e) return {};
|
|
1275
1275
|
try {
|
|
1276
1276
|
return n(e.adapter.read(), {
|
|
@@ -1283,21 +1283,21 @@ function lt(e, t, r) {
|
|
|
1283
1283
|
return {};
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
let s =
|
|
1286
|
+
function lt({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
1287
|
+
let s = U(i);
|
|
1288
1288
|
s.current = i;
|
|
1289
|
-
let c =
|
|
1289
|
+
let c = U(a);
|
|
1290
1290
|
c.current = a;
|
|
1291
|
-
let l =
|
|
1291
|
+
let l = U(o);
|
|
1292
1292
|
l.current = o;
|
|
1293
|
-
let u =
|
|
1293
|
+
let u = U(r);
|
|
1294
1294
|
u.current = r;
|
|
1295
1295
|
let d = r ? t(i, {
|
|
1296
1296
|
serializer: r.serializer,
|
|
1297
1297
|
include: r.include,
|
|
1298
1298
|
getFilterMeta: o
|
|
1299
1299
|
}) : null;
|
|
1300
|
-
|
|
1300
|
+
V(() => {
|
|
1301
1301
|
let t = u.current;
|
|
1302
1302
|
if (!t || !d) return;
|
|
1303
1303
|
let n = e(t.adapter.read(), t.serializer, t.include);
|
|
@@ -1305,7 +1305,7 @@ function ut({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1305
1305
|
...n,
|
|
1306
1306
|
...d
|
|
1307
1307
|
}, { replace: !0 });
|
|
1308
|
-
}, [d ? JSON.stringify(d) : ""]),
|
|
1308
|
+
}, [d ? JSON.stringify(d) : ""]), V(() => {
|
|
1309
1309
|
if (!r) return;
|
|
1310
1310
|
let { adapter: e, serializer: t, include: i } = r;
|
|
1311
1311
|
return e.subscribe?.(() => {
|
|
@@ -1321,18 +1321,18 @@ function ut({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
//#endregion
|
|
1323
1323
|
//#region src/core/resolveStatus.ts
|
|
1324
|
-
function
|
|
1324
|
+
function ut(e) {
|
|
1325
1325
|
return e.columnFilters.length > 0 || e.globalFilter.trim() !== "";
|
|
1326
1326
|
}
|
|
1327
|
-
function
|
|
1327
|
+
function dt({ status: e, error: t, pageRowCount: n, state: r }) {
|
|
1328
1328
|
return e === "error" ? {
|
|
1329
1329
|
phase: "error",
|
|
1330
1330
|
error: t
|
|
1331
|
-
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ?
|
|
1331
|
+
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ? ut(r) ? { phase: "empty-filtered" } : { phase: "empty" } : { phase: "ready" };
|
|
1332
1332
|
}
|
|
1333
1333
|
//#endregion
|
|
1334
1334
|
//#region src/core/useDataView.ts
|
|
1335
|
-
var
|
|
1335
|
+
var ft = 300, pt = [
|
|
1336
1336
|
10,
|
|
1337
1337
|
25,
|
|
1338
1338
|
50,
|
|
@@ -1340,14 +1340,14 @@ var $ = 300, pt = [
|
|
|
1340
1340
|
], mt = 10;
|
|
1341
1341
|
function ht(e) {
|
|
1342
1342
|
return e == null ? {
|
|
1343
|
-
globalFilter:
|
|
1344
|
-
columnFilters:
|
|
1343
|
+
globalFilter: ft,
|
|
1344
|
+
columnFilters: ft
|
|
1345
1345
|
} : typeof e == "number" ? {
|
|
1346
1346
|
globalFilter: e,
|
|
1347
1347
|
columnFilters: e
|
|
1348
1348
|
} : {
|
|
1349
|
-
globalFilter: e.globalFilter ??
|
|
1350
|
-
columnFilters: e.columnFilters ??
|
|
1349
|
+
globalFilter: e.globalFilter ?? ft,
|
|
1350
|
+
columnFilters: e.columnFilters ?? ft
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
1353
|
function gt(e) {
|
|
@@ -1382,74 +1382,74 @@ function vt(e) {
|
|
|
1382
1382
|
};
|
|
1383
1383
|
}
|
|
1384
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,
|
|
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, b = v ?? {}, x = y ? JSON.stringify(y) : "", S = y ?? {}, C = H(() => t.map((e) => {
|
|
1386
1386
|
let t = e.meta?.dataType;
|
|
1387
1387
|
if (!t || e.cell) return e;
|
|
1388
|
-
let n =
|
|
1388
|
+
let n = Me(t, e.meta?.format, _);
|
|
1389
1389
|
return {
|
|
1390
1390
|
...e,
|
|
1391
1391
|
cell: (e) => n(e.getValue())
|
|
1392
1392
|
};
|
|
1393
|
-
}), [t, _]),
|
|
1393
|
+
}), [t, _]), ee = H(() => _t(C), [C]), w = H(() => st(e.urlSync), [e.urlSync]), [te, ne] = W(() => {
|
|
1394
1394
|
let t = vt(e);
|
|
1395
1395
|
return {
|
|
1396
1396
|
...t,
|
|
1397
|
-
...
|
|
1397
|
+
...ct(w, t, ee)
|
|
1398
1398
|
};
|
|
1399
|
-
}),
|
|
1400
|
-
...
|
|
1399
|
+
}), T = H(() => ({
|
|
1400
|
+
...te,
|
|
1401
1401
|
...d
|
|
1402
|
-
}), [
|
|
1403
|
-
|
|
1404
|
-
let
|
|
1405
|
-
|
|
1402
|
+
}), [te, d]), E = U(T);
|
|
1403
|
+
E.current = T;
|
|
1404
|
+
let D = z((e) => {
|
|
1405
|
+
ne((t) => ({
|
|
1406
1406
|
...t,
|
|
1407
1407
|
...e
|
|
1408
1408
|
})), f?.({
|
|
1409
|
-
...
|
|
1409
|
+
...E.current,
|
|
1410
1410
|
...e
|
|
1411
1411
|
});
|
|
1412
1412
|
}, [f]);
|
|
1413
|
-
|
|
1414
|
-
config:
|
|
1415
|
-
state:
|
|
1416
|
-
applyPatch:
|
|
1417
|
-
getFilterMeta:
|
|
1413
|
+
lt({
|
|
1414
|
+
config: w,
|
|
1415
|
+
state: T,
|
|
1416
|
+
applyPatch: D,
|
|
1417
|
+
getFilterMeta: ee
|
|
1418
1418
|
});
|
|
1419
|
-
let
|
|
1420
|
-
...
|
|
1419
|
+
let O = z(() => ({
|
|
1420
|
+
...E.current.pagination,
|
|
1421
1421
|
pageIndex: 0
|
|
1422
|
-
}), []),
|
|
1423
|
-
|
|
1424
|
-
|
|
1422
|
+
}), []), k = U(x);
|
|
1423
|
+
V(() => {
|
|
1424
|
+
k.current !== x && (k.current = x, D({ pagination: O() }));
|
|
1425
1425
|
});
|
|
1426
|
-
let
|
|
1427
|
-
|
|
1428
|
-
}, [
|
|
1429
|
-
|
|
1430
|
-
sorting: c(e,
|
|
1431
|
-
pagination:
|
|
1426
|
+
let A = z((e) => {
|
|
1427
|
+
D({ pagination: c(e, E.current.pagination) });
|
|
1428
|
+
}, [D]), j = z((e) => {
|
|
1429
|
+
D({
|
|
1430
|
+
sorting: c(e, E.current.sorting),
|
|
1431
|
+
pagination: O()
|
|
1432
1432
|
});
|
|
1433
|
-
}, [
|
|
1434
|
-
|
|
1435
|
-
columnFilters: c(e,
|
|
1436
|
-
pagination:
|
|
1433
|
+
}, [D, O]), M = z((e) => {
|
|
1434
|
+
D({
|
|
1435
|
+
columnFilters: c(e, E.current.columnFilters),
|
|
1436
|
+
pagination: O()
|
|
1437
1437
|
});
|
|
1438
|
-
}, [
|
|
1439
|
-
|
|
1440
|
-
globalFilter: c(e,
|
|
1441
|
-
pagination:
|
|
1438
|
+
}, [D, O]), N = z((e) => {
|
|
1439
|
+
D({
|
|
1440
|
+
globalFilter: c(e, E.current.globalFilter),
|
|
1441
|
+
pagination: O()
|
|
1442
1442
|
});
|
|
1443
|
-
}, [
|
|
1444
|
-
|
|
1445
|
-
}, [
|
|
1446
|
-
|
|
1447
|
-
}, [
|
|
1448
|
-
|
|
1449
|
-
}, [
|
|
1443
|
+
}, [D, O]), re = z((e) => {
|
|
1444
|
+
D({ rowSelection: c(e, E.current.rowSelection) });
|
|
1445
|
+
}, [D]), ie = z((e) => {
|
|
1446
|
+
D({ columnVisibility: c(e, E.current.columnVisibility) });
|
|
1447
|
+
}, [D]), ae = z((e) => {
|
|
1448
|
+
D({ columnPinning: c(e, E.current.columnPinning) });
|
|
1449
|
+
}, [D]), P = ke(g), F = P ? "cards" : T.view, I = u({
|
|
1450
1450
|
data: n,
|
|
1451
|
-
meta: { viewMode:
|
|
1452
|
-
columns:
|
|
1451
|
+
meta: { viewMode: F },
|
|
1452
|
+
columns: C,
|
|
1453
1453
|
getCoreRowModel: l(),
|
|
1454
1454
|
manualPagination: !0,
|
|
1455
1455
|
manualSorting: !0,
|
|
@@ -1460,127 +1460,186 @@ function yt(e) {
|
|
|
1460
1460
|
enableRowSelection: typeof p == "function" ? (e) => p(e.original) : p ?? !0,
|
|
1461
1461
|
enableGlobalFilter: m,
|
|
1462
1462
|
state: {
|
|
1463
|
-
pagination:
|
|
1464
|
-
sorting:
|
|
1465
|
-
columnFilters:
|
|
1466
|
-
globalFilter:
|
|
1467
|
-
rowSelection:
|
|
1468
|
-
columnVisibility:
|
|
1469
|
-
columnPinning:
|
|
1463
|
+
pagination: T.pagination,
|
|
1464
|
+
sorting: T.sorting,
|
|
1465
|
+
columnFilters: T.columnFilters,
|
|
1466
|
+
globalFilter: T.globalFilter,
|
|
1467
|
+
rowSelection: T.rowSelection,
|
|
1468
|
+
columnVisibility: T.columnVisibility,
|
|
1469
|
+
columnPinning: T.columnPinning
|
|
1470
1470
|
},
|
|
1471
|
-
onPaginationChange:
|
|
1472
|
-
onSortingChange:
|
|
1473
|
-
onColumnFiltersChange:
|
|
1474
|
-
onGlobalFilterChange:
|
|
1475
|
-
onRowSelectionChange:
|
|
1476
|
-
onColumnVisibilityChange:
|
|
1477
|
-
onColumnPinningChange:
|
|
1478
|
-
}),
|
|
1479
|
-
pagination:
|
|
1480
|
-
sorting:
|
|
1481
|
-
filters:
|
|
1482
|
-
globalFilter:
|
|
1483
|
-
params:
|
|
1471
|
+
onPaginationChange: A,
|
|
1472
|
+
onSortingChange: j,
|
|
1473
|
+
onColumnFiltersChange: M,
|
|
1474
|
+
onGlobalFilterChange: N,
|
|
1475
|
+
onRowSelectionChange: re,
|
|
1476
|
+
onColumnVisibilityChange: ie,
|
|
1477
|
+
onColumnPinningChange: ae
|
|
1478
|
+
}), L = H(() => ({
|
|
1479
|
+
pagination: T.pagination,
|
|
1480
|
+
sorting: T.sorting,
|
|
1481
|
+
filters: T.columnFilters,
|
|
1482
|
+
globalFilter: T.globalFilter,
|
|
1483
|
+
params: S
|
|
1484
1484
|
}), [
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
]),
|
|
1491
|
-
|
|
1492
|
-
let
|
|
1493
|
-
|
|
1494
|
-
let
|
|
1495
|
-
|
|
1496
|
-
let e =
|
|
1497
|
-
|
|
1485
|
+
T.pagination,
|
|
1486
|
+
T.sorting,
|
|
1487
|
+
T.columnFilters,
|
|
1488
|
+
T.globalFilter,
|
|
1489
|
+
x
|
|
1490
|
+
]), R = U(s);
|
|
1491
|
+
R.current = s;
|
|
1492
|
+
let B = U(ht(h));
|
|
1493
|
+
B.current = ht(h);
|
|
1494
|
+
let oe = U(null), G = U(void 0);
|
|
1495
|
+
V(() => {
|
|
1496
|
+
let e = oe.current, t = e === null, n = !e || e.globalFilter !== L.globalFilter, r = !e || e.filters !== L.filters, i = () => {
|
|
1497
|
+
oe.current = L, R.current?.(L);
|
|
1498
1498
|
}, a = 0;
|
|
1499
|
-
n && (a = Math.max(a,
|
|
1499
|
+
n && (a = Math.max(a, B.current.globalFilter)), r && (a = Math.max(a, B.current.columnFilters));
|
|
1500
1500
|
let o = !t && (n || r) && a > 0;
|
|
1501
|
-
return clearTimeout(
|
|
1502
|
-
}, [
|
|
1503
|
-
let
|
|
1504
|
-
|
|
1505
|
-
let
|
|
1506
|
-
|
|
1507
|
-
}, []),
|
|
1501
|
+
return clearTimeout(G.current), o ? G.current = setTimeout(i, a) : i(), () => clearTimeout(G.current);
|
|
1502
|
+
}, [L]);
|
|
1503
|
+
let K = U(L);
|
|
1504
|
+
K.current = L;
|
|
1505
|
+
let q = z(() => {
|
|
1506
|
+
R.current?.(K.current);
|
|
1507
|
+
}, []), J = H(() => dt({
|
|
1508
1508
|
status: i,
|
|
1509
1509
|
error: a,
|
|
1510
1510
|
pageRowCount: n.length,
|
|
1511
|
-
state:
|
|
1511
|
+
state: T
|
|
1512
1512
|
}), [
|
|
1513
1513
|
i,
|
|
1514
1514
|
a,
|
|
1515
1515
|
n.length,
|
|
1516
|
-
|
|
1517
|
-
]),
|
|
1516
|
+
T
|
|
1517
|
+
]), se = z((e) => D({ view: e }), [D]), ce = e.pageSizeOptions ?? pt, Y = I.getAllColumns(), le = Y.filter((e) => e.getCanSort()), ue = Y.filter((e) => e.columnDef.meta?.filter != null), X = z(() => D({ rowSelection: {} }), [D]);
|
|
1518
1518
|
return {
|
|
1519
|
-
table:
|
|
1520
|
-
request:
|
|
1521
|
-
state:
|
|
1522
|
-
view:
|
|
1523
|
-
setView:
|
|
1524
|
-
isMobileForced:
|
|
1519
|
+
table: I,
|
|
1520
|
+
request: L,
|
|
1521
|
+
state: T,
|
|
1522
|
+
view: F,
|
|
1523
|
+
setView: se,
|
|
1524
|
+
isMobileForced: P,
|
|
1525
1525
|
status: i,
|
|
1526
1526
|
error: a,
|
|
1527
|
-
renderStatus:
|
|
1528
|
-
refetch:
|
|
1529
|
-
pageSizeOptions:
|
|
1530
|
-
sortableColumns:
|
|
1531
|
-
filterableColumns:
|
|
1532
|
-
selection:
|
|
1533
|
-
let e =
|
|
1527
|
+
renderStatus: J,
|
|
1528
|
+
refetch: q,
|
|
1529
|
+
pageSizeOptions: ce,
|
|
1530
|
+
sortableColumns: le,
|
|
1531
|
+
filterableColumns: ue,
|
|
1532
|
+
selection: H(() => {
|
|
1533
|
+
let e = T.rowSelection, t = Object.keys(e).filter((t) => e[t]), r = n.filter((t) => e[o(t)] === !0);
|
|
1534
1534
|
return {
|
|
1535
1535
|
count: t.length,
|
|
1536
1536
|
ids: t,
|
|
1537
1537
|
rows: r,
|
|
1538
|
-
clear:
|
|
1538
|
+
clear: X
|
|
1539
1539
|
};
|
|
1540
1540
|
}, [
|
|
1541
|
-
|
|
1541
|
+
T.rowSelection,
|
|
1542
1542
|
n,
|
|
1543
1543
|
o,
|
|
1544
|
-
|
|
1544
|
+
X
|
|
1545
1545
|
]),
|
|
1546
|
-
exportCsv:
|
|
1547
|
-
facets:
|
|
1548
|
-
resetFilter:
|
|
1549
|
-
resetAllFilters:
|
|
1546
|
+
exportCsv: z((e) => at(I, e), [I]),
|
|
1547
|
+
facets: b,
|
|
1548
|
+
resetFilter: z((e) => I.getColumn(e)?.setFilterValue(void 0), [I]),
|
|
1549
|
+
resetAllFilters: z(() => I.resetColumnFilters(), [I]),
|
|
1550
|
+
patchRow: z((e) => {
|
|
1551
|
+
q();
|
|
1552
|
+
}, [q]),
|
|
1553
|
+
insertRow: z((e) => {
|
|
1554
|
+
q();
|
|
1555
|
+
}, [q]),
|
|
1556
|
+
removeRow: z((e) => {
|
|
1557
|
+
q();
|
|
1558
|
+
}, [q]),
|
|
1559
|
+
isRevalidating: !1
|
|
1550
1560
|
};
|
|
1551
1561
|
}
|
|
1552
1562
|
//#endregion
|
|
1553
1563
|
//#region src/core/useDataViewFetcher.ts
|
|
1554
|
-
|
|
1555
|
-
|
|
1564
|
+
var bt = 1e3;
|
|
1565
|
+
function xt({ fetcher: e, deps: t, revalidateDelay: n = bt, ...r }) {
|
|
1566
|
+
let [i, a] = W({
|
|
1556
1567
|
rows: [],
|
|
1557
1568
|
rowCount: 0
|
|
1558
|
-
}), [
|
|
1559
|
-
|
|
1560
|
-
let
|
|
1561
|
-
|
|
1562
|
-
let t = ++
|
|
1563
|
-
|
|
1569
|
+
}), [o, s] = W("idle"), [c, l] = W(void 0), [u, d] = W(!1), f = U(e);
|
|
1570
|
+
f.current = e;
|
|
1571
|
+
let p = U(0), m = U(null), h = U(void 0), g = z(async (e) => {
|
|
1572
|
+
m.current = e;
|
|
1573
|
+
let t = ++p.current;
|
|
1574
|
+
s("loading");
|
|
1564
1575
|
try {
|
|
1565
|
-
let n = await
|
|
1566
|
-
t ===
|
|
1576
|
+
let n = await f.current(e);
|
|
1577
|
+
t === p.current && (a(n), l(void 0), s("success"), d(!1));
|
|
1567
1578
|
} catch (e) {
|
|
1568
|
-
t ===
|
|
1579
|
+
t === p.current && (l(e), s("error"), d(!1));
|
|
1569
1580
|
}
|
|
1570
|
-
}, []),
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
}), yt({
|
|
1574
|
-
...n,
|
|
1575
|
-
rows: r.rows,
|
|
1576
|
-
rowCount: r.rowCount,
|
|
1577
|
-
facets: r.facets,
|
|
1578
|
-
status: a,
|
|
1579
|
-
error: s,
|
|
1580
|
-
onRequestChange: f
|
|
1581
|
+
}, []), _ = t ? JSON.stringify(t) : "", v = U(_);
|
|
1582
|
+
V(() => {
|
|
1583
|
+
v.current !== _ && (v.current = _, m.current && g(m.current));
|
|
1581
1584
|
});
|
|
1585
|
+
let y = U(r.getRowId);
|
|
1586
|
+
y.current = r.getRowId;
|
|
1587
|
+
let b = z(() => {
|
|
1588
|
+
clearTimeout(h.current), d(!0), h.current = setTimeout(async () => {
|
|
1589
|
+
if (m.current) {
|
|
1590
|
+
let e = ++p.current;
|
|
1591
|
+
try {
|
|
1592
|
+
let t = await f.current(m.current);
|
|
1593
|
+
e === p.current && (a(t), l(void 0), d(!1));
|
|
1594
|
+
} catch (t) {
|
|
1595
|
+
e === p.current && (l(t), d(!1));
|
|
1596
|
+
}
|
|
1597
|
+
} else d(!1);
|
|
1598
|
+
}, n);
|
|
1599
|
+
}, [n]), x = z((e) => {
|
|
1600
|
+
let t = y.current(e);
|
|
1601
|
+
a((n) => {
|
|
1602
|
+
let r = n.rows.findIndex((e) => y.current(e) === t);
|
|
1603
|
+
if (r === -1) return n;
|
|
1604
|
+
let i = [...n.rows];
|
|
1605
|
+
return i[r] = e, {
|
|
1606
|
+
...n,
|
|
1607
|
+
rows: i
|
|
1608
|
+
};
|
|
1609
|
+
}), b();
|
|
1610
|
+
}, [b]), S = z((e) => {
|
|
1611
|
+
a((t) => ({
|
|
1612
|
+
...t,
|
|
1613
|
+
rows: [e, ...t.rows],
|
|
1614
|
+
rowCount: t.rowCount + 1
|
|
1615
|
+
})), b();
|
|
1616
|
+
}, [b]), C = z((e) => {
|
|
1617
|
+
a((t) => {
|
|
1618
|
+
let n = t.rows.filter((t) => y.current(t) !== e);
|
|
1619
|
+
return n.length === t.rows.length ? t : {
|
|
1620
|
+
...t,
|
|
1621
|
+
rows: n,
|
|
1622
|
+
rowCount: t.rowCount - 1
|
|
1623
|
+
};
|
|
1624
|
+
}), b();
|
|
1625
|
+
}, [b]);
|
|
1626
|
+
return V(() => () => clearTimeout(h.current), []), {
|
|
1627
|
+
...yt({
|
|
1628
|
+
...r,
|
|
1629
|
+
rows: i.rows,
|
|
1630
|
+
rowCount: i.rowCount,
|
|
1631
|
+
facets: i.facets,
|
|
1632
|
+
status: o,
|
|
1633
|
+
error: c,
|
|
1634
|
+
onRequestChange: g
|
|
1635
|
+
}),
|
|
1636
|
+
patchRow: x,
|
|
1637
|
+
insertRow: S,
|
|
1638
|
+
removeRow: C,
|
|
1639
|
+
isRevalidating: u
|
|
1640
|
+
};
|
|
1582
1641
|
}
|
|
1583
1642
|
//#endregion
|
|
1584
|
-
export {
|
|
1643
|
+
export { nt as ColumnBuilder, q as DataBulkActions, fe as DataCards, me as DataPagination, Ce as DataTable, qe as DataToolbar, $ as DataViewer, Re as FilterControl, We as ViewSwitcher, rt as col, ce as composeCardLayout, a as createColumnHelper, at as exportCsv, ot as getViewMode, J as resolveColumnLabel, yt as useDataView, Q as useDataViewContext, xt as useDataViewFetcher };
|
|
1585
1644
|
|
|
1586
1645
|
//# sourceMappingURL=index.js.map
|