Skip to content

Commit 54cf03d

Browse files
Merge branch '8.2.x' into lastPage-equalTo-totalPages-82x
2 parents e8102a2 + 7c70376 commit 54cf03d

File tree

3 files changed

+84
-62
lines changed

3 files changed

+84
-62
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,14 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
462462
this.expressionsList[0].expression.searchVal === null &&
463463
this.expressionsList[0].expression.condition.isUnary === false) {
464464
this.filteringService.getExpressions(this.column.field).pop();
465+
466+
this.filter();
465467
} else {
466-
this.expressionsList.forEach((item) => {
467-
if (item.expression.searchVal === null && !item.expression.condition.isUnary) {
468-
this.filteringService.removeExpression(this.column.field, this.expressionsList.indexOf(item));
469-
}
470-
});
468+
const condToRemove = this.expressionsList.filter(ex => ex.expression.searchVal === null && !ex.expression.condition.isUnary);
469+
if (condToRemove && condToRemove.length > 0) {
470+
condToRemove.forEach(c => this.filteringService.removeExpression(this.column.field, this.expressionsList.indexOf(c)));
471+
this.filter();
472+
}
471473
}
472474

473475
this.filteringService.isFilterRowVisible = false;
@@ -654,7 +656,8 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
654656

655657
// TODO: revise the cdr.detectChanges() usage here
656658
if (!(this.cdr as ViewRef).destroyed) {
657-
this.cdr.detectChanges(); }
659+
this.cdr.detectChanges();
660+
}
658661
}
659662
});
660663
}

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

Lines changed: 56 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,7 +3312,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
33123312
await wait(100);
33133313
}));
33143314

3315-
it('should scroll correct chip in view when one is deleted', async() => {
3315+
it('should scroll correct chip in view when one is deleted', async () => {
33163316
grid.width = '700px';
33173317
fix.detectChanges();
33183318

@@ -3400,11 +3400,10 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
34003400
GridFunctions.verifyColumnIsHidden(prodNameCol, true, 5);
34013401
}));
34023402

3403-
it('Unary conditions should be committable', fakeAsync (() => {
3403+
it('Unary conditions should be committable', fakeAsync(() => {
34043404
grid.height = '700px';
34053405
fix.detectChanges();
34063406

3407-
const prodNameCol = grid.columns.find((col) => col.field === 'ProductName');
34083407
GridFunctions.clickFilterCellChip(fix, 'ProductName');
34093408
fix.detectChanges();
34103409

@@ -3429,36 +3428,53 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
34293428
fix.detectChanges();
34303429
tick(100);
34313430
expect(chip.componentInstance.selected).toBeTruthy();
3432-
}));
3431+
}));
34333432

3434-
it('Should close filterRow when changing filterMode from \'quickFilter\' to \'excelStyleFilter\'', (async () => {
3435-
GridFunctions.clickFilterCellChip(fix, 'ProductName');
3436-
fix.detectChanges();
3433+
it('Should close filterRow when changing filterMode from \'quickFilter\' to \'excelStyleFilter\'', (async () => {
3434+
GridFunctions.clickFilterCellChip(fix, 'ProductName');
3435+
fix.detectChanges();
34373436

3438-
// Add a condition chip without submitting it.
3439-
GridFunctions.typeValueInFilterRowInput('a', fix);
3440-
await wait(16);
3437+
// Add a condition chip without submitting it.
3438+
GridFunctions.typeValueInFilterRowInput('a', fix);
3439+
await wait(16);
34413440

3442-
// Change filterMode to 'excelStyleFilter`
3443-
grid.filterMode = FilterMode.excelStyleFilter;
3444-
fix.detectChanges();
3441+
// Change filterMode to 'excelStyleFilter`
3442+
grid.filterMode = FilterMode.excelStyleFilter;
3443+
fix.detectChanges();
34453444

3446-
// Verify the the filterRow is closed.
3447-
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
3448-
expect(filterUIRow).toBeNull('filterRow is visible');
3449-
3450-
// Verify the ESF icons are visible.
3451-
const gridNativeElement = fix.debugElement.query(By.css('igx-grid')).nativeElement;
3452-
const thead = gridNativeElement.querySelector('.igx-grid__thead-wrapper');
3453-
const filterIcons = thead.querySelectorAll('.igx-excel-filter__icon');
3454-
expect(filterIcons.length).toEqual(4, 'incorrect esf filter icons count');
3455-
3456-
// Verify the condition was submitted.
3457-
const header = GridFunctions.getColumnHeader('ProductName', fix);
3458-
const activeFilterIcon = header.nativeElement.querySelector('.igx-excel-filter__icon--filtered');
3459-
expect(activeFilterIcon).toBeDefined('no active filter icon was found');
3460-
}));
3461-
});
3445+
// Verify the the filterRow is closed.
3446+
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
3447+
expect(filterUIRow).toBeNull('filterRow is visible');
3448+
3449+
// Verify the ESF icons are visible.
3450+
const gridNativeElement = fix.debugElement.query(By.css('igx-grid')).nativeElement;
3451+
const thead = gridNativeElement.querySelector('.igx-grid__thead-wrapper');
3452+
const filterIcons = thead.querySelectorAll('.igx-excel-filter__icon');
3453+
expect(filterIcons.length).toEqual(4, 'incorrect esf filter icons count');
3454+
3455+
// Verify the condition was submitted.
3456+
const header = GridFunctions.getColumnHeader('ProductName', fix);
3457+
const activeFilterIcon = header.nativeElement.querySelector('.igx-excel-filter__icon--filtered');
3458+
expect(activeFilterIcon).toBeDefined('no active filter icon was found');
3459+
}));
3460+
3461+
it('Should clear non-unary conditions with null searchVal when close', fakeAsync(() => {
3462+
GridFunctions.clickFilterCellChip(fix, 'ProductName');
3463+
fix.detectChanges();
3464+
3465+
GridFunctions.openFilterDD(fix.debugElement);
3466+
const dropdownList = fix.debugElement.query(By.css('div.igx-drop-down__list.igx-toggle'));
3467+
GridFunctions.selectFilteringCondition('Empty', dropdownList);
3468+
fix.detectChanges();
3469+
GridFunctions.openFilterDD(fix.debugElement);
3470+
GridFunctions.selectFilteringCondition('Contains', dropdownList);
3471+
fix.detectChanges();
3472+
GridFunctions.closeFilterRow(fix);
3473+
3474+
const headerChip = GridFunctions.getFilterChipsForColumn('ProductName', fix);
3475+
expect(headerChip.length).toBe(1);
3476+
}));
3477+
});
34623478
describe(null, () => {
34633479
let fix, grid;
34643480
beforeEach(fakeAsync(() => {
@@ -5887,11 +5903,11 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
58875903
}));
58885904

58895905
it('Should be able to set custom filtering strategy', () => {
5890-
expect(grid.filterStrategy).toBeUndefined();
5891-
grid.filterStrategy = fix.componentInstance.strategy;
5892-
fix.detectChanges();
5906+
expect(grid.filterStrategy).toBeUndefined();
5907+
grid.filterStrategy = fix.componentInstance.strategy;
5908+
fix.detectChanges();
58935909

5894-
expect(grid.filterStrategy).toEqual(fix.componentInstance.strategy);
5910+
expect(grid.filterStrategy).toEqual(fix.componentInstance.strategy);
58955911
});
58965912

58975913
it('Should be able to override getFieldValue method', fakeAsync(() => {
@@ -5933,8 +5949,8 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
59335949
fix.detectChanges();
59345950

59355951
expect(grid.filteredData).toEqual([
5936-
{ ID: 2, Name: { FirstName: 'Gilberto', LastName: 'Todd' } , JobTitle: 'Director', Company: 'Company C' },
5937-
{ ID: 3, Name: { FirstName: 'Tanya', LastName: 'Bennett' } , JobTitle: 'Director', Company: 'Company A' }]);
5952+
{ ID: 2, Name: { FirstName: 'Gilberto', LastName: 'Todd' }, JobTitle: 'Director', Company: 'Company C' },
5953+
{ ID: 3, Name: { FirstName: 'Tanya', LastName: 'Bennett' }, JobTitle: 'Director', Company: 'Company A' }]);
59385954
GridFunctions.resetFilterRow(fix);
59395955
GridFunctions.closeFilterRow(fix);
59405956
fix.detectChanges();
@@ -5961,8 +5977,10 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
59615977
fix.detectChanges();
59625978

59635979
expect(grid.filteredData).toEqual([
5964-
{ ID: 7, Name: { FirstName: 'Debra', LastName: 'Morton' } ,
5965-
JobTitle: 'Associate Software Developer', Company: 'Company B' },
5980+
{
5981+
ID: 7, Name: { FirstName: 'Debra', LastName: 'Morton' },
5982+
JobTitle: 'Associate Software Developer', Company: 'Company B'
5983+
},
59665984
{ ID: 10, Name: { FirstName: 'Eduardo', LastName: 'Ramirez' }, JobTitle: 'Manager', Company: 'Company E' }]);
59675985
}));
59685986
});
@@ -6478,7 +6496,7 @@ function clickElemAndBlur(clickElem, blurElem) {
64786496
UIInteractions.simulatePointerEvent('pointerdown', clickElem.nativeElement, elementRect.left, elementRect.top);
64796497
blurElem.nativeElement.blur();
64806498
(clickElem as DebugElement).nativeElement.focus();
6481-
blurElem.nativeElement.dispatchEvent(new FocusEvent('focusout', {bubbles: true}));
6499+
blurElem.nativeElement.dispatchEvent(new FocusEvent('focusout', { bubbles: true }));
64826500
UIInteractions.simulatePointerEvent('pointerup', clickElem.nativeElement, elementRect.left, elementRect.top);
64836501
UIInteractions.simulateMouseEvent('click', clickElem.nativeElement, 10, 10);
64846502
}

projects/igniteui-angular/src/lib/select/select.component.html

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
<igx-input-group #inputGroup class="input-group" [disabled]="disabled" (click)="toggle()" [type]="type" [displayDensity]="displayDensity">
1+
<igx-input-group #inputGroup class="input-group" (click)="toggle()" [type]="type" [displayDensity]="displayDensity">
22
<ng-container ngProjectAs="[igxLabel]">
33
<ng-content select="[igxLabel]"></ng-content>
44
</ng-container>
55
<ng-container ngProjectAs="igx-prefix">
66
<ng-content select="igx-prefix,[igxPrefix]"></ng-content>
77
</ng-container>
8-
<input #input class="input" type="text" igxInput [igxSelectItemNavigation]="this"
9-
readonly="true"
10-
[attr.placeholder]="this.placeholder"
11-
[value]="this.selectionValue"
12-
role="combobox"
13-
aria-haspopup="listbox"
14-
[attr.aria-labelledby]="this.label ? this.label.id : ''"
15-
[attr.aria-expanded]="!this.collapsed"
16-
[attr.aria-owns]="this.listId"
17-
[attr.aria-activedescendant]="!this.collapsed ? this.focusedItem?.id : null"
18-
(blur)="onBlur()"
19-
(focus)="onFocus()"
20-
/>
21-
<ng-container ngProjectAs="igx-suffix">
22-
<ng-content select="igx-suffix,[igxSuffix]"></ng-content>
23-
</ng-container>
24-
<igx-suffix>
8+
<input #input class="input" type="text" igxInput [igxSelectItemNavigation]="this"
9+
[disabled]="disabled"
10+
readonly="true"
11+
[attr.placeholder]="this.placeholder"
12+
[value]="this.selectionValue"
13+
role="combobox"
14+
aria-haspopup="listbox"
15+
[attr.aria-labelledby]="this.label ? this.label.id : ''"
16+
[attr.aria-expanded]="!this.collapsed"
17+
[attr.aria-owns]="this.listId"
18+
[attr.aria-activedescendant]="!this.collapsed ? this.focusedItem?.id : null"
19+
(blur)="onBlur()"
20+
(focus)="onFocus()"
21+
/>
22+
<ng-container ngProjectAs="igx-suffix">
23+
<ng-content select="igx-suffix,[igxSuffix]"></ng-content>
24+
</ng-container>
25+
<igx-suffix>
2526
<ng-container *ngIf="toggleIconTemplate">
2627
<ng-container *ngTemplateOutlet="toggleIconTemplate; context: {$implicit: this.collapsed}"></ng-container>
2728
</ng-container>

0 commit comments

Comments
 (0)