'use no memo'; 'use client'; 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) { 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); } }} />
); }