diff --git a/packages/odyssey-react-mui/src/DataTable/DataTable.tsx b/packages/odyssey-react-mui/src/DataTable/DataTable.tsx index ec80de53ee..36172e33d4 100644 --- a/packages/odyssey-react-mui/src/DataTable/DataTable.tsx +++ b/packages/odyssey-react-mui/src/DataTable/DataTable.tsx @@ -61,6 +61,7 @@ import { import { useScrollIndication } from "./useScrollIndication"; import styled from "@emotion/styled"; import { EmptyState } from "../EmptyState"; +import { Button } from "../Button"; import { Callout } from "../Callout"; export type DataTableColumn = MRT_ColumnDef & { @@ -255,62 +256,6 @@ export type DataTableProps = { maxPages?: number; }; -const displayColumnDefOptions = { - "mrt-row-actions": { - header: "", - grow: true, - muiTableBodyCellProps: { - align: "right", - sx: { - overflow: "visible", - width: "unset", - }, - className: "ods-actions-cell", - }, - muiTableHeadCellProps: { - align: "right", - sx: { - width: "unset", - }, - className: "ods-actions-cell", - }, - }, - "mrt-row-drag": { - header: "", - muiTableBodyCellProps: { - sx: { - minWidth: 0, - width: "auto", - }, - className: "ods-drag-handle", - }, - muiTableHeadCellProps: { - sx: { - minWidth: 0, - width: "auto", - }, - children: ( - // Add a spacer to simulate the width of the drag handle in the column. - // Without this, the head cells are offset from their body cell counterparts - - - - ), - }, - }, - "mrt-row-select": { - muiTableHeadCellProps: { - padding: "checkbox", - }, - muiTableBodyCellProps: { - padding: "checkbox", - }, - }, - "mrt-row-expand": { - header: "", - }, -}; - const ScrollableTableContainer = styled("div", { shouldForwardProp: (prop) => prop !== "odysseyDesignTokens" && @@ -677,14 +622,86 @@ const DataTable = ({ }, }, selectAllMode: "all", - displayColumnDefOptions: - displayColumnDefOptions as MRT_TableOptions["displayColumnDefOptions"], + displayColumnDefOptions: { + "mrt-row-actions": { + header: "", + grow: true, + muiTableBodyCellProps: { + align: "right", + sx: { + overflow: "visible", + width: "unset", + }, + className: "ods-actions-cell", + }, + muiTableHeadCellProps: { + align: "right", + sx: { + width: "unset", + }, + className: "ods-actions-cell", + children: ( + + {rowActionButtons && rowActionButtons({ id: null })} + {((hasRowReordering && onReorderRows) || rowActionMenuItems) && ( + +