diff --git a/src/utils/fixUtil.ts b/src/utils/fixUtil.ts index 466ea6ed4..785ed8c88 100644 --- a/src/utils/fixUtil.ts +++ b/src/utils/fixUtil.ts @@ -70,22 +70,22 @@ export function getCellFixedInfo( const hasChildren = hasColumnChildren(curColumns); // no children only - const canLastFix = !(curColumns as ColumnGroupType)?.children || hasChildren; + const canLastFix = !(curColumns as ColumnGroupType)?.children; if (direction === 'rtl') { if (fixLeft !== undefined) { const prevFixLeft = prevColumn && prevColumn.fixed === 'left'; - firstFixLeft = !prevFixLeft && canLastFix; + firstFixLeft = !prevFixLeft && (canLastFix || hasChildren); } else if (fixRight !== undefined) { const nextFixRight = nextColumn && nextColumn.fixed === 'right'; - lastFixRight = !nextFixRight && canLastFix; + lastFixRight = !nextFixRight && (canLastFix || hasChildren); } } else if (fixLeft !== undefined) { const nextFixLeft = nextColumn && nextColumn.fixed === 'left'; lastFixLeft = !nextFixLeft && canLastFix; } else if (fixRight !== undefined) { const prevFixRight = prevColumn && prevColumn.fixed === 'right'; - firstFixRight = !prevFixRight && canLastFix; + firstFixRight = !prevFixRight && (canLastFix || hasChildren); } return { diff --git a/tests/FixedHeader.spec.jsx b/tests/FixedHeader.spec.jsx index 6798d2b4e..c3d3dd8f4 100644 --- a/tests/FixedHeader.spec.jsx +++ b/tests/FixedHeader.spec.jsx @@ -261,6 +261,8 @@ describe('Table.FixedHeader', () => { const wrapper = mount(); await safeAct(wrapper); expect(wrapper.find('td').at(9).props().className).toContain('rc-table-cell-fix-left-last'); - expect(wrapper.find('th').first().props().className).toContain('rc-table-cell-fix-left-last'); + expect(wrapper.find('th').first().props().className).not.toContain( + 'rc-table-cell-fix-left-last', + ); }); });