@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
90 lines • 3.42 kB
TypeScript
import { InjectionToken, Injector } from '@angular/core';
import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { ExtensionFactory, GenericHookType, ExtensionPointForPlugins, GenericHookOptions } from '../common/extension-hooks';
import { PluginsResolveService } from '../plugins/plugins-resolve.service';
import { Step } from './stepper.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 StepperExtension = Step | Step[] | ExtensionFactory<Step>;
/**
* A hook to use for Multi Provider extension.
* @deprecated Consider using the `hookStepper` function instead.
*/
export declare const HOOK_STEPPER: InjectionToken<StepperExtension[]>;
/**
* You can either provide a single `Step` as parameter:
* ```typescript
* hookStepper(...)
* ```
*
* Or an array to directly register multiple:
* ```typescript
* hookStepper([...])
* ```
*
* Or you provide an Service that implements `ExtensionFactory<Step>`
* ```typescript
* export class MyStepFactory implements ExtensionFactory<Step> {...}
* ...
* hookStepper(MyStepFactory)
* ```
* A typed alternative to `HOOK_STEPPER`.
* @param step The `Step`'s or `ExtensionFactory` to be provided.
* @returns An `Provider` to be provided in your module.
*/
export declare function hookStepper(step: GenericHookType<Step>, options?: Partial<GenericHookOptions>): import("@angular/core").ValueProvider | import("@angular/core").ExistingProvider | import("@angular/core").ClassProvider;
/**
* A service which defines the steps in a stepper component.
* A stepper hook needs an certain outlet which has an matching id
* to display the steps.
*/
export declare class StepperService extends ExtensionPointForPlugins<Step> {
private router;
private translateService;
constructor(rootInjector: Injector, router: Router, translateService: TranslateService, plugins: PluginsResolveService);
sortSteps(steps: Step[]): Step[];
/**
* Returns the current state.
* @readonly
* @returns The current set of actions.
*/
get state(): Set<Step>;
/**
* Adds a new item to tabs and emits state change
* @param item The item to add.
*/
add(item: Step): void;
/**
* Removes a step and emits a state change.
* @param item The item to remove.
*/
remove(item: Step): void;
/**
* Returns the component by it's asssigned stepper id as an observable.
* @param id The id of the stepper to hook into.
*/
getById$(id: any): Observable<Step[]>;
protected setupItemsObservable(): Observable<Step[]>;
static ɵfac: i0.ɵɵFactoryDeclaration<StepperService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<StepperService>;
}
//# sourceMappingURL=stepper.service.d.ts.map