@data-c/pro 0.2.51 → 0.2.54

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,1085 @@
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.Button =ot;exports.Button = 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
+ },
335
+ ".MuiDataGrid-columnHeaderTitle": {
336
+ fontSize: "12px",
337
+ color: "#0b0e14",
338
+ fontWeight: "600"
339
+ },
340
+ "& .sticky-cell": {
341
+ position: "sticky",
342
+ right: 0,
343
+ background: "inherit",
344
+ zIndex: 1
345
+ },
346
+ "& .sticky-header": {
347
+ position: "sticky",
348
+ right: 0,
349
+ background: "inherit",
350
+ zIndex: 2
351
+ }
352
+ },
353
+ ...rest
354
+ }
355
+ )
356
+ ] });
357
+ }
358
+
359
+ // src/DataTable/DataTableAction.tsx
360
+
361
+
362
+
363
+
364
+ function DataTableAction(props) {
365
+ const { ref, ...rest } = props;
366
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
367
+ _xdatagridpro.GridActionsCellItem,
368
+ {
369
+ ...rest,
370
+ ref
371
+ }
372
+ );
373
+ }
374
+
375
+ // src/DataTable/DataTableActionDelete.tsx
376
+
377
+
378
+
379
+
380
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
381
+
382
+
383
+ // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
384
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
385
+ var toCamelCase = (string) => string.replace(
386
+ /^([A-Z])|[\s-_]+(\w)/g,
387
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
388
+ );
389
+ var toPascalCase = (string) => {
390
+ const camelCase = toCamelCase(string);
391
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
392
+ };
393
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
394
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
395
+ }).join(" ").trim();
396
+ var hasA11yProp = (props) => {
397
+ for (const prop in props) {
398
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
399
+ return true;
400
+ }
401
+ }
402
+ };
403
+
404
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
405
+
406
+
407
+ // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
408
+ var defaultAttributes = {
409
+ xmlns: "http://www.w3.org/2000/svg",
410
+ width: 24,
411
+ height: 24,
412
+ viewBox: "0 0 24 24",
413
+ fill: "none",
414
+ stroke: "currentColor",
415
+ strokeWidth: 2,
416
+ strokeLinecap: "round",
417
+ strokeLinejoin: "round"
418
+ };
419
+
420
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
421
+ var Icon = _react.forwardRef.call(void 0,
422
+ ({
423
+ color = "currentColor",
424
+ size = 24,
425
+ strokeWidth = 2,
426
+ absoluteStrokeWidth,
427
+ className = "",
428
+ children,
429
+ iconNode,
430
+ ...rest
431
+ }, ref) => _react.createElement.call(void 0,
432
+ "svg",
433
+ {
434
+ ref,
435
+ ...defaultAttributes,
436
+ width: size,
437
+ height: size,
438
+ stroke: color,
439
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
440
+ className: mergeClasses("lucide", className),
441
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
442
+ ...rest
443
+ },
444
+ [
445
+ ...iconNode.map(([tag, attrs]) => _react.createElement.call(void 0, tag, attrs)),
446
+ ...Array.isArray(children) ? children : [children]
447
+ ]
448
+ )
449
+ );
450
+
451
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
452
+ var createLucideIcon = (iconName, iconNode) => {
453
+ const Component = _react.forwardRef.call(void 0,
454
+ ({ className, ...props }, ref) => _react.createElement.call(void 0, Icon, {
455
+ ref,
456
+ iconNode,
457
+ className: mergeClasses(
458
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
459
+ `lucide-${iconName}`,
460
+ className
461
+ ),
462
+ ...props
463
+ })
464
+ );
465
+ Component.displayName = toPascalCase(iconName);
466
+ return Component;
467
+ };
468
+
469
+ // ../../node_modules/lucide-react/dist/esm/icons/arrow-big-down.js
470
+ var __iconNode = [
471
+ [
472
+ "path",
473
+ {
474
+ 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",
475
+ key: "1eaqc3"
476
+ }
477
+ ]
478
+ ];
479
+ var ArrowBigDown = createLucideIcon("arrow-big-down", __iconNode);
480
+
481
+ // ../../node_modules/lucide-react/dist/esm/icons/pencil.js
482
+ var __iconNode2 = [
483
+ [
484
+ "path",
485
+ {
486
+ 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",
487
+ key: "1a8usu"
488
+ }
489
+ ],
490
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
491
+ ];
492
+ var Pencil = createLucideIcon("pencil", __iconNode2);
493
+
494
+ // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
495
+ var __iconNode3 = [
496
+ ["path", { d: "M10 11v6", key: "nco0om" }],
497
+ ["path", { d: "M14 11v6", key: "outv1u" }],
498
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
499
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
500
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
501
+ ];
502
+ var Trash2 = createLucideIcon("trash-2", __iconNode3);
503
+
504
+ // src/DataTable/DataTableActionDelete.tsx
505
+
506
+ function DataTableActionDelete(props) {
507
+ const { ref, ...rest } = props;
508
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
509
+ _xdatagridpro.GridActionsCellItem,
510
+ {
511
+ color: "error",
512
+ label: "Deletar",
513
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Trash2, { size: 16 }),
514
+ ...rest,
515
+ ref
516
+ }
517
+ );
518
+ }
519
+
520
+ // src/DataTable/DataTableActionEdit.tsx
521
+
522
+
523
+
524
+
525
+ function DataTableActionEdit(props) {
526
+ const { ref, ...rest } = props;
527
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
528
+ _xdatagridpro.GridActionsCellItem,
529
+ {
530
+ label: "Editar",
531
+ color: "primary",
532
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Pencil, { size: 16 }),
533
+ ...rest,
534
+ ref
535
+ }
536
+ );
537
+ }
538
+
539
+ // src/DataTable/DataTableActions.tsx
540
+
541
+
542
+
543
+ function Actions({ children, breakpoints }) {
544
+ const { setBreakpoint } = useTableRootContext();
545
+ const theme = _material.useTheme.call(void 0, );
546
+ const breakpoint = _material.useMediaQuery.call(void 0, theme.breakpoints.down(breakpoints || "md"));
547
+ _react.useEffect.call(void 0, () => {
548
+ setBreakpoint(breakpoint);
549
+ }, [breakpoint]);
550
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
551
+ _material.Stack,
552
+ {
553
+ flexDirection: "row",
554
+ alignItems: "center",
555
+ justifyContent: "flex-end",
556
+ gap: 1,
557
+ marginLeft: "auto",
558
+ flexGrow: 1,
559
+ children
560
+ }
561
+ );
562
+ }
563
+
564
+ // src/DataTable/DataTableActionTransport.tsx
565
+
566
+
567
+
568
+
569
+ function DataTableActionTransport(props) {
570
+ const { ref, ...rest } = props;
571
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
572
+ _xdatagridpro.GridActionsCellItem,
573
+ {
574
+ color: "primary",
575
+ label: "Transportar",
576
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ArrowBigDown, { size: 16 }),
577
+ ...rest,
578
+ ref
579
+ }
580
+ );
581
+ }
582
+
583
+ // src/DataTable/DataTableButton.tsx
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+ function DataTableButton(props) {
593
+ const { isLoading, startIcon, children, title, ...rest } = props;
594
+ const { breakpoint } = useTableRootContext();
595
+ 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,
596
+ _material.IconButton,
597
+ {
598
+ ...rest,
599
+ color: "primary",
600
+ disabled: isLoading ? true : rest.disabled,
601
+ children: [
602
+ startIcon,
603
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
604
+ _material.CircularProgress,
605
+ {
606
+ color: "secondary",
607
+ size: 14,
608
+ sx: {
609
+ position: "absolute",
610
+ top: "25%",
611
+ bottom: "25%",
612
+ left: "25%",
613
+ right: "25%",
614
+ transform: "translate(-50%, -50%)"
615
+ }
616
+ }
617
+ )
618
+ ]
619
+ }
620
+ ) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
621
+ _material.Button,
622
+ {
623
+ startIcon,
624
+ disabled: isLoading ? true : rest.disabled,
625
+ sx: {
626
+ position: "relative",
627
+ height: "26px",
628
+ minWidth: "70px",
629
+ padding: "7px 8px 8px",
630
+ border: "1px solid rgba(223, 226, 231, 0.8)",
631
+ borderRadius: "6px",
632
+ display: "flex",
633
+ alignItems: "center",
634
+ overflow: "hidden",
635
+ whiteSpace: "nowrap",
636
+ flexShrink: 1,
637
+ transition: "width 0.2s ease"
638
+ },
639
+ ...rest,
640
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
641
+ _material.Box,
642
+ {
643
+ component: "span",
644
+ sx: {
645
+ transition: "opacity 0.2s ease, width 0.2s ease",
646
+ overflow: "hidden",
647
+ whiteSpace: "nowrap",
648
+ textOverflow: "ellipsis"
649
+ },
650
+ children: [
651
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
652
+ _material.CircularProgress,
653
+ {
654
+ color: "secondary",
655
+ size: 14,
656
+ sx: {
657
+ position: "absolute",
658
+ top: "22%",
659
+ left: "44%",
660
+ transform: "translate(-50%, -50%)"
661
+ }
662
+ }
663
+ ),
664
+ children
665
+ ]
666
+ }
667
+ )
668
+ }
669
+ ) });
670
+ }
671
+
672
+ // src/DataTable/DataTableCellAction.tsx
673
+
674
+
675
+ function CellAction(props) {
676
+ const { event, onClick, ...rest } = props;
677
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
678
+ _xdatagridpro.GridActionsCellItem,
679
+ {
680
+ label: "A\xE7\xE3o",
681
+ onClick: () => {
682
+ },
683
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u{1F527}" })
684
+ }
685
+ );
686
+ }
687
+
688
+ // src/DataTable/DataTableCellActionDelete.tsx
689
+
690
+
691
+
692
+ function CellActionDelete({
693
+ onClick,
694
+ ...rest
695
+ }) {
696
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
697
+ _xdatagridpro.GridActionsCellItem,
698
+ {
699
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Delete, {}),
700
+ label: "Delete",
701
+ color: "primary",
702
+ onClick: () => {
703
+ if (onClick)
704
+ onClick("delete");
705
+ },
706
+ ...rest
707
+ }
708
+ );
709
+ }
710
+
711
+ // src/DataTable/DataTableCellActionEdit.tsx
712
+
713
+
714
+
715
+ function CellActionEdit({
716
+ onClick,
717
+ ...rest
718
+ }) {
719
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
720
+ _xdatagridpro.GridActionsCellItem,
721
+ {
722
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Edit, {}),
723
+ label: "Edit",
724
+ color: "primary",
725
+ onClick: () => onClick && onClick("edit"),
726
+ ...rest
727
+ }
728
+ );
729
+ }
730
+
731
+ // src/DataTable/DataTableCellActions.tsx
732
+
733
+
734
+ function CellActions(props) {
735
+ const { children, onClick: onItemClick } = props;
736
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: _react.Children.map(children, (child) => {
737
+ if (_react.isValidElement.call(void 0, child)) {
738
+ return _react.cloneElement.call(void 0, child, {
739
+ onClick: onItemClick
740
+ });
741
+ }
742
+ }) });
743
+ }
744
+
745
+ // src/DataTable/DataTableCellActionTransport.tsx
746
+
747
+
748
+
749
+ function CellActionTransport({
750
+ onClick,
751
+ ...rest
752
+ }) {
753
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
754
+ _xdatagridpro.GridActionsCellItem,
755
+ {
756
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.GetApp, {}),
757
+ label: "Transport",
758
+ color: "primary",
759
+ onClick: () => onClick && onClick("transport"),
760
+ ...rest
761
+ }
762
+ );
763
+ }
764
+
765
+ // src/DataTable/DataTableContent.tsx
766
+
767
+
768
+ function Content(props) {
769
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
770
+ _material.Stack,
771
+ {
772
+ direction: "row",
773
+ width: "100%",
774
+ flexGrow: 1,
775
+ alignItems: "center",
776
+ gap: 1.5,
777
+ sx: { background: "#f4f" },
778
+ ...props
779
+ }
780
+ );
781
+ }
782
+
783
+ // src/DataTable/DataTableExportCsvButton.tsx
784
+
785
+
786
+
787
+
788
+
789
+ var getFilteredRows2 = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
790
+ function ExportCsvButton() {
791
+ const { apiRef } = useTableRootContext();
792
+ const handleExport = (options) => {
793
+ if (_optionalChain([apiRef, 'optionalAccess', _5 => _5.current])) {
794
+ apiRef.current.exportDataAsCsv(options);
795
+ }
796
+ };
797
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
798
+ DataTableButton,
799
+ {
800
+ startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.FileDownload, {}),
801
+ onClick: () => handleExport({ getRowsToExport: getFilteredRows2 }),
802
+ children: "Exportar CSV"
803
+ }
804
+ );
805
+ }
806
+
807
+ // src/DataTable/DataTableFooter.tsx
808
+
809
+
810
+ function Footer(props) {
811
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
812
+ _material.TableFooter,
813
+ {
814
+ ...props,
815
+ sx: {
816
+ height: "54px",
817
+ paddingX: "12px",
818
+ gap: "12px",
819
+ display: "flex",
820
+ alignItems: "center",
821
+ backgroundColor: "white",
822
+ borderBottomLeftRadius: "8px",
823
+ borderBottomRightRadius: "8px",
824
+ borderTop: "1px solid #edf2f9"
825
+ }
826
+ }
827
+ );
828
+ }
829
+
830
+ // src/DataTable/DataTablePagination.tsx
831
+
832
+
833
+ var _hooks = require('@data-c/hooks');
834
+
835
+
836
+
837
+
838
+
839
+
840
+
841
+
842
+
843
+ function Pagination(props) {
844
+ const {
845
+ onChangePageSize,
846
+ onChangePage,
847
+ pagination,
848
+ rowsPerPageOptions = [15, 50, 100, 200]
849
+ } = props;
850
+ const { page, pageSize = 15, totalRecords } = pagination || {};
851
+ const pages = _react.useMemo.call(void 0, () => {
852
+ if (_optionalChain([pagination, 'optionalAccess', _6 => _6.lastPage]))
853
+ return pagination.lastPage;
854
+ if ((totalRecords || 0) < pageSize)
855
+ return 1;
856
+ return Math.max(Math.ceil((totalRecords || 0) / pageSize));
857
+ }, [totalRecords, pageSize]);
858
+ const totalRecordsLabel = _react.useMemo.call(void 0, () => {
859
+ if ((totalRecords || 0) < pageSize)
860
+ return `Exibindo ${_hooks.pluralizar.call(void 0,
861
+ totalRecords || 0,
862
+ "registro",
863
+ "registros",
864
+ true
865
+ )}`;
866
+ let registrosExibidos = pageSize;
867
+ if (page === pages) {
868
+ const ultimaPaginaRegistros = (totalRecords || 0) % pageSize;
869
+ registrosExibidos = ultimaPaginaRegistros === 0 ? pageSize : ultimaPaginaRegistros;
870
+ }
871
+ return `Exibindo ${_hooks.pluralizar.call(void 0,
872
+ registrosExibidos || 0,
873
+ "registro",
874
+ "registros",
875
+ true
876
+ )} de ${totalRecords}`;
877
+ }, [pagination, pages]);
878
+ const showPagination = true;
879
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
880
+ _material.Stack,
881
+ {
882
+ width: "100%",
883
+ direction: "row",
884
+ alignItems: "center",
885
+ gap: 2,
886
+ marginLeft: "auto",
887
+ children: [
888
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
889
+ _material.Typography,
890
+ {
891
+ variant: "body2",
892
+ fontSize: "13px",
893
+ fontWeight: "500",
894
+ whiteSpace: "nowrap",
895
+ children: totalRecordsLabel
896
+ }
897
+ ),
898
+ showPagination && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", gap: 2, marginLeft: "auto", children: [
899
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
900
+ _material.TextField,
901
+ {
902
+ sx: {
903
+ width: "78px",
904
+ fontSize: "8pt"
905
+ },
906
+ size: "small",
907
+ value: pageSize || 0,
908
+ select: true,
909
+ onChange: (e) => {
910
+ if (onChangePageSize) {
911
+ onChangePageSize(parseInt(e.target.value));
912
+ }
913
+ },
914
+ children: rowsPerPageOptions.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: option, children: option }, option))
915
+ }
916
+ ),
917
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
918
+ _material.Pagination,
919
+ {
920
+ variant: "outlined",
921
+ shape: "rounded",
922
+ count: pages || 0,
923
+ showFirstButton: true,
924
+ showLastButton: true,
925
+ onChange: (_, _page) => {
926
+ if (onChangePage)
927
+ onChangePage(_page);
928
+ },
929
+ page: page || 0,
930
+ color: "primary"
931
+ }
932
+ )
933
+ ] })
934
+ ]
935
+ }
936
+ );
937
+ }
938
+
939
+ // src/DataTable/DataTableRoot.tsx
940
+
941
+
942
+
943
+ function Root({ children, height, ...rest }) {
944
+ const tableContainerRef = _react.useRef.call(void 0, null);
945
+ const [tableHeight, setTableHeight] = _react.useState.call(void 0, 500);
946
+ _react.useEffect.call(void 0, () => {
947
+ const calculateHeight = () => {
948
+ const container = tableContainerRef.current;
949
+ if (!container)
950
+ return;
951
+ const containerTop = container.getBoundingClientRect().top;
952
+ setTableHeight(window.innerHeight - containerTop);
953
+ };
954
+ calculateHeight();
955
+ window.addEventListener("resize", calculateHeight);
956
+ return () => {
957
+ window.removeEventListener("resize", calculateHeight);
958
+ };
959
+ }, []);
960
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
961
+ _material.Stack,
962
+ {
963
+ ref: tableContainerRef,
964
+ sx: {
965
+ backgroundColor: "#f4f6fa",
966
+ border: "1px solid #edf2f9",
967
+ borderRadius: 2,
968
+ height: height || `calc(${tableHeight}px - 16px)`,
969
+ ...rest.sx
970
+ },
971
+ ...rest,
972
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TableRootProvider, { children })
973
+ }
974
+ );
975
+ }
976
+
977
+ // src/DataTable/DataTableSelectionCounter.tsx
978
+
979
+
980
+
981
+ function SelectionCounter(props) {
982
+ const { countTitle, gender } = props;
983
+ const { rowsSelectedId } = useTableRootContext();
984
+ const countQuantidade = _optionalChain([rowsSelectedId, 'optionalAccess', _7 => _7.ids, 'access', _8 => _8.size]) || 0;
985
+ const flexSufixCountTitle = _react.useMemo.call(void 0, () => {
986
+ if (!countTitle)
987
+ return "";
988
+ const selecionadoText = gender === "feminino" ? "selecionada" : "selecionado";
989
+ const selecionadosText = gender === "feminino" ? "selecionadas" : "selecionados";
990
+ const nenhumText = gender === "feminino" ? "Nenhuma" : "Nenhum";
991
+ return countQuantidade === 1 ? `${countTitle} ${selecionadoText}` : countQuantidade && countQuantidade > 1 ? `${countTitle.split(" ").map((item) => `${item}s`).join(" ")} ${selecionadosText}` : `${nenhumText} ${countTitle} ${selecionadoText}`;
992
+ }, [countQuantidade]);
993
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Stack, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
994
+ _material.Typography,
995
+ {
996
+ variant: "body2",
997
+ fontSize: "13px",
998
+ fontWeight: "500",
999
+ whiteSpace: "nowrap",
1000
+ children: [
1001
+ countQuantidade && countQuantidade > 0 ? countQuantidade : "",
1002
+ " ",
1003
+ flexSufixCountTitle
1004
+ ]
1005
+ }
1006
+ ) });
1007
+ }
1008
+
1009
+ // src/DataTable/DataTableTitle.tsx
1010
+
1011
+
1012
+ function Title({
1013
+ children,
1014
+ titleDivider = false,
1015
+ sx
1016
+ }) {
1017
+ const theme = _material.useTheme.call(void 0, );
1018
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1019
+ _material.Typography,
1020
+ {
1021
+ variant: "h6",
1022
+ whiteSpace: "nowrap",
1023
+ sx: {
1024
+ borderRight: titleDivider ? `solid 1px ${theme.palette.grey[300]}` : "none",
1025
+ paddingRight: 1.5,
1026
+ ...sx
1027
+ },
1028
+ children
1029
+ }
1030
+ );
1031
+ }
1032
+
1033
+ // src/DataTable/DataTableToolbar.tsx
1034
+
1035
+
1036
+ function Toolbar({ children }) {
1037
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1038
+ _material.Stack,
1039
+ {
1040
+ component: _material.Paper,
1041
+ elevation: 0,
1042
+ gap: 1.5,
1043
+ flexDirection: "row",
1044
+ justifyContent: "space-between",
1045
+ alignItems: "center",
1046
+ p: 1,
1047
+ borderRadius: "8px 8px 0 0",
1048
+ sx: { width: "100%" },
1049
+ children
1050
+ }
1051
+ );
1052
+ }
1053
+
1054
+ // src/DataTable/index.ts
1055
+ var DataTable = {
1056
+ CellActionTransport,
1057
+ SelectionCounter,
1058
+ CellActionDelete,
1059
+ ExportCsvButton,
1060
+ CellActionEdit,
1061
+ CellActions,
1062
+ CellAction,
1063
+ Pagination,
1064
+ Actions,
1065
+ Toolbar,
1066
+ Content,
1067
+ Button: DataTableButton,
1068
+ Footer,
1069
+ Table,
1070
+ Title,
1071
+ Root,
1072
+ Action: DataTableAction,
1073
+ ActionEdit: DataTableActionEdit,
1074
+ ActionDelete: DataTableActionDelete,
1075
+ ActionTransport: DataTableActionTransport,
1076
+ ColumnsPanelTrigger: _xdatagridpro.ColumnsPanelTrigger,
1077
+ useGridApiRef: _xdatagridpro.useGridApiRef
1078
+ };
1079
+ var DataTable_default = DataTable;
1080
+
1081
+
1082
+ exports.DataTable = DataTable_default;
2
1083
  /*! Bundled license information:
3
1084
 
4
1085
  lucide-react/dist/esm/shared/src/utils.js: