From 83393687cbe919895c91d617aaa13f93b5e52c95 Mon Sep 17 00:00:00 2001
From: linxianxi <904492381@qq.com>
Date: Tue, 30 Apr 2024 09:12:05 +0800
Subject: [PATCH] fix: shadow should be shown when there are columns where
fixed is false
---
src/utils/fixUtil.ts | 4 +-
tests/FixedColumn.spec.tsx | 32 +
tests/__mocks__/shadowTest.tsx | 6 +-
tests/__snapshots__/FixedColumn.spec.tsx.snap | 2415 +++++++++++++++++
4 files changed, 2452 insertions(+), 5 deletions(-)
diff --git a/src/utils/fixUtil.ts b/src/utils/fixUtil.ts
index 6c29f9eea..e1540f395 100644
--- a/src/utils/fixUtil.ts
+++ b/src/utils/fixUtil.ts
@@ -43,8 +43,8 @@ export function getCellFixedInfo(
// need show shadow only when canLastFix is true
const canLastFix =
- (nextColumn && nextColumn.fixed === undefined) ||
- (prevColumn && prevColumn.fixed === undefined) ||
+ (nextColumn && !nextColumn.fixed) ||
+ (prevColumn && !prevColumn.fixed) ||
columns.every(col => col.fixed === 'left');
if (direction === 'rtl') {
diff --git a/tests/FixedColumn.spec.tsx b/tests/FixedColumn.spec.tsx
index 628073aa5..9e1c95abf 100644
--- a/tests/FixedColumn.spec.tsx
+++ b/tests/FixedColumn.spec.tsx
@@ -309,4 +309,36 @@ describe('Table.FixedColumn', () => {
expect(container.querySelectorAll('.rc-table-cell-fix-right-first').length).toBe(4);
expect(container).toMatchSnapshot();
});
+
+ it('shadow should be shown when there are columns where fixed is false', async () => {
+ const { container } = render(
+
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +
+ | + John Brown + | ++ | + M + | +