diff --git a/assets/index.less b/assets/index.less index d2f2d8fee..25ce61ea5 100644 --- a/assets/index.less +++ b/assets/index.less @@ -92,6 +92,10 @@ pointer-events: none; } + &-fix-left-all::after { + display: none; + } + &-fix-right-first, &-fix-right-last { box-shadow: -1px 0 0 @border-color; diff --git a/src/Cell/index.tsx b/src/Cell/index.tsx index 5d8d2fe22..6a1aae867 100644 --- a/src/Cell/index.tsx +++ b/src/Cell/index.tsx @@ -15,6 +15,7 @@ import type { import { getPathValue, validateValue } from '../utils/valueUtil'; import StickyContext from '../context/StickyContext'; import HoverContext from '../context/HoverContext'; +import BodyContext from '../context/BodyContext'; import type { HoverContextProps } from '../context/HoverContext'; import warning from 'rc-util/lib/warning'; import PerfContext from '../context/PerfContext'; @@ -67,6 +68,7 @@ interface InternalCellProps lastFixLeft?: boolean; firstFixRight?: boolean; lastFixRight?: boolean; + allColsFixedLeft?: boolean; // ====================== Private Props ====================== /** @private Used for `expandable` with nest tree */ @@ -141,6 +143,7 @@ function Cell( const perfRecord = React.useContext(PerfContext); const supportSticky = React.useContext(StickyContext); + const { allColumnsFixedLeft } = React.useContext(BodyContext); // ==================== Child Node ==================== const [childNode, legacyCellProps] = React.useMemo< @@ -280,6 +283,7 @@ function Cell( [`${cellPrefixCls}-fix-left`]: isFixLeft && supportSticky, [`${cellPrefixCls}-fix-left-first`]: firstFixLeft && supportSticky, [`${cellPrefixCls}-fix-left-last`]: lastFixLeft && supportSticky, + [`${cellPrefixCls}-fix-left-all`]: lastFixLeft && allColumnsFixedLeft && supportSticky, [`${cellPrefixCls}-fix-right`]: isFixRight && supportSticky, [`${cellPrefixCls}-fix-right-first`]: firstFixRight && supportSticky, [`${cellPrefixCls}-fix-right-last`]: lastFixRight && supportSticky, diff --git a/src/Table.tsx b/src/Table.tsx index 51383a158..cd31bd0d0 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -822,6 +822,7 @@ function Table(props: TableProps col.fixed === 'left'), }), [ columnContext, diff --git a/src/context/BodyContext.tsx b/src/context/BodyContext.tsx index 5f7233971..c0d2ccb85 100644 --- a/src/context/BodyContext.tsx +++ b/src/context/BodyContext.tsx @@ -27,6 +27,7 @@ export interface BodyContextProps { expandIcon: RenderExpandIcon; onTriggerExpand: TriggerEventHandler; expandIconColumnIndex: number; + allColumnsFixedLeft: boolean; } const BodyContext = React.createContext(null); diff --git a/tests/FixedColumn.spec.js b/tests/FixedColumn.spec.js index 18fe541b5..ac0b19491 100644 --- a/tests/FixedColumn.spec.js +++ b/tests/FixedColumn.spec.js @@ -272,4 +272,9 @@ describe('Table.FixedColumn', () => { wrapper.update(); expect(wrapper.find('.rc-table-measure-row td')).toHaveLength(4); }); + + it('when all columns fixed left,cell should has classname rc-table-cell-fix-left-all', () => { + const wrapper = mount(); + expect(wrapper.find('.rc-table-cell-fix-left-all')).toHaveLength(10); + }); });