import { parseFromValuesOrFunc } from "@/core/utils/utils"; import { Paper } from "@mui/material"; import DataTable_BottomToolbar from "../toolbar/BottomToolbar"; import DataTable_TopToolbar from "../toolbar/TopToolbar"; import DataTable_TableContainer from "./TableContainer"; const DataTable_Paper = ({ table, ...rest }) => { const { getState, options: { enableBottomToolbar, enableTopToolbar, mrtTheme: { baseBackgroundColor }, muiTablePaperProps, renderBottomToolbar, renderTopToolbar, }, refs: { tablePaperRef }, } = table; const { isFullScreen } = getState(); const paperProps = { ...parseFromValuesOrFunc(muiTablePaperProps, { table }), ...rest, }; return ( { tablePaperRef.current = ref; if (paperProps?.ref) { //@ts-ignore paperProps.ref.current = ref; } }} style={{ ...(isFullScreen ? { bottom: 0, height: "100dvh", left: 0, margin: 0, maxHeight: "100dvh", maxWidth: "100dvw", padding: 0, position: "fixed", right: 0, top: 0, width: "100dvw", zIndex: 999, } : {}), ...paperProps?.style, }} sx={(theme) => ({ backgroundColor: baseBackgroundColor, backgroundImage: "unset", overflow: "hidden", transition: "all 100ms ease-in-out", ...parseFromValuesOrFunc(paperProps?.sx, theme), })} > {enableTopToolbar && (parseFromValuesOrFunc(renderTopToolbar, { table }) ?? ( ))} {enableBottomToolbar && (parseFromValuesOrFunc(renderBottomToolbar, { table }) ?? )} ); }; export default DataTable_Paper;