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

23 lines
566 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> {
2023-12-28 14:04:44 +03:00
table: Table<TData>;
2023-09-10 20:17:18 +03:00
}
2023-12-28 14:04:44 +03:00
function SelectAll<TData>({ table }: SelectAllProps<TData>) {
2023-09-10 20:17:18 +03:00
return (
2023-12-28 14:04:44 +03:00
<Tristate
tabIndex={-1}
title='Выделить все'
value={
!table.getIsAllPageRowsSelected() && table.getIsSomePageRowsSelected() ? null : table.getIsAllPageRowsSelected()
}
setValue={value => table.toggleAllPageRowsSelected(value !== false)}
/>
);
2023-09-10 20:17:18 +03:00
}
2023-12-28 14:04:44 +03:00
export default SelectAll;