x4js 2.0.35 → 2.1.0-manual
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -21
- package/package.json +39 -26
- package/src/components/base.scss +25 -89
- package/src/components/boxes/boxes.module.scss +54 -54
- package/src/components/boxes/boxes.ts +513 -513
- package/src/components/breadcrumb/breadcrumb.scss +56 -56
- package/src/components/breadcrumb/breadcrumb.ts +93 -93
- package/src/components/btngroup/btngroup.module.scss +40 -40
- package/src/components/btngroup/btngroup.ts +152 -152
- package/src/components/button/button.module.scss +172 -172
- package/src/components/button/button.ts +232 -232
- package/src/components/calendar/calendar.module.scss +162 -162
- package/src/components/calendar/calendar.ts +326 -326
- package/src/components/canvas/canvas.module.scss +24 -24
- package/src/components/canvas/canvas.ts +195 -195
- package/src/components/canvas/canvas_ex.ts +275 -275
- package/src/components/checkbox/check.svg +3 -3
- package/src/components/checkbox/checkbox.module.scss +141 -141
- package/src/components/checkbox/checkbox.ts +139 -139
- package/src/components/colorinput/colorinput.module.scss +64 -64
- package/src/components/colorinput/colorinput.ts +90 -90
- package/src/components/colorpicker/colorpicker.module.scss +132 -132
- package/src/components/colorpicker/colorpicker.ts +481 -481
- package/src/components/combobox/combobox.module.scss +145 -145
- package/src/components/combobox/combobox.ts +282 -282
- package/src/components/combobox/updown.svg +3 -3
- package/src/components/components.ts +45 -44
- package/src/components/dialog/dialog.module.scss +103 -105
- package/src/components/dialog/dialog.ts +233 -233
- package/src/components/filedrop/filedrop.module.scss +69 -69
- package/src/components/filedrop/filedrop.ts +130 -130
- package/src/components/form/form.module.scss +38 -38
- package/src/components/form/form.ts +172 -172
- package/src/components/gridview/gridview.module.scss +323 -337
- package/src/components/gridview/gridview.ts +1276 -1316
- package/src/components/header/header.module.scss +40 -40
- package/src/components/header/header.ts +141 -141
- package/src/components/icon/icon.module.scss +32 -32
- package/src/components/icon/icon.ts +165 -165
- package/src/components/image/image.module.scss +27 -27
- package/src/components/image/image.ts +168 -168
- package/src/components/input/input.module.scss +74 -74
- package/src/components/input/input.ts +537 -537
- package/src/components/keyboard/keyboard.module.scss +136 -136
- package/src/components/keyboard/keyboard.ts +549 -549
- package/src/components/label/label.module.scss +90 -91
- package/src/components/label/label.ts +101 -101
- package/src/components/link/link.module.scss +44 -44
- package/src/components/link/link.ts +87 -87
- package/src/components/listbox/listbox.module.scss +179 -179
- package/src/components/listbox/listbox.ts +596 -596
- package/src/components/menu/menu.module.scss +128 -128
- package/src/components/menu/menu.ts +174 -174
- package/src/components/messages/messages.module.scss +92 -146
- package/src/components/messages/messages.ts +237 -303
- package/src/components/normalize.scss +391 -391
- package/src/components/notification/notification.module.scss +83 -83
- package/src/components/notification/notification.ts +107 -107
- package/src/components/panel/panel.module.scss +66 -71
- package/src/components/panel/panel.ts +57 -57
- package/src/components/popup/popup.module.scss +51 -51
- package/src/components/popup/popup.ts +457 -457
- package/src/components/progress/progress.module.scss +56 -56
- package/src/components/progress/progress.ts +43 -43
- package/src/components/propgrid/progrid.module.scss +111 -111
- package/src/components/propgrid/propgrid.ts +300 -300
- package/src/components/propgrid/updown.svg +3 -3
- package/src/components/radio/radio.module.scss +163 -163
- package/src/components/radio/radio.svg +3 -3
- package/src/components/radio/radio.ts +141 -141
- package/src/components/rating/rating.module.scss +22 -22
- package/src/components/rating/rating.ts +131 -131
- package/src/components/select/select.module.scss +8 -8
- package/src/components/select/select.ts +134 -134
- package/src/components/shared.scss +141 -71
- package/src/components/sizers/sizer.module.scss +90 -112
- package/src/components/sizers/sizer.ts +131 -155
- package/src/components/slider/slider.module.scss +117 -117
- package/src/components/slider/slider.ts +197 -197
- package/src/components/spreadsheet/spreadsheet.module.scss +307 -307
- package/src/components/spreadsheet/spreadsheet.ts +1223 -1223
- package/src/components/switch/switch.module.scss +126 -126
- package/src/components/switch/switch.ts +61 -61
- package/src/components/tabs/tabs.module.scss +46 -67
- package/src/components/tabs/tabs.ts +229 -234
- package/src/components/textarea/textarea.module.scss +63 -63
- package/src/components/textarea/textarea.ts +131 -131
- package/src/components/textedit/textedit.module.scss +115 -115
- package/src/components/textedit/textedit.ts +122 -122
- package/src/components/themes.scss +90 -90
- package/src/components/tickline/tickline.module.scss +25 -25
- package/src/components/tickline/tickline.ts +81 -81
- package/src/components/tooltips/tooltips.scss +71 -71
- package/src/components/tooltips/tooltips.ts +120 -120
- package/src/components/treeview/treeview.module.scss +192 -192
- package/src/components/treeview/treeview.ts +484 -484
- package/src/components/viewport/viewport.module.scss +31 -31
- package/src/components/viewport/viewport.ts +41 -41
- package/src/core/component.ts +1299 -1299
- package/src/core/core_application.ts +361 -361
- package/src/core/core_colors.ts +512 -512
- package/src/core/core_data.ts +1297 -1310
- package/src/core/core_dom.ts +481 -481
- package/src/core/core_dragdrop.ts +225 -225
- package/src/core/core_element.ts +221 -221
- package/src/core/core_events.ts +214 -214
- package/src/core/core_i18n.ts +395 -395
- package/src/core/core_pdf.ts +454 -454
- package/src/core/core_react.ts +78 -78
- package/src/core/core_router.ts +296 -296
- package/src/core/core_state.ts +62 -62
- package/src/core/core_styles.ts +213 -213
- package/src/core/core_svg.ts +1042 -1042
- package/src/core/core_tools.ts +996 -996
- package/src/types/scss.d.ts +4 -4
- package/src/types/x4react.d.ts +8 -8
- package/src/x4.scss +19 -19
- package/src/x4.ts +36 -36
- package/src/x4tsx.d.ts +26 -26
- package/.vscode/launch.json +0 -14
- package/.vscode/settings.json +0 -2
- package/demo/assets/house-light.svg +0 -1
- package/demo/assets/radio.svg +0 -4
- package/demo/index.html +0 -12
- package/demo/main.scss +0 -23
- package/demo/main.ts +0 -324
- package/demo/package.json +0 -26
- package/demo/scss.d.ts +0 -4
- package/demo/svg.d.ts +0 -1
- package/demo/tsconfig.json +0 -14
- package/src/components/gridview/folder-open.svg +0 -1
- package/src/components/messages/spinner.svg +0 -1
- package/src/x4.d.ts +0 -10
- package/tsconfig.json +0 -11
|
@@ -1,303 +1,237 @@
|
|
|
1
|
-
|
|
2
|
-
// :: MESSAGEBOX ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
3
|
-
|
|
4
|
-
import { _tr } from '../../core/core_i18n';
|
|
5
|
-
import { asap, class_ns,
|
|
6
|
-
|
|
7
|
-
import { HBox, VBox } from '../boxes/boxes';
|
|
8
|
-
import { Icon } from '../icon/icon';
|
|
9
|
-
import { Label
|
|
10
|
-
import { Dialog, DialogProps } from "../dialog/dialog"
|
|
11
|
-
import { Form } from '../form/form';
|
|
12
|
-
import { BtnGroupItem } from '../btngroup/btngroup';
|
|
13
|
-
import { Input } from '../input/input';
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
import "./
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
@class_ns( "x4" )
|
|
241
|
-
export class ProgressionBox extends Dialog {
|
|
242
|
-
|
|
243
|
-
#has_errors = false;
|
|
244
|
-
|
|
245
|
-
constructor( title: string ) {
|
|
246
|
-
super( {
|
|
247
|
-
modal: true,
|
|
248
|
-
title: null,
|
|
249
|
-
sizable: true,
|
|
250
|
-
movable: true,
|
|
251
|
-
form: new Form( {
|
|
252
|
-
content: [
|
|
253
|
-
new HBox( {
|
|
254
|
-
content: [
|
|
255
|
-
new Icon( { iconId: spinner }),
|
|
256
|
-
new VBox( { flex: 1, cls: "right", content: [
|
|
257
|
-
new SimpleText( { id: "title", text: title } ),
|
|
258
|
-
new Progress( { id:"prog", min: 0, max: 100, value: 0 } ),
|
|
259
|
-
new VBox( { id: "sub-text" } ),
|
|
260
|
-
]})
|
|
261
|
-
]
|
|
262
|
-
}),
|
|
263
|
-
]
|
|
264
|
-
}),
|
|
265
|
-
buttons: [ "ok.outline.default" ]
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
this.query("#btnbar").show( false );
|
|
269
|
-
|
|
270
|
-
this.on("btnclick", ( ) => this.show( false ) );
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
addText( text: string | UnsafeHtml, perc: number ) {
|
|
274
|
-
this.query<Label>( "#sub-text").appendContent( new SimpleText( { text } ) );
|
|
275
|
-
this.query<Progress>( "#prog").setValue( perc );
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
addError( text: string | UnsafeHtml, perc: number ) {
|
|
279
|
-
this.query<Label>( "#sub-text").appendContent( new SimpleText( { cls:"error", text } ) );
|
|
280
|
-
this.query<Progress>( "#prog").setValue( perc );
|
|
281
|
-
|
|
282
|
-
this.#has_errors = true;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
setText( text: string | UnsafeHtml, perc: number ) {
|
|
286
|
-
this.query<Label>( "#sub-text").setContent( new SimpleText( { text } ) );
|
|
287
|
-
this.query<Progress>( "#prog").setValue( perc );
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
clear( ) {
|
|
291
|
-
this.#has_errors = true;
|
|
292
|
-
this.query<Label>( "#sub-text").clearContent( );
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
done( ) {
|
|
296
|
-
if( this.#has_errors ) {
|
|
297
|
-
this.query("#btnbar").show( true );
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
this.setTimeout( "close", 5000, ( ) => { this.show(false);} );
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
1
|
+
|
|
2
|
+
// :: MESSAGEBOX ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
3
|
+
|
|
4
|
+
import { _tr } from '../../core/core_i18n';
|
|
5
|
+
import { asap, class_ns, UnsafeHtml } from '../../core/core_tools';
|
|
6
|
+
|
|
7
|
+
import { HBox, VBox } from '../boxes/boxes';
|
|
8
|
+
import { Icon } from '../icon/icon';
|
|
9
|
+
import { Label } from '../label/label';
|
|
10
|
+
import { Dialog, DialogProps } from "../dialog/dialog"
|
|
11
|
+
import { Form } from '../form/form';
|
|
12
|
+
import { BtnGroupItem } from '../btngroup/btngroup';
|
|
13
|
+
import { Input } from '../input/input';
|
|
14
|
+
|
|
15
|
+
import "./messages.module.scss";
|
|
16
|
+
|
|
17
|
+
import error_icon from "./circle-exclamation.svg";
|
|
18
|
+
import pen_icon from "./pen-field.svg";
|
|
19
|
+
import { Component } from '../../core/component';
|
|
20
|
+
|
|
21
|
+
export interface MessageBoxProps extends DialogProps {
|
|
22
|
+
message: string;
|
|
23
|
+
click: (button: string) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
@class_ns( "x4" )
|
|
31
|
+
export class MessageBox extends Dialog<DialogProps>
|
|
32
|
+
{
|
|
33
|
+
constructor(props: DialogProps) {
|
|
34
|
+
super(props);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
private static _create( msg: string | UnsafeHtml, buttons?: BtnGroupItem[], title?: string ) {
|
|
42
|
+
const box = new MessageBox({
|
|
43
|
+
modal: true,
|
|
44
|
+
title: title ?? _tr.global.error,
|
|
45
|
+
movable: true,
|
|
46
|
+
form: new Form( {
|
|
47
|
+
content: [
|
|
48
|
+
new HBox( {
|
|
49
|
+
content: [
|
|
50
|
+
new Icon( { iconId: error_icon }),
|
|
51
|
+
new Label( { text: msg } ),
|
|
52
|
+
]
|
|
53
|
+
}),
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
buttons: buttons ?? [ "ok.outline","cancel.outline" ]
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return box;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* display a messagebox
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
static show( msg: string | UnsafeHtml, buttons?: BtnGroupItem[], title?: string ): MessageBox {
|
|
67
|
+
|
|
68
|
+
const box = this._create( msg, buttons, title );
|
|
69
|
+
box.on( "btnclick", ( ev ) => {
|
|
70
|
+
asap( ( ) => {
|
|
71
|
+
box.close()
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
box.show();
|
|
76
|
+
return box;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* idem with promise
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
static async showAsync( msg: string | UnsafeHtml, buttons?: BtnGroupItem[], title?: string ) : Promise<string> {
|
|
84
|
+
|
|
85
|
+
return new Promise( (resolve, reject ) => {
|
|
86
|
+
const box = this._create( msg, buttons, title );
|
|
87
|
+
box.on( "btnclick", ( ev ) => {
|
|
88
|
+
asap( ( ) => {
|
|
89
|
+
resolve( ev.button );
|
|
90
|
+
box.close()
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
box.show();
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
interface InputOptions {
|
|
102
|
+
password?: boolean;
|
|
103
|
+
trim?: boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@class_ns( "x4" )
|
|
107
|
+
export class InputBox extends Dialog<DialogProps>
|
|
108
|
+
{
|
|
109
|
+
constructor(props: DialogProps) {
|
|
110
|
+
super(props);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
getValue( ) {
|
|
114
|
+
const input = this.query<Input>( "input" );
|
|
115
|
+
return input.getValue( );
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private static _create( msg: string | UnsafeHtml, value: string, title: string, options?: InputOptions ) {
|
|
119
|
+
|
|
120
|
+
options = {trim: true, password: false, ...options };
|
|
121
|
+
|
|
122
|
+
const box = new InputBox({
|
|
123
|
+
modal: true,
|
|
124
|
+
title,
|
|
125
|
+
movable: true,
|
|
126
|
+
form: new Form( {
|
|
127
|
+
content: [
|
|
128
|
+
new HBox( {
|
|
129
|
+
content: [
|
|
130
|
+
new Icon( { iconId: pen_icon }),
|
|
131
|
+
new VBox( { flex: 1, content: [
|
|
132
|
+
new Label( { text: msg } ),
|
|
133
|
+
new Input( { value, type: options.password ? "password" : "text", trim: options.trim } )
|
|
134
|
+
]})
|
|
135
|
+
]
|
|
136
|
+
}),
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
buttons: [ "ok.outline.default","cancel.outline" ]
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
return box;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* idem with promise
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
static async showAsync( msg: string | UnsafeHtml, value: string, title?: string, options?: InputOptions ) : Promise<string> {
|
|
150
|
+
|
|
151
|
+
return new Promise( (resolve, _reject ) => {
|
|
152
|
+
|
|
153
|
+
const box = this._create( msg, value, title, options );
|
|
154
|
+
|
|
155
|
+
box.on( "btnclick", ( ev ) => {
|
|
156
|
+
asap( ( ) => {
|
|
157
|
+
resolve( ev.button=="ok" ? box.getValue( ) : null );
|
|
158
|
+
box.close()
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
box.show();
|
|
163
|
+
} );
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@class_ns( "x4" )
|
|
171
|
+
export class PromptBox extends Dialog<DialogProps>
|
|
172
|
+
{
|
|
173
|
+
constructor(props: DialogProps) {
|
|
174
|
+
super(props);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private static _create( msg: string | UnsafeHtml, editor: Component, title: string ) {
|
|
178
|
+
const box = new PromptBox({
|
|
179
|
+
modal: true,
|
|
180
|
+
title,
|
|
181
|
+
movable: true,
|
|
182
|
+
form: new Form( {
|
|
183
|
+
content: [
|
|
184
|
+
new HBox( {
|
|
185
|
+
content: [
|
|
186
|
+
new Icon( { iconId: pen_icon }),
|
|
187
|
+
new VBox( { flex: 1, cls: "right", content: [
|
|
188
|
+
new Label( { text: msg } ),
|
|
189
|
+
editor
|
|
190
|
+
]})
|
|
191
|
+
]
|
|
192
|
+
}),
|
|
193
|
+
]
|
|
194
|
+
}),
|
|
195
|
+
buttons: [ "ok.outline.default","cancel.outline" ]
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
return box;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* idem with promise
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
static async showAsync( msg: string | UnsafeHtml, editor: Component, title?: string ) : Promise<string> {
|
|
206
|
+
|
|
207
|
+
return new Promise( (resolve ) => {
|
|
208
|
+
|
|
209
|
+
const box = this._create( msg, editor, title );
|
|
210
|
+
|
|
211
|
+
box.on( "btnclick", ( ev ) => {
|
|
212
|
+
asap( ( ) => {
|
|
213
|
+
resolve( ev.button );
|
|
214
|
+
box.close()
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
box.show();
|
|
219
|
+
} );
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
static show( msg: string | UnsafeHtml, editor: Component, title: string, callback: ( btn: string ) => boolean | Promise<boolean> | Promise<void> ) {
|
|
223
|
+
|
|
224
|
+
const box = this._create( msg, editor, title );
|
|
225
|
+
|
|
226
|
+
box.on( "btnclick", ( ev ) => {
|
|
227
|
+
asap( async ( ) => {
|
|
228
|
+
if( await callback( ev.button )!==false ) {
|
|
229
|
+
box.close()
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
box.show();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|