Skip to content

Commit 5f41e75

Browse files
committed
feat: 不改虚拟表格
1 parent 2f15e97 commit 5f41e75

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

src/VirtualTable/BodyGrid.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
9595

9696
return obj;
9797
});
98-
const rowKeys = flattenData.map(item => item.rowKey);
98+
9999
// ======================= Col/Row Span =======================
100100
const getRowSpan = (column: ColumnType<any>, index: number): number => {
101101
const record = flattenData[index]?.record;
@@ -185,7 +185,6 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
185185
key={index}
186186
data={item}
187187
rowKey={rowKey}
188-
rowKeys={rowKeys}
189188
index={index}
190189
style={{
191190
top: -offsetY + sizeInfo.top,
@@ -244,15 +243,7 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
244243
>
245244
{(item, index, itemProps) => {
246245
const rowKey = getRowKey(item.record, index);
247-
return (
248-
<BodyLine
249-
data={item}
250-
rowKey={rowKey}
251-
rowKeys={rowKeys}
252-
index={index}
253-
style={itemProps.style}
254-
/>
255-
);
246+
return <BodyLine data={item} rowKey={rowKey} index={index} style={itemProps.style} />;
256247
}}
257248
</VirtualList>
258249
</GridContext.Provider>

src/VirtualTable/BodyLine.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ export interface BodyLineProps<RecordType = any> {
1515
className?: string;
1616
style?: React.CSSProperties;
1717
rowKey: React.Key;
18-
rowKeys: React.Key[];
1918

2019
/** Render cell only when it has `rowSpan > 1` */
2120
extra?: boolean;
2221
getHeight?: (rowSpan: number) => number;
2322
}
2423

2524
const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) => {
26-
const { data, index, className, rowKey, style, extra, getHeight, rowKeys, ...restProps } = props;
25+
const { data, index, className, rowKey, style, extra, getHeight, ...restProps } = props;
2726
const { record, indent, index: renderIndex } = data;
2827

2928
const { scrollX, flattenColumns, prefixCls, fixColumn, componentWidth } = useContext(
@@ -115,7 +114,6 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
115114
record={record}
116115
inverse={extra}
117116
getHeight={getHeight}
118-
rowKeys={rowKeys}
119117
/>
120118
);
121119
})}

src/VirtualTable/VirtualCell.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export interface VirtualCellProps<RecordType> {
2525
/** Render cell only when it has `rowSpan > 1` */
2626
inverse?: boolean;
2727
getHeight?: (rowSpan: number) => number;
28-
rowKeys: React.Key[];
2928
}
3029

3130
/**
@@ -51,7 +50,6 @@ function VirtualCell<RecordType = any>(props: VirtualCellProps<RecordType>) {
5150
className,
5251
inverse,
5352
getHeight,
54-
rowKeys,
5553
} = props;
5654

5755
const { render, dataIndex, className: columnClassName, width: colWidth } = column;
@@ -64,7 +62,7 @@ function VirtualCell<RecordType = any>(props: VirtualCellProps<RecordType>) {
6462
colIndex,
6563
indent,
6664
index,
67-
rowKeys,
65+
[],
6866
);
6967

7068
const { style: cellStyle, colSpan = 1, rowSpan = 1 } = additionalCellProps;

0 commit comments

Comments
 (0)