UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

121 lines 4 kB
import { OnInit } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; import { AlertService } from '../alert/alert.service'; import { OptionsService } from '../common/options.service'; import { Permissions } from '../common/permissions.service'; import { AppStateService } from '../common/ui-state.service'; import { Steppers } from '../stepper/stepper.model'; import { StepperService } from '../stepper/stepper.service'; import { SetupState, SetupStep } from './setup.model'; import { SetupService } from './setup.service'; import * as i0 from "@angular/core"; /** * This component is the parent of each setup and can be injected * into setup steps to control them. */ export declare class SetupComponent implements OnInit { options: OptionsService; private stepperService; private appState; private alert; private permissions; private setupService; /** * A subject which can be used to exchange data between * steps. */ data$: BehaviorSubject<any>; /** * All current shown setup steps. */ steps: SetupStep[]; /** * The current state. SetupState.START shows an application overview * while SetupState.WIZARD shows the steps. */ currentSetupState: SetupState; /** * Emits when the setup is done. You can add certain operations before completing the setup that needed to be awaited. Return * true if everything is fine, otherwise false. * * ```typescript * const asyncOperation = delay(2000); * this.setup.completed$ = this.setup.completed$.pipe(asyncOperation, map(() => true)); * ``` * * Note: Remember that a step can be viewed multiple times. The step needs to ensure, to only add a completed operation ones. */ completed$: Observable<boolean>; /** * @ignore */ readonly stepperId = Steppers.SETUP; /** * @ignore */ setupState: typeof SetupState; /** * @ignore */ properties: any[]; /** * @ignore */ canSkip: boolean; /** * @ignore */ hasRole: boolean; /** * @ignore */ isOwner: boolean; private readonly RELOAD_APP_TIMEOUT; constructor(options: OptionsService, stepperService: StepperService, appState: AppStateService, alert: AlertService, permissions: Permissions, setupService: SetupService); /** * Mark a step as completed. If the step is required, this is needed to fulfill * the setup. * @param stepIndex The index of the step you want to mark as completed * @param isCompleted Defaults to true to mark it as completed but can be set to false to invalidate the step. */ stepCompleted(stepIndex: any, isCompleted?: boolean): void; /** * Returns a step by it index position in the wizard. * @param stepIndex The step index that you want to receive. * @returns An indexed step definition. */ getByIndex(stepIndex: any): SetupStep; /** * @ignore */ ngOnInit(): Promise<void>; /** * Skips the current setup wizard */ skip(): void; /** * Starts the wizards (or finish the setup if no steps are found) */ start(): void; /** * Cancels the wizards and goes back to the start view. */ cancel(): void; /** * Finish the wizard and will start the application. */ finish(): void; finalize(): Promise<void>; /** * Verifies every step and checks if all required are completed. * Updates the icons to reflect the state of the steps (error, warning, done). * @returns Returns true if no error was found. */ verify(): boolean; private reloadApp; private hasRequiredSteps; private getState; static ɵfac: i0.ɵɵFactoryDeclaration<SetupComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<SetupComponent, "c8y-setup", never, {}, {}, never, never, true, never>; } //# sourceMappingURL=setup.component.d.ts.map