x4js 2.3.24 → 2.3.26
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/aicontext.md +101 -17
- package/aiguide.md +64 -15
- package/package.json +1 -1
- package/src/components/assets/icons.ts +2 -0
- package/src/components/autocomplete/autocomplete.ts +2 -2
- package/src/components/boxes/boxes.module.scss +16 -2
- package/src/components/boxes/boxes.ts +24 -11
- package/src/components/breadcrumb/breadcrumb.ts +1 -2
- package/src/components/btngroup/btngroup.ts +2 -2
- package/src/components/button/button.ts +7 -2
- package/src/components/calendar/calendar.ts +4 -2
- package/src/components/canvas/canvas.ts +1 -2
- package/src/components/chart/chart.ts +3 -3
- package/src/components/checkbox/checkbox.ts +2 -2
- package/src/components/colorinput/colorinput.ts +3 -2
- package/src/components/colorpicker/colorpicker.ts +5 -5
- package/src/components/combobox/combobox.ts +3 -3
- package/src/components/dialog/dialog.ts +8 -2
- package/src/components/dockingview/dockingview.ts +1 -2
- package/src/components/filedrop/filedrop.ts +3 -2
- package/src/components/form/form.module.scss +2 -1
- package/src/components/form/form.ts +7 -3
- package/src/components/gauge/gauge.ts +2 -2
- package/src/components/gridview/gridview.module.scss +8 -5
- package/src/components/gridview/gridview.ts +11 -13
- package/src/components/header/header.ts +2 -2
- package/src/components/icon/icon.ts +1 -2
- package/src/components/image/image.ts +1 -2
- package/src/components/input/input.ts +3 -2
- package/src/components/keyboard/keyboard.ts +2 -2
- package/src/components/label/label.ts +3 -3
- package/src/components/link/link.ts +3 -2
- package/src/components/listbox/listbox.module.scss +59 -2
- package/src/components/listbox/listbox.ts +133 -23
- package/src/components/menu/menu.ts +5 -4
- package/src/components/messages/messages.module.scss +95 -3
- package/src/components/messages/messages.ts +113 -27
- package/src/components/notification/notification.ts +6 -6
- package/src/components/panel/panel.ts +2 -2
- package/src/components/popup/popup.ts +17 -2
- package/src/components/progress/progress.ts +1 -2
- package/src/components/propgrid/progrid.module.scss +2 -3
- package/src/components/propgrid/propgrid.ts +32 -38
- package/src/components/radio/radio.ts +1 -2
- package/src/components/rating/rating.ts +2 -2
- package/src/components/select/select.ts +2 -2
- package/src/components/settingsview/settingsview.module.scss +6 -5
- package/src/components/settingsview/settingsview.ts +3 -3
- package/src/components/sizers/sizer.ts +21 -29
- package/src/components/slider/slider.ts +2 -2
- package/src/components/spreadsheet/spreadsheet.ts +8 -10
- package/src/components/switch/switch.ts +2 -2
- package/src/components/tabs/tabs.ts +4 -4
- package/src/components/tag/tag.ts +2 -2
- package/src/components/textarea/textarea.ts +3 -3
- package/src/components/textedit/textedit.ts +2 -2
- package/src/components/themes.scss +2 -0
- package/src/components/tickline/tickline.ts +3 -3
- package/src/components/tooltips/tooltips.ts +11 -2
- package/src/components/treeview/treeview.ts +3 -3
- package/src/components/video/video.ts +1 -2
- package/src/components/viewport/viewport.ts +4 -3
- package/src/core/component.ts +15 -24
- package/src/core/core_application.ts +36 -3
- package/src/core/core_events.ts +14 -2
- package/src/core/core_i18n.ts +67 -0
- package/src/core/core_svg.ts +1 -0
- package/src/core/core_tools.ts +83 -24
|
@@ -34,6 +34,13 @@
|
|
|
34
34
|
|
|
35
35
|
--listbox-title-background: var( --background-primary );
|
|
36
36
|
--listbox-title-color: var( --text-primary );
|
|
37
|
+
|
|
38
|
+
--listbox-check-border: var( --border );
|
|
39
|
+
--listbox-check-border-hover: var( --border-hover );
|
|
40
|
+
--listbox-check-border-sel: var( --accent-color );
|
|
41
|
+
--listbox-check-background: var( --accent-background );
|
|
42
|
+
--listbox-check-background-disabled: var( --disabled-background );
|
|
43
|
+
--listbox-check-color: var( --accent-color );
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
.x4listbox {
|
|
@@ -50,6 +57,11 @@
|
|
|
50
57
|
padding: 0 4px;
|
|
51
58
|
}
|
|
52
59
|
|
|
60
|
+
// the columns start after the case
|
|
61
|
+
&.checkable>.x4header {
|
|
62
|
+
padding-left: calc( 4px + 6px + 1rem );
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
&>.title {
|
|
54
66
|
background: var( --listbox-title-background );
|
|
55
67
|
padding: 4px;
|
|
@@ -129,9 +141,49 @@
|
|
|
129
141
|
}
|
|
130
142
|
}
|
|
131
143
|
|
|
144
|
+
// checkable: the case at the start of the line
|
|
145
|
+
&>.x4check {
|
|
146
|
+
flex: none;
|
|
147
|
+
display: inline-flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
align-self: center;
|
|
151
|
+
vertical-align: middle;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
width: 1rem;
|
|
154
|
+
height: 1rem;
|
|
155
|
+
margin-left: 6px;
|
|
156
|
+
border: 1px solid var( --listbox-check-border );
|
|
157
|
+
color: var( --listbox-check-color );
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
|
|
160
|
+
svg {
|
|
161
|
+
width: 70%;
|
|
162
|
+
height: 70%;
|
|
163
|
+
visibility: hidden;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&:hover {
|
|
167
|
+
border-color: var( --listbox-check-border-hover );
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&.checked>.x4check {
|
|
172
|
+
background-color: var( --listbox-check-background );
|
|
173
|
+
border-color: var( --listbox-check-background );
|
|
174
|
+
|
|
175
|
+
svg {
|
|
176
|
+
visibility: visible;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&.selected>.x4check {
|
|
181
|
+
border-color: var( --listbox-check-border-sel );
|
|
182
|
+
}
|
|
183
|
+
|
|
132
184
|
.column {
|
|
133
|
-
background-color: transparent;
|
|
134
|
-
overflow: hidden;
|
|
185
|
+
background-color: transparent;
|
|
186
|
+
overflow: hidden;
|
|
135
187
|
}
|
|
136
188
|
|
|
137
189
|
// 10 columns max (see Header)
|
|
@@ -232,6 +284,11 @@
|
|
|
232
284
|
&.selected {
|
|
233
285
|
background-color: var( --listbox-item-color-sel-disabled );
|
|
234
286
|
}
|
|
287
|
+
|
|
288
|
+
&.checked>.x4check {
|
|
289
|
+
background-color: var( --listbox-check-background-disabled );
|
|
290
|
+
border-color: var( --listbox-check-background-disabled );
|
|
291
|
+
}
|
|
235
292
|
}
|
|
236
293
|
}
|
|
237
294
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { Component, ComponentEvent, ComponentEvents, componentFromDOM, ComponentProps, EvChange, EvClick, EvContextMenu, EvDblClick, EvSelectionChange } from '../../core/component';
|
|
18
18
|
import { EventCallback } from '../../core/core_events';
|
|
19
|
-
import { kbNav,
|
|
19
|
+
import { kbNav, isArray, UnsafeHtml, asap } from '../../core/core_tools';
|
|
20
20
|
|
|
21
21
|
import { ScrollView, Viewport } from '../viewport/viewport';
|
|
22
22
|
import { Header } from '../header/header';
|
|
@@ -40,11 +40,20 @@ export interface ListItem {
|
|
|
40
40
|
iconId?: string;
|
|
41
41
|
data?: any;
|
|
42
42
|
cls?: string;
|
|
43
|
-
checked?: boolean;
|
|
43
|
+
checked?: boolean; // checkable listbox: the starting state of the case, getChecked() gives the current one
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* a case changed by the user (click, Space)
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export interface EvCheckChange extends ComponentEvent {
|
|
51
|
+
readonly id: ListboxID;
|
|
52
|
+
readonly checked: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
48
57
|
*/
|
|
49
58
|
|
|
50
59
|
export interface ListboxEvents extends ComponentEvents {
|
|
@@ -52,6 +61,7 @@ export interface ListboxEvents extends ComponentEvents {
|
|
|
52
61
|
dblClick?: EvDblClick;
|
|
53
62
|
contextMenu?: EvContextMenu;
|
|
54
63
|
selectionChange?: EvSelectionChange;
|
|
64
|
+
checkChange?: EvCheckChange;
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
/**
|
|
@@ -65,16 +75,25 @@ export interface ListboxProps extends Omit<ComponentProps,'content'> {
|
|
|
65
75
|
icon?: string;
|
|
66
76
|
header?: Header;
|
|
67
77
|
footer?: Component,
|
|
68
|
-
checkable?:
|
|
78
|
+
checkable?: boolean, // a case at the start of each line
|
|
69
79
|
multisel?: true,
|
|
80
|
+
reselect?: boolean, // a click on the item already selected fires selectionChange again
|
|
70
81
|
emptyMsg?: string,
|
|
71
82
|
|
|
72
83
|
dblClick?: EventCallback<EvDblClick>;
|
|
73
84
|
selectionChange?: EventCallback<EvSelectionChange>;
|
|
74
85
|
contextMenu?: EventCallback<EvContextMenu>;
|
|
86
|
+
checkChange?: EventCallback<EvCheckChange>;
|
|
75
87
|
}
|
|
76
88
|
|
|
77
89
|
/**
|
|
90
|
+
* checkable: a click on the case, or Space for the last item selected, changes it and fires
|
|
91
|
+
* checkChange; neither click nor the selection. A double click on the case is ignored.
|
|
92
|
+
*
|
|
93
|
+
* reselect: a click of the user on the item already selected fires selectionChange with the
|
|
94
|
+
* same selection: lists linked together whose view shows what was clicked last. select( ) by
|
|
95
|
+
* the code, the arrows and a right click do not.
|
|
96
|
+
*
|
|
78
97
|
* @cssvar
|
|
79
98
|
* ```
|
|
80
99
|
* --listbox-item-color
|
|
@@ -90,11 +109,17 @@ export interface ListboxProps extends Omit<ComponentProps,'content'> {
|
|
|
90
109
|
* --listbox-border-focus
|
|
91
110
|
* --listbox-title-background
|
|
92
111
|
* --listbox-title-color
|
|
112
|
+
* --listbox-check-border
|
|
113
|
+
* --listbox-check-border-hover
|
|
114
|
+
* --listbox-check-border-sel
|
|
115
|
+
* --listbox-check-background
|
|
116
|
+
* --listbox-check-background-disabled
|
|
117
|
+
* --listbox-check-color
|
|
93
118
|
* ```
|
|
94
119
|
*/
|
|
95
120
|
|
|
96
|
-
@class_ns( "x4" )
|
|
97
121
|
export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
122
|
+
static classPrefix = "x4";
|
|
98
123
|
|
|
99
124
|
private _view: Viewport;
|
|
100
125
|
private _lastsel: ListboxID;
|
|
@@ -106,7 +131,8 @@ private _view: Viewport;
|
|
|
106
131
|
super( { ...props } );
|
|
107
132
|
|
|
108
133
|
this.setAttribute( "tabindex", 0 );
|
|
109
|
-
this.mapPropEvents( props, "dblClick", "selectionChange", "contextMenu" );
|
|
134
|
+
this.mapPropEvents( props, "dblClick", "selectionChange", "contextMenu", "checkChange" );
|
|
135
|
+
this.setClass( "checkable", !!props.checkable );
|
|
110
136
|
|
|
111
137
|
const scroller = new ScrollView( { cls: "body" } );
|
|
112
138
|
this._view = scroller.getViewport( );
|
|
@@ -169,6 +195,18 @@ private _view: Viewport;
|
|
|
169
195
|
break;
|
|
170
196
|
}
|
|
171
197
|
|
|
198
|
+
case " ": {
|
|
199
|
+
if( !this.props.checkable || this._lastsel===undefined ) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const line = this._itemWithID( this._lastsel );
|
|
204
|
+
if( line ) {
|
|
205
|
+
this._toggleCheck( line );
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
|
|
172
210
|
default:
|
|
173
211
|
return;
|
|
174
212
|
}
|
|
@@ -246,6 +284,7 @@ private _view: Viewport;
|
|
|
246
284
|
|
|
247
285
|
private _on_click( ev: MouseEvent ) {
|
|
248
286
|
let target = ev.target as HTMLElement;
|
|
287
|
+
let on_check = false;
|
|
249
288
|
|
|
250
289
|
while( target && target!=this.dom ) {
|
|
251
290
|
const c = componentFromDOM( target );
|
|
@@ -255,7 +294,19 @@ private _view: Viewport;
|
|
|
255
294
|
return;
|
|
256
295
|
}
|
|
257
296
|
|
|
297
|
+
if( c && c.hasClass("x4check") ) {
|
|
298
|
+
on_check = true;
|
|
299
|
+
}
|
|
300
|
+
|
|
258
301
|
if( c && c.hasClass("x4item") ) {
|
|
302
|
+
// the case changes alone; a double click on it is ignored
|
|
303
|
+
if( on_check ) {
|
|
304
|
+
if( ev.type == 'click' ) {
|
|
305
|
+
this._toggleCheck( c );
|
|
306
|
+
}
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
259
310
|
const id = c.getInternalData( "id" );
|
|
260
311
|
const fev: EvClick = { context:id };
|
|
261
312
|
if (ev.type == 'click') {
|
|
@@ -266,7 +317,7 @@ private _view: Viewport;
|
|
|
266
317
|
}
|
|
267
318
|
|
|
268
319
|
if (!fev.defaultPrevented) {
|
|
269
|
-
this._selectItem( id, c, ev.ctrlKey ? 'toggle' : 'single' );
|
|
320
|
+
this._selectItem( id, c, ev.ctrlKey ? 'toggle' : 'single', ev.type == 'click' && this.props.reselect );
|
|
270
321
|
}
|
|
271
322
|
|
|
272
323
|
return;
|
|
@@ -315,8 +366,8 @@ private _view: Viewport;
|
|
|
315
366
|
*
|
|
316
367
|
*/
|
|
317
368
|
|
|
318
|
-
private _selectItem( id: ListboxID, item: Component, mode: "single" | "toggle" ) {
|
|
319
|
-
|
|
369
|
+
private _selectItem( id: ListboxID, item: Component, mode: "single" | "toggle", again = false ) {
|
|
370
|
+
|
|
320
371
|
if( !this.props.multisel ) {
|
|
321
372
|
mode = 'single';
|
|
322
373
|
}
|
|
@@ -324,7 +375,11 @@ private _view: Viewport;
|
|
|
324
375
|
this._lastsel = id;
|
|
325
376
|
|
|
326
377
|
if( mode=='single' ) {
|
|
378
|
+
// already selected: nothing changes; again (reselect): its selectionChange all the same
|
|
327
379
|
if( this._multisel.has(id) ) {
|
|
380
|
+
if( again ) {
|
|
381
|
+
this.fire( "selectionChange", { selection: this.getSelection(), empty: false } );
|
|
382
|
+
}
|
|
328
383
|
return;
|
|
329
384
|
}
|
|
330
385
|
|
|
@@ -450,38 +505,43 @@ private _view: Viewport;
|
|
|
450
505
|
}
|
|
451
506
|
|
|
452
507
|
/**
|
|
453
|
-
*
|
|
508
|
+
* replaces the items of the list
|
|
509
|
+
* @param items - the new items; empty or null: the message of an empty list (emptyMsg)
|
|
510
|
+
* @param keepSel - true: the items selected before stay selected, when they are in the new items
|
|
511
|
+
*
|
|
512
|
+
* selectionChange: fired once, after the items are drawn, with the selection they end with,
|
|
513
|
+
* when there was a selection before or there is one after. With keepSel and the same ids, it
|
|
514
|
+
* is fired too: the items changed, a view that shows the selection draws it again.
|
|
515
|
+
* Nothing selected before nor after: no selectionChange.
|
|
454
516
|
*/
|
|
455
517
|
|
|
456
518
|
setItems( items: ListItem[], keepSel = false ) {
|
|
457
519
|
|
|
458
520
|
const oldSel = this.getSelection( );
|
|
459
521
|
|
|
460
|
-
|
|
522
|
+
// the selection changes silently: one selectionChange at the end
|
|
523
|
+
this.clearSelection( false );
|
|
461
524
|
this._view.clearContent( );
|
|
462
525
|
this._items = items ?? [];
|
|
463
526
|
|
|
464
|
-
let update_sel = false;
|
|
465
|
-
|
|
466
527
|
if( this._items.length ) {
|
|
467
528
|
this.removeClass( "empty" );
|
|
468
529
|
const content = items.map( x => this.renderItem(x) );
|
|
469
530
|
this._view.setContent( content );
|
|
470
531
|
|
|
471
532
|
if( keepSel && oldSel.length>0 ) {
|
|
472
|
-
this.select( oldSel );
|
|
533
|
+
this.select( oldSel, false );
|
|
473
534
|
}
|
|
474
535
|
}
|
|
475
536
|
else {
|
|
476
537
|
this.addClass( "empty" );
|
|
477
|
-
update_sel = oldSel.length>0;
|
|
478
538
|
this._view.setContent( new Label( { cls: "empty vertical", icon: icons.empty, text: this.props.emptyMsg ?? _tr.global.empty_list } ) );
|
|
479
539
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
} );
|
|
540
|
+
|
|
541
|
+
// a selection before or after: one selectionChange, the same ids too (the items changed)
|
|
542
|
+
const sel = this.getSelection( );
|
|
543
|
+
if( oldSel.length || sel.length ) {
|
|
544
|
+
this.fire( "selectionChange", { selection: sel, empty: sel.length==0 } );
|
|
485
545
|
}
|
|
486
546
|
}
|
|
487
547
|
|
|
@@ -492,13 +552,52 @@ private _view: Viewport;
|
|
|
492
552
|
renderItem( item: ListItem ) {
|
|
493
553
|
const renderer = this.props.renderer ?? this.defaultRenderer;
|
|
494
554
|
const line = renderer( item );
|
|
495
|
-
|
|
555
|
+
|
|
496
556
|
line.addClass( "x4item" );
|
|
497
557
|
line.setInternalData( "id", item.id );
|
|
498
|
-
|
|
558
|
+
|
|
559
|
+
if( this.props.checkable ) {
|
|
560
|
+
const check = new Component( { cls: "x4check" } );
|
|
561
|
+
check.dom.insertAdjacentHTML( "beforeend", icons.check );
|
|
562
|
+
line.prependContent( check );
|
|
563
|
+
line.setClass( "checked", !!item.checked );
|
|
564
|
+
}
|
|
565
|
+
|
|
499
566
|
return line;
|
|
500
567
|
}
|
|
501
568
|
|
|
569
|
+
/**
|
|
570
|
+
* the user changed the case of a line
|
|
571
|
+
*/
|
|
572
|
+
|
|
573
|
+
private _toggleCheck( line: Component ) {
|
|
574
|
+
line.toggleClass( "checked" );
|
|
575
|
+
this.fire( "checkChange", { id: line.getInternalData( "id" ), checked: line.hasClass( "checked" ) } );
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* ids of the items checked, in the order of the list
|
|
580
|
+
*/
|
|
581
|
+
|
|
582
|
+
getChecked( ): ListboxID[] {
|
|
583
|
+
return this._view.enumChildComponents( false )
|
|
584
|
+
.filter( x => x.hasClass( "checked" ) )
|
|
585
|
+
.map( x => x.getInternalData( "id" ) );
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* check these items, uncheck the others; no event
|
|
590
|
+
*/
|
|
591
|
+
|
|
592
|
+
setChecked( ids: ListboxID[] ) {
|
|
593
|
+
const checked = new Set( ids );
|
|
594
|
+
this._view.enumChildComponents( false ).forEach( x => {
|
|
595
|
+
if( x.hasClass( "x4item" ) ) {
|
|
596
|
+
x.setClass( "checked", checked.has( x.getInternalData( "id" ) ) );
|
|
597
|
+
}
|
|
598
|
+
} );
|
|
599
|
+
}
|
|
600
|
+
|
|
502
601
|
/**
|
|
503
602
|
*
|
|
504
603
|
*/
|
|
@@ -574,11 +673,17 @@ private _view: Viewport;
|
|
|
574
673
|
*/
|
|
575
674
|
|
|
576
675
|
appendItem( item: ListItem, prepend = false, select = true ) {
|
|
577
|
-
|
|
676
|
+
|
|
578
677
|
if( select ) {
|
|
579
678
|
this._clearSelection( );
|
|
580
679
|
}
|
|
581
680
|
|
|
681
|
+
// the first item: the message of an empty list goes away
|
|
682
|
+
if( !this._items.length ) {
|
|
683
|
+
this._view.clearContent( );
|
|
684
|
+
this.removeClass( "empty" );
|
|
685
|
+
}
|
|
686
|
+
|
|
582
687
|
let el = this.renderItem( item );
|
|
583
688
|
|
|
584
689
|
if( prepend ) {
|
|
@@ -624,6 +729,11 @@ private _view: Viewport;
|
|
|
624
729
|
_new.addClass( "selected" );
|
|
625
730
|
}
|
|
626
731
|
|
|
732
|
+
// the case keeps its state
|
|
733
|
+
if( this.props.checkable ) {
|
|
734
|
+
_new.setClass( "checked", old.hasClass( "checked" ) );
|
|
735
|
+
}
|
|
736
|
+
|
|
627
737
|
this._view.dom.replaceChild( _new.dom, old.dom );
|
|
628
738
|
}
|
|
629
739
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { Component } from "../../core/component"
|
|
18
18
|
import { DOMEventHandler } from '../../core/core_dom';
|
|
19
|
-
import { Timer, UnsafeHtml,
|
|
19
|
+
import { Timer, UnsafeHtml, isFunction, isString } from '../../core/core_tools';
|
|
20
20
|
|
|
21
21
|
import { Popup, PopupProps } from '../popup/popup';
|
|
22
22
|
import { Icon } from '../icon/icon';
|
|
@@ -59,8 +59,9 @@ export interface MenuProps extends Omit<PopupProps,"content"> {
|
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
|
-
@class_ns( "x4" )
|
|
63
62
|
class CMenuSep extends Component {
|
|
63
|
+
static classPrefix = "x4";
|
|
64
|
+
|
|
64
65
|
constructor( ) {
|
|
65
66
|
super( { } );
|
|
66
67
|
}
|
|
@@ -73,8 +74,8 @@ const openTimer = new Timer( );
|
|
|
73
74
|
*
|
|
74
75
|
*/
|
|
75
76
|
|
|
76
|
-
@class_ns( "x4" )
|
|
77
77
|
class CMenuItem extends Component {
|
|
78
|
+
static classPrefix = "x4";
|
|
78
79
|
|
|
79
80
|
private menu: Menu;
|
|
80
81
|
|
|
@@ -164,8 +165,8 @@ class CMenuItem extends Component {
|
|
|
164
165
|
*
|
|
165
166
|
*/
|
|
166
167
|
|
|
167
|
-
@class_ns( "x4" )
|
|
168
168
|
export class Menu extends Popup {
|
|
169
|
+
static classPrefix = "x4";
|
|
169
170
|
|
|
170
171
|
constructor( props: MenuProps ) {
|
|
171
172
|
super( { ...props, autoClose: "menu" } );
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
--msgbox-question-icon-color: var( --accent-background ); // a question, an InputBox, a PromptBox
|
|
24
24
|
|
|
25
25
|
--msgbox-log-background: var( --background-ternary ); // the lines of a ProgressionBox
|
|
26
|
+
--msgbox-log-border: var( --border );
|
|
27
|
+
--msgbox-log-border-focus: var( --border-focus );
|
|
28
|
+
--msgbox-log-error-color: var( --alert-background ); // the text and the bar of an error
|
|
29
|
+
--msgbox-log-error-background: var( --alert-background-light );
|
|
30
|
+
--msgbox-log-warning-color: var( --warning-background );
|
|
31
|
+
--msgbox-log-warning-background: var( --warning-background-light );
|
|
32
|
+
--msgbox-log-scrollbar: var( --border-hover ); // the thumb; the track is the background of the lines
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
.x4messagebox {
|
|
@@ -95,6 +102,26 @@
|
|
|
95
102
|
min-height: 200px;
|
|
96
103
|
min-width: 500px;
|
|
97
104
|
|
|
105
|
+
// after an error: the title bar of an error of MessageBox
|
|
106
|
+
&.error > .caption {
|
|
107
|
+
background-color: var( --msgbox-caption-background );
|
|
108
|
+
|
|
109
|
+
& > #title {
|
|
110
|
+
color: var( --msgbox-caption-color );
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// on the left of OK: the counts of the errors and the warnings, the icon of the worst
|
|
115
|
+
#alerts {
|
|
116
|
+
&.error {
|
|
117
|
+
--label-icon-color: var( --msgbox-log-error-color );
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.warning {
|
|
121
|
+
--label-icon-color: var( --msgbox-log-warning-color );
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
98
125
|
&> .x4form {
|
|
99
126
|
min-height: unset;
|
|
100
127
|
}
|
|
@@ -122,8 +149,9 @@
|
|
|
122
149
|
}
|
|
123
150
|
|
|
124
151
|
#title {
|
|
125
|
-
padding:
|
|
152
|
+
padding: 0 16px;
|
|
126
153
|
line-height: 1.8em;
|
|
154
|
+
font-weight: bold;
|
|
127
155
|
}
|
|
128
156
|
|
|
129
157
|
// on the right, the bar and the lines end where the button OK does: the bar of
|
|
@@ -132,16 +160,80 @@
|
|
|
132
160
|
margin: 0 6px 0 16px;
|
|
133
161
|
}
|
|
134
162
|
|
|
135
|
-
// the lines: a
|
|
163
|
+
// the lines: a <pre> in a fixed font, 10 lines high at least; its text gives it no size
|
|
164
|
+
// (contain): it scrolls, the box does not grow; a line is not wrapped. Each line is a
|
|
165
|
+
// <div>, all of them as wide as the longest one (the column of the grid): an error, a
|
|
166
|
+
// warning, coloured on all their width, a bar on their left
|
|
136
167
|
#sub-text {
|
|
137
168
|
flex-grow: 1;
|
|
138
169
|
min-height: calc( 10lh + 10px ); // its padding and its border too
|
|
139
170
|
max-height: 400px;
|
|
140
171
|
overflow: auto;
|
|
141
172
|
white-space: pre;
|
|
173
|
+
contain: size;
|
|
174
|
+
display: grid;
|
|
175
|
+
grid-template-columns: minmax( max-content, 1fr );
|
|
176
|
+
align-content: start;
|
|
177
|
+
font: inherit;
|
|
178
|
+
font-family: monospace, monospace;
|
|
179
|
+
line-height: 1.3em;
|
|
180
|
+
scrollbar-color: var( --msgbox-log-scrollbar ) transparent;
|
|
181
|
+
outline: none;
|
|
182
|
+
border: 1px solid var( --msgbox-log-border );
|
|
142
183
|
background-color: var( --msgbox-log-background );
|
|
143
|
-
padding: 4px
|
|
184
|
+
padding: 4px 0;
|
|
144
185
|
margin: 0 6px 0 16px;
|
|
186
|
+
|
|
187
|
+
.line {
|
|
188
|
+
min-height: 1lh; // an empty line too
|
|
189
|
+
padding: 0 8px;
|
|
190
|
+
border-left: 3px solid transparent;
|
|
191
|
+
|
|
192
|
+
&.error {
|
|
193
|
+
background-color: var( --msgbox-log-error-background );
|
|
194
|
+
border-left-color: var( --msgbox-log-error-color );
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&.warning {
|
|
198
|
+
background-color: var( --msgbox-log-warning-background );
|
|
199
|
+
border-left-color: var( --msgbox-log-warning-color );
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&, * {
|
|
204
|
+
user-select: text;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&:focus {
|
|
208
|
+
border-color: var( --msgbox-log-border-focus );
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
svg {
|
|
212
|
+
width: 1em;
|
|
213
|
+
height: 1em;
|
|
214
|
+
vertical-align: -0.125em;
|
|
215
|
+
margin-right: 4px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.error {
|
|
219
|
+
color: var( --msgbox-log-error-color );
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.warning {
|
|
223
|
+
color: var( --msgbox-log-warning-color );
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// a section: its title, a click folds it; its lines below, under the title
|
|
227
|
+
details {
|
|
228
|
+
padding-left: 1em;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
summary {
|
|
232
|
+
margin-left: -1em;
|
|
233
|
+
padding-left: 11px; // as the text of a line: its padding and its bar
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
font-weight: bold;
|
|
236
|
+
}
|
|
145
237
|
}
|
|
146
238
|
}
|
|
147
239
|
}
|