@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
78 lines • 3.13 kB
TypeScript
import { InjectionToken, Injector } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { ExtensionFactory, GenericHookType, ExtensionPointForPlugins, GenericHookOptions } from '../common/extension-hooks';
import { PluginsResolveService } from '../plugins/plugins-resolve.service';
import { Breadcrumb } from './breadcrumb.model';
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 }
* ```
*/
export type BreadcrumbExtension = Breadcrumb | Breadcrumb[] | ExtensionFactory<Breadcrumb>;
/**
* @deprecated Consider using the `hookBreadcrumb` function instead.
*/
export declare const HOOK_BREADCRUMB: InjectionToken<unknown>;
/**
* You can either provide a single `Breadcrumb` as parameter:
* ```typescript
* hookBreadcrumb(...)
* ```
*
* Or an array to directly register multiple:
* ```typescript
* hookBreadcrumb([...])
* ```
*
* Or you provide an Service that implements `ExtensionFactory<Breadcrumb>`
* ```typescript
* export class MyBreadcrumbFactory implements ExtensionFactory<Breadcrumb> {...}
* ...
* hookBreadcrumb(MyBreadcrumbFactory)
* ```
* A typed alternative to `HOOK_BREADCRUMB`.
* @param breadcrumb The `Breadcrumb`'s or `ExtensionFactory` to be provided.
* @returns An `Provider` to be provided in your module.
*/
export declare function hookBreadcrumb(breadcrumb: GenericHookType<Breadcrumb>, options?: Partial<GenericHookOptions>): import("@angular/core").ValueProvider | import("@angular/core").ExistingProvider | import("@angular/core").ClassProvider;
export declare class BreadcrumbService extends ExtensionPointForPlugins<Breadcrumb> {
private router;
private preferredPath;
constructor(rootInjector: Injector, router: Router, plugins: PluginsResolveService);
get state(): Set<Breadcrumb>;
/**
* Adds a new item to the action bar in the header.
* @param item The item to add.
*/
add(item: Breadcrumb): void;
/**
* Removes an action bar item from the header.
* @param item The item to remove.
*/
remove(item: Breadcrumb): void;
/**
* Sets the crumb that contains that path to the top.
* @param path The path to prefer.
*/
selectPreferredByPath(path: string): void;
sortByPreferredPath(breadcrumbs: any): any;
protected setupItemsObservable(): Observable<Breadcrumb[]>;
static ɵfac: i0.ɵɵFactoryDeclaration<BreadcrumbService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<BreadcrumbService>;
}
//# sourceMappingURL=breadcrumb.service.d.ts.map