From 21d13259926be2e7411b8ad78d4217dd0889bdc1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 26 Aug 2025 14:44:31 +0800 Subject: [PATCH] refactor: remove maxContentScroll prop and related logic from FixedHolder and Table components --- src/FixedHolder/index.tsx | 20 +++++--------------- src/Table.tsx | 1 - 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index de95b0203..66a2151f8 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -27,7 +27,6 @@ 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; @@ -58,7 +57,6 @@ const FixedHolder = React.forwardRef>((pro stickyBottomOffset, stickyClassName, onScroll, - maxContentScroll, children, ...restProps } = props; @@ -98,12 +96,6 @@ 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 } = { @@ -156,13 +148,11 @@ 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 b61de7520..37fd39fba 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -680,7 +680,6 @@ function Table( // Fixed holder share the props const fixedHolderProps = { noData: !mergedData.length, - maxContentScroll: horizonScroll && mergedScrollX === 'max-content', ...headerProps, ...columnContext, direction,