diff --git a/src/renderer/components/item-object-list/item-list-layout.tsx b/src/renderer/components/item-object-list/item-list-layout.tsx index 42e890ab88..dda2979abf 100644 --- a/src/renderer/components/item-object-list/item-list-layout.tsx +++ b/src/renderer/components/item-object-list/item-list-layout.tsx @@ -247,7 +247,7 @@ export class ItemListLayout extends React.Component { getRow(uid: string) { const { isSelectable, renderTableHeader, renderTableContents, renderItemMenu, - store, hasDetailsView, onDetails, isResizable: resizable, + store, hasDetailsView, onDetails, isResizable, copyClassNameFromHeadCells, customizeTableRowProps, detailsItem, } = this.props; const { isSelected } = store; @@ -283,17 +283,12 @@ export class ItemListLayout extends React.Component { cellProps.className = cssNames(cellProps.className, headCell.className); } - if (cellSize !== undefined) { - cellProps.size = cellSize; - } - - if (resizable) { - cellProps._onResize = width => this.handleCellResize(index, width); - cellProps._onResizeComplete = () => this.persistCellSizes(); - } + cellProps.size = cellSize; + cellProps.onResize = width => this.handleCellResize(index, width); + cellProps.onResizeComplete = () => this.persistCellSizes(); if (!headCell || !this.isHiddenColumn(headCell)) { - return ; + return ; } }) } @@ -447,14 +442,16 @@ export class ItemListLayout extends React.Component { const _cellProps = isResizable ? { ...cellProps, - _onResize: (width: number) => this.handleCellResize(index, width), - _onResizeComplete: () => this.persistCellSizes(), size: this.cellSizes[index], isResizable } : cellProps; if (!this.isHiddenColumn(cellProps)) { - return ; + return this.handleCellResize(index, width) } + onResizeComplete={ () => this.persistCellSizes() } + {..._cellProps} />; } })} diff --git a/src/renderer/components/table/table-cell.tsx b/src/renderer/components/table/table-cell.tsx index 2eddffc1b0..9a8ee2de62 100644 --- a/src/renderer/components/table/table-cell.tsx +++ b/src/renderer/components/table/table-cell.tsx @@ -29,12 +29,12 @@ export interface TableCellProps extends React.DOMAttributes { * Triggers every time this cell is resized by user * @param width desired width of this cell */ - _onResize?(width: number): void; + onResize?(width: number): void; /** * Triggers once the user has finished resizing this cell */ - _onResizeComplete?(): void; // triggers a callback when user stops resizing + onResizeComplete?(): void; // triggers a callback when user stops resizing } type ResizeHandlerState = { @@ -105,14 +105,14 @@ export class TableCell extends React.Component { const diffPosX = event.pageX - this.resizeHandlerState.mousePosX; const currentWidth = this.cellContainer.current.offsetWidth; - this.props?._onResize(currentWidth + diffPosX); + this.props?.onResize(currentWidth + diffPosX); this.resizeHandlerState.mousePosX = event.pageX; }, ERGONOMIC_RESIZE_THROTTLE_RATE); private mouseUpHandler() { TableCell.removeMouseEventListeners(); - this.props?._onResizeComplete(); + this.props?.onResizeComplete(); delete this.resizeHandlerState; } @@ -176,8 +176,8 @@ export class TableCell extends React.Component { title, renderBoolean: displayBoolean, showWithColumn, - _onResize, - _onResizeComplete, + onResize, + onResizeComplete, ...cellProps } = this.props; const classNames = cssNames("TableCell", className, { checkbox,