@@ -6,6 +6,7 @@ import TableContext, { responseImmutable } from '../context/TableContext';
6
6
import type { FlattenData } from '../hooks/useFlattenRecords' ;
7
7
import useRowInfo from '../hooks/useRowInfo' ;
8
8
import VirtualCell from './VirtualCell' ;
9
+ import { StaticContext } from './context' ;
9
10
10
11
export interface BodyLineProps < RecordType = any > {
11
12
data : FlattenData < RecordType > ;
@@ -27,9 +28,13 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
27
28
TableContext ,
28
29
[ 'prefixCls' , 'flattenColumns' , 'fixColumn' , 'componentWidth' , 'scrollX' ] ,
29
30
) ;
31
+ const { getComponent } = useContext ( StaticContext , [ 'getComponent' ] ) ;
30
32
31
33
const rowInfo = useRowInfo ( record , rowKey , index , indent ) ;
32
34
35
+ const RowComponent = getComponent ( [ 'body' , 'row' ] , 'div' ) ;
36
+ const cellComponent = getComponent ( [ 'body' , 'cell' ] , 'div' ) ;
37
+
33
38
// ========================== Expand ==========================
34
39
const { rowSupportExpand, expanded, rowProps, expandedRowRender, expandedRowClassName } = rowInfo ;
35
40
@@ -50,15 +55,15 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
50
55
const rowCellCls = `${ prefixCls } -expanded-row-cell` ;
51
56
52
57
expandRowNode = (
53
- < div
58
+ < RowComponent
54
59
className = { classNames (
55
60
`${ prefixCls } -expanded-row` ,
56
61
`${ prefixCls } -expanded-row-level-${ indent + 1 } ` ,
57
62
computedExpandedRowClassName ,
58
63
) }
59
64
>
60
65
< Cell
61
- component = "div"
66
+ component = { cellComponent }
62
67
prefixCls = { prefixCls }
63
68
className = { classNames ( rowCellCls , {
64
69
[ `${ rowCellCls } -fixed` ] : fixColumn ,
@@ -67,12 +72,11 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
67
72
>
68
73
{ expandContent }
69
74
</ Cell >
70
- </ div >
75
+ </ RowComponent >
71
76
) ;
72
77
}
73
78
74
79
// ========================== Render ==========================
75
-
76
80
const rowStyle : React . CSSProperties = {
77
81
...style ,
78
82
width : scrollX as number ,
@@ -84,7 +88,7 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
84
88
}
85
89
86
90
const rowNode = (
87
- < div
91
+ < RowComponent
88
92
{ ...rowProps }
89
93
{ ...restProps }
90
94
ref = { rowSupportExpand ? null : ref }
@@ -97,6 +101,7 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
97
101
return (
98
102
< VirtualCell
99
103
key = { colIndex }
104
+ component = { cellComponent }
100
105
rowInfo = { rowInfo }
101
106
column = { column }
102
107
colIndex = { colIndex }
@@ -109,7 +114,7 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
109
114
/>
110
115
) ;
111
116
} ) }
112
- </ div >
117
+ </ RowComponent >
113
118
) ;
114
119
115
120
if ( rowSupportExpand ) {
0 commit comments