Skip to content

Commit 0eac718

Browse files
authored
Merge branch 'master' into mkirova/fix-7315
2 parents 311c753 + e9abe7a commit 0eac718

File tree

4 files changed

+55
-16
lines changed

4 files changed

+55
-16
lines changed

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ describe('igxCombo', () => {
750750
scrollIndex += 10;
751751
if (scrollIndex < combo.data.length) {
752752
combo.virtualScrollContainer.scrollTo(scrollIndex);
753-
combo.virtualScrollContainer.onChunkLoad.pipe(take(1)).subscribe(() => {
753+
combo.virtualScrollContainer.onChunkLoad.pipe(take(1)).subscribe(async() => {
754+
await wait(30);
754755
checkGroupedItemsClass();
755756
});
756757
} else {

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -734,13 +734,8 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
734734
if (!parseInt(this.scrollComponent.nativeElement.style.height, 10)) {
735735
return;
736736
}
737-
738-
const containerSize = parseInt(this.igxForContainerSize, 10);
739-
const maxRealScrollTop = event.target.children[0].scrollHeight - containerSize;
740-
const realPercentScrolled = maxRealScrollTop !== 0 ? event.target.scrollTop / maxRealScrollTop : 0;
741737
if (!this._bScrollInternal) {
742-
const maxVirtScrollTop = this._virtHeight - containerSize;
743-
this._virtScrollTop = realPercentScrolled * maxVirtScrollTop;
738+
this._calcVirtualScrollTop(event.target.scrollTop);
744739
} else {
745740
this._bScrollInternal = false;
746741
}
@@ -1340,11 +1335,25 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
13401335
}
13411336
private _updateVScrollOffset() {
13421337
let scrollOffset = 0;
1338+
let currentScrollTop = this.scrollPosition;
1339+
if (this._virtHeightRatio !== 1) {
1340+
this._calcVirtualScrollTop(this.scrollPosition);
1341+
currentScrollTop = this._virtScrollTop;
1342+
}
13431343
const vScroll = this.scrollComponent.nativeElement;
13441344
scrollOffset = vScroll && this.scrollComponent.size ?
1345-
this.scrollPosition - this.sizesCache[this.state.startIndex] : 0;
1345+
currentScrollTop - this.sizesCache[this.state.startIndex] : 0;
13461346
this.dc.instance._viewContainer.element.nativeElement.style.top = -(scrollOffset) + 'px';
13471347
}
1348+
1349+
protected _calcVirtualScrollTop(scrollTop: number) {
1350+
const containerSize = parseInt(this.igxForContainerSize, 10);
1351+
const maxRealScrollTop = this.scrollComponent.size - containerSize;
1352+
const realPercentScrolled = maxRealScrollTop !== 0 ? scrollTop / maxRealScrollTop : 0;
1353+
const maxVirtScrollTop = this._virtHeight - containerSize;
1354+
this._virtScrollTop = realPercentScrolled * maxVirtScrollTop;
1355+
}
1356+
13481357
private _updateHScrollOffset() {
13491358
let scrollOffset = 0;
13501359
scrollOffset = this.scrollComponent.nativeElement &&
@@ -1615,13 +1624,8 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
16151624
if (!parseInt(this.scrollComponent.nativeElement.style.height, 10)) {
16161625
return;
16171626
}
1618-
1619-
const containerSize = parseInt(this.igxForContainerSize, 10);
1620-
const maxRealScrollTop = event.target.children[0].scrollHeight - containerSize;
1621-
const realPercentScrolled = maxRealScrollTop !== 0 ? event.target.scrollTop / maxRealScrollTop : 0;
16221627
if (!this._bScrollInternal) {
1623-
const maxVirtScrollTop = this._virtHeight - containerSize;
1624-
this._virtScrollTop = realPercentScrolled * maxVirtScrollTop;
1628+
this._calcVirtualScrollTop(event.target.scrollTop);
16251629
} else {
16261630
this._bScrollInternal = false;
16271631
}

projects/igniteui-angular/src/lib/grids/filtering/advanced-filtering/advanced-filtering-dialog.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,11 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
797797
*/
798798
public onKeyDown(eventArgs: KeyboardEvent) {
799799
eventArgs.stopPropagation();
800-
if (!this.contextMenuToggle.collapsed &&
801-
(eventArgs.key === KEYS.ESCAPE || eventArgs.key === KEYS.ESCAPE_IE)) {
800+
const key = eventArgs.key;
801+
if (!this.contextMenuToggle.collapsed && (key === KEYS.ESCAPE || key === KEYS.ESCAPE_IE)) {
802802
this.clearSelection();
803+
} else if (key === KEYS.ESCAPE || key === KEYS.ESCAPE_IE) {
804+
this.closeDialog();
803805
}
804806
}
805807

@@ -1072,6 +1074,9 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
10721074
if (this._overlayComponentId) {
10731075
this._overlayService.hide(this._overlayComponentId);
10741076
}
1077+
if (this.grid.navigation.activeNode && this.grid.navigation.activeNode.row === -1) {
1078+
(this.grid as any).theadRow.nativeElement.focus();
1079+
}
10751080
}
10761081

10771082
/**

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,35 @@ describe('IgxGrid - Headers Keyboard navigation #grid', () => {
421421
expect(GridFunctions.getAdvancedFilteringComponent(fix)).not.toBeNull();
422422
});
423423

424+
it('Advanced Filtering: Should be able to close Advanced filtering with "escape"', fakeAsync(() => {
425+
// Enable Advanced Filtering
426+
grid.allowAdvancedFiltering = true;
427+
fix.detectChanges();
428+
let header = GridFunctions.getColumnHeader('Name', fix);
429+
UIInteractions.simulateClickAndSelectEvent(header);
430+
fix.detectChanges();
431+
432+
// Verify first header is focused
433+
GridFunctions.verifyHeaderIsFocused(header.parent);
434+
435+
UIInteractions.triggerEventHandlerKeyDown('L', gridHeader, true);
436+
fix.detectChanges();
437+
438+
// Verify AF dialog is opened.
439+
expect(GridFunctions.getAdvancedFilteringComponent(fix)).not.toBeNull();
440+
441+
const afDialog = fix.nativeElement.querySelector('.igx-advanced-filter');
442+
UIInteractions.triggerKeyDownEvtUponElem('Escape', afDialog);
443+
tick(DEBOUNCETIME);
444+
fix.detectChanges();
445+
446+
// Verify AF dialog is closed.
447+
header = GridFunctions.getColumnHeader('Name', fix);
448+
expect(GridFunctions.getAdvancedFilteringComponent(fix)).toBeNull();
449+
GridFunctions.verifyHeaderIsFocused(header.parent);
450+
}));
451+
452+
424453
it('Column selection: Should be able to select columns when columnSelection is multi', () => {
425454
const columnID = grid.getColumnByName('ID');
426455
const columnParentID = grid.getColumnByName('ParentID');

0 commit comments

Comments
 (0)