diff --git a/src/Cell/index.tsx b/src/Cell/index.tsx index 2fe6520e4..9a7a6166a 100644 --- a/src/Cell/index.tsx +++ b/src/Cell/index.tsx @@ -44,6 +44,7 @@ export interface CellProps { offsetFixedStartShadow?: number; offsetFixedEndShadow?: number; zIndex?: number; + zIndexReverse?: number; allColsFixedLeft?: boolean; // ====================== Private Props ====================== @@ -112,6 +113,7 @@ function Cell(props: CellProps) { offsetFixedStartShadow, offsetFixedEndShadow, zIndex, + zIndexReverse, // Private appendNode, @@ -164,10 +166,12 @@ function Cell(props: CellProps) { if (isFixStart) { fixedStyle.insetInlineStart = fixStart as number; fixedStyle['--z-offset'] = zIndex; + fixedStyle['--z-offset-reverse'] = zIndexReverse; } if (isFixEnd) { fixedStyle.insetInlineEnd = fixEnd as number; fixedStyle['--z-offset'] = zIndex; + fixedStyle['--z-offset-reverse'] = zIndexReverse; } // ================ RowSpan & ColSpan ================= diff --git a/src/utils/fixUtil.ts b/src/utils/fixUtil.ts index 5186b2837..125ec1d6d 100644 --- a/src/utils/fixUtil.ts +++ b/src/utils/fixUtil.ts @@ -17,7 +17,10 @@ export interface FixedInfo { /** Show the shadow when `scrollLeft` arrive for `fixed: end` */ offsetFixedEndShadow?: number; + /** First sticky column `zIndex` will be larger than next */ zIndex?: number; + /** First sticky column `zIndex` will be smaller than next */ + zIndexReverse?: number; } function isFixedStart(column: { fixed?: FixedType }) { @@ -53,14 +56,17 @@ export function getCellFixedInfo( // first fixed start (start -> end) column `zIndex` should be greater than next column. // first fixed end (end -> start) column `zIndex` should be greater than next column. let zIndex = 0; + let zIndexReverse = 0; if (fixStart !== null) { fixedStartShadow = !columns[colEnd + 1] || !isFixedStart(columns[colEnd + 1]); zIndex = columns.length * 2 - colStart; // Fix start always overlay fix end + zIndexReverse = colStart; } if (fixEnd !== null) { fixedEndShadow = !columns[colStart - 1] || !isFixedEnd(columns[colStart - 1]); zIndex = colEnd; + zIndexReverse = columns.length * 2 - colEnd; // Fix end always overlay fix start } // Check if scrollLeft will show the shadow @@ -91,5 +97,6 @@ export function getCellFixedInfo( offsetFixedEndShadow, isSticky: stickyOffsets.isSticky, zIndex, + zIndexReverse, }; } diff --git a/tests/__snapshots__/ExpandRow.spec.jsx.snap b/tests/__snapshots__/ExpandRow.spec.jsx.snap index 71d1f8f9d..ba89a19b1 100644 --- a/tests/__snapshots__/ExpandRow.spec.jsx.snap +++ b/tests/__snapshots__/ExpandRow.spec.jsx.snap @@ -461,12 +461,12 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = ` Name @@ -479,7 +479,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = ` Gender @@ -536,7 +536,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = ` > renders fixed column correctly > work 1`] = ` Lucy @@ -555,7 +555,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = ` F @@ -583,7 +583,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = ` > renders fixed column correctly > work 1`] = ` Jack @@ -602,7 +602,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = ` M @@ -1072,7 +1072,7 @@ exports[`Table.Expand > work in expandable fix 2`] = ` @@ -1142,7 +1142,7 @@ exports[`Table.Expand > work in expandable fix 2`] = ` work in expandable fix 2`] = ` fixed column renders correctly RTL 1`] = ` title1 fixed column renders correctly RTL 1`] = ` title12 @@ -243,13 +243,13 @@ exports[`Table.FixedColumn > fixed column renders correctly RTL 1`] = ` > 123 fixed column renders correctly RTL 1`] = ` xxxxxxxx @@ -316,13 +316,13 @@ exports[`Table.FixedColumn > fixed column renders correctly RTL 1`] = ` > cdd fixed column renders correctly RTL 1`] = ` edd12221 @@ -389,13 +389,13 @@ exports[`Table.FixedColumn > fixed column renders correctly RTL 1`] = ` > 133 fixed column renders correctly RTL 1`] = ` /> fixed column renders correctly RTL 1`] = ` > 133 fixed column renders correctly RTL 1`] = ` /> fixed column renders correctly RTL 1`] = ` > 133 fixed column renders correctly RTL 1`] = ` /> fixed column renders correctly RTL 1`] = ` > 133 fixed column renders correctly RTL 1`] = ` /> fixed column renders correctly RTL 1`] = ` > 133 fixed column renders correctly RTL 1`] = ` /> fixed column renders correctly RTL 1`] = ` > 133 fixed column renders correctly RTL 1`] = ` /> fixed column renders correctly RTL 1`] = ` > 133 fixed column renders correctly RTL 1`] = ` /> @@ -832,14 +832,14 @@ exports[`Table.FixedColumn > renders correctly > scrollX - with data 1`] = ` title1 renders correctly > scrollX - with data 1`] = ` title12 @@ -1034,13 +1034,13 @@ exports[`Table.FixedColumn > renders correctly > scrollX - with data 1`] = ` > 123 renders correctly > scrollX - with data 1`] = ` xxxxxxxx @@ -1107,13 +1107,13 @@ exports[`Table.FixedColumn > renders correctly > scrollX - with data 1`] = ` > cdd renders correctly > scrollX - with data 1`] = ` edd12221 @@ -1180,13 +1180,13 @@ exports[`Table.FixedColumn > renders correctly > scrollX - with data 1`] = ` > 133 renders correctly > scrollX - with data 1`] = ` /> renders correctly > scrollX - with data 1`] = ` > 133 renders correctly > scrollX - with data 1`] = ` /> renders correctly > scrollX - with data 1`] = ` > 133 renders correctly > scrollX - with data 1`] = ` /> renders correctly > scrollX - with data 1`] = ` > 133 renders correctly > scrollX - with data 1`] = ` /> renders correctly > scrollX - with data 1`] = ` > 133 renders correctly > scrollX - with data 1`] = ` /> renders correctly > scrollX - with data 1`] = ` > 133 renders correctly > scrollX - with data 1`] = ` /> renders correctly > scrollX - with data 1`] = ` > 133 renders correctly > scrollX - with data 1`] = ` /> @@ -1621,14 +1621,14 @@ exports[`Table.FixedColumn > renders correctly > scrollX - without data 1`] = ` title1 renders correctly > scrollX - without data 1`] = ` title12 @@ -1901,14 +1901,14 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - with data 1`] = ` title1 renders correctly > scrollXY - with data 1`] = ` title12 @@ -2136,13 +2136,13 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - with data 1`] = ` > 123 renders correctly > scrollXY - with data 1`] = ` xxxxxxxx @@ -2209,13 +2209,13 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - with data 1`] = ` > cdd renders correctly > scrollXY - with data 1`] = ` edd12221 @@ -2282,13 +2282,13 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - with data 1`] = ` > 133 renders correctly > scrollXY - with data 1`] = ` /> renders correctly > scrollXY - with data 1`] = ` > 133 renders correctly > scrollXY - with data 1`] = ` /> renders correctly > scrollXY - with data 1`] = ` > 133 renders correctly > scrollXY - with data 1`] = ` /> renders correctly > scrollXY - with data 1`] = ` > 133 renders correctly > scrollXY - with data 1`] = ` /> renders correctly > scrollXY - with data 1`] = ` > 133 renders correctly > scrollXY - with data 1`] = ` /> renders correctly > scrollXY - with data 1`] = ` > 133 renders correctly > scrollXY - with data 1`] = ` /> renders correctly > scrollXY - with data 1`] = ` > 133 renders correctly > scrollXY - with data 1`] = ` /> @@ -2744,14 +2744,14 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - without data 1`] = ` title1 renders correctly > scrollXY - without data 1`] = ` title12 diff --git a/tests/__snapshots__/Summary.spec.tsx.snap b/tests/__snapshots__/Summary.spec.tsx.snap index a49082978..3012348ff 100644 --- a/tests/__snapshots__/Summary.spec.tsx.snap +++ b/tests/__snapshots__/Summary.spec.tsx.snap @@ -8,7 +8,7 @@ exports[`Table.Summary > support data type 1`] = ` Light diff --git a/tests/__snapshots__/Table.spec.jsx.snap b/tests/__snapshots__/Table.spec.jsx.snap index d69946a3b..3a09a0e24 100644 --- a/tests/__snapshots__/Table.spec.jsx.snap +++ b/tests/__snapshots__/Table.spec.jsx.snap @@ -100,7 +100,7 @@ exports[`Table.Basic > custom components > renders fixed column and header corre class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-start rc-table-cell-fix-start-shadow" name="my-header-cell" scope="col" - style="inset-inline-start: 0; --z-offset: 8;" + style="inset-inline-start: 0; --z-offset: 8; --z-offset-reverse: 0;" > Name @@ -115,14 +115,14 @@ exports[`Table.Basic > custom components > renders fixed column and header corre class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-end rc-table-cell-fix-end-shadow" name="my-header-cell" scope="col" - style="inset-inline-end: 15px; --z-offset: 2;" + style="inset-inline-end: 15px; --z-offset: 2; --z-offset-reverse: 6;" > Gender @@ -182,7 +182,7 @@ exports[`Table.Basic > custom components > renders fixed column and header corre Lucy @@ -195,7 +195,7 @@ exports[`Table.Basic > custom components > renders fixed column and header corre F