diff --git a/docs/examples/stickyHeader.tsx b/docs/examples/stickyHeader.tsx index e5013e453..bed178ea3 100644 --- a/docs/examples/stickyHeader.tsx +++ b/docs/examples/stickyHeader.tsx @@ -261,6 +261,15 @@ const Demo = () => { }} sticky /> +
+ ({ ...column, width: undefined }))} + data={[]} + scroll={{ + x: 'max-content', + }} + sticky + /> ); }; diff --git a/package.json b/package.json index 7485f2c52..cf1b72481 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-table", - "version": "7.52.1", + "version": "7.52.2", "description": "table ui component for react", "engines": { "node": ">=8.x" diff --git a/src/FixedHolder/index.tsx b/src/FixedHolder/index.tsx index d9e1a0f8b..f98cc3686 100644 --- a/src/FixedHolder/index.tsx +++ b/src/FixedHolder/index.tsx @@ -34,6 +34,7 @@ export interface FixedHeaderProps extends HeaderProps { stickyTopOffset?: number; stickyBottomOffset?: number; stickyClassName?: string; + scrollTableStyle?: React.CSSProperties; onScroll: (info: { currentTarget: HTMLDivElement; scrollLeft?: number }) => void; children: (info: HeaderProps) => React.ReactNode; colGroup?: React.ReactNode; @@ -58,6 +59,7 @@ const FixedHolder = React.forwardRef>((pro stickyTopOffset, stickyBottomOffset, stickyClassName, + scrollTableStyle, onScroll, children, ...restProps @@ -148,6 +150,7 @@ const FixedHolder = React.forwardRef>((pro style={{ tableLayout: 'fixed', visibility: noData || mergedColumnWidth ? null : 'hidden', + ...scrollTableStyle, }} > {/* use original ColGroup if no data, otherwise use calculated column width */} diff --git a/src/Table.tsx b/src/Table.tsx index 8ef2d5a6b..25f63313b 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -684,6 +684,7 @@ function Table( ...columnContext, direction, stickyClassName, + scrollTableStyle, onScroll: onInternalScroll, }; diff --git a/tests/__snapshots__/FixedColumn.spec.tsx.snap b/tests/__snapshots__/FixedColumn.spec.tsx.snap index 6bb8e4339..f2c5abeca 100644 --- a/tests/__snapshots__/FixedColumn.spec.tsx.snap +++ b/tests/__snapshots__/FixedColumn.spec.tsx.snap @@ -1941,7 +1941,7 @@ LoadedCheerio { style="overflow: hidden;" >
shadow should be shown when there are columns where style="overflow: hidden;" >
shadow should display correctly 1`] = ` style="overflow: hidden;" >
shadow should display correctly 2`] = ` style="overflow: hidden;" >