-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(package): individual module imports for navigation components (#393
) This allows components to be imported individually without having to install an unused, optional dependency. Deprecations - NavigationItemConfig: Use VerticalNavigationItem or ApplicationLauncherItem - NavigationModule: Use ApplicationLauncherModule or VerticalNavigationModule
- Loading branch information
Showing
15 changed files
with
193 additions
and
67 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/app/navigation/application-launcher/application-launcher-item.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { NavigationItemBase } from '../navigation-item-base'; | ||
|
||
/** | ||
* A config containing properties for application launcher items | ||
*/ | ||
export class ApplicationLauncherItem extends NavigationItemBase {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/app/navigation/application-launcher/application-launcher.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { BsDropdownConfig, BsDropdownModule } from 'ngx-bootstrap/dropdown'; | ||
|
||
import { ApplicationLauncherComponent } from './application-launcher.component'; | ||
|
||
/** | ||
* A module containing objects associated with the application laucnher components | ||
*/ | ||
@NgModule({ | ||
imports: [ | ||
BsDropdownModule.forRoot(), | ||
CommonModule | ||
], | ||
declarations: [ApplicationLauncherComponent], | ||
exports: [ApplicationLauncherComponent], | ||
providers: [BsDropdownConfig] | ||
}) | ||
export class ApplicationLauncherModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* A config containing properties for navigation items | ||
*/ | ||
export class NavigationItemBase { | ||
/** | ||
* Badges to display information about the navigation item | ||
*/ | ||
badges?: any[]; | ||
|
||
/** | ||
* The icon class to use for icons displayed to the left of text | ||
*/ | ||
iconStyleClass?: string; | ||
|
||
/** | ||
* Target for URL (e.g., _blank) | ||
*/ | ||
target?: string; | ||
|
||
/** | ||
* Title for the navigation item | ||
*/ | ||
title: string; | ||
|
||
/** | ||
* Link to navigate to | ||
*/ | ||
url?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { BsDropdownConfig, BsDropdownModule } from 'ngx-bootstrap/dropdown'; | ||
import { TooltipConfig, TooltipModule } from 'ngx-bootstrap/tooltip'; | ||
|
||
import { ApplicationLauncherComponent } from './application-launcher/application-launcher.component'; | ||
import { ApplicationLauncherModule } from './application-launcher/application-launcher.module'; | ||
import { NavigationItemConfig } from './navigation-item-config'; | ||
import { VerticalNavigationComponent } from './vertical-navigation/vertical-navigation.component'; | ||
import { WindowReference } from '../utilities/window.reference'; | ||
import { ApplicationLauncherComponent } from './application-launcher/application-launcher.component'; | ||
import { VerticalNavigationModule } from './vertical-navigation/vertical-navigation.module'; | ||
|
||
export { | ||
NavigationItemConfig | ||
}; | ||
|
||
/** | ||
* A module containing objects associated with the navigation components | ||
* | ||
* @deprecated Use individual module imports | ||
* | ||
* import { | ||
* ApplicationLauncherModule, | ||
* VerticalNavigationModule | ||
* } from 'patternfly-ng/navigation'; | ||
*/ | ||
@NgModule({ | ||
imports: [ | ||
BsDropdownModule.forRoot(), | ||
ApplicationLauncherModule, | ||
CommonModule, | ||
TooltipModule.forRoot() | ||
VerticalNavigationModule | ||
], | ||
declarations: [ ApplicationLauncherComponent, VerticalNavigationComponent], | ||
exports: [ ApplicationLauncherComponent, VerticalNavigationComponent], | ||
providers: [BsDropdownConfig, TooltipConfig, WindowReference] | ||
exports: [ ApplicationLauncherComponent, VerticalNavigationComponent] | ||
}) | ||
export class NavigationModule {} | ||
export class NavigationModule { | ||
constructor() { | ||
console.log('patternfly-ng: NavigationModule is deprecated; use ApplicationLauncherModule ' + | ||
'or VerticalNavigationModule'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/app/navigation/vertical-navigation/vertical-navigation-item.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { NavigationItemBase } from '../navigation-item-base'; | ||
|
||
/** | ||
* A config containing properties for vertical navigation items | ||
*/ | ||
export class VerticalNavigationItem extends NavigationItemBase { | ||
/** | ||
* Navigation children (used for secondary and tertiary navigation) | ||
*/ | ||
children?: VerticalNavigationItem[]; | ||
|
||
/** | ||
* Indicate if the item should be active on load | ||
*/ | ||
activeOnLoad?: boolean; | ||
|
||
/** | ||
* Track the active state of the navigation item | ||
*/ | ||
trackActiveState?: boolean; | ||
|
||
/** | ||
* Track the hover state of the navigation item | ||
*/ | ||
trackHoverState?: boolean; | ||
|
||
/** | ||
* Indicates if the child secondary menu is opened | ||
*/ | ||
secondaryCollapsed?: boolean; | ||
|
||
/** | ||
* Indicates if the child tertiary menu is opened | ||
*/ | ||
tertiaryCollapsed?: boolean; | ||
|
||
/** | ||
* Indicates if this is a mobile item | ||
*/ | ||
mobileItem?: boolean; | ||
|
||
/** | ||
* Internal variable used for hovering timeout | ||
*/ | ||
hoverTimeout?: any; | ||
|
||
/** | ||
* Internal variable used for blur timeout | ||
*/ | ||
blurTimeout?: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.