12.0.0 • Published 9 months ago

@k3imagine/sidebar-navigation v12.0.0

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

Imagine Sidebar Navigation Module

To implement the sidebar navigation module into an Angular project, you will need to: 1. Run npm i @k3imagine/sidebar-navigation, the package can be found here: https://www.npmjs.com/package/@k3imagine/sidebar-navigation 2. import { NavigationLibModule } from '@k3imagine/sidebar-navigation'; in the app.module.ts and the imports of the NgModule.

  1. import 'CUSTOM_ELEMENTS_SCHEMA'; into the app.module.ts if it isn't already there. schemas: [CUSTOM_ELEMENTS_SCHEMA],

  2. Call the component's HTML tag in the app.component.html file, with your <router-outlet> in between the <sidebar-navigation> tags and pass in values from your UI's environment variables, this allows the navigation library to make module calls to the correct gateway. As each UI's environment variables are set-up differently, the sidebar expects the apiRequestUrl and the portalUrl from the env. For the portalUrl I'd suggest only setting it if in a production environment. This ensures that the sidebar will remain on localhost and not route you to the module via the portal.

this.sidebarEnvironment = {
portalUrl: env.portalUrl,
apiRequestUrl: `${env.apiRequestUrl}api/v${env.apiVersion}`
};
<sidebar-navigation  [environment]="sidebarEnvironment" (selectedRoute)="routeToItem($event)">
<router-outlet></router-outlet>
</sidebar-navigation>

You will also need to include a routing function in the consuming module UI, this enables us to use each project's internal routers and router guards by passing back the selectedItem when the current module matches the selectedItem's parent module.

public routeToItem(selectedItem) {
  this.zone.run(() => this.router.navigate([selectedItem.url]));
}
  1. Optionally, you can include useCustomPage="true" which will remove the existing page-container and page-body wrappers which set margins and padding.

  2. In your angular.json, you need to configure the input of the library's assets as so:

{ "glob": "*/", "input": "./node_modules/@k3imagine/sidebar-navigation/lib/assets", "output": "/assets/" }

When passing in the environment variables, you can set the apiVersion to TEST in order to have a sidebar populated with mock data for immediate testing purposes.

Local Development

When adding new sidebar sidebarEntries/children, you will still need to configure the module UI's internal routing and components as normal, but also be sure to add the destination into your mock node server's date - this will allow you to see it on the sidebar and navigate to/from the new route.

Adding this new item to the module call will require a migration.

This project was generated with Angular CLI version 11.2.4.

12.0.0

9 months ago

12.0.0-rc.0

10 months ago

11.0.64

10 months ago

11.0.62

12 months ago

11.0.63

11 months ago

11.0.60

1 year ago

11.0.61

1 year ago

11.0.59

2 years ago

11.0.57

2 years ago

11.0.58

2 years ago

11.0.56

2 years ago

11.0.55

3 years ago

11.0.53

3 years ago

11.0.54

3 years ago

11.0.51

3 years ago

11.0.52

3 years ago

11.0.50

3 years ago

11.0.48

3 years ago

11.0.49

3 years ago

11.0.42

3 years ago

11.0.43

3 years ago

11.0.40

3 years ago

11.0.41

3 years ago

11.0.46

3 years ago

11.0.47

3 years ago

11.0.44

3 years ago

11.0.45

3 years ago

11.0.39

3 years ago

11.0.37

3 years ago

11.0.38

3 years ago

11.0.31

3 years ago

11.0.32

3 years ago

11.0.30

3 years ago

11.0.35

3 years ago

11.0.36

3 years ago

11.0.33

3 years ago

11.0.34

3 years ago

11.0.28

3 years ago

11.0.29

3 years ago

11.0.27

3 years ago

11.0.26

3 years ago

11.0.20

3 years ago

11.0.21

3 years ago

11.0.24

3 years ago

11.0.25

3 years ago

11.0.22

3 years ago

11.0.23

3 years ago

11.0.17

3 years ago

11.0.18

3 years ago

11.0.15

3 years ago

11.0.16

3 years ago

11.0.19

3 years ago

11.0.13

3 years ago

11.0.14

3 years ago

11.0.12

3 years ago

11.0.11

3 years ago

11.0.10

3 years ago

11.0.9

3 years ago

11.0.8

3 years ago

11.0.7

3 years ago

11.0.6

3 years ago

11.0.5

3 years ago

11.0.4

3 years ago