mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2626] added preserved state functionality for sidenav component
This commit is contained in:
@@ -488,5 +488,10 @@
|
||||
"adf-version-manager": {
|
||||
"allowComments": true,
|
||||
"allowDownload": true
|
||||
},
|
||||
|
||||
"sideNav": {
|
||||
"openedSidenav": true,
|
||||
"preserveState": true
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<adf-sidenav-layout [sidenavMin]="70" [sidenavMax]="220" [stepOver]="780" [hideSidenav]="false" [expandedSidenav]="false">
|
||||
<adf-sidenav-layout [sidenavMin]="70" [sidenavMax]="220" [stepOver]="780" [hideSidenav]="false"[expandedSidenav]= "expandedSidenav">
|
||||
|
||||
<adf-sidenav-layout-header>
|
||||
<ng-template let-toggleMenu="toggleMenu">
|
||||
|
@@ -15,7 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, ViewEncapsulation, Input } from '@angular/core';
|
||||
import { StorageService, AppConfigService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'app-layout.component.html',
|
||||
@@ -25,6 +26,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
||||
},
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
||||
export class AppLayoutComponent {
|
||||
|
||||
links: Array<any> = [
|
||||
@@ -48,6 +50,18 @@ export class AppLayoutComponent {
|
||||
{ href: '/about', icon: 'info_outline', title: 'APP_LAYOUT.ABOUT' }
|
||||
];
|
||||
|
||||
constructor() {
|
||||
@Input() expandedSidenav = false;
|
||||
|
||||
constructor(private storage: StorageService, private config: AppConfigService) {
|
||||
const preserved = this.storage.getItem('openedSidenav');
|
||||
if (preserved !== null) {
|
||||
if (preserved === 'false') {
|
||||
this.expandedSidenav = false;
|
||||
} else {
|
||||
this.expandedSidenav = true;
|
||||
}
|
||||
} else {
|
||||
this.expandedSidenav = this.config.get('sideNav.openedSidenav');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user