File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ import type { ColumnType } from '../interface';
66export interface MeasureCellProps {
77 columnKey : React . Key ;
88 onColumnResize : ( key : React . Key , width : number ) => void ;
9- column ?: ColumnType < any > ;
109 prefixCls : string ;
10+ title ?: React . ReactNode ;
1111}
1212
1313export default function MeasureCell ( {
1414 columnKey,
1515 onColumnResize,
16- column,
1716 prefixCls,
17+ title,
1818} : MeasureCellProps ) {
1919 const cellRef = React . useRef < HTMLTableCellElement > ( ) ;
2020
@@ -27,7 +27,7 @@ export default function MeasureCell({
2727 return (
2828 < ResizeObserver data = { columnKey } >
2929 < th ref = { cellRef } className = { `${ prefixCls } -measure-cell` } >
30- < div className = { `${ prefixCls } -measure-cell-content` } > { column ?. title || '\xa0' } </ div >
30+ < div className = { `${ prefixCls } -measure-cell-content` } > { title || '\xa0' } </ div >
3131 </ th >
3232 </ ResizeObserver >
3333 ) ;
Original file line number Diff line number Diff line change @@ -35,13 +35,17 @@ export default function MeasureRow({
3535 >
3636 { columnsKey . map ( columnKey => {
3737 const column = columns . find ( col => col . key === columnKey ) ;
38+ const rawTitle = column ?. title ;
39+ const titleForMeasure = React . isValidElement < React . RefAttributes < any > > ( rawTitle )
40+ ? React . cloneElement ( rawTitle , { ref : null } )
41+ : rawTitle ;
3842 return (
3943 < MeasureCell
4044 prefixCls = { prefixCls }
4145 key = { columnKey }
4246 columnKey = { columnKey }
4347 onColumnResize = { onColumnResize }
44- column = { column }
48+ title = { titleForMeasure }
4549 />
4650 ) ;
4751 } ) }
You can’t perform that action at this time.
0 commit comments