@zydon/common 2.8.57 → 2.8.58
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/{bulkActions-3ec5afc1.d.ts → bulkActions-29cd56a9.d.ts} +4 -4
- package/dist/chunk-PRWQQJDL.js +12 -0
- package/dist/chunk-PRWQQJDL.js.map +1 -0
- package/dist/chunk-XLNJJJ7D.js +27 -0
- package/dist/chunk-XLNJJJ7D.js.map +1 -0
- package/dist/{chunk-3HKLNWRZ.js → chunk-XUDTPZHF.js} +4 -4
- package/dist/chunk-XUDTPZHF.js.map +1 -0
- package/dist/components/BulkEditModal/index.js +1 -1
- package/dist/components/Confirm/index.js +1 -1
- package/dist/components/DataView/index.d.ts +10 -8
- package/dist/components/DataView/index.js +3 -3
- package/dist/components/DynamicDataView/index.d.ts +2 -3
- package/dist/components/DynamicDataView/index.js +6 -6
- package/dist/components/DynamicDataView/index.js.map +1 -1
- package/dist/components/MenuPopover/index.d.ts +2 -8
- package/dist/props-3c1ceae1.d.ts +10 -0
- package/package.json +1 -1
- package/dist/chunk-3HKLNWRZ.js.map +0 -1
- package/dist/chunk-75PS5WVR.js +0 -27
- package/dist/chunk-75PS5WVR.js.map +0 -1
- package/dist/chunk-D3RY7C7B.js +0 -12
- package/dist/chunk-D3RY7C7B.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ButtonProps } from '@mui/material/Button';
|
|
3
2
|
import { GridValidRowModel, GridRowSelectionModel } from '@mui/x-data-grid-premium';
|
|
4
3
|
|
|
5
4
|
interface BulkActionConfirmation {
|
|
@@ -15,12 +14,13 @@ interface BulkActionContext<T extends GridValidRowModel = GridValidRowModel> {
|
|
|
15
14
|
clearSelection: () => void;
|
|
16
15
|
}
|
|
17
16
|
interface BulkAction<T extends GridValidRowModel = GridValidRowModel> {
|
|
18
|
-
|
|
17
|
+
actionId: string;
|
|
19
18
|
label: ReactNode;
|
|
20
19
|
icon?: ReactNode | string;
|
|
21
|
-
|
|
20
|
+
action?: string;
|
|
21
|
+
entityName?: string;
|
|
22
22
|
handler: (context: BulkActionContext<T>) => void | Promise<void>;
|
|
23
|
-
confirmation?: BulkActionConfirmation | boolean;
|
|
23
|
+
confirmation?: BulkActionConfirmation | boolean | ((context: BulkActionContext<T>) => BulkActionConfirmation);
|
|
24
24
|
disabled?: boolean | ((context: BulkActionContext<T>) => boolean);
|
|
25
25
|
hidden?: boolean | ((context: BulkActionContext<T>) => boolean);
|
|
26
26
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import c from '@mui/lab/LoadingButton';
|
|
2
|
+
import d from '@mui/material/Button';
|
|
3
|
+
import u from '@mui/material/Dialog';
|
|
4
|
+
import C from '@mui/material/DialogActions';
|
|
5
|
+
import D from '@mui/material/DialogContent';
|
|
6
|
+
import x from '@mui/material/DialogTitle';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var B=({modalTitle:t="Tem certeza que deseja excluir?",message:a="Essa a\xE7\xE3o n\xE3o poder\xE1 ser desfeita.",cancelButtonText:n="Cancelar",confirmButtonText:e="Sim, excluir registro",onClose:i,onConfirm:l,confirming:m,child:g,cancelButtonProps:f,confirmButtonProps:s,...p})=>jsxs(u,{fullWidth:!0,maxWidth:"xs",...p,onClose:i,children:[jsx(x,{children:t}),jsx(D,{children:a}),g,jsxs(C,{children:[jsx(d,{variant:"outlined",color:"inherit",onClick:i,size:"large",...f,children:n}),jsx(c,{variant:"contained",color:"primary",onClick:l,size:"large",loading:m,...s,children:e})]})]}),L=B;
|
|
10
|
+
|
|
11
|
+
export { L as a };
|
|
12
|
+
//# sourceMappingURL=chunk-PRWQQJDL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Confirm/index.tsx"],"names":["LoadingButton","Button","Dialog","DialogActions","DialogContent","DialogTitle","jsx","jsxs","Confirm","modalTitle","message","cancelButtonText","confirmButtonText","onClose","onConfirm","confirming","child","cancelButtonProps","confirmButtonProps","other","Confirm_default"],"mappings":"AAAA,OAAOA,MAAmB,yBAC1B,OAAOC,MAAY,uBACnB,OAAOC,MAAY,uBACnB,OAAOC,MAAmB,8BAC1B,OAAOC,MAAmB,8BAC1B,OAAOC,MAAiB,4BAmBlB,cAAAC,EAIA,QAAAC,MAJA,oBAfN,IAAMC,EAAU,CAAC,CACf,WAAAC,EAAa,kCACb,QAAAC,EAAU,iDACV,iBAAAC,EAAmB,WACnB,kBAAAC,EAAoB,wBACpB,QAAAC,EACA,UAAAC,EACA,WAAAC,EACA,MAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,GAAGC,CACL,IAEIZ,EAACL,EAAA,CAAO,UAAS,GAAC,SAAS,KAAM,GAAGiB,EAAO,QAASN,EAClD,UAAAP,EAACD,EAAA,CAAa,SAAAI,EAAW,EAEzBH,EAACF,EAAA,CAAe,SAAAM,EAAQ,EACvBM,EACDT,EAACJ,EAAA,CACC,UAAAG,EAACL,EAAA,CACC,QAAQ,WACR,MAAM,UACN,QAASY,EACT,KAAK,QACJ,GAAGI,EAEH,SAAAN,EACH,EAEAL,EAACN,EAAA,CACC,QAAQ,YACR,MAAM,UACN,QAASc,EACT,KAAK,QACL,QAASC,EACR,GAAGG,EAEH,SAAAN,EACH,GACF,GACF,EAIGQ,EAAQZ","sourcesContent":["import LoadingButton from '@mui/lab/LoadingButton';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\n\nimport { ConfirmProps } from './props';\n\nconst Confirm = ({\n modalTitle = 'Tem certeza que deseja excluir?',\n message = 'Essa ação não poderá ser desfeita.',\n cancelButtonText = 'Cancelar',\n confirmButtonText = 'Sim, excluir registro',\n onClose,\n onConfirm,\n confirming,\n child,\n cancelButtonProps,\n confirmButtonProps,\n ...other\n}: ConfirmProps) => {\n return (\n <Dialog fullWidth maxWidth=\"xs\" {...other} onClose={onClose}>\n <DialogTitle>{modalTitle}</DialogTitle>\n\n <DialogContent>{message}</DialogContent>\n {child}\n <DialogActions>\n <Button\n variant=\"outlined\"\n color=\"inherit\"\n onClick={onClose}\n size=\"large\"\n {...cancelButtonProps}\n >\n {cancelButtonText}\n </Button>\n\n <LoadingButton\n variant=\"contained\"\n color=\"primary\"\n onClick={onConfirm}\n size=\"large\"\n loading={confirming}\n {...confirmButtonProps}\n >\n {confirmButtonText}\n </LoadingButton>\n </DialogActions>\n </Dialog>\n );\n};\n\nexport default Confirm;\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { a as a$9 } from './chunk-PVI5BAUW.js';
|
|
2
|
+
import { a as a$6 } from './chunk-IJZCVZ32.js';
|
|
3
|
+
import { a as a$3 } from './chunk-IDFJFFIV.js';
|
|
4
|
+
import { a as a$7 } from './chunk-6U5LS7MP.js';
|
|
5
|
+
import { a as a$5 } from './chunk-PRWQQJDL.js';
|
|
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';
|
|
7
|
+
import { a as a$8 } from './chunk-F65ZXAGV.js';
|
|
8
|
+
import { a as a$4 } from './chunk-I4PPSW36.js';
|
|
9
|
+
import { a } from './chunk-VURAUMLN.js';
|
|
10
|
+
import { a as a$1 } from './chunk-LQRRMVFN.js';
|
|
11
|
+
import { b } from './chunk-RPO7AI5K.js';
|
|
12
|
+
import { memo, forwardRef, useState, useRef, useEffect, useMemo, Children, isValidElement, cloneElement, useCallback, Fragment as Fragment$1 } from 'react';
|
|
13
|
+
import ot from 'react-fast-compare';
|
|
14
|
+
import et from '@mui/material/IconButton';
|
|
15
|
+
import tt from '@mui/material/LinearProgress';
|
|
16
|
+
import to from '@mui/material/Stack';
|
|
17
|
+
import ee from '@mui/material/Tooltip';
|
|
18
|
+
import Ce from '@mui/lab/LoadingButton';
|
|
19
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
|
+
import _o from '@mui/material/Button';
|
|
21
|
+
import Xo from '@mui/material/Typography';
|
|
22
|
+
import { GridToolbarColumnsButton } from '@mui/x-data-grid-premium';
|
|
23
|
+
|
|
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),s=useMemo(()=>o.filter(n=>!Fo(n.hidden,e)),[o,e]),c=useCallback(async n=>{i(n.actionId);try{await n.handler(e);}finally{i(null);}},[e]),d=useCallback(n=>{if(n.confirmation){r(n);return}c(n).catch(()=>{});},[c]),m$1=useCallback(async()=>{t&&(await c(t),r(null));},[t,c]),f=useCallback(()=>{a$1||r(null);},[a$1]),l=Ae(t?.confirmation,e);return jsxs(Fragment,{children:[jsx(m,{children:s.map(n=>{let C=!!a$1||Fo(n.disabled,e),k=a$1===n.actionId;return jsx(Ce,{size:"small",variant:"text",onClick:()=>d(n),loading:k,disabled:C,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:l?.title??`${t.action??"Excluir"} ${e.selectedCount} ${t.entityName??"registro"}${e.selectedCount!==1?"s":""}?`,message:l?.message??"Esta a\xE7\xE3o n\xE3o poder\xE1 ser desfeita.",cancelButtonText:l?.cancelButtonText??"Cancelar",confirmButtonText:l?.confirmButtonText??"Sim, excluir"})]})},zo=ke;var Re=({title:o,breakpoint:e,actions:t,showActions:r,showAdd:a$1,showHeaderMoreActions:i,showActionsContainer:s,onAdd:c$1,onOpenMoreActions:d$1})=>jsxs(b$1,{breakpoint:e,children:[jsx(Xo,{variant:"overline",color:"text.secondary",noWrap:!0,children:o}),s&&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:c$1,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:s,mobileRender:c,hideFooter:d,onPaginationChange:m,rowCount:f,paginationModel:l})=>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:s,children:t.map(n=>jsx(Fragment$1,{children:c(n)},n.id))})]}),!d&&m&&jsx(h,{children:jsx(r,{count:f,page:l.page,rowsPerPage:l.pageSize,onPageChange:n=>m?.(n,l.pageSize),onRowsPerPageChange:n=>m?.(l.page,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=(...s)=>{e(),r&&r(...s);};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:s,searchValue:c,onSearch:d,onSearchChange:m,moreActions:f$1,popover:l})=>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:l.onOpen,children:"Mais"}),!e$1&&jsx(e,{orientation:"vertical",flexItem:!0})]}),(a$1||i)&&jsx(o,{open:l.open,anchorEl:l.open,onClose:l.onClose,disabledArrow:!0,children:jsx(ro,{onClose:l.onClose,children:f$1})})]}),!e$1&&s&&jsxs(Fragment,{children:[s,a$1&&jsx(e,{orientation:"vertical",flexItem:!0})]})]}),t&&jsxs(g,{breakpoint:o$1,children:[jsx(a$9,{value:c,placeholder:"Buscar",onSearch:n=>d(n??""),onChange:n=>m?.(n.target.value),size:"small",fullWidth:!0,iconPosition:"start"}),e$1&&s&&jsx(to,{ml:1,children:s})]})]}),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(e,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]),s=i.length,c=useMemo(()=>o.map(S=>r(S)),[o,r]),d=useMemo(()=>new Set(c),[c]),m=useMemo(()=>i.reduce((S,g)=>S+(d.has(g)?1:0),0),[i,d]),f=c.length>0&&m===c.length,l=m>0&&!f,n=useCallback(S=>{t&&t(S);},[t]),C=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:s,clearSelection:C}),[i,I,s,C]),W=!!a?.length,v=useCallback((S,g)=>{if(!t)return;if(g){let M=new Set(i),V=[...i];c.forEach(y=>{M.has(y)||V.push(y);}),n(V);return}let G=i.filter(M=>!d.has(M));n(G);},[t,i,c,d,n]);return {selectionModel:i,numSelected:s,allSelected:f,someSelected:l,hasBulkActions:W,bulkActionContext:_,clearSelection:C,handleSelectAllToggle:v}},jo=Qe;var nt=({title:o,header:e,headerProps:t,breakpoint:r="md",columns:a$4,rows:i=[],mobileSlots:s,mobileSlotsProps:c,mobileRender:d,rowCount:m=0,paginationModel:f={page:0,pageSize:25},onPaginationChange:l$1,actions:n$1,moreActions:C,onAdd:k$1,onSearch:I,searchValue:_,onSearchChange:W,slots:v,slotProps:S,loading:g,fetching:G,fetchingNextPage:M,containerProps:V={height:562,maxHeight:562},hideFooter:y,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:l$1}),ho=!!I,Co=!!k$1,Ao=!!n$1,K=!!C,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:g?1:void 0,minHeight:g||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:C,popover:So}),uo&&uo,!To&&jsx(p,{})]}),T?jsx(qo,{fetching:G,loading:g,rows:i,mobileSlots:s,mobileSlotsProps:c,slots:v,scrollableNodeRef:go,mobileRender:d,hideFooter:y,onPaginationChange:l$1,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:g,fetching:G,hideFooter:y,onRowsScrollEnd:E,scrollEndThreshold:$,...R})]}),M&&jsx(tt,{})]},g?"loading":"data")},xn=memo(nt,ot);
|
|
25
|
+
|
|
26
|
+
export { ro as a, lo as b, so as c, xn as d };
|
|
27
|
+
//# sourceMappingURL=chunk-XLNJJJ7D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DataView/index.tsx","../src/components/DataView/BulkActionsBar.tsx","../src/components/DataView/DataViewHeader.tsx","../src/components/DataView/DataViewMobileContent.tsx","../src/components/DataView/DataViewTopbar.tsx","../src/components/DataView/contants.ts","../src/components/DataView/EnhancedMoreActions.ts","../src/components/DataView/use-data-grid-slots.tsx","../src/components/DataView/DesktopFooter.tsx","../src/components/DataView/Toolbar.tsx","../src/components/DataView/use-selection-state.ts"],"names":["memo","useEffect","useMemo","useRef","useState","isEqual","IconButton","LinearProgress","Stack","Tooltip","useCallback","LoadingButton","Fragment","jsx","jsxs","resolveDynamicBoolean","value","context","resolveConfirmation","confirmation","BulkActionsBar","actions","confirmAction","setConfirmAction","runningActionId","setRunningActionId","visibleActions","action","executeAction","handleActionClick","handleConfirm","handleCloseConfirm","confirmationConfig","SelectionActions","disabled","loading","Icon_default","Confirm_default","BulkActionsBar_default","Button","Typography","DataViewHeader","title","breakpoint","showActions","showAdd","showHeaderMoreActions","showActionsContainer","onAdd","onOpenMoreActions","Header","ActionsContainer","ActionsDivider","DataViewHeader_default","DataViewMobileContent","fetching","rows","mobileSlots","mobileSlotsProps","slots","scrollableNodeRef","mobileRender","hideFooter","onPaginationChange","rowCount","paginationModel","Result_default","FixedProgressBar_default","LoadingProgress","Scrollbar_default","row","MobilePaginationContainer","Pagination_default","newPage","newRowsPerPage","DataViewMobileContent_default","DATAGRID_ACTIONS","Children","cloneElement","isValidElement","createEnhanceMoreActions","children","onClose","child","originalOnClick","enhancedProps","args","childProps","EnhancedMoreActions","EnhancedMoreActions_default","DataViewTopbar","isMobile","showSearch","showMoreActions","showTopbarMoreActions","filterButton","searchValue","onSearch","onSearchChange","moreActions","popover","Topbar","ToolbarActionsDivider","MoreActionsPopover","SearchContainer","SearchInput_default","v","e","DataViewTopbar_default","DesktopFooter","page","rowsPerPage","DesktopPaginationContainer","DesktopFooter_default","forwardRef","GridToolbarColumnsButton","ColumnsButton","props","ref","Toolbar","setFilterButtonEl","handleColumnsButtonRef","button","Portal_default","Toolbar_default","useDataGridSlots","showColumnButton","FooterComponent","use_data_grid_slots_default","useSelectionState","rowSelectionModel","onRowSelectionModelChange","getRowId","bulkActions","selectionModel","numSelected","pageRowIds","pageRowIdSet","selectedOnPageCount","count","id","allSelected","someSelected","emitRowSelectionChange","nextSelection","clearSelection","selectedIdSet","selectedRowsInPage","bulkActionContext","hasBulkActions","handleSelectAllToggle","_event","checked","selectedIds","use_selection_state_default","DataViewComponent","header","headerProps","columns","slotProps","fetchingNextPage","containerProps","activeFilters","onRowsScrollEnd","scrollEndThreshold","others","usePopover_default","useResponsive_default","filterButtonEl","node","handleScroll","scrollTop","scrollHeight","clientHeight","dataGridSlots","showTopbar","selectionOverlay","SelectionOverlay","SelectionCheckbox","SelectionCount","Container","TopbarDivider","DataGridWrapper","DataGrid_default","DataView_default"],"mappings":"kkBAAA,OAAS,QAAAA,GAAM,aAAAC,GAAW,WAAAC,GAAS,UAAAC,GAAQ,YAAAC,OAAgB,QAC3D,OAAOC,OAAa,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,EACjB,mBAAoBC,EACnB,GAAGC,EACN,GACF,EAGDL,GAAoBnJ,EAACN,GAAA,EAAe,IAzFhC4B,EAAU,UAAY,MA0F7B,CAEJ,EAEOqJ,GAAQxL,GAAK2J,GAAmBtJ,EAAO","sourcesContent":["import { memo, useEffect, useMemo, useRef, useState } from 'react';\nimport isEqual from 'react-fast-compare';\nimport IconButton from '@mui/material/IconButton';\nimport LinearProgress from '@mui/material/LinearProgress';\nimport Stack from '@mui/material/Stack';\nimport Tooltip from '@mui/material/Tooltip';\nimport {\n GridRowId,\n GridSlotsComponentsProps,\n GridValidRowModel,\n} from '@mui/x-data-grid-premium';\n\nimport DataGrid from 'components/DataGrid';\nimport Icon from 'components/Icon';\nimport usePopover from 'hooks/usePopover';\nimport useResponsive from 'hooks/useResponsive';\n\nimport BulkActionsBar from './BulkActionsBar';\nimport DataViewHeader from './DataViewHeader';\nimport DataViewMobileContent from './DataViewMobileContent';\nimport DataViewTopbar from './DataViewTopbar';\nimport { DataViewProps } from './props';\nimport {\n ActionsContainer,\n ActionsDivider,\n Container,\n DataGridWrapper,\n Header,\n MobilePaginationContainer,\n MoreActionsPopover,\n SearchContainer,\n SelectionActions,\n SelectionCheckbox,\n SelectionCount,\n SelectionOverlay,\n ToolbarActionsDivider,\n Topbar,\n TopbarDivider,\n} from './styles';\nimport useDataGridSlots from './use-data-grid-slots';\nimport useSelectionState from './use-selection-state';\n\nconst DataViewComponent = <T extends GridValidRowModel = GridValidRowModel>({\n title,\n header,\n headerProps,\n breakpoint = 'md',\n columns,\n rows = [],\n mobileSlots,\n mobileSlotsProps,\n mobileRender,\n rowCount = 0,\n paginationModel = { page: 0, pageSize: 25 },\n onPaginationChange,\n actions,\n moreActions,\n onAdd,\n onSearch,\n searchValue,\n onSearchChange,\n slots,\n slotProps,\n loading,\n fetching,\n fetchingNextPage,\n containerProps = { height: 562, maxHeight: 562 },\n hideFooter,\n showColumnButton = false,\n filterButton,\n activeFilters,\n bulkActions,\n onRowsScrollEnd,\n scrollEndThreshold = 200,\n ...others\n}: DataViewProps<T>) => {\n const popover = usePopover();\n const isMobile = useResponsive('down', breakpoint);\n const [filterButtonEl, setFilterButtonEl] =\n useState<HTMLButtonElement | null>(null);\n const scrollableNodeRef = useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n const node = scrollableNodeRef.current;\n if (!node || !isMobile || !onRowsScrollEnd) return;\n\n const handleScroll = () => {\n const { scrollTop, scrollHeight, clientHeight } = node;\n const distanceToBottom = scrollHeight - scrollTop - clientHeight;\n if (distanceToBottom <= scrollEndThreshold) {\n (onRowsScrollEnd as () => void)();\n }\n };\n\n node.addEventListener('scroll', handleScroll, { passive: true });\n return () => {\n node.removeEventListener('scroll', handleScroll);\n };\n }, [isMobile, onRowsScrollEnd, scrollEndThreshold, rows.length]);\n\n const getRowId = useMemo(\n () =>\n (others.getRowId ?? ((row: GridValidRowModel) => row.id)) as (\n row: GridValidRowModel,\n ) => GridRowId,\n [others.getRowId],\n );\n\n const {\n\n numSelected,\n allSelected,\n someSelected,\n hasBulkActions,\n bulkActionContext,\n clearSelection,\n handleSelectAllToggle,\n } = useSelectionState<T>({\n rows,\n rowSelectionModel: Array.isArray(others.rowSelectionModel)\n ? others.rowSelectionModel\n : undefined,\n onRowSelectionModelChange: others.onRowSelectionModelChange as\n | ((model: GridRowId[], details?: unknown) => void)\n | undefined,\n getRowId,\n bulkActions,\n });\n\n const { dataGridSlots } = useDataGridSlots({\n slots,\n showColumnButton,\n rowCount,\n paginationModel,\n onPaginationChange,\n });\n\n const showSearch = !!onSearch;\n const showAdd = !!onAdd;\n const showActions = !!actions;\n const showMoreActions = !!moreActions;\n const showHeaderMoreActions = isMobile && showMoreActions;\n const showTopbarMoreActions = !isMobile && showMoreActions;\n const showActionsContainer = showActions || showAdd || showHeaderMoreActions;\n const showTopbar =\n showTopbarMoreActions ||\n showSearch ||\n showColumnButton ||\n !!filterButton ||\n !isMobile;\n\n const selectionOverlay = hasBulkActions && numSelected > 0 && (\n <SelectionOverlay>\n <Stack flexDirection=\"row\" alignItems=\"center\" gap={1} flex={1}>\n <Tooltip title=\"Selecione todos nessa pagina\">\n <SelectionCheckbox\n size=\"small\"\n checked={allSelected}\n indeterminate={someSelected}\n onChange={handleSelectAllToggle}\n />\n </Tooltip>\n\n <SelectionCount variant=\"body2\">\n {numSelected} selecionado{numSelected > 1 ? 's' : ''}\n </SelectionCount>\n\n <Tooltip title=\"Desselecionar tudo\">\n <IconButton\n size=\"small\"\n onClick={clearSelection}\n aria-label=\"Desselecionar tudo\"\n sx={{ color: 'primary.main' }}\n >\n <Icon icon=\"CLOSE_MARK_BUTTON\" width={18} height={18} />\n </IconButton>\n </Tooltip>\n </Stack>\n\n <BulkActionsBar\n actions={bulkActions ?? []}\n context={bulkActionContext}\n />\n </SelectionOverlay>\n );\n\n return (\n <Container\n key={loading ? 'loading' : 'data'}\n breakpoint={breakpoint}\n {...containerProps}\n flex={loading ? 1 : undefined}\n minHeight={loading || rows.length === 0 ? 562 : undefined}\n >\n {header ? (\n <Stack p={3} {...headerProps}>\n {header}\n </Stack>\n ) : (\n <>\n <DataViewHeader\n title={title}\n breakpoint={breakpoint}\n actions={actions}\n showActions={showActions}\n showAdd={showAdd}\n showHeaderMoreActions={showHeaderMoreActions}\n showActionsContainer={showActionsContainer}\n onAdd={onAdd}\n onOpenMoreActions={popover.onOpen}\n />\n\n {showTopbar && (\n <DataViewTopbar\n breakpoint={breakpoint}\n isMobile={isMobile}\n showSearch={showSearch}\n showMoreActions={showMoreActions}\n showTopbarMoreActions={showTopbarMoreActions}\n showHeaderMoreActions={showHeaderMoreActions}\n filterButton={filterButton}\n searchValue={searchValue}\n onSearch={onSearch}\n onSearchChange={onSearchChange}\n moreActions={moreActions}\n popover={popover}\n />\n )}\n\n {activeFilters && activeFilters}\n\n {!showTopbar && <TopbarDivider />}\n </>\n )}\n\n {isMobile ? (\n <DataViewMobileContent<T>\n fetching={fetching}\n loading={loading}\n rows={rows}\n mobileSlots={mobileSlots}\n mobileSlotsProps={mobileSlotsProps}\n slots={slots}\n scrollableNodeRef={scrollableNodeRef}\n mobileRender={mobileRender}\n hideFooter={hideFooter}\n onPaginationChange={onPaginationChange}\n rowCount={rowCount}\n paginationModel={paginationModel}\n />\n ) : (\n <DataGridWrapper>\n {selectionOverlay}\n <DataGrid\n columns={columns}\n rows={rows}\n slots={dataGridSlots}\n slotProps={{\n panel: { anchorEl: filterButtonEl },\n toolbar: {\n setFilterButtonEl,\n showQuickFilter: true,\n } as unknown as GridSlotsComponentsProps['toolbar'],\n ...slotProps,\n }}\n columnHeaderHeight={48}\n getRowHeight={() => 68}\n loading={loading}\n fetching={fetching}\n hideFooter={hideFooter}\n onRowsScrollEnd={onRowsScrollEnd}\n scrollEndThreshold={scrollEndThreshold}\n {...others}\n />\n </DataGridWrapper>\n )}\n\n {fetchingNextPage && <LinearProgress />}\n </Container>\n );\n};\n\nexport default memo(DataViewComponent, isEqual) as typeof DataViewComponent;\nexport {\n ActionsContainer,\n ActionsDivider,\n Container,\n DataGridWrapper,\n Header,\n MobilePaginationContainer,\n MoreActionsPopover,\n SearchContainer,\n SelectionActions,\n SelectionCount,\n SelectionOverlay,\n ToolbarActionsDivider,\n Topbar,\n};\nexport type {\n BulkAction,\n BulkActionConfirmation,\n BulkActionContext,\n} from './bulkActions';\nexport { default as DesktopFooter } from './DesktopFooter';\nexport { default as EnhancedMoreActions } from './EnhancedMoreActions';\nexport { default as Toolbar } from './Toolbar';\n","import { useCallback, useMemo, useState } from 'react';\nimport LoadingButton from '@mui/lab/LoadingButton';\nimport { GridValidRowModel } from '@mui/x-data-grid-premium';\n\nimport Confirm from 'components/Confirm';\nimport Icon from 'components/Icon';\nimport { IconName } from 'types/icon';\n\nimport type {\n BulkAction,\n BulkActionConfirmation,\n BulkActionContext,\n} from './bulkActions';\nimport type { BulkActionsBarProps } from './props';\nimport { SelectionActions } from './styles';\n\nconst resolveDynamicBoolean = <T extends GridValidRowModel>(\n value: boolean | ((context: BulkActionContext<T>) => boolean) | undefined,\n context: BulkActionContext<T>,\n) => (typeof value === 'function' ? value(context) : !!value);\n\nconst resolveConfirmation = <T extends GridValidRowModel>(\n confirmation: BulkAction<T>['confirmation'],\n context: BulkActionContext<T>,\n): BulkActionConfirmation | undefined => {\n if (!confirmation) return undefined;\n if (confirmation === true) return {};\n if (typeof confirmation === 'function') return confirmation(context);\n\n return confirmation;\n};\n\nconst BulkActionsBar = <T extends GridValidRowModel>({\n actions,\n context,\n}: BulkActionsBarProps<T>) => {\n const [confirmAction, setConfirmAction] = useState<BulkAction<T> | null>(\n null,\n );\n const [runningActionId, setRunningActionId] = useState<string | null>(null);\n\n const visibleActions = useMemo(\n () =>\n actions.filter(action => !resolveDynamicBoolean(action.hidden, context)),\n [actions, context],\n );\n\n const executeAction = useCallback(\n async (action: BulkAction<T>) => {\n setRunningActionId(action.actionId);\n try {\n await action.handler(context);\n } finally {\n setRunningActionId(null);\n }\n },\n [context],\n );\n\n const handleActionClick = useCallback(\n (action: BulkAction<T>) => {\n if (action.confirmation) {\n setConfirmAction(action);\n return;\n }\n\n void executeAction(action).catch(() => undefined);\n },\n [executeAction],\n );\n\n const handleConfirm = useCallback(async () => {\n if (!confirmAction) return;\n await executeAction(confirmAction);\n setConfirmAction(null);\n }, [confirmAction, executeAction]);\n\n const handleCloseConfirm = useCallback(() => {\n if (runningActionId) return;\n setConfirmAction(null);\n }, [runningActionId]);\n\n const confirmationConfig = resolveConfirmation(confirmAction?.confirmation, context);\n\n return (\n <>\n <SelectionActions>\n {visibleActions.map(action => {\n const disabled =\n !!runningActionId ||\n resolveDynamicBoolean(action.disabled, context);\n const loading = runningActionId === action.actionId;\n\n return (\n <LoadingButton\n key={action.actionId}\n size=\"small\"\n variant=\"text\"\n onClick={() => handleActionClick(action)}\n loading={loading}\n disabled={disabled}\n sx={{ color: 'text.primary' }}\n startIcon={\n typeof action.icon === 'string' ? (\n <Icon icon={action.icon as IconName} />\n ) : (\n action.icon\n )\n }\n >\n {action.label}\n </LoadingButton>\n );\n })}\n </SelectionActions>\n\n {confirmAction && (\n <Confirm\n open\n onClose={handleCloseConfirm}\n onConfirm={() => {\n void handleConfirm().catch(() => undefined);\n }}\n confirming={runningActionId === confirmAction.actionId}\n modalTitle={\n confirmationConfig?.title ??\n `${confirmAction.action ?? 'Excluir'} ${context.selectedCount} ${confirmAction.entityName ?? 'registro'}${context.selectedCount !== 1 ? 's' : ''}?`\n }\n message={\n confirmationConfig?.message ??\n 'Esta ação não poderá ser desfeita.'\n }\n cancelButtonText={confirmationConfig?.cancelButtonText ?? 'Cancelar'}\n confirmButtonText={\n confirmationConfig?.confirmButtonText ?? 'Sim, excluir'\n }\n />\n )}\n </>\n );\n};\n\nexport default BulkActionsBar;\n","\nimport Button from '@mui/material/Button';\nimport Typography from '@mui/material/Typography';\n\nimport Icon from 'components/Icon';\n\nimport { DataViewHeaderProps } from './props';\nimport {\n ActionsContainer,\n ActionsDivider,\n Header,\n} from './styles';\n\nconst DataViewHeader = ({\n title,\n breakpoint,\n actions,\n showActions,\n showAdd,\n showHeaderMoreActions,\n showActionsContainer,\n onAdd,\n onOpenMoreActions,\n}: DataViewHeaderProps) => (\n <Header breakpoint={breakpoint}>\n <Typography variant=\"overline\" color=\"text.secondary\" noWrap>\n {title}\n </Typography>\n\n {showActionsContainer && (\n <ActionsContainer breakpoint={breakpoint}>\n {showActions && actions}\n\n {showAdd && (\n <>\n {showActions && (\n <ActionsDivider orientation=\"vertical\" flexItem />\n )}\n\n <Button\n startIcon={<Icon icon=\"SIMPLE_ADD\" />}\n variant=\"contained\"\n onClick={onAdd}\n >\n Adicionar\n </Button>\n </>\n )}\n\n {showHeaderMoreActions && (\n <>\n {(showActions || showAdd) && (\n <ActionsDivider orientation=\"vertical\" flexItem />\n )}\n\n <Button\n color=\"inherit\"\n startIcon={<Icon icon=\"MORE_BOLD\" />}\n size=\"small\"\n onClick={onOpenMoreActions}\n >\n Mais\n </Button>\n </>\n )}\n </ActionsContainer>\n )}\n </Header>\n);\n\n\nexport default DataViewHeader;\n","import { Fragment } from 'react';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\nimport { GridValidRowModel } from '@mui/x-data-grid-premium';\n\nimport FixedProgressBar from 'components/FixedProgressBar';\nimport Result from 'components/Result';\nimport Scrollbar from 'components/Scrollbar';\n\nimport Pagination from './Pagination';\nimport { DataViewMobileContentProps } from './props';\nimport { LoadingProgress, MobilePaginationContainer } from './styles';\n\nconst DataViewMobileContent = <T extends GridValidRowModel>({\n fetching,\n loading,\n rows,\n mobileSlots,\n mobileSlotsProps,\n slots,\n scrollableNodeRef,\n mobileRender,\n hideFooter,\n onPaginationChange,\n rowCount,\n paginationModel,\n}: DataViewMobileContentProps<T>) => (\n <Result\n isFetching={fetching}\n fetching={<FixedProgressBar />}\n isLoading={loading}\n loading={<LoadingProgress />}\n isEmpty={rows.length === 0}\n empty={\n <Stack flex={1} direction=\"column\" {...mobileSlotsProps}>\n {mobileSlots && mobileSlots}\n\n <Stack flex={1} alignItems=\"center\" justifyContent=\"center\">\n {slots?.noRowsOverlay ? (\n <slots.noRowsOverlay />\n ) : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n Nenhum registro encontrado\n </Typography>\n )}\n </Stack>\n </Stack>\n }\n >\n <Stack direction=\"column\" flex={1} minHeight={0} {...mobileSlotsProps}>\n {mobileSlots && mobileSlots}\n\n <Scrollbar fillContent ref={scrollableNodeRef}>\n {rows.map(row => (\n <Fragment key={(row as unknown as { id: string }).id}>\n {mobileRender(row)}\n </Fragment>\n ))}\n </Scrollbar>\n </Stack>\n\n {!hideFooter && onPaginationChange && (\n <MobilePaginationContainer>\n <Pagination\n count={rowCount}\n page={paginationModel.page}\n rowsPerPage={paginationModel.pageSize}\n onPageChange={newPage =>\n onPaginationChange?.(newPage, paginationModel.pageSize)\n }\n onRowsPerPageChange={newRowsPerPage =>\n onPaginationChange?.(paginationModel.page, newRowsPerPage)\n }\n />\n </MobilePaginationContainer>\n )}\n </Result>\n);\n\n\nexport default DataViewMobileContent;\n","import Button from '@mui/material/Button';\nimport Stack from '@mui/material/Stack';\n\nimport Icon from 'components/Icon';\nimport SearchInput from 'components/SearchInput';\n\nimport { DATAGRID_ACTIONS } from './contants';\nimport EnhancedMoreActions from './EnhancedMoreActions';\nimport { DataViewTopbarProps } from './props';\nimport {\n MoreActionsPopover,\n SearchContainer,\n ToolbarActionsDivider,\n Topbar,\n} from './styles';\n\nconst DataViewTopbar = ({\n breakpoint,\n isMobile,\n showSearch,\n showMoreActions,\n showTopbarMoreActions,\n showHeaderMoreActions,\n filterButton,\n searchValue,\n onSearch,\n onSearchChange,\n moreActions,\n popover,\n}: DataViewTopbarProps) => (\n <Topbar breakpoint={breakpoint}>\n <Stack\n flex={1}\n direction=\"row\"\n alignItems=\"center\"\n id={DATAGRID_ACTIONS}\n gap={0.5}\n >\n {showMoreActions && (\n <>\n {showTopbarMoreActions && (\n <>\n <Button\n color=\"inherit\"\n startIcon={<Icon icon=\"MORE_BOLD\" />}\n size=\"small\"\n onClick={popover.onOpen}\n >\n Mais\n </Button>\n\n {!isMobile && (\n <ToolbarActionsDivider orientation=\"vertical\" flexItem />\n )}\n </>\n )}\n\n {(showTopbarMoreActions || showHeaderMoreActions) && (\n <MoreActionsPopover\n open={popover.open}\n anchorEl={popover.open}\n onClose={popover.onClose}\n disabledArrow={true}\n >\n <EnhancedMoreActions onClose={popover.onClose}>\n {moreActions}\n </EnhancedMoreActions>\n </MoreActionsPopover>\n )}\n </>\n )}\n\n {!isMobile && filterButton && (\n <>\n {filterButton}\n\n {showTopbarMoreActions && (\n <ToolbarActionsDivider orientation=\"vertical\" flexItem />\n )}\n </>\n )}\n </Stack>\n\n {showSearch && (\n <SearchContainer breakpoint={breakpoint}>\n <SearchInput\n value={searchValue}\n placeholder=\"Buscar\"\n onSearch={v => onSearch!(v ?? '')}\n onChange={e => onSearchChange?.(e.target.value)}\n size=\"small\"\n fullWidth\n iconPosition=\"start\"\n />\n {isMobile && filterButton && <Stack ml={1}>{filterButton}</Stack>}\n </SearchContainer>\n )}\n </Topbar>\n);\n\n\nexport default DataViewTopbar;\n","export const DATAGRID_ACTIONS = 'datagrid-actions';\n","import {\n Children,\n cloneElement,\n isValidElement,\n memo,\n ReactElement,\n ReactNode,\n} from 'react';\n\nimport { EnhancedMoreActionsProps } from './props';\n\nconst createEnhanceMoreActions = (\n children: ReactNode,\n onClose: () => void,\n): ReactNode => {\n return Children.map(children, child => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const originalOnClick = (\n child.props as { onClick?: (...args: unknown[]) => void }\n ).onClick;\n\n const enhancedProps: {\n onClick?: (...args: unknown[]) => void;\n children?: ReactNode;\n } = {};\n\n enhancedProps.onClick = (...args: unknown[]) => {\n onClose();\n if (originalOnClick) {\n originalOnClick(...args);\n }\n };\n\n const childProps = child.props as { children?: ReactNode };\n if (childProps?.children) {\n enhancedProps.children = createEnhanceMoreActions(\n childProps.children,\n onClose,\n );\n }\n\n return cloneElement(child as ReactElement, enhancedProps);\n });\n};\n\nconst EnhancedMoreActions = ({\n children,\n onClose,\n}: EnhancedMoreActionsProps) => {\n if (!children) return null;\n return createEnhanceMoreActions(children, onClose);\n};\n\nexport default memo(EnhancedMoreActions);\n","import { useCallback, useMemo } from 'react';\n\nimport DesktopFooter from './DesktopFooter';\nimport { DataGridSlotsProps } from './props';\nimport { UseDataGridSlotsProps, UseDataGridSlotsReturn } from './props';\nimport Toolbar from './Toolbar';\n\nconst useDataGridSlots = ({\n slots,\n showColumnButton,\n rowCount,\n paginationModel,\n onPaginationChange,\n}: UseDataGridSlotsProps): UseDataGridSlotsReturn => {\n const FooterComponent = useCallback(() => {\n if (onPaginationChange) {\n return (\n <DesktopFooter\n rowCount={rowCount}\n page={paginationModel.page}\n rowsPerPage={paginationModel.pageSize}\n onPaginationChange={onPaginationChange}\n />\n );\n }\n return null;\n }, [rowCount, paginationModel, onPaginationChange]);\n\n const dataGridSlots: DataGridSlotsProps = useMemo(\n () => ({\n ...slots,\n footer: FooterComponent as unknown as DataGridSlotsProps['footer'],\n ...(showColumnButton &&\n !slots?.toolbar && {\n toolbar: Toolbar as unknown as DataGridSlotsProps['toolbar'],\n }),\n }),\n [slots, FooterComponent, showColumnButton],\n );\n\n return { dataGridSlots };\n};\n\n\nexport default useDataGridSlots;\n","import { memo } from 'react';\nimport Stack from '@mui/material/Stack';\nimport Typography from '@mui/material/Typography';\n\nimport Pagination from './Pagination';\nimport { DesktopFooterProps } from './props';\nimport { DesktopPaginationContainer } from './styles';\n\nconst DesktopFooter = ({\n rowCount,\n page,\n rowsPerPage,\n onPaginationChange,\n}: DesktopFooterProps) => {\n return (\n <DesktopPaginationContainer>\n <Stack direction=\"row\" alignItems=\"center\" gap={0.5}>\n <Typography variant=\"body2\" color=\"text.disabled\">\n Total de itens:\n </Typography>\n <Typography variant=\"body2\">{rowCount}</Typography>\n </Stack>\n\n <Pagination\n count={rowCount}\n page={page}\n rowsPerPage={rowsPerPage}\n onPageChange={newPage => onPaginationChange(newPage, rowsPerPage)}\n onRowsPerPageChange={newRowsPerPage =>\n onPaginationChange(page, newRowsPerPage)\n }\n />\n </DesktopPaginationContainer>\n );\n};\n\nexport default memo(DesktopFooter);\n","import { forwardRef, useCallback } from 'react';\nimport Button, { ButtonProps } from '@mui/material/Button';\nimport { GridToolbarColumnsButton } from '@mui/x-data-grid-premium';\n\nimport Icon from 'components/Icon';\nimport Portal from 'components/Portal';\n\nimport { DATAGRID_ACTIONS } from './contants';\nimport { ToolbarProps } from './props';\n\nconst ColumnsButton = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ children, ...props }, ref) => (\n <Button\n {...props}\n ref={ref}\n color=\"inherit\"\n startIcon={<Icon icon=\"COLUMNS\" />}\n >\n {children ?? 'Colunas'}\n </Button>\n ),\n);\n\nColumnsButton.displayName = 'ColumnsButton';\n\nconst Toolbar = ({ setFilterButtonEl }: ToolbarProps) => {\n const handleColumnsButtonRef = useCallback(\n (button: HTMLButtonElement | null) => {\n setFilterButtonEl(button);\n },\n [setFilterButtonEl],\n );\n\n return (\n <Portal container={DATAGRID_ACTIONS}>\n <GridToolbarColumnsButton\n ref={handleColumnsButtonRef}\n slotProps={{\n button: {\n color: 'inherit',\n startIcon: <Icon icon=\"COLUMNS\" />,\n children: 'Colunas',\n },\n }}\n />\n </Portal>\n );\n};\n\nexport default Toolbar;\n","import { ChangeEvent, useCallback, useMemo } from 'react';\nimport { GridRowId, GridValidRowModel } from '@mui/x-data-grid-premium';\n\nimport type { BulkAction, BulkActionContext } from './bulkActions';\n\ninterface UseSelectionStateProps<T extends GridValidRowModel> {\n rows: readonly T[];\n rowSelectionModel: GridRowId[] | undefined;\n onRowSelectionModelChange:\n | ((model: GridRowId[], details?: unknown) => void)\n | undefined;\n getRowId: (row: GridValidRowModel) => GridRowId;\n bulkActions: BulkAction<T>[] | undefined;\n}\n\ninterface UseSelectionStateReturn<T extends GridValidRowModel> {\n selectionModel: GridRowId[];\n numSelected: number;\n allSelected: boolean;\n someSelected: boolean;\n hasBulkActions: boolean;\n bulkActionContext: BulkActionContext<T>;\n clearSelection: () => void;\n handleSelectAllToggle: (\n event: ChangeEvent<HTMLInputElement>,\n checked: boolean,\n ) => void;\n}\n\nconst useSelectionState = <T extends GridValidRowModel>({\n rows,\n rowSelectionModel,\n onRowSelectionModelChange,\n getRowId,\n bulkActions,\n}: UseSelectionStateProps<T>): UseSelectionStateReturn<T> => {\n const selectionModel = useMemo(() => {\n if (Array.isArray(rowSelectionModel)) return rowSelectionModel;\n return [];\n }, [rowSelectionModel]);\n\n const numSelected = selectionModel.length;\n\n const pageRowIds = useMemo(\n () => rows.map(row => getRowId(row)),\n [rows, getRowId],\n );\n\n const pageRowIdSet = useMemo(() => new Set(pageRowIds), [pageRowIds]);\n\n const selectedOnPageCount = useMemo(\n () =>\n selectionModel.reduce<number>(\n (count, id) => count + (pageRowIdSet.has(id) ? 1 : 0),\n 0,\n ),\n [selectionModel, pageRowIdSet],\n );\n\n const allSelected =\n pageRowIds.length > 0 && selectedOnPageCount === pageRowIds.length;\n const someSelected = selectedOnPageCount > 0 && !allSelected;\n\n const emitRowSelectionChange = useCallback(\n (nextSelection: GridRowId[]) => {\n if (!onRowSelectionModelChange) return;\n onRowSelectionModelChange(nextSelection);\n },\n [onRowSelectionModelChange],\n );\n\n const clearSelection = useCallback(() => {\n emitRowSelectionChange([]);\n }, [emitRowSelectionChange]);\n\n const selectedIdSet = useMemo(\n () => new Set(selectionModel),\n [selectionModel],\n );\n\n const selectedRowsInPage = useMemo(\n () => rows.filter(row => selectedIdSet.has(getRowId(row))) as T[],\n [rows, selectedIdSet, getRowId],\n );\n\n const bulkActionContext: BulkActionContext<T> = useMemo(\n () => ({\n selectedIds: selectionModel,\n selectedRowsInPage: selectedRowsInPage as T[],\n selectedCount: numSelected,\n clearSelection,\n }),\n [selectionModel, selectedRowsInPage, numSelected, clearSelection],\n );\n\n const hasBulkActions = !!bulkActions?.length;\n\n const handleSelectAllToggle = useCallback(\n (_event: ChangeEvent<HTMLInputElement>, checked: boolean) => {\n if (!onRowSelectionModelChange) return;\n\n if (checked) {\n const selectedIds = new Set(selectionModel);\n const nextSelection = [...selectionModel];\n pageRowIds.forEach(id => {\n if (!selectedIds.has(id)) nextSelection.push(id);\n });\n emitRowSelectionChange(nextSelection);\n return;\n }\n\n const nextSelection = selectionModel.filter(id => !pageRowIdSet.has(id));\n emitRowSelectionChange(nextSelection);\n },\n [\n onRowSelectionModelChange,\n selectionModel,\n pageRowIds,\n pageRowIdSet,\n emitRowSelectionChange,\n ],\n );\n\n return {\n selectionModel,\n numSelected,\n allSelected,\n someSelected,\n hasBulkActions,\n bulkActionContext,\n clearSelection,\n handleSelectAllToggle,\n };\n};\n\nexport type { UseSelectionStateProps, UseSelectionStateReturn };\nexport default useSelectionState;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a } from './chunk-UVPQR2Q2.js';
|
|
2
2
|
import { a as a$1 } from './chunk-CO2KQFUN.js';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import P from '@mui/material/Checkbox';
|
|
4
|
+
import w from '@mui/material/CircularProgress';
|
|
5
5
|
import i from '@mui/material/Divider';
|
|
6
6
|
import n from '@mui/material/Stack';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
@@ -10,7 +10,7 @@ import { useCallback, useMemo } from 'react';
|
|
|
10
10
|
import v from '@mui/material/TablePagination';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
|
|
13
|
-
var $=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:o.palette.divider}})),z=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:o.spacing(3,3,0),gap:o.spacing(3),[o.breakpoints.down(e)]:{padding:o.spacing(2,2,0)}})),F=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({flexDirection:"row",alignItems:"center",gap:o.spacing(1.5),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}}}})),L=styled(i)(({theme:o})=>({borderStyle:"dashed",height:o.spacing(2),margin:"auto"})),j=styled(i)(({theme:o})=>({borderStyle:"dashed",height:o.spacing(1.5),marginTop:"auto",marginBottom:"auto"})),R=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({position:"relative",padding:o.spacing(2),flexDirection:"row",alignItems:"center",color:o.palette.text.secondary,[o.breakpoints.down(e)]:{padding:o.spacing(1.5,2),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}}}}})),E=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({width:320,flexDirection:"row",alignItems:"center",justifyContent:"center",[o.breakpoints.down(e)]:{width:"100%",zIndex:1,"& fieldset, & input":{display:"flex"},"& .MuiInputAdornment-root":{marginLeft:0}}})),g=styled(n)(({theme:o})=>({"& .MuiToolbar-root":{height:24,minHeight:24,overflow:"hidden",[o.breakpoints.down("sm")]:{height:"auto",flexWrap:"wrap",justifyContent:"center"}}})),G=styled(n)(({theme:o})=>({minHeight:60,alignItems:"flex-end",justifyContent:"center",borderTop:`1px solid ${o.palette.divider}`,[o.breakpoints.down("sm")]:{minHeight:"auto"}})),N=styled(n)(({theme:o})=>({flexDirection:"row",height:60,alignItems:"center",justifyContent:"space-between",borderTop:`1px solid ${o.palette.divider}`,gap:o.spacing(2),padding:o.spacing(2)})),O=styled(n)({position:"relative",flex:1,minHeight:0}),_=styled(n)(({theme:o})=>({flexDirection:"row",alignItems:"center",padding:`0 ${o.spacing(3)}`,top:0,left:0,width:"100%",zIndex:9,height:48,position:"absolute",backgroundColor:o.palette.primary.lighter})),q=styled(k)(({theme:o})=>({
|
|
13
|
+
var $=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:o.palette.divider}})),z=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:o.spacing(3,3,0),gap:o.spacing(3),[o.breakpoints.down(e)]:{padding:o.spacing(2,2,0)}})),F=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({flexDirection:"row",alignItems:"center",gap:o.spacing(1.5),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}}}})),L=styled(i)(({theme:o})=>({borderStyle:"dashed",height:o.spacing(2),margin:"auto"})),j=styled(i)(({theme:o})=>({borderStyle:"dashed",height:o.spacing(1.5),marginTop:"auto",marginBottom:"auto"})),R=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({position:"relative",padding:o.spacing(2),flexDirection:"row",alignItems:"center",color:o.palette.text.secondary,[o.breakpoints.down(e)]:{padding:o.spacing(1.5,2),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}}}}})),E=styled(n,{shouldForwardProp:o=>o!=="breakpoint"})(({theme:o,breakpoint:e})=>({width:320,flexDirection:"row",alignItems:"center",justifyContent:"center",[o.breakpoints.down(e)]:{width:"100%",zIndex:1,"& fieldset, & input":{display:"flex"},"& .MuiInputAdornment-root":{marginLeft:0}}})),g=styled(n)(({theme:o})=>({"& .MuiToolbar-root":{height:24,minHeight:24,overflow:"hidden",[o.breakpoints.down("sm")]:{height:"auto",flexWrap:"wrap",justifyContent:"center"}}})),G=styled(n)(({theme:o})=>({minHeight:60,alignItems:"flex-end",justifyContent:"center",borderTop:`1px solid ${o.palette.divider}`,[o.breakpoints.down("sm")]:{minHeight:"auto"}})),N=styled(n)(({theme:o})=>({flexDirection:"row",height:60,alignItems:"center",justifyContent:"space-between",borderTop:`1px solid ${o.palette.divider}`,gap:o.spacing(2),padding:o.spacing(2)})),O=styled(n)({position:"relative",flex:1,minHeight:0}),_=styled(n)(({theme:o})=>({flexDirection:"row",alignItems:"center",padding:`0 ${o.spacing(3)}`,top:0,left:0,width:"100%",zIndex:9,height:48,position:"absolute",backgroundColor:o.palette.primary.lighter})),q=styled(k)(({theme:o})=>({color:o.palette.primary.main,fontWeight:600})),J=styled(n)(({theme:o})=>({flexDirection:"row",alignItems:"center",gap:o.spacing(1)})),K=styled(P)({marginLeft:-6}),Q=styled(a$1)({minWidth:160}),U=styled(i)(({theme:o})=>({marginTop:o.spacing(2)})),V=styled(w)({margin:"160px auto"});var D=({count:o,page:e,rowsPerPage:r,onPageChange:a,onRowsPerPageChange:p})=>{let s=Math.ceil(o/r)||1,u=useCallback((d,h)=>{a(h);},[a]),x=useCallback(d=>{p(Number(d.target.value));},[p]),b=useMemo(()=>`P\xE1gina ${e+1} de ${s}`,[e,s]);return jsx(g,{"aria-label":b,"aria-live":"polite",role:"navigation",children:jsx(v,{color:"primary",component:"div",size:"small",count:o,page:e,rowsPerPage:r,onPageChange:u,onRowsPerPageChange:x})})},to=D;
|
|
14
14
|
|
|
15
15
|
export { $ as a, z as b, F as c, L as d, j as e, R as f, E as g, G as h, N as i, O as j, _ as k, q as l, J as m, K as n, Q as o, U as p, V as q, to as r };
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-XUDTPZHF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DataView/styles.ts","../src/components/DataView/Pagination.tsx"],"names":["Checkbox","CircularProgress","Divider","Stack","styled","Typography","Container","Panel_default","prop","theme","breakpoint","Header","ActionsContainer","ActionsDivider","ToolbarActionsDivider","Topbar","SearchContainer","PaginationContainer","MobilePaginationContainer","DesktopPaginationContainer","DataGridWrapper","SelectionOverlay","SelectionCount","SelectionActions","SelectionCheckbox","MoreActionsPopover","MenuPopover_default","TopbarDivider","LoadingProgress","useCallback","useMemo","MuiPagination","jsx","Pagination","count","page","rowsPerPage","onPageChange","onRowsPerPageChange","totalPages","handlePageChange","_","newPage","handleRowsPerPageChange","event","ariaLabel","Pagination_default"],"mappings":"gFAAA,OAAOA,MAAc,yBACrB,OAAOC,MAAsB,iCAC7B,OAAOC,MAAa,wBACpB,OAAOC,MAA2B,sBAClC,OAAS,UAAAC,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C5B,EAAE,EAEWmB,EAAkBxB,EAAOH,CAAgB,EAAE,CACtD,OAAQ,YACV,CAAC,EC1ND,OAAS,eAAA4B,EAAa,WAAAC,MAAe,QACrC,OAAOC,MAAmB,gCAuCpB,cAAAC,MAAA,oBAlCN,IAAMC,EAAa,CAAC,CAClB,MAAAC,EACA,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,oBAAAC,CACF,IAAuB,CACrB,IAAMC,EAAa,KAAK,KAAKL,EAAQE,CAAW,GAAK,EAE/CI,EAAmBX,EACvB,CAACY,EAAYC,IAAoB,CAC/BL,EAAaK,CAAO,CACtB,EACA,CAACL,CAAY,CACf,EAEMM,EAA0Bd,EAC7Be,GAA+C,CAC9CN,EAAoB,OAAOM,EAAM,OAAO,KAAK,CAAC,CAChD,EACA,CAACN,CAAmB,CACtB,EAEMO,EAAYf,EAChB,IAAM,aAAUK,EAAO,QAAQI,IAC/B,CAACJ,EAAMI,CAAU,CACnB,EAEA,OACEP,EAACf,EAAA,CACC,aAAY4B,EACZ,YAAU,SACV,KAAK,aAEL,SAAAb,EAACD,EAAA,CACC,MAAM,UACN,UAAU,MACV,KAAK,QACL,MAAOG,EACP,KAAMC,EACN,YAAaC,EACb,aAAcI,EACd,oBAAqBG,EACvB,EACF,CAEJ,EAEOG,GAAQb","sourcesContent":["import Checkbox from '@mui/material/Checkbox';\nimport CircularProgress from '@mui/material/CircularProgress';\nimport Divider from '@mui/material/Divider';\nimport Stack, { StackProps } from '@mui/material/Stack';\nimport { styled } from '@mui/material/styles';\nimport { Breakpoint } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport MenuPopover from 'components/MenuPopover';\nimport Panel from 'components/Panel';\n\nexport interface DefaultProps {\n breakpoint: Breakpoint | number;\n}\n\nexport interface ContainerProps extends StackProps {\n breakpoint: Breakpoint | number;\n}\n\nexport const Container = styled(Panel, {\n shouldForwardProp: prop => prop !== 'breakpoint',\n})<ContainerProps>(({ theme, breakpoint }) => ({\n position: 'relative',\n borderRadius: 12,\n padding: 0,\n gap: 0,\n overflow: 'hidden',\n\n [theme.breakpoints.down(breakpoint)]: {\n borderColor: theme.palette.divider,\n },\n}));\n\nexport const Header = styled(Stack, {\n shouldForwardProp: prop => prop !== 'breakpoint',\n})<DefaultProps>(({ theme, breakpoint }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: theme.spacing(3, 3, 0),\n gap: theme.spacing(3),\n\n [theme.breakpoints.down(breakpoint)]: {\n padding: theme.spacing(2, 2, 0),\n },\n}));\n\nexport const ActionsContainer = styled(Stack, {\n shouldForwardProp: prop => prop !== 'breakpoint',\n})<DefaultProps>(({ theme, breakpoint }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(1.5),\n color: theme.palette.text.secondary,\n\n [theme.breakpoints.down(breakpoint)]: {\n '& button, & a': {\n textIndent: '-9999em',\n fontSize: 0,\n minWidth: 36,\n maxWidth: 36,\n height: 36,\n width: 36,\n overflow: 'hidden',\n\n '& .MuiButton-icon': {\n margin: 0,\n },\n },\n },\n}));\n\nexport const ActionsDivider = styled(Divider)(({ theme }) => ({\n borderStyle: 'dashed',\n height: theme.spacing(2),\n margin: 'auto',\n}));\n\nexport const ToolbarActionsDivider = styled(Divider)(({ theme }) => ({\n borderStyle: 'dashed',\n height: theme.spacing(1.5),\n marginTop: 'auto',\n marginBottom: 'auto',\n}));\n\nexport const Topbar = styled(Stack, {\n shouldForwardProp: prop => prop !== 'breakpoint',\n})<DefaultProps>(({ theme, breakpoint }) => ({\n position: 'relative',\n padding: theme.spacing(2),\n flexDirection: 'row',\n alignItems: 'center',\n color: theme.palette.text.secondary,\n\n [theme.breakpoints.down(breakpoint)]: {\n padding: theme.spacing(1.5, 2),\n borderBottom: `1px solid ${theme.palette.divider}`,\n minHeight: 60,\n\n [theme.breakpoints.down(breakpoint)]: {\n '& button': {\n textIndent: '-9999em',\n fontSize: 0,\n minWidth: 36,\n maxWidth: 36,\n height: 36,\n width: 36,\n overflow: 'hidden',\n\n '& .MuiButton-icon': {\n margin: 0,\n },\n },\n },\n },\n}));\n\nexport const SearchContainer = styled(Stack, {\n shouldForwardProp: prop => prop !== 'breakpoint',\n})<DefaultProps>(({ theme, breakpoint }) => ({\n width: 320,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n\n [theme.breakpoints.down(breakpoint)]: {\n width: '100%',\n zIndex: 1,\n\n '& fieldset, & input': {\n display: 'flex',\n },\n\n '& .MuiInputAdornment-root': {\n marginLeft: 0,\n },\n },\n}));\n\nexport const PaginationContainer = styled(Stack)(({ theme }) => ({\n '& .MuiToolbar-root': {\n height: 24,\n minHeight: 24,\n overflow: 'hidden',\n\n [theme.breakpoints.down('sm')]: {\n height: 'auto',\n flexWrap: 'wrap',\n justifyContent: 'center',\n },\n },\n}));\n\nexport const MobilePaginationContainer = styled(Stack)(({ theme }) => ({\n minHeight: 60,\n alignItems: 'flex-end',\n justifyContent: 'center',\n borderTop: `1px solid ${theme.palette.divider}`,\n\n [theme.breakpoints.down('sm')]: {\n minHeight: 'auto',\n },\n}));\n\nexport const DesktopPaginationContainer = styled(Stack)(({ theme }) => ({\n flexDirection: 'row',\n height: 60,\n alignItems: 'center',\n justifyContent: 'space-between',\n borderTop: `1px solid ${theme.palette.divider}`,\n gap: theme.spacing(2),\n padding: theme.spacing(2),\n}));\n\nexport const DataGridWrapper = styled(Stack)({\n position: 'relative',\n flex: 1,\n minHeight: 0,\n});\n\nexport const SelectionOverlay = styled(Stack)(({ theme }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n padding: `0 ${theme.spacing(3)}`,\n top: 0,\n left: 0,\n width: '100%',\n zIndex: 9,\n height: 48,\n position: 'absolute',\n backgroundColor: theme.palette.primary.lighter,\n}));\n\nexport const SelectionCount = styled(Typography)(({ theme }) => ({\n color: theme.palette.primary.main,\n fontWeight: 600,\n}));\n\nexport const SelectionActions = styled(Stack)(({ theme }) => ({\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(1),\n}));\n\nexport const SelectionCheckbox = styled(Checkbox)({\n marginLeft: -6,\n});\n\nexport const MoreActionsPopover = styled(MenuPopover)({\n minWidth: 160,\n});\n\nexport const TopbarDivider = styled(Divider)(({ theme }) => ({\n marginTop: theme.spacing(2),\n}));\n\nexport const LoadingProgress = styled(CircularProgress)({\n margin: '160px auto',\n});\n","import { useCallback, useMemo } from 'react';\nimport MuiPagination from '@mui/material/TablePagination';\n\nimport { PaginationProps } from './props';\nimport { PaginationContainer } from './styles';\n\nconst Pagination = ({\n count,\n page,\n rowsPerPage,\n onPageChange,\n onRowsPerPageChange,\n}: PaginationProps) => {\n const totalPages = Math.ceil(count / rowsPerPage) || 1;\n\n const handlePageChange = useCallback(\n (_: unknown, newPage: number) => {\n onPageChange(newPage);\n },\n [onPageChange],\n );\n\n const handleRowsPerPageChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n onRowsPerPageChange(Number(event.target.value));\n },\n [onRowsPerPageChange],\n );\n\n const ariaLabel = useMemo(\n () => `Página ${page + 1} de ${totalPages}`,\n [page, totalPages],\n );\n\n return (\n <PaginationContainer\n aria-label={ariaLabel}\n aria-live=\"polite\"\n role=\"navigation\"\n >\n <MuiPagination\n color=\"primary\"\n component=\"div\"\n size=\"small\"\n count={count}\n page={page}\n rowsPerPage={rowsPerPage}\n onPageChange={handlePageChange}\n onRowsPerPageChange={handleRowsPerPageChange}\n />\n </PaginationContainer>\n );\n};\n\nexport default Pagination;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a } from '../../chunk-OFOIKKG2.js';
|
|
2
|
-
import { r } from '../../chunk-
|
|
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';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { a as default } from '../../chunk-
|
|
1
|
+
export { a as default } from '../../chunk-PRWQQJDL.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -7,15 +7,16 @@ import { StackProps } from '@mui/material/Stack';
|
|
|
7
7
|
import * as _mui_material_styles from '@mui/material/styles';
|
|
8
8
|
import { Breakpoint } from '@mui/material/styles';
|
|
9
9
|
import { DataGridProps } from '../../types/dataGridProps.js';
|
|
10
|
-
import { B as BulkAction } from '../../bulkActions-
|
|
11
|
-
export { a as BulkActionConfirmation, b as BulkActionContext } from '../../bulkActions-
|
|
10
|
+
import { B as BulkAction } from '../../bulkActions-29cd56a9.js';
|
|
11
|
+
export { a as BulkActionConfirmation, b as BulkActionContext } from '../../bulkActions-29cd56a9.js';
|
|
12
|
+
import { M as MenuPopoverProps } from '../../props-3c1ceae1.js';
|
|
12
13
|
import * as _mui_material_Typography from '@mui/material/Typography';
|
|
13
14
|
import * as _mui_material_Divider from '@mui/material/Divider';
|
|
14
15
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
15
16
|
import * as _emotion_styled from '@emotion/styled';
|
|
16
17
|
import * as _mui_system from '@mui/system';
|
|
17
18
|
import { P as PanelProps } from '../../props-a62a2c29.js';
|
|
18
|
-
import '@mui/material/
|
|
19
|
+
import '@mui/material/Popover';
|
|
19
20
|
|
|
20
21
|
interface DataViewProps<T extends GridValidRowModel = GridValidRowModel> extends DataGridProps {
|
|
21
22
|
containerProps?: StackProps;
|
|
@@ -53,10 +54,6 @@ interface EnhancedMoreActionsProps extends PropsWithChildren {
|
|
|
53
54
|
onClose: () => void;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
declare const _default$2: react.MemoExoticComponent<({ rowCount, page, rowsPerPage, onPaginationChange, }: DesktopFooterProps) => react_jsx_runtime.JSX.Element>;
|
|
57
|
-
|
|
58
|
-
declare const _default$1: react.MemoExoticComponent<({ children, onClose, }: EnhancedMoreActionsProps) => ReactNode>;
|
|
59
|
-
|
|
60
57
|
interface DefaultProps {
|
|
61
58
|
breakpoint: Breakpoint | number;
|
|
62
59
|
}
|
|
@@ -97,9 +94,14 @@ declare const SelectionCount: _emotion_styled.StyledComponent<_mui_material_Typo
|
|
|
97
94
|
declare const SelectionActions: _emotion_styled.StyledComponent<_mui_material_Stack.StackOwnProps & _mui_material_OverridableComponent.CommonProps & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
98
95
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
99
96
|
}, keyof _mui_material_OverridableComponent.CommonProps | keyof _mui_material_Stack.StackOwnProps> & _mui_system.MUIStyledCommonProps<_mui_material_styles.Theme>, {}, {}>;
|
|
97
|
+
declare const MoreActionsPopover: _emotion_styled.StyledComponent<MenuPopoverProps & _mui_system.MUIStyledCommonProps<_mui_material_styles.Theme>, {}, {}>;
|
|
98
|
+
|
|
99
|
+
declare const _default$2: react.MemoExoticComponent<({ rowCount, page, rowsPerPage, onPaginationChange, }: DesktopFooterProps) => react_jsx_runtime.JSX.Element>;
|
|
100
|
+
|
|
101
|
+
declare const _default$1: react.MemoExoticComponent<({ children, onClose, }: EnhancedMoreActionsProps) => ReactNode>;
|
|
100
102
|
|
|
101
103
|
declare const Toolbar: ({ setFilterButtonEl }: ToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
102
104
|
|
|
103
105
|
declare const _default: <T extends GridValidRowModel = GridValidRowModel>({ title, header, headerProps, breakpoint, columns, rows, mobileSlots, mobileSlotsProps, mobileRender, rowCount, paginationModel, onPaginationChange, actions, moreActions, onAdd, onSearch, searchValue, onSearchChange, slots, slotProps, loading, fetching, fetchingNextPage, containerProps, hideFooter, showColumnButton, filterButton, activeFilters, bulkActions, onRowsScrollEnd, scrollEndThreshold, ...others }: DataViewProps<T>) => react_jsx_runtime.JSX.Element;
|
|
104
106
|
|
|
105
|
-
export { ActionsContainer, ActionsDivider, BulkAction, Container, DataGridWrapper, _default$2 as DesktopFooter, _default$1 as EnhancedMoreActions, Header, MobilePaginationContainer, SearchContainer, SelectionActions, SelectionCount, SelectionOverlay, Toolbar, ToolbarActionsDivider, Topbar, _default as default };
|
|
107
|
+
export { ActionsContainer, ActionsDivider, BulkAction, Container, DataGridWrapper, _default$2 as DesktopFooter, _default$1 as EnhancedMoreActions, Header, MobilePaginationContainer, MoreActionsPopover, SearchContainer, SelectionActions, SelectionCount, SelectionOverlay, Toolbar, ToolbarActionsDivider, Topbar, _default as default };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as DesktopFooter, a as EnhancedMoreActions, c as Toolbar, d as default } from '../../chunk-XLNJJJ7D.js';
|
|
2
2
|
import '../../chunk-PVI5BAUW.js';
|
|
3
3
|
import '../../chunk-IJZCVZ32.js';
|
|
4
4
|
import '../../chunk-IDFJFFIV.js';
|
|
5
5
|
import '../../chunk-6U5LS7MP.js';
|
|
6
6
|
import '../../chunk-BNBE2OMA.js';
|
|
7
7
|
import '../../chunk-NIQW2J3M.js';
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
export { c as ActionsContainer, d as ActionsDivider, a as Container, j as DataGridWrapper, b as Header, h as MobilePaginationContainer, g as SearchContainer, m as SelectionActions, l as SelectionCount, k as SelectionOverlay, e as ToolbarActionsDivider, f as Topbar } from '../../chunk-
|
|
8
|
+
import '../../chunk-PRWQQJDL.js';
|
|
9
|
+
export { c as ActionsContainer, d as ActionsDivider, a as Container, j as DataGridWrapper, b as Header, h as MobilePaginationContainer, o as MoreActionsPopover, g as SearchContainer, m as SelectionActions, l as SelectionCount, k as SelectionOverlay, e as ToolbarActionsDivider, f as Topbar } from '../../chunk-XUDTPZHF.js';
|
|
10
10
|
import '../../chunk-UVPQR2Q2.js';
|
|
11
11
|
import '../../chunk-RBTYTONM.js';
|
|
12
12
|
import '../../chunk-F65ZXAGV.js';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { B as BulkAction } from '../../bulkActions-29cd56a9.js';
|
|
2
|
+
export { a as BulkActionConfirmation, b as BulkActionContext } from '../../bulkActions-29cd56a9.js';
|
|
1
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
4
|
import * as react from 'react';
|
|
3
5
|
import { MouseEvent, ReactNode, ReactElement } from 'react';
|
|
@@ -6,11 +8,8 @@ import { Field, EntityMetadataResponse } from '../../types/entityMetadata.js';
|
|
|
6
8
|
import { Filter, Sort } from '../../types/filter.js';
|
|
7
9
|
export { FilterConditional, FilterGroup, FilterOperator, FilterState, FilterValue, GridQuery, SortType } from '../../types/filter.js';
|
|
8
10
|
import { PagedResponse } from '../../types/api.js';
|
|
9
|
-
import { B as BulkAction } from '../../bulkActions-3ec5afc1.js';
|
|
10
|
-
export { a as BulkActionConfirmation, b as BulkActionContext } from '../../bulkActions-3ec5afc1.js';
|
|
11
11
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
12
12
|
import { Icon } from '../../types/icon.js';
|
|
13
|
-
import '@mui/material/Button';
|
|
14
13
|
|
|
15
14
|
interface StatusRendererProps {
|
|
16
15
|
active: boolean;
|
|
@@ -3,17 +3,17 @@ import '../../chunk-4P2L7UJA.js';
|
|
|
3
3
|
import { a as a$1 } from '../../chunk-LG2B5RFV.js';
|
|
4
4
|
import { d, c } from '../../chunk-N7IK5EUP.js';
|
|
5
5
|
import { h, a as a$3 } from '../../chunk-OF6623HG.js';
|
|
6
|
-
import { d as d$1 } from '../../chunk-
|
|
6
|
+
import { d as d$1 } from '../../chunk-XLNJJJ7D.js';
|
|
7
7
|
import '../../chunk-PVI5BAUW.js';
|
|
8
8
|
import '../../chunk-IJZCVZ32.js';
|
|
9
9
|
import '../../chunk-IDFJFFIV.js';
|
|
10
10
|
import '../../chunk-6U5LS7MP.js';
|
|
11
11
|
import '../../chunk-BNBE2OMA.js';
|
|
12
12
|
import '../../chunk-NIQW2J3M.js';
|
|
13
|
-
import '../../chunk-
|
|
13
|
+
import '../../chunk-PRWQQJDL.js';
|
|
14
14
|
import { a as a$2 } from '../../chunk-SKFBUMRN.js';
|
|
15
15
|
import '../../chunk-FBN7HCBY.js';
|
|
16
|
-
import { e } from '../../chunk-
|
|
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';
|
|
@@ -36,7 +36,7 @@ import Wo from 'react-fast-compare';
|
|
|
36
36
|
import Qe from '@mui/material/Badge';
|
|
37
37
|
import he from '@mui/material/Button';
|
|
38
38
|
import je from '@mui/material/IconButton';
|
|
39
|
-
import
|
|
39
|
+
import Nt from '@mui/material/Stack';
|
|
40
40
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
41
41
|
import pt from '@mui/material/Divider';
|
|
42
42
|
import Se from '@mui/material/Typography';
|
|
@@ -53,7 +53,7 @@ import Rr from '@mui/material/DialogContent';
|
|
|
53
53
|
import Dr from '@mui/material/DialogTitle';
|
|
54
54
|
import Xr 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(_t,{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(_t,{sx:{width:55,flexShrink:0}}):jsxs(ge,{value:e,onChange:n=>t(n.target.value),size:"small",sx:{width:55,flexShrink:0},children:[jsx($,{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]),d=useCallback(a=>{let u=t.find(A=>(A.filter_field_name??A.name)===a);if(!u)return;let L=u.available_filter_conditions[0]||"EQUALS";o({...e,fieldName:a,conditional:L,value:[]});},[t,e,o]),f=useCallback(a=>{o({...e,conditional:a});},[e,o]),p=useCallback(a=>{o({...e,value:a?[a]:[]});},[e,o]),c=useCallback(a=>{o({...e,operator:a});},[e,o]);return jsxs(_t,{direction:"row",spacing:1,alignItems:"center",children:[jsx(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=>d(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=>p(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=>p(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(d=>!l.includes(d.name)||d.name===s),[e,l]);return e.length===0?jsx(Se,{variant:"body2",color:"text.secondary",textAlign:"center",children:"Nenhum filtro dispon\xEDvel"}):t.length===0?jsxs(Se,{variant:"body2",color:"text.secondary",textAlign:"center",children:["Clique em"," ",jsx(Se,{component:"strong",variant:"body2",fontWeight:600,color:"text.primary",children:'"+"'})," ","para adicionar um filtro"]}):jsx(Fragment,{children:t.map((s,d)=>jsx(nt,{condition:s,fields:m(s.fieldName),onChange:n,onRemove:i(s.id),showOperator:d>0,totalConditions:t.length,isFirst:d===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 d=Ze(t),f=o.length>0,p=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>=d.length,children:jsx(a,{icon:"SIMPLE_ADD"})})]}),jsx(pt,{}),jsx(mt,{children:jsx(at,{filterableFields:d,conditions:o,onUpdateCondition:n,onRemoveCondition:i})}),jsx(pt,{}),jsxs(dt,{children:[jsx(he,{variant:"text",color:"inherit",onClick:c,children:"Limpar"}),jsxs(_t,{direction:"row",spacing:1,children:[jsx(he,{variant:"outlined",color:"inherit",onClick:a$1,startIcon:jsx(a,{icon:"CANCEL_CIRCLE"}),children:"Cancelar"}),jsx(he,{variant:"contained",onClick:p,disabled:!f,startIcon:jsx(a,{icon:"SIMPLE_CHECK"}),children:"Aplicar"})]})]})]})},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:d,onApply:f,onClear:p,onCancel:c})=>e?jsx(ft,{open:t||!!o,anchorEl:o,onClose:l,fields:r,conditions:n,onAddCondition:m,onUpdateCondition:s,onRemoveCondition:d,onApply:f,onClear:p,onCancel:c,isMobileProp:i}):null,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"),d=useMemo(()=>o.filter(u=>u.name!=="ACTIONS"&&u.access_type!=="WRITE_ONLY"),[o]),f=useMemo(()=>o.find(u=>(u.filter_field_name??u.name)===i),[o,i]),p=f?.type==="DECIMAL"||f?.type==="INTEGER";useEffect(()=>{e&&(l(r?.fieldName||""),s(r?.sortType||"ASC"));},[e,r]);let c=useCallback(()=>{n&&n(i?{fieldName:i,sortType:m}:void 0),t();},[n,i,m,t]),a$1=useCallback(()=>{n&&(l(""),s("ASC"),n(void 0),t());},[n,t]);return jsxs(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(_t,{spacing:2,pt:2,children:[jsxs(fe,{fullWidth:!0,size:"small",children:[jsx(Ce,{id:"sort-field-label",children:"Campo"}),jsxs(ge,{labelId:"sort-field-label",value:i,label:"Campo",onChange:u=>l(u.target.value),children:[jsx($,{value:"",children:jsx("em",{children:"Nenhum"})}),d.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 ",p?"(1-9)":"(A-Z)"]}),jsxs($,{value:"DESC",children:["Decrescente ",p?"(9-1)":"(Z-A)"]})]})]})]})}),jsxs(bt,{children:[jsx(_t,{flex:1,width:"100%",direction:"row",children:jsx(he,{color:"inherit",onClick:a$1,children:"Limpar"})}),jsxs(he,{onClick:t,variant:"outlined",color:"inherit",sx:{minWidth:24},children:[jsx(a,{icon:"CANCEL_CIRCLE"}),jsx(Fe,{children:"Cancelar"})]}),jsxs(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(p=>p!==l),s=new Set,d=[],f=p=>{let c=n.get(p);if(!c)return;let a=r.get(c.name);!a||s.has(c.name)||(d.push(a),s.add(c.name));};return m.forEach(p=>{f(p);}),t.forEach(p=>{if(p.name===l||m.includes(p.name))return;let c=r.get(p.name);!c||s.has(p.name)||(d.push(c),s.add(p.name));}),f(l),d.length===0?e:d},[e,r,n,o,t]),columnsByFieldId:r,fieldsByName:n}};function 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(p=>{let c=Mr(p);if(!t.has(c))return;let a;if(i&&l){let u=l[c];typeof u=="boolean"&&(a=u);}a===void 0&&o&&o.length>0&&(a=o.includes(p.name)),typeof a=="boolean"&&(f[c]=a);}),Object.keys(f).length!==0)return {columns:{columnVisibilityModel:f}}},[t,o,e,i,l]),d=useCallback(f=>{i&&m(f),n&&n(f);},[i,n,m]);return {initialState:s,handleColumnVisibilityModelChange:d}};var _={IMAGE_WIDTH:90,MIN_WIDTH:130,ENTITY_MIN_WIDTH:100,ENTITY_FLEX:.5,ID_MIN_WIDTH:200,ID_FLEX:1,ACTIONS_WIDTH:80},Te={READ_ONLY:"READ_ONLY",READ_AND_WRITE:"READ_AND_WRITE"},wt=["price","base_price","minimum_value","maximum_value","minimum_installment_value"];var wr=(e,t)=>({field:e.name,headerName:e.description,sortable:!1,width:_.IMAGE_WIDTH,resizable:!1,headerAlign:"center",align:"center",renderCell:o=>t(e,o.row)}),Lr=(e,t)=>({field:e.name,headerName:e.description,minWidth:_.ID_MIN_WIDTH,flex:_.ID_FLEX,renderCell:o=>t(e,o.row)}),Pr=(e,t)=>({field:e.name,headerName:e.description,minWidth:_.ENTITY_MIN_WIDTH,flex:_.ENTITY_FLEX,renderCell:o=>t(e,o.row)}),Or=(e,t)=>({field:e.name,headerName:e.description,minWidth:_.MIN_WIDTH,renderCell:o=>t(e,o.row)}),kr=(e,t)=>({field:e.name,headerName:"A\xE7\xF5es",width:_.ACTIONS_WIDTH,sortable:!1,resizable:!1,disableReorder:!0,headerAlign:"center",disableColumnMenu:!0,align:"center",renderCell:o=>t(e,o.row)}),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,d]=useState(()=>Ot(t)),f=useRef([]),p=useCallback(()=>{f.current=n.map(C=>({...C})),d(n.map(C=>({...C}))),r(!0);},[n]),c=()=>r(!1),a=useCallback(()=>{let C=e.filter(R=>R.available_filter_conditions?.length>0);if(C.length===0)return;let S=s.map(R=>R.fieldName),F=C.filter(R=>!S.includes(R.filter_field_name??R.name));if(F.length===0)return;let E=s.length>0?s[0].operator:"AND",b=F[0],x={id:a$5(),operator:E,fieldName:b.filter_field_name??b.name,conditional:et(b),value:[]};d(R=>[...R,x]);},[e,s]),u=useCallback((C,S)=>{d(F=>{let E=F.find(b=>b.id===C);if(!E)return F;if(S.operator&&S.operator!==E.operator){let b=S.operator;return F.map(x=>x.id===C?{...x,...S}:{...x,operator:b})}return F.map(b=>b.id===C?{...b,...S}:b)});},[]),L=useCallback(C=>{d(S=>S.filter(F=>F.id!==C));},[]),A=()=>{d([]),i([]),m(void 0);},re=()=>{let C=tt(s);return i(s.map(S=>({...S}))),m(C),r(!1),C},ie=()=>{d(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:p,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},Ne=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(_t,{height:1,justifyContent:"center",children:[jsx(Se,{variant:"subtitle2",noWrap:!0,title:t,children:t}),jsxs(_t,{direction:"row",gap:1,alignItems:"center",children:[jsxs(Se,{color:"grey.600",variant:"body2",noWrap:!0,children:["ID: ",e]}),jsx(a$2,{toCopy:e,message:o})]})]}),si=memo(li);var ci=({value:e,isCurrency:t=!1})=>e==null?"-":jsx(_t,{direction:"row",alignItems:"center",height:"100%",children:jsx(Se,{variant:"body2",noWrap:!0,width:"fit-content",children:t?h(Number(e)):a$3(Number(e))})}),Ee=memo(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(_t,{direction:"row",gap:1,alignItems:"center",children:[jsx(Se,{variant:"body2",noWrap:!0,children:l}),jsx(a$2,{toCopy:i,message:o,label:r})]}):l},Me=memo(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(Ne,{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:d,onPaginationChange:f,onAdd:p,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 N=B[0],H=Object.keys(N).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(N=>{if(!a)return;let H=N.id?.toString()||"";a(H,N.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:No,clearAllFilters:Pe,applyFilters:Oe,cancelChanges:ke,hasActiveFilters:_o,activeFiltersCount:Ao}=kt({fields:G,initialFilter:ho}),Eo=useCallback(()=>{let N=Oe();U(N);},[Oe,U]),vo=useCallback(()=>{Pe(),U(void 0);},[Pe,U]),Mo=useCallback(N=>{V?de():(de(),se(N.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:d,onSearchChange:s,paginationModel:{page:i,pageSize:l},onPaginationChange:f,actions:u,moreActions:L,onAdd:p,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:_o,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:No,onApply:Eo,onClear:vo,onCancel:wo}),jsx(Et,{open:Lo,onClose:()=>Be(!1),fields:G,sort:me,onSortChange:we})]})]})},xi=memo(Di,Wo);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,l)=>{let m=o.indexOf(i),s=o.indexOf(l);return m-s||0}):n};
|
|
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};
|
|
57
57
|
|
|
58
|
-
export { De as DateRenderer, xe as DateTimeRenderer,
|
|
58
|
+
export { De as DateRenderer, xe as DateTimeRenderer, _e as EntityRenderer, ei as IconRenderer, ni as ImageRenderer, si as NameRenderer, Ee as NumberRenderer, ve as StatusRenderer, Me as TextRenderer, Re as addActionsFieldToMetadata, _i as buildVisibleFields, Yt as createActionsField, xi as default };
|
|
59
59
|
//# sourceMappingURL=index.js.map
|