@zydon/common 2.9.1 → 2.9.3
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-I3HQNMR3.js +9 -0
- package/dist/chunk-I3HQNMR3.js.map +1 -0
- package/dist/{chunk-MJ5EROEP.js → chunk-PSG5JWK7.js} +2 -2
- package/dist/{chunk-6XOCS4DE.js → chunk-T3RP2QXG.js} +2 -2
- package/dist/chunk-T3RP2QXG.js.map +1 -0
- package/dist/{chunk-6ACD5WGD.js → chunk-ZLPEDESQ.js} +2 -2
- package/dist/components/Analytics/OverviewAnalytics/index.js +2 -2
- package/dist/components/Analytics/PartnerAnalysis/index.js +2 -2
- package/dist/components/DataGrid/index.js +1 -1
- package/dist/components/DataView/index.js +2 -2
- package/dist/components/DynamicDataView/index.js +2 -2
- package/dist/components/Incrementer/index.js +2 -2
- package/dist/components/NumberInput/index.js +1 -1
- package/dist/components/form/Incrementer/index.js +2 -2
- package/dist/components/form/NumberInput/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3D2PY6PO.js +0 -9
- package/dist/chunk-3D2PY6PO.js.map +0 -1
- package/dist/chunk-6XOCS4DE.js.map +0 -1
- /package/dist/{chunk-MJ5EROEP.js.map → chunk-PSG5JWK7.js.map} +0 -0
- /package/dist/{chunk-6ACD5WGD.js.map → chunk-ZLPEDESQ.js.map} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { memo, forwardRef, useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { NumericFormat } from 'react-number-format';
|
|
3
|
+
import Q from '@mui/material/TextField';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var s=memo(forwardRef(({decimalScale:c=0,fixedDecimalScale:d=!0,prefix:I,suffix:N,allowNegative:b,minValue:u,maxValue:a=1/0,maxLength:T,value:g,inputProps:h,InputProps:y,InputLabelProps:S,size:x,disabled:R,name:t,helperText:F,error:P,fullWidth:v,label:w,required:D,onChange:r,tabIndex:L,placeholder:k,margin:E,className:V,delay:l,id:i,inputRef:q},z)=>{let[C,H]=useState(Date.now()),e=useRef(null),p=()=>H(Date.now()),K=(M,o)=>{if(!r)return;e.current&&clearTimeout(e.current);let f=()=>{let{floatValue:n}=M,m=n||0;if(u!==void 0&&u>m){r({target:{name:t,value:u},event:o}),p();return}if(n!==void 0&&a<m){r({target:{name:t,value:a},event:o}),p();return}r({target:{name:t,value:n},event:o});};l===0?f():e.current=setTimeout(f,l||1e3);};return useEffect(()=>()=>{e.current&&clearTimeout(e.current);},[]),jsx(NumericFormat,{getInputRef:z,inputRef:q,value:g,prefix:I,suffix:N,decimalSeparator:",",thousandSeparator:".",decimalScale:c,fixedDecimalScale:d,autoComplete:"off",allowNegative:b,maxLength:T,onValueChange:K,customInput:Q,InputProps:{...y},inputProps:{...h,name:t,tabIndex:L,id:i},disabled:R,size:x,helperText:F,error:P,fullWidth:v,label:w,required:D,placeholder:k,margin:E,className:V,InputLabelProps:{...S,htmlFor:i}},C)}));s.displayName="NumberInput";var j=s;
|
|
7
|
+
|
|
8
|
+
export { j as a };
|
|
9
|
+
//# sourceMappingURL=chunk-I3HQNMR3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/NumberInput/index.tsx"],"names":["forwardRef","memo","useEffect","useRef","useState","NumericFormat","TextField","jsx","NumberInput","decimalScale","fixedDecimalScale","prefix","suffix","allowNegative","minValue","maxValue","maxLength","value","inputProps","InputProps","InputLabelProps","size","disabled","name","helperText","error","fullWidth","label","required","onChange","tabIndex","placeholder","margin","className","delay","id","inputRef","ref","inputkey","setInputKey","delayTimer","reRenderInput","handleChange","values","event","executeChange","floatValue","comparisonValue","NumberInput_default"],"mappings":"AAAA,OAAS,cAAAA,EAAY,QAAAC,EAAM,aAAAC,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QAC9D,OAEE,iBAAAC,MAEK,sBACP,OAAOC,MAAe,0BA4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AhC,EAAU,IACD,IAAM,CACPsC,EAAW,SACb,aAAaA,EAAW,OAAO,CAEnC,EACC,CAAC,CAAC,EAGHjC,EAACF,EAAA,CAEC,YAAagC,EACb,SAAUD,EACV,MAAOnB,EACP,OAAQN,EACR,OAAQC,EACR,iBAAiB,IACjB,kBAAkB,IAClB,aAAcH,EACd,kBAAmBC,EACnB,aAAa,MACb,cAAeG,EACf,UAAWG,EACX,cAAe0B,EACf,YAAapC,EACb,WAAY,CACV,GAAGa,CACL,EACA,WAAY,CAAE,GAAGD,EAAY,KAAAK,EAAM,SAAAO,EAAU,GAAAK,CAAG,EAChD,SAAUb,EACV,KAAMD,EACN,WAAYG,EACZ,MAAOC,EACP,UAAWC,EACX,MAAOC,EACP,SAAUC,EACV,YAAaG,EACb,OAAQC,EACR,UAAWC,EACX,gBAAiB,CAAE,GAAGb,EAAiB,QAASe,CAAG,GA7B9CG,CA8BP,CAEJ,CACF,CACF,EAEA9B,EAAY,YAAc,cAE1B,IAAOwC,EAAQxC","sourcesContent":["import { forwardRef, memo, useEffect, useRef, useState } from 'react';\nimport {\n NumberFormatValues,\n NumericFormat,\n SourceInfo,\n} from 'react-number-format';\nimport TextField from '@mui/material/TextField';\n\nimport { NumberInputProps } from 'types/numberInputProps';\n\nconst NumberInput = memo(\n forwardRef<HTMLDivElement, NumberInputProps>(\n (\n {\n decimalScale = 0,\n fixedDecimalScale = true,\n prefix,\n suffix,\n allowNegative,\n minValue,\n maxValue = Infinity,\n maxLength,\n value,\n inputProps,\n InputProps,\n InputLabelProps,\n size,\n disabled,\n name,\n helperText,\n error,\n fullWidth,\n label,\n required,\n onChange,\n tabIndex,\n placeholder,\n margin,\n className,\n delay,\n id,\n inputRef,\n },\n ref,\n ) => {\n const [inputkey, setInputKey] = useState(Date.now());\n const delayTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const reRenderInput = () => setInputKey(Date.now());\n\n const handleChange = (values: NumberFormatValues, event: SourceInfo) => {\n if (!onChange) return;\n\n if (delayTimer.current) clearTimeout(delayTimer.current);\n\n const executeChange = () => {\n const { floatValue } = values;\n const comparisonValue = floatValue || 0;\n\n if (minValue !== undefined && minValue > comparisonValue) {\n onChange({ target: { name, value: minValue }, event });\n reRenderInput();\n\n return;\n }\n\n if (floatValue !== undefined && maxValue < comparisonValue) {\n onChange({ target: { name, value: maxValue }, event });\n reRenderInput();\n\n return;\n }\n\n onChange({\n target: {\n name,\n value: floatValue,\n },\n event,\n });\n };\n\n if (delay === 0) {\n executeChange();\n } else {\n delayTimer.current = setTimeout(executeChange, delay || 1000);\n }\n };\n\n useEffect(() => {\n return () => {\n if (delayTimer.current) {\n clearTimeout(delayTimer.current);\n }\n };\n }, []);\n\n return (\n <NumericFormat\n key={inputkey}\n getInputRef={ref}\n inputRef={inputRef}\n value={value}\n prefix={prefix}\n suffix={suffix}\n decimalSeparator=\",\"\n thousandSeparator=\".\"\n decimalScale={decimalScale}\n fixedDecimalScale={fixedDecimalScale}\n autoComplete=\"off\"\n allowNegative={allowNegative}\n maxLength={maxLength}\n onValueChange={handleChange}\n customInput={TextField}\n InputProps={{\n ...InputProps,\n }}\n inputProps={{ ...inputProps, name, tabIndex, id }}\n disabled={disabled}\n size={size}\n helperText={helperText}\n error={error}\n fullWidth={fullWidth}\n label={label}\n required={required}\n placeholder={placeholder}\n margin={margin}\n className={className}\n InputLabelProps={{ ...InputLabelProps, htmlFor: id }}\n />\n );\n },\n ),\n);\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a } from './chunk-
|
|
1
|
+
import { a } from './chunk-I3HQNMR3.js';
|
|
2
2
|
import { f } from './chunk-OF6623HG.js';
|
|
3
3
|
import { a as a$1 } from './chunk-2GTD4JW2.js';
|
|
4
4
|
import { forwardRef, useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
@@ -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: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
10
|
|
|
11
11
|
export { F as a };
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-PSG5JWK7.js.map
|
|
@@ -6,7 +6,7 @@ import { GRID_CHECKBOX_SELECTION_COL_DEF, DataGridPremium, GridToolbarContainer,
|
|
|
6
6
|
import x from '@mui/material/Box';
|
|
7
7
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
|
-
var H=({showToolbar:i,disableExport:r,setFilterButtonEl:l,toolbarContent:n})=>{if(i)return jsxs(GridToolbarContainer,{children:[jsx(GridToolbarColumnsButton,{slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarFilterButton,{ref:l,slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarDensitySelector,{slotProps:{button:{color:"inherit"}}}),!r&&jsx(GridToolbarExport,{slotProps:{button:{color:"inherit"}}}),jsx(x,{sx:{flexGrow:1}}),n]})},m=H;var _=({columns:i,rows:r=[],loading:l,fetching:n,hideFooter:p,sx:u,showToolbar:d,disableExport:b,columnHeaderHeight:f=56,rowHeight:
|
|
9
|
+
var H=({showToolbar:i,disableExport:r,setFilterButtonEl:l,toolbarContent:n})=>{if(i)return jsxs(GridToolbarContainer,{children:[jsx(GridToolbarColumnsButton,{slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarFilterButton,{ref:l,slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarDensitySelector,{slotProps:{button:{color:"inherit"}}}),!r&&jsx(GridToolbarExport,{slotProps:{button:{color:"inherit"}}}),jsx(x,{sx:{flexGrow:1}}),n]})},m=H;var _=({columns:i,rows:r=[],loading:l,fetching:n,hideFooter:p,sx:u,showToolbar:d,disableExport:b,columnHeaderHeight:f=56,rowHeight:g=76,rowSpacingType:h="margin",getRowSpacing:C=()=>({top:0,bottom:0}),autoHeight:G=!1,toolbarContent:c,slots:P,...T})=>{let[w,E]=useState(null),S=[{...GRID_CHECKBOX_SELECTION_COL_DEF,width:71},...i];return jsxs(Fragment,{children:[n&&jsx(a,{sx:{zIndex:1}}),jsx(DataGridPremium,{columns:S,rows:r,loading:l,autoHeight:G,hideFooter:r.length===0?!0:p,rowHeight:g,columnHeaderHeight:f,getRowSpacing:C,rowSpacingType:h,disableAggregation:!0,disableRowGrouping:!0,slots:{toolbar:m,noRowsOverlay:()=>jsx(a$1,{title:"Nenhum registro encontrado"}),noResultsOverlay:()=>jsx(a$1,{title:"Nenhum registro encontrado"}),loadingOverlay:a$2,...P},slotProps:{panel:{anchorEl:w},toolbar:{setFilterButtonEl:E,showQuickFilter:!0,disableExport:b,showToolbar:d,toolbarContent:c}},sx:u,...T})]})},Z=_;
|
|
10
10
|
|
|
11
11
|
export { Z as a };
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-T3RP2QXG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DataGrid/index.tsx","../src/components/DataGrid/CustomToolbar/index.tsx"],"names":["useState","DataGridPremium","GRID_CHECKBOX_SELECTION_COL_DEF","Box","GridToolbarColumnsButton","GridToolbarContainer","GridToolbarDensitySelector","GridToolbarExport","GridToolbarFilterButton","jsx","jsxs","CustomToolbar","showToolbar","disableExport","setFilterButtonEl","toolbarContent","CustomToolbar_default","Fragment","DataGrid","columns","rows","loading","fetching","hideFooter","sx","columnHeaderHeight","rowHeight","rowSpacingType","getRowSpacing","autoHeight","slots","other","filterButtonEl","COLUMNS","FixedProgressBar_default","EmptyContent_default","LoadingOverlay_default","DataGrid_default"],"mappings":"mHAAA,OAAS,YAAAA,MAAgB,QACzB,OACE,mBAAAC,EACA,mCAAAC,MAGK,2BCLP,OAAOC,MAAS,oBAChB,OACE,4BAAAC,EACA,wBAAAC,EACA,8BAAAC,EACA,qBAAAC,EACA,2BAAAC,MACK,2BAaH,OAC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WAAYT,EAAK,SAAW,EAAI,GAAOG,EACvC,UAAWG,EACX,mBAAoBD,EACpB,cAAeG,EACf,eAAgBD,EAChB,mBAAkB,GAClB,mBAAkB,GAClB,MAAO,CACL,QAASX,EACT,cAAe,IACbP,EAAC0B,EAAA,CAAa,MAAM,6BAA6B,EAEnD,iBAAkB,IAChB1B,EAAC0B,EAAA,CAAa,MAAM,6BAA6B,EAEnD,eAAgBC,EAChB,GAAGN,CACL,EACA,UAAW,CACT,MAAO,CAAE,SAAUE,CAAe,EAClC,QAAS,CACP,kBAAAlB,EACA,gBAAiB,GACjB,cAAAD,EACA,YAAAD,EACA,eAAAG,CACF,CACF,EACA,GAAIS,EACH,GAAGO,EACN,GACF,CAEJ,EAEOM,EAAQnB","sourcesContent":["import { useState } from 'react';\nimport {\n DataGridPremium,\n GRID_CHECKBOX_SELECTION_COL_DEF,\n GridSlots,\n GridSlotsComponentsProps,\n} from '@mui/x-data-grid-premium';\n\nimport EmptyContent from 'components/EmptyContent';\nimport { DataGridProps } from 'types/dataGridProps';\n\nimport FixedProgressBar from '../FixedProgressBar';\n\nimport CustomToolbar from './CustomToolbar';\nimport LoadingOverlay from './LoadingOverlay';\n\nconst DataGrid = ({\n columns,\n rows = [],\n loading,\n fetching,\n hideFooter,\n sx,\n showToolbar,\n disableExport,\n columnHeaderHeight = 56,\n rowHeight = 76,\n rowSpacingType = 'margin',\n getRowSpacing = () => ({\n top: 0,\n bottom: 0,\n }),\n autoHeight = false,\n toolbarContent,\n slots,\n ...other\n}: DataGridProps) => {\n const [filterButtonEl, setFilterButtonEl] =\n useState<HTMLButtonElement | null>(null);\n\n const COLUMNS = [\n {\n ...GRID_CHECKBOX_SELECTION_COL_DEF,\n width: 71,\n },\n ...columns,\n ];\n\n return (\n <>\n {fetching && <FixedProgressBar sx={{ zIndex: 1 }} />}\n\n <DataGridPremium\n columns={COLUMNS}\n rows={rows}\n loading={loading}\n autoHeight={autoHeight}\n hideFooter={rows.length === 0 ? true : hideFooter}\n rowHeight={rowHeight}\n columnHeaderHeight={columnHeaderHeight}\n getRowSpacing={getRowSpacing}\n rowSpacingType={rowSpacingType}\n disableAggregation\n disableRowGrouping\n slots={{\n toolbar: CustomToolbar as unknown as GridSlots['toolbar'],\n noRowsOverlay: () => (\n <EmptyContent title=\"Nenhum registro encontrado\" />\n ),\n noResultsOverlay: () => (\n <EmptyContent title=\"Nenhum registro encontrado\" />\n ),\n loadingOverlay: LoadingOverlay,\n ...slots,\n }}\n slotProps={{\n panel: { anchorEl: filterButtonEl },\n toolbar: {\n setFilterButtonEl,\n showQuickFilter: true,\n disableExport,\n showToolbar,\n toolbarContent,\n } as unknown as GridSlotsComponentsProps['toolbar'],\n }}\n sx={sx}\n {...other}\n />\n </>\n );\n};\n\nexport default DataGrid;\n","import { PropsWithChildren } from 'react';\nimport Box from '@mui/material/Box';\nimport {\n GridToolbarColumnsButton,\n GridToolbarContainer,\n GridToolbarDensitySelector,\n GridToolbarExport,\n GridToolbarFilterButton,\n} from '@mui/x-data-grid-premium';\n\nimport { CustomToolbarProps } from './props';\n\nconst CustomToolbar = ({\n showToolbar,\n disableExport,\n setFilterButtonEl,\n toolbarContent,\n}: PropsWithChildren<CustomToolbarProps>) => {\n if (!showToolbar) return;\n\n return (\n <GridToolbarContainer>\n <GridToolbarColumnsButton slotProps={{ button: { color: 'inherit' } }} />\n <GridToolbarFilterButton\n ref={setFilterButtonEl}\n slotProps={{ button: { color: 'inherit' } }}\n />\n <GridToolbarDensitySelector\n slotProps={{ button: { color: 'inherit' } }}\n />\n {!disableExport && (\n <GridToolbarExport slotProps={{ button: { color: 'inherit' } }} />\n )}\n <Box sx={{ flexGrow: 1 }} />\n {toolbarContent}\n </GridToolbarContainer>\n );\n};\n\nexport default CustomToolbar;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as a$9 } from './chunk-R2BCPHRH.js';
|
|
2
2
|
import { a as a$6 } from './chunk-4F2NKGF6.js';
|
|
3
|
-
import { a as a$3 } from './chunk-
|
|
3
|
+
import { a as a$3 } from './chunk-T3RP2QXG.js';
|
|
4
4
|
import { a as a$7 } from './chunk-6U5LS7MP.js';
|
|
5
5
|
import { a as a$5 } from './chunk-PRWQQJDL.js';
|
|
6
6
|
import { i, r, k, n, l, a as a$2, p, j, m, b as b$1, c, d, q, h, f, e, o, g } from './chunk-XUDTPZHF.js';
|
|
@@ -24,4 +24,4 @@ import { GridToolbarColumnsButton } from '@mui/x-data-grid-premium';
|
|
|
24
24
|
var Fo=(o,e)=>typeof o=="function"?o(e):!!o,Ae=(o,e)=>{if(o)return o===!0?{}:typeof o=="function"?o(e):o},ke=({actions:o,context:e})=>{let[t,r]=useState(null),[a$1,i]=useState(null),l=useMemo(()=>o.filter(n=>!Fo(n.hidden,e)),[o,e]),s=useCallback(async n=>{i(n.actionId);try{await n.handler(e);}finally{i(null);}},[e]),d=useCallback(n=>{if(n.confirmation){r(n);return}s(n).catch(()=>{});},[s]),m$1=useCallback(async()=>{t&&(await s(t),r(null));},[t,s]),f=useCallback(()=>{a$1||r(null);},[a$1]),c=Ae(t?.confirmation,e);return jsxs(Fragment,{children:[jsx(m,{children:l.map(n=>{let h=!!a$1||Fo(n.disabled,e),k=a$1===n.actionId;return jsx(Ce,{size:"small",variant:"text",onClick:()=>d(n),loading:k,disabled:h,sx:{color:"text.primary"},startIcon:typeof n.icon=="string"?jsx(a,{icon:n.icon}):n.icon,children:n.label},n.actionId)})}),t&&jsx(a$5,{open:!0,onClose:f,onConfirm:()=>{m$1().catch(()=>{});},confirming:a$1===t.actionId,modalTitle:c?.title??`${t.action??"Excluir"} ${e.selectedCount} ${t.entityName??"registro"}${e.selectedCount!==1?"s":""}?`,message:c?.message??"Esta a\xE7\xE3o n\xE3o poder\xE1 ser desfeita.",cancelButtonText:c?.cancelButtonText??"Cancelar",confirmButtonText:c?.confirmButtonText??"Sim, excluir"})]})},zo=ke;var Re=({title:o,breakpoint:e,actions:t,showActions:r,showAdd:a$1,showHeaderMoreActions:i,showActionsContainer:l,onAdd:s,onOpenMoreActions:d$1})=>jsxs(b$1,{breakpoint:e,children:[jsx(Xo,{variant:"overline",color:"text.secondary",noWrap:!0,children:o}),l&&jsxs(c,{breakpoint:e,children:[r&&t,a$1&&jsxs(Fragment,{children:[r&&jsx(d,{orientation:"vertical",flexItem:!0}),jsx(_o,{startIcon:jsx(a,{icon:"SIMPLE_ADD"}),variant:"contained",onClick:s,children:"Adicionar"})]}),i&&jsxs(Fragment,{children:[(r||a$1)&&jsx(d,{orientation:"vertical",flexItem:!0}),jsx(_o,{color:"inherit",startIcon:jsx(a,{icon:"MORE_BOLD"}),size:"small",onClick:d$1,children:"Mais"})]})]})]}),$o=Re;var De=({fetching:o,loading:e,rows:t,mobileSlots:r$1,mobileSlotsProps:a,slots:i,scrollableNodeRef:l,mobileRender:s,hideFooter:d,onPaginationChange:m,rowCount:f,paginationModel:c})=>jsxs(a$6,{isFetching:o,fetching:jsx(a$7,{}),isLoading:e,loading:jsx(q,{}),isEmpty:t.length===0,empty:jsxs(to,{flex:1,direction:"column",...a,children:[r$1&&r$1,jsx(to,{flex:1,alignItems:"center",justifyContent:"center",children:i?.noRowsOverlay?jsx(i.noRowsOverlay,{}):jsx(Xo,{variant:"body2",color:"text.secondary",children:"Nenhum registro encontrado"})})]}),children:[jsxs(to,{direction:"column",flex:1,minHeight:0,...a,children:[r$1&&r$1,jsx(a$8,{fillContent:!0,ref:l,children:t.map(n=>jsx(Fragment$1,{children:s(n)},n.id))})]}),!d&&m&&jsx(h,{children:jsx(r,{count:f,page:c.page,rowsPerPage:c.pageSize,onPageChange:n=>m?.(n,c.pageSize),onRowsPerPageChange:n=>m?.(0,n)})})]}),qo=De;var z="datagrid-actions";var Ko=(o,e)=>Children.map(o,t=>{if(!isValidElement(t))return t;let r=t.props.onClick,a={};a.onClick=(...l)=>{e(),r&&r(...l);};let i=t.props;return i?.children&&(a.children=Ko(i.children,e)),cloneElement(t,a)}),ve=({children:o,onClose:e})=>o?Ko(o,e):null,ro=memo(ve);var Ve=({breakpoint:o$1,isMobile:e$1,showSearch:t,showMoreActions:r,showTopbarMoreActions:a$1,showHeaderMoreActions:i,filterButton:l,searchValue:s,onSearch:d,onSearchChange:m,moreActions:f$1,popover:c})=>jsxs(f,{breakpoint:o$1,children:[jsxs(to,{flex:1,direction:"row",alignItems:"center",id:z,gap:.5,children:[r&&jsxs(Fragment,{children:[a$1&&jsxs(Fragment,{children:[jsx(_o,{color:"inherit",startIcon:jsx(a,{icon:"MORE_BOLD"}),size:"small",onClick:c.onOpen,children:"Mais"}),!e$1&&jsx(e,{orientation:"vertical",flexItem:!0})]}),(a$1||i)&&jsx(o,{open:c.open,anchorEl:c.open,onClose:c.onClose,disabledArrow:!0,children:jsx(ro,{onClose:c.onClose,children:f$1})})]}),!e$1&&l&&jsxs(Fragment,{children:[l,a$1&&jsx(e,{orientation:"vertical",flexItem:!0})]})]}),t&&jsxs(g,{breakpoint:o$1,children:[jsx(a$9,{value:s,placeholder:"Buscar",onSearch:n=>d(n??""),onChange:n=>m?.(n.target.value),size:"small",fullWidth:!0,iconPosition:"start"}),e$1&&l&&jsx(to,{ml:1,children:l})]})]}),Jo=Ve;var Oe=({rowCount:o,page:e,rowsPerPage:t,onPaginationChange:r$1})=>jsxs(i,{children:[jsxs(to,{direction:"row",alignItems:"center",gap:.5,children:[jsx(Xo,{variant:"body2",color:"text.disabled",children:"Total de itens:"}),jsx(Xo,{variant:"body2",children:o})]}),jsx(r,{count:o,page:e,rowsPerPage:t,onPageChange:a=>r$1(a,t),onRowsPerPageChange:a=>r$1(0,a)})]}),lo=memo(Oe);var ze=forwardRef(({children:o,...e},t)=>jsx(_o,{...e,ref:t,color:"inherit",startIcon:jsx(a,{icon:"COLUMNS"}),children:o??"Colunas"}));ze.displayName="ColumnsButton";var _e=({setFilterButtonEl:o})=>{let e=useCallback(t=>{o(t);},[o]);return jsx(a$4,{container:z,children:jsx(GridToolbarColumnsButton,{ref:e,slotProps:{button:{color:"inherit",startIcon:jsx(a,{icon:"COLUMNS"}),children:"Colunas"}}})})},so=_e;var qe=({slots:o,showColumnButton:e,rowCount:t,paginationModel:r,onPaginationChange:a})=>{let i=useCallback(()=>a?jsx(lo,{rowCount:t,page:r.page,rowsPerPage:r.pageSize,onPaginationChange:a}):null,[t,r,a]);return {dataGridSlots:useMemo(()=>({...o,footer:i,...e&&!o?.toolbar&&{toolbar:so}}),[o,i,e])}},Zo=qe;var Qe=({rows:o,rowSelectionModel:e,onRowSelectionModelChange:t,getRowId:r,bulkActions:a})=>{let i=useMemo(()=>Array.isArray(e)?e:[],[e]),l=i.length,s=useMemo(()=>o.map(S=>r(S)),[o,r]),d=useMemo(()=>new Set(s),[s]),m=useMemo(()=>i.reduce((S,C)=>S+(d.has(C)?1:0),0),[i,d]),f=s.length>0&&m===s.length,c=m>0&&!f,n=useCallback(S=>{t&&t(S);},[t]),h=useCallback(()=>{n([]);},[n]),k=useMemo(()=>new Set(i),[i]),I=useMemo(()=>o.filter(S=>k.has(r(S))),[o,k,r]),_=useMemo(()=>({selectedIds:i,selectedRowsInPage:I,selectedCount:l,clearSelection:h}),[i,I,l,h]),W=!!a?.length,v=useCallback((S,C)=>{if(!t)return;if(C){let M=new Set(i),V=[...i];s.forEach(x=>{M.has(x)||V.push(x);}),n(V);return}let G=i.filter(M=>!d.has(M));n(G);},[t,i,s,d,n]);return {selectionModel:i,numSelected:l,allSelected:f,someSelected:c,hasBulkActions:W,bulkActionContext:_,clearSelection:h,handleSelectAllToggle:v}},jo=Qe;var nt=({title:o,header:e,headerProps:t,breakpoint:r="md",columns:a$4,rows:i=[],mobileSlots:l$1,mobileSlotsProps:s,mobileRender:d,rowCount:m=0,paginationModel:f={page:0,pageSize:25},onPaginationChange:c,actions:n$1,moreActions:h,onAdd:k$1,onSearch:I,searchValue:_,onSearchChange:W,slots:v,slotProps:S,loading:C,fetching:G,fetchingNextPage:M,containerProps:V={height:562,maxHeight:562},hideFooter:x,showColumnButton:mo=!1,filterButton:po,activeFilters:uo,bulkActions:fo,onRowsScrollEnd:E,scrollEndThreshold:$=200,...R})=>{let So=a$1(),T=b("down",r),[te,ne]=useState(null),go=useRef(null);useEffect(()=>{let P=go.current;if(!P||!T||!E)return;let wo=()=>{let{scrollTop:fe,scrollHeight:Se,clientHeight:ge}=P;Se-fe-ge<=$&&E();};return P.addEventListener("scroll",wo,{passive:!0}),()=>{P.removeEventListener("scroll",wo);}},[T,E,$,i.length]);let re=useMemo(()=>R.getRowId??(P=>P.id),[R.getRowId]),{numSelected:q,allSelected:ie,someSelected:ae,hasBulkActions:le,bulkActionContext:se,clearSelection:ce,handleSelectAllToggle:de}=jo({rows:i,rowSelectionModel:Array.isArray(R.rowSelectionModel)?R.rowSelectionModel:void 0,onRowSelectionModelChange:R.onRowSelectionModelChange,getRowId:re,bulkActions:fo}),{dataGridSlots:me}=Zo({slots:v,showColumnButton:mo,rowCount:m,paginationModel:f,onPaginationChange:c}),ho=!!I,Co=!!k$1,Ao=!!n$1,K=!!h,Q=T&&K,ko=!T&&K,pe=Ao||Co||Q,To=ko||ho||mo||!!po||!T,ue=le&&q>0&&jsxs(k,{children:[jsxs(to,{flexDirection:"row",alignItems:"center",gap:1,flex:1,children:[jsx(ee,{title:"Selecione todos nessa pagina",children:jsx(n,{size:"small",checked:ie,indeterminate:ae,onChange:de})}),jsxs(l,{variant:"body2",children:[q," selecionado",q>1?"s":""]}),jsx(ee,{title:"Desselecionar tudo",children:jsx(et,{size:"small",onClick:ce,"aria-label":"Desselecionar tudo",sx:{color:"primary.main"},children:jsx(a,{icon:"CLOSE_MARK_BUTTON",width:18,height:18})})})]}),jsx(zo,{actions:fo??[],context:se})]});return jsxs(a$2,{breakpoint:r,...V,flex:C?1:void 0,minHeight:C||i.length===0?562:void 0,children:[e?jsx(to,{p:3,...t,children:e}):jsxs(Fragment,{children:[jsx($o,{title:o,breakpoint:r,actions:n$1,showActions:Ao,showAdd:Co,showHeaderMoreActions:Q,showActionsContainer:pe,onAdd:k$1,onOpenMoreActions:So.onOpen}),To&&jsx(Jo,{breakpoint:r,isMobile:T,showSearch:ho,showMoreActions:K,showTopbarMoreActions:ko,showHeaderMoreActions:Q,filterButton:po,searchValue:_,onSearch:I,onSearchChange:W,moreActions:h,popover:So}),uo&&uo,!To&&jsx(p,{})]}),T?jsx(qo,{fetching:G,loading:C,rows:i,mobileSlots:l$1,mobileSlotsProps:s,slots:v,scrollableNodeRef:go,mobileRender:d,hideFooter:x,onPaginationChange:c,rowCount:m,paginationModel:f}):jsxs(j,{children:[ue,jsx(a$3,{columns:a$4,rows:i,slots:me,slotProps:{panel:{anchorEl:te},toolbar:{setFilterButtonEl:ne,showQuickFilter:!0},...S},columnHeaderHeight:48,getRowHeight:()=>68,loading:C,fetching:G,hideFooter:x,onRowsScrollEnd:E,scrollEndThreshold:$,...R})]}),M&&jsx(tt,{})]})},yn=memo(nt,ot);
|
|
25
25
|
|
|
26
26
|
export { ro as a, lo as b, so as c, yn as d };
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-ZLPEDESQ.js.map
|
|
@@ -7,10 +7,10 @@ import { a as a$4 } from '../../../chunk-J5B2YJSR.js';
|
|
|
7
7
|
import { d as d$2 } from '../../../chunk-A7QSCOUE.js';
|
|
8
8
|
import { h, d as d$1, c as c$2 } from '../../../chunk-OF6623HG.js';
|
|
9
9
|
import { a as a$3 } from '../../../chunk-CBW32OUQ.js';
|
|
10
|
-
import { d } from '../../../chunk-
|
|
10
|
+
import { d } from '../../../chunk-ZLPEDESQ.js';
|
|
11
11
|
import { a as a$2 } from '../../../chunk-R2BCPHRH.js';
|
|
12
12
|
import { a as a$1 } from '../../../chunk-4F2NKGF6.js';
|
|
13
|
-
import '../../../chunk-
|
|
13
|
+
import '../../../chunk-T3RP2QXG.js';
|
|
14
14
|
import '../../../chunk-LZQ7OFKO.js';
|
|
15
15
|
import '../../../chunk-NIQW2J3M.js';
|
|
16
16
|
import '../../../chunk-6U5LS7MP.js';
|
|
@@ -6,10 +6,10 @@ import { a as a$4 } from '../../../chunk-J5B2YJSR.js';
|
|
|
6
6
|
import { d as d$2 } from '../../../chunk-A7QSCOUE.js';
|
|
7
7
|
import { h, d, a as a$6, c as c$1 } from '../../../chunk-OF6623HG.js';
|
|
8
8
|
import { a as a$3 } from '../../../chunk-CBW32OUQ.js';
|
|
9
|
-
import { d as d$1 } from '../../../chunk-
|
|
9
|
+
import { d as d$1 } from '../../../chunk-ZLPEDESQ.js';
|
|
10
10
|
import { a as a$2 } from '../../../chunk-R2BCPHRH.js';
|
|
11
11
|
import { a as a$1 } from '../../../chunk-4F2NKGF6.js';
|
|
12
|
-
import '../../../chunk-
|
|
12
|
+
import '../../../chunk-T3RP2QXG.js';
|
|
13
13
|
import '../../../chunk-LZQ7OFKO.js';
|
|
14
14
|
import '../../../chunk-NIQW2J3M.js';
|
|
15
15
|
import '../../../chunk-6U5LS7MP.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { b as DesktopFooter, a as EnhancedMoreActions, c as Toolbar, d as default } from '../../chunk-
|
|
1
|
+
export { b as DesktopFooter, a as EnhancedMoreActions, c as Toolbar, d as default } from '../../chunk-ZLPEDESQ.js';
|
|
2
2
|
import '../../chunk-R2BCPHRH.js';
|
|
3
3
|
import '../../chunk-4F2NKGF6.js';
|
|
4
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-T3RP2QXG.js';
|
|
5
5
|
import '../../chunk-LZQ7OFKO.js';
|
|
6
6
|
import '../../chunk-NIQW2J3M.js';
|
|
7
7
|
import '../../chunk-6U5LS7MP.js';
|
|
@@ -3,10 +3,10 @@ export { a as FilterOperator, b as SortType } from '../../chunk-P64QBDAO.js';
|
|
|
3
3
|
import { d, c } from '../../chunk-A7QSCOUE.js';
|
|
4
4
|
import { a as a$4 } from '../../chunk-WLRSUL67.js';
|
|
5
5
|
import { h, a as a$6 } from '../../chunk-OF6623HG.js';
|
|
6
|
-
import { d as d$1 } from '../../chunk-
|
|
6
|
+
import { d as d$1 } from '../../chunk-ZLPEDESQ.js';
|
|
7
7
|
import '../../chunk-R2BCPHRH.js';
|
|
8
8
|
import '../../chunk-4F2NKGF6.js';
|
|
9
|
-
import '../../chunk-
|
|
9
|
+
import '../../chunk-T3RP2QXG.js';
|
|
10
10
|
import '../../chunk-LZQ7OFKO.js';
|
|
11
11
|
import '../../chunk-NIQW2J3M.js';
|
|
12
12
|
import '../../chunk-6U5LS7MP.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-PSG5JWK7.js';
|
|
2
|
+
import '../../chunk-I3HQNMR3.js';
|
|
3
3
|
import '../../chunk-OF6623HG.js';
|
|
4
4
|
import '../../chunk-2GTD4JW2.js';
|
|
5
5
|
import '../../chunk-PBLSVXV5.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-I3HQNMR3.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
import { a } from '../../../chunk-PSG5JWK7.js';
|
|
2
|
+
import '../../../chunk-I3HQNMR3.js';
|
|
3
3
|
import '../../../chunk-OF6623HG.js';
|
|
4
4
|
import '../../../chunk-2GTD4JW2.js';
|
|
5
5
|
import '../../../chunk-PBLSVXV5.js';
|
package/package.json
CHANGED
package/dist/chunk-3D2PY6PO.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { memo, forwardRef, useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { NumericFormat } from 'react-number-format';
|
|
3
|
-
import Q from '@mui/material/TextField';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
var s=memo(forwardRef(({decimalScale:c=0,fixedDecimalScale:d=!0,prefix:I,suffix:N,allowNegative:b,minValue:u,maxValue:n=1/0,maxLength:T,value:g,inputProps:h,InputProps:y,InputLabelProps:S,size:x,disabled:F,name:t,helperText:P,error:R,fullWidth:v,label:w,required:D,onChange:r,tabIndex:L,placeholder:k,margin:E,className:V,delay:l,id:i,inputRef:q},z)=>{let[C,H]=useState(Date.now()),e=useRef(null),p=()=>H(Date.now()),K=(M,o)=>{if(!r)return;e.current&&clearTimeout(e.current);let f=()=>{let{floatValue:a}=M,m=a||0;if(u!==void 0&&u>m){r({target:{name:t,value:u},event:o}),p();return}if(a!==void 0&&n<m){r({target:{name:t,value:n},event:o}),p();return}r({target:{name:t,value:a},event:o});};l===0?f():e.current=setTimeout(f,l||1e3);};return useEffect(()=>()=>{e.current&&clearTimeout(e.current);},[]),jsx(NumericFormat,{getInputRef:q??z,value:g,prefix:I,suffix:N,decimalSeparator:",",thousandSeparator:".",decimalScale:c,fixedDecimalScale:d,autoComplete:"off",allowNegative:b,maxLength:T,onValueChange:K,customInput:Q,InputProps:{...y},inputProps:{...h,name:t,tabIndex:L,id:i},disabled:F,size:x,helperText:P,error:R,fullWidth:v,label:w,required:D,placeholder:k,margin:E,className:V,InputLabelProps:{...S,htmlFor:i}},C)}));s.displayName="NumberInput";var j=s;
|
|
7
|
-
|
|
8
|
-
export { j as a };
|
|
9
|
-
//# sourceMappingURL=chunk-3D2PY6PO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/NumberInput/index.tsx"],"names":["forwardRef","memo","useEffect","useRef","useState","NumericFormat","TextField","jsx","NumberInput","decimalScale","fixedDecimalScale","prefix","suffix","allowNegative","minValue","maxValue","maxLength","value","inputProps","InputProps","InputLabelProps","size","disabled","name","helperText","error","fullWidth","label","required","onChange","tabIndex","placeholder","margin","className","delay","id","inputRef","ref","inputkey","setInputKey","delayTimer","reRenderInput","handleChange","values","event","executeChange","floatValue","comparisonValue","NumberInput_default"],"mappings":"AAAA,OAAS,c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CACT,EACA,MAAAF,CACF,CAAC,CACH,EAEIV,IAAU,EACZW,EAAc,EAEdL,EAAW,QAAU,WAAWK,EAAeX,GAAS,GAAI,CAEhE,EAEA,OAAAhC,EAAU,IACD,IAAM,CACPsC,EAAW,SACb,aAAaA,EAAW,OAAO,CAEnC,EACC,CAAC,CAAC,EAGHjC,EAACF,EAAA,CAEC,YAAa+B,GAAYC,EACzB,MAAOpB,EACP,OAAQN,EACR,OAAQC,EACR,iBAAiB,IACjB,kBAAkB,IAClB,aAAcH,EACd,kBAAmBC,EACnB,aAAa,MACb,cAAeG,EACf,UAAWG,EACX,cAAe0B,EACf,YAAapC,EACb,WAAY,CACV,GAAGa,CACL,EACA,WAAY,CAAE,GAAGD,EAAY,KAAAK,EAAM,SAAAO,EAAU,GAAAK,CAAG,EAChD,SAAUb,EACV,KAAMD,EACN,WAAYG,EACZ,MAAOC,EACP,UAAWC,EACX,MAAOC,EACP,SAAUC,EACV,YAAaG,EACb,OAAQC,EACR,UAAWC,EACX,gBAAiB,CAAE,GAAGb,EAAiB,QAASe,CAAG,GA5B9CG,CA6BP,CAEJ,CACF,CACF,EAEA9B,EAAY,YAAc,cAE1B,IAAOwC,EAAQxC","sourcesContent":["import { forwardRef, memo, useEffect, useRef, useState } from 'react';\nimport {\n NumberFormatValues,\n NumericFormat,\n SourceInfo,\n} from 'react-number-format';\nimport TextField from '@mui/material/TextField';\n\nimport { NumberInputProps } from 'types/numberInputProps';\n\nconst NumberInput = memo(\n forwardRef<HTMLDivElement, NumberInputProps>(\n (\n {\n decimalScale = 0,\n fixedDecimalScale = true,\n prefix,\n suffix,\n allowNegative,\n minValue,\n maxValue = Infinity,\n maxLength,\n value,\n inputProps,\n InputProps,\n InputLabelProps,\n size,\n disabled,\n name,\n helperText,\n error,\n fullWidth,\n label,\n required,\n onChange,\n tabIndex,\n placeholder,\n margin,\n className,\n delay,\n id,\n inputRef,\n },\n ref,\n ) => {\n const [inputkey, setInputKey] = useState(Date.now());\n const delayTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const reRenderInput = () => setInputKey(Date.now());\n\n const handleChange = (values: NumberFormatValues, event: SourceInfo) => {\n if (!onChange) return;\n\n if (delayTimer.current) clearTimeout(delayTimer.current);\n\n const executeChange = () => {\n const { floatValue } = values;\n const comparisonValue = floatValue || 0;\n\n if (minValue !== undefined && minValue > comparisonValue) {\n onChange({ target: { name, value: minValue }, event });\n reRenderInput();\n\n return;\n }\n\n if (floatValue !== undefined && maxValue < comparisonValue) {\n onChange({ target: { name, value: maxValue }, event });\n reRenderInput();\n\n return;\n }\n\n onChange({\n target: {\n name,\n value: floatValue,\n },\n event,\n });\n };\n\n if (delay === 0) {\n executeChange();\n } else {\n delayTimer.current = setTimeout(executeChange, delay || 1000);\n }\n };\n\n useEffect(() => {\n return () => {\n if (delayTimer.current) {\n clearTimeout(delayTimer.current);\n }\n };\n }, []);\n\n return (\n <NumericFormat\n key={inputkey}\n getInputRef={inputRef ?? ref}\n value={value}\n prefix={prefix}\n suffix={suffix}\n decimalSeparator=\",\"\n thousandSeparator=\".\"\n decimalScale={decimalScale}\n fixedDecimalScale={fixedDecimalScale}\n autoComplete=\"off\"\n allowNegative={allowNegative}\n maxLength={maxLength}\n onValueChange={handleChange}\n customInput={TextField}\n InputProps={{\n ...InputProps,\n }}\n inputProps={{ ...inputProps, name, tabIndex, id }}\n disabled={disabled}\n size={size}\n helperText={helperText}\n error={error}\n fullWidth={fullWidth}\n label={label}\n required={required}\n placeholder={placeholder}\n margin={margin}\n className={className}\n InputLabelProps={{ ...InputLabelProps, htmlFor: id }}\n />\n );\n },\n ),\n);\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DataGrid/index.tsx","../src/components/DataGrid/CustomToolbar/index.tsx"],"names":["useState","DataGridPremium","GRID_CHECKBOX_SELECTION_COL_DEF","Box","GridToolbarColumnsButton","GridToolbarContainer","GridToolbarDensitySelector","GridToolbarExport","GridToolbarFilterButton","jsx","jsxs","CustomToolbar","showToolbar","disableExport","setFilterButtonEl","toolbarContent","CustomToolbar_default","Fragment","DataGrid","columns","rows","loading","fetching","hideFooter","sx","columnHeaderHeight","rowHeight","rowSpacingType","getRowSpacing","autoHeight","slots","other","filterButtonEl","COLUMNS","FixedProgressBar_default","EmptyContent_default","LoadingOverlay_default","DataGrid_default"],"mappings":"mHAAA,OAAS,YAAAA,MAAgB,QACzB,OACE,mBAAAC,EACA,mCAAAC,MAGK,2BCLP,OAAOC,MAAS,oBAChB,OACE,4BAAAC,EACA,wBAAAC,EACA,8BAAAC,EACA,qBAAAC,EACA,2BAAAC,MACK,2BAaH,OACE,OAAAC,EADF,QAAAC,MAAA,oBATJ,IAAMC,EAAgB,CAAC,CACrB,YAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,eAAAC,CACF,IAA6C,CAC3C,GAAKH,EAEL,OACEF,EAACL,EAAA,CACC,UAAAI,EAACL,EAAA,CAAyB,UAAW,CAAE,OAAQ,CAAE,MAAO,SAAU,CAAE,EAAG,EACvEK,EAACD,EAAA,CACC,IAAKM,EACL,UAAW,CAAE,OAAQ,CAAE,MAAO,SAAU,CAAE,EAC5C,EACAL,EAACH,EAAA,CACC,UAAW,CAAE,OAAQ,CAAE,MAAO,SAAU,CAAE,EAC5C,EACC,CAACO,GACAJ,EAACF,EAAA,CAAkB,UAAW,CAAE,OAAQ,CAAE,MAAO,SAAU,CAAE,EAAG,EAElEE,EAACN,EAAA,CAAI,GAAI,CAAE,SAAU,CAAE,EAAG,EACzBY,GACH,CAEJ,EAEOC,EAAQL,EDUX,mBAAAM,EACe,OAAAR,EADf,QAAAC,MAAA,oBAjCJ,IAAMQ,EAAW,CAAC,CAChB,QAAAC,EACA,KAAAC,EAAO,CAAC,EACR,QAAAC,EACA,SAAAC,EACA,WAAAC,EACA,GAAAC,EACA,YAAAZ,EACA,cAAAC,EACA,mBAAAY,EAAqB,GACrB,UAAAC,EAAY,GACZ,eAAAC,EAAiB,SACjB,cAAAC,EAAgB,KAAO,CACrB,IAAK,EACL,OAAQ,CACV,GACA,WAAAC,EAAa,GACb,eAAAd,EACA,MAAAe,EACA,GAAGC,CACL,IAAqB,CACnB,GAAM,CAACC,EAAgBlB,CAAiB,EACtCd,EAAmC,IAAI,EAEnCiC,EAAU,CACd,CACE,GAAG/B,EACH,MAAO,EACT,EACA,GAAGiB,CACL,EAEA,OACET,EAAAO,EAAA,CACG,UAAAK,GAAYb,EAACyB,EAAA,CAAiB,GAAI,CAAE,OAAQ,CAAE,EAAG,EAElDzB,EAACR,EAAA,CACC,QAASgC,EACT,KAAMb,EACN,QAASC,EACT,WAAYQ,EACZ,WAAYT,EAAK,SAAW,EAAI,GAAOG,EACvC,UAAWG,EACX,mBAAoBD,EACpB,cAAeG,EACf,eAAgBD,EAChB,mBAAkB,GAClB,MAAO,CACL,QAASX,EACT,cAAe,IACbP,EAAC0B,EAAA,CAAa,MAAM,6BAA6B,EAEnD,iBAAkB,IAChB1B,EAAC0B,EAAA,CAAa,MAAM,6BAA6B,EAEnD,eAAgBC,EAChB,GAAGN,CACL,EACA,UAAW,CACT,MAAO,CAAE,SAAUE,CAAe,EAClC,QAAS,CACP,kBAAAlB,EACA,gBAAiB,GACjB,cAAAD,EACA,YAAAD,EACA,eAAAG,CACF,CACF,EACA,GAAIS,EACH,GAAGO,EACN,GACF,CAEJ,EAEOM,EAAQnB","sourcesContent":["import { useState } from 'react';\nimport {\n DataGridPremium,\n GRID_CHECKBOX_SELECTION_COL_DEF,\n GridSlots,\n GridSlotsComponentsProps,\n} from '@mui/x-data-grid-premium';\n\nimport EmptyContent from 'components/EmptyContent';\nimport { DataGridProps } from 'types/dataGridProps';\n\nimport FixedProgressBar from '../FixedProgressBar';\n\nimport CustomToolbar from './CustomToolbar';\nimport LoadingOverlay from './LoadingOverlay';\n\nconst DataGrid = ({\n columns,\n rows = [],\n loading,\n fetching,\n hideFooter,\n sx,\n showToolbar,\n disableExport,\n columnHeaderHeight = 56,\n rowHeight = 76,\n rowSpacingType = 'margin',\n getRowSpacing = () => ({\n top: 0,\n bottom: 0,\n }),\n autoHeight = false,\n toolbarContent,\n slots,\n ...other\n}: DataGridProps) => {\n const [filterButtonEl, setFilterButtonEl] =\n useState<HTMLButtonElement | null>(null);\n\n const COLUMNS = [\n {\n ...GRID_CHECKBOX_SELECTION_COL_DEF,\n width: 71,\n },\n ...columns,\n ];\n\n return (\n <>\n {fetching && <FixedProgressBar sx={{ zIndex: 1 }} />}\n\n <DataGridPremium\n columns={COLUMNS}\n rows={rows}\n loading={loading}\n autoHeight={autoHeight}\n hideFooter={rows.length === 0 ? true : hideFooter}\n rowHeight={rowHeight}\n columnHeaderHeight={columnHeaderHeight}\n getRowSpacing={getRowSpacing}\n rowSpacingType={rowSpacingType}\n disableAggregation\n slots={{\n toolbar: CustomToolbar as unknown as GridSlots['toolbar'],\n noRowsOverlay: () => (\n <EmptyContent title=\"Nenhum registro encontrado\" />\n ),\n noResultsOverlay: () => (\n <EmptyContent title=\"Nenhum registro encontrado\" />\n ),\n loadingOverlay: LoadingOverlay,\n ...slots,\n }}\n slotProps={{\n panel: { anchorEl: filterButtonEl },\n toolbar: {\n setFilterButtonEl,\n showQuickFilter: true,\n disableExport,\n showToolbar,\n toolbarContent,\n } as unknown as GridSlotsComponentsProps['toolbar'],\n }}\n sx={sx}\n {...other}\n />\n </>\n );\n};\n\nexport default DataGrid;\n","import { PropsWithChildren } from 'react';\nimport Box from '@mui/material/Box';\nimport {\n GridToolbarColumnsButton,\n GridToolbarContainer,\n GridToolbarDensitySelector,\n GridToolbarExport,\n GridToolbarFilterButton,\n} from '@mui/x-data-grid-premium';\n\nimport { CustomToolbarProps } from './props';\n\nconst CustomToolbar = ({\n showToolbar,\n disableExport,\n setFilterButtonEl,\n toolbarContent,\n}: PropsWithChildren<CustomToolbarProps>) => {\n if (!showToolbar) return;\n\n return (\n <GridToolbarContainer>\n <GridToolbarColumnsButton slotProps={{ button: { color: 'inherit' } }} />\n <GridToolbarFilterButton\n ref={setFilterButtonEl}\n slotProps={{ button: { color: 'inherit' } }}\n />\n <GridToolbarDensitySelector\n slotProps={{ button: { color: 'inherit' } }}\n />\n {!disableExport && (\n <GridToolbarExport slotProps={{ button: { color: 'inherit' } }} />\n )}\n <Box sx={{ flexGrow: 1 }} />\n {toolbarContent}\n </GridToolbarContainer>\n );\n};\n\nexport default CustomToolbar;\n"]}
|
|
File without changes
|
|
File without changes
|