Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add "frozen" class to all slick-pane for easier styling #1752

Merged
merged 1 commit into from
Nov 28, 2024
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
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