diff --git a/src/Body/MeasureCell.tsx b/src/Body/MeasureCell.tsx index 1db7d06bb..11b861148 100644 --- a/src/Body/MeasureCell.tsx +++ b/src/Body/MeasureCell.tsx @@ -1,20 +1,19 @@ import * as React from 'react'; import ResizeObserver from 'rc-resize-observer'; import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; -import type { ColumnType } from '../interface'; export interface MeasureCellProps { columnKey: React.Key; onColumnResize: (key: React.Key, width: number) => void; - column?: ColumnType; prefixCls: string; + title?: React.ReactNode; } export default function MeasureCell({ columnKey, onColumnResize, - column, prefixCls, + title, }: MeasureCellProps) { const cellRef = React.useRef(); @@ -27,7 +26,7 @@ export default function MeasureCell({ return ( -
{column?.title || '\xa0'}
+
{title || '\xa0'}
); diff --git a/src/Body/MeasureRow.tsx b/src/Body/MeasureRow.tsx index 14ecb2f8e..c0fda2e52 100644 --- a/src/Body/MeasureRow.tsx +++ b/src/Body/MeasureRow.tsx @@ -35,13 +35,17 @@ export default function MeasureRow({ > {columnsKey.map(columnKey => { const column = columns.find(col => col.key === columnKey); + const rawTitle = column?.title; + const titleForMeasure = React.isValidElement>(rawTitle) + ? React.cloneElement(rawTitle, { ref: null }) + : rawTitle; return ( ); })}