@reportportal/ui-kit 0.0.1-alpha.147 → 0.0.1-alpha.148
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/components/table/utils.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/table-f1461100.js +595 -0
- package/dist/table.js +1 -1
- package/package.json +1 -1
- package/dist/table-b4364f2c.js +0 -588
|
@@ -9,4 +9,4 @@ export declare const isPrimaryColumn: (column: PrimaryColumn | FixedColumn) => b
|
|
|
9
9
|
export declare const getRowSizeClassName: (rowData: RowData) => string;
|
|
10
10
|
export declare const calculatePinnedPosition: (columnIndex: number, columns: (PrimaryColumn | FixedColumn)[], columnWidthsRef: MutableRefObject<Map<string, number>>, isRowsExpandable: boolean, selectable: boolean) => number;
|
|
11
11
|
export declare const getCellStyle: (column: FixedColumn | PrimaryColumn, isPinned: boolean, pinnedIndex: number | undefined, pinnedColumns: (PrimaryColumn | FixedColumn)[], columnWidthsRef: MutableRefObject<Map<string, number>>, isRowsExpandable: boolean, selectable: boolean) => CSSProperties;
|
|
12
|
-
export declare const getGridTemplateColumns: (pinnedColumns: (PrimaryColumn | FixedColumn)[], scrollableColumns: (PrimaryColumn | FixedColumn)[], isRowsExpandable: boolean, selectable: boolean, renderRowActions: boolean, isHeader?: boolean, columnWidths?: Record<string, number
|
|
12
|
+
export declare const getGridTemplateColumns: (pinnedColumns: (PrimaryColumn | FixedColumn)[], scrollableColumns: (PrimaryColumn | FixedColumn)[], isRowsExpandable: boolean, selectable: boolean, renderRowActions: boolean, isHeader?: boolean, columnWidths?: Record<string, number>, isResizable?: boolean) => string;
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { S as so } from "./spinLoader-c4a53718.js";
|
|
|
24
24
|
import { SystemAlert as lo } from "./systemAlert.js";
|
|
25
25
|
import { S as fo } from "./systemMessage-924fdaa6.js";
|
|
26
26
|
import { DragLayer as So, SortableItem as Po, SortableList as Co } from "./sortable.js";
|
|
27
|
-
import { T as Fo } from "./table-
|
|
27
|
+
import { T as Fo } from "./table-f1461100.js";
|
|
28
28
|
import { T as bo } from "./themeProvider-46c2be7b.js";
|
|
29
29
|
import { T as To } from "./toggle-304107fa.js";
|
|
30
30
|
import { Tooltip as Bo } from "./tooltip.js";
|
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import { jsx as o, jsxs as z } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as se, useState as $, useCallback as x, useEffect as re, useRef as oe, forwardRef as We } from "react";
|
|
3
|
+
import { Resizable as De } from "react-resizable";
|
|
4
|
+
import { c as ce } from "./bind-06a7ff84.js";
|
|
5
|
+
import { c as Oe, b as ee, a as le, S as Ue } from "./resizeColumn-d4107941.js";
|
|
6
|
+
import { C as te } from "./checkbox-ed6cc375.js";
|
|
7
|
+
import { Tooltip as je } from "./tooltip.js";
|
|
8
|
+
const ie = (l) => typeof l == "string", He = "_table_1244e_1", Be = "_resizable_1244e_46", Ge = "_selectable_1244e_63", Xe = "_expanded_1244e_59", Ye = "_label_1244e_303", qe = {
|
|
9
|
+
table: He,
|
|
10
|
+
"fixed-header": "_fixed-header_1244e_8",
|
|
11
|
+
"horizontally-scrollable-container": "_horizontally-scrollable-container_1244e_14",
|
|
12
|
+
"table-header": "_table-header_1244e_19",
|
|
13
|
+
"sticky-header": "_sticky-header_1244e_26",
|
|
14
|
+
"horizontally-scrollable": "_horizontally-scrollable_1244e_14",
|
|
15
|
+
resizable: Be,
|
|
16
|
+
"resizable-column": "_resizable-column_1244e_46",
|
|
17
|
+
"table-row": "_table-row_1244e_54",
|
|
18
|
+
"expanded-cell": "_expanded-cell_1244e_59",
|
|
19
|
+
selectable: Ge,
|
|
20
|
+
"row-content-wrapper": "_row-content-wrapper_1244e_67",
|
|
21
|
+
"table-row-content": "_table-row-content_1244e_75",
|
|
22
|
+
"expand-cell": "_expand-cell_1244e_89",
|
|
23
|
+
"size-small": "_size-small_1244e_92",
|
|
24
|
+
"size-large": "_size-large_1244e_103",
|
|
25
|
+
"table-body": "_table-body_1244e_115",
|
|
26
|
+
"scrollable-body": "_scrollable-body_1244e_121",
|
|
27
|
+
"table-header-cell": "_table-header-cell_1244e_181",
|
|
28
|
+
"table-cell": "_table-cell_1244e_182",
|
|
29
|
+
"action-menu-cell": "_action-menu-cell_1244e_188",
|
|
30
|
+
"checkbox-cell": "_checkbox-cell_1244e_213",
|
|
31
|
+
"expand-all-tooltip-wrapper": "_expand-all-tooltip-wrapper_1244e_255",
|
|
32
|
+
"expand-all-tooltip-content": "_expand-all-tooltip-content_1244e_264",
|
|
33
|
+
"expand-icon": "_expand-icon_1244e_273",
|
|
34
|
+
expanded: Xe,
|
|
35
|
+
"primary-cell": "_primary-cell_1244e_282",
|
|
36
|
+
label: Ye,
|
|
37
|
+
"sortable-cell": "_sortable-cell_1244e_317",
|
|
38
|
+
"align-right": "_align-right_1244e_320",
|
|
39
|
+
"align-center": "_align-center_1244e_326",
|
|
40
|
+
"pinned-column": "_pinned-column_1244e_329"
|
|
41
|
+
}, de = "asc", S = 32, he = 100, Je = 48, Qe = (l) => l.toLowerCase() === de, Ve = (l) => l.map((n) => n.key), N = (l) => "primary" in l && l.primary === !0, Ze = (l) => {
|
|
42
|
+
var s;
|
|
43
|
+
return `size-${((s = l.rowConfigs) == null ? void 0 : s.size) ?? "default"}`;
|
|
44
|
+
}, j = (l) => ie(l) ? l : `${l}px`, Ke = (l, n, s, c, i) => {
|
|
45
|
+
let a = 0;
|
|
46
|
+
c && (a += S), i && (a += S);
|
|
47
|
+
for (let p = 0; p < l; p++) {
|
|
48
|
+
const u = n[p];
|
|
49
|
+
if (N(u)) {
|
|
50
|
+
const t = s.current.get(u.key) || he;
|
|
51
|
+
a += t;
|
|
52
|
+
} else {
|
|
53
|
+
const t = u, h = ie(t.width) ? parseInt(t.width, 10) || 0 : t.width;
|
|
54
|
+
a += h;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return a;
|
|
58
|
+
}, W = (l, n, s, c, i, a, p) => {
|
|
59
|
+
const u = {};
|
|
60
|
+
if (!N(l)) {
|
|
61
|
+
const t = l;
|
|
62
|
+
u.textAlign = t.align;
|
|
63
|
+
}
|
|
64
|
+
if (n && s !== void 0) {
|
|
65
|
+
const t = Ke(
|
|
66
|
+
s,
|
|
67
|
+
c,
|
|
68
|
+
i,
|
|
69
|
+
a,
|
|
70
|
+
p
|
|
71
|
+
);
|
|
72
|
+
u.left = `${t}px`;
|
|
73
|
+
}
|
|
74
|
+
return u;
|
|
75
|
+
}, ne = (l, n, s, c, i, a = !1, p, u = !1) => {
|
|
76
|
+
const t = [];
|
|
77
|
+
s && t.push(`${S}px`), a && c && t.push(`${S}px`);
|
|
78
|
+
const h = (r) => {
|
|
79
|
+
if ((p == null ? void 0 : p[r.key]) !== void 0) {
|
|
80
|
+
t.push(`${p[r.key]}px`);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (N(r)) {
|
|
84
|
+
const f = r;
|
|
85
|
+
if (u && f.width) {
|
|
86
|
+
t.push(j(f.width));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const y = f.width ? j(f.width) : `${he}px`;
|
|
90
|
+
t.push(`minmax(${y}, 1fr)`);
|
|
91
|
+
} else {
|
|
92
|
+
const y = j(r.width);
|
|
93
|
+
t.push(y);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return l.forEach(h), n.forEach(h), i && t.push(`${Je}px`), t.join(" ");
|
|
97
|
+
}, Fe = ({
|
|
98
|
+
primaryColumns: l,
|
|
99
|
+
fixedColumns: n,
|
|
100
|
+
pinnedColumnKeys: s
|
|
101
|
+
}) => se(() => {
|
|
102
|
+
const c = [], i = [];
|
|
103
|
+
return l.forEach((a) => {
|
|
104
|
+
const p = { ...a, primary: !0 };
|
|
105
|
+
s.includes(a.key) ? c.push(p) : i.push(p);
|
|
106
|
+
}), n.forEach((a) => {
|
|
107
|
+
s.includes(a.key) ? c.push(a) : i.push(a);
|
|
108
|
+
}), {
|
|
109
|
+
pinnedColumns: c,
|
|
110
|
+
scrollableColumns: i
|
|
111
|
+
};
|
|
112
|
+
}, [l, n, s]), Re = () => {
|
|
113
|
+
const [l, n] = $(null), [s, c] = $(null), i = x((t) => {
|
|
114
|
+
n(t);
|
|
115
|
+
}, []), a = x(() => {
|
|
116
|
+
n(null);
|
|
117
|
+
}, []), p = x((t) => {
|
|
118
|
+
c(t);
|
|
119
|
+
}, []), u = x(() => {
|
|
120
|
+
c(null);
|
|
121
|
+
}, []);
|
|
122
|
+
return {
|
|
123
|
+
hoveredColumn: l,
|
|
124
|
+
hoveredRow: s,
|
|
125
|
+
handleColumnMouseEnter: i,
|
|
126
|
+
handleColumnMouseLeave: a,
|
|
127
|
+
handleRowMouseEnter: p,
|
|
128
|
+
handleRowMouseLeave: u
|
|
129
|
+
};
|
|
130
|
+
}, Ie = ({
|
|
131
|
+
primaryColumns: l,
|
|
132
|
+
fixedColumns: n,
|
|
133
|
+
expandedRowIds: s,
|
|
134
|
+
onToggleRowExpansion: c
|
|
135
|
+
}) => {
|
|
136
|
+
const [i, a] = $(/* @__PURE__ */ new Set());
|
|
137
|
+
re(() => {
|
|
138
|
+
const t = [
|
|
139
|
+
...l.map((r) => r.key),
|
|
140
|
+
...n.map((r) => r.key)
|
|
141
|
+
], h = /* @__PURE__ */ new Set();
|
|
142
|
+
s.forEach((r) => {
|
|
143
|
+
t.forEach((f) => {
|
|
144
|
+
h.add(`${r}-${f}`);
|
|
145
|
+
});
|
|
146
|
+
}), a((r) => {
|
|
147
|
+
if (r.size === h.size) {
|
|
148
|
+
let f = !0;
|
|
149
|
+
if (r.forEach((y) => {
|
|
150
|
+
h.has(y) || (f = !1);
|
|
151
|
+
}), f)
|
|
152
|
+
return r;
|
|
153
|
+
}
|
|
154
|
+
return h;
|
|
155
|
+
});
|
|
156
|
+
}, [s, l, n]);
|
|
157
|
+
const p = x(
|
|
158
|
+
(t) => {
|
|
159
|
+
const h = new Set(i), r = s.includes(t), f = [
|
|
160
|
+
...l.map((y) => y.key),
|
|
161
|
+
...n.map((y) => y.key)
|
|
162
|
+
];
|
|
163
|
+
r ? f.forEach((y) => {
|
|
164
|
+
const k = `${t}-${y}`;
|
|
165
|
+
h.delete(k);
|
|
166
|
+
}) : f.forEach((y) => {
|
|
167
|
+
const k = `${t}-${y}`;
|
|
168
|
+
h.add(k);
|
|
169
|
+
}), a(h), c(t);
|
|
170
|
+
},
|
|
171
|
+
[i, s, l, n, c]
|
|
172
|
+
), u = x(
|
|
173
|
+
(t, h) => {
|
|
174
|
+
const r = `${t}-${h}`;
|
|
175
|
+
return i.has(r);
|
|
176
|
+
},
|
|
177
|
+
[i]
|
|
178
|
+
);
|
|
179
|
+
return {
|
|
180
|
+
expandedCells: i,
|
|
181
|
+
handleToggleRowExpansion: p,
|
|
182
|
+
isCellExpanded: u
|
|
183
|
+
};
|
|
184
|
+
}, el = () => {
|
|
185
|
+
const l = oe(/* @__PURE__ */ new Map()), n = x(
|
|
186
|
+
(s) => (c) => {
|
|
187
|
+
if (!c)
|
|
188
|
+
return;
|
|
189
|
+
const i = c.getBoundingClientRect().width;
|
|
190
|
+
i > 0 && l.current.set(s, i);
|
|
191
|
+
},
|
|
192
|
+
[]
|
|
193
|
+
);
|
|
194
|
+
return {
|
|
195
|
+
columnWidthsRef: l,
|
|
196
|
+
setCellRef: n
|
|
197
|
+
};
|
|
198
|
+
}, ll = ({
|
|
199
|
+
enabled: l = !1,
|
|
200
|
+
minWidth: n = 50,
|
|
201
|
+
maxWidth: s = 500,
|
|
202
|
+
columnWidthsRef: c,
|
|
203
|
+
onColumnResize: i
|
|
204
|
+
}) => {
|
|
205
|
+
const [a, p] = $({}), u = x(() => {
|
|
206
|
+
if (!l || Object.keys(a).length > 0 || !c)
|
|
207
|
+
return;
|
|
208
|
+
const r = {};
|
|
209
|
+
c.current.forEach((f, y) => {
|
|
210
|
+
r[y] = f;
|
|
211
|
+
}), p(r);
|
|
212
|
+
}, [l, a, c]), t = x(
|
|
213
|
+
(r) => (f, { size: y }) => {
|
|
214
|
+
if (!l)
|
|
215
|
+
return;
|
|
216
|
+
const k = Math.min(s, Math.max(n, y.width));
|
|
217
|
+
p((m) => ({ ...m, [r]: k }));
|
|
218
|
+
},
|
|
219
|
+
[l, n, s]
|
|
220
|
+
), h = x(
|
|
221
|
+
(r) => () => {
|
|
222
|
+
!l || !a[r] || i == null || i(r, a[r]);
|
|
223
|
+
},
|
|
224
|
+
[l, a, i]
|
|
225
|
+
);
|
|
226
|
+
return {
|
|
227
|
+
columnWidths: a,
|
|
228
|
+
handleResize: t,
|
|
229
|
+
handleResizeStop: h,
|
|
230
|
+
handleResizeStart: u
|
|
231
|
+
};
|
|
232
|
+
}, tl = {
|
|
233
|
+
"resize-handle": "_resize-handle_15uk3_1"
|
|
234
|
+
}, nl = ce.bind(tl), al = We(
|
|
235
|
+
(l, n) => /* @__PURE__ */ o("div", { ref: n, className: nl("resize-handle"), ...l, children: /* @__PURE__ */ o(Oe, {}) })
|
|
236
|
+
), d = ce.bind(qe), ae = ({ column: l }) => {
|
|
237
|
+
const n = oe(null), [s, c] = $(!1);
|
|
238
|
+
return re(() => {
|
|
239
|
+
if (n.current) {
|
|
240
|
+
const i = n.current.offsetWidth, a = n.current.scrollWidth;
|
|
241
|
+
c(a > i);
|
|
242
|
+
}
|
|
243
|
+
}, [l.header]), /* @__PURE__ */ o("span", { ref: n, title: s ? l.header : void 0, children: l.header });
|
|
244
|
+
}, pl = ({
|
|
245
|
+
data: l,
|
|
246
|
+
primaryColumn: n,
|
|
247
|
+
fixedColumns: s,
|
|
248
|
+
renderRowActions: c,
|
|
249
|
+
className: i = "",
|
|
250
|
+
rowClassName: a = "",
|
|
251
|
+
headerClassName: p = "",
|
|
252
|
+
bodyClassName: u = "",
|
|
253
|
+
selectable: t = !1,
|
|
254
|
+
selectedRowIds: h = [],
|
|
255
|
+
sortingDirection: r = de,
|
|
256
|
+
sortingColumn: f,
|
|
257
|
+
sortableColumns: y,
|
|
258
|
+
isHeaderFixed: k = !1,
|
|
259
|
+
isHorizontallyScrollable: m = !1,
|
|
260
|
+
pinnedColumnKeys: pe = [],
|
|
261
|
+
isRowsExpandable: v = !1,
|
|
262
|
+
expandedRowIds: E = [],
|
|
263
|
+
isAllExpandedByDefault: H,
|
|
264
|
+
expandAllTooltip: B,
|
|
265
|
+
isResizable: b = !1,
|
|
266
|
+
minColumnWidth: D = 50,
|
|
267
|
+
maxColumnWidth: G = 500,
|
|
268
|
+
onChangeSorting: _e = () => {
|
|
269
|
+
},
|
|
270
|
+
onToggleRowSelection: ye = () => {
|
|
271
|
+
},
|
|
272
|
+
onToggleAllRowsSelection: fe = () => {
|
|
273
|
+
},
|
|
274
|
+
onToggleRowExpansion: ue = () => {
|
|
275
|
+
},
|
|
276
|
+
onToggleAllRowsExpansion: be = () => {
|
|
277
|
+
},
|
|
278
|
+
onColumnResize: ke = () => {
|
|
279
|
+
}
|
|
280
|
+
}) => {
|
|
281
|
+
const T = se(
|
|
282
|
+
() => Array.isArray(n) ? n : [n],
|
|
283
|
+
[n]
|
|
284
|
+
), w = f ?? T[0], A = y ?? Ve([...T, ...s]), { pinnedColumns: g, scrollableColumns: L } = Fe({
|
|
285
|
+
primaryColumns: T,
|
|
286
|
+
fixedColumns: s,
|
|
287
|
+
pinnedColumnKeys: pe
|
|
288
|
+
}), {
|
|
289
|
+
hoveredColumn: X,
|
|
290
|
+
hoveredRow: ve,
|
|
291
|
+
handleColumnMouseEnter: Y,
|
|
292
|
+
handleColumnMouseLeave: q,
|
|
293
|
+
handleRowMouseEnter: xe,
|
|
294
|
+
handleRowMouseLeave: we
|
|
295
|
+
} = Re(), { columnWidthsRef: M, setCellRef: J } = el(), { handleToggleRowExpansion: Ce, isCellExpanded: Q } = Ie({
|
|
296
|
+
primaryColumns: T,
|
|
297
|
+
fixedColumns: s,
|
|
298
|
+
expandedRowIds: E,
|
|
299
|
+
onToggleRowExpansion: ue
|
|
300
|
+
}), { columnWidths: O, handleResize: ge, handleResizeStop: Ne, handleResizeStart: ze } = ll({
|
|
301
|
+
enabled: b,
|
|
302
|
+
minWidth: D,
|
|
303
|
+
maxWidth: G,
|
|
304
|
+
columnWidthsRef: M,
|
|
305
|
+
onColumnResize: ke
|
|
306
|
+
}), V = (e, C) => /* @__PURE__ */ o(
|
|
307
|
+
De,
|
|
308
|
+
{
|
|
309
|
+
width: O[e.key] ?? (typeof e.width == "number" ? e.width : D),
|
|
310
|
+
height: 0,
|
|
311
|
+
axis: "x",
|
|
312
|
+
handle: /* @__PURE__ */ o(al, {}),
|
|
313
|
+
onResizeStart: ze,
|
|
314
|
+
onResize: ge(e.key),
|
|
315
|
+
onResizeStop: Ne(e.key),
|
|
316
|
+
minConstraints: [D, 0],
|
|
317
|
+
maxConstraints: [G, 0],
|
|
318
|
+
className: d("resizable-column"),
|
|
319
|
+
children: C
|
|
320
|
+
},
|
|
321
|
+
e.key
|
|
322
|
+
), Z = (e) => {
|
|
323
|
+
A.includes(e) && _e({ key: e, direction: r });
|
|
324
|
+
}, Se = (e) => {
|
|
325
|
+
ye(e);
|
|
326
|
+
}, me = () => {
|
|
327
|
+
fe();
|
|
328
|
+
}, Ee = () => {
|
|
329
|
+
be();
|
|
330
|
+
}, K = (e) => A.includes(e) ? (w == null ? void 0 : w.key) === e ? Qe(r) ? /* @__PURE__ */ o(le, {}) : /* @__PURE__ */ o(Ue, {}) : /* @__PURE__ */ o(le, {}) : null, Me = l.every((e) => h.includes(e.id)), $e = l.some((e) => h.includes(e.id)), F = (h == null ? void 0 : h.length) > 0, Te = l.every((e) => E.includes(e.id)), Ae = H !== void 0 ? H : Te, Le = ne(
|
|
331
|
+
g,
|
|
332
|
+
L,
|
|
333
|
+
v,
|
|
334
|
+
t,
|
|
335
|
+
!!c,
|
|
336
|
+
!1,
|
|
337
|
+
b ? O : void 0,
|
|
338
|
+
b
|
|
339
|
+
), Pe = ne(
|
|
340
|
+
g,
|
|
341
|
+
L,
|
|
342
|
+
v,
|
|
343
|
+
t,
|
|
344
|
+
!!c,
|
|
345
|
+
!0,
|
|
346
|
+
b ? O : void 0,
|
|
347
|
+
b
|
|
348
|
+
), R = /* @__PURE__ */ o("button", { onClick: Ee, "aria-label": "Toggle all rows expansion", children: /* @__PURE__ */ o("span", { className: d("expand-icon", { expanded: Ae }), children: /* @__PURE__ */ o(ee, {}) }) });
|
|
349
|
+
return /* @__PURE__ */ z(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
className: d(
|
|
353
|
+
"table",
|
|
354
|
+
{
|
|
355
|
+
"fixed-header": k,
|
|
356
|
+
"horizontally-scrollable-container": k && (m || b)
|
|
357
|
+
},
|
|
358
|
+
i
|
|
359
|
+
),
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ z(
|
|
362
|
+
"div",
|
|
363
|
+
{
|
|
364
|
+
className: d(
|
|
365
|
+
"table-header",
|
|
366
|
+
{
|
|
367
|
+
"sticky-header": k,
|
|
368
|
+
"horizontally-scrollable": m,
|
|
369
|
+
resizable: b
|
|
370
|
+
},
|
|
371
|
+
p
|
|
372
|
+
),
|
|
373
|
+
style: { gridTemplateColumns: Pe },
|
|
374
|
+
children: [
|
|
375
|
+
t && /* @__PURE__ */ o(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
className: d("table-header-cell", "checkbox-cell"),
|
|
379
|
+
style: { left: v ? `${S}px` : "0" },
|
|
380
|
+
children: F && /* @__PURE__ */ o(
|
|
381
|
+
te,
|
|
382
|
+
{
|
|
383
|
+
value: Me,
|
|
384
|
+
partiallyChecked: $e,
|
|
385
|
+
onChange: me,
|
|
386
|
+
className: d("checkbox-cell")
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
v && /* @__PURE__ */ o("div", { className: d("table-header-cell", "expand-cell"), style: { left: "0" }, children: B ? /* @__PURE__ */ o(
|
|
392
|
+
je,
|
|
393
|
+
{
|
|
394
|
+
content: B,
|
|
395
|
+
placement: "top",
|
|
396
|
+
wrapperClassName: d("expand-all-tooltip-wrapper"),
|
|
397
|
+
contentClassName: d("expand-all-tooltip-content"),
|
|
398
|
+
children: R
|
|
399
|
+
}
|
|
400
|
+
) : R }),
|
|
401
|
+
g.map((e, C) => {
|
|
402
|
+
const _ = /* @__PURE__ */ o(
|
|
403
|
+
"button",
|
|
404
|
+
{
|
|
405
|
+
className: d("table-header-cell", "pinned-column", {
|
|
406
|
+
[`align-${e.align}`]: "align" in e,
|
|
407
|
+
"primary-cell": N(e),
|
|
408
|
+
"sortable-cell": A.includes(e.key),
|
|
409
|
+
resizable: b
|
|
410
|
+
}),
|
|
411
|
+
style: W(
|
|
412
|
+
e,
|
|
413
|
+
!0,
|
|
414
|
+
C,
|
|
415
|
+
g,
|
|
416
|
+
M,
|
|
417
|
+
v,
|
|
418
|
+
t
|
|
419
|
+
),
|
|
420
|
+
children: /* @__PURE__ */ z(
|
|
421
|
+
"div",
|
|
422
|
+
{
|
|
423
|
+
className: d("label"),
|
|
424
|
+
onClick: () => Z(e.key),
|
|
425
|
+
onMouseEnter: () => Y(e.key),
|
|
426
|
+
onMouseLeave: q,
|
|
427
|
+
children: [
|
|
428
|
+
/* @__PURE__ */ o(ae, { column: e }),
|
|
429
|
+
(X === e.key || (w == null ? void 0 : w.key) === e.key) && K(e.key)
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
},
|
|
434
|
+
e.key
|
|
435
|
+
);
|
|
436
|
+
return b ? V(e, _) : _;
|
|
437
|
+
}),
|
|
438
|
+
L.map((e) => {
|
|
439
|
+
const C = /* @__PURE__ */ o(
|
|
440
|
+
"button",
|
|
441
|
+
{
|
|
442
|
+
className: d("table-header-cell", {
|
|
443
|
+
[`align-${e.align}`]: "align" in e,
|
|
444
|
+
"primary-cell": N(e),
|
|
445
|
+
"sortable-cell": A.includes(e.key),
|
|
446
|
+
resizable: b
|
|
447
|
+
}),
|
|
448
|
+
style: W(
|
|
449
|
+
e,
|
|
450
|
+
!1,
|
|
451
|
+
void 0,
|
|
452
|
+
g,
|
|
453
|
+
M,
|
|
454
|
+
v,
|
|
455
|
+
t
|
|
456
|
+
),
|
|
457
|
+
children: /* @__PURE__ */ z(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
className: d("label"),
|
|
461
|
+
onClick: () => Z(e.key),
|
|
462
|
+
onMouseEnter: () => Y(e.key),
|
|
463
|
+
onMouseLeave: q,
|
|
464
|
+
children: [
|
|
465
|
+
/* @__PURE__ */ o(ae, { column: e }),
|
|
466
|
+
(X === e.key || (w == null ? void 0 : w.key) === e.key) && K(e.key)
|
|
467
|
+
]
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
},
|
|
471
|
+
e.key
|
|
472
|
+
);
|
|
473
|
+
return b ? V(e, C) : C;
|
|
474
|
+
}),
|
|
475
|
+
c && /* @__PURE__ */ o("div", { className: d("table-header-cell", "action-menu-cell") })
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
),
|
|
479
|
+
/* @__PURE__ */ o(
|
|
480
|
+
"div",
|
|
481
|
+
{
|
|
482
|
+
className: d(
|
|
483
|
+
"table-body",
|
|
484
|
+
{
|
|
485
|
+
"scrollable-body": k,
|
|
486
|
+
"horizontally-scrollable": m,
|
|
487
|
+
resizable: b
|
|
488
|
+
},
|
|
489
|
+
u
|
|
490
|
+
),
|
|
491
|
+
children: l.map((e, C) => /* @__PURE__ */ z(
|
|
492
|
+
"div",
|
|
493
|
+
{
|
|
494
|
+
className: d("table-row", Ze(e), a, {
|
|
495
|
+
selectable: t
|
|
496
|
+
}),
|
|
497
|
+
onMouseEnter: () => xe(C),
|
|
498
|
+
onMouseLeave: we,
|
|
499
|
+
children: [
|
|
500
|
+
t && /* @__PURE__ */ o(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
className: d("table-cell", "checkbox-cell"),
|
|
504
|
+
style: { left: v ? `${S}px` : "0" },
|
|
505
|
+
children: (F || ve === C) && /* @__PURE__ */ o(
|
|
506
|
+
te,
|
|
507
|
+
{
|
|
508
|
+
value: h.includes(e.id),
|
|
509
|
+
onChange: () => Se(e.id),
|
|
510
|
+
className: d("checkbox-cell")
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
/* @__PURE__ */ o("div", { className: d("row-content-wrapper"), children: /* @__PURE__ */ z("div", { className: d("table-row-content"), style: { gridTemplateColumns: Le }, children: [
|
|
516
|
+
v && /* @__PURE__ */ o("div", { className: d("table-cell", "expand-cell"), style: { left: "0" }, children: /* @__PURE__ */ o(
|
|
517
|
+
"button",
|
|
518
|
+
{
|
|
519
|
+
onClick: () => Ce(e.id),
|
|
520
|
+
"aria-label": E.includes(e.id) ? "Collapse row" : "Expand row",
|
|
521
|
+
"aria-expanded": E.includes(e.id),
|
|
522
|
+
children: /* @__PURE__ */ o(
|
|
523
|
+
"span",
|
|
524
|
+
{
|
|
525
|
+
className: d("expand-icon", {
|
|
526
|
+
expanded: E.includes(e.id)
|
|
527
|
+
}),
|
|
528
|
+
children: /* @__PURE__ */ o(ee, {})
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
}
|
|
532
|
+
) }),
|
|
533
|
+
g.map((_, U) => {
|
|
534
|
+
const P = Q(e.id, _.key), I = N(_);
|
|
535
|
+
return /* @__PURE__ */ o(
|
|
536
|
+
"div",
|
|
537
|
+
{
|
|
538
|
+
ref: I ? J(_.key) : void 0,
|
|
539
|
+
className: d("table-cell", "pinned-column", {
|
|
540
|
+
"primary-cell": I,
|
|
541
|
+
"expanded-cell": P
|
|
542
|
+
}),
|
|
543
|
+
style: W(
|
|
544
|
+
_,
|
|
545
|
+
!0,
|
|
546
|
+
U,
|
|
547
|
+
g,
|
|
548
|
+
M,
|
|
549
|
+
v,
|
|
550
|
+
t
|
|
551
|
+
),
|
|
552
|
+
children: e[_.key].component || e[_.key].content || e[_.key]
|
|
553
|
+
},
|
|
554
|
+
_.key
|
|
555
|
+
);
|
|
556
|
+
}),
|
|
557
|
+
L.map((_) => {
|
|
558
|
+
const U = Q(e.id, _.key), P = N(_);
|
|
559
|
+
return /* @__PURE__ */ o(
|
|
560
|
+
"div",
|
|
561
|
+
{
|
|
562
|
+
ref: P ? J(_.key) : void 0,
|
|
563
|
+
className: d("table-cell", {
|
|
564
|
+
"primary-cell": P,
|
|
565
|
+
"expanded-cell": U
|
|
566
|
+
}),
|
|
567
|
+
style: W(
|
|
568
|
+
_,
|
|
569
|
+
!1,
|
|
570
|
+
void 0,
|
|
571
|
+
g,
|
|
572
|
+
M,
|
|
573
|
+
v,
|
|
574
|
+
t
|
|
575
|
+
),
|
|
576
|
+
children: e[_.key].component || e[_.key].content || e[_.key]
|
|
577
|
+
},
|
|
578
|
+
_.key
|
|
579
|
+
);
|
|
580
|
+
}),
|
|
581
|
+
c && /* @__PURE__ */ o("div", { className: d("table-cell", "action-menu-cell"), children: c(e.metaData) })
|
|
582
|
+
] }) })
|
|
583
|
+
]
|
|
584
|
+
},
|
|
585
|
+
e.id
|
|
586
|
+
))
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
);
|
|
592
|
+
};
|
|
593
|
+
export {
|
|
594
|
+
pl as T
|
|
595
|
+
};
|
package/dist/table.js
CHANGED
package/package.json
CHANGED
package/dist/table-b4364f2c.js
DELETED
|
@@ -1,588 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as z } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as se, useState as m, useCallback as w, useEffect as re, useRef as oe, forwardRef as Pe } from "react";
|
|
3
|
-
import { Resizable as De } from "react-resizable";
|
|
4
|
-
import { c as ce } from "./bind-06a7ff84.js";
|
|
5
|
-
import { c as We, b as ee, a as le, S as Oe } from "./resizeColumn-d4107941.js";
|
|
6
|
-
import { C as te } from "./checkbox-ed6cc375.js";
|
|
7
|
-
import { Tooltip as Ue } from "./tooltip.js";
|
|
8
|
-
const j = (l) => typeof l == "string", je = "_table_1244e_1", He = "_resizable_1244e_46", Be = "_selectable_1244e_63", Ge = "_expanded_1244e_59", Xe = "_label_1244e_303", Ye = {
|
|
9
|
-
table: je,
|
|
10
|
-
"fixed-header": "_fixed-header_1244e_8",
|
|
11
|
-
"horizontally-scrollable-container": "_horizontally-scrollable-container_1244e_14",
|
|
12
|
-
"table-header": "_table-header_1244e_19",
|
|
13
|
-
"sticky-header": "_sticky-header_1244e_26",
|
|
14
|
-
"horizontally-scrollable": "_horizontally-scrollable_1244e_14",
|
|
15
|
-
resizable: He,
|
|
16
|
-
"resizable-column": "_resizable-column_1244e_46",
|
|
17
|
-
"table-row": "_table-row_1244e_54",
|
|
18
|
-
"expanded-cell": "_expanded-cell_1244e_59",
|
|
19
|
-
selectable: Be,
|
|
20
|
-
"row-content-wrapper": "_row-content-wrapper_1244e_67",
|
|
21
|
-
"table-row-content": "_table-row-content_1244e_75",
|
|
22
|
-
"expand-cell": "_expand-cell_1244e_89",
|
|
23
|
-
"size-small": "_size-small_1244e_92",
|
|
24
|
-
"size-large": "_size-large_1244e_103",
|
|
25
|
-
"table-body": "_table-body_1244e_115",
|
|
26
|
-
"scrollable-body": "_scrollable-body_1244e_121",
|
|
27
|
-
"table-header-cell": "_table-header-cell_1244e_181",
|
|
28
|
-
"table-cell": "_table-cell_1244e_182",
|
|
29
|
-
"action-menu-cell": "_action-menu-cell_1244e_188",
|
|
30
|
-
"checkbox-cell": "_checkbox-cell_1244e_213",
|
|
31
|
-
"expand-all-tooltip-wrapper": "_expand-all-tooltip-wrapper_1244e_255",
|
|
32
|
-
"expand-all-tooltip-content": "_expand-all-tooltip-content_1244e_264",
|
|
33
|
-
"expand-icon": "_expand-icon_1244e_273",
|
|
34
|
-
expanded: Ge,
|
|
35
|
-
"primary-cell": "_primary-cell_1244e_282",
|
|
36
|
-
label: Xe,
|
|
37
|
-
"sortable-cell": "_sortable-cell_1244e_317",
|
|
38
|
-
"align-right": "_align-right_1244e_320",
|
|
39
|
-
"align-center": "_align-center_1244e_326",
|
|
40
|
-
"pinned-column": "_pinned-column_1244e_329"
|
|
41
|
-
}, ie = "asc", S = 32, de = 100, qe = 48, Je = (l) => l.toLowerCase() === ie, Qe = (l) => l.map((n) => n.key), N = (l) => "primary" in l && l.primary === !0, Ve = (l) => {
|
|
42
|
-
var r;
|
|
43
|
-
return `size-${((r = l.rowConfigs) == null ? void 0 : r.size) ?? "default"}`;
|
|
44
|
-
}, Ze = (l, n, r, c, i) => {
|
|
45
|
-
let s = 0;
|
|
46
|
-
c && (s += S), i && (s += S);
|
|
47
|
-
for (let _ = 0; _ < l; _++) {
|
|
48
|
-
const p = n[_];
|
|
49
|
-
if (N(p)) {
|
|
50
|
-
const t = r.current.get(p.key) || de;
|
|
51
|
-
s += t;
|
|
52
|
-
} else {
|
|
53
|
-
const t = p, d = j(t.width) ? parseInt(t.width, 10) || 0 : t.width;
|
|
54
|
-
s += d;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return s;
|
|
58
|
-
}, D = (l, n, r, c, i, s, _) => {
|
|
59
|
-
const p = {};
|
|
60
|
-
if (!N(l)) {
|
|
61
|
-
const t = l;
|
|
62
|
-
p.textAlign = t.align;
|
|
63
|
-
}
|
|
64
|
-
if (n && r !== void 0) {
|
|
65
|
-
const t = Ze(
|
|
66
|
-
r,
|
|
67
|
-
c,
|
|
68
|
-
i,
|
|
69
|
-
s,
|
|
70
|
-
_
|
|
71
|
-
);
|
|
72
|
-
p.left = `${t}px`;
|
|
73
|
-
}
|
|
74
|
-
return p;
|
|
75
|
-
}, ne = (l, n, r, c, i, s = !1, _) => {
|
|
76
|
-
const p = [];
|
|
77
|
-
r && p.push(`${S}px`), s && c && p.push(`${S}px`);
|
|
78
|
-
const t = (d) => {
|
|
79
|
-
if ((_ == null ? void 0 : _[d.key]) !== void 0) {
|
|
80
|
-
p.push(`${_[d.key]}px`);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (N(d)) {
|
|
84
|
-
const a = d, f = a.width ? j(a.width) ? a.width : `${a.width}px` : `${de}px`;
|
|
85
|
-
p.push(`minmax(${f}, 1fr)`);
|
|
86
|
-
} else {
|
|
87
|
-
const a = d, f = j(a.width) ? a.width : `${a.width}px`;
|
|
88
|
-
p.push(f);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
return l.forEach(t), n.forEach(t), i && p.push(`${qe}px`), p.join(" ");
|
|
92
|
-
}, Ke = ({
|
|
93
|
-
primaryColumns: l,
|
|
94
|
-
fixedColumns: n,
|
|
95
|
-
pinnedColumnKeys: r
|
|
96
|
-
}) => se(() => {
|
|
97
|
-
const c = [], i = [];
|
|
98
|
-
return l.forEach((s) => {
|
|
99
|
-
const _ = { ...s, primary: !0 };
|
|
100
|
-
r.includes(s.key) ? c.push(_) : i.push(_);
|
|
101
|
-
}), n.forEach((s) => {
|
|
102
|
-
r.includes(s.key) ? c.push(s) : i.push(s);
|
|
103
|
-
}), {
|
|
104
|
-
pinnedColumns: c,
|
|
105
|
-
scrollableColumns: i
|
|
106
|
-
};
|
|
107
|
-
}, [l, n, r]), Fe = () => {
|
|
108
|
-
const [l, n] = m(null), [r, c] = m(null), i = w((t) => {
|
|
109
|
-
n(t);
|
|
110
|
-
}, []), s = w(() => {
|
|
111
|
-
n(null);
|
|
112
|
-
}, []), _ = w((t) => {
|
|
113
|
-
c(t);
|
|
114
|
-
}, []), p = w(() => {
|
|
115
|
-
c(null);
|
|
116
|
-
}, []);
|
|
117
|
-
return {
|
|
118
|
-
hoveredColumn: l,
|
|
119
|
-
hoveredRow: r,
|
|
120
|
-
handleColumnMouseEnter: i,
|
|
121
|
-
handleColumnMouseLeave: s,
|
|
122
|
-
handleRowMouseEnter: _,
|
|
123
|
-
handleRowMouseLeave: p
|
|
124
|
-
};
|
|
125
|
-
}, Re = ({
|
|
126
|
-
primaryColumns: l,
|
|
127
|
-
fixedColumns: n,
|
|
128
|
-
expandedRowIds: r,
|
|
129
|
-
onToggleRowExpansion: c
|
|
130
|
-
}) => {
|
|
131
|
-
const [i, s] = m(/* @__PURE__ */ new Set());
|
|
132
|
-
re(() => {
|
|
133
|
-
const t = [
|
|
134
|
-
...l.map((a) => a.key),
|
|
135
|
-
...n.map((a) => a.key)
|
|
136
|
-
], d = /* @__PURE__ */ new Set();
|
|
137
|
-
r.forEach((a) => {
|
|
138
|
-
t.forEach((f) => {
|
|
139
|
-
d.add(`${a}-${f}`);
|
|
140
|
-
});
|
|
141
|
-
}), s((a) => {
|
|
142
|
-
if (a.size === d.size) {
|
|
143
|
-
let f = !0;
|
|
144
|
-
if (a.forEach((b) => {
|
|
145
|
-
d.has(b) || (f = !1);
|
|
146
|
-
}), f)
|
|
147
|
-
return a;
|
|
148
|
-
}
|
|
149
|
-
return d;
|
|
150
|
-
});
|
|
151
|
-
}, [r, l, n]);
|
|
152
|
-
const _ = w(
|
|
153
|
-
(t) => {
|
|
154
|
-
const d = new Set(i), a = r.includes(t), f = [
|
|
155
|
-
...l.map((b) => b.key),
|
|
156
|
-
...n.map((b) => b.key)
|
|
157
|
-
];
|
|
158
|
-
a ? f.forEach((b) => {
|
|
159
|
-
const u = `${t}-${b}`;
|
|
160
|
-
d.delete(u);
|
|
161
|
-
}) : f.forEach((b) => {
|
|
162
|
-
const u = `${t}-${b}`;
|
|
163
|
-
d.add(u);
|
|
164
|
-
}), s(d), c(t);
|
|
165
|
-
},
|
|
166
|
-
[i, r, l, n, c]
|
|
167
|
-
), p = w(
|
|
168
|
-
(t, d) => {
|
|
169
|
-
const a = `${t}-${d}`;
|
|
170
|
-
return i.has(a);
|
|
171
|
-
},
|
|
172
|
-
[i]
|
|
173
|
-
);
|
|
174
|
-
return {
|
|
175
|
-
expandedCells: i,
|
|
176
|
-
handleToggleRowExpansion: _,
|
|
177
|
-
isCellExpanded: p
|
|
178
|
-
};
|
|
179
|
-
}, Ie = () => {
|
|
180
|
-
const l = oe(/* @__PURE__ */ new Map()), n = w(
|
|
181
|
-
(r) => (c) => {
|
|
182
|
-
if (!c)
|
|
183
|
-
return;
|
|
184
|
-
const i = c.getBoundingClientRect().width;
|
|
185
|
-
i > 0 && l.current.set(r, i);
|
|
186
|
-
},
|
|
187
|
-
[]
|
|
188
|
-
);
|
|
189
|
-
return {
|
|
190
|
-
columnWidthsRef: l,
|
|
191
|
-
setCellRef: n
|
|
192
|
-
};
|
|
193
|
-
}, el = ({
|
|
194
|
-
enabled: l = !1,
|
|
195
|
-
minWidth: n = 50,
|
|
196
|
-
maxWidth: r = 500,
|
|
197
|
-
columnWidthsRef: c,
|
|
198
|
-
onColumnResize: i
|
|
199
|
-
}) => {
|
|
200
|
-
const [s, _] = m({}), p = w(() => {
|
|
201
|
-
if (!l || Object.keys(s).length > 0 || !c)
|
|
202
|
-
return;
|
|
203
|
-
const a = {};
|
|
204
|
-
c.current.forEach((f, b) => {
|
|
205
|
-
a[b] = f;
|
|
206
|
-
}), _(a);
|
|
207
|
-
}, [l, s, c]), t = w(
|
|
208
|
-
(a) => (f, { size: b }) => {
|
|
209
|
-
if (!l)
|
|
210
|
-
return;
|
|
211
|
-
const u = Math.min(r, Math.max(n, b.width));
|
|
212
|
-
_((E) => ({ ...E, [a]: u }));
|
|
213
|
-
},
|
|
214
|
-
[l, n, r]
|
|
215
|
-
), d = w(
|
|
216
|
-
(a) => () => {
|
|
217
|
-
!l || !s[a] || i == null || i(a, s[a]);
|
|
218
|
-
},
|
|
219
|
-
[l, s, i]
|
|
220
|
-
);
|
|
221
|
-
return {
|
|
222
|
-
columnWidths: s,
|
|
223
|
-
handleResize: t,
|
|
224
|
-
handleResizeStop: d,
|
|
225
|
-
handleResizeStart: p
|
|
226
|
-
};
|
|
227
|
-
}, ll = {
|
|
228
|
-
"resize-handle": "_resize-handle_15uk3_1"
|
|
229
|
-
}, tl = ce.bind(ll), nl = Pe(
|
|
230
|
-
(l, n) => /* @__PURE__ */ o("div", { ref: n, className: tl("resize-handle"), ...l, children: /* @__PURE__ */ o(We, {}) })
|
|
231
|
-
), h = ce.bind(Ye), ae = ({ column: l }) => {
|
|
232
|
-
const n = oe(null), [r, c] = m(!1);
|
|
233
|
-
return re(() => {
|
|
234
|
-
if (n.current) {
|
|
235
|
-
const i = n.current.offsetWidth, s = n.current.scrollWidth;
|
|
236
|
-
c(s > i);
|
|
237
|
-
}
|
|
238
|
-
}, [l.header]), /* @__PURE__ */ o("span", { ref: n, title: r ? l.header : void 0, children: l.header });
|
|
239
|
-
}, hl = ({
|
|
240
|
-
data: l,
|
|
241
|
-
primaryColumn: n,
|
|
242
|
-
fixedColumns: r,
|
|
243
|
-
renderRowActions: c,
|
|
244
|
-
className: i = "",
|
|
245
|
-
rowClassName: s = "",
|
|
246
|
-
headerClassName: _ = "",
|
|
247
|
-
bodyClassName: p = "",
|
|
248
|
-
selectable: t = !1,
|
|
249
|
-
selectedRowIds: d = [],
|
|
250
|
-
sortingDirection: a = ie,
|
|
251
|
-
sortingColumn: f,
|
|
252
|
-
sortableColumns: b,
|
|
253
|
-
isHeaderFixed: u = !1,
|
|
254
|
-
isHorizontallyScrollable: E = !1,
|
|
255
|
-
pinnedColumnKeys: he = [],
|
|
256
|
-
isRowsExpandable: k = !1,
|
|
257
|
-
expandedRowIds: $ = [],
|
|
258
|
-
isAllExpandedByDefault: H,
|
|
259
|
-
expandAllTooltip: B,
|
|
260
|
-
isResizable: v = !1,
|
|
261
|
-
minColumnWidth: W = 50,
|
|
262
|
-
maxColumnWidth: G = 500,
|
|
263
|
-
onChangeSorting: pe = () => {
|
|
264
|
-
},
|
|
265
|
-
onToggleRowSelection: _e = () => {
|
|
266
|
-
},
|
|
267
|
-
onToggleAllRowsSelection: ye = () => {
|
|
268
|
-
},
|
|
269
|
-
onToggleRowExpansion: fe = () => {
|
|
270
|
-
},
|
|
271
|
-
onToggleAllRowsExpansion: be = () => {
|
|
272
|
-
},
|
|
273
|
-
onColumnResize: ue = () => {
|
|
274
|
-
}
|
|
275
|
-
}) => {
|
|
276
|
-
const T = se(
|
|
277
|
-
() => Array.isArray(n) ? n : [n],
|
|
278
|
-
[n]
|
|
279
|
-
), x = f ?? T[0], A = b ?? Qe([...T, ...r]), { pinnedColumns: g, scrollableColumns: L } = Ke({
|
|
280
|
-
primaryColumns: T,
|
|
281
|
-
fixedColumns: r,
|
|
282
|
-
pinnedColumnKeys: he
|
|
283
|
-
}), {
|
|
284
|
-
hoveredColumn: X,
|
|
285
|
-
hoveredRow: ke,
|
|
286
|
-
handleColumnMouseEnter: Y,
|
|
287
|
-
handleColumnMouseLeave: q,
|
|
288
|
-
handleRowMouseEnter: ve,
|
|
289
|
-
handleRowMouseLeave: we
|
|
290
|
-
} = Fe(), { columnWidthsRef: M, setCellRef: J } = Ie(), { handleToggleRowExpansion: xe, isCellExpanded: Q } = Re({
|
|
291
|
-
primaryColumns: T,
|
|
292
|
-
fixedColumns: r,
|
|
293
|
-
expandedRowIds: $,
|
|
294
|
-
onToggleRowExpansion: fe
|
|
295
|
-
}), { columnWidths: O, handleResize: Ce, handleResizeStop: ge, handleResizeStart: Ne } = el({
|
|
296
|
-
enabled: v,
|
|
297
|
-
minWidth: W,
|
|
298
|
-
maxWidth: G,
|
|
299
|
-
columnWidthsRef: M,
|
|
300
|
-
onColumnResize: ue
|
|
301
|
-
}), V = (e, C) => /* @__PURE__ */ o(
|
|
302
|
-
De,
|
|
303
|
-
{
|
|
304
|
-
width: O[e.key] ?? (typeof e.width == "number" ? e.width : W),
|
|
305
|
-
height: 0,
|
|
306
|
-
axis: "x",
|
|
307
|
-
handle: /* @__PURE__ */ o(nl, {}),
|
|
308
|
-
onResizeStart: Ne,
|
|
309
|
-
onResize: Ce(e.key),
|
|
310
|
-
onResizeStop: ge(e.key),
|
|
311
|
-
minConstraints: [W, 0],
|
|
312
|
-
maxConstraints: [G, 0],
|
|
313
|
-
className: h("resizable-column"),
|
|
314
|
-
children: C
|
|
315
|
-
},
|
|
316
|
-
e.key
|
|
317
|
-
), Z = (e) => {
|
|
318
|
-
A.includes(e) && pe({ key: e, direction: a });
|
|
319
|
-
}, ze = (e) => {
|
|
320
|
-
_e(e);
|
|
321
|
-
}, Se = () => {
|
|
322
|
-
ye();
|
|
323
|
-
}, Ee = () => {
|
|
324
|
-
be();
|
|
325
|
-
}, K = (e) => A.includes(e) ? (x == null ? void 0 : x.key) === e ? Je(a) ? /* @__PURE__ */ o(le, {}) : /* @__PURE__ */ o(Oe, {}) : /* @__PURE__ */ o(le, {}) : null, $e = l.every((e) => d.includes(e.id)), Me = l.some((e) => d.includes(e.id)), F = (d == null ? void 0 : d.length) > 0, me = l.every((e) => $.includes(e.id)), Te = H !== void 0 ? H : me, Ae = ne(
|
|
326
|
-
g,
|
|
327
|
-
L,
|
|
328
|
-
k,
|
|
329
|
-
t,
|
|
330
|
-
!!c,
|
|
331
|
-
!1,
|
|
332
|
-
v ? O : void 0
|
|
333
|
-
), Le = ne(
|
|
334
|
-
g,
|
|
335
|
-
L,
|
|
336
|
-
k,
|
|
337
|
-
t,
|
|
338
|
-
!!c,
|
|
339
|
-
!0,
|
|
340
|
-
v ? O : void 0
|
|
341
|
-
), R = /* @__PURE__ */ o("button", { onClick: Ee, "aria-label": "Toggle all rows expansion", children: /* @__PURE__ */ o("span", { className: h("expand-icon", { expanded: Te }), children: /* @__PURE__ */ o(ee, {}) }) });
|
|
342
|
-
return /* @__PURE__ */ z(
|
|
343
|
-
"div",
|
|
344
|
-
{
|
|
345
|
-
className: h(
|
|
346
|
-
"table",
|
|
347
|
-
{
|
|
348
|
-
"fixed-header": u,
|
|
349
|
-
"horizontally-scrollable-container": u && (E || v)
|
|
350
|
-
},
|
|
351
|
-
i
|
|
352
|
-
),
|
|
353
|
-
children: [
|
|
354
|
-
/* @__PURE__ */ z(
|
|
355
|
-
"div",
|
|
356
|
-
{
|
|
357
|
-
className: h(
|
|
358
|
-
"table-header",
|
|
359
|
-
{
|
|
360
|
-
"sticky-header": u,
|
|
361
|
-
"horizontally-scrollable": E,
|
|
362
|
-
resizable: v
|
|
363
|
-
},
|
|
364
|
-
_
|
|
365
|
-
),
|
|
366
|
-
style: { gridTemplateColumns: Le },
|
|
367
|
-
children: [
|
|
368
|
-
t && /* @__PURE__ */ o(
|
|
369
|
-
"div",
|
|
370
|
-
{
|
|
371
|
-
className: h("table-header-cell", "checkbox-cell"),
|
|
372
|
-
style: { left: k ? `${S}px` : "0" },
|
|
373
|
-
children: F && /* @__PURE__ */ o(
|
|
374
|
-
te,
|
|
375
|
-
{
|
|
376
|
-
value: $e,
|
|
377
|
-
partiallyChecked: Me,
|
|
378
|
-
onChange: Se,
|
|
379
|
-
className: h("checkbox-cell")
|
|
380
|
-
}
|
|
381
|
-
)
|
|
382
|
-
}
|
|
383
|
-
),
|
|
384
|
-
k && /* @__PURE__ */ o("div", { className: h("table-header-cell", "expand-cell"), style: { left: "0" }, children: B ? /* @__PURE__ */ o(
|
|
385
|
-
Ue,
|
|
386
|
-
{
|
|
387
|
-
content: B,
|
|
388
|
-
placement: "top",
|
|
389
|
-
wrapperClassName: h("expand-all-tooltip-wrapper"),
|
|
390
|
-
contentClassName: h("expand-all-tooltip-content"),
|
|
391
|
-
children: R
|
|
392
|
-
}
|
|
393
|
-
) : R }),
|
|
394
|
-
g.map((e, C) => {
|
|
395
|
-
const y = /* @__PURE__ */ o(
|
|
396
|
-
"button",
|
|
397
|
-
{
|
|
398
|
-
className: h("table-header-cell", "pinned-column", {
|
|
399
|
-
[`align-${e.align}`]: "align" in e,
|
|
400
|
-
"primary-cell": N(e),
|
|
401
|
-
"sortable-cell": A.includes(e.key),
|
|
402
|
-
resizable: v
|
|
403
|
-
}),
|
|
404
|
-
style: D(
|
|
405
|
-
e,
|
|
406
|
-
!0,
|
|
407
|
-
C,
|
|
408
|
-
g,
|
|
409
|
-
M,
|
|
410
|
-
k,
|
|
411
|
-
t
|
|
412
|
-
),
|
|
413
|
-
children: /* @__PURE__ */ z(
|
|
414
|
-
"div",
|
|
415
|
-
{
|
|
416
|
-
className: h("label"),
|
|
417
|
-
onClick: () => Z(e.key),
|
|
418
|
-
onMouseEnter: () => Y(e.key),
|
|
419
|
-
onMouseLeave: q,
|
|
420
|
-
children: [
|
|
421
|
-
/* @__PURE__ */ o(ae, { column: e }),
|
|
422
|
-
(X === e.key || (x == null ? void 0 : x.key) === e.key) && K(e.key)
|
|
423
|
-
]
|
|
424
|
-
}
|
|
425
|
-
)
|
|
426
|
-
},
|
|
427
|
-
e.key
|
|
428
|
-
);
|
|
429
|
-
return v ? V(e, y) : y;
|
|
430
|
-
}),
|
|
431
|
-
L.map((e) => {
|
|
432
|
-
const C = /* @__PURE__ */ o(
|
|
433
|
-
"button",
|
|
434
|
-
{
|
|
435
|
-
className: h("table-header-cell", {
|
|
436
|
-
[`align-${e.align}`]: "align" in e,
|
|
437
|
-
"primary-cell": N(e),
|
|
438
|
-
"sortable-cell": A.includes(e.key),
|
|
439
|
-
resizable: v
|
|
440
|
-
}),
|
|
441
|
-
style: D(
|
|
442
|
-
e,
|
|
443
|
-
!1,
|
|
444
|
-
void 0,
|
|
445
|
-
g,
|
|
446
|
-
M,
|
|
447
|
-
k,
|
|
448
|
-
t
|
|
449
|
-
),
|
|
450
|
-
children: /* @__PURE__ */ z(
|
|
451
|
-
"div",
|
|
452
|
-
{
|
|
453
|
-
className: h("label"),
|
|
454
|
-
onClick: () => Z(e.key),
|
|
455
|
-
onMouseEnter: () => Y(e.key),
|
|
456
|
-
onMouseLeave: q,
|
|
457
|
-
children: [
|
|
458
|
-
/* @__PURE__ */ o(ae, { column: e }),
|
|
459
|
-
(X === e.key || (x == null ? void 0 : x.key) === e.key) && K(e.key)
|
|
460
|
-
]
|
|
461
|
-
}
|
|
462
|
-
)
|
|
463
|
-
},
|
|
464
|
-
e.key
|
|
465
|
-
);
|
|
466
|
-
return v ? V(e, C) : C;
|
|
467
|
-
}),
|
|
468
|
-
c && /* @__PURE__ */ o("div", { className: h("table-header-cell", "action-menu-cell") })
|
|
469
|
-
]
|
|
470
|
-
}
|
|
471
|
-
),
|
|
472
|
-
/* @__PURE__ */ o(
|
|
473
|
-
"div",
|
|
474
|
-
{
|
|
475
|
-
className: h(
|
|
476
|
-
"table-body",
|
|
477
|
-
{
|
|
478
|
-
"scrollable-body": u,
|
|
479
|
-
"horizontally-scrollable": E,
|
|
480
|
-
resizable: v
|
|
481
|
-
},
|
|
482
|
-
p
|
|
483
|
-
),
|
|
484
|
-
children: l.map((e, C) => /* @__PURE__ */ z(
|
|
485
|
-
"div",
|
|
486
|
-
{
|
|
487
|
-
className: h("table-row", Ve(e), s, {
|
|
488
|
-
selectable: t
|
|
489
|
-
}),
|
|
490
|
-
onMouseEnter: () => ve(C),
|
|
491
|
-
onMouseLeave: we,
|
|
492
|
-
children: [
|
|
493
|
-
t && /* @__PURE__ */ o(
|
|
494
|
-
"div",
|
|
495
|
-
{
|
|
496
|
-
className: h("table-cell", "checkbox-cell"),
|
|
497
|
-
style: { left: k ? `${S}px` : "0" },
|
|
498
|
-
children: (F || ke === C) && /* @__PURE__ */ o(
|
|
499
|
-
te,
|
|
500
|
-
{
|
|
501
|
-
value: d.includes(e.id),
|
|
502
|
-
onChange: () => ze(e.id),
|
|
503
|
-
className: h("checkbox-cell")
|
|
504
|
-
}
|
|
505
|
-
)
|
|
506
|
-
}
|
|
507
|
-
),
|
|
508
|
-
/* @__PURE__ */ o("div", { className: h("row-content-wrapper"), children: /* @__PURE__ */ z("div", { className: h("table-row-content"), style: { gridTemplateColumns: Ae }, children: [
|
|
509
|
-
k && /* @__PURE__ */ o("div", { className: h("table-cell", "expand-cell"), style: { left: "0" }, children: /* @__PURE__ */ o(
|
|
510
|
-
"button",
|
|
511
|
-
{
|
|
512
|
-
onClick: () => xe(e.id),
|
|
513
|
-
"aria-label": $.includes(e.id) ? "Collapse row" : "Expand row",
|
|
514
|
-
"aria-expanded": $.includes(e.id),
|
|
515
|
-
children: /* @__PURE__ */ o(
|
|
516
|
-
"span",
|
|
517
|
-
{
|
|
518
|
-
className: h("expand-icon", {
|
|
519
|
-
expanded: $.includes(e.id)
|
|
520
|
-
}),
|
|
521
|
-
children: /* @__PURE__ */ o(ee, {})
|
|
522
|
-
}
|
|
523
|
-
)
|
|
524
|
-
}
|
|
525
|
-
) }),
|
|
526
|
-
g.map((y, U) => {
|
|
527
|
-
const P = Q(e.id, y.key), I = N(y);
|
|
528
|
-
return /* @__PURE__ */ o(
|
|
529
|
-
"div",
|
|
530
|
-
{
|
|
531
|
-
ref: I ? J(y.key) : void 0,
|
|
532
|
-
className: h("table-cell", "pinned-column", {
|
|
533
|
-
"primary-cell": I,
|
|
534
|
-
"expanded-cell": P
|
|
535
|
-
}),
|
|
536
|
-
style: D(
|
|
537
|
-
y,
|
|
538
|
-
!0,
|
|
539
|
-
U,
|
|
540
|
-
g,
|
|
541
|
-
M,
|
|
542
|
-
k,
|
|
543
|
-
t
|
|
544
|
-
),
|
|
545
|
-
children: e[y.key].component || e[y.key].content || e[y.key]
|
|
546
|
-
},
|
|
547
|
-
y.key
|
|
548
|
-
);
|
|
549
|
-
}),
|
|
550
|
-
L.map((y) => {
|
|
551
|
-
const U = Q(e.id, y.key), P = N(y);
|
|
552
|
-
return /* @__PURE__ */ o(
|
|
553
|
-
"div",
|
|
554
|
-
{
|
|
555
|
-
ref: P ? J(y.key) : void 0,
|
|
556
|
-
className: h("table-cell", {
|
|
557
|
-
"primary-cell": P,
|
|
558
|
-
"expanded-cell": U
|
|
559
|
-
}),
|
|
560
|
-
style: D(
|
|
561
|
-
y,
|
|
562
|
-
!1,
|
|
563
|
-
void 0,
|
|
564
|
-
g,
|
|
565
|
-
M,
|
|
566
|
-
k,
|
|
567
|
-
t
|
|
568
|
-
),
|
|
569
|
-
children: e[y.key].component || e[y.key].content || e[y.key]
|
|
570
|
-
},
|
|
571
|
-
y.key
|
|
572
|
-
);
|
|
573
|
-
}),
|
|
574
|
-
c && /* @__PURE__ */ o("div", { className: h("table-cell", "action-menu-cell"), children: c(e.metaData) })
|
|
575
|
-
] }) })
|
|
576
|
-
]
|
|
577
|
-
},
|
|
578
|
-
e.id
|
|
579
|
-
))
|
|
580
|
-
}
|
|
581
|
-
)
|
|
582
|
-
]
|
|
583
|
-
}
|
|
584
|
-
);
|
|
585
|
-
};
|
|
586
|
-
export {
|
|
587
|
-
hl as T
|
|
588
|
-
};
|