Skip to content

Commit ab9dbb3

Browse files
authored
Merge branch '8.2.x' into bpenkov/fix-6494-8.2
2 parents 2604ef8 + e4496af commit ab9dbb3

File tree

7 files changed

+33
-48
lines changed

7 files changed

+33
-48
lines changed

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-search.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ export class IgxExcelStyleSearchComponent implements AfterViewInit {
5454
@Input()
5555
public data: FilterListItem[];
5656

57-
public filteredData: FilterListItem[];
58-
5957
@Input()
6058
public column: IgxColumnComponent;
6159

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-search.pipe.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ import { cloneArray } from '../../../core/utils';
99
name: 'excelStyleSearchFilter'
1010
})
1111
export class IgxExcelStyleSearchFilterPipe implements PipeTransform {
12-
13-
constructor(private esf: IgxGridExcelStyleFilteringComponent) { }
14-
1512
transform(items: FilterListItem[], searchText: string): any[] {
1613
if (!items || !items.length) {
1714
return [];
1815
}
1916

2017
if (!searchText) {
21-
this.esf.excelStyleSearch.filteredData = null;
2218
return items;
2319
}
2420

@@ -27,14 +23,7 @@ export class IgxExcelStyleSearchFilterPipe implements PipeTransform {
2723
(it.value !== null && it.value !== undefined) &&
2824
it.value.toString().toLowerCase().indexOf(searchText) > -1);
2925

30-
// If 'result' contains the 'Select All' item and at least one more, we use it as a 'finalResult',
31-
// otherwise we use an empty array as a 'finalResult' of the filtering.
32-
const finalResult = result.length > 1 ? result : [];
33-
34-
// Update the filteredData of the search component.
35-
this.esf.excelStyleSearch.filteredData = cloneArray(finalResult);
36-
this.esf.cdr.detectChanges();
37-
38-
return finalResult;
26+
// If 'result' contains the 'Select All' item and at least one more - we use it, otherwise we use an empty array.
27+
return result.length > 1 ? result : [];
3928
}
4029
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy, OnInit, A
131131
public customDialog: IgxExcelStyleCustomDialogComponent;
132132

133133
@ViewChild('excelStyleSearch', { read: IgxExcelStyleSearchComponent, static: true })
134-
public excelStyleSearch: IgxExcelStyleSearchComponent;
134+
protected excelStyleSearch: IgxExcelStyleSearchComponent;
135135

136136
@ViewChild('excelStyleSorting', { read: IgxExcelStyleSortingComponent, static: false })
137137
protected excelStyleSorting: IgxExcelStyleSortingComponent;
@@ -171,7 +171,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy, OnInit, A
171171
}
172172
}
173173

174-
constructor(public cdr: ChangeDetectorRef) {}
174+
constructor(private cdr: ChangeDetectorRef) {}
175175

176176
ngOnInit() {
177177
this.isColumnPinnable = this.column.pinnable;
@@ -608,8 +608,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy, OnInit, A
608608
}
609609

610610
get applyButtonDisabled() {
611-
return (this.excelStyleSearch.filteredData && this.excelStyleSearch.filteredData.length === 0) ||
612-
(this.listData[0] && !this.listData[0].isSelected && !this.listData[0].indeterminate);
611+
return this.listData[0] && !this.listData[0].isSelected && !this.listData[0].indeterminate;
613612
}
614613

615614
public applyFilter() {

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

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4403,40 +4403,27 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
44034403
tick(100);
44044404
}));
44054405

4406-
it('Should filter, clear and enable/disable the apply button correctly.', fakeAsync(() => {
4406+
it('Should enable/disable the apply button correctly.', fakeAsync(() => {
44074407
GridFunctions.clickExcelFilterIcon(fix, 'ProductName');
44084408
tick(100);
44094409
fix.detectChanges();
44104410

4411-
// Type string in search box.
4411+
// Verify there are filtered-in results and that apply button is enabled.
44124412
const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix);
4413-
const inputNativeElement = searchComponent.querySelector('.igx-input-group__input');
4414-
sendInputNativeElement(inputNativeElement, 'hello there', fix);
4415-
tick(100);
4416-
fix.detectChanges();
4417-
4418-
// Verify there are no filtered-in results and that apply button is disabled.
4419-
let listItems = searchComponent.querySelectorAll('igx-list-item');
4420-
let excelMenu = GridFunctions.getExcelStyleFilteringComponent(fix);
4421-
let raisedButtons = Array.from(excelMenu.querySelectorAll('.igx-button--raised'));
4413+
const listItems = searchComponent.querySelectorAll('igx-list-item');
4414+
const excelMenu = GridFunctions.getExcelStyleFilteringComponent(fix);
4415+
const raisedButtons = Array.from(excelMenu.querySelectorAll('.igx-button--raised'));
44224416
let applyButton: any = raisedButtons.find((rb: any) => rb.innerText === 'apply');
4423-
expect(listItems.length).toBe(0, 'ESF search result should be empty');
4424-
expect(applyButton.classList.contains('igx-button--disabled')).toBe(true);
4417+
expect(listItems.length).toBe(6, 'ESF search result should NOT be empty');
4418+
expect(applyButton.classList.contains('igx-button--disabled')).toBe(false);
44254419

4426-
// Clear filtering.
4427-
const icons = Array.from(searchComponent.querySelectorAll('igx-icon'));
4428-
const clearIcon: any = icons.find((ic: any) => ic.innerText === 'clear');
4429-
clearIcon.click();
4430-
tick(100);
4420+
// Verify the apply button is disabled when all items are unchecked (when unchecking 'Select All').
4421+
const checkbox = excelMenu.querySelectorAll('.igx-checkbox__input');
4422+
checkbox[0].click(); // Select All
4423+
tick();
44314424
fix.detectChanges();
4432-
4433-
// Verify there are filtered-in results and that apply button is enabled.
4434-
listItems = searchComponent.querySelectorAll('igx-list-item');
4435-
excelMenu = GridFunctions.getExcelStyleFilteringComponent(fix);
4436-
raisedButtons = Array.from(excelMenu.querySelectorAll('.igx-button--raised'));
44374425
applyButton = raisedButtons.find((rb: any) => rb.innerText === 'apply');
4438-
expect(listItems.length).toBe(6, 'ESF search result should NOT be empty');
4439-
expect(applyButton.classList.contains('igx-button--disabled')).toBe(false);
4426+
expect(applyButton.classList.contains('igx-button--disabled')).toBe(true);
44404427
}));
44414428

44424429
it('display density is properly applied on the excel style filtering component', fakeAsync(() => {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
655655
}
656656

657657
private _setGroupColsVisibility(value) {
658-
if (this.columnList && !this.hasColumnLayouts) {
658+
if (this.columnList.length > 0 && !this.hasColumnLayouts) {
659659
this.groupingExpressions.forEach((expr) => {
660660
const col = this.getColumnByName(expr.fieldName);
661661
col.hidden = value;
@@ -916,7 +916,7 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
916916
public ngDoCheck(): void {
917917
if (this.groupingDiffer && this.columnList && !this.hasColumnLayouts) {
918918
const changes = this.groupingDiffer.diff(this.groupingExpressions);
919-
if (changes && this.columnList) {
919+
if (changes && this.columnList.length > 0) {
920920
changes.forEachAddedItem((rec) => {
921921
const col = this.getColumnByName(rec.item.fieldName);
922922
col.hidden = true;

projects/igniteui-angular/src/lib/navigation-drawer/navigation-drawer.component.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,14 @@ describe('Navigation Drawer', () => {
571571
done();
572572
});
573573

574+
it('should retain classes added in markup, fix for #6508', () => {
575+
const fix = TestBed.createComponent(TestComponent);
576+
fix.detectChanges();
577+
578+
expect(fix.componentInstance.navDrawer.element.classList.contains('markupClass')).toBeTruthy();
579+
expect(fix.componentInstance.navDrawer.element.classList.contains('igx-nav-drawer')).toBeTruthy();
580+
});
581+
574582
function swipe(element, posX, posY, duration, deltaX, deltaY) {
575583
const swipeOptions = {
576584
deltaX,
@@ -610,7 +618,7 @@ describe('Navigation Drawer', () => {
610618

611619
@Component({
612620
selector: 'igx-test-cmp',
613-
template: '<igx-nav-drawer></igx-nav-drawer>'
621+
template: '<igx-nav-drawer class="markupClass"></igx-nav-drawer>'
614622
})
615623
class TestComponent {
616624
@ViewChild(IgxNavigationDrawerComponent, { static: true }) public navDrawer: IgxNavigationDrawerComponent;

projects/igniteui-angular/src/lib/navigation-drawer/navigation-drawer.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ export class IgxNavigationDrawerComponent implements
6161
AfterContentInit,
6262
OnDestroy,
6363
OnChanges {
64+
6465
private _isOpen = false;
65-
@HostBinding('class') public cssClass = 'igx-nav-drawer';
66+
67+
/** @hidden @internal */
68+
@HostBinding('class.igx-nav-drawer')
69+
public cssClass = true;
6670

6771
/**
6872
* ID of the component

0 commit comments

Comments
 (0)