diff --git a/.eslintrc.js b/.eslintrc.js index e75449fee..5b4f4d681 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,7 @@ module.exports = { ...base, rules: { ...base.rules, + 'arrow-parens': 0, 'react/no-array-index-key': 0, 'react/sort-comp': 0, '@typescript-eslint/no-explicit-any': 1, diff --git a/src/Body/BodyRow.tsx b/src/Body/BodyRow.tsx index 02028bd1b..34074c837 100644 --- a/src/Body/BodyRow.tsx +++ b/src/Body/BodyRow.tsx @@ -52,6 +52,7 @@ function BodyRow(props: BodyRowP const { prefixCls, direction } = React.useContext(TableContext); const { fixHeader, + fixColumn, horizonScroll, componentWidth, flattenColumns, @@ -196,6 +197,7 @@ function BodyRow(props: BodyRowP )} prefixCls={prefixCls} fixHeader={fixHeader} + fixColumn={fixColumn} horizonScroll={horizonScroll} component={RowComponent} componentWidth={componentWidth} diff --git a/src/Body/ExpandedRow.tsx b/src/Body/ExpandedRow.tsx index 0ca68ee2d..08c1a6fe2 100644 --- a/src/Body/ExpandedRow.tsx +++ b/src/Body/ExpandedRow.tsx @@ -8,6 +8,7 @@ export interface ExpandedRowProps { component: CustomizeComponent; cellComponent: CustomizeComponent; fixHeader: boolean; + fixColumn: boolean; horizonScroll: boolean; componentWidth: number; className: string; @@ -22,6 +23,7 @@ function ExpandedRow({ component: Component, cellComponent, fixHeader, + fixColumn, horizonScroll, className, expanded, @@ -34,7 +36,7 @@ function ExpandedRow({ return React.useMemo(() => { let contentNode = children; - if (horizonScroll) { + if (fixColumn) { contentNode = (
({ className={`${prefixCls}-placeholder`} prefixCls={prefixCls} fixHeader={fixHeader} + fixColumn={horizonScroll} horizonScroll={horizonScroll} component={trComponent} componentWidth={componentWidth} diff --git a/src/Table.tsx b/src/Table.tsx index 743a0c377..df5e15a88 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -370,6 +370,7 @@ function Table(props: TableProps fixed); let scrollXStyle: React.CSSProperties; let scrollYStyle: React.CSSProperties; @@ -469,11 +470,11 @@ function Table(props: TableProps ellipsis || fixed)) { + if (fixHeader || fixColumn || flattenColumns.some(({ ellipsis }) => ellipsis)) { return 'fixed'; } return 'auto'; - }, [fixHeader, flattenColumns, tableLayout]); + }, [fixHeader, fixColumn, flattenColumns, tableLayout]); let groupTableNode: React.ReactNode; @@ -625,7 +626,7 @@ function Table(props: TableProps(props: TableProps(props: TableProps { componentWidth: number; tableLayout: TableLayout; fixHeader: boolean; + fixColumn: boolean; horizonScroll: boolean; indentSize: number; diff --git a/tests/FixedColumn.spec.js b/tests/FixedColumn.spec.js index 2d0650607..1d9e66436 100644 --- a/tests/FixedColumn.spec.js +++ b/tests/FixedColumn.spec.js @@ -158,7 +158,9 @@ describe('Table.FixedColumn', () => { }); it('fixed column renders correctly RTL', () => { - const wrapper = mount(); + const wrapper = mount( +
, + ); expect(wrapper.render()).toMatchSnapshot(); }); it('has correct scroll classNames when table direction is RTL', () => { diff --git a/tests/__snapshots__/FixedColumn.spec.js.snap b/tests/__snapshots__/FixedColumn.spec.js.snap index 3a85d77af..fd7508b2d 100644 --- a/tests/__snapshots__/FixedColumn.spec.js.snap +++ b/tests/__snapshots__/FixedColumn.spec.js.snap @@ -2,16 +2,17 @@ exports[`Table.FixedColumn fixed column renders correctly RTL 1`] = `
+ +