1
1
import * as React from 'react' ;
2
2
import classNames from 'classnames' ;
3
- import ResizeObserver from 'rc-resize-observer' ;
4
3
import Cell from '../Cell' ;
5
4
import TableContext from '../context/TableContext' ;
6
5
import BodyContext from '../context/BodyContext' ;
@@ -13,7 +12,6 @@ import {
13
12
Key ,
14
13
GetRowKey ,
15
14
} from '../interface' ;
16
- import ResizeContext from '../context/ResizeContext' ;
17
15
import { getCellFixedInfo } from '../utils/fixUtil' ;
18
16
import ExpandedRow from './ExpandedRow' ;
19
17
@@ -22,8 +20,6 @@ export interface BodyRowProps<RecordType> {
22
20
index : number ;
23
21
className ?: string ;
24
22
style ?: React . CSSProperties ;
25
- /** Set if need collect column width info */
26
- measureColumnWidth : boolean ;
27
23
stickyOffsets : StickyOffsets ;
28
24
recordKey : Key ;
29
25
expandedKeys : Set < Key > ;
@@ -51,7 +47,6 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
51
47
indent = 0 ,
52
48
rowComponent : RowComponent ,
53
49
cellComponent,
54
- measureColumnWidth,
55
50
childrenColumnName,
56
51
} = props ;
57
52
const { prefixCls } = React . useContext ( TableContext ) ;
@@ -70,7 +65,6 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
70
65
expandedRowRender,
71
66
expandIconColumnIndex,
72
67
} = React . useContext ( BodyContext ) ;
73
- const { onColumnResize } = React . useContext ( ResizeContext ) ;
74
68
const [ expandRended , setExpandRended ] = React . useState ( false ) ;
75
69
76
70
const expanded = props . expandedKeys . has ( props . recordKey ) ;
@@ -165,7 +159,7 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
165
159
additionalCellProps = column . onCell ( record , index ) ;
166
160
}
167
161
168
- const cellNode = (
162
+ return (
169
163
< Cell
170
164
className = { columnClassName }
171
165
ellipsis = { column . ellipsis }
@@ -182,21 +176,6 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
182
176
additionalProps = { additionalCellProps }
183
177
/>
184
178
) ;
185
-
186
- if ( measureColumnWidth ) {
187
- return (
188
- < ResizeObserver
189
- key = { key }
190
- onResize = { ( { width } ) => {
191
- onColumnResize ( key , width ) ;
192
- } }
193
- >
194
- { cellNode }
195
- </ ResizeObserver >
196
- ) ;
197
- }
198
-
199
- return cellNode ;
200
179
} ) }
201
180
</ RowComponent >
202
181
) ;
@@ -243,7 +222,6 @@ function BodyRow<RecordType extends { children?: RecordType[] }>(props: BodyRowP
243
222
recordKey = { subKey }
244
223
index = { subIndex }
245
224
indent = { indent + 1 }
246
- measureColumnWidth = { false }
247
225
/>
248
226
) ;
249
227
} ,
0 commit comments