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

22 lines
559 B
TypeScript
Raw Normal View History

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