@@ -6,6 +6,7 @@ import type { FlattenData } from '../hooks/useFlattenRecords';
66import { StaticContext } from './context' ;
77import VirtualCell from './VirtualCell' ;
88import useRowInfo from '../hooks/useRowInfo' ;
9+ import Cell from '../Cell' ;
910
1011export interface BodyLineProps < RecordType = any > {
1112 data : FlattenData < RecordType > ;
@@ -23,11 +24,11 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
2324 const { data, index, className, rowKey, style, extra, getHeight, ...restProps } = props ;
2425 const { record, indent } = data ;
2526
26- const { flattenColumns, prefixCls } = useContext ( TableContext , [
27+ const { flattenColumns, prefixCls, fixColumn , componentWidth } = useContext ( TableContext , [
2728 'prefixCls' ,
2829 'flattenColumns' ,
29- 'expandableType ' ,
30- 'rowExpandable ' ,
30+ 'fixColumn ' ,
31+ 'componentWidth ' ,
3132 ] ) ;
3233 const { scrollX } = useContext ( StaticContext , [ 'scrollX' ] ) ;
3334
@@ -41,6 +42,20 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
4142 const expandContent = expandedRowRender ( record , index , indent + 1 , expanded ) ;
4243 const computedExpandedRowClassName = expandedRowClassName ?.( record , index , indent ) ;
4344
45+ let additionalProps : React . TdHTMLAttributes < HTMLElement > = { } ;
46+ if ( fixColumn ) {
47+ additionalProps = {
48+ style : {
49+ position : 'sticky' ,
50+ left : 0 ,
51+ overflow : 'hidden' ,
52+ [ '--virtual-width' as any ] : `${ componentWidth } px` ,
53+ } ,
54+ } ;
55+ }
56+
57+ const rowCellCls = `${ prefixCls } -expanded-row-cell` ;
58+
4459 expandRowNode = (
4560 < div
4661 className = { classNames (
@@ -49,7 +64,16 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
4964 computedExpandedRowClassName ,
5065 ) }
5166 >
52- { expandContent }
67+ < Cell
68+ component = "div"
69+ prefixCls = { prefixCls }
70+ className = { classNames ( rowCellCls , {
71+ [ `${ rowCellCls } -fixed` ] : fixColumn ,
72+ } ) }
73+ additionalProps = { additionalProps }
74+ >
75+ { expandContent }
76+ </ Cell >
5377 </ div >
5478 ) ;
5579 }
0 commit comments