@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
408 lines (407 loc) • 13.8 kB
TypeScript
import { ChangeDetectorRef, ComponentFactoryResolver, ElementRef, EventEmitter, Injector, OnInit } from '@angular/core';
import { Strings } from '../../generated/Strings';
import { AppContextService } from '../../service/app-context.service';
import { BannerItem } from '../banner';
import { DynamicComponentBase } from '../common/dynamic.component';
import { Layout } from '../common/layout';
import { SmeHeaderData } from '../header/header.component';
import { PageAlert } from '../page-alert-bar/models/page-alert';
import { WizardModel } from './models/wizard-model';
import { WizardNavigationInterface } from './models/wizard-navigation-interface';
import { WizardStage } from './models/wizard-stage';
import { WizardStep } from './models/wizard-step';
import { WizardStepChangedEvent } from './models/wizard-step-changed-event';
import { WizardStepValidation } from './models/wizard-step-validation';
import { WizardBuilder } from './wizard-builder';
import { WizardNavigationInformation } from './wizard-navigation-information';
import { GenericWizardStepComponent } from './wizard-step/wizard-step.component';
import * as i0 from "@angular/core";
/**
* Whatever state the wizard is in
*/
declare enum WizardState {
Exit = "Exit",
Entry = "Entry",
Finished = "Finished",
Active = "Active"
}
/**
* Data to collect in wizard
*/
declare class WizardTelemetryData {
stepIndexNumber: string;
stepName: string;
stepIndexStartTime: string;
entryPoint?: string;
wizardType?: string;
wizardId?: string;
state?: WizardState;
}
/**
* @smeDoc {@label Wizard @id sme-wizard}
*
* @overview
* @file {@filepath ./examples/overview.md}
*
* @example {@label Example Wizard @id simple-wizard}
* @file {@filename component.html @filepath ./examples/wizard-example.component.html}
* @file {@filename component.ts @filepath ./examples/wizard-example.component.ts}
* @file {@filename data-model.ts @filepath ./examples/example-model.ts}
* @file {@filename finish-component.ts @filepath ./examples/finish.component.ts}
* @file {@filename finish-component.html @filepath ./examples/finish.component.html}
* @file {@filename simple-static-text.html @filepath ./examples/simple-static-text.component.html}
* @file {@filename simple-static-text.ts @filepath ./examples/simple-static-text.ts}
* @file {@filename simple-text-input.component.html @filepath ./examples/simple-text-input.component.html}
* @file {@filename simple-text-input.component.ts @filepath ./examples/simple-text-input.component.ts}
*/
/**
* The component class definition for the wizard component.
*/
export declare class WizardComponent<TModel extends WizardModel> extends DynamicComponentBase<GenericWizardStepComponent<TModel>> implements Layout, OnInit, WizardNavigationInterface {
hostElement: ElementRef;
private appContext;
private changeDetectorRef;
/**
* Sets the data model for sharing data across the wizard.
*/
set model(value: TModel);
/**
* Gets the data model for sharing data across the wizard.
*/
get model(): TModel;
/**
* The backing store for the model property
*/
private internalModel;
/**
* Internal copy of model to rollback to when the
* current step is skipped.
*/
private currentStepModelCopy;
/**
* The wizardBuilder used to instantiate the key wizard properties.
*/
wizardBuilder: WizardBuilder;
/**
* The stages of the wizard.
*/
stages: WizardStage[];
/**
* The banner items in the wizard.
*/
bannerItems: BannerItem[];
/**
* Indicates whether to show wizard banner.
*/
showWizardBanner: boolean;
/**
* The heading of the wizard.
*/
heading: string;
/**
* The header object.
*/
headerData: SmeHeaderData;
/**
* The title of the exit button.
*/
exitButtonTitle: string;
/**
* The title of the finish button.
*/
finishButtonTitle: string;
/**
* The finish view of the wizard.
*/
finishView: WizardStep;
/**
* Whether the steps list side pane will be visible.
*/
hideStepsListSidePane: boolean;
/**
* Whether a confirmation dialog will be shown upon 'Exit' clicked.
*/
showExitConfirmationDialog: boolean;
/**
* Whether the application is in preview.
*/
isInPreview: boolean;
/**
* Whether the wizard can navigate to a previous step.
*/
canNavigateToPreviousStep: boolean;
/**
* Telemetry data collected while navigating through wizard. By default, start at 1.1 step index and
* Entry state.
* Keep same format as telemetry event timestamp
*/
telemetryData: WizardTelemetryData;
wizardFooter: ElementRef;
/**
* Occurs when the wizard model changes
*/
readonly modelChange: EventEmitter<TModel>;
/**
* Occurs when the wizard is exited.
*/
readonly exit: EventEmitter<void>;
/**
* Occurs whenever a step is submitted.
*/
readonly stepSubmitted: EventEmitter<void>;
/**
* Occurs whenever a step index is changed.
*/
readonly stepChanged: EventEmitter<WizardStepChangedEvent>;
/**
* Occurs whenever step validation fails
*/
readonly stepInvalidated: EventEmitter<WizardStepValidation>;
/**
* Occurs when the wizard is finished
*/
readonly finished: EventEmitter<void>;
/**
* It implements the ILayout interface. It's triggered when the layout is changed.
* It's used to tell the child components to coordinate with the layout change.
*/
layoutChanged: EventEmitter<void>;
/**
* Implementation of the Layout interface
*/
windowBreakpointChanged: EventEmitter<void>;
/**
* Resource strings for the component.
*/
strings: Strings;
/**
* Whether or not the wizard is validating input.
*/
validating: boolean;
/**
* Whether or not all of the wizard's steps are complete & 'Finish' is clicked.
*/
wizardIsFinished: boolean;
/**
* Wizard navigation information.
*/
navigationInformation: WizardNavigationInformation;
/**
* It dynamically check if any of the header step content will fail to render.
*/
shouldRenderTextOnSteps: boolean;
/**
* The alert for a disabled step.
*/
alert: PageAlert;
/**
* Side pane toggle state
*/
isExpanded: boolean;
/**
* The index of the current step.
*/
private index;
/**
* The index of the current stage.
*/
private stageIndex;
/**
* The rxjs lifetime manager for the current step.
*/
private currentStepRxjsLifetime;
/**
* The window responsive manager for the wizard control.
*/
private wizardResponsiveWindowManager;
/**
* Whether an exit button will be shown throughout the wizard.
*/
get showExitButton(): boolean;
/**
* Initializes a new instance of the WizardComponent class.
* @param appContext - The application context service class.
* @param changeDetectorRef - The change detector.
* @param componentFactoryResolver - The component factory resolver.
*/
constructor(injector: Injector, hostElement: ElementRef, appContext: AppContextService, changeDetectorRef: ChangeDetectorRef, componentFactoryResolver: ComponentFactoryResolver, layout: Layout);
/**
* Create and return the current telemetry event structure for wizard telemetry. This can be used for any automatic
* actions not triggered by a DOM interaction.
*/
get wizardTelemetryEventBlob(): any;
/**
* Gets the index of the current stage of the wizard.
*/
get stagesArrayIndex(): number;
/**
* Gets the index of the current step of the wizard.
*/
get stepIndex(): number;
/**
* Gets the current stage of the wizard.
*/
get currentStage(): WizardStage;
/**
* Gets the current step of the wizard.
*/
get currentStep(): WizardStep;
/**
* Gets the finish view of the wizard.
*/
get finishStep(): WizardStep;
/**
* Gets the current steps for the current stage.
*/
getStepsForStage(): WizardStep[];
/**
* Gets the dynamically rendered component of the current step.
*/
get currentStepComponent(): GenericWizardStepComponent<TModel>;
get onLastStepOfStage(): boolean;
get onLastStage(): boolean;
get onLastStepOfLastStage(): boolean;
deferredOnLayoutChanged(): void;
onLayoutChanged(): void;
/**
* The on window breakpoint changed handler.
* Adding yield for component to get ElementRef after initialization.
*/
onWindowBreakpointChanged(): void;
stageIndexDisabled(stage: WizardStage, index: number): boolean;
stepIndexDisabled(step: WizardStep, index: number): boolean;
/**
* Gets the text for the next button.
*/
nextButtonText(): string;
/**
* Gets the text for the exit/finish button.
*/
exitButtonText(): string;
/**
* Gets the disabled state of the wizard buttons
*/
get disableBackButton(): boolean;
get disableNextButton(): boolean;
get showSkipButton(): boolean;
/**
* Sets the index of the current step of the wizard.
*/
set stepIndex(value: number);
/**
* Sets the index of the current stage of the wizard.
*/
set stagesArrayIndex(value: number);
/**
* Marks the current stage of the wizard as complete.
*
* @returns True if the stage was completed and false if not.
*/
completeCurrentStage(): boolean;
/**
* Marks the current step of the wizard as complete.
*
* @returns True if the step was completed and false if not.
*/
completeCurrentStep(): boolean;
/**
* Marks the current step of the wizard as incomplete.
*
* @returns True if the step was failed and false if not.
*/
failCurrentStep(): boolean;
/**
* Moves the wizard to the next visible step in the list.
*/
moveToNextStep(): void;
/**
* Handles the indexing for moving to the next step.
*/
navigateToNextStep(): void;
/**
* Moves the wizard to the previous (visible) step in the list.
*/
moveToPreviousStep(): void;
/**
* Handles the indexing for moving back to last step.
*/
navigateToPreviousStep(): void;
/**
* The method that focuses on an active step or stage
*/
private focusOnActiveStep;
/**
* The method to run when the component is initialized.
*/
ngOnInit(): void;
/**
* Open or close side pane
*/
togglePane(): void;
/**
* The method called when the back button is clicked.
*/
onBackClick(): void;
/**
* The method called when the skip button is clicked.
*/
onSkipClick(): void;
/**
* The method called when the Exit / Finish button is clicked.
*/
onExitClick(): void;
/**
* The method that handles completion of the wizard,
* and renders the finishView if provided.
*/
private handleFinishNavigation;
/**
* The method called when the next button is clicked.
*/
onNextClick(): void;
/**
* The method that validates step.
*/
private runStepValidation;
/**
* The method that handles indexes and
* step and stage completion for the Next button.
*/
private handleNextNavigation;
private showPreviousStepDialog;
private showDialogIfBusyOrJustComplete;
/**
* The method called when a stage is clicked.
*
* @param clickedStepIndex - The index of the clicked stage.
*/
onStageClick(clickedStageIndex: number): void;
/**
* The method called when a step is clicked.
*
* @param clickedStepIndex - The index of the clicked step.
*/
onStepClick(clickedStepIndex: number): void;
protected createComponent(): void;
protected cleanComponent(): void;
/**
* Saves the state of the model at the beginning
* of the current step.
*/
private preserveModelForCurrentStep;
/**
* Resets the model back to the state at the
* beginning of the current step.
*/
private restoreModelForCurrentStep;
private emitStepChanged;
/**
* Update telemetry string used to populate telemetry action events. Updates wizard state, step index, and time step index started.
* Step index start time should be used together with event timestamp to more easily calculate time spent in stage.
* @param state The state to change to, if provided.
*/
private updateTelemetryTags;
static ɵfac: i0.ɵɵFactoryDeclaration<WizardComponent<any>, [null, null, null, null, null, { optional: true; skipSelf: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<WizardComponent<any>, "sme-wizard", never, { "model": "model"; "wizardBuilder": "wizardBuilder"; "showWizardBanner": "showWizardBanner"; }, { "modelChange": "modelChange"; "exit": "exit"; "stepSubmitted": "stepSubmitted"; "stepChanged": "stepChanged"; "stepInvalidated": "stepInvalidated"; "finished": "finished"; "layoutChanged": "layoutChanged"; "windowBreakpointChanged": "windowBreakpointChanged"; }, never, never, false, never>;
}
export {};