@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
import Cell from '../Cell' ;
4
4
import { responseImmutable } from '../context/TableContext' ;
5
5
import devRenderTimes from '../hooks/useRenderTimes' ;
6
- import type { ColumnType , CustomizeComponent , GetComponentProps , GetRowKey } from '../interface' ;
6
+ import type { ColumnType , CustomizeComponent , GetRowKey } from '../interface' ;
7
7
import ExpandedRow from './ExpandedRow' ;
8
8
import useRowInfo from '../hooks/useRowInfo' ;
9
9
@@ -16,7 +16,6 @@ export interface BodyRowProps<RecordType> {
16
16
rowComponent : CustomizeComponent ;
17
17
cellComponent : CustomizeComponent ;
18
18
scopeCellComponent : CustomizeComponent ;
19
- onRow : GetComponentProps < RecordType > ;
20
19
indent ?: number ;
21
20
rowKey : React . Key ;
22
21
getRowKey : GetRowKey < RecordType > ;
@@ -99,26 +98,23 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
99
98
index,
100
99
renderIndex,
101
100
rowKey,
102
- onRow,
103
101
indent = 0 ,
104
102
rowComponent : RowComponent ,
105
103
cellComponent,
106
104
scopeCellComponent,
107
105
} = props ;
108
- const rowInfo = useRowInfo ( record , rowKey ) ;
106
+ const rowInfo = useRowInfo ( record , rowKey , index ) ;
109
107
const {
110
108
prefixCls,
111
109
flattenColumns,
112
- expandRowByClick,
113
- onTriggerExpand,
114
110
rowClassName,
115
111
expandedRowClassName,
116
112
expandedRowRender,
113
+ rowProps,
117
114
118
115
// Misc
119
116
expanded,
120
117
rowSupportExpand,
121
- expandable,
122
118
} = rowInfo ;
123
119
124
120
const [ expandRended , setExpandRended ] = React . useState ( false ) ;
@@ -133,17 +129,6 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
133
129
}
134
130
} , [ expanded ] ) ;
135
131
136
- // =========================== onRow ===========================
137
- const additionalProps = onRow ?.( record , index ) ;
138
-
139
- const onClick : React . MouseEventHandler < HTMLElement > = ( event , ...args ) => {
140
- if ( expandRowByClick && expandable ) {
141
- onTriggerExpand ( record , event ) ;
142
- }
143
-
144
- additionalProps ?. onClick ?.( event , ...args ) ;
145
- } ;
146
-
147
132
// ======================== Base tr row ========================
148
133
let computeRowClassName : string ;
149
134
if ( typeof rowClassName === 'string' ) {
@@ -154,20 +139,19 @@ function BodyRow<RecordType extends { children?: readonly RecordType[] }>(
154
139
155
140
const baseRowNode = (
156
141
< RowComponent
157
- { ...additionalProps }
142
+ { ...rowProps }
158
143
data-row-key = { rowKey }
159
144
className = { classNames (
160
145
className ,
161
146
`${ prefixCls } -row` ,
162
147
`${ prefixCls } -row-level-${ indent } ` ,
163
148
computeRowClassName ,
164
- additionalProps && additionalProps . className ,
149
+ rowProps ? .className ,
165
150
) }
166
151
style = { {
167
152
...style ,
168
- ...( additionalProps ? additionalProps . style : null ) ,
153
+ ...rowProps ? .style ,
169
154
} }
170
- onClick = { onClick }
171
155
>
172
156
{ flattenColumns . map ( ( column : ColumnType < RecordType > , colIndex ) => {
173
157
const { render, dataIndex, className : columnClassName } = column ;
0 commit comments