Skip to content

Commit 73ed670

Browse files
authored
fix(grid): Make sure border does not appear when new theme is loaded runtime. (#17029)
1 parent 7ed9ee8 commit 73ed670

6 files changed

Lines changed: 70 additions & 17 deletions

File tree

angular.json

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"index": "src/index.html",
2424
"polyfills": [
25-
"zone.js"
25+
"zone.js"
2626
],
2727
"tsConfig": "src/tsconfig.app.json",
2828
"assets": [
@@ -31,7 +31,12 @@
3131
"src/web.config"
3232
],
3333
"styles": [
34-
"src/styles/styles.scss"
34+
"src/styles/styles.scss",
35+
{
36+
"input": "src/styles/grid-cell-merging-alternate-theme.scss",
37+
"bundleName": "grid-cell-merging-alternate-theme",
38+
"inject": false
39+
}
3540
],
3641
"scripts": [],
3742
"extractLicenses": false,
@@ -346,11 +351,19 @@
346351
"projects/igniteui-angular-elements/src/styles.scss"
347352
],
348353
"scripts": [
349-
{ "input": "./node_modules/lit-html/lit-html.js", "inject": false },
350-
{ "input": "./node_modules/lit-html/development/directive.js", "inject": false }
354+
{
355+
"input": "./node_modules/lit-html/lit-html.js",
356+
"inject": false
357+
},
358+
{
359+
"input": "./node_modules/lit-html/development/directive.js",
360+
"inject": false
361+
}
351362
],
352363
"stylePreprocessorOptions": {
353-
"includePaths": ["node_modules"]
364+
"includePaths": [
365+
"node_modules"
366+
]
354367
},
355368
"browser": "projects/igniteui-angular-elements/src/main.ts"
356369
},
@@ -382,7 +395,10 @@
382395
],
383396
"outputHashing": "none",
384397
"optimization": true,
385-
"externalDependencies": ["lit", "igniteui-i18n-core"]
398+
"externalDependencies": [
399+
"lit",
400+
"igniteui-i18n-core"
401+
]
386402
},
387403
"development": {
388404
"optimization": false,
@@ -391,8 +407,8 @@
391407
"namedChunks": true
392408
},
393409
"dev-app": {
394-
"browser": "projects/igniteui-angular-elements/src/main.app.ts",
395-
"tsConfig": "projects/igniteui-angular-elements/tsconfig.app.json"
410+
"browser": "projects/igniteui-angular-elements/src/main.app.ts",
411+
"tsConfig": "projects/igniteui-angular-elements/tsconfig.app.json"
396412
}
397413
},
398414
"defaultConfiguration": "production"
@@ -419,7 +435,7 @@
419435
"builder": "@angular/build:karma",
420436
"options": {
421437
"main": "projects/igniteui-angular-elements/src/test.ts",
422-
"polyfills": [
438+
"polyfills": [
423439
"projects/igniteui-angular-elements/src/polyfills.ts"
424440
],
425441
"tsConfig": "projects/igniteui-angular-elements/tsconfig.spec.json",
@@ -433,7 +449,9 @@
433449
"projects/igniteui-angular-elements/src/styles.scss"
434450
],
435451
"stylePreprocessorOptions": {
436-
"includePaths": ["node_modules"]
452+
"includePaths": [
453+
"node_modules"
454+
]
437455
},
438456
"scripts": []
439457
}
@@ -572,7 +590,9 @@
572590
"projects/igniteui-angular-performance/src/styles.scss"
573591
],
574592
"stylePreprocessorOptions": {
575-
"includePaths": ["node_modules"]
593+
"includePaths": [
594+
"node_modules"
595+
]
576596
}
577597
},
578598
"configurations": {

projects/igniteui-angular/core/src/core/styles/components/grid/_grid-theme.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,7 @@
13721372
}
13731373

13741374
%igx-grid__tr--merged {
1375+
border-bottom: 0;
13751376
border-block-end: 0;
13761377
}
13771378

projects/igniteui-angular/grids/core/src/row.directive.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,6 @@ export class IgxRowDirective implements DoCheck, AfterViewInit, OnDestroy {
696696
}
697697
const isPinned = this.pinned && !this.disabled;
698698
const indexInData = this.grid.isRowPinningToTop && !isPinned ? this.index - this.grid.pinnedRecordsCount : this.index;
699-
if ((this.grid as any)._cdrRequests) {
700-
// recalc size if repaint is requested.
701-
this.grid.verticalScrollContainer.recalcUpdateSizes();
702-
}
703699
const size = this.grid.verticalScrollContainer.getSizeAt(indexInData);
704700
return size || this.grid.rowHeight;
705701
}

src/app/grid-cellMerging/grid-cellMerging.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<h4 class="sample-title">Grid with cell merge</h4>
22

3+
<button (click)="toggleTheme()">{{ themeLoaded() ? 'Unload Theme CSS' : 'Load Theme CSS' }}</button>
4+
35
<div class="grid__wrapper">
46
<igx-input-group type="search" class="searchInput">
57
<igx-prefix>

src/app/grid-cellMerging/grid-cellMerging.component.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Component, ViewChild } from '@angular/core';
1+
import { Component, OnDestroy, ViewChild, inject, signal } from '@angular/core';
2+
import { DOCUMENT } from '@angular/common';
23
import { FormsModule } from '@angular/forms';
34
import {
45
DefaultTreeGridMergeStrategy,
@@ -56,7 +57,10 @@ import { INVOICE_DATA } from '../shared/invoiceData';
5657
IgxIconButtonDirective
5758
]
5859
})
59-
export class GridCellMergingComponent {
60+
export class GridCellMergingComponent implements OnDestroy {
61+
private readonly document = inject(DOCUMENT);
62+
public themeLoaded = signal(false);
63+
private readonly THEME_LINK_ID = 'grid-cell-merging-alternate-theme';
6064
public hierarchicalData = HIERARCHICAL_DATA.concat(HIERARCHICAL_DATA).concat(HIERARCHICAL_DATA);
6165
public treeData = HIERARCHICAL_SAMPLE_DATA;
6266
public treeGridMergeStrategy = new ByLevelTreeGridMergeStrategy();
@@ -77,6 +81,25 @@ export class GridCellMergingComponent {
7781
this.data = allData;
7882
}
7983

84+
public ngOnDestroy(): void {
85+
this.document.getElementById(this.THEME_LINK_ID)?.remove();
86+
}
87+
88+
public toggleTheme(): void {
89+
const existing = this.document.getElementById(this.THEME_LINK_ID);
90+
if (existing) {
91+
existing.remove();
92+
this.themeLoaded.set(false);
93+
} else {
94+
const link = this.document.createElement('link');
95+
link.rel = 'stylesheet';
96+
link.href = 'grid-cell-merging-alternate-theme.css';
97+
link.id = this.THEME_LINK_ID;
98+
this.document.head.appendChild(link);
99+
this.themeLoaded.set(true);
100+
}
101+
}
102+
80103
public toggleStrategy() {
81104
if (this.treeGridMergeStrategy instanceof ByLevelTreeGridMergeStrategy) {
82105
this.treeGridMergeStrategy = new DefaultTreeGridMergeStrategy();
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@use '../../projects/igniteui-angular/core/src/core/styles/themes' as *;
2+
3+
@include core();
4+
@include typography(
5+
$font-family: $material-typeface,
6+
$type-scale: $material-type-scale
7+
);
8+
@include theme(
9+
$schema: $dark-material-schema,
10+
$palette: $dark-material-palette,
11+
);

0 commit comments

Comments
 (0)