@@ -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 , ExpandableConfig } from '../interface' ;
7+ import type { ColumnType , CustomizeComponent } 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 ;
@@ -22,7 +22,12 @@ export interface BodyRowProps<RecordType> {
2222 scopeCellComponent : CustomizeComponent ;
2323 indent ?: number ;
2424 rowKey : React . Key ;
25- expandedRowOffset ?: ExpandableConfig < RecordType > [ 'expandedRowOffset' ] ;
25+
26+ // Expanded Row
27+ expandedRowInfo : {
28+ colSpan : number ;
29+ sticky : number ;
30+ } ;
2631}
2732
2833// ==================================================================================
@@ -108,7 +113,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
108113 rowComponent : RowComponent ,
109114 cellComponent,
110115 scopeCellComponent,
111- expandedRowOffset = 0 ,
116+ expandedRowInfo ,
112117 } = props ;
113118
114119 const rowInfo = useRowInfo ( record , rowKey , index , indent ) ;
@@ -198,14 +203,6 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
198203 if ( rowSupportExpand && ( expandedRef . current || expanded ) ) {
199204 const expandContent = expandedRowRender ( record , index , indent + 1 , expanded ) ;
200205
201- const offsetColumns = flattenColumns . filter ( ( _ , idx ) => idx < expandedRowOffset ) ;
202- let offsetWidth = 0 ;
203- offsetColumns . forEach ( item => {
204- if ( typeof item . width === 'number' ) {
205- offsetWidth = offsetWidth + ( item . width ?? 0 ) ;
206- }
207- } ) ;
208-
209206 expandRowNode = (
210207 < ExpandedRow
211208 expanded = { expanded }
@@ -217,9 +214,9 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
217214 prefixCls = { prefixCls }
218215 component = { RowComponent }
219216 cellComponent = { cellComponent }
220- offsetWidth = { offsetWidth }
221- colSpan = { flattenColumns . length - expandedRowOffset }
217+ colSpan = { expandedRowInfo . colSpan }
222218 isEmpty = { false }
219+ stickyOffset = { expandedRowInfo . sticky }
223220 >
224221 { expandContent }
225222 </ ExpandedRow >
0 commit comments