'use no memo'; import { type Table } from '@tanstack/react-table'; import { IconPageFirst, IconPageLast, IconPageLeft, IconPageRight } from '../icons'; import { SelectPagination } from './select-pagination'; interface PaginationToolsProps { id?: string; table: Table; paginationOptions: readonly number[]; onChangePaginationOption?: (newValue: number) => void; } export function PaginationTools({ id, table, onChangePaginationOption, paginationOptions }: PaginationToolsProps) { const buttonClass = 'cc-hover-text cc-animate-color focus-outline rounded-md disabled:opacity-75 not-[:disabled]:cursor-pointer'; return (
{`${table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1} - ${Math.min( table.getFilteredRowModel().rows.length, (table.getState().pagination.pageIndex + 1) * table.getState().pagination.pageSize )} из ${table.getFilteredRowModel().rows.length}`}
{ const page = event.target.value ? Number(event.target.value) - 1 : 0; if (page + 1 <= table.getPageCount()) { table.setPageIndex(page); } }} />
); }