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
4 changes: 4 additions & 0 deletions src/Cell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface CellProps<RecordType extends DefaultRecordType> {
offsetFixedStartShadow?: number;
offsetFixedEndShadow?: number;
zIndex?: number;
zIndexReverse?: number;
allColsFixedLeft?: boolean;

// ====================== Private Props ======================
Expand Down Expand Up @@ -112,6 +113,7 @@ function Cell<RecordType>(props: CellProps<RecordType>) {
offsetFixedStartShadow,
offsetFixedEndShadow,
zIndex,
zIndexReverse,

// Private
appendNode,
Expand Down Expand Up @@ -164,10 +166,12 @@ function Cell<RecordType>(props: CellProps<RecordType>) {
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 =================
Expand Down
7 changes: 7 additions & 0 deletions src/utils/fixUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -91,5 +97,6 @@ export function getCellFixedInfo(
offsetFixedEndShadow,
isSticky: stickyOffsets.isSticky,
zIndex,
zIndexReverse,
};
}
24 changes: 12 additions & 12 deletions tests/__snapshots__/ExpandRow.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,12 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
<tr>
<th
class="rc-table-cell rc-table-row-expand-icon-cell rc-table-cell-fix rc-table-cell-fix-start"
style="inset-inline-start: 0; --z-offset: 8;"
style="inset-inline-start: 0; --z-offset: 8; --z-offset-reverse: 0;"
/>
<th
class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-start rc-table-cell-fix-start-shadow"
scope="col"
style="inset-inline-start: 0; --z-offset: 7;"
style="inset-inline-start: 0; --z-offset: 7; --z-offset-reverse: 1;"
>
Name
</th>
Expand All @@ -479,7 +479,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
<th
class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-end rc-table-cell-fix-end-shadow"
scope="col"
style="inset-inline-end: 0; --z-offset: 3;"
style="inset-inline-end: 0; --z-offset: 3; --z-offset-reverse: 5;"
>
Gender
</th>
Expand Down Expand Up @@ -536,15 +536,15 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
>
<td
class="rc-table-cell rc-table-row-expand-icon-cell rc-table-cell-fix rc-table-cell-fix-start"
style="inset-inline-start: 0; --z-offset: 8;"
style="inset-inline-start: 0; --z-offset: 8; --z-offset-reverse: 0;"
>
<span
class="rc-table-row-expand-icon rc-table-row-expanded"
/>
</td>
<td
class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-start rc-table-cell-fix-start-shadow"
style="inset-inline-start: 0; --z-offset: 7;"
style="inset-inline-start: 0; --z-offset: 7; --z-offset-reverse: 1;"
>
Lucy
</td>
Expand All @@ -555,7 +555,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
</td>
<td
class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-end rc-table-cell-fix-end-shadow"
style="inset-inline-end: 0; --z-offset: 3;"
style="inset-inline-end: 0; --z-offset: 3; --z-offset-reverse: 5;"
>
F
</td>
Expand Down Expand Up @@ -583,15 +583,15 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
>
<td
class="rc-table-cell rc-table-row-expand-icon-cell rc-table-cell-fix rc-table-cell-fix-start"
style="inset-inline-start: 0; --z-offset: 8;"
style="inset-inline-start: 0; --z-offset: 8; --z-offset-reverse: 0;"
>
<span
class="rc-table-row-expand-icon rc-table-row-expanded"
/>
</td>
<td
class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-start rc-table-cell-fix-start-shadow"
style="inset-inline-start: 0; --z-offset: 7;"
style="inset-inline-start: 0; --z-offset: 7; --z-offset-reverse: 1;"
>
Jack
</td>
Expand All @@ -602,7 +602,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
</td>
<td
class="rc-table-cell rc-table-cell-fix rc-table-cell-fix-end rc-table-cell-fix-end-shadow"
style="inset-inline-end: 0; --z-offset: 3;"
style="inset-inline-end: 0; --z-offset: 3; --z-offset-reverse: 5;"
>
M
</td>
Expand Down Expand Up @@ -1072,7 +1072,7 @@ exports[`Table.Expand > work in expandable fix 2`] = `
</th>
<th
class="rc-table-cell rc-table-row-expand-icon-cell rc-table-cell-fix rc-table-cell-fix-start rc-table-cell-fix-start-shadow"
style="inset-inline-start: 0; --z-offset: 5;"
style="inset-inline-start: 0; --z-offset: 5; --z-offset-reverse: 3;"
/>
</tr>
</thead>
Expand Down Expand Up @@ -1142,7 +1142,7 @@ exports[`Table.Expand > work in expandable fix 2`] = `
</td>
<td
class="rc-table-cell rc-table-row-expand-icon-cell rc-table-cell-fix rc-table-cell-fix-start rc-table-cell-fix-start-shadow"
style="inset-inline-start: 0; --z-offset: 5;"
style="inset-inline-start: 0; --z-offset: 5; --z-offset-reverse: 3;"
>
<span
class="rc-table-row-expand-icon rc-table-row-collapsed"
Expand Down Expand Up @@ -1170,7 +1170,7 @@ exports[`Table.Expand > work in expandable fix 2`] = `
</td>
<td
class="rc-table-cell rc-table-row-expand-icon-cell rc-table-cell-fix rc-table-cell-fix-start rc-table-cell-fix-start-shadow"
style="inset-inline-start: 0; --z-offset: 5;"
style="inset-inline-start: 0; --z-offset: 5; --z-offset-reverse: 3;"
>
<span
class="rc-table-row-expand-icon rc-table-row-collapsed"
Expand Down
Loading