@ethanhann/mantine-dataview 0.2.0 → 0.4.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 +216 -40
- package/dist/components/DataCards/DataCards.d.ts +3 -1
- package/dist/components/DataTable/DataTable.d.ts +5 -1
- package/dist/components/DataToolbar/DataToolbar.d.ts +8 -1
- package/dist/components/DataToolbar/ViewSwitcher.d.ts +8 -2
- package/dist/components/DataToolbar/index.d.ts +1 -0
- package/dist/components/{DataView/DataView.d.ts → DataViewer/DataViewer.d.ts} +9 -7
- package/dist/components/{DataView → DataViewer}/context.d.ts +1 -0
- package/dist/components/DataViewer/index.d.ts +2 -0
- package/dist/core/useRowTransition.d.ts +8 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +482 -413
- package/dist/index.js.map +1 -1
- package/dist/mantine-dataview.css +2 -0
- package/dist/types/options.d.ts +3 -1
- package/dist/types/request.d.ts +4 -0
- package/package.json +1 -1
- package/dist/components/DataView/index.d.ts +0 -2
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
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { useDisclosure as oe, useMediaQuery 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 P, UnstyledButton as re, useMantineTheme as ie } from "@mantine/core";
|
|
4
|
+
import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as R, createContext as ae, useCallback as z, useContext as B, useEffect as V, useMemo as H, useRef as U, useState as W } from "react";
|
|
6
|
+
import { useDisclosure as oe, useMediaQuery as se } from "@mantine/hooks";
|
|
7
|
+
import { DatePickerInput as ce } from "@mantine/dates";
|
|
8
8
|
import "@mantine/dates/styles.css";
|
|
9
9
|
//#region src/components/DataBulkActions/DataBulkActions.tsx
|
|
10
|
-
function
|
|
10
|
+
function G({ 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__ */ I(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__ */ L(x, {
|
|
20
20
|
justify: "space-between",
|
|
21
21
|
wrap: "wrap",
|
|
22
22
|
gap: "sm",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ L(x, {
|
|
24
24
|
gap: "sm",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
25
|
+
children: [/* @__PURE__ */ L(N, {
|
|
26
26
|
size: "sm",
|
|
27
27
|
fw: 500,
|
|
28
28
|
children: [r.count, " selected"]
|
|
29
|
-
}), /* @__PURE__ */
|
|
29
|
+
}), /* @__PURE__ */ I(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__ */ I(x, {
|
|
36
36
|
gap: "xs",
|
|
37
37
|
children: t.BulkActions(r)
|
|
38
38
|
})]
|
|
@@ -41,14 +41,14 @@ function q({ view: e, slots: t, ...n }) {
|
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/core/cardComposition.ts
|
|
44
|
-
function
|
|
44
|
+
function K(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 le(e, t, n) {
|
|
49
49
|
return t ? t === "hidden" ? null : t : e.accessorFn == null || n === "hidden" ? null : n;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function ue(e, t = {}) {
|
|
52
52
|
let n = t.fallbackRole ?? "meta", r = {
|
|
53
53
|
title: [],
|
|
54
54
|
subtitle: [],
|
|
@@ -57,14 +57,14 @@ function Y(e, t = {}) {
|
|
|
57
57
|
meta: []
|
|
58
58
|
};
|
|
59
59
|
e.getVisibleLeafColumns().forEach((e, t) => {
|
|
60
|
-
let i = e.columnDef.meta?.card, a =
|
|
60
|
+
let i = e.columnDef.meta?.card, a = le(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: K(e),
|
|
68
68
|
showLabel: i?.showLabel ?? a === "meta"
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -79,21 +79,36 @@ function Y(e, t = {}) {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
|
+
//#region src/core/useRowTransition.ts
|
|
83
|
+
function q(e, t) {
|
|
84
|
+
let n = U([]), r = U(!1), i = U(0), a = e.map((e) => e.id), o = /* @__PURE__ */ new Set();
|
|
85
|
+
if (t && r.current) {
|
|
86
|
+
let e = n.current, t = new Set(e);
|
|
87
|
+
if (a.length !== e.length || a.some((t, n) => t !== e[n])) if (i.current++, a.length === e.length && a.every((e) => t.has(e))) for (let e of a) o.add(e);
|
|
88
|
+
else for (let e of a) t.has(e) || o.add(e);
|
|
89
|
+
}
|
|
90
|
+
return n.current = a, r.current = !0, {
|
|
91
|
+
rows: e,
|
|
92
|
+
entering: o,
|
|
93
|
+
generation: i.current
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
82
97
|
//#region src/components/StateMessage.tsx
|
|
83
|
-
function
|
|
98
|
+
function de(e) {
|
|
84
99
|
e.resetColumnFilters(), e.setGlobalFilter("");
|
|
85
100
|
}
|
|
86
|
-
function
|
|
87
|
-
return t?.ErrorState ? /* @__PURE__ */
|
|
101
|
+
function fe({ view: e, slots: t }) {
|
|
102
|
+
return t?.ErrorState ? /* @__PURE__ */ I(F, { children: t.ErrorState({
|
|
88
103
|
error: e.error,
|
|
89
104
|
retry: e.refetch
|
|
90
|
-
}) }) : /* @__PURE__ */
|
|
105
|
+
}) }) : /* @__PURE__ */ L(j, {
|
|
91
106
|
align: "center",
|
|
92
107
|
gap: "xs",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ I(N, {
|
|
94
109
|
c: "red",
|
|
95
110
|
children: "Something went wrong."
|
|
96
|
-
}), /* @__PURE__ */
|
|
111
|
+
}), /* @__PURE__ */ I(h, {
|
|
97
112
|
variant: "light",
|
|
98
113
|
size: "xs",
|
|
99
114
|
onClick: e.refetch,
|
|
@@ -101,119 +116,125 @@ function le({ view: e, slots: t }) {
|
|
|
101
116
|
})]
|
|
102
117
|
});
|
|
103
118
|
}
|
|
104
|
-
function
|
|
105
|
-
let n = e.renderStatus.phase === "empty-filtered", r = () =>
|
|
106
|
-
return t?.Empty ? /* @__PURE__ */
|
|
119
|
+
function J({ view: e, slots: t }) {
|
|
120
|
+
let n = e.renderStatus.phase === "empty-filtered", r = () => de(e.table);
|
|
121
|
+
return t?.Empty ? /* @__PURE__ */ I(F, { children: t.Empty({
|
|
107
122
|
filtered: n,
|
|
108
123
|
clearFilters: r
|
|
109
|
-
}) }) : n ? /* @__PURE__ */
|
|
124
|
+
}) }) : n ? /* @__PURE__ */ L(j, {
|
|
110
125
|
align: "center",
|
|
111
126
|
gap: "xs",
|
|
112
|
-
children: [/* @__PURE__ */
|
|
127
|
+
children: [/* @__PURE__ */ I(N, {
|
|
113
128
|
c: "dimmed",
|
|
114
129
|
children: "No matches."
|
|
115
|
-
}), /* @__PURE__ */
|
|
130
|
+
}), /* @__PURE__ */ I(h, {
|
|
116
131
|
variant: "subtle",
|
|
117
132
|
size: "xs",
|
|
118
133
|
onClick: r,
|
|
119
134
|
children: "Clear filters"
|
|
120
135
|
})]
|
|
121
|
-
}) : /* @__PURE__ */
|
|
136
|
+
}) : /* @__PURE__ */ I(N, {
|
|
122
137
|
c: "dimmed",
|
|
123
138
|
children: "No results."
|
|
124
139
|
});
|
|
125
140
|
}
|
|
126
141
|
//#endregion
|
|
127
142
|
//#region src/components/DataCards/DataCards.tsx
|
|
128
|
-
var
|
|
143
|
+
var pe = {
|
|
129
144
|
base: 1,
|
|
130
145
|
sm: 2,
|
|
131
146
|
lg: 3
|
|
132
147
|
};
|
|
133
|
-
function
|
|
134
|
-
let { table:
|
|
135
|
-
cols:
|
|
136
|
-
...
|
|
148
|
+
function me({ view: e, slots: t, renderCard: n, fallbackRole: r, enableSelection: i, loadingCardCount: a, animateRows: o = !1, cols: s = pe, ...c }) {
|
|
149
|
+
let { table: l, renderStatus: u } = e, d = i ?? l.options.enableRowSelection !== !1, f = a ?? Math.min(e.state.pagination.pageSize, 6), p = {
|
|
150
|
+
cols: s,
|
|
151
|
+
...c
|
|
152
|
+
}, m = q(l.getRowModel().rows, o), h = (e) => {
|
|
153
|
+
let i = ue(l, { fallbackRole: r });
|
|
154
|
+
return /* @__PURE__ */ I(k, {
|
|
155
|
+
"data-changed": o || void 0,
|
|
156
|
+
...p,
|
|
157
|
+
children: e.map((e) => {
|
|
158
|
+
let r = e.getIsSelected(), a = {
|
|
159
|
+
row: e,
|
|
160
|
+
data: e.original,
|
|
161
|
+
selected: r,
|
|
162
|
+
toggleSelected: () => e.toggleSelected()
|
|
163
|
+
}, o = m.entering.has(e.id) || void 0;
|
|
164
|
+
if (n) return /* @__PURE__ */ I("div", {
|
|
165
|
+
"data-entering": o,
|
|
166
|
+
children: n(a)
|
|
167
|
+
}, e.id);
|
|
168
|
+
let s = /* @__PURE__ */ I(he, {
|
|
169
|
+
row: e,
|
|
170
|
+
layout: i,
|
|
171
|
+
selectionEnabled: d
|
|
172
|
+
});
|
|
173
|
+
return t?.Card ? /* @__PURE__ */ I("div", {
|
|
174
|
+
"data-entering": o,
|
|
175
|
+
children: t.Card({
|
|
176
|
+
...a,
|
|
177
|
+
children: s
|
|
178
|
+
})
|
|
179
|
+
}, e.id) : /* @__PURE__ */ I(g, {
|
|
180
|
+
withBorder: !0,
|
|
181
|
+
padding: "lg",
|
|
182
|
+
pos: "relative",
|
|
183
|
+
"data-selected": r || void 0,
|
|
184
|
+
"data-entering": o,
|
|
185
|
+
children: s
|
|
186
|
+
}, e.id);
|
|
187
|
+
})
|
|
188
|
+
}, m.generation);
|
|
137
189
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
190
|
+
if (o && u.phase === "loading" && m.rows.length > 0) return h(m.rows);
|
|
191
|
+
switch (u.phase) {
|
|
192
|
+
case "loading": return t?.LoadingCards ? t.LoadingCards() : /* @__PURE__ */ I(k, {
|
|
193
|
+
...p,
|
|
194
|
+
children: Array.from({ length: f }, (e, t) => /* @__PURE__ */ I(g, {
|
|
142
195
|
withBorder: !0,
|
|
143
196
|
padding: "md",
|
|
144
|
-
children: /* @__PURE__ */
|
|
197
|
+
children: /* @__PURE__ */ L(j, {
|
|
145
198
|
gap: "xs",
|
|
146
199
|
children: [
|
|
147
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ I(A, {
|
|
148
201
|
height: 20,
|
|
149
202
|
width: "60%"
|
|
150
203
|
}),
|
|
151
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ I(A, {
|
|
152
205
|
height: 12,
|
|
153
206
|
width: "40%"
|
|
154
207
|
}),
|
|
155
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ I(A, { height: 12 })
|
|
156
209
|
]
|
|
157
210
|
})
|
|
158
211
|
}, t))
|
|
159
212
|
});
|
|
160
|
-
case "error": return /* @__PURE__ */
|
|
213
|
+
case "error": return /* @__PURE__ */ I(_, {
|
|
161
214
|
p: "xl",
|
|
162
|
-
children: /* @__PURE__ */
|
|
215
|
+
children: /* @__PURE__ */ I(fe, {
|
|
163
216
|
view: e,
|
|
164
217
|
slots: t
|
|
165
218
|
})
|
|
166
219
|
});
|
|
167
220
|
case "empty":
|
|
168
|
-
case "empty-filtered": return /* @__PURE__ */
|
|
221
|
+
case "empty-filtered": return /* @__PURE__ */ I(_, {
|
|
169
222
|
p: "xl",
|
|
170
|
-
children: /* @__PURE__ */
|
|
223
|
+
children: /* @__PURE__ */ I(J, {
|
|
171
224
|
view: e,
|
|
172
225
|
slots: t
|
|
173
226
|
})
|
|
174
227
|
});
|
|
175
|
-
default:
|
|
176
|
-
let e = Y(c, { fallbackRole: r });
|
|
177
|
-
return /* @__PURE__ */ L(re, {
|
|
178
|
-
...f,
|
|
179
|
-
children: c.getRowModel().rows.map((r) => {
|
|
180
|
-
let i = r.getIsSelected(), a = {
|
|
181
|
-
row: r,
|
|
182
|
-
data: r.original,
|
|
183
|
-
selected: i,
|
|
184
|
-
toggleSelected: () => r.toggleSelected()
|
|
185
|
-
};
|
|
186
|
-
if (n) return /* @__PURE__ */ L(pe, { children: n(a) }, r.id);
|
|
187
|
-
let o = /* @__PURE__ */ L(me, {
|
|
188
|
-
row: r,
|
|
189
|
-
layout: e,
|
|
190
|
-
selectionEnabled: u
|
|
191
|
-
});
|
|
192
|
-
return t?.Card ? /* @__PURE__ */ L(pe, { children: t.Card({
|
|
193
|
-
...a,
|
|
194
|
-
children: o
|
|
195
|
-
}) }, r.id) : /* @__PURE__ */ L(g, {
|
|
196
|
-
withBorder: !0,
|
|
197
|
-
padding: "lg",
|
|
198
|
-
pos: "relative",
|
|
199
|
-
"data-selected": i || void 0,
|
|
200
|
-
children: o
|
|
201
|
-
}, r.id);
|
|
202
|
-
})
|
|
203
|
-
});
|
|
204
|
-
}
|
|
228
|
+
default: return h(m.rows);
|
|
205
229
|
}
|
|
206
230
|
}
|
|
207
|
-
function
|
|
208
|
-
return /* @__PURE__ */ L(I, { children: e });
|
|
209
|
-
}
|
|
210
|
-
function me({ row: e, layout: t, selectionEnabled: n }) {
|
|
231
|
+
function he({ row: e, layout: t, selectionEnabled: n }) {
|
|
211
232
|
let r = new Map(e.getAllCells().map((e) => [e.column.id, e])), i = (e) => {
|
|
212
233
|
let t = r.get(e.id);
|
|
213
234
|
return t ? s(t.column.columnDef.cell, t.getContext()) : null;
|
|
214
235
|
};
|
|
215
|
-
return /* @__PURE__ */
|
|
216
|
-
n && /* @__PURE__ */
|
|
236
|
+
return /* @__PURE__ */ L(F, { children: [
|
|
237
|
+
n && /* @__PURE__ */ I(v, {
|
|
217
238
|
"aria-label": "Select card",
|
|
218
239
|
checked: e.getIsSelected(),
|
|
219
240
|
disabled: !e.getCanSelect(),
|
|
@@ -225,42 +246,42 @@ function me({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
225
246
|
zIndex: 1
|
|
226
247
|
}
|
|
227
248
|
}),
|
|
228
|
-
t.media.length > 0 && /* @__PURE__ */
|
|
249
|
+
t.media.length > 0 && /* @__PURE__ */ I(g.Section, {
|
|
229
250
|
mb: "xs",
|
|
230
|
-
children: t.media.map((e) => /* @__PURE__ */
|
|
251
|
+
children: t.media.map((e) => /* @__PURE__ */ I(m, { children: i(e) }, e.id))
|
|
231
252
|
}),
|
|
232
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ L(j, {
|
|
233
254
|
gap: "md",
|
|
234
255
|
children: [
|
|
235
|
-
(t.title.length > 0 || t.subtitle.length > 0) && /* @__PURE__ */
|
|
256
|
+
(t.title.length > 0 || t.subtitle.length > 0) && /* @__PURE__ */ L(j, {
|
|
236
257
|
gap: 4,
|
|
237
|
-
children: [t.title.map((e) => /* @__PURE__ */
|
|
258
|
+
children: [t.title.map((e) => /* @__PURE__ */ I(N, {
|
|
238
259
|
fw: 600,
|
|
239
260
|
size: "lg",
|
|
240
261
|
lh: 1.2,
|
|
241
262
|
pr: n ? 28 : 0,
|
|
242
263
|
children: i(e)
|
|
243
|
-
}, e.id)), t.subtitle.map((e) => /* @__PURE__ */
|
|
264
|
+
}, e.id)), t.subtitle.map((e) => /* @__PURE__ */ I(N, {
|
|
244
265
|
size: "sm",
|
|
245
266
|
c: "dimmed",
|
|
246
267
|
children: i(e)
|
|
247
268
|
}, e.id))]
|
|
248
269
|
}),
|
|
249
|
-
t.badge.length > 0 && /* @__PURE__ */
|
|
270
|
+
t.badge.length > 0 && /* @__PURE__ */ I(x, {
|
|
250
271
|
gap: "xs",
|
|
251
|
-
children: t.badge.map((e) => /* @__PURE__ */
|
|
272
|
+
children: t.badge.map((e) => /* @__PURE__ */ I(R, { children: i(e) }, e.id))
|
|
252
273
|
}),
|
|
253
|
-
t.meta.length > 0 && /* @__PURE__ */
|
|
274
|
+
t.meta.length > 0 && /* @__PURE__ */ I(j, {
|
|
254
275
|
gap: 4,
|
|
255
|
-
children: t.meta.map((e) => /* @__PURE__ */
|
|
276
|
+
children: t.meta.map((e) => /* @__PURE__ */ L(x, {
|
|
256
277
|
justify: "space-between",
|
|
257
278
|
gap: "xs",
|
|
258
279
|
wrap: "nowrap",
|
|
259
|
-
children: [e.showLabel && /* @__PURE__ */
|
|
280
|
+
children: [e.showLabel && /* @__PURE__ */ I(N, {
|
|
260
281
|
size: "sm",
|
|
261
282
|
c: "dimmed",
|
|
262
283
|
children: e.label
|
|
263
|
-
}), /* @__PURE__ */
|
|
284
|
+
}), /* @__PURE__ */ I(N, {
|
|
264
285
|
size: "sm",
|
|
265
286
|
children: i(e)
|
|
266
287
|
})]
|
|
@@ -272,24 +293,24 @@ function me({ row: e, layout: t, selectionEnabled: n }) {
|
|
|
272
293
|
}
|
|
273
294
|
//#endregion
|
|
274
295
|
//#region src/components/DataPagination/DataPagination.tsx
|
|
275
|
-
function
|
|
296
|
+
function ge({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r = !0, pageSizeLabel: i = "Rows per page", ...a }) {
|
|
276
297
|
let { table: o } = e, { pageIndex: s, pageSize: c } = e.state.pagination, l = o.getRowCount(), u = o.getPageCount(), d = t ?? e.pageSizeOptions, f = l === 0 ? 0 : s * c + 1, p = Math.min((s + 1) * c, l);
|
|
277
|
-
return /* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ L(x, {
|
|
278
299
|
justify: "space-between",
|
|
279
300
|
wrap: "wrap",
|
|
280
301
|
gap: "sm",
|
|
281
302
|
...a,
|
|
282
|
-
children: [/* @__PURE__ */
|
|
303
|
+
children: [/* @__PURE__ */ L(x, {
|
|
283
304
|
gap: "sm",
|
|
284
305
|
wrap: "wrap",
|
|
285
|
-
children: [n && /* @__PURE__ */
|
|
306
|
+
children: [n && /* @__PURE__ */ I(O, {
|
|
286
307
|
"aria-label": i,
|
|
287
308
|
data: d.map(String),
|
|
288
309
|
value: String(c),
|
|
289
310
|
onChange: (e) => e && o.setPageSize(Number(e)),
|
|
290
311
|
w: 80,
|
|
291
312
|
comboboxProps: { withinPortal: !0 }
|
|
292
|
-
}), r && /* @__PURE__ */
|
|
313
|
+
}), r && /* @__PURE__ */ L(N, {
|
|
293
314
|
size: "sm",
|
|
294
315
|
c: "dimmed",
|
|
295
316
|
children: [
|
|
@@ -300,7 +321,7 @@ function he({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r =
|
|
|
300
321
|
l
|
|
301
322
|
]
|
|
302
323
|
})]
|
|
303
|
-
}), /* @__PURE__ */
|
|
324
|
+
}), /* @__PURE__ */ I(te, {
|
|
304
325
|
value: s + 1,
|
|
305
326
|
total: Math.max(u, 1),
|
|
306
327
|
onChange: (e) => o.setPageIndex(e - 1),
|
|
@@ -310,8 +331,8 @@ function he({ view: e, pageSizeOptions: t, showPageSize: n = !0, showRange: r =
|
|
|
310
331
|
}
|
|
311
332
|
//#endregion
|
|
312
333
|
//#region src/components/icons.tsx
|
|
313
|
-
function
|
|
314
|
-
return /* @__PURE__ */
|
|
334
|
+
function _e({ direction: e }) {
|
|
335
|
+
return /* @__PURE__ */ L("svg", {
|
|
315
336
|
width: "14",
|
|
316
337
|
height: "14",
|
|
317
338
|
viewBox: "0 0 24 24",
|
|
@@ -320,8 +341,8 @@ function ge({ direction: e }) {
|
|
|
320
341
|
focusable: "false",
|
|
321
342
|
style: { flexShrink: 0 },
|
|
322
343
|
children: [
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ I("title", { children: "sort" }),
|
|
345
|
+
/* @__PURE__ */ I("path", {
|
|
325
346
|
d: "M8 10l4-4 4 4",
|
|
326
347
|
stroke: "currentColor",
|
|
327
348
|
strokeWidth: "2",
|
|
@@ -329,7 +350,7 @@ function ge({ direction: e }) {
|
|
|
329
350
|
strokeLinejoin: "round",
|
|
330
351
|
opacity: e === "asc" ? 1 : .35
|
|
331
352
|
}),
|
|
332
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ I("path", {
|
|
333
354
|
d: "M8 14l4 4 4-4",
|
|
334
355
|
stroke: "currentColor",
|
|
335
356
|
strokeWidth: "2",
|
|
@@ -340,8 +361,8 @@ function ge({ direction: e }) {
|
|
|
340
361
|
]
|
|
341
362
|
});
|
|
342
363
|
}
|
|
343
|
-
function
|
|
344
|
-
return /* @__PURE__ */
|
|
364
|
+
function Y({ d: e, title: t }) {
|
|
365
|
+
return /* @__PURE__ */ L("svg", {
|
|
345
366
|
width: "16",
|
|
346
367
|
height: "16",
|
|
347
368
|
viewBox: "0 0 24 24",
|
|
@@ -353,48 +374,48 @@ function X({ d: e, title: t }) {
|
|
|
353
374
|
"aria-hidden": "true",
|
|
354
375
|
focusable: "false",
|
|
355
376
|
style: { flexShrink: 0 },
|
|
356
|
-
children: [/* @__PURE__ */
|
|
377
|
+
children: [/* @__PURE__ */ I("title", { children: t }), /* @__PURE__ */ I("path", { d: e })]
|
|
357
378
|
});
|
|
358
379
|
}
|
|
359
|
-
function
|
|
360
|
-
return /* @__PURE__ */
|
|
380
|
+
function ve() {
|
|
381
|
+
return /* @__PURE__ */ I(Y, {
|
|
361
382
|
title: "search",
|
|
362
383
|
d: "M21 21l-4.3-4.3M11 19a8 8 0 110-16 8 8 0 010 16z"
|
|
363
384
|
});
|
|
364
385
|
}
|
|
365
|
-
function
|
|
366
|
-
return /* @__PURE__ */
|
|
386
|
+
function ye() {
|
|
387
|
+
return /* @__PURE__ */ I(Y, {
|
|
367
388
|
title: "filter",
|
|
368
389
|
d: "M3 5h18M7 12h10M10 19h4"
|
|
369
390
|
});
|
|
370
391
|
}
|
|
371
|
-
function
|
|
372
|
-
return /* @__PURE__ */
|
|
392
|
+
function be() {
|
|
393
|
+
return /* @__PURE__ */ I(Y, {
|
|
373
394
|
title: "open",
|
|
374
395
|
d: "M6 9l6 6 6-6"
|
|
375
396
|
});
|
|
376
397
|
}
|
|
377
|
-
function
|
|
378
|
-
return /* @__PURE__ */
|
|
398
|
+
function xe() {
|
|
399
|
+
return /* @__PURE__ */ I(Y, {
|
|
379
400
|
title: "close",
|
|
380
401
|
d: "M18 6L6 18M6 6l12 12"
|
|
381
402
|
});
|
|
382
403
|
}
|
|
383
|
-
function
|
|
384
|
-
return /* @__PURE__ */
|
|
404
|
+
function Se() {
|
|
405
|
+
return /* @__PURE__ */ I(Y, {
|
|
385
406
|
title: "pin left",
|
|
386
407
|
d: "M4 4v16M9 8h8M9 12h6M9 16h8"
|
|
387
408
|
});
|
|
388
409
|
}
|
|
389
|
-
function
|
|
390
|
-
return /* @__PURE__ */
|
|
410
|
+
function Ce() {
|
|
411
|
+
return /* @__PURE__ */ I(Y, {
|
|
391
412
|
title: "pin right",
|
|
392
413
|
d: "M20 4v16M7 8h8M9 12h6M7 16h8"
|
|
393
414
|
});
|
|
394
415
|
}
|
|
395
416
|
//#endregion
|
|
396
417
|
//#region src/components/DataTable/DataTable.tsx
|
|
397
|
-
function
|
|
418
|
+
function we(e) {
|
|
398
419
|
let t = e.getIsPinned();
|
|
399
420
|
if (t) return {
|
|
400
421
|
position: "sticky",
|
|
@@ -403,94 +424,102 @@ function Ce(e) {
|
|
|
403
424
|
backgroundColor: "var(--mantine-color-body)"
|
|
404
425
|
};
|
|
405
426
|
}
|
|
406
|
-
function
|
|
407
|
-
let { table:
|
|
408
|
-
|
|
409
|
-
|
|
427
|
+
function Te({ view: e, slots: t, enableSelection: n, loadingRowCount: r, disableWhileLoading: i = !0, animateRows: a = !1, ...o }) {
|
|
428
|
+
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__ */ I(M.Tbody, {
|
|
429
|
+
"data-changed": a || void 0,
|
|
430
|
+
children: e.map((e) => {
|
|
431
|
+
let n = d.entering.has(e.id) || void 0, r = /* @__PURE__ */ L(F, { children: [p && /* @__PURE__ */ I(M.Td, { children: /* @__PURE__ */ I(v, {
|
|
432
|
+
"aria-label": "Select row",
|
|
433
|
+
checked: e.getIsSelected(),
|
|
434
|
+
disabled: !e.getCanSelect(),
|
|
435
|
+
indeterminate: e.getIsSomeSelected(),
|
|
436
|
+
onChange: e.getToggleSelectedHandler()
|
|
437
|
+
}) }), e.getVisibleCells().map((e) => {
|
|
438
|
+
let t = e.column.columnDef.meta?.align;
|
|
439
|
+
return /* @__PURE__ */ I(M.Td, {
|
|
440
|
+
style: {
|
|
441
|
+
...we(e.column),
|
|
442
|
+
...t ? { textAlign: t } : void 0
|
|
443
|
+
},
|
|
444
|
+
children: s(e.column.columnDef.cell, e.getContext())
|
|
445
|
+
}, e.id);
|
|
446
|
+
})] });
|
|
447
|
+
return t?.Row ? /* @__PURE__ */ I(Ee, { children: t.Row({
|
|
448
|
+
row: e,
|
|
449
|
+
cells: r
|
|
450
|
+
}) }, e.id) : /* @__PURE__ */ I(M.Tr, {
|
|
451
|
+
"data-selected": e.getIsSelected() || void 0,
|
|
452
|
+
"data-entering": n,
|
|
453
|
+
children: r
|
|
454
|
+
}, e.id);
|
|
455
|
+
})
|
|
456
|
+
}, d.generation), _ = () => {
|
|
457
|
+
if (a && l.phase === "loading" && d.rows.length > 0) return g(d.rows);
|
|
458
|
+
switch (l.phase) {
|
|
459
|
+
case "loading": return t?.LoadingTable ? t.LoadingTable() : /* @__PURE__ */ I(M.Tbody, { children: Array.from({ length: h }, (e, t) => /* @__PURE__ */ L(M.Tr, { children: [p && /* @__PURE__ */ I(M.Td, { children: /* @__PURE__ */ I(A, {
|
|
410
460
|
height: 16,
|
|
411
461
|
width: 16
|
|
412
|
-
}) }),
|
|
413
|
-
case "error": return /* @__PURE__ */
|
|
414
|
-
colSpan:
|
|
415
|
-
children: /* @__PURE__ */
|
|
462
|
+
}) }), f.map((e) => /* @__PURE__ */ I(M.Td, { children: /* @__PURE__ */ I(A, { height: 12 }) }, e.id))] }, t)) });
|
|
463
|
+
case "error": return /* @__PURE__ */ I(De, {
|
|
464
|
+
colSpan: m,
|
|
465
|
+
children: /* @__PURE__ */ I(fe, {
|
|
416
466
|
view: e,
|
|
417
467
|
slots: t
|
|
418
468
|
})
|
|
419
469
|
});
|
|
420
470
|
case "empty":
|
|
421
|
-
case "empty-filtered": return /* @__PURE__ */
|
|
422
|
-
colSpan:
|
|
423
|
-
children: /* @__PURE__ */
|
|
471
|
+
case "empty-filtered": return /* @__PURE__ */ I(De, {
|
|
472
|
+
colSpan: m,
|
|
473
|
+
children: /* @__PURE__ */ I(J, {
|
|
424
474
|
view: e,
|
|
425
475
|
slots: t
|
|
426
476
|
})
|
|
427
477
|
});
|
|
428
|
-
default: return
|
|
429
|
-
let n = /* @__PURE__ */ R(I, { children: [l && /* @__PURE__ */ L(j.Td, { children: /* @__PURE__ */ L(v, {
|
|
430
|
-
"aria-label": "Select row",
|
|
431
|
-
checked: e.getIsSelected(),
|
|
432
|
-
disabled: !e.getCanSelect(),
|
|
433
|
-
indeterminate: e.getIsSomeSelected(),
|
|
434
|
-
onChange: e.getToggleSelectedHandler()
|
|
435
|
-
}) }), e.getVisibleCells().map((e) => {
|
|
436
|
-
let t = e.column.columnDef.meta?.align;
|
|
437
|
-
return /* @__PURE__ */ L(j.Td, {
|
|
438
|
-
style: {
|
|
439
|
-
...Ce(e.column),
|
|
440
|
-
...t ? { textAlign: t } : void 0
|
|
441
|
-
},
|
|
442
|
-
children: s(e.column.columnDef.cell, e.getContext())
|
|
443
|
-
}, e.id);
|
|
444
|
-
})] });
|
|
445
|
-
return t?.Row ? /* @__PURE__ */ L(Te, { children: t.Row({
|
|
446
|
-
row: e,
|
|
447
|
-
cells: n
|
|
448
|
-
}) }, e.id) : /* @__PURE__ */ L(j.Tr, {
|
|
449
|
-
"data-selected": e.getIsSelected() || void 0,
|
|
450
|
-
children: n
|
|
451
|
-
}, e.id);
|
|
452
|
-
}) });
|
|
478
|
+
default: return g(d.rows);
|
|
453
479
|
}
|
|
454
480
|
};
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
style:
|
|
457
|
-
children: /* @__PURE__ */
|
|
481
|
+
return /* @__PURE__ */ I("div", {
|
|
482
|
+
style: c.getIsSomeColumnsPinned() ? { overflowX: "auto" } : void 0,
|
|
483
|
+
children: /* @__PURE__ */ L(M, {
|
|
458
484
|
layout: "fixed",
|
|
459
|
-
...
|
|
460
|
-
children: [/* @__PURE__ */
|
|
485
|
+
...o,
|
|
486
|
+
children: [/* @__PURE__ */ I(M.Thead, { children: c.getHeaderGroups().map((e) => /* @__PURE__ */ L(M.Tr, { children: [p && /* @__PURE__ */ I(M.Th, {
|
|
461
487
|
style: { width: 40 },
|
|
462
|
-
children: /* @__PURE__ */
|
|
488
|
+
children: /* @__PURE__ */ I(v, {
|
|
463
489
|
"aria-label": "Select all rows on this page",
|
|
464
|
-
checked:
|
|
465
|
-
indeterminate:
|
|
466
|
-
onChange:
|
|
490
|
+
checked: c.getIsAllPageRowsSelected(),
|
|
491
|
+
indeterminate: c.getIsSomePageRowsSelected() && !c.getIsAllPageRowsSelected(),
|
|
492
|
+
onChange: c.getToggleAllPageRowsSelectedHandler()
|
|
467
493
|
})
|
|
468
|
-
}), e.headers.map((e) => /* @__PURE__ */
|
|
494
|
+
}), e.headers.map((e) => /* @__PURE__ */ I(Oe, {
|
|
495
|
+
header: e,
|
|
496
|
+
disabled: u
|
|
497
|
+
}, e.id))] }, e.id)) }), _()]
|
|
469
498
|
})
|
|
470
499
|
});
|
|
471
500
|
}
|
|
472
|
-
function
|
|
473
|
-
return /* @__PURE__ */
|
|
501
|
+
function Ee({ children: e }) {
|
|
502
|
+
return /* @__PURE__ */ I(F, { children: e });
|
|
474
503
|
}
|
|
475
|
-
function
|
|
476
|
-
return /* @__PURE__ */
|
|
504
|
+
function De({ colSpan: e, children: t }) {
|
|
505
|
+
return /* @__PURE__ */ I(M.Tbody, { children: /* @__PURE__ */ I(M.Tr, { children: /* @__PURE__ */ I(M.Td, {
|
|
477
506
|
colSpan: e,
|
|
478
|
-
children: /* @__PURE__ */
|
|
507
|
+
children: /* @__PURE__ */ I(_, {
|
|
479
508
|
p: "xl",
|
|
480
509
|
children: t
|
|
481
510
|
})
|
|
482
511
|
}) }) });
|
|
483
512
|
}
|
|
484
|
-
function
|
|
485
|
-
let { column:
|
|
486
|
-
return /* @__PURE__ */
|
|
513
|
+
function Oe({ header: e, disabled: t }) {
|
|
514
|
+
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;
|
|
515
|
+
return /* @__PURE__ */ I(M.Th, {
|
|
487
516
|
style: {
|
|
488
|
-
...
|
|
489
|
-
...
|
|
517
|
+
...we(n),
|
|
518
|
+
...r ? { textAlign: r } : void 0
|
|
490
519
|
},
|
|
491
|
-
"aria-sort":
|
|
492
|
-
children:
|
|
493
|
-
onClick:
|
|
520
|
+
"aria-sort": i === "asc" ? "ascending" : i === "desc" ? "descending" : void 0,
|
|
521
|
+
children: l ? /* @__PURE__ */ L(re, {
|
|
522
|
+
onClick: n.getToggleSortingHandler(),
|
|
494
523
|
style: {
|
|
495
524
|
display: "inline-flex",
|
|
496
525
|
alignItems: "center",
|
|
@@ -498,37 +527,45 @@ function De({ header: e }) {
|
|
|
498
527
|
font: "inherit"
|
|
499
528
|
},
|
|
500
529
|
children: [
|
|
501
|
-
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
|
|
530
|
+
c,
|
|
531
|
+
/* @__PURE__ */ I(_e, { direction: i }),
|
|
532
|
+
o && /* @__PURE__ */ I("span", {
|
|
504
533
|
role: "note",
|
|
505
534
|
style: {
|
|
506
535
|
fontSize: "0.7em",
|
|
507
536
|
opacity: .6
|
|
508
537
|
},
|
|
509
|
-
"aria-label": `Sort priority ${
|
|
510
|
-
children:
|
|
538
|
+
"aria-label": `Sort priority ${a + 1}`,
|
|
539
|
+
children: a + 1
|
|
511
540
|
})
|
|
512
541
|
]
|
|
513
|
-
}) :
|
|
542
|
+
}) : /* @__PURE__ */ L("span", {
|
|
543
|
+
style: {
|
|
544
|
+
display: "inline-flex",
|
|
545
|
+
alignItems: "center",
|
|
546
|
+
gap: 4,
|
|
547
|
+
...t ? { opacity: .5 } : {}
|
|
548
|
+
},
|
|
549
|
+
children: [c, i && /* @__PURE__ */ I(_e, { direction: i })]
|
|
550
|
+
})
|
|
514
551
|
});
|
|
515
552
|
}
|
|
516
553
|
//#endregion
|
|
517
554
|
//#region src/core/useForceCards.ts
|
|
518
|
-
var
|
|
519
|
-
function
|
|
555
|
+
var ke = "(max-width: 0px)";
|
|
556
|
+
function Ae(e) {
|
|
520
557
|
let t = /^([\d.]+)(\D*)$/.exec(e.trim());
|
|
521
558
|
if (!t) return `(max-width: ${e})`;
|
|
522
559
|
let n = Number(t[1]), r = t[2] || "px";
|
|
523
560
|
return `(max-width: ${n - (r === "em" || r === "rem" ? .01 : .1)}${r})`;
|
|
524
561
|
}
|
|
525
|
-
function
|
|
526
|
-
let t =
|
|
562
|
+
function je(e) {
|
|
563
|
+
let t = ie(), n = e?.forceCardsBelow, r = n ? t.breakpoints[n] : void 0, i = se(r ? Ae(r) : ke, !1);
|
|
527
564
|
return !!r && !!i;
|
|
528
565
|
}
|
|
529
566
|
//#endregion
|
|
530
567
|
//#region src/core/formatValue.ts
|
|
531
|
-
var
|
|
568
|
+
var Me = {
|
|
532
569
|
text: (e) => e == null ? "" : String(e),
|
|
533
570
|
number: (e) => e == null ? "" : new Intl.NumberFormat().format(Number(e)),
|
|
534
571
|
currency: (e) => e == null ? "" : new Intl.NumberFormat(void 0, {
|
|
@@ -542,7 +579,7 @@ var je = {
|
|
|
542
579
|
},
|
|
543
580
|
boolean: (e) => e == null ? "" : e ? "Yes" : "No"
|
|
544
581
|
};
|
|
545
|
-
function
|
|
582
|
+
function Ne(e, t) {
|
|
546
583
|
if (e === "number" || e === "currency") {
|
|
547
584
|
let n = new Intl.NumberFormat(void 0, e === "currency" ? {
|
|
548
585
|
style: "currency",
|
|
@@ -558,35 +595,35 @@ function Me(e, t) {
|
|
|
558
595
|
return Number.isNaN(n.getTime()) ? String(t) : e.format(n);
|
|
559
596
|
};
|
|
560
597
|
}
|
|
561
|
-
return
|
|
598
|
+
return Me[e];
|
|
562
599
|
}
|
|
563
|
-
function
|
|
600
|
+
function X(e, t, n) {
|
|
564
601
|
let r = t ?? n?.[e];
|
|
565
|
-
return r ? typeof r == "function" ? r :
|
|
602
|
+
return r ? typeof r == "function" ? r : Ne(e, r) : Me[e];
|
|
566
603
|
}
|
|
567
604
|
//#endregion
|
|
568
605
|
//#region src/components/DataToolbar/FacetBuckets.tsx
|
|
569
606
|
function Pe({ facet: e, value: t, onChange: n }) {
|
|
570
607
|
let r = Array.isArray(t) ? t : null;
|
|
571
|
-
return /* @__PURE__ */
|
|
608
|
+
return /* @__PURE__ */ I(j, {
|
|
572
609
|
gap: 4,
|
|
573
610
|
children: e.ranges.map((e) => {
|
|
574
611
|
let t = r != null && r[0] === e.from && r[1] === e.to;
|
|
575
|
-
return /* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ I(re, {
|
|
576
613
|
onClick: () => n(t ? void 0 : [e.from, e.to]),
|
|
577
614
|
style: {
|
|
578
615
|
padding: "4px 8px",
|
|
579
616
|
borderRadius: 4,
|
|
580
617
|
background: t ? "var(--mantine-color-blue-light)" : void 0
|
|
581
618
|
},
|
|
582
|
-
children: /* @__PURE__ */
|
|
619
|
+
children: /* @__PURE__ */ L(x, {
|
|
583
620
|
gap: "xs",
|
|
584
621
|
justify: "space-between",
|
|
585
622
|
wrap: "nowrap",
|
|
586
|
-
children: [/* @__PURE__ */
|
|
623
|
+
children: [/* @__PURE__ */ I(N, {
|
|
587
624
|
size: "sm",
|
|
588
625
|
children: e.label
|
|
589
|
-
}), /* @__PURE__ */
|
|
626
|
+
}), /* @__PURE__ */ I(p, {
|
|
590
627
|
size: "sm",
|
|
591
628
|
variant: "light",
|
|
592
629
|
color: e.count === 0 ? "gray" : "blue",
|
|
@@ -600,14 +637,14 @@ function Pe({ facet: e, value: t, onChange: n }) {
|
|
|
600
637
|
//#endregion
|
|
601
638
|
//#region src/components/DataToolbar/FilterControl.tsx
|
|
602
639
|
function Fe({ label: e, onClear: t }) {
|
|
603
|
-
return /* @__PURE__ */
|
|
640
|
+
return /* @__PURE__ */ L(x, {
|
|
604
641
|
justify: "space-between",
|
|
605
642
|
wrap: "nowrap",
|
|
606
|
-
children: [/* @__PURE__ */
|
|
643
|
+
children: [/* @__PURE__ */ I(N, {
|
|
607
644
|
size: "sm",
|
|
608
645
|
fw: 500,
|
|
609
646
|
children: e
|
|
610
|
-
}), /* @__PURE__ */
|
|
647
|
+
}), /* @__PURE__ */ I(f, {
|
|
611
648
|
component: "button",
|
|
612
649
|
type: "button",
|
|
613
650
|
size: "xs",
|
|
@@ -633,12 +670,12 @@ function Re(e, t) {
|
|
|
633
670
|
function ze({ column: e, facet: t }) {
|
|
634
671
|
let n = e.columnDef.meta?.filter;
|
|
635
672
|
if (!n) return null;
|
|
636
|
-
let r =
|
|
673
|
+
let r = K(e), i = n.placeholder ?? r, a = e.getFilterValue(), o = (t) => e.setFilterValue(t);
|
|
637
674
|
if (n.component) {
|
|
638
675
|
let t = n.component;
|
|
639
|
-
return /* @__PURE__ */
|
|
676
|
+
return /* @__PURE__ */ I(S.Wrapper, {
|
|
640
677
|
label: r,
|
|
641
|
-
children: /* @__PURE__ */
|
|
678
|
+
children: /* @__PURE__ */ I(t, {
|
|
642
679
|
value: a,
|
|
643
680
|
onChange: o,
|
|
644
681
|
column: e
|
|
@@ -647,7 +684,7 @@ function ze({ column: e, facet: t }) {
|
|
|
647
684
|
}
|
|
648
685
|
let s = t?.type === "values" ? t : void 0, c = t?.type === "ranges" ? t : void 0;
|
|
649
686
|
switch (n.variant) {
|
|
650
|
-
case "select": return /* @__PURE__ */
|
|
687
|
+
case "select": return /* @__PURE__ */ I(O, {
|
|
651
688
|
label: r,
|
|
652
689
|
placeholder: i,
|
|
653
690
|
clearable: !0,
|
|
@@ -655,7 +692,7 @@ function ze({ column: e, facet: t }) {
|
|
|
655
692
|
value: a ?? null,
|
|
656
693
|
onChange: (e) => o(e ?? void 0)
|
|
657
694
|
});
|
|
658
|
-
case "multiselect": return /* @__PURE__ */
|
|
695
|
+
case "multiselect": return /* @__PURE__ */ I(ee, {
|
|
659
696
|
label: r,
|
|
660
697
|
placeholder: i,
|
|
661
698
|
data: s ? Re(s, n.options) : n.options ?? [],
|
|
@@ -664,9 +701,9 @@ function ze({ column: e, facet: t }) {
|
|
|
664
701
|
});
|
|
665
702
|
case "boolean": {
|
|
666
703
|
let e = a == null ? "all" : a ? "yes" : "no", t = s?.values.find((e) => e.value === "true"), n = s?.values.find((e) => e.value === "false"), i = t ? `Yes (${t.count})` : "Yes", c = n ? `No (${n.count})` : "No";
|
|
667
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ I(S.Wrapper, {
|
|
668
705
|
label: r,
|
|
669
|
-
children: /* @__PURE__ */
|
|
706
|
+
children: /* @__PURE__ */ I(D, {
|
|
670
707
|
fullWidth: !0,
|
|
671
708
|
size: "xs",
|
|
672
709
|
data: [
|
|
@@ -691,21 +728,21 @@ function ze({ column: e, facet: t }) {
|
|
|
691
728
|
});
|
|
692
729
|
}
|
|
693
730
|
case "numberRange": {
|
|
694
|
-
let [t, i] = Le(a), s = n.min ?? c?.min, l = n.max ?? c?.max, u = s != null && l != null, d = a != null, f = c ? /* @__PURE__ */
|
|
731
|
+
let [t, i] = Le(a), s = n.min ?? c?.min, l = n.max ?? c?.max, u = s != null && l != null, d = a != null, f = c ? /* @__PURE__ */ I(Pe, {
|
|
695
732
|
facet: c,
|
|
696
733
|
value: a,
|
|
697
734
|
onChange: o
|
|
698
|
-
}) : null, p = d ? /* @__PURE__ */
|
|
735
|
+
}) : null, p = d ? /* @__PURE__ */ I(Fe, {
|
|
699
736
|
label: r,
|
|
700
737
|
onClear: () => o(void 0)
|
|
701
738
|
}) : r;
|
|
702
739
|
if (u) {
|
|
703
|
-
let a = [t ?? s, i ?? l], c = e.columnDef.meta?.dataType, u = c ?
|
|
704
|
-
return /* @__PURE__ */
|
|
740
|
+
let a = [t ?? s, i ?? l], c = e.columnDef.meta?.dataType, u = c ? X(c, e.columnDef.meta?.format, void 0) : (e) => String(e);
|
|
741
|
+
return /* @__PURE__ */ I(S.Wrapper, {
|
|
705
742
|
label: p,
|
|
706
|
-
children: /* @__PURE__ */
|
|
743
|
+
children: /* @__PURE__ */ L(j, {
|
|
707
744
|
gap: "xs",
|
|
708
|
-
children: [f, /* @__PURE__ */
|
|
745
|
+
children: [f, /* @__PURE__ */ I(E, {
|
|
709
746
|
min: s,
|
|
710
747
|
max: l,
|
|
711
748
|
step: n.step ?? 1,
|
|
@@ -720,23 +757,23 @@ function ze({ column: e, facet: t }) {
|
|
|
720
757
|
})
|
|
721
758
|
});
|
|
722
759
|
}
|
|
723
|
-
if (f) return /* @__PURE__ */
|
|
760
|
+
if (f) return /* @__PURE__ */ I(S.Wrapper, {
|
|
724
761
|
label: p,
|
|
725
762
|
children: f
|
|
726
763
|
});
|
|
727
764
|
let m = (e) => o(e[0] == null && e[1] == null ? void 0 : e), h = (e) => e === "" || e == null ? null : Number(e);
|
|
728
|
-
return /* @__PURE__ */
|
|
765
|
+
return /* @__PURE__ */ I(S.Wrapper, {
|
|
729
766
|
label: r,
|
|
730
|
-
children: /* @__PURE__ */
|
|
767
|
+
children: /* @__PURE__ */ L(x, {
|
|
731
768
|
gap: 4,
|
|
732
769
|
wrap: "nowrap",
|
|
733
|
-
children: [/* @__PURE__ */
|
|
770
|
+
children: [/* @__PURE__ */ I(w, {
|
|
734
771
|
"aria-label": `${r} minimum`,
|
|
735
772
|
placeholder: "Min",
|
|
736
773
|
value: t ?? "",
|
|
737
774
|
onChange: (e) => m([h(e), i]),
|
|
738
775
|
w: 90
|
|
739
|
-
}), /* @__PURE__ */
|
|
776
|
+
}), /* @__PURE__ */ I(w, {
|
|
740
777
|
"aria-label": `${r} maximum`,
|
|
741
778
|
placeholder: "Max",
|
|
742
779
|
value: i ?? "",
|
|
@@ -746,7 +783,7 @@ function ze({ column: e, facet: t }) {
|
|
|
746
783
|
})
|
|
747
784
|
});
|
|
748
785
|
}
|
|
749
|
-
case "date": return /* @__PURE__ */
|
|
786
|
+
case "date": return /* @__PURE__ */ I(ce, {
|
|
750
787
|
label: r,
|
|
751
788
|
placeholder: i,
|
|
752
789
|
clearable: !0,
|
|
@@ -755,19 +792,19 @@ function ze({ column: e, facet: t }) {
|
|
|
755
792
|
onChange: (e) => o(Ie(e) ?? void 0)
|
|
756
793
|
});
|
|
757
794
|
case "dateRange": {
|
|
758
|
-
let [e, t] = Le(a), n = [e ? new Date(e) : null, t ? new Date(t) : null], s = a == null ? r : /* @__PURE__ */
|
|
795
|
+
let [e, t] = Le(a), n = [e ? new Date(e) : null, t ? new Date(t) : null], s = a == null ? r : /* @__PURE__ */ I(Fe, {
|
|
759
796
|
label: r,
|
|
760
797
|
onClear: () => o(void 0)
|
|
761
798
|
});
|
|
762
|
-
return /* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ I(S.Wrapper, {
|
|
763
800
|
label: s,
|
|
764
|
-
children: /* @__PURE__ */
|
|
801
|
+
children: /* @__PURE__ */ L(j, {
|
|
765
802
|
gap: "xs",
|
|
766
|
-
children: [c && /* @__PURE__ */
|
|
803
|
+
children: [c && /* @__PURE__ */ I(Pe, {
|
|
767
804
|
facet: c,
|
|
768
805
|
value: a,
|
|
769
806
|
onChange: o
|
|
770
|
-
}), /* @__PURE__ */
|
|
807
|
+
}), /* @__PURE__ */ I(ce, {
|
|
771
808
|
type: "range",
|
|
772
809
|
popoverProps: { withinPortal: !1 },
|
|
773
810
|
placeholder: i,
|
|
@@ -781,7 +818,7 @@ function ze({ column: e, facet: t }) {
|
|
|
781
818
|
})
|
|
782
819
|
});
|
|
783
820
|
}
|
|
784
|
-
default: return /* @__PURE__ */
|
|
821
|
+
default: return /* @__PURE__ */ I(P, {
|
|
785
822
|
label: r,
|
|
786
823
|
placeholder: i,
|
|
787
824
|
value: a ?? "",
|
|
@@ -792,11 +829,11 @@ function ze({ column: e, facet: t }) {
|
|
|
792
829
|
//#endregion
|
|
793
830
|
//#region src/components/DataToolbar/FilterControls.tsx
|
|
794
831
|
function Be({ view: e }) {
|
|
795
|
-
return e.state.columnFilters.length > 0 ? /* @__PURE__ */
|
|
832
|
+
return e.state.columnFilters.length > 0 ? /* @__PURE__ */ I(h, {
|
|
796
833
|
variant: "subtle",
|
|
797
834
|
size: "compact-sm",
|
|
798
835
|
color: "gray",
|
|
799
|
-
leftSection: /* @__PURE__ */
|
|
836
|
+
leftSection: /* @__PURE__ */ I(xe, {}),
|
|
800
837
|
onClick: () => e.table.resetColumnFilters(),
|
|
801
838
|
children: "Reset filters"
|
|
802
839
|
}) : null;
|
|
@@ -805,45 +842,45 @@ function Ve(e) {
|
|
|
805
842
|
return e > 0 ? `Filters (${e})` : "Filters";
|
|
806
843
|
}
|
|
807
844
|
function He({ view: e, controls: t }) {
|
|
808
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ L(j, {
|
|
809
846
|
gap: "sm",
|
|
810
847
|
style: { minWidth: 240 },
|
|
811
|
-
children: [t, /* @__PURE__ */
|
|
848
|
+
children: [t, /* @__PURE__ */ I(x, {
|
|
812
849
|
justify: "flex-end",
|
|
813
|
-
children: /* @__PURE__ */
|
|
850
|
+
children: /* @__PURE__ */ I(Be, { view: e })
|
|
814
851
|
})]
|
|
815
852
|
});
|
|
816
853
|
}
|
|
817
854
|
function Ue({ view: e, inlineThreshold: t }) {
|
|
818
|
-
let n = e.filterableColumns, r =
|
|
855
|
+
let n = e.filterableColumns, r = se(Ae(ie().breakpoints.sm), !1), [i, { open: a, close: o }] = oe(!1);
|
|
819
856
|
if (n.length === 0) return null;
|
|
820
|
-
let s = n.map((t) => /* @__PURE__ */
|
|
857
|
+
let s = n.map((t) => /* @__PURE__ */ I(ze, {
|
|
821
858
|
column: t,
|
|
822
859
|
facet: e.facets[t.id]
|
|
823
860
|
}, t.id)), c = e.state.columnFilters.length;
|
|
824
|
-
return r ? /* @__PURE__ */
|
|
861
|
+
return r ? /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I(h, {
|
|
825
862
|
variant: "default",
|
|
826
|
-
leftSection: /* @__PURE__ */
|
|
863
|
+
leftSection: /* @__PURE__ */ I(ye, {}),
|
|
827
864
|
onClick: a,
|
|
828
865
|
children: Ve(c)
|
|
829
|
-
}), /* @__PURE__ */
|
|
866
|
+
}), /* @__PURE__ */ I(b, {
|
|
830
867
|
opened: i,
|
|
831
868
|
onClose: o,
|
|
832
869
|
title: "Filters",
|
|
833
870
|
position: "bottom",
|
|
834
871
|
size: "auto",
|
|
835
|
-
children: /* @__PURE__ */
|
|
872
|
+
children: /* @__PURE__ */ I(He, {
|
|
836
873
|
view: e,
|
|
837
874
|
controls: s
|
|
838
875
|
})
|
|
839
|
-
})] }) : n.length <= t ? /* @__PURE__ */
|
|
876
|
+
})] }) : n.length <= t ? /* @__PURE__ */ L(F, { children: [s, /* @__PURE__ */ I(Be, { view: e })] }) : /* @__PURE__ */ L(T, {
|
|
840
877
|
position: "bottom-start",
|
|
841
878
|
closeOnClickOutside: !1,
|
|
842
|
-
children: [/* @__PURE__ */
|
|
879
|
+
children: [/* @__PURE__ */ I(T.Target, { children: /* @__PURE__ */ I(h, {
|
|
843
880
|
variant: "default",
|
|
844
|
-
leftSection: /* @__PURE__ */
|
|
881
|
+
leftSection: /* @__PURE__ */ I(ye, {}),
|
|
845
882
|
children: Ve(c)
|
|
846
|
-
}) }), /* @__PURE__ */
|
|
883
|
+
}) }), /* @__PURE__ */ I(T.Dropdown, { children: /* @__PURE__ */ I(He, {
|
|
847
884
|
view: e,
|
|
848
885
|
controls: s
|
|
849
886
|
}) })]
|
|
@@ -853,23 +890,23 @@ function Ue({ view: e, inlineThreshold: t }) {
|
|
|
853
890
|
//#region src/components/DataToolbar/SortControl.tsx
|
|
854
891
|
function We({ view: e }) {
|
|
855
892
|
let { sortableColumns: t, state: n, table: r } = e, i = n.sorting[0];
|
|
856
|
-
return /* @__PURE__ */
|
|
893
|
+
return /* @__PURE__ */ L(x, {
|
|
857
894
|
gap: 4,
|
|
858
895
|
wrap: "nowrap",
|
|
859
|
-
children: [/* @__PURE__ */
|
|
896
|
+
children: [/* @__PURE__ */ I(O, {
|
|
860
897
|
"aria-label": "Sort by",
|
|
861
898
|
placeholder: "Sort by",
|
|
862
899
|
clearable: !0,
|
|
863
900
|
data: t.map((e) => ({
|
|
864
901
|
value: e.id,
|
|
865
|
-
label:
|
|
902
|
+
label: K(e)
|
|
866
903
|
})),
|
|
867
904
|
value: i?.id ?? null,
|
|
868
905
|
onChange: (e) => r.setSorting(e ? [{
|
|
869
906
|
id: e,
|
|
870
907
|
desc: i?.desc ?? !1
|
|
871
908
|
}] : [])
|
|
872
|
-
}), /* @__PURE__ */
|
|
909
|
+
}), /* @__PURE__ */ I(d, {
|
|
873
910
|
"aria-label": "Toggle sort direction",
|
|
874
911
|
variant: "default",
|
|
875
912
|
size: "lg",
|
|
@@ -878,14 +915,14 @@ function We({ view: e }) {
|
|
|
878
915
|
id: i.id,
|
|
879
916
|
desc: !i.desc
|
|
880
917
|
}]),
|
|
881
|
-
children: /* @__PURE__ */
|
|
918
|
+
children: /* @__PURE__ */ I(_e, { direction: i ? i.desc ? "desc" : "asc" : !1 })
|
|
882
919
|
})]
|
|
883
920
|
});
|
|
884
921
|
}
|
|
885
922
|
//#endregion
|
|
886
923
|
//#region src/components/DataToolbar/ViewSwitcher.tsx
|
|
887
|
-
function Ge({ view: e, lockSwitcherOnMobile: t }) {
|
|
888
|
-
return e.isMobileForced && t ? null : /* @__PURE__ */
|
|
924
|
+
function Ge({ view: e, lockSwitcherOnMobile: t, tableLabel: n = "Table", cardsLabel: r = "Cards" }) {
|
|
925
|
+
return e.isMobileForced && t ? null : /* @__PURE__ */ I(D, {
|
|
889
926
|
"aria-label": "View",
|
|
890
927
|
value: e.view,
|
|
891
928
|
disabled: e.isMobileForced,
|
|
@@ -894,10 +931,10 @@ function Ge({ view: e, lockSwitcherOnMobile: t }) {
|
|
|
894
931
|
},
|
|
895
932
|
data: [{
|
|
896
933
|
value: "table",
|
|
897
|
-
label:
|
|
934
|
+
label: n
|
|
898
935
|
}, {
|
|
899
936
|
value: "cards",
|
|
900
|
-
label:
|
|
937
|
+
label: r
|
|
901
938
|
}]
|
|
902
939
|
});
|
|
903
940
|
}
|
|
@@ -906,160 +943,186 @@ function Ge({ view: e, lockSwitcherOnMobile: t }) {
|
|
|
906
943
|
function Ke({ column: e }) {
|
|
907
944
|
if (!e.getCanPin()) return null;
|
|
908
945
|
let t = e.getIsPinned();
|
|
909
|
-
return /* @__PURE__ */
|
|
946
|
+
return /* @__PURE__ */ L(x, {
|
|
910
947
|
gap: 2,
|
|
911
|
-
children: [/* @__PURE__ */
|
|
948
|
+
children: [/* @__PURE__ */ I(d, {
|
|
912
949
|
size: "xs",
|
|
913
950
|
variant: t === "left" ? "filled" : "subtle",
|
|
914
951
|
color: t === "left" ? "blue" : "gray",
|
|
915
|
-
"aria-label": `Pin ${
|
|
952
|
+
"aria-label": `Pin ${K(e)} left`,
|
|
916
953
|
onClick: () => e.pin(t === "left" ? !1 : "left"),
|
|
917
|
-
children: /* @__PURE__ */
|
|
918
|
-
}), /* @__PURE__ */
|
|
954
|
+
children: /* @__PURE__ */ I(Se, {})
|
|
955
|
+
}), /* @__PURE__ */ I(d, {
|
|
919
956
|
size: "xs",
|
|
920
957
|
variant: t === "right" ? "filled" : "subtle",
|
|
921
958
|
color: t === "right" ? "blue" : "gray",
|
|
922
|
-
"aria-label": `Pin ${
|
|
959
|
+
"aria-label": `Pin ${K(e)} right`,
|
|
923
960
|
onClick: () => e.pin(t === "right" ? !1 : "right"),
|
|
924
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ I(Ce, {})
|
|
925
962
|
})]
|
|
926
963
|
});
|
|
927
964
|
}
|
|
928
965
|
function qe({ view: e }) {
|
|
929
966
|
let t = e.table.getAllLeafColumns().filter((e) => e.getCanHide());
|
|
930
|
-
return t.length === 0 ? null : /* @__PURE__ */
|
|
967
|
+
return t.length === 0 ? null : /* @__PURE__ */ L(C, {
|
|
931
968
|
closeOnItemClick: !1,
|
|
932
969
|
withinPortal: !0,
|
|
933
970
|
position: "bottom-end",
|
|
934
|
-
children: [/* @__PURE__ */
|
|
971
|
+
children: [/* @__PURE__ */ I(C.Target, { children: /* @__PURE__ */ I(h, {
|
|
935
972
|
variant: "default",
|
|
936
|
-
rightSection: /* @__PURE__ */
|
|
973
|
+
rightSection: /* @__PURE__ */ I(be, {}),
|
|
937
974
|
children: "Columns"
|
|
938
|
-
}) }), /* @__PURE__ */
|
|
975
|
+
}) }), /* @__PURE__ */ I(C.Dropdown, { children: /* @__PURE__ */ I(j, {
|
|
939
976
|
gap: "xs",
|
|
940
977
|
p: "xs",
|
|
941
|
-
children: t.map((e) => /* @__PURE__ */
|
|
978
|
+
children: t.map((e) => /* @__PURE__ */ L(x, {
|
|
942
979
|
gap: "xs",
|
|
943
980
|
justify: "space-between",
|
|
944
981
|
wrap: "nowrap",
|
|
945
|
-
children: [/* @__PURE__ */
|
|
946
|
-
label:
|
|
982
|
+
children: [/* @__PURE__ */ I(v, {
|
|
983
|
+
label: K(e),
|
|
947
984
|
checked: e.getIsVisible(),
|
|
948
985
|
onChange: (t) => e.toggleVisibility(t.currentTarget.checked)
|
|
949
|
-
}), /* @__PURE__ */
|
|
986
|
+
}), /* @__PURE__ */ I(Ke, { column: e })]
|
|
950
987
|
}, e.id))
|
|
951
988
|
}) })]
|
|
952
989
|
});
|
|
953
990
|
}
|
|
954
991
|
//#endregion
|
|
955
992
|
//#region src/components/DataToolbar/DataToolbar.tsx
|
|
956
|
-
function Je({ view: e, searchPlaceholder: t = "Search…", filterInlineThreshold: n = 3, lockSwitcherOnMobile: r, showSearch: i, showFilters: a, showSort: o, showVisibility: s, showViewSwitcher: c,
|
|
957
|
-
let { table:
|
|
958
|
-
return /* @__PURE__ */
|
|
993
|
+
function Je({ 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 }) {
|
|
994
|
+
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;
|
|
995
|
+
return /* @__PURE__ */ L(x, {
|
|
959
996
|
justify: "space-between",
|
|
960
997
|
wrap: "wrap",
|
|
961
998
|
gap: "sm",
|
|
962
|
-
...
|
|
963
|
-
children: [/* @__PURE__ */
|
|
999
|
+
...f,
|
|
1000
|
+
children: [/* @__PURE__ */ L(x, {
|
|
964
1001
|
wrap: "wrap",
|
|
965
1002
|
gap: "sm",
|
|
966
1003
|
children: [
|
|
967
|
-
|
|
1004
|
+
u,
|
|
1005
|
+
g && /* @__PURE__ */ I(P, {
|
|
968
1006
|
"aria-label": "Search",
|
|
969
1007
|
placeholder: t,
|
|
970
|
-
leftSection: /* @__PURE__ */
|
|
971
|
-
value:
|
|
972
|
-
onChange: (e) =>
|
|
973
|
-
rightSection:
|
|
1008
|
+
leftSection: /* @__PURE__ */ I(ve, {}),
|
|
1009
|
+
value: m.globalFilter,
|
|
1010
|
+
onChange: (e) => p.setGlobalFilter(e.currentTarget.value),
|
|
1011
|
+
rightSection: m.globalFilter ? /* @__PURE__ */ I(y, {
|
|
974
1012
|
size: "sm",
|
|
975
1013
|
"aria-label": "Clear search",
|
|
976
|
-
onClick: () =>
|
|
1014
|
+
onClick: () => p.setGlobalFilter("")
|
|
977
1015
|
}) : void 0
|
|
978
1016
|
}),
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1017
|
+
/* @__PURE__ */ L("fieldset", {
|
|
1018
|
+
disabled: h,
|
|
1019
|
+
style: {
|
|
1020
|
+
display: "contents",
|
|
1021
|
+
border: "none",
|
|
1022
|
+
padding: 0,
|
|
1023
|
+
margin: 0
|
|
1024
|
+
},
|
|
1025
|
+
children: [_ && /* @__PURE__ */ I(Ue, {
|
|
1026
|
+
view: e,
|
|
1027
|
+
inlineThreshold: n
|
|
1028
|
+
}), v && /* @__PURE__ */ I(We, { view: e })]
|
|
1029
|
+
})
|
|
984
1030
|
]
|
|
985
|
-
}), /* @__PURE__ */
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1031
|
+
}), /* @__PURE__ */ I("fieldset", {
|
|
1032
|
+
disabled: h,
|
|
1033
|
+
style: {
|
|
1034
|
+
display: "contents",
|
|
1035
|
+
border: "none",
|
|
1036
|
+
padding: 0,
|
|
1037
|
+
margin: 0
|
|
1038
|
+
},
|
|
1039
|
+
children: /* @__PURE__ */ L(x, {
|
|
1040
|
+
wrap: "wrap",
|
|
1041
|
+
gap: "sm",
|
|
1042
|
+
children: [
|
|
1043
|
+
b && /* @__PURE__ */ I(qe, { view: e }),
|
|
1044
|
+
S && /* @__PURE__ */ I(Ge, {
|
|
1045
|
+
view: e,
|
|
1046
|
+
lockSwitcherOnMobile: r
|
|
1047
|
+
}),
|
|
1048
|
+
d
|
|
1049
|
+
]
|
|
1050
|
+
})
|
|
992
1051
|
})]
|
|
993
1052
|
});
|
|
994
1053
|
}
|
|
995
1054
|
//#endregion
|
|
996
|
-
//#region src/components/
|
|
1055
|
+
//#region src/components/DataViewer/context.tsx
|
|
997
1056
|
var Ye = ae(null), Xe = Ye.Provider;
|
|
998
1057
|
function Z() {
|
|
999
1058
|
let e = B(Ye);
|
|
1000
|
-
if (!e) throw Error("
|
|
1059
|
+
if (!e) throw Error("DataViewer.Toolbar / DataViewer.Body / DataViewer.Pagination must be rendered inside <DataViewer>.");
|
|
1001
1060
|
return e;
|
|
1002
1061
|
}
|
|
1003
1062
|
//#endregion
|
|
1004
|
-
//#region src/components/
|
|
1005
|
-
function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMobile: i,
|
|
1006
|
-
return /* @__PURE__ */
|
|
1063
|
+
//#region src/components/DataViewer/DataViewer.tsx
|
|
1064
|
+
function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMobile: i, animateRows: a, children: o, ...s }) {
|
|
1065
|
+
return /* @__PURE__ */ I(Xe, {
|
|
1007
1066
|
value: H(() => ({
|
|
1008
1067
|
view: e,
|
|
1009
1068
|
slots: t,
|
|
1010
1069
|
renderCard: n,
|
|
1011
1070
|
fallbackRole: r,
|
|
1012
|
-
lockSwitcherOnMobile: i
|
|
1071
|
+
lockSwitcherOnMobile: i,
|
|
1072
|
+
animateRows: a
|
|
1013
1073
|
}), [
|
|
1014
1074
|
e,
|
|
1015
1075
|
t,
|
|
1016
1076
|
n,
|
|
1017
1077
|
r,
|
|
1018
|
-
i
|
|
1078
|
+
i,
|
|
1079
|
+
a
|
|
1019
1080
|
]),
|
|
1020
|
-
children: /* @__PURE__ */
|
|
1021
|
-
...
|
|
1022
|
-
children:
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
/* @__PURE__ */
|
|
1081
|
+
children: /* @__PURE__ */ I(j, {
|
|
1082
|
+
...s,
|
|
1083
|
+
children: o ?? /* @__PURE__ */ L(F, { children: [
|
|
1084
|
+
/* @__PURE__ */ I(Ze, {}),
|
|
1085
|
+
/* @__PURE__ */ I(et, {}),
|
|
1086
|
+
/* @__PURE__ */ I(Qe, {}),
|
|
1087
|
+
/* @__PURE__ */ I($e, {})
|
|
1027
1088
|
] })
|
|
1028
1089
|
})
|
|
1029
1090
|
});
|
|
1030
1091
|
}
|
|
1031
1092
|
function Ze(e) {
|
|
1032
1093
|
let { view: t, lockSwitcherOnMobile: n } = Z();
|
|
1033
|
-
return /* @__PURE__ */
|
|
1094
|
+
return /* @__PURE__ */ I(Je, {
|
|
1034
1095
|
view: t,
|
|
1035
1096
|
lockSwitcherOnMobile: n,
|
|
1036
1097
|
...e
|
|
1037
1098
|
});
|
|
1038
1099
|
}
|
|
1039
1100
|
function Qe({ tableProps: e, cardsProps: t }) {
|
|
1040
|
-
let { view: n, slots: r, renderCard: i, fallbackRole: a } = Z();
|
|
1041
|
-
return n.view === "cards" ? /* @__PURE__ */
|
|
1101
|
+
let { view: n, slots: r, renderCard: i, fallbackRole: a, animateRows: o } = Z();
|
|
1102
|
+
return n.view === "cards" ? /* @__PURE__ */ I(me, {
|
|
1042
1103
|
view: n,
|
|
1043
1104
|
slots: r,
|
|
1044
1105
|
renderCard: i,
|
|
1045
1106
|
fallbackRole: a,
|
|
1107
|
+
animateRows: o,
|
|
1046
1108
|
...t
|
|
1047
|
-
}) : /* @__PURE__ */
|
|
1109
|
+
}) : /* @__PURE__ */ I(Te, {
|
|
1048
1110
|
view: n,
|
|
1049
1111
|
slots: r,
|
|
1112
|
+
animateRows: o,
|
|
1050
1113
|
...e
|
|
1051
1114
|
});
|
|
1052
1115
|
}
|
|
1053
1116
|
function $e(e) {
|
|
1054
1117
|
let { view: t } = Z();
|
|
1055
|
-
return /* @__PURE__ */
|
|
1118
|
+
return /* @__PURE__ */ I(ge, {
|
|
1056
1119
|
view: t,
|
|
1057
1120
|
...e
|
|
1058
1121
|
});
|
|
1059
1122
|
}
|
|
1060
1123
|
function et(e) {
|
|
1061
1124
|
let { view: t, slots: n } = Z();
|
|
1062
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ I(G, {
|
|
1063
1126
|
view: t,
|
|
1064
1127
|
slots: n,
|
|
1065
1128
|
...e
|
|
@@ -1170,9 +1233,9 @@ function at(e) {
|
|
|
1170
1233
|
return t.includes(",") || t.includes("\"") || t.includes("\n") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1171
1234
|
}
|
|
1172
1235
|
function ot(e, t) {
|
|
1173
|
-
let { filename: n = "export.csv", separator: r = ",", formatted: i = !1, formatDefaults: a } = t ?? {}, o = e.getVisibleLeafColumns().filter((e) => e.id !== "_select"), s = [o.map((e) => at(
|
|
1236
|
+
let { filename: n = "export.csv", separator: r = ",", formatted: i = !1, formatDefaults: a } = t ?? {}, o = e.getVisibleLeafColumns().filter((e) => e.id !== "_select"), s = [o.map((e) => at(K(e))), ...e.getRowModel().rows.map((e) => o.map((t) => {
|
|
1174
1237
|
let n = e.getAllCells().find((e) => e.column.id === t.id)?.getValue();
|
|
1175
|
-
return i && t.columnDef.meta?.dataType ? at(
|
|
1238
|
+
return i && t.columnDef.meta?.dataType ? at(X(t.columnDef.meta.dataType, t.columnDef.meta.format, a)(n)) : at(n);
|
|
1176
1239
|
}))].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");
|
|
1177
1240
|
u.href = l, u.download = n, u.click(), URL.revokeObjectURL(l);
|
|
1178
1241
|
}
|
|
@@ -1300,69 +1363,73 @@ function _t(e) {
|
|
|
1300
1363
|
};
|
|
1301
1364
|
}
|
|
1302
1365
|
function vt(e) {
|
|
1303
|
-
let { columns: t, rows: n, rowCount: r, status: i, error: a, getRowId: o, onRequestChange: s, state: d, onStateChange: f, enableRowSelection: p, enableGlobalFilter: m = !0, debounce: h, responsive: g, formatDefaults: _, facets: v } = e,
|
|
1366
|
+
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) => {
|
|
1304
1367
|
let t = e.meta?.dataType;
|
|
1305
1368
|
if (!t || e.cell) return e;
|
|
1306
|
-
let n =
|
|
1369
|
+
let n = X(t, e.meta?.format, _);
|
|
1307
1370
|
return {
|
|
1308
1371
|
...e,
|
|
1309
1372
|
cell: (e) => n(e.getValue())
|
|
1310
1373
|
};
|
|
1311
|
-
}), [t, _]),
|
|
1374
|
+
}), [t, _]), ee = H(() => gt(C), [C]), w = H(() => st(e.urlSync), [e.urlSync]), [te, ne] = W(() => {
|
|
1312
1375
|
let t = _t(e);
|
|
1313
1376
|
return {
|
|
1314
1377
|
...t,
|
|
1315
|
-
...ct(
|
|
1378
|
+
...ct(w, t, ee)
|
|
1316
1379
|
};
|
|
1317
|
-
}),
|
|
1318
|
-
...
|
|
1380
|
+
}), T = H(() => ({
|
|
1381
|
+
...te,
|
|
1319
1382
|
...d
|
|
1320
|
-
}), [
|
|
1321
|
-
|
|
1322
|
-
let
|
|
1323
|
-
|
|
1383
|
+
}), [te, d]), E = U(T);
|
|
1384
|
+
E.current = T;
|
|
1385
|
+
let D = z((e) => {
|
|
1386
|
+
ne((t) => ({
|
|
1324
1387
|
...t,
|
|
1325
1388
|
...e
|
|
1326
1389
|
})), f?.({
|
|
1327
|
-
...
|
|
1390
|
+
...E.current,
|
|
1328
1391
|
...e
|
|
1329
1392
|
});
|
|
1330
1393
|
}, [f]);
|
|
1331
1394
|
lt({
|
|
1332
|
-
config:
|
|
1333
|
-
state:
|
|
1334
|
-
applyPatch:
|
|
1335
|
-
getFilterMeta:
|
|
1395
|
+
config: w,
|
|
1396
|
+
state: T,
|
|
1397
|
+
applyPatch: D,
|
|
1398
|
+
getFilterMeta: ee
|
|
1336
1399
|
});
|
|
1337
|
-
let
|
|
1338
|
-
...
|
|
1400
|
+
let O = z(() => ({
|
|
1401
|
+
...E.current.pagination,
|
|
1339
1402
|
pageIndex: 0
|
|
1340
|
-
}), []),
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1403
|
+
}), []), k = U(x);
|
|
1404
|
+
V(() => {
|
|
1405
|
+
k.current !== x && (k.current = x, D({ pagination: O() }));
|
|
1406
|
+
});
|
|
1407
|
+
let A = z((e) => {
|
|
1408
|
+
D({ pagination: c(e, E.current.pagination) });
|
|
1409
|
+
}, [D]), j = z((e) => {
|
|
1410
|
+
D({
|
|
1411
|
+
sorting: c(e, E.current.sorting),
|
|
1412
|
+
pagination: O()
|
|
1346
1413
|
});
|
|
1347
|
-
}, [
|
|
1348
|
-
|
|
1349
|
-
columnFilters: c(e,
|
|
1350
|
-
pagination:
|
|
1414
|
+
}, [D, O]), M = z((e) => {
|
|
1415
|
+
D({
|
|
1416
|
+
columnFilters: c(e, E.current.columnFilters),
|
|
1417
|
+
pagination: O()
|
|
1351
1418
|
});
|
|
1352
|
-
}, [
|
|
1353
|
-
|
|
1354
|
-
globalFilter: c(e,
|
|
1355
|
-
pagination:
|
|
1419
|
+
}, [D, O]), N = z((e) => {
|
|
1420
|
+
D({
|
|
1421
|
+
globalFilter: c(e, E.current.globalFilter),
|
|
1422
|
+
pagination: O()
|
|
1356
1423
|
});
|
|
1357
|
-
}, [
|
|
1358
|
-
|
|
1359
|
-
}, [
|
|
1360
|
-
|
|
1361
|
-
}, [
|
|
1362
|
-
|
|
1363
|
-
}, [
|
|
1424
|
+
}, [D, O]), P = z((e) => {
|
|
1425
|
+
D({ rowSelection: c(e, E.current.rowSelection) });
|
|
1426
|
+
}, [D]), re = z((e) => {
|
|
1427
|
+
D({ columnVisibility: c(e, E.current.columnVisibility) });
|
|
1428
|
+
}, [D]), ie = z((e) => {
|
|
1429
|
+
D({ columnPinning: c(e, E.current.columnPinning) });
|
|
1430
|
+
}, [D]), F = u({
|
|
1364
1431
|
data: n,
|
|
1365
|
-
columns:
|
|
1432
|
+
columns: C,
|
|
1366
1433
|
getCoreRowModel: l(),
|
|
1367
1434
|
manualPagination: !0,
|
|
1368
1435
|
manualSorting: !0,
|
|
@@ -1373,91 +1440,93 @@ function vt(e) {
|
|
|
1373
1440
|
enableRowSelection: typeof p == "function" ? (e) => p(e.original) : p ?? !0,
|
|
1374
1441
|
enableGlobalFilter: m,
|
|
1375
1442
|
state: {
|
|
1376
|
-
pagination:
|
|
1377
|
-
sorting:
|
|
1378
|
-
columnFilters:
|
|
1379
|
-
globalFilter:
|
|
1380
|
-
rowSelection:
|
|
1381
|
-
columnVisibility:
|
|
1382
|
-
columnPinning:
|
|
1443
|
+
pagination: T.pagination,
|
|
1444
|
+
sorting: T.sorting,
|
|
1445
|
+
columnFilters: T.columnFilters,
|
|
1446
|
+
globalFilter: T.globalFilter,
|
|
1447
|
+
rowSelection: T.rowSelection,
|
|
1448
|
+
columnVisibility: T.columnVisibility,
|
|
1449
|
+
columnPinning: T.columnPinning
|
|
1383
1450
|
},
|
|
1384
|
-
onPaginationChange:
|
|
1385
|
-
onSortingChange:
|
|
1386
|
-
onColumnFiltersChange:
|
|
1387
|
-
onGlobalFilterChange:
|
|
1388
|
-
onRowSelectionChange:
|
|
1389
|
-
onColumnVisibilityChange:
|
|
1390
|
-
onColumnPinningChange:
|
|
1391
|
-
}),
|
|
1392
|
-
pagination:
|
|
1393
|
-
sorting:
|
|
1394
|
-
filters:
|
|
1395
|
-
globalFilter:
|
|
1451
|
+
onPaginationChange: A,
|
|
1452
|
+
onSortingChange: j,
|
|
1453
|
+
onColumnFiltersChange: M,
|
|
1454
|
+
onGlobalFilterChange: N,
|
|
1455
|
+
onRowSelectionChange: P,
|
|
1456
|
+
onColumnVisibilityChange: re,
|
|
1457
|
+
onColumnPinningChange: ie
|
|
1458
|
+
}), I = H(() => ({
|
|
1459
|
+
pagination: T.pagination,
|
|
1460
|
+
sorting: T.sorting,
|
|
1461
|
+
filters: T.columnFilters,
|
|
1462
|
+
globalFilter: T.globalFilter,
|
|
1463
|
+
params: S
|
|
1396
1464
|
}), [
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1465
|
+
T.pagination,
|
|
1466
|
+
T.sorting,
|
|
1467
|
+
T.columnFilters,
|
|
1468
|
+
T.globalFilter,
|
|
1469
|
+
x
|
|
1470
|
+
]), L = U(s);
|
|
1471
|
+
L.current = s;
|
|
1472
|
+
let R = U(mt(h));
|
|
1473
|
+
R.current = mt(h);
|
|
1474
|
+
let ae = U(null), B = U(void 0);
|
|
1406
1475
|
V(() => {
|
|
1407
|
-
let e =
|
|
1408
|
-
|
|
1476
|
+
let e = ae.current, t = e === null, n = !e || e.globalFilter !== I.globalFilter, r = !e || e.filters !== I.filters, i = () => {
|
|
1477
|
+
ae.current = I, L.current?.(I);
|
|
1409
1478
|
}, a = 0;
|
|
1410
|
-
n && (a = Math.max(a,
|
|
1479
|
+
n && (a = Math.max(a, R.current.globalFilter)), r && (a = Math.max(a, R.current.columnFilters));
|
|
1411
1480
|
let o = !t && (n || r) && a > 0;
|
|
1412
|
-
return clearTimeout(
|
|
1413
|
-
}, [
|
|
1414
|
-
let
|
|
1415
|
-
|
|
1416
|
-
let
|
|
1417
|
-
|
|
1418
|
-
}, []),
|
|
1481
|
+
return clearTimeout(B.current), o ? B.current = setTimeout(i, a) : i(), () => clearTimeout(B.current);
|
|
1482
|
+
}, [I]);
|
|
1483
|
+
let oe = U(I);
|
|
1484
|
+
oe.current = I;
|
|
1485
|
+
let se = z(() => {
|
|
1486
|
+
L.current?.(oe.current);
|
|
1487
|
+
}, []), ce = H(() => dt({
|
|
1419
1488
|
status: i,
|
|
1420
1489
|
error: a,
|
|
1421
1490
|
pageRowCount: n.length,
|
|
1422
|
-
state:
|
|
1491
|
+
state: T
|
|
1423
1492
|
}), [
|
|
1424
1493
|
i,
|
|
1425
1494
|
a,
|
|
1426
1495
|
n.length,
|
|
1427
|
-
|
|
1428
|
-
]),
|
|
1496
|
+
T
|
|
1497
|
+
]), G = je(g), K = G ? "cards" : T.view, le = z((e) => D({ view: e }), [D]), ue = e.pageSizeOptions ?? ft, q = F.getAllColumns(), de = q.filter((e) => e.getCanSort()), fe = q.filter((e) => e.columnDef.meta?.filter != null), J = z(() => D({ rowSelection: {} }), [D]);
|
|
1429
1498
|
return {
|
|
1430
|
-
table:
|
|
1431
|
-
request:
|
|
1432
|
-
state:
|
|
1433
|
-
view:
|
|
1434
|
-
setView:
|
|
1435
|
-
isMobileForced:
|
|
1499
|
+
table: F,
|
|
1500
|
+
request: I,
|
|
1501
|
+
state: T,
|
|
1502
|
+
view: K,
|
|
1503
|
+
setView: le,
|
|
1504
|
+
isMobileForced: G,
|
|
1436
1505
|
status: i,
|
|
1437
1506
|
error: a,
|
|
1438
|
-
renderStatus:
|
|
1439
|
-
refetch:
|
|
1440
|
-
pageSizeOptions:
|
|
1441
|
-
sortableColumns:
|
|
1442
|
-
filterableColumns:
|
|
1507
|
+
renderStatus: ce,
|
|
1508
|
+
refetch: se,
|
|
1509
|
+
pageSizeOptions: ue,
|
|
1510
|
+
sortableColumns: de,
|
|
1511
|
+
filterableColumns: fe,
|
|
1443
1512
|
selection: H(() => {
|
|
1444
|
-
let e =
|
|
1513
|
+
let e = T.rowSelection, t = Object.keys(e).filter((t) => e[t]), r = n.filter((t) => e[o(t)] === !0);
|
|
1445
1514
|
return {
|
|
1446
1515
|
count: t.length,
|
|
1447
1516
|
ids: t,
|
|
1448
1517
|
rows: r,
|
|
1449
|
-
clear:
|
|
1518
|
+
clear: J
|
|
1450
1519
|
};
|
|
1451
1520
|
}, [
|
|
1452
|
-
|
|
1521
|
+
T.rowSelection,
|
|
1453
1522
|
n,
|
|
1454
1523
|
o,
|
|
1455
|
-
|
|
1524
|
+
J
|
|
1456
1525
|
]),
|
|
1457
|
-
exportCsv: z((e) => ot(
|
|
1458
|
-
facets:
|
|
1459
|
-
resetFilter: z((e) =>
|
|
1460
|
-
resetAllFilters: z(() =>
|
|
1526
|
+
exportCsv: z((e) => ot(F, e), [F]),
|
|
1527
|
+
facets: b,
|
|
1528
|
+
resetFilter: z((e) => F.getColumn(e)?.setFilterValue(void 0), [F]),
|
|
1529
|
+
resetAllFilters: z(() => F.resetColumnFilters(), [F])
|
|
1461
1530
|
};
|
|
1462
1531
|
}
|
|
1463
1532
|
//#endregion
|
|
@@ -1492,6 +1561,6 @@ function yt({ fetcher: e, deps: t, ...n }) {
|
|
|
1492
1561
|
});
|
|
1493
1562
|
}
|
|
1494
1563
|
//#endregion
|
|
1495
|
-
export { rt as ColumnBuilder,
|
|
1564
|
+
export { rt as ColumnBuilder, G as DataBulkActions, me as DataCards, ge as DataPagination, Te as DataTable, Je as DataToolbar, Q as DataViewer, ze as FilterControl, Ge as ViewSwitcher, it as col, ue as composeCardLayout, a as createColumnHelper, ot as exportCsv, K as resolveColumnLabel, vt as useDataView, Z as useDataViewContext, yt as useDataViewFetcher };
|
|
1496
1565
|
|
|
1497
1566
|
//# sourceMappingURL=index.js.map
|