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

23 lines
590 B
TypeScript
Raw Normal View History

2023-09-10 20:17:18 +03:00
import { Table } from '@tanstack/react-table';
import CheckboxTristate from '@/components/Common/CheckboxTristate';
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 (
<CheckboxTristate
2023-12-28 14:04:44 +03:00
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;