diff --git a/src/@fuse/components/navigation/navigation.component.html b/src/@fuse/components/navigation/navigation.component.html
index 79459998..e26575f3 100644
--- a/src/@fuse/components/navigation/navigation.component.html
+++ b/src/@fuse/components/navigation/navigation.component.html
@@ -1,5 +1,4 @@
-
+
@@ -21,7 +20,8 @@
-
+
diff --git a/src/@fuse/components/navigation/navigation.component.scss b/src/@fuse/components/navigation/navigation.component.scss
index 3432e89a..5231f7c7 100644
--- a/src/@fuse/components/navigation/navigation.component.scss
+++ b/src/@fuse/components/navigation/navigation.component.scss
@@ -4,7 +4,7 @@ fuse-navigation {
display: flex;
flex: 1 0 auto;
- #main-navigation {
+ > .nav {
margin: 0;
padding: 0;
width: 100%;
diff --git a/src/@fuse/components/navigation/navigation.service.ts b/src/@fuse/components/navigation/navigation.service.ts
index 49995acb..3b07b456 100644
--- a/src/@fuse/components/navigation/navigation.service.ts
+++ b/src/@fuse/components/navigation/navigation.service.ts
@@ -1,11 +1,13 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
-@Injectable()
+import { FuseNavigationItem } from '@fuse/types';
+
+@Injectable({
+ providedIn: 'root'
+})
export class FuseNavigationService
{
- flatNavigation: any[] = [];
-
onItemCollapsed: Subject;
onItemCollapseToggled: Subject;
@@ -138,39 +140,30 @@ export class FuseNavigationService
* Get flattened navigation array
*
* @param navigation
+ * @param flatNavigation
* @returns {any[]}
*/
- getFlatNavigation(navigation): any
+ getFlatNavigation(navigation, flatNavigation: FuseNavigationItem[] = []): any
{
- for ( const navItem of navigation )
+ for ( const item of navigation )
{
- if ( navItem.type === 'item' )
+ if ( item.type === 'item' )
{
- this.flatNavigation.push({
- id : navItem.id || null,
- title : navItem.title || null,
- translate : navItem.translate || null,
- type : navItem.type,
- icon : navItem.icon || null,
- url : navItem.url || null,
- function : navItem.function || null,
- exactMatch: navItem.exactMatch || false,
- badge : navItem.badge || null
- });
+ flatNavigation.push(item);
continue;
}
- if ( navItem.type === 'collapse' || navItem.type === 'group' )
+ if ( item.type === 'collapsable' || item.type === 'group' )
{
- if ( navItem.children )
+ if ( item.children )
{
- this.getFlatNavigation(navItem.children);
+ this.getFlatNavigation(item.children, flatNavigation);
}
}
}
- return this.flatNavigation;
+ return flatNavigation;
}
/**
diff --git a/src/@fuse/components/search-bar/search-bar.component.scss b/src/@fuse/components/search-bar/search-bar.component.scss
index 3fad367d..954a1b90 100644
--- a/src/@fuse/components/search-bar/search-bar.component.scss
+++ b/src/@fuse/components/search-bar/search-bar.component.scss
@@ -9,7 +9,7 @@
height: 64px;
font-size: 13px;
- @include media-breakpoint-down('sm') {
+ @include media-breakpoint-down('xs') {
height: 56px;
}
@@ -28,7 +28,7 @@
height: 64px !important;
line-height: 64px !important;
- @include media-breakpoint-down('sm') {
+ @include media-breakpoint-down('xs') {
height: 56px !important;
line-height: 56px !important;
}
@@ -39,7 +39,7 @@
height: 64px !important;
line-height: 64px !important;
- @include media-breakpoint-down('sm') {
+ @include media-breakpoint-down('xs') {
height: 56px !important;
line-height: 56px !important;
}
diff --git a/src/@fuse/components/sidebar/sidebar.service.ts b/src/@fuse/components/sidebar/sidebar.service.ts
index 180e15ec..7f6ed609 100644
--- a/src/@fuse/components/sidebar/sidebar.service.ts
+++ b/src/@fuse/components/sidebar/sidebar.service.ts
@@ -2,7 +2,9 @@ import { Injectable } from '@angular/core';
import { FuseSidebarComponent } from './sidebar.component';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseSidebarService
{
// Private
diff --git a/src/@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service.ts b/src/@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service.ts
index 893c7fd4..510e0b98 100644
--- a/src/@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service.ts
+++ b/src/@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service.ts
@@ -1,7 +1,9 @@
import { Injectable } from '@angular/core';
import { MatSidenav } from '@angular/material';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseMatSidenavHelperService
{
sidenavInstances: MatSidenav[];
diff --git a/src/@fuse/fuse.module.ts b/src/@fuse/fuse.module.ts
index c25a483e..c942f0e8 100644
--- a/src/@fuse/fuse.module.ts
+++ b/src/@fuse/fuse.module.ts
@@ -1,29 +1,8 @@
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
-import { FUSE_CONFIG, FuseConfigService } from '@fuse/services/config.service';
-import { FuseCopierService } from '@fuse/services/copier.service';
-import { FuseLoadingBarService } from '@fuse/services/loading-bar.service';
-import { FuseMatchMediaService } from '@fuse/services/match-media.service';
-import { FuseMatSidenavHelperService } from '@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service';
-import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
-import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service';
-import { FuseSplashScreenService } from '@fuse/services/splash-screen.service';
-import { FuseTranslationLoaderService } from '@fuse/services/translation-loader.service';
+import { FUSE_CONFIG } from '@fuse/services/config.service';
-@NgModule({
- entryComponents: [],
- providers : [
- FuseConfigService,
- FuseCopierService,
- FuseLoadingBarService,
- FuseMatchMediaService,
- FuseMatSidenavHelperService,
- FuseNavigationService,
- FuseSidebarService,
- FuseSplashScreenService,
- FuseTranslationLoaderService
- ]
-})
+@NgModule()
export class FuseModule
{
constructor(@Optional() @SkipSelf() parentModule: FuseModule)
diff --git a/src/@fuse/services/config.service.ts b/src/@fuse/services/config.service.ts
index 9b73c1d9..175ee264 100644
--- a/src/@fuse/services/config.service.ts
+++ b/src/@fuse/services/config.service.ts
@@ -8,7 +8,9 @@ import * as _ from 'lodash';
// Create the injection token for the custom settings
export const FUSE_CONFIG = new InjectionToken('fuseCustomConfig');
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseConfigService
{
// Private
diff --git a/src/@fuse/services/copier.service.ts b/src/@fuse/services/copier.service.ts
index 1b431b0b..e3f8cc87 100644
--- a/src/@fuse/services/copier.service.ts
+++ b/src/@fuse/services/copier.service.ts
@@ -1,14 +1,15 @@
/**
* This class is based on the code in the following projects:
- *
- * - https://github.com/zenorocha/select
- * - https://github.com/zenorocha/clipboard.js/
+ * https://github.com/zenorocha/select
+ * https://github.com/zenorocha/clipboard.js/
*
* Both released under MIT license - © Zeno Rocha
*/
import { Injectable } from '@angular/core';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseCopierService
{
private textarea: HTMLTextAreaElement;
diff --git a/src/@fuse/services/loading-bar.service.ts b/src/@fuse/services/loading-bar.service.ts
index 81de5ced..f9735e58 100644
--- a/src/@fuse/services/loading-bar.service.ts
+++ b/src/@fuse/services/loading-bar.service.ts
@@ -1,9 +1,11 @@
import { Injectable } from '@angular/core';
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
import { BehaviorSubject, Observable } from 'rxjs';
-import { filter, takeUntil } from 'rxjs/operators';
+import { filter } from 'rxjs/operators';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseLoadingBarService
{
// Private
@@ -26,7 +28,7 @@ export class FuseLoadingBarService
// @ Accessors
// -----------------------------------------------------------------------------------------------------
- get visible(): Observable
+ get visible(): Observable
{
// Return the _visible as observable
return this._visible.asObservable();
diff --git a/src/@fuse/services/match-media.service.ts b/src/@fuse/services/match-media.service.ts
index fdaa1f3c..e096900a 100644
--- a/src/@fuse/services/match-media.service.ts
+++ b/src/@fuse/services/match-media.service.ts
@@ -2,7 +2,9 @@ import { MediaChange, ObservableMedia } from '@angular/flex-layout';
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseMatchMediaService
{
activeMediaQuery: string;
diff --git a/src/@fuse/services/splash-screen.service.ts b/src/@fuse/services/splash-screen.service.ts
index 6ad009d9..0e328fbc 100644
--- a/src/@fuse/services/splash-screen.service.ts
+++ b/src/@fuse/services/splash-screen.service.ts
@@ -3,7 +3,9 @@ import { DOCUMENT } from '@angular/common';
import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';
import { NavigationEnd, Router } from '@angular/router';
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseSplashScreenService
{
splashScreenEl: any;
diff --git a/src/@fuse/services/translation-loader.service.ts b/src/@fuse/services/translation-loader.service.ts
index a26d7027..abb4e2d1 100644
--- a/src/@fuse/services/translation-loader.service.ts
+++ b/src/@fuse/services/translation-loader.service.ts
@@ -7,7 +7,9 @@ export interface Locale
data: Object;
}
-@Injectable()
+@Injectable({
+ providedIn: 'root'
+})
export class FuseTranslationLoaderService
{
/**
diff --git a/src/app/layout/components/navbar/navbar.component.ts b/src/app/layout/components/navbar/navbar.component.ts
index c611f7c9..4809bb61 100644
--- a/src/app/layout/components/navbar/navbar.component.ts
+++ b/src/app/layout/components/navbar/navbar.component.ts
@@ -1,7 +1,7 @@
import { Component, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
import { Subject } from 'rxjs';
-import { filter, takeUntil } from 'rxjs/operators';
+import { filter, take, takeUntil } from 'rxjs/operators';
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
import { FusePerfectScrollbarDirective } from '@fuse/directives/fuse-perfect-scrollbar/fuse-perfect-scrollbar.directive';
@@ -61,6 +61,7 @@ export class NavbarComponent implements OnInit, OnDestroy
this._fusePerfectScrollbar = theDirective;
+ // Update the scrollbar on collapsable item toggle
this._fuseNavigationService.onItemCollapseToggled
.pipe(takeUntil(this._unsubscribeAll))
.subscribe(() => {
@@ -68,6 +69,28 @@ export class NavbarComponent implements OnInit, OnDestroy
this._fusePerfectScrollbar.update();
}, 310);
});
+
+ // Scroll to the active item position
+ this._router.events
+ .pipe(
+ filter((event) => event instanceof NavigationEnd),
+ take(1)
+ )
+ .subscribe(() => {
+ setTimeout(() => {
+ const activeNavItem = document.querySelector('navbar .nav-link.active');
+
+ if ( activeNavItem )
+ {
+ const activeItemOffsetTop = activeNavItem.offsetTop,
+ activeItemOffsetParentTop = activeNavItem.offsetParent.offsetTop,
+ scrollDistance = activeItemOffsetTop - activeItemOffsetParentTop - (48 * 3);
+
+ this._fusePerfectScrollbar.scrollToTop(scrollDistance);
+ }
+ });
+ }
+ );
}
// -----------------------------------------------------------------------------------------------------
diff --git a/src/app/layout/components/toolbar/toolbar.component.html b/src/app/layout/components/toolbar/toolbar.component.html
index 6324fe04..14d2e6f5 100644
--- a/src/app/layout/components/toolbar/toolbar.component.html
+++ b/src/app/layout/components/toolbar/toolbar.component.html
@@ -72,7 +72,7 @@
-