Skip to content

Commit

Permalink
Fix issue with column border when there are band columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Alyar committed Oct 14, 2024
1 parent 422e309 commit 064bf38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ const baseStickyColumns = <T extends ModuleType<ColumnsView>>(Base: T) => class
rowIndex: number | null,
): void {
const columnsController = this._columnsController;
const prevCellIsFixed = prevColumnIsFixed(columnsController, column, rowIndex);
const isRowsView = this.name === 'rowsView';
const prevCellIsFixed = prevColumnIsFixed(
columnsController,
column,
rowIndex,
isRowsView,
);
const isFirstColumn = columnsController?.isFirstColumn(column, rowIndex);

GridCoreStickyColumnsDom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ const getPrevColumn = function (
that: ColumnsController,
column,
visibleColumns,
rowIndex: number | null,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): any {
const visibleColumnIndex = that.getVisibleIndex(column.index, 0);
const visibleColumnIndex = that.getVisibleIndex(column.index, rowIndex);

return visibleColumns?.slice(0, visibleColumnIndex)
.reverse()
Expand All @@ -113,13 +114,15 @@ const prevColumnIsFixedCore = function (
that: ColumnsController,
column,
visibleColumns,
rowIndex: number | null,
): boolean {
const prevColumn = getPrevColumn(that, column, visibleColumns);
const prevColumn = getPrevColumn(that, column, visibleColumns, rowIndex);
const fixedPosition = getColumnFixedPosition(that, column);

return !!prevColumn?.fixed
&& (!column.fixed
|| column.fixedPosition === StickyPosition.Sticky
|| column.fixedPosition !== prevColumn?.fixedPosition
|| fixedPosition === StickyPosition.Sticky
|| fixedPosition !== getColumnFixedPosition(that, prevColumn)
);
};

Expand Down Expand Up @@ -195,18 +198,18 @@ export const prevColumnIsFixed = function (
rowIndex: number | null,
isDataColumn = false,
): boolean {
const visibleColumns = that.getVisibleColumns(isDataColumn ? null : 0);
const visibleColumns = that.getVisibleColumns(isDataColumn ? null : rowIndex);
const parentColumn = !isDataColumn && that.getParentColumn(column);

if (parentColumn) {
const isFirstColumn = that.isFirstColumn(column, rowIndex, true);

if (isFirstColumn) {
return prevColumnIsFixedCore(that, parentColumn, visibleColumns);
return prevColumnIsFixedCore(that, parentColumn, that.getVisibleColumns(0), 0);
}
}

return prevColumnIsFixedCore(that, column, visibleColumns);
return prevColumnIsFixedCore(that, column, visibleColumns, rowIndex);
};

export const normalizeOffset = function (offset: Record<string, number>): CSSStyleDeclaration {
Expand Down

0 comments on commit 064bf38

Please sign in to comment.