@@ -4,10 +4,10 @@ import Cell from '../Cell';
44import { responseImmutable } from '../context/TableContext' ;
55import devRenderTimes from '../hooks/useRenderTimes' ;
66import useRowInfo from '../hooks/useRowInfo' ;
7- import type { ColumnType , CustomizeComponent } from '../interface' ;
7+ import type { ColumnType , CustomizeComponent , ExpandableConfig } from '../interface' ;
88import ExpandedRow from './ExpandedRow' ;
99import { computedExpandedClassName } from '../utils/expandUtil' ;
10- import { TableProps } from '..' ;
10+ import type { TableProps } from '..' ;
1111
1212export interface BodyRowProps < RecordType > {
1313 record : RecordType ;
@@ -23,6 +23,7 @@ export interface BodyRowProps<RecordType> {
2323 indent ?: number ;
2424 rowKey : React . Key ;
2525 rowKeys : React . Key [ ] ;
26+ expandedRowOffset ?: ExpandableConfig < RecordType > [ 'expandedRowOffset' ] ;
2627}
2728
2829// ==================================================================================
@@ -126,6 +127,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
126127 rowComponent : RowComponent ,
127128 cellComponent,
128129 scopeCellComponent,
130+ expandedRowOffset = 0 ,
129131 rowKeys,
130132 } = props ;
131133
@@ -218,6 +220,14 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
218220 if ( rowSupportExpand && ( expandedRef . current || expanded ) ) {
219221 const expandContent = expandedRowRender ( record , index , indent + 1 , expanded ) ;
220222
223+ const offsetColumns = flattenColumns . filter ( ( _ , idx ) => idx < expandedRowOffset ) ;
224+ let offsetWidth = 0 ;
225+ offsetColumns . forEach ( item => {
226+ if ( typeof item . width === 'number' ) {
227+ offsetWidth = offsetWidth + ( item . width ?? 0 ) ;
228+ }
229+ } ) ;
230+
221231 expandRowNode = (
222232 < ExpandedRow
223233 expanded = { expanded }
@@ -229,7 +239,8 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
229239 prefixCls = { prefixCls }
230240 component = { RowComponent }
231241 cellComponent = { cellComponent }
232- colSpan = { flattenColumns . length }
242+ offsetWidth = { offsetWidth }
243+ colSpan = { flattenColumns . length - expandedRowOffset }
233244 isEmpty = { false }
234245 >
235246 { expandContent }
0 commit comments