diff --git a/src/Cell.tsx b/src/Cell.tsx index 7b723a9e2e..c35b8323f0 100644 --- a/src/Cell.tsx +++ b/src/Cell.tsx @@ -40,6 +40,7 @@ function Cell( onContextMenu, onRowChange, selectCell, + style, ...props }: CellRendererProps, ref: React.Ref @@ -93,6 +94,14 @@ function Cell( onRowChange(column, newRow); } + const cellStyle = getCellStyle(column, colSpan); + if (style) { + let key: keyof React.CSSProperties; + for (key in style) { + (cellStyle as any)[key] = style[key]; + } + } + return (
( ref={ref} tabIndex={tabIndex} className={className} - style={getCellStyle(column, colSpan)} + style={cellStyle} onClick={handleClick} onDoubleClick={handleDoubleClick} onContextMenu={handleContextMenu} diff --git a/src/types.ts b/src/types.ts index db108d6f2b..8eff5abe2b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -145,7 +145,7 @@ export interface CellRendererProps extends Pick, 'row' | 'rowIdx' | 'selectCell'>, Omit< React.HTMLAttributes, - 'style' | 'children' | 'onClick' | 'onDoubleClick' | 'onContextMenu' + 'children' | 'onClick' | 'onDoubleClick' | 'onContextMenu' > { column: CalculatedColumn; colSpan: number | undefined;