@zydon/common 2.5.24 → 2.5.25

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.
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ReactNode, Dispatch, SetStateAction } from 'react';
3
+ import { ReactNode } from 'react';
4
4
  import * as _mui_material_Stack from '@mui/material/Stack';
5
5
  import { StackProps } from '@mui/material/Stack';
6
6
  import * as _mui_material_styles from '@mui/material/styles';
@@ -26,9 +26,6 @@ interface DataViewProps extends DataGridProps {
26
26
  searchValue?: string;
27
27
  onSearchChange?: (value: string) => void;
28
28
  }
29
- interface ToolbarProps {
30
- setFilterButtonEl: Dispatch<SetStateAction<HTMLButtonElement | null>>;
31
- }
32
29
 
33
30
  interface DefaultProps {
34
31
  breakpoint: Breakpoint | number;
@@ -59,7 +56,7 @@ declare const DesktopPaginationContainer: _emotion_styled.StyledComponent<_mui_m
59
56
  ref?: react.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
60
57
  }, keyof _mui_material_OverridableComponent.CommonProps | keyof _mui_material_Stack.StackOwnProps> & _mui_system.MUIStyledCommonProps<_mui_material_styles.Theme>, {}, {}>;
61
58
 
62
- declare const Toolbar: ({ setFilterButtonEl }: ToolbarProps) => react_jsx_runtime.JSX.Element;
59
+ declare const Toolbar: () => react_jsx_runtime.JSX.Element;
63
60
 
64
61
  declare const DataView: ({ title, breakpoint, columns, rows, mobileRender, rowCount, paginationModel, onPaginationChange, actions, moreActions, onAdd, onSearch, searchValue, onSearchChange, slots, slotProps, loading, fetching, containerProps, ...others }: DataViewProps) => react_jsx_runtime.JSX.Element;
65
62
 
@@ -12,18 +12,18 @@ import { a as a$8 } from '../../chunk-26GV7WKC.js';
12
12
  import { a as a$1 } from '../../chunk-UZ4KBLZU.js';
13
13
  import '../../chunk-6PEJXOLM.js';
14
14
  import { a as a$3 } from '../../chunk-ORYAES3Q.js';
15
- import { b as b$1 } from '../../chunk-ILHUUK4X.js';
15
+ import { b } from '../../chunk-ILHUUK4X.js';
16
16
  import { forwardRef, useState } from 'react';
17
- import ro from '@mui/material/Button';
18
- import To from '@mui/material/CircularProgress';
17
+ import eo from '@mui/material/Button';
18
+ import yo from '@mui/material/CircularProgress';
19
19
  import j from '@mui/material/Divider';
20
- import d from '@mui/material/Stack';
21
- import x from '@mui/material/Typography';
22
- import ho from '@mui/material/TablePagination';
20
+ import p from '@mui/material/Stack';
21
+ import b$1 from '@mui/material/Typography';
22
+ import uo from '@mui/material/TablePagination';
23
23
  import { styled, alpha } from '@mui/material/styles';
24
24
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
25
- import { GridToolbarFilterButton, GridToolbarColumnsButton } from '@mui/x-data-grid-premium';
25
+ import { GridToolbarColumnsButton } from '@mui/x-data-grid-premium';
26
26
 
27
- var P="datagrid-actions";var $=styled(a,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:r})=>({position:"relative",borderRadius:12,padding:0,gap:0,overflow:"hidden",[o.breakpoints.down(r)]:{borderColor:alpha(o.palette.grey[500],.2)}})),U=styled(d,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:r})=>({flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"24px 24px 0",gap:24,[o.breakpoints.down(r)]:{padding:"16px 16px 0"}})),Q=styled(d,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:r})=>({flexDirection:"row",alignItems:"center",gap:12,color:o.palette.text.secondary,[o.breakpoints.down(r)]:{"& button, & a":{textIndent:"-9999em",fontSize:0,minWidth:36,maxWidth:36,height:36,width:36,overflow:"hidden","& .MuiButton-icon":{margin:0}}}})),q=styled(j)({borderStyle:"dashed",height:16,margin:"auto"}),b=styled(j)({borderStyle:"dashed",height:12,marginTop:"auto",marginBottom:"auto"}),J=styled(d,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:r})=>({position:"relative",padding:16,flexDirection:"row",alignItems:"center",color:o.palette.text.secondary,[o.breakpoints.down(r)]:{padding:"12px 16px",borderBottom:`1px solid ${o.palette.divider}`,minHeight:60,[o.breakpoints.down(r)]:{"& button":{textIndent:"-9999em",fontSize:0,minWidth:36,maxWidth:36,height:36,width:36,overflow:"hidden","& .MuiButton-icon":{margin:0}}}}})),K=styled(d,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:r})=>({width:320,alignItems:"center",justifyContent:"center",[o.breakpoints.down(r)]:{position:"absolute",left:0,width:"100%",padding:"0 12px",zIndex:1,"& fieldset, & input":{display:"flex"},"& .MuiInputAdornment-root":{marginLeft:0}}})),X=styled(d)(({theme:o})=>({"& .MuiToolbar-root":{height:24,minHeight:24,overflow:"hidden",[o.breakpoints.down("sm")]:{height:"auto",flexWrap:"wrap",justifyContent:"center"}}})),Y=styled(d)(({theme:o})=>({minHeight:60,alignItems:"flex-end",justifyContent:"center",borderTop:`1px solid ${o.palette.divider}`,[o.breakpoints.down("sm")]:{minHeight:"auto"}})),Z=styled(d)(({theme:o})=>({flexDirection:"row",height:60,alignItems:"center",justifyContent:"space-between",borderTop:`1px solid ${o.palette.divider}`,gap:16,padding:16}));var Po=({count:o,page:r,rowsPerPage:l,onPageChange:m,onRowsPerPageChange:w})=>jsx(X,{children:jsx(ho,{color:"primary",component:"div",size:"small",count:o,page:r,rowsPerPage:l,onPageChange:(c,n)=>m(n),onRowsPerPageChange:c=>w(Number(c.target.value))})}),y=Po;var wo=forwardRef(({children:o,...r},l)=>jsx(ro,{...r,ref:l,color:"inherit",startIcon:jsx(a$1,{icon:"COLUMNS"}),children:o??"Colunas"}));wo.displayName="ColumnsButton";var Co=forwardRef(({children:o,...r},l)=>jsx(ro,{...r,ref:l,color:"inherit",startIcon:jsx(a$1,{icon:"FILTER_VERTICAL"}),children:o??"Filtros"}));Co.displayName="FilterButton";var vo=({setFilterButtonEl:o})=>jsxs(a$2,{container:P,children:[jsx(GridToolbarFilterButton,{ref:o,slotProps:{button:{color:"inherit",startIcon:jsx(a$1,{icon:"FILTER_VERTICAL"}),children:"Filtros"}}}),jsx(b,{orientation:"vertical",flexItem:!0}),jsx(GridToolbarColumnsButton,{slotProps:{button:{color:"inherit",startIcon:jsx(a$1,{icon:"COLUMNS"}),children:"Colunas"}}})]}),eo=vo;var So=({title:o,breakpoint:r="md",columns:l,rows:m=[],mobileRender:w,rowCount:c=0,paginationModel:n={page:0,pageSize:25},onPaginationChange:g,actions:T,moreActions:D,onAdd:S,onSearch:B,searchValue:ao,onSearchChange:po,slots:C,slotProps:so,loading:u,fetching:k,containerProps:lo={height:562,maxHeight:562},...mo})=>{let f=a$3(),h=b$1("down",r),[co,uo]=useState(null),A=!!B,v=!!S,R=!!T,go=R||v,F=!!D,H=F||A||!h;return jsxs($,{breakpoint:r,...lo,flex:u?1:void 0,minHeight:!u&&m.length===0?562:void 0,children:[jsxs(U,{breakpoint:r,children:[jsx(x,{variant:"overline",color:"text.secondary",noWrap:!0,children:o}),go&&jsxs(Q,{breakpoint:r,children:[R&&jsxs(Fragment,{children:[T,v&&jsx(q,{orientation:"vertical",flexItem:!0})]}),v&&jsx(ro,{startIcon:jsx(a$1,{icon:"SIMPLE_ADD"}),variant:"contained",onClick:S,children:"Adicionar"})]})]}),H&&jsxs(J,{breakpoint:r,children:[jsx(d,{flex:1,direction:"row",alignItems:"center",id:P,gap:.5,children:F&&jsxs(Fragment,{children:[jsx(ro,{color:"inherit",startIcon:jsx(a$1,{icon:"MORE_BOLD"}),size:"small",onClick:f.onOpen,children:"Mais"}),!h&&jsx(b,{orientation:"vertical",flexItem:!0}),jsx(a$4,{open:f.open,anchorEl:f.open,onClose:f.onClose,sx:{minWidth:160},disabledArrow:h,children:D})]})}),A&&jsx(K,{breakpoint:r,children:jsx(a$5,{value:ao,placeholder:"Buscar",onSearch:B,onChange:e=>po?.(e.target.value),size:"small",fullWidth:!0,iconPosition:"start"})})]}),!H&&jsx(j,{sx:{mt:2}}),h?jsxs(a$6,{isFetching:k,fetching:jsx(a$7,{}),isLoading:u,loading:jsx(To,{sx:{m:"160px auto"}}),isEmpty:m.length===0,empty:jsx(d,{flex:1,alignItems:"center",justifyContent:"center",children:C?.noRowsOverlay?jsx(C.noRowsOverlay,{}):jsx(x,{variant:"body2",color:"text.secondary",children:"Nenhum registro encontrado"})}),children:[jsx(a$8,{fillContent:!0,children:m.map(e=>w(e))}),jsx(Y,{children:jsx(y,{count:c,page:n.page,rowsPerPage:n.pageSize,onPageChange:e=>g(e,n.pageSize),onRowsPerPageChange:e=>g(n.page,e)})})]}):jsx(a$9,{columns:l,rows:m,slots:{toolbar:eo,footer:()=>jsxs(Z,{children:[jsxs(d,{direction:"row",alignItems:"center",gap:.5,children:[jsx(x,{variant:"body2",color:"text.disabled",children:"Total de itens:"}),jsx(x,{variant:"body2",children:c})]}),jsx(y,{count:c,page:n.page,rowsPerPage:n.pageSize,onPageChange:e=>g(e,n.pageSize),onRowsPerPageChange:e=>g(n.page,e)})]}),...C},slotProps:{panel:{anchorEl:co},toolbar:{setFilterButtonEl:uo,showQuickFilter:!0},...so},columnHeaderHeight:48,getRowHeight:()=>68,loading:u,fetching:k,...mo})]},u?"loading":"data")},ut=So;
27
+ var P="datagrid-actions";var V=styled(a,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({position:"relative",borderRadius:12,padding:0,gap:0,overflow:"hidden",[o.breakpoints.down(e)]:{borderColor:alpha(o.palette.grey[500],.2)}})),$=styled(p,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:"24px 24px 0",gap:24,[o.breakpoints.down(e)]:{padding:"16px 16px 0"}})),U=styled(p,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({flexDirection:"row",alignItems:"center",gap:12,color:o.palette.text.secondary,[o.breakpoints.down(e)]:{"& button, & a":{textIndent:"-9999em",fontSize:0,minWidth:36,maxWidth:36,height:36,width:36,overflow:"hidden","& .MuiButton-icon":{margin:0}}}})),Q=styled(j)({borderStyle:"dashed",height:16,margin:"auto"}),q=styled(j)({borderStyle:"dashed",height:12,marginTop:"auto",marginBottom:"auto"}),J=styled(p,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({position:"relative",padding:16,flexDirection:"row",alignItems:"center",color:o.palette.text.secondary,[o.breakpoints.down(e)]:{padding:"12px 16px",borderBottom:`1px solid ${o.palette.divider}`,minHeight:60,[o.breakpoints.down(e)]:{"& button":{textIndent:"-9999em",fontSize:0,minWidth:36,maxWidth:36,height:36,width:36,overflow:"hidden","& .MuiButton-icon":{margin:0}}}}})),K=styled(p,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({width:320,alignItems:"center",justifyContent:"center",[o.breakpoints.down(e)]:{position:"absolute",left:0,width:"100%",padding:"0 12px",zIndex:1,"& fieldset, & input":{display:"flex"},"& .MuiInputAdornment-root":{marginLeft:0}}})),X=styled(p)(({theme:o})=>({"& .MuiToolbar-root":{height:24,minHeight:24,overflow:"hidden",[o.breakpoints.down("sm")]:{height:"auto",flexWrap:"wrap",justifyContent:"center"}}})),Y=styled(p)(({theme:o})=>({minHeight:60,alignItems:"flex-end",justifyContent:"center",borderTop:`1px solid ${o.palette.divider}`,[o.breakpoints.down("sm")]:{minHeight:"auto"}})),Z=styled(p)(({theme:o})=>({flexDirection:"row",height:60,alignItems:"center",justifyContent:"space-between",borderTop:`1px solid ${o.palette.divider}`,gap:16,padding:16}));var fo=({count:o,page:e,rowsPerPage:m,onPageChange:s,onRowsPerPageChange:x})=>jsx(X,{children:jsx(uo,{color:"primary",component:"div",size:"small",count:o,page:e,rowsPerPage:m,onPageChange:(l,n)=>s(n),onRowsPerPageChange:l=>x(Number(l.target.value))})}),y=fo;var xo=forwardRef(({children:o,...e},m)=>jsx(eo,{...e,ref:m,color:"inherit",startIcon:jsx(a$1,{icon:"COLUMNS"}),children:o??"Colunas"}));xo.displayName="ColumnsButton";var wo=()=>jsx(a$2,{container:P,children:jsx(GridToolbarColumnsButton,{slotProps:{button:{color:"inherit",startIcon:jsx(a$1,{icon:"COLUMNS"}),children:"Colunas"}}})}),to=wo;var Do=({title:o,breakpoint:e="md",columns:m,rows:s=[],mobileRender:x,rowCount:l=0,paginationModel:n={page:0,pageSize:25},onPaginationChange:u,actions:D,moreActions:S,onAdd:k,onSearch:I,searchValue:no,onSearchChange:io,slots:w,slotProps:ao,loading:c,fetching:T,containerProps:po={height:562,maxHeight:562},...so})=>{let f=a$3(),h=b("down",e),[lo,mo]=useState(null),B=!!I,C=!!k,A=!!D,co=A||C,R=!!S,H=R||B||!h;return jsxs(V,{breakpoint:e,...po,flex:c?1:void 0,minHeight:!c&&s.length===0?562:void 0,children:[jsxs($,{breakpoint:e,children:[jsx(b$1,{variant:"overline",color:"text.secondary",noWrap:!0,children:o}),co&&jsxs(U,{breakpoint:e,children:[A&&jsxs(Fragment,{children:[D,C&&jsx(Q,{orientation:"vertical",flexItem:!0})]}),C&&jsx(eo,{startIcon:jsx(a$1,{icon:"SIMPLE_ADD"}),variant:"contained",onClick:k,children:"Adicionar"})]})]}),H&&jsxs(J,{breakpoint:e,children:[jsx(p,{flex:1,direction:"row",alignItems:"center",id:P,gap:.5,children:R&&jsxs(Fragment,{children:[jsx(eo,{color:"inherit",startIcon:jsx(a$1,{icon:"MORE_BOLD"}),size:"small",onClick:f.onOpen,children:"Mais"}),!h&&jsx(q,{orientation:"vertical",flexItem:!0}),jsx(a$4,{open:f.open,anchorEl:f.open,onClose:f.onClose,sx:{minWidth:160},disabledArrow:h,children:S})]})}),B&&jsx(K,{breakpoint:e,children:jsx(a$5,{value:no,placeholder:"Buscar",onSearch:I,onChange:r=>io?.(r.target.value),size:"small",fullWidth:!0,iconPosition:"start"})})]}),!H&&jsx(j,{sx:{mt:2}}),h?jsxs(a$6,{isFetching:T,fetching:jsx(a$7,{}),isLoading:c,loading:jsx(yo,{sx:{m:"160px auto"}}),isEmpty:s.length===0,empty:jsx(p,{flex:1,alignItems:"center",justifyContent:"center",children:w?.noRowsOverlay?jsx(w.noRowsOverlay,{}):jsx(b$1,{variant:"body2",color:"text.secondary",children:"Nenhum registro encontrado"})}),children:[jsx(a$8,{fillContent:!0,children:s.map(r=>x(r))}),jsx(Y,{children:jsx(y,{count:l,page:n.page,rowsPerPage:n.pageSize,onPageChange:r=>u(r,n.pageSize),onRowsPerPageChange:r=>u(n.page,r)})})]}):jsx(a$9,{columns:m,rows:s,slots:{toolbar:to,footer:()=>jsxs(Z,{children:[jsxs(p,{direction:"row",alignItems:"center",gap:.5,children:[jsx(b$1,{variant:"body2",color:"text.disabled",children:"Total de itens:"}),jsx(b$1,{variant:"body2",children:l})]}),jsx(y,{count:l,page:n.page,rowsPerPage:n.pageSize,onPageChange:r=>u(r,n.pageSize),onRowsPerPageChange:r=>u(n.page,r)})]}),...w},slotProps:{panel:{anchorEl:lo},toolbar:{setFilterButtonEl:mo,showQuickFilter:!0},...ao},columnHeaderHeight:48,getRowHeight:()=>68,loading:c,fetching:T,...so})]},c?"loading":"data")},lt=Do;
28
28
 
29
- export { Q as ActionsContainer, q as ActionsDivider, $ as Container, Z as DesktopPaginationContainer, U as Header, Y as MobilePaginationContainer, K as SearchContainer, eo as Toolbar, b as ToolbarActionsDivider, J as Topbar, ut as default };
29
+ export { U as ActionsContainer, Q as ActionsDivider, V as Container, Z as DesktopPaginationContainer, $ as Header, Y as MobilePaginationContainer, K as SearchContainer, to as Toolbar, q as ToolbarActionsDivider, J as Topbar, lt as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.5.24",
3
+ "version": "2.5.25",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",