From 5c40e99518ea1356d86c6468e1be126f017c367b Mon Sep 17 00:00:00 2001 From: sercan Date: Tue, 18 May 2021 13:10:39 +0300 Subject: [PATCH] (FuseNavigation) Use the generic return type for "getComponent" (docs) Updated FuseNavigation docs --- .../horizontal/centered/centered.component.ts | 4 +-- .../enterprise/enterprise.component.ts | 4 +-- .../horizontal/material/material.component.ts | 4 +-- .../horizontal/modern/modern.component.ts | 4 +-- .../vertical/classic/classic.component.ts | 4 +-- .../vertical/classy/classy.component.ts | 4 +-- .../vertical/compact/compact.component.ts | 4 +-- .../layouts/vertical/dense/dense.component.ts | 4 +-- .../futuristic/futuristic.component.ts | 4 +-- .../layouts/vertical/thin/thin.component.ts | 4 +-- .../apps/mailbox/sidebar/sidebar.component.ts | 4 +-- .../admin/apps/tasks/list/list.component.ts | 4 +-- .../navigation/navigation.component.html | 10 +++---- .../navigation/navigation.component.ts | 26 +++++++++---------- 14 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/app/layout/layouts/horizontal/centered/centered.component.ts b/src/app/layout/layouts/horizontal/centered/centered.component.ts index 637e2eab..513ffa98 100644 --- a/src/app/layout/layouts/horizontal/centered/centered.component.ts +++ b/src/app/layout/layouts/horizontal/centered/centered.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class CenteredLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/horizontal/enterprise/enterprise.component.ts b/src/app/layout/layouts/horizontal/enterprise/enterprise.component.ts index 2edbaf7b..73b7ca19 100644 --- a/src/app/layout/layouts/horizontal/enterprise/enterprise.component.ts +++ b/src/app/layout/layouts/horizontal/enterprise/enterprise.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class EnterpriseLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/horizontal/material/material.component.ts b/src/app/layout/layouts/horizontal/material/material.component.ts index 6dd9cac9..4bb450a5 100644 --- a/src/app/layout/layouts/horizontal/material/material.component.ts +++ b/src/app/layout/layouts/horizontal/material/material.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class MaterialLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/horizontal/modern/modern.component.ts b/src/app/layout/layouts/horizontal/modern/modern.component.ts index 8b98f101..496c1837 100644 --- a/src/app/layout/layouts/horizontal/modern/modern.component.ts +++ b/src/app/layout/layouts/horizontal/modern/modern.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class ModernLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/vertical/classic/classic.component.ts b/src/app/layout/layouts/vertical/classic/classic.component.ts index e424a4a7..629cbb56 100644 --- a/src/app/layout/layouts/vertical/classic/classic.component.ts +++ b/src/app/layout/layouts/vertical/classic/classic.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class ClassicLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/vertical/classy/classy.component.ts b/src/app/layout/layouts/vertical/classy/classy.component.ts index 200513c3..2c1d5c55 100644 --- a/src/app/layout/layouts/vertical/classy/classy.component.ts +++ b/src/app/layout/layouts/vertical/classy/classy.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class ClassyLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/vertical/compact/compact.component.ts b/src/app/layout/layouts/vertical/compact/compact.component.ts index 4b58fcff..884e7eca 100644 --- a/src/app/layout/layouts/vertical/compact/compact.component.ts +++ b/src/app/layout/layouts/vertical/compact/compact.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class CompactLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/vertical/dense/dense.component.ts b/src/app/layout/layouts/vertical/dense/dense.component.ts index b7107147..624db14d 100644 --- a/src/app/layout/layouts/vertical/dense/dense.component.ts +++ b/src/app/layout/layouts/vertical/dense/dense.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -88,7 +88,7 @@ export class DenseLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/vertical/futuristic/futuristic.component.ts b/src/app/layout/layouts/vertical/futuristic/futuristic.component.ts index 6756e5e3..b4bdca90 100644 --- a/src/app/layout/layouts/vertical/futuristic/futuristic.component.ts +++ b/src/app/layout/layouts/vertical/futuristic/futuristic.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class FuturisticLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/layout/layouts/vertical/thin/thin.component.ts b/src/app/layout/layouts/vertical/thin/thin.component.ts index 2b134f3d..b56bdf62 100644 --- a/src/app/layout/layouts/vertical/thin/thin.component.ts +++ b/src/app/layout/layouts/vertical/thin/thin.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Data, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { InitialData } from 'app/app.types'; @Component({ @@ -87,7 +87,7 @@ export class ThinLayoutComponent implements OnInit, OnDestroy toggleNavigation(name: string): void { // Get the navigation - const navigation = this._fuseNavigationService.getComponent(name); + const navigation = this._fuseNavigationService.getComponent(name); if ( navigation ) { diff --git a/src/app/modules/admin/apps/mailbox/sidebar/sidebar.component.ts b/src/app/modules/admin/apps/mailbox/sidebar/sidebar.component.ts index 3b4c2cd8..0f145622 100644 --- a/src/app/modules/admin/apps/mailbox/sidebar/sidebar.component.ts +++ b/src/app/modules/admin/apps/mailbox/sidebar/sidebar.component.ts @@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; -import { FuseNavigationItem, FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationItem, FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { MailboxService } from 'app/modules/admin/apps/mailbox/mailbox.service'; import { MailboxComposeComponent } from 'app/modules/admin/apps/mailbox/compose/compose.component'; import { labelColorDefs } from 'app/modules/admin/apps/mailbox/mailbox.constants'; @@ -279,7 +279,7 @@ export class MailboxSidebarComponent implements OnInit, OnDestroy const inboxFolder = this.folders.find(folder => folder.slug === 'inbox'); // Get the component -> navigation mock-api -> item - const mainNavigationComponent = this._fuseNavigationService.getComponent('mainNavigation'); + const mainNavigationComponent = this._fuseNavigationService.getComponent('mainNavigation'); // If the main navigation component exists... if ( mainNavigationComponent ) diff --git a/src/app/modules/admin/apps/tasks/list/list.component.ts b/src/app/modules/admin/apps/tasks/list/list.component.ts index 0c022200..e454e62d 100644 --- a/src/app/modules/admin/apps/tasks/list/list.component.ts +++ b/src/app/modules/admin/apps/tasks/list/list.component.ts @@ -6,7 +6,7 @@ import { MatDrawer } from '@angular/material/sidenav'; import { fromEvent, Subject } from 'rxjs'; import { filter, takeUntil } from 'rxjs/operators'; import { FuseMediaWatcherService } from '@fuse/services/media-watcher'; -import { FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { Tag, Task } from 'app/modules/admin/apps/tasks/tasks.types'; import { TasksService } from 'app/modules/admin/apps/tasks/tasks.service'; @@ -83,7 +83,7 @@ export class TasksListComponent implements OnInit, OnDestroy setTimeout(() => { // Get the component -> navigation data -> item - const mainNavigationComponent = this._fuseNavigationService.getComponent('mainNavigation'); + const mainNavigationComponent = this._fuseNavigationService.getComponent('mainNavigation'); // If the main navigation component exists... if ( mainNavigationComponent ) diff --git a/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.html b/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.html index 7dc0cfbf..38ccdca5 100644 --- a/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.html +++ b/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.html @@ -687,7 +687,7 @@ getNavItem(itemId, navigationName): FuseNavigationItem | null { // Get the component -> navigation data -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -772,7 +772,7 @@ updateBadgeTitle(itemId, navigationName, title): void { // Get the component -> navigation data -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -850,7 +850,7 @@ toggleDisabled(itemId, navigationName): void { // Get the component -> navigation data -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -940,7 +940,7 @@ swapNavigationData(navigationName): void { // Get the component -> navigation data -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -949,7 +949,7 @@ } // A navigation data to replace with - const newNavigation = [ + const newNavigation: FuseNavigationItem[] = [ { id : 'supported-components', title : 'Supported components', diff --git a/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.ts b/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.ts index 4ca49d9f..ababfd73 100644 --- a/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.ts +++ b/src/app/modules/admin/docs/core-features/components/navigation/navigation.component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { FuseNavigationItem, FuseNavigationService } from '@fuse/components/navigation'; +import { FuseNavigationItem, FuseNavigationService, FuseVerticalNavigationComponent } from '@fuse/components/navigation'; import { CoreFeaturesComponent } from 'app/modules/admin/docs/core-features/core-features.component'; @Component({ @@ -32,8 +32,8 @@ export class NavigationComponent */ getNavItem(itemId, navigationName): FuseNavigationItem | null { - // Get the component -> navigation mock-api -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + // Get the component -> navigation data -> item + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -57,8 +57,8 @@ export class NavigationComponent */ updateBadgeTitle(itemId, navigationName, title): void { - // Get the component -> navigation mock-api -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + // Get the component -> navigation data -> item + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -81,8 +81,8 @@ export class NavigationComponent */ toggleDisabled(itemId, navigationName): void { - // Get the component -> navigation mock-api -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + // Get the component -> navigation data -> item + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -98,14 +98,14 @@ export class NavigationComponent } /** - * Swap navigation mock-api + * Swap navigation data * * @param navigationName */ swapNavigationData(navigationName): void { - // Get the component -> navigation mock-api -> item - const navComponent = this._fuseNavigationService.getComponent(navigationName); + // Get the component -> navigation data -> item + const navComponent = this._fuseNavigationService.getComponent(navigationName); // Return if the navigation component does not exist if ( !navComponent ) @@ -113,8 +113,8 @@ export class NavigationComponent return null; } - // A navigation mock-api to replace with - const newNavigation = [ + // A navigation data to replace with + const newNavigation: FuseNavigationItem[] = [ { id : 'supported-components', title : 'Supported components', @@ -168,7 +168,7 @@ export class NavigationComponent } ]; - // Replace the navigation mock-api + // Replace the navigation data navComponent.navigation = newNavigation; navComponent.refresh(); }