@data-c/pro 0.2.53 → 0.2.55

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/index.js CHANGED
@@ -1,4 +1,1092 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _xdatagridpro = require('@mui/x-data-grid-pro');var _react = require('react');var _iconsmaterial = require('@mui/icons-material');var _material = require('@mui/material');var _locales = require('@mui/x-data-grid-pro/locales');var _jsxruntime = require('react/jsx-runtime');function F(){return _jsxruntime.jsxs.call(void 0, _material.Stack,{alignItems:"center",justifyContent:"center",gap:2,padding:2,maxWidth:"400px",minWidth:"200px",children:[_jsxruntime.jsx.call(void 0, _material.Stack,{width:"250px",height:"250px",alignItems:"center",justifyContent:"center",borderRadius:"50%",sx:{background:"linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"},children:_jsxruntime.jsx.call(void 0, "img",{src:"https://datac-site-assets.s3.sa-east-1.amazonaws.com/empty-data.svg",alt:"Imagem de notifica\xE7\xE3o",width:"148px",height:"148px"})}),_jsxruntime.jsxs.call(void 0, _material.Stack,{spacing:1,textAlign:"center",children:[_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"h4",component:"h2",fontWeight:"600",children:"Nenhum registro encontrado"}),_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"body2",whiteSpace:"normal",children:"Tente outra pesquisa ou adicione um novo registro."})]})]})}function T({errorMessage:e}){return _jsxruntime.jsxs.call(void 0, _material.Stack,{alignItems:"center",justifyContent:"center",gap:2,padding:2,maxWidth:"400px",minWidth:"200px",children:[_jsxruntime.jsx.call(void 0, _material.Stack,{width:"250px",height:"250px",alignItems:"center",justifyContent:"center",borderRadius:"50%",sx:{background:"linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"},children:_jsxruntime.jsx.call(void 0, "img",{src:"https://datac-site-assets.s3.sa-east-1.amazonaws.com/error.svg",alt:"Imagem de erro",width:"148px",height:"148px"})}),_jsxruntime.jsxs.call(void 0, _material.Stack,{gap:1,textAlign:"center",children:[_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"h4",component:"h2",fontWeight:"600",children:"Ops! Algo deu errado"}),_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"body2",children:e})]})]})}var le=_react.createContext.call(void 0, {});function y({children:e}){let[a,t]=_react.useState.call(void 0, {type:"include",ids:new Set}),[o,d]=_react.useState.call(void 0, !1),[l,u]=_react.useState.call(void 0, !1),f=_xdatagridpro.useGridApiRef.call(void 0, );function s(){t({type:"include",ids:new Set}),d(!0)}return _jsxruntime.jsx.call(void 0, le.Provider,{value:{apiRef:f,rowsSelectedId:a,clearCallback:o,breakpoint:l,setClearCallback:d,setBreakpoint:u,setRowsSelectedId:t,clearRowsSelectedId:s},children:e})}function p(){return _react.useContext.call(void 0, le)}var Qe=({apiRef:e})=>_xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, e);function q(e){let{error:a,isLoading:t,isFetching:o,data:d,columns:l,controlledRowsSelectedId:u,onClearRowsSelectedId:f,onRowSelectionChange:s,onCellKeyDown:i,onRowDoubleClick:x,stackProps:c,slots:m,...Fe}=e,{rowsSelectedId:Re,setRowsSelectedId:ee,clearCallback:ae,setClearCallback:Te,apiRef:B}=p(),be=_react.useMemo.call(void 0, ()=>n=>n.map(r=>r.headerName==="A\xE7\xF5es"?{...r,minWidth:r.minWidth||80,maxWidth:r.maxWidth||r.width||80,headerClassName:"sticky-header",cellClassName:"sticky-cell"}:{...r,flex:r.flex||1,minWidth:r.minWidth||100,headerClassName:_optionalChain([r, 'optionalAccess', _2 => _2.enableStickyColumns])?"sticky-header":"",cellClassName:_optionalChain([r, 'optionalAccess', _3 => _3.enableStickyColumns])?"sticky-cell":""}),[l]);_react.useEffect.call(void 0, ()=>{u&&ee(u)},[u]),_react.useEffect.call(void 0, ()=>{ae&&(f&&f({type:"include",ids:new Set}),Te(!1))},[ae]);function ye(n,r,ve){switch(r.ctrlKey&&r.code==="KeyE"?"ctrl+e":r.code){case"Enter":r.preventDefault(),i&&i("edit",n.id);break;case"F3":r.preventDefault(),i&&i("edit",n.id);break;case"Delete":r.preventDefault(),i&&i("delete",n.id);break;case"ctrl+e":r.preventDefault(),(Ue=>{_optionalChain([B, 'optionalAccess', _4 => _4.current])&&B.current.exportDataAsCsv(Ue)})({getRowsToExport:Qe});break;default:break}}function qe(n,r,ve){x&&x("edit",n.id)}return _jsxruntime.jsxs.call(void 0, _material.Stack,{height:"100%",minHeight:"500px",position:"relative",...c,children:[!t&&o&&_jsxruntime.jsx.call(void 0, _material.LinearProgress,{sx:{position:"absolute",top:0,right:0,left:0,zIndex:999,height:"3px"}}),_jsxruntime.jsx.call(void 0, _xdatagridpro.DataGridPro,{apiRef:B,rows:d,columns:be(l),density:"compact",hideFooterPagination:!0,hideFooter:!0,loading:t,rowHeight:43,columnHeaderHeight:43,disableVirtualization:!0,onRowDoubleClick:qe,onCellKeyDown:ye,disableRowSelectionOnClick:!0,rowSelectionModel:Re,onRowSelectionModelChange:(n,r)=>{s&&s(n,r),!u&&ee(n)},slots:{booleanCellFalseIcon:()=>_jsxruntime.jsx.call(void 0, _iconsmaterial.Circle,{color:"error",sx:{fontSize:"10pt"}}),booleanCellTrueIcon:()=>_jsxruntime.jsx.call(void 0, _iconsmaterial.Circle,{color:"success",sx:{fontSize:"10pt"}}),noRowsOverlay:()=>!t&&a?_jsxruntime.jsx.call(void 0, T,{errorMessage:a}):_jsxruntime.jsx.call(void 0, F,{}),...m},slotProps:{loadingOverlay:{variant:"skeleton",noRowsVariant:"skeleton"}},disableColumnFilter:!0,localeText:_locales.ptBR.components.MuiDataGrid.defaultProps.localeText,sx:{border:"none",borderRadius:0,"--DataGridPro-rowBorderColor":"#edf2f9","--DataGridPro-containerBackground":"#f4f6fa",".MuiDataGridPro-overlayWrapperInner":{display:"flex",alignItems:"center",justifyContent:"center"},".MuiDataGridPro-row":{backgroundColor:"white","&:nth-of-type(even)":{backgroundColor:"#f9fafd"},":hover":{backgroundColor:"#e9e9e9"},"&.Mui-selected":{backgroundColor:"rgb(238, 249, 252)","&:hover":{backgroundColor:"rgb(222, 243, 249)"}}},".MuiDataGridPro-cell":{fontSize:"12px",color:"#0b0e14"},".MuiDataGridPro-columnHeaders":{border:"solid 1px #edf2f9"},".MuiDataGridPro-columnHeaderTitle":{fontSize:"12px",color:"#0b0e14",fontWeight:"600"},"& .sticky-cell":{position:"sticky",right:0,background:"inherit",zIndex:1},"& .sticky-header":{position:"sticky",right:0,background:"inherit",zIndex:2}},...Fe})]})}function v(e){let{ref:a,...t}=e;return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{...t,ref:a})}var se=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_e=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,t,o)=>o?o.toUpperCase():t.toLowerCase()),U=e=>{let a=_e(e);return a.charAt(0).toUpperCase()+a.slice(1)},A=(...e)=>e.filter((a,t,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===t).join(" ").trim(),ie=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var ce={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var pe=_react.forwardRef.call(void 0, ({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:d="",children:l,iconNode:u,...f},s)=>_react.createElement.call(void 0, "svg",{ref:s,...ce,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:A("lucide",d),...!l&&!ie(f)&&{"aria-hidden":"true"},...f},[...u.map(([i,x])=>_react.createElement.call(void 0, i,x)),...Array.isArray(l)?l:[l]]));var I=(e,a)=>{let t=_react.forwardRef.call(void 0, ({className:o,...d},l)=>_react.createElement.call(void 0, pe,{ref:l,iconNode:a,className:A(`lucide-${se(U(e))}`,`lucide-${e}`,o),...d}));return t.displayName=U(e),t};var aa=[["path",{d:"M15 11a1 1 0 0 0 1 1h2.939a1 1 0 0 1 .75 1.811l-6.835 6.836a1.207 1.207 0 0 1-1.707 0L4.31 13.81a1 1 0 0 1 .75-1.811H8a1 1 0 0 0 1-1V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1z",key:"1eaqc3"}]],C=I("arrow-big-down",aa);var ta=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],g=I("pencil",ta);var oa=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],h=I("trash-2",oa);function O(e){let{ref:a,...t}=e;return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{color:"error",label:"Deletar",icon:_jsxruntime.jsx.call(void 0, h,{size:16}),...t,ref:a})}function H(e){let{ref:a,...t}=e;return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{label:"Editar",color:"primary",icon:_jsxruntime.jsx.call(void 0, g,{size:16}),...t,ref:a})}function G({children:e,breakpoints:a}){let{setBreakpoint:t}=p(),o=_material.useTheme.call(void 0, ),d=_material.useMediaQuery.call(void 0, o.breakpoints.down(a||"md"));return _react.useEffect.call(void 0, ()=>{t(d)},[d]),_jsxruntime.jsx.call(void 0, _material.Stack,{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:1,marginLeft:"auto",flexGrow:1,children:e})}function E(e){let{ref:a,...t}=e;return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{color:"primary",label:"Transportar",icon:_jsxruntime.jsx.call(void 0, C,{size:16}),...t,ref:a})}function w(e){let{isLoading:a,startIcon:t,children:o,title:d,...l}=e,{breakpoint:u}=p();return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:u?_jsxruntime.jsx.call(void 0, _material.Tooltip,{title:o,children:_jsxruntime.jsxs.call(void 0, _material.IconButton,{...l,color:"primary",disabled:a?!0:l.disabled,children:[t,a&&_jsxruntime.jsx.call(void 0, _material.CircularProgress,{color:"secondary",size:14,sx:{position:"absolute",top:"25%",bottom:"25%",left:"25%",right:"25%",transform:"translate(-50%, -50%)"}})]})}):_jsxruntime.jsx.call(void 0, _material.Button,{startIcon:t,disabled:a?!0:l.disabled,sx:{position:"relative",height:"26px",minWidth:"70px",padding:"7px 8px 8px",border:"1px solid rgba(223, 226, 231, 0.8)",borderRadius:"6px",display:"flex",alignItems:"center",overflow:"hidden",whiteSpace:"nowrap",flexShrink:1,transition:"width 0.2s ease"},...l,children:_jsxruntime.jsxs.call(void 0, _material.Box,{component:"span",sx:{transition:"opacity 0.2s ease, width 0.2s ease",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:[a&&_jsxruntime.jsx.call(void 0, _material.CircularProgress,{color:"secondary",size:14,sx:{position:"absolute",top:"22%",left:"44%",transform:"translate(-50%, -50%)"}}),o]})})})}function W(e){let{event:a,onClick:t,...o}=e;return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{label:"A\xE7\xE3o",onClick:()=>{},icon:_jsxruntime.jsx.call(void 0, "span",{children:"\u{1F527}"})})}function V({onClick:e,...a}){return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{icon:_jsxruntime.jsx.call(void 0, _iconsmaterial.Delete,{}),label:"Delete",color:"primary",onClick:()=>{e&&e("delete")},...a})}function z({onClick:e,...a}){return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{icon:_jsxruntime.jsx.call(void 0, _iconsmaterial.Edit,{}),label:"Edit",color:"primary",onClick:()=>e&&e("edit"),...a})}function X(e){let{children:a,onClick:t}=e;return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_react.Children.map(a,o=>{if(_react.isValidElement.call(void 0, o))return _react.cloneElement.call(void 0, o,{onClick:t})})})}function N({onClick:e,...a}){return _jsxruntime.jsx.call(void 0, _xdatagridpro.GridActionsCellItem,{icon:_jsxruntime.jsx.call(void 0, _iconsmaterial.GetApp,{}),label:"Transport",color:"primary",onClick:()=>e&&e("transport"),...a})}function K(e){return _jsxruntime.jsx.call(void 0, _material.Stack,{direction:"row",width:"100%",flexGrow:1,alignItems:"center",gap:1.5,sx:{background:"#f4f"},...e})}var ya=({apiRef:e})=>_xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, e);function Q(){let{apiRef:e}=p(),a=t=>{_optionalChain([e, 'optionalAccess', _5 => _5.current])&&e.current.exportDataAsCsv(t)};return _jsxruntime.jsx.call(void 0, w,{startIcon:_jsxruntime.jsx.call(void 0, _iconsmaterial.FileDownload,{}),onClick:()=>a({getRowsToExport:ya}),children:"Exportar CSV"})}function Z(e){return _jsxruntime.jsx.call(void 0, _material.TableFooter,{...e,sx:{height:"54px",paddingX:"12px",gap:"12px",display:"flex",alignItems:"center",backgroundColor:"white",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px",borderTop:"1px solid #edf2f9"}})}var _hooks = require('@data-c/hooks');function J(e){let{onChangePageSize:a,onChangePage:t,pagination:o,rowsPerPageOptions:d=[15,50,100,200]}=e,{page:l,pageSize:u=15,totalRecords:f}=o||{},s=_react.useMemo.call(void 0, ()=>_optionalChain([o, 'optionalAccess', _6 => _6.lastPage])?o.lastPage:(f||0)<u?1:Math.max(Math.ceil((f||0)/u)),[f,u]),i=_react.useMemo.call(void 0, ()=>{if((f||0)<u)return`Exibindo ${_hooks.pluralizar.call(void 0, f||0,"registro","registros",!0)}`;let c=u;if(l===s){let m=(f||0)%u;c=m===0?u:m}return`Exibindo ${_hooks.pluralizar.call(void 0, c||0,"registro","registros",!0)} de ${f}`},[o,s]);return _jsxruntime.jsxs.call(void 0, _material.Stack,{width:"100%",direction:"row",alignItems:"center",gap:2,marginLeft:"auto",children:[_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"body2",fontSize:"13px",fontWeight:"500",whiteSpace:"nowrap",children:i}),!0&&_jsxruntime.jsxs.call(void 0, _material.Stack,{direction:"row",alignItems:"center",gap:2,marginLeft:"auto",children:[_jsxruntime.jsx.call(void 0, _material.TextField,{sx:{width:"78px",fontSize:"8pt"},size:"small",value:u||0,select:!0,onChange:c=>{a&&a(parseInt(c.target.value))},children:d.map(c=>_jsxruntime.jsx.call(void 0, _material.MenuItem,{value:c,children:c},c))}),_jsxruntime.jsx.call(void 0, _material.Pagination,{variant:"outlined",shape:"rounded",count:s||0,showFirstButton:!0,showLastButton:!0,onChange:(c,m)=>{t&&t(m)},page:l||0,color:"primary"})]})]})}function $({children:e,height:a,...t}){let o=_react.useRef.call(void 0, null),[d,l]=_react.useState.call(void 0, 500);return _react.useEffect.call(void 0, ()=>{let u=()=>{let f=o.current;if(!f)return;let s=f.getBoundingClientRect().top;l(window.innerHeight-s)};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]),_jsxruntime.jsx.call(void 0, _material.Stack,{ref:o,sx:{backgroundColor:"#f4f6fa",border:"1px solid #edf2f9",borderRadius:2,height:a||`calc(${d}px - 16px)`,...t.sx},...t,children:_jsxruntime.jsx.call(void 0, y,{children:e})})}function _(e){let{countTitle:a,gender:t}=e,{rowsSelectedId:o}=p(),d=_optionalChain([o, 'optionalAccess', _7 => _7.ids, 'access', _8 => _8.size])||0,l=_react.useMemo.call(void 0, ()=>{if(!a)return"";let u=t==="feminino"?"selecionada":"selecionado",f=t==="feminino"?"selecionadas":"selecionados",s=t==="feminino"?"Nenhuma":"Nenhum";return d===1?`${a} ${u}`:d&&d>1?`${a.split(" ").map(i=>`${i}s`).join(" ")} ${f}`:`${s} ${a} ${u}`},[d]);return _jsxruntime.jsx.call(void 0, _material.Stack,{children:_jsxruntime.jsxs.call(void 0, _material.Typography,{variant:"body2",fontSize:"13px",fontWeight:"500",whiteSpace:"nowrap",children:[d&&d>0?d:""," ",l]})})}function Y({children:e,titleDivider:a=!1,sx:t}){let o=_material.useTheme.call(void 0, );return _jsxruntime.jsx.call(void 0, _material.Typography,{variant:"h6",whiteSpace:"nowrap",sx:{borderRight:a?`solid 1px ${o.palette.grey[300]}`:"none",paddingRight:1.5,...t},children:e})}function j({children:e}){return _jsxruntime.jsx.call(void 0, _material.Stack,{component:_material.Paper,elevation:0,gap:1.5,flexDirection:"row",justifyContent:"space-between",alignItems:"center",p:1,borderRadius:"8px 8px 0 0",sx:{width:"100%"},children:e})}var ot={CellActionTransport:N,SelectionCounter:_,CellActionDelete:V,ExportCsvButton:Q,CellActionEdit:z,CellActions:X,CellAction:W,Pagination:J,Actions:G,Toolbar:j,Content:K,Button:w,Footer:Z,Table:q,Title:Y,Root:$,Action:v,ActionEdit:H,ActionDelete:O,ActionTransport:E,ColumnsPanelTrigger:_xdatagridpro.ColumnsPanelTrigger,useGridApiRef:_xdatagridpro.useGridApiRef},ut= exports.DataTable =ot;exports.DataTable = ut;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/DataTable/index.ts
2
+ var _xdatagridpro = require('@mui/x-data-grid-pro');
3
+
4
+ // src/DataTable/DataTable.tsx
5
+ var _react = require('react');
6
+ var _iconsmaterial = require('@mui/icons-material');
7
+ var _material = require('@mui/material');
8
+
9
+
10
+
11
+
12
+ var _locales = require('@mui/x-data-grid-pro/locales');
13
+
14
+ // src/DataTable/DataTableEmptyData.tsx
15
+
16
+ var _jsxruntime = require('react/jsx-runtime');
17
+ function DataTableEmptyData() {
18
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
19
+ _material.Stack,
20
+ {
21
+ alignItems: "center",
22
+ justifyContent: "center",
23
+ gap: 2,
24
+ padding: 2,
25
+ maxWidth: "400px",
26
+ minWidth: "200px",
27
+ children: [
28
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
29
+ _material.Stack,
30
+ {
31
+ width: "250px",
32
+ height: "250px",
33
+ alignItems: "center",
34
+ justifyContent: "center",
35
+ borderRadius: "50%",
36
+ sx: {
37
+ background: "linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"
38
+ },
39
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
40
+ "img",
41
+ {
42
+ src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/empty-data.svg",
43
+ alt: "Imagem de notifica\xE7\xE3o",
44
+ width: "148px",
45
+ height: "148px"
46
+ }
47
+ )
48
+ }
49
+ ),
50
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { spacing: 1, textAlign: "center", children: [
51
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h4", component: "h2", fontWeight: "600", children: "Nenhum registro encontrado" }),
52
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", whiteSpace: "normal", children: "Tente outra pesquisa ou adicione um novo registro." })
53
+ ] })
54
+ ]
55
+ }
56
+ );
57
+ }
58
+
59
+ // src/DataTable/DataTableError.tsx
60
+
61
+
62
+ function DataTableError({
63
+ errorMessage
64
+ }) {
65
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
66
+ _material.Stack,
67
+ {
68
+ alignItems: "center",
69
+ justifyContent: "center",
70
+ gap: 2,
71
+ padding: 2,
72
+ maxWidth: "400px",
73
+ minWidth: "200px",
74
+ children: [
75
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
76
+ _material.Stack,
77
+ {
78
+ width: "250px",
79
+ height: "250px",
80
+ alignItems: "center",
81
+ justifyContent: "center",
82
+ borderRadius: "50%",
83
+ sx: {
84
+ background: "linear-gradient(to top, #ffffff, #fdfcfd, #fafafa, #f8f7f8, #f5f5f6);"
85
+ },
86
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
87
+ "img",
88
+ {
89
+ src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/error.svg",
90
+ alt: "Imagem de erro",
91
+ width: "148px",
92
+ height: "148px"
93
+ }
94
+ )
95
+ }
96
+ ),
97
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { gap: 1, textAlign: "center", children: [
98
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h4", component: "h2", fontWeight: "600", children: "Ops! Algo deu errado" }),
99
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", children: errorMessage })
100
+ ] })
101
+ ]
102
+ }
103
+ );
104
+ }
105
+
106
+ // src/DataTable/DataTableRootProvider.tsx
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ var TableRootContext = _react.createContext.call(void 0, {});
115
+ function TableRootProvider({
116
+ children
117
+ }) {
118
+ const [ids, setIds] = _react.useState.call(void 0, {
119
+ type: "include",
120
+ ids: /* @__PURE__ */ new Set()
121
+ });
122
+ const [clearCallback, setClearCallback] = _react.useState.call(void 0, false);
123
+ const [breakpoint, setBreakpoint] = _react.useState.call(void 0, false);
124
+ const apiRef = _xdatagridpro.useGridApiRef.call(void 0, );
125
+ function handleClearRowsSelectedId() {
126
+ setIds({
127
+ type: "include",
128
+ ids: /* @__PURE__ */ new Set()
129
+ });
130
+ setClearCallback(true);
131
+ }
132
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
133
+ TableRootContext.Provider,
134
+ {
135
+ value: {
136
+ apiRef,
137
+ rowsSelectedId: ids,
138
+ clearCallback,
139
+ breakpoint,
140
+ setClearCallback,
141
+ setBreakpoint,
142
+ setRowsSelectedId: setIds,
143
+ clearRowsSelectedId: handleClearRowsSelectedId
144
+ },
145
+ children
146
+ }
147
+ );
148
+ }
149
+ function useTableRootContext() {
150
+ return _react.useContext.call(void 0, TableRootContext);
151
+ }
152
+
153
+ // src/DataTable/DataTable.tsx
154
+
155
+ var getFilteredRows = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
156
+ function Table(props) {
157
+ const {
158
+ error,
159
+ isLoading,
160
+ isFetching,
161
+ data,
162
+ columns,
163
+ controlledRowsSelectedId,
164
+ onClearRowsSelectedId,
165
+ onRowSelectionChange,
166
+ onCellKeyDown,
167
+ onRowDoubleClick,
168
+ stackProps,
169
+ slots,
170
+ ...rest
171
+ } = props;
172
+ const {
173
+ rowsSelectedId,
174
+ setRowsSelectedId,
175
+ clearCallback,
176
+ setClearCallback,
177
+ apiRef
178
+ } = useTableRootContext();
179
+ const parsedColumns = _react.useMemo.call(void 0, () => {
180
+ return (columns2) => {
181
+ return columns2.map((col) => {
182
+ if (col.headerName === "A\xE7\xF5es") {
183
+ return {
184
+ ...col,
185
+ minWidth: col.minWidth || 80,
186
+ maxWidth: col.maxWidth || col.width || 80,
187
+ headerClassName: "sticky-header",
188
+ cellClassName: "sticky-cell"
189
+ };
190
+ }
191
+ return {
192
+ ...col,
193
+ flex: col.flex || 1,
194
+ minWidth: col.minWidth || 100,
195
+ headerClassName: _optionalChain([col, 'optionalAccess', _2 => _2.enableStickyColumns]) ? "sticky-header" : "",
196
+ cellClassName: _optionalChain([col, 'optionalAccess', _3 => _3.enableStickyColumns]) ? "sticky-cell" : ""
197
+ };
198
+ });
199
+ };
200
+ }, [columns]);
201
+ _react.useEffect.call(void 0, () => {
202
+ if (controlledRowsSelectedId) {
203
+ setRowsSelectedId(controlledRowsSelectedId);
204
+ }
205
+ }, [controlledRowsSelectedId]);
206
+ _react.useEffect.call(void 0, () => {
207
+ if (clearCallback) {
208
+ onClearRowsSelectedId && onClearRowsSelectedId({
209
+ type: "include",
210
+ ids: /* @__PURE__ */ new Set()
211
+ });
212
+ setClearCallback(false);
213
+ }
214
+ }, [clearCallback]);
215
+ function handleCellKeyDown(params, event, details) {
216
+ const eventCode = event.ctrlKey && event.code === "KeyE" ? "ctrl+e" : event.code;
217
+ switch (eventCode) {
218
+ case "Enter":
219
+ event.preventDefault();
220
+ if (onCellKeyDown)
221
+ onCellKeyDown("edit", params.id);
222
+ break;
223
+ case "F3":
224
+ event.preventDefault();
225
+ if (onCellKeyDown)
226
+ onCellKeyDown("edit", params.id);
227
+ break;
228
+ case "Delete":
229
+ event.preventDefault();
230
+ if (onCellKeyDown)
231
+ onCellKeyDown("delete", params.id);
232
+ break;
233
+ case "ctrl+e":
234
+ event.preventDefault();
235
+ const handleExport = (options) => {
236
+ if (_optionalChain([apiRef, 'optionalAccess', _4 => _4.current])) {
237
+ apiRef.current.exportDataAsCsv(options);
238
+ }
239
+ };
240
+ handleExport({ getRowsToExport: getFilteredRows });
241
+ break;
242
+ default:
243
+ break;
244
+ }
245
+ }
246
+ function handleRowDoubleClick(params, _, details) {
247
+ if (onRowDoubleClick)
248
+ onRowDoubleClick("edit", params.id);
249
+ }
250
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { height: "100%", minHeight: "500px", position: "relative", ...stackProps, children: [
251
+ !isLoading && isFetching && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
252
+ _material.LinearProgress,
253
+ {
254
+ sx: {
255
+ position: "absolute",
256
+ top: 0,
257
+ right: 0,
258
+ left: 0,
259
+ zIndex: 999,
260
+ height: "3px"
261
+ }
262
+ }
263
+ ),
264
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
265
+ _xdatagridpro.DataGridPro,
266
+ {
267
+ apiRef,
268
+ rows: data,
269
+ columns: parsedColumns(columns),
270
+ density: "compact",
271
+ hideFooterPagination: true,
272
+ hideFooter: true,
273
+ loading: isLoading,
274
+ rowHeight: 43,
275
+ columnHeaderHeight: 43,
276
+ disableVirtualization: true,
277
+ onRowDoubleClick: handleRowDoubleClick,
278
+ onCellKeyDown: handleCellKeyDown,
279
+ disableRowSelectionOnClick: true,
280
+ rowSelectionModel: rowsSelectedId,
281
+ onRowSelectionModelChange: (rowSelectionModel, details) => {
282
+ if (onRowSelectionChange) {
283
+ onRowSelectionChange(rowSelectionModel, details);
284
+ }
285
+ if (controlledRowsSelectedId)
286
+ return;
287
+ setRowsSelectedId(rowSelectionModel);
288
+ },
289
+ slots: {
290
+ booleanCellFalseIcon: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Circle, { color: "error", sx: { fontSize: "10pt" } }),
291
+ booleanCellTrueIcon: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Circle, { color: "success", sx: { fontSize: "10pt" } }),
292
+ noRowsOverlay: () => !isLoading && !!error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTableError, { errorMessage: error }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTableEmptyData, {}),
293
+ ...slots
294
+ },
295
+ slotProps: {
296
+ loadingOverlay: {
297
+ variant: "skeleton",
298
+ noRowsVariant: "skeleton"
299
+ }
300
+ },
301
+ disableColumnFilter: true,
302
+ localeText: _locales.ptBR.components.MuiDataGrid.defaultProps.localeText,
303
+ sx: {
304
+ border: "none",
305
+ borderRadius: 0,
306
+ "--DataGrid-rowBorderColor": "#edf2f9",
307
+ "--DataGrid-containerBackground": "#f4f6fa",
308
+ ".MuiDataGrid-overlayWrapperInner": {
309
+ display: "flex",
310
+ alignItems: "center",
311
+ justifyContent: "center"
312
+ },
313
+ ".MuiDataGrid-row": {
314
+ backgroundColor: "white",
315
+ "&:nth-of-type(even)": {
316
+ backgroundColor: "#f9fafd"
317
+ },
318
+ ":hover": {
319
+ backgroundColor: "#e9e9e9"
320
+ },
321
+ "&.Mui-selected": {
322
+ backgroundColor: "rgb(238, 249, 252)",
323
+ "&:hover": {
324
+ backgroundColor: "rgb(222, 243, 249)"
325
+ }
326
+ }
327
+ },
328
+ ".MuiDataGrid-cell": {
329
+ fontSize: "12px",
330
+ color: "#0b0e14"
331
+ },
332
+ ".MuiDataGrid-columnHeaders": {
333
+ border: "solid 1px #edf2f9",
334
+ backgroundColor: "#f4f6fa"
335
+ },
336
+ ".MuiDataGrid-columnHeader": {
337
+ backgroundColor: "#f4f6fa"
338
+ },
339
+ ".MuiDataGrid-columnHeaders .MuiDataGrid-filler": {
340
+ backgroundColor: "#f4f6fa"
341
+ },
342
+ ".MuiDataGrid-columnHeaderTitle": {
343
+ fontSize: "12px",
344
+ color: "#0b0e14",
345
+ fontWeight: "600"
346
+ },
347
+ "& .sticky-cell": {
348
+ position: "sticky",
349
+ right: 0,
350
+ background: "inherit",
351
+ zIndex: 1
352
+ },
353
+ "& .sticky-header": {
354
+ position: "sticky",
355
+ right: 0,
356
+ backgroundColor: "#f4f6fa",
357
+ zIndex: 2
358
+ }
359
+ },
360
+ ...rest
361
+ }
362
+ )
363
+ ] });
364
+ }
365
+
366
+ // src/DataTable/DataTableAction.tsx
367
+
368
+
369
+
370
+
371
+ function DataTableAction(props) {
372
+ const { ref, ...rest } = props;
373
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
374
+ _xdatagridpro.GridActionsCellItem,
375
+ {
376
+ ...rest,
377
+ ref
378
+ }
379
+ );
380
+ }
381
+
382
+ // src/DataTable/DataTableActionDelete.tsx
383
+
384
+
385
+
386
+
387
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
388
+
389
+
390
+ // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
391
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
392
+ var toCamelCase = (string) => string.replace(
393
+ /^([A-Z])|[\s-_]+(\w)/g,
394
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
395
+ );
396
+ var toPascalCase = (string) => {
397
+ const camelCase = toCamelCase(string);
398
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
399
+ };
400
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
401
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
402
+ }).join(" ").trim();
403
+ var hasA11yProp = (props) => {
404
+ for (const prop in props) {
405
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
406
+ return true;
407
+ }
408
+ }
409
+ };
410
+
411
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
412
+
413
+
414
+ // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
415
+ var defaultAttributes = {
416
+ xmlns: "http://www.w3.org/2000/svg",
417
+ width: 24,
418
+ height: 24,
419
+ viewBox: "0 0 24 24",
420
+ fill: "none",
421
+ stroke: "currentColor",
422
+ strokeWidth: 2,
423
+ strokeLinecap: "round",
424
+ strokeLinejoin: "round"
425
+ };
426
+
427
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
428
+ var Icon = _react.forwardRef.call(void 0,
429
+ ({
430
+ color = "currentColor",
431
+ size = 24,
432
+ strokeWidth = 2,
433
+ absoluteStrokeWidth,
434
+ className = "",
435
+ children,
436
+ iconNode,
437
+ ...rest
438
+ }, ref) => _react.createElement.call(void 0,
439
+ "svg",
440
+ {
441
+ ref,
442
+ ...defaultAttributes,
443
+ width: size,
444
+ height: size,
445
+ stroke: color,
446
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
447
+ className: mergeClasses("lucide", className),
448
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
449
+ ...rest
450
+ },
451
+ [
452
+ ...iconNode.map(([tag, attrs]) => _react.createElement.call(void 0, tag, attrs)),
453
+ ...Array.isArray(children) ? children : [children]
454
+ ]
455
+ )
456
+ );
457
+
458
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
459
+ var createLucideIcon = (iconName, iconNode) => {
460
+ const Component = _react.forwardRef.call(void 0,
461
+ ({ className, ...props }, ref) => _react.createElement.call(void 0, Icon, {
462
+ ref,
463
+ iconNode,
464
+ className: mergeClasses(
465
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
466
+ `lucide-${iconName}`,
467
+ className
468
+ ),
469
+ ...props
470
+ })
471
+ );
472
+ Component.displayName = toPascalCase(iconName);
473
+ return Component;
474
+ };
475
+
476
+ // ../../node_modules/lucide-react/dist/esm/icons/arrow-big-down.js
477
+ var __iconNode = [
478
+ [
479
+ "path",
480
+ {
481
+ d: "M15 11a1 1 0 0 0 1 1h2.939a1 1 0 0 1 .75 1.811l-6.835 6.836a1.207 1.207 0 0 1-1.707 0L4.31 13.81a1 1 0 0 1 .75-1.811H8a1 1 0 0 0 1-1V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1z",
482
+ key: "1eaqc3"
483
+ }
484
+ ]
485
+ ];
486
+ var ArrowBigDown = createLucideIcon("arrow-big-down", __iconNode);
487
+
488
+ // ../../node_modules/lucide-react/dist/esm/icons/pencil.js
489
+ var __iconNode2 = [
490
+ [
491
+ "path",
492
+ {
493
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
494
+ key: "1a8usu"
495
+ }
496
+ ],
497
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
498
+ ];
499
+ var Pencil = createLucideIcon("pencil", __iconNode2);
500
+
501
+ // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
502
+ var __iconNode3 = [
503
+ ["path", { d: "M10 11v6", key: "nco0om" }],
504
+ ["path", { d: "M14 11v6", key: "outv1u" }],
505
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
506
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
507
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
508
+ ];
509
+ var Trash2 = createLucideIcon("trash-2", __iconNode3);
510
+
511
+ // src/DataTable/DataTableActionDelete.tsx
512
+
513
+ function DataTableActionDelete(props) {
514
+ const { ref, ...rest } = props;
515
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
516
+ _xdatagridpro.GridActionsCellItem,
517
+ {
518
+ color: "error",
519
+ label: "Deletar",
520
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Trash2, { size: 16 }),
521
+ ...rest,
522
+ ref
523
+ }
524
+ );
525
+ }
526
+
527
+ // src/DataTable/DataTableActionEdit.tsx
528
+
529
+
530
+
531
+
532
+ function DataTableActionEdit(props) {
533
+ const { ref, ...rest } = props;
534
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
535
+ _xdatagridpro.GridActionsCellItem,
536
+ {
537
+ label: "Editar",
538
+ color: "primary",
539
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Pencil, { size: 16 }),
540
+ ...rest,
541
+ ref
542
+ }
543
+ );
544
+ }
545
+
546
+ // src/DataTable/DataTableActions.tsx
547
+
548
+
549
+
550
+ function Actions({ children, breakpoints }) {
551
+ const { setBreakpoint } = useTableRootContext();
552
+ const theme = _material.useTheme.call(void 0, );
553
+ const breakpoint = _material.useMediaQuery.call(void 0, theme.breakpoints.down(breakpoints || "md"));
554
+ _react.useEffect.call(void 0, () => {
555
+ setBreakpoint(breakpoint);
556
+ }, [breakpoint]);
557
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
558
+ _material.Stack,
559
+ {
560
+ flexDirection: "row",
561
+ alignItems: "center",
562
+ justifyContent: "flex-end",
563
+ gap: 1,
564
+ marginLeft: "auto",
565
+ flexGrow: 1,
566
+ children
567
+ }
568
+ );
569
+ }
570
+
571
+ // src/DataTable/DataTableActionTransport.tsx
572
+
573
+
574
+
575
+
576
+ function DataTableActionTransport(props) {
577
+ const { ref, ...rest } = props;
578
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
579
+ _xdatagridpro.GridActionsCellItem,
580
+ {
581
+ color: "primary",
582
+ label: "Transportar",
583
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ArrowBigDown, { size: 16 }),
584
+ ...rest,
585
+ ref
586
+ }
587
+ );
588
+ }
589
+
590
+ // src/DataTable/DataTableButton.tsx
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+ function DataTableButton(props) {
600
+ const { isLoading, startIcon, children, title, ...rest } = props;
601
+ const { breakpoint } = useTableRootContext();
602
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: breakpoint ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: children, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
603
+ _material.IconButton,
604
+ {
605
+ ...rest,
606
+ color: "primary",
607
+ disabled: isLoading ? true : rest.disabled,
608
+ children: [
609
+ startIcon,
610
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
611
+ _material.CircularProgress,
612
+ {
613
+ color: "secondary",
614
+ size: 14,
615
+ sx: {
616
+ position: "absolute",
617
+ top: "25%",
618
+ bottom: "25%",
619
+ left: "25%",
620
+ right: "25%",
621
+ transform: "translate(-50%, -50%)"
622
+ }
623
+ }
624
+ )
625
+ ]
626
+ }
627
+ ) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
628
+ _material.Button,
629
+ {
630
+ startIcon,
631
+ disabled: isLoading ? true : rest.disabled,
632
+ sx: {
633
+ position: "relative",
634
+ height: "26px",
635
+ minWidth: "70px",
636
+ padding: "7px 8px 8px",
637
+ border: "1px solid rgba(223, 226, 231, 0.8)",
638
+ borderRadius: "6px",
639
+ display: "flex",
640
+ alignItems: "center",
641
+ overflow: "hidden",
642
+ whiteSpace: "nowrap",
643
+ flexShrink: 1,
644
+ transition: "width 0.2s ease"
645
+ },
646
+ ...rest,
647
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
648
+ _material.Box,
649
+ {
650
+ component: "span",
651
+ sx: {
652
+ transition: "opacity 0.2s ease, width 0.2s ease",
653
+ overflow: "hidden",
654
+ whiteSpace: "nowrap",
655
+ textOverflow: "ellipsis"
656
+ },
657
+ children: [
658
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
659
+ _material.CircularProgress,
660
+ {
661
+ color: "secondary",
662
+ size: 14,
663
+ sx: {
664
+ position: "absolute",
665
+ top: "22%",
666
+ left: "44%",
667
+ transform: "translate(-50%, -50%)"
668
+ }
669
+ }
670
+ ),
671
+ children
672
+ ]
673
+ }
674
+ )
675
+ }
676
+ ) });
677
+ }
678
+
679
+ // src/DataTable/DataTableCellAction.tsx
680
+
681
+
682
+ function CellAction(props) {
683
+ const { event, onClick, ...rest } = props;
684
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
685
+ _xdatagridpro.GridActionsCellItem,
686
+ {
687
+ label: "A\xE7\xE3o",
688
+ onClick: () => {
689
+ },
690
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u{1F527}" })
691
+ }
692
+ );
693
+ }
694
+
695
+ // src/DataTable/DataTableCellActionDelete.tsx
696
+
697
+
698
+
699
+ function CellActionDelete({
700
+ onClick,
701
+ ...rest
702
+ }) {
703
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
704
+ _xdatagridpro.GridActionsCellItem,
705
+ {
706
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Delete, {}),
707
+ label: "Delete",
708
+ color: "primary",
709
+ onClick: () => {
710
+ if (onClick)
711
+ onClick("delete");
712
+ },
713
+ ...rest
714
+ }
715
+ );
716
+ }
717
+
718
+ // src/DataTable/DataTableCellActionEdit.tsx
719
+
720
+
721
+
722
+ function CellActionEdit({
723
+ onClick,
724
+ ...rest
725
+ }) {
726
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
727
+ _xdatagridpro.GridActionsCellItem,
728
+ {
729
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Edit, {}),
730
+ label: "Edit",
731
+ color: "primary",
732
+ onClick: () => onClick && onClick("edit"),
733
+ ...rest
734
+ }
735
+ );
736
+ }
737
+
738
+ // src/DataTable/DataTableCellActions.tsx
739
+
740
+
741
+ function CellActions(props) {
742
+ const { children, onClick: onItemClick } = props;
743
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: _react.Children.map(children, (child) => {
744
+ if (_react.isValidElement.call(void 0, child)) {
745
+ return _react.cloneElement.call(void 0, child, {
746
+ onClick: onItemClick
747
+ });
748
+ }
749
+ }) });
750
+ }
751
+
752
+ // src/DataTable/DataTableCellActionTransport.tsx
753
+
754
+
755
+
756
+ function CellActionTransport({
757
+ onClick,
758
+ ...rest
759
+ }) {
760
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
761
+ _xdatagridpro.GridActionsCellItem,
762
+ {
763
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.GetApp, {}),
764
+ label: "Transport",
765
+ color: "primary",
766
+ onClick: () => onClick && onClick("transport"),
767
+ ...rest
768
+ }
769
+ );
770
+ }
771
+
772
+ // src/DataTable/DataTableContent.tsx
773
+
774
+
775
+ function Content(props) {
776
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
777
+ _material.Stack,
778
+ {
779
+ direction: "row",
780
+ width: "100%",
781
+ flexGrow: 1,
782
+ alignItems: "center",
783
+ gap: 1.5,
784
+ sx: { background: "#f4f" },
785
+ ...props
786
+ }
787
+ );
788
+ }
789
+
790
+ // src/DataTable/DataTableExportCsvButton.tsx
791
+
792
+
793
+
794
+
795
+
796
+ var getFilteredRows2 = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
797
+ function ExportCsvButton() {
798
+ const { apiRef } = useTableRootContext();
799
+ const handleExport = (options) => {
800
+ if (_optionalChain([apiRef, 'optionalAccess', _5 => _5.current])) {
801
+ apiRef.current.exportDataAsCsv(options);
802
+ }
803
+ };
804
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
805
+ DataTableButton,
806
+ {
807
+ startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.FileDownload, {}),
808
+ onClick: () => handleExport({ getRowsToExport: getFilteredRows2 }),
809
+ children: "Exportar CSV"
810
+ }
811
+ );
812
+ }
813
+
814
+ // src/DataTable/DataTableFooter.tsx
815
+
816
+
817
+ function Footer(props) {
818
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
819
+ _material.TableFooter,
820
+ {
821
+ ...props,
822
+ sx: {
823
+ height: "54px",
824
+ paddingX: "12px",
825
+ gap: "12px",
826
+ display: "flex",
827
+ alignItems: "center",
828
+ backgroundColor: "white",
829
+ borderBottomLeftRadius: "8px",
830
+ borderBottomRightRadius: "8px",
831
+ borderTop: "1px solid #edf2f9"
832
+ }
833
+ }
834
+ );
835
+ }
836
+
837
+ // src/DataTable/DataTablePagination.tsx
838
+
839
+
840
+ var _hooks = require('@data-c/hooks');
841
+
842
+
843
+
844
+
845
+
846
+
847
+
848
+
849
+
850
+ function Pagination(props) {
851
+ const {
852
+ onChangePageSize,
853
+ onChangePage,
854
+ pagination,
855
+ rowsPerPageOptions = [15, 50, 100, 200]
856
+ } = props;
857
+ const { page, pageSize = 15, totalRecords } = pagination || {};
858
+ const pages = _react.useMemo.call(void 0, () => {
859
+ if (_optionalChain([pagination, 'optionalAccess', _6 => _6.lastPage]))
860
+ return pagination.lastPage;
861
+ if ((totalRecords || 0) < pageSize)
862
+ return 1;
863
+ return Math.max(Math.ceil((totalRecords || 0) / pageSize));
864
+ }, [totalRecords, pageSize]);
865
+ const totalRecordsLabel = _react.useMemo.call(void 0, () => {
866
+ if ((totalRecords || 0) < pageSize)
867
+ return `Exibindo ${_hooks.pluralizar.call(void 0,
868
+ totalRecords || 0,
869
+ "registro",
870
+ "registros",
871
+ true
872
+ )}`;
873
+ let registrosExibidos = pageSize;
874
+ if (page === pages) {
875
+ const ultimaPaginaRegistros = (totalRecords || 0) % pageSize;
876
+ registrosExibidos = ultimaPaginaRegistros === 0 ? pageSize : ultimaPaginaRegistros;
877
+ }
878
+ return `Exibindo ${_hooks.pluralizar.call(void 0,
879
+ registrosExibidos || 0,
880
+ "registro",
881
+ "registros",
882
+ true
883
+ )} de ${totalRecords}`;
884
+ }, [pagination, pages]);
885
+ const showPagination = true;
886
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
887
+ _material.Stack,
888
+ {
889
+ width: "100%",
890
+ direction: "row",
891
+ alignItems: "center",
892
+ gap: 2,
893
+ marginLeft: "auto",
894
+ children: [
895
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
896
+ _material.Typography,
897
+ {
898
+ variant: "body2",
899
+ fontSize: "13px",
900
+ fontWeight: "500",
901
+ whiteSpace: "nowrap",
902
+ children: totalRecordsLabel
903
+ }
904
+ ),
905
+ showPagination && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", gap: 2, marginLeft: "auto", children: [
906
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
907
+ _material.TextField,
908
+ {
909
+ sx: {
910
+ width: "78px",
911
+ fontSize: "8pt"
912
+ },
913
+ size: "small",
914
+ value: pageSize || 0,
915
+ select: true,
916
+ onChange: (e) => {
917
+ if (onChangePageSize) {
918
+ onChangePageSize(parseInt(e.target.value));
919
+ }
920
+ },
921
+ children: rowsPerPageOptions.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: option, children: option }, option))
922
+ }
923
+ ),
924
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
925
+ _material.Pagination,
926
+ {
927
+ variant: "outlined",
928
+ shape: "rounded",
929
+ count: pages || 0,
930
+ showFirstButton: true,
931
+ showLastButton: true,
932
+ onChange: (_, _page) => {
933
+ if (onChangePage)
934
+ onChangePage(_page);
935
+ },
936
+ page: page || 0,
937
+ color: "primary"
938
+ }
939
+ )
940
+ ] })
941
+ ]
942
+ }
943
+ );
944
+ }
945
+
946
+ // src/DataTable/DataTableRoot.tsx
947
+
948
+
949
+
950
+ function Root({ children, height, ...rest }) {
951
+ const tableContainerRef = _react.useRef.call(void 0, null);
952
+ const [tableHeight, setTableHeight] = _react.useState.call(void 0, 500);
953
+ _react.useEffect.call(void 0, () => {
954
+ const calculateHeight = () => {
955
+ const container = tableContainerRef.current;
956
+ if (!container)
957
+ return;
958
+ const containerTop = container.getBoundingClientRect().top;
959
+ setTableHeight(window.innerHeight - containerTop);
960
+ };
961
+ calculateHeight();
962
+ window.addEventListener("resize", calculateHeight);
963
+ return () => {
964
+ window.removeEventListener("resize", calculateHeight);
965
+ };
966
+ }, []);
967
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
968
+ _material.Stack,
969
+ {
970
+ ref: tableContainerRef,
971
+ sx: {
972
+ backgroundColor: "#f4f6fa",
973
+ border: "1px solid #edf2f9",
974
+ borderRadius: 2,
975
+ height: height || `calc(${tableHeight}px - 16px)`,
976
+ ...rest.sx
977
+ },
978
+ ...rest,
979
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TableRootProvider, { children })
980
+ }
981
+ );
982
+ }
983
+
984
+ // src/DataTable/DataTableSelectionCounter.tsx
985
+
986
+
987
+
988
+ function SelectionCounter(props) {
989
+ const { countTitle, gender } = props;
990
+ const { rowsSelectedId } = useTableRootContext();
991
+ const countQuantidade = _optionalChain([rowsSelectedId, 'optionalAccess', _7 => _7.ids, 'access', _8 => _8.size]) || 0;
992
+ const flexSufixCountTitle = _react.useMemo.call(void 0, () => {
993
+ if (!countTitle)
994
+ return "";
995
+ const selecionadoText = gender === "feminino" ? "selecionada" : "selecionado";
996
+ const selecionadosText = gender === "feminino" ? "selecionadas" : "selecionados";
997
+ const nenhumText = gender === "feminino" ? "Nenhuma" : "Nenhum";
998
+ return countQuantidade === 1 ? `${countTitle} ${selecionadoText}` : countQuantidade && countQuantidade > 1 ? `${countTitle.split(" ").map((item) => `${item}s`).join(" ")} ${selecionadosText}` : `${nenhumText} ${countTitle} ${selecionadoText}`;
999
+ }, [countQuantidade]);
1000
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Stack, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1001
+ _material.Typography,
1002
+ {
1003
+ variant: "body2",
1004
+ fontSize: "13px",
1005
+ fontWeight: "500",
1006
+ whiteSpace: "nowrap",
1007
+ children: [
1008
+ countQuantidade && countQuantidade > 0 ? countQuantidade : "",
1009
+ " ",
1010
+ flexSufixCountTitle
1011
+ ]
1012
+ }
1013
+ ) });
1014
+ }
1015
+
1016
+ // src/DataTable/DataTableTitle.tsx
1017
+
1018
+
1019
+ function Title({
1020
+ children,
1021
+ titleDivider = false,
1022
+ sx
1023
+ }) {
1024
+ const theme = _material.useTheme.call(void 0, );
1025
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1026
+ _material.Typography,
1027
+ {
1028
+ variant: "h6",
1029
+ whiteSpace: "nowrap",
1030
+ sx: {
1031
+ borderRight: titleDivider ? `solid 1px ${theme.palette.grey[300]}` : "none",
1032
+ paddingRight: 1.5,
1033
+ ...sx
1034
+ },
1035
+ children
1036
+ }
1037
+ );
1038
+ }
1039
+
1040
+ // src/DataTable/DataTableToolbar.tsx
1041
+
1042
+
1043
+ function Toolbar({ children }) {
1044
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1045
+ _material.Stack,
1046
+ {
1047
+ component: _material.Paper,
1048
+ elevation: 0,
1049
+ gap: 1.5,
1050
+ flexDirection: "row",
1051
+ justifyContent: "space-between",
1052
+ alignItems: "center",
1053
+ p: 1,
1054
+ borderRadius: "8px 8px 0 0",
1055
+ sx: { width: "100%" },
1056
+ children
1057
+ }
1058
+ );
1059
+ }
1060
+
1061
+ // src/DataTable/index.ts
1062
+ var DataTable = {
1063
+ CellActionTransport,
1064
+ SelectionCounter,
1065
+ CellActionDelete,
1066
+ ExportCsvButton,
1067
+ CellActionEdit,
1068
+ CellActions,
1069
+ CellAction,
1070
+ Pagination,
1071
+ Actions,
1072
+ Toolbar,
1073
+ Content,
1074
+ Button: DataTableButton,
1075
+ Footer,
1076
+ Table,
1077
+ Title,
1078
+ Root,
1079
+ Action: DataTableAction,
1080
+ ActionEdit: DataTableActionEdit,
1081
+ ActionDelete: DataTableActionDelete,
1082
+ ActionTransport: DataTableActionTransport,
1083
+ ColumnsPanelTrigger: _xdatagridpro.ColumnsPanelTrigger,
1084
+ useGridApiRef: _xdatagridpro.useGridApiRef
1085
+ };
1086
+ var DataTable_default = DataTable;
1087
+
1088
+
1089
+ exports.DataTable = DataTable_default;
2
1090
  /*! Bundled license information:
3
1091
 
4
1092
  lucide-react/dist/esm/shared/src/utils.js: