import { Row } from '@tanstack/react-table'; import { ReactNode } from 'react'; import { ExpandableDatatableTableRow } from './ExpandableDatatableRow'; import { Datatable, Props as DatatableProps, PaginationProps, } from './Datatable'; import { DefaultType } from './types'; interface Props extends Omit, 'renderRow' | 'expandable'> { renderSubRow(row: Row): ReactNode; expandOnRowClick?: boolean; } export function ExpandableDatatable({ renderSubRow, getRowCanExpand = () => true, expandOnRowClick, ...props }: Props & PaginationProps) { return ( // eslint-disable-next-line react/jsx-props-no-spreading {...props} getRowCanExpand={getRowCanExpand} renderRow={(row) => ( row={row} renderSubRow={renderSubRow} expandOnClick={expandOnRowClick} /> )} /> ); }