diff --git a/package.json b/package.json index 8caa3efc..e8190bd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@netdata/netdata-ui", - "version": "4.8.5", + "version": "4.8.6", "description": "netdata UI kit", "main": "dist/index.js", "module": "dist/es6/index.js", diff --git a/src/components/table/body/row.js b/src/components/table/body/row.js index 84633dcd..8f7b41c4 100644 --- a/src/components/table/body/row.js +++ b/src/components/table/body/row.js @@ -96,6 +96,7 @@ export default memo( index, zIndex, onHoverCell, + renderSubComponent, ...rest }) => { useTableState(rerenderSelector) @@ -108,94 +109,110 @@ export default memo( }, [row, onClickRow]) return ( - onClickRow({ data: row.original, table: table, fullRow: row }) - : undefined, - [isClickable, row, onClickRow] - )} - cursor={isClickable ? "pointer" : "default"} - onMouseEnter={() => onHoverCell?.({ row: row.index })} - onMouseLeave={() => onHoverCell?.({ row: null })} - flex - > - {!!row.getLeftVisibleCells().length && ( - - {row.getLeftVisibleCells().map((cell, index) => ( - - ))} - - )} + <> onClickRow({ data: row.original, table: table, fullRow: row }, e) + : undefined, + [isClickable, row, onClickRow] + )} + cursor={isClickable ? "pointer" : "default"} + onMouseEnter={() => onHoverCell?.({ row: row.index })} + onMouseLeave={() => onHoverCell?.({ row: null })} + flex + column > - {row.getCenterVisibleCells().map((cell, index) => ( - - ))} + {!!row.getLeftVisibleCells().length && ( + + {row.getLeftVisibleCells().map((cell, index) => ( + + ))} + + )} + + + {row.getCenterVisibleCells().map((cell, index) => ( + + ))} + + + {!!row.getRightVisibleCells().length && ( + + {row.getRightVisibleCells().map((cell, index) => ( + + ))} + + )} + {renderSubComponent && row.getIsExpanded() && ( + e.stopPropagation()} + > + {renderSubComponent({ data: row.original, table, fullRow: row })} + + )} - {!!row.getRightVisibleCells().length && ( - - {row.getRightVisibleCells().map((cell, index) => ( - - ))} - - )} - + ) } ) diff --git a/src/components/table/table.js b/src/components/table/table.js index ee23c20d..d8140a5a 100644 --- a/src/components/table/table.js +++ b/src/components/table/table.js @@ -119,6 +119,7 @@ const Table = memo( tableRef, className, width, + getRowCanExpand, ...rest } = { ...tableDefaultProps, ...props } @@ -191,6 +192,7 @@ const Table = memo( getSortedRowModel: getSortedRowModel(), getPaginationRowModel: getPaginationRowModel(), getExpandedRowModel: getExpandedRowModel(), + getRowCanExpand, getGroupedRowModel: getGroupedRowModel(), getSubRows: useCallback(row => row.children, []), onPaginationChange,