import React, { forwardRef, HTMLAttributes, PropsWithChildren } from 'react'; import { observer } from 'mobx-react-lite'; import { LoadingRowState } from '../LoadingRow/LoadingRowState'; import { LoadingRowTD } from '../LoadingRow/LoadingRowTD'; interface TableBaseRowProps extends HTMLAttributes { state: LoadingRowState; rowData: { id: string }; } export const TableBaseRow = observer( forwardRef((props: PropsWithChildren, ref: any) => { const { state, rowData, children, ...rest } = props; const isLoadingRow = state.isLoading(rowData.id); return ( {isLoadingRow && Array.isArray(children) ? children.map((child, index) => { return index === children.length - 1 ? ( ) : ( React.cloneElement(child, { key: index, style: { visibility: 'hidden' }, }) ); }) : children} ); }), );