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

24 lines
567 B
TypeScript
Raw Normal View History

2023-09-10 20:17:18 +03:00
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;