99 ElementRef ,
1010 EventEmitter ,
1111 HostBinding ,
12- HostListener ,
1312 Inject ,
1413 Input ,
1514 IterableChangeRecord ,
@@ -32,7 +31,7 @@ import {
3231} from '@angular/core' ;
3332import ResizeObserver from 'resize-observer-polyfill' ;
3433import 'igniteui-trial-watermark' ;
35- import { Subject , pipe } from 'rxjs' ;
34+ import { Subject , pipe , fromEvent } from 'rxjs' ;
3635import { takeUntil , first , filter , throttleTime , map } from 'rxjs/operators' ;
3736import { cloneArray , flatten , mergeObjects , isIE , compareMaps } from '../core/utils' ;
3837import { DataType } from '../data-operations/data-util' ;
@@ -2815,15 +2814,6 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28152814 return this . _pinnedRecordIDs . length ;
28162815 }
28172816
2818- @HostListener ( 'focusout' , [ '$event' ] )
2819- public blur ( event ) {
2820- if ( ! this . crudService . cell && ( event . target === this . tbody . nativeElement &&
2821- this . navigation . activeNode . row >= 0 && this . navigation . activeNode . row < this . dataView . length )
2822- || ( event . target === this . theadRow . nativeElement && this . navigation . activeNode . row === - 1 )
2823- || ( event . target === this . tfoot . nativeElement && this . navigation . activeNode . row === this . dataView . length ) ) {
2824- this . navigation . activeNode = { } as IActiveNode ;
2825- }
2826- }
28272817
28282818 constructor (
28292819 public selectionService : IgxGridSelectionService ,
@@ -2858,6 +2848,14 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
28582848
28592849 _setupListeners ( ) {
28602850 const destructor = takeUntil < any > ( this . destroy$ ) ;
2851+ fromEvent ( this . nativeElement , 'focusout' ) . pipe ( filter ( ( ) => ! ! this . navigation . activeNode ) , destructor ) . subscribe ( ( event ) => {
2852+ if ( ! this . crudService . cell && ! ! this . navigation . activeNode && ( event . target === this . tbody . nativeElement &&
2853+ this . navigation . activeNode . row >= 0 && this . navigation . activeNode . row < this . dataView . length )
2854+ || ( event . target === this . theadRow . nativeElement && this . navigation . activeNode . row === - 1 )
2855+ || ( event . target === this . tfoot . nativeElement && this . navigation . activeNode . row === this . dataView . length ) ) {
2856+ this . navigation . activeNode = { } as IActiveNode ;
2857+ }
2858+ } ) ;
28612859 this . onRowAdded . pipe ( destructor ) . subscribe ( args => this . refreshGridState ( args ) ) ;
28622860 this . onRowDeleted . pipe ( destructor ) . subscribe ( args => {
28632861 this . summaryService . deleteOperation = true ;
0 commit comments