1+ import { useContext } from '@rc-component/context' ;
2+ import classNames from 'classnames' ;
13import * as React from 'react' ;
24import { getCellProps } from '../Body/BodyRow' ;
35import Cell from '../Cell' ;
6+ import type useRowInfo from '../hooks/useRowInfo' ;
47import type { ColumnType } from '../interface' ;
5- import classNames from 'classnames' ;
6- import { useContext } from '@rc-component/context' ;
78import { GridContext } from './context' ;
8- import type useRowInfo from '../hooks/useRowInfo' ;
99
10- export interface VirtualCellProps < RecordType extends { index : number } > {
10+ export interface VirtualCellProps < RecordType > {
1111 rowInfo : ReturnType < typeof useRowInfo > ;
1212 column : ColumnType < RecordType > ;
1313 colIndex : number ;
1414 indent : number ;
1515 index : number ;
16+ /** Used for `column.render` */
17+ renderIndex : number ;
1618 record : RecordType ;
1719
1820 // Follow props is used for RowSpanVirtualCell only
@@ -33,11 +35,20 @@ export function getColumnWidth(colIndex: number, colSpan: number, columnsOffset:
3335 return columnsOffset [ colIndex + mergedColSpan ] - ( columnsOffset [ colIndex ] || 0 ) ;
3436}
3537
36- function VirtualCell < RecordType extends { index : number } = any > (
37- props : VirtualCellProps < RecordType > ,
38- ) {
39- const { rowInfo, column, colIndex, indent, index, record, style, className, inverse, getHeight } =
40- props ;
38+ function VirtualCell < RecordType = any > ( props : VirtualCellProps < RecordType > ) {
39+ const {
40+ rowInfo,
41+ column,
42+ colIndex,
43+ indent,
44+ index,
45+ renderIndex,
46+ record,
47+ style,
48+ className,
49+ inverse,
50+ getHeight,
51+ } = props ;
4152
4253 const { render, dataIndex, className : columnClassName , width : colWidth } = column ;
4354
@@ -108,7 +119,7 @@ function VirtualCell<RecordType extends { index: number } = any>(
108119 key = { key }
109120 record = { record }
110121 index = { index }
111- renderIndex = { record . index }
122+ renderIndex = { renderIndex }
112123 dataIndex = { dataIndex }
113124 render = { mergedRender }
114125 shouldCellUpdate = { column . shouldCellUpdate }
0 commit comments