UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

93 lines 3.71 kB
import { InjectionToken, Injector } from '@angular/core'; import { Router } from '@angular/router'; import { Observable } from 'rxjs'; import { ExtensionFactory, ExtensionPointForPlugins, GenericHookOptions, GenericHookType } from '../common/extension-hooks'; import { PluginsResolveService } from '../plugins/plugins-resolve.service'; import { NavigatorNode } from './navigator-node'; import { NavigatorNodeData } from './navigator-node-data'; import * as i0 from "@angular/core"; /** * An extension HOOK can use either a pure value: * ```typescript * { provide: HOOK_X, useValue: { ...hookValue }, multi: true } * ``` * * Or an array to directly register multiple: * ```typescript * { provide: HOOK_X, useValue: [{ ...hookValues }], multi: true } * ``` * * Or an ExtensionFactory which allows to define a get() function. This function * gets called on each navigation with the current route and can return values * async (observable or promise). * ```typescript * { provide: HOOK_X, useFactory: { get: (route) => doSomethingAsync(route) }, multi: true } * ``` */ type NavigatorExtension = NavigatorNode | NavigatorNode[] | ExtensionFactory<NavigatorNode>; /** * A hook to use for Multi Provider extension. * @deprecated Consider using the `hookNavigator` function instead. */ export declare const HOOK_NAVIGATOR_NODES: InjectionToken<NavigatorExtension[]>; /** * You can either provide a single `NavigatorNode` or `NavigatorNodeData` as parameter: * ```typescript * hookNavigator(...) * ``` * * Or an array to directly register multiple: * ```typescript * hookNavigator([...]) * ``` * * Or you provide an Service that implements `ExtensionFactory<NavigatorNode | NavigatorNodeData>` * ```typescript * export class MyNavigatorFactory implements ExtensionFactory<NavigatorNode | NavigatorNodeData> {...} * ... * hookNavigator(MyNavigatorFactory) * ``` * A typed alternative to `HOOK_NAVIGATOR_NODES`. * @param nodes The `NavigatorNode`'s, `NavigatorNodeData`'s or `ExtensionFactory` to be provided. * @returns An `Provider` to be provided in your module. */ export declare function hookNavigator(nodes: GenericHookType<NavigatorNode | NavigatorNodeData>, options?: Partial<GenericHookOptions>): import("@angular/core").ValueProvider | import("@angular/core").ExistingProvider | import("@angular/core").ClassProvider; /** * A service which defines the navigator. */ export declare class NavigatorService extends ExtensionPointForPlugins<NavigatorNode> { private router; /** * Indicates whether the menu entry associated with the given URL should be expanded. */ firstUrl: boolean; hasItemsInNavigator$: Observable<boolean>; constructor(rootInjector: Injector, router: Router, plugins: PluginsResolveService); /** * Returns the current state. * @readonly * @returns The current set of actions. */ get state(): Set<NavigatorNode>; /** * Adds a new node to the navigator. * @param {NavigatorNode} node Navigator node to add. */ add(node: NavigatorNode): void; /** * Removes a node from the navigator. * @param {NavigatorNode} node Navigator node to remove. */ remove(node: NavigatorNode): void; protected setupItemsObservable(): Observable<NavigatorNode[]>; /** * This will redirect on the inital navigation to '#/' to * the first node with a path and the highest priority. */ private redirectToFirstNode; private getFirstNodeWithPath; static ɵfac: i0.ɵɵFactoryDeclaration<NavigatorService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NavigatorService>; } export {}; //# sourceMappingURL=navigator.service.d.ts.map