@@ -6,6 +6,7 @@ import devRenderTimes from '../hooks/useRenderTimes';
66import useRowInfo from '../hooks/useRowInfo' ;
77import type { ColumnType , CustomizeComponent , GetRowKey } from '../interface' ;
88import ExpandedRow from './ExpandedRow' ;
9+ import { computedExpandedClassName } from '../utils/expandUtil' ;
910
1011export interface BodyRowProps < RecordType > {
1112 record : RecordType ;
@@ -126,8 +127,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
126127
127128 // 若没有 expandedRowRender 参数, 将使用 baseRowNode 渲染 Children
128129 // 此时如果 level > 1 则说明是 expandedRow, 一样需要附加 computedExpandedRowClassName
129- const computedExpandedRowClassName =
130- expandedRowClassName && expandedRowClassName ( record , index , indent ) ;
130+ const expandedClsName = computedExpandedClassName ( expandedRowClassName , record , index , indent ) ;
131131
132132 // ======================== Base tr row ========================
133133 const baseRowNode = (
@@ -139,12 +139,11 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
139139 `${ prefixCls } -row` ,
140140 `${ prefixCls } -row-level-${ indent } ` ,
141141 rowProps ?. className ,
142- indent >= 1 ? computedExpandedRowClassName : '' ,
142+ {
143+ [ expandedClsName ] : indent >= 1 ,
144+ } ,
143145 ) }
144- style = { {
145- ...style ,
146- ...rowProps ?. style ,
147- } }
146+ style = { { ...style , ...rowProps ?. style } }
148147 >
149148 { flattenColumns . map ( ( column : ColumnType < RecordType > , colIndex ) => {
150149 const { render, dataIndex, className : columnClassName } = column ;
@@ -192,7 +191,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
192191 className = { classNames (
193192 `${ prefixCls } -expanded-row` ,
194193 `${ prefixCls } -expanded-row-level-${ indent + 1 } ` ,
195- computedExpandedRowClassName ,
194+ expandedClsName ,
196195 ) }
197196 prefixCls = { prefixCls }
198197 component = { RowComponent }
0 commit comments