Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix truncation issue in DataTable #2426

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions packages/odyssey-react-mui/src/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -721,17 +721,37 @@ const DataTable = ({
},
muiTableBodyCellProps: ({ column }) => ({
className: column.getIsResizing() ? "isResizing" : "",
sx: {
overflowWrap: "anywhere",
maxWidth: odysseyDesignTokens.TypographyLineLengthMax,
},
}),

// Reordering
enableRowOrdering: hasRowReordering && Boolean(onReorderRows),
enableRowDragging: hasRowReordering && Boolean(onReorderRows),
muiTableBodyRowProps: ({ table, row }) => ({
muiDetailPanelProps: ({ row }) => ({
sx: {
paddingBlock: row.getIsExpanded()
? `${odysseyDesignTokens.Spacing3} !important`
: undefined,
},
}),
muiTableBodyRowProps: ({ table, row, isDetailPanel }) => ({
className: draggableTableBodyRowClassName({
currentRowId: row.id,
draggingRowId: draggingRow?.id,
hoveredRowId: table.getState().hoveredRow?.id,
}),
sx: isDetailPanel
? {
paddingBlock: "0 !important",
border: 0,
["&:hover"]: {
backgroundColor: `${odysseyDesignTokens.HueNeutralWhite} !important`,
},
}
: {},
}),
muiRowDragHandleProps: ({ table, row }) => ({
onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),
Expand Down Expand Up @@ -778,10 +798,7 @@ const DataTable = ({
// Refs
muiTableProps: {
ref: tableContentRef,
className:
!shouldDisplayRowActions && hasColumnResizing
? "ods-hide-spacer-column"
: "",
className: !shouldDisplayRowActions && hasColumnResizing ? "" : "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jordankoschei-okta We are never setting any className here. Might as well just remove this prop or set it as empty string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does removing this reintroduce weird last column issues we've seen in the past?

},

muiTableContainerProps: {
Expand Down