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( + , + ); + expect(container.querySelectorAll('.rc-table-cell-fix-left-last').length).toBe(101); + expect(container.querySelectorAll('.rc-table-cell-fix-right-first').length).toBe(101); + expect(container).toMatchSnapshot(); + }); }); diff --git a/tests/__mocks__/shadowTest.tsx b/tests/__mocks__/shadowTest.tsx index d3e4b834e..e45e37c49 100644 --- a/tests/__mocks__/shadowTest.tsx +++ b/tests/__mocks__/shadowTest.tsx @@ -1,7 +1,7 @@ import React from 'react'; import Table from '../../src'; import '../../assets/index.less'; -import type { ColumnsType } from '../../src'; +import type { ColumnsType, TableProps } from '../../src'; interface DataType { key: React.Key; @@ -171,8 +171,8 @@ const data2: User[] = [ }, ]; -export const RowColSpanWithFixed = () => ( - +export const RowColSpanWithFixed = (props?: TableProps) => ( +
); export const RowColSpanWithFixed2 = () => (
diff --git a/tests/__snapshots__/FixedColumn.spec.tsx.snap b/tests/__snapshots__/FixedColumn.spec.tsx.snap index 559ffb5eb..a2649b157 100644 --- a/tests/__snapshots__/FixedColumn.spec.tsx.snap +++ b/tests/__snapshots__/FixedColumn.spec.tsx.snap @@ -3144,6 +3144,2421 @@ LoadedCheerio { } `; +exports[`Table.FixedColumn > shadow should be shown when there are columns where fixed is false 1`] = ` +
+
+
+
+
+ + + + + + + + + +
+ Other + + Name + + Company + + Gender + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 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 +
+
+ + + +`; + exports[`Table.FixedColumn > shadow should display correctly 1`] = `