1
- import { useContext } from '@rc-component/context' ;
2
1
import classNames from 'classnames' ;
3
2
import * as React from 'react' ;
4
3
import Cell from '../Cell' ;
5
- import TableContext , { responseImmutable } from '../context/TableContext' ;
4
+ import { responseImmutable } from '../context/TableContext' ;
6
5
import devRenderTimes from '../hooks/useRenderTimes' ;
7
6
import type { ColumnType , CustomizeComponent , GetComponentProps , GetRowKey } from '../interface' ;
8
7
import ExpandedRow from './ExpandedRow' ;
@@ -110,20 +109,18 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
110
109
const {
111
110
prefixCls,
112
111
flattenColumns,
113
- expandableType,
114
112
expandRowByClick,
115
113
onTriggerExpand,
116
114
rowClassName,
117
115
expandedRowClassName,
118
116
expandedRowRender,
119
117
120
118
// Misc
121
- nestExpandable,
122
119
expanded,
120
+ supportExpand,
121
+ expandable,
123
122
} = rowInfo ;
124
123
125
- const { rowExpandable } = useContext ( TableContext , [ 'rowExpandable' ] ) ;
126
-
127
124
const [ expandRended , setExpandRended ] = React . useState ( false ) ;
128
125
129
126
if ( process . env . NODE_ENV !== 'production' ) {
@@ -136,14 +133,11 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
136
133
}
137
134
} , [ expanded ] ) ;
138
135
139
- const rowSupportExpand = expandableType === 'row' && ( ! rowExpandable || rowExpandable ( record ) ) ;
140
- const mergedExpandable = rowSupportExpand || nestExpandable ;
141
-
142
136
// =========================== onRow ===========================
143
137
const additionalProps = onRow ?.( record , index ) ;
144
138
145
139
const onClick : React . MouseEventHandler < HTMLElement > = ( event , ...args ) => {
146
- if ( expandRowByClick && mergedExpandable ) {
140
+ if ( expandRowByClick && expandable ) {
147
141
onTriggerExpand ( record , event ) ;
148
142
}
149
143
@@ -212,7 +206,7 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
212
206
213
207
// ======================== Expand Row =========================
214
208
let expandRowNode : React . ReactElement ;
215
- if ( rowSupportExpand && ( expandRended || expanded ) ) {
209
+ if ( supportExpand && ( expandRended || expanded ) ) {
216
210
const expandContent = expandedRowRender ( record , index , indent + 1 , expanded ) ;
217
211
const computedExpandedRowClassName =
218
212
expandedRowClassName && expandedRowClassName ( record , index , indent ) ;
0 commit comments