Skip to content

Commit

Permalink
fix: add "frozen" class to all slick-pane for easier styling (#1752)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored Nov 28, 2024
1 parent 8ccd0fa commit 33a8a38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
10 changes: 10 additions & 0 deletions packages/common/src/core/slickGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
}

this.setFrozenOptions();
this.setPaneFrozenClasses();
this.setPaneVisibility();
this.setScroller();
this.setOverflow();
Expand Down Expand Up @@ -2285,6 +2286,14 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
}
}

/** add/remove frozen class to left headers/footer when defined */
protected setPaneFrozenClasses(): void {
const classAction = this.hasFrozenColumns() ? 'add' : 'remove';
for (const elm of [this._paneHeaderL, this._paneTopL, this._paneBottomL]) {
elm.classList[classAction]('frozen');
}
}

protected setPaneVisibility(): void {
if (this.hasFrozenColumns()) {
Utils.show(this._paneHeaderR);
Expand Down Expand Up @@ -3017,6 +3026,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
this.updateColumnCaches();

if (this.initialized) {
this.setPaneFrozenClasses();
this.setPaneVisibility();
this.setOverflow();
this.invalidateAllRows();
Expand Down
3 changes: 0 additions & 3 deletions packages/common/src/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ $slick-header-scroll-width-to-remove: 16px !default;
/* Frozen pinned rows/columns */
$slick-frozen-border-bottom: 1px solid #a5a5a5 !default;
$slick-frozen-border-right: 1px solid #a5a5a5 !default;
$slick-frozen-preheader-row-border-right: $slick-frozen-border-right !default;
$slick-frozen-header-row-border-right: $slick-frozen-border-right !default;
$slick-frozen-filter-row-border-right: $slick-frozen-border-right !default;
$slick-frozen-overflow-right: scroll !default; // typically we would like to always have the scroll displayed when using hamburger menu (top right)

/* icons */
Expand Down
16 changes: 1 addition & 15 deletions packages/common/src/styles/slick-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -758,23 +758,9 @@
}

/** Frozen/Pinned styling */

.slick-row .slick-cell.frozen:last-child,
.slick-footerrow-column.frozen:last-child {
.slick-pane-left.frozen {
border-right: var(--slick-frozen-border-right, v.$slick-frozen-border-right);
}
.slick-header-column.frozen:last-child {
border-right: var(--slick-frozen-header-row-border-right, v.$slick-frozen-header-row-border-right);
}
.slick-pane-left {
.slick-preheader-panel .slick-header-column.frozen:last-child,
.slick-topheader-panel .slick-header-column.frozen:last-child {
border-right: var(--slick-frozen-preheader-row-border-right, v.$slick-frozen-preheader-row-border-right);
}
}
.slick-headerrow-column.frozen:last-child {
border-right: var(--slick-frozen-filter-row-border-right, v.$slick-frozen-filter-row-border-right);
}

.slick-pane-bottom {
border-top: var(--slick-frozen-border-bottom, v.$slick-frozen-border-bottom);
Expand Down

0 comments on commit 33a8a38

Please sign in to comment.