import { IMessageBusTopicSubscription } from "../../models"; import { TsxAllowUnknowProperties, WizardStyles } from ".."; export interface WizardStepModel { id: string; title: string; content: JSX.Element; beforeButtons?: () => JSX.Element[]; afterButtons?: () => JSX.Element[]; onGoToNext?: () => Promise; onGoToPrev?: () => Promise; } export interface WizardStateModel { hideStepsProgress: boolean; currentStepNumber: number; totalSteps: number; } export interface IWizardStep { /** * get back to previous step */ goBack: () => IWizardStep; /** * go next step */ goNext: () => IWizardStep; /** * hide a step progress */ hideStepProgress: () => IWizardStep; /** * show a step progress */ showStepProgress: () => IWizardStep; /** * register self step buttons. */ registerButtons: (afterButtons: () => JSX.Element[], beforeButtons: () => JSX.Element[]) => IWizardStep; /** * listen to when your step visible */ onStepVisible: () => IMessageBusTopicSubscription; /** * disable go next step */ disableNext: () => IWizardStep; /** * enable go next step */ enableNext: () => IWizardStep; /** * hide go next step */ hideNext: () => IWizardStep; /** * enable go next step */ showNext: () => IWizardStep; /** * disable go back step */ disableBack: () => IWizardStep; /** * enable go back step */ enableBack: () => IWizardStep; /** * hide go back step */ hideBack: () => IWizardStep; /** * enable go back step */ showBack: () => IWizardStep; } export interface IWizardInstance { /** * @param step the sequence of the steps to go to */ goTo(step: number): Promise; /** * get back to last step */ goBack(): Promise; /** * go next step */ goNext(): Promise; /** * get state of wizard */ getWizardState: () => T; /** * set state of wizard */ setWizardState: (state: WizardStateModel) => void; /** * add new step */ addStep: (step: WizardStepModel, position: number) => void; /** * add new steps */ addSteps: (steps: Array) => void; /** * remove a step */ removeSteps: (position: number, howmany?: number) => void; /** * register step instance. */ registerStepInstance: (stepId: string, instance: IWizardStepComponent) => IWizardStep; /** * get step instance. */ getStep: (stepId: string) => IWizardStep; /** * listen to wizard state changed */ onWizardStateChanged: () => IMessageBusTopicSubscription; } export interface IWizardStepComponent { wizard?: () => IWizardInstance; stepId: string; canGoNext?: () => Promise; } export interface IWizard { styles?: typeof WizardStyles; onInstanceCreated?: (instance: IWizardInstance) => void; steps: Array; defaultStepIndex?: number; horizontalMinHeight?: number; } declare global { namespace VueTsxSupport.JSX { interface Element { } interface ElementClass { } interface ElementAttributesProperty { } interface IntrinsicElements { "omfx-wizard": TsxAllowUnknowProperties; } } }