From e8ac74a9593f9e176557c9fefede62115ce1aa94 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 26 Aug 2025 17:11:04 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"refactor:=20remove=20maxContentScroll?= =?UTF-8?q?=20prop=20and=20related=20logic=20from=20FixedHo=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ce95747358eab1f7ed3f6502289dbaa79241c506. --- src/FixedHolder/index.tsx | 20 +++++++++++++++----- src/Table.tsx | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index 66a2151f8..de95b0203 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -27,6 +27,7 @@ function useColumnWidth(colWidths: readonly number[], columCount: number) { export interface FixedHeaderProps extends HeaderProps { className: string; noData: boolean; + maxContentScroll: boolean; colWidths: readonly number[]; columCount: number; direction: Direction; @@ -57,6 +58,7 @@ const FixedHolder = React.forwardRef>((pro stickyBottomOffset, stickyClassName, onScroll, + maxContentScroll, children, ...restProps } = props; @@ -96,6 +98,12 @@ const FixedHolder = React.forwardRef>((pro }; }, []); + // Check if all flattenColumns has width + const allFlattenColumnsWithWidth = React.useMemo( + () => flattenColumns.every(column => column.width), + [flattenColumns], + ); + // Add scrollbar column const lastColumn = flattenColumns[flattenColumns.length - 1]; const ScrollBarColumn: ColumnType & { scrollbar: true } = { @@ -148,11 +156,13 @@ const FixedHolder = React.forwardRef>((pro visibility: noData || mergedColumnWidth ? null : 'hidden', }} > - + {(!noData || !maxContentScroll || allFlattenColumnsWithWidth) && ( + + )} {children({ ...restProps, stickyOffsets: headerStickyOffsets, diff --git a/src/Table.tsx b/src/Table.tsx index 37fd39fba..b61de7520 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -680,6 +680,7 @@ function Table( // Fixed holder share the props const fixedHolderProps = { noData: !mergedData.length, + maxContentScroll: horizonScroll && mergedScrollX === 'max-content', ...headerProps, ...columnContext, direction,