@ufal-lccv/gpsub-ds 0.2.44 → 0.2.46
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.
- package/dist/{GenericAGGridTable-BW_ALIFn.cjs → GenericAGGridTable-CXb9pBC0.cjs} +945 -989
- package/dist/{GenericAGGridTable-COlnjl1w.js → GenericAGGridTable-DNnLeEvP.js} +15481 -15679
- package/dist/{RequiredLabel.view-BgNucZ_B.js → RequiredLabel.view-8O_wMprt.js} +6 -6
- package/dist/{RequiredLabel.view-y5DtgVbF.cjs → RequiredLabel.view-BKKEwY3_.cjs} +1 -1
- package/dist/{Table.view-V-EgsTKv.js → Table.view-BB4_hN9n.js} +68 -68
- package/dist/{Table.view-XpQMN0Aw.cjs → Table.view-DRlsznoR.cjs} +1 -1
- package/dist/{Title.view-C3puqDYy.cjs → Title.view-D5GmQ4pO.cjs} +1 -1
- package/dist/{Title.view-CwHWk0Sf.js → Title.view-OTu-Renl.js} +3 -3
- package/dist/components/atoms/Checkbox/Checkbox.view.d.ts +2 -0
- package/dist/components/atoms/index.cjs.js +1 -1
- package/dist/components/atoms/index.es.js +2 -2
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.es.js +66 -69
- package/dist/components/molecules/Confirm/index.d.ts +0 -2
- package/dist/components/molecules/Modal/Modal.styles.d.ts +1 -0
- package/dist/components/molecules/Modal/Modal.view.d.ts +4 -3
- package/dist/components/molecules/Modal/showModal.d.ts +1 -1
- package/dist/components/molecules/index.cjs.js +1 -1
- package/dist/components/molecules/index.es.js +23 -26
- package/dist/components/organisms/index.cjs.js +1 -1
- package/dist/components/organisms/index.es.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +89 -92
- package/package.json +1 -1
- package/dist/components/molecules/Confirm/ConfirmModal.styles.d.ts +0 -6
- package/dist/components/molecules/Confirm/ConfirmModal.view.d.ts +0 -28
- package/dist/components/molecules/Confirm/showConfirm.d.ts +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as e, ac as S, ad as w, ae as R, af as v, Z as a, ag as $, a6 as D, c as u, ah as L, ai as O, aj as _, ak as y, a4 as z, al as W, e as q, I as B, am as M } from "./GenericAGGridTable-DNnLeEvP.js";
|
|
2
2
|
import { d as V, v as j } from "./index-YF_5f0O1.js";
|
|
3
3
|
import { useState as C, useEffect as N } from "react";
|
|
4
4
|
import "sbwb-ds";
|
|
@@ -8,14 +8,14 @@ const h = [], T = (r) => (h.push(r), () => {
|
|
|
8
8
|
o >= 0 && h.splice(o, 1);
|
|
9
9
|
}), F = () => h.forEach((r) => r()), X = (r) => {
|
|
10
10
|
b = [r, ...b], F();
|
|
11
|
-
},
|
|
11
|
+
}, Z = (r) => {
|
|
12
12
|
b = b.filter((o) => o.instanceId !== r), F();
|
|
13
|
-
},
|
|
13
|
+
}, G = () => b, x = { subscribe: T, add: X, remove: Z, getAlerts: G }, H = () => {
|
|
14
14
|
const [r, o] = C(x.getAlerts());
|
|
15
15
|
return N(() => x.subscribe(() => o([...x.getAlerts()])), []), /* @__PURE__ */ e.jsx(S, { children: r.map(({ instanceId: s, props: t, destroy: l }) => /* @__PURE__ */ e.jsx(w, { ...t, destroy: l }, s)) });
|
|
16
16
|
};
|
|
17
17
|
let m = !1;
|
|
18
|
-
const
|
|
18
|
+
const Y = ({
|
|
19
19
|
id: r,
|
|
20
20
|
type: o,
|
|
21
21
|
title: s,
|
|
@@ -32,7 +32,7 @@ const Z = ({
|
|
|
32
32
|
}), !m) {
|
|
33
33
|
m = !0;
|
|
34
34
|
const g = V.portal.add("alert-stack");
|
|
35
|
-
R.createRoot(g).render(/* @__PURE__ */ e.jsx(
|
|
35
|
+
R.createRoot(g).render(/* @__PURE__ */ e.jsx(H, {}));
|
|
36
36
|
}
|
|
37
37
|
}, P = ({
|
|
38
38
|
width: r = "100%",
|
|
@@ -161,5 +161,5 @@ export {
|
|
|
161
161
|
P as A,
|
|
162
162
|
ee as L,
|
|
163
163
|
re as R,
|
|
164
|
-
|
|
164
|
+
Y as s
|
|
165
165
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./GenericAGGridTable-
|
|
1
|
+
"use strict";const e=require("./GenericAGGridTable-CXb9pBC0.cjs"),b=require("./index-CPP6SuZS.cjs"),m=require("react");require("sbwb-ds");let u=[];const p=[],F=r=>(p.push(r),()=>{const o=p.indexOf(r);o>=0&&p.splice(o,1)}),R=()=>p.forEach(r=>r()),A=r=>{u=[r,...u],R()},I=r=>{u=u.filter(o=>o.instanceId!==r),R()},y=()=>u,d={subscribe:F,add:A,remove:I,getAlerts:y},w=()=>{const[r,o]=m.useState(d.getAlerts());return m.useEffect(()=>d.subscribe(()=>o([...d.getAlerts()])),[]),e.jsxRuntimeExports.jsx(e.AlertStackContainer,{children:r.map(({instanceId:s,props:t,destroy:n})=>e.jsxRuntimeExports.jsx(e.AlertView,{...t,destroy:n},s))})};let g=!1;const S=({id:r,type:o,title:s,description:t,durationInMilliseconds:n=3e3,dataToCopy:l,offset:a={x:0,y:0}})=>{const c=r+Date.now()+Math.random(),x=()=>d.remove(c);if(d.add({instanceId:c,props:{id:r,type:o,title:s,description:t,durationInMilliseconds:n,dataToCopy:l,offset:a},destroy:x}),!g){g=!0;const j=b.dom.portal.add("alert-stack");e.clientExports.createRoot(j).render(e.jsxRuntimeExports.jsx(w,{}))}},q=({width:r="100%",height:o="fit-content",type:s,variant:t="small",title:n,message:l,margin:a,open:c=!0,onClose:x,canClose:j=!0})=>{var h,E;const[C,k]=m.useState(c),i={info:{backgroundColor:"#D5EBFD",borderColor:e.y.colors.feedbackColors.colorFeedbackInfo,icon:e.jsxRuntimeExports.jsx(e.InfoFill_default,{color:e.y.colors.feedbackColors.colorFeedbackInfo,height:"24px",width:"24px"})},success:{backgroundColor:"#DAF9DB",borderColor:e.y.colors.feedbackColors.colorFeedbackSuccess,icon:e.jsxRuntimeExports.jsx(e.CheckCircleFill_default,{color:e.y.colors.feedbackColors.colorFeedbackSuccess,height:"24px",width:"24px"})},warning:{backgroundColor:"#FEEECF",borderColor:e.y.colors.feedbackColors.colorFeedbackWarning},error:{backgroundColor:"#FFE1E1",borderColor:e.y.colors.feedbackColors.colorFeedbackError,icon:e.jsxRuntimeExports.jsx(e.ErrorFill_default,{color:e.y.colors.feedbackColors.colorFeedbackError,height:"24px",width:"24px"})}};function f(){k(!1),x==null||x()}return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:C?e.jsxRuntimeExports.jsxs(e.Container,{width:r,height:o,direction:"horizontal",verticalAlign:n?"top":"center",gap:e.y.spacings.spacingInline.spacingInlineAnt,padding:t=="small"?`${e.y.spacings.spacingStack.spacingStackXs} ${e.y.spacings.spacingInline.spacingInlineAnt}`:e.y.spacings.spacingInline.spacingInlineSm,backgroundColor:(h=i==null?void 0:i[s])==null?void 0:h.backgroundColor,customStyles:{border:`1px solid ${(E=i==null?void 0:i[s])==null?void 0:E.borderColor}`,borderRadius:e.y.borders.borderRadius.borderRadiusSm,margin:a,position:"relative"},children:[s==="warning"?e.jsxRuntimeExports.jsx(e.ContainerWarning,{children:e.jsxRuntimeExports.jsx(e.WarningFill_default,{width:"24px",height:"24px"})}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i==null?void 0:i[s].icon}),e.jsxRuntimeExports.jsxs(e.Container,{width:"100%",flex:"1",height:"100%",verticalAlign:"center",children:[b.valuable(n)&&e.jsxRuntimeExports.jsx(e.Title$1,{children:n}),b.valuable(l)&&e.jsxRuntimeExports.jsx(e.Message,{children:l})]}),j&&e.jsxRuntimeExports.jsx(e.Container,{children:e.jsxRuntimeExports.jsx(e.Close_default,{color:e.y.colors.neutralColors.colorNeutralCloudy,cursor:"pointer",onClick:f,height:"20px",width:"20px"})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})})},v=({label:r,labelRender:o,infoProps:s={},withInfo:t=!0,flex:n,width:l="100%",isRequired:a=!1})=>{const c={tooltipProps:{position:"top",...s==null?void 0:s.tooltipProps,size:"Small"}};return e.jsxRuntimeExports.jsxs(e.Container,{width:l,direction:"horizontal",gap:"4px",flex:n,children:[o??e.jsxRuntimeExports.jsxs(e.Label$1,{children:[r," ",a?e.jsxRuntimeExports.jsx(e.Required,{}):null]}),t&&e.jsxRuntimeExports.jsx(e.Info,{...c})]})},$=({width:r="100%",flex:o,label:s="Obrigatório",margin:t="0 0 16px 0"})=>e.jsxRuntimeExports.jsx(e.Container,{width:r,flex:o,customStyles:{margin:t},children:e.jsxRuntimeExports.jsx(e.Label$2,{children:`* ${s}`})});exports.AlertInline=q;exports.LabelField=v;exports.RequiredLabelView=$;exports.showAlert=S;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as t, c as P, p as re, an as K, C as ae, D as de, m as oe, X as ce, Z as V, ao as he, ap as ue, aq as fe, ar as xe, U as ge, E as ie, as as pe, at as me, au as be, av as je, aw as Y, ax as z, ay as we, az as We, aA as Ie, aB as ye } from "./GenericAGGridTable-DNnLeEvP.js";
|
|
2
2
|
import { useState as J, useEffect as G, useMemo as Z, useRef as Q, useLayoutEffect as Ae } from "react";
|
|
3
3
|
import { Icon as te } from "sbwb-ds";
|
|
4
4
|
import { Controller as B, useController as ke } from "react-hook-form";
|
|
@@ -17,7 +17,7 @@ const le = 350, Fe = ({
|
|
|
17
17
|
// Default to 'none' to allow full expansion
|
|
18
18
|
height: H = "fit-content"
|
|
19
19
|
}) => {
|
|
20
|
-
const [R, S] = J(!1), [
|
|
20
|
+
const [R, S] = J(!1), [m, I] = J(!0);
|
|
21
21
|
G(() => {
|
|
22
22
|
if (x)
|
|
23
23
|
if (R) {
|
|
@@ -29,7 +29,7 @@ const le = 350, Fe = ({
|
|
|
29
29
|
} else
|
|
30
30
|
I(!0);
|
|
31
31
|
}, [R, x]);
|
|
32
|
-
const N = x && !
|
|
32
|
+
const N = x && !m ? null : f;
|
|
33
33
|
return /* @__PURE__ */ t.jsxs(
|
|
34
34
|
P,
|
|
35
35
|
{
|
|
@@ -83,7 +83,7 @@ function Oe({
|
|
|
83
83
|
parser: H,
|
|
84
84
|
flex: R,
|
|
85
85
|
size: S = "Medium",
|
|
86
|
-
checkColor:
|
|
86
|
+
checkColor: m,
|
|
87
87
|
triggerFormField: I = null,
|
|
88
88
|
...N
|
|
89
89
|
}) {
|
|
@@ -92,8 +92,8 @@ function Oe({
|
|
|
92
92
|
fieldName: a,
|
|
93
93
|
triggerType: I,
|
|
94
94
|
debounceTime: 0
|
|
95
|
-
}), h = (
|
|
96
|
-
C(
|
|
95
|
+
}), h = (b, C) => {
|
|
96
|
+
C(b), c == null || c(b), w == null || w();
|
|
97
97
|
};
|
|
98
98
|
return /* @__PURE__ */ t.jsx(P, { width: x, flex: R, children: /* @__PURE__ */ t.jsx(
|
|
99
99
|
B,
|
|
@@ -101,7 +101,7 @@ function Oe({
|
|
|
101
101
|
name: a,
|
|
102
102
|
control: r.control,
|
|
103
103
|
render: ({
|
|
104
|
-
field: { onChange:
|
|
104
|
+
field: { onChange: b, value: C, onBlur: $ },
|
|
105
105
|
fieldState: { error: T = null }
|
|
106
106
|
}) => {
|
|
107
107
|
const M = T == null ? void 0 : T.message;
|
|
@@ -116,11 +116,11 @@ function Oe({
|
|
|
116
116
|
onChange: (g) => {
|
|
117
117
|
h(
|
|
118
118
|
(H == null ? void 0 : H(g.target.checked, C)) ?? g.target.checked,
|
|
119
|
-
|
|
119
|
+
b
|
|
120
120
|
), $ == null || $();
|
|
121
121
|
},
|
|
122
122
|
size: S,
|
|
123
|
-
checkColor:
|
|
123
|
+
checkColor: m,
|
|
124
124
|
...N
|
|
125
125
|
}
|
|
126
126
|
);
|
|
@@ -141,7 +141,7 @@ const Ee = ({
|
|
|
141
141
|
tooltipMaxWidth: H,
|
|
142
142
|
tooltipPosition: R = "top",
|
|
143
143
|
afterFormChange: S,
|
|
144
|
-
openToDate:
|
|
144
|
+
openToDate: m,
|
|
145
145
|
range: I = !1,
|
|
146
146
|
openCalendarOnInputClick: N = !1,
|
|
147
147
|
...w
|
|
@@ -152,9 +152,9 @@ const Ee = ({
|
|
|
152
152
|
{
|
|
153
153
|
name: a,
|
|
154
154
|
control: r.control,
|
|
155
|
-
render: ({ field: { value:
|
|
155
|
+
render: ({ field: { value: b, onChange: C, ref: $ } }) => {
|
|
156
156
|
let T;
|
|
157
|
-
q(
|
|
157
|
+
q(b) && (I ? T = Array.isArray(b) ? b.join(" - ") : b : T = new Date(Re(b.slice(0, 10))));
|
|
158
158
|
const { error: M } = r.getFieldState(a, r.formState);
|
|
159
159
|
return /* @__PURE__ */ t.jsx(
|
|
160
160
|
de,
|
|
@@ -177,7 +177,7 @@ const Ee = ({
|
|
|
177
177
|
}) : [null, null] : g && ((n = se(g)) == null ? void 0 : n.slice(0, 10)) || null
|
|
178
178
|
), S == null || S(g);
|
|
179
179
|
},
|
|
180
|
-
openToDate:
|
|
180
|
+
openToDate: m,
|
|
181
181
|
selectsRange: I,
|
|
182
182
|
openCalendarOnInputClick: N,
|
|
183
183
|
width: c,
|
|
@@ -189,7 +189,7 @@ const Ee = ({
|
|
|
189
189
|
}
|
|
190
190
|
) });
|
|
191
191
|
};
|
|
192
|
-
function
|
|
192
|
+
function Ue({
|
|
193
193
|
form: r,
|
|
194
194
|
name: a,
|
|
195
195
|
label: f,
|
|
@@ -205,7 +205,7 @@ function Ve({
|
|
|
205
205
|
readonly: R = !1,
|
|
206
206
|
disabled: S = !1,
|
|
207
207
|
// Tranformations
|
|
208
|
-
parser:
|
|
208
|
+
parser: m,
|
|
209
209
|
// Debounce
|
|
210
210
|
debounce: I,
|
|
211
211
|
// Change handlers
|
|
@@ -213,7 +213,7 @@ function Ve({
|
|
|
213
213
|
onChange: w,
|
|
214
214
|
afterChange: h,
|
|
215
215
|
// Blur handlers
|
|
216
|
-
beforeBlur:
|
|
216
|
+
beforeBlur: b,
|
|
217
217
|
onBlur: C,
|
|
218
218
|
afterBlur: $,
|
|
219
219
|
// Enter handlers
|
|
@@ -229,7 +229,7 @@ function Ve({
|
|
|
229
229
|
debounceTime: D ? 0 : 500
|
|
230
230
|
}), i = (e, j) => {
|
|
231
231
|
var A, _;
|
|
232
|
-
const F = ((A = e == null ? void 0 : e.target) == null ? void 0 : A.value) || ((_ = e == null ? void 0 : e.target) == null ? void 0 : _.checked) || e || void 0, y = q(
|
|
232
|
+
const F = ((A = e == null ? void 0 : e.target) == null ? void 0 : A.value) || ((_ = e == null ? void 0 : e.target) == null ? void 0 : _.checked) || e || void 0, y = q(m) ? m(F) : F;
|
|
233
233
|
N == null || N(y), x || j == null || j(y), w == null || w(e, j), h == null || h(e, j), O == null || O();
|
|
234
234
|
}, W = Z(() => {
|
|
235
235
|
if (!D) return i;
|
|
@@ -240,7 +240,7 @@ function Ve({
|
|
|
240
240
|
}, [D, I, i]), u = (e, j) => {
|
|
241
241
|
var y, A;
|
|
242
242
|
const F = ((y = e == null ? void 0 : e.target) == null ? void 0 : y.value) || ((A = e == null ? void 0 : e.target) == null ? void 0 : A.checked) || e || void 0;
|
|
243
|
-
!k && x && (g == null || g(F)),
|
|
243
|
+
!k && x && (g == null || g(F)), b == null || b(e, j), C == null || C(e, j), $ == null || $(e, j), d == null || d();
|
|
244
244
|
}, L = (e, j) => {
|
|
245
245
|
T == null || T(e, j);
|
|
246
246
|
};
|
|
@@ -259,7 +259,7 @@ function Ve({
|
|
|
259
259
|
}
|
|
260
260
|
) });
|
|
261
261
|
}
|
|
262
|
-
const
|
|
262
|
+
const Ve = ({
|
|
263
263
|
form: r,
|
|
264
264
|
name: a,
|
|
265
265
|
label: f,
|
|
@@ -272,12 +272,12 @@ const Ue = ({
|
|
|
272
272
|
iconName: H,
|
|
273
273
|
onSelect: R,
|
|
274
274
|
hasSelectAll: S = !1,
|
|
275
|
-
tags:
|
|
275
|
+
tags: m = !0,
|
|
276
276
|
sortOptions: I = !1,
|
|
277
277
|
enableSearch: N = !1,
|
|
278
278
|
valueAllOption: w,
|
|
279
279
|
isRequired: h = !1,
|
|
280
|
-
tooltipProps:
|
|
280
|
+
tooltipProps: b = {},
|
|
281
281
|
infoProps: C = {},
|
|
282
282
|
triggerFormField: $ = null,
|
|
283
283
|
...T
|
|
@@ -309,7 +309,7 @@ const Ue = ({
|
|
|
309
309
|
options: p,
|
|
310
310
|
iconName: H,
|
|
311
311
|
hasSelectAll: S,
|
|
312
|
-
tags:
|
|
312
|
+
tags: m,
|
|
313
313
|
sortOptions: I,
|
|
314
314
|
placeholder: k,
|
|
315
315
|
enableSearch: N,
|
|
@@ -317,7 +317,7 @@ const Ue = ({
|
|
|
317
317
|
isRequired: h,
|
|
318
318
|
tooltipProps: {
|
|
319
319
|
position: "top",
|
|
320
|
-
...
|
|
320
|
+
...b
|
|
321
321
|
},
|
|
322
322
|
infoProps: {
|
|
323
323
|
tooltipProps: {
|
|
@@ -346,12 +346,12 @@ const Ue = ({
|
|
|
346
346
|
flex: H,
|
|
347
347
|
placeholder: R,
|
|
348
348
|
onSelect: S,
|
|
349
|
-
parser:
|
|
349
|
+
parser: m,
|
|
350
350
|
onPaste: I,
|
|
351
351
|
filter: N,
|
|
352
352
|
tooltipProps: w = {},
|
|
353
353
|
infoProps: h = {},
|
|
354
|
-
maxHeightMenu:
|
|
354
|
+
maxHeightMenu: b,
|
|
355
355
|
isRequired: C = !1,
|
|
356
356
|
onRemoveSelected: $,
|
|
357
357
|
triggerFormField: T = null,
|
|
@@ -376,7 +376,7 @@ const Ue = ({
|
|
|
376
376
|
}
|
|
377
377
|
}, i = (u, L) => {
|
|
378
378
|
let s = u;
|
|
379
|
-
|
|
379
|
+
m && (s = m == null ? void 0 : m(u)), L(s), S == null || S(s), D == null || D();
|
|
380
380
|
}, W = Z(() => q(x) ? x : Object.fromEntries(o.map((u) => [u.value, u])), [o, x]);
|
|
381
381
|
return /* @__PURE__ */ t.jsx(P, { width: k, flex: H, children: /* @__PURE__ */ t.jsx(
|
|
382
382
|
B,
|
|
@@ -408,7 +408,7 @@ const Ue = ({
|
|
|
408
408
|
options: o,
|
|
409
409
|
usePortal: g,
|
|
410
410
|
infoProps: d,
|
|
411
|
-
maxHeightMenu:
|
|
411
|
+
maxHeightMenu: b,
|
|
412
412
|
isRequired: C,
|
|
413
413
|
onRemoveSelected: $,
|
|
414
414
|
displayText: M,
|
|
@@ -444,10 +444,10 @@ const Ue = ({
|
|
|
444
444
|
iconName: R,
|
|
445
445
|
optionsIconPosition: S
|
|
446
446
|
}) => {
|
|
447
|
-
const { isOpen:
|
|
448
|
-
let h =
|
|
449
|
-
o ? h =
|
|
450
|
-
const
|
|
447
|
+
const { isOpen: m, setIsOpen: I, selectContainerRef: N, optionsSelect: w } = Se(x);
|
|
448
|
+
let h = V.colors.backgroundColors.colorBackgroundSnow;
|
|
449
|
+
o ? h = V.colors.neutralColors.colorNeutralCloudy : a !== "primary" && (h = V.colors.neutralColors.colorNeutralDark);
|
|
450
|
+
const b = {
|
|
451
451
|
...H
|
|
452
452
|
};
|
|
453
453
|
return /* @__PURE__ */ t.jsxs(
|
|
@@ -468,7 +468,7 @@ const Ue = ({
|
|
|
468
468
|
disabled: o,
|
|
469
469
|
variant: a,
|
|
470
470
|
isLoading: l,
|
|
471
|
-
onClick: () => !l && I(!
|
|
471
|
+
onClick: () => !l && I(!m),
|
|
472
472
|
id: `button-component-${r}`,
|
|
473
473
|
"data-cy": `button-component-${r}`,
|
|
474
474
|
children: [
|
|
@@ -481,7 +481,7 @@ const Ue = ({
|
|
|
481
481
|
}
|
|
482
482
|
) }),
|
|
483
483
|
!l && /* @__PURE__ */ t.jsx("p", { title: r, children: r }),
|
|
484
|
-
!l && (
|
|
484
|
+
!l && (m ? /* @__PURE__ */ t.jsx(
|
|
485
485
|
te,
|
|
486
486
|
{
|
|
487
487
|
iconName: `ExpandLess${p === "Small" ? "Ant" : "Sm"}`,
|
|
@@ -499,7 +499,7 @@ const Ue = ({
|
|
|
499
499
|
]
|
|
500
500
|
}
|
|
501
501
|
),
|
|
502
|
-
|
|
502
|
+
m && /* @__PURE__ */ t.jsx(
|
|
503
503
|
ge,
|
|
504
504
|
{
|
|
505
505
|
selectContainerRef: N,
|
|
@@ -510,7 +510,7 @@ const Ue = ({
|
|
|
510
510
|
inputValue: null,
|
|
511
511
|
iconPosition: S,
|
|
512
512
|
iconName: R,
|
|
513
|
-
...
|
|
513
|
+
...b
|
|
514
514
|
}
|
|
515
515
|
)
|
|
516
516
|
]
|
|
@@ -520,7 +520,7 @@ const Ue = ({
|
|
|
520
520
|
width: r = "100%",
|
|
521
521
|
height: a = "fit-content",
|
|
522
522
|
flex: f,
|
|
523
|
-
backgroundColor: p =
|
|
523
|
+
backgroundColor: p = V.colors.backgroundColors.colorBackgroundCarpet,
|
|
524
524
|
upperComponent: o = void 0,
|
|
525
525
|
options: l = [],
|
|
526
526
|
lowerComponent: c = void 0,
|
|
@@ -531,17 +531,17 @@ const Ue = ({
|
|
|
531
531
|
body: null
|
|
532
532
|
},
|
|
533
533
|
customWrapperStyles: R = {
|
|
534
|
-
border: `1px solid ${
|
|
534
|
+
border: `1px solid ${V.colors.neutralColors.colorNeutralSoft}`,
|
|
535
535
|
borderRadius: "8px"
|
|
536
536
|
},
|
|
537
537
|
customItemStyles: S = {},
|
|
538
|
-
selectedKey:
|
|
538
|
+
selectedKey: m,
|
|
539
539
|
onSelect: I,
|
|
540
540
|
selectedItemKey: N,
|
|
541
541
|
setSelectedItemKey: w
|
|
542
542
|
}) => {
|
|
543
543
|
var O;
|
|
544
|
-
const h =
|
|
544
|
+
const h = m !== void 0, b = !h && N !== void 0, [C, $] = J(((O = l[0]) == null ? void 0 : O.key) ?? null), T = Q(null), M = Q(null), g = h ? m : b ? N : C, n = Z(() => l.length ? g == null ? h ? null : l[0] : l.find((i) => i.key === g) ?? (h || b ? null : l[0]) : null, [l, g, h, b]);
|
|
545
545
|
G(() => {
|
|
546
546
|
const d = T.current, i = M.current, W = () => {
|
|
547
547
|
d && i && (i.scrollTop = d.scrollTop);
|
|
@@ -550,16 +550,16 @@ const Ue = ({
|
|
|
550
550
|
d == null || d.removeEventListener("scroll", W);
|
|
551
551
|
};
|
|
552
552
|
}, []), G(() => {
|
|
553
|
-
if (!(h ||
|
|
553
|
+
if (!(h || b)) {
|
|
554
554
|
if (!l.length) {
|
|
555
555
|
$(null);
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
558
558
|
$((d) => d != null && l.some((i) => i.key === d) ? d : l[0].key);
|
|
559
559
|
}
|
|
560
|
-
}, [l, h,
|
|
560
|
+
}, [l, h, b]);
|
|
561
561
|
const D = (d) => {
|
|
562
|
-
I == null || I(d), w == null || w(d.key), !h && !
|
|
562
|
+
I == null || I(d), w == null || w(d.key), !h && !b && $(d.key);
|
|
563
563
|
};
|
|
564
564
|
return (l == null ? void 0 : l.length) === 0 ? /* @__PURE__ */ t.jsx(
|
|
565
565
|
ie,
|
|
@@ -578,8 +578,8 @@ const Ue = ({
|
|
|
578
578
|
backgroundColor: p,
|
|
579
579
|
direction: "horizontal",
|
|
580
580
|
customStyles: {
|
|
581
|
-
border: `1px solid ${
|
|
582
|
-
borderRadius:
|
|
581
|
+
border: `1px solid ${V.colors.neutralColors.colorNeutralSoft}`,
|
|
582
|
+
borderRadius: V.borders.borderRadius.borderRadiusSm,
|
|
583
583
|
...R,
|
|
584
584
|
overflow: "hidden"
|
|
585
585
|
},
|
|
@@ -587,7 +587,7 @@ const Ue = ({
|
|
|
587
587
|
/* @__PURE__ */ t.jsxs(pe, { ref: T, widthItems: k, children: [
|
|
588
588
|
o && o,
|
|
589
589
|
l == null ? void 0 : l.map((d) => /* @__PURE__ */ t.jsx(
|
|
590
|
-
|
|
590
|
+
me,
|
|
591
591
|
{
|
|
592
592
|
selected: g === d.key,
|
|
593
593
|
onClick: () => D(d),
|
|
@@ -599,7 +599,7 @@ const Ue = ({
|
|
|
599
599
|
d.key
|
|
600
600
|
)),
|
|
601
601
|
c && c,
|
|
602
|
-
/* @__PURE__ */ t.jsx(
|
|
602
|
+
/* @__PURE__ */ t.jsx(be, {})
|
|
603
603
|
] }),
|
|
604
604
|
/* @__PURE__ */ t.jsx(je, { children: n && (n == null ? void 0 : n.contentItem) })
|
|
605
605
|
]
|
|
@@ -625,16 +625,16 @@ function Je({
|
|
|
625
625
|
title: "Nenhum dado a ser mostrado.",
|
|
626
626
|
mode: "table",
|
|
627
627
|
borders: !0,
|
|
628
|
-
backgroundColor:
|
|
628
|
+
backgroundColor: V.colors.backgroundColors.colorBackgroundSnow
|
|
629
629
|
},
|
|
630
630
|
selectedRow: R = !1,
|
|
631
631
|
hideHeader: S = !1,
|
|
632
|
-
withBorder:
|
|
632
|
+
withBorder: m = !0,
|
|
633
633
|
withBorderRadius: I = !0,
|
|
634
634
|
striped: N = !1,
|
|
635
|
-
borderRadius: w =
|
|
635
|
+
borderRadius: w = V.borders.borderRadius.borderRadiusSm,
|
|
636
636
|
disableMaxHeight: h = !1,
|
|
637
|
-
isVisible:
|
|
637
|
+
isVisible: b = !1
|
|
638
638
|
}) {
|
|
639
639
|
const C = Z(() => Te(a), [a]), [$, T] = J(null), M = Q(null), g = Q(null), [n, D] = J(c);
|
|
640
640
|
Ae(() => {
|
|
@@ -648,19 +648,19 @@ function Je({
|
|
|
648
648
|
if (u === 0) return;
|
|
649
649
|
let L = 0, s = 0;
|
|
650
650
|
const e = [], j = [];
|
|
651
|
-
c.forEach((
|
|
652
|
-
const E = Number(
|
|
653
|
-
|
|
651
|
+
c.forEach((U) => {
|
|
652
|
+
const E = Number(U.flex);
|
|
653
|
+
U.width ? L += parseInt(U.width, 10) || 0 : U.flex && E > 0 ? (s += E, e.push(U)) : j.push(U);
|
|
654
654
|
});
|
|
655
655
|
const F = u - L, y = "80";
|
|
656
656
|
let A = [...c];
|
|
657
657
|
if (F > 0) {
|
|
658
658
|
if (e.length > 0) {
|
|
659
|
-
const
|
|
659
|
+
const U = F / s;
|
|
660
660
|
A = c.map((E) => {
|
|
661
661
|
const X = Number(E.flex);
|
|
662
662
|
if (X && X > 0) {
|
|
663
|
-
const v = parseInt(E.minWidth || y, 10), ee = X *
|
|
663
|
+
const v = parseInt(E.minWidth || y, 10), ee = X * U, ne = Math.max(ee, v);
|
|
664
664
|
return { ...E, width: `${Math.floor(ne)}px` };
|
|
665
665
|
}
|
|
666
666
|
return !E.width && !X ? {
|
|
@@ -669,18 +669,18 @@ function Je({
|
|
|
669
669
|
} : E;
|
|
670
670
|
});
|
|
671
671
|
} else if (j.length > 0) {
|
|
672
|
-
const
|
|
672
|
+
const U = F / j.length;
|
|
673
673
|
A = c.map((E) => {
|
|
674
674
|
const X = Number(E.flex);
|
|
675
675
|
if (!E.width && !X) {
|
|
676
|
-
const v = parseInt(E.minWidth || y, 10), ee = Math.max(
|
|
676
|
+
const v = parseInt(E.minWidth || y, 10), ee = Math.max(U, v);
|
|
677
677
|
return { ...E, width: `${Math.floor(ee)}px` };
|
|
678
678
|
}
|
|
679
679
|
return E;
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
682
|
} else
|
|
683
|
-
A = c.map((
|
|
683
|
+
A = c.map((U) => U.width ? U : { ...U, width: U.minWidth || `${y}px` });
|
|
684
684
|
D(A);
|
|
685
685
|
};
|
|
686
686
|
i();
|
|
@@ -719,7 +719,7 @@ function Je({
|
|
|
719
719
|
horizontalAlign: e.horizontalAlign,
|
|
720
720
|
size: f,
|
|
721
721
|
columnsTextSize: k,
|
|
722
|
-
withBorder:
|
|
722
|
+
withBorder: m,
|
|
723
723
|
headerAlign: e.headerAlign,
|
|
724
724
|
isLastColumn: j === n.length - 1,
|
|
725
725
|
children: ((F = e.columnRender) == null ? void 0 : F.call(e, x)) || /* @__PURE__ */ t.jsx("span", { title: e.label, children: e.label })
|
|
@@ -746,7 +746,7 @@ function Je({
|
|
|
746
746
|
horizontalAlign: "center",
|
|
747
747
|
size: f,
|
|
748
748
|
columnsTextSize: k,
|
|
749
|
-
withBorder:
|
|
749
|
+
withBorder: m,
|
|
750
750
|
width: e.width,
|
|
751
751
|
minWidth: e.minWidth,
|
|
752
752
|
maxWidth: e.maxWidth,
|
|
@@ -770,7 +770,7 @@ function Je({
|
|
|
770
770
|
horizontalAlign: A.horizontalAlign,
|
|
771
771
|
size: f,
|
|
772
772
|
columnsTextSize: k,
|
|
773
|
-
withBorder:
|
|
773
|
+
withBorder: m,
|
|
774
774
|
headerAlign: e.headerAlign,
|
|
775
775
|
isLastColumn: u + y === n.length - 1,
|
|
776
776
|
children: ((L = A.columnRender) == null ? void 0 : L.call(A, x)) || /* @__PURE__ */ t.jsx("span", { title: A.label, children: A.label })
|
|
@@ -792,7 +792,7 @@ function Je({
|
|
|
792
792
|
horizontalAlign: e.horizontalAlign,
|
|
793
793
|
size: f,
|
|
794
794
|
columnsTextSize: k,
|
|
795
|
-
withBorder:
|
|
795
|
+
withBorder: m,
|
|
796
796
|
headerAlign: e.headerAlign,
|
|
797
797
|
isTopRow: !0,
|
|
798
798
|
isLastColumn: u === n.length - 1,
|
|
@@ -828,7 +828,7 @@ function Je({
|
|
|
828
828
|
return !x || x.length === 0 ? /* @__PURE__ */ t.jsx(
|
|
829
829
|
ie,
|
|
830
830
|
{
|
|
831
|
-
backgroundColor:
|
|
831
|
+
backgroundColor: V.colors.backgroundColors.colorBackgroundSnow,
|
|
832
832
|
borders: !0,
|
|
833
833
|
mode: "table",
|
|
834
834
|
...H
|
|
@@ -841,7 +841,7 @@ function Je({
|
|
|
841
841
|
withBorderRadius: I,
|
|
842
842
|
ref: g,
|
|
843
843
|
borderRadius: w,
|
|
844
|
-
isVisible:
|
|
844
|
+
isVisible: b,
|
|
845
845
|
children: /* @__PURE__ */ t.jsxs(We, { id: r, ref: M, children: [
|
|
846
846
|
/* @__PURE__ */ t.jsx("thead", { children: d }),
|
|
847
847
|
/* @__PURE__ */ t.jsx("tbody", { style: { width: "100%" }, children: x == null ? void 0 : x.map((i, W, u) => {
|
|
@@ -852,7 +852,7 @@ function Je({
|
|
|
852
852
|
isLast: W === u.length - 1,
|
|
853
853
|
fit: o,
|
|
854
854
|
size: f,
|
|
855
|
-
withBorder:
|
|
855
|
+
withBorder: m,
|
|
856
856
|
isSelected: L === $ && R,
|
|
857
857
|
striped: N && W % 2 !== 0,
|
|
858
858
|
borderRadius: w,
|
|
@@ -875,7 +875,7 @@ function Je({
|
|
|
875
875
|
horizontalAlign: s.horizontalAlign,
|
|
876
876
|
verticalAlign: s.verticalAlign,
|
|
877
877
|
rowPadding: s.rowPadding,
|
|
878
|
-
withBorder:
|
|
878
|
+
withBorder: m,
|
|
879
879
|
isLast: W === u.length - 1,
|
|
880
880
|
disabled: (j = s.disable) == null ? void 0 : j.call(
|
|
881
881
|
s,
|
|
@@ -927,8 +927,8 @@ function Je({
|
|
|
927
927
|
export {
|
|
928
928
|
Fe as C,
|
|
929
929
|
Ee as D,
|
|
930
|
-
|
|
931
|
-
|
|
930
|
+
Ue as F,
|
|
931
|
+
Ve as M,
|
|
932
932
|
_e as S,
|
|
933
933
|
Pe as T,
|
|
934
934
|
Oe as a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./GenericAGGridTable-BW_ALIFn.cjs"),I=require("react"),X=require("sbwb-ds"),P=require("react-hook-form"),q=require("./index-CPP6SuZS.cjs"),Y=require("./parseDate-w5bp6OXe.cjs"),Z=350,K=({title:r,children:o,endAdornment:h=null,marginBottom:m="16px",customStyles:a={},wrapperCustomStyles:l={},animationContainerCustomStyles:u={},hideAdornmentOnCollapse:f=!1,maxHeight:S="none",height:L="fit-content"})=>{const[C,k]=I.useState(!1),[j,w]=I.useState(!0);I.useEffect(()=>{if(f)if(C){const b=setTimeout(()=>w(!1),Z);return()=>clearTimeout(b)}else w(!0)},[C,f]);const A=f&&!j?null:h;return e.jsxRuntimeExports.jsxs(e.Container,{width:"100%",flex:"1",gap:"8px",customStyles:l,children:[e.jsxRuntimeExports.jsx(e.SectionTitle,{title:r,divider:!0,marginBottom:m,collapse:{collapsed:C,setCollapsed:k},endAdornment:A,customStyles:a}),e.jsxRuntimeExports.jsx(e.Container,{gap:"8px",width:"100%",height:L,customStyles:{...u,maxHeight:C?"0":S,transition:`max-height ${Z}ms ease-in-out`},children:o})]})};function v({form:r,name:o,id:h=o,label:m,readonly:a=!1,disabled:l=!1,afterCheck:u,width:f="100%",formatter:S,parser:L,flex:C,size:k="Medium",checkColor:j,triggerFormField:w=null,...A}){const{onChangeTrigger:b}=e.useTriggerFormField({form:r,fieldName:o,triggerType:w,debounceTime:0}),x=(R,F)=>{F(R),u==null||u(R),b==null||b()};return e.jsxRuntimeExports.jsx(e.Container,{width:f,flex:C,children:e.jsxRuntimeExports.jsx(P.Controller,{name:o,control:r.control,render:({field:{onChange:R,value:F,onBlur:N},fieldState:{error:T=null}})=>{const M=T==null?void 0:T.message;return M&&console.log("Error on checkbox!",M),e.jsxRuntimeExports.jsx(e.Checkbox,{id:`form-checkbox-${h}`,checked:S?S(F):!!F,name:o,label:m,disabled:l||a,onChange:p=>{x((L==null?void 0:L(p.target.checked,F))??p.target.checked,R),N==null||N()},size:k,checkColor:j,...A})}})})}const B=({form:r,name:o,label:h,placeholder:m,readonly:a=!1,disabled:l=!1,width:u="100%",flex:f,tooltipIsVisible:S,tooltipMaxWidth:L,tooltipPosition:C="top",afterFormChange:k,openToDate:j,range:w=!1,openCalendarOnInputClick:A=!1,...b})=>{let x=m;return!q.valuable(m)&&!l&&(x=a?"Nenhuma data escolhida":"Escolha uma data"),e.jsxRuntimeExports.jsx(e.Container,{width:u,flex:f,children:e.jsxRuntimeExports.jsx(P.Controller,{name:o,control:r.control,render:({field:{value:R,onChange:F,ref:N}})=>{let T;q.valuable(R)&&(w?T=Array.isArray(R)?R.join(" - "):R:T=new Date(q.stringToUtcDate(R.slice(0,10))));const{error:M}=r.getFieldState(o,r.formState);return e.jsxRuntimeExports.jsx(e.Datepicker,{ref:N,idCalendar:`${o}-calendar`,label:h,value:T,size:"Small",readonly:a,errorMessage:M==null?void 0:M.message,disabled:l,placeholder:x,onChangeHandleDate:p=>{var n;F(w?p?p.split(" - ").map(D=>{var O;return((O=Y.parseDate(D))==null?void 0:O.slice(0,10))||null}):[null,null]:p&&((n=Y.parseDate(p))==null?void 0:n.slice(0,10))||null),k==null||k(p)},openToDate:j,selectsRange:w,openCalendarOnInputClick:A,width:u,flex:f,...b})}})})};function ee({form:r,name:o,label:h,slots:{field:m},slotsProps:a,triggerFormField:l=null,value:u,bypassControllerOnChange:f=!1,overrideOnBlur:S=!1,isRequired:L=!1,readonly:C=!1,disabled:k=!1,parser:j,debounce:w,beforeChange:A,onChange:b,afterChange:x,beforeBlur:R,onBlur:F,afterBlur:N,onEnter:T}){const{field:{value:M,onChange:p},fieldState:{error:n=null}}=P.useController({name:o,control:r.control}),D=q.valuable(w),{onChangeTrigger:O,onBlurTrigger:d}=e.useTriggerFormField({form:r,fieldName:o,triggerType:l,debounceTime:D?0:500}),i=(t,g)=>{var W,_;const $=((W=t==null?void 0:t.target)==null?void 0:W.value)||((_=t==null?void 0:t.target)==null?void 0:_.checked)||t||void 0,y=q.valuable(j)?j($):$;A==null||A(y),f||g==null||g(y),b==null||b(t,g),x==null||x(t,g),O==null||O()},E=I.useMemo(()=>{if(!D)return i;let t;return($,y)=>{clearTimeout(t),t=setTimeout(()=>i($,y),w)}},[D,w,i]),c=(t,g)=>{var y,W;const $=((y=t==null?void 0:t.target)==null?void 0:y.value)||((W=t==null?void 0:t.target)==null?void 0:W.checked)||t||void 0;!S&&f&&(p==null||p($)),R==null||R(t,g),F==null||F(t,g),N==null||N(t,g),d==null||d()},H=(t,g)=>{T==null||T(t,g)};n!=null&&n.message&&console.log(`Error on ${m.displayName}!`,n.message);const s=q.valuable(u)?u==null?void 0:u(M):{value:M};return e.jsxRuntimeExports.jsx(e.Container,{...a==null?void 0:a.container,children:e.jsxRuntimeExports.jsx(m,{...a==null?void 0:a.field,...s,label:h,onChange:t=>E==null?void 0:E(t,p),onBlur:t=>c==null?void 0:c(t,p),onEnter:t=>H==null?void 0:H(t,p),errorMessage:n==null?void 0:n.message})})}const te=({form:r,name:o,label:h,options:m,readonly:a=!1,disabled:l=!1,width:u="100%",flex:f,placeholder:S,iconName:L,onSelect:C,hasSelectAll:k=!1,tags:j=!0,sortOptions:w=!1,enableSearch:A=!1,valueAllOption:b,isRequired:x=!1,tooltipProps:R={},infoProps:F={},triggerFormField:N=null,...T})=>{const{onChangeTrigger:M}=e.useTriggerFormField({form:r,fieldName:o,triggerType:N,debounceTime:0});return e.jsxRuntimeExports.jsx(e.Container,{width:u,flex:f,children:e.jsxRuntimeExports.jsx(P.Controller,{name:o,control:r.control,render:({field:{value:p,onChange:n}})=>{const{error:D}=r.getFieldState(o),O=q.valuable(p)?p:[];return e.jsxRuntimeExports.jsx(e.MultiSelect,{label:h,size:"Small",disabled:l||a,onChange:d=>{n(d),C==null||C(d),M==null||M()},values:O,errorMessage:D==null?void 0:D.message,options:m,iconName:L,hasSelectAll:k,tags:j,sortOptions:w,placeholder:S,enableSearch:A,valueAllOption:b,isRequired:x,tooltipProps:{position:"top",...R},infoProps:{tooltipProps:{position:"top",maxWidth:"300px",...F.tooltipProps},...F},...T})}})})},se=({variant:r="default",form:o,name:h,label:m,options:a,readonly:l=!1,disabled:u=!1,optionsMap:f,width:S="100%",flex:L,placeholder:C,onSelect:k,parser:j,onPaste:w,filter:A,tooltipProps:b={},infoProps:x={},maxHeightMenu:R,isRequired:F=!1,onRemoveSelected:N,triggerFormField:T=null,displayText:M,usePortal:p=!1,...n})=>{const{onChangeTrigger:D}=e.useTriggerFormField({form:o,fieldName:h,triggerType:T,debounceTime:0}),O={position:"top",...b},d={...x,tooltipProps:{position:"top",maxWidth:"300px",...x==null?void 0:x.tooltipProps}},i=(c,H)=>{let s=c;j&&(s=j==null?void 0:j(c)),H(s),k==null||k(s),D==null||D()},E=I.useMemo(()=>q.valuable(f)?f:Object.fromEntries(a.map(c=>[c.value,c])),[a,f]);return e.jsxRuntimeExports.jsx(e.Container,{width:S,flex:L,children:e.jsxRuntimeExports.jsx(P.Controller,{name:h,control:o.control,render:({field:{onChange:c,value:H},fieldState:{error:s=null}})=>{let t=E[H];return e.jsxRuntimeExports.jsx(e.Select,{label:m,width:"100%",size:"Small",variant:r,disabled:u,readonly:l,filter:A,errorMessage:s==null?void 0:s.message,placeholder:C,value:t,handleOption:g=>{i(g.value,c)},tooltipProps:O,options:a,usePortal:p,infoProps:d,maxHeightMenu:R,isRequired:F,onRemoveSelected:N,displayText:M,onPaste:w,...n})}})})},le=r=>{const[o,h]=I.useState(!1),[m,a]=I.useState(r),l=I.useRef(null);return I.useEffect(()=>{a(r)},[r]),{setIsOpen:h,isOpen:o,setOptionsSelect:a,optionsSelect:m,selectContainerRef:l}},ie=200,ne=({name:r,variant:o="primary",width:h="100%",size:m="Medium",disabled:a=!1,isLoading:l=!1,onClick:u,options:f,label:S,menuSelectProps:L={},iconName:C,optionsIconPosition:k})=>{const{isOpen:j,setIsOpen:w,selectContainerRef:A,optionsSelect:b}=le(f);let x=e.y.colors.backgroundColors.colorBackgroundSnow;a?x=e.y.colors.neutralColors.colorNeutralCloudy:o!=="primary"&&(x=e.y.colors.neutralColors.colorNeutralDark);const R={...L};return e.jsxRuntimeExports.jsxs(e.SelectContainer,{ref:A,width:h,size:m,disabled:a,onBlur:()=>setTimeout(()=>w(!1),ie),children:[S&&e.jsxRuntimeExports.jsx(e.Label$3,{children:S}),e.jsxRuntimeExports.jsxs(e.Button$1,{type:"button",size:m,disabled:a,variant:o,isLoading:l,onClick:()=>!l&&w(!j),id:`button-component-${r}`,"data-cy":`button-component-${r}`,children:[l&&e.jsxRuntimeExports.jsx(e.WrapperIcon,{size:m,disabled:a,variant:o,children:e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ProgressActivity${m==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-loading"})}),!l&&e.jsxRuntimeExports.jsx("p",{title:r,children:r}),!l&&(j?e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ExpandLess${m==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-button-less"}):e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ExpandMore${m==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-button-more"}))]}),j&&e.jsxRuntimeExports.jsx(e.MenuSelect,{selectContainerRef:A,value:null,optionsSelect:b,selectOption:u,size:m,inputValue:null,iconPosition:k,iconName:C,...R})]})},re=({width:r="100%",height:o="fit-content",flex:h,backgroundColor:m=e.y.colors.backgroundColors.colorBackgroundCarpet,upperComponent:a=void 0,options:l=[],lowerComponent:u=void 0,heightItems:f="60px",widthItems:S="155px",emptyProps:L={title:"Nenhum dado a ser mostrado",body:null},customWrapperStyles:C={border:`1px solid ${e.y.colors.neutralColors.colorNeutralSoft}`,borderRadius:"8px"},customItemStyles:k={},selectedKey:j,onSelect:w,selectedItemKey:A,setSelectedItemKey:b})=>{var O;const x=j!==void 0,R=!x&&A!==void 0,[F,N]=I.useState(((O=l[0])==null?void 0:O.key)??null),T=I.useRef(null),M=I.useRef(null),p=x?j:R?A:F,n=I.useMemo(()=>l.length?p==null?x?null:l[0]:l.find(i=>i.key===p)??(x||R?null:l[0]):null,[l,p,x,R]);I.useEffect(()=>{const d=T.current,i=M.current,E=()=>{d&&i&&(i.scrollTop=d.scrollTop)};return d==null||d.addEventListener("scroll",E),()=>{d==null||d.removeEventListener("scroll",E)}},[]),I.useEffect(()=>{if(!(x||R)){if(!l.length){N(null);return}N(d=>d!=null&&l.some(i=>i.key===d)?d:l[0].key)}},[l,x,R]);const D=d=>{w==null||w(d),b==null||b(d.key),!x&&!R&&N(d.key)};return(l==null?void 0:l.length)===0?e.jsxRuntimeExports.jsx(e.Empty,{title:L.title,body:L.body,flex:"1",mode:"table"}):e.jsxRuntimeExports.jsxs(e.Container,{width:r,height:o,flex:h,backgroundColor:m,direction:"horizontal",customStyles:{border:`1px solid ${e.y.colors.neutralColors.colorNeutralSoft}`,borderRadius:e.y.borders.borderRadius.borderRadiusSm,...C,overflow:"hidden"},children:[e.jsxRuntimeExports.jsxs(e.Container$2,{ref:T,widthItems:S,children:[a&&a,l==null?void 0:l.map(d=>e.jsxRuntimeExports.jsx(e.ContainerItem,{selected:p===d.key,onClick:()=>D(d),withBorderRight:!0,heightItems:f,customStyles:k,children:d.item},d.key)),u&&u,e.jsxRuntimeExports.jsx(e.LastSpace,{})]}),e.jsxRuntimeExports.jsx(e.ContainerContent,{children:n&&(n==null?void 0:n.contentItem)})]})};function oe(r){return o=>typeof r=="string"?o[r]:typeof r=="function"?r(o):(console.warn("Please, setup a rowKey for table."),JSON.stringify(o))}function de({id:r,rowKey:o="id",size:h="Small",onRowClick:m,fit:a=!1,maxHeight:l="40rem",columns:u,dataSource:f,columnsTextSize:S=h,emptyProps:L={width:"100%",height:"100%",title:"Nenhum dado a ser mostrado.",mode:"table",borders:!0,backgroundColor:e.y.colors.backgroundColors.colorBackgroundSnow},selectedRow:C=!1,hideHeader:k=!1,withBorder:j=!0,withBorderRadius:w=!0,striped:A=!1,borderRadius:b=e.y.borders.borderRadius.borderRadiusSm,disableMaxHeight:x=!1,isVisible:R=!1}){const F=I.useMemo(()=>oe(o),[o]),[N,T]=I.useState(null),M=I.useRef(null),p=I.useRef(null),[n,D]=I.useState(u);I.useLayoutEffect(()=>{if(!p.current||u.length===0){D(u);return}const i=()=>{var _;const c=((_=p.current)==null?void 0:_.clientWidth)||0;if(c===0)return;let H=0,s=0;const t=[],g=[];u.forEach(U=>{const V=Number(U.flex);U.width?H+=parseInt(U.width,10)||0:U.flex&&V>0?(s+=V,t.push(U)):g.push(U)});const $=c-H,y="80";let W=[...u];if($>0){if(t.length>0){const U=$/s;W=u.map(V=>{const G=Number(V.flex);if(G&&G>0){const J=parseInt(V.minWidth||y,10),Q=G*U,z=Math.max(Q,J);return{...V,width:`${Math.floor(z)}px`}}return!V.width&&!G?{...V,width:V.minWidth||`${y}px`}:V})}else if(g.length>0){const U=$/g.length;W=u.map(V=>{const G=Number(V.flex);if(!V.width&&!G){const J=parseInt(V.minWidth||y,10),Q=Math.max(U,J);return{...V,width:`${Math.floor(Q)}px`}}return V})}}else W=u.map(U=>U.width?U:{...U,width:U.minWidth||`${y}px`});D(W)};i();const E=new ResizeObserver(i);return E.observe(p.current),()=>E.disconnect()},[u]),I.useEffect(()=>{const i=E=>{M.current&&!M.current.contains(E.target)&&T(null)};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]);const O=I.useMemo(()=>n?n.some(i=>i.mergeHeaderId&&i.mergeHeaderLabel):!1,[n]),d=I.useMemo(()=>{var H,s;if(k||!n||n.length===0)return null;if(!O)return e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:h,numRows:1,borderRadius:b,children:n.map((t,g)=>{var $;return e.jsxRuntimeExports.jsx(e.HeaderCell,{width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,horizontalAlign:t.horizontalAlign,size:h,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,isLastColumn:g===n.length-1,children:(($=t.columnRender)==null?void 0:$.call(t,f))||e.jsxRuntimeExports.jsx("span",{title:t.label,children:t.label})},t.dataIndex)})});const i=[],E=[];let c=0;for(;c<n.length;){const t=n[c];if(t.mergeHeaderId&&t.mergeHeaderLabel){let g=0;const $=t.mergeHeaderId;for(let y=c;y<n.length&&n[y].mergeHeaderId===$;y++)g++;i.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{colSpan:g,horizontalAlign:"center",size:h,columnsTextSize:S,withBorder:j,width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,headerAlign:t.headerAlign,isTopRow:!0,isLastColumn:c+g-1===n.length-1,children:e.jsxRuntimeExports.jsx("span",{title:t.mergeHeaderLabel,children:t.mergeHeaderLabel})},`${t.mergeHeaderId}-merged`));for(let y=0;y<g;y++){const W=n[c+y];E.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{width:W.width,minWidth:W.minWidth,maxWidth:W.maxWidth,horizontalAlign:W.horizontalAlign,size:h,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,isLastColumn:c+y===n.length-1,children:((H=W.columnRender)==null?void 0:H.call(W,f))||e.jsxRuntimeExports.jsx("span",{title:W.label,children:W.label})},W.dataIndex+"-individual"))}c+=g}else i.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{rowSpan:2,width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,horizontalAlign:t.horizontalAlign,size:h,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,isTopRow:!0,isLastColumn:c===n.length-1,children:((s=t.columnRender)==null?void 0:s.call(t,f))||e.jsxRuntimeExports.jsx("span",{title:t.label,children:t.label})},t.dataIndex)),c++}return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:h,numRows:2,borderRadius:b,children:i}),E.length>0&&e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:h,numRows:2,borderRadius:b,children:E})]})},[n,k,h,S,O]);return!f||f.length===0?e.jsxRuntimeExports.jsx(e.Empty,{backgroundColor:e.y.colors.backgroundColors.colorBackgroundSnow,borders:!0,mode:"table",...L}):e.jsxRuntimeExports.jsx(e.ContainerTable,{maxHeight:l,disableMaxHeight:x,withBorderRadius:w,ref:p,borderRadius:b,isVisible:R,children:e.jsxRuntimeExports.jsxs(e.Table,{id:r,ref:M,children:[e.jsxRuntimeExports.jsx("thead",{children:d}),e.jsxRuntimeExports.jsx("tbody",{style:{width:"100%"},children:f==null?void 0:f.map((i,E,c)=>{const H=F(i);return e.jsxRuntimeExports.jsx(e.TableRow,{isLast:E===c.length-1,fit:a,size:h,withBorder:j,isSelected:H===N&&C,striped:A&&E%2!==0,borderRadius:b,children:n.map((s,t)=>{var g,$,y,W,_;return e.jsxRuntimeExports.jsx(e.RowCell,{width:s.width,minWidth:s.minWidth,maxWidth:s.maxWidth,size:h,isClickable:q.valuable(m),isLastColumn:t===n.length-1,onClick:()=>{m&&m(i,s,E),C&&T(N===H?null:H)},horizontalAlign:s.horizontalAlign,verticalAlign:s.verticalAlign,rowPadding:s.rowPadding,withBorder:j,isLast:E===c.length-1,disabled:(g=s.disable)==null?void 0:g.call(s,i[s.dataIndex],i,E,c),hasError:($=s.warn)==null?void 0:$.call(s,i[s.dataIndex],i,E,c),backgroundColor:(y=s.paint)==null?void 0:y.call(s,i[s.dataIndex],i,E,c),children:((W=s.render)==null?void 0:W.call(s,i[s.dataIndex],i,E,c))||e.jsxRuntimeExports.jsx(e.CellText,{title:i[s.dataIndex],style:(_=s.rowCss)==null?void 0:_.call(s,i),children:i[s.dataIndex]})||""},`${H}::${s.dataIndex}`)})},H)})})]})})}exports.CheckboxField=v;exports.CollapseSection=K;exports.DateField=B;exports.FormFieldView=ee;exports.MultiSelectField=te;exports.SelectButton=ne;exports.SelectField=se;exports.TabInfo=re;exports.Table=de;
|
|
1
|
+
"use strict";const e=require("./GenericAGGridTable-CXb9pBC0.cjs"),I=require("react"),X=require("sbwb-ds"),P=require("react-hook-form"),q=require("./index-CPP6SuZS.cjs"),Y=require("./parseDate-w5bp6OXe.cjs"),Z=350,K=({title:r,children:o,endAdornment:h=null,marginBottom:m="16px",customStyles:a={},wrapperCustomStyles:l={},animationContainerCustomStyles:u={},hideAdornmentOnCollapse:f=!1,maxHeight:S="none",height:L="fit-content"})=>{const[C,k]=I.useState(!1),[j,w]=I.useState(!0);I.useEffect(()=>{if(f)if(C){const b=setTimeout(()=>w(!1),Z);return()=>clearTimeout(b)}else w(!0)},[C,f]);const A=f&&!j?null:h;return e.jsxRuntimeExports.jsxs(e.Container,{width:"100%",flex:"1",gap:"8px",customStyles:l,children:[e.jsxRuntimeExports.jsx(e.SectionTitle,{title:r,divider:!0,marginBottom:m,collapse:{collapsed:C,setCollapsed:k},endAdornment:A,customStyles:a}),e.jsxRuntimeExports.jsx(e.Container,{gap:"8px",width:"100%",height:L,customStyles:{...u,maxHeight:C?"0":S,transition:`max-height ${Z}ms ease-in-out`},children:o})]})};function v({form:r,name:o,id:h=o,label:m,readonly:a=!1,disabled:l=!1,afterCheck:u,width:f="100%",formatter:S,parser:L,flex:C,size:k="Medium",checkColor:j,triggerFormField:w=null,...A}){const{onChangeTrigger:b}=e.useTriggerFormField({form:r,fieldName:o,triggerType:w,debounceTime:0}),x=(R,F)=>{F(R),u==null||u(R),b==null||b()};return e.jsxRuntimeExports.jsx(e.Container,{width:f,flex:C,children:e.jsxRuntimeExports.jsx(P.Controller,{name:o,control:r.control,render:({field:{onChange:R,value:F,onBlur:N},fieldState:{error:T=null}})=>{const M=T==null?void 0:T.message;return M&&console.log("Error on checkbox!",M),e.jsxRuntimeExports.jsx(e.Checkbox,{id:`form-checkbox-${h}`,checked:S?S(F):!!F,name:o,label:m,disabled:l||a,onChange:p=>{x((L==null?void 0:L(p.target.checked,F))??p.target.checked,R),N==null||N()},size:k,checkColor:j,...A})}})})}const B=({form:r,name:o,label:h,placeholder:m,readonly:a=!1,disabled:l=!1,width:u="100%",flex:f,tooltipIsVisible:S,tooltipMaxWidth:L,tooltipPosition:C="top",afterFormChange:k,openToDate:j,range:w=!1,openCalendarOnInputClick:A=!1,...b})=>{let x=m;return!q.valuable(m)&&!l&&(x=a?"Nenhuma data escolhida":"Escolha uma data"),e.jsxRuntimeExports.jsx(e.Container,{width:u,flex:f,children:e.jsxRuntimeExports.jsx(P.Controller,{name:o,control:r.control,render:({field:{value:R,onChange:F,ref:N}})=>{let T;q.valuable(R)&&(w?T=Array.isArray(R)?R.join(" - "):R:T=new Date(q.stringToUtcDate(R.slice(0,10))));const{error:M}=r.getFieldState(o,r.formState);return e.jsxRuntimeExports.jsx(e.Datepicker,{ref:N,idCalendar:`${o}-calendar`,label:h,value:T,size:"Small",readonly:a,errorMessage:M==null?void 0:M.message,disabled:l,placeholder:x,onChangeHandleDate:p=>{var n;F(w?p?p.split(" - ").map(D=>{var O;return((O=Y.parseDate(D))==null?void 0:O.slice(0,10))||null}):[null,null]:p&&((n=Y.parseDate(p))==null?void 0:n.slice(0,10))||null),k==null||k(p)},openToDate:j,selectsRange:w,openCalendarOnInputClick:A,width:u,flex:f,...b})}})})};function ee({form:r,name:o,label:h,slots:{field:m},slotsProps:a,triggerFormField:l=null,value:u,bypassControllerOnChange:f=!1,overrideOnBlur:S=!1,isRequired:L=!1,readonly:C=!1,disabled:k=!1,parser:j,debounce:w,beforeChange:A,onChange:b,afterChange:x,beforeBlur:R,onBlur:F,afterBlur:N,onEnter:T}){const{field:{value:M,onChange:p},fieldState:{error:n=null}}=P.useController({name:o,control:r.control}),D=q.valuable(w),{onChangeTrigger:O,onBlurTrigger:d}=e.useTriggerFormField({form:r,fieldName:o,triggerType:l,debounceTime:D?0:500}),i=(t,g)=>{var W,_;const $=((W=t==null?void 0:t.target)==null?void 0:W.value)||((_=t==null?void 0:t.target)==null?void 0:_.checked)||t||void 0,y=q.valuable(j)?j($):$;A==null||A(y),f||g==null||g(y),b==null||b(t,g),x==null||x(t,g),O==null||O()},E=I.useMemo(()=>{if(!D)return i;let t;return($,y)=>{clearTimeout(t),t=setTimeout(()=>i($,y),w)}},[D,w,i]),c=(t,g)=>{var y,W;const $=((y=t==null?void 0:t.target)==null?void 0:y.value)||((W=t==null?void 0:t.target)==null?void 0:W.checked)||t||void 0;!S&&f&&(p==null||p($)),R==null||R(t,g),F==null||F(t,g),N==null||N(t,g),d==null||d()},H=(t,g)=>{T==null||T(t,g)};n!=null&&n.message&&console.log(`Error on ${m.displayName}!`,n.message);const s=q.valuable(u)?u==null?void 0:u(M):{value:M};return e.jsxRuntimeExports.jsx(e.Container,{...a==null?void 0:a.container,children:e.jsxRuntimeExports.jsx(m,{...a==null?void 0:a.field,...s,label:h,onChange:t=>E==null?void 0:E(t,p),onBlur:t=>c==null?void 0:c(t,p),onEnter:t=>H==null?void 0:H(t,p),errorMessage:n==null?void 0:n.message})})}const te=({form:r,name:o,label:h,options:m,readonly:a=!1,disabled:l=!1,width:u="100%",flex:f,placeholder:S,iconName:L,onSelect:C,hasSelectAll:k=!1,tags:j=!0,sortOptions:w=!1,enableSearch:A=!1,valueAllOption:b,isRequired:x=!1,tooltipProps:R={},infoProps:F={},triggerFormField:N=null,...T})=>{const{onChangeTrigger:M}=e.useTriggerFormField({form:r,fieldName:o,triggerType:N,debounceTime:0});return e.jsxRuntimeExports.jsx(e.Container,{width:u,flex:f,children:e.jsxRuntimeExports.jsx(P.Controller,{name:o,control:r.control,render:({field:{value:p,onChange:n}})=>{const{error:D}=r.getFieldState(o),O=q.valuable(p)?p:[];return e.jsxRuntimeExports.jsx(e.MultiSelect,{label:h,size:"Small",disabled:l||a,onChange:d=>{n(d),C==null||C(d),M==null||M()},values:O,errorMessage:D==null?void 0:D.message,options:m,iconName:L,hasSelectAll:k,tags:j,sortOptions:w,placeholder:S,enableSearch:A,valueAllOption:b,isRequired:x,tooltipProps:{position:"top",...R},infoProps:{tooltipProps:{position:"top",maxWidth:"300px",...F.tooltipProps},...F},...T})}})})},se=({variant:r="default",form:o,name:h,label:m,options:a,readonly:l=!1,disabled:u=!1,optionsMap:f,width:S="100%",flex:L,placeholder:C,onSelect:k,parser:j,onPaste:w,filter:A,tooltipProps:b={},infoProps:x={},maxHeightMenu:R,isRequired:F=!1,onRemoveSelected:N,triggerFormField:T=null,displayText:M,usePortal:p=!1,...n})=>{const{onChangeTrigger:D}=e.useTriggerFormField({form:o,fieldName:h,triggerType:T,debounceTime:0}),O={position:"top",...b},d={...x,tooltipProps:{position:"top",maxWidth:"300px",...x==null?void 0:x.tooltipProps}},i=(c,H)=>{let s=c;j&&(s=j==null?void 0:j(c)),H(s),k==null||k(s),D==null||D()},E=I.useMemo(()=>q.valuable(f)?f:Object.fromEntries(a.map(c=>[c.value,c])),[a,f]);return e.jsxRuntimeExports.jsx(e.Container,{width:S,flex:L,children:e.jsxRuntimeExports.jsx(P.Controller,{name:h,control:o.control,render:({field:{onChange:c,value:H},fieldState:{error:s=null}})=>{let t=E[H];return e.jsxRuntimeExports.jsx(e.Select,{label:m,width:"100%",size:"Small",variant:r,disabled:u,readonly:l,filter:A,errorMessage:s==null?void 0:s.message,placeholder:C,value:t,handleOption:g=>{i(g.value,c)},tooltipProps:O,options:a,usePortal:p,infoProps:d,maxHeightMenu:R,isRequired:F,onRemoveSelected:N,displayText:M,onPaste:w,...n})}})})},le=r=>{const[o,h]=I.useState(!1),[m,a]=I.useState(r),l=I.useRef(null);return I.useEffect(()=>{a(r)},[r]),{setIsOpen:h,isOpen:o,setOptionsSelect:a,optionsSelect:m,selectContainerRef:l}},ie=200,ne=({name:r,variant:o="primary",width:h="100%",size:m="Medium",disabled:a=!1,isLoading:l=!1,onClick:u,options:f,label:S,menuSelectProps:L={},iconName:C,optionsIconPosition:k})=>{const{isOpen:j,setIsOpen:w,selectContainerRef:A,optionsSelect:b}=le(f);let x=e.y.colors.backgroundColors.colorBackgroundSnow;a?x=e.y.colors.neutralColors.colorNeutralCloudy:o!=="primary"&&(x=e.y.colors.neutralColors.colorNeutralDark);const R={...L};return e.jsxRuntimeExports.jsxs(e.SelectContainer,{ref:A,width:h,size:m,disabled:a,onBlur:()=>setTimeout(()=>w(!1),ie),children:[S&&e.jsxRuntimeExports.jsx(e.Label$3,{children:S}),e.jsxRuntimeExports.jsxs(e.Button$1,{type:"button",size:m,disabled:a,variant:o,isLoading:l,onClick:()=>!l&&w(!j),id:`button-component-${r}`,"data-cy":`button-component-${r}`,children:[l&&e.jsxRuntimeExports.jsx(e.WrapperIcon,{size:m,disabled:a,variant:o,children:e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ProgressActivity${m==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-loading"})}),!l&&e.jsxRuntimeExports.jsx("p",{title:r,children:r}),!l&&(j?e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ExpandLess${m==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-button-less"}):e.jsxRuntimeExports.jsx(X.Icon,{iconName:`ExpandMore${m==="Small"?"Ant":"Sm"}`,color:x,"data-testid":"icon-button-more"}))]}),j&&e.jsxRuntimeExports.jsx(e.MenuSelect,{selectContainerRef:A,value:null,optionsSelect:b,selectOption:u,size:m,inputValue:null,iconPosition:k,iconName:C,...R})]})},re=({width:r="100%",height:o="fit-content",flex:h,backgroundColor:m=e.y.colors.backgroundColors.colorBackgroundCarpet,upperComponent:a=void 0,options:l=[],lowerComponent:u=void 0,heightItems:f="60px",widthItems:S="155px",emptyProps:L={title:"Nenhum dado a ser mostrado",body:null},customWrapperStyles:C={border:`1px solid ${e.y.colors.neutralColors.colorNeutralSoft}`,borderRadius:"8px"},customItemStyles:k={},selectedKey:j,onSelect:w,selectedItemKey:A,setSelectedItemKey:b})=>{var O;const x=j!==void 0,R=!x&&A!==void 0,[F,N]=I.useState(((O=l[0])==null?void 0:O.key)??null),T=I.useRef(null),M=I.useRef(null),p=x?j:R?A:F,n=I.useMemo(()=>l.length?p==null?x?null:l[0]:l.find(i=>i.key===p)??(x||R?null:l[0]):null,[l,p,x,R]);I.useEffect(()=>{const d=T.current,i=M.current,E=()=>{d&&i&&(i.scrollTop=d.scrollTop)};return d==null||d.addEventListener("scroll",E),()=>{d==null||d.removeEventListener("scroll",E)}},[]),I.useEffect(()=>{if(!(x||R)){if(!l.length){N(null);return}N(d=>d!=null&&l.some(i=>i.key===d)?d:l[0].key)}},[l,x,R]);const D=d=>{w==null||w(d),b==null||b(d.key),!x&&!R&&N(d.key)};return(l==null?void 0:l.length)===0?e.jsxRuntimeExports.jsx(e.Empty,{title:L.title,body:L.body,flex:"1",mode:"table"}):e.jsxRuntimeExports.jsxs(e.Container,{width:r,height:o,flex:h,backgroundColor:m,direction:"horizontal",customStyles:{border:`1px solid ${e.y.colors.neutralColors.colorNeutralSoft}`,borderRadius:e.y.borders.borderRadius.borderRadiusSm,...C,overflow:"hidden"},children:[e.jsxRuntimeExports.jsxs(e.Container$2,{ref:T,widthItems:S,children:[a&&a,l==null?void 0:l.map(d=>e.jsxRuntimeExports.jsx(e.ContainerItem,{selected:p===d.key,onClick:()=>D(d),withBorderRight:!0,heightItems:f,customStyles:k,children:d.item},d.key)),u&&u,e.jsxRuntimeExports.jsx(e.LastSpace,{})]}),e.jsxRuntimeExports.jsx(e.ContainerContent,{children:n&&(n==null?void 0:n.contentItem)})]})};function oe(r){return o=>typeof r=="string"?o[r]:typeof r=="function"?r(o):(console.warn("Please, setup a rowKey for table."),JSON.stringify(o))}function de({id:r,rowKey:o="id",size:h="Small",onRowClick:m,fit:a=!1,maxHeight:l="40rem",columns:u,dataSource:f,columnsTextSize:S=h,emptyProps:L={width:"100%",height:"100%",title:"Nenhum dado a ser mostrado.",mode:"table",borders:!0,backgroundColor:e.y.colors.backgroundColors.colorBackgroundSnow},selectedRow:C=!1,hideHeader:k=!1,withBorder:j=!0,withBorderRadius:w=!0,striped:A=!1,borderRadius:b=e.y.borders.borderRadius.borderRadiusSm,disableMaxHeight:x=!1,isVisible:R=!1}){const F=I.useMemo(()=>oe(o),[o]),[N,T]=I.useState(null),M=I.useRef(null),p=I.useRef(null),[n,D]=I.useState(u);I.useLayoutEffect(()=>{if(!p.current||u.length===0){D(u);return}const i=()=>{var _;const c=((_=p.current)==null?void 0:_.clientWidth)||0;if(c===0)return;let H=0,s=0;const t=[],g=[];u.forEach(U=>{const V=Number(U.flex);U.width?H+=parseInt(U.width,10)||0:U.flex&&V>0?(s+=V,t.push(U)):g.push(U)});const $=c-H,y="80";let W=[...u];if($>0){if(t.length>0){const U=$/s;W=u.map(V=>{const G=Number(V.flex);if(G&&G>0){const J=parseInt(V.minWidth||y,10),Q=G*U,z=Math.max(Q,J);return{...V,width:`${Math.floor(z)}px`}}return!V.width&&!G?{...V,width:V.minWidth||`${y}px`}:V})}else if(g.length>0){const U=$/g.length;W=u.map(V=>{const G=Number(V.flex);if(!V.width&&!G){const J=parseInt(V.minWidth||y,10),Q=Math.max(U,J);return{...V,width:`${Math.floor(Q)}px`}}return V})}}else W=u.map(U=>U.width?U:{...U,width:U.minWidth||`${y}px`});D(W)};i();const E=new ResizeObserver(i);return E.observe(p.current),()=>E.disconnect()},[u]),I.useEffect(()=>{const i=E=>{M.current&&!M.current.contains(E.target)&&T(null)};return document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}},[]);const O=I.useMemo(()=>n?n.some(i=>i.mergeHeaderId&&i.mergeHeaderLabel):!1,[n]),d=I.useMemo(()=>{var H,s;if(k||!n||n.length===0)return null;if(!O)return e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:h,numRows:1,borderRadius:b,children:n.map((t,g)=>{var $;return e.jsxRuntimeExports.jsx(e.HeaderCell,{width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,horizontalAlign:t.horizontalAlign,size:h,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,isLastColumn:g===n.length-1,children:(($=t.columnRender)==null?void 0:$.call(t,f))||e.jsxRuntimeExports.jsx("span",{title:t.label,children:t.label})},t.dataIndex)})});const i=[],E=[];let c=0;for(;c<n.length;){const t=n[c];if(t.mergeHeaderId&&t.mergeHeaderLabel){let g=0;const $=t.mergeHeaderId;for(let y=c;y<n.length&&n[y].mergeHeaderId===$;y++)g++;i.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{colSpan:g,horizontalAlign:"center",size:h,columnsTextSize:S,withBorder:j,width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,headerAlign:t.headerAlign,isTopRow:!0,isLastColumn:c+g-1===n.length-1,children:e.jsxRuntimeExports.jsx("span",{title:t.mergeHeaderLabel,children:t.mergeHeaderLabel})},`${t.mergeHeaderId}-merged`));for(let y=0;y<g;y++){const W=n[c+y];E.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{width:W.width,minWidth:W.minWidth,maxWidth:W.maxWidth,horizontalAlign:W.horizontalAlign,size:h,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,isLastColumn:c+y===n.length-1,children:((H=W.columnRender)==null?void 0:H.call(W,f))||e.jsxRuntimeExports.jsx("span",{title:W.label,children:W.label})},W.dataIndex+"-individual"))}c+=g}else i.push(e.jsxRuntimeExports.jsx(e.HeaderCell,{rowSpan:2,width:t.width,minWidth:t.minWidth,maxWidth:t.maxWidth,horizontalAlign:t.horizontalAlign,size:h,columnsTextSize:S,withBorder:j,headerAlign:t.headerAlign,isTopRow:!0,isLastColumn:c===n.length-1,children:((s=t.columnRender)==null?void 0:s.call(t,f))||e.jsxRuntimeExports.jsx("span",{title:t.label,children:t.label})},t.dataIndex)),c++}return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:h,numRows:2,borderRadius:b,children:i}),E.length>0&&e.jsxRuntimeExports.jsx(e.TableRow,{isHeader:!0,size:h,numRows:2,borderRadius:b,children:E})]})},[n,k,h,S,O]);return!f||f.length===0?e.jsxRuntimeExports.jsx(e.Empty,{backgroundColor:e.y.colors.backgroundColors.colorBackgroundSnow,borders:!0,mode:"table",...L}):e.jsxRuntimeExports.jsx(e.ContainerTable,{maxHeight:l,disableMaxHeight:x,withBorderRadius:w,ref:p,borderRadius:b,isVisible:R,children:e.jsxRuntimeExports.jsxs(e.Table,{id:r,ref:M,children:[e.jsxRuntimeExports.jsx("thead",{children:d}),e.jsxRuntimeExports.jsx("tbody",{style:{width:"100%"},children:f==null?void 0:f.map((i,E,c)=>{const H=F(i);return e.jsxRuntimeExports.jsx(e.TableRow,{isLast:E===c.length-1,fit:a,size:h,withBorder:j,isSelected:H===N&&C,striped:A&&E%2!==0,borderRadius:b,children:n.map((s,t)=>{var g,$,y,W,_;return e.jsxRuntimeExports.jsx(e.RowCell,{width:s.width,minWidth:s.minWidth,maxWidth:s.maxWidth,size:h,isClickable:q.valuable(m),isLastColumn:t===n.length-1,onClick:()=>{m&&m(i,s,E),C&&T(N===H?null:H)},horizontalAlign:s.horizontalAlign,verticalAlign:s.verticalAlign,rowPadding:s.rowPadding,withBorder:j,isLast:E===c.length-1,disabled:(g=s.disable)==null?void 0:g.call(s,i[s.dataIndex],i,E,c),hasError:($=s.warn)==null?void 0:$.call(s,i[s.dataIndex],i,E,c),backgroundColor:(y=s.paint)==null?void 0:y.call(s,i[s.dataIndex],i,E,c),children:((W=s.render)==null?void 0:W.call(s,i[s.dataIndex],i,E,c))||e.jsxRuntimeExports.jsx(e.CellText,{title:i[s.dataIndex],style:(_=s.rowCss)==null?void 0:_.call(s,i),children:i[s.dataIndex]})||""},`${H}::${s.dataIndex}`)})},H)})})]})})}exports.CheckboxField=v;exports.CollapseSection=K;exports.DateField=B;exports.FormFieldView=ee;exports.MultiSelectField=te;exports.SelectButton=ne;exports.SelectField=se;exports.TabInfo=re;exports.Table=de;
|