@reportportal/ui-kit 0.0.1-alpha.236 → 0.0.1-alpha.238

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