ConceptPortal-public/rsconcept/frontend/src/components/DataTable/SelectAll.tsx
2023-11-26 02:24:16 +03:00

24 lines
567 B
TypeScript

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