2024-06-07 20:17:03 +03:00
|
|
|
import { Row } from '@tanstack/react-table';
|
|
|
|
|
|
|
|
import Checkbox from '@/components/ui/Checkbox';
|
|
|
|
|
|
|
|
interface SelectRowProps<TData> {
|
|
|
|
row: Row<TData>;
|
2024-11-21 00:26:04 +03:00
|
|
|
onChangeLastSelected: (newValue: string | undefined) => void;
|
2024-06-07 20:17:03 +03:00
|
|
|
}
|
|
|
|
|
2024-11-21 00:26:04 +03:00
|
|
|
function SelectRow<TData>({ row, onChangeLastSelected }: SelectRowProps<TData>) {
|
2024-06-07 20:17:03 +03:00
|
|
|
function handleChange(value: boolean) {
|
2024-11-21 00:26:04 +03:00
|
|
|
onChangeLastSelected(row.id);
|
2024-06-07 20:17:03 +03:00
|
|
|
row.toggleSelected(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
return <Checkbox tabIndex={-1} value={row.getIsSelected()} setValue={handleChange} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SelectRow;
|