Skip to content

Commit 835c6fc

Browse files
committed
feat(overlay): remove grid loading outlet
1 parent c2f3146 commit 835c6fc

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

projects/igniteui-angular/grids/grid/src/grid-base.directive.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,13 +1147,7 @@ export abstract class IgxGridBaseDirective implements GridType,
11471147
* @hidden @internal
11481148
*/
11491149
@ViewChild('loadingOverlay', { read: IgxToggleDirective, static: true })
1150-
public loadingOverlay: IgxToggleDirective;
1151-
1152-
/**
1153-
* @hidden @internal
1154-
*/
1155-
@ViewChild('igxLoadingOverlayOutlet', { static: true })
1156-
public loadingOutlet: ElementRef<HTMLElement>;
1150+
public loadingOverlay?: IgxToggleDirective;
11571151

11581152
/* reactContentChildren */
11591153
/* blazorInclude */
@@ -6731,13 +6725,12 @@ export abstract class IgxGridBaseDirective implements GridType,
67316725
if (this.shouldOverlayLoading) {
67326726
// a new overlay should be shown
67336727
const overlaySettings: OverlaySettings = {
6734-
outlet: this.loadingOutlet,
67356728
closeOnOutsideClick: false,
67366729
positionStrategy: new ContainerPositionStrategy()
67376730
};
6738-
this.loadingOverlay.open(overlaySettings);
6731+
this.loadingOverlay?.open(overlaySettings);
67396732
} else {
6740-
this.loadingOverlay.close();
6733+
this.loadingOverlay?.close();
67416734
}
67426735
}
67436736

projects/igniteui-angular/grids/grid/src/grid.component.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@
160160
<ng-container #bodyViewContainerRef></ng-container>
161161
<igc-trial-watermark></igc-trial-watermark>
162162
</div>
163-
<div igxToggle #loadingOverlay>
164-
@if (shouldOverlayLoading) {
165-
<igx-circular-bar [indeterminate]="true">
166-
</igx-circular-bar>
167-
}
168-
</div>
169163
@if (moving && columnInDrag) {
170164
<span [igxColumnMovingDrop]="headerContainer" [attr.droppable]="true"
171165
id="right" class="igx-grid__scroll-on-drag-right"></span>
@@ -182,7 +176,13 @@
182176
<igx-snackbar #addRowSnackbar [actionText]="resourceStrings.igx_grid_snackbar_addrow_actiontext" [displayTime]="snackbarDisplayTime">{{resourceStrings.igx_grid_snackbar_addrow_label}}</igx-snackbar>
183177
</div>
184178

185-
<div class="igx-grid__loading-outlet" #igxLoadingOverlayOutlet></div>
179+
<div class="igx-grid__loading-outlet">
180+
<div igxToggle>
181+
@if (shouldOverlayLoading) {
182+
<igx-circular-bar [indeterminate]="true"></igx-circular-bar>
183+
}
184+
</div>
185+
</div>
186186
</div>
187187

188188

projects/igniteui-angular/grids/grid/src/grid.component.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ describe('IgxGrid Component Tests #grid', () => {
463463
expect(loadingIndicator.nativeElement.offsetWidth).toBe(gridBody.nativeElement.offsetWidth);
464464
expect(loadingIndicator.nativeElement.offsetHeight).toBe(gridBody.nativeElement.offsetHeight);
465465

466-
expect(loadingIndicator.nativeElement.children.length).not.toBe(0);
466+
expect(loadingIndicator.nativeElement.children.length).not.toBeNull();
467467

468468
// Check for empty filter grid message and body less than 100px
469469
const columns = fixture.componentInstance.grid.columnList;
@@ -490,7 +490,7 @@ describe('IgxGrid Component Tests #grid', () => {
490490
loadingIndicator = gridElement.query(By.css('.igx-grid__loading-outlet'));
491491
expect(loadingIndicator.nativeElement.offsetWidth).toBe(gridBody.nativeElement.offsetWidth);
492492
expect(loadingIndicator.nativeElement.offsetHeight).toBe(gridBody.nativeElement.offsetHeight);
493-
expect(loadingIndicator.nativeElement.children.length).toBe(0);
493+
expect(loadingIndicator.query(By.css('igx-circular-bar'))).toBeNull();
494494
}));
495495

496496
it('should render loading indicator when loading is enabled and autoGenerate is enabled', fakeAsync(() => {
@@ -644,11 +644,12 @@ describe('IgxGrid Component Tests #grid', () => {
644644
const gridBody = fixture.debugElement.query(By.css('.igx-grid__tbody'));
645645
expect(loadingIndicator.nativeElement.offsetWidth).toBe(gridBody.nativeElement.offsetWidth);
646646
expect(loadingIndicator.nativeElement.offsetHeight).toBe(gridBody.nativeElement.offsetHeight);
647-
expect(loadingIndicator.nativeElement.children.length).not.toBe(0);
647+
expect(loadingIndicator.query(By.css('igx-circular-bar'))).not.toBeNull();
648648

649649
grid.isLoading = false;
650650
tick(16);
651-
expect(loadingIndicator.nativeElement.children.length).toBe(0);
651+
fixture.detectChanges();
652+
expect(loadingIndicator.query(By.css('igx-circular-bar'))).toBeNull();
652653

653654
// Clearing grid's data and check for empty grid message
654655
fixture.componentInstance.clearData();

0 commit comments

Comments
 (0)