Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/examples/stickyHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ const Demo = () => {
}}
sticky
/>
<br />
<Table
columns={fixedColumns.map(column => ({ ...column, width: undefined }))}
data={[]}
scroll={{
x: 'max-content',
}}
sticky
/>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/FixedHolder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface FixedHeaderProps<RecordType> extends HeaderProps<RecordType> {
stickyTopOffset?: number;
stickyBottomOffset?: number;
stickyClassName?: string;
scrollTableStyle?: React.CSSProperties;
onScroll: (info: { currentTarget: HTMLDivElement; scrollLeft?: number }) => void;
children: (info: HeaderProps<RecordType>) => React.ReactNode;
colGroup?: React.ReactNode;
Expand All @@ -58,6 +59,7 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
stickyTopOffset,
stickyBottomOffset,
stickyClassName,
scrollTableStyle,
onScroll,
children,
...restProps
Expand Down Expand Up @@ -148,6 +150,7 @@ const FixedHolder = React.forwardRef<HTMLDivElement, FixedHeaderProps<any>>((pro
style={{
tableLayout: 'fixed',
visibility: noData || mergedColumnWidth ? null : 'hidden',
...scrollTableStyle,
}}
>
{/* use original ColGroup if no data, otherwise use calculated column width */}
Expand Down
1 change: 1 addition & 0 deletions src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ function Table<RecordType extends DefaultRecordType>(
...columnContext,
direction,
stickyClassName,
scrollTableStyle,
onScroll: onInternalScroll,
};

Expand Down
10 changes: 5 additions & 5 deletions tests/__snapshots__/FixedColumn.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,7 @@ LoadedCheerio {
style="overflow: hidden;"
>
<table
style="table-layout: fixed;"
style="table-layout: fixed; width: 1200px; min-width: 100%;"
>
<colgroup>
<col
Expand Down Expand Up @@ -2814,7 +2814,7 @@ LoadedCheerio {
style="overflow: hidden;"
>
<table
style="table-layout: fixed;"
style="table-layout: fixed; width: 1200px; min-width: 100%;"
>
<colgroup>
<col
Expand Down Expand Up @@ -3136,7 +3136,7 @@ exports[`Table.FixedColumn > shadow should be shown when there are columns where
style="overflow: hidden;"
>
<table
style="table-layout: fixed;"
style="table-layout: fixed; width: 1500px; min-width: 100%;"
>
<colgroup>
<col
Expand Down Expand Up @@ -5567,7 +5567,7 @@ exports[`Table.FixedColumn > shadow should display correctly 1`] = `
style="overflow: hidden;"
>
<table
style="table-layout: fixed;"
style="table-layout: fixed; width: 1500px; min-width: 100%;"
>
<colgroup>
<col
Expand Down Expand Up @@ -11653,7 +11653,7 @@ exports[`Table.FixedColumn > shadow should display correctly 2`] = `
style="overflow: hidden;"
>
<table
style="table-layout: fixed;"
style="table-layout: fixed; width: 1500px; min-width: 100%;"
>
<colgroup>
<col
Expand Down
4 changes: 2 additions & 2 deletions tests/__snapshots__/Table.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ LoadedCheerio {
style="overflow: hidden;"
>
<table
style="table-layout: fixed;"
style="table-layout: fixed; width: 100px; min-width: 100%;"
>
<colgroup>
<col
Expand Down Expand Up @@ -390,7 +390,7 @@ LoadedCheerio {
style="overflow: hidden;"
>
<table
style="table-layout: fixed;"
style="table-layout: fixed; width: 100px; min-width: 100%;"
>
<colgroup>
<col
Expand Down