@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
111 lines • 3.31 kB
TypeScript
import { InjectionToken, Injector, Type } from '@angular/core';
import { ExtensionFactory, GenericHookType } from '../common/extension-hooks';
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
/**
* 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 DocLinkExtension = DocLink | DocLink[] | ExtensionFactory<DocLink>;
export declare const HOOK_DOCS: InjectionToken<DocLinkExtension[]>;
/**
* You can either provide a single `DocLink` as parameter:
* ```typescript
* hookOptions(...)
* ```
*
* Or an array to directly register multiple:
* ```typescript
* hookOptions([...])
* ```
*
* Or you provide an Service that implements `ExtensionFactory<DocLink>`
* ```typescript
* @Injectable({ providedIn: 'root' })
* export class MyDocLinkFactory implements ExtensionFactory<DocLink> {...}
* ...
* hookOptions(MyDocLinkFactory)
* ```
* A typed alternative to `HOOK_DOCS`.
* @param doc The `DocLink`'s or `ExtensionFactory` to be provided.
* @returns An `Provider` to be provided in your module.
*/
export declare function hookDocs(doc: GenericHookType<DocLink>): import("@angular/core").ValueProvider | import("@angular/core").ExistingProvider | import("@angular/core").ClassProvider;
/**
* A link on the right drawer.
*/
export type DocLink = DocLinkWithComponent | DocLinkWithLabel;
interface DocLinkBasic {
/**
* Doc is shown under Help & Support. Quicklink is displayed bigger and shown at the top.
*/
type: 'doc' | 'quicklink';
/**
* Used for ordering the links.
*/
priority?: number;
/**
* Specifies the target of the link.
* - If null, the link opens in the same tab.
* - If '_blank', the link opens in a new tab.
*/
target?: string;
}
export interface DocLinkWithComponent extends DocLinkBasic {
/**
* A component to render.
*/
component: Type<any>;
/**
* A injector to use. If none is set the default root one is used.
*/
injector?: Injector;
icon?: never;
iconSrc?: never;
label?: never;
url?: never;
/**
@deprecated pass a `url` instead
*/
click?: never;
}
export interface DocLinkWithLabel extends DocLinkBasic {
/**
* The (css) icon to display.
*/
icon: SupportedIconsSuggestions;
/**
* An alternative image-path as icon.
*/
iconSrc?: string;
/**
* A label to display.
*/
label: string;
/**
* A url where the link naviagates to.
*/
url: string;
/**
* A handler which is called if the DocLink is clicked.
* @deprecated pass a `url` instead
*/
click?: any;
component?: never;
injector?: never;
}
export {};
//# sourceMappingURL=docs.models.d.ts.map