@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
import { getCellProps , useRowInfo } from '../Body/BodyRow' ;
3
3
import Cell from '../Cell' ;
4
4
import type { ColumnType } from '../interface' ;
5
+ import classNames from 'classnames' ;
5
6
6
7
export interface VirtualCellProps < RecordType extends { index : number } > {
7
8
rowInfo : ReturnType < typeof useRowInfo > ;
@@ -14,12 +15,13 @@ export interface VirtualCellProps<RecordType extends { index: number }> {
14
15
// Follow props is used for RowSpanVirtualCell only
15
16
forceRender ?: boolean ;
16
17
style ?: React . CSSProperties ;
18
+ className ?: string ;
17
19
}
18
20
19
21
function VirtualCell < RecordType extends { index : number } = any > (
20
22
props : VirtualCellProps < RecordType > ,
21
23
) {
22
- const { rowInfo, column, colIndex, indent, index, record, forceRender, style } = props ;
24
+ const { rowInfo, column, colIndex, indent, index, record, forceRender, style, className } = props ;
23
25
24
26
const { render, dataIndex, className : columnClassName , width : colWidth } = column ;
25
27
@@ -46,7 +48,7 @@ function VirtualCell<RecordType extends { index: number } = any>(
46
48
47
49
return (
48
50
< Cell
49
- className = { columnClassName }
51
+ className = { classNames ( columnClassName , className ) }
50
52
ellipsis = { column . ellipsis }
51
53
align = { column . align }
52
54
scope = { column . rowScope }
@@ -73,20 +75,40 @@ function VirtualCell<RecordType extends { index: number } = any>(
73
75
) ;
74
76
}
75
77
78
+ // ================= Virtual Row Span Cell =================
76
79
export interface RowSpanVirtualCellProps < RecordType extends { index : number } >
77
80
extends Omit < VirtualCellProps < RecordType > , 'rowInfo' > {
78
81
record : RecordType ;
79
82
rowKey : React . Key ;
83
+ top : number ;
84
+ height : number ;
85
+ left : number ;
86
+ width : number ;
80
87
}
81
88
82
89
export function RowSpanVirtualCell < RecordType extends { index : number } = any > (
83
90
props : RowSpanVirtualCellProps < RecordType > ,
84
91
) {
85
- const { record, rowKey } = props ;
92
+ const { record, rowKey, top , height , left , width , style } = props ;
86
93
87
94
const rowInfo = useRowInfo < RecordType > ( record , rowKey ) ;
95
+ const { prefixCls } = rowInfo ;
88
96
89
- return < VirtualCell rowInfo = { rowInfo } { ...props } forceRender /> ;
97
+ return (
98
+ < VirtualCell
99
+ rowInfo = { rowInfo }
100
+ { ...props }
101
+ style = { {
102
+ ...style ,
103
+ top,
104
+ height,
105
+ left,
106
+ width,
107
+ } }
108
+ className = { `${ prefixCls } -cell-virtual-fixed` }
109
+ forceRender
110
+ />
111
+ ) ;
90
112
}
91
113
92
114
export default VirtualCell ;
0 commit comments