Skip to content

Commit 3d731c4

Browse files
authored
🐞 fix: swap columns for rtl direction (#964)
1 parent 83cce50 commit 3d731c4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/utils/fixUtil.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import type { StickyOffsets, FixedType, Direction, ColumnType, ColumnGroupType } from '../interface';
1+
import type {
2+
ColumnGroupType,
3+
ColumnType,
4+
Direction,
5+
FixedType,
6+
StickyOffsets,
7+
} from '../interface';
28

39
export interface FixedInfo {
410
fixLeft: number | false;
@@ -19,7 +25,7 @@ export function getCellFixedInfo<RecordType = any>(
1925
columns: readonly { fixed?: FixedType }[],
2026
stickyOffsets: StickyOffsets,
2127
direction: Direction,
22-
curColumns?: ColumnType<RecordType> | ColumnGroupType<RecordType>
28+
curColumns?: ColumnType<RecordType> | ColumnGroupType<RecordType>,
2329
): FixedInfo {
2430
const startColumn = columns[colStart] || {};
2531
const endColumn = columns[colEnd] || {};
@@ -28,9 +34,9 @@ export function getCellFixedInfo<RecordType = any>(
2834
let fixRight: number;
2935

3036
if (startColumn.fixed === 'left') {
31-
fixLeft = stickyOffsets.left[colStart];
37+
fixLeft = stickyOffsets.left[direction === 'rtl' ? colEnd : colStart];
3238
} else if (endColumn.fixed === 'right') {
33-
fixRight = stickyOffsets.right[colEnd];
39+
fixRight = stickyOffsets.right[direction === 'rtl' ? colStart : colEnd];
3440
}
3541

3642
let lastFixLeft: boolean = false;

0 commit comments

Comments
 (0)