@tedi-design-system/react 19.0.0-rc.4 → 19.0.0-rc.6
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/bundle-stats.html +1 -1
- package/fonts/material-symbols-outlined.woff2 +0 -0
- package/fonts/material-symbols-rounded.woff2 +0 -0
- package/fonts/material-symbols-sharp.woff2 +0 -0
- package/index.css +1 -1
- package/package.json +3 -3
- package/src/tedi/components/content/table/table.cjs.js +1 -1
- package/src/tedi/components/content/table/table.d.ts +6 -0
- package/src/tedi/components/content/table/table.es.js +431 -413
- package/src/tedi/components/content/table/table.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/table/table.module.scss.es.js +3 -0
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useReactTable as
|
|
1
|
+
import { jsx as r, jsxs as re } from "react/jsx-runtime";
|
|
2
|
+
import { useReactTable as Cn, flexRender as De } from "../../../../../external/@tanstack/react-table/build/lib/index.es.js";
|
|
3
3
|
import k from "../../../../../external/classnames/index.es.js";
|
|
4
|
-
import { useRef as
|
|
4
|
+
import { useRef as z, useId as _n, useMemo as w, useCallback as N, useState as B, useEffect as Me, Fragment as xn } from "react";
|
|
5
5
|
import { Icon as _t } from "../../base/icon/icon.es.js";
|
|
6
|
-
import { CollapseButton as
|
|
7
|
-
import { Checkbox as
|
|
8
|
-
import { Radio as
|
|
9
|
-
import { TextField as
|
|
6
|
+
import { CollapseButton as Sn } from "../../buttons/collapse-button/collapse-button.es.js";
|
|
7
|
+
import { Checkbox as Ct } from "../../form/checkbox/checkbox.es.js";
|
|
8
|
+
import { Radio as Dn } from "../../form/radio/radio.es.js";
|
|
9
|
+
import { TextField as Rn } from "../../form/textfield/textfield.es.js";
|
|
10
10
|
import l from "./table.module.scss.es.js";
|
|
11
|
-
import { TableColumnsMenu as
|
|
12
|
-
import { TableContext as
|
|
13
|
-
import { TableHeaderButton as
|
|
14
|
-
import { TableToolbar as
|
|
15
|
-
import { useTablePersistence as
|
|
16
|
-
import { useLabels as
|
|
17
|
-
import { getCoreRowModel as
|
|
18
|
-
import { Pagination as
|
|
19
|
-
const
|
|
11
|
+
import { TableColumnsMenu as yn } from "./table-columns-menu/table-columns-menu.es.js";
|
|
12
|
+
import { TableContext as In } from "./table-context.es.js";
|
|
13
|
+
import { TableHeaderButton as kn } from "./table-header-button/table-header-button.es.js";
|
|
14
|
+
import { TableToolbar as En } from "./table-toolbar/table-toolbar.es.js";
|
|
15
|
+
import { useTablePersistence as Tn } from "./use-table-persistence.es.js";
|
|
16
|
+
import { useLabels as Nn } from "../../../providers/label-provider/use-labels.es.js";
|
|
17
|
+
import { getCoreRowModel as On, getFilteredRowModel as Ln, getSortedRowModel as $n, getExpandedRowModel as Pn, getPaginationRowModel as An } from "../../../../../external/@tanstack/table-core/build/lib/index.es.js";
|
|
18
|
+
import { Pagination as Fn } from "../../navigation/pagination/pagination.es.js";
|
|
19
|
+
const io = (R, E) => (V) => {
|
|
20
20
|
const x = V.index;
|
|
21
21
|
if (x < 0 || x >= R.length) return 1;
|
|
22
|
-
const
|
|
23
|
-
if (x > 0 &&
|
|
24
|
-
let
|
|
25
|
-
for (let
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
},
|
|
22
|
+
const L = E(R[x]);
|
|
23
|
+
if (x > 0 && E(R[x - 1]) === L) return 0;
|
|
24
|
+
let T = 1;
|
|
25
|
+
for (let U = x + 1; U < R.length && E(R[U]) === L; U++)
|
|
26
|
+
T++;
|
|
27
|
+
return T;
|
|
28
|
+
}, xt = "data-tedi-drag-handle", zn = ({
|
|
29
29
|
label: R,
|
|
30
|
-
onHandlePointerDown:
|
|
30
|
+
onHandlePointerDown: E,
|
|
31
31
|
id: V,
|
|
32
32
|
pickedUp: x,
|
|
33
|
-
onKeyDown:
|
|
34
|
-
}) => /* @__PURE__ */
|
|
33
|
+
onKeyDown: L
|
|
34
|
+
}) => /* @__PURE__ */ r(
|
|
35
35
|
"button",
|
|
36
36
|
{
|
|
37
37
|
type: "button",
|
|
@@ -41,157 +41,158 @@ const no = (R, T) => (V) => {
|
|
|
41
41
|
}),
|
|
42
42
|
"aria-label": R,
|
|
43
43
|
"aria-pressed": x,
|
|
44
|
-
onClick: (
|
|
45
|
-
onMouseDown:
|
|
46
|
-
onTouchStart:
|
|
47
|
-
onKeyDown:
|
|
48
|
-
[
|
|
49
|
-
children: /* @__PURE__ */
|
|
44
|
+
onClick: (T) => T.stopPropagation(),
|
|
45
|
+
onMouseDown: E,
|
|
46
|
+
onTouchStart: E,
|
|
47
|
+
onKeyDown: L,
|
|
48
|
+
[xt]: "",
|
|
49
|
+
children: /* @__PURE__ */ r(_t, { name: "drag_indicator", size: 18, color: "inherit" })
|
|
50
50
|
}
|
|
51
|
-
),
|
|
51
|
+
), Bn = (R) => {
|
|
52
52
|
const {
|
|
53
|
-
row:
|
|
53
|
+
row: E,
|
|
54
54
|
rowClassName: V,
|
|
55
55
|
rowStyle: x,
|
|
56
|
-
isActiveRow:
|
|
57
|
-
clickable:
|
|
58
|
-
onClick:
|
|
59
|
-
onKeyDownHandler:
|
|
60
|
-
ariaRowIndex:
|
|
61
|
-
columnProps:
|
|
62
|
-
draggable:
|
|
63
|
-
dragHandleLabel:
|
|
56
|
+
isActiveRow: L,
|
|
57
|
+
clickable: T,
|
|
58
|
+
onClick: U,
|
|
59
|
+
onKeyDownHandler: ye,
|
|
60
|
+
ariaRowIndex: Ie,
|
|
61
|
+
columnProps: ne,
|
|
62
|
+
draggable: de,
|
|
63
|
+
dragHandleLabel: ce,
|
|
64
64
|
dragHandlers: u,
|
|
65
|
-
dragHandleId:
|
|
66
|
-
dragHandlePickedUp:
|
|
67
|
-
dragOverColumnId:
|
|
65
|
+
dragHandleId: ke,
|
|
66
|
+
dragHandlePickedUp: Ee,
|
|
67
|
+
dragOverColumnId: ue
|
|
68
68
|
} = R;
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ r(
|
|
70
70
|
"tr",
|
|
71
71
|
{
|
|
72
72
|
className: V,
|
|
73
73
|
style: x,
|
|
74
|
-
draggable:
|
|
74
|
+
draggable: de || void 0,
|
|
75
75
|
onDragStart: u == null ? void 0 : u.onDragStart,
|
|
76
76
|
onDragOver: u == null ? void 0 : u.onDragOver,
|
|
77
77
|
onDragLeave: u == null ? void 0 : u.onDragLeave,
|
|
78
78
|
onDragEnd: u == null ? void 0 : u.onDragEnd,
|
|
79
79
|
onDrop: u == null ? void 0 : u.onDrop,
|
|
80
|
-
onClick:
|
|
81
|
-
onKeyDown:
|
|
82
|
-
tabIndex:
|
|
83
|
-
role:
|
|
84
|
-
"aria-rowindex":
|
|
85
|
-
"aria-current":
|
|
86
|
-
children:
|
|
87
|
-
var
|
|
88
|
-
const g = $.column.columnDef.meta,
|
|
89
|
-
return
|
|
80
|
+
onClick: T && U ? () => U(E) : void 0,
|
|
81
|
+
onKeyDown: T ? ye : void 0,
|
|
82
|
+
tabIndex: T ? 0 : void 0,
|
|
83
|
+
role: T ? "button" : void 0,
|
|
84
|
+
"aria-rowindex": Ie,
|
|
85
|
+
"aria-current": L ? "true" : void 0,
|
|
86
|
+
children: E.getVisibleCells().map(($) => {
|
|
87
|
+
var oe;
|
|
88
|
+
const g = $.column.columnDef.meta, P = ne == null ? void 0 : ne($.column.id), ge = de && $.column.id === Re, me = !!ue && $.column.id === ue, O = (oe = g == null ? void 0 : g.rowSpan) == null ? void 0 : oe.call(g, $.row);
|
|
89
|
+
return O === 0 ? null : /* @__PURE__ */ r(
|
|
90
90
|
"td",
|
|
91
91
|
{
|
|
92
|
-
rowSpan:
|
|
92
|
+
rowSpan: O && O > 1 ? O : void 0,
|
|
93
93
|
className: k(
|
|
94
94
|
l["tedi-table__cell"],
|
|
95
95
|
{
|
|
96
96
|
[l[`tedi-table__cell--align-${g == null ? void 0 : g.align}`]]: g == null ? void 0 : g.align,
|
|
97
97
|
[l[`tedi-table__cell--valign-${g == null ? void 0 : g.vAlign}`]]: g == null ? void 0 : g.vAlign,
|
|
98
|
-
[l["tedi-table__cell--drag-handle"]]:
|
|
99
|
-
[l["tedi-table__cell--drag-over"]]:
|
|
98
|
+
[l["tedi-table__cell--drag-handle"]]: ge,
|
|
99
|
+
[l["tedi-table__cell--drag-over"]]: me
|
|
100
100
|
},
|
|
101
|
-
|
|
101
|
+
P == null ? void 0 : P.className
|
|
102
102
|
),
|
|
103
|
-
style:
|
|
104
|
-
children:
|
|
105
|
-
|
|
103
|
+
style: P == null ? void 0 : P.style,
|
|
104
|
+
children: ge ? /* @__PURE__ */ r(
|
|
105
|
+
zn,
|
|
106
106
|
{
|
|
107
|
-
label:
|
|
107
|
+
label: ce,
|
|
108
108
|
onHandlePointerDown: (u == null ? void 0 : u.onHandlePointerDown) ?? (() => {
|
|
109
109
|
}),
|
|
110
110
|
onKeyDown: u == null ? void 0 : u.onKeyDown,
|
|
111
|
-
id:
|
|
112
|
-
pickedUp:
|
|
111
|
+
id: ke,
|
|
112
|
+
pickedUp: Ee
|
|
113
113
|
}
|
|
114
|
-
) :
|
|
114
|
+
) : De($.column.columnDef.cell, $.getContext())
|
|
115
115
|
},
|
|
116
116
|
$.id
|
|
117
117
|
);
|
|
118
118
|
})
|
|
119
119
|
}
|
|
120
120
|
);
|
|
121
|
-
},
|
|
122
|
-
text:
|
|
123
|
-
select:
|
|
124
|
-
"multi-select":
|
|
125
|
-
"date-range":
|
|
126
|
-
"date-range-period":
|
|
121
|
+
}, We = "__select__", je = "__expand__", Re = "__drag__", se = () => !0, Un = {
|
|
122
|
+
text: se,
|
|
123
|
+
select: se,
|
|
124
|
+
"multi-select": se,
|
|
125
|
+
"date-range": se,
|
|
126
|
+
"date-range-period": se
|
|
127
127
|
};
|
|
128
|
-
function
|
|
128
|
+
function Hn(R) {
|
|
129
129
|
return Array.isArray(R.columns);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function St(R) {
|
|
132
132
|
const {
|
|
133
|
-
id:
|
|
133
|
+
id: E,
|
|
134
134
|
data: V,
|
|
135
135
|
columns: x,
|
|
136
|
-
size:
|
|
137
|
-
caption:
|
|
138
|
-
state:
|
|
139
|
-
defaultState:
|
|
140
|
-
onStateChange:
|
|
141
|
-
persist:
|
|
142
|
-
emptyState:
|
|
143
|
-
emptyStateRole:
|
|
136
|
+
size: L = "medium",
|
|
137
|
+
caption: T,
|
|
138
|
+
state: U,
|
|
139
|
+
defaultState: ye,
|
|
140
|
+
onStateChange: Ie,
|
|
141
|
+
persist: ne,
|
|
142
|
+
emptyState: de,
|
|
143
|
+
emptyStateRole: ce,
|
|
144
144
|
className: u,
|
|
145
|
-
children:
|
|
146
|
-
striped:
|
|
147
|
-
verticalBorders:
|
|
145
|
+
children: ke,
|
|
146
|
+
striped: Ee = !1,
|
|
147
|
+
verticalBorders: ue = !1,
|
|
148
148
|
borderless: $ = !1,
|
|
149
149
|
stickyFirstColumn: g = !1,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
stickyLastColumn: P = !1,
|
|
151
|
+
stickyHeader: ge = !1,
|
|
152
|
+
maxHeight: me,
|
|
153
|
+
onRowClick: O,
|
|
154
|
+
activeRowId: oe,
|
|
155
|
+
rowHover: Dt,
|
|
156
|
+
enableRowSelection: Xe,
|
|
156
157
|
selectionMode: Te = "multiple",
|
|
157
|
-
highlightSelectedRows:
|
|
158
|
-
enableColumnFilters:
|
|
159
|
-
renderSubComponent:
|
|
160
|
-
getRowCanExpand:
|
|
161
|
-
getSubRows:
|
|
162
|
-
getRowId:
|
|
163
|
-
expandTrigger:
|
|
164
|
-
paginateExpandedRows:
|
|
165
|
-
pagination:
|
|
166
|
-
autoResetPageIndex:
|
|
167
|
-
manualPagination:
|
|
168
|
-
manualSorting:
|
|
158
|
+
highlightSelectedRows: Rt = !0,
|
|
159
|
+
enableColumnFilters: Ne = !1,
|
|
160
|
+
renderSubComponent: j,
|
|
161
|
+
getRowCanExpand: Ye,
|
|
162
|
+
getSubRows: qe,
|
|
163
|
+
getRowId: yt,
|
|
164
|
+
expandTrigger: Oe = "button",
|
|
165
|
+
paginateExpandedRows: It = !1,
|
|
166
|
+
pagination: G,
|
|
167
|
+
autoResetPageIndex: kt,
|
|
168
|
+
manualPagination: M = !1,
|
|
169
|
+
manualSorting: Le = !1,
|
|
169
170
|
manualFiltering: $e = !1,
|
|
170
|
-
pageCount:
|
|
171
|
-
rowCount:
|
|
172
|
-
checkboxProps:
|
|
173
|
-
radioProps:
|
|
174
|
-
collapseProps:
|
|
175
|
-
rowProps:
|
|
171
|
+
pageCount: Je,
|
|
172
|
+
rowCount: pe,
|
|
173
|
+
checkboxProps: Pe,
|
|
174
|
+
radioProps: Qe,
|
|
175
|
+
collapseProps: Ze,
|
|
176
|
+
rowProps: Ae,
|
|
176
177
|
columnProps: W,
|
|
177
178
|
reorderableRows: S = !1,
|
|
178
|
-
onRowDrop:
|
|
179
|
-
reorderableColumns:
|
|
180
|
-
} = R, { getLabel: b } =
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
pageSize:
|
|
184
|
-
pageSizeOptions:
|
|
185
|
-
paginationProps:
|
|
186
|
-
} : null, [
|
|
179
|
+
onRowDrop: A,
|
|
180
|
+
reorderableColumns: X = !1
|
|
181
|
+
} = R, { getLabel: b } = Nn(), et = de ?? b("table.no-data"), Y = z(b);
|
|
182
|
+
Y.current = b;
|
|
183
|
+
const Et = _n(), m = E ?? Et, h = w(() => G ? G === !0 ? { pageSize: 10, pageSizeOptions: [10, 25, 50], paginationProps: void 0 } : {
|
|
184
|
+
pageSize: G.pageSize ?? 10,
|
|
185
|
+
pageSizeOptions: G.pageSizeOptions === void 0 ? [10, 25, 50] : G.pageSizeOptions,
|
|
186
|
+
paginationProps: G.paginationProps
|
|
187
|
+
} : null, [G]), y = h !== null, Tt = w(() => {
|
|
187
188
|
const e = h == null ? void 0 : h.pageSizeOptions;
|
|
188
189
|
return Array.isArray(e) && e.length > 0 ? e : void 0;
|
|
189
|
-
}, [h]), [
|
|
190
|
-
persist:
|
|
191
|
-
controlled:
|
|
192
|
-
defaultState:
|
|
193
|
-
onStateChange:
|
|
194
|
-
}),
|
|
190
|
+
}, [h]), [F, D] = Tn({
|
|
191
|
+
persist: ne,
|
|
192
|
+
controlled: U,
|
|
193
|
+
defaultState: ye,
|
|
194
|
+
onStateChange: Ie
|
|
195
|
+
}), Nt = N(
|
|
195
196
|
(e) => {
|
|
196
197
|
D((n) => {
|
|
197
198
|
const t = n.columnVisibility ?? {};
|
|
@@ -199,7 +200,7 @@ function Ct(R) {
|
|
|
199
200
|
});
|
|
200
201
|
},
|
|
201
202
|
[D]
|
|
202
|
-
),
|
|
203
|
+
), Ot = N(
|
|
203
204
|
(e) => {
|
|
204
205
|
D((n) => {
|
|
205
206
|
const t = n.rowSelection ?? {};
|
|
@@ -207,7 +208,7 @@ function Ct(R) {
|
|
|
207
208
|
});
|
|
208
209
|
},
|
|
209
210
|
[D]
|
|
210
|
-
),
|
|
211
|
+
), Lt = N(
|
|
211
212
|
(e) => {
|
|
212
213
|
D((n) => {
|
|
213
214
|
const t = n.expanded ?? {};
|
|
@@ -215,7 +216,7 @@ function Ct(R) {
|
|
|
215
216
|
});
|
|
216
217
|
},
|
|
217
218
|
[D]
|
|
218
|
-
),
|
|
219
|
+
), $t = N(
|
|
219
220
|
(e) => {
|
|
220
221
|
D((n) => {
|
|
221
222
|
const t = n.columnFilters ?? [];
|
|
@@ -223,7 +224,7 @@ function Ct(R) {
|
|
|
223
224
|
});
|
|
224
225
|
},
|
|
225
226
|
[D]
|
|
226
|
-
),
|
|
227
|
+
), Pt = N(
|
|
227
228
|
(e) => {
|
|
228
229
|
D((n) => {
|
|
229
230
|
const t = n.columnOrder ?? [];
|
|
@@ -231,7 +232,7 @@ function Ct(R) {
|
|
|
231
232
|
});
|
|
232
233
|
},
|
|
233
234
|
[D]
|
|
234
|
-
),
|
|
235
|
+
), At = N(
|
|
235
236
|
(e) => {
|
|
236
237
|
D((n) => {
|
|
237
238
|
const t = n.sorting ?? [];
|
|
@@ -239,7 +240,7 @@ function Ct(R) {
|
|
|
239
240
|
});
|
|
240
241
|
},
|
|
241
242
|
[D]
|
|
242
|
-
),
|
|
243
|
+
), Ft = N(
|
|
243
244
|
(e) => {
|
|
244
245
|
D((n) => {
|
|
245
246
|
const t = n.pagination ?? {
|
|
@@ -250,74 +251,74 @@ function Ct(R) {
|
|
|
250
251
|
});
|
|
251
252
|
},
|
|
252
253
|
[D, h]
|
|
253
|
-
),
|
|
254
|
-
() => y && !
|
|
255
|
-
[y,
|
|
256
|
-
),
|
|
254
|
+
), le = !!(j || qe), tt = !!Xe, zt = w(() => On(), []), Bt = w(() => $e ? void 0 : Ln(), [$e]), Ut = w(() => Le ? void 0 : $n(), [Le]), Ht = w(() => le ? Pn() : void 0, [le]), Kt = w(
|
|
255
|
+
() => y && !M ? An() : void 0,
|
|
256
|
+
[y, M]
|
|
257
|
+
), Vt = w(() => {
|
|
257
258
|
const e = [];
|
|
258
259
|
if (S && e.push({
|
|
259
|
-
id:
|
|
260
|
+
id: Re,
|
|
260
261
|
enableSorting: !1,
|
|
261
262
|
enableHiding: !1,
|
|
262
263
|
enableColumnFilter: !1,
|
|
263
264
|
size: 40,
|
|
264
265
|
header: "",
|
|
265
266
|
cell: () => null
|
|
266
|
-
}),
|
|
267
|
-
const n = Te === "single", t = `${
|
|
267
|
+
}), tt) {
|
|
268
|
+
const n = Te === "single", t = `${m}-select`;
|
|
268
269
|
e.push({
|
|
269
|
-
id:
|
|
270
|
+
id: We,
|
|
270
271
|
enableSorting: !1,
|
|
271
272
|
enableHiding: !1,
|
|
272
273
|
enableColumnFilter: !1,
|
|
273
274
|
size: 40,
|
|
274
|
-
header: n ? "" : ({ table: o }) => /* @__PURE__ */
|
|
275
|
-
|
|
275
|
+
header: n ? "" : ({ table: o }) => /* @__PURE__ */ r(
|
|
276
|
+
Ct,
|
|
276
277
|
{
|
|
277
|
-
...
|
|
278
|
-
id: `${
|
|
279
|
-
name: `${
|
|
280
|
-
label:
|
|
278
|
+
...Pe,
|
|
279
|
+
id: `${m}-select-all`,
|
|
280
|
+
name: `${m}-select-all`,
|
|
281
|
+
label: Y.current("table.select-all", o.getIsAllPageRowsSelected()),
|
|
281
282
|
hideLabel: !0,
|
|
282
283
|
value: "all",
|
|
283
284
|
checked: o.getIsAllPageRowsSelected(),
|
|
284
285
|
indeterminate: o.getIsSomePageRowsSelected() && !o.getIsAllPageRowsSelected(),
|
|
285
|
-
onChange: (a,
|
|
286
|
+
onChange: (a, i) => o.toggleAllPageRowsSelected(i)
|
|
286
287
|
}
|
|
287
288
|
),
|
|
288
|
-
cell: ({ row: o }) => n ? /* @__PURE__ */
|
|
289
|
-
|
|
289
|
+
cell: ({ row: o }) => n ? /* @__PURE__ */ r(
|
|
290
|
+
Dn,
|
|
290
291
|
{
|
|
291
|
-
...
|
|
292
|
-
id: `${
|
|
292
|
+
...Qe,
|
|
293
|
+
id: `${m}-select-${o.id}`,
|
|
293
294
|
name: t,
|
|
294
|
-
label:
|
|
295
|
+
label: Y.current("table.select-row", o.getIsSelected()),
|
|
295
296
|
hideLabel: !0,
|
|
296
297
|
value: o.id,
|
|
297
298
|
checked: o.getIsSelected(),
|
|
298
299
|
disabled: !o.getCanSelect(),
|
|
299
|
-
onChange: (a,
|
|
300
|
-
|
|
300
|
+
onChange: (a, i) => {
|
|
301
|
+
i && o.toggleSelected(!0);
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
|
-
) : /* @__PURE__ */
|
|
304
|
-
|
|
304
|
+
) : /* @__PURE__ */ r(
|
|
305
|
+
Ct,
|
|
305
306
|
{
|
|
306
|
-
...
|
|
307
|
-
id: `${
|
|
308
|
-
name: `${
|
|
309
|
-
label:
|
|
307
|
+
...Pe,
|
|
308
|
+
id: `${m}-select-${o.id}`,
|
|
309
|
+
name: `${m}-select-${o.id}`,
|
|
310
|
+
label: Y.current("table.select-row", o.getIsSelected()),
|
|
310
311
|
hideLabel: !0,
|
|
311
312
|
value: o.id,
|
|
312
313
|
checked: o.getIsSelected(),
|
|
313
314
|
disabled: !o.getCanSelect(),
|
|
314
315
|
indeterminate: o.getIsSomeSelected(),
|
|
315
|
-
onChange: (a,
|
|
316
|
+
onChange: (a, i) => o.toggleSelected(i)
|
|
316
317
|
}
|
|
317
318
|
)
|
|
318
319
|
});
|
|
319
320
|
}
|
|
320
|
-
return
|
|
321
|
+
return le && e.push({
|
|
321
322
|
id: je,
|
|
322
323
|
enableSorting: !1,
|
|
323
324
|
enableHiding: !1,
|
|
@@ -326,24 +327,24 @@ function Ct(R) {
|
|
|
326
327
|
header: "",
|
|
327
328
|
cell: ({ row: n }) => {
|
|
328
329
|
if (!n.getCanExpand()) return null;
|
|
329
|
-
const t = `${
|
|
330
|
-
return /* @__PURE__ */
|
|
330
|
+
const t = `${m}-sub-${n.id}`;
|
|
331
|
+
return /* @__PURE__ */ r(
|
|
331
332
|
"span",
|
|
332
333
|
{
|
|
333
334
|
onClick: (o) => o.stopPropagation(),
|
|
334
335
|
onKeyDown: (o) => {
|
|
335
336
|
(o.key === "Enter" || o.key === " ") && o.stopPropagation();
|
|
336
337
|
},
|
|
337
|
-
children: /* @__PURE__ */
|
|
338
|
-
|
|
338
|
+
children: /* @__PURE__ */ r(
|
|
339
|
+
Sn,
|
|
339
340
|
{
|
|
340
|
-
arrowType:
|
|
341
|
-
...
|
|
341
|
+
arrowType: Oe === "row" ? "default" : "secondary",
|
|
342
|
+
...Ze,
|
|
342
343
|
hideText: !0,
|
|
343
|
-
id: `${
|
|
344
|
-
"aria-controls":
|
|
345
|
-
openText:
|
|
346
|
-
closeText:
|
|
344
|
+
id: `${m}-expand-${n.id}`,
|
|
345
|
+
"aria-controls": j ? t : void 0,
|
|
346
|
+
openText: Y.current("table.expand-row"),
|
|
347
|
+
closeText: Y.current("table.collapse-row"),
|
|
347
348
|
open: n.getIsExpanded(),
|
|
348
349
|
onOpenChange: () => n.toggleExpanded()
|
|
349
350
|
}
|
|
@@ -354,347 +355,364 @@ function Ct(R) {
|
|
|
354
355
|
}), [...e, ...x];
|
|
355
356
|
}, [
|
|
356
357
|
x,
|
|
357
|
-
|
|
358
|
+
tt,
|
|
358
359
|
Te,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
le,
|
|
361
|
+
j,
|
|
362
|
+
Oe,
|
|
362
363
|
S,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
]),
|
|
364
|
+
m,
|
|
365
|
+
Pe,
|
|
366
|
+
Qe,
|
|
367
|
+
Ze
|
|
368
|
+
]), Gt = w(() => ({}), []), Mt = w(() => ({}), []), Wt = w(() => [], []), jt = w(() => [], []), Xt = w(() => [], []), Yt = w(
|
|
368
369
|
() => ({ pageIndex: 0, pageSize: (h == null ? void 0 : h.pageSize) ?? 10 }),
|
|
369
370
|
[h]
|
|
370
|
-
), d =
|
|
371
|
+
), d = Cn({
|
|
371
372
|
data: V,
|
|
372
|
-
columns:
|
|
373
|
+
columns: Vt,
|
|
373
374
|
state: {
|
|
374
|
-
columnVisibility:
|
|
375
|
-
columnOrder:
|
|
376
|
-
rowSelection:
|
|
377
|
-
expanded:
|
|
378
|
-
columnFilters:
|
|
379
|
-
sorting:
|
|
380
|
-
pagination: y ?
|
|
375
|
+
columnVisibility: F.columnVisibility,
|
|
376
|
+
columnOrder: F.columnOrder ?? jt,
|
|
377
|
+
rowSelection: F.rowSelection ?? Gt,
|
|
378
|
+
expanded: F.expanded ?? Mt,
|
|
379
|
+
columnFilters: F.columnFilters ?? Wt,
|
|
380
|
+
sorting: F.sorting ?? Xt,
|
|
381
|
+
pagination: y ? F.pagination ?? Yt : void 0
|
|
381
382
|
},
|
|
382
|
-
enableRowSelection:
|
|
383
|
+
enableRowSelection: Xe,
|
|
383
384
|
enableMultiRowSelection: Te !== "single",
|
|
384
|
-
enableColumnFilters:
|
|
385
|
-
autoResetPageIndex:
|
|
386
|
-
paginateExpandedRows: y && !
|
|
387
|
-
manualPagination:
|
|
388
|
-
manualSorting:
|
|
385
|
+
enableColumnFilters: Ne,
|
|
386
|
+
autoResetPageIndex: kt ?? !M,
|
|
387
|
+
paginateExpandedRows: y && !M ? It : !0,
|
|
388
|
+
manualPagination: M,
|
|
389
|
+
manualSorting: Le,
|
|
389
390
|
manualFiltering: $e,
|
|
390
391
|
// `pageCount` only matters in manual mode; TanStack ignores it otherwise.
|
|
391
|
-
pageCount:
|
|
392
|
-
rowCount:
|
|
393
|
-
getRowCanExpand:
|
|
394
|
-
getSubRows:
|
|
395
|
-
getRowId:
|
|
396
|
-
onColumnVisibilityChange:
|
|
397
|
-
onColumnOrderChange:
|
|
398
|
-
onRowSelectionChange:
|
|
399
|
-
onExpandedChange:
|
|
400
|
-
onColumnFiltersChange:
|
|
401
|
-
onSortingChange:
|
|
402
|
-
onPaginationChange: y ?
|
|
403
|
-
filterFns:
|
|
404
|
-
getCoreRowModel:
|
|
405
|
-
getFilteredRowModel:
|
|
406
|
-
getExpandedRowModel:
|
|
407
|
-
getSortedRowModel:
|
|
408
|
-
getPaginationRowModel:
|
|
409
|
-
}),
|
|
410
|
-
() => ({ table: d, size:
|
|
411
|
-
[d,
|
|
412
|
-
),
|
|
413
|
-
|
|
414
|
-
|
|
392
|
+
pageCount: M && Je !== void 0 ? Je : void 0,
|
|
393
|
+
rowCount: M && pe !== void 0 ? pe : void 0,
|
|
394
|
+
getRowCanExpand: j ? Ye ?? (() => !0) : Ye,
|
|
395
|
+
getSubRows: qe,
|
|
396
|
+
getRowId: yt,
|
|
397
|
+
onColumnVisibilityChange: Nt,
|
|
398
|
+
onColumnOrderChange: Pt,
|
|
399
|
+
onRowSelectionChange: Ot,
|
|
400
|
+
onExpandedChange: Lt,
|
|
401
|
+
onColumnFiltersChange: $t,
|
|
402
|
+
onSortingChange: At,
|
|
403
|
+
onPaginationChange: y ? Ft : void 0,
|
|
404
|
+
filterFns: Un,
|
|
405
|
+
getCoreRowModel: zt,
|
|
406
|
+
getFilteredRowModel: Bt,
|
|
407
|
+
getExpandedRowModel: Ht,
|
|
408
|
+
getSortedRowModel: Ut,
|
|
409
|
+
getPaginationRowModel: Kt
|
|
410
|
+
}), qt = w(
|
|
411
|
+
() => ({ table: d, size: L, id: m, state: F }),
|
|
412
|
+
[d, L, m, F]
|
|
413
|
+
), fe = z(null), [nt, Jt] = B({ left: !1, right: !1 }), ot = g || P;
|
|
414
|
+
Me(() => {
|
|
415
|
+
const e = fe.current;
|
|
416
|
+
if (!e || !ot) return;
|
|
417
|
+
const n = () => {
|
|
418
|
+
const o = e.scrollLeft > 0, a = Math.ceil(e.scrollLeft + e.clientWidth) < e.scrollWidth;
|
|
419
|
+
Jt((i) => i.left === o && i.right === a ? i : { left: o, right: a });
|
|
420
|
+
};
|
|
421
|
+
n(), e.addEventListener("scroll", n, { passive: !0 });
|
|
422
|
+
const t = new ResizeObserver(n);
|
|
423
|
+
return t.observe(e), e.firstElementChild && t.observe(e.firstElementChild), () => {
|
|
424
|
+
e.removeEventListener("scroll", n), t.disconnect();
|
|
425
|
+
};
|
|
426
|
+
}, [ot]);
|
|
427
|
+
const be = N(() => {
|
|
428
|
+
fe.current && (fe.current.scrollTop = 0);
|
|
429
|
+
}, []), Qt = N(
|
|
415
430
|
(e) => {
|
|
416
|
-
d.setPageIndex(e - 1),
|
|
431
|
+
d.setPageIndex(e - 1), be();
|
|
417
432
|
},
|
|
418
|
-
[d,
|
|
419
|
-
),
|
|
433
|
+
[d, be]
|
|
434
|
+
), Zt = N(
|
|
420
435
|
(e) => {
|
|
421
|
-
d.setPageSize(e),
|
|
436
|
+
d.setPageSize(e), be();
|
|
422
437
|
},
|
|
423
|
-
[d,
|
|
424
|
-
),
|
|
438
|
+
[d, be]
|
|
439
|
+
), en = d.getHeaderGroups().length > 1, he = Oe === "row" && le, tn = Dt ?? (!!O || he), nn = k(
|
|
425
440
|
l["tedi-table"],
|
|
426
|
-
l[`tedi-table--${
|
|
441
|
+
l[`tedi-table--${L}`],
|
|
427
442
|
{
|
|
428
|
-
[l["tedi-table--striped"]]:
|
|
429
|
-
[l["tedi-table--vertical-borders"]]:
|
|
443
|
+
[l["tedi-table--striped"]]: Ee,
|
|
444
|
+
[l["tedi-table--vertical-borders"]]: ue,
|
|
430
445
|
[l["tedi-table--borderless"]]: $,
|
|
431
446
|
[l["tedi-table--sticky-first-column"]]: g,
|
|
432
|
-
[l["tedi-table--sticky-
|
|
433
|
-
[l["tedi-table--
|
|
434
|
-
[l["tedi-table--
|
|
447
|
+
[l["tedi-table--sticky-last-column"]]: P,
|
|
448
|
+
[l["tedi-table--overflow-left"]]: g && nt.left,
|
|
449
|
+
[l["tedi-table--overflow-right"]]: P && nt.right,
|
|
450
|
+
[l["tedi-table--sticky-header"]]: ge,
|
|
451
|
+
[l["tedi-table--clickable-rows"]]: !!O || he,
|
|
452
|
+
[l["tedi-table--row-hover"]]: tn,
|
|
435
453
|
[l["tedi-table--has-pagination"]]: y,
|
|
436
|
-
[l["tedi-table--grouped-headers"]]:
|
|
454
|
+
[l["tedi-table--grouped-headers"]]: en
|
|
437
455
|
},
|
|
438
456
|
u
|
|
439
|
-
),
|
|
457
|
+
), v = d.getRowModel().rows, we = d.getHeaderGroups(), lt = d.getFooterGroups(), at = d.getVisibleLeafColumns(), ve = at.length, on = lt.some(
|
|
440
458
|
(e) => e.headers.some((n) => n.column.columnDef.footer !== void 0)
|
|
441
|
-
),
|
|
442
|
-
|
|
443
|
-
},
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
() => S ? new Map(
|
|
447
|
-
[S,
|
|
459
|
+
), it = (e) => !!O || he && e.getCanExpand(), rt = (e) => {
|
|
460
|
+
he && e.getCanExpand() && e.toggleExpanded(), O == null || O(e);
|
|
461
|
+
}, ln = (e) => (n) => {
|
|
462
|
+
it(e) && n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && (n.preventDefault(), rt(e));
|
|
463
|
+
}, st = we.length + (Ne ? 1 : 0), dt = d.getState().pagination, an = y ? dt.pageIndex * dt.pageSize : 0, rn = y ? pe ?? d.getFilteredRowModel().rows.length : v.length, sn = y ? st + rn : void 0, [ct, Fe] = B(null), [dn, Ce] = B(null), q = z(null), J = z(null), [ut, ze] = B(null), [gt, _e] = B(null), Q = z(null), Z = z(null), [mt, Be] = B(null), xe = z([]), [pt, Ue] = B(null), ae = z(-1), [cn, H] = B(""), Se = z(null), [un, ft] = B(0), He = w(
|
|
464
|
+
() => S ? new Map(v.map((e) => [e.id, e.index])) : /* @__PURE__ */ new Map(),
|
|
465
|
+
[S, v]
|
|
448
466
|
);
|
|
449
|
-
|
|
450
|
-
if (!S && !
|
|
467
|
+
Me(() => {
|
|
468
|
+
if (!S && !X) return;
|
|
451
469
|
const e = () => {
|
|
452
|
-
|
|
470
|
+
J.current = null, Z.current = null;
|
|
453
471
|
};
|
|
454
472
|
return window.addEventListener("mouseup", e), window.addEventListener("touchend", e), () => {
|
|
455
473
|
window.removeEventListener("mouseup", e), window.removeEventListener("touchend", e);
|
|
456
474
|
};
|
|
457
|
-
}, [S,
|
|
458
|
-
const
|
|
475
|
+
}, [S, X]);
|
|
476
|
+
const gn = N(
|
|
459
477
|
(e) => ({
|
|
460
478
|
onHandlePointerDown: () => {
|
|
461
|
-
|
|
479
|
+
J.current = e;
|
|
462
480
|
},
|
|
463
481
|
onDragStart: (n) => {
|
|
464
|
-
if (
|
|
482
|
+
if (J.current !== e) {
|
|
465
483
|
n.preventDefault();
|
|
466
484
|
return;
|
|
467
485
|
}
|
|
468
|
-
|
|
486
|
+
J.current = null, n.dataTransfer.effectAllowed = "move";
|
|
469
487
|
try {
|
|
470
488
|
n.dataTransfer.setData("text/plain", e);
|
|
471
489
|
} catch {
|
|
472
490
|
}
|
|
473
491
|
const t = n.currentTarget, o = t.closest("table");
|
|
474
492
|
if (o) {
|
|
475
|
-
const a = t.getBoundingClientRect(),
|
|
493
|
+
const a = t.getBoundingClientRect(), i = Array.from(t.children), c = document.createElement("div");
|
|
476
494
|
c.style.cssText = `position:fixed;top:-10000px;left:0;width:${a.width}px;pointer-events:none;`;
|
|
477
495
|
const f = document.createElement("table");
|
|
478
496
|
f.className = o.className, f.style.cssText = `width:${a.width}px;table-layout:fixed;border-collapse:collapse;`;
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
const s = Array.from(
|
|
482
|
-
|
|
483
|
-
const
|
|
484
|
-
if (!
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
}),
|
|
497
|
+
const C = document.createElement("tbody"), _ = t.cloneNode(!0);
|
|
498
|
+
_.classList.add(l["tedi-table__row--drag-preview"]);
|
|
499
|
+
const s = Array.from(_.children);
|
|
500
|
+
i.forEach((ee, I) => {
|
|
501
|
+
const K = s[I];
|
|
502
|
+
if (!K) return;
|
|
503
|
+
const ie = ee.getBoundingClientRect();
|
|
504
|
+
K.style.width = `${ie.width}px`, K.style.minWidth = `${ie.width}px`, K.style.maxWidth = `${ie.width}px`;
|
|
505
|
+
}), C.appendChild(_), f.appendChild(C), c.appendChild(f), document.body.appendChild(c), n.dataTransfer.setDragImage(c, 24, a.height / 2), window.setTimeout(() => c.remove(), 0);
|
|
488
506
|
}
|
|
489
|
-
|
|
507
|
+
q.current = e, Fe(e);
|
|
490
508
|
},
|
|
491
509
|
onDragOver: (n) => {
|
|
492
|
-
!
|
|
510
|
+
!q.current || q.current === e || (n.preventDefault(), n.dataTransfer.dropEffect = "move", Ce(e));
|
|
493
511
|
},
|
|
494
512
|
onDragLeave: () => {
|
|
495
|
-
|
|
513
|
+
Ce((n) => n === e ? null : n);
|
|
496
514
|
},
|
|
497
515
|
onDragEnd: () => {
|
|
498
|
-
|
|
516
|
+
q.current = null, J.current = null, Fe(null), Ce(null);
|
|
499
517
|
},
|
|
500
518
|
onDrop: (n) => {
|
|
501
519
|
n.preventDefault();
|
|
502
|
-
const t =
|
|
503
|
-
if (
|
|
504
|
-
const a = He.get(t),
|
|
505
|
-
a === void 0 ||
|
|
520
|
+
const t = q.current, o = e;
|
|
521
|
+
if (q.current = null, J.current = null, Fe(null), Ce(null), !t || t === o) return;
|
|
522
|
+
const a = He.get(t), i = He.get(o);
|
|
523
|
+
a === void 0 || i === void 0 || A == null || A({ fromId: t, toId: o, fromIndex: a, toIndex: i });
|
|
506
524
|
}
|
|
507
525
|
}),
|
|
508
|
-
[He,
|
|
509
|
-
),
|
|
526
|
+
[He, A]
|
|
527
|
+
), bt = (e, n, t) => {
|
|
510
528
|
const o = e.slice(), [a] = o.splice(n, 1);
|
|
511
529
|
return o.splice(t, 0, a), o;
|
|
512
|
-
},
|
|
530
|
+
}, mn = N(
|
|
513
531
|
(e) => ({
|
|
514
532
|
onHandlePointerDown: () => {
|
|
515
|
-
|
|
533
|
+
Z.current = e;
|
|
516
534
|
},
|
|
517
535
|
onDragStart: (n) => {
|
|
518
|
-
if (
|
|
536
|
+
if (Z.current !== e) {
|
|
519
537
|
n.preventDefault();
|
|
520
538
|
return;
|
|
521
539
|
}
|
|
522
|
-
|
|
540
|
+
Z.current = null, n.dataTransfer.effectAllowed = "move";
|
|
523
541
|
try {
|
|
524
542
|
n.dataTransfer.setData("text/plain", e);
|
|
525
543
|
} catch {
|
|
526
544
|
}
|
|
527
545
|
const t = n.currentTarget, o = t.getBoundingClientRect(), a = document.createElement("div");
|
|
528
546
|
a.style.cssText = `position:fixed;top:-10000px;left:0;width:${o.width}px;pointer-events:none;`;
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
const f = document.createElement("thead"),
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
|
|
547
|
+
const i = document.createElement("table"), c = t.closest("table");
|
|
548
|
+
i.className = (c == null ? void 0 : c.className) ?? "", i.style.cssText = `width:${o.width}px;table-layout:fixed;border-collapse:collapse;`;
|
|
549
|
+
const f = document.createElement("thead"), C = document.createElement("tr");
|
|
550
|
+
C.className = l["tedi-table__row"];
|
|
551
|
+
const _ = t.cloneNode(!0);
|
|
552
|
+
_.classList.add(l["tedi-table__header-cell--drag-preview"]), _.style.width = `${o.width}px`, C.appendChild(_), f.appendChild(C), i.appendChild(f), a.appendChild(i), document.body.appendChild(a), n.dataTransfer.setDragImage(a, o.width / 2, o.height / 2), window.setTimeout(() => a.remove(), 0), Q.current = e, ze(e);
|
|
535
553
|
},
|
|
536
554
|
onDragOver: (n) => {
|
|
537
|
-
!
|
|
555
|
+
!Q.current || Q.current === e || (n.preventDefault(), n.dataTransfer.dropEffect = "move", _e(e));
|
|
538
556
|
},
|
|
539
557
|
onDragLeave: () => {
|
|
540
|
-
|
|
558
|
+
_e((n) => n === e ? null : n);
|
|
541
559
|
},
|
|
542
560
|
onDragEnd: () => {
|
|
543
|
-
|
|
561
|
+
Q.current = null, Z.current = null, ze(null), _e(null);
|
|
544
562
|
},
|
|
545
563
|
onDrop: (n) => {
|
|
546
564
|
n.preventDefault();
|
|
547
|
-
const t =
|
|
548
|
-
if (
|
|
549
|
-
const a = d.getState().columnOrder,
|
|
550
|
-
c < 0 || f < 0 || d.setColumnOrder(
|
|
565
|
+
const t = Q.current, o = e;
|
|
566
|
+
if (Q.current = null, Z.current = null, ze(null), _e(null), !t || t === o) return;
|
|
567
|
+
const a = d.getState().columnOrder, i = a.length > 0 ? a : d.getAllLeafColumns().map((C) => C.id), c = i.indexOf(t), f = i.indexOf(o);
|
|
568
|
+
c < 0 || f < 0 || d.setColumnOrder(bt(i, c, f));
|
|
551
569
|
}
|
|
552
570
|
}),
|
|
553
571
|
[d]
|
|
554
|
-
),
|
|
572
|
+
), pn = (e) => `${m}-col-reorder-${e}`, fn = (e) => `${m}-row-reorder-${e}`, ht = () => d.getVisibleLeafColumns().filter((e) => !e.parent && e.id !== Re && e.id !== We && e.id !== je).map((e) => e.id), Ke = (e) => {
|
|
555
573
|
const n = d.getColumn(e), t = n == null ? void 0 : n.columnDef.meta;
|
|
556
574
|
return (t == null ? void 0 : t.label) ?? (typeof (n == null ? void 0 : n.columnDef.header) == "string" ? n.columnDef.header : e);
|
|
557
|
-
},
|
|
558
|
-
const t =
|
|
575
|
+
}, wt = (e, n) => {
|
|
576
|
+
const t = ht(), o = t.indexOf(n);
|
|
559
577
|
if (o < 0) return;
|
|
560
578
|
const a = o + e;
|
|
561
579
|
if (a < 0 || a >= t.length) return;
|
|
562
|
-
const
|
|
563
|
-
let
|
|
564
|
-
const
|
|
565
|
-
for (const s of
|
|
566
|
-
d.setColumnOrder(
|
|
567
|
-
},
|
|
568
|
-
if (!
|
|
569
|
-
const t =
|
|
580
|
+
const i = bt(t, o, a), c = d.getState().columnOrder.length > 0 ? [...d.getState().columnOrder] : d.getAllLeafColumns().map((s) => s.id), f = new Set(t);
|
|
581
|
+
let C = 0;
|
|
582
|
+
const _ = c.map((s) => f.has(s) ? i[C++] : s);
|
|
583
|
+
for (const s of i) _.includes(s) || _.push(s);
|
|
584
|
+
d.setColumnOrder(_), H(b("table.reorder.move", Ke(n), a + 1)), Se.current = { kind: "column", id: n }, ft((s) => s + 1);
|
|
585
|
+
}, bn = (e, n) => {
|
|
586
|
+
if (!X) return;
|
|
587
|
+
const t = mt;
|
|
570
588
|
switch (e.key) {
|
|
571
589
|
case " ":
|
|
572
590
|
case "Enter":
|
|
573
591
|
if (e.preventDefault(), t === null)
|
|
574
|
-
|
|
592
|
+
xe.current = [...d.getState().columnOrder ?? []], Be(n), H(b("table.reorder.pickup", Ke(n)));
|
|
575
593
|
else {
|
|
576
|
-
const o =
|
|
577
|
-
Be(null),
|
|
594
|
+
const o = ht().indexOf(t) + 1;
|
|
595
|
+
Be(null), xe.current = [], H(b("table.reorder.drop", Ke(t), o));
|
|
578
596
|
}
|
|
579
597
|
break;
|
|
580
598
|
case "Escape":
|
|
581
|
-
t !== null && (e.preventDefault(), d.setColumnOrder(
|
|
599
|
+
t !== null && (e.preventDefault(), d.setColumnOrder(xe.current), Be(null), xe.current = [], H(b("table.reorder.cancel")));
|
|
582
600
|
break;
|
|
583
601
|
case "ArrowLeft":
|
|
584
|
-
t !== null && (e.preventDefault(),
|
|
602
|
+
t !== null && (e.preventDefault(), wt(-1, t));
|
|
585
603
|
break;
|
|
586
604
|
case "ArrowRight":
|
|
587
|
-
t !== null && (e.preventDefault(),
|
|
605
|
+
t !== null && (e.preventDefault(), wt(1, t));
|
|
588
606
|
break;
|
|
589
607
|
}
|
|
590
|
-
},
|
|
591
|
-
const t =
|
|
608
|
+
}, vt = (e, n) => {
|
|
609
|
+
const t = v.findIndex((c) => c.original === n);
|
|
592
610
|
if (t < 0) return;
|
|
593
611
|
const o = t + e;
|
|
594
|
-
if (o < 0 || o >=
|
|
595
|
-
const a =
|
|
596
|
-
|
|
612
|
+
if (o < 0 || o >= v.length) return;
|
|
613
|
+
const a = v[t], i = v[o];
|
|
614
|
+
A == null || A({
|
|
597
615
|
fromId: a.id,
|
|
598
|
-
toId:
|
|
616
|
+
toId: i.id,
|
|
599
617
|
fromIndex: a.index,
|
|
600
|
-
toIndex:
|
|
601
|
-
}),
|
|
602
|
-
},
|
|
618
|
+
toIndex: i.index
|
|
619
|
+
}), H(b("table.row-reorder.move", o + 1)), Se.current = { kind: "row", original: n }, ft((c) => c + 1);
|
|
620
|
+
}, hn = (e, n) => {
|
|
603
621
|
if (!S) return;
|
|
604
|
-
const t =
|
|
622
|
+
const t = pt;
|
|
605
623
|
switch (e.key) {
|
|
606
624
|
case " ":
|
|
607
625
|
case "Enter":
|
|
608
626
|
if (e.preventDefault(), t === null)
|
|
609
|
-
Ue(n.original),
|
|
627
|
+
Ue(n.original), ae.current = n.index, H(b("table.row-reorder.pickup", v.indexOf(n) + 1));
|
|
610
628
|
else {
|
|
611
|
-
const o =
|
|
612
|
-
Ue(null),
|
|
629
|
+
const o = v.findIndex((a) => a.original === t) + 1;
|
|
630
|
+
Ue(null), ae.current = -1, H(b("table.row-reorder.drop", o));
|
|
613
631
|
}
|
|
614
632
|
break;
|
|
615
633
|
case "Escape":
|
|
616
634
|
if (t !== null) {
|
|
617
635
|
e.preventDefault();
|
|
618
|
-
const o =
|
|
619
|
-
if (o >= 0 &&
|
|
620
|
-
const a =
|
|
621
|
-
|
|
636
|
+
const o = v.findIndex((a) => a.original === t);
|
|
637
|
+
if (o >= 0 && ae.current >= 0) {
|
|
638
|
+
const a = v[o];
|
|
639
|
+
A == null || A({
|
|
622
640
|
fromId: a.id,
|
|
623
641
|
toId: a.id,
|
|
624
642
|
fromIndex: a.index,
|
|
625
|
-
toIndex:
|
|
643
|
+
toIndex: ae.current
|
|
626
644
|
});
|
|
627
645
|
}
|
|
628
|
-
Ue(null),
|
|
646
|
+
Ue(null), ae.current = -1, H(b("table.row-reorder.cancel"));
|
|
629
647
|
}
|
|
630
648
|
break;
|
|
631
649
|
case "ArrowUp":
|
|
632
|
-
t !== null && (e.preventDefault(),
|
|
650
|
+
t !== null && (e.preventDefault(), vt(-1, t));
|
|
633
651
|
break;
|
|
634
652
|
case "ArrowDown":
|
|
635
|
-
t !== null && (e.preventDefault(),
|
|
653
|
+
t !== null && (e.preventDefault(), vt(1, t));
|
|
636
654
|
break;
|
|
637
655
|
}
|
|
638
656
|
};
|
|
639
|
-
return
|
|
657
|
+
return Me(() => {
|
|
640
658
|
var t;
|
|
641
|
-
const e =
|
|
659
|
+
const e = Se.current;
|
|
642
660
|
if (!e) return;
|
|
643
|
-
|
|
661
|
+
Se.current = null;
|
|
644
662
|
let n;
|
|
645
663
|
if (e.kind === "column")
|
|
646
|
-
n = `${
|
|
664
|
+
n = `${m}-col-reorder-${e.id}`;
|
|
647
665
|
else {
|
|
648
|
-
const o =
|
|
649
|
-
n = o ? `${
|
|
666
|
+
const o = v.find((a) => a.original === e.original);
|
|
667
|
+
n = o ? `${m}-row-reorder-${o.id}` : null;
|
|
650
668
|
}
|
|
651
669
|
n && ((t = document.getElementById(n)) == null || t.focus());
|
|
652
|
-
}, [
|
|
653
|
-
|
|
654
|
-
(S ||
|
|
655
|
-
/* @__PURE__ */
|
|
670
|
+
}, [un, v, m]), /* @__PURE__ */ r(In.Provider, { value: qt, children: /* @__PURE__ */ re("div", { className: nn, "data-name": "tedi-table", children: [
|
|
671
|
+
ke,
|
|
672
|
+
(S || X) && /* @__PURE__ */ r("div", { className: l["tedi-table__sr-only"], "aria-live": "polite", "aria-atomic": "true", children: cn }),
|
|
673
|
+
/* @__PURE__ */ r(
|
|
656
674
|
"div",
|
|
657
675
|
{
|
|
658
|
-
ref:
|
|
676
|
+
ref: fe,
|
|
659
677
|
className: l["tedi-table__scroll"],
|
|
660
|
-
style:
|
|
661
|
-
children: /* @__PURE__ */
|
|
678
|
+
style: me !== void 0 ? { maxHeight: me, overflowY: "auto" } : void 0,
|
|
679
|
+
children: /* @__PURE__ */ re(
|
|
662
680
|
"table",
|
|
663
681
|
{
|
|
664
|
-
id:
|
|
682
|
+
id: E,
|
|
665
683
|
className: l["tedi-table__table"],
|
|
666
|
-
"aria-rowcount":
|
|
667
|
-
"aria-colcount":
|
|
684
|
+
"aria-rowcount": sn,
|
|
685
|
+
"aria-colcount": ve > 0 ? ve : void 0,
|
|
668
686
|
children: [
|
|
669
|
-
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
|
|
687
|
+
T && /* @__PURE__ */ r("caption", { className: l["tedi-table__caption"], children: T }),
|
|
688
|
+
/* @__PURE__ */ re("thead", { className: l["tedi-table__head"], children: [
|
|
689
|
+
we.map((e, n) => /* @__PURE__ */ r(
|
|
672
690
|
"tr",
|
|
673
691
|
{
|
|
674
692
|
className: l["tedi-table__row"],
|
|
675
693
|
"aria-rowindex": y ? n + 1 : void 0,
|
|
676
694
|
children: e.headers.map((t) => {
|
|
677
|
-
const o = t.subHeaders.length > 0, a = !!t.column.parent,
|
|
695
|
+
const o = t.subHeaders.length > 0, a = !!t.column.parent, i = Hn(t.column.columnDef), c = !i && !a;
|
|
678
696
|
if (t.isPlaceholder && !c || !t.isPlaceholder && c && n > 0)
|
|
679
697
|
return null;
|
|
680
|
-
const f = c ?
|
|
681
|
-
return /* @__PURE__ */
|
|
698
|
+
const f = c ? we.length - n : 1, C = t.column.getIsSorted(), _ = t.column.getCanSort() ? C === "asc" ? "ascending" : C === "desc" ? "descending" : "none" : void 0, s = t.column.columnDef.meta, ee = (s == null ? void 0 : s.label) ?? (typeof t.column.columnDef.header == "string" ? t.column.columnDef.header : void 0), I = W == null ? void 0 : W(t.column.id), K = t.column.getSize(), ie = t.column.id === Re || t.column.id === We || t.column.id === je, te = X && c && !ie, p = te ? mn(t.column.id) : void 0, wn = te && ut === t.column.id, vn = te && gt === t.column.id && ut !== t.column.id, Ve = te && mt === t.column.id;
|
|
699
|
+
return /* @__PURE__ */ r(
|
|
682
700
|
"th",
|
|
683
701
|
{
|
|
684
702
|
colSpan: t.colSpan,
|
|
685
703
|
rowSpan: f > 1 ? f : void 0,
|
|
686
|
-
draggable:
|
|
687
|
-
onDragStart:
|
|
688
|
-
onDragOver:
|
|
689
|
-
onDragLeave:
|
|
690
|
-
onDragEnd:
|
|
691
|
-
onDrop:
|
|
704
|
+
draggable: te || void 0,
|
|
705
|
+
onDragStart: p == null ? void 0 : p.onDragStart,
|
|
706
|
+
onDragOver: p == null ? void 0 : p.onDragOver,
|
|
707
|
+
onDragLeave: p == null ? void 0 : p.onDragLeave,
|
|
708
|
+
onDragEnd: p == null ? void 0 : p.onDragEnd,
|
|
709
|
+
onDrop: p == null ? void 0 : p.onDrop,
|
|
692
710
|
className: k(
|
|
693
711
|
l["tedi-table__header-cell"],
|
|
694
712
|
{
|
|
695
713
|
[l["tedi-table__header-cell--group"]]: o,
|
|
696
|
-
[l["tedi-table__header-cell--dragging"]]:
|
|
697
|
-
[l["tedi-table__header-cell--drag-over"]]:
|
|
714
|
+
[l["tedi-table__header-cell--dragging"]]: wn,
|
|
715
|
+
[l["tedi-table__header-cell--drag-over"]]: vn,
|
|
698
716
|
[l["tedi-table__header-cell--picked-up"]]: Ve,
|
|
699
717
|
[l[`tedi-table__cell--align-${s == null ? void 0 : s.align}`]]: s == null ? void 0 : s.align,
|
|
700
718
|
[l[`tedi-table__cell--valign-${s == null ? void 0 : s.vAlign}`]]: s == null ? void 0 : s.vAlign
|
|
@@ -702,30 +720,30 @@ function Ct(R) {
|
|
|
702
720
|
I == null ? void 0 : I.className
|
|
703
721
|
),
|
|
704
722
|
scope: "col",
|
|
705
|
-
"aria-sort":
|
|
706
|
-
"aria-label":
|
|
707
|
-
style:
|
|
708
|
-
children:
|
|
709
|
-
/* @__PURE__ */
|
|
723
|
+
"aria-sort": _,
|
|
724
|
+
"aria-label": ee ?? (i ? void 0 : t.column.id),
|
|
725
|
+
style: K || I != null && I.style ? { ...K ? { width: K } : null, ...I == null ? void 0 : I.style } : void 0,
|
|
726
|
+
children: te && p ? /* @__PURE__ */ re("span", { className: l["tedi-table__header-cell-inner"], children: [
|
|
727
|
+
/* @__PURE__ */ r(
|
|
710
728
|
"button",
|
|
711
729
|
{
|
|
712
730
|
type: "button",
|
|
713
|
-
id:
|
|
731
|
+
id: pn(t.column.id),
|
|
714
732
|
className: k(l["tedi-table__drag-handle"], {
|
|
715
733
|
[l["tedi-table__drag-handle--picked-up"]]: Ve
|
|
716
734
|
}),
|
|
717
|
-
"aria-label": b("table.drag-column",
|
|
735
|
+
"aria-label": b("table.drag-column", ee ?? t.column.id),
|
|
718
736
|
"aria-pressed": Ve,
|
|
719
737
|
onClick: (Ge) => Ge.stopPropagation(),
|
|
720
|
-
onMouseDown:
|
|
721
|
-
onTouchStart:
|
|
722
|
-
onKeyDown: (Ge) =>
|
|
723
|
-
[
|
|
724
|
-
children: /* @__PURE__ */
|
|
738
|
+
onMouseDown: p.onHandlePointerDown,
|
|
739
|
+
onTouchStart: p.onHandlePointerDown,
|
|
740
|
+
onKeyDown: (Ge) => bn(Ge, t.column.id),
|
|
741
|
+
[xt]: "",
|
|
742
|
+
children: /* @__PURE__ */ r(_t, { name: "drag_indicator", size: 18, color: "inherit" })
|
|
725
743
|
}
|
|
726
744
|
),
|
|
727
|
-
|
|
728
|
-
] }) :
|
|
745
|
+
De(t.column.columnDef.header, t.getContext())
|
|
746
|
+
] }) : De(t.column.columnDef.header, t.getContext())
|
|
729
747
|
},
|
|
730
748
|
t.id
|
|
731
749
|
);
|
|
@@ -733,21 +751,21 @@ function Ct(R) {
|
|
|
733
751
|
},
|
|
734
752
|
e.id
|
|
735
753
|
)),
|
|
736
|
-
|
|
754
|
+
Ne && /* @__PURE__ */ r(
|
|
737
755
|
"tr",
|
|
738
756
|
{
|
|
739
757
|
className: k(l["tedi-table__row"], l["tedi-table__row--filter"]),
|
|
740
|
-
"aria-rowindex": y ?
|
|
741
|
-
children:
|
|
742
|
-
const n = e.columnDef.meta, t = (n == null ? void 0 : n.label) ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id), o = `${
|
|
743
|
-
return /* @__PURE__ */
|
|
758
|
+
"aria-rowindex": y ? we.length + 1 : void 0,
|
|
759
|
+
children: at.map((e) => {
|
|
760
|
+
const n = e.columnDef.meta, t = (n == null ? void 0 : n.label) ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id), o = `${m}-filter-${e.id}`, a = W == null ? void 0 : W(e.id);
|
|
761
|
+
return /* @__PURE__ */ r(
|
|
744
762
|
"th",
|
|
745
763
|
{
|
|
746
764
|
className: k(l["tedi-table__header-cell"], a == null ? void 0 : a.className),
|
|
747
765
|
style: a == null ? void 0 : a.style,
|
|
748
766
|
scope: "col",
|
|
749
|
-
children: e.getCanFilter() && /* @__PURE__ */
|
|
750
|
-
|
|
767
|
+
children: e.getCanFilter() && /* @__PURE__ */ r(
|
|
768
|
+
Rn,
|
|
751
769
|
{
|
|
752
770
|
size: "small",
|
|
753
771
|
placeholder: b("table.filter-placeholder"),
|
|
@@ -757,7 +775,7 @@ function Ct(R) {
|
|
|
757
775
|
label: b("table.filter-input", t),
|
|
758
776
|
hideLabel: !0,
|
|
759
777
|
value: e.getFilterValue() ?? "",
|
|
760
|
-
onChange: (
|
|
778
|
+
onChange: (i) => e.setFilterValue(i || void 0)
|
|
761
779
|
}
|
|
762
780
|
)
|
|
763
781
|
},
|
|
@@ -767,62 +785,62 @@ function Ct(R) {
|
|
|
767
785
|
}
|
|
768
786
|
)
|
|
769
787
|
] }),
|
|
770
|
-
/* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ r("tbody", { className: l["tedi-table__body"], children: v.length === 0 ? /* @__PURE__ */ r("tr", { className: l["tedi-table__row"], children: /* @__PURE__ */ r(
|
|
771
789
|
"td",
|
|
772
790
|
{
|
|
773
|
-
colSpan: Math.max(1,
|
|
791
|
+
colSpan: Math.max(1, ve),
|
|
774
792
|
className: k(l["tedi-table__cell"], l["tedi-table__cell--placeholder"]),
|
|
775
|
-
children:
|
|
793
|
+
children: ce ? /* @__PURE__ */ r("div", { role: ce, children: et }) : et
|
|
776
794
|
}
|
|
777
|
-
) }) :
|
|
778
|
-
const t =
|
|
795
|
+
) }) : v.map((e, n) => {
|
|
796
|
+
const t = it(e), o = oe !== void 0 && e.id === oe, a = Ae == null ? void 0 : Ae(e), i = k(
|
|
779
797
|
l["tedi-table__row"],
|
|
780
798
|
{
|
|
781
|
-
[l["tedi-table__row--selected"]]:
|
|
799
|
+
[l["tedi-table__row--selected"]]: Rt && e.getIsSelected(),
|
|
782
800
|
[l["tedi-table__row--active"]]: o,
|
|
783
801
|
[l["tedi-table__row--clickable"]]: t,
|
|
784
802
|
[l["tedi-table__row--sub-row"]]: e.depth > 0
|
|
785
803
|
},
|
|
786
804
|
a == null ? void 0 : a.className
|
|
787
|
-
), c = y ?
|
|
805
|
+
), c = y ? st + an + n + 1 : void 0, f = `${m}-sub-${e.id}`, C = S && ct === e.id, _ = S && dn === e.id && ct !== e.id, s = S && pt === e.original, ee = {
|
|
788
806
|
row: e,
|
|
789
|
-
rowClassName: k(
|
|
790
|
-
[l["tedi-table__row--dragging"]]:
|
|
791
|
-
[l["tedi-table__row--drag-over"]]:
|
|
807
|
+
rowClassName: k(i, {
|
|
808
|
+
[l["tedi-table__row--dragging"]]: C,
|
|
809
|
+
[l["tedi-table__row--drag-over"]]: _,
|
|
792
810
|
[l["tedi-table__row--picked-up"]]: s
|
|
793
811
|
}),
|
|
794
812
|
rowStyle: a == null ? void 0 : a.style,
|
|
795
813
|
isActiveRow: o,
|
|
796
814
|
clickable: t,
|
|
797
|
-
onClick:
|
|
798
|
-
onKeyDownHandler:
|
|
815
|
+
onClick: rt,
|
|
816
|
+
onKeyDownHandler: ln(e),
|
|
799
817
|
ariaRowIndex: c,
|
|
800
818
|
columnProps: W,
|
|
801
819
|
draggable: S,
|
|
802
820
|
dragHandleLabel: b("table.drag-row"),
|
|
803
|
-
dragHandlers: S ? { ...
|
|
804
|
-
dragHandleId: S ?
|
|
821
|
+
dragHandlers: S ? { ...gn(e.id), onKeyDown: (I) => hn(I, e) } : void 0,
|
|
822
|
+
dragHandleId: S ? fn(e.id) : void 0,
|
|
805
823
|
dragHandlePickedUp: s,
|
|
806
|
-
dragOverColumnId:
|
|
824
|
+
dragOverColumnId: X ? gt : null
|
|
807
825
|
};
|
|
808
|
-
return /* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
-
|
|
826
|
+
return /* @__PURE__ */ re(xn, { children: [
|
|
827
|
+
/* @__PURE__ */ r(Bn, { ...ee }),
|
|
828
|
+
j && e.getIsExpanded() && /* @__PURE__ */ r("tr", { className: k(l["tedi-table__row"], l["tedi-table__row--sub-component"]), children: /* @__PURE__ */ r(
|
|
811
829
|
"td",
|
|
812
830
|
{
|
|
813
831
|
id: f,
|
|
814
832
|
role: "region",
|
|
815
833
|
"aria-label": b("table.row-details"),
|
|
816
|
-
colSpan: Math.max(1,
|
|
834
|
+
colSpan: Math.max(1, ve),
|
|
817
835
|
className: k(l["tedi-table__cell"], l["tedi-table__cell--sub-component"]),
|
|
818
|
-
children:
|
|
836
|
+
children: j(e)
|
|
819
837
|
}
|
|
820
838
|
) })
|
|
821
839
|
] }, e.id);
|
|
822
840
|
}) }),
|
|
823
|
-
|
|
841
|
+
on && /* @__PURE__ */ r("tfoot", { className: l["tedi-table__foot"], children: lt.map((e) => /* @__PURE__ */ r("tr", { className: l["tedi-table__row"], children: e.headers.map((n) => {
|
|
824
842
|
const t = n.column.columnDef.meta;
|
|
825
|
-
return /* @__PURE__ */
|
|
843
|
+
return /* @__PURE__ */ r(
|
|
826
844
|
"td",
|
|
827
845
|
{
|
|
828
846
|
colSpan: n.colSpan,
|
|
@@ -830,7 +848,7 @@ function Ct(R) {
|
|
|
830
848
|
[l[`tedi-table__cell--align-${t == null ? void 0 : t.align}`]]: t == null ? void 0 : t.align,
|
|
831
849
|
[l[`tedi-table__cell--valign-${t == null ? void 0 : t.vAlign}`]]: t == null ? void 0 : t.vAlign
|
|
832
850
|
}),
|
|
833
|
-
children: n.isPlaceholder ? null :
|
|
851
|
+
children: n.isPlaceholder ? null : De(n.column.columnDef.footer, n.getContext())
|
|
834
852
|
},
|
|
835
853
|
n.id
|
|
836
854
|
);
|
|
@@ -840,28 +858,28 @@ function Ct(R) {
|
|
|
840
858
|
)
|
|
841
859
|
}
|
|
842
860
|
),
|
|
843
|
-
y && /* @__PURE__ */
|
|
844
|
-
|
|
861
|
+
y && /* @__PURE__ */ r("div", { className: l["tedi-table__pagination"], children: /* @__PURE__ */ r(
|
|
862
|
+
Fn,
|
|
845
863
|
{
|
|
846
864
|
...h == null ? void 0 : h.paginationProps,
|
|
847
865
|
pageCount: Math.max(1, d.getPageCount()),
|
|
848
866
|
page: d.getState().pagination.pageIndex + 1,
|
|
849
|
-
onPageChange:
|
|
850
|
-
totalItems:
|
|
867
|
+
onPageChange: Qt,
|
|
868
|
+
totalItems: pe ?? d.getFilteredRowModel().rows.length,
|
|
851
869
|
pageSize: d.getState().pagination.pageSize,
|
|
852
|
-
pageSizeOptions:
|
|
853
|
-
onPageSizeChange:
|
|
870
|
+
pageSizeOptions: Tt,
|
|
871
|
+
onPageSizeChange: Zt
|
|
854
872
|
}
|
|
855
873
|
) })
|
|
856
874
|
] }) });
|
|
857
875
|
}
|
|
858
|
-
|
|
859
|
-
const
|
|
860
|
-
Toolbar:
|
|
861
|
-
ColumnsMenu:
|
|
862
|
-
HeaderButton:
|
|
876
|
+
St.displayName = "Table";
|
|
877
|
+
const ro = Object.assign(St, {
|
|
878
|
+
Toolbar: En,
|
|
879
|
+
ColumnsMenu: yn,
|
|
880
|
+
HeaderButton: kn
|
|
863
881
|
});
|
|
864
882
|
export {
|
|
865
|
-
|
|
866
|
-
|
|
883
|
+
ro as Table,
|
|
884
|
+
io as groupRowSpan
|
|
867
885
|
};
|