@ufal-lccv/gpsub-ds 0.2.21 → 0.2.23

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