31 lines
888 B
TypeScript
31 lines
888 B
TypeScript
|
import { Checkbox } from "@/components/ui/checkbox";
|
||
|
import { CellContext, Column, ColumnDef, ColumnMeta, Header, HeaderContext, RowSelectionTableState, Table, TableState } from "@tanstack/react-table";
|
||
|
|
||
|
export const selectCol = {
|
||
|
id: "select",
|
||
|
header: (props: HeaderContext<any, any>) => {
|
||
|
return (
|
||
|
<div className="flex items-center justify-center">
|
||
|
<Checkbox
|
||
|
checked={props.table.getIsAllRowsSelected()}
|
||
|
onCheckedChange={props.table.toggleAllRowsSelected}
|
||
|
aria-label="select/deselect all rows"
|
||
|
/>
|
||
|
</div>
|
||
|
|
||
|
)
|
||
|
},
|
||
|
|
||
|
cell: (props: CellContext<any, any>) => {
|
||
|
return (
|
||
|
<div className="flex items-center justify-center">
|
||
|
<Checkbox
|
||
|
checked={props.row.getIsSelected()}
|
||
|
onCheckedChange={props.row.toggleSelected}
|
||
|
aria-label="select/deselect row" />
|
||
|
</div>
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
|