@zydon/common 2.8.43 → 2.8.45
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/{chunk-ORET77S7.js → chunk-3F7IG7L5.js} +3 -3
- package/dist/{chunk-PVJOWF4I.js → chunk-5VGZYUE7.js} +3 -3
- package/dist/{chunk-JWCPN44T.js → chunk-6RAHUEY4.js} +2 -2
- package/dist/{chunk-REPRWI3Y.js → chunk-7BSTOES7.js} +5 -5
- package/dist/{chunk-TXPDTQPO.js → chunk-AKXWNSJ2.js} +2 -2
- package/dist/{chunk-ENKYC5FD.js → chunk-B4B3DYXL.js} +2 -2
- package/dist/{chunk-OOTDAVZP.js → chunk-B6Z2DDZ3.js} +2 -2
- package/dist/{chunk-7LOACNA5.js → chunk-G6RPYFEW.js} +2 -2
- package/dist/{chunk-ZCYDKOBA.js → chunk-GHNW35K2.js} +2 -2
- package/dist/{chunk-6G3R27TK.js → chunk-GT6B5O6A.js} +5 -5
- package/dist/chunk-GT6B5O6A.js.map +1 -0
- package/dist/{chunk-RQCBR7G4.js → chunk-I6IPA6PC.js} +2 -2
- package/dist/{chunk-NNE2KBPQ.js → chunk-KB6LNVUR.js} +2 -2
- package/dist/{chunk-V3GFNNMP.js → chunk-KTIXBH2B.js} +2 -2
- package/dist/{chunk-7LLJEBIS.js → chunk-NGFMABYA.js} +2 -2
- package/dist/{chunk-HXKN6FG5.js → chunk-PYJ57NHL.js} +2 -2
- package/dist/{chunk-AOFPJ5C4.js → chunk-W7XPH3DV.js} +2 -2
- package/dist/{chunk-KFIRLGIO.js → chunk-WNDZ25TN.js} +3 -3
- package/dist/{chunk-3Q4SFI2E.js → chunk-WXAXG5QL.js} +2 -2
- package/dist/components/ActionButton/index.js +2 -2
- package/dist/components/Autocomplete/index.js +2 -2
- package/dist/components/AvatarButton/index.js +1 -1
- package/dist/components/BuilderLayout/index.js +2 -2
- package/dist/components/BuilderSidebar/index.js +1 -1
- package/dist/components/BulkEditModal/index.js +3 -3
- package/dist/components/CardBrand/index.js +1 -1
- package/dist/components/Common/index.js +1 -1
- package/dist/components/CopyButton/index.js +2 -2
- package/dist/components/DataView/index.js +3 -3
- package/dist/components/DragButton/index.js +2 -2
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/DynamicDataView/index.js +10 -10
- package/dist/components/DynamicDataView/index.js.map +1 -1
- package/dist/components/EasyCropModal/index.js +3 -3
- package/dist/components/Error/index.js +1 -1
- package/dist/components/ExpandableGroup/index.js +1 -1
- package/dist/components/FileUpload/index.js +6 -6
- package/dist/components/FrameSkeleton/index.js +1 -1
- package/dist/components/HelpButton/index.js +2 -2
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/IconButton/index.js +2 -2
- package/dist/components/ImageCropModal/index.js +2 -2
- package/dist/components/Incrementer/index.js +2 -2
- package/dist/components/InfoCircle/index.js +1 -1
- package/dist/components/ListBundles/index.js +2 -2
- package/dist/components/MenuItem/index.js +1 -1
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/MoreMenu/index.js +1 -1
- package/dist/components/NotFound/index.js +1 -1
- package/dist/components/PasswordRules/index.js +1 -1
- package/dist/components/PopoverSelect/index.js +1 -1
- package/dist/components/SearchInput/index.js +2 -2
- package/dist/components/SelectList/index.js +4 -4
- package/dist/components/SelectableCards/index.js +3 -3
- package/dist/components/SeoPreview/index.js +1 -1
- package/dist/components/StateDisplay/index.js +2 -2
- package/dist/components/Steps/index.js +1 -1
- package/dist/components/StyledTab/index.js +1 -1
- package/dist/components/SwapList/index.js +2 -2
- package/dist/components/WebhookCard/index.js +1 -1
- package/dist/components/carousel/index.js +2 -2
- package/dist/components/form/Address/index.js +3 -3
- package/dist/components/form/Autocomplete/index.js +3 -3
- package/dist/components/form/FileUpload/index.js +6 -6
- package/dist/components/form/Incrementer/index.js +2 -2
- package/dist/components/form/Password/index.js +1 -1
- package/dist/components/form/SelectList/index.js +4 -4
- package/dist/components/form/SelectableCards/index.js +3 -3
- package/dist/components/form/Webhook/index.js +4 -4
- package/dist/components/lightbox/index.js +1 -1
- package/dist/components/table/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-6G3R27TK.js.map +0 -1
- /package/dist/{chunk-ORET77S7.js.map → chunk-3F7IG7L5.js.map} +0 -0
- /package/dist/{chunk-PVJOWF4I.js.map → chunk-5VGZYUE7.js.map} +0 -0
- /package/dist/{chunk-JWCPN44T.js.map → chunk-6RAHUEY4.js.map} +0 -0
- /package/dist/{chunk-REPRWI3Y.js.map → chunk-7BSTOES7.js.map} +0 -0
- /package/dist/{chunk-TXPDTQPO.js.map → chunk-AKXWNSJ2.js.map} +0 -0
- /package/dist/{chunk-ENKYC5FD.js.map → chunk-B4B3DYXL.js.map} +0 -0
- /package/dist/{chunk-OOTDAVZP.js.map → chunk-B6Z2DDZ3.js.map} +0 -0
- /package/dist/{chunk-7LOACNA5.js.map → chunk-G6RPYFEW.js.map} +0 -0
- /package/dist/{chunk-ZCYDKOBA.js.map → chunk-GHNW35K2.js.map} +0 -0
- /package/dist/{chunk-RQCBR7G4.js.map → chunk-I6IPA6PC.js.map} +0 -0
- /package/dist/{chunk-NNE2KBPQ.js.map → chunk-KB6LNVUR.js.map} +0 -0
- /package/dist/{chunk-V3GFNNMP.js.map → chunk-KTIXBH2B.js.map} +0 -0
- /package/dist/{chunk-7LLJEBIS.js.map → chunk-NGFMABYA.js.map} +0 -0
- /package/dist/{chunk-HXKN6FG5.js.map → chunk-PYJ57NHL.js.map} +0 -0
- /package/dist/{chunk-AOFPJ5C4.js.map → chunk-W7XPH3DV.js.map} +0 -0
- /package/dist/{chunk-KFIRLGIO.js.map → chunk-WNDZ25TN.js.map} +0 -0
- /package/dist/{chunk-3Q4SFI2E.js.map → chunk-WXAXG5QL.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as a$1 } from './chunk-
|
|
1
|
+
import { a as a$1 } from './chunk-GT6B5O6A.js';
|
|
2
2
|
import c from '@mui/material/IconButton';
|
|
3
3
|
import s from '@mui/material/Stack';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
@@ -7,4 +7,4 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
7
7
|
var a=styled(c,{shouldForwardProp:t=>t!=="disableDrag"})(({theme:t})=>({position:"absolute",top:0,left:-2,zIndex:1,color:t.palette.grey[500],padding:"22px 5px",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",cursor:"grab","&:active":{cursor:"grabbing"},"@media (pointer:coarse)":{userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",touchAction:"none","&:active":{pointerEvents:"none"}}})),i=styled(s)({flexDirection:"row",alignItems:"center",justifyContent:"center",width:16,height:16,overflow:"hidden",transform:"scale(0.8)"});var u=({disableDrag:t,...l})=>t?null:jsx(a,{className:"dragIcon",disableRipple:!0,"aria-label":"Arrastar para ordenar",onTouchStart:e=>e.preventDefault(),onTouchMove:e=>e.preventDefault(),...l,children:jsxs(i,{children:[jsx(a$1,{sx:{marginLeft:0},icon:"MORE_BOLD",width:16}),jsx(a$1,{sx:{marginLeft:"-10px"},icon:"MORE_BOLD",width:16})]})}),D=u;
|
|
8
8
|
|
|
9
9
|
export { D as a };
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-I6IPA6PC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-GT6B5O6A.js';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import A from '@mui/material/IconButton';
|
|
4
4
|
import c from '@mui/material/InputAdornment';
|
|
@@ -8,4 +8,4 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
8
8
|
var h=({onSearch:n,onChange:a$1,trigger:d="click",iconPosition:r="end",tabIndex:f,InputProps:e,iconButtonAriaLabel:s="Buscar",...o})=>{let u=useRef(null),i=jsx(A,{color:"inherit",onClick:()=>{n(u.current?.value);},"aria-label":s,children:jsx(a,{icon:"SEARCH_MAGNIFYING_GLASS",width:20,height:20,color:"text.secondary"})});return jsx(g,{inputRef:u,sx:{"& .MuiOutlinedInput-root":{backgroundColor:"background.paper","& input::placeholder":{color:"text.disabled",opacity:.7}}},InputProps:{...e,onKeyDown:t=>{t.key==="Enter"&&(n(u.current?.value),t.preventDefault());},...r==="start"?{startAdornment:jsxs(c,{position:r,children:[i,e?.startAdornment]})}:{endAdornment:jsxs(c,{position:r,children:[i,e?.endAdornment]})}},inputProps:{tabIndex:f,name:o.name,...o.inputProps},onChange:t=>{if(d==="change"){n(t.target.value);return}t.target.value===""&&n(""),a$1&&a$1(t);},...o})},R=h;
|
|
9
9
|
|
|
10
10
|
export { R as a };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-KB6LNVUR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-GT6B5O6A.js';
|
|
2
2
|
import { memo, createContext, forwardRef, useContext, useMemo, useCallback, useRef, useEffect } from 'react';
|
|
3
3
|
import Ge, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
4
4
|
import fe from '@mui/material/CircularProgress';
|
|
@@ -15,4 +15,4 @@ import Ee from '@mui/material/Popper';
|
|
|
15
15
|
var z=memo(({params:e,name:t,placeholder:s,error:n,helperText:p,label:m,required:L,multiple:l,formattedValue:o,loading:a$1,tabIndex:u,InputLabelProps:y})=>jsx(be,{...e,name:t,placeholder:s,fullWidth:!0,error:!!n,helperText:p,label:m,required:L,InputProps:{...e.InputProps,...!l&&{startAdornment:o&&!Array.isArray(o)&&o.icon?jsx(a,{icon:o.icon}):void 0},endAdornment:jsxs(Fragment,{children:[a$1?jsx(fe,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,name:t,tabIndex:u},InputLabelProps:y}));z.displayName="AutocompleteInput";var D=z;var w=8,F=memo(e=>{let{data:t,index:s,style:n}=e,p=t[s],m={...n,top:n.top+w,paddingTop:8};if(Object.prototype.hasOwnProperty.call(p,"group")){let y=p;return jsx(Ie,{component:"div",style:m,children:y.group},`list-box-item-group-${y.group}`)}let[L,l]=p,{showValueInLabel:o,key:a$1,...u}=L;return jsx(V,{component:"li",...u,noWrap:!0,style:m,children:jsxs(Pe,{component:"div",direction:"row",flex:1,gap:1,justifyContent:"start",children:[l.icon&&jsx(a,{icon:l.icon}),l.label,o&&jsxs(V,{variant:"inherit",color:"grey.400",children:["(",l.value,")"]})]})},`list-box-item-${a$1}`)});F.displayName="ListboxRow";var B=F;var Re=createContext(void 0),x=Re;var Q=createContext({}),J=forwardRef((e,t)=>{let s=useContext(Q);return jsx("div",{ref:t,...e,...s})});J.displayName="OuterElementType";var Se=e=>{let t=useRef(null);return useEffect(()=>{t.current!=null&&t.current.resetAfterIndex(0,!0);},[e]),t},Te=forwardRef(function(t,s){let{children:n,...p}=t,m=useMemo(()=>{let r=[];return n.forEach(b=>{r.push(b),Object.prototype.hasOwnProperty.call(b,"children")&&Array.isArray(b.children)&&r.push(...b.children);}),r},[n]),L=useTheme(),l=Ce(L.breakpoints.up("sm")),o=m.length,a=l?36:48,u=useCallback(r=>Object.prototype.hasOwnProperty.call(r,"group")?48:a,[a]),y=useMemo(()=>o>8?8*a:m.map(u).reduce((r,b)=>r+b,0),[o,a,m,u]),g=Se(o),I=useContext(x),c=useRef(!1);useEffect(()=>{c.current=!1;},[o]);let R=useCallback(({visibleStopIndex:r})=>{I&&!c.current&&r>=o-3&&(c.current=!0,I());},[I,o]);return jsx("div",{ref:s,children:jsx(Q.Provider,{value:p,children:jsx(VariableSizeList,{itemData:m,height:y+2*w,width:"100%",ref:g,outerElementType:J,innerElementType:"ul",itemSize:r=>u(m[r]),overscanCount:5,itemCount:o,onItemsRendered:R,children:B})})})}),K=Te;var Y=styled(Ee)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var Ne=e=>e&&typeof e=="object"?e.value.toString():e.toString(),ze=e=>e,De=(e,t)=>{let s=t.inputValue.toLocaleUpperCase();return e.filter(n=>`${n.value} ${n.label}`.toLocaleUpperCase().includes(s))},ee=memo(forwardRef(({name:e,label:t,value:s,options:n=[],loading:p,noOptionsText:m="Nenhum resultado encontrado.",loadingText:L="Carregando op\xE7\xF5es...",error:l,helperText:o,placeholder:a,onChange:u,groupBy:y,showValueInLabel:g,disabled:I,multiple:c,required:R,renderOption:r,tabIndex:b,onInputChange:C,onSearch:A,onBlur:S,onScrollEnd:te,InputLabelProps:k,filterOptions:oe,...re},ne)=>{let G=useRef(null),T=useMemo(()=>c?(Array.isArray(s)?s:[]).reduce((f,v)=>{let N=n.find(ce=>ce.value.toString()===v.toString());return N?[...f,N]:[...f]},[]):n.find(i=>i.value.toString()===s?.toString())||null,[n,s,c]),ie=oe??(G.current==="reset"?void 0:De),se=useCallback((d,i,f)=>{if(G.current=f,C&&C(d,i,f),f==="input"){A&&A(i);return}f==="reset"&&A&&A(void 0),f==="clear"&&A&&A("");},[C,A]),pe=useCallback((d,i)=>{if(!i){u(c?[]:null);return}if(Array.isArray(i)){u(i.map(Ne));return}u(typeof i=="string"?i.toString():i.value.toString());},[u,c]),me=useCallback(d=>{S&&S(d);},[S]),ue=useCallback((d,i,f,v)=>r?r(d,i,f,v):[{...d,showValueInLabel:g},i],[r,g]),le=useMemo(()=>r?void 0:K,[r]),ae=useCallback(d=>jsx(D,{params:d,name:e,placeholder:a,error:l,helperText:o,label:t,required:R,multiple:c,formattedValue:T,loading:p,tabIndex:b,InputLabelProps:k}),[e,a,l,o,t,R,c,T,p,b,k]);return jsx(x.Provider,{value:te,children:jsx(Ge,{ref:ne,value:T,onInputChange:se,options:n,loading:p,noOptionsText:m,loadingText:L,disabled:I,disableListWrap:!0,PopperComponent:Y,ListboxComponent:le,filterOptions:ie,onChange:pe,onBlur:me,renderOption:ue,renderGroup:ze,groupBy:y,multiple:c,renderInput:ae,...re})})}));ee.displayName="Autocomplete";var Ct=ee;
|
|
16
16
|
|
|
17
17
|
export { Ct as a };
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-KTIXBH2B.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as a$1 } from './chunk-
|
|
1
|
+
import { a as a$1 } from './chunk-GT6B5O6A.js';
|
|
2
2
|
import p from '@mui/material/Button';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
5
|
var e=({link:o,...n})=>jsx(p,{...n,startIcon:jsx(a$1,{icon:"HELP_CIRCLE"}),variant:"outlined",color:"inherit",...o&&{href:o,target:"_blank"},children:"Ajuda"}),a=e;
|
|
6
6
|
|
|
7
7
|
export { a };
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-NGFMABYA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-GT6B5O6A.js';
|
|
2
2
|
import M from '@mui/material/Dialog';
|
|
3
3
|
import k from '@mui/material/DialogTitle';
|
|
4
4
|
import B from '@mui/material/IconButton';
|
|
@@ -11,4 +11,4 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
11
11
|
var l=styled(P)(({theme:o})=>({flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${o.palette.divider}`,button:{marginRight:24}})),c=styled(D)({padding:24}),d=styled(x)(({theme:o})=>({borderTop:`1px solid ${o.palette.divider}`,backgroundColor:o.palette.background.paper}));var h=({children:o,actionsProps:i})=>jsx(d,{"data-testid":"modal-actions",...i,children:o}),m=h;var O=({actions:o,actionsProps:i,children:A,dialogContentProps:g,dialogTitle:r,dialogTitleProps:b,onClose:e,id:a$1,...C})=>{let u=a$1||"actions",p="caixa de di\xE1logo";return jsxs(M,{"aria-label":r?`${p}: ${r}`:p,id:a$1,scroll:"body",...C,onClose:e,children:[jsxs(l,{children:[r&&jsx(k,{variant:"subtitle1",...b,children:r}),jsx(B,{onClick:e,"aria-label":"fechar caixa de di\xE1logo",children:jsx(a,{icon:"CLOSE_MARK_BUTTON"})})]}),jsx(c,{"data-testid":"modal-content",...g,children:A}),o&&jsx(m,{actionsProps:{...i,id:u},children:o})]})},U=O;
|
|
12
12
|
|
|
13
13
|
export { U as a };
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-PYJ57NHL.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a } from './chunk-W3CK33IH.js';
|
|
2
2
|
import { f } from './chunk-OF6623HG.js';
|
|
3
|
-
import { a as a$1 } from './chunk-
|
|
3
|
+
import { a as a$1 } from './chunk-GT6B5O6A.js';
|
|
4
4
|
import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
|
|
5
5
|
import T from '@mui/material/IconButton';
|
|
6
6
|
import R from '@mui/material/InputAdornment';
|
|
@@ -9,4 +9,4 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
9
9
|
var C=forwardRef(({name:M,increment:e=1,updadteForMultiple:P,allowNegative:u=!1,value:m,onChange:c,minValue:r,maxValue:o,decimalScale:p,disabled:i,tabIndex:w,labelIncrementer:B,labelDecrementer:O,placeholder:z,InputProps:y,...E},L)=>{let[N,_]=useState(`incrementer-input-${Date.now()}`),I=useRef(null),s=Number(m||0),b=()=>{I.current&&(clearTimeout(I.current),I.current=null);},$=useMemo(()=>{let n=s-e;return typeof r=="number"&&n<r?!0:i||!u&&n<0},[i,s,e,r,u]),G=useMemo(()=>{let n=s+e;return typeof o=="number"&&n>o?!0:i},[i,s,e,o]),H=useCallback(()=>{if(b(),!u&&s-e<0)return;let n=s-e,t=r!==void 0&&n<r?r:f(n,p);c(t);},[s,e,r,p,c,u]),K=n=>r!==void 0&&n<r?r:o!==void 0&&n>o?o:f(n,p),U=useCallback(()=>{b();let n=s+e,t=K(n);c(t);},[s,e,o,r,p,c]),W=useCallback(n=>{b();let t=Number(n.target.value||0);(e!==1||P)&&(t=t+e/2,t-=t%e),!u&&t<0&&(t=0),typeof r=="number"&&t<r&&(t=r),typeof o=="number"&&t>o&&(t=o),t=f(t,p),(!t||t===m)&&(I.current=setTimeout(()=>{_(`incrementer-input-${Date.now()}`);},600)),c(t);},[m,e,r,o,p,c,P,u]);return jsx(a,{ref:L,name:M,value:m,minValue:r,maxValue:o,allowNegative:u,decimalScale:p,InputProps:{...y,startAdornment:jsx(R,{position:"start",sx:{ml:-1},children:jsx(T,{onClick:H,disabled:$,size:"small","aria-label":O||"Decrementa",sx:{p:.5},children:jsx(a$1,{icon:"MINUS_SIGN",width:14,height:14,color:"primary.main"})})}),endAdornment:jsx(R,{position:"end",sx:{mr:-1},children:jsx(T,{onClick:U,disabled:G,size:"small","aria-label":B||"Incrementa",sx:{p:.5},children:jsx(a$1,{icon:"SIMPLE_ADD",width:14,height:14,color:"primary.main"})})}),inputProps:{...y?.inputProps,style:{...y?.inputProps?.style,textAlign:"center"},sx:{mx:-2.5}}},inputProps:{tabIndex:w},onChange:W,disabled:i,placeholder:z,...E},N)});C.displayName="Incrementer";var x=C;
|
|
10
10
|
|
|
11
11
|
export { x as a };
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-W7XPH3DV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as a$4 } from './chunk-
|
|
1
|
+
import { a as a$4 } from './chunk-KB6LNVUR.js';
|
|
2
2
|
import { a as a$5 } from './chunk-IJZCVZ32.js';
|
|
3
3
|
import { a as a$8 } from './chunk-IDFJFFIV.js';
|
|
4
4
|
import { a as a$6 } from './chunk-6U5LS7MP.js';
|
|
@@ -6,7 +6,7 @@ import { i, j, a as a$2, b as b$1, c, d, f, e, g, h as h$1 } from './chunk-2W54C
|
|
|
6
6
|
import { a as a$7 } from './chunk-F65ZXAGV.js';
|
|
7
7
|
import { a as a$9 } from './chunk-I4PPSW36.js';
|
|
8
8
|
import { a as a$3 } from './chunk-CO2KQFUN.js';
|
|
9
|
-
import { a } from './chunk-
|
|
9
|
+
import { a } from './chunk-GT6B5O6A.js';
|
|
10
10
|
import { a as a$1 } from './chunk-LQRRMVFN.js';
|
|
11
11
|
import { b } from './chunk-RPO7AI5K.js';
|
|
12
12
|
import { memo, forwardRef, useState, useRef, useEffect, useCallback, useMemo, Fragment as Fragment$1, Children, isValidElement, cloneElement } from 'react';
|
|
@@ -23,4 +23,4 @@ import { GridToolbarColumnsButton } from '@mui/x-data-grid-premium';
|
|
|
23
23
|
var A="datagrid-actions";var Ho=({rowCount:r,page:e,rowsPerPage:n,onPaginationChange:a})=>jsxs(i,{children:[jsxs(h,{direction:"row",alignItems:"center",gap:.5,children:[jsx(po,{variant:"body2",color:"text.disabled",children:"Total de itens:"}),jsx(po,{variant:"body2",children:r})]}),jsx(j,{count:r,page:e,rowsPerPage:n,onPageChange:s=>a(s,n),onRowsPerPageChange:s=>a(e,s)})]}),uo=memo(Ho);var ho=(r,e)=>Children.map(r,n=>{if(!isValidElement(n))return n;let a=n.props.onClick,s={};s.onClick=(...d)=>{e(),a&&a(...d);};let l=n.props;return l?.children&&(s.children=ho(l.children,e)),cloneElement(n,s)}),Vo=({children:r,onClose:e})=>r?ho(r,e):null,go=memo(Vo);var qo=forwardRef(({children:r,...e},n)=>jsx(H,{...e,ref:n,color:"inherit",startIcon:jsx(a,{icon:"COLUMNS"}),children:r??"Colunas"}));qo.displayName="ColumnsButton";var Qo=({setFilterButtonEl:r})=>{let e=useCallback(n=>{r(n);},[r]);return jsx(a$9,{container:A,children:jsx(GridToolbarColumnsButton,{ref:e,slotProps:{button:{color:"inherit",startIcon:jsx(a,{icon:"COLUMNS"}),children:"Colunas"}}})})},Co=Qo;var nt=({title:r,header:e$1,headerProps:n,breakpoint:a$9="md",columns:s,rows:l=[],mobileSlots:d$1,mobileSlotsProps:O,mobileRender:ko,rowCount:b$2=0,paginationModel:m={page:0,pageSize:25},onPaginationChange:f$1,actions:L,moreActions:N,onAdd:F,onSearch:V,searchValue:To,onSearchChange:vo,slots:C,slotProps:Do,loading:P,fetching:z,fetchingNextPage:So,containerProps:yo={height:562,maxHeight:562},hideFooter:_,showColumnButton:R=!1,filterButton:k,activeFilters:W,onRowsScrollEnd:v,scrollEndThreshold:w=200,...Ao})=>{let u=a$1(),c$1=b("down",a$9),[bo,Ro]=useState(null),U=useRef(null);useEffect(()=>{let i=U.current;if(!i||!c$1||!v)return;let K=()=>{let{scrollTop:xo,scrollHeight:Eo,clientHeight:Io}=i;Eo-xo-Io<=w&&v();};return i.addEventListener("scroll",K,{passive:!0}),()=>{i.removeEventListener("scroll",K);}},[c$1,v,w,l.length]);let q=!!V,M=!!F,D=!!L,x=!!N,E=c$1&&x,S=!c$1&&x,wo=D||M||E,Q=S||q||R||!!k||!c$1,J=useCallback(()=>f$1?jsx(uo,{rowCount:b$2,page:m.page,rowsPerPage:m.pageSize,onPaginationChange:f$1}):null,[b$2,m,f$1]),Mo=useMemo(()=>({...C,footer:J,...R&&!C?.toolbar&&{toolbar:Co}}),[C,J,R]);return jsxs(a$2,{breakpoint:a$9,...yo,flex:P?1:void 0,minHeight:P||l.length===0?562:void 0,children:[e$1?jsx(h,{p:3,...n,children:e$1}):jsxs(Fragment,{children:[jsxs(b$1,{breakpoint:a$9,children:[jsx(po,{variant:"overline",color:"text.secondary",noWrap:!0,children:r}),wo&&jsxs(c,{breakpoint:a$9,children:[D&&L,M&&jsxs(Fragment,{children:[D&&jsx(d,{orientation:"vertical",flexItem:!0}),jsx(H,{startIcon:jsx(a,{icon:"SIMPLE_ADD"}),variant:"contained",onClick:F,children:"Adicionar"})]}),E&&jsxs(Fragment,{children:[(D||M)&&jsx(d,{orientation:"vertical",flexItem:!0}),jsx(H,{color:"inherit",startIcon:jsx(a,{icon:"MORE_BOLD"}),size:"small",onClick:u.onOpen,children:"Mais"})]})]})]}),Q&&jsxs(f,{breakpoint:a$9,children:[jsxs(h,{flex:1,direction:"row",alignItems:"center",id:A,gap:.5,children:[x&&jsxs(Fragment,{children:[S&&jsxs(Fragment,{children:[jsx(H,{color:"inherit",startIcon:jsx(a,{icon:"MORE_BOLD"}),size:"small",onClick:u.onOpen,children:"Mais"}),!c$1&&jsx(e,{orientation:"vertical",flexItem:!0})]}),(S||E)&&jsx(a$3,{open:u.open,anchorEl:u.open,onClose:u.onClose,sx:{minWidth:160},disabledArrow:!0,children:jsx(go,{onClose:u.onClose,children:N})})]}),!c$1&&k&&jsxs(Fragment,{children:[k,S&&jsx(e,{orientation:"vertical",flexItem:!0})]})]}),q&&jsxs(g,{breakpoint:a$9,children:[jsx(a$4,{value:To,placeholder:"Buscar",onSearch:V,onChange:i=>vo?.(i.target.value),size:"small",fullWidth:!0,iconPosition:"start"}),c$1&&k&&jsx(h,{ml:1,children:k})]})]}),W&&W,!Q&&jsx(rt,{sx:{mt:2}})]}),c$1?jsxs(a$5,{isFetching:z,fetching:jsx(a$6,{}),isLoading:P,loading:jsx(tt,{sx:{m:"160px auto"}}),isEmpty:l.length===0,empty:jsxs(h,{flex:1,direction:"column",...O,children:[d$1&&d$1,jsx(h,{flex:1,alignItems:"center",justifyContent:"center",children:C?.noRowsOverlay?jsx(C.noRowsOverlay,{}):jsx(po,{variant:"body2",color:"text.secondary",children:"Nenhum registro encontrado"})})]}),children:[jsxs(h,{direction:"column",flex:1,minHeight:0,...O,children:[d$1&&d$1,jsx(a$7,{fillContent:!0,ref:U,children:l.map(i=>jsx(Fragment$1,{children:ko(i)},i.id))})]}),!_&&f$1&&jsx(h$1,{children:jsx(j,{count:b$2,page:m.page,rowsPerPage:m.pageSize,onPageChange:i=>f$1?.(i,m.pageSize),onRowsPerPageChange:i=>f$1?.(m.page,i)})})]}):jsx(a$8,{columns:s,rows:l,slots:Mo,slotProps:{panel:{anchorEl:bo},toolbar:{setFilterButtonEl:Ro,showQuickFilter:!0},...Do},columnHeaderHeight:48,getRowHeight:()=>68,loading:P,fetching:z,hideFooter:_,onRowsScrollEnd:v,scrollEndThreshold:w,...Ao}),So&&jsx(et,{})]},P?"loading":"data")},Yt=memo(nt,ot);
|
|
24
24
|
|
|
25
25
|
export { uo as a, go as b, Co as c, Yt as d };
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-WNDZ25TN.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-KTIXBH2B.js';
|
|
2
2
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
5
|
var f=({name:t,helperText:s,rules:u,onSelectOption:r,InputLabelProps:m,onBlur:n,...p})=>{let{control:c}=useFormContext(),C=e=>o=>{r&&r(o,e.value),e.onChange(o);};return jsx(Controller,{name:t,control:c,rules:u,render:({field:e,fieldState:{error:o}})=>{let g=h=>{e.onBlur(),n&&n(h);};return jsx(a,{"data-intercom-target":t,...e,...p,onChange:C(e),onBlur:g,error:!!o,helperText:o?.message||s,InputLabelProps:m})}})},B=f;
|
|
6
6
|
|
|
7
7
|
export { B as a };
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-WXAXG5QL.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as a$4 } from '../../chunk-5EKUS6HX.js';
|
|
2
2
|
import { a as a$5 } from '../../chunk-T6UNWMMX.js';
|
|
3
3
|
import { a } from '../../chunk-CO2KQFUN.js';
|
|
4
|
-
import { a as a$3 } from '../../chunk-
|
|
4
|
+
import { a as a$3 } from '../../chunk-GT6B5O6A.js';
|
|
5
5
|
import '../../chunk-5EAE4SP2.js';
|
|
6
6
|
import { a as a$2 } from '../../chunk-VR3K2Y2C.js';
|
|
7
7
|
import { a as a$1 } from '../../chunk-LQRRMVFN.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as a$1 } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { a as a$1 } from '../../chunk-NGFMABYA.js';
|
|
2
|
+
import '../../chunk-GT6B5O6A.js';
|
|
3
3
|
import '../../chunk-5EAE4SP2.js';
|
|
4
4
|
import a from '@mui/material/Stack';
|
|
5
5
|
import { styled, alpha } from '@mui/material/styles';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a } from '../../chunk-
|
|
1
|
+
import { a } from '../../chunk-WXAXG5QL.js';
|
|
2
2
|
import { j as j$1 } from '../../chunk-2W54CJ6E.js';
|
|
3
3
|
import '../../chunk-UVPQR2Q2.js';
|
|
4
4
|
import { a as a$1 } from '../../chunk-RBTYTONM.js';
|
|
5
5
|
import { a as a$3 } from '../../chunk-I4PPSW36.js';
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import { a as a$2 } from '../../chunk-
|
|
6
|
+
import '../../chunk-KTIXBH2B.js';
|
|
7
|
+
import { a as a$2 } from '../../chunk-GT6B5O6A.js';
|
|
8
8
|
import '../../chunk-5EAE4SP2.js';
|
|
9
9
|
import { memo, useEffect, useState, useMemo, useCallback } from 'react';
|
|
10
10
|
import { useFormContext, useWatch, useForm, FormProvider } from 'react-hook-form';
|
|
@@ -2,7 +2,7 @@ import '../../chunk-MZN5X6GM.js';
|
|
|
2
2
|
import { a as a$1 } from '../../chunk-RFAAH7QG.js';
|
|
3
3
|
import '../../chunk-HSJS3HUW.js';
|
|
4
4
|
import '../../chunk-IL3EAU5G.js';
|
|
5
|
-
import { a } from '../../chunk-
|
|
5
|
+
import { a } from '../../chunk-GT6B5O6A.js';
|
|
6
6
|
import '../../chunk-5EAE4SP2.js';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-GHNW35K2.js';
|
|
2
2
|
import '../../chunk-FBN7HCBY.js';
|
|
3
|
-
import '../../chunk-
|
|
3
|
+
import '../../chunk-GT6B5O6A.js';
|
|
4
4
|
import '../../chunk-5EAE4SP2.js';
|
|
5
5
|
import '../../chunk-IAOMC4C4.js';
|
|
6
6
|
import '../../chunk-CFNATBO2.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as DesktopFooter, b as EnhancedMoreActions, c as Toolbar, d as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { a as DesktopFooter, b as EnhancedMoreActions, c as Toolbar, d as default } from '../../chunk-WNDZ25TN.js';
|
|
2
|
+
import '../../chunk-KB6LNVUR.js';
|
|
3
3
|
import '../../chunk-IJZCVZ32.js';
|
|
4
4
|
import '../../chunk-IDFJFFIV.js';
|
|
5
5
|
import '../../chunk-6U5LS7MP.js';
|
|
@@ -11,7 +11,7 @@ import '../../chunk-RBTYTONM.js';
|
|
|
11
11
|
import '../../chunk-F65ZXAGV.js';
|
|
12
12
|
import '../../chunk-I4PPSW36.js';
|
|
13
13
|
import '../../chunk-CO2KQFUN.js';
|
|
14
|
-
import '../../chunk-
|
|
14
|
+
import '../../chunk-GT6B5O6A.js';
|
|
15
15
|
import '../../chunk-5EAE4SP2.js';
|
|
16
16
|
import '../../chunk-LQRRMVFN.js';
|
|
17
17
|
import '../../chunk-RPO7AI5K.js';
|
|
@@ -3,14 +3,14 @@ export { a as FilterOperator, b as SortType } from '../../chunk-VL4W63YA.js';
|
|
|
3
3
|
import { a as a$1 } from '../../chunk-LG2B5RFV.js';
|
|
4
4
|
import { d, c } from '../../chunk-N7IK5EUP.js';
|
|
5
5
|
import { h, a as a$3 } from '../../chunk-OF6623HG.js';
|
|
6
|
-
import { d as d$1 } from '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
6
|
+
import { d as d$1 } from '../../chunk-WNDZ25TN.js';
|
|
7
|
+
import '../../chunk-KB6LNVUR.js';
|
|
8
8
|
import '../../chunk-IJZCVZ32.js';
|
|
9
9
|
import '../../chunk-IDFJFFIV.js';
|
|
10
10
|
import '../../chunk-6U5LS7MP.js';
|
|
11
11
|
import '../../chunk-BNBE2OMA.js';
|
|
12
12
|
import '../../chunk-NIQW2J3M.js';
|
|
13
|
-
import { a as a$2 } from '../../chunk-
|
|
13
|
+
import { a as a$2 } from '../../chunk-GHNW35K2.js';
|
|
14
14
|
import '../../chunk-FBN7HCBY.js';
|
|
15
15
|
import { e } from '../../chunk-2W54CJ6E.js';
|
|
16
16
|
import '../../chunk-UVPQR2Q2.js';
|
|
@@ -18,7 +18,7 @@ import '../../chunk-RBTYTONM.js';
|
|
|
18
18
|
import '../../chunk-F65ZXAGV.js';
|
|
19
19
|
import '../../chunk-I4PPSW36.js';
|
|
20
20
|
import '../../chunk-CO2KQFUN.js';
|
|
21
|
-
import { a } from '../../chunk-
|
|
21
|
+
import { a } from '../../chunk-GT6B5O6A.js';
|
|
22
22
|
import '../../chunk-5EAE4SP2.js';
|
|
23
23
|
import '../../chunk-IAOMC4C4.js';
|
|
24
24
|
import { a as a$5 } from '../../chunk-F6H765KA.js';
|
|
@@ -35,24 +35,24 @@ import Po from 'react-fast-compare';
|
|
|
35
35
|
import Xe from '@mui/material/Badge';
|
|
36
36
|
import he from '@mui/material/Button';
|
|
37
37
|
import Qe from '@mui/material/IconButton';
|
|
38
|
-
import
|
|
38
|
+
import _t from '@mui/material/Stack';
|
|
39
39
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
40
40
|
import dt from '@mui/material/Divider';
|
|
41
41
|
import Se from '@mui/material/Typography';
|
|
42
42
|
import fe from '@mui/material/FormControl';
|
|
43
43
|
import Ce from '@mui/material/InputLabel';
|
|
44
|
-
import
|
|
44
|
+
import X from '@mui/material/MenuItem';
|
|
45
45
|
import ge from '@mui/material/Select';
|
|
46
46
|
import Qo from '@mui/material/TextField';
|
|
47
|
-
import
|
|
47
|
+
import j from '@mui/material/Box';
|
|
48
48
|
import { styled } from '@mui/material/styles';
|
|
49
49
|
import Sr from '@mui/material/Dialog';
|
|
50
50
|
import br from '@mui/material/DialogActions';
|
|
51
51
|
import hr from '@mui/material/DialogContent';
|
|
52
52
|
import Fr from '@mui/material/DialogTitle';
|
|
53
|
-
import
|
|
53
|
+
import Yr from '@mui/material/Chip';
|
|
54
54
|
|
|
55
|
-
var Bo=({showFilterButton:e$1,isMobile:t,hasActiveFilters:o,activeFiltersCount:i,sort:n,onFilterClick:r,onSortClick:l})=>e$1?t?jsxs(Nt,{direction:"row",spacing:.5,children:[jsx(Xe,{badgeContent:i,color:"primary",invisible:i===0,sx:{"& .MuiBadge-badge":{transform:"scale(0.9) translate(10px, 9px)",opacity:i===0?0:1}},children:jsx(Qe,{color:o?"primary":"default",onClick:r,size:"small","aria-label":"Filtrar",sx:{overflow:"visible"},children:jsx(a,{icon:"FILTER_VERTICAL"})})}),jsx(e,{sx:{height:16},orientation:"vertical",flexItem:!0}),jsx(Qe,{color:n?"primary":"default",onClick:l,size:"small","aria-label":"Ordenar",children:jsx(a,{icon:n?.sortType==="DESC"?"SORTING_DESC":"SORTING_ASC"})})]}):jsx(Xe,{badgeContent:i,color:"primary",invisible:i===0,sx:{"& .MuiBadge-badge":i?{transform:"scale(0.9) translate(-3px, 7px)",position:"relative",opacity:1,transition:"none"}:{transition:"none",opacity:0}},children:jsx(he,{variant:"text",color:o?"primary":"inherit",startIcon:jsx(a,{icon:"FILTER_VERTICAL"}),onClick:r,size:"small",children:"Filtrar"})}):null,je=memo(Bo,Po);var Je=e=>e.filter(t=>t.available_filter_conditions&&t.available_filter_conditions.length>0&&t.name!=="ACTIONS");var Ze=e=>{let{type:t,available_filter_conditions:o}=e;return o.length===0?"EQUALS":t==="TEXT"&&o.includes("LIKE")?"LIKE":o[0]},q=e=>e.value.length>0||e.conditional==="IS_NULL"||e.conditional==="IS_NOT_NULL",et=e=>{if(e.length===0)return;let t=e.filter(q);if(t.length!==0)return {operator:"AND",groups:[{operator:t[0]?.operator||"AND",conditionals:t.map(o=>({fieldName:o.fieldName,conditional:o.conditional,value:o.value}))}]}};var tt={["EQUALS"]:"Igual a",["NOT_EQUALS"]:"Diferente de",["LIKE"]:"Cont\xE9m",["NOT_LIKE"]:"N\xE3o cont\xE9m",["GREATER_THAN"]:"Maior que",["LESS_THAN"]:"Menor que",["GREATER_THAN_OR_EQUAL"]:"Maior ou igual a",["LESS_THAN_OR_EQUAL"]:"Menor ou igual a",["IN"]:"Em",["NOT_IN"]:"N\xE3o em",["IS_NULL"]:"\xC9 nulo",["IS_NOT_NULL"]:"N\xE3o \xE9 nulo"};var zo=({value:e,onChange:t,totalConditions:o,isFirst:i})=>o===1?null:i?jsx(Nt,{sx:{width:55,flexShrink:0}}):jsxs(ge,{value:e,onChange:n=>t(n.target.value),size:"small",sx:{width:55,flexShrink:0},children:[jsx(K,{value:"AND",children:"e"}),jsx(K,{value:"OR",children:"ou"})]}),rt=memo(zo,Po);var O={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},jo=({condition:e,fields:t,onChange:o,onRemove:i,totalConditions:n,isFirst:r})=>{let l=useMemo(()=>t.find(a=>(a.filter_field_name??a.name)===e.fieldName),[t,e.fieldName]),m=useMemo(()=>l?.available_filter_conditions||[],[l]),s=useMemo(()=>!e.fieldName||e.conditional==="IS_NULL"||e.conditional==="IS_NOT_NULL",[e.fieldName,e.conditional]),d=useCallback(a=>{let u=t.find(A=>(A.filter_field_name??A.name)===a);if(!u)return;let L=u.available_filter_conditions[0]||"EQUALS";o({...e,fieldName:a,conditional:L,value:[]});},[t,e,o]),f=useCallback(a=>{o({...e,conditional:a});},[e,o]),p=useCallback(a=>{o({...e,value:a?[a]:[]});},[e,o]),c=useCallback(a=>{o({...e,operator:a});},[e,o]);return jsxs(Nt,{direction:"row",spacing:1,alignItems:"center",children:[jsx(Qe,{onClick:i,size:"small","aria-label":"Remover filtro",sx:{flexShrink:0},children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:18})}),jsx(rt,{value:e.operator,onChange:c,totalConditions:n,isFirst:r}),jsxs(fe,{size:"small",sx:{minWidth:150,flex:1},children:[jsx(Ce,{id:`field-label-${e.id}`,children:"Coluna"}),jsx(ge,{labelId:`field-label-${e.id}`,label:"Coluna",value:e.fieldName,onChange:a=>d(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:t.map(a=>jsx(K,{value:a.filter_field_name??a.name,sx:O,title:a.description||a.name,children:a.description||a.name},a.name))})]}),jsxs(fe,{size:"small",sx:{minWidth:90},disabled:!e.fieldName,children:[jsx(Ce,{id:`condition-label-${e.id}`,children:"Condi\xE7\xE3o"}),jsx(ge,{labelId:`condition-label-${e.id}`,label:"Condi\xE7\xE3o",value:e.conditional,onChange:a=>f(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:m.map(a=>jsx(K,{value:a,sx:O,children:tt[a]||a},a))})]}),l?.type==="BOOLEAN"?jsxs(fe,{size:"small",sx:{flex:1,minWidth:120},disabled:s,children:[jsx(Ce,{id:`value-label-${e.id}`,children:"Valor"}),jsxs(ge,{labelId:`value-label-${e.id}`,label:"Valor",value:e.value[0]||"",onChange:a=>p(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:[jsx(K,{value:"true",children:"Verdadeiro"}),jsx(K,{value:"false",children:"Falso"})]})]}):jsx(Qo,{label:"Filtro",value:e.value[0]||"",onChange:a=>p(a.target.value),size:"small",disabled:s,InputLabelProps:{shrink:!0},sx:{flex:1,minWidth:120}})]})},it=memo(jo,Po);var tr=({filterableFields:e,conditions:t,onUpdateCondition:o,onRemoveCondition:i})=>{let n=useCallback(s=>{o(s.id,s);},[o]),r=useCallback(s=>()=>{i(s);},[i]),l=useMemo(()=>t.map(s=>s.fieldName).filter(s=>!!s),[t]),m=useCallback(s=>e.filter(d=>!l.includes(d.name)||d.name===s),[e,l]);return e.length===0?jsx(Se,{variant:"body2",color:"text.secondary",textAlign:"center",children:"Nenhum filtro dispon\xEDvel"}):t.length===0?jsxs(Se,{variant:"body2",color:"text.secondary",textAlign:"center",children:["Clique em"," ",jsx(Se,{component:"strong",variant:"body2",fontWeight:600,color:"text.primary",children:'"+"'})," ","para adicionar um filtro"]}):jsx(Fragment,{children:t.map((s,d)=>jsx(it,{condition:s,fields:m(s.fieldName),onChange:n,onRemove:r(s.id),showOperator:d>0,totalConditions:t.length,isFirst:d===0},s.id))})},nt=memo(tr,Po);var at=styled(Q)({display:"flex",flexDirection:"column",height:"100%"}),lt=styled(Q)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2,3)})),st=styled(Q)(({theme:e})=>({flex:1,overflowY:"auto",padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(2)})),mt=styled(Q)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2)}));var mr=({onClose:e,fields:t,conditions:o,onAddCondition:i,onUpdateCondition:n,onRemoveCondition:r,onApply:l,onClear:m,onCancel:s})=>{let d=Je(t),f=o.length>0,p=useCallback(()=>{l(),e();},[l,e]),c=useCallback(()=>{m(),e();},[m,e]),a$1=useCallback(()=>{s();},[s]);return jsxs(at,{children:[jsxs(lt,{children:[jsx(Se,{variant:"overline",fontWeight:600,color:"text.secondary",children:"Defina as condi\xE7\xF5es para filtrar"}),jsx(Qe,{onClick:i,size:"small","aria-label":"Adicionar filtro",title:"Adicionar filtro",disabled:o.length>=d.length,children:jsx(a,{icon:"SIMPLE_ADD"})})]}),jsx(dt,{}),jsx(st,{children:jsx(nt,{filterableFields:d,conditions:o,onUpdateCondition:n,onRemoveCondition:r})}),jsx(dt,{}),jsxs(mt,{children:[jsx(he,{variant:"text",color:"inherit",onClick:c,children:"Limpar"}),jsxs(Nt,{direction:"row",spacing:1,children:[jsx(he,{variant:"outlined",color:"inherit",onClick:a$1,startIcon:jsx(a,{icon:"CANCEL_CIRCLE"}),children:"Cancelar"}),jsx(he,{variant:"contained",onClick:p,disabled:!f,startIcon:jsx(a,{icon:"SIMPLE_CHECK"}),children:"Aplicar"})]})]})]})},pt=memo(mr,Po);var cr=e=>jsx(a$1,{open:e.open,onClose:e.onClose,anchorEl:e.anchorEl,isMobile:e.isMobileProp,popoverProps:{slotProps:{paper:{sx:{width:520,maxWidth:"calc(100vw - 24px)",maxHeight:600,mt:1}}}},drawerProps:{anchor:"right",PaperProps:{sx:{width:"100%",maxWidth:"100%",height:"100%",maxHeight:"100%",borderRadius:0}}},children:jsx(pt,{...e})}),ut=memo(cr,Po);var Cr=({showFilterButton:e,isOpen:t,filterAnchorEl:o,fields:i,conditions:n,isMobile:r,onClose:l,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:d,onApply:f,onClear:p,onCancel:c})=>e?jsx(ut,{open:t||!!o,anchorEl:o,onClose:l,fields:i,conditions:n,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:d,onApply:f,onClear:p,onCancel:c,isMobileProp:r}):null,ft=memo(Cr,Po);var Ct=styled(Sr)(()=>({"& .MuiDialog-paper":{width:"100%"}})),gt=styled(Fr)(({theme:e})=>({borderBottom:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),yt=styled(hr)(({theme:e})=>({padding:e.spacing(2)})),St=styled(br)(({theme:e})=>({borderTop:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),bt=styled(he)(({theme:e})=>({minWidth:24,[e.breakpoints.down(330)]:{padding:e.spacing(1)}})),Fe=styled(Se)(({theme:e})=>({fontWeight:"600",margin:e.spacing(0,1),[e.breakpoints.down(330)]:{fontSize:0,margin:0}}));var _t=({open:e,onClose:t,fields:o,sort:i,onSortChange:n})=>{let[r,l]=useState(i?.fieldName||""),[m,s]=useState(i?.sortType||"ASC"),d=useMemo(()=>o.filter(u=>u.name!=="ACTIONS"&&u.access_type!=="WRITE_ONLY"),[o]),f=useMemo(()=>o.find(u=>(u.filter_field_name??u.name)===r),[o,r]),p=f?.type==="DECIMAL"||f?.type==="INTEGER";useEffect(()=>{e&&(l(i?.fieldName||""),s(i?.sortType||"ASC"));},[e,i]);let c=useCallback(()=>{n&&n(r?{fieldName:r,sortType:m}:void 0),t();},[n,r,m,t]),a$1=useCallback(()=>{n&&(l(""),s("ASC"),n(void 0),t());},[n,t]);return jsxs(Ct,{open:e,onClose:t,maxWidth:"xs",fullWidth:!0,children:[jsx(gt,{children:jsx(Se,{variant:"overline",color:"text.secondary",children:"Ordenar por"})}),jsx(yt,{children:jsxs(Nt,{spacing:2,pt:2,children:[jsxs(fe,{fullWidth:!0,size:"small",children:[jsx(Ce,{id:"sort-field-label",children:"Campo"}),jsxs(ge,{labelId:"sort-field-label",value:r,label:"Campo",onChange:u=>l(u.target.value),children:[jsx(K,{value:"",children:jsx("em",{children:"Nenhum"})}),d.map(u=>jsx(K,{value:u.filter_field_name??u.name,children:u.description||u.name},u.name))]})]}),jsxs(fe,{fullWidth:!0,size:"small",disabled:!r,children:[jsx(Ce,{id:"sort-direction-label",children:"Dire\xE7\xE3o"}),jsxs(ge,{labelId:"sort-direction-label",value:m,label:"Dire\xE7\xE3o",onChange:u=>s(u.target.value),children:[jsxs(K,{value:"ASC",children:["Crescente ",p?"(1-9)":"(A-Z)"]}),jsxs(K,{value:"DESC",children:["Decrescente ",p?"(9-1)":"(Z-A)"]})]})]})]})}),jsxs(St,{children:[jsx(Nt,{flex:1,width:"100%",direction:"row",children:jsx(he,{color:"inherit",onClick:a$1,children:"Limpar"})}),jsxs(he,{onClick:t,variant:"outlined",color:"inherit",sx:{minWidth:24},children:[jsx(a,{icon:"CANCEL_CIRCLE"}),jsx(Fe,{children:"Cancelar"})]}),jsxs(bt,{onClick:c,variant:"contained",children:[jsx(a,{icon:"SIMPLE_CHECK"}),jsx(Fe,{children:"Aplicar"})]})]})]})};_t.displayName="SortModal";var At=memo(_t);var Et=({columns:e,fields:t,preferredFieldOrder:o})=>{let i=useMemo(()=>new Map(e.map(l=>[l.field,l])),[e]),n=useMemo(()=>new Map(t?.map(l=>[l.name,l])||[]),[t]);return {orderedColumns:useMemo(()=>{if(!o||o.length===0||!t)return e;let l="ACTIONS",m=o.filter(p=>p!==l),s=new Set,d=[],f=p=>{let c=n.get(p);if(!c)return;let a=i.get(c.name);!a||s.has(c.name)||(d.push(a),s.add(c.name));};return m.forEach(p=>{f(p);}),t.forEach(p=>{if(p.name===l||m.includes(p.name))return;let c=i.get(p.name);!c||s.has(p.name)||(d.push(c),s.add(p.name));}),f(l),d.length===0?e:d},[e,i,n,o,t]),columnsByFieldId:i,fieldsByName:n}};function _r(e){return e.name}var vt=({fields:e,columnsByFieldId:t,defaultVisibleFieldNames:o,columnVisibilityStorageKey:i,onColumnVisibilityModelChange:n})=>{let r=!!i,[l,m]=a$4(i||"__dynamic-data-view:columns__",void 0,{initializeWithValue:r}),s=useMemo(()=>{if(!e)return;let f={};if(e.forEach(p=>{let c=_r(p);if(!t.has(c))return;let a;if(r&&l){let u=l[c];typeof u=="boolean"&&(a=u);}a===void 0&&o&&o.length>0&&(a=o.includes(p.name)),typeof a=="boolean"&&(f[c]=a);}),Object.keys(f).length!==0)return {columns:{columnVisibilityModel:f}}},[t,o,e,r,l]),d=useCallback(f=>{r&&m(f),n&&n(f);},[r,n,m]);return {initialState:s,handleColumnVisibilityModelChange:d}};var N={IMAGE_WIDTH:90,MIN_WIDTH:130,ENTITY_MIN_WIDTH:100,ENTITY_FLEX:.5,ID_MIN_WIDTH:200,ID_FLEX:1,ACTIONS_WIDTH:80},Te={READ_ONLY:"READ_ONLY",READ_AND_WRITE:"READ_AND_WRITE"},Mt=["price","base_price","minimum_value","maximum_value","minimum_installment_value"];var Ar=(e,t)=>({field:e.name,headerName:e.description,sortable:!1,width:N.IMAGE_WIDTH,resizable:!1,headerAlign:"center",align:"center",renderCell:o=>t(e,o.row)}),Er=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.ID_MIN_WIDTH,flex:N.ID_FLEX,renderCell:o=>t(e,o.row)}),vr=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.ENTITY_MIN_WIDTH,flex:N.ENTITY_FLEX,renderCell:o=>t(e,o.row)}),Mr=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.MIN_WIDTH,renderCell:o=>t(e,o.row)}),wr=(e,t)=>({field:e.name,headerName:"A\xE7\xF5es",width:N.ACTIONS_WIDTH,sortable:!1,resizable:!1,disableReorder:!0,headerAlign:"center",disableColumnMenu:!0,align:"center",renderCell:o=>t(e,o.row)}),wt=(e,t)=>e.name===t?.id_field_name||e.name==="name"?Er:e.name==="ACTIONS"?wr:e.type==="FILE"?Ar:e.type==="ENTITY"?vr:Mr;var Lt=({metadata:e,renderCell:t,columnStrategies:o})=>useMemo(()=>{if(!e?.fields)return [];let i=new Map;return e.fields.filter(r=>r.access_type===Te.READ_ONLY||r.access_type===Te.READ_AND_WRITE?!0:r.name==="ACTIONS"||r.name===e?.id_field_name||r.name==="NAME").forEach(r=>{if(i.has(r.name))return;let m=(o?.[r.name]??wt(r,e))(r,t,e);i.set(r.name,m);}),Array.from(i.values())},[o,e,t]);var Pt=e=>e?.groups?.[0]?.conditionals?e.groups[0].conditionals.map(t=>({id:a$5(),operator:e.groups[0].operator,fieldName:t.fieldName,conditional:t.conditional,value:t.value})):[],Ot=({fields:e,initialFilter:t})=>{let[o,i]=useState(!1),[n,r]=useState(()=>Pt(t)),[l,m]=useState(t),[s,d]=useState(()=>Pt(t)),f=useRef([]),p=useCallback(()=>{f.current=n.map(C=>({...C})),d(n.map(C=>({...C}))),i(!0);},[n]),c=()=>i(!1),a=useCallback(()=>{let C=e.filter(R=>R.available_filter_conditions?.length>0);if(C.length===0)return;let S=s.map(R=>R.fieldName),F=C.filter(R=>!S.includes(R.filter_field_name??R.name));if(F.length===0)return;let E=s.length>0?s[0].operator:"AND",b=F[0],_={id:a$5(),operator:E,fieldName:b.filter_field_name??b.name,conditional:Ze(b),value:[]};d(R=>[...R,_]);},[e,s]),u=useCallback((C,S)=>{d(F=>{let E=F.find(b=>b.id===C);if(!E)return F;if(S.operator&&S.operator!==E.operator){let b=S.operator;return F.map(_=>_.id===C?{..._,...S}:{..._,operator:b})}return F.map(b=>b.id===C?{...b,...S}:b)});},[]),L=useCallback(C=>{d(S=>S.filter(F=>F.id!==C));},[]),A=()=>{d([]),r([]),m(void 0);},ie=()=>{let C=et(s);return r(s.map(S=>({...S}))),m(C),i(!1),C},B=()=>{d(f.current.map(C=>({...C}))),i(!1);},ne=n.some(q),W=n.filter(q).length;return {conditions:s,filter:l,isOpen:o,hasActiveFilters:ne,activeFiltersCount:W,openDrawer:p,closeDrawer:c,addCondition:a,updateCondition:u,removeCondition:L,clearAllFilters:A,applyFilters:ie,cancelChanges:B}};var Wt=e=>{try{let t=localStorage.getItem(e);return t?JSON.parse(t):void 0}catch{return}},Gt=(e,t)=>{try{t===void 0?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t));}catch{}},Ut=(e,t,o)=>{let i=`${e}:filter`,[n,r]=useState(()=>Wt(i)||t);return useEffect(()=>{t!==void 0&&r(t);},[t]),{filter:n,setFilter:m=>{r(m),Gt(i,m),o?.(m);}}},Vt=(e,t,o)=>{let i=`${e}:sort`,[n,r]=useState(()=>Wt(i)||t);return useEffect(()=>{t!==void 0&&r(t);},[t]),{sort:n,setSort:m=>{r(m),Gt(i,m),o?.(m);}}};var Ht=({sort:e,onSortChange:t})=>{let o=useMemo(()=>e?[{field:e.fieldName,sort:e.sortType.toLowerCase()}]:[],[e]),i=useCallback(n=>{if(!t)return;let r=n[0];if(!r||!r.sort){t(void 0);return}let l={fieldName:r.field,sortType:r.sort.toUpperCase()};t(l);},[t]);return {sortModel:o,handleSortModelChange:i}};var zt=()=>({name:"ACTIONS",description:"",filter_field_name:null,type:"TEXT",metadata:null,access_type:"READ_ONLY",relation_field_name:null,available_filter_conditions:[]}),Re=e=>e.fields.some(o=>o.name==="ACTIONS")?e:{...e,fields:[...e.fields,zt()]};var Wr=({value:e,format:t})=>e==null?"-":d(e,t),De=memo(Wr);var Ur=({value:e,format:t})=>e==null?"-":c(e,t),xe=memo(Ur);var zr=({value:e,field:t})=>{if(!t.metadata||typeof e!="object"||e===null)return e?String(e):"-";let o=e[t.metadata.description_field_name];return o?jsx(Hr,{label:String(o),variant:"outlined",size:"small",sx:{width:"fit-content",color:"text.secondary",borderColor:"divider",borderRadius:3}}):null},Ne=memo(zr);var $r=({value:e,trueIcon:t="STAR_02",falseIcon:o="STAR",color:i="primary.main",width:n=18})=>jsx(a,{icon:e?t:o,color:i,width:n}),Kr=memo($r);var qt=styled("span")(({theme:e,isActive:t})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:e.spacing(.2,1),borderRadius:e.shape.borderRadius,fontSize:"0.75rem",fontWeight:600,width:"fit-content",height:"auto",lineHeight:"1.25rem",whiteSpace:"nowrap",margin:"auto",backgroundColor:t?e.palette.success.lighter||"#00A76F29":e.palette.warning.lighter||"#FF563029",color:t?e.palette.success.darker||"#007867":e.palette.warning.darker||"#B71D18"})),$t=styled(Q,{shouldForwardProp:e=>!["size","noImage","clickable"].includes(e)})(({theme:e,size:t,noImage:o,clickable:i})=>({width:t,height:t,minWidth:t,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",cursor:i?"pointer":"default",transition:"opacity 0.2s ease-in-out",color:e.palette.text.disabled,...o&&{border:`1px dashed ${e.palette.divider}`,backgroundColor:e.palette.grey[100]},...i&&{"&:hover":{opacity:.8}},"& img":{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"},[e.breakpoints.down("sm")]:{justifyContent:"flex-start",alignItems:"flex-start"}}));var Jr=({imageResourceId:e,getImageUrl:t,size:o=48,alt:i="Imagem",onClick:n,sx:r})=>{let l=!!e,m=l&&t?t(e):void 0;return jsx($t,{size:o,noImage:!l,clickable:!!n,onClick:n,sx:r,children:m?jsx("img",{src:m,alt:i}):jsx(a,{icon:"SEARCH_IMAGE",width:Math.round(o/2),color:"text.disabled"})})},Zr=memo(Jr);var ti=({id:e,displayName:t,copyMessage:o="ID copiado!"})=>jsxs(Nt,{height:1,justifyContent:"center",children:[jsx(Se,{variant:"subtitle2",noWrap:!0,title:t,children:t}),jsxs(Nt,{direction:"row",gap:1,alignItems:"center",children:[jsxs(Se,{color:"grey.600",variant:"body2",noWrap:!0,children:["ID: ",e]}),jsx(a$2,{toCopy:e,message:o})]})]}),oi=memo(ti);var ai=({value:e,isCurrency:t=!1})=>e==null?"-":jsx(Nt,{direction:"row",alignItems:"center",height:"100%",children:jsx(Se,{variant:"body2",noWrap:!0,width:"fit-content",children:t?h(Number(e)):a$3(Number(e))})}),Ee=memo(ai);var si=({active:e,activeLabel:t="Ativo",inactiveLabel:o="Inativo"})=>jsx(qt,{isActive:e,children:e?t:o}),ve=memo(si);var ui=e=>e.replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim(),fi=({value:e,showCopyButton:t=!1,copyMessage:o="Copiado",copyLabel:i,mask:n})=>{if(!e)return "-";let r=String(e),l=n?n(r):ui(r);return t?jsxs(Nt,{direction:"row",gap:1,alignItems:"center",children:[jsx(Se,{variant:"body2",noWrap:!0,children:l}),jsx(a$2,{toCopy:r,message:o,label:i})]}):l},Me=memo(fi);function gi(e){return Mt.includes(e)}var Zt=e=>{let{onRowAction:t}=e,o=(i,n)=>{let r=n[i.name];if(i.name==="ACTIONS")return t?.(n.id,n);switch(i.type){case"BOOLEAN":return jsx(ve,{active:!!r,activeLabel:"Ativo",inactiveLabel:"Inativo"});case"DATE":return jsx(De,{value:r});case"DATETIME":return jsx(xe,{value:r});case"DECIMAL":case"INTEGER":return jsx(Ee,{value:r,isCurrency:gi(i.name)});case"FILE":case"ENTITY":return jsx(Ne,{value:r,field:i});case"TEXT":default:return jsx(Me,{value:r})}};return o.displayName="CellRendererComponent",o};var bi=({title:e,metadata:t,data:o,isLoading:i,isFetching:n,page:r,perPage:l,searchValue:m,onSearchChange:s,onSearch:d,onPaginationChange:f,onAdd:p,onRowAction:c,onRowDoubleClick:a,actions:u,moreActions:L,slots:A,mobileRender:ie,containerHeight:B=600,showColumnButton:ne=!1,showFilterButton:W=!1,filter:C,onFilterChange:S,sort:F,onSortChange:E,defaultVisibleFieldNames:b$1,preferredFieldOrder:_,columnStrategies:R,onColumnVisibilityModelChange:ro,storageKey:ae})=>{let{items:G=[],total:io=0}=o||{},U=useMemo(()=>{if(t)return t;if(G.length>0){let x=G[0],z=Object.keys(x).map(We=>({name:We,type:"TEXT",description:We,filter_field_name:null,metadata:null,access_type:"READ_ONLY",relation_field_name:null,available_filter_conditions:[]}));return {name:"loading",description:"Loading...",id_field_name:"id",description_field_name:z[0]?.name||"id",access_type:"READ_ONLY",fields:z}}},[t,G]),P=useMemo(()=>U&&c?Re(U):U,[U,c]),le=useMemo(()=>P?.fields||[],[P]),no=useMemo(()=>Zt({onRowAction:c}),[c]),ao=Lt({metadata:P,renderCell:no,columnStrategies:R}),{orderedColumns:lo,columnsByFieldId:so}=Et({columns:ao,fields:P?.fields,preferredFieldOrder:_}),{initialState:mo,handleColumnVisibilityModelChange:po}=vt({fields:P?.fields,columnsByFieldId:so,defaultVisibleFieldNames:b$1,columnVisibilityStorageKey:`${ae}:columns`,onColumnVisibilityModelChange:ro}),co=useCallback(x=>{if(!a)return;let z=x.id?.toString()||"";a(z,x.row);},[a]),V=b("down","md"),[uo,se]=useState(null),{filter:fo,setFilter:H}=Ut(ae,C,S),{sort:Co,setSort:we}=Vt(ae,F,E),go=C??fo,me=F??Co,{sortModel:yo,handleSortModelChange:So}=Ht({sort:me,onSortChange:we}),{conditions:bo,isOpen:ho,openDrawer:de,closeDrawer:Le,addCondition:Fo,updateCondition:Io,removeCondition:To,clearAllFilters:Pe,applyFilters:Oe,cancelChanges:ke,hasActiveFilters:Ro,activeFiltersCount:Do}=Ot({fields:le,initialFilter:go}),xo=useCallback(()=>{let x=Oe();H(x);},[Oe,H]),No=useCallback(()=>{Pe(),H(void 0);},[Pe,H]),_o=useCallback(x=>{V?de():(de(),se(x.currentTarget));},[V,de]),Ao=useCallback(()=>{ke(),se(null);},[ke]),[Eo,Be]=useState(!1),vo=useCallback(()=>{se(null),Le();},[Le]);return jsxs(Fragment,{children:[jsx(d$1,{title:e,columns:lo,rows:G,mobileRender:ie,rowCount:io,loading:i||!t,fetching:n,searchValue:m,onSearch:d,onSearchChange:s,paginationModel:{page:r,pageSize:l},onPaginationChange:f,actions:u,moreActions:L,onAdd:p,onRowDoubleClick:a?co:void 0,disableRowSelectionOnClick:!0,slots:A,initialState:mo,showColumnButton:ne,containerProps:{height:B,maxHeight:B},onColumnVisibilityModelChange:po,filterButton:jsx(je,{showFilterButton:W,isMobile:V,hasActiveFilters:Ro,activeFiltersCount:Do,sort:me,onFilterClick:_o,onSortClick:()=>Be(!0)}),sortingMode:"server",sortModel:yo,onSortModelChange:So,disableColumnFilter:!0}),t&&jsxs(Fragment,{children:[jsx(ft,{showFilterButton:W,isOpen:ho,filterAnchorEl:uo,fields:le,conditions:bo,isMobile:V,onClose:vo,onAddCondition:Fo,onUpdateCondition:Io,onRemoveCondition:To,onApply:xo,onClear:No,onCancel:Ao}),jsx(At,{open:Eo,onClose:()=>Be(!1),fields:le,sort:me,onSortChange:we})]})]})},hi=memo(bi,Po);var Fi=({metadata:e,columnVisibilityModel:t,defaultVisibleFields:o})=>{if(!e?.fields)return;let n=e.fields.map(r=>r.name).filter(r=>r==="ACTIONS"?!1:t?t[r]!==!1:o?.includes(r)??!0);return o?n.sort((r,l)=>{let m=o.indexOf(r),s=o.indexOf(l);return m-s||0}):n};
|
|
55
|
+
var Bo=({showFilterButton:e$1,isMobile:t,hasActiveFilters:o,activeFiltersCount:r,sort:n,onFilterClick:i,onSortClick:l})=>e$1?t?jsxs(_t,{direction:"row",spacing:.5,children:[jsx(Xe,{badgeContent:r,color:"primary",invisible:r===0,sx:{"& .MuiBadge-badge":{transform:"scale(0.9) translate(10px, 9px)",opacity:r===0?0:1}},children:jsx(Qe,{color:o?"primary":"default",onClick:i,size:"small","aria-label":"Filtrar",sx:{overflow:"visible"},children:jsx(a,{icon:"FILTER_VERTICAL"})})}),jsx(e,{sx:{height:16},orientation:"vertical",flexItem:!0}),jsx(Qe,{color:n?"primary":"default",onClick:l,size:"small","aria-label":"Ordenar",children:jsx(a,{icon:n?.sortType==="DESC"?"SORTING_DESC":"SORTING_ASC"})})]}):jsx(Xe,{badgeContent:r,color:"primary",invisible:r===0,sx:{"& .MuiBadge-badge":r?{transform:"scale(0.9) translate(-3px, 7px)",position:"relative",opacity:1,transition:"none"}:{transition:"none",opacity:0}},children:jsx(he,{variant:"text",color:o?"primary":"inherit",startIcon:jsx(a,{icon:"FILTER_VERTICAL"}),onClick:i,size:"small",children:"Filtrar"})}):null,je=memo(Bo,Po);var Je=e=>e.filter(t=>t.available_filter_conditions&&t.available_filter_conditions.length>0&&t.name!=="ACTIONS");var Ze=e=>{let{type:t,available_filter_conditions:o}=e;return o.length===0?"EQUALS":t==="TEXT"&&o.includes("LIKE")?"LIKE":o[0]},$=e=>e.value.length>0||e.conditional==="IS_NULL"||e.conditional==="IS_NOT_NULL",et=e=>{if(e.length===0)return;let t=e.filter($);if(t.length!==0)return {operator:"AND",groups:[{operator:t[0]?.operator||"AND",conditionals:t.map(o=>({fieldName:o.fieldName,conditional:o.conditional,value:o.value}))}]}};var tt={["EQUALS"]:"Igual a",["NOT_EQUALS"]:"Diferente de",["LIKE"]:"Cont\xE9m",["NOT_LIKE"]:"N\xE3o cont\xE9m",["GREATER_THAN"]:"Maior que",["LESS_THAN"]:"Menor que",["GREATER_THAN_OR_EQUAL"]:"Maior ou igual a",["LESS_THAN_OR_EQUAL"]:"Menor ou igual a",["IN"]:"Em",["NOT_IN"]:"N\xE3o em",["IS_NULL"]:"\xC9 nulo",["IS_NOT_NULL"]:"N\xE3o \xE9 nulo"};var zo=({value:e,onChange:t,totalConditions:o,isFirst:r})=>o===1?null:r?jsx(_t,{sx:{width:55,flexShrink:0}}):jsxs(ge,{value:e,onChange:n=>t(n.target.value),size:"small",sx:{width:55,flexShrink:0},children:[jsx(X,{value:"AND",children:"e"}),jsx(X,{value:"OR",children:"ou"})]}),rt=memo(zo,Po);var O={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},jo=({condition:e,fields:t,onChange:o,onRemove:r,totalConditions:n,isFirst:i})=>{let l=useMemo(()=>t.find(a=>(a.filter_field_name??a.name)===e.fieldName),[t,e.fieldName]),m=useMemo(()=>l?.available_filter_conditions||[],[l]),s=useMemo(()=>!e.fieldName||e.conditional==="IS_NULL"||e.conditional==="IS_NOT_NULL",[e.fieldName,e.conditional]),d=useCallback(a=>{let u=t.find(A=>(A.filter_field_name??A.name)===a);if(!u)return;let L=u.available_filter_conditions[0]||"EQUALS";o({...e,fieldName:a,conditional:L,value:[]});},[t,e,o]),f=useCallback(a=>{o({...e,conditional:a});},[e,o]),p=useCallback(a=>{o({...e,value:a?[a]:[]});},[e,o]),c=useCallback(a=>{o({...e,operator:a});},[e,o]);return jsxs(_t,{direction:"row",spacing:1,alignItems:"center",children:[jsx(Qe,{onClick:r,size:"small","aria-label":"Remover filtro",sx:{flexShrink:0},children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:18})}),jsx(rt,{value:e.operator,onChange:c,totalConditions:n,isFirst:i}),jsxs(fe,{size:"small",sx:{minWidth:150,flex:1},children:[jsx(Ce,{id:`field-label-${e.id}`,children:"Coluna"}),jsx(ge,{labelId:`field-label-${e.id}`,label:"Coluna",value:e.fieldName,onChange:a=>d(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:t.map(a=>jsx(X,{value:a.filter_field_name??a.name,sx:O,title:a.description||a.name,children:a.description||a.name},a.name))})]}),jsxs(fe,{size:"small",sx:{minWidth:90},disabled:!e.fieldName,children:[jsx(Ce,{id:`condition-label-${e.id}`,children:"Condi\xE7\xE3o"}),jsx(ge,{labelId:`condition-label-${e.id}`,label:"Condi\xE7\xE3o",value:e.conditional,onChange:a=>f(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:m.map(a=>jsx(X,{value:a,sx:O,children:tt[a]||a},a))})]}),l?.type==="BOOLEAN"?jsxs(fe,{size:"small",sx:{flex:1,minWidth:120},disabled:s,children:[jsx(Ce,{id:`value-label-${e.id}`,children:"Valor"}),jsxs(ge,{labelId:`value-label-${e.id}`,label:"Valor",value:e.value[0]||"",onChange:a=>p(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:[jsx(X,{value:"true",children:"Verdadeiro"}),jsx(X,{value:"false",children:"Falso"})]})]}):jsx(Qo,{label:"Filtro",value:e.value[0]||"",onChange:a=>p(a.target.value),size:"small",disabled:s,InputLabelProps:{shrink:!0},sx:{flex:1,minWidth:120}})]})},it=memo(jo,Po);var tr=({filterableFields:e,conditions:t,onUpdateCondition:o,onRemoveCondition:r})=>{let n=useCallback(s=>{o(s.id,s);},[o]),i=useCallback(s=>()=>{r(s);},[r]),l=useMemo(()=>t.map(s=>s.fieldName).filter(s=>!!s),[t]),m=useCallback(s=>e.filter(d=>!l.includes(d.name)||d.name===s),[e,l]);return e.length===0?jsx(Se,{variant:"body2",color:"text.secondary",textAlign:"center",children:"Nenhum filtro dispon\xEDvel"}):t.length===0?jsxs(Se,{variant:"body2",color:"text.secondary",textAlign:"center",children:["Clique em"," ",jsx(Se,{component:"strong",variant:"body2",fontWeight:600,color:"text.primary",children:'"+"'})," ","para adicionar um filtro"]}):jsx(Fragment,{children:t.map((s,d)=>jsx(it,{condition:s,fields:m(s.fieldName),onChange:n,onRemove:i(s.id),showOperator:d>0,totalConditions:t.length,isFirst:d===0},s.id))})},nt=memo(tr,Po);var at=styled(j)({display:"flex",flexDirection:"column",height:"100%"}),lt=styled(j)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2,3)})),st=styled(j)(({theme:e})=>({flex:1,overflowY:"auto",padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(2)})),mt=styled(j)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2)}));var mr=({onClose:e,fields:t,conditions:o,onAddCondition:r,onUpdateCondition:n,onRemoveCondition:i,onApply:l,onClear:m,onCancel:s})=>{let d=Je(t),f=o.length>0,p=useCallback(()=>{l(),e();},[l,e]),c=useCallback(()=>{m(),e();},[m,e]),a$1=useCallback(()=>{s();},[s]);return jsxs(at,{children:[jsxs(lt,{children:[jsx(Se,{variant:"overline",fontWeight:600,color:"text.secondary",children:"Defina as condi\xE7\xF5es para filtrar"}),jsx(Qe,{onClick:r,size:"small","aria-label":"Adicionar filtro",title:"Adicionar filtro",disabled:o.length>=d.length,children:jsx(a,{icon:"SIMPLE_ADD"})})]}),jsx(dt,{}),jsx(st,{children:jsx(nt,{filterableFields:d,conditions:o,onUpdateCondition:n,onRemoveCondition:i})}),jsx(dt,{}),jsxs(mt,{children:[jsx(he,{variant:"text",color:"inherit",onClick:c,children:"Limpar"}),jsxs(_t,{direction:"row",spacing:1,children:[jsx(he,{variant:"outlined",color:"inherit",onClick:a$1,startIcon:jsx(a,{icon:"CANCEL_CIRCLE"}),children:"Cancelar"}),jsx(he,{variant:"contained",onClick:p,disabled:!f,startIcon:jsx(a,{icon:"SIMPLE_CHECK"}),children:"Aplicar"})]})]})]})},pt=memo(mr,Po);var cr=e=>jsx(a$1,{open:e.open,onClose:e.onClose,anchorEl:e.anchorEl,isMobile:e.isMobileProp,popoverProps:{slotProps:{paper:{sx:{width:520,maxWidth:"calc(100vw - 24px)",maxHeight:600,mt:1}}}},drawerProps:{anchor:"right",PaperProps:{sx:{width:"100%",maxWidth:"100%",height:"100%",maxHeight:"100%",borderRadius:0}}},children:jsx(pt,{...e})}),ut=memo(cr,Po);var Cr=({showFilterButton:e,isOpen:t,filterAnchorEl:o,fields:r,conditions:n,isMobile:i,onClose:l,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:d,onApply:f,onClear:p,onCancel:c})=>e?jsx(ut,{open:t||!!o,anchorEl:o,onClose:l,fields:r,conditions:n,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:d,onApply:f,onClear:p,onCancel:c,isMobileProp:i}):null,ft=memo(Cr,Po);var Ct=styled(Sr)(()=>({"& .MuiDialog-paper":{width:"100%"}})),gt=styled(Fr)(({theme:e})=>({borderBottom:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),yt=styled(hr)(({theme:e})=>({padding:e.spacing(2)})),St=styled(br)(({theme:e})=>({borderTop:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),bt=styled(he)(({theme:e})=>({minWidth:24,[e.breakpoints.down(330)]:{padding:e.spacing(1)}})),Fe=styled(Se)(({theme:e})=>({fontWeight:"600",margin:e.spacing(0,1),[e.breakpoints.down(330)]:{fontSize:0,margin:0}}));var Nt=({open:e,onClose:t,fields:o,sort:r,onSortChange:n})=>{let[i,l]=useState(r?.fieldName||""),[m,s]=useState(r?.sortType||"ASC"),d=useMemo(()=>o.filter(u=>u.name!=="ACTIONS"&&u.access_type!=="WRITE_ONLY"),[o]),f=useMemo(()=>o.find(u=>(u.filter_field_name??u.name)===i),[o,i]),p=f?.type==="DECIMAL"||f?.type==="INTEGER";useEffect(()=>{e&&(l(r?.fieldName||""),s(r?.sortType||"ASC"));},[e,r]);let c=useCallback(()=>{n&&n(i?{fieldName:i,sortType:m}:void 0),t();},[n,i,m,t]),a$1=useCallback(()=>{n&&(l(""),s("ASC"),n(void 0),t());},[n,t]);return jsxs(Ct,{open:e,onClose:t,maxWidth:"xs",fullWidth:!0,children:[jsx(gt,{children:jsx(Se,{variant:"overline",color:"text.secondary",children:"Ordenar por"})}),jsx(yt,{children:jsxs(_t,{spacing:2,pt:2,children:[jsxs(fe,{fullWidth:!0,size:"small",children:[jsx(Ce,{id:"sort-field-label",children:"Campo"}),jsxs(ge,{labelId:"sort-field-label",value:i,label:"Campo",onChange:u=>l(u.target.value),children:[jsx(X,{value:"",children:jsx("em",{children:"Nenhum"})}),d.map(u=>jsx(X,{value:u.filter_field_name??u.name,children:u.description||u.name},u.name))]})]}),jsxs(fe,{fullWidth:!0,size:"small",disabled:!i,children:[jsx(Ce,{id:"sort-direction-label",children:"Dire\xE7\xE3o"}),jsxs(ge,{labelId:"sort-direction-label",value:m,label:"Dire\xE7\xE3o",onChange:u=>s(u.target.value),children:[jsxs(X,{value:"ASC",children:["Crescente ",p?"(1-9)":"(A-Z)"]}),jsxs(X,{value:"DESC",children:["Decrescente ",p?"(9-1)":"(Z-A)"]})]})]})]})}),jsxs(St,{children:[jsx(_t,{flex:1,width:"100%",direction:"row",children:jsx(he,{color:"inherit",onClick:a$1,children:"Limpar"})}),jsxs(he,{onClick:t,variant:"outlined",color:"inherit",sx:{minWidth:24},children:[jsx(a,{icon:"CANCEL_CIRCLE"}),jsx(Fe,{children:"Cancelar"})]}),jsxs(bt,{onClick:c,variant:"contained",children:[jsx(a,{icon:"SIMPLE_CHECK"}),jsx(Fe,{children:"Aplicar"})]})]})]})};Nt.displayName="SortModal";var At=memo(Nt);var Et=({columns:e,fields:t,preferredFieldOrder:o})=>{let r=useMemo(()=>new Map(e.map(l=>[l.field,l])),[e]),n=useMemo(()=>new Map(t?.map(l=>[l.name,l])||[]),[t]);return {orderedColumns:useMemo(()=>{if(!o||o.length===0||!t)return e;let l="ACTIONS",m=o.filter(p=>p!==l),s=new Set,d=[],f=p=>{let c=n.get(p);if(!c)return;let a=r.get(c.name);!a||s.has(c.name)||(d.push(a),s.add(c.name));};return m.forEach(p=>{f(p);}),t.forEach(p=>{if(p.name===l||m.includes(p.name))return;let c=r.get(p.name);!c||s.has(p.name)||(d.push(c),s.add(p.name));}),f(l),d.length===0?e:d},[e,r,n,o,t]),columnsByFieldId:r,fieldsByName:n}};function Nr(e){return e.name}var vt=({fields:e,columnsByFieldId:t,defaultVisibleFieldNames:o,columnVisibilityStorageKey:r,onColumnVisibilityModelChange:n})=>{let i=!!r,[l,m]=a$4(r||"__dynamic-data-view:columns__",void 0,{initializeWithValue:i}),s=useMemo(()=>{if(!e)return;let f={};if(e.forEach(p=>{let c=Nr(p);if(!t.has(c))return;let a;if(i&&l){let u=l[c];typeof u=="boolean"&&(a=u);}a===void 0&&o&&o.length>0&&(a=o.includes(p.name)),typeof a=="boolean"&&(f[c]=a);}),Object.keys(f).length!==0)return {columns:{columnVisibilityModel:f}}},[t,o,e,i,l]),d=useCallback(f=>{i&&m(f),n&&n(f);},[i,n,m]);return {initialState:s,handleColumnVisibilityModelChange:d}};var _={IMAGE_WIDTH:90,MIN_WIDTH:130,ENTITY_MIN_WIDTH:100,ENTITY_FLEX:.5,ID_MIN_WIDTH:200,ID_FLEX:1,ACTIONS_WIDTH:80},Te={READ_ONLY:"READ_ONLY",READ_AND_WRITE:"READ_AND_WRITE"},Mt=["price","base_price","minimum_value","maximum_value","minimum_installment_value"];var Ar=(e,t)=>({field:e.name,headerName:e.description,sortable:!1,width:_.IMAGE_WIDTH,resizable:!1,headerAlign:"center",align:"center",renderCell:o=>t(e,o.row)}),Er=(e,t)=>({field:e.name,headerName:e.description,minWidth:_.ID_MIN_WIDTH,flex:_.ID_FLEX,renderCell:o=>t(e,o.row)}),vr=(e,t)=>({field:e.name,headerName:e.description,minWidth:_.ENTITY_MIN_WIDTH,flex:_.ENTITY_FLEX,renderCell:o=>t(e,o.row)}),Mr=(e,t)=>({field:e.name,headerName:e.description,minWidth:_.MIN_WIDTH,renderCell:o=>t(e,o.row)}),wr=(e,t)=>({field:e.name,headerName:"A\xE7\xF5es",width:_.ACTIONS_WIDTH,sortable:!1,resizable:!1,disableReorder:!0,headerAlign:"center",disableColumnMenu:!0,align:"center",renderCell:o=>t(e,o.row)}),wt=(e,t)=>e.name===t?.id_field_name||e.name==="name"?Er:e.name==="ACTIONS"?wr:e.type==="FILE"?Ar:e.type==="ENTITY"?vr:Mr;var Lt=({metadata:e,renderCell:t,columnStrategies:o})=>useMemo(()=>{if(!e?.fields)return [];let r=new Map;return e.fields.filter(i=>i.access_type===Te.READ_ONLY||i.access_type===Te.READ_AND_WRITE?!0:i.name==="ACTIONS"||i.name===e?.id_field_name||i.name==="NAME").forEach(i=>{if(r.has(i.name))return;let m=(o?.[i.name]??wt(i,e))(i,t,e);r.set(i.name,m);}),Array.from(r.values())},[o,e,t]);var Pt=e=>e?.groups?.[0]?.conditionals?e.groups[0].conditionals.map(t=>({id:a$5(),operator:e.groups[0].operator,fieldName:t.fieldName,conditional:t.conditional,value:t.value})):[],Ot=({fields:e,initialFilter:t})=>{let[o,r]=useState(!1),[n,i]=useState(()=>Pt(t)),[l,m]=useState(t),[s,d]=useState(()=>Pt(t)),f=useRef([]),p=useCallback(()=>{f.current=n.map(C=>({...C})),d(n.map(C=>({...C}))),r(!0);},[n]),c=()=>r(!1),a=useCallback(()=>{let C=e.filter(R=>R.available_filter_conditions?.length>0);if(C.length===0)return;let S=s.map(R=>R.fieldName),F=C.filter(R=>!S.includes(R.filter_field_name??R.name));if(F.length===0)return;let E=s.length>0?s[0].operator:"AND",b=F[0],N={id:a$5(),operator:E,fieldName:b.filter_field_name??b.name,conditional:Ze(b),value:[]};d(R=>[...R,N]);},[e,s]),u=useCallback((C,S)=>{d(F=>{let E=F.find(b=>b.id===C);if(!E)return F;if(S.operator&&S.operator!==E.operator){let b=S.operator;return F.map(N=>N.id===C?{...N,...S}:{...N,operator:b})}return F.map(b=>b.id===C?{...b,...S}:b)});},[]),L=useCallback(C=>{d(S=>S.filter(F=>F.id!==C));},[]),A=()=>{d([]),i([]),m(void 0);},ne=()=>{let C=et(s);return i(s.map(S=>({...S}))),m(C),r(!1),C},B=()=>{d(f.current.map(C=>({...C}))),r(!1);},ae=n.some($),W=n.filter($).length;return {conditions:s,filter:l,isOpen:o,hasActiveFilters:ae,activeFiltersCount:W,openDrawer:p,closeDrawer:c,addCondition:a,updateCondition:u,removeCondition:L,clearAllFilters:A,applyFilters:ne,cancelChanges:B}};var Wt=e=>{try{let t=localStorage.getItem(e);return t?JSON.parse(t):void 0}catch{return}},Gt=(e,t)=>{try{t===void 0?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t));}catch{}},Ut=(e,t,o)=>{let r=`${e}:filter`,[n,i]=useState(()=>Wt(r)||t);return useEffect(()=>{t!==void 0&&i(t);},[t]),{filter:n,setFilter:m=>{i(m),Gt(r,m),o?.(m);}}},Vt=(e,t,o)=>{let r=`${e}:sort`,[n,i]=useState(()=>Wt(r)||t);return useEffect(()=>{t!==void 0&&i(t);},[t]),{sort:n,setSort:m=>{i(m),Gt(r,m),o?.(m);}}};var Br=(e,t)=>e?e.find(r=>r.name===t)?.filter_field_name??t:t,Wr=(e,t)=>e?e.find(r=>r.filter_field_name===t||r.name===t)?.name??t:t,Ht=({sort:e,onSortChange:t,fields:o})=>{let r=useMemo(()=>e?[{field:Wr(o,e.fieldName),sort:e.sortType.toLowerCase()}]:[],[e,o]),n=useCallback(i=>{if(!t)return;let l=i[0];if(!l||!l.sort){t(void 0);return}let m={fieldName:Br(o,l.field),sortType:l.sort.toUpperCase()};t(m);},[t,o]);return {sortModel:r,handleSortModelChange:n}};var zt=()=>({name:"ACTIONS",description:"",filter_field_name:null,type:"TEXT",metadata:null,access_type:"READ_ONLY",relation_field_name:null,available_filter_conditions:[]}),Re=e=>e.fields.some(o=>o.name==="ACTIONS")?e:{...e,fields:[...e.fields,zt()]};var Ur=({value:e,format:t})=>e==null?"-":d(e,t),De=memo(Ur);var Hr=({value:e,format:t})=>e==null?"-":c(e,t),xe=memo(Hr);var qr=({value:e,field:t})=>{if(!t.metadata||typeof e!="object"||e===null)return e?String(e):"-";let o=e[t.metadata.description_field_name];return o?jsx(Yr,{label:String(o),variant:"outlined",size:"small",sx:{width:"fit-content",color:"text.secondary",borderColor:"divider",borderRadius:3}}):null},_e=memo(qr);var Xr=({value:e,trueIcon:t="STAR_02",falseIcon:o="STAR",color:r="primary.main",width:n=18})=>jsx(a,{icon:e?t:o,color:r,width:n}),Qr=memo(Xr);var qt=styled("span")(({theme:e,isActive:t})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:e.spacing(.2,1),borderRadius:e.shape.borderRadius,fontSize:"0.75rem",fontWeight:600,width:"fit-content",height:"auto",lineHeight:"1.25rem",whiteSpace:"nowrap",margin:"auto",backgroundColor:t?e.palette.success.lighter||"#00A76F29":e.palette.warning.lighter||"#FF563029",color:t?e.palette.success.darker||"#007867":e.palette.warning.darker||"#B71D18"})),$t=styled(j,{shouldForwardProp:e=>!["size","noImage","clickable"].includes(e)})(({theme:e,size:t,noImage:o,clickable:r})=>({width:t,height:t,minWidth:t,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",cursor:r?"pointer":"default",transition:"opacity 0.2s ease-in-out",color:e.palette.text.disabled,...o&&{border:`1px dashed ${e.palette.divider}`,backgroundColor:e.palette.grey[100]},...r&&{"&:hover":{opacity:.8}},"& img":{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"},[e.breakpoints.down("sm")]:{justifyContent:"flex-start",alignItems:"flex-start"}}));var ei=({imageResourceId:e,getImageUrl:t,size:o=48,alt:r="Imagem",onClick:n,sx:i})=>{let l=!!e,m=l&&t?t(e):void 0;return jsx($t,{size:o,noImage:!l,clickable:!!n,onClick:n,sx:i,children:m?jsx("img",{src:m,alt:r}):jsx(a,{icon:"SEARCH_IMAGE",width:Math.round(o/2),color:"text.disabled"})})},ti=memo(ei);var ri=({id:e,displayName:t,copyMessage:o="ID copiado!"})=>jsxs(_t,{height:1,justifyContent:"center",children:[jsx(Se,{variant:"subtitle2",noWrap:!0,title:t,children:t}),jsxs(_t,{direction:"row",gap:1,alignItems:"center",children:[jsxs(Se,{color:"grey.600",variant:"body2",noWrap:!0,children:["ID: ",e]}),jsx(a$2,{toCopy:e,message:o})]})]}),ii=memo(ri);var si=({value:e,isCurrency:t=!1})=>e==null?"-":jsx(_t,{direction:"row",alignItems:"center",height:"100%",children:jsx(Se,{variant:"body2",noWrap:!0,width:"fit-content",children:t?h(Number(e)):a$3(Number(e))})}),Ee=memo(si);var di=({active:e,activeLabel:t="Ativo",inactiveLabel:o="Inativo"})=>jsx(qt,{isActive:e,children:e?t:o}),ve=memo(di);var Ci=e=>e.replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim(),gi=({value:e,showCopyButton:t=!1,copyMessage:o="Copiado",copyLabel:r,mask:n})=>{if(!e)return "-";let i=String(e),l=n?n(i):Ci(i);return t?jsxs(_t,{direction:"row",gap:1,alignItems:"center",children:[jsx(Se,{variant:"body2",noWrap:!0,children:l}),jsx(a$2,{toCopy:i,message:o,label:r})]}):l},Me=memo(gi);function Si(e){return Mt.includes(e)}var Zt=e=>{let{onRowAction:t}=e,o=(r,n)=>{let i=n[r.name];if(r.name==="ACTIONS")return t?.(n.id,n);switch(r.type){case"BOOLEAN":return jsx(ve,{active:!!i,activeLabel:"Ativo",inactiveLabel:"Inativo"});case"DATE":return jsx(De,{value:i});case"DATETIME":return jsx(xe,{value:i});case"DECIMAL":case"INTEGER":return jsx(Ee,{value:i,isCurrency:Si(r.name)});case"FILE":case"ENTITY":return jsx(_e,{value:i,field:r});case"TEXT":default:return jsx(Me,{value:i})}};return o.displayName="CellRendererComponent",o};var Fi=({title:e,metadata:t,data:o,isLoading:r,isFetching:n,page:i,perPage:l,searchValue:m,onSearchChange:s,onSearch:d,onPaginationChange:f,onAdd:p,onRowAction:c,onRowDoubleClick:a,actions:u,moreActions:L,slots:A,mobileRender:ne,containerHeight:B=600,showColumnButton:ae=!1,showFilterButton:W=!1,filter:C,onFilterChange:S,sort:F,onSortChange:E,defaultVisibleFieldNames:b$1,preferredFieldOrder:N,columnStrategies:R,onColumnVisibilityModelChange:ro,storageKey:le})=>{let{items:G=[],total:io=0}=o||{},U=useMemo(()=>{if(t)return t;if(G.length>0){let x=G[0],Y=Object.keys(x).map(We=>({name:We,type:"TEXT",description:We,filter_field_name:null,metadata:null,access_type:"READ_ONLY",relation_field_name:null,available_filter_conditions:[]}));return {name:"loading",description:"Loading...",id_field_name:"id",description_field_name:Y[0]?.name||"id",access_type:"READ_ONLY",fields:Y}}},[t,G]),P=useMemo(()=>U&&c?Re(U):U,[U,c]),V=useMemo(()=>P?.fields||[],[P]),no=useMemo(()=>Zt({onRowAction:c}),[c]),ao=Lt({metadata:P,renderCell:no,columnStrategies:R}),{orderedColumns:lo,columnsByFieldId:so}=Et({columns:ao,fields:P?.fields,preferredFieldOrder:N}),{initialState:mo,handleColumnVisibilityModelChange:po}=vt({fields:P?.fields,columnsByFieldId:so,defaultVisibleFieldNames:b$1,columnVisibilityStorageKey:`${le}:columns`,onColumnVisibilityModelChange:ro}),co=useCallback(x=>{if(!a)return;let Y=x.id?.toString()||"";a(Y,x.row);},[a]),H=b("down","md"),[uo,se]=useState(null),{filter:fo,setFilter:z}=Ut(le,C,S),{sort:Co,setSort:we}=Vt(le,F,E),go=C??fo,me=F??Co,{sortModel:yo,handleSortModelChange:So}=Ht({sort:me,onSortChange:we,fields:V}),{conditions:bo,isOpen:ho,openDrawer:de,closeDrawer:Le,addCondition:Fo,updateCondition:Io,removeCondition:To,clearAllFilters:Pe,applyFilters:Oe,cancelChanges:ke,hasActiveFilters:Ro,activeFiltersCount:Do}=Ot({fields:V,initialFilter:go}),xo=useCallback(()=>{let x=Oe();z(x);},[Oe,z]),_o=useCallback(()=>{Pe(),z(void 0);},[Pe,z]),No=useCallback(x=>{H?de():(de(),se(x.currentTarget));},[H,de]),Ao=useCallback(()=>{ke(),se(null);},[ke]),[Eo,Be]=useState(!1),vo=useCallback(()=>{se(null),Le();},[Le]);return jsxs(Fragment,{children:[jsx(d$1,{title:e,columns:lo,rows:G,mobileRender:ne,rowCount:io,loading:r||!t,fetching:n,searchValue:m,onSearch:d,onSearchChange:s,paginationModel:{page:i,pageSize:l},onPaginationChange:f,actions:u,moreActions:L,onAdd:p,onRowDoubleClick:a?co:void 0,disableRowSelectionOnClick:!0,slots:A,initialState:mo,showColumnButton:ae,containerProps:{height:B,maxHeight:B},onColumnVisibilityModelChange:po,filterButton:jsx(je,{showFilterButton:W,isMobile:H,hasActiveFilters:Ro,activeFiltersCount:Do,sort:me,onFilterClick:No,onSortClick:()=>Be(!0)}),sortingMode:"server",sortModel:yo,onSortModelChange:So,disableColumnFilter:!0}),t&&jsxs(Fragment,{children:[jsx(ft,{showFilterButton:W,isOpen:ho,filterAnchorEl:uo,fields:V,conditions:bo,isMobile:H,onClose:vo,onAddCondition:Fo,onUpdateCondition:Io,onRemoveCondition:To,onApply:xo,onClear:_o,onCancel:Ao}),jsx(At,{open:Eo,onClose:()=>Be(!1),fields:V,sort:me,onSortChange:we})]})]})},Ii=memo(Fi,Po);var Ti=({metadata:e,columnVisibilityModel:t,defaultVisibleFields:o})=>{if(!e?.fields)return;let n=e.fields.map(i=>i.name).filter(i=>i==="ACTIONS"?!1:t?t[i]!==!1:o?.includes(i)??!0);return o?n.sort((i,l)=>{let m=o.indexOf(i),s=o.indexOf(l);return m-s||0}):n};
|
|
56
56
|
|
|
57
|
-
export { De as DateRenderer, xe as DateTimeRenderer,
|
|
57
|
+
export { De as DateRenderer, xe as DateTimeRenderer, _e as EntityRenderer, Qr as IconRenderer, ti as ImageRenderer, ii as NameRenderer, Ee as NumberRenderer, ve as StatusRenderer, Me as TextRenderer, Re as addActionsFieldToMetadata, Ti as buildVisibleFields, zt as createActionsField, Ii as default };
|
|
58
58
|
//# sourceMappingURL=index.js.map
|