@ufal-lccv/gpsub-ds 0.2.46 → 0.2.48

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