@ufal-lccv/gpsub-ds 0.2.45 → 0.2.47

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,950 @@
1
+ import { a0 as t, c as P, q as ie, ao as K, C as ae, D as de, n as oe, Y as ce, _ as U, ap as he, aq as ue, ar as fe, as as xe, W as ge, E as ne, at as pe, au as me, av as be, aw as je, ax as Z, ay as z, az as we, aA as We, aB as Ie, aC as ye } from "./GenericAGGridTable-CizvYJ68.js";
2
+ import { useState as J, useEffect as Q, useMemo as G, useRef as X, useLayoutEffect as Ae } from "react";
3
+ import { Icon as te } from "sbwb-ds";
4
+ import { Controller as v, useController as Re } from "react-hook-form";
5
+ import { v as q, s as Se } from "./index-YF_5f0O1.js";
6
+ import { p as se } from "./parseDate-ihxA2lUF.js";
7
+ const le = 350, De = ({
8
+ title: d,
9
+ children: i,
10
+ endAdornment: f = null,
11
+ marginBottom: p = "16px",
12
+ customStyles: c = {},
13
+ wrapperCustomStyles: l = {},
14
+ animationContainerCustomStyles: a = {},
15
+ hideAdornmentOnCollapse: h = !1,
16
+ maxHeight: k = "none",
17
+ // Default to 'none' to allow full expansion
18
+ height: H = "fit-content"
19
+ }) => {
20
+ const [N, T] = J(!1), [m, W] = J(!0);
21
+ Q(() => {
22
+ if (h)
23
+ if (N) {
24
+ const w = setTimeout(
25
+ () => W(!1),
26
+ le
27
+ );
28
+ return () => clearTimeout(w);
29
+ } else
30
+ W(!0);
31
+ }, [N, h]);
32
+ const M = h && !m ? null : f;
33
+ return /* @__PURE__ */ t.jsxs(
34
+ P,
35
+ {
36
+ width: "100%",
37
+ flex: "1",
38
+ gap: "8px",
39
+ customStyles: l,
40
+ children: [
41
+ /* @__PURE__ */ t.jsx(
42
+ ie,
43
+ {
44
+ title: d,
45
+ divider: !0,
46
+ marginBottom: p,
47
+ collapse: {
48
+ collapsed: N,
49
+ setCollapsed: T
50
+ },
51
+ endAdornment: M,
52
+ customStyles: c
53
+ }
54
+ ),
55
+ /* @__PURE__ */ t.jsx(
56
+ P,
57
+ {
58
+ gap: "8px",
59
+ width: "100%",
60
+ height: H,
61
+ customStyles: {
62
+ ...a,
63
+ maxHeight: N ? "0" : k,
64
+ transition: `max-height ${le}ms ease-in-out`
65
+ },
66
+ children: i
67
+ }
68
+ )
69
+ ]
70
+ }
71
+ );
72
+ };
73
+ function Fe({
74
+ form: d,
75
+ name: i,
76
+ id: f = i,
77
+ label: p,
78
+ readonly: c = !1,
79
+ disabled: l = !1,
80
+ afterCheck: a,
81
+ width: h = "100%",
82
+ formatter: k,
83
+ parser: H,
84
+ flex: N,
85
+ size: T = "Medium",
86
+ checkColor: m,
87
+ triggerFormField: W = null,
88
+ ...M
89
+ }) {
90
+ const { onChangeTrigger: w } = K({
91
+ form: d,
92
+ fieldName: i,
93
+ triggerType: W,
94
+ debounceTime: 0
95
+ }), u = (b, y) => {
96
+ y(b), a == null || a(b), w == null || w();
97
+ };
98
+ return /* @__PURE__ */ t.jsx(P, { width: h, flex: N, children: /* @__PURE__ */ t.jsx(
99
+ v,
100
+ {
101
+ name: i,
102
+ control: d.control,
103
+ render: ({
104
+ field: { onChange: b, value: y, onBlur: S },
105
+ fieldState: { error: $ = null }
106
+ }) => {
107
+ const L = $ == null ? void 0 : $.message;
108
+ return L && console.log("Error on checkbox!", L), /* @__PURE__ */ t.jsx(
109
+ ae,
110
+ {
111
+ id: `form-checkbox-${f}`,
112
+ checked: k ? k(y) : !!y,
113
+ name: i,
114
+ label: p,
115
+ disabled: l || c,
116
+ onChange: (g) => {
117
+ u(
118
+ (H == null ? void 0 : H(g.target.checked, y)) ?? g.target.checked,
119
+ b
120
+ ), S == null || S();
121
+ },
122
+ size: T,
123
+ checkColor: m,
124
+ ...M
125
+ }
126
+ );
127
+ }
128
+ }
129
+ ) });
130
+ }
131
+ const Oe = ({
132
+ form: d,
133
+ name: i,
134
+ label: f,
135
+ placeholder: p,
136
+ readonly: c = !1,
137
+ disabled: l = !1,
138
+ width: a = "100%",
139
+ flex: h,
140
+ tooltipIsVisible: k,
141
+ tooltipMaxWidth: H,
142
+ tooltipPosition: N = "top",
143
+ afterFormChange: T,
144
+ openToDate: m,
145
+ range: W = !1,
146
+ openCalendarOnInputClick: M = !1,
147
+ ...w
148
+ }) => {
149
+ let u = p;
150
+ return !q(p) && !l && (u = c ? "Nenhuma data escolhida" : "Escolha uma data"), /* @__PURE__ */ t.jsx(P, { width: a, flex: h, children: /* @__PURE__ */ t.jsx(
151
+ v,
152
+ {
153
+ name: i,
154
+ control: d.control,
155
+ render: ({ field: { value: b, onChange: y, ref: S } }) => {
156
+ let $;
157
+ q(b) && (W ? $ = Array.isArray(b) ? b.join(" - ") : b : $ = new Date(Se(b.slice(0, 10))));
158
+ const { error: L } = d.getFieldState(i, d.formState);
159
+ return /* @__PURE__ */ t.jsx(
160
+ de,
161
+ {
162
+ ref: S,
163
+ idCalendar: `${i}-calendar`,
164
+ label: f,
165
+ value: $,
166
+ size: "Small",
167
+ readonly: c,
168
+ errorMessage: L == null ? void 0 : L.message,
169
+ disabled: l,
170
+ placeholder: u,
171
+ onChangeHandleDate: (g) => {
172
+ var r;
173
+ y(
174
+ W ? g ? g.split(" - ").map((D) => {
175
+ var O;
176
+ return ((O = se(D)) == null ? void 0 : O.slice(0, 10)) || null;
177
+ }) : [null, null] : g && ((r = se(g)) == null ? void 0 : r.slice(0, 10)) || null
178
+ ), T == null || T(g);
179
+ },
180
+ openToDate: m,
181
+ selectsRange: W,
182
+ openCalendarOnInputClick: M,
183
+ width: a,
184
+ flex: h,
185
+ ...w
186
+ }
187
+ );
188
+ }
189
+ }
190
+ ) });
191
+ };
192
+ function Ee({
193
+ form: d,
194
+ name: i,
195
+ label: f,
196
+ slots: { field: p },
197
+ slotsProps: c,
198
+ triggerFormField: l = null,
199
+ // Value
200
+ value: a,
201
+ // Flags
202
+ bypassControllerOnChange: h = !1,
203
+ overrideOnBlur: k = !1,
204
+ isRequired: H = !1,
205
+ readonly: N = !1,
206
+ disabled: T = !1,
207
+ // Tranformations
208
+ parser: m,
209
+ // Debounce
210
+ debounce: W,
211
+ // Change handlers
212
+ beforeChange: M,
213
+ onChange: w,
214
+ afterChange: u,
215
+ // Blur handlers
216
+ beforeBlur: b,
217
+ onBlur: y,
218
+ afterBlur: S,
219
+ // Enter handlers
220
+ onEnter: $
221
+ }) {
222
+ const {
223
+ field: { value: L, onChange: g },
224
+ fieldState: { error: r = null }
225
+ } = Re({ name: i, control: d.control }), D = q(W), { onChangeTrigger: O, onBlurTrigger: o } = K({
226
+ form: d,
227
+ fieldName: i,
228
+ triggerType: l,
229
+ debounceTime: D ? 0 : 500
230
+ }), n = (e, j) => {
231
+ var R, _;
232
+ const F = ((R = e == null ? void 0 : e.target) == null ? void 0 : R.value) || ((_ = e == null ? void 0 : e.target) == null ? void 0 : _.checked) || e || void 0, A = q(m) ? m(F) : F;
233
+ M == null || M(A), h || j == null || j(A), w == null || w(e, j), u == null || u(e, j), O == null || O();
234
+ }, I = G(() => {
235
+ if (!D) return n;
236
+ let e;
237
+ return (F, A) => {
238
+ clearTimeout(e), e = setTimeout(() => n(F, A), W);
239
+ };
240
+ }, [D, W, n]), x = (e, j) => {
241
+ var A, R;
242
+ const F = ((A = e == null ? void 0 : e.target) == null ? void 0 : A.value) || ((R = e == null ? void 0 : e.target) == null ? void 0 : R.checked) || e || void 0;
243
+ !k && h && (g == null || g(F)), b == null || b(e, j), y == null || y(e, j), S == null || S(e, j), o == null || o();
244
+ }, C = (e, j) => {
245
+ $ == null || $(e, j);
246
+ };
247
+ r != null && r.message && console.log(`Error on ${p.displayName}!`, r.message);
248
+ const s = q(a) ? a == null ? void 0 : a(L) : { value: L };
249
+ return /* @__PURE__ */ t.jsx(P, { ...c == null ? void 0 : c.container, children: /* @__PURE__ */ t.jsx(
250
+ p,
251
+ {
252
+ ...c == null ? void 0 : c.field,
253
+ ...s,
254
+ label: f,
255
+ onChange: (e) => I == null ? void 0 : I(e, g),
256
+ onBlur: (e) => x == null ? void 0 : x(e, g),
257
+ onEnter: (e) => C == null ? void 0 : C(e, g),
258
+ errorMessage: r == null ? void 0 : r.message
259
+ }
260
+ ) });
261
+ }
262
+ const Ve = ({
263
+ form: d,
264
+ name: i,
265
+ label: f,
266
+ options: p,
267
+ readonly: c = !1,
268
+ disabled: l = !1,
269
+ width: a = "100%",
270
+ flex: h,
271
+ placeholder: k,
272
+ iconName: H,
273
+ onSelect: N,
274
+ hasSelectAll: T = !1,
275
+ tags: m = !0,
276
+ sortOptions: W = !1,
277
+ enableSearch: M = !1,
278
+ valueAllOption: w,
279
+ isRequired: u = !1,
280
+ tooltipProps: b = {},
281
+ infoProps: y = {},
282
+ triggerFormField: S = null,
283
+ ...$
284
+ }) => {
285
+ const { onChangeTrigger: L } = K({
286
+ form: d,
287
+ fieldName: i,
288
+ triggerType: S,
289
+ debounceTime: 0
290
+ });
291
+ return /* @__PURE__ */ t.jsx(P, { width: a, flex: h, children: /* @__PURE__ */ t.jsx(
292
+ v,
293
+ {
294
+ name: i,
295
+ control: d.control,
296
+ render: ({ field: { value: g, onChange: r } }) => {
297
+ const { error: D } = d.getFieldState(i), O = q(g) ? g : [];
298
+ return /* @__PURE__ */ t.jsx(
299
+ oe,
300
+ {
301
+ label: f,
302
+ size: "Small",
303
+ disabled: l || c,
304
+ onChange: (o) => {
305
+ r(o), N == null || N(o), L == null || L();
306
+ },
307
+ values: O,
308
+ errorMessage: D == null ? void 0 : D.message,
309
+ options: p,
310
+ iconName: H,
311
+ hasSelectAll: T,
312
+ tags: m,
313
+ sortOptions: W,
314
+ placeholder: k,
315
+ enableSearch: M,
316
+ valueAllOption: w,
317
+ isRequired: u,
318
+ tooltipProps: {
319
+ position: "top",
320
+ ...b
321
+ },
322
+ infoProps: {
323
+ tooltipProps: {
324
+ position: "top",
325
+ maxWidth: "300px",
326
+ ...y.tooltipProps
327
+ },
328
+ ...y
329
+ },
330
+ ...$
331
+ }
332
+ );
333
+ }
334
+ }
335
+ ) });
336
+ }, Ue = ({
337
+ variant: d = "default",
338
+ form: i,
339
+ name: f,
340
+ label: p,
341
+ options: c,
342
+ readonly: l = !1,
343
+ disabled: a = !1,
344
+ optionsMap: h,
345
+ width: k = "100%",
346
+ flex: H,
347
+ placeholder: N,
348
+ onSelect: T,
349
+ parser: m,
350
+ onPaste: W,
351
+ filter: M,
352
+ tooltipProps: w = {},
353
+ infoProps: u = {},
354
+ maxHeightMenu: b,
355
+ isRequired: y = !1,
356
+ onRemoveSelected: S,
357
+ triggerFormField: $ = null,
358
+ displayText: L,
359
+ usePortal: g = !1,
360
+ ...r
361
+ }) => {
362
+ const { onChangeTrigger: D } = K({
363
+ form: i,
364
+ fieldName: f,
365
+ triggerType: $,
366
+ debounceTime: 0
367
+ }), O = {
368
+ position: "top",
369
+ ...w
370
+ }, o = {
371
+ ...u,
372
+ tooltipProps: {
373
+ position: "top",
374
+ maxWidth: "300px",
375
+ ...u == null ? void 0 : u.tooltipProps
376
+ }
377
+ }, n = (x, C) => {
378
+ let s = x;
379
+ m && (s = m == null ? void 0 : m(x)), C(s), T == null || T(s), D == null || D();
380
+ }, I = G(() => q(h) ? h : Object.fromEntries(c.map((x) => [x.value, x])), [c, h]);
381
+ return /* @__PURE__ */ t.jsx(P, { width: k, flex: H, children: /* @__PURE__ */ t.jsx(
382
+ v,
383
+ {
384
+ name: f,
385
+ control: i.control,
386
+ render: ({
387
+ field: { onChange: x, value: C },
388
+ fieldState: { error: s = null }
389
+ }) => {
390
+ let e = I[C];
391
+ return /* @__PURE__ */ t.jsx(
392
+ ce,
393
+ {
394
+ label: p,
395
+ width: "100%",
396
+ size: "Small",
397
+ variant: d,
398
+ disabled: a,
399
+ readonly: l,
400
+ filter: M,
401
+ errorMessage: s == null ? void 0 : s.message,
402
+ placeholder: N,
403
+ value: e,
404
+ handleOption: (j) => {
405
+ n(j.value, x);
406
+ },
407
+ tooltipProps: O,
408
+ options: c,
409
+ usePortal: g,
410
+ infoProps: o,
411
+ maxHeightMenu: b,
412
+ isRequired: y,
413
+ onRemoveSelected: S,
414
+ displayText: L,
415
+ onPaste: W,
416
+ ...r
417
+ }
418
+ );
419
+ }
420
+ }
421
+ ) });
422
+ }, ke = (d) => {
423
+ const [i, f] = J(!1), [p, c] = J(d), l = X(null);
424
+ return Q(() => {
425
+ c(d);
426
+ }, [d]), Q(() => {
427
+ if (!i) return;
428
+ const a = (h) => {
429
+ l.current && !l.current.contains(h.target) && f(!1);
430
+ };
431
+ return document.addEventListener("pointerdown", a), () => {
432
+ document.removeEventListener("pointerdown", a);
433
+ };
434
+ }, [i]), {
435
+ setIsOpen: f,
436
+ isOpen: i,
437
+ setOptionsSelect: c,
438
+ optionsSelect: p,
439
+ selectContainerRef: l
440
+ };
441
+ }, _e = ({
442
+ name: d,
443
+ variant: i = "primary",
444
+ width: f = "100%",
445
+ size: p = "Medium",
446
+ disabled: c = !1,
447
+ isLoading: l = !1,
448
+ onClick: a,
449
+ options: h,
450
+ label: k,
451
+ menuSelectProps: H = {},
452
+ iconName: N,
453
+ optionsIconPosition: T
454
+ }) => {
455
+ const { isOpen: m, setIsOpen: W, selectContainerRef: M, optionsSelect: w } = ke(h);
456
+ let u = U.colors.backgroundColors.colorBackgroundSnow;
457
+ c ? u = U.colors.neutralColors.colorNeutralCloudy : i !== "primary" && (u = U.colors.neutralColors.colorNeutralDark);
458
+ const b = {
459
+ ...H
460
+ };
461
+ return /* @__PURE__ */ t.jsxs(
462
+ he,
463
+ {
464
+ ref: M,
465
+ width: f,
466
+ size: p,
467
+ disabled: c,
468
+ onBlur: (y) => {
469
+ const S = y.relatedTarget;
470
+ S && !y.currentTarget.contains(S) && W(!1);
471
+ },
472
+ children: [
473
+ k && /* @__PURE__ */ t.jsx(ue, { children: k }),
474
+ /* @__PURE__ */ t.jsxs(
475
+ fe,
476
+ {
477
+ type: "button",
478
+ size: p,
479
+ disabled: c,
480
+ variant: i,
481
+ isLoading: l,
482
+ onClick: () => !l && W(!m),
483
+ id: `button-component-${d}`,
484
+ "data-cy": `button-component-${d}`,
485
+ children: [
486
+ l && /* @__PURE__ */ t.jsx(xe, { size: p, disabled: c, variant: i, children: /* @__PURE__ */ t.jsx(
487
+ te,
488
+ {
489
+ iconName: `ProgressActivity${p === "Small" ? "Ant" : "Sm"}`,
490
+ color: u,
491
+ "data-testid": "icon-loading"
492
+ }
493
+ ) }),
494
+ !l && /* @__PURE__ */ t.jsx("p", { title: d, children: d }),
495
+ !l && (m ? /* @__PURE__ */ t.jsx(
496
+ te,
497
+ {
498
+ iconName: `ExpandLess${p === "Small" ? "Ant" : "Sm"}`,
499
+ color: u,
500
+ "data-testid": "icon-button-less"
501
+ }
502
+ ) : /* @__PURE__ */ t.jsx(
503
+ te,
504
+ {
505
+ iconName: `ExpandMore${p === "Small" ? "Ant" : "Sm"}`,
506
+ color: u,
507
+ "data-testid": "icon-button-more"
508
+ }
509
+ ))
510
+ ]
511
+ }
512
+ ),
513
+ m && /* @__PURE__ */ t.jsx(
514
+ ge,
515
+ {
516
+ selectContainerRef: M,
517
+ value: null,
518
+ optionsSelect: w,
519
+ selectOption: (y) => {
520
+ a == null || a(y), W(!1);
521
+ },
522
+ size: p,
523
+ inputValue: null,
524
+ iconPosition: T,
525
+ iconName: N,
526
+ ...b
527
+ }
528
+ )
529
+ ]
530
+ }
531
+ );
532
+ }, qe = ({
533
+ width: d = "100%",
534
+ height: i = "fit-content",
535
+ flex: f,
536
+ backgroundColor: p = U.colors.backgroundColors.colorBackgroundCarpet,
537
+ upperComponent: c = void 0,
538
+ options: l = [],
539
+ lowerComponent: a = void 0,
540
+ heightItems: h = "60px",
541
+ widthItems: k = "155px",
542
+ emptyProps: H = {
543
+ title: "Nenhum dado a ser mostrado",
544
+ body: null
545
+ },
546
+ customWrapperStyles: N = {
547
+ border: `1px solid ${U.colors.neutralColors.colorNeutralSoft}`,
548
+ borderRadius: "8px"
549
+ },
550
+ customItemStyles: T = {},
551
+ selectedKey: m,
552
+ onSelect: W,
553
+ selectedItemKey: M,
554
+ setSelectedItemKey: w
555
+ }) => {
556
+ var O;
557
+ const u = m !== void 0, b = !u && M !== void 0, [y, S] = J(((O = l[0]) == null ? void 0 : O.key) ?? null), $ = X(null), L = X(null), g = u ? m : b ? M : y, r = G(() => l.length ? g == null ? u ? null : l[0] : l.find((n) => n.key === g) ?? (u || b ? null : l[0]) : null, [l, g, u, b]);
558
+ Q(() => {
559
+ const o = $.current, n = L.current, I = () => {
560
+ o && n && (n.scrollTop = o.scrollTop);
561
+ };
562
+ return o == null || o.addEventListener("scroll", I), () => {
563
+ o == null || o.removeEventListener("scroll", I);
564
+ };
565
+ }, []), Q(() => {
566
+ if (!(u || b)) {
567
+ if (!l.length) {
568
+ S(null);
569
+ return;
570
+ }
571
+ S((o) => o != null && l.some((n) => n.key === o) ? o : l[0].key);
572
+ }
573
+ }, [l, u, b]);
574
+ const D = (o) => {
575
+ W == null || W(o), w == null || w(o.key), !u && !b && S(o.key);
576
+ };
577
+ return (l == null ? void 0 : l.length) === 0 ? /* @__PURE__ */ t.jsx(
578
+ ne,
579
+ {
580
+ title: H.title,
581
+ body: H.body,
582
+ flex: "1",
583
+ mode: "table"
584
+ }
585
+ ) : /* @__PURE__ */ t.jsxs(
586
+ P,
587
+ {
588
+ width: d,
589
+ height: i,
590
+ flex: f,
591
+ backgroundColor: p,
592
+ direction: "horizontal",
593
+ customStyles: {
594
+ border: `1px solid ${U.colors.neutralColors.colorNeutralSoft}`,
595
+ borderRadius: U.borders.borderRadius.borderRadiusSm,
596
+ ...N,
597
+ overflow: "hidden"
598
+ },
599
+ children: [
600
+ /* @__PURE__ */ t.jsxs(pe, { ref: $, widthItems: k, children: [
601
+ c && c,
602
+ l == null ? void 0 : l.map((o) => /* @__PURE__ */ t.jsx(
603
+ me,
604
+ {
605
+ selected: g === o.key,
606
+ onClick: () => D(o),
607
+ withBorderRight: !0,
608
+ heightItems: h,
609
+ customStyles: T,
610
+ children: o.item
611
+ },
612
+ o.key
613
+ )),
614
+ a && a,
615
+ /* @__PURE__ */ t.jsx(be, {})
616
+ ] }),
617
+ /* @__PURE__ */ t.jsx(je, { children: r && (r == null ? void 0 : r.contentItem) })
618
+ ]
619
+ }
620
+ );
621
+ };
622
+ function Ne(d) {
623
+ return (i) => typeof d == "string" ? i[d] : typeof d == "function" ? d(i) : (console.warn("Please, setup a rowKey for table."), JSON.stringify(i));
624
+ }
625
+ function Pe({
626
+ id: d,
627
+ rowKey: i = "id",
628
+ size: f = "Small",
629
+ onRowClick: p,
630
+ fit: c = !1,
631
+ maxHeight: l = "40rem",
632
+ columns: a,
633
+ dataSource: h,
634
+ columnsTextSize: k = f,
635
+ emptyProps: H = {
636
+ width: "100%",
637
+ height: "100%",
638
+ title: "Nenhum dado a ser mostrado.",
639
+ mode: "table",
640
+ borders: !0,
641
+ backgroundColor: U.colors.backgroundColors.colorBackgroundSnow
642
+ },
643
+ selectedRow: N = !1,
644
+ hideHeader: T = !1,
645
+ withBorder: m = !0,
646
+ withBorderRadius: W = !0,
647
+ striped: M = !1,
648
+ borderRadius: w = U.borders.borderRadius.borderRadiusSm,
649
+ disableMaxHeight: u = !1,
650
+ isVisible: b = !1
651
+ }) {
652
+ const y = G(() => Ne(i), [i]), [S, $] = J(null), L = X(null), g = X(null), [r, D] = J(a);
653
+ Ae(() => {
654
+ if (!g.current || a.length === 0) {
655
+ D(a);
656
+ return;
657
+ }
658
+ const n = () => {
659
+ var _;
660
+ const x = ((_ = g.current) == null ? void 0 : _.clientWidth) || 0;
661
+ if (x === 0) return;
662
+ let C = 0, s = 0;
663
+ const e = [], j = [];
664
+ a.forEach((V) => {
665
+ const E = Number(V.flex);
666
+ V.width ? C += parseInt(V.width, 10) || 0 : V.flex && E > 0 ? (s += E, e.push(V)) : j.push(V);
667
+ });
668
+ const F = x - C, A = "80";
669
+ let R = [...a];
670
+ if (F > 0) {
671
+ if (e.length > 0) {
672
+ const V = F / s;
673
+ R = a.map((E) => {
674
+ const Y = Number(E.flex);
675
+ if (Y && Y > 0) {
676
+ const B = parseInt(E.minWidth || A, 10), ee = Y * V, re = Math.max(ee, B);
677
+ return { ...E, width: `${Math.floor(re)}px` };
678
+ }
679
+ return !E.width && !Y ? {
680
+ ...E,
681
+ width: E.minWidth || `${A}px`
682
+ } : E;
683
+ });
684
+ } else if (j.length > 0) {
685
+ const V = F / j.length;
686
+ R = a.map((E) => {
687
+ const Y = Number(E.flex);
688
+ if (!E.width && !Y) {
689
+ const B = parseInt(E.minWidth || A, 10), ee = Math.max(V, B);
690
+ return { ...E, width: `${Math.floor(ee)}px` };
691
+ }
692
+ return E;
693
+ });
694
+ }
695
+ } else
696
+ R = a.map((V) => V.width ? V : { ...V, width: V.minWidth || `${A}px` });
697
+ D(R);
698
+ };
699
+ n();
700
+ const I = new ResizeObserver(n);
701
+ return I.observe(g.current), () => I.disconnect();
702
+ }, [a]), Q(() => {
703
+ const n = (I) => {
704
+ L.current && !L.current.contains(I.target) && $(null);
705
+ };
706
+ return document.addEventListener("mousedown", n), () => {
707
+ document.removeEventListener("mousedown", n);
708
+ };
709
+ }, []);
710
+ const O = G(() => r ? r.some(
711
+ (n) => n.mergeHeaderId && n.mergeHeaderLabel
712
+ ) : !1, [r]), o = G(() => {
713
+ var C, s;
714
+ if (T || !r || r.length === 0)
715
+ return null;
716
+ if (!O)
717
+ return /* @__PURE__ */ t.jsx(
718
+ Z,
719
+ {
720
+ isHeader: !0,
721
+ size: f,
722
+ numRows: 1,
723
+ borderRadius: w,
724
+ children: r.map((e, j) => {
725
+ var F;
726
+ return /* @__PURE__ */ t.jsx(
727
+ z,
728
+ {
729
+ width: e.width,
730
+ minWidth: e.minWidth,
731
+ maxWidth: e.maxWidth,
732
+ horizontalAlign: e.horizontalAlign,
733
+ size: f,
734
+ columnsTextSize: k,
735
+ withBorder: m,
736
+ headerAlign: e.headerAlign,
737
+ isLastColumn: j === r.length - 1,
738
+ children: ((F = e.columnRender) == null ? void 0 : F.call(e, h)) || /* @__PURE__ */ t.jsx("span", { title: e.label, children: e.label })
739
+ },
740
+ e.dataIndex
741
+ );
742
+ })
743
+ }
744
+ );
745
+ const n = [], I = [];
746
+ let x = 0;
747
+ for (; x < r.length; ) {
748
+ const e = r[x];
749
+ if (e.mergeHeaderId && e.mergeHeaderLabel) {
750
+ let j = 0;
751
+ const F = e.mergeHeaderId;
752
+ for (let A = x; A < r.length && r[A].mergeHeaderId === F; A++)
753
+ j++;
754
+ n.push(
755
+ /* @__PURE__ */ t.jsx(
756
+ z,
757
+ {
758
+ colSpan: j,
759
+ horizontalAlign: "center",
760
+ size: f,
761
+ columnsTextSize: k,
762
+ withBorder: m,
763
+ width: e.width,
764
+ minWidth: e.minWidth,
765
+ maxWidth: e.maxWidth,
766
+ headerAlign: e.headerAlign,
767
+ isTopRow: !0,
768
+ isLastColumn: x + j - 1 === r.length - 1,
769
+ children: /* @__PURE__ */ t.jsx("span", { title: e.mergeHeaderLabel, children: e.mergeHeaderLabel })
770
+ },
771
+ `${e.mergeHeaderId}-merged`
772
+ )
773
+ );
774
+ for (let A = 0; A < j; A++) {
775
+ const R = r[x + A];
776
+ I.push(
777
+ /* @__PURE__ */ t.jsx(
778
+ z,
779
+ {
780
+ width: R.width,
781
+ minWidth: R.minWidth,
782
+ maxWidth: R.maxWidth,
783
+ horizontalAlign: R.horizontalAlign,
784
+ size: f,
785
+ columnsTextSize: k,
786
+ withBorder: m,
787
+ headerAlign: e.headerAlign,
788
+ isLastColumn: x + A === r.length - 1,
789
+ children: ((C = R.columnRender) == null ? void 0 : C.call(R, h)) || /* @__PURE__ */ t.jsx("span", { title: R.label, children: R.label })
790
+ },
791
+ R.dataIndex + "-individual"
792
+ )
793
+ );
794
+ }
795
+ x += j;
796
+ } else
797
+ n.push(
798
+ /* @__PURE__ */ t.jsx(
799
+ z,
800
+ {
801
+ rowSpan: 2,
802
+ width: e.width,
803
+ minWidth: e.minWidth,
804
+ maxWidth: e.maxWidth,
805
+ horizontalAlign: e.horizontalAlign,
806
+ size: f,
807
+ columnsTextSize: k,
808
+ withBorder: m,
809
+ headerAlign: e.headerAlign,
810
+ isTopRow: !0,
811
+ isLastColumn: x === r.length - 1,
812
+ children: ((s = e.columnRender) == null ? void 0 : s.call(e, h)) || /* @__PURE__ */ t.jsx("span", { title: e.label, children: e.label })
813
+ },
814
+ e.dataIndex
815
+ )
816
+ ), x++;
817
+ }
818
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
819
+ /* @__PURE__ */ t.jsx(
820
+ Z,
821
+ {
822
+ isHeader: !0,
823
+ size: f,
824
+ numRows: 2,
825
+ borderRadius: w,
826
+ children: n
827
+ }
828
+ ),
829
+ I.length > 0 && /* @__PURE__ */ t.jsx(
830
+ Z,
831
+ {
832
+ isHeader: !0,
833
+ size: f,
834
+ numRows: 2,
835
+ borderRadius: w,
836
+ children: I
837
+ }
838
+ )
839
+ ] });
840
+ }, [r, T, f, k, O]);
841
+ return !h || h.length === 0 ? /* @__PURE__ */ t.jsx(
842
+ ne,
843
+ {
844
+ backgroundColor: U.colors.backgroundColors.colorBackgroundSnow,
845
+ borders: !0,
846
+ mode: "table",
847
+ ...H
848
+ }
849
+ ) : /* @__PURE__ */ t.jsx(
850
+ we,
851
+ {
852
+ maxHeight: l,
853
+ disableMaxHeight: u,
854
+ withBorderRadius: W,
855
+ ref: g,
856
+ borderRadius: w,
857
+ isVisible: b,
858
+ children: /* @__PURE__ */ t.jsxs(We, { id: d, ref: L, children: [
859
+ /* @__PURE__ */ t.jsx("thead", { children: o }),
860
+ /* @__PURE__ */ t.jsx("tbody", { style: { width: "100%" }, children: h == null ? void 0 : h.map((n, I, x) => {
861
+ const C = y(n);
862
+ return /* @__PURE__ */ t.jsx(
863
+ Z,
864
+ {
865
+ isLast: I === x.length - 1,
866
+ fit: c,
867
+ size: f,
868
+ withBorder: m,
869
+ isSelected: C === S && N,
870
+ striped: M && I % 2 !== 0,
871
+ borderRadius: w,
872
+ children: r.map((s, e) => {
873
+ var j, F, A, R, _;
874
+ return /* @__PURE__ */ t.jsx(
875
+ Ie,
876
+ {
877
+ width: s.width,
878
+ minWidth: s.minWidth,
879
+ maxWidth: s.maxWidth,
880
+ size: f,
881
+ isClickable: q(p),
882
+ isLastColumn: e === r.length - 1,
883
+ onClick: () => {
884
+ p && p(n, s, I), N && $(
885
+ S === C ? null : C
886
+ );
887
+ },
888
+ horizontalAlign: s.horizontalAlign,
889
+ verticalAlign: s.verticalAlign,
890
+ rowPadding: s.rowPadding,
891
+ withBorder: m,
892
+ isLast: I === x.length - 1,
893
+ disabled: (j = s.disable) == null ? void 0 : j.call(
894
+ s,
895
+ n[s.dataIndex],
896
+ n,
897
+ I,
898
+ x
899
+ ),
900
+ hasError: (F = s.warn) == null ? void 0 : F.call(
901
+ s,
902
+ n[s.dataIndex],
903
+ n,
904
+ I,
905
+ x
906
+ ),
907
+ backgroundColor: (A = s.paint) == null ? void 0 : A.call(
908
+ s,
909
+ n[s.dataIndex],
910
+ n,
911
+ I,
912
+ x
913
+ ),
914
+ children: ((R = s.render) == null ? void 0 : R.call(
915
+ s,
916
+ n[s.dataIndex],
917
+ n,
918
+ I,
919
+ x
920
+ )) || /* @__PURE__ */ t.jsx(
921
+ ye,
922
+ {
923
+ title: n[s.dataIndex],
924
+ style: (_ = s.rowCss) == null ? void 0 : _.call(s, n),
925
+ children: n[s.dataIndex]
926
+ }
927
+ ) || ""
928
+ },
929
+ `${C}::${s.dataIndex}`
930
+ );
931
+ })
932
+ },
933
+ C
934
+ );
935
+ }) })
936
+ ] })
937
+ }
938
+ );
939
+ }
940
+ export {
941
+ De as C,
942
+ Oe as D,
943
+ Ee as F,
944
+ Ve as M,
945
+ Ue as S,
946
+ qe as T,
947
+ Fe as a,
948
+ _e as b,
949
+ Pe as c
950
+ };