ConceptPortal-public/rsconcept/frontend/src/components/DataTable/SelectAll.tsx

23 lines
590 B
TypeScript

import { Table } from '@tanstack/react-table';
import CheckboxTristate from '@/components/Common/CheckboxTristate';
interface SelectAllProps<TData> {
table: Table<TData>;
}
function SelectAll<TData>({ table }: SelectAllProps<TData>) {
return (
<CheckboxTristate
tabIndex={-1}
title='Выделить все'
value={
!table.getIsAllPageRowsSelected() && table.getIsSomePageRowsSelected() ? null : table.getIsAllPageRowsSelected()
}
setValue={value => table.toggleAllPageRowsSelected(value !== false)}
/>
);
}
export default SelectAll;