@baishuyun/ui-base 6.28.2 → 6.29.1

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.
Files changed (45) hide show
  1. package/dist/Amap/index.js +1 -1
  2. package/dist/Calendar/{Calendar-DPF0ecD9.js → Calendar-cXOw65UG.js} +1 -1
  3. package/dist/Calendar/index.js +3 -3
  4. package/dist/Card/index.js +1 -1
  5. package/dist/CheckBox/index.js +1 -1
  6. package/dist/ColorPicker/index.js +1 -1
  7. package/dist/ConfigProvider/index.js +1 -1
  8. package/dist/DatePicker/{DatePicker-Hn_P6uYt.js → DatePicker-TimXurVT.js} +1 -1
  9. package/dist/DatePicker/{DatePickerPanel-Bl83l0FK.js → DatePickerPanel-CfnP7Cpa.js} +1 -1
  10. package/dist/DatePicker/index.js +2 -2
  11. package/dist/DropDown/index.js +1 -1
  12. package/dist/Editor/index.js +1 -1
  13. package/dist/FieldCard/index.js +1 -1
  14. package/dist/Gantt/index.js +2 -2
  15. package/dist/Icon/index.js +1 -1
  16. package/dist/InputTag/index.js +1 -1
  17. package/dist/Kanban/index.js +1 -1
  18. package/dist/Loading/index.js +1 -1
  19. package/dist/Modal/index.js +1 -1
  20. package/dist/NotFoundContent/index.js +1 -1
  21. package/dist/Overlay/index.js +1 -1
  22. package/dist/Radio/index.js +1 -1
  23. package/dist/ScrollBar/index.js +1 -1
  24. package/dist/Segmented/index.js +1 -1
  25. package/dist/Select/index.js +1 -1
  26. package/dist/Table/Table-BMqJZqBK.js +1169 -0
  27. package/dist/Table/index.js +4 -3
  28. package/dist/Tabs/index.js +1 -1
  29. package/dist/Tooltip/index.js +1 -1
  30. package/dist/Tree/index.js +1 -1
  31. package/dist/components/Table/HierarchyCell/HierarchyCell.d.ts +3 -0
  32. package/dist/components/Table/HierarchyCell/hierarchyTreeLayout.d.ts +27 -0
  33. package/dist/components/Table/HierarchyCell/index.d.ts +4 -0
  34. package/dist/components/Table/HierarchyCell/interface.d.ts +46 -0
  35. package/dist/components/Table/components/TableBody.d.ts +1 -40
  36. package/dist/components/Table/hooks/useTableVirtual.d.ts +5 -1
  37. package/dist/components/Table/index.d.ts +3 -2
  38. package/dist/components/Table/interface.d.ts +39 -0
  39. package/dist/components/Table/utils/tableUtils.d.ts +1 -1
  40. package/dist/components/index.d.ts +2 -1
  41. package/dist/index.js +6 -6
  42. package/dist/style.css +1 -1
  43. package/dist/vendors/{version-C6z7Jrt6.js → version-Foao691n.js} +1 -1
  44. package/package.json +1 -1
  45. package/dist/Table/Table-Cfj7bTb2.js +0 -881
@@ -0,0 +1,1169 @@
1
+ import { t as e } from "../Icon/Icon-CcKDWNGy.js";
2
+ import { t } from "../vendors/useLocale-3oUjPb-k.js";
3
+ import { t as n } from "../vendors/cssVars-UpriQzph.js";
4
+ import { LoadingOutlined as r } from "@ant-design/icons";
5
+ import { clamp as i, groupBy as a, sumBy as o } from "lodash-es";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import l, { forwardRef as u, memo as d, useCallback as f, useEffect as p, useImperativeHandle as m, useLayoutEffect as h, useMemo as g, useRef as _, useState as v } from "react";
8
+ import y from "clsx";
9
+ import { useEventListener as b, useLatest as x, useMemoizedFn as S, useSize as C } from "ahooks";
10
+ import { useOverlayScrollbars as w } from "overlayscrollbars-react";
11
+ import { useVirtualizer as T } from "@tanstack/react-virtual";
12
+ //#region src/components/Table/constants.ts
13
+ var E = {
14
+ ROW_HEIGHT: 34,
15
+ HEADER_HEIGHT: 34,
16
+ EMPTY_TEXT_KEY: "table.empty"
17
+ }, D = {
18
+ MIN_HEIGHT: 34,
19
+ MAX_HEIGHT: 200
20
+ }, O = {
21
+ DEFAULT_OVERSCAN: 10,
22
+ ENABLE_AUTO_SIZE: 40
23
+ }, k = {
24
+ DEFAULT_WIDTH: 120,
25
+ MIN_WIDTH: 60,
26
+ MAX_WIDTH: 1e3
27
+ }, A = {
28
+ low: {
29
+ className: "bsy-row-height-low",
30
+ height: 34
31
+ },
32
+ middle: {
33
+ className: "bsy-row-height-middle",
34
+ height: 68
35
+ },
36
+ high: {
37
+ className: "bsy-row-height-high",
38
+ height: 106
39
+ },
40
+ auto: {
41
+ className: "bsy-row-height-auto",
42
+ height: "auto"
43
+ }
44
+ }, ee = {
45
+ ASC: "asc",
46
+ DESC: "desc",
47
+ NONE: null
48
+ }, j = {
49
+ wrapper: "custom-table-wrapper",
50
+ body: "custom-table-body"
51
+ }, M = (e = []) => e.flatMap((e) => e.children?.length ? e.children : [e]), N = (e, t) => t.findIndex((t) => e.isParent ? t.parentKey === e.key : t.key === e.key), P = (e, t, n, r = k.DEFAULT_WIDTH) => o(n === "left" ? t.slice(0, e) : t.slice(e + 1), (e) => e.width || r), F = (e, t, n) => n !== "left" && n !== "right" ? null : {
52
+ position: "sticky",
53
+ [n]: P(e, t, n),
54
+ zIndex: 2
55
+ }, te = (e, t, n, r) => {
56
+ if (!t || !n) return e;
57
+ let i = n === ee.DESC ? -1 : 1;
58
+ return [...e].sort((e, n) => {
59
+ let a = e[t], o = n[t];
60
+ return r ? r(a, o, e, n) * i : a === o ? 0 : a == null ? 1 : o == null ? -1 : typeof a == "string" && typeof o == "string" ? a.localeCompare(o) * i : (a < o ? -1 : 1) * i;
61
+ });
62
+ }, I = (e, t = "id", n) => {
63
+ if (!e) return n;
64
+ let r = e[t];
65
+ if (typeof r == "string" || typeof r == "number") return r;
66
+ let i = e.uniqueId ?? e._id ?? e.id;
67
+ return typeof i == "string" || typeof i == "number" ? i : n;
68
+ }, ne = (e) => {
69
+ let t = [], n = [], r = [];
70
+ return e.forEach((e, i) => {
71
+ let a = {
72
+ ...e,
73
+ index: i
74
+ };
75
+ e.fixed === "left" ? t.push(a) : e.fixed === "right" ? r.push(a) : n.push(a);
76
+ }), {
77
+ leftFixedColumns: t,
78
+ normalColumns: n,
79
+ rightFixedColumns: r
80
+ };
81
+ }, L = (e, t = k.DEFAULT_WIDTH) => o(e, (e) => e.children?.length ? o(e.children, (e) => e.width || t) : e.width || t), re = (e, t) => {
82
+ if (Object.keys(t).length === 0) return e;
83
+ let n = (e) => {
84
+ let r = !1, i = e.map((e) => {
85
+ let i = e.children?.length ? n(e.children) : e.children, a = t[e.key];
86
+ return i === e.children && (a === void 0 || a === e.width) ? e : (r = !0, {
87
+ ...e,
88
+ ...i === e.children ? null : { children: i },
89
+ ...a === void 0 ? null : { width: a }
90
+ });
91
+ });
92
+ return r ? i : e;
93
+ };
94
+ return n(e);
95
+ }, ie = (e, t) => {
96
+ let n = ne(e), r = L(e);
97
+ return {
98
+ ...n,
99
+ fixedLeftWidth: L(n.leftFixedColumns),
100
+ fixedRightWidth: L(n.rightFixedColumns),
101
+ totalColumnsWidth: r,
102
+ needSpacer: r < t
103
+ };
104
+ }, ae = Object.freeze({}), oe = d(({ column: e, style: t = ae, className: n = "", onResizeStart: r, isResizing: i = !1, resizable: a = !0, colSpan: o = 1, rowSpan: l = 1 }) => {
105
+ let u = _(null), d = _(null);
106
+ p(() => () => {
107
+ d.current?.(), d.current = null;
108
+ }, []);
109
+ let m = f((e) => {
110
+ u.current?.triggerClick?.(e);
111
+ }, []), h = f((t) => {
112
+ if (!a || !r) return;
113
+ t.preventDefault(), t.stopPropagation(), d.current?.();
114
+ let n = null, i = (e) => {
115
+ e.preventDefault(), e.stopPropagation();
116
+ }, o = () => {
117
+ document.removeEventListener("click", i, !0), d.current = null, n !== null && (clearTimeout(n), n = null);
118
+ }, s = () => {
119
+ n = setTimeout(o, 0);
120
+ };
121
+ document.addEventListener("click", i, !0), document.addEventListener("mouseup", s, { once: !0 }), d.current = () => {
122
+ document.removeEventListener("mouseup", s), o();
123
+ }, r(e.key, e.width || k.DEFAULT_WIDTH, t.clientX);
124
+ }, [
125
+ e.key,
126
+ e.width,
127
+ a,
128
+ r
129
+ ]), g = typeof e.header == "function" ? e.header(e, { menuRef: u }) : e.title;
130
+ return /* @__PURE__ */ c("th", {
131
+ className: `custom-table-header-cell ${n} `,
132
+ style: t,
133
+ colSpan: o > 1 ? o : void 0,
134
+ rowSpan: l > 1 ? l : void 0,
135
+ onClick: m,
136
+ children: [/* @__PURE__ */ s("div", {
137
+ className: "header-cell-content",
138
+ children: g
139
+ }), a ? /* @__PURE__ */ s("div", {
140
+ className: `resize-handle ${i ? "resizing" : ""}`,
141
+ onMouseDown: h
142
+ }) : null]
143
+ });
144
+ });
145
+ oe.displayName = "HeaderCell";
146
+ //#endregion
147
+ //#region src/components/Table/utils/flattenColumns.ts
148
+ var se = (e) => {
149
+ let t = [], n = [], r = (e, i = 0, a = null) => {
150
+ t[i] || (t[i] = []), e.forEach((e) => {
151
+ let o = e.children, s = e.fixed || a || void 0;
152
+ if (o && o.length > 0) t[i].push({
153
+ ...e,
154
+ colSpan: o.length,
155
+ rowSpan: 1,
156
+ isParent: !0,
157
+ fixed: s
158
+ }), r(o, i + 1, s || null);
159
+ else {
160
+ let r = i + 1, a = {
161
+ ...e,
162
+ colSpan: 1,
163
+ rowSpan: r,
164
+ isLeaf: !0,
165
+ fixed: s
166
+ };
167
+ t[i].push(a), n.push(a);
168
+ }
169
+ });
170
+ };
171
+ r(e);
172
+ let i = [], a = t.length;
173
+ for (let t = 0; t < a; t++) {
174
+ let n = [], r = (e, i = 0, o = null) => {
175
+ e.forEach((e) => {
176
+ let s = e.children, c = e.fixed || o || void 0;
177
+ s && s.length > 0 ? i === t ? n.push({
178
+ ...e,
179
+ colSpan: s.length,
180
+ rowSpan: 1,
181
+ isParent: !0,
182
+ fixed: c
183
+ }) : i < t && r(s, i + 1, c || null) : i === t && n.push({
184
+ ...e,
185
+ colSpan: 1,
186
+ rowSpan: a - i,
187
+ isLeaf: !0,
188
+ fixed: c
189
+ });
190
+ });
191
+ };
192
+ r(e), i.push(n);
193
+ }
194
+ return {
195
+ flatColumns: n,
196
+ headerRows: i
197
+ };
198
+ }, R = Object.freeze([]), ce = Object.freeze([]), z = u(({ columns: e = R, enableFixed: t = !1, height: n = E.HEADER_HEIGHT, resizingColumn: r = null, onResizeStart: i, resizable: a = !0, disabledResizeColumns: o = ce, totalColumnsWidth: l = 0, needSpacer: u = !1, headerRowSpan: d = 1 }, f) => {
199
+ let p = e.some((e) => !!(e.children && e.children.length > 0)), { flatColumns: m, headerRows: h } = g(() => {
200
+ if (p) return se(e);
201
+ let t = Math.max(1, d || 1);
202
+ if (t > 1) {
203
+ let n = [e.map((e) => ({
204
+ ...e,
205
+ colSpan: 1,
206
+ rowSpan: t,
207
+ isLeaf: !0
208
+ }))];
209
+ for (let e = 1; e < t; e++) n.push([]);
210
+ return {
211
+ flatColumns: e,
212
+ headerRows: n
213
+ };
214
+ }
215
+ return {
216
+ flatColumns: e,
217
+ headerRows: [e]
218
+ };
219
+ }, [
220
+ e,
221
+ p,
222
+ d
223
+ ]), _ = g(() => new Set(o), [o]), v = g(() => {
224
+ let e = /* @__PURE__ */ new Map(), t = m.length - 1, n = /* @__PURE__ */ new Map();
225
+ m.forEach((e, t) => {
226
+ n.set(e.key, t);
227
+ });
228
+ let r = /* @__PURE__ */ new Set();
229
+ return h.forEach((i) => {
230
+ i.forEach((i) => {
231
+ if (r.has(i.key)) return;
232
+ r.add(i.key);
233
+ let a = i.isParent ? m.findIndex((e) => e.parentKey === i.key) : n.get(i.key) ?? -1, o = i.align || "left", s = _.has(i.key), c = {
234
+ textAlign: o,
235
+ ...F(a, m, i.fixed)
236
+ }, l = `custom-table-header-cell ${i.className || ""}`.trim();
237
+ i.fixed === "left" && (l += " fixed-left"), i.fixed === "right" && (l += " fixed-right"), a === 0 && (l += " first");
238
+ let u = a === t;
239
+ if (i.isParent) {
240
+ let e = -1;
241
+ for (let t = 0; t < m.length; t++) m[t].parentKey === i.key && (e = t);
242
+ u = e === t;
243
+ }
244
+ u && (l += " last"), e.set(i.key, {
245
+ style: c,
246
+ className: l,
247
+ isDisabled: s
248
+ });
249
+ });
250
+ }), e;
251
+ }, [
252
+ m,
253
+ h,
254
+ _
255
+ ]), y = (e) => {
256
+ let t = v.get(e.key) || {
257
+ style: { textAlign: e.align || "left" },
258
+ className: `custom-table-header-cell ${e.className || ""}`.trim(),
259
+ isDisabled: _.has(e.key)
260
+ };
261
+ return /* @__PURE__ */ s(oe, {
262
+ column: e,
263
+ style: t.style,
264
+ className: t.className,
265
+ onResizeStart: i,
266
+ isResizing: r === e.key,
267
+ resizable: a && !e.children && !t.isDisabled,
268
+ colSpan: e.colSpan,
269
+ rowSpan: e.rowSpan
270
+ }, e.key);
271
+ };
272
+ return /* @__PURE__ */ s("div", {
273
+ ref: f,
274
+ className: "custom-table-header",
275
+ style: g(() => {
276
+ let e = { minWidth: l };
277
+ return t && (e.position = "sticky", e.top = 0, e.zIndex = 11), e;
278
+ }, [t, l]),
279
+ children: /* @__PURE__ */ c("table", {
280
+ style: {
281
+ tableLayout: "fixed",
282
+ minWidth: l,
283
+ width: u ? "100%" : l
284
+ },
285
+ children: [/* @__PURE__ */ c("colgroup", { children: [m.map((e) => /* @__PURE__ */ s("col", { style: { width: e.width || k.DEFAULT_WIDTH } }, e.key)), u ? /* @__PURE__ */ s("col", {
286
+ className: "spacer-col",
287
+ style: { width: "auto" }
288
+ }) : null] }), /* @__PURE__ */ s("thead", { children: h.map((e, t) => e.length === 0 ? /* @__PURE__ */ s("tr", { style: { height: n } }, t) : /* @__PURE__ */ c("tr", {
289
+ style: { height: p || d > 1 ? n : "auto" },
290
+ children: [e.map((e) => y(e)), u && t === 0 ? /* @__PURE__ */ s("th", {
291
+ className: "custom-table-header-cell spacer-cell",
292
+ rowSpan: h.length
293
+ }) : null]
294
+ }, t)) })]
295
+ })
296
+ });
297
+ });
298
+ z.displayName = "TableHeader";
299
+ var le = d(z), ue = (e, t) => {
300
+ let n = t.name, r = t.children || [], i = 0;
301
+ for (let t = 0; t < e.length; t++) {
302
+ let a = e[t], o = Object.keys(a);
303
+ r.some((e) => {
304
+ let t = `${n}.${e.subformField || e.key}.`;
305
+ return o.some((e) => e.startsWith(t) && a[e] !== void 0 && a[e] !== "");
306
+ }) && (i = t + 1);
307
+ }
308
+ return i;
309
+ }, de = (e, t, n = "_id") => {
310
+ if (!e || e.length === 0) return [];
311
+ let r = t.filter((e) => !!(e.children && e.children.length > 0));
312
+ if (r.length === 0) return e.map((e) => ({
313
+ ...e,
314
+ _rowspan: {},
315
+ _showMainFields: !0
316
+ }));
317
+ let i = a(e, (e) => String(e[n] || e._id || e.id)), o = {};
318
+ Object.entries(i).forEach(([e, t]) => {
319
+ let n = {};
320
+ r.forEach((e) => {
321
+ n[e.name] = ue(t, e);
322
+ }), o[e] = {
323
+ groupSize: t.length,
324
+ subformRowCounts: n
325
+ };
326
+ });
327
+ let s = [], c = {};
328
+ return e.forEach((e) => {
329
+ let t = String(e[n] || e._id || e.id), i = o[t], a = c[t] ?? 0;
330
+ c[t] = a + 1;
331
+ let l = a === 0, u = {};
332
+ r.forEach((e) => {
333
+ u[e.key] = l ? i.groupSize : 0;
334
+ }), u._mainFields = l ? i.groupSize : 0, s.push({
335
+ ...e,
336
+ _rowspan: u,
337
+ _showMainFields: l,
338
+ _groupIndex: a,
339
+ _groupSize: i.groupSize,
340
+ _subformRowCounts: i.subformRowCounts
341
+ });
342
+ }), s;
343
+ }, B = (e, t) => {
344
+ if (t.parentKey) return 1;
345
+ if (e._rowspan && e._rowspan[t.key] !== void 0) {
346
+ let n = e._rowspan[t.key];
347
+ return n > 0 ? n : 0;
348
+ }
349
+ if (e._rowspan && e._rowspan._mainFields !== void 0) {
350
+ let t = e._rowspan._mainFields;
351
+ return t > 0 ? t : 0;
352
+ }
353
+ return 1;
354
+ }, V = (e, t) => B(e, t) > 0, H = (e, t, n) => {
355
+ let r = N(e, t), i = e.align || "left", a = F(r, t, n);
356
+ return {
357
+ column: e,
358
+ className: y("custom-table-cell", {
359
+ first: r === 0,
360
+ last: r >= 0 && r === t.length - 1,
361
+ fixed: !!n
362
+ }, e.className, e.type, e.colorEnable && "color-enable", e.regex === "barcode" && "bar-code", e.regex === "qrcode" && "qr-code"),
363
+ style: {
364
+ textAlign: i,
365
+ ...a
366
+ }
367
+ };
368
+ }, U = Object.freeze([]), fe = Object.freeze([]), pe = ({ leftFixedColumns: e = U, normalColumns: t = U, rightFixedColumns: n = U, dataSource: r = fe, rowKey: i = "id", rowHeight: a = E.ROW_HEIGHT, emptyText: o, onRowClick: l, onRow: u, onCell: d, totalColumnsWidth: p = 0, needSpacer: m = !1, rowRefCallback: h, isDynamicHeight: _ = !1, emptyRowContent: v, showEmptyRow: b = !0, startVirtualIndex: x, hideWhenEmpty: S = !1, wrapperClassName: C, forceRowHeight: w = !1 }) => {
369
+ let T = g(() => M(e), [e]), D = g(() => M(t), [t]), O = g(() => M(n), [n]), A = g(() => [
370
+ ...T,
371
+ ...D,
372
+ ...O
373
+ ], [
374
+ T,
375
+ D,
376
+ O
377
+ ]), ee = g(() => {
378
+ let e = T.map((e) => H(e, A, "left")), t = D.map((e) => H(e, A, void 0)), n = O.map((e) => H(e, A, "right"));
379
+ return [
380
+ ...e,
381
+ ...t,
382
+ ...n
383
+ ];
384
+ }, [
385
+ A,
386
+ T,
387
+ D,
388
+ O
389
+ ]), j = f((e) => {
390
+ e && h && h(e);
391
+ }, [h]), N = (e, t, n) => {
392
+ let { column: r, className: i, style: a } = e;
393
+ if (!V(t, r)) return null;
394
+ let o = B(t, r), c = r.dataIndex ? t[r.dataIndex] : void 0, l = r.render && typeof r.render == "function" ? r.render(c, t, n) : c, u, f = i, p = a;
395
+ if (d && typeof d == "function") {
396
+ let e = d(c, t, r, n, {
397
+ className: i,
398
+ style: a
399
+ });
400
+ e && (u = e, e.className && e.className !== i && (f = `${i} ${e.className}`.trim()), e.style && e.style !== a && (p = {
401
+ ...a,
402
+ ...e.style
403
+ }));
404
+ }
405
+ return /* @__PURE__ */ s("td", {
406
+ className: f,
407
+ style: p,
408
+ rowSpan: o > 1 ? o : void 0,
409
+ ...u,
410
+ children: /* @__PURE__ */ s("div", {
411
+ className: y("cell-content", r.align),
412
+ children: l
413
+ })
414
+ }, r.key);
415
+ };
416
+ if (S && r.length === 0) return null;
417
+ let P = () => v ?? /* @__PURE__ */ s("tr", {
418
+ className: "custom-table-empty-row",
419
+ children: /* @__PURE__ */ s("td", {
420
+ colSpan: A.length + (m ? 1 : 0),
421
+ style: {
422
+ textAlign: "center",
423
+ padding: "20px",
424
+ color: "#999"
425
+ },
426
+ children: o
427
+ })
428
+ }), F = w || !_;
429
+ return /* @__PURE__ */ s("div", {
430
+ className: y("custom-table-body", C),
431
+ style: { minWidth: p },
432
+ children: /* @__PURE__ */ c("table", {
433
+ style: {
434
+ tableLayout: "fixed",
435
+ minWidth: p,
436
+ width: m ? "100%" : p
437
+ },
438
+ children: [/* @__PURE__ */ c("colgroup", { children: [A.map((e) => /* @__PURE__ */ s("col", { style: { width: e.width || k.DEFAULT_WIDTH } }, e.key)), m ? /* @__PURE__ */ s("col", {
439
+ className: "spacer-col",
440
+ style: { width: "auto" }
441
+ }) : null] }), /* @__PURE__ */ s("tbody", { children: r.length === 0 ? b ? P() : null : r.map((e, t) => {
442
+ let n = {};
443
+ if (u && typeof u == "function") {
444
+ let r = u(e, t, {
445
+ className: "",
446
+ style: {}
447
+ }) || {};
448
+ n = {
449
+ className: r.className,
450
+ style: r.style,
451
+ ...r
452
+ };
453
+ }
454
+ let r = typeof x == "number" ? x + t : typeof e.dataIndex == "number" ? e.dataIndex : t;
455
+ return /* @__PURE__ */ c("tr", {
456
+ ref: _ ? j : void 0,
457
+ style: {
458
+ height: F ? a : "auto",
459
+ ...n.style
460
+ },
461
+ className: y("custom-table-row", n.className),
462
+ onClick: l ? (n) => l(e, t, n) : void 0,
463
+ "data-index": _ ? r : void 0,
464
+ ...n,
465
+ children: [ee.map((n) => N(n, e, t)), m ? /* @__PURE__ */ s("td", { className: "spacer-cell" }) : null]
466
+ }, I(e, i, t));
467
+ }) })]
468
+ })
469
+ });
470
+ };
471
+ pe.displayName = "TableBody";
472
+ var me = d(pe), he = Object.freeze([]), ge = Object.freeze({}), _e = ({ leftFixedColumns: e = he, normalColumns: t = he, rightFixedColumns: n = he, footerData: r = ge, summary: i, render: a, enableFixed: o = !0, totalColumnsWidth: l = 0, needSpacer: u = !1 }) => {
473
+ let d = g(() => M(e), [e]), f = g(() => M(t), [t]), p = g(() => M(n), [n]), m = g(() => [
474
+ ...d,
475
+ ...f,
476
+ ...p
477
+ ], [
478
+ d,
479
+ f,
480
+ p
481
+ ]), h = g(() => {
482
+ let e = /* @__PURE__ */ new Map();
483
+ return m.forEach((t, n) => {
484
+ let r = { textAlign: t.align || "left" }, i = "custom-table-footer-cell";
485
+ if (o && t.fixed) {
486
+ let e = F(n, m, t.fixed);
487
+ e && (r = {
488
+ ...r,
489
+ ...e
490
+ }, i += t.fixed === "left" ? " fixed-left" : " fixed-right");
491
+ }
492
+ e.set(t.key, {
493
+ cellStyle: r,
494
+ cellClassName: i
495
+ });
496
+ }), e;
497
+ }, [m, o]), _ = (e) => {
498
+ let t = (e.dataIndex ? r?.[e.dataIndex] : void 0) ?? i?.[e.key], { renderFooter: n } = e, o = n && typeof n == "function" ? n(t, e) : a && typeof a == "function" ? a(t, e) : t, c = h.get(e.key) || {
499
+ cellStyle: { textAlign: e.align || "left" },
500
+ cellClassName: "custom-table-footer-cell"
501
+ };
502
+ return /* @__PURE__ */ s("td", {
503
+ className: c.cellClassName,
504
+ style: c.cellStyle,
505
+ children: /* @__PURE__ */ s("div", {
506
+ className: "cell-content",
507
+ children: o
508
+ })
509
+ }, e.key);
510
+ };
511
+ return /* @__PURE__ */ s("div", {
512
+ className: "custom-table-footer",
513
+ style: g(() => {
514
+ let e = { minWidth: l };
515
+ return o && (e.position = "sticky", e.bottom = 0, e.zIndex = 10), e;
516
+ }, [o, l]),
517
+ children: /* @__PURE__ */ c("table", {
518
+ style: {
519
+ tableLayout: "fixed",
520
+ minWidth: l,
521
+ width: u ? "100%" : l
522
+ },
523
+ children: [/* @__PURE__ */ c("colgroup", { children: [m.map((e) => /* @__PURE__ */ s("col", { style: { width: e.width || k.DEFAULT_WIDTH } }, e.key)), u ? /* @__PURE__ */ s("col", {
524
+ className: "spacer-col",
525
+ style: { width: "auto" }
526
+ }) : null] }), /* @__PURE__ */ s("tfoot", { children: /* @__PURE__ */ c("tr", { children: [
527
+ d.map((e) => _(e)),
528
+ f.map((e) => _(e)),
529
+ p.map((e) => _(e)),
530
+ u ? /* @__PURE__ */ s("td", { className: "spacer-cell" }) : null
531
+ ] }) })]
532
+ })
533
+ });
534
+ };
535
+ _e.displayName = "TableFooter";
536
+ var ve = d(_e), W = [];
537
+ function ye(e, t, n) {
538
+ let r = x(e), a = x(t.estimateSize), o = t.rowHeight, s = t.minRowHeight || D.MIN_HEIGHT, c = t.maxRowHeight || D.MAX_HEIGHT, l = f((e) => {
539
+ let t = r.current ?? [], n = a.current;
540
+ if (typeof n == "function") return n(e, t[e]);
541
+ let l = t[e];
542
+ return l && typeof l.rowHeight == "number" ? i(l.rowHeight, s, c) : o === "auto" ? D.MIN_HEIGHT : typeof o == "function" ? i(o(e), s, c) : typeof o == "number" ? i(o, s, c) : D.MIN_HEIGHT;
543
+ }, [
544
+ o,
545
+ s,
546
+ c,
547
+ a,
548
+ r
549
+ ]), u = t.enabled ?? e.length > O.ENABLE_AUTO_SIZE, d = t.dynamicHeight ?? o === "auto", m = _(/* @__PURE__ */ new Map()), h = _(null), v = g(() => {
550
+ if (e.length === 0) return null;
551
+ let n = I(e[0], t.rowKey, 0), r = I(e[e.length - 1], t.rowKey, e.length - 1);
552
+ return `${String(n)}-${String(r)}-${e.length}`;
553
+ }, [e, t.rowKey]);
554
+ p(() => {
555
+ let e = m.current;
556
+ return () => {
557
+ e.clear();
558
+ };
559
+ }, []);
560
+ let y = f((e) => I((r.current ?? [])[e], t.rowKey, e), [t.rowKey, r]), b = T({
561
+ count: u ? e.length : 0,
562
+ getScrollElement: () => n.current,
563
+ estimateSize: l,
564
+ overscan: t.overscan ?? O.DEFAULT_OVERSCAN,
565
+ enabled: u,
566
+ measureElement: d ? (e) => {
567
+ let t = e.getAttribute("data-index");
568
+ if (!t) return D.MIN_HEIGHT;
569
+ let n = m.current, r = n.get(t);
570
+ if (r !== void 0) return r;
571
+ let i = e.getBoundingClientRect().height, a = Math.max(D.MIN_HEIGHT, i);
572
+ return n.set(t, a), a;
573
+ } : void 0,
574
+ getItemKey: y
575
+ });
576
+ p(() => {
577
+ h.current !== null && h.current !== v && (m.current.clear(), typeof b.measure == "function" && b.measure()), h.current = v;
578
+ }, [v, b]);
579
+ let C = u ? b.getTotalSize() : 0, w = u ? b.getVirtualItems() : W, E = u && w.length > 0 && w[0].start || 0, k = u && w.length > 0 ? C - (w[w.length - 1].end || 0) : 0, A = S(() => {
580
+ m.current.clear(), typeof b.measure == "function" && b.measure();
581
+ }), ee = S((e) => {
582
+ if (e === void 0) {
583
+ m.current.clear(), typeof b.measure == "function" && b.measure();
584
+ return;
585
+ }
586
+ let n = Array.isArray(e) ? e : [e], i = m.current, a = r.current ?? [];
587
+ n.forEach((e) => {
588
+ if (typeof e == "number") i.delete(String(e));
589
+ else {
590
+ let n = a.findIndex((n, r) => I(n, t.rowKey, r) === e);
591
+ n !== -1 && i.delete(String(n));
592
+ }
593
+ }), typeof b.measure == "function" && b.measure();
594
+ });
595
+ return {
596
+ enabled: u,
597
+ virtualRows: w,
598
+ rowRefCallback: b.measureElement,
599
+ totalHeight: C,
600
+ paddingTop: E,
601
+ paddingBottom: k,
602
+ remeasure: A,
603
+ clearRowHeightCache: ee,
604
+ isDynamicHeight: d
605
+ };
606
+ }
607
+ function be(e, t, n, r) {
608
+ let i = n ? t.map((t) => {
609
+ let n = e[t.index];
610
+ return n && {
611
+ ...n,
612
+ dataIndex: t.index
613
+ };
614
+ }) : e.map((e, t) => ({
615
+ ...e,
616
+ dataIndex: t
617
+ }));
618
+ return r ? r(i) : i;
619
+ }
620
+ //#endregion
621
+ //#region src/components/Table/hooks/useColumnResize.ts
622
+ function G(e = {}) {
623
+ let { minColumnWidth: t = k.MIN_WIDTH, maxColumnWidth: n = k.MAX_WIDTH, onColumnResize: r, onColumnResizeEnd: a } = e, [o, s] = v(null), c = x(o), l = x(r), u = x(a), d = S((e, t, n) => {
624
+ s({
625
+ columnKey: e,
626
+ startWidth: t,
627
+ startX: n
628
+ });
629
+ }), f = (e, r) => Math.round(i(r.startWidth + e - r.startX, t, n));
630
+ return b("mousemove", (e) => {
631
+ let t = c.current;
632
+ t && l.current?.(e, t.columnKey, f(e.clientX, t));
633
+ }, {
634
+ target: document,
635
+ enable: !!o
636
+ }), b("mouseup", (e) => {
637
+ let t = c.current;
638
+ t && (u.current?.(t.columnKey, f(e.clientX, t)), s(null));
639
+ }, {
640
+ target: document,
641
+ enable: !!o
642
+ }), {
643
+ isResizing: !!o,
644
+ resizingColumn: o?.columnKey,
645
+ startResize: d
646
+ };
647
+ }
648
+ //#endregion
649
+ //#region src/components/Table/hooks/useTableColumnWidths.ts
650
+ var xe = {};
651
+ function Se({ columns: e, scrollRef: t, minColumnWidth: n, maxColumnWidth: r, onColumnResize: i, onColumnResizeEnd: a }) {
652
+ let o = _(null), s = _(/* @__PURE__ */ new Map()), c = _(/* @__PURE__ */ new Map()), l = _(null), [u, d] = v(xe), f = g(() => M(e), [e]), m = g(() => re(e, u), [e, u]), h = g(() => M(m), [m]);
653
+ p(() => {
654
+ let e = c.current, t = /* @__PURE__ */ new Map();
655
+ for (let e of f) t.set(e.key, e.width || k.DEFAULT_WIDTH);
656
+ d((n) => {
657
+ let r = Object.keys(n);
658
+ if (r.length === 0) return n;
659
+ let i = !1, a = { ...n };
660
+ for (let o of r) {
661
+ let r = t.get(o);
662
+ if (r === void 0) {
663
+ delete a[o], i = !0;
664
+ continue;
665
+ }
666
+ let s = e.get(o), c = s !== void 0 && s !== r;
667
+ (r === n[o] || c) && (delete a[o], i = !0);
668
+ }
669
+ return i ? a : n;
670
+ });
671
+ for (let [n, r] of t) {
672
+ let t = e.get(n), i = s.current.get(n);
673
+ (i === void 0 || t !== void 0 && t !== r || i === r) && s.current.set(n, r);
674
+ }
675
+ c.current = t;
676
+ }, [f]);
677
+ let y = S((e) => s.current.get(e.key) || e.width || k.DEFAULT_WIDTH), b = S((e) => {
678
+ let n = h.findIndex((t) => t.key === e);
679
+ if (n === -1) return 0;
680
+ let r = h[n], i = 0;
681
+ for (let e = 0; e <= n; e++) i += y(h[e]);
682
+ return r.fixed === "left" ? i : i - (t.current?.scrollLeft || 0);
683
+ }), x = S((e) => {
684
+ o.current && (o.current.style.display = "block", o.current.style.left = `${e}px`);
685
+ }), C = S((e, t) => {
686
+ s.current.set(e, t), d((n) => n[e] === t ? n : {
687
+ ...n,
688
+ [e]: t
689
+ });
690
+ }), { isResizing: w, resizingColumn: T, startResize: E } = G({
691
+ minColumnWidth: n || k.MIN_WIDTH,
692
+ maxColumnWidth: r || k.MAX_WIDTH,
693
+ onColumnResizeEnd: S((e, t) => {
694
+ l.current = null, C(e, t), a?.(e, t, s.current), o.current && (o.current.style.display = "none");
695
+ }),
696
+ onColumnResize: S((e, t, n) => {
697
+ let r = l.current;
698
+ !r || r.columnKey !== t || (x(r.left + n - r.startWidth), i?.(t, n, s.current));
699
+ })
700
+ });
701
+ return {
702
+ sizedColumns: m,
703
+ flatColumns: h,
704
+ isResizing: w,
705
+ resizingColumn: T,
706
+ handleResizeStart: S((e, t, n) => {
707
+ let r = b(e);
708
+ l.current = {
709
+ columnKey: e,
710
+ left: r,
711
+ startWidth: t
712
+ }, x(r), E(e, t, n);
713
+ }),
714
+ resizeHandleRef: o
715
+ };
716
+ }
717
+ //#endregion
718
+ //#region src/components/Table/hooks/useTableViewport.ts
719
+ var Ce = {
720
+ elementWidth: 0,
721
+ viewportClientHeight: 0,
722
+ scrollOffset: {
723
+ left: 0,
724
+ top: 0
725
+ },
726
+ headerHeight: E.HEADER_HEIGHT,
727
+ hasYScroll: !1
728
+ };
729
+ function we({ scrollRef: e, tableHeaderRef: t, bordered: n, hasFooter: r, headerRowSpan: i, dataSourceLength: a, overlayScrollbarOptions: o }) {
730
+ let s = C(e), c = s?.height ?? 0, [l, u] = v(Ce), [d] = w({ options: {
731
+ overflow: {
732
+ x: o?.overflowX ?? "scroll",
733
+ y: o?.overflowY ?? "scroll"
734
+ },
735
+ scrollbars: {
736
+ theme: o?.theme ?? "os-theme-bsy",
737
+ autoHide: o?.autoHide ?? "move",
738
+ autoHideDelay: 400
739
+ }
740
+ } });
741
+ h(() => {
742
+ if (!e.current) return;
743
+ let t = e.current, n = t.parentElement;
744
+ n && d({
745
+ target: n,
746
+ elements: { viewport: t }
747
+ });
748
+ }, [d, e]), h(() => {
749
+ let n = e.current;
750
+ if (!n) return;
751
+ let r = n.clientWidth, i = n.clientHeight, a = n.offsetLeft, o = n.offsetTop, s = t.current?.clientHeight || E.HEADER_HEIGHT, c = n.scrollHeight > n.clientHeight;
752
+ u((e) => e.elementWidth === r && e.viewportClientHeight === i && e.scrollOffset.left === a && e.scrollOffset.top === o && e.headerHeight === s && e.hasYScroll === c ? e : {
753
+ elementWidth: r,
754
+ viewportClientHeight: i,
755
+ scrollOffset: {
756
+ left: a,
757
+ top: o
758
+ },
759
+ headerHeight: s,
760
+ hasYScroll: c
761
+ });
762
+ }, [
763
+ s?.width,
764
+ s?.height,
765
+ a,
766
+ r,
767
+ i,
768
+ e,
769
+ t
770
+ ]);
771
+ let f = s?.width || l.elementWidth, p = g(() => {
772
+ if (!c || !l.viewportClientHeight) return;
773
+ let e = n ? 2 : 0, t = l.viewportClientHeight - l.headerHeight - (r ? E.HEADER_HEIGHT : 0) - e;
774
+ return Math.max(0, t);
775
+ }, [
776
+ c,
777
+ l.viewportClientHeight,
778
+ l.headerHeight,
779
+ r,
780
+ n
781
+ ]);
782
+ return {
783
+ elementWidth: f,
784
+ hasYScroll: l.hasYScroll,
785
+ scrollOffset: l.scrollOffset,
786
+ headerHeight: l.headerHeight,
787
+ bodyMinHeight: p
788
+ };
789
+ }
790
+ //#endregion
791
+ //#region src/components/Table/style/resolveTableThemeVars.ts
792
+ var Te = (e) => {
793
+ if (!e) return {};
794
+ let t = {};
795
+ return n(t, "--bsy-table-color-border", e.colorBorder), n(t, "--bsy-table-color-bg-header", e.colorBgHeader), n(t, "--bsy-table-color-bg-container", e.colorBgContainer), n(t, "--bsy-table-color-text", e.colorText), n(t, "--bsy-table-color-text-heading", e.colorTextHeading), n(t, "--bsy-table-color-bg-row-hover", e.colorBgRowHover), t;
796
+ }, Ee = Object.freeze([]), De = Object.freeze({
797
+ left: !0,
798
+ right: !0
799
+ }), Oe = Object.freeze([]), ke = Object.freeze([]), Ae = u(({ columns: e = Oe, dataSource: n = ke, rowKey: r = "id", height: i, bordered: a = !0, emptyText: o, onRowClick: u, scroll: d, footerData: f, footerSummary: h, renderFooter: v, hasFooter: y = !1, onRow: b, onCell: x, rowHeightStyle: S = "low", resizable: C = !0, disabledResizeColumns: w = Ee, minColumnWidth: T, maxColumnWidth: D, onColumnResize: k, onColumnResizeEnd: ee, renderBody: j, estimateSize: M, virtualEnabled: N, dataProcessor: P, headerRowSpan: F, fixedShadowMask: te = De, onRenderEmpty: I, overlayScrollbarOptions: ne, wrapperStyle: L, theme: re }, ae) => {
800
+ let { t: oe } = t(), se = g(() => Te(re), [re]), R = _(null), ce = _(null), { elementWidth: z, hasYScroll: ue, scrollOffset: de, headerHeight: B, bodyMinHeight: V } = we({
801
+ scrollRef: R,
802
+ tableHeaderRef: ce,
803
+ bordered: a,
804
+ hasFooter: y,
805
+ headerRowSpan: F,
806
+ dataSourceLength: n.length,
807
+ overlayScrollbarOptions: ne
808
+ }), { sizedColumns: H, flatColumns: U, isResizing: fe, resizingColumn: pe, handleResizeStart: he, resizeHandleRef: ge } = Se({
809
+ columns: e,
810
+ scrollRef: R,
811
+ minColumnWidth: T,
812
+ maxColumnWidth: D,
813
+ onColumnResize: k,
814
+ onColumnResizeEnd: ee
815
+ }), { className: _e, height: W } = A[S] || A.auto, { virtualRows: G, totalHeight: xe, paddingTop: Ce, paddingBottom: Ae, remeasure: K, rowRefCallback: q, isDynamicHeight: je, clearRowHeightCache: Me, enabled: Ne } = ye(n, g(() => ({
816
+ rowHeight: W,
817
+ dynamicHeight: S === "auto",
818
+ rowKey: r,
819
+ overscan: O.DEFAULT_OVERSCAN,
820
+ estimateSize: M,
821
+ ...N === void 0 ? {} : { enabled: N }
822
+ }), [
823
+ W,
824
+ S,
825
+ r,
826
+ M,
827
+ N
828
+ ]), R);
829
+ m(ae, () => ({
830
+ clearRowHeightCache: Me,
831
+ remeasure: K
832
+ }), [Me, K]);
833
+ let Pe = o || oe(E.EMPTY_TEXT_KEY);
834
+ p(() => {
835
+ K?.();
836
+ }, [W, K]);
837
+ let { leftFixedColumns: J, normalColumns: Y, rightFixedColumns: X, fixedLeftWidth: Fe, fixedRightWidth: Z, totalColumnsWidth: Q, needSpacer: $ } = g(() => ie(H, z), [H, z]), Ie = g(() => be(n, G, Ne, P), [
838
+ Ne,
839
+ G,
840
+ n,
841
+ P
842
+ ]), Le = g(() => {
843
+ let e = {};
844
+ return a ? e.border = "1px solid var(--bsy-table-color-border, var(--bsy-base-border-color, #e0e0e0))" : e.border = "none", (i || d?.y) && (e.maxHeight = i || d?.y), e;
845
+ }, [
846
+ a,
847
+ i,
848
+ d
849
+ ]), Re = !!(i || d?.y), ze, Be, Ve = !0;
850
+ if (!j && n.length === 0 && typeof I == "function") {
851
+ let e = I();
852
+ l.isValidElement(e) && e.type === "tr" ? ze = e : e && (Be = e, Ve = !1);
853
+ }
854
+ return /* @__PURE__ */ c("div", {
855
+ className: `custom-table ${ue ? "has-y-scroll" : ""}`,
856
+ style: {
857
+ position: "relative",
858
+ height: "100%",
859
+ ...se
860
+ },
861
+ "data-overlayscrollbars-initialize": "",
862
+ children: [
863
+ /* @__PURE__ */ c("div", {
864
+ ref: R,
865
+ className: `custom-table-wrapper ${fe ? "resizing" : ""} ${_e} os-enabled`,
866
+ style: {
867
+ ...Le,
868
+ ...L
869
+ },
870
+ children: [
871
+ /* @__PURE__ */ s(le, {
872
+ ref: ce,
873
+ columns: H,
874
+ enableFixed: Re,
875
+ height: E.HEADER_HEIGHT,
876
+ resizingColumn: pe,
877
+ onResizeStart: C ? he : void 0,
878
+ resizable: C,
879
+ disabledResizeColumns: w,
880
+ totalColumnsWidth: Q,
881
+ needSpacer: $,
882
+ headerRowSpan: F
883
+ }),
884
+ /* @__PURE__ */ s("div", {
885
+ className: "custom-table-body-wrapper",
886
+ style: { position: "relative" },
887
+ children: /* @__PURE__ */ s("div", {
888
+ style: {
889
+ minHeight: V,
890
+ height: xe,
891
+ paddingBottom: Ae > 0 ? `${Ae}px` : void 0,
892
+ paddingTop: Ce > 0 ? `${Ce}px` : void 0,
893
+ position: "relative"
894
+ },
895
+ children: j ? j({
896
+ columns: H,
897
+ flatColumns: U,
898
+ leftFixedColumns: J,
899
+ normalColumns: Y,
900
+ rightFixedColumns: X,
901
+ totalColumnsWidth: Q,
902
+ needSpacer: $,
903
+ rowRefCallback: q,
904
+ isDynamicHeight: je,
905
+ rowHeight: W,
906
+ onRowClick: u,
907
+ scrollRef: R,
908
+ virtualRows: G,
909
+ virtualEnabled: Ne
910
+ }) : /* @__PURE__ */ s(me, {
911
+ leftFixedColumns: J,
912
+ normalColumns: Y,
913
+ rightFixedColumns: X,
914
+ dataSource: Ie,
915
+ rowKey: r,
916
+ rowHeight: W,
917
+ emptyText: Pe,
918
+ emptyRowContent: ze,
919
+ showEmptyRow: Ve,
920
+ onRowClick: u,
921
+ onRow: b,
922
+ onCell: x,
923
+ totalColumnsWidth: Q,
924
+ needSpacer: $,
925
+ rowRefCallback: q,
926
+ isDynamicHeight: je
927
+ })
928
+ })
929
+ }),
930
+ y && (f || h || v) ? /* @__PURE__ */ s(ve, {
931
+ leftFixedColumns: J,
932
+ normalColumns: Y,
933
+ rightFixedColumns: X,
934
+ footerData: f,
935
+ summary: h,
936
+ render: v,
937
+ enableFixed: Re,
938
+ totalColumnsWidth: Q,
939
+ needSpacer: $
940
+ }) : null
941
+ ]
942
+ }),
943
+ Be ? /* @__PURE__ */ s("div", {
944
+ className: "custom-table-empty-overlay",
945
+ style: {
946
+ height: V,
947
+ left: de.left,
948
+ top: de.top + B + (a ? 1 : 0),
949
+ width: z || void 0
950
+ },
951
+ children: /* @__PURE__ */ s("div", {
952
+ className: "custom-table-empty-overlay-inner",
953
+ children: Be
954
+ })
955
+ }) : null,
956
+ C ? /* @__PURE__ */ s("div", {
957
+ className: "custom-table-resize-handle",
958
+ ref: ge
959
+ }) : null,
960
+ te.left !== !1 && Fe > 0 ? /* @__PURE__ */ s("div", {
961
+ className: "fixed-shadow-mask left",
962
+ style: { width: Fe }
963
+ }) : null,
964
+ !$ && te.right !== !1 && Z > 0 ? /* @__PURE__ */ s("div", {
965
+ className: "fixed-shadow-mask right",
966
+ style: { width: Z }
967
+ }) : null
968
+ ]
969
+ });
970
+ });
971
+ Ae.displayName = "Table";
972
+ var K = l.memo(Ae), q = {
973
+ axisOffset: 18,
974
+ arrowSize: 16,
975
+ branchContinueOffset: 11,
976
+ branchEndOffset: 10,
977
+ iconOffset: 10,
978
+ levelStep: 26,
979
+ prefixOffset: 34,
980
+ textGap: 16,
981
+ textOffset: 42
982
+ }, je = {
983
+ top: 17 + q.branchContinueOffset,
984
+ bottom: -1
985
+ }, Me = {
986
+ top: -1,
987
+ bottom: -1
988
+ }, Ne = {
989
+ top: -1,
990
+ bottom: "10%"
991
+ }, Pe = /* @__PURE__ */ new Map(), J = (e = 0) => {
992
+ let t = Math.max(Number(e) || 0, 0), n = Pe.get(t);
993
+ if (n) return n;
994
+ let r = t * q.levelStep, i = {
995
+ axisCenter: q.axisOffset + r,
996
+ arrowLeft: q.iconOffset + r,
997
+ prefixWidth: q.prefixOffset + r,
998
+ textOffset: q.textOffset + r
999
+ };
1000
+ return Pe.set(t, i), i;
1001
+ }, Y = (e) => {
1002
+ if (!Array.isArray(e) || e.length === 0) return [];
1003
+ let t = e.length, n = Array(t), r = [];
1004
+ for (let i = 0; i < t; i += 1) {
1005
+ let a = Math.max(Number(e[i]) || 0, 0);
1006
+ for (; r.length > a;) {
1007
+ let e = r.pop();
1008
+ e !== void 0 && (n[e].subtreeEndIndex = i - 1);
1009
+ }
1010
+ n[i] = {
1011
+ ancestorIndices: r.slice(0, a),
1012
+ subtreeEndIndex: t - 1
1013
+ }, r[a] = i, r.length = a + 1;
1014
+ }
1015
+ for (; r.length > 0;) {
1016
+ let e = r.pop();
1017
+ e !== void 0 && (n[e].subtreeEndIndex = t - 1);
1018
+ }
1019
+ return n;
1020
+ }, X = ({ rowIndex: e, subtreeEndIndex: t, type: n = "ancestor" }) => n === "current" ? je : e < t ? Me : Ne, Fe = ({ depth: e = 0, hasChildren: t = !1, previousDepth: n = -1, rowIndex: r = 0, rowMeta: i = null, treeMeta: a = [] }) => {
1021
+ if (t) return null;
1022
+ let o = Math.max(Number(e) || 0, 0), { prefixWidth: s, axisCenter: c } = J(o), l = i?.ancestorIndices || [];
1023
+ if ((Number(n) || 0) > o) return {
1024
+ left: c,
1025
+ width: s - c
1026
+ };
1027
+ for (let e = 0; e < l.length; e += 1) {
1028
+ let t = l[e], n = a?.[t];
1029
+ if (X({
1030
+ rowIndex: r,
1031
+ subtreeEndIndex: n?.subtreeEndIndex ?? r
1032
+ }) !== Me) {
1033
+ let t = J(e).axisCenter;
1034
+ return {
1035
+ left: t,
1036
+ width: s - t
1037
+ };
1038
+ }
1039
+ }
1040
+ let u = o === 0 ? 0 : J(o - 1).prefixWidth;
1041
+ return {
1042
+ left: u,
1043
+ width: s - u
1044
+ };
1045
+ }, Z = {
1046
+ root: "_root_1vwno_1",
1047
+ gutter: "_gutter_1vwno_26",
1048
+ rail: "_rail_1vwno_33",
1049
+ divider: "_divider_1vwno_43",
1050
+ toggle: "_toggle_1vwno_52",
1051
+ toggleExpanded: "_toggleExpanded_1vwno_78",
1052
+ loading: "_loading_1vwno_82",
1053
+ value: "_value_1vwno_95",
1054
+ loadMore: "_loadMore_1vwno_106"
1055
+ }, Q = (e) => {
1056
+ e.stopPropagation();
1057
+ }, $ = ({ depth: e, loadMore: t }) => {
1058
+ let { prefixWidth: n } = J(e);
1059
+ return /* @__PURE__ */ c("div", {
1060
+ className: Z.root,
1061
+ "data-testid": "hierarchy-tree",
1062
+ children: [/* @__PURE__ */ s("div", {
1063
+ className: Z.gutter,
1064
+ style: { width: n },
1065
+ children: /* @__PURE__ */ s("span", {
1066
+ className: Z.divider,
1067
+ style: {
1068
+ left: 0,
1069
+ width: "100%"
1070
+ }
1071
+ })
1072
+ }), /* @__PURE__ */ s("div", {
1073
+ className: Z.value,
1074
+ children: /* @__PURE__ */ s("button", {
1075
+ type: "button",
1076
+ className: Z.loadMore,
1077
+ disabled: t.loading,
1078
+ onClick: (e) => {
1079
+ Q(e), t.onClick();
1080
+ },
1081
+ children: t.label
1082
+ })
1083
+ })]
1084
+ });
1085
+ }, Ie = (e, t, n) => (t.ancestorIndices || []).map((t, r) => {
1086
+ let i = n[t];
1087
+ return {
1088
+ axisCenter: J(r).axisCenter,
1089
+ key: `${t}-${r}`,
1090
+ segmentStyle: X({
1091
+ rowIndex: e,
1092
+ subtreeEndIndex: i?.subtreeEndIndex ?? e
1093
+ })
1094
+ };
1095
+ }), Le = ({ depth: t, children: n, rowIndex: i, previousDepth: a = -1, rowMeta: o, treeMeta: l, hasChildren: u = !1, expanded: d = !1, loading: f = !1, onToggle: p }) => {
1096
+ let { axisCenter: m, prefixWidth: h } = J(t), g = i === Math.max(l.length - 1, 0), _ = Ie(i, o, l), v = Fe({
1097
+ depth: t,
1098
+ hasChildren: u && d,
1099
+ previousDepth: a,
1100
+ rowIndex: i,
1101
+ rowMeta: o,
1102
+ treeMeta: l
1103
+ }), b = g ? {
1104
+ left: 0,
1105
+ width: "100%"
1106
+ } : v, x = u && d && o.subtreeEndIndex > i, S = X({
1107
+ rowIndex: i,
1108
+ subtreeEndIndex: o.subtreeEndIndex,
1109
+ type: "current"
1110
+ });
1111
+ return /* @__PURE__ */ c("div", {
1112
+ className: Z.root,
1113
+ "data-testid": "hierarchy-tree",
1114
+ children: [/* @__PURE__ */ c("div", {
1115
+ className: Z.gutter,
1116
+ style: { width: h },
1117
+ children: [
1118
+ b ? /* @__PURE__ */ s("span", {
1119
+ className: Z.divider,
1120
+ "data-testid": "hierarchy-tree-divider",
1121
+ style: b
1122
+ }) : null,
1123
+ _.map((e) => /* @__PURE__ */ s("span", {
1124
+ className: Z.rail,
1125
+ style: {
1126
+ left: e.axisCenter,
1127
+ ...e.segmentStyle
1128
+ }
1129
+ }, e.key)),
1130
+ x ? /* @__PURE__ */ s("span", {
1131
+ className: Z.rail,
1132
+ style: {
1133
+ left: m,
1134
+ ...S
1135
+ }
1136
+ }) : null,
1137
+ u ? f ? /* @__PURE__ */ s("span", {
1138
+ className: Z.loading,
1139
+ "data-testid": "hierarchy-tree-loading",
1140
+ style: { left: m },
1141
+ children: /* @__PURE__ */ s(r, {
1142
+ style: { fontSize: 16 },
1143
+ spin: !0
1144
+ })
1145
+ }) : /* @__PURE__ */ s("button", {
1146
+ type: "button",
1147
+ className: y(Z.toggle, d && Z.toggleExpanded),
1148
+ style: { left: m },
1149
+ "aria-expanded": d,
1150
+ onClick: (e) => {
1151
+ Q(e), p?.();
1152
+ },
1153
+ children: /* @__PURE__ */ s(e, {
1154
+ name: "arrow-right",
1155
+ size: 16
1156
+ })
1157
+ }) : null
1158
+ ]
1159
+ }), /* @__PURE__ */ s("div", {
1160
+ className: Z.value,
1161
+ children: n
1162
+ })]
1163
+ });
1164
+ }, Re = (e) => e.loadMore ? /* @__PURE__ */ s($, {
1165
+ depth: e.depth,
1166
+ loadMore: e.loadMore
1167
+ }) : /* @__PURE__ */ s(Le, { ...e });
1168
+ //#endregion
1169
+ export { k as _, G as a, B as c, P as d, M as f, ne as g, te as h, Te as i, de as l, I as m, Y as n, ye as o, L as p, K as r, me as s, Re as t, V as u, E as v, j as y };