|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
import { Component, Injector, Optional, SkipSelf, Type } from '@angular/core';
|
|
|
|
|
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|
|
|
|
import { filter } from 'rxjs/operators';
|
|
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
|
|
|
import { eLayoutType } from '../enums/common';
|
|
|
|
|
import { ABP } from '../models';
|
|
|
|
|
import { ReplaceableComponents } from '../models/replaceable-components';
|
|
|
|
|
import { LocalizationService } from '../services/localization.service';
|
|
|
|
|
import { ReplaceableComponentsService } from '../services/replaceable-components.service';
|
|
|
|
|
import { RouterEvents } from '../services/router-events.service';
|
|
|
|
|
import { RoutesService } from '../services/routes.service';
|
|
|
|
|
import { SubscriptionService } from '../services/subscription.service';
|
|
|
|
|
import { findRoute, getRoutePath } from '../utils/route-utils';
|
|
|
|
@ -44,6 +44,7 @@ export class DynamicLayoutComponent {
|
|
|
|
|
private localizationService: LocalizationService,
|
|
|
|
|
private replaceableComponents: ReplaceableComponentsService,
|
|
|
|
|
private subscription: SubscriptionService,
|
|
|
|
|
private routerEvents: RouterEvents,
|
|
|
|
|
@Optional() @SkipSelf() dynamicLayoutComponent: DynamicLayoutComponent,
|
|
|
|
|
) {
|
|
|
|
|
if (dynamicLayoutComponent) return;
|
|
|
|
@ -52,16 +53,16 @@ export class DynamicLayoutComponent {
|
|
|
|
|
this.routes = injector.get(RoutesService);
|
|
|
|
|
|
|
|
|
|
this.getLayout();
|
|
|
|
|
this.subscription.addOne(
|
|
|
|
|
this.router.events.pipe(filter(event => event instanceof NavigationEnd)),
|
|
|
|
|
() => {
|
|
|
|
|
this.getLayout();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
this.checkLayoutOnNavigationEnd();
|
|
|
|
|
|
|
|
|
|
this.listenToLanguageChange();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private checkLayoutOnNavigationEnd() {
|
|
|
|
|
const navigationEnd$ = this.routerEvents.getNavigationEvents('End');
|
|
|
|
|
this.subscription.addOne(navigationEnd$, () => this.getLayout());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getLayout() {
|
|
|
|
|
let expectedLayout = (this.route.snapshot.data || {}).layout;
|
|
|
|
|
|
|
|
|
|