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