Skip to content

Commit 2ba8b5d

Browse files
authored
Merge branch '8.2.x' into vmihalkov/fix-6593-8.2.x
2 parents 1272c95 + 5a784a1 commit 2ba8b5d

File tree

4 files changed

+17
-44
lines changed

4 files changed

+17
-44
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(() => {

0 commit comments

Comments
 (0)