@reportportal/ui-kit 0.0.1-alpha.151 → 0.0.1-alpha.152

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