@@ -101,7 +101,7 @@ export class IgxQueryBuilderDragService {
101101 }
102102
103103 //If entering the one that's been picked up don't do any thing
104- if ( targetExpressionItem == this . dropGhostExpression ) {
104+ if ( targetExpressionItem === this . dropGhostExpression ) {
105105 return ;
106106 }
107107
@@ -164,7 +164,7 @@ export class IgxQueryBuilderDragService {
164164 * @param targetExpressionItem The expressionItem of the drop area chip that's been dragged to
165165 */
166166 public onDivDropped ( targetExpressionItem : ExpressionItem ) {
167- if ( targetExpressionItem != this . _sourceExpressionItem ) {
167+ if ( targetExpressionItem !== this . _sourceExpressionItem ) {
168168 this . onChipDropped ( ) ;
169169 }
170170 }
@@ -293,7 +293,7 @@ export class IgxQueryBuilderDragService {
293293
294294 /** Make a copy of the _sourceExpressionItem's chip and paste it in the tree north or south of the _targetExpressionItem's chip */
295295 private renderDropGhostChip ( appendUnder : boolean ) : void {
296- if ( appendUnder != this . _dropUnder || this . isKeyboardDrag ) {
296+ if ( appendUnder !== this . _dropUnder || this . isKeyboardDrag ) {
297297 this . clearDropGhost ( ) ;
298298
299299 //Copy dragged chip
@@ -321,8 +321,12 @@ export class IgxQueryBuilderDragService {
321321 if ( ! this . isKeyboardDrag && this . getDragGhostElement && ( ! this . _ghostChipMousemoveSubscription$ || this . _ghostChipMousemoveSubscription$ ?. closed === true ) ) {
322322 const mouseMoves = fromEvent < MouseEvent > ( this . getDragGhostElement , 'mousemove' ) ;
323323
324+ //When mouse moves and there is a drop ghost => trigger onChipLeave to check if the drop ghost has to be removed
325+ //effectively solving the case when mouse leaves the QB and a drop ghost is still in place
324326 this . _ghostChipMousemoveSubscription$ = mouseMoves . pipe ( sampleTime ( 100 ) ) . subscribe ( ( ) => {
325- this . onChipLeave ( ) ;
327+ if ( this . getDropGhostElement ) {
328+ this . onChipLeave ( ) ;
329+ }
326330 } ) ;
327331 }
328332
@@ -385,16 +389,16 @@ export class IgxQueryBuilderDragService {
385389 // }))
386390 . pipe ( filter ( event => ! event . repeat ) )
387391 . subscribe ( e => {
388- if ( e . key == 'Escape' ) {
392+ if ( e . key === 'Escape' ) {
389393 //TODO cancel mouse drag once it's implemented in igx-chip draggable
390394 this . resetDragAndDrop ( false ) ;
391395 //Regain focus on the drag icon after keyboard drag cancel
392396 if ( this . isKeyboardDrag ) {
393397 ( this . _sourceElement . firstElementChild . firstElementChild . firstElementChild . firstElementChild as HTMLElement ) . focus ( ) ;
394398 }
395- } else if ( e . key == 'ArrowUp' || e . key == 'ArrowDown' ) {
399+ } else if ( e . key === 'ArrowUp' || e . key = == 'ArrowDown' ) {
396400 this . arrowDrag ( e . key ) ;
397- } else if ( e . key == 'Enter' || e . key == 'Space' ) {
401+ } else if ( e . key === 'Enter' || e . key = == 'Space' ) {
398402 //this.platform.isActivationKey(eventArgs) Maybe use this rather that Enter/Space?
399403 this . onChipDropped ( ) ;
400404 this . _keyboardSubscription$ . unsubscribe ( ) ;
@@ -421,10 +425,10 @@ export class IgxQueryBuilderDragService {
421425 }
422426
423427 let newKeyIndexOffset = this . _keyDragCurrentIndex ;
424- if ( key == 'ArrowUp' ) {
428+ if ( key === 'ArrowUp' ) {
425429 //decrease index capped at top of tree
426430 newKeyIndexOffset && newKeyIndexOffset -- ;
427- } else if ( key == 'ArrowDown' ) {
431+ } else if ( key === 'ArrowDown' ) {
428432 //increase index capped at bottom of tree
429433 newKeyIndexOffset < this . _possibleDropLocations . length - 1 && newKeyIndexOffset ++ ;
430434 } else {
@@ -433,7 +437,7 @@ export class IgxQueryBuilderDragService {
433437 }
434438
435439 //if drop location has no change
436- if ( newKeyIndexOffset != this . _keyDragCurrentIndex || this . _isKeyDragsFirstMove ) {
440+ if ( newKeyIndexOffset !== this . _keyDragCurrentIndex || this . _isKeyDragsFirstMove ) {
437441 this . _keyDragCurrentIndex = newKeyIndexOffset ;
438442
439443 const newDropTarget = this . _possibleDropLocations [ this . _keyDragCurrentIndex ] ;
0 commit comments