Skip to content

Commit 8c2e093

Browse files
committed
chore: add reverse zIndex
1 parent 2480d88 commit 8c2e093

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Cell/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export interface CellProps<RecordType extends DefaultRecordType> {
4444
offsetFixedStartShadow?: number;
4545
offsetFixedEndShadow?: number;
4646
zIndex?: number;
47+
zIndexReverse?: number;
4748
allColsFixedLeft?: boolean;
4849

4950
// ====================== Private Props ======================
@@ -112,6 +113,7 @@ function Cell<RecordType>(props: CellProps<RecordType>) {
112113
offsetFixedStartShadow,
113114
offsetFixedEndShadow,
114115
zIndex,
116+
zIndexReverse,
115117

116118
// Private
117119
appendNode,
@@ -164,10 +166,12 @@ function Cell<RecordType>(props: CellProps<RecordType>) {
164166
if (isFixStart) {
165167
fixedStyle.insetInlineStart = fixStart as number;
166168
fixedStyle['--z-offset'] = zIndex;
169+
fixedStyle['--z-offset-reverse'] = zIndexReverse;
167170
}
168171
if (isFixEnd) {
169172
fixedStyle.insetInlineEnd = fixEnd as number;
170173
fixedStyle['--z-offset'] = zIndex;
174+
fixedStyle['--z-offset-reverse'] = zIndexReverse;
171175
}
172176

173177
// ================ RowSpan & ColSpan =================

src/utils/fixUtil.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export interface FixedInfo {
1717
/** Show the shadow when `scrollLeft` arrive for `fixed: end` */
1818
offsetFixedEndShadow?: number;
1919

20+
/** First sticky column `zIndex` will be larger than next */
2021
zIndex?: number;
22+
/** First sticky column `zIndex` will be smaller than next */
23+
zIndexReverse?: number;
2124
}
2225

2326
function isFixedStart(column: { fixed?: FixedType }) {
@@ -53,14 +56,17 @@ export function getCellFixedInfo(
5356
// first fixed start (start -> end) column `zIndex` should be greater than next column.
5457
// first fixed end (end -> start) column `zIndex` should be greater than next column.
5558
let zIndex = 0;
59+
let zIndexReverse = 0;
5660

5761
if (fixStart !== null) {
5862
fixedStartShadow = !columns[colEnd + 1] || !isFixedStart(columns[colEnd + 1]);
5963
zIndex = columns.length * 2 - colStart; // Fix start always overlay fix end
64+
zIndexReverse = colStart;
6065
}
6166
if (fixEnd !== null) {
6267
fixedEndShadow = !columns[colStart - 1] || !isFixedEnd(columns[colStart - 1]);
6368
zIndex = colEnd;
69+
zIndexReverse = columns.length * 2 - colEnd; // Fix end always overlay fix start
6470
}
6571

6672
// Check if scrollLeft will show the shadow
@@ -91,5 +97,6 @@ export function getCellFixedInfo(
9197
offsetFixedEndShadow,
9298
isSticky: stickyOffsets.isSticky,
9399
zIndex,
100+
zIndexReverse,
94101
};
95102
}

0 commit comments

Comments
 (0)