@zydon/common 2.0.54 → 2.0.56

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.
@@ -6,10 +6,10 @@ import x, { useState } from 'react';
6
6
  import { GRID_CHECKBOX_SELECTION_COL_DEF, DataGridPremium, GridToolbarContainer, GridToolbarColumnsButton, GridToolbarFilterButton, GridToolbarDensitySelector, GridToolbarExport, useGridApiContext, useGridRootProps, gridColumnsTotalWidthSelector, gridColumnPositionsSelector } from '@mui/x-data-grid-premium';
7
7
  import R from '@mui/material/Box';
8
8
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
9
- import F from '@mui/material/Skeleton';
10
- import L from '@mui/material/Stack';
9
+ import M from '@mui/material/Skeleton';
10
+ import N from '@mui/material/Stack';
11
11
  import { styled } from '@mui/material/styles';
12
12
 
13
- var H=({showToolbar:t,disableExport:r,setFilterButtonEl:i,toolbarContent:l})=>{if(t)return jsxs(GridToolbarContainer,{children:[jsx(GridToolbarColumnsButton,{slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarFilterButton,{ref:i,slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarDensitySelector,{slotProps:{button:{color:"inherit"}}}),!r&&jsx(GridToolbarExport,{slotProps:{button:{color:"inherit"}}}),jsx(R,{sx:{flexGrow:1}}),l]})},S=H;var y=styled(R)({display:"flex",flexDirection:"row",alignItems:"center",padding:"0 16px"}),A=()=>{let t=useGridApiContext(),{rowHeight:r,paginationModel:i,initialState:l}=useGridRootProps(),d=i?.pageSize||l?.pagination?.paginationModel?.pageSize||10,m=gridColumnsTotalWidthSelector(t),p=gridColumnPositionsSelector(t),h=x.useMemo(()=>p.filter(o=>o<=m).length,[m,p]),n=t.current.getVisibleColumns().slice(0,h),a=n.length>1?n:[...n,{field:"fake01",headerName:"",computedWidth:100},{field:"fake02",headerName:"",computedWidth:100},{field:"fake03",headerName:"",computedWidth:100},{field:"fake04",headerName:"",computedWidth:100}],g=x.useMemo(()=>{let o=[];for(let e=0;e<d;e+=1){for(let u of a)o.push(jsx(y,{sx:{justifyContent:u.align},children:jsx(F,{width:"100%"})},`column-${e}-${u.field}`));o.push(jsx(y,{},`fill-${e}`));}return o},[d,a]);return jsx(L,{display:"grid",sx:{display:"grid",gridTemplateColumns:`${a.map(({computedWidth:o})=>`${o}px`).join(" ")} 1fr`,gridAutoRows:r,backgroundColor:"#fff",overflow:"hidden",maxHeight:"100%"},children:g})},G=A;var U=({columns:t,rows:r=[],loading:i,fetching:l,hideFooter:d,sx:m,showToolbar:p,disableExport:h,columnHeaderHeight:n=56,rowHeight:a$2=76,rowSpacingType:g="margin",getRowSpacing:o=()=>({top:0,bottom:0}),autoHeight:e=!1,toolbarContent:u,...P})=>{let[T,k]=useState(null),w=[{...GRID_CHECKBOX_SELECTION_COL_DEF,width:71},...t];return jsxs(Fragment,{children:[l&&jsx(a,{sx:{zIndex:1}}),jsx(DataGridPremium,{columns:w,rows:r,loading:i,autoHeight:e,hideFooter:r.length===0?!0:d,rowHeight:a$2,columnHeaderHeight:n,getRowSpacing:o,rowSpacingType:g,slots:{toolbar:S,noRowsOverlay:()=>jsx(a$1,{title:"Nenhum registro encontrado"}),noResultsOverlay:()=>jsx(a$1,{title:"Nenhum registro encontrado"}),loadingOverlay:G},slotProps:{panel:{anchorEl:T},toolbar:{setFilterButtonEl:k,showQuickFilter:!0,disableExport:h,showToolbar:p,toolbarContent:u}},sx:m,...P})]})},go=U;
13
+ var v=({showToolbar:r,disableExport:e,setFilterButtonEl:i,toolbarContent:l})=>{if(r)return jsxs(GridToolbarContainer,{children:[jsx(GridToolbarColumnsButton,{slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarFilterButton,{ref:i,slotProps:{button:{color:"inherit"}}}),jsx(GridToolbarDensitySelector,{slotProps:{button:{color:"inherit"}}}),!e&&jsx(GridToolbarExport,{slotProps:{button:{color:"inherit"}}}),jsx(R,{sx:{flexGrow:1}}),l]})},S=v;var y=styled(R)({display:"flex",flexDirection:"row",alignItems:"center",padding:"0 16px"}),A=()=>{let r=useGridApiContext(),{rowHeight:e,paginationModel:i,initialState:l}=useGridRootProps(),m=i?.pageSize||l?.pagination?.paginationModel?.pageSize||10,p=gridColumnsTotalWidthSelector(r),d=gridColumnPositionsSelector(r),g=x.useMemo(()=>d.filter(o=>o<=p).length,[p,d]),n=r.current.getVisibleColumns().slice(0,g),s=n.length>1?n:[...n,...Array.from({length:8},(o,t)=>({field:`fake${String(t+1).padStart(2,"0")}`,headerName:"",computedWidth:200,align:"flex-start"}))],h=x.useMemo(()=>{let o=[];for(let t=0;t<m;t+=1){for(let u of s)o.push(jsx(y,{sx:{justifyContent:u.align},children:jsx(M,{width:"100%"})},`column-${t}-${u.field}`));o.push(jsx(y,{},`fill-${t}`));}return o},[m,s]);return jsx(N,{display:"grid",sx:{display:"grid",gridTemplateColumns:`${s.map(({computedWidth:o})=>`${o}px`).join(" ")} 1fr`,gridAutoRows:e,backgroundColor:"#fff",overflow:"hidden",maxHeight:"100%"},children:h})},G=A;var U=({columns:r,rows:e=[],loading:i,fetching:l,hideFooter:m,sx:p,showToolbar:d,disableExport:g,columnHeaderHeight:n=56,rowHeight:s=76,rowSpacingType:h="margin",getRowSpacing:o=()=>({top:0,bottom:0}),autoHeight:t=!1,toolbarContent:u,...P})=>{let[T,w]=useState(null),k=[{...GRID_CHECKBOX_SELECTION_COL_DEF,width:71},...r];return jsxs(Fragment,{children:[l&&jsx(a,{sx:{zIndex:1}}),jsx(DataGridPremium,{columns:k,rows:e,loading:i,autoHeight:t,hideFooter:e.length===0?!0:m,rowHeight:s,columnHeaderHeight:n,getRowSpacing:o,rowSpacingType:h,slots:{toolbar:S,noRowsOverlay:()=>jsx(a$1,{title:"Nenhum registro encontrado"}),noResultsOverlay:()=>jsx(a$1,{title:"Nenhum registro encontrado"}),loadingOverlay:G},slotProps:{panel:{anchorEl:T},toolbar:{setFilterButtonEl:w,showQuickFilter:!0,disableExport:g,showToolbar:d,toolbarContent:u}},sx:p,...P})]})},ho=U;
14
14
 
15
- export { go as default };
15
+ export { ho as default };
@@ -1,7 +1,7 @@
1
1
  import { DateRangePicker } from '@mui/x-date-pickers-pro';
2
- import o from 'dayjs';
2
+ import r from 'dayjs';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
- var p=({label:a,value:e,onChange:l,tabIndex:n,helperText:D,required:s,...r})=>jsx(DateRangePicker,{format:"DD/MM/YYYY",value:[e?.startDate?o(e.startDate):null,e?.endDate?o(e.endDate):null],onChange:t=>l({startDate:t[0]?t[0].toDate():null,endDate:t[1]?t[1].toDate():null}),...r,slotProps:{textField:({position:t})=>({...r.slotProps?.textField,required:s,helperText:D,autoComplete:"off",spellCheck:"false",fullWidth:!0,label:t==="start"?`${a} (Dt. In\xEDcio)`:`${a} (Dt. Fim)`,inputProps:{tabIndex:n}})},sx:{width:1}}),m=p;
5
+ var p=({label:o,value:t,onChange:l,tabIndex:n,helperText:s,required:D,...a})=>jsx(DateRangePicker,{format:"DD/MM/YYYY",value:[t?.startDate?r(t.startDate):null,t?.endDate?r(t.endDate):null],onChange:e=>l({startDate:e[0]?e[0].toDate():null,endDate:e[1]?e[1].toDate():null}),...a,slotProps:{textField:()=>({...a.slotProps?.textField,required:D,helperText:s,autoComplete:"off",spellCheck:"false",fullWidth:!0,label:o,inputProps:{tabIndex:n}})},sx:{width:1}}),u=p;
6
6
 
7
- export { m as default };
7
+ export { u as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.0.54",
3
+ "version": "2.0.56",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",