@harpercollins/harpercollins-design-system 1.36.1 → 1.37.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/dist/cjs/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/cjs/components/data-display/DataGrid/FilterChipsSection.cjs +1 -1
- package/dist/cjs/components/data-display/DataGrid/TableSettingsDropdown.cjs +1 -0
- package/dist/cjs/components/data-display/DataGrid/TableToolbar.cjs +3 -3
- package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -1
- package/dist/cjs/components/data-display/Table/Table.cjs +1 -1
- package/dist/cjs/components/data-display/Table/Table.styles.cjs +32 -16
- package/dist/cjs/components/data-display/Table/TableHeader.cjs +1 -1
- package/dist/cjs/components/data-display/Table/TableLayout.cjs +1 -1
- package/dist/esm/components/data-display/DataGrid/DataGrid.js +32 -28
- package/dist/esm/components/data-display/DataGrid/FilterChipsSection.js +25 -16
- package/dist/esm/components/data-display/DataGrid/TableSettingsDropdown.js +41 -0
- package/dist/esm/components/data-display/DataGrid/TableToolbar.js +28 -18
- package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +120 -112
- package/dist/esm/components/data-display/Table/Table.js +19 -19
- package/dist/esm/components/data-display/Table/Table.styles.js +39 -21
- package/dist/esm/components/data-display/Table/TableHeader.js +24 -24
- package/dist/esm/components/data-display/Table/TableLayout.js +72 -72
- package/dist/index.d.ts +9 -4
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useReactTable as
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { useReactTable as ce } from "../../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.js";
|
|
3
3
|
import n from "react";
|
|
4
|
-
import { useLocalStorage as
|
|
5
|
-
import
|
|
6
|
-
import { multiSelectFilter as
|
|
7
|
-
import { extractColumnFilterTypes as
|
|
8
|
-
import { useInfiniteScroll as
|
|
9
|
-
import { getFilteredRowModel as
|
|
10
|
-
function
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
|
|
4
|
+
import { useLocalStorage as F } from "../../../../hooks/useLocalStorage.js";
|
|
5
|
+
import P from "../../../inputs/Checkbox/Checkbox.js";
|
|
6
|
+
import { multiSelectFilter as ue, selectFilter as ae, dateFilter as me, numericFilter as fe, textFilter as ge } from "../filters/filterFunctions.js";
|
|
7
|
+
import { extractColumnFilterTypes as L, parseSortingFromUrl as de, parseFiltersFromUrl as he, syncStateToUrl as Ce } from "../tableUrlUtils.js";
|
|
8
|
+
import { useInfiniteScroll as Re } from "./useInfiniteScroll.js";
|
|
9
|
+
import { getFilteredRowModel as Se, getSortedRowModel as we, getCoreRowModel as Fe } from "../../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
|
|
10
|
+
function ye({ table: s }) {
|
|
11
|
+
return /* @__PURE__ */ A(
|
|
12
|
+
P,
|
|
13
13
|
{
|
|
14
14
|
checked: s.getIsAllRowsSelected(),
|
|
15
15
|
indeterminate: s.getIsSomeRowsSelected(),
|
|
@@ -18,9 +18,9 @@ function Re({ table: s }) {
|
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
21
|
+
function pe({ row: s }) {
|
|
22
|
+
return /* @__PURE__ */ A(
|
|
23
|
+
P,
|
|
24
24
|
{
|
|
25
25
|
checked: s.getIsSelected(),
|
|
26
26
|
disabled: !s.getCanSelect(),
|
|
@@ -29,87 +29,93 @@ function Se({ row: s }) {
|
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function Ne({
|
|
33
33
|
id: s,
|
|
34
34
|
loading: l = !1,
|
|
35
35
|
reactTableOptions: t,
|
|
36
36
|
gridCheckboxes: f = !1,
|
|
37
|
-
allSelected:
|
|
38
|
-
onSelectionChange:
|
|
39
|
-
infiniteScroll:
|
|
40
|
-
syncUrl:
|
|
41
|
-
urlParamPrefix:
|
|
37
|
+
allSelected: y = !1,
|
|
38
|
+
onSelectionChange: p,
|
|
39
|
+
infiniteScroll: c,
|
|
40
|
+
syncUrl: u = !1,
|
|
41
|
+
urlParamPrefix: a = "",
|
|
42
|
+
initialWrapText: _ = !1
|
|
42
43
|
}) {
|
|
43
|
-
const { columns: r } = t,
|
|
44
|
-
|
|
45
|
-
), [
|
|
46
|
-
if (
|
|
44
|
+
const { columns: r } = t, $ = n.useRef(
|
|
45
|
+
L(r)
|
|
46
|
+
), [z, U] = n.useState(() => {
|
|
47
|
+
if (u && typeof window < "u") {
|
|
47
48
|
const e = new URLSearchParams(window.location.search);
|
|
48
|
-
return
|
|
49
|
+
return de(e, a);
|
|
49
50
|
}
|
|
50
51
|
return [];
|
|
51
|
-
}), [
|
|
52
|
+
}), [M, W] = n.useState(
|
|
52
53
|
() => {
|
|
53
|
-
if (
|
|
54
|
+
if (u && typeof window < "u") {
|
|
54
55
|
const e = new URLSearchParams(window.location.search);
|
|
55
|
-
return
|
|
56
|
+
return he(
|
|
56
57
|
e,
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
a,
|
|
59
|
+
$.current
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
62
|
return [];
|
|
62
63
|
}
|
|
63
|
-
), [
|
|
64
|
+
), [g, x] = F(
|
|
65
|
+
`table.${s}.wrapText`,
|
|
66
|
+
_
|
|
67
|
+
), j = n.useCallback(() => {
|
|
68
|
+
x(!g);
|
|
69
|
+
}, [g, x]), [G, K] = F(
|
|
64
70
|
`table.${s}.columnSizing`,
|
|
65
71
|
{}
|
|
66
|
-
),
|
|
72
|
+
), q = n.useRef(r), d = n.useMemo(() => {
|
|
67
73
|
const e = {};
|
|
68
|
-
return
|
|
74
|
+
return q.current.forEach((i) => {
|
|
69
75
|
const o = i.id ?? i.accessorKey;
|
|
70
76
|
o && i.meta?.hidden && (e[o] = !1);
|
|
71
77
|
}), e;
|
|
72
|
-
}, []), [
|
|
78
|
+
}, []), [h, m] = F(
|
|
73
79
|
`table.${s}.columnVisibility`,
|
|
74
|
-
|
|
75
|
-
),
|
|
76
|
-
|
|
77
|
-
}, [
|
|
80
|
+
d
|
|
81
|
+
), J = n.useCallback(() => {
|
|
82
|
+
m(d);
|
|
83
|
+
}, [d, m]), Q = n.useCallback(
|
|
78
84
|
(e) => {
|
|
79
|
-
|
|
80
|
-
typeof e == "function" ? e(
|
|
85
|
+
m(
|
|
86
|
+
typeof e == "function" ? e(h) : e
|
|
81
87
|
);
|
|
82
88
|
},
|
|
83
|
-
[
|
|
84
|
-
), [
|
|
89
|
+
[h, m]
|
|
90
|
+
), [X, Y] = n.useState({}), Z = n.useCallback(
|
|
85
91
|
(e) => {
|
|
86
|
-
|
|
92
|
+
Y((i) => {
|
|
87
93
|
const o = typeof e == "function" ? e(i) : e;
|
|
88
|
-
return
|
|
94
|
+
return p?.(o), o;
|
|
89
95
|
});
|
|
90
96
|
},
|
|
91
|
-
[
|
|
92
|
-
),
|
|
97
|
+
[p]
|
|
98
|
+
), b = n.useRef(null), C = n.useRef(t.data), T = l && C.current.length > 0 ? C.current : t.data;
|
|
93
99
|
n.useEffect(() => {
|
|
94
|
-
!l && t.data.length > 0 && (
|
|
100
|
+
!l && t.data.length > 0 && (C.current = t.data);
|
|
95
101
|
}, [l, t.data]);
|
|
96
|
-
const
|
|
102
|
+
const R = n.useRef(null), O = n.useRef(null), ee = n.useMemo(() => {
|
|
97
103
|
const e = [], i = [];
|
|
98
104
|
return r.forEach((o) => {
|
|
99
105
|
o.meta?.pinned === "left" && o.id ? e.push(o.id) : o.meta?.pinned === "right" && o.id && i.push(o.id);
|
|
100
106
|
}), { left: e, right: i };
|
|
101
|
-
}, [r]),
|
|
107
|
+
}, [r]), te = n.useMemo(() => {
|
|
102
108
|
let e = [...r];
|
|
103
109
|
return e = e.map((i) => {
|
|
104
110
|
const o = i.meta?.filterType;
|
|
105
111
|
return o && !i.filterFn ? {
|
|
106
112
|
...i,
|
|
107
113
|
filterFn: {
|
|
108
|
-
text:
|
|
109
|
-
number:
|
|
110
|
-
date:
|
|
111
|
-
select:
|
|
112
|
-
multiselect:
|
|
114
|
+
text: ge,
|
|
115
|
+
number: fe,
|
|
116
|
+
date: me,
|
|
117
|
+
select: ae,
|
|
118
|
+
multiselect: ue
|
|
113
119
|
}[o]
|
|
114
120
|
} : i;
|
|
115
121
|
}), f && (e = [{
|
|
@@ -118,93 +124,95 @@ function ke({
|
|
|
118
124
|
enableSorting: !1,
|
|
119
125
|
enableResizing: !1,
|
|
120
126
|
meta: { noSortButton: !0 },
|
|
121
|
-
header:
|
|
122
|
-
cell:
|
|
127
|
+
header: ye,
|
|
128
|
+
cell: pe
|
|
123
129
|
}, ...e]), e;
|
|
124
|
-
}, [f, r]),
|
|
130
|
+
}, [f, r]), S = ce({
|
|
125
131
|
// Overridable defaults
|
|
126
132
|
columnResizeDirection: "ltr",
|
|
127
133
|
defaultColumn: { size: 200, minSize: 20, maxSize: 500 },
|
|
128
134
|
// Consumer customisation
|
|
129
135
|
...t,
|
|
130
136
|
// Values always controlled by this hook
|
|
131
|
-
getCoreRowModel:
|
|
132
|
-
getSortedRowModel:
|
|
133
|
-
getFilteredRowModel:
|
|
134
|
-
columns:
|
|
135
|
-
data:
|
|
137
|
+
getCoreRowModel: Fe(),
|
|
138
|
+
getSortedRowModel: we(),
|
|
139
|
+
getFilteredRowModel: Se(),
|
|
140
|
+
columns: te,
|
|
141
|
+
data: T,
|
|
136
142
|
enableSorting: t.enableSorting ?? !0,
|
|
137
143
|
enableColumnResizing: t.enableColumnResizing ?? !0,
|
|
138
144
|
columnResizeMode: t.columnResizeMode ?? "onChange",
|
|
139
|
-
onColumnSizingChange: t.onColumnSizingChange ??
|
|
140
|
-
onSortingChange: t.onSortingChange ??
|
|
141
|
-
onColumnFiltersChange: t.onColumnFiltersChange ??
|
|
142
|
-
onColumnVisibilityChange: t.onColumnVisibilityChange ??
|
|
145
|
+
onColumnSizingChange: t.onColumnSizingChange ?? K,
|
|
146
|
+
onSortingChange: t.onSortingChange ?? U,
|
|
147
|
+
onColumnFiltersChange: t.onColumnFiltersChange ?? W,
|
|
148
|
+
onColumnVisibilityChange: t.onColumnVisibilityChange ?? Q,
|
|
143
149
|
enableRowSelection: f,
|
|
144
|
-
onRowSelectionChange: t.onRowSelectionChange ??
|
|
150
|
+
onRowSelectionChange: t.onRowSelectionChange ?? Z,
|
|
145
151
|
state: {
|
|
146
152
|
...t.state,
|
|
147
|
-
rowSelection: t.state?.rowSelection ??
|
|
148
|
-
sorting: t.state?.sorting ??
|
|
149
|
-
columnFilters: t.state?.columnFilters ??
|
|
150
|
-
columnSizing:
|
|
151
|
-
columnPinning:
|
|
152
|
-
columnVisibility: t.state?.columnVisibility ??
|
|
153
|
+
rowSelection: t.state?.rowSelection ?? X,
|
|
154
|
+
sorting: t.state?.sorting ?? z,
|
|
155
|
+
columnFilters: t.state?.columnFilters ?? M,
|
|
156
|
+
columnSizing: G,
|
|
157
|
+
columnPinning: ee,
|
|
158
|
+
columnVisibility: t.state?.columnVisibility ?? h
|
|
153
159
|
}
|
|
154
|
-
}), { rows:
|
|
155
|
-
enabled:
|
|
156
|
-
virtualItems:
|
|
157
|
-
paddingTop:
|
|
158
|
-
paddingBottom:
|
|
159
|
-
measureElement:
|
|
160
|
-
} =
|
|
160
|
+
}), { rows: V } = S.getRowModel(), {
|
|
161
|
+
enabled: ne,
|
|
162
|
+
virtualItems: oe,
|
|
163
|
+
paddingTop: ie,
|
|
164
|
+
paddingBottom: se,
|
|
165
|
+
measureElement: le
|
|
166
|
+
} = Re(V.length, c, R), k = c?.enabled, E = c?.hasNextPage, v = c?.isFetchingNextPage, I = c?.fetchNextPage, re = 200, w = n.useCallback(
|
|
161
167
|
(e) => {
|
|
162
|
-
if (!e || !
|
|
163
|
-
const { scrollHeight: i, scrollTop: o, clientHeight:
|
|
164
|
-
i - o -
|
|
168
|
+
if (!e || !k) return;
|
|
169
|
+
const { scrollHeight: i, scrollTop: o, clientHeight: D } = e;
|
|
170
|
+
i - o - D < re && !v && E && I?.();
|
|
165
171
|
},
|
|
166
|
-
[
|
|
172
|
+
[k, E, v, I]
|
|
167
173
|
);
|
|
168
174
|
n.useEffect(() => {
|
|
169
|
-
|
|
170
|
-
}, [
|
|
171
|
-
|
|
172
|
-
}, [
|
|
173
|
-
const
|
|
174
|
-
() =>
|
|
175
|
+
w(R.current);
|
|
176
|
+
}, [w]), b.current = S, n.useEffect(() => {
|
|
177
|
+
b.current?.toggleAllRowsSelected(y);
|
|
178
|
+
}, [y]);
|
|
179
|
+
const N = t.state?.sorting ?? z, H = t.state?.columnFilters ?? M, B = n.useMemo(
|
|
180
|
+
() => L(
|
|
175
181
|
r
|
|
176
182
|
),
|
|
177
183
|
[r]
|
|
178
184
|
);
|
|
179
185
|
return n.useEffect(() => {
|
|
180
|
-
!
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
186
|
+
!u || typeof window > "u" || Ce(
|
|
187
|
+
N,
|
|
188
|
+
H,
|
|
189
|
+
a,
|
|
190
|
+
B
|
|
185
191
|
);
|
|
186
192
|
}, [
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
u,
|
|
194
|
+
N,
|
|
195
|
+
H,
|
|
196
|
+
a,
|
|
197
|
+
B
|
|
192
198
|
]), {
|
|
193
199
|
id: s,
|
|
194
|
-
table:
|
|
195
|
-
rows:
|
|
196
|
-
isVirtual:
|
|
197
|
-
virtualItems:
|
|
198
|
-
paddingTop:
|
|
199
|
-
paddingBottom:
|
|
200
|
-
measureElement:
|
|
201
|
-
wrapperRef:
|
|
202
|
-
toolbarRef:
|
|
200
|
+
table: S,
|
|
201
|
+
rows: V,
|
|
202
|
+
isVirtual: ne,
|
|
203
|
+
virtualItems: oe,
|
|
204
|
+
paddingTop: ie,
|
|
205
|
+
paddingBottom: se,
|
|
206
|
+
measureElement: le,
|
|
207
|
+
wrapperRef: R,
|
|
208
|
+
toolbarRef: O,
|
|
203
209
|
loading: l,
|
|
204
|
-
fetchMoreOnBottomReached:
|
|
205
|
-
resetColumnVisibility:
|
|
210
|
+
fetchMoreOnBottomReached: w,
|
|
211
|
+
resetColumnVisibility: J,
|
|
212
|
+
wrapText: g,
|
|
213
|
+
toggleWrapText: j
|
|
206
214
|
};
|
|
207
215
|
}
|
|
208
216
|
export {
|
|
209
|
-
|
|
217
|
+
Ne as useDataGrid
|
|
210
218
|
};
|
|
@@ -6,9 +6,9 @@ function G({
|
|
|
6
6
|
loading: r = !1,
|
|
7
7
|
maxHeight: l = !1,
|
|
8
8
|
wrapText: f = !1,
|
|
9
|
-
rowRender:
|
|
10
|
-
reactTableOptions:
|
|
11
|
-
gridCheckboxes:
|
|
9
|
+
rowRender: t,
|
|
10
|
+
reactTableOptions: o,
|
|
11
|
+
gridCheckboxes: s = !1,
|
|
12
12
|
allSelected: i = !1,
|
|
13
13
|
onSelectionChange: n,
|
|
14
14
|
showStickyScrollbar: d = !1,
|
|
@@ -16,38 +16,38 @@ function G({
|
|
|
16
16
|
stickyHeaderOffset: u = 0,
|
|
17
17
|
infiniteScroll: p,
|
|
18
18
|
toolbar: c,
|
|
19
|
-
footer:
|
|
20
|
-
isError:
|
|
21
|
-
errorMessage:
|
|
22
|
-
syncUrl:
|
|
23
|
-
urlParamPrefix:
|
|
19
|
+
footer: x,
|
|
20
|
+
isError: y = !1,
|
|
21
|
+
errorMessage: T = "An error occurred while loading data. Please try again.",
|
|
22
|
+
syncUrl: b = !1,
|
|
23
|
+
urlParamPrefix: g = ""
|
|
24
24
|
}) {
|
|
25
25
|
return /* @__PURE__ */ a(
|
|
26
26
|
h,
|
|
27
27
|
{
|
|
28
28
|
id: e,
|
|
29
29
|
loading: r,
|
|
30
|
-
reactTableOptions:
|
|
31
|
-
gridCheckboxes:
|
|
30
|
+
reactTableOptions: o,
|
|
31
|
+
gridCheckboxes: s,
|
|
32
32
|
allSelected: i,
|
|
33
33
|
onSelectionChange: n,
|
|
34
34
|
infiniteScroll: p,
|
|
35
35
|
toolbar: c,
|
|
36
|
-
isError:
|
|
37
|
-
errorMessage:
|
|
38
|
-
syncUrl:
|
|
39
|
-
urlParamPrefix:
|
|
40
|
-
|
|
36
|
+
isError: y,
|
|
37
|
+
errorMessage: T,
|
|
38
|
+
syncUrl: b,
|
|
39
|
+
urlParamPrefix: g,
|
|
40
|
+
initialWrapText: f,
|
|
41
|
+
renderLayout: (L) => /* @__PURE__ */ a(
|
|
41
42
|
j,
|
|
42
43
|
{
|
|
43
|
-
ctx:
|
|
44
|
+
ctx: L,
|
|
44
45
|
maxHeight: l,
|
|
45
|
-
|
|
46
|
-
rowRender: o,
|
|
46
|
+
rowRender: t,
|
|
47
47
|
showStickyScrollbar: d,
|
|
48
48
|
enableStickyHeader: m,
|
|
49
49
|
stickyHeaderOffset: u,
|
|
50
|
-
footer:
|
|
50
|
+
footer: x
|
|
51
51
|
}
|
|
52
52
|
)
|
|
53
53
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import e from "styled-components";
|
|
2
2
|
import r from "../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.js";
|
|
3
|
-
const
|
|
3
|
+
const s = e.div`
|
|
4
4
|
width: 100%;
|
|
5
5
|
max-height: ${({ $maxHeight: t }) => t ? "75vh" : "initial"};
|
|
6
6
|
background: var(--palette-background-surface);
|
|
7
7
|
overflow-x: auto;
|
|
8
8
|
overflow-y: ${({ $maxHeight: t }) => t ? "auto" : "visible"};
|
|
9
9
|
position: relative;
|
|
10
|
-
`,
|
|
10
|
+
`, d = e.button`
|
|
11
11
|
&& {
|
|
12
12
|
display: flex;
|
|
13
13
|
flex-wrap: nowrap;
|
|
14
14
|
align-items: center;
|
|
15
|
-
gap:
|
|
16
|
-
flex:
|
|
15
|
+
gap: 2px;
|
|
16
|
+
flex: 1 1 0;
|
|
17
17
|
justify-content: space-between;
|
|
18
18
|
min-width: 0;
|
|
19
|
+
overflow: hidden;
|
|
19
20
|
height: 100%;
|
|
20
21
|
background: none;
|
|
21
22
|
border: none;
|
|
@@ -26,35 +27,50 @@ const l = e.div`
|
|
|
26
27
|
color: inherit;
|
|
27
28
|
font-size: inherit;
|
|
28
29
|
font-weight: bold;
|
|
29
|
-
white-space: wrap;
|
|
30
|
-
max-width: 300px;
|
|
31
30
|
}
|
|
32
31
|
// disabled state
|
|
33
32
|
&&:disabled {
|
|
34
33
|
cursor: auto;
|
|
35
34
|
}
|
|
36
35
|
`, h = e.span`
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
display: ${({ $isSorted: t }) => t ? "flex" : "none"};
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
|
|
41
|
+
${d}:hover & {
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
`, c = e.span`
|
|
37
45
|
&& {
|
|
38
46
|
display: flex;
|
|
39
47
|
flex-wrap: nowrap;
|
|
40
48
|
align-items: center;
|
|
41
49
|
gap: 6px;
|
|
42
|
-
flex:
|
|
43
|
-
justify-content: space-between;
|
|
50
|
+
flex: 1 1 0;
|
|
44
51
|
min-width: 0;
|
|
52
|
+
overflow: hidden;
|
|
45
53
|
height: 100%;
|
|
46
54
|
padding: 0;
|
|
47
55
|
font-weight: bold;
|
|
48
|
-
white-space: wrap;
|
|
49
|
-
max-width: 300px;
|
|
50
56
|
}
|
|
51
|
-
`,
|
|
57
|
+
`, g = e.span`
|
|
58
|
+
flex: 1 1 0;
|
|
59
|
+
min-width: 0;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
text-overflow: ellipsis;
|
|
62
|
+
display: -webkit-box;
|
|
63
|
+
-webkit-line-clamp: 3;
|
|
64
|
+
-webkit-box-orient: vertical;
|
|
65
|
+
white-space: normal;
|
|
66
|
+
font-size: 0.75rem;
|
|
67
|
+
`, f = e.div`
|
|
52
68
|
display: flex;
|
|
53
69
|
align-items: center;
|
|
54
70
|
gap: 2px;
|
|
55
71
|
width: 100%;
|
|
56
72
|
height: 100%;
|
|
57
|
-
`,
|
|
73
|
+
`, b = e(r)`
|
|
58
74
|
position: absolute;
|
|
59
75
|
top: 0;
|
|
60
76
|
left: 0;
|
|
@@ -66,7 +82,7 @@ const l = e.div`
|
|
|
66
82
|
align-items: flex-start;
|
|
67
83
|
z-index: 1;
|
|
68
84
|
padding-top: 10%;
|
|
69
|
-
`,
|
|
85
|
+
`, x = (t, i, o, n, a) => ({
|
|
70
86
|
...t,
|
|
71
87
|
tableLayout: "fixed",
|
|
72
88
|
width: "100%",
|
|
@@ -81,7 +97,7 @@ const l = e.div`
|
|
|
81
97
|
verticalAlign: "middle",
|
|
82
98
|
position: "sticky",
|
|
83
99
|
zIndex: 1,
|
|
84
|
-
top: !
|
|
100
|
+
top: !a && n ? "var(--header-top, 0px)" : 0
|
|
85
101
|
},
|
|
86
102
|
"& tfoot": {
|
|
87
103
|
position: "sticky",
|
|
@@ -165,7 +181,7 @@ const l = e.div`
|
|
|
165
181
|
display: "flex",
|
|
166
182
|
alignItems: "center",
|
|
167
183
|
flexWrap: "nowrap",
|
|
168
|
-
gap: "
|
|
184
|
+
gap: "2px",
|
|
169
185
|
position: "relative",
|
|
170
186
|
border: "none",
|
|
171
187
|
cursor: "pointer",
|
|
@@ -187,10 +203,12 @@ const l = e.div`
|
|
|
187
203
|
}
|
|
188
204
|
});
|
|
189
205
|
export {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
g as
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
206
|
+
c as ColumnHeaderContainer,
|
|
207
|
+
f as HeaderContent,
|
|
208
|
+
g as HeaderLabel,
|
|
209
|
+
b as LoadingOverlay,
|
|
210
|
+
d as SortButton,
|
|
211
|
+
h as SortIcon,
|
|
212
|
+
s as TableWrapper,
|
|
213
|
+
x as getTableStyles
|
|
196
214
|
};
|
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
import { jsx as n, Fragment as p, jsxs as r } from "react/jsx-runtime";
|
|
2
2
|
import { faArrowDown as c, faArrowUp as m } from "../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js";
|
|
3
3
|
import { flexRender as l } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { ColumnFilter as C } from "../DataGrid/filters/FilterComponents.js";
|
|
5
|
+
import o from "../Icon/Icon.js";
|
|
6
|
+
import { HeaderContent as z, SortButton as D, HeaderLabel as a, SortIcon as x, ColumnHeaderContainer as b } from "./Table.styles.js";
|
|
7
|
+
import { SortDirection as s } from "./Table.types.js";
|
|
8
8
|
function w({
|
|
9
|
-
headerGroups:
|
|
9
|
+
headerGroups: d,
|
|
10
10
|
id: u,
|
|
11
|
-
theadRef:
|
|
11
|
+
theadRef: f
|
|
12
12
|
}) {
|
|
13
|
-
return /* @__PURE__ */ n(p, { children:
|
|
14
|
-
const
|
|
13
|
+
return /* @__PURE__ */ n(p, { children: d.map((t) => /* @__PURE__ */ n("thead", { ref: f, children: /* @__PURE__ */ n("tr", { children: t.headers.map((e, g) => {
|
|
14
|
+
const S = g === t.headers.length - 1, i = e.column.getIsPinned();
|
|
15
15
|
return /* @__PURE__ */ r(
|
|
16
16
|
"th",
|
|
17
17
|
{
|
|
18
18
|
colSpan: e.colSpan,
|
|
19
19
|
"data-pinned": i || void 0,
|
|
20
20
|
style: {
|
|
21
|
-
width: !i &&
|
|
21
|
+
width: !i && S ? "auto" : `calc(var(--${u}-header-${e.id}-size) * 1px)`
|
|
22
22
|
},
|
|
23
23
|
children: [
|
|
24
|
-
e.isPlaceholder ? null : /* @__PURE__ */ r(
|
|
24
|
+
e.isPlaceholder ? null : /* @__PURE__ */ r(z, { children: [
|
|
25
25
|
e.column.columnDef.meta?.noSortButton ? l(e.column.columnDef.header, e.getContext()) : e.column.getCanSort() ? /* @__PURE__ */ r(
|
|
26
|
-
|
|
26
|
+
D,
|
|
27
27
|
{
|
|
28
28
|
type: "button",
|
|
29
29
|
"aria-label": `Sort ${e.id} column`,
|
|
30
30
|
onClick: e.column.getToggleSortingHandler(),
|
|
31
31
|
title: (
|
|
32
32
|
// eslint-disable-next-line no-nested-ternary
|
|
33
|
-
e.column.getNextSortingOrder() ===
|
|
33
|
+
e.column.getNextSortingOrder() === s.ASC ? "Sort ascending" : e.column.getNextSortingOrder() === s.DESC ? "Sort descending" : "Clear sort"
|
|
34
34
|
),
|
|
35
35
|
children: [
|
|
36
|
-
l(
|
|
36
|
+
/* @__PURE__ */ n(a, { children: l(
|
|
37
37
|
e.column.columnDef.header,
|
|
38
38
|
e.getContext()
|
|
39
|
-
),
|
|
40
|
-
{
|
|
41
|
-
asc: /* @__PURE__ */ n(
|
|
42
|
-
desc: /* @__PURE__ */ n(
|
|
39
|
+
) }),
|
|
40
|
+
/* @__PURE__ */ n(x, { $isSorted: e.column.getIsSorted(), children: {
|
|
41
|
+
asc: /* @__PURE__ */ n(o, { icon: m, size: "sm" }),
|
|
42
|
+
desc: /* @__PURE__ */ n(o, { icon: c, size: "sm" })
|
|
43
43
|
}[e.column.getIsSorted()] ?? (e.column.getNextSortingOrder() === "desc" ? /* @__PURE__ */ n(
|
|
44
|
-
|
|
44
|
+
o,
|
|
45
45
|
{
|
|
46
46
|
icon: c,
|
|
47
47
|
size: "sm",
|
|
48
48
|
className: "fade"
|
|
49
49
|
}
|
|
50
50
|
) : /* @__PURE__ */ n(
|
|
51
|
-
|
|
51
|
+
o,
|
|
52
52
|
{
|
|
53
53
|
icon: m,
|
|
54
54
|
size: "sm",
|
|
55
55
|
className: "fade"
|
|
56
56
|
}
|
|
57
|
-
))
|
|
57
|
+
)) })
|
|
58
58
|
]
|
|
59
59
|
}
|
|
60
|
-
) : /* @__PURE__ */ n(
|
|
60
|
+
) : /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(a, { children: l(
|
|
61
61
|
e.column.columnDef.header,
|
|
62
62
|
e.getContext()
|
|
63
|
-
) }),
|
|
63
|
+
) }) }),
|
|
64
64
|
e.column.getCanFilter() && e.column.columnDef.meta?.filterType && /* @__PURE__ */ n(
|
|
65
|
-
|
|
65
|
+
C,
|
|
66
66
|
{
|
|
67
67
|
column: e.column,
|
|
68
68
|
filterType: e.column.columnDef.meta.filterType,
|
|
@@ -85,7 +85,7 @@ function w({
|
|
|
85
85
|
},
|
|
86
86
|
e.id
|
|
87
87
|
);
|
|
88
|
-
}) }) },
|
|
88
|
+
}) }) }, t.id)) });
|
|
89
89
|
}
|
|
90
90
|
export {
|
|
91
91
|
w as default
|