|
1 | 1 | import { CdkConnectedOverlay } from '@angular/cdk/overlay'; |
2 | | -import { AfterContentInit, Directive, Inject, OnDestroy, Optional } from '@angular/core'; |
| 2 | +import { AfterContentInit, Directive, EventEmitter, Inject, OnDestroy, Optional } from '@angular/core'; |
3 | 3 | import { END, ESCAPE, HOME, SPACE } from '@koobiq/cdk/keycodes'; |
4 | 4 | import { Subscription } from 'rxjs'; |
5 | 5 | import { KBQ_FORM_FIELD_REF, KbqFormFieldRef } from '../form-field'; |
@@ -33,14 +33,16 @@ export class KbqSelectFooter {} |
33 | 33 | } |
34 | 34 | }) |
35 | 35 | export class KbqSelectSearch implements AfterContentInit, OnDestroy { |
36 | | - searchChangesSubscription: Subscription = new Subscription(); |
| 36 | + readonly changes: EventEmitter<string> = new EventEmitter<string>(); |
37 | 37 |
|
38 | 38 | isSearchChanged: boolean = false; |
39 | 39 |
|
40 | 40 | get ngControl() { |
41 | 41 | return this.formField.control.ngControl; |
42 | 42 | } |
43 | 43 |
|
| 44 | + private searchChangesSubscription: Subscription = new Subscription(); |
| 45 | + |
44 | 46 | constructor(@Optional() @Inject(KBQ_FORM_FIELD_REF) protected formField: KbqFormFieldRef) { |
45 | 47 | formField.canCleanerClearByEsc = false; |
46 | 48 | } |
@@ -75,8 +77,9 @@ export class KbqSelectSearch implements AfterContentInit, OnDestroy { |
75 | 77 | } |
76 | 78 |
|
77 | 79 | Promise.resolve().then(() => { |
78 | | - this.searchChangesSubscription = this.ngControl.valueChanges!.subscribe(() => { |
| 80 | + this.searchChangesSubscription = this.ngControl.valueChanges!.subscribe((value) => { |
79 | 81 | this.isSearchChanged = true; |
| 82 | + this.changes.next(value); |
80 | 83 | }); |
81 | 84 | }); |
82 | 85 | } |
|
0 commit comments