Skip to content

Commit 767cadc

Browse files
authored
Merge branch '10.2.x' into simeonoff/dock-mgr-drop-shadow
2 parents bab4325 + 4231dd4 commit 767cadc

File tree

13 files changed

+83
-61
lines changed

13 files changed

+83
-61
lines changed

angular.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
"browserTarget": "igniteui-dev-demos:build:hmr"
9191
},
9292
"es5": {
93+
"hmr": true,
94+
"hmrWarning": false,
9395
"browserTarget": "igniteui-dev-demos:build:es5"
9496
}
9597
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve --open --configuration hmr",
7-
"start-es5": "ng serve --configuration es5 -o",
7+
"start:es5": "ng serve --open --configuration es5",
88
"build": "ng build",
99
"test": "ng test",
1010
"lint": "ng lint",

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-action-button.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ng-container *ngIf="!asMenuItem">
22

33
<ng-container *ngIf="!asMenuItem">
4-
<button igxButton="icon" igxRipple (click)="handleClick($event)">
4+
<button igxButton="icon" igxRipple (click)="handleClick($event)" (mousedown)="preventEvent($event)">
55
<igx-icon *ngIf="iconSet" [fontSet]="iconSet" [name]="iconName">{{iconName}}</igx-icon>
66
<igx-icon *ngIf="!iconSet" >{{iconName}}</igx-icon>
77
</button>
@@ -14,4 +14,4 @@
1414
<label *ngIf='asMenuItem' igxLabel>{{labelText}}</label>
1515
</div>
1616
</ng-container>
17-
</ng-container>
17+
</ng-container>

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-action-button.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,14 @@ export class IgxGridActionButtonComponent {
6969
public handleClick(event) {
7070
this.onActionClick.emit(event);
7171
}
72+
73+
/**
74+
* @hidden @internal
75+
*/
76+
public preventEvent(event) {
77+
if (event) {
78+
event.stopPropagation();
79+
event.preventDefault();
80+
}
81+
}
7282
}

projects/igniteui-angular/src/lib/grids/api.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ export class GridBaseAPIService <T extends IgxGridBaseDirective & GridType> {
471471

472472
public get_all_data(includeTransactions = false): any[] {
473473
const grid = this.grid;
474-
let data = grid.data ? grid.data : [];
474+
let data = grid && grid.data ? grid.data : [];
475475
data = includeTransactions ? grid.dataWithAddedInTransactionRows : data;
476476
return data;
477477
}

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6767,6 +6767,37 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
67676767
return this.transactions.enabled ? this.dataWithAddedInTransactionRows.length : this.gridAPI.get_all_data().length;
67686768
}
67696769

6770+
/**
6771+
* @hidden @internal
6772+
*/
6773+
public get template(): TemplateRef<any> {
6774+
if (this.isLoading && (this.hasZeroResultFilter || this.hasNoData)) {
6775+
return this.loadingGridTemplate ? this.loadingGridTemplate : this.loadingGridDefaultTemplate;
6776+
}
6777+
6778+
if (this.hasZeroResultFilter) {
6779+
return this.emptyGridTemplate ? this.emptyGridTemplate : this.emptyFilteredGridTemplate;
6780+
}
6781+
6782+
if (this.hasNoData) {
6783+
return this.emptyGridTemplate ? this.emptyGridTemplate : this.emptyGridDefaultTemplate;
6784+
}
6785+
}
6786+
6787+
/**
6788+
* @hidden @internal
6789+
*/
6790+
private get hasZeroResultFilter(): boolean {
6791+
return this.filteredData && this.filteredData.length === 0;
6792+
}
6793+
6794+
/**
6795+
* @hidden @internal
6796+
*/
6797+
private get hasNoData(): boolean {
6798+
return !this.data || this.dataLength === 0;
6799+
}
6800+
67706801
/**
67716802
* @hidden @internal
67726803
*/
@@ -6805,7 +6836,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
68056836
* @hidden @internal
68066837
*/
68076838
get shouldOverlayLoading(): boolean {
6808-
return this.isLoading && this.data && this.data.length > 0;
6839+
return this.isLoading && !this.hasNoData && !this.hasZeroResultFilter;
68096840
}
68106841

68116842
/**

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

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { IgxTabsModule, IgxTabsComponent } from '../../tabs/public_api';
2424
import { GridSelectionMode } from '../common/enums';
2525
import { registerLocaleData } from '@angular/common';
2626
import localeDE from '@angular/common/locales/de';
27+
import { FilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree';
28+
import { FilteringLogic } from '../../data-operations/filtering-expression.interface';
2729

2830

2931
describe('IgxGrid Component Tests #grid', () => {
@@ -347,7 +349,7 @@ describe('IgxGrid Component Tests #grid', () => {
347349
grid.filter(columns[0].field, 546000, IgxNumberFilteringOperand.instance().condition('equals'));
348350
fixture.detectChanges();
349351
tick(100);
350-
expect(gridBody.nativeElement.textContent).toEqual(grid.emptyFilteredGridMessage);
352+
expect(gridBody.nativeElement.textContent).not.toEqual(grid.emptyFilteredGridMessage);
351353
expect(parseInt(window.getComputedStyle(gridBody.nativeElement).height, 10)).toBe(548);
352354

353355
// Clear filter and check if grid's body height is restored based on all loaded rows
@@ -399,7 +401,7 @@ describe('IgxGrid Component Tests #grid', () => {
399401
grid.filter(columns[0].field, 546000, IgxNumberFilteringOperand.instance().condition('equals'));
400402
fixture.detectChanges();
401403
tick(100);
402-
expect(gridBody.nativeElement.textContent).toEqual(grid.emptyFilteredGridMessage);
404+
expect(gridBody.nativeElement.textContent).not.toEqual(grid.emptyFilteredGridMessage);
403405

404406
// Clear filter and check if grid's body height is restored based on all loaded rows
405407
grid.clearFilter(columns[0].field);
@@ -483,6 +485,33 @@ describe('IgxGrid Component Tests #grid', () => {
483485
expect(parseInt(window.getComputedStyle(gridBody.nativeElement).height, 10)).toBeGreaterThan(500);
484486
}));
485487

488+
it('should render loading indicator when loading is enabled and the grid has empty filtering pre-applied', fakeAsync(() => {
489+
const fixture = TestBed.createComponent(IgxGridTestComponent);
490+
const grid = fixture.componentInstance.grid;
491+
grid.filteringExpressionsTree = new FilteringExpressionsTree(FilteringLogic.And);
492+
grid.filteringExpressionsTree.filteringOperands = [
493+
{
494+
condition: IgxNumberFilteringOperand.instance().condition('equals'),
495+
fieldName: 'index',
496+
searchVal: 0
497+
}
498+
];
499+
grid.isLoading = true;
500+
fixture.detectChanges();
501+
tick(16);
502+
503+
const gridBody = fixture.debugElement.query(By.css(TBODY_CLASS));
504+
const loadingIndicator = gridBody.query(By.css('.igx-grid__loading'));
505+
const domGrid = fixture.debugElement.query(By.css('igx-grid')).nativeElement;
506+
507+
// make sure default width/height are applied when there is no data
508+
expect(domGrid.style.height).toBe('100%');
509+
expect(domGrid.style.width).toBe('100%');
510+
511+
expect(loadingIndicator).not.toBeNull();
512+
expect(gridBody.nativeElement.textContent).not.toEqual(grid.emptyFilteredGridMessage);
513+
}));
514+
486515
it('should allow applying custom loading indicator', fakeAsync(() => {
487516
const fixture = TestBed.createComponent(IgxGridRemoteOnDemandComponent);
488517
fixture.componentInstance.instance.loadingGridTemplate = fixture.componentInstance.customTemaplate;

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -828,24 +828,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
828828
}
829829
}
830830

831-
832-
/**
833-
* @hidden @internal
834-
*/
835-
public get template(): TemplateRef<any> {
836-
if (this.filteredData && this.filteredData.length === 0) {
837-
return this.emptyGridTemplate ? this.emptyGridTemplate : this.emptyFilteredGridTemplate;
838-
}
839-
840-
if (this.isLoading && (!this.data || this.dataLength === 0)) {
841-
return this.loadingGridTemplate ? this.loadingGridTemplate : this.loadingGridDefaultTemplate;
842-
}
843-
844-
if (this.dataLength === 0) {
845-
return this.emptyGridTemplate ? this.emptyGridTemplate : this.emptyGridDefaultTemplate;
846-
}
847-
}
848-
849831
/**
850832
* @hidden @internal
851833
*/

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.component.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -485,23 +485,6 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
485485
});
486486
}
487487

488-
/**
489-
* @hidden
490-
*/
491-
public get template(): TemplateRef<any> {
492-
if (this.filteredData && this.filteredData.length === 0) {
493-
return this.emptyGridTemplate ? this.emptyGridTemplate : this.emptyFilteredGridTemplate;
494-
}
495-
496-
if (this.isLoading && (!this.data || this.dataLength === 0)) {
497-
return this.loadingGridTemplate ? this.loadingGridTemplate : this.loadingGridDefaultTemplate;
498-
}
499-
500-
if (this.dataLength === 0) {
501-
return this.emptyGridTemplate ? this.emptyGridTemplate : this.emptyGridDefaultTemplate;
502-
}
503-
}
504-
505488
/**
506489
* @hidden
507490
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class IgxRowDirective<T extends IgxGridBaseDirective & GridType> implemen
113113
}
114114

115115
get cellHeight() {
116-
return this.addRow ? null : this.grid.rowHeight || 32;
116+
return this.addRow && !this.inEditMode ? null : this.grid.rowHeight || 32;
117117
}
118118

119119
/**

0 commit comments

Comments
 (0)