Skip to content

Commit

Permalink
fix: add "frozen" class to all slick-pane for easier styling (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored Nov 28, 2024
1 parent 1032280 commit 967c9d8
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
5 changes: 1 addition & 4 deletions examples/example-auto-scroll-when-dragging.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
.slick-row:not(.slick-group) >.cell-unselectable {
background: #efefef;
}
.slick-row .slick-cell.frozen:last-child,
.slick-header-column.frozen:last-child,
.slick-headerrow-column.frozen:last-child,
.slick-footerrow-column.frozen:last-child {
.slick-pane.frozen {
border-right: 1px solid red;
}

Expand Down
5 changes: 1 addition & 4 deletions examples/example-frozen-columns-and-rows.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@
box-sizing: border-box;
}

.slick-row .slick-cell.frozen:last-child,
.slick-header-column.frozen:last-child,
.slick-headerrow-column.frozen:last-child,
.slick-footerrow-column.frozen:last-child {
.slick-pane.frozen {
border-right: 1px solid #999;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/example-frozen-columns-large.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
background-color: transparent; /* show default selected row background */
}

.slick-cell.frozen:last-child, .slick-header-column.frozen:last-child {
.slick-pane.frozen {
border-right: 1.5px dotted darkblue !important;
}
.options-panel {
Expand Down
2 changes: 1 addition & 1 deletion examples/example-frozen-columns.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
background-color: transparent; /* show default selected row background */
}

.slick-cell.frozen:last-child, .slick-header-column.frozen:last-child {
.slick-pane.frozen {
border-right: 1.5px dotted darkblue !important;
}
</style>
Expand Down
10 changes: 10 additions & 0 deletions src/slick.grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,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 @@ -2306,6 +2307,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() {
if (this.hasFrozenColumns()) {
Utils.show(this._paneHeaderR);
Expand Down Expand Up @@ -3580,6 +3589,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();

Expand Down
1 change: 1 addition & 0 deletions src/styles/slick-alpine-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@
}

.slick-pane {
box-sizing: border-box;
position: absolute;
outline: 0;
overflow: hidden;
Expand Down

0 comments on commit 967c9d8

Please sign in to comment.