import { Injectable } from '@angular/core' ; import { BehaviorSubject } from 'rxjs' ; const UNSET_FOCUS = { groupId : null , index : - 1 } ; @ Injectable ( { providedIn : 'root' } ) export class SearchBuilderFocusService { focus$ = new BehaviorSubject < SearchBuilderFocus > ( UNSET_FOCUS ) ; param groupId param index setFocus ( groupId , index ) { this . focus$ . next ( { groupId , index } ) ; } /**
     * Removes focus from all components. If focus is not on a search builder component, this does nothing.
     */ clearFocus ( ) { this . focus$ . next ( UNSET_FOCUS ) ; } } export interface SearchBuilderFocus { groupId : string ; index : number ; }