import { Fragment } from 'react'; import { IRow, IRowData, IExtraData, IHeaderRow } from '../../../components'; import { mapOpenedRows } from '../../../components'; import { Tbody } from '../../../components'; export interface BodyWrapperProps { children?: React.ReactNode; mappedRows?: IRow[]; rows?: IRow[]; onCollapse?: ( event: React.MouseEvent, rowIndex: number, isOpen: boolean, rowData: IRowData, extraData: IExtraData ) => undefined; tbodyRef?: React.Ref | Function; headerRows?: IHeaderRow[]; } export const BodyWrapper: React.FunctionComponent = ({ mappedRows, tbodyRef, /* eslint-disable @typescript-eslint/no-unused-vars */ rows = [] as IRow[], onCollapse, headerRows, /* eslint-enable @typescript-eslint/no-unused-vars */ ...props }: BodyWrapperProps) => { if (mappedRows && mappedRows.some((row) => row.hasOwnProperty('parent'))) { return ( {mapOpenedRows(mappedRows, props.children).map((oneRow, key) => ( }> {oneRow.rows} ))} ); } return } />; }; BodyWrapper.displayName = 'BodyWrapper';