@ethanhann/mantine-dataview 0.1.2 → 0.3.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 +549 -252
- 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 +3 -1
- package/dist/components/DataView/context.d.ts +1 -0
- package/dist/core/colBuilder.d.ts +37 -0
- package/dist/core/useDataViewFetcher.d.ts +3 -1
- 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 -2
- package/dist/index.js +655 -484
- package/dist/index.js.map +1 -1
- package/dist/mantine-dataview.css +2 -0
- package/dist/types/options.d.ts +7 -1
- package/dist/types/request.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { a as e, i as t, n, r, t as i } from "./serializer-u2zq_sU7.js";
|
|
2
|
-
import { createColumnHelper as a,
|
|
3
|
-
import { ActionIcon as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { useDisclosure as
|
|
7
|
-
import { DatePickerInput as
|
|
2
|
+
import { createColumnHelper as a, createColumnHelper as o, flexRender as s, functionalUpdate as c, getCoreRowModel as l, useReactTable as u } from "@tanstack/react-table";
|
|
3
|
+
import { ActionIcon as d, Anchor as f, Badge as p, Box as m, Button as h, Card as g, Center as _, Checkbox as v, CloseButton as 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 ce({ 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(ne, {
|
|
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(fe, { children: n(a) }, r.id);
|
|
187
|
-
let o = /* @__PURE__ */ L(pe, {
|
|
188
|
-
row: r,
|
|
189
|
-
layout: e,
|
|
190
|
-
selectionEnabled: u
|
|
191
|
-
});
|
|
192
|
-
return t?.Card ? /* @__PURE__ */ L(fe, { children: t.Card({
|
|
193
|
-
...a,
|
|
194
|
-
children: o
|
|
195
|
-
}) }, r.id) : /* @__PURE__ */ L(h, {
|
|
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 pe({ 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
|
-
return t ?
|
|
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 pe({ 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 pe({ 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 me({ 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 me({ 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 he({ 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 he({ 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 he({ 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 Se(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(_, {
|
|
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
|
-
...Se(e.column),
|
|
440
|
-
...t ? { textAlign: t } : void 0
|
|
441
|
-
},
|
|
442
|
-
children: o(e.column.columnDef.cell, e.getContext())
|
|
443
|
-
}, e.id);
|
|
444
|
-
})] });
|
|
445
|
-
return t?.Row ? /* @__PURE__ */ L(we, { 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 Ee({ 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 Ae = {
|
|
|
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 je(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
|
-
function
|
|
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",
|
|
@@ -599,15 +636,15 @@ function Ne({ facet: e, value: t, onChange: n }) {
|
|
|
599
636
|
}
|
|
600
637
|
//#endregion
|
|
601
638
|
//#region src/components/DataToolbar/FilterControl.tsx
|
|
602
|
-
function
|
|
603
|
-
return /* @__PURE__ */
|
|
639
|
+
function Fe({ label: e, onClear: t }) {
|
|
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",
|
|
@@ -617,28 +654,28 @@ function Pe({ label: e, onClear: t }) {
|
|
|
617
654
|
})]
|
|
618
655
|
});
|
|
619
656
|
}
|
|
620
|
-
function
|
|
657
|
+
function Ie(e) {
|
|
621
658
|
return e ? typeof e == "string" ? e : e.toISOString().split("T")[0] ?? null : null;
|
|
622
659
|
}
|
|
623
|
-
function
|
|
660
|
+
function Le(e) {
|
|
624
661
|
return Array.isArray(e) ? [e[0], e[1]] : [null, null];
|
|
625
662
|
}
|
|
626
|
-
function
|
|
663
|
+
function Re(e, t) {
|
|
627
664
|
return e.values.length > 0 ? e.values.map((e) => ({
|
|
628
665
|
value: e.value,
|
|
629
666
|
label: `${e.label ?? e.value} (${e.count})`,
|
|
630
667
|
disabled: e.count === 0
|
|
631
668
|
})) : t ?? [];
|
|
632
669
|
}
|
|
633
|
-
function
|
|
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,26 +684,26 @@ function Re({ 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,
|
|
654
|
-
data: s ?
|
|
691
|
+
data: s ? Re(s, n.options) : n.options ?? [],
|
|
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
|
-
data: s ?
|
|
698
|
+
data: s ? Re(s, n.options) : n.options ?? [],
|
|
662
699
|
value: a ?? [],
|
|
663
700
|
onChange: (e) => o(e.length > 0 ? e : void 0)
|
|
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 Re({ column: e, facet: t }) {
|
|
|
691
728
|
});
|
|
692
729
|
}
|
|
693
730
|
case "numberRange": {
|
|
694
|
-
let [t, i] =
|
|
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 Re({ 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,42 +783,42 @@ function Re({ 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,
|
|
753
790
|
popoverProps: { withinPortal: !1 },
|
|
754
791
|
value: a ? new Date(a) : null,
|
|
755
|
-
onChange: (e) => o(
|
|
792
|
+
onChange: (e) => o(Ie(e) ?? void 0)
|
|
756
793
|
});
|
|
757
794
|
case "dateRange": {
|
|
758
|
-
let [e, t] =
|
|
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,
|
|
774
811
|
clearable: !0,
|
|
775
812
|
value: n,
|
|
776
813
|
onChange: ([e, t]) => {
|
|
777
|
-
let n =
|
|
814
|
+
let n = Ie(e), r = Ie(t);
|
|
778
815
|
o(n == null && r == null ? void 0 : [n, r]);
|
|
779
816
|
}
|
|
780
817
|
})]
|
|
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 ?? "",
|
|
@@ -791,59 +828,59 @@ function Re({ column: e, facet: t }) {
|
|
|
791
828
|
}
|
|
792
829
|
//#endregion
|
|
793
830
|
//#region src/components/DataToolbar/FilterControls.tsx
|
|
794
|
-
function
|
|
795
|
-
return e.state.columnFilters.length > 0 ? /* @__PURE__ */
|
|
831
|
+
function Be({ view: e }) {
|
|
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;
|
|
803
840
|
}
|
|
804
|
-
function
|
|
841
|
+
function Ve(e) {
|
|
805
842
|
return e > 0 ? `Filters (${e})` : "Filters";
|
|
806
843
|
}
|
|
807
|
-
function
|
|
808
|
-
return /* @__PURE__ */
|
|
844
|
+
function He({ view: e, controls: t }) {
|
|
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
|
-
function
|
|
818
|
-
let n = e.filterableColumns, r =
|
|
854
|
+
function Ue({ view: e, inlineThreshold: t }) {
|
|
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
|
-
children:
|
|
829
|
-
}), /* @__PURE__ */
|
|
865
|
+
children: Ve(c)
|
|
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__ */
|
|
845
|
-
children:
|
|
846
|
-
}) }), /* @__PURE__ */
|
|
881
|
+
leftSection: /* @__PURE__ */ I(ye, {}),
|
|
882
|
+
children: Ve(c)
|
|
883
|
+
}) }), /* @__PURE__ */ I(T.Dropdown, { children: /* @__PURE__ */ I(He, {
|
|
847
884
|
view: e,
|
|
848
885
|
controls: s
|
|
849
886
|
}) })]
|
|
@@ -851,25 +888,25 @@ function He({ view: e, inlineThreshold: t }) {
|
|
|
851
888
|
}
|
|
852
889
|
//#endregion
|
|
853
890
|
//#region src/components/DataToolbar/SortControl.tsx
|
|
854
|
-
function
|
|
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 Ue({ 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
|
|
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,194 +931,317 @@ function We({ 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
|
}
|
|
904
941
|
//#endregion
|
|
905
942
|
//#region src/components/DataToolbar/VisibilityMenu.tsx
|
|
906
|
-
function
|
|
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
|
-
function
|
|
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
|
|
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
1055
|
//#region src/components/DataView/context.tsx
|
|
997
|
-
var
|
|
1056
|
+
var Ye = ae(null), Xe = Ye.Provider;
|
|
998
1057
|
function Z() {
|
|
999
|
-
let e =
|
|
1058
|
+
let e = B(Ye);
|
|
1000
1059
|
if (!e) throw Error("DataView.Toolbar / DataView.Body / DataView.Pagination must be rendered inside <DataView>.");
|
|
1001
1060
|
return e;
|
|
1002
1061
|
}
|
|
1003
1062
|
//#endregion
|
|
1004
1063
|
//#region src/components/DataView/DataView.tsx
|
|
1005
|
-
function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMobile: i,
|
|
1006
|
-
return /* @__PURE__ */
|
|
1007
|
-
value:
|
|
1064
|
+
function Q({ view: e, slots: t, renderCard: n, fallbackRole: r, lockSwitcherOnMobile: i, animateRows: a, children: o, ...s }) {
|
|
1065
|
+
return /* @__PURE__ */ I(Xe, {
|
|
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
|
-
function
|
|
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
|
-
function
|
|
1040
|
-
let { view: n, slots: r, renderCard: i, fallbackRole: a } = Z();
|
|
1041
|
-
return n.view === "cards" ? /* @__PURE__ */
|
|
1100
|
+
function Qe({ tableProps: e, cardsProps: t }) {
|
|
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
|
-
function
|
|
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
|
-
function
|
|
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
|
|
1066
1129
|
});
|
|
1067
1130
|
}
|
|
1068
|
-
Q.Toolbar =
|
|
1131
|
+
Q.Toolbar = Ze, Q.BulkActions = et, Q.Body = Qe, Q.Pagination = $e;
|
|
1132
|
+
//#endregion
|
|
1133
|
+
//#region src/core/colBuilder.ts
|
|
1134
|
+
function tt(e) {
|
|
1135
|
+
return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
1136
|
+
}
|
|
1137
|
+
var nt = {
|
|
1138
|
+
text: {
|
|
1139
|
+
dataType: "text",
|
|
1140
|
+
filterVariant: "text"
|
|
1141
|
+
},
|
|
1142
|
+
number: {
|
|
1143
|
+
dataType: "number",
|
|
1144
|
+
filterVariant: "numberRange",
|
|
1145
|
+
align: "right"
|
|
1146
|
+
},
|
|
1147
|
+
currency: {
|
|
1148
|
+
dataType: "currency",
|
|
1149
|
+
filterVariant: "numberRange",
|
|
1150
|
+
align: "right"
|
|
1151
|
+
},
|
|
1152
|
+
date: {
|
|
1153
|
+
dataType: "date",
|
|
1154
|
+
filterVariant: "dateRange"
|
|
1155
|
+
},
|
|
1156
|
+
boolean: {
|
|
1157
|
+
dataType: "boolean",
|
|
1158
|
+
filterVariant: "boolean"
|
|
1159
|
+
},
|
|
1160
|
+
select: { filterVariant: "select" },
|
|
1161
|
+
multiselect: { filterVariant: "multiselect" }
|
|
1162
|
+
}, rt = class {
|
|
1163
|
+
cols = [];
|
|
1164
|
+
helper = o();
|
|
1165
|
+
add(e, t, n) {
|
|
1166
|
+
let r = nt[e];
|
|
1167
|
+
if (!r) throw Error(`Unknown preset: ${e}`);
|
|
1168
|
+
let i = n?.header ?? tt(t), a = n?.align ?? r.align, o;
|
|
1169
|
+
if (n?.filter === !1) o = void 0;
|
|
1170
|
+
else {
|
|
1171
|
+
let e = {
|
|
1172
|
+
variant: r.filterVariant,
|
|
1173
|
+
...n?.options ? { options: n.options } : {}
|
|
1174
|
+
};
|
|
1175
|
+
o = n?.filter ? {
|
|
1176
|
+
...e,
|
|
1177
|
+
...n.filter
|
|
1178
|
+
} : e;
|
|
1179
|
+
}
|
|
1180
|
+
let s = this.helper.accessor(t, {
|
|
1181
|
+
header: i,
|
|
1182
|
+
...n?.cell ? { cell: n.cell } : {},
|
|
1183
|
+
...n?.enableSorting === !1 ? { enableSorting: !1 } : {},
|
|
1184
|
+
meta: {
|
|
1185
|
+
label: i,
|
|
1186
|
+
...r.dataType ? { dataType: r.dataType } : {},
|
|
1187
|
+
...a ? { align: a } : {},
|
|
1188
|
+
...o ? { filter: o } : {},
|
|
1189
|
+
...n?.format ? { format: n.format } : {},
|
|
1190
|
+
...n?.card ? { card: {
|
|
1191
|
+
role: n.card,
|
|
1192
|
+
...n.cardOrder == null ? {} : { order: n.cardOrder }
|
|
1193
|
+
} } : {}
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
return this.cols.push(s), this;
|
|
1197
|
+
}
|
|
1198
|
+
text(e, t) {
|
|
1199
|
+
return this.add("text", e, t);
|
|
1200
|
+
}
|
|
1201
|
+
number(e, t) {
|
|
1202
|
+
return this.add("number", e, t);
|
|
1203
|
+
}
|
|
1204
|
+
currency(e, t) {
|
|
1205
|
+
return this.add("currency", e, t);
|
|
1206
|
+
}
|
|
1207
|
+
date(e, t) {
|
|
1208
|
+
return this.add("date", e, t);
|
|
1209
|
+
}
|
|
1210
|
+
boolean(e, t) {
|
|
1211
|
+
return this.add("boolean", e, t);
|
|
1212
|
+
}
|
|
1213
|
+
select(e, t) {
|
|
1214
|
+
return this.add("select", e, t);
|
|
1215
|
+
}
|
|
1216
|
+
multiselect(e, t) {
|
|
1217
|
+
return this.add("multiselect", e, t);
|
|
1218
|
+
}
|
|
1219
|
+
custom(e) {
|
|
1220
|
+
return this.cols.push(e), this;
|
|
1221
|
+
}
|
|
1222
|
+
build() {
|
|
1223
|
+
return this.cols;
|
|
1224
|
+
}
|
|
1225
|
+
};
|
|
1226
|
+
function it() {
|
|
1227
|
+
return new rt();
|
|
1228
|
+
}
|
|
1069
1229
|
//#endregion
|
|
1070
1230
|
//#region src/core/exportCsv.ts
|
|
1071
|
-
function
|
|
1231
|
+
function at(e) {
|
|
1072
1232
|
let t = e == null ? "" : String(e);
|
|
1073
1233
|
return t.includes(",") || t.includes("\"") || t.includes("\n") ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
1074
1234
|
}
|
|
1075
|
-
function
|
|
1076
|
-
let { filename: n = "export.csv", separator: r = ",", formatted: i = !1, formatDefaults: a } = t ?? {}, o = e.getVisibleLeafColumns().filter((e) => e.id !== "_select"), s = [o.map((e) =>
|
|
1235
|
+
function ot(e, t) {
|
|
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) => {
|
|
1077
1237
|
let n = e.getAllCells().find((e) => e.column.id === t.id)?.getValue();
|
|
1078
|
-
return i && t.columnDef.meta?.dataType ?
|
|
1238
|
+
return i && t.columnDef.meta?.dataType ? at(X(t.columnDef.meta.dataType, t.columnDef.meta.format, a)(n)) : at(n);
|
|
1079
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");
|
|
1080
1240
|
u.href = l, u.download = n, u.click(), URL.revokeObjectURL(l);
|
|
1081
1241
|
}
|
|
1082
1242
|
//#endregion
|
|
1083
1243
|
//#region src/url/useUrlSync.ts
|
|
1084
|
-
function
|
|
1244
|
+
function st(e) {
|
|
1085
1245
|
return e ? {
|
|
1086
1246
|
adapter: e.adapter,
|
|
1087
1247
|
serializer: {
|
|
@@ -1091,7 +1251,7 @@ function nt(e) {
|
|
|
1091
1251
|
include: r(e.include)
|
|
1092
1252
|
} : null;
|
|
1093
1253
|
}
|
|
1094
|
-
function
|
|
1254
|
+
function ct(e, t, r) {
|
|
1095
1255
|
if (!e) return {};
|
|
1096
1256
|
try {
|
|
1097
1257
|
return n(e.adapter.read(), {
|
|
@@ -1104,21 +1264,21 @@ function rt(e, t, r) {
|
|
|
1104
1264
|
return {};
|
|
1105
1265
|
}
|
|
1106
1266
|
}
|
|
1107
|
-
function
|
|
1108
|
-
let s =
|
|
1267
|
+
function lt({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
1268
|
+
let s = U(i);
|
|
1109
1269
|
s.current = i;
|
|
1110
|
-
let c =
|
|
1270
|
+
let c = U(a);
|
|
1111
1271
|
c.current = a;
|
|
1112
|
-
let l =
|
|
1272
|
+
let l = U(o);
|
|
1113
1273
|
l.current = o;
|
|
1114
|
-
let u =
|
|
1274
|
+
let u = U(r);
|
|
1115
1275
|
u.current = r;
|
|
1116
1276
|
let d = r ? t(i, {
|
|
1117
1277
|
serializer: r.serializer,
|
|
1118
1278
|
include: r.include,
|
|
1119
1279
|
getFilterMeta: o
|
|
1120
1280
|
}) : null;
|
|
1121
|
-
|
|
1281
|
+
V(() => {
|
|
1122
1282
|
let t = u.current;
|
|
1123
1283
|
if (!t || !d) return;
|
|
1124
1284
|
let n = e(t.adapter.read(), t.serializer, t.include);
|
|
@@ -1126,7 +1286,7 @@ function it({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1126
1286
|
...n,
|
|
1127
1287
|
...d
|
|
1128
1288
|
}, { replace: !0 });
|
|
1129
|
-
}, [d ? JSON.stringify(d) : ""]),
|
|
1289
|
+
}, [d ? JSON.stringify(d) : ""]), V(() => {
|
|
1130
1290
|
if (!r) return;
|
|
1131
1291
|
let { adapter: e, serializer: t, include: i } = r;
|
|
1132
1292
|
return e.subscribe?.(() => {
|
|
@@ -1142,24 +1302,24 @@ function it({ config: r, state: i, applyPatch: a, getFilterMeta: o }) {
|
|
|
1142
1302
|
}
|
|
1143
1303
|
//#endregion
|
|
1144
1304
|
//#region src/core/resolveStatus.ts
|
|
1145
|
-
function
|
|
1305
|
+
function ut(e) {
|
|
1146
1306
|
return e.columnFilters.length > 0 || e.globalFilter.trim() !== "";
|
|
1147
1307
|
}
|
|
1148
|
-
function
|
|
1308
|
+
function dt({ status: e, error: t, pageRowCount: n, state: r }) {
|
|
1149
1309
|
return e === "error" ? {
|
|
1150
1310
|
phase: "error",
|
|
1151
1311
|
error: t
|
|
1152
|
-
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ?
|
|
1312
|
+
} : e === "loading" || e === "idle" ? { phase: "loading" } : n === 0 ? ut(r) ? { phase: "empty-filtered" } : { phase: "empty" } : { phase: "ready" };
|
|
1153
1313
|
}
|
|
1154
1314
|
//#endregion
|
|
1155
1315
|
//#region src/core/useDataView.ts
|
|
1156
|
-
var $ = 300,
|
|
1316
|
+
var $ = 300, ft = [
|
|
1157
1317
|
10,
|
|
1158
1318
|
25,
|
|
1159
1319
|
50,
|
|
1160
1320
|
100
|
|
1161
|
-
],
|
|
1162
|
-
function
|
|
1321
|
+
], pt = 10;
|
|
1322
|
+
function mt(e) {
|
|
1163
1323
|
return e == null ? {
|
|
1164
1324
|
globalFilter: $,
|
|
1165
1325
|
columnFilters: $
|
|
@@ -1171,23 +1331,23 @@ function lt(e) {
|
|
|
1171
1331
|
columnFilters: e.columnFilters ?? $
|
|
1172
1332
|
};
|
|
1173
1333
|
}
|
|
1174
|
-
function
|
|
1334
|
+
function ht(e) {
|
|
1175
1335
|
if (e.id) return e.id;
|
|
1176
1336
|
if ("accessorKey" in e && e.accessorKey != null) return String(e.accessorKey);
|
|
1177
1337
|
}
|
|
1178
|
-
function
|
|
1338
|
+
function gt(e) {
|
|
1179
1339
|
let t = /* @__PURE__ */ new Map();
|
|
1180
1340
|
for (let n of e) {
|
|
1181
|
-
let e =
|
|
1341
|
+
let e = ht(n), r = n.meta?.filter;
|
|
1182
1342
|
e && r && t.set(e, r);
|
|
1183
1343
|
}
|
|
1184
1344
|
return (e) => t.get(e);
|
|
1185
1345
|
}
|
|
1186
|
-
function
|
|
1346
|
+
function _t(e) {
|
|
1187
1347
|
return {
|
|
1188
1348
|
pagination: {
|
|
1189
1349
|
pageIndex: 0,
|
|
1190
|
-
pageSize: e.pageSizeOptions?.[0] ??
|
|
1350
|
+
pageSize: e.pageSizeOptions?.[0] ?? pt
|
|
1191
1351
|
},
|
|
1192
1352
|
sorting: [],
|
|
1193
1353
|
columnFilters: [],
|
|
@@ -1202,71 +1362,75 @@ function ft(e) {
|
|
|
1202
1362
|
...e.initialState
|
|
1203
1363
|
};
|
|
1204
1364
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let { columns: t, rows: n, rowCount: r, status: i, error: a, getRowId: o, onRequestChange:
|
|
1365
|
+
function vt(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) => {
|
|
1207
1367
|
let t = e.meta?.dataType;
|
|
1208
1368
|
if (!t || e.cell) return e;
|
|
1209
|
-
let n =
|
|
1369
|
+
let n = X(t, e.meta?.format, _);
|
|
1210
1370
|
return {
|
|
1211
1371
|
...e,
|
|
1212
1372
|
cell: (e) => n(e.getValue())
|
|
1213
1373
|
};
|
|
1214
|
-
}), [t, _]),
|
|
1215
|
-
let t =
|
|
1374
|
+
}), [t, _]), ee = H(() => gt(C), [C]), w = H(() => st(e.urlSync), [e.urlSync]), [te, ne] = W(() => {
|
|
1375
|
+
let t = _t(e);
|
|
1216
1376
|
return {
|
|
1217
1377
|
...t,
|
|
1218
|
-
...
|
|
1378
|
+
...ct(w, t, ee)
|
|
1219
1379
|
};
|
|
1220
|
-
}),
|
|
1221
|
-
...
|
|
1380
|
+
}), T = H(() => ({
|
|
1381
|
+
...te,
|
|
1222
1382
|
...d
|
|
1223
|
-
}), [
|
|
1224
|
-
|
|
1225
|
-
let
|
|
1226
|
-
|
|
1383
|
+
}), [te, d]), E = U(T);
|
|
1384
|
+
E.current = T;
|
|
1385
|
+
let D = z((e) => {
|
|
1386
|
+
ne((t) => ({
|
|
1227
1387
|
...t,
|
|
1228
1388
|
...e
|
|
1229
1389
|
})), f?.({
|
|
1230
|
-
...
|
|
1390
|
+
...E.current,
|
|
1231
1391
|
...e
|
|
1232
1392
|
});
|
|
1233
1393
|
}, [f]);
|
|
1234
|
-
|
|
1235
|
-
config:
|
|
1236
|
-
state:
|
|
1237
|
-
applyPatch:
|
|
1238
|
-
getFilterMeta:
|
|
1394
|
+
lt({
|
|
1395
|
+
config: w,
|
|
1396
|
+
state: T,
|
|
1397
|
+
applyPatch: D,
|
|
1398
|
+
getFilterMeta: ee
|
|
1239
1399
|
});
|
|
1240
|
-
let
|
|
1241
|
-
...
|
|
1400
|
+
let O = z(() => ({
|
|
1401
|
+
...E.current.pagination,
|
|
1242
1402
|
pageIndex: 0
|
|
1243
|
-
}), []),
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
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()
|
|
1249
1413
|
});
|
|
1250
|
-
}, [
|
|
1251
|
-
|
|
1252
|
-
columnFilters:
|
|
1253
|
-
pagination:
|
|
1414
|
+
}, [D, O]), M = z((e) => {
|
|
1415
|
+
D({
|
|
1416
|
+
columnFilters: c(e, E.current.columnFilters),
|
|
1417
|
+
pagination: O()
|
|
1254
1418
|
});
|
|
1255
|
-
}, [
|
|
1256
|
-
|
|
1257
|
-
globalFilter:
|
|
1258
|
-
pagination:
|
|
1419
|
+
}, [D, O]), N = z((e) => {
|
|
1420
|
+
D({
|
|
1421
|
+
globalFilter: c(e, E.current.globalFilter),
|
|
1422
|
+
pagination: O()
|
|
1259
1423
|
});
|
|
1260
|
-
}, [
|
|
1261
|
-
|
|
1262
|
-
}, [
|
|
1263
|
-
|
|
1264
|
-
}, [
|
|
1265
|
-
|
|
1266
|
-
}, [
|
|
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({
|
|
1267
1431
|
data: n,
|
|
1268
|
-
columns:
|
|
1269
|
-
getCoreRowModel:
|
|
1432
|
+
columns: C,
|
|
1433
|
+
getCoreRowModel: l(),
|
|
1270
1434
|
manualPagination: !0,
|
|
1271
1435
|
manualSorting: !0,
|
|
1272
1436
|
manualFiltering: !0,
|
|
@@ -1276,120 +1440,127 @@ function pt(e) {
|
|
|
1276
1440
|
enableRowSelection: typeof p == "function" ? (e) => p(e.original) : p ?? !0,
|
|
1277
1441
|
enableGlobalFilter: m,
|
|
1278
1442
|
state: {
|
|
1279
|
-
pagination:
|
|
1280
|
-
sorting:
|
|
1281
|
-
columnFilters:
|
|
1282
|
-
globalFilter:
|
|
1283
|
-
rowSelection:
|
|
1284
|
-
columnVisibility:
|
|
1285
|
-
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
|
|
1286
1450
|
},
|
|
1287
|
-
onPaginationChange:
|
|
1288
|
-
onSortingChange:
|
|
1289
|
-
onColumnFiltersChange:
|
|
1290
|
-
onGlobalFilterChange:
|
|
1291
|
-
onRowSelectionChange:
|
|
1292
|
-
onColumnVisibilityChange:
|
|
1293
|
-
onColumnPinningChange:
|
|
1294
|
-
}),
|
|
1295
|
-
pagination:
|
|
1296
|
-
sorting:
|
|
1297
|
-
filters:
|
|
1298
|
-
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
|
|
1299
1464
|
}), [
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
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);
|
|
1475
|
+
V(() => {
|
|
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);
|
|
1312
1478
|
}, a = 0;
|
|
1313
|
-
n && (a = Math.max(a,
|
|
1479
|
+
n && (a = Math.max(a, R.current.globalFilter)), r && (a = Math.max(a, R.current.columnFilters));
|
|
1314
1480
|
let o = !t && (n || r) && a > 0;
|
|
1315
|
-
return clearTimeout(
|
|
1316
|
-
}, [
|
|
1317
|
-
let
|
|
1318
|
-
|
|
1319
|
-
let
|
|
1320
|
-
|
|
1321
|
-
}, []),
|
|
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({
|
|
1322
1488
|
status: i,
|
|
1323
1489
|
error: a,
|
|
1324
1490
|
pageRowCount: n.length,
|
|
1325
|
-
state:
|
|
1491
|
+
state: T
|
|
1326
1492
|
}), [
|
|
1327
1493
|
i,
|
|
1328
1494
|
a,
|
|
1329
1495
|
n.length,
|
|
1330
|
-
|
|
1331
|
-
]),
|
|
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]);
|
|
1332
1498
|
return {
|
|
1333
|
-
table:
|
|
1334
|
-
request:
|
|
1335
|
-
state:
|
|
1336
|
-
view:
|
|
1337
|
-
setView:
|
|
1338
|
-
isMobileForced:
|
|
1499
|
+
table: F,
|
|
1500
|
+
request: I,
|
|
1501
|
+
state: T,
|
|
1502
|
+
view: K,
|
|
1503
|
+
setView: le,
|
|
1504
|
+
isMobileForced: G,
|
|
1339
1505
|
status: i,
|
|
1340
1506
|
error: a,
|
|
1341
|
-
renderStatus:
|
|
1342
|
-
refetch:
|
|
1343
|
-
pageSizeOptions:
|
|
1344
|
-
sortableColumns:
|
|
1345
|
-
filterableColumns:
|
|
1346
|
-
selection:
|
|
1347
|
-
let e =
|
|
1507
|
+
renderStatus: ce,
|
|
1508
|
+
refetch: se,
|
|
1509
|
+
pageSizeOptions: ue,
|
|
1510
|
+
sortableColumns: de,
|
|
1511
|
+
filterableColumns: fe,
|
|
1512
|
+
selection: H(() => {
|
|
1513
|
+
let e = T.rowSelection, t = Object.keys(e).filter((t) => e[t]), r = n.filter((t) => e[o(t)] === !0);
|
|
1348
1514
|
return {
|
|
1349
1515
|
count: t.length,
|
|
1350
1516
|
ids: t,
|
|
1351
1517
|
rows: r,
|
|
1352
|
-
clear:
|
|
1518
|
+
clear: J
|
|
1353
1519
|
};
|
|
1354
1520
|
}, [
|
|
1355
|
-
|
|
1521
|
+
T.rowSelection,
|
|
1356
1522
|
n,
|
|
1357
1523
|
o,
|
|
1358
|
-
|
|
1524
|
+
J
|
|
1359
1525
|
]),
|
|
1360
|
-
exportCsv: z((e) =>
|
|
1361
|
-
facets:
|
|
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])
|
|
1362
1530
|
};
|
|
1363
1531
|
}
|
|
1364
1532
|
//#endregion
|
|
1365
1533
|
//#region src/core/useDataViewFetcher.ts
|
|
1366
|
-
function
|
|
1367
|
-
let [
|
|
1534
|
+
function yt({ fetcher: e, deps: t, ...n }) {
|
|
1535
|
+
let [r, i] = W({
|
|
1368
1536
|
rows: [],
|
|
1369
1537
|
rowCount: 0
|
|
1370
|
-
}), [
|
|
1371
|
-
|
|
1372
|
-
let
|
|
1373
|
-
|
|
1374
|
-
|
|
1538
|
+
}), [a, o] = W("idle"), [s, c] = W(void 0), l = U(e);
|
|
1539
|
+
l.current = e;
|
|
1540
|
+
let u = U(0), d = U(null), f = z(async (e) => {
|
|
1541
|
+
d.current = e;
|
|
1542
|
+
let t = ++u.current;
|
|
1543
|
+
o("loading");
|
|
1375
1544
|
try {
|
|
1376
|
-
let n = await
|
|
1377
|
-
t ===
|
|
1545
|
+
let n = await l.current(e);
|
|
1546
|
+
t === u.current && (i(n), c(void 0), o("success"));
|
|
1378
1547
|
} catch (e) {
|
|
1379
|
-
t ===
|
|
1548
|
+
t === u.current && (c(e), o("error"));
|
|
1380
1549
|
}
|
|
1381
|
-
}, []);
|
|
1382
|
-
return
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1550
|
+
}, []), p = t ? JSON.stringify(t) : "", m = U(p);
|
|
1551
|
+
return V(() => {
|
|
1552
|
+
m.current !== p && (m.current = p, d.current && f(d.current));
|
|
1553
|
+
}), vt({
|
|
1554
|
+
...n,
|
|
1555
|
+
rows: r.rows,
|
|
1556
|
+
rowCount: r.rowCount,
|
|
1557
|
+
facets: r.facets,
|
|
1558
|
+
status: a,
|
|
1559
|
+
error: s,
|
|
1560
|
+
onRequestChange: f
|
|
1390
1561
|
});
|
|
1391
1562
|
}
|
|
1392
1563
|
//#endregion
|
|
1393
|
-
export {
|
|
1564
|
+
export { rt as ColumnBuilder, G as DataBulkActions, me as DataCards, ge as DataPagination, Te as DataTable, Je as DataToolbar, Q as DataView, 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 };
|
|
1394
1565
|
|
|
1395
1566
|
//# sourceMappingURL=index.js.map
|