Lucas/t 295 fix checkbox column width (#261)
* wip * Fixed table and column width * Use last resizable column instead of table width 100% * Removed comments * Fix lint * Fixed table theme * Removed left clickable margin * Removed overflow * Added table width
This commit is contained in:
27
front/src/modules/ui/tables/utils/getCheckBoxColumn.tsx
Normal file
27
front/src/modules/ui/tables/utils/getCheckBoxColumn.tsx
Normal file
@ -0,0 +1,27 @@
|
||||
import { CellContext } from '@tanstack/react-table';
|
||||
|
||||
import { CheckboxCell } from '@/ui/components/table/CheckboxCell';
|
||||
import { SelectAllCheckbox } from '@/ui/components/table/SelectAllCheckbox';
|
||||
|
||||
export function getCheckBoxColumn() {
|
||||
return {
|
||||
id: 'select',
|
||||
header: ({ table }: any) => (
|
||||
<SelectAllCheckbox
|
||||
checked={table.getIsAllRowsSelected()}
|
||||
indeterminate={table.getIsSomeRowsSelected()}
|
||||
onChange={(newValue) => table.toggleAllRowsSelected(newValue)}
|
||||
/>
|
||||
),
|
||||
cell: (props: CellContext<any, string>) => (
|
||||
<CheckboxCell
|
||||
id={`checkbox-selected-${props.row.original.id}`}
|
||||
name={`checkbox-selected-${props.row.original.id}`}
|
||||
checked={props.row.getIsSelected()}
|
||||
onChange={(newValue) => props.row.toggleSelected(newValue)}
|
||||
/>
|
||||
),
|
||||
size: 32,
|
||||
maxSize: 32,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user