@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.03 kB
JavaScript
import{jsx as e}from"react/jsx-runtime";import i from"@mui/icons-material/MoreVert";import o from"@mui/material/IconButton";import r from"@mui/material/Typography";import t from"@mui/material/Tooltip";import l from"clsx";import{FileNameCell as n}from"./components/FileNameCell.js";import{FileUserCell as a}from"./components/FileUserCell.js";import{getMobileSheetCell as m,getActionCell as d}from"./components/FileActionCell.js";import{getHumanFileSize as c}from"../../core/util/functions/index.js";const s="NexusFileManagement",p=(e,i)=>{const o=new Date(e),r=new Date(i);return o.getTime()&&r.getTime()?o.getTime()-r.getTime():o.getTime()?o.getTime():r.getTime()?-r.getTime():0},f=(f,h,g,u,w)=>[{field:"name",headerName:h("name"),minWidth:g?180:250,flex:1,renderCell:i=>e(n,{row:i.row,isMobile:g,onAction:u})},{field:"owner",headerName:h("uploadedBy"),minWidth:g?50:100,flex:1,renderCell:i=>e(a,{row:i.row})},{field:"updatedTime",headerName:h("uploadedOn"),sortComparator:p,minWidth:100,flex:1,renderCell:i=>e(r,{noWrap:!0,color:"text.secondary",variant:"body2",children:i.row.updatedTime})},{field:"size",headerName:h("size"),type:"number",minWidth:50,flex:1,renderCell:i=>{const o=i.row.isFolder?"-":c(i.row.size,!0);return e(r,{color:"text.secondary",variant:"body2",children:o})}},g?{field:"action",cellClassName:l(`${s}-actionCell`,"file-management-action-cell"),minWidth:50,align:"right",filterable:!1,renderCell:r=>e(t,{arrow:!0,title:h("actions"),children:e(o,{"data-testid":"file-management-mobile-action","aria-label":h("actions"),sx:{"&:hover":{color:"primary.main",backgroundColor:"grey.200"}},onClick:()=>w(m({onAction:u,row:r.row})(f)),children:e(i,{})})})}:{field:"action",align:"right",type:"actions",cellClassName:l(`${s}-actionCell`,"file-management-action-cell","MuiDataGrid-cellAction-onHover"),minWidth:150,sortable:!1,filterable:!1,hideable:!1,flex:1,renderHeader:()=>e("span",{style:{opacity:0,width:0},children:h("actions")}),getActions:e=>d({onAction:u,row:e.row})(f)}];export{f as getDefaultColumns};