[ACA-3506] - Fixed refresh for filters on ADF (#5993)

* Fixed refresh for filters on ADF

* Update search-widget-container.component.ts

Co-authored-by: Vito Albano <vitoalbano@Vitos-MacBook-Pro.local>
Co-authored-by: Eugenio Romano <eromano@users.noreply.github.com>
This commit is contained in:
Vito
2020-08-13 23:30:49 +01:00
committed by GitHub
parent 5f5867370c
commit 04b6d841d1

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, ViewChild, ViewContainerRef, OnInit, OnDestroy, ComponentRef, ComponentFactoryResolver, Inject } from '@angular/core';
import { Component, Input, ViewChild, ViewContainerRef, OnInit, OnDestroy, ComponentRef, ComponentFactoryResolver, Inject, SimpleChanges, OnChanges } from '@angular/core';
import { SearchFilterService } from '../search-filter/search-filter.service';
import { BaseQueryBuilderService } from '../../base-query-builder.service';
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../search-query-service.token';
@@ -24,7 +24,7 @@ import { SEARCH_QUERY_SERVICE_TOKEN } from '../../search-query-service.token';
selector: 'adf-search-widget-container',
template: '<div #content></div>'
})
export class SearchWidgetContainerComponent implements OnInit, OnDestroy {
export class SearchWidgetContainerComponent implements OnInit, OnDestroy, OnChanges {
@ViewChild('content', { read: ViewContainerRef, static: true })
content: ViewContainerRef;
@@ -64,6 +64,13 @@ export class SearchWidgetContainerComponent implements OnInit, OnDestroy {
}
}
ngOnChanges(changes: SimpleChanges) {
if (changes['value']?.currentValue && this.componentRef?.instance) {
this.componentRef.instance.isActive = true;
this.componentRef.instance.setValue(changes['value'].currentValue);
}
}
private setupWidget(ref: ComponentRef<any>) {
if (ref && ref.instance) {
ref.instance.id = this.id;