@@ -6,6 +6,7 @@ import TableContext, { responseImmutable } from '../context/TableContext';
66import type { FlattenData } from '../hooks/useFlattenRecords' ;
77import useRowInfo from '../hooks/useRowInfo' ;
88import VirtualCell from './VirtualCell' ;
9+ import { StaticContext } from './context' ;
910
1011export interface BodyLineProps < RecordType = any > {
1112 data : FlattenData < RecordType > ;
@@ -27,9 +28,13 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
2728 TableContext ,
2829 [ 'prefixCls' , 'flattenColumns' , 'fixColumn' , 'componentWidth' , 'scrollX' ] ,
2930 ) ;
31+ const { getComponent } = useContext ( StaticContext , [ 'getComponent' ] ) ;
3032
3133 const rowInfo = useRowInfo ( record , rowKey , index , indent ) ;
3234
35+ const RowComponent = getComponent ( [ 'body' , 'row' ] , 'div' ) ;
36+ const cellComponent = getComponent ( [ 'body' , 'cell' ] , 'div' ) ;
37+
3338 // ========================== Expand ==========================
3439 const { rowSupportExpand, expanded, rowProps, expandedRowRender, expandedRowClassName } = rowInfo ;
3540
@@ -50,15 +55,15 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
5055 const rowCellCls = `${ prefixCls } -expanded-row-cell` ;
5156
5257 expandRowNode = (
53- < div
58+ < RowComponent
5459 className = { classNames (
5560 `${ prefixCls } -expanded-row` ,
5661 `${ prefixCls } -expanded-row-level-${ indent + 1 } ` ,
5762 computedExpandedRowClassName ,
5863 ) }
5964 >
6065 < Cell
61- component = "div"
66+ component = { cellComponent }
6267 prefixCls = { prefixCls }
6368 className = { classNames ( rowCellCls , {
6469 [ `${ rowCellCls } -fixed` ] : fixColumn ,
@@ -67,12 +72,11 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
6772 >
6873 { expandContent }
6974 </ Cell >
70- </ div >
75+ </ RowComponent >
7176 ) ;
7277 }
7378
7479 // ========================== Render ==========================
75-
7680 const rowStyle : React . CSSProperties = {
7781 ...style ,
7882 width : scrollX as number ,
@@ -84,7 +88,7 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
8488 }
8589
8690 const rowNode = (
87- < div
91+ < RowComponent
8892 { ...rowProps }
8993 { ...restProps }
9094 ref = { rowSupportExpand ? null : ref }
@@ -97,6 +101,7 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
97101 return (
98102 < VirtualCell
99103 key = { colIndex }
104+ component = { cellComponent }
100105 rowInfo = { rowInfo }
101106 column = { column }
102107 colIndex = { colIndex }
@@ -109,7 +114,7 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
109114 />
110115 ) ;
111116 } ) }
112- </ div >
117+ </ RowComponent >
113118 ) ;
114119
115120 if ( rowSupportExpand ) {
0 commit comments