|
|
|
@ -15,7 +15,7 @@ |
|
|
|
///
|
|
|
|
|
|
|
|
import { AfterViewInit, Component, ElementRef, Inject, OnDestroy, OnInit, ViewChild } from '@angular/core'; |
|
|
|
import { startWith, skip, Subject } from 'rxjs'; |
|
|
|
import { skip, startWith, Subject } from 'rxjs'; |
|
|
|
import { Store } from '@ngrx/store'; |
|
|
|
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; |
|
|
|
|
|
|
|
@ -32,6 +32,8 @@ import { instanceOfSearchableComponent, ISearchableComponent } from '@home/model |
|
|
|
import { ActiveComponentService } from '@core/services/active-component.service'; |
|
|
|
import { RouterTabsComponent } from '@home/components/router-tabs.component'; |
|
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
|
import { isDefined, isDefinedAndNotNull } from '@core/utils'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'tb-home', |
|
|
|
@ -70,8 +72,8 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni |
|
|
|
constructor(protected store: Store<AppState>, |
|
|
|
@Inject(WINDOW) private window: Window, |
|
|
|
private activeComponentService: ActiveComponentService, |
|
|
|
public breakpointObserver: BreakpointObserver, |
|
|
|
private fb: FormBuilder) { |
|
|
|
private fb: FormBuilder, |
|
|
|
public breakpointObserver: BreakpointObserver) { |
|
|
|
super(store); |
|
|
|
} |
|
|
|
|
|
|
|
@ -144,9 +146,18 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni |
|
|
|
|
|
|
|
private updateActiveComponent(activeComponent: any) { |
|
|
|
this.showSearch = false; |
|
|
|
this.hideLoadingBar = false; |
|
|
|
this.textSearch.reset('', {emitEvent: false}); |
|
|
|
this.activeComponent = activeComponent; |
|
|
|
this.hideLoadingBar = activeComponent && activeComponent instanceof RouterTabsComponent; |
|
|
|
|
|
|
|
if (activeComponent && activeComponent instanceof RouterTabsComponent |
|
|
|
&& isDefinedAndNotNull(this.activeComponent.activatedRoute?.snapshot?.data?.showMainLoadingBar)) { |
|
|
|
this.hideLoadingBar = !this.activeComponent.activatedRoute.snapshot.data.showMainLoadingBar; |
|
|
|
} else if (activeComponent && activeComponent instanceof PageComponent |
|
|
|
&& isDefinedAndNotNull(this.activeComponent?.showMainLoadingBar)) { |
|
|
|
this.hideLoadingBar = !this.activeComponent.showMainLoadingBar; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.activeComponent && instanceOfSearchableComponent(this.activeComponent)) { |
|
|
|
this.searchEnabled = true; |
|
|
|
this.searchableComponent = this.activeComponent; |
|
|
|
|