1 | import { Disposable, MaybePromise, CancellationTokenSource } from '../common';
|
2 | import { BaseWidget, Message } from './widgets';
|
3 | import { FrontendApplicationContribution } from './frontend-application';
|
4 | export declare class DialogProps {
|
5 | readonly title: string;
|
6 | |
7 |
|
8 |
|
9 |
|
10 | maxWidth?: number;
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | wordWrap?: 'normal' | 'break-word' | 'initial' | 'inherit';
|
20 | }
|
21 | export declare type DialogMode = 'open' | 'preview';
|
22 | export declare type DialogError = string | boolean | {
|
23 | message: string;
|
24 | result: boolean;
|
25 | };
|
26 | export declare namespace DialogError {
|
27 | function getResult(error: DialogError): boolean;
|
28 | function getMessage(error: DialogError): string;
|
29 | }
|
30 | export declare namespace Dialog {
|
31 | const YES: string;
|
32 | const NO: string;
|
33 | const OK: string;
|
34 | const CANCEL: string;
|
35 | }
|
36 | export declare class DialogOverlayService implements FrontendApplicationContribution {
|
37 | protected static INSTANCE: DialogOverlayService;
|
38 | static get(): DialogOverlayService;
|
39 | protected readonly dialogs: AbstractDialog<any>[];
|
40 | constructor();
|
41 | initialize(): void;
|
42 | protected get currentDialog(): AbstractDialog<any> | undefined;
|
43 | push(dialog: AbstractDialog<any>): Disposable;
|
44 | protected handleEscape(event: KeyboardEvent): boolean | void;
|
45 | protected handleEnter(event: KeyboardEvent): boolean | void;
|
46 | }
|
47 | export declare abstract class AbstractDialog<T> extends BaseWidget {
|
48 | protected readonly props: DialogProps;
|
49 | protected readonly titleNode: HTMLDivElement;
|
50 | protected readonly contentNode: HTMLDivElement;
|
51 | protected readonly closeCrossNode: HTMLElement;
|
52 | protected readonly controlPanel: HTMLDivElement;
|
53 | protected readonly errorMessageNode: HTMLDivElement;
|
54 | protected resolve: undefined | ((value: T | undefined) => void);
|
55 | protected reject: undefined | ((reason: any) => void);
|
56 | protected closeButton: HTMLButtonElement | undefined;
|
57 | protected acceptButton: HTMLButtonElement | undefined;
|
58 | protected activeElement: HTMLElement | undefined;
|
59 | constructor(props: DialogProps);
|
60 | protected appendCloseButton(text?: string): HTMLButtonElement;
|
61 | protected appendAcceptButton(text?: string): HTMLButtonElement;
|
62 | protected createButton(text: string): HTMLButtonElement;
|
63 | protected onAfterAttach(msg: Message): void;
|
64 | protected handleEscape(event: KeyboardEvent): boolean | void;
|
65 | protected handleEnter(event: KeyboardEvent): boolean | void;
|
66 | protected onActivateRequest(msg: Message): void;
|
67 | open(): Promise<T | undefined>;
|
68 | close(): void;
|
69 | protected onUpdateRequest(msg: Message): void;
|
70 | protected validateCancellationSource: CancellationTokenSource;
|
71 | protected validate(): Promise<void>;
|
72 | protected acceptCancellationSource: CancellationTokenSource;
|
73 | protected accept(): Promise<void>;
|
74 | abstract get value(): T;
|
75 | /**
|
76 | * Return a string of zero-length or true if valid.
|
77 | */
|
78 | protected isValid(value: T, mode: DialogMode): MaybePromise<DialogError>;
|
79 | protected setErrorMessage(error: DialogError): void;
|
80 | protected addAction<K extends keyof HTMLElementEventMap>(element: HTMLElement, callback: () => void, ...additionalEventTypes: K[]): void;
|
81 | protected addCloseAction<K extends keyof HTMLElementEventMap>(element: HTMLElement, ...additionalEventTypes: K[]): void;
|
82 | protected addAcceptAction<K extends keyof HTMLElementEventMap>(element: HTMLElement, ...additionalEventTypes: K[]): void;
|
83 | }
|
84 | export declare class ConfirmDialogProps extends DialogProps {
|
85 | readonly msg: string | HTMLElement;
|
86 | readonly cancel?: string;
|
87 | readonly ok?: string;
|
88 | }
|
89 | export declare class ConfirmDialog extends AbstractDialog<boolean> {
|
90 | protected readonly props: ConfirmDialogProps;
|
91 | protected confirmed: boolean;
|
92 | constructor(props: ConfirmDialogProps);
|
93 | protected onCloseRequest(msg: Message): void;
|
94 | get value(): boolean;
|
95 | protected createMessageNode(msg: string | HTMLElement): HTMLElement;
|
96 | }
|
97 | export declare function confirmExit(): Promise<boolean>;
|
98 | export declare class SingleTextInputDialogProps extends DialogProps {
|
99 | readonly confirmButtonLabel?: string;
|
100 | readonly initialValue?: string;
|
101 | readonly initialSelectionRange?: {
|
102 | start: number;
|
103 | end: number;
|
104 | direction?: 'forward' | 'backward' | 'none';
|
105 | };
|
106 | readonly validate?: (input: string, mode: DialogMode) => MaybePromise<DialogError>;
|
107 | }
|
108 | export declare class SingleTextInputDialog extends AbstractDialog<string> {
|
109 | protected props: SingleTextInputDialogProps;
|
110 | protected readonly inputField: HTMLInputElement;
|
111 | constructor(props: SingleTextInputDialogProps);
|
112 | get value(): string;
|
113 | protected isValid(value: string, mode: DialogMode): MaybePromise<DialogError>;
|
114 | protected onAfterAttach(msg: Message): void;
|
115 | protected onActivateRequest(msg: Message): void;
|
116 | protected handleEnter(event: KeyboardEvent): boolean | void;
|
117 | }
|
118 | //# sourceMappingURL=dialogs.d.ts.map |
\ | No newline at end of file |