@zydon/common 2.8.68 → 2.8.70
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-CYWFK4OE.js → chunk-2HAPOY5M.js} +2 -2
- package/dist/chunk-2ZJUGM2S.js +7 -0
- package/dist/chunk-2ZJUGM2S.js.map +1 -0
- package/dist/chunk-3ANG24S3.js +34 -0
- package/dist/chunk-3ANG24S3.js.map +1 -0
- package/dist/{chunk-GODJQLB7.js → chunk-3WZXWW7U.js} +4 -4
- package/dist/chunk-4F2NKGF6.js +6 -0
- package/dist/chunk-4F2NKGF6.js.map +1 -0
- package/dist/{chunk-JSL5OEWZ.js → chunk-5J35UAV6.js} +1 -1
- package/dist/chunk-5J35UAV6.js.map +1 -0
- package/dist/{chunk-6JTWZZRD.js → chunk-5ZLMWQZN.js} +4 -4
- package/dist/{chunk-5PUQMKA5.js → chunk-6WJV6RIV.js} +7 -7
- package/dist/chunk-6WJV6RIV.js.map +1 -0
- package/dist/{chunk-T53CFFZY.js → chunk-ASFSMJ6A.js} +2 -2
- package/dist/chunk-B26QCROD.js +11 -0
- package/dist/chunk-B26QCROD.js.map +1 -0
- package/dist/{chunk-D7UUJ7FJ.js → chunk-BVPBGV4Y.js} +2 -2
- package/dist/{chunk-CWRUW77O.js → chunk-C2G7TCA7.js} +2 -2
- package/dist/{chunk-EPMAHRQO.js → chunk-E5LHYPVP.js} +2 -2
- package/dist/{chunk-Y3TJIK6E.js → chunk-EGVNLRFU.js} +2 -2
- package/dist/chunk-EJ7OI2EH.js +16 -0
- package/dist/chunk-EJ7OI2EH.js.map +1 -0
- package/dist/chunk-FJBC6QA5.js +7 -0
- package/dist/chunk-FJBC6QA5.js.map +1 -0
- package/dist/{chunk-YKLRB3EJ.js → chunk-H5L3ML2R.js} +2 -2
- package/dist/{chunk-2A4XOLBZ.js → chunk-I3B772WD.js} +2 -2
- package/dist/chunk-IWUIXO24.js +4 -0
- package/dist/chunk-IWUIXO24.js.map +1 -0
- package/dist/{chunk-QMFFV7WM.js → chunk-KGV3O7H4.js} +3 -3
- package/dist/{chunk-PWR4GBUH.js → chunk-KKHNN3AT.js} +3 -3
- package/dist/{chunk-7JCGMZ6E.js → chunk-KZ7BJCEU.js} +2 -2
- package/dist/{chunk-PODYWSY7.js → chunk-MDDIBNRN.js} +2 -2
- package/dist/{chunk-KZFKHQ5P.js → chunk-OVLYORSO.js} +2 -2
- package/dist/{chunk-N2UR3W55.js → chunk-QPGDZXQ3.js} +2 -2
- package/dist/chunk-VTTZVSBX.js +12 -0
- package/dist/chunk-VTTZVSBX.js.map +1 -0
- package/dist/{chunk-LG2B5RFV.js → chunk-WLRSUL67.js} +2 -2
- package/dist/{chunk-3ELMAXMX.js → chunk-Z7F5DZAT.js} +2 -2
- package/dist/{chunk-O7SN6FIA.js → chunk-ZTTBPQJZ.js} +2 -2
- package/dist/components/ActionButton/index.js +3 -3
- package/dist/components/Autocomplete/index.js +3 -3
- package/dist/components/AutocompleteDetailed/index.js +2 -2
- package/dist/components/AvatarButton/index.js +2 -2
- package/dist/components/BuilderLayout/index.js +3 -3
- package/dist/components/BuilderSidebar/index.js +2 -2
- package/dist/components/BulkEditModal/index.js +4 -4
- package/dist/components/CardBrand/index.js +2 -2
- package/dist/components/Common/index.js +2 -2
- package/dist/components/CopyButton/index.js +4 -4
- package/dist/components/DataView/index.js +6 -6
- package/dist/components/DragButton/index.js +3 -3
- package/dist/components/Drawer/index.js +2 -2
- package/dist/components/DynamicDataView/index.js +21 -21
- package/dist/components/DynamicDataView/index.js.map +1 -1
- package/dist/components/EasyCropModal/index.js +5 -5
- package/dist/components/Error/index.js +2 -2
- package/dist/components/ExpandableGroup/index.js +2 -2
- package/dist/components/FileUpload/index.js +10 -10
- package/dist/components/FrameSkeleton/index.js +5 -5
- package/dist/components/HelpButton/index.js +3 -3
- package/dist/components/Icon/index.js +2 -2
- package/dist/components/IconButton/index.js +3 -3
- package/dist/components/ImageCropModal/index.js +3 -3
- package/dist/components/Incrementer/index.js +3 -3
- package/dist/components/InfoCircle/index.js +3 -3
- package/dist/components/ListBundles/index.js +4 -4
- package/dist/components/MenuItem/index.js +2 -2
- package/dist/components/Modal/index.js +3 -3
- package/dist/components/MoreMenu/index.js +2 -2
- package/dist/components/NotFound/index.js +2 -2
- package/dist/components/PasswordRules/index.js +2 -2
- package/dist/components/PopoverSelect/index.js +2 -2
- package/dist/components/ResponsivePopover/index.js +2 -2
- package/dist/components/Result/index.d.ts +1 -2
- package/dist/components/Result/index.js +1 -1
- package/dist/components/SearchInput/index.js +3 -3
- package/dist/components/SelectList/index.js +6 -6
- package/dist/components/SelectableCards/index.js +5 -5
- package/dist/components/SeoPreview/index.js +4 -4
- package/dist/components/SmartText/index.js +2 -2
- package/dist/components/SmartText/index.js.map +1 -1
- package/dist/components/StateDisplay/index.js +3 -3
- package/dist/components/Steps/index.js +2 -2
- package/dist/components/StyledTab/index.js +2 -2
- package/dist/components/SwapList/index.js +4 -4
- package/dist/components/TextMaxLine/index.js +2 -2
- package/dist/components/Tooltip/index.js +1 -1
- package/dist/components/WebhookCard/index.js +2 -2
- package/dist/components/animate/index.js +2 -2
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/form/Address/index.js +4 -4
- package/dist/components/form/Autocomplete/index.js +4 -4
- package/dist/components/form/AutocompleteDetailed/index.js +2 -2
- package/dist/components/form/Codes/index.js +1 -1
- package/dist/components/form/FileUpload/index.js +10 -10
- package/dist/components/form/Incrementer/index.js +3 -3
- package/dist/components/form/Password/index.js +2 -2
- package/dist/components/form/SelectList/index.js +6 -6
- package/dist/components/form/SelectableCards/index.js +5 -5
- package/dist/components/form/Webhook/index.js +15 -14
- package/dist/components/form/Webhook/index.js.map +1 -1
- package/dist/components/lightbox/index.js +2 -2
- package/dist/components/table/index.js +3 -3
- package/dist/hooks/useActiveElement.js +1 -1
- package/dist/hooks/useActiveElement.js.map +1 -1
- package/dist/hooks/useCollapseSidebarOnMount.js +3 -3
- package/dist/hooks/useEventListener.js +1 -1
- package/dist/hooks/useLocalStorage.js +2 -2
- package/dist/hooks/useOnClickOutside.js +1 -1
- package/dist/hooks/useResponsive.d.ts +1 -1
- package/dist/hooks/useResponsive.js +1 -1
- package/dist/hooks/useUpload.js +3 -3
- package/dist/hooks/useUpload.js.map +1 -1
- package/dist/types/icon.d.ts +7 -1
- package/dist/types/icon.js +1 -1
- package/dist/utils/sanitize-html.d.ts +3 -0
- package/dist/utils/sanitize-html.js +6 -0
- package/dist/utils/sanitize-html.js.map +1 -0
- package/package.json +6 -3
- package/dist/chunk-2MCLMTFV.js +0 -16
- package/dist/chunk-2MCLMTFV.js.map +0 -1
- package/dist/chunk-5PUQMKA5.js.map +0 -1
- package/dist/chunk-DGCPCUVB.js +0 -4
- package/dist/chunk-DGCPCUVB.js.map +0 -1
- package/dist/chunk-FBVAHVU3.js +0 -11
- package/dist/chunk-FBVAHVU3.js.map +0 -1
- package/dist/chunk-FQOV5EGQ.js +0 -12
- package/dist/chunk-FQOV5EGQ.js.map +0 -1
- package/dist/chunk-IJZCVZ32.js +0 -6
- package/dist/chunk-IJZCVZ32.js.map +0 -1
- package/dist/chunk-JSL5OEWZ.js.map +0 -1
- package/dist/chunk-KKVRDMSE.js +0 -7
- package/dist/chunk-KKVRDMSE.js.map +0 -1
- package/dist/chunk-RPO7AI5K.js +0 -7
- package/dist/chunk-RPO7AI5K.js.map +0 -1
- package/dist/chunk-TBFQ5PEL.js +0 -34
- package/dist/chunk-TBFQ5PEL.js.map +0 -1
- /package/dist/{chunk-CYWFK4OE.js.map → chunk-2HAPOY5M.js.map} +0 -0
- /package/dist/{chunk-GODJQLB7.js.map → chunk-3WZXWW7U.js.map} +0 -0
- /package/dist/{chunk-6JTWZZRD.js.map → chunk-5ZLMWQZN.js.map} +0 -0
- /package/dist/{chunk-T53CFFZY.js.map → chunk-ASFSMJ6A.js.map} +0 -0
- /package/dist/{chunk-D7UUJ7FJ.js.map → chunk-BVPBGV4Y.js.map} +0 -0
- /package/dist/{chunk-CWRUW77O.js.map → chunk-C2G7TCA7.js.map} +0 -0
- /package/dist/{chunk-EPMAHRQO.js.map → chunk-E5LHYPVP.js.map} +0 -0
- /package/dist/{chunk-Y3TJIK6E.js.map → chunk-EGVNLRFU.js.map} +0 -0
- /package/dist/{chunk-YKLRB3EJ.js.map → chunk-H5L3ML2R.js.map} +0 -0
- /package/dist/{chunk-2A4XOLBZ.js.map → chunk-I3B772WD.js.map} +0 -0
- /package/dist/{chunk-QMFFV7WM.js.map → chunk-KGV3O7H4.js.map} +0 -0
- /package/dist/{chunk-PWR4GBUH.js.map → chunk-KKHNN3AT.js.map} +0 -0
- /package/dist/{chunk-7JCGMZ6E.js.map → chunk-KZ7BJCEU.js.map} +0 -0
- /package/dist/{chunk-PODYWSY7.js.map → chunk-MDDIBNRN.js.map} +0 -0
- /package/dist/{chunk-KZFKHQ5P.js.map → chunk-OVLYORSO.js.map} +0 -0
- /package/dist/{chunk-N2UR3W55.js.map → chunk-QPGDZXQ3.js.map} +0 -0
- /package/dist/{chunk-LG2B5RFV.js.map → chunk-WLRSUL67.js.map} +0 -0
- /package/dist/{chunk-3ELMAXMX.js.map → chunk-Z7F5DZAT.js.map} +0 -0
- /package/dist/{chunk-O7SN6FIA.js.map → chunk-ZTTBPQJZ.js.map} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a } from './chunk-W3CK33IH.js';
|
|
2
|
+
import { f } from './chunk-OF6623HG.js';
|
|
3
|
+
import { a as a$1 } from './chunk-B26QCROD.js';
|
|
4
|
+
import { forwardRef, useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
5
|
+
import T from '@mui/material/IconButton';
|
|
6
|
+
import R from '@mui/material/InputAdornment';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
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:E,placeholder:O,InputProps:b,...z},L)=>{let[N,_]=useState(`incrementer-input-${Date.now()}`),I=useRef(null),s=Number(m||0),d=()=>{I.current&&(clearTimeout(I.current),I.current=null);};useEffect(()=>()=>d(),[]);let $=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(d(),!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(()=>{d();let n=s+e,t=K(n);c(t);},[s,e,o,r,p,c]),W=useCallback(n=>{d();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:{...b,startAdornment:jsx(R,{position:"start",sx:{ml:-1},children:jsx(T,{onClick:H,disabled:$,size:"small","aria-label":E||"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:{...b?.inputProps,style:{...b?.inputProps?.style,textAlign:"center"},sx:{mx:-2.5}}},inputProps:{tabIndex:w},onChange:W,disabled:i,placeholder:O,...z},N)});C.displayName="Incrementer";var F=C;
|
|
10
|
+
|
|
11
|
+
export { F as a };
|
|
12
|
+
//# sourceMappingURL=chunk-VTTZVSBX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Incrementer/index.tsx"],"names":["forwardRef","useCallback","useEffect","useMemo","useRef","useState","IconButton","InputAdornment","jsx","Incrementer","name","increment","updadteForMultiple","allowNegative","originalValue","onChange","minValue","maxValue","decimalScale","disabled","tabIndex","labelIncrementer","labelDecrementer","placeholder","InputProps","other","ref","inputkey","setInputKey","timer","value","clearTimer","disableDecrement","nextValue","disableIncrement","handleClickDecrement","valueMinusIncrement","newValue","fWithDecimalPlacesOrNot","getIncrementValue","handleClickIncrement","valuePlusIncrement","handleChange","e","NumberInput_default","Icon_default","Incrementer_default"],"mappings":"wHAAA,OACE,cAAAA,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EACA,YAAAC,MACK,QACP,OAAOC,MAAgB,2BACvB,OAAOC,MAAoB,+BA4JX,cAAAC,MAAA,oBAlJhB,IAAMC,EAAcT,EAClB,CACE,CACE,KAAAU,EACA,UAAAC,EAAY,EACZ,mBAAAC,EACA,cAAAC,EAAgB,GAChB,MAAOC,EACP,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,aAAAC,EACA,SAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,WAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,GAAM,CAACC,EAAUC,CAAW,EAAIvB,EAAS,qBAAqB,KAAK,IAAI,GAAG,EACpEwB,EAAQzB,EAA6C,IAAI,EACzD0B,EAAQ,OAAOhB,GAAiB,CAAC,EAEjCiB,EAAa,IAAM,CAClBF,EAAM,UACX,aAAaA,EAAM,OAAO,EAC1BA,EAAM,QAAU,KAClB,EAEA3B,EAAU,IACD,IAAM6B,EAAW,EACvB,CAAC,CAAC,EAEL,IAAMC,EAAmB7B,EAAQ,IAAM,CACrC,IAAM8B,EAAYH,EAAQnB,EAC1B,OAAI,OAAOK,GAAa,UAAYiB,EAAYjB,EAAiB,GAC1DG,GAAa,CAACN,GAAiBoB,EAAY,CACpD,EAAG,CAACd,EAAUW,EAAOnB,EAAWK,EAAUH,CAAa,CAAC,EAElDqB,EAAmB/B,EAAQ,IAAM,CACrC,IAAM8B,EAAYH,EAAQnB,EAC1B,OAAI,OAAOM,GAAa,UAAYgB,EAAYhB,EAAiB,GAE1DE,CACT,EAAG,CAACA,EAAUW,EAAOnB,EAAWM,CAAQ,CAAC,EAEnCkB,EAAuBlC,EAAY,IAAM,CAE7C,GADA8B,EAAW,EACP,CAAClB,GAAiBiB,EAAQnB,EAAY,EAAG,OAE7C,IAAMyB,EAAsBN,EAAQnB,EAC9B0B,EACJrB,IAAa,QAAaoB,EAAsBpB,EAC5CA,EACAsB,EAAwBF,EAAqBlB,CAAY,EAE/DH,EAASsB,CAAQ,CACnB,EAAG,CAACP,EAAOnB,EAAWK,EAAUE,EAAcH,EAAUF,CAAa,CAAC,EAEhE0B,EAAqBT,GACrBd,IAAa,QAAac,EAAQd,EAC7BA,EAELC,IAAa,QAAaa,EAAQb,EAC7BA,EAEFqB,EAAwBR,EAAOZ,CAAY,EAG9CsB,EAAuBvC,EAAY,IAAM,CAC7C8B,EAAW,EACX,IAAMU,EAAqBX,EAAQnB,EAC7B0B,EAAWE,EAAkBE,CAAkB,EACrD1B,EAASsB,CAAQ,CAEnB,EAAG,CAACP,EAAOnB,EAAWM,EAAUD,EAAUE,EAAcH,CAAQ,CAAC,EAE3D2B,EAAezC,EAClB0C,GAAsB,CACrBZ,EAAW,EACX,IAAIM,EAAW,OAAOM,EAAE,OAAO,OAAS,CAAC,GAErChC,IAAc,GAAKC,KACrByB,EAAWA,EAAW1B,EAAY,EAClC0B,GAAYA,EAAW1B,GAGrB,CAACE,GAAiBwB,EAAW,IAC/BA,EAAW,GAGT,OAAOrB,GAAa,UAAYqB,EAAWrB,IAC7CqB,EAAWrB,GAGT,OAAOC,GAAa,UAAYoB,EAAWpB,IAC7CoB,EAAWpB,GAGboB,EAAWC,EAAwBD,EAAUnB,CAAY,GACrD,CAACmB,GAAYA,IAAavB,KAC5Be,EAAM,QAAU,WAAW,IAAM,CAE/BD,EAAY,qBAAqB,KAAK,IAAI,GAAG,CAC/C,EAAG,GAAG,GAGRb,EAASsB,CAAQ,CAEnB,EACA,CACEvB,EACAH,EACAK,EACAC,EACAC,EACAH,EACAH,EACAC,CACF,CACF,EAEA,OACEL,EAACoC,EAAA,CAEC,IAAKlB,EACL,KAAMhB,EACN,MAAOI,EACP,SAAUE,EACV,SAAUC,EACV,cAAeJ,EACf,aAAcK,EACd,WAAY,CACV,GAAGM,EACH,eACEhB,EAACD,EAAA,CAAe,SAAS,QAAQ,GAAI,CAAE,GAAI,EAAG,EAC5C,SAAAC,EAACF,EAAA,CACC,QAAS6B,EACT,SAAUH,EACV,KAAK,QACL,aAAYV,GAAoB,aAChC,GAAI,CAAE,EAAG,EAAI,EAEb,SAAAd,EAACqC,EAAA,CACC,KAAK,aACL,MAAO,GACP,OAAQ,GACR,MAAM,eACR,EACF,EACF,EAEF,aACErC,EAACD,EAAA,CAAe,SAAS,MAAM,GAAI,CAAE,GAAI,EAAG,EAC1C,SAAAC,EAACF,EAAA,CACC,QAASkC,EACT,SAAUN,EACV,KAAK,QACL,aAAYb,GAAoB,aAChC,GAAI,CAAE,EAAG,EAAI,EAEb,SAAAb,EAACqC,EAAA,CACC,KAAK,aACL,MAAO,GACP,OAAQ,GACR,MAAM,eACR,EACF,EACF,EAEF,WAAY,CACV,GAAGrB,GAAY,WACf,MAAO,CACL,GAAGA,GAAY,YAAY,MAC3B,UAAW,QACb,EACA,GAAI,CACF,GAAI,IACN,CACF,CACF,EACA,WAAY,CAAE,SAAAJ,CAAS,EACvB,SAAUsB,EACV,SAAUvB,EACV,YAAaI,EACZ,GAAGE,GA7DCE,CA8DP,CAEJ,CACF,EAEAlB,EAAY,YAAc,cAE1B,IAAOqC,EAAQrC","sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport IconButton from '@mui/material/IconButton';\nimport InputAdornment from '@mui/material/InputAdornment';\n\nimport { OnChangeReturn } from 'types/numberInputProps';\nimport { fWithDecimalPlacesOrNot } from 'utils/formatNumber';\n\nimport Icon from '../Icon';\nimport NumberInput from '../NumberInput';\n\nimport { IncrementerProps } from './props';\n\nconst Incrementer = forwardRef<HTMLDivElement, IncrementerProps>(\n (\n {\n name,\n increment = 1,\n updadteForMultiple,\n allowNegative = false,\n value: originalValue,\n onChange,\n minValue,\n maxValue,\n decimalScale,\n disabled,\n tabIndex,\n labelIncrementer,\n labelDecrementer,\n placeholder,\n InputProps,\n ...other\n },\n ref,\n ) => {\n const [inputkey, setInputKey] = useState(`incrementer-input-${Date.now()}`);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const value = Number(originalValue || 0);\n\n const clearTimer = () => {\n if (!timer.current) return;\n clearTimeout(timer.current);\n timer.current = null;\n };\n\n useEffect(() => {\n return () => clearTimer();\n }, []);\n\n const disableDecrement = useMemo(() => {\n const nextValue = value - increment;\n if (typeof minValue === 'number' && nextValue < minValue) return true;\n return disabled || (!allowNegative && nextValue < 0);\n }, [disabled, value, increment, minValue, allowNegative]);\n\n const disableIncrement = useMemo(() => {\n const nextValue = value + increment;\n if (typeof maxValue === 'number' && nextValue > maxValue) return true;\n\n return disabled;\n }, [disabled, value, increment, maxValue]);\n\n const handleClickDecrement = useCallback(() => {\n clearTimer();\n if (!allowNegative && value - increment < 0) return;\n\n const valueMinusIncrement = value - increment;\n const newValue =\n minValue !== undefined && valueMinusIncrement < minValue\n ? minValue\n : fWithDecimalPlacesOrNot(valueMinusIncrement, decimalScale);\n\n onChange(newValue);\n }, [value, increment, minValue, decimalScale, onChange, allowNegative]);\n\n const getIncrementValue = (value: number) => {\n if (minValue !== undefined && value < minValue) {\n return minValue;\n }\n if (maxValue !== undefined && value > maxValue) {\n return maxValue;\n }\n return fWithDecimalPlacesOrNot(value, decimalScale);\n };\n\n const handleClickIncrement = useCallback(() => {\n clearTimer();\n const valuePlusIncrement = value + increment;\n const newValue = getIncrementValue(valuePlusIncrement);\n onChange(newValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, increment, maxValue, minValue, decimalScale, onChange]);\n\n const handleChange = useCallback(\n (e: OnChangeReturn) => {\n clearTimer();\n let newValue = Number(e.target.value || 0);\n\n if (increment !== 1 || updadteForMultiple) {\n newValue = newValue + increment / 2;\n newValue -= newValue % increment;\n }\n\n if (!allowNegative && newValue < 0) {\n newValue = 0;\n }\n\n if (typeof minValue === 'number' && newValue < minValue) {\n newValue = minValue;\n }\n\n if (typeof maxValue === 'number' && newValue > maxValue) {\n newValue = maxValue;\n }\n\n newValue = fWithDecimalPlacesOrNot(newValue, decimalScale);\n if (!newValue || newValue === originalValue) {\n timer.current = setTimeout(() => {\n //force clean when new value is the same as original value\n setInputKey(`incrementer-input-${Date.now()}`);\n }, 600);\n }\n\n onChange(newValue);\n return;\n },\n [\n originalValue,\n increment,\n minValue,\n maxValue,\n decimalScale,\n onChange,\n updadteForMultiple,\n allowNegative,\n ],\n );\n\n return (\n <NumberInput\n key={inputkey}\n ref={ref}\n name={name}\n value={originalValue}\n minValue={minValue}\n maxValue={maxValue}\n allowNegative={allowNegative}\n decimalScale={decimalScale}\n InputProps={{\n ...InputProps,\n startAdornment: (\n <InputAdornment position=\"start\" sx={{ ml: -1 }}>\n <IconButton\n onClick={handleClickDecrement}\n disabled={disableDecrement}\n size=\"small\"\n aria-label={labelDecrementer || 'Decrementa'}\n sx={{ p: 0.5 }}\n >\n <Icon\n icon=\"MINUS_SIGN\"\n width={14}\n height={14}\n color=\"primary.main\"\n />\n </IconButton>\n </InputAdornment>\n ),\n endAdornment: (\n <InputAdornment position=\"end\" sx={{ mr: -1 }}>\n <IconButton\n onClick={handleClickIncrement}\n disabled={disableIncrement}\n size=\"small\"\n aria-label={labelIncrementer || 'Incrementa'}\n sx={{ p: 0.5 }}\n >\n <Icon\n icon=\"SIMPLE_ADD\"\n width={14}\n height={14}\n color=\"primary.main\"\n />\n </IconButton>\n </InputAdornment>\n ),\n inputProps: {\n ...InputProps?.inputProps,\n style: {\n ...InputProps?.inputProps?.style,\n textAlign: 'center',\n },\n sx: {\n mx: -2.5,\n },\n },\n }}\n inputProps={{ tabIndex }}\n onChange={handleChange}\n disabled={disabled}\n placeholder={placeholder}\n {...other}\n />\n );\n },\n);\n\nIncrementer.displayName = 'Incrementer';\n\nexport default Incrementer;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b } from './chunk-
|
|
1
|
+
import { b } from './chunk-2ZJUGM2S.js';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import v from 'react-fast-compare';
|
|
4
4
|
import f from '@mui/material/Drawer';
|
|
@@ -8,4 +8,4 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
8
8
|
var c=({open:r,onClose:e,anchorEl:s,children:i,isMobile:m,popoverProps:n,drawerProps:o})=>{let a=b("down","md");return m??a?jsx(f,{anchor:"bottom",open:r,onClose:e,...o,PaperProps:{sx:{maxWidth:"calc(100vw - 24px)",maxHeight:"85vh",...o?.PaperProps?.sx},...o?.PaperProps},children:i}):jsx(P,{open:r,anchorEl:s,onClose:e,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},...n,children:i})},g=memo(c,v);
|
|
9
9
|
|
|
10
10
|
export { g as a };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-WLRSUL67.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-B26QCROD.js';
|
|
2
2
|
import { memo, forwardRef, useMemo } from 'react';
|
|
3
3
|
import w from '@mui/material/Box';
|
|
4
4
|
import E from '@mui/material/CircularProgress';
|
|
@@ -8,4 +8,4 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
8
8
|
var c=memo(forwardRef(({icon:o,label:e,loading:r=!1,disabled:s=!1,iconProps:m={},children:n,color:a$1="primary.main",boxProps:B={},...l},p)=>{if(!o&&!n)throw new Error("IconButton: icon or children is required");let i=useMemo(()=>o?jsx(a,{icon:o,...m}):n,[o,n,m]),I=useMemo(()=>r?jsx(E,{size:20,color:"inherit"}):i,[r,i]);return jsx(w,{color:a$1,...B,children:jsx(R,{ref:p,color:"inherit","aria-label":e,title:e,disabled:r||s,...l,children:I})})}));c.displayName="IconButton";var L=c;
|
|
9
9
|
|
|
10
10
|
export { L as a };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-Z7F5DZAT.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as a$1 } from './chunk-
|
|
1
|
+
import { a as a$1 } from './chunk-2ZJUGM2S.js';
|
|
2
2
|
import { memo, forwardRef } from 'react';
|
|
3
3
|
import d from '@mui/material/Link';
|
|
4
4
|
import k from '@mui/material/Typography';
|
|
@@ -8,4 +8,4 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
8
8
|
function c(o){return Math.round(parseFloat(o)*16)}function y(o){let e=useTheme(),t=a$1(),p=e.breakpoints.up(t==="xl"?"lg":t),h=(o==="h1"||o==="h2"||o==="h3"||o==="h4"||o==="h5"||o==="h6")&&e.typography[o][p]?e.typography[o][p]:e.typography[o],r=c(h.fontSize),i=Number(e.typography[o].lineHeight)*r,{fontWeight:m,letterSpacing:n}=e.typography[o];return {fontSize:r,lineHeight:i,fontWeight:m,letterSpacing:n}}var a=memo(forwardRef(({asLink:o,variant:e="body1",line:t=2,persistent:p=!1,children:s,sx:h,...r},i)=>{let{lineHeight:m}=y(e),n={overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical",wordBreak:"break-all",...p&&{height:m*t},...h};return o?jsx(d,{color:"inherit",ref:i,variant:e,sx:{...n},...r,children:s}):jsx(k,{ref:i,variant:e,sx:{...n},...r,children:s})}));a.displayName="TextMaxLine";var P=a;
|
|
9
9
|
|
|
10
10
|
export { P as a };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-ZTTBPQJZ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-QPGDZXQ3.js';
|
|
2
|
+
import '../../chunk-B26QCROD.js';
|
|
3
|
+
import '../../chunk-IWUIXO24.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-E5LHYPVP.js';
|
|
2
|
+
import '../../chunk-B26QCROD.js';
|
|
3
|
+
import '../../chunk-IWUIXO24.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as a$4 } from '../../chunk-5EKUS6HX.js';
|
|
2
2
|
import { a as a$5 } from '../../chunk-UJMWTYPH.js';
|
|
3
3
|
import { a } from '../../chunk-CO2KQFUN.js';
|
|
4
|
-
import { a as a$3 } from '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
4
|
+
import { a as a$3 } from '../../chunk-B26QCROD.js';
|
|
5
|
+
import '../../chunk-IWUIXO24.js';
|
|
6
6
|
import { a as a$2 } from '../../chunk-VR3K2Y2C.js';
|
|
7
7
|
import { a as a$1 } from '../../chunk-LQRRMVFN.js';
|
|
8
8
|
import '../../chunk-U4I7JPER.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as a$1 } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
import { a as a$1 } from '../../chunk-MDDIBNRN.js';
|
|
2
|
+
import '../../chunk-B26QCROD.js';
|
|
3
|
+
import '../../chunk-IWUIXO24.js';
|
|
4
4
|
import a from '@mui/material/Stack';
|
|
5
5
|
import { styled, alpha } from '@mui/material/styles';
|
|
6
6
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as a$2 } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { a as a$2 } from '../../chunk-B26QCROD.js';
|
|
2
|
+
import '../../chunk-IWUIXO24.js';
|
|
3
3
|
import { a as a$1 } from '../../chunk-E3R7W7GK.js';
|
|
4
4
|
import a from '@mui/material/Stack';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a } from '../../chunk-
|
|
1
|
+
import { a } from '../../chunk-ASFSMJ6A.js';
|
|
2
2
|
import { r } from '../../chunk-XUDTPZHF.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-
|
|
6
|
+
import '../../chunk-E5LHYPVP.js';
|
|
7
7
|
import '../../chunk-CO2KQFUN.js';
|
|
8
|
-
import { a as a$2 } from '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
8
|
+
import { a as a$2 } from '../../chunk-B26QCROD.js';
|
|
9
|
+
import '../../chunk-IWUIXO24.js';
|
|
10
10
|
import { memo, useEffect, useState, useMemo, useCallback } from 'react';
|
|
11
11
|
import { useFormContext, useWatch, useForm, FormProvider } from 'react-hook-form';
|
|
12
12
|
import Vt from '@mui/material/LinearProgress';
|
|
@@ -2,8 +2,8 @@ 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-
|
|
6
|
-
import '../../chunk-
|
|
5
|
+
import { a } from '../../chunk-B26QCROD.js';
|
|
6
|
+
import '../../chunk-IWUIXO24.js';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
var o=A=>({["MERCADOPAY"]:"MERCADO_PAGO",["AMAZONPAY"]:"AMAZON_PAY",["GPAY"]:"GOOGLE_PAY",["PAYPAL"]:"PAYPAL",["APPLEPAY"]:"APPLE_PAY",["ELO"]:"ELO",["MASTERCARD"]:"MASTERCARD",["AMEX"]:"AMERICAN_EXPRESS",["DINERSCLUB"]:"DINERS_CLUB",["CIRRUS"]:"CIRRUS",["VISA"]:"VISA",["HIPERCARD"]:"HIPERCARD",["JCB"]:"JCB",["UNIONPAY"]:"UNIONPAY",["MAESTRO"]:"MAESTRO",["HIPER"]:"HIPER",["DISCOVER"]:"DISCOVER"})[A]??null,R=({cardNumber:A,...r})=>jsx(a,{icon:o(a$1(A)),...r}),d=R;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { a } from '../../chunk-B26QCROD.js';
|
|
2
|
+
import '../../chunk-IWUIXO24.js';
|
|
3
3
|
import { b } from '../../chunk-NWT5TUJO.js';
|
|
4
4
|
import '../../chunk-373WGZZL.js';
|
|
5
5
|
import '../../chunk-BX2DSNRV.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-KGV3O7H4.js';
|
|
2
|
+
import '../../chunk-5J35UAV6.js';
|
|
3
|
+
import '../../chunk-B26QCROD.js';
|
|
4
|
+
import '../../chunk-IWUIXO24.js';
|
|
5
5
|
import '../../chunk-IAOMC4C4.js';
|
|
6
6
|
import '../../chunk-CFNATBO2.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as DesktopFooter, a as EnhancedMoreActions, c as Toolbar, d as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
export { b as DesktopFooter, a as EnhancedMoreActions, c as Toolbar, d as default } from '../../chunk-6WJV6RIV.js';
|
|
2
|
+
import '../../chunk-EGVNLRFU.js';
|
|
3
|
+
import '../../chunk-4F2NKGF6.js';
|
|
4
4
|
import '../../chunk-NMGWHSNZ.js';
|
|
5
5
|
import '../../chunk-6U5LS7MP.js';
|
|
6
6
|
import '../../chunk-LZQ7OFKO.js';
|
|
@@ -12,9 +12,9 @@ import '../../chunk-RBTYTONM.js';
|
|
|
12
12
|
import '../../chunk-F65ZXAGV.js';
|
|
13
13
|
import '../../chunk-I4PPSW36.js';
|
|
14
14
|
import '../../chunk-CO2KQFUN.js';
|
|
15
|
-
import '../../chunk-
|
|
16
|
-
import '../../chunk-
|
|
15
|
+
import '../../chunk-B26QCROD.js';
|
|
16
|
+
import '../../chunk-IWUIXO24.js';
|
|
17
17
|
import '../../chunk-LQRRMVFN.js';
|
|
18
|
-
import '../../chunk-
|
|
18
|
+
import '../../chunk-2ZJUGM2S.js';
|
|
19
19
|
import '../../chunk-GLRLKFPS.js';
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-H5L3ML2R.js';
|
|
2
|
+
import '../../chunk-B26QCROD.js';
|
|
3
|
+
import '../../chunk-IWUIXO24.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as a$1 } from '../../chunk-F65ZXAGV.js';
|
|
2
|
-
import { a } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
2
|
+
import { a } from '../../chunk-B26QCROD.js';
|
|
3
|
+
import '../../chunk-IWUIXO24.js';
|
|
4
4
|
import S from '@mui/material/Drawer';
|
|
5
5
|
import T from '@mui/material/IconButton';
|
|
6
6
|
import l from '@mui/material/Stack';
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
export { a as FilterOperator, b as SortType } from '../../chunk-VL4W63YA.js';
|
|
2
2
|
import '../../chunk-4P2L7UJA.js';
|
|
3
|
-
import { a as a$1 } from '../../chunk-
|
|
3
|
+
import { a as a$1 } from '../../chunk-WLRSUL67.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-
|
|
8
|
-
import '../../chunk-
|
|
6
|
+
import { d as d$1 } from '../../chunk-6WJV6RIV.js';
|
|
7
|
+
import '../../chunk-EGVNLRFU.js';
|
|
8
|
+
import '../../chunk-4F2NKGF6.js';
|
|
9
9
|
import '../../chunk-NMGWHSNZ.js';
|
|
10
10
|
import '../../chunk-6U5LS7MP.js';
|
|
11
11
|
import '../../chunk-LZQ7OFKO.js';
|
|
12
12
|
import '../../chunk-NIQW2J3M.js';
|
|
13
13
|
import '../../chunk-PRWQQJDL.js';
|
|
14
|
-
import { a as a$2 } from '../../chunk-
|
|
15
|
-
import '../../chunk-
|
|
14
|
+
import { a as a$2 } from '../../chunk-KGV3O7H4.js';
|
|
15
|
+
import '../../chunk-5J35UAV6.js';
|
|
16
16
|
import { e } from '../../chunk-XUDTPZHF.js';
|
|
17
17
|
import '../../chunk-UVPQR2Q2.js';
|
|
18
18
|
import '../../chunk-RBTYTONM.js';
|
|
19
19
|
import '../../chunk-F65ZXAGV.js';
|
|
20
20
|
import '../../chunk-I4PPSW36.js';
|
|
21
21
|
import '../../chunk-CO2KQFUN.js';
|
|
22
|
-
import { a } from '../../chunk-
|
|
23
|
-
import '../../chunk-
|
|
22
|
+
import { a } from '../../chunk-B26QCROD.js';
|
|
23
|
+
import '../../chunk-IWUIXO24.js';
|
|
24
24
|
import '../../chunk-IAOMC4C4.js';
|
|
25
25
|
import { a as a$5 } from '../../chunk-F6H765KA.js';
|
|
26
26
|
import '../../chunk-LQRRMVFN.js';
|
|
27
|
-
import { b } from '../../chunk-
|
|
27
|
+
import { b } from '../../chunk-2ZJUGM2S.js';
|
|
28
28
|
import '../../chunk-GLRLKFPS.js';
|
|
29
|
-
import { a as a$4 } from '../../chunk-
|
|
30
|
-
import '../../chunk-
|
|
29
|
+
import { a as a$4 } from '../../chunk-2HAPOY5M.js';
|
|
30
|
+
import '../../chunk-FJBC6QA5.js';
|
|
31
31
|
import '../../chunk-POTVACYB.js';
|
|
32
32
|
import '../../chunk-ET3WPQIO.js';
|
|
33
33
|
import '../../chunk-CFNATBO2.js';
|
|
34
34
|
import { memo, useMemo, useCallback, useState, useEffect, useRef } from 'react';
|
|
35
|
-
import
|
|
35
|
+
import Go from 'react-fast-compare';
|
|
36
36
|
import Qe from '@mui/material/Badge';
|
|
37
|
-
import
|
|
37
|
+
import Fe from '@mui/material/Button';
|
|
38
38
|
import je from '@mui/material/IconButton';
|
|
39
39
|
import Nt from '@mui/material/Stack';
|
|
40
40
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -44,16 +44,16 @@ import fe from '@mui/material/FormControl';
|
|
|
44
44
|
import Ce from '@mui/material/InputLabel';
|
|
45
45
|
import $ from '@mui/material/MenuItem';
|
|
46
46
|
import ge from '@mui/material/Select';
|
|
47
|
-
import
|
|
47
|
+
import tr from '@mui/material/TextField';
|
|
48
48
|
import X from '@mui/material/Box';
|
|
49
49
|
import { styled } from '@mui/material/styles';
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
50
|
+
import Tr from '@mui/material/Dialog';
|
|
51
|
+
import Rr from '@mui/material/DialogActions';
|
|
52
|
+
import Dr from '@mui/material/DialogContent';
|
|
53
|
+
import xr from '@mui/material/DialogTitle';
|
|
54
|
+
import Qr from '@mui/material/Chip';
|
|
55
55
|
|
|
56
|
-
var Uo=({showFilterButton:e$1,isMobile:t,hasActiveFilters:o,activeFiltersCount:r,sort:n,onFilterClick:i,onSortClick:l})=>e$1?t?jsxs(Nt,{direction:"row",spacing:.5,children:[jsx(Qe,{badgeContent:r,color:"primary",invisible:r===0,sx:{"& .MuiBadge-badge":{transform:"scale(0.9) translate(10px, 9px)",opacity:r===0?0:1}},children:jsx(je,{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(je,{color:n?"primary":"default",onClick:l,size:"small","aria-label":"Ordenar",children:jsx(a,{icon:n?.sortType==="DESC"?"SORTING_DESC":"SORTING_ASC"})})]}):jsx(Qe,{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(Uo,Wo);var Ze=e=>e.filter(t=>t.available_filter_conditions&&t.available_filter_conditions.length>0&&t.name!=="ACTIONS");var et=e=>{let{type:t,available_filter_conditions:o}=e;return o.length===0?"EQUALS":t==="TEXT"&&o.includes("LIKE")?"LIKE":o[0]},Y=e=>e.value.length>0||e.conditional==="IS_NULL"||e.conditional==="IS_NOT_NULL",tt=e=>{if(e.length===0)return;let t=e.filter(Y);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 ot={["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 Ko=({value:e,onChange:t,totalConditions:o,isFirst:r})=>o===1?null:r?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($,{value:"AND",children:"e"}),jsx($,{value:"OR",children:"ou"})]}),it=memo(Ko,Wo);var O={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},tr=({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]),p=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]),d=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(je,{onClick:r,size:"small","aria-label":"Remover filtro",sx:{flexShrink:0},children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:18})}),jsx(it,{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=>p(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:t.map(a=>jsx($,{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($,{value:a,sx:O,children:ot[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=>d(a.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:[jsx($,{value:"true",children:"Verdadeiro"}),jsx($,{value:"false",children:"Falso"})]})]}):jsx(er,{label:"Filtro",value:e.value[0]||"",onChange:a=>d(a.target.value),size:"small",disabled:s,InputLabelProps:{shrink:!0},sx:{flex:1,minWidth:120}})]})},nt=memo(tr,Wo);var nr=({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(p=>!l.includes(p.name)||p.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,p)=>jsx(nt,{condition:s,fields:m(s.fieldName),onChange:n,onRemove:i(s.id),showOperator:p>0,totalConditions:t.length,isFirst:p===0},s.id))})},at=memo(nr,Wo);var lt=styled(X)({display:"flex",flexDirection:"column",height:"100%"}),st=styled(X)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2,3)})),mt=styled(X)(({theme:e})=>({flex:1,overflowY:"auto",padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(2)})),dt=styled(X)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2)}));var ur=({onClose:e,fields:t,conditions:o,onAddCondition:r,onUpdateCondition:n,onRemoveCondition:i,onApply:l,onClear:m,onCancel:s})=>{let p=Ze(t),f=o.length>0,d=useCallback(()=>{l(),e();},[l,e]),c=useCallback(()=>{m(),e();},[m,e]),a$1=useCallback(()=>{s();},[s]);return jsxs(lt,{children:[jsxs(st,{children:[jsx(Se,{variant:"overline",fontWeight:600,color:"text.secondary",children:"Defina as condi\xE7\xF5es para filtrar"}),jsx(je,{onClick:r,size:"small","aria-label":"Adicionar filtro",title:"Adicionar filtro",disabled:o.length>=p.length,children:jsx(a,{icon:"SIMPLE_ADD"})})]}),jsx(pt,{}),jsx(mt,{children:jsx(at,{filterableFields:p,conditions:o,onUpdateCondition:n,onRemoveCondition:i})}),jsx(pt,{}),jsxs(dt,{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:d,disabled:!f,startIcon:jsx(a,{icon:"SIMPLE_CHECK"}),children:"Aplicar"})]})]})]})},ct=memo(ur,Wo);var gr=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(ct,{...e})}),ft=memo(gr,Wo);var br=({showFilterButton:e,isOpen:t,filterAnchorEl:o,fields:r,conditions:n,isMobile:i,onClose:l,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:p,onApply:f,onClear:d,onCancel:c})=>e?jsx(ft,{open:t||!!o,anchorEl:o,onClose:l,fields:r,conditions:n,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:p,onApply:f,onClear:d,onCancel:c,isMobileProp:i}):null,Ct=memo(br,Wo);var gt=styled(Ir)(()=>({"& .MuiDialog-paper":{width:"100%"}})),yt=styled(Dr)(({theme:e})=>({borderBottom:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),St=styled(Rr)(({theme:e})=>({padding:e.spacing(2)})),bt=styled(Tr)(({theme:e})=>({borderTop:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),ht=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 At=({open:e,onClose:t,fields:o,sort:r,onSortChange:n})=>{let[i,l]=useState(r?.fieldName||""),[m,s]=useState(r?.sortType||"ASC"),p=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]),d=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(gt,{open:e,onClose:t,maxWidth:"xs",fullWidth:!0,children:[jsx(yt,{children:jsx(Se,{variant:"overline",color:"text.secondary",children:"Ordenar por"})}),jsx(St,{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:i,label:"Campo",onChange:u=>l(u.target.value),children:[jsx($,{value:"",children:jsx("em",{children:"Nenhum"})}),p.map(u=>jsx($,{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($,{value:"ASC",children:["Crescente ",d?"(1-9)":"(A-Z)"]}),jsxs($,{value:"DESC",children:["Decrescente ",d?"(9-1)":"(Z-A)"]})]})]})]})}),jsxs(bt,{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(ht,{onClick:c,variant:"contained",children:[jsx(a,{icon:"SIMPLE_CHECK"}),jsx(Fe,{children:"Aplicar"})]})]})]})};At.displayName="SortModal";var Et=memo(At);var vt=({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(d=>d!==l),s=new Set,p=[],f=d=>{let c=n.get(d);if(!c)return;let a=r.get(c.name);!a||s.has(c.name)||(p.push(a),s.add(c.name));};return m.forEach(d=>{f(d);}),t.forEach(d=>{if(d.name===l||m.includes(d.name))return;let c=r.get(d.name);!c||s.has(d.name)||(p.push(c),s.add(d.name));}),f(l),p.length===0?e:p},[e,r,n,o,t]),columnsByFieldId:r,fieldsByName:n}};function Mr(e){return e.name}var Mt=({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(d=>{let c=Mr(d);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(d.name)),typeof a=="boolean"&&(f[c]=a);}),Object.keys(f).length!==0)return {columns:{columnVisibilityModel:f}}},[t,o,e,i,l]),p=useCallback(f=>{if(i){let d={...f};delete d.__check__,m(d);}n&&n(f);},[i,n,m]);return {initialState:s,handleColumnVisibilityModelChange:p}};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"},wt=["price","base_price","minimum_value","maximum_value","minimum_installment_value"];var wr=(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)}),Lr=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.ID_MIN_WIDTH,flex:N.ID_FLEX,renderCell:o=>t(e,o.row)}),Pr=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.ENTITY_MIN_WIDTH,flex:N.ENTITY_FLEX,renderCell:o=>t(e,o.row)}),Or=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.MIN_WIDTH,renderCell:o=>t(e,o.row)}),kr=(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)}),Lt=(e,t)=>e.name===t?.id_field_name||e.name==="name"?Lr:e.name==="ACTIONS"?kr:e.type==="FILE"?wr:e.type==="ENTITY"?Pr:Or;var Pt=({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]??Lt(i,e))(i,t,e);r.set(i.name,m);}),Array.from(r.values())},[o,e,t]);var Ot=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})):[],kt=({fields:e,initialFilter:t})=>{let[o,r]=useState(!1),[n,i]=useState(()=>Ot(t)),[l,m]=useState(t),[s,p]=useState(()=>Ot(t)),f=useRef([]),d=useCallback(()=>{f.current=n.map(C=>({...C})),p(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],x={id:a$5(),operator:E,fieldName:b.filter_field_name??b.name,conditional:et(b),value:[]};p(R=>[...R,x]);},[e,s]),u=useCallback((C,S)=>{p(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(x=>x.id===C?{...x,...S}:{...x,operator:b})}return F.map(b=>b.id===C?{...b,...S}:b)});},[]),L=useCallback(C=>{p(S=>S.filter(F=>F.id!==C));},[]),A=()=>{p([]),i([]),m(void 0);},re=()=>{let C=tt(s);return i(s.map(S=>({...S}))),m(C),r(!1),C},ie=()=>{p(f.current.map(C=>({...C}))),r(!1);},ne=n.some(Y),ae=n.filter(Y).length;return {conditions:s,filter:l,isOpen:o,hasActiveFilters:ne,activeFiltersCount:ae,openDrawer:d,closeDrawer:c,addCondition:a,updateCondition:u,removeCondition:L,clearAllFilters:A,applyFilters:re,cancelChanges:ie}};var Gt=e=>{try{let t=localStorage.getItem(e);return t?JSON.parse(t):void 0}catch{return}},Vt=(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(()=>Gt(r)||t);return useEffect(()=>{t!==void 0&&i(t);},[t]),{filter:n,setFilter:m=>{i(m),Vt(r,m),o?.(m);}}},Ht=(e,t,o)=>{let r=`${e}:sort`,[n,i]=useState(()=>Gt(r)||t);return useEffect(()=>{t!==void 0&&i(t);},[t]),{sort:n,setSort:m=>{i(m),Vt(r,m),o?.(m);}}};var Ur=(e,t)=>e?e.find(r=>r.name===t)?.filter_field_name??t:t,Hr=(e,t)=>e?e.find(r=>r.filter_field_name===t||r.name===t)?.name??t:t,zt=({sort:e,onSortChange:t,fields:o})=>{let r=useMemo(()=>e?[{field:Hr(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:Ur(o,l.field),sortType:l.sort.toUpperCase()};t(m);},[t,o]);return {sortModel:r,handleSortModelChange:n}};var Yt=()=>({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,Yt()]};var Yr=({value:e,format:t})=>e==null?"-":d(e,t),De=memo(Yr);var $r=({value:e,format:t})=>e==null?"-":c(e,t),xe=memo($r);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(Xr,{label:String(o),variant:"outlined",size:"small",sx:{width:"fit-content",color:"text.secondary",borderColor:"divider",borderRadius:3}}):null},_e=memo(Qr);var Zr=({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}),ei=memo(Zr);var $t=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"})),Kt=styled(X,{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 ii=({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(Kt,{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"})})},ni=memo(ii);var li=({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})]})]}),si=memo(li);var ci=({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(ci);var fi=({active:e,activeLabel:t="Ativo",inactiveLabel:o="Inativo"})=>jsx($t,{isActive:e,children:e?t:o}),ve=memo(fi);var bi=e=>e.replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim(),hi=({value:e,showCopyButton:t=!1,copyMessage:o="Copiado",copyLabel:r,mask:n})=>{if(!e)return "-";let i=String(e),l=n?n(i):bi(i);return t?jsxs(Nt,{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(hi);function Ii(e){return wt.includes(e)}var eo=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:Ii(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 Di=({title:e,metadata:t,data:o,isLoading:r,isFetching:n,page:i,perPage:l,searchValue:m,onSearchChange:s,onSearch:p,onPaginationChange:f,onAdd:d,onRowAction:c,onRowDoubleClick:a,actions:u,moreActions:L,bulkActions:A,rowSelectionModel:re,onRowSelectionModelChange:ie,slots:ne,mobileRender:ae,containerHeight:C=600,showColumnButton:S=!1,showFilterButton:F=!1,filter:E,onFilterChange:b$1,sort:x,onSortChange:R,defaultVisibleFieldNames:io,preferredFieldOrder:no,columnStrategies:ao,onColumnVisibilityModelChange:lo,storageKey:le})=>{let{items:B=[],total:so=0}=o||{},W=useMemo(()=>{if(t)return t;if(B.length>0){let _=B[0],H=Object.keys(_).map(Ge=>({name:Ge,type:"TEXT",description:Ge,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:H[0]?.name||"id",access_type:"READ_ONLY",fields:H}}},[t,B]),P=useMemo(()=>W&&c?Re(W):W,[W,c]),G=useMemo(()=>P?.fields||[],[P]),mo=useMemo(()=>eo({onRowAction:c}),[c]),po=Pt({metadata:P,renderCell:mo,columnStrategies:ao}),{orderedColumns:co,columnsByFieldId:uo}=vt({columns:po,fields:P?.fields,preferredFieldOrder:no}),{initialState:fo,handleColumnVisibilityModelChange:Co}=Mt({fields:P?.fields,columnsByFieldId:uo,defaultVisibleFieldNames:io,columnVisibilityStorageKey:`${le}:columns`,onColumnVisibilityModelChange:lo}),go=useCallback(_=>{if(!a)return;let H=_.id?.toString()||"";a(H,_.row);},[a]),V=b("down","md"),[yo,se]=useState(null),{filter:So,setFilter:U}=Ut(le,E,b$1),{sort:bo,setSort:we}=Ht(le,x,R),ho=E??So,me=x??bo,{sortModel:Fo,handleSortModelChange:Io}=zt({sort:me,onSortChange:we,fields:G}),{conditions:To,isOpen:Ro,openDrawer:de,closeDrawer:Le,addCondition:Do,updateCondition:xo,removeCondition:_o,clearAllFilters:Pe,applyFilters:Oe,cancelChanges:ke,hasActiveFilters:No,activeFiltersCount:Ao}=kt({fields:G,initialFilter:ho}),Eo=useCallback(()=>{let _=Oe();U(_);},[Oe,U]),vo=useCallback(()=>{Pe(),U(void 0);},[Pe,U]),Mo=useCallback(_=>{V?de():(de(),se(_.currentTarget));},[V,de]),wo=useCallback(()=>{ke(),se(null);},[ke]),[Lo,Be]=useState(!1),Po=useCallback(()=>{se(null),Le();},[Le]),We=!!A?.length;return jsxs(Fragment,{children:[jsx(d$1,{title:e,columns:co,rows:B,mobileRender:ae,rowCount:so,loading:r||!t,fetching:n,searchValue:m,onSearch:p,onSearchChange:s,paginationModel:{page:i,pageSize:l},onPaginationChange:f,actions:u,moreActions:L,onAdd:d,onRowDoubleClick:a?go:void 0,bulkActions:A,checkboxSelection:We,rowSelectionModel:re,onRowSelectionModelChange:ie,keepNonExistentRowsSelected:We,disableRowSelectionOnClick:!0,slots:ne,initialState:fo,showColumnButton:S,containerProps:{height:C,maxHeight:C},onColumnVisibilityModelChange:Co,filterButton:jsx(Je,{showFilterButton:F,isMobile:V,hasActiveFilters:No,activeFiltersCount:Ao,sort:me,onFilterClick:Mo,onSortClick:()=>Be(!0)}),sortingMode:"server",sortModel:Fo,onSortModelChange:Io,disableColumnFilter:!0}),t&&jsxs(Fragment,{children:[jsx(Ct,{showFilterButton:F,isOpen:Ro,filterAnchorEl:yo,fields:G,conditions:To,isMobile:V,onClose:Po,onAddCondition:Do,onUpdateCondition:xo,onRemoveCondition:_o,onApply:Eo,onClear:vo,onCancel:wo}),jsx(Et,{open:Lo,onClose:()=>Be(!1),fields:G,sort:me,onSortChange:we})]})]})},xi=memo(Di,Wo);var _i=({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
|
+
var Ho=({showFilterButton:e$1,isMobile:t,hasActiveFilters:o,activeFiltersCount:r,sort:n,onFilterClick:i,onSortClick:a$1})=>e$1?t?jsxs(Nt,{direction:"row",spacing:.5,children:[jsx(Qe,{badgeContent:r,color:"primary",invisible:r===0,sx:{"& .MuiBadge-badge":{transform:"scale(0.9) translate(10px, 9px)",opacity:r===0?0:1}},children:jsx(je,{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(je,{color:n?"primary":"default",onClick:a$1,size:"small","aria-label":"Ordenar",children:jsx(a,{icon:n?.sortType==="DESC"?"SORTING_DESC":"SORTING_ASC"})})]}):jsx(Qe,{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(Fe,{variant:"text",color:o?"primary":"inherit",startIcon:jsx(a,{icon:"FILTER_VERTICAL"}),onClick:i,size:"small",children:"Filtrar"})}):null,Je=memo(Ho,Go);var Ze=e=>e.filter(t=>t.available_filter_conditions&&t.available_filter_conditions.length>0&&t.name!=="ACTIONS");var et=e=>{let{type:t,available_filter_conditions:o}=e;return o.length===0?"EQUALS":t==="TEXT"&&o.includes("LIKE")?"LIKE":o[0]},Y=e=>e.value.length>0||e.conditional==="IS_NULL"||e.conditional==="IS_NOT_NULL",tt=e=>{if(e.length===0)return;let t=e.filter(Y);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 ot={["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 Xo=({value:e,onChange:t,totalConditions:o,isFirst:r})=>o===1?null:r?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($,{value:"AND",children:"e"}),jsx($,{value:"OR",children:"ou"})]}),it=memo(Xo,Go);var O={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},or=({condition:e,fields:t,onChange:o,onRemove:r,totalConditions:n,isFirst:i})=>{let a$1=useMemo(()=>t.find(l=>(l.filter_field_name??l.name)===e.fieldName),[t,e.fieldName]),m=useMemo(()=>a$1?.available_filter_conditions||[],[a$1]),s=useMemo(()=>!e.fieldName||e.conditional==="IS_NULL"||e.conditional==="IS_NOT_NULL",[e.fieldName,e.conditional]),p=useCallback(l=>{let u=t.find(A=>(A.filter_field_name??A.name)===l);if(!u)return;let L=u.available_filter_conditions[0]||"EQUALS";o({...e,fieldName:l,conditional:L,value:[]});},[t,e,o]),f=useCallback(l=>{o({...e,conditional:l});},[e,o]),d=useCallback(l=>{o({...e,value:l?[l]:[]});},[e,o]),c=useCallback(l=>{o({...e,operator:l});},[e,o]);return jsxs(Nt,{direction:"row",spacing:1,alignItems:"center",children:[jsx(je,{onClick:r,size:"small","aria-label":"Remover filtro",sx:{flexShrink:0},children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:18})}),jsx(it,{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:l=>p(l.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:t.map(l=>jsx($,{value:l.filter_field_name??l.name,sx:O,title:l.description||l.name,children:l.description||l.name},l.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:l=>f(l.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:m.map(l=>jsx($,{value:l,sx:O,children:ot[l]||l},l))})]}),a$1?.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:l=>d(l.target.value),size:"small",sx:{"& .MuiSelect-select":O},children:[jsx($,{value:"true",children:"Verdadeiro"}),jsx($,{value:"false",children:"Falso"})]})]}):jsx(tr,{label:"Filtro",value:e.value[0]||"",onChange:l=>d(l.target.value),size:"small",disabled:s,InputLabelProps:{shrink:!0},sx:{flex:1,minWidth:120}})]})},nt=memo(or,Go);var ar=({filterableFields:e,conditions:t,onUpdateCondition:o,onRemoveCondition:r})=>{let n=useCallback(s=>{o(s.id,s);},[o]),i=useCallback(s=>()=>{r(s);},[r]),a=useMemo(()=>t.map(s=>s.fieldName).filter(s=>!!s),[t]),m=useCallback(s=>e.filter(p=>!a.includes(p.name)||p.name===s),[e,a]);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,p)=>jsx(nt,{condition:s,fields:m(s.fieldName),onChange:n,onRemove:i(s.id),showOperator:p>0,totalConditions:t.length,isFirst:p===0},s.id))})},at=memo(ar,Go);var lt=styled(X)({display:"flex",flexDirection:"column",height:"100%"}),st=styled(X)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2,3)})),mt=styled(X)(({theme:e})=>({flex:1,overflowY:"auto",padding:e.spacing(3),display:"flex",flexDirection:"column",gap:e.spacing(2)})),dt=styled(X)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(2)}));var fr=({onClose:e,fields:t,conditions:o,onAddCondition:r,onUpdateCondition:n,onRemoveCondition:i,onApply:a$1,onClear:m,onCancel:s})=>{let p=Ze(t),f=o.length>0,d=useCallback(()=>{a$1(),e();},[a$1,e]),c=useCallback(()=>{m(),e();},[m,e]),l=useCallback(()=>{s();},[s]);return jsxs(lt,{children:[jsxs(st,{children:[jsx(Se,{variant:"overline",fontWeight:600,color:"text.secondary",children:"Defina as condi\xE7\xF5es para filtrar"}),jsx(je,{onClick:r,size:"small","aria-label":"Adicionar filtro",title:"Adicionar filtro",disabled:o.length>=p.length,children:jsx(a,{icon:"SIMPLE_ADD"})})]}),jsx(pt,{}),jsx(mt,{children:jsx(at,{filterableFields:p,conditions:o,onUpdateCondition:n,onRemoveCondition:i})}),jsx(pt,{}),jsxs(dt,{children:[jsx(Fe,{variant:"text",color:"inherit",onClick:c,children:"Limpar"}),jsxs(Nt,{direction:"row",spacing:1,children:[jsx(Fe,{variant:"outlined",color:"inherit",onClick:l,startIcon:jsx(a,{icon:"CANCEL_CIRCLE"}),children:"Cancelar"}),jsx(Fe,{variant:"contained",onClick:d,disabled:!f,startIcon:jsx(a,{icon:"SIMPLE_CHECK"}),children:"Aplicar"})]})]})]})},ct=memo(fr,Go);var yr=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(ct,{...e})}),ft=memo(yr,Go);var Fr=({showFilterButton:e,isOpen:t,filterAnchorEl:o,fields:r,conditions:n,isMobile:i,onClose:a,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:p,onApply:f,onClear:d,onCancel:c})=>e?jsx(ft,{open:t||!!o,anchorEl:o,onClose:a,fields:r,conditions:n,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:p,onApply:f,onClear:d,onCancel:c,isMobileProp:i}):null,Ct=memo(Fr,Go);var gt=styled(Tr)(()=>({"& .MuiDialog-paper":{width:"100%"}})),yt=styled(xr)(({theme:e})=>({borderBottom:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),St=styled(Dr)(({theme:e})=>({padding:e.spacing(2)})),bt=styled(Rr)(({theme:e})=>({borderTop:"1px solid",borderColor:e.palette.divider,padding:e.spacing(1.5,2)})),Ft=styled(Fe)(({theme:e})=>({minWidth:24,[e.breakpoints.down(330)]:{padding:e.spacing(1)}})),he=styled(Se)(({theme:e})=>({fontWeight:"600",margin:e.spacing(0,1),[e.breakpoints.down(330)]:{fontSize:0,margin:0}}));var At=({open:e,onClose:t,fields:o,sort:r,onSortChange:n})=>{let[i,a$1]=useState(r?.fieldName||""),[m,s]=useState(r?.sortType||"ASC"),p=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]),d=f?.type==="DECIMAL"||f?.type==="INTEGER";useEffect(()=>{e&&(a$1(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]),l=useCallback(()=>{n&&(a$1(""),s("ASC"),n(void 0),t());},[n,t]);return jsxs(gt,{open:e,onClose:t,maxWidth:"xs",fullWidth:!0,children:[jsx(yt,{children:jsx(Se,{variant:"overline",color:"text.secondary",children:"Ordenar por"})}),jsx(St,{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:i,label:"Campo",onChange:u=>a$1(u.target.value),children:[jsx($,{value:"",children:jsx("em",{children:"Nenhum"})}),p.map(u=>jsx($,{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($,{value:"ASC",children:["Crescente ",d?"(1-9)":"(A-Z)"]}),jsxs($,{value:"DESC",children:["Decrescente ",d?"(9-1)":"(Z-A)"]})]})]})]})}),jsxs(bt,{children:[jsx(Nt,{flex:1,width:"100%",direction:"row",children:jsx(Fe,{color:"inherit",onClick:l,children:"Limpar"})}),jsxs(Fe,{onClick:t,variant:"outlined",color:"inherit",sx:{minWidth:24},children:[jsx(a,{icon:"CANCEL_CIRCLE"}),jsx(he,{children:"Cancelar"})]}),jsxs(Ft,{onClick:c,variant:"contained",children:[jsx(a,{icon:"SIMPLE_CHECK"}),jsx(he,{children:"Aplicar"})]})]})]})};At.displayName="SortModal";var Et=memo(At);var vt=({columns:e,fields:t,preferredFieldOrder:o})=>{let r=useMemo(()=>new Map(e.map(a=>[a.field,a])),[e]),n=useMemo(()=>new Map(t?.map(a=>[a.name,a])||[]),[t]);return {orderedColumns:useMemo(()=>{if(!o||o.length===0||!t)return e;let a="ACTIONS",m=o.filter(d=>d!==a),s=new Set,p=[],f=d=>{let c=n.get(d);if(!c)return;let l=r.get(c.name);!l||s.has(c.name)||(p.push(l),s.add(c.name));};return m.forEach(d=>{f(d);}),t.forEach(d=>{if(d.name===a||m.includes(d.name))return;let c=r.get(d.name);!c||s.has(d.name)||(p.push(c),s.add(d.name));}),f(a),p.length===0?e:p},[e,r,n,o,t]),columnsByFieldId:r,fieldsByName:n}};function wr(e){return e.name}var Mt=({fields:e,columnsByFieldId:t,defaultVisibleFieldNames:o,columnVisibilityStorageKey:r,onColumnVisibilityModelChange:n})=>{let i=!!r,[a,m]=a$4(r||"__dynamic-data-view:columns__",void 0,{initializeWithValue:i}),s=useMemo(()=>{if(!e)return;let f={};if(e.forEach(d=>{let c=wr(d);if(!t.has(c))return;let l;if(i&&a){let u=a[c];typeof u=="boolean"&&(l=u);}l===void 0&&o&&o.length>0&&(l=o.includes(d.name)),typeof l=="boolean"&&(f[c]=l);}),Object.keys(f).length!==0)return {columns:{columnVisibilityModel:f}}},[t,o,e,i,a]),p=useCallback(f=>{if(i){let d={...f};delete d.__check__,m(d);}n&&n(f);},[i,n,m]);return {initialState:s,handleColumnVisibilityModelChange:p}};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"},wt=["price","base_price","minimum_value","maximum_value","minimum_installment_value"];var Lr=(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)}),Pr=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.ID_MIN_WIDTH,flex:N.ID_FLEX,renderCell:o=>t(e,o.row)}),Or=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.ENTITY_MIN_WIDTH,flex:N.ENTITY_FLEX,renderCell:o=>t(e,o.row)}),kr=(e,t)=>({field:e.name,headerName:e.description,minWidth:N.MIN_WIDTH,renderCell:o=>t(e,o.row)}),Br=(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)}),Lt=(e,t)=>e.name===t?.id_field_name||e.name==="name"?Pr:e.name==="ACTIONS"?Br:e.type==="FILE"?Lr:e.type==="ENTITY"?Or:kr;var Pt=({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]??Lt(i,e))(i,t,e);r.set(i.name,m);}),Array.from(r.values())},[o,e,t]);var Ot=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})):[],kt=({fields:e,initialFilter:t})=>{let[o,r]=useState(!1),[n,i]=useState(()=>Ot(t)),[a,m]=useState(t),[s,p]=useState(()=>Ot(t)),f=useRef([]),d=useCallback(()=>{f.current=n.map(C=>({...C})),p(n.map(C=>({...C}))),r(!0);},[n]),c=()=>r(!1),l=useCallback(()=>{let C=e.filter(R=>R.available_filter_conditions?.length>0);if(C.length===0)return;let S=s.map(R=>R.fieldName),h=C.filter(R=>!S.includes(R.filter_field_name??R.name));if(h.length===0)return;let E=s.length>0?s[0].operator:"AND",b=h[0],x={id:a$5(),operator:E,fieldName:b.filter_field_name??b.name,conditional:et(b),value:[]};p(R=>[...R,x]);},[e,s]),u=useCallback((C,S)=>{p(h=>{let E=h.find(b=>b.id===C);if(!E)return h;if(S.operator&&S.operator!==E.operator){let b=S.operator;return h.map(x=>x.id===C?{...x,...S}:{...x,operator:b})}return h.map(b=>b.id===C?{...b,...S}:b)});},[]),L=useCallback(C=>{p(S=>S.filter(h=>h.id!==C));},[]),A=()=>{p([]),i([]),m(void 0);},re=()=>{let C=tt(s);return i(s.map(S=>({...S}))),m(C),r(!1),C},ie=()=>{p(f.current.map(C=>({...C}))),r(!1);},ne=n.some(Y),ae=n.filter(Y).length;return {conditions:s,filter:a,isOpen:o,hasActiveFilters:ne,activeFiltersCount:ae,openDrawer:d,closeDrawer:c,addCondition:l,updateCondition:u,removeCondition:L,clearAllFilters:A,applyFilters:re,cancelChanges:ie}};var Vt=e=>{try{let t=localStorage.getItem(e);return t?JSON.parse(t):void 0}catch{return}},Ut=(e,t)=>{try{t===void 0?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t));}catch{}},Ht=(e,t,o)=>{let r=`${e}:filter`,[n,i]=useState(()=>Vt(r)||t);useEffect(()=>{t!==void 0&&i(t);},[t]);let a=useCallback(m=>{i(m),Ut(r,m),o?.(m);},[r,o]);return {filter:n,setFilter:a}},zt=(e,t,o)=>{let r=`${e}:sort`,[n,i]=useState(()=>Vt(r)||t);useEffect(()=>{t!==void 0&&i(t);},[t]);let a=useCallback(m=>{i(m),Ut(r,m),o?.(m);},[r,o]);return {sort:n,setSort:a}};var Hr=(e,t)=>e?e.find(r=>r.name===t)?.filter_field_name??t:t,zr=(e,t)=>e?e.find(r=>r.filter_field_name===t||r.name===t)?.name??t:t,Yt=({sort:e,onSortChange:t,fields:o})=>{let r=useMemo(()=>e?[{field:zr(o,e.fieldName),sort:e.sortType.toLowerCase()}]:[],[e,o]),n=useCallback(i=>{if(!t)return;let a=i[0];if(!a||!a.sort){t(void 0);return}let m={fieldName:Hr(o,a.field),sortType:a.sort.toUpperCase()};t(m);},[t,o]);return {sortModel:r,handleSortModelChange:n}};var qt=()=>({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,qt()]};var qr=({value:e,format:t})=>e==null?"-":d(e,t),De=memo(qr);var Kr=({value:e,format:t})=>e==null?"-":c(e,t),xe=memo(Kr);var jr=({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(Qr,{label:String(o),variant:"outlined",size:"small",sx:{width:"fit-content",color:"text.secondary",borderColor:"divider",borderRadius:3}}):null},_e=memo(jr);var ei=({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}),ti=memo(ei);var Kt=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"})),Xt=styled(X,{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 ni=({imageResourceId:e,getImageUrl:t,size:o=48,alt:r="Imagem",onClick:n,sx:i})=>{let a$1=!!e,m=a$1&&t?t(e):void 0;return jsx(Xt,{size:o,noImage:!a$1,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"})})},ai=memo(ni);var si=({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})]})]}),mi=memo(si);var ui=({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(ui);var Ci=({active:e,activeLabel:t="Ativo",inactiveLabel:o="Inativo"})=>jsx(Kt,{isActive:e,children:e?t:o}),ve=memo(Ci);var Fi=e=>e.replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim(),hi=({value:e,showCopyButton:t=!1,copyMessage:o="Copiado",copyLabel:r,mask:n})=>{if(!e)return "-";let i=String(e),a=n?n(i):Fi(i);return t?jsxs(Nt,{direction:"row",gap:1,alignItems:"center",children:[jsx(Se,{variant:"body2",noWrap:!0,children:a}),jsx(a$2,{toCopy:i,message:o,label:r})]}):a},Me=memo(hi);function Ti(e){return wt.includes(e)}var to=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:Ti(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 xi=({title:e,metadata:t,data:o,isLoading:r,isFetching:n,page:i,perPage:a,searchValue:m,onSearchChange:s,onSearch:p,onPaginationChange:f,onAdd:d,onRowAction:c,onRowDoubleClick:l,actions:u,moreActions:L,bulkActions:A,rowSelectionModel:re,onRowSelectionModelChange:ie,slots:ne,mobileRender:ae,containerHeight:C=600,showColumnButton:S=!1,showFilterButton:h=!1,filter:E,onFilterChange:b$1,sort:x,onSortChange:R,defaultVisibleFieldNames:no,preferredFieldOrder:ao,columnStrategies:lo,onColumnVisibilityModelChange:so,storageKey:le})=>{let{items:B=[],total:mo=0}=o||{},W=useMemo(()=>{if(t)return t;if(B.length>0){let _=B[0],H=Object.keys(_).map(Ge=>({name:Ge,type:"TEXT",description:Ge,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:H[0]?.name||"id",access_type:"READ_ONLY",fields:H}}},[t,B]),P=useMemo(()=>W&&c?Re(W):W,[W,c]),G=useMemo(()=>P?.fields||[],[P]),po=useMemo(()=>to({onRowAction:c}),[c]),co=Pt({metadata:P,renderCell:po,columnStrategies:lo}),{orderedColumns:uo,columnsByFieldId:fo}=vt({columns:co,fields:P?.fields,preferredFieldOrder:ao}),{initialState:Co,handleColumnVisibilityModelChange:go}=Mt({fields:P?.fields,columnsByFieldId:fo,defaultVisibleFieldNames:no,columnVisibilityStorageKey:`${le}:columns`,onColumnVisibilityModelChange:so}),yo=useCallback(_=>{if(!l)return;let H=_.id?.toString()||"";l(H,_.row);},[l]),V=b("down","md"),[So,se]=useState(null),{filter:bo,setFilter:U}=Ht(le,E,b$1),{sort:Fo,setSort:we}=zt(le,x,R),ho=E??bo,me=x??Fo,{sortModel:Io,handleSortModelChange:To}=Yt({sort:me,onSortChange:we,fields:G}),{conditions:Ro,isOpen:Do,openDrawer:de,closeDrawer:Le,addCondition:xo,updateCondition:_o,removeCondition:No,clearAllFilters:Pe,applyFilters:Oe,cancelChanges:ke,hasActiveFilters:Ao,activeFiltersCount:Eo}=kt({fields:G,initialFilter:ho}),vo=useCallback(()=>{let _=Oe();U(_);},[Oe,U]),Mo=useCallback(()=>{Pe(),U(void 0);},[Pe,U]),wo=useCallback(_=>{V?de():(de(),se(_.currentTarget));},[V,de]),Lo=useCallback(()=>{ke(),se(null);},[ke]),[Po,Be]=useState(!1),Oo=useCallback(()=>{se(null),Le();},[Le]),We=!!A?.length;return jsxs(Fragment,{children:[jsx(d$1,{title:e,columns:uo,rows:B,mobileRender:ae,rowCount:mo,loading:r||!t,fetching:n,searchValue:m,onSearch:p,onSearchChange:s,paginationModel:{page:i,pageSize:a},onPaginationChange:f,actions:u,moreActions:L,onAdd:d,onRowDoubleClick:l?yo:void 0,bulkActions:A,checkboxSelection:We,rowSelectionModel:re,onRowSelectionModelChange:ie,keepNonExistentRowsSelected:We,disableRowSelectionOnClick:!0,slots:ne,initialState:Co,showColumnButton:S,containerProps:{height:C,maxHeight:C},onColumnVisibilityModelChange:go,filterButton:jsx(Je,{showFilterButton:h,isMobile:V,hasActiveFilters:Ao,activeFiltersCount:Eo,sort:me,onFilterClick:wo,onSortClick:()=>Be(!0)}),sortingMode:"server",sortModel:Io,onSortModelChange:To,disableColumnFilter:!0}),t&&jsxs(Fragment,{children:[jsx(Ct,{showFilterButton:h,isOpen:Do,filterAnchorEl:So,fields:G,conditions:Ro,isMobile:V,onClose:Oo,onAddCondition:xo,onUpdateCondition:_o,onRemoveCondition:No,onApply:vo,onClear:Mo,onCancel:Lo}),jsx(Et,{open:Po,onClose:()=>Be(!1),fields:G,sort:me,onSortChange:we})]})]})},_i=memo(xi,Go);var Ni=({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,a)=>{let m=o.indexOf(i),s=o.indexOf(a);return m-s||0}):n};
|
|
57
57
|
|
|
58
|
-
export { De as DateRenderer, xe as DateTimeRenderer, _e as EntityRenderer,
|
|
58
|
+
export { De as DateRenderer, xe as DateTimeRenderer, _e as EntityRenderer, ti as IconRenderer, ai as ImageRenderer, mi as NameRenderer, Ee as NumberRenderer, ve as StatusRenderer, Me as TextRenderer, Re as addActionsFieldToMetadata, Ni as buildVisibleFields, qt as createActionsField, _i as default };
|
|
59
59
|
//# sourceMappingURL=index.js.map
|