@@ -6,6 +6,7 @@ import devRenderTimes from '../hooks/useRenderTimes';
6
6
import useRowInfo from '../hooks/useRowInfo' ;
7
7
import type { ColumnType , CustomizeComponent , GetRowKey } from '../interface' ;
8
8
import ExpandedRow from './ExpandedRow' ;
9
+ import { computedExpandedClassName } from '../utils/expandUtil' ;
9
10
10
11
export interface BodyRowProps < RecordType > {
11
12
record : RecordType ;
@@ -126,8 +127,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
126
127
127
128
// 若没有 expandedRowRender 参数, 将使用 baseRowNode 渲染 Children
128
129
// 此时如果 level > 1 则说明是 expandedRow, 一样需要附加 computedExpandedRowClassName
129
- const computedExpandedRowClassName =
130
- expandedRowClassName && expandedRowClassName ( record , index , indent ) ;
130
+ const expandedClsName = computedExpandedClassName ( expandedRowClassName , record , index , indent ) ;
131
131
132
132
// ======================== Base tr row ========================
133
133
const baseRowNode = (
@@ -139,12 +139,11 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
139
139
`${ prefixCls } -row` ,
140
140
`${ prefixCls } -row-level-${ indent } ` ,
141
141
rowProps ?. className ,
142
- indent >= 1 ? computedExpandedRowClassName : '' ,
142
+ {
143
+ [ expandedClsName ] : indent >= 1 ,
144
+ } ,
143
145
) }
144
- style = { {
145
- ...style ,
146
- ...rowProps ?. style ,
147
- } }
146
+ style = { { ...style , ...rowProps ?. style } }
148
147
>
149
148
{ flattenColumns . map ( ( column : ColumnType < RecordType > , colIndex ) => {
150
149
const { render, dataIndex, className : columnClassName } = column ;
@@ -192,7 +191,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
192
191
className = { classNames (
193
192
`${ prefixCls } -expanded-row` ,
194
193
`${ prefixCls } -expanded-row-level-${ indent + 1 } ` ,
195
- computedExpandedRowClassName ,
194
+ expandedClsName ,
196
195
) }
197
196
prefixCls = { prefixCls }
198
197
component = { RowComponent }
0 commit comments