Skip to content

Commit d5b5bb1

Browse files
gavanxclaude
andauthored
fix: pass classNames.body.cell to VirtualCell in virtual mode (#1487)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 80fcd5e commit d5b5bb1

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/VirtualTable/BodyLine.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
2525
const { data, index, className, rowKey, style, extra, getHeight, ...restProps } = props;
2626
const { record, indent, index: renderIndex } = data;
2727

28-
const { scrollX, flattenColumns, prefixCls, fixColumn, componentWidth } = useContext(
29-
TableContext,
30-
['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX'],
31-
);
28+
const { scrollX, flattenColumns, prefixCls, fixColumn, componentWidth, classNames, styles } =
29+
useContext(TableContext, [
30+
'prefixCls',
31+
'flattenColumns',
32+
'fixColumn',
33+
'componentWidth',
34+
'scrollX',
35+
'classNames',
36+
'styles',
37+
]);
3238
const { getComponent } = useContext(StaticContext, ['getComponent']);
3339

3440
const rowInfo = useRowInfo(record, rowKey, index, indent);
@@ -93,16 +99,18 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
9399
{...restProps}
94100
data-row-key={rowKey}
95101
ref={rowSupportExpand ? null : ref}
96-
className={clsx(className, `${prefixCls}-row`, rowProps?.className, {
102+
className={clsx(className, `${prefixCls}-row`, rowProps?.className, classNames?.body?.row, {
97103
[expandedClsName]: indent >= 1,
98104
[`${prefixCls}-row-extra`]: extra,
99105
})}
100-
style={{ ...rowStyle, ...rowProps?.style }}
106+
style={{ ...rowStyle, ...rowProps?.style, ...styles?.body?.row }}
101107
>
102108
{flattenColumns.map((column, colIndex) => {
103109
return (
104110
<VirtualCell
105111
key={colIndex}
112+
className={classNames?.body?.cell}
113+
style={styles?.body?.cell}
106114
component={cellComponent}
107115
rowInfo={rowInfo}
108116
column={column}

0 commit comments

Comments
 (0)