@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
82 lines • 3.66 kB
TypeScript
import { EventEmitter, InjectionToken, Injector, Type } from '@angular/core';
import { ExtensionFactory, GenericHookType, GenericHookOptions } from '../common/extension-hooks';
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';
/**
* A hook to add wizard entries.
* @deprecated Consider using the `hookWizard` function instead.
*/
export declare const HOOK_WIZARD: InjectionToken<WizardExtension[]>;
/**
* A hook to add wizard entries.
*
* You can either provide a single `WizardEntry` as parameter:
* ```typescript
* hookWizard(...)
* ```
*
* Or an array to directly register multiple:
* ```typescript
* hookWizard([...])
* ```
*
* Or you provide an Service that implements `ExtensionFactory<WizardEntry>`
* ```typescript
* export class MyWizardFactory implements ExtensionFactory<WizardEntry> {...}
* ...
* hookWizard(MyWizardFactory)
* ```
* A typed alternative to `HOOK_WIZARD`.
* @param wizard The `WizardEntry`'s or `ExtensionFactory` to be provided.
* @returns An `Provider` to be provided in your module.
*/
export declare function hookWizard(wizard: GenericHookType<WizardEntry>, options?: Partial<GenericHookOptions>): import("@angular/core").ValueProvider | import("@angular/core").ExistingProvider | import("@angular/core").ClassProvider;
export interface Wizard<T = any> {
/**
* The id parameter identifies the particular wizard and can be used to refer to it when hooking wizard entries.
* Example: "wizardId".
*/
id: string;
/** Wizard configuration object. */
wizardConfig?: WizardConfig;
/** A state that will be assigned to the actual component contained by the wizard. */
componentInitialState?: Partial<T>;
/** The event that is emitted when the wizard entry is selected. */
onSelect?: EventEmitter<WizardEntry>;
/** The event that is emitted when the wizard is closed. */
onClose?: EventEmitter<any>;
/** The event that is emitted when the wizard is reset. */
onReset?: EventEmitter<any>;
}
export interface WizardConfig {
/** Text that will be displayed in the header of the wizard */
headerText?: string;
/** Icon that will be displayed in the header of the wizard */
headerIcon?: SupportedIconsSuggestions;
/** Text that will be displayed in the header of the wizard body section */
bodyHeaderText?: string;
/** Icon that will be displayed in the header of the wizard body section */
bodyHeaderIcon?: SupportedIconsSuggestions;
}
/**
* A single item in the wizard.
* An interface describing the entry displayed in the first step of the wizard as well as the configuration of the second step and their way of interaction.
*/
export interface WizardEntry {
/**
* The identifier of a wizard to which the entry will be hooked.
* Example: "wizardId".
*/
wizardId: string;
/** The name that will be displayed in the wizard menu */
name: string;
/** The path where user will be redirected when this entry is selected in the wizard's menu. Takes precedence over `component` property. */
path?: string;
/** The component that will be rendered when this entry is selected in the wizard's menu. If `path` is provided, the `component` will be ignored. */
component?: Type<any>;
/** The injector to use. If not set, default injector will be used. */
injector?: Injector;
/** The icon that will be shown in the wizard menu next to the item. */
c8yIcon?: SupportedIconsSuggestions;
}
export type WizardExtension = WizardEntry | WizardEntry[] | ExtensionFactory<WizardEntry>;
//# sourceMappingURL=wizard.model.d.ts.map