@reportportal/ui-kit 0.0.1-alpha.158 → 0.0.1-alpha.159

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.
@@ -0,0 +1,1058 @@
1
+ import { jsx as h, jsxs as F, Fragment as zt } from "react/jsx-runtime";
2
+ import { useMemo as de, useState as B, useCallback as x, useEffect as P, useRef as H, useLayoutEffect as et, forwardRef as xt } from "react";
3
+ import { Resizable as At } from "react-resizable";
4
+ import { c as me } from "./bind-06a7ff84.js";
5
+ import { c as $t, b as Ye, a as Je, S as Mt } from "./resizeColumn-d4107941.js";
6
+ import { C as ie } from "./checkbox-493fdc63.js";
7
+ import { Tooltip as Ht } from "./tooltip.js";
8
+ import { createPortal as Wt } from "react-dom";
9
+ import { i as Pt } from "./isEmpty-ccacb5ff.js";
10
+ const tt = (t) => typeof t == "string", Bt = "_table_1rtld_1", Gt = "_resizable_1rtld_67", St = "_selectable_1rtld_84", Ft = "_expanded_1rtld_80", qt = "_label_1rtld_353", Ut = {
11
+ table: Bt,
12
+ "fixed-header": "_fixed-header_1rtld_10",
13
+ "external-scroll-container": "_external-scroll-container_1rtld_14",
14
+ "horizontally-scrollable-container": "_horizontally-scrollable-container_1rtld_21",
15
+ "table-header": "_table-header_1rtld_26",
16
+ "sticky-header": "_sticky-header_1rtld_34",
17
+ "pinned-header": "_pinned-header_1rtld_44",
18
+ "horizontally-scrollable": "_horizontally-scrollable_1rtld_21",
19
+ resizable: Gt,
20
+ "resizable-column": "_resizable-column_1rtld_67",
21
+ "table-row": "_table-row_1rtld_75",
22
+ "expanded-cell": "_expanded-cell_1rtld_80",
23
+ selectable: St,
24
+ "row-content-wrapper": "_row-content-wrapper_1rtld_88",
25
+ "pinned-column": "_pinned-column_1rtld_96",
26
+ "has-scroll": "_has-scroll_1rtld_96",
27
+ "table-row-content": "_table-row-content_1rtld_99",
28
+ "expand-cell": "_expand-cell_1rtld_116",
29
+ "left-border-accent": "_left-border-accent_1rtld_119",
30
+ "size-small": "_size-small_1rtld_129",
31
+ "size-large": "_size-large_1rtld_140",
32
+ "table-body": "_table-body_1rtld_152",
33
+ "scrollable-body": "_scrollable-body_1rtld_158",
34
+ "table-header-cell": "_table-header-cell_1rtld_222",
35
+ "table-cell": "_table-cell_1rtld_223",
36
+ "action-menu-cell": "_action-menu-cell_1rtld_229",
37
+ "checkbox-cell": "_checkbox-cell_1rtld_257",
38
+ "expand-all-tooltip-wrapper": "_expand-all-tooltip-wrapper_1rtld_302",
39
+ "expand-all-tooltip-content": "_expand-all-tooltip-content_1rtld_311",
40
+ "expand-icon": "_expand-icon_1rtld_320",
41
+ expanded: Ft,
42
+ "primary-cell": "_primary-cell_1rtld_329",
43
+ label: qt,
44
+ "sortable-cell": "_sortable-cell_1rtld_367",
45
+ "align-right": "_align-right_1rtld_370",
46
+ "align-center": "_align-center_1rtld_376",
47
+ "table-wrapper": "_table-wrapper_1rtld_430",
48
+ "checkbox-column": "_checkbox-column_1rtld_442",
49
+ "checkbox-header": "_checkbox-header_1rtld_454",
50
+ "checkbox-body": "_checkbox-body_1rtld_478",
51
+ "checkbox-row": "_checkbox-row_1rtld_485"
52
+ }, nt = "asc", C = 32, rt = 100, Dt = 48, we = 48, Xt = (t) => t.toLowerCase() === nt, jt = (t) => t.map((l) => l.key), V = (t) => "primary" in t && t.primary === !0, Qe = (t) => {
53
+ var o;
54
+ return `size-${((o = t.rowConfigs) == null ? void 0 : o.size) ?? "default"}`;
55
+ }, ye = (t) => tt(t) ? t : `${t}px`, It = (t, l, o, i, d, u = !1) => {
56
+ let p = 0;
57
+ i && (p += C), d && !u && (p += C);
58
+ for (let b = 0; b < t; b++) {
59
+ const a = l[b];
60
+ if (V(a)) {
61
+ const n = o.current.get(a.key) || rt;
62
+ p += n;
63
+ } else {
64
+ const n = a, c = tt(n.width) ? parseInt(n.width, 10) || 0 : n.width;
65
+ p += c;
66
+ }
67
+ }
68
+ return p;
69
+ }, ae = (t, l, o, i, d, u, p, b = !1) => {
70
+ const a = {};
71
+ if (!V(t)) {
72
+ const n = t;
73
+ a.textAlign = n.align;
74
+ }
75
+ if (l && o !== void 0) {
76
+ const n = It(
77
+ o,
78
+ i,
79
+ d,
80
+ u,
81
+ p,
82
+ b
83
+ );
84
+ a.left = `${n}px`;
85
+ }
86
+ return a;
87
+ }, Ze = (t, l, o, i, d, u = !1, p, b = !1, a = !1) => {
88
+ const n = [];
89
+ o && n.push(`${C}px`), u && i && !a && n.push(`${C}px`);
90
+ const c = (_) => {
91
+ if ((p == null ? void 0 : p[_.key]) !== void 0) {
92
+ n.push(`${p[_.key]}px`);
93
+ return;
94
+ }
95
+ if (V(_)) {
96
+ const v = _;
97
+ if (b && v.width) {
98
+ n.push(ye(v.width));
99
+ return;
100
+ }
101
+ const k = v.width ? ye(v.width) : `${rt}px`;
102
+ n.push(`minmax(${k}, 1fr)`);
103
+ } else {
104
+ const k = ye(_.width);
105
+ n.push(k);
106
+ }
107
+ };
108
+ return t.forEach(c), l.forEach(c), d && n.push(`${Dt}px`), n.join(" ");
109
+ }, Rt = ({
110
+ primaryColumns: t,
111
+ fixedColumns: l,
112
+ pinnedColumnKeys: o
113
+ }) => de(() => {
114
+ const i = [], d = [];
115
+ return t.forEach((u) => {
116
+ const p = { ...u, primary: !0 };
117
+ o.includes(u.key) ? i.push(p) : d.push(p);
118
+ }), l.forEach((u) => {
119
+ o.includes(u.key) ? i.push(u) : d.push(u);
120
+ }), {
121
+ pinnedColumns: i,
122
+ scrollableColumns: d
123
+ };
124
+ }, [t, l, o]), Vt = () => {
125
+ const [t, l] = B(null), [o, i] = B(null), d = x((a) => {
126
+ l(a);
127
+ }, []), u = x(() => {
128
+ l(null);
129
+ }, []), p = x((a) => {
130
+ i(a);
131
+ }, []), b = x(() => {
132
+ i(null);
133
+ }, []);
134
+ return {
135
+ hoveredColumn: t,
136
+ hoveredRow: o,
137
+ handleColumnMouseEnter: d,
138
+ handleColumnMouseLeave: u,
139
+ handleRowMouseEnter: p,
140
+ handleRowMouseLeave: b
141
+ };
142
+ }, Ct = ({
143
+ primaryColumns: t,
144
+ fixedColumns: l,
145
+ expandedRowIds: o,
146
+ onToggleRowExpansion: i
147
+ }) => {
148
+ const [d, u] = B(/* @__PURE__ */ new Set());
149
+ P(() => {
150
+ const a = [
151
+ ...t.map((c) => c.key),
152
+ ...l.map((c) => c.key)
153
+ ], n = /* @__PURE__ */ new Set();
154
+ o.forEach((c) => {
155
+ a.forEach((_) => {
156
+ n.add(`${c}-${_}`);
157
+ });
158
+ }), u((c) => {
159
+ if (c.size === n.size) {
160
+ let _ = !0;
161
+ if (c.forEach((v) => {
162
+ n.has(v) || (_ = !1);
163
+ }), _)
164
+ return c;
165
+ }
166
+ return n;
167
+ });
168
+ }, [o, t, l]);
169
+ const p = x(
170
+ (a) => {
171
+ const n = new Set(d), c = o.includes(a), _ = [
172
+ ...t.map((v) => v.key),
173
+ ...l.map((v) => v.key)
174
+ ];
175
+ c ? _.forEach((v) => {
176
+ const k = `${a}-${v}`;
177
+ n.delete(k);
178
+ }) : _.forEach((v) => {
179
+ const k = `${a}-${v}`;
180
+ n.add(k);
181
+ }), u(n), i(a);
182
+ },
183
+ [d, o, t, l, i]
184
+ ), b = x(
185
+ (a, n) => {
186
+ const c = `${a}-${n}`;
187
+ return d.has(c);
188
+ },
189
+ [d]
190
+ );
191
+ return {
192
+ expandedCells: d,
193
+ handleToggleRowExpansion: p,
194
+ isCellExpanded: b
195
+ };
196
+ }, Yt = () => {
197
+ const t = H(/* @__PURE__ */ new Map()), l = x(
198
+ (o) => (i) => {
199
+ if (!i)
200
+ return;
201
+ const d = i.getBoundingClientRect().width;
202
+ d > 0 && t.current.set(o, d);
203
+ },
204
+ []
205
+ );
206
+ return {
207
+ columnWidthsRef: t,
208
+ setCellRef: l
209
+ };
210
+ }, Jt = ({
211
+ enabled: t = !1,
212
+ minWidth: l = 50,
213
+ maxWidth: o = 500,
214
+ columnWidthsRef: i,
215
+ onColumnResize: d
216
+ }) => {
217
+ const [u, p] = B({}), b = x(() => {
218
+ if (!t || Object.keys(u).length > 0 || !i)
219
+ return;
220
+ const c = {};
221
+ i.current.forEach((_, v) => {
222
+ c[v] = _;
223
+ }), p(c);
224
+ }, [t, u, i]), a = x(
225
+ (c) => (_, { size: v }) => {
226
+ if (!t)
227
+ return;
228
+ const k = Math.min(o, Math.max(l, v.width));
229
+ p((z) => ({ ...z, [c]: k }));
230
+ },
231
+ [t, l, o]
232
+ ), n = x(
233
+ (c) => () => {
234
+ !t || !u[c] || d == null || d(c, u[c]);
235
+ },
236
+ [t, u, d]
237
+ );
238
+ return {
239
+ columnWidths: u,
240
+ handleResize: a,
241
+ handleResizeStop: n,
242
+ handleResizeStart: b
243
+ };
244
+ }, Qt = (t, l, o, i, d, u, p, b) => de(() => {
245
+ if (!t)
246
+ return {
247
+ visible: !1,
248
+ position: { top: 0, left: 0 },
249
+ size: { width: 0, height: 0 }
250
+ };
251
+ if (!(d + t.clientWidth < p))
252
+ return {
253
+ visible: !1,
254
+ position: { top: 0, left: 0 },
255
+ size: { width: 0, height: 0 }
256
+ };
257
+ const n = t.getBoundingClientRect(), c = (l == null ? void 0 : l.offsetHeight) || 0, _ = o == null ? void 0 : o.getBoundingClientRect(), v = Math.min(
258
+ n.bottom,
259
+ (_ == null ? void 0 : _.bottom) || Number.MAX_SAFE_INTEGER
260
+ );
261
+ let k;
262
+ i && o && _ ? k = _.top - n.top + c : k = c;
263
+ const z = n.top + k, G = t.scrollWidth > t.clientWidth ? t.offsetHeight - t.clientHeight : 0, N = v - z - G, q = t.scrollHeight > t.clientHeight ? t.offsetWidth - t.clientWidth : 0, j = n.right - we - q;
264
+ return {
265
+ visible: !0,
266
+ position: {
267
+ top: z,
268
+ left: j
269
+ },
270
+ size: {
271
+ width: we,
272
+ height: N
273
+ }
274
+ };
275
+ }, [
276
+ t,
277
+ l,
278
+ o,
279
+ i,
280
+ d,
281
+ u,
282
+ p,
283
+ b
284
+ ]), Zt = (t, l, o, i, d, u, p, b) => de(() => {
285
+ if (!t)
286
+ return {
287
+ visible: !1,
288
+ position: { top: 0, left: 0 },
289
+ size: { width: 0, height: 0 }
290
+ };
291
+ if (!(l > 0))
292
+ return {
293
+ visible: !1,
294
+ position: { top: 0, left: 0 },
295
+ size: { width: 0, height: 0 }
296
+ };
297
+ const n = t.querySelector('[data-row-index="0"]');
298
+ if (!n)
299
+ return {
300
+ visible: !1,
301
+ position: { top: 0, left: 0 },
302
+ size: { width: 0, height: 0 }
303
+ };
304
+ const c = Array.from(n.querySelectorAll("[data-pinned-index]"));
305
+ if (c.length === 0)
306
+ return {
307
+ visible: !1,
308
+ position: { top: 0, left: 0 },
309
+ size: { width: 0, height: 0 }
310
+ };
311
+ const _ = Math.max(
312
+ ...c.map(
313
+ (J) => parseInt(J.getAttribute("data-pinned-index") || "-1", 10)
314
+ )
315
+ );
316
+ if (_ < 0)
317
+ return {
318
+ visible: !1,
319
+ position: { top: 0, left: 0 },
320
+ size: { width: 0, height: 0 }
321
+ };
322
+ const v = c.find(
323
+ (J) => parseInt(J.getAttribute("data-pinned-index") || "-1", 10) === _
324
+ );
325
+ if (!v)
326
+ return {
327
+ visible: !1,
328
+ position: { top: 0, left: 0 },
329
+ size: { width: 0, height: 0 }
330
+ };
331
+ const k = v.getBoundingClientRect(), z = t.getBoundingClientRect(), E = (o == null ? void 0 : o.offsetHeight) || 0, G = i == null ? void 0 : i.getBoundingClientRect(), N = k.right, M = Math.min(
332
+ z.bottom,
333
+ (G == null ? void 0 : G.bottom) || Number.MAX_SAFE_INTEGER
334
+ );
335
+ let q;
336
+ d && i && G ? q = G.top - z.top + E : q = E;
337
+ const j = z.top + q, Y = t.scrollWidth > t.clientWidth ? t.offsetHeight - t.clientHeight : 0, O = M - j - Y;
338
+ return {
339
+ visible: !0,
340
+ position: {
341
+ top: j,
342
+ left: N
343
+ },
344
+ size: {
345
+ width: we,
346
+ height: O
347
+ }
348
+ };
349
+ }, [
350
+ t,
351
+ l,
352
+ o,
353
+ i,
354
+ d,
355
+ u,
356
+ p,
357
+ b
358
+ ]), Kt = ({ enabled: t, rowCount: l }) => {
359
+ const o = H(/* @__PURE__ */ new Map()), i = H(/* @__PURE__ */ new Map()), d = x(
360
+ (a) => (n) => {
361
+ n ? o.current.set(a, n) : o.current.delete(a);
362
+ },
363
+ []
364
+ ), u = x(
365
+ (a) => (n) => {
366
+ n ? i.current.set(a, n) : i.current.delete(a);
367
+ },
368
+ []
369
+ ), p = x((a, n) => {
370
+ const c = `${a.offsetHeight}px`;
371
+ n.style.height !== c && (n.style.height = c);
372
+ }, []), b = x(() => {
373
+ o.current.forEach((a, n) => {
374
+ const c = i.current.get(n);
375
+ c && p(a, c);
376
+ });
377
+ }, [p]);
378
+ return P(() => {
379
+ if (!t)
380
+ return;
381
+ const a = new ResizeObserver((n) => {
382
+ requestAnimationFrame(() => {
383
+ n.forEach((c) => {
384
+ const _ = c.target, v = parseInt(_.dataset.rowIndex || "-1", 10), k = i.current.get(v);
385
+ k && v >= 0 && p(_, k);
386
+ });
387
+ });
388
+ });
389
+ return o.current.forEach((n) => a.observe(n)), () => a.disconnect();
390
+ }, [t, l, p]), et(() => {
391
+ t && b();
392
+ }, [t, l, b]), { setTableRowRef: d, setCheckboxRowRef: u, syncAllHeights: b };
393
+ }, Ot = {
394
+ "resize-handle": "_resize-handle_15uk3_1"
395
+ }, en = me.bind(Ot), tn = xt(
396
+ (t, l) => /* @__PURE__ */ h("div", { ref: l, className: en("resize-handle"), ...t, children: /* @__PURE__ */ h($t, {}) })
397
+ ), nn = {
398
+ "gradient-overlay": "_gradient-overlay_hx7m8_1",
399
+ "direction-right": "_direction-right_hx7m8_5",
400
+ "direction-left": "_direction-left_hx7m8_13"
401
+ }, rn = me.bind(nn), Ke = ({
402
+ portalContainer: t,
403
+ visible: l,
404
+ position: o,
405
+ size: i,
406
+ direction: d,
407
+ className: u,
408
+ dataTestId: p
409
+ }) => {
410
+ if (!l || !t)
411
+ return null;
412
+ const b = {
413
+ position: "fixed",
414
+ top: `${o.top}px`,
415
+ width: `${i.width}px`,
416
+ height: `${i.height}px`
417
+ };
418
+ return o.left !== void 0 && (b.left = `${o.left}px`), o.right !== void 0 && (b.right = `${o.right}px`), Wt(
419
+ /* @__PURE__ */ h(
420
+ "div",
421
+ {
422
+ className: rn("gradient-overlay", `direction-${d}`, u),
423
+ style: b,
424
+ "data-gradient-type": p
425
+ }
426
+ ),
427
+ t
428
+ );
429
+ }, f = me.bind(Ut), Oe = ({ column: t }) => {
430
+ const l = H(null), [o, i] = B(!1);
431
+ return P(() => {
432
+ if (l.current) {
433
+ const d = l.current.offsetWidth, u = l.current.scrollWidth;
434
+ i(u > d);
435
+ }
436
+ }, [t.header]), /* @__PURE__ */ h("span", { ref: l, title: o ? t.header : void 0, children: t.header });
437
+ }, _n = ({
438
+ data: t,
439
+ primaryColumn: l,
440
+ fixedColumns: o,
441
+ renderRowActions: i,
442
+ className: d = "",
443
+ wrapperClassName: u = "",
444
+ rowClassName: p = "",
445
+ headerClassName: b = "",
446
+ bodyClassName: a = "",
447
+ selectable: n = !1,
448
+ selectedRowIds: c = [],
449
+ sortingDirection: _ = nt,
450
+ sortingColumn: v,
451
+ sortableColumns: k,
452
+ isHeaderFixed: z = !1,
453
+ isHorizontallyScrollable: E = !1,
454
+ pinnedColumnKeys: G = [],
455
+ isRowsExpandable: N = !1,
456
+ expandedRowIds: M = [],
457
+ isAllExpandedByDefault: q,
458
+ expandAllTooltip: j,
459
+ isResizable: $ = !1,
460
+ minColumnWidth: Y = 50,
461
+ maxColumnWidth: O = 500,
462
+ isSelectAllCheckboxAlwaysVisible: J = !1,
463
+ isCheckboxOutside: L = !1,
464
+ onChangeSorting: st = () => {
465
+ },
466
+ onToggleRowSelection: ot = () => {
467
+ },
468
+ onToggleAllRowsSelection: ct = () => {
469
+ },
470
+ onToggleRowExpansion: lt = () => {
471
+ },
472
+ onToggleAllRowsExpansion: it = () => {
473
+ },
474
+ onColumnResize: at = () => {
475
+ },
476
+ externalScrollContainerRef: y,
477
+ portalContainer: ke = typeof document < "u" ? document.body : null,
478
+ rightGradientClassName: dt,
479
+ pinnedGradientClassName: ht
480
+ }) => {
481
+ const ee = de(
482
+ () => Array.isArray(l) ? l : [l],
483
+ [l]
484
+ ), S = v ?? ee[0], te = k ?? jt([...ee, ...o]), { pinnedColumns: U, scrollableColumns: ne } = Rt({
485
+ primaryColumns: ee,
486
+ fixedColumns: o,
487
+ pinnedColumnKeys: G
488
+ }), {
489
+ hoveredColumn: Ee,
490
+ hoveredRow: Te,
491
+ handleColumnMouseEnter: Le,
492
+ handleColumnMouseLeave: Ne,
493
+ handleRowMouseEnter: ze,
494
+ handleRowMouseLeave: xe
495
+ } = Vt(), { columnWidthsRef: Q, setCellRef: Ae } = Yt(), { handleToggleRowExpansion: pt, isCellExpanded: $e } = Ct({
496
+ primaryColumns: ee,
497
+ fixedColumns: o,
498
+ expandedRowIds: M,
499
+ onToggleRowExpansion: lt
500
+ }), { columnWidths: re, handleResize: ut, handleResizeStop: ft, handleResizeStart: _t } = Jt({
501
+ enabled: $,
502
+ minWidth: Y,
503
+ maxWidth: O,
504
+ columnWidthsRef: Q,
505
+ onColumnResize: at
506
+ }), { setTableRowRef: gt, setCheckboxRowRef: vt } = Kt({
507
+ enabled: n && L,
508
+ rowCount: t.length
509
+ }), Me = (e, s) => /* @__PURE__ */ h(
510
+ At,
511
+ {
512
+ width: re[e.key] ?? (typeof e.width == "number" ? e.width : Y),
513
+ height: 0,
514
+ axis: "x",
515
+ handle: /* @__PURE__ */ h(tn, {}),
516
+ onResizeStart: _t,
517
+ onResize: ut(e.key),
518
+ onResizeStop: ft(e.key),
519
+ minConstraints: [Y, 0],
520
+ maxConstraints: [O, 0],
521
+ className: f("resizable-column"),
522
+ children: s
523
+ },
524
+ e.key
525
+ ), T = H(null), D = H(null), bt = H(null), Z = H(null), he = H(null), [I, yt] = B(!1), se = x((e) => {
526
+ const s = D.current;
527
+ if (s && s.contains(e))
528
+ return;
529
+ const r = e.parentElement;
530
+ if (!r)
531
+ return;
532
+ const g = window.getComputedStyle(r), w = parseFloat(g.paddingTop) || 0, m = parseFloat(g.paddingBottom) || 0, W = e.offsetHeight + w + m;
533
+ e.style.setProperty("--expand-cell-top", `${w}px`), e.style.setProperty("--expand-cell-height", `${W}px`);
534
+ }, []), [He, pe] = B(0), [We, ue] = B(0), [Pe, fe] = B(0), [Be, Ge] = B(0), oe = H(!1), _e = H(/* @__PURE__ */ new Set()), K = H(null), ge = Qt(
535
+ T.current,
536
+ D.current,
537
+ (y == null ? void 0 : y.current) instanceof HTMLElement ? y.current : null,
538
+ I,
539
+ He,
540
+ We,
541
+ Pe,
542
+ Be
543
+ ), ve = Zt(
544
+ T.current,
545
+ He,
546
+ D.current,
547
+ (y == null ? void 0 : y.current) instanceof HTMLElement ? y.current : null,
548
+ I,
549
+ We,
550
+ Pe,
551
+ Be
552
+ ), Se = (e) => {
553
+ te.includes(e) && st({ key: e, direction: _ });
554
+ }, Fe = (e) => {
555
+ ot(e);
556
+ }, qe = () => {
557
+ ct();
558
+ }, wt = () => {
559
+ it();
560
+ }, Ue = (e) => te.includes(e) ? (S == null ? void 0 : S.key) === e ? Xt(_) ? /* @__PURE__ */ h(Je, {}) : /* @__PURE__ */ h(Mt, {}) : /* @__PURE__ */ h(Je, {}) : null, De = t.every((e) => c.includes(e.id)), Xe = t.some((e) => c.includes(e.id)), be = (c == null ? void 0 : c.length) > 0, mt = !Pt(t), je = J && mt || be, kt = t.every((e) => M.includes(e.id)), Et = q !== void 0 ? q : kt, Tt = Ze(
561
+ U,
562
+ ne,
563
+ N,
564
+ n,
565
+ !!i,
566
+ !1,
567
+ $ ? re : void 0,
568
+ $,
569
+ L
570
+ ), Lt = Ze(
571
+ U,
572
+ ne,
573
+ N,
574
+ n,
575
+ !!i,
576
+ !0,
577
+ $ ? re : void 0,
578
+ $,
579
+ L
580
+ ), Ie = /* @__PURE__ */ h("button", { onClick: wt, "aria-label": "Toggle all rows expansion", children: /* @__PURE__ */ h("span", { className: f("expand-icon", { expanded: Et }), children: /* @__PURE__ */ h(Ye, {}) }) });
581
+ P(() => {
582
+ if (!(y != null && y.current) || !T.current || !D.current)
583
+ return;
584
+ const e = y.current, s = T.current, r = D.current, g = he.current, w = () => {
585
+ const A = s.getBoundingClientRect(), W = e.getBoundingClientRect(), R = r.offsetHeight, X = A.top - W.top, ce = A.bottom - W.top, Ve = e.scrollTop > 0 && X <= 0 && ce > R;
586
+ if (yt(Ve), Ve) {
587
+ const le = A.left, Ce = W.top;
588
+ r.classList.add(f("pinned-header")), E && (r.style.overflow = "hidden", r.style.overflowX = "hidden"), r.style.left = `${le}px`, r.style.top = `${Ce}px`, r.style.width = `${A.width}px`, g && L && (g.style.top = `${Ce}px`);
589
+ } else {
590
+ const le = s.scrollLeft;
591
+ oe.current = !0, r.classList.remove(f("pinned-header")), E && (r.scrollLeft = 0), r.style.left = "", r.style.top = "", r.style.width = "", E && (r.style.overflow = "", r.style.overflowX = ""), g && L && (g.style.top = "", g.classList.remove(f("pinned-header"))), E && le > 0 ? requestAnimationFrame(() => {
592
+ s.scrollLeft = le, setTimeout(() => {
593
+ oe.current = !1;
594
+ }, 0);
595
+ }) : oe.current = !1;
596
+ }
597
+ }, m = requestAnimationFrame(() => {
598
+ w();
599
+ });
600
+ return e.addEventListener("scroll", w), window.addEventListener("resize", w), () => {
601
+ cancelAnimationFrame(m), e.removeEventListener("scroll", w), window.removeEventListener("resize", w);
602
+ };
603
+ }, [y, E, L]), P(() => {
604
+ if (!(y != null && y.current) || !T.current || !D.current || !I)
605
+ return;
606
+ const e = y.current, s = T.current, r = D.current, g = he.current, w = () => {
607
+ const X = s.getBoundingClientRect(), ce = e.getBoundingClientRect();
608
+ r.style.left = `${X.left}px`, r.style.top = `${ce.top}px`, r.style.width = `${X.width}px`, g && L && (g.style.top = `${ce.top}px`);
609
+ }, m = (X) => {
610
+ oe.current || (X === r ? s.scrollLeft = r.scrollLeft : r.scrollLeft = s.scrollLeft, K.current && K.current());
611
+ }, A = () => {
612
+ m(s), w();
613
+ }, W = () => {
614
+ m(r);
615
+ }, R = () => {
616
+ w();
617
+ };
618
+ return s.addEventListener("scroll", A), E && r.addEventListener("scroll", W), e.addEventListener("scroll", R), window.addEventListener("resize", w), m(s), w(), () => {
619
+ s.removeEventListener("scroll", A), E && r.removeEventListener("scroll", W), e.removeEventListener("scroll", R), window.removeEventListener("resize", w);
620
+ };
621
+ }, [I, y, E, L]), P(() => {
622
+ if (!T.current || !E)
623
+ return;
624
+ const e = T.current, s = y == null ? void 0 : y.current;
625
+ pe(e.scrollLeft), ue((s == null ? void 0 : s.scrollTop) || e.scrollTop || 0), fe(e.scrollWidth);
626
+ const r = () => {
627
+ e && (pe(e.scrollLeft), ue((s == null ? void 0 : s.scrollTop) || e.scrollTop || 0), fe(e.scrollWidth));
628
+ };
629
+ let g = null;
630
+ const w = () => {
631
+ g === null && (g = requestAnimationFrame(() => {
632
+ r(), g = null;
633
+ }));
634
+ }, m = () => {
635
+ w();
636
+ }, A = () => {
637
+ w();
638
+ };
639
+ e.addEventListener("scroll", m, { passive: !0 }), s && s.addEventListener("scroll", A, {
640
+ passive: !0
641
+ });
642
+ const W = () => {
643
+ r(), Ge((X) => X + 1);
644
+ };
645
+ window.addEventListener("resize", W), K.current = r, r();
646
+ const R = new ResizeObserver(() => {
647
+ r();
648
+ });
649
+ return e && R.observe(e), () => {
650
+ e.removeEventListener("scroll", m), s && s.removeEventListener("scroll", A), window.removeEventListener("resize", W), R.disconnect(), g !== null && (cancelAnimationFrame(g), g = null);
651
+ };
652
+ }, [E, y, I, M]), P(() => {
653
+ if (!T.current || !E)
654
+ return;
655
+ const e = T.current, s = y == null ? void 0 : y.current;
656
+ requestAnimationFrame(() => {
657
+ e && (pe(e.scrollLeft), ue((s == null ? void 0 : s.scrollTop) || e.scrollTop || 0), fe(e.scrollWidth), K.current && K.current());
658
+ });
659
+ }, [re, E, y]), P(() => {
660
+ if (!T.current)
661
+ return;
662
+ const e = T.current, s = () => {
663
+ Array.from(e.querySelectorAll('[data-base-left="0"]')).forEach(se);
664
+ };
665
+ requestAnimationFrame(() => {
666
+ s();
667
+ });
668
+ }, [N, t, se]), P(() => {
669
+ if (!T.current)
670
+ return;
671
+ const e = T.current, s = new Set(M), r = _e.current, g = /* @__PURE__ */ new Set();
672
+ if (M.forEach((m) => {
673
+ r.has(m) || g.add(m);
674
+ }), r.forEach((m) => {
675
+ s.has(m) || g.add(m);
676
+ }), g.size === 0) {
677
+ _e.current = s;
678
+ return;
679
+ }
680
+ const w = setTimeout(() => {
681
+ g.forEach((m) => {
682
+ const A = e.querySelector(
683
+ `[data-base-left="0"][data-row-id="${m}"]`
684
+ );
685
+ A && se(A);
686
+ }), Ge((m) => m + 1);
687
+ }, 0);
688
+ return _e.current = s, () => clearTimeout(w);
689
+ }, [N, M, se]), P(() => {
690
+ if (!Z.current || !T.current || !L)
691
+ return;
692
+ const e = Z.current, s = T.current, r = () => {
693
+ requestAnimationFrame(() => {
694
+ e.scrollTop = s.scrollTop;
695
+ });
696
+ };
697
+ return s.addEventListener("scroll", r), () => {
698
+ s.removeEventListener("scroll", r);
699
+ };
700
+ }, [t, L]), et(() => {
701
+ if (!T.current || !Z.current)
702
+ return;
703
+ const e = T.current, s = Z.current, r = () => {
704
+ const w = `${e.clientHeight}px`;
705
+ s.style.height !== w && (s.style.height = w);
706
+ };
707
+ r();
708
+ const g = new ResizeObserver(() => {
709
+ requestAnimationFrame(r);
710
+ });
711
+ return g.observe(e), () => g.disconnect();
712
+ }, []);
713
+ const Nt = () => /* @__PURE__ */ F("div", { className: f("checkbox-column"), ref: Z, children: [
714
+ /* @__PURE__ */ h(
715
+ "div",
716
+ {
717
+ ref: he,
718
+ className: f(
719
+ "table-header",
720
+ "checkbox-header",
721
+ { "pinned-header": I },
722
+ b
723
+ ),
724
+ children: je && /* @__PURE__ */ h(
725
+ ie,
726
+ {
727
+ value: De,
728
+ partiallyChecked: Xe,
729
+ onChange: qe,
730
+ className: f("checkbox-cell")
731
+ }
732
+ )
733
+ }
734
+ ),
735
+ /* @__PURE__ */ h("div", { className: f("checkbox-body", a), children: t.map((e, s) => /* @__PURE__ */ h(
736
+ "div",
737
+ {
738
+ ref: vt(s),
739
+ className: f("checkbox-row", "table-row", Qe(e), p),
740
+ onMouseEnter: () => ze(s),
741
+ onMouseLeave: xe,
742
+ children: (be || Te === s) && /* @__PURE__ */ h(
743
+ ie,
744
+ {
745
+ value: c.includes(e.id),
746
+ onChange: () => Fe(e.id),
747
+ className: f("checkbox-cell")
748
+ }
749
+ )
750
+ },
751
+ e.id
752
+ )) })
753
+ ] }), Re = () => /* @__PURE__ */ F(
754
+ "div",
755
+ {
756
+ ref: T,
757
+ className: f(
758
+ "table",
759
+ {
760
+ "fixed-header": z,
761
+ "horizontally-scrollable-container": z && (E || $),
762
+ "external-scroll-container": z && !!y
763
+ },
764
+ d
765
+ ),
766
+ children: [
767
+ /* @__PURE__ */ F(
768
+ "div",
769
+ {
770
+ ref: D,
771
+ className: f(
772
+ "table-header",
773
+ {
774
+ "sticky-header": z && !I,
775
+ "horizontally-scrollable": E,
776
+ resizable: $
777
+ },
778
+ b
779
+ ),
780
+ style: { gridTemplateColumns: Lt },
781
+ children: [
782
+ n && !L && /* @__PURE__ */ h(
783
+ "div",
784
+ {
785
+ className: f("table-header-cell", "checkbox-cell"),
786
+ "data-base-left": N ? C : 0,
787
+ children: je && /* @__PURE__ */ h(
788
+ ie,
789
+ {
790
+ value: De,
791
+ partiallyChecked: Xe,
792
+ onChange: qe,
793
+ className: f("checkbox-cell")
794
+ }
795
+ )
796
+ }
797
+ ),
798
+ N && /* @__PURE__ */ h(
799
+ "div",
800
+ {
801
+ className: f("table-header-cell", "expand-cell", "left-border-accent"),
802
+ "data-base-left": "0",
803
+ children: j ? /* @__PURE__ */ h(
804
+ Ht,
805
+ {
806
+ content: j,
807
+ placement: "top",
808
+ wrapperClassName: f("expand-all-tooltip-wrapper"),
809
+ contentClassName: f("expand-all-tooltip-content"),
810
+ children: Ie
811
+ }
812
+ ) : Ie
813
+ }
814
+ ),
815
+ U.map((e, s) => {
816
+ const r = /* @__PURE__ */ h(
817
+ "button",
818
+ {
819
+ "data-column-key": e.key,
820
+ "data-pinned-index": s,
821
+ className: f("table-header-cell", "pinned-column", {
822
+ [`align-${e.align}`]: "align" in e,
823
+ "primary-cell": V(e),
824
+ "sortable-cell": te.includes(e.key),
825
+ resizable: $
826
+ }),
827
+ style: ae(
828
+ e,
829
+ !0,
830
+ s,
831
+ U,
832
+ Q,
833
+ N,
834
+ n,
835
+ L
836
+ ),
837
+ children: /* @__PURE__ */ F(
838
+ "div",
839
+ {
840
+ className: f("label"),
841
+ onClick: () => Se(e.key),
842
+ onMouseEnter: () => Le(e.key),
843
+ onMouseLeave: Ne,
844
+ children: [
845
+ /* @__PURE__ */ h(Oe, { column: e }),
846
+ (Ee === e.key || (S == null ? void 0 : S.key) === e.key) && Ue(e.key)
847
+ ]
848
+ }
849
+ )
850
+ },
851
+ e.key
852
+ );
853
+ return $ ? Me(e, r) : r;
854
+ }),
855
+ ne.map((e) => {
856
+ const s = /* @__PURE__ */ h(
857
+ "button",
858
+ {
859
+ className: f("table-header-cell", {
860
+ [`align-${e.align}`]: "align" in e,
861
+ "primary-cell": V(e),
862
+ "sortable-cell": te.includes(e.key),
863
+ resizable: $
864
+ }),
865
+ style: ae(
866
+ e,
867
+ !1,
868
+ void 0,
869
+ U,
870
+ Q,
871
+ N,
872
+ n,
873
+ L
874
+ ),
875
+ children: /* @__PURE__ */ F(
876
+ "div",
877
+ {
878
+ className: f("label"),
879
+ onClick: () => Se(e.key),
880
+ onMouseEnter: () => Le(e.key),
881
+ onMouseLeave: Ne,
882
+ children: [
883
+ /* @__PURE__ */ h(Oe, { column: e }),
884
+ (Ee === e.key || (S == null ? void 0 : S.key) === e.key) && Ue(e.key)
885
+ ]
886
+ }
887
+ )
888
+ },
889
+ e.key
890
+ );
891
+ return $ ? Me(e, s) : s;
892
+ }),
893
+ i && /* @__PURE__ */ h("div", { className: f("table-header-cell", "action-menu-cell") })
894
+ ]
895
+ }
896
+ ),
897
+ /* @__PURE__ */ h(
898
+ "div",
899
+ {
900
+ ref: bt,
901
+ className: f(
902
+ "table-body",
903
+ {
904
+ "scrollable-body": z,
905
+ "horizontally-scrollable": E,
906
+ resizable: $
907
+ },
908
+ a
909
+ ),
910
+ children: t.map((e, s) => /* @__PURE__ */ F(
911
+ "div",
912
+ {
913
+ "data-row-index": s,
914
+ ref: gt(s),
915
+ className: f("table-row", Qe(e), p, {
916
+ selectable: n && !L
917
+ }),
918
+ onMouseEnter: () => ze(s),
919
+ onMouseLeave: xe,
920
+ children: [
921
+ n && !L && /* @__PURE__ */ h(
922
+ "div",
923
+ {
924
+ className: f("table-cell", "checkbox-cell"),
925
+ "data-base-left": N ? C : 0,
926
+ children: (be || Te === s) && /* @__PURE__ */ h(
927
+ ie,
928
+ {
929
+ value: c.includes(e.id),
930
+ onChange: () => Fe(e.id),
931
+ className: f("checkbox-cell")
932
+ }
933
+ )
934
+ }
935
+ ),
936
+ /* @__PURE__ */ h("div", { className: f("row-content-wrapper"), children: /* @__PURE__ */ F("div", { className: f("table-row-content"), style: { gridTemplateColumns: Tt }, children: [
937
+ N && /* @__PURE__ */ h(
938
+ "div",
939
+ {
940
+ className: f("table-cell", "expand-cell", "left-border-accent"),
941
+ "data-base-left": "0",
942
+ "data-row-id": e.id,
943
+ children: /* @__PURE__ */ h(
944
+ "button",
945
+ {
946
+ onClick: () => pt(e.id),
947
+ "aria-label": M.includes(e.id) ? "Collapse row" : "Expand row",
948
+ "aria-expanded": M.includes(e.id),
949
+ children: /* @__PURE__ */ h(
950
+ "span",
951
+ {
952
+ className: f("expand-icon", {
953
+ expanded: M.includes(e.id)
954
+ }),
955
+ children: /* @__PURE__ */ h(Ye, {})
956
+ }
957
+ )
958
+ }
959
+ )
960
+ }
961
+ ),
962
+ U.map((r, g) => {
963
+ const w = $e(e.id, r.key), m = V(r);
964
+ return /* @__PURE__ */ h(
965
+ "div",
966
+ {
967
+ "data-column-key": r.key,
968
+ "data-pinned-index": g,
969
+ ref: m ? Ae(r.key) : void 0,
970
+ className: f("table-cell", "pinned-column", {
971
+ "primary-cell": m,
972
+ "expanded-cell": w
973
+ }),
974
+ style: ae(
975
+ r,
976
+ !0,
977
+ g,
978
+ U,
979
+ Q,
980
+ N,
981
+ n,
982
+ L
983
+ ),
984
+ children: e[r.key].component || e[r.key].content || e[r.key]
985
+ },
986
+ r.key
987
+ );
988
+ }),
989
+ ne.map((r) => {
990
+ const g = $e(e.id, r.key), w = V(r);
991
+ return /* @__PURE__ */ h(
992
+ "div",
993
+ {
994
+ ref: w ? Ae(r.key) : void 0,
995
+ className: f("table-cell", {
996
+ "primary-cell": w,
997
+ "expanded-cell": g
998
+ }),
999
+ style: ae(
1000
+ r,
1001
+ !1,
1002
+ void 0,
1003
+ U,
1004
+ Q,
1005
+ N,
1006
+ n,
1007
+ L
1008
+ ),
1009
+ children: e[r.key].component || e[r.key].content || e[r.key]
1010
+ },
1011
+ r.key
1012
+ );
1013
+ }),
1014
+ i && /* @__PURE__ */ h("div", { className: f("table-cell", "action-menu-cell"), children: i(e.metaData) })
1015
+ ] }) })
1016
+ ]
1017
+ },
1018
+ e.id
1019
+ ))
1020
+ }
1021
+ ),
1022
+ E && /* @__PURE__ */ F(zt, { children: [
1023
+ /* @__PURE__ */ h(
1024
+ Ke,
1025
+ {
1026
+ portalContainer: ke,
1027
+ visible: ge.visible,
1028
+ position: ge.position,
1029
+ size: ge.size,
1030
+ direction: "right",
1031
+ className: dt,
1032
+ dataTestId: "right-gradient"
1033
+ }
1034
+ ),
1035
+ /* @__PURE__ */ h(
1036
+ Ke,
1037
+ {
1038
+ portalContainer: ke,
1039
+ visible: ve.visible,
1040
+ position: ve.position,
1041
+ size: ve.size,
1042
+ direction: "left",
1043
+ className: ht,
1044
+ dataTestId: "pinned-gradient"
1045
+ }
1046
+ )
1047
+ ] })
1048
+ ]
1049
+ }
1050
+ );
1051
+ return L ? /* @__PURE__ */ F("div", { className: f("table-wrapper", { "fixed-header": z }, u), children: [
1052
+ Nt(),
1053
+ Re()
1054
+ ] }) : Re();
1055
+ };
1056
+ export {
1057
+ _n as T
1058
+ };