99 Output
1010} from '@angular/core' ;
1111import { IconType } from '@hypertrace/assets-library' ;
12- import { SubscriptionLifecycle , TypedSimpleChanges } from '@hypertrace/common' ;
13- import { Subject } from 'rxjs' ;
14- import { debounceTime } from 'rxjs/operators' ;
12+ import { TypedSimpleChanges } from '@hypertrace/common' ;
1513import { IconSize } from '../../icon/icon-size' ;
1614import { MultiSelectJustify } from '../../multi-select/multi-select-justify' ;
1715import { MultiSelectSearchMode , TriggerLabelDisplayMode } from '../../multi-select/multi-select.component' ;
@@ -27,7 +25,6 @@ import {
2725@Component ( {
2826 selector : 'ht-table-controls' ,
2927 styleUrls : [ './table-controls.component.scss' ] ,
30- providers : [ SubscriptionLifecycle ] ,
3128 changeDetection : ChangeDetectionStrategy . OnPush ,
3229 template : `
3330 <div class="table-controls" *ngIf="this.anyControlsEnabled">
@@ -38,6 +35,7 @@ import {
3835 *ngIf="this.searchEnabled"
3936 class="control search-box"
4037 [placeholder]="this.searchPlaceholder || this.DEFAULT_SEARCH_PLACEHOLDER"
38+ [debounceTime]="400"
4139 (valueChange)="this.onSearchChange($event)"
4240 ></ht-search-box>
4341
@@ -152,17 +150,8 @@ export class TableControlsComponent implements OnChanges {
152150 return ! ! this . searchEnabled || this . viewToggleEnabled || this . selectControlsEnabled || this . checkboxControlsEnabled ;
153151 }
154152
155- private readonly searchDebounceSubject : Subject < string > = new Subject < string > ( ) ;
156-
157- public constructor (
158- private readonly subscriptionLifecycle : SubscriptionLifecycle ,
159- private readonly differFactory : IterableDiffers
160- ) {
153+ public constructor ( private readonly differFactory : IterableDiffers ) {
161154 this . checkboxDiffer = this . differFactory . find ( [ ] ) . create ( ) ;
162-
163- this . subscriptionLifecycle . add (
164- this . searchDebounceSubject . pipe ( debounceTime ( 400 ) ) . subscribe ( text => this . searchChange . emit ( text ) )
165- ) ;
166155 }
167156
168157 public ngOnChanges ( changes : TypedSimpleChanges < this> ) : void {
@@ -208,7 +197,7 @@ export class TableControlsComponent implements OnChanges {
208197 }
209198
210199 public onSearchChange ( text : string ) : void {
211- this . searchDebounceSubject . next ( text ) ;
200+ this . searchChange . emit ( text ) ;
212201 }
213202
214203 public onMultiSelectChange ( select : TableSelectControl , selections : TableSelectControlOption [ ] ) : void {
0 commit comments