UNPKG

angular-archwizard

Version:

An Angular 9+ module containing a wizard component and its supporting components and directives

87 lines (86 loc) 3.06 kB
import { EventEmitter } from '@angular/core'; import { StepId } from '../util/step-id.interface'; import { StepIndex } from '../util/step-index.interface'; import { StepOffset } from '../util/step-offset.interface'; import { WizardStep } from '../util/wizard-step.interface'; import { WizardComponent } from '../components/wizard.component'; /** * The `awGoToStep` directive can be used to navigate to a given step. * This step can be defined in one of multiple formats * * ### Syntax * * With absolute step index: * * ```html * <button [awGoToStep]="{ stepIndex: absolute step index }" (finalize)="finalize method">...</button> * ``` * * With unique step id: * * ```html * <button [awGoToStep]="{ stepId: 'step id of destination step' }" (finalize)="finalize method">...</button> * ``` * * With a wizard step object: * * ```html * <button [awGoToStep]="wizard step object" (finalize)="finalize method">...</button> * ``` * * With an offset to the defining step: * * ```html * <button [awGoToStep]="{ stepOffset: offset }" (finalize)="finalize method">...</button> * ``` * * @author Marc Arndt */ export declare class GoToStepDirective { private wizard; private wizardStep; /** * This [[EventEmitter]] is called directly before the current step is exited during a transition through a component with this directive. */ preFinalize: EventEmitter<void>; /** * This [[EventEmitter]] is called directly after the current step is exited during a transition through a component with this directive. */ postFinalize: EventEmitter<void>; /** * The destination step, to which the wizard should navigate, after the component, having this directive has been activated. * This destination step can be given either as a [[WizardStep]] containing the step directly, * a [[StepOffset]] between the current step and the `wizardStep`, in which this directive has been used, * or a step index as a number or string */ targetStep: WizardStep | StepOffset | StepIndex | StepId; /** * Constructor * * @param wizard The wizard component * @param wizardStep The wizard step, which contains this [[GoToStepDirective]] */ constructor(wizard: WizardComponent, wizardStep: WizardStep); /** * A convenience field for `preFinalize` */ get finalize(): EventEmitter<void>; /** * A convenience name for `preFinalize` * * @param emitter The [[EventEmitter]] to be set */ set finalize(emitter: EventEmitter<void>); /** * Returns the destination step of this directive as an absolute step index inside the wizard * * @returns The index of the destination step * @throws If `targetStep` is of an unknown type an `Error` is thrown */ get destinationStep(): number; /** * Listener method for `click` events on the component with this directive. * After this method is called the wizard will try to transition to the `destinationStep` */ onClick(): void; }