mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
Angular 6 (#556)
* upgrade to angular 6 (with rxjs-compat) * fix tests * fix test scripts * upgrade rxjs to 6.0 * remove rxjs-compat layer * update unit tests * restore tests * context-menu transparent backdrop * upgrade libs * changed snackbar locator * locator as class * remove locator element reference * snackbar locators * wait for snackbar before executing the action button * expect cdk-overlay before mat-menu-panel condition * update libs
This commit is contained in:
@@ -30,7 +30,7 @@ import {
|
||||
ViewChild,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { Observable, Subject } from 'rxjs/Rx';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { NodePermissionService } from '../../services/node-permission.service';
|
||||
import { SidenavViewsManagerDirective } from './sidenav-views-manager.directive';
|
||||
|
@@ -1,13 +1,17 @@
|
||||
import { Directive, ContentChild } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { UserPreferencesService, AppConfigService, SidenavLayoutComponent } from '@alfresco/adf-core';
|
||||
import {
|
||||
UserPreferencesService,
|
||||
AppConfigService,
|
||||
SidenavLayoutComponent
|
||||
} from '@alfresco/adf-core';
|
||||
import { filter } from 'rxjs/operators';
|
||||
|
||||
@Directive({
|
||||
selector: '[acaSidenavManager]',
|
||||
exportAs: 'acaSidenavManager'
|
||||
selector: '[acaSidenavManager]',
|
||||
exportAs: 'acaSidenavManager'
|
||||
})
|
||||
export class SidenavViewsManagerDirective {
|
||||
|
||||
@ContentChild(SidenavLayoutComponent) sidenavLayout: SidenavLayoutComponent;
|
||||
|
||||
minimizeSidenav = false;
|
||||
@@ -23,19 +27,22 @@ export class SidenavViewsManagerDirective {
|
||||
private appConfigService: AppConfigService
|
||||
) {
|
||||
this.router.events
|
||||
.filter(event => event instanceof NavigationEnd)
|
||||
.subscribe( (event: any ) => {
|
||||
this.minimizeSidenav = this.minimizeConditions.some(el => event.urlAfterRedirects.includes(el));
|
||||
this.hideSidenav = this.hideConditions.some(el => event.urlAfterRedirects.includes(el));
|
||||
.pipe(filter(event => event instanceof NavigationEnd))
|
||||
.subscribe((event: any) => {
|
||||
this.minimizeSidenav = this.minimizeConditions.some(el =>
|
||||
event.urlAfterRedirects.includes(el)
|
||||
);
|
||||
this.hideSidenav = this.hideConditions.some(el =>
|
||||
event.urlAfterRedirects.includes(el)
|
||||
);
|
||||
|
||||
if (this._run) {
|
||||
this.manageSidenavState();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
run (shouldRun) {
|
||||
run(shouldRun) {
|
||||
this._run = shouldRun;
|
||||
}
|
||||
|
||||
@@ -54,17 +61,31 @@ export class SidenavViewsManagerDirective {
|
||||
}
|
||||
|
||||
setState(state) {
|
||||
if (!this.minimizeSidenav && this.appConfigService.get('sideNav.preserveState')) {
|
||||
if (
|
||||
!this.minimizeSidenav &&
|
||||
this.appConfigService.get('sideNav.preserveState')
|
||||
) {
|
||||
this.userPreferenceService.set('expandedSidenav', state);
|
||||
}
|
||||
}
|
||||
|
||||
get sidenavState(): boolean {
|
||||
const expand = this.appConfigService.get<boolean>('sideNav.expandedSidenav', true);
|
||||
const preserveState = this.appConfigService.get<boolean>('sideNav.preserveState', true);
|
||||
const expand = this.appConfigService.get<boolean>(
|
||||
'sideNav.expandedSidenav',
|
||||
true
|
||||
);
|
||||
const preserveState = this.appConfigService.get<boolean>(
|
||||
'sideNav.preserveState',
|
||||
true
|
||||
);
|
||||
|
||||
if (preserveState) {
|
||||
return (this.userPreferenceService.get('expandedSidenav', expand.toString()) === 'true');
|
||||
if (preserveState) {
|
||||
return (
|
||||
this.userPreferenceService.get(
|
||||
'expandedSidenav',
|
||||
expand.toString()
|
||||
) === 'true'
|
||||
);
|
||||
}
|
||||
|
||||
return expand;
|
||||
|
Reference in New Issue
Block a user