UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

148 lines (147 loc) 5.78 kB
import { Observable, ReplaySubject } from 'rxjs'; import { AppContextService } from '../../service/app-context.service'; import { BaseDialogComponent, DialogOptions, DialogResult } from './base-dialog.component'; import { ChoiceDialogOptions, ChoiceDialogResult } from './choice-dialog/choice-dialog.component'; import { ConfirmationDialogOptions, ConfirmationDialogResult } from './confirmation-dialog/confirmation-dialog.component'; import { ConfirmationListDialogOptions, ConfirmationListDialogResult } from './confirmation-list-dialog/confirmation-list-dialog.component'; import { MessageDialogOptions } from './message-dialog/message-dialog.component'; import * as i0 from "@angular/core"; export declare enum DialogChangeEvent { Show = 0, Hide = 1 } export interface DialogEvent { dialogId: string; changeEvent: DialogChangeEvent; } export declare class DialogService { private appContext; private parentDialogService?; commonIds: { choice: string; confirmation: string; confirmationList: string; message: string; notificationsPane: string; settings: string; help: string; userPane: string; manageAs: string; powerShellShowScript: string; credSSPConfirmation: string; userAlive: string; }; activeDialogsStack: BaseDialogComponent<DialogOptions, DialogResult>[]; private strings; private componentMap; private activeDialogResult; private dialogOrigins; private changedEventSubject; constructor(appContext: AppContextService, parentDialogService?: DialogService); /** * Gets the subject of notification changed event. */ get changed(): ReplaySubject<DialogEvent>; get currentDialogLevel(): number; private iFrameDialogCount; /** * Registers the dialog with the service. * * TOptions the type of the dialog options. * TResult the type of the dialog results. * @param id The unique identifier of the dialog. * @param component The dialog component. */ register<TOptions extends DialogOptions, TResult extends DialogResult>(id: string, component: BaseDialogComponent<TOptions, TResult>): void; /** * Unregisters the dialog with the service. * * @param id The unique identifier of the dialog. */ unregister(id: string): void; addIFrameDialog(): void; removeIFrameDialog(): void; /** * Shows the dialog. * * TOptions The type of the dialog options. * TResult The result of the dialog. * @param id The unique identifier of the dialog. * @param options The dialog options. */ show<TOptions extends DialogOptions, TResult extends DialogResult>(id: string, options: TOptions): Observable<TResult>; /** * Shows a message dialog with the given options * * @param options The dialog options. * @returns A subject that will be published one time with the dialog result * @deprecated Please use 'AppContextService.frame.showDialogMessage' on extensions. */ showMessage(options: MessageDialogOptions): Observable<DialogResult>; /** * Hide a message dialog. */ hideMessage(): void; /** * Shows a choice dialog with the given options. * * @param options The dialog options. * @returns A subject that will be published one time with the dialog result. */ showChoice(options: ChoiceDialogOptions): Observable<ChoiceDialogResult>; /** * Hide a choice dialog. */ hideChoice(): void; /** * Shows a confirmation dialog with the given options * * @param options The dialog options. * @returns A subject that will be published one time with the dialog result * @deprecated since 02/20/18. Please use 'AppContextService.frame.showDialogConfirmation' instead */ showConfirmation(options: ConfirmationDialogOptions): Observable<ConfirmationDialogResult>; /** * Hide a confirmation dialog. */ hideConfirmation(): void; /** * Shows a confirmation list dialog with the given options * * @param options The dialog options. * @returns A subject that will be published one time with the dialog result */ showConfirmationList(options: ConfirmationListDialogOptions): Observable<ConfirmationListDialogResult>; /** * Hide a confirmation list dialog. */ hideConfirmationList(): void; /** * Hides the dialog. * * TResult The type of the dialog result. * @param id The unique identifier of the dialog. * @param result The result of the dialog. */ hide<TResult extends DialogResult>(id: string, result?: TResult): void; /** * Send Rpc request to shell to add/remove overlay * @param overlay true: add, false: remove * @param id id of the dialog */ overlayOpen(overlay: boolean, id: string): void; /** * Handle clicking on dialog background in shell * @param dialogId id of dialog whose background was clicked */ overlayClicked(dialogId: string): boolean; /** * Resume focus back to the original element that shows the dialog. * @param id The id of dialog * @param delay If provided, delays resuming focus for a period of time in ms */ resumeFocus(id: string, delay?: number): void; emitDialogChangeEvent(dialogId: String, changeEvent: DialogChangeEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration<DialogService, [null, { optional: true; skipSelf: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<DialogService>; }