1 | import { Dialog } from './dialog';
|
2 | /**
|
3 | * Namespace for input dialogs
|
4 | */
|
5 | export declare namespace InputDialog {
|
6 | /**
|
7 | * Common constructor options for input dialogs
|
8 | */
|
9 | interface IOptions {
|
10 | /**
|
11 | * The top level text for the dialog. Defaults to an empty string.
|
12 | */
|
13 | title: Dialog.Header;
|
14 | /**
|
15 | * The host element for the dialog. Defaults to `document.body`.
|
16 | */
|
17 | host?: HTMLElement;
|
18 | /**
|
19 | * Label of the requested input
|
20 | */
|
21 | label?: string;
|
22 | /**
|
23 | * An optional renderer for dialog items. Defaults to a shared
|
24 | * default renderer.
|
25 | */
|
26 | renderer?: Dialog.IRenderer;
|
27 | /**
|
28 | * Label for ok button.
|
29 | */
|
30 | okLabel?: string;
|
31 | /**
|
32 | * Label for cancel button.
|
33 | */
|
34 | cancelLabel?: string;
|
35 | }
|
36 | /**
|
37 | * Constructor options for boolean input dialogs
|
38 | */
|
39 | interface IBooleanOptions extends IOptions {
|
40 | /**
|
41 | * Default value
|
42 | */
|
43 | value?: boolean;
|
44 | }
|
45 | /**
|
46 | * Create and show a input dialog for a boolean.
|
47 | *
|
48 | * @param options - The dialog setup options.
|
49 | *
|
50 | * @returns A promise that resolves with whether the dialog was accepted
|
51 | */
|
52 | function getBoolean(options: IBooleanOptions): Promise<Dialog.IResult<boolean>>;
|
53 | /**
|
54 | * Constructor options for number input dialogs
|
55 | */
|
56 | interface INumberOptions extends IOptions {
|
57 | /**
|
58 | * Default value
|
59 | */
|
60 | value?: number;
|
61 | }
|
62 | /**
|
63 | * Create and show a input dialog for a number.
|
64 | *
|
65 | * @param options - The dialog setup options.
|
66 | *
|
67 | * @returns A promise that resolves with whether the dialog was accepted
|
68 | */
|
69 | function getNumber(options: INumberOptions): Promise<Dialog.IResult<number>>;
|
70 | /**
|
71 | * Constructor options for item selection input dialogs
|
72 | */
|
73 | interface IItemOptions extends IOptions {
|
74 | /**
|
75 | * List of choices
|
76 | */
|
77 | items: Array<string>;
|
78 | /**
|
79 | * Default choice
|
80 | *
|
81 | * If the list is editable a string with a default value can be provided
|
82 | * otherwise the index of the default choice should be given.
|
83 | */
|
84 | current?: number | string;
|
85 | /**
|
86 | * Is the item editable?
|
87 | */
|
88 | editable?: boolean;
|
89 | /**
|
90 | * Placeholder text for editable input
|
91 | */
|
92 | placeholder?: string;
|
93 | }
|
94 | /**
|
95 | * Create and show a input dialog for a choice.
|
96 | *
|
97 | * @param options - The dialog setup options.
|
98 | *
|
99 | * @returns A promise that resolves with whether the dialog was accepted
|
100 | */
|
101 | function getItem(options: IItemOptions): Promise<Dialog.IResult<string>>;
|
102 | /**
|
103 | * Constructor options for text input dialogs
|
104 | */
|
105 | interface ITextOptions extends IOptions {
|
106 | /**
|
107 | * Default input text
|
108 | */
|
109 | text?: string;
|
110 | /**
|
111 | * Placeholder text
|
112 | */
|
113 | placeholder?: string;
|
114 | }
|
115 | /**
|
116 | * Create and show a input dialog for a text.
|
117 | *
|
118 | * @param options - The dialog setup options.
|
119 | *
|
120 | * @returns A promise that resolves with whether the dialog was accepted
|
121 | */
|
122 | function getText(options: ITextOptions): Promise<Dialog.IResult<string>>;
|
123 | /**
|
124 | * Create and show a input dialog for a password.
|
125 | *
|
126 | * @param options - The dialog setup options.
|
127 | *
|
128 | * @returns A promise that resolves with whether the dialog was accepted
|
129 | */
|
130 | function getPassword(options: ITextOptions): Promise<Dialog.IResult<string>>;
|
131 | }
|