diff --git a/src/components/DataTable/DataTable.stories.tsx b/src/components/DataTable/DataTable.stories.tsx index 2e7a7a4..54fd716 100644 --- a/src/components/DataTable/DataTable.stories.tsx +++ b/src/components/DataTable/DataTable.stories.tsx @@ -228,6 +228,7 @@ export const Grouped: Story = { header: 'Status' } ], + enableResizing: false, header: 'Internal' }, { @@ -241,15 +242,32 @@ export const Grouped: Story = { header: 'Amount' } ], + enableResizing: false, header: 'Details' } ], + data: createData(100), onRowDoubleClick(row) { alert(`row with ID ${row.id} double clicked`); }, onSearchChange: () => { return; - } + }, + rowActions: [ + { + label: 'Modify', + onSelect: () => { + alert('Modify'); + } + }, + { + destructive: true, + label: 'Delete', + onSelect: () => { + alert('Delete'); + } + } + ] } }; diff --git a/src/components/DataTable/DataTableBody.tsx b/src/components/DataTable/DataTableBody.tsx index c515a69..4c7d8f9 100644 --- a/src/components/DataTable/DataTableBody.tsx +++ b/src/components/DataTable/DataTableBody.tsx @@ -63,7 +63,11 @@ export const DataTableBody: React.FC< } const content = flexRender(cell.column.columnDef.cell, cell.getContext()); return ( -
+
{content && typeof content === 'object' ? content : {content}}
); diff --git a/src/components/DataTable/DataTableHead.tsx b/src/components/DataTable/DataTableHead.tsx index f720eb4..857517f 100644 --- a/src/components/DataTable/DataTableHead.tsx +++ b/src/components/DataTable/DataTableHead.tsx @@ -1,3 +1,4 @@ +import { ACTIONS_COLUMN_ID } from './constants.ts'; import { useDataTableHandle } from './hooks.ts'; import { flexRender } from './utils.tsx'; @@ -24,11 +25,12 @@ export const DataTableHead = () => { style.position = 'sticky'; style.zIndex = 20; } - // no border with actions on right - // TODO - consider resizing toggle in this case - if (header.column.getIsLastColumn('center')) { + + const nextHeader = headerGroup.headers[header.index + 1]; + if (nextHeader?.column.id === ACTIONS_COLUMN_ID) { style.borderRight = 'none'; } + return (