1- import React , { FC , ReactNode , useEffect , useRef , useState , useCallback } from 'react' ;
1+ import React , { FC , ReactNode , useRef , useCallback } from 'react' ;
22import { Cell , CellPropGetter , TableCellProps , TableHeaderProps } from 'react-table' ;
33import { useStyles } from './styles/styles' ;
44import { isStyledColumn } from '../dataTable/interfaces' ;
@@ -35,7 +35,6 @@ export const RowCell: FC<IRowCellProps> = ({ cell, preContent, row, rowIndex, ce
3535 const { key, style, ...restProps } = cell . getCellProps ( cellProps ) ;
3636 const cellRef = useRef ( null ) ;
3737 const cellParentRef = useRef ( null ) ;
38- const [ cellParentRefWidth , setcellParentRefWidth ] = useState < number > ( ) ;
3938
4039 let cellStyle : React . CSSProperties = useActualContextExecutionExecutor (
4140 ( context ) => {
@@ -63,11 +62,6 @@ export const RowCell: FC<IRowCellProps> = ({ cell, preContent, row, rowIndex, ce
6362 return false ;
6463 } , [ ] ) ;
6564
66- useEffect ( ( ) => {
67- const cellParentRefRect = cellParentRef . current . getBoundingClientRect ( ) ;
68- setcellParentRefWidth ( cellParentRefRect . width ) ;
69- } , [ cellParentRef ] ) ;
70-
7165 return (
7266 < div
7367 key = { key }
@@ -80,16 +74,21 @@ export const RowCell: FC<IRowCellProps> = ({ cell, preContent, row, rowIndex, ce
8074 } ) }
8175 >
8276 { preContent }
83- < div
84- ref = { cellRef }
85- className = { showExpandedView && styles . shaCellParent }
86- onMouseOver = { ( ) => {
87- void ( showExpandedView ? getCellRef ( cellRef , checkOverflow ( ) ) : getCellRef ( null , null ) ) ;
88- } }
89- style = { { maxWidth : cellParentRefWidth + "px" } } >
90- { cell . render ( 'Cell' ) }
77+ {
78+ ( cell . column as unknown as { columnType : string } ) . columnType === 'data' ?
79+ < div
80+ ref = { cellRef }
81+ className = { showExpandedView && styles . shaCellParent }
82+ onMouseOver = { ( ) => {
83+ void ( showExpandedView ? getCellRef ( cellRef , checkOverflow ( ) ) : getCellRef ( null , null ) ) ;
84+ } }
85+ >
86+ { cell . render ( 'Cell' ) }
87+ </ div >
88+ :
89+ cell . render ( 'Cell' )
90+ }
9191
92- </ div >
9392 </ div >
9493 ) ;
9594} ;
0 commit comments