1
- import { Component , OnInit , OnDestroy , HostBinding , ElementRef } from '@angular/core' ;
1
+ import { Component , OnInit , OnDestroy , HostBinding , ElementRef , NgZone } from '@angular/core' ;
2
2
import { Subject , Observable , of } from 'rxjs' ;
3
3
import { ThySelectionListChange } from '../../list' ;
4
4
import { MentionDefaultDataItem , Mention , MentionSuggestionSelectEvent } from '../interfaces' ;
5
- import { debounceTime , switchMap , catchError } from 'rxjs/operators' ;
5
+ import { debounceTime , switchMap , catchError , take } from 'rxjs/operators' ;
6
6
import { SeekQueryResult } from '../adapter/adapter' ;
7
+ import { ThyPopoverRef } from '../../popover' ;
7
8
8
9
@Component ( {
9
10
selector : 'thy-mention-suggestions' ,
@@ -24,7 +25,11 @@ export class ThyMentionSuggestionsComponent<TItem = MentionDefaultDataItem> impl
24
25
25
26
@HostBinding ( 'class.thy-mention-suggestions' ) suggestionsClass = true ;
26
27
27
- constructor ( public elementRef : ElementRef < HTMLElement > ) {
28
+ constructor (
29
+ public elementRef : ElementRef < HTMLElement > ,
30
+ private ngZone : NgZone ,
31
+ private popoverRef : ThyPopoverRef < any >
32
+ ) {
28
33
this . search$
29
34
. pipe (
30
35
switchMap ( query => {
@@ -44,6 +49,12 @@ export class ThyMentionSuggestionsComponent<TItem = MentionDefaultDataItem> impl
44
49
. subscribe ( data => {
45
50
this . loadingDone = true ;
46
51
this . data = data ;
52
+
53
+ if ( this . popoverRef ) {
54
+ this . ngZone . onStable . pipe ( take ( 1 ) ) . subscribe ( ( ) => {
55
+ this . popoverRef . updatePosition ( ) ;
56
+ } ) ;
57
+ }
47
58
} ) ;
48
59
}
49
60
0 commit comments