Added an ability to control the folded status of the vertical navigation via FuseConfig

This commit is contained in:
Sercan Yemen 2017-10-30 13:31:23 +03:00
parent 7b10b2ad86
commit ee29f20304
4 changed files with 37 additions and 9 deletions

View File

@ -21,6 +21,12 @@
<mat-radio-button class="mr-8 mb-8" value="none">None</mat-radio-button>
</mat-radio-group>
<h3>Navigation Fold (for vertical navigation):</h3>
<mat-slide-toggle [(ngModel)]="fuseSettings.layout.navigationFolded"
(change)="onSettingsChange()">
Folded
</mat-slide-toggle>
<h3 class="mt-24">Toolbar:</h3>
<mat-radio-group [(ngModel)]="fuseSettings.layout.toolbar" (ngModelChange)="onSettingsChange()"
fxLayout="column" fxLayout.gt-xs="row" fxLayoutAlign="start start" fxLayoutWrap>

View File

@ -22,7 +22,8 @@ export class FuseConfigService
// Set the default settings
this.defaultSettings = {
layout : {
navigation: 'left', // 'right', 'left', 'top', 'none'
navigation : 'left', // 'right', 'left', 'top', 'none'
navigationFolded: false, // true, false
toolbar : 'below', // 'above', 'below', 'none'
footer : 'below', // 'above', 'below', 'none'
mode : 'fullwidth' // 'boxed', 'fullwidth'

View File

@ -18,7 +18,7 @@
<div id="wrapper">
<!-- NAVBAR: Left -->
<fuse-navbar-vertical [folded]="false"
<fuse-navbar-vertical [folded]="fuseSettings.layout.navigationFolded"
class="left-navbar"
[class]="fuseSettings.colorClasses.navbar"
*ngIf="fuseSettings.layout.navigation === 'left' || fuseSettings.layout.navigation === 'top'">
@ -44,7 +44,7 @@
</div>
<!-- NAVBAR: Right -->
<fuse-navbar-vertical [folded]="false"
<fuse-navbar-vertical [folded]="fuseSettings.layout.navigationFolded"
class="right-navbar"
[class]="fuseSettings.colorClasses.navbar"
*ngIf="fuseSettings.layout.navigation === 'right'">

View File

@ -18,13 +18,34 @@ import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/anim
export class FuseNavbarVerticalComponent implements OnInit, OnDestroy
{
private _backdropElement: HTMLElement | null = null;
private _folded = false;
@HostBinding('class.close') isClosed: boolean;
@HostBinding('class.folded') isFoldedActive: boolean;
@HostBinding('class.folded-open') isFoldedOpen: boolean;
@HostBinding('class.initialized') initialized: boolean;
@Input('folded') foldedByDefault = false;
@ViewChild(FusePerfectScrollbarDirective) fusePerfectScrollbarDirective;
@Input()
set folded(value: boolean)
{
this._folded = value;
if ( this._folded )
{
this.activateFolded();
}
else
{
this.deActivateFolded();
}
}
get folded(): boolean
{
return this._folded;
}
matchMediaWatcher: Subscription;
navigationServiceWatcher: Subscription;
fusePerfectScrollbarUpdateTimeout;
@ -88,7 +109,7 @@ export class FuseNavbarVerticalComponent implements OnInit, OnDestroy
ngOnInit()
{
this.isClosed = false;
this.isFoldedActive = this.foldedByDefault;
this.isFoldedActive = this._folded;
this.isFoldedOpen = false;
this.initialized = false;
this.updateCssClasses();
@ -104,7 +125,7 @@ export class FuseNavbarVerticalComponent implements OnInit, OnDestroy
}
else
{
if ( !this.foldedByDefault )
if ( !this._folded )
{
this.deActivateFolded();
}