From 1f77e201a1e6bee81b9679705f8d05f34a700553 Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Fri, 15 Jun 2018 19:46:31 +0300 Subject: [PATCH 1/4] Added the update date to the changelog --- src/app/main/documentation/changelog/changelog.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/main/documentation/changelog/changelog.component.html b/src/app/main/documentation/changelog/changelog.component.html index 22803863..8130cd11 100644 --- a/src/app/main/documentation/changelog/changelog.component.html +++ b/src/app/main/documentation/changelog/changelog.component.html @@ -26,7 +26,7 @@
v6.1.0 - (2018-06-xx) + (2018-06-16)
From 29f8ddda9e2fe4ae5c9d48c479e18ee9f8b975dc Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Sun, 17 Jun 2018 13:16:04 +0300 Subject: [PATCH 2/4] Remove unnecessary input binding from sidebars --- .../layout/horizontal/layout-1/layout-1.component.html | 4 ++-- .../layout/vertical/layout-1/layout-1.component.html | 10 +++++----- .../layout/vertical/layout-2/layout-2.component.html | 10 +++++----- .../layout/vertical/layout-3/layout-3.component.html | 10 +++++----- .../components/sidebar/sidebar.component.html | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/app/layout/horizontal/layout-1/layout-1.component.html b/src/app/layout/horizontal/layout-1/layout-1.component.html index aa7ab758..1795eb96 100644 --- a/src/app/layout/horizontal/layout-1/layout-1.component.html +++ b/src/app/layout/horizontal/layout-1/layout-1.component.html @@ -56,7 +56,7 @@
- + @@ -91,7 +91,7 @@ - diff --git a/src/app/layout/vertical/layout-1/layout-1.component.html b/src/app/layout/vertical/layout-1/layout-1.component.html index e6b32e29..2d6dd0a9 100644 --- a/src/app/layout/vertical/layout-1/layout-1.component.html +++ b/src/app/layout/vertical/layout-1/layout-1.component.html @@ -68,7 +68,7 @@ - + @@ -93,9 +93,9 @@ - @@ -104,9 +104,9 @@ - diff --git a/src/app/layout/vertical/layout-2/layout-2.component.html b/src/app/layout/vertical/layout-2/layout-2.component.html index 6eb66b31..8e03dc7e 100644 --- a/src/app/layout/vertical/layout-2/layout-2.component.html +++ b/src/app/layout/vertical/layout-2/layout-2.component.html @@ -68,7 +68,7 @@ - + @@ -93,9 +93,9 @@ - @@ -104,9 +104,9 @@ - diff --git a/src/app/layout/vertical/layout-3/layout-3.component.html b/src/app/layout/vertical/layout-3/layout-3.component.html index f6468ccc..c7e8c0de 100644 --- a/src/app/layout/vertical/layout-3/layout-3.component.html +++ b/src/app/layout/vertical/layout-3/layout-3.component.html @@ -54,7 +54,7 @@ - + @@ -79,9 +79,9 @@ - @@ -90,9 +90,9 @@ - diff --git a/src/app/main/documentation/components/sidebar/sidebar.component.html b/src/app/main/documentation/components/sidebar/sidebar.component.html index 73863e9b..b32f53b1 100644 --- a/src/app/main/documentation/components/sidebar/sidebar.component.html +++ b/src/app/main/documentation/components/sidebar/sidebar.component.html @@ -27,7 +27,7 @@

From 147525d16a8625a4a0979d142f244ddee1a46d7a Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Sun, 17 Jun 2018 14:24:10 +0300 Subject: [PATCH 3/4] (Sidebar) Fixed the folded issue --- .../components/sidebar/sidebar.component.ts | 103 +++++++++++++++--- 1 file changed, 90 insertions(+), 13 deletions(-) diff --git a/src/@fuse/components/sidebar/sidebar.component.ts b/src/@fuse/components/sidebar/sidebar.component.ts index 96dcadd3..02d3e7ce 100644 --- a/src/@fuse/components/sidebar/sidebar.component.ts +++ b/src/@fuse/components/sidebar/sidebar.component.ts @@ -2,11 +2,11 @@ import { ChangeDetectorRef, Component, ElementRef, HostBinding, HostListener, In import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations'; import { ObservableMedia } from '@angular/flex-layout'; import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/internal/operators'; import { FuseSidebarService } from './sidebar.service'; import { FuseMatchMediaService } from '@fuse/services/match-media.service'; import { FuseConfigService } from '@fuse/services/config.service'; -import { takeUntil } from 'rxjs/internal/operators'; @Component({ selector : 'fuse-sidebar', @@ -20,6 +20,10 @@ export class FuseSidebarComponent implements OnInit, OnDestroy @Input() name: string; + // Key + @Input() + key: string; + // Position @Input() position: 'left' | 'right'; @@ -48,6 +52,7 @@ export class FuseSidebarComponent implements OnInit, OnDestroy private _folded: boolean; private _fuseConfig: any; private _wasActive: boolean; + private _wasFolded: boolean; private _backdrop: HTMLElement | null = null; private _player: AnimationPlayer; private _unsubscribeAll: Subject; @@ -79,13 +84,14 @@ export class FuseSidebarComponent implements OnInit, OnDestroy ) { // Set the defaults - this.folded = false; this.opened = false; + // this.folded = false; this.position = 'left'; this.invisibleOverlay = false; // Set the private defaults this._animationsEnabled = false; + this._folded = false; this._unsubscribeAll = new Subject(); } @@ -94,19 +100,18 @@ export class FuseSidebarComponent implements OnInit, OnDestroy // ----------------------------------------------------------------------------------------------------- // Folded - @HostBinding('class.folded') @Input() set folded(value: boolean) { - // Only work if the sidebar is not closed + // Set the folded + this._folded = value; + + // Return if the sidebar is closed if ( !this.opened ) { return; } - // Set the folded - this._folded = value; - // Programmatically add/remove margin to the element // that comes after or before based on the position let sibling, @@ -135,14 +140,22 @@ export class FuseSidebarComponent implements OnInit, OnDestroy // If folded... if ( value ) { - // Set the style + // Fold the sidebar + this.fold(); + + // Set the style and class this._renderer.setStyle(sibling, styleRule, styleValue, RendererStyleFlags2.Important + RendererStyleFlags2.DashCase); + this._renderer.addClass(this._elementRef.nativeElement, 'folded'); } // If unfolded... else { - // Remove the style + // Unfold the sidebar + this.unfold(); + + // Remove the style and class this._renderer.removeStyle(sibling, styleRule); + this._renderer.removeClass(this._elementRef.nativeElement, 'folded'); } } @@ -178,6 +191,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy // Setup lockedOpen this._setupLockedOpen(); + + // Setup folded + this._setupFolded(); } /** @@ -253,6 +269,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy // Set the wasActive for the first time this._wasActive = false; + // Set the wasFolded + this._wasFolded = this.folded; + // Show the sidebar this._showSidebar(); @@ -282,11 +301,17 @@ export class FuseSidebarComponent implements OnInit, OnDestroy // Force the the opened status to true this.opened = true; - // Read the folded setting from the config - // and fold the sidebar if it's true - if ( this._fuseConfig.layout.navbar.folded ) + // If the sidebar was folded, forcefully fold it again + if ( this._wasFolded ) { - this.fold(); + // Enable the animations + this._enableAnimations(); + + // Fold + this.folded = true; + + // Mark for check + this._changeDetectorRef.markForCheck(); } // Hide the backdrop if any exists @@ -313,6 +338,58 @@ export class FuseSidebarComponent implements OnInit, OnDestroy }); } + /** + * Setup the initial folded status + * + * @private + */ + private _setupFolded(): void + { + // Return, if sidebar is not folded + if ( !this.folded ) + { + return; + } + + // Return if the sidebar is closed + if ( !this.opened ) + { + return; + } + + // Programmatically add/remove margin to the element + // that comes after or before based on the position + let sibling, + styleRule; + + const styleValue = '64px'; + + // Get the sibling and set the style rule + if ( this.position === 'left' ) + { + sibling = this._elementRef.nativeElement.nextElementSibling; + styleRule = 'margin-left'; + } + else + { + sibling = this._elementRef.nativeElement.previousElementSibling; + styleRule = 'margin-right'; + } + + // If there is no sibling, return... + if ( !sibling ) + { + return; + } + + // Fold the sidebar + this.fold(); + + // Set the style and class + this._renderer.setStyle(sibling, styleRule, styleValue, RendererStyleFlags2.Important + RendererStyleFlags2.DashCase); + this._renderer.addClass(this._elementRef.nativeElement, 'folded'); + } + /** * Show the backdrop * From 6d3cfe8ace3c426103604a4ba52e009a4a310257 Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Sun, 17 Jun 2018 14:29:35 +0300 Subject: [PATCH 4/4] Increase the version number Updated the changelog --- package-lock.json | 2 +- package.json | 2 +- .../changelog/changelog.component.html | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f7f5482..230fe206 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fuse", - "version": "6.1.0", + "version": "6.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index db81e5da..380e0ad2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fuse", - "version": "6.1.0", + "version": "6.1.1", "license": "https://themeforest.net/licenses/terms/regular", "scripts": { "ng": "ng", diff --git a/src/app/main/documentation/changelog/changelog.component.html b/src/app/main/documentation/changelog/changelog.component.html index 8130cd11..65b68d44 100644 --- a/src/app/main/documentation/changelog/changelog.component.html +++ b/src/app/main/documentation/changelog/changelog.component.html @@ -19,6 +19,32 @@
+ + + +
+ +
+ v6.1.1 + (2018-06-17) +
+ +
+ +
+ Fixed +
    +
  • + (Fuse Sidebar) Folded status doesn't work correctly when there are multiple instances +
  • +
+
+ +
+ +
+ +