[ADF-2626] added preserved state functionality for sidenav component (#3278)

* [ADF-2626] added preserved state functionality for sidenav component

* [ADF-2626] changed logic for preserving the sidenav component state

* [ADF-2626] added missing curly brace }

* [ADF-2626] small changes on logic based on pr comments

* [ADF-2843] added tooltip for create folder and edit folder icons from Content Services

* Revert "[ADF-2843] added tooltip for create folder and edit folder icons from Content Services"

This reverts commit d5a7abb65b.

* [ADF-2626] changed casting

* [ADF-2626] updated documentation with event

* [ADF-2626] removed app-config pipe because it was not being used
This commit is contained in:
Georgiana Roman
2018-05-10 12:21:30 +03:00
committed by Eugenio Romano
parent a5aff3d2df
commit 440c666583
6 changed files with 65 additions and 9 deletions

View File

@@ -18,7 +18,8 @@ Displays the standard three-region ADF application layout.
[sidenavMax]="220"
[stepOver]="600"
[hideSidenav]="false"
[expandedSidenav]="true">
[expandedSidenav]="true"
(expanded)="setState($event)">
<adf-sidenav-layout-header>
<ng-template let-toggleMenu="toggleMenu">
@@ -54,7 +55,7 @@ Displays the standard three-region ADF application layout.
| sidenavMax | `number` | | (**required**) Width in pixels when expanded |
| stepOver | `number` | | (**required**) "Breakpoint" size (ie, number of pixels for selecting between mobile and desktop layouts) |
| hideSidenav | `boolean` | false | Toggles showing/hiding the navigation region |
| expandedSidenav | `boolean` | true | Should the navigation region be expanded initially? |
| expandedSidenav | `boolean` | true | Should the navigation region be expanded initially? |
## Details
@@ -88,6 +89,11 @@ Mobile layout (screen width less than the `stepOver` value):
| --- | --- | --- | --- |
| menuOpenState$ | Observable&lt;boolean&gt; | true | Another way to listen to menu open/closed state |
### Events
| Name | Type | Description |
| expanded | `EventEmitter<boolean>` | Emmitted when the menu toggle and the collapsed/expanded state of the sideNav changes
### Template context
Each template is given a context containing the following methods:
@@ -105,4 +111,24 @@ Beside the template context's **isMenuMinimized** variable, another way to liste
Every time the menu state is changed, the following values are emitted:
- true, if the menu got into opened state
- false, if the menu git into closed state
- false, if the menu git into closed state
### Preserving the menu state
It is possible to preserve the state of the menu between sessions. This require to first set a property in the appConfig.json file.
```
"sideNav" : {
"preserveState" : true
}
```
If this property is set, the collapsed/expanded state will be stored in the local storage, and it will be restored with page reload or the next time the user visits the app.
Beside this, it is also possible to set the default value in the appConfig.json file:
```
"sideNav" : {
"expandedSidenav" : true
}
```
By default the collapsed/exapnded state should be read from the application configuration file, but only if there is no value for the collapsed/expanded state in the local storage.