@reportportal/ui-kit 0.0.1-alpha.249 → 0.0.1-alpha.250

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