@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
2 lines (1 loc) • 2.25 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("@mui/icons-material/MoreVert"),t=require("@mui/material/IconButton"),l=require("@mui/material/Typography"),r=require("@mui/material/Tooltip"),a=require("clsx"),n=require("./components/FileNameCell.js"),o=require("./components/FileUserCell.js"),d=require("./components/FileActionCell.js"),s=require("../../core/util/functions/index.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=c(i),u=c(t),f=c(l),g=c(r),h=c(a);const x="NexusFileManagement",p=(e,i)=>{const t=new Date(e),l=new Date(i);return t.getTime()&&l.getTime()?t.getTime()-l.getTime():t.getTime()?t.getTime():l.getTime()?-l.getTime():0};exports.getDefaultColumns=(i,t,l,r,a)=>[{field:"name",headerName:t("name"),minWidth:l?180:250,flex:1,renderCell:i=>e.jsx(n.FileNameCell,{row:i.row,isMobile:l,onAction:r})},{field:"owner",headerName:t("uploadedBy"),minWidth:l?50:100,flex:1,renderCell:i=>e.jsx(o.FileUserCell,{row:i.row})},{field:"updatedTime",headerName:t("uploadedOn"),sortComparator:p,minWidth:100,flex:1,renderCell:i=>e.jsx(f.default,{noWrap:!0,color:"text.secondary",variant:"body2",children:i.row.updatedTime})},{field:"size",headerName:t("size"),type:"number",minWidth:50,flex:1,renderCell:i=>{const t=i.row.isFolder?"-":s.getHumanFileSize(i.row.size,!0);return e.jsx(f.default,{color:"text.secondary",variant:"body2",children:t})}},l?{field:"action",cellClassName:h.default(`${x}-actionCell`,"file-management-action-cell"),minWidth:50,align:"right",filterable:!1,renderCell:l=>e.jsx(g.default,{arrow:!0,title:t("actions"),children:e.jsx(u.default,{"data-testid":"file-management-mobile-action","aria-label":t("actions"),sx:{"&:hover":{color:"primary.main",backgroundColor:"grey.200"}},onClick:()=>a(d.getMobileSheetCell({onAction:r,row:l.row})(i)),children:e.jsx(m.default,{})})})}:{field:"action",align:"right",type:"actions",cellClassName:h.default(`${x}-actionCell`,"file-management-action-cell","MuiDataGrid-cellAction-onHover"),minWidth:150,sortable:!1,filterable:!1,hideable:!1,flex:1,renderHeader:()=>e.jsx("span",{style:{opacity:0,width:0},children:t("actions")}),getActions:e=>d.getActionCell({onAction:r,row:e.row})(i)}];