x4js 2.3.25 → 2.3.27
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 +87 -13
- package/package.json +1 -1
- package/src/components/autocomplete/autocomplete.ts +3 -3
- 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 +2 -2
- package/src/components/calendar/calendar.ts +5 -3
- package/src/components/canvas/canvas.ts +1 -2
- package/src/components/chart/chart.ts +4 -4
- 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/components.ts +1 -0
- package/src/components/dialog/dialog.ts +2 -2
- package/src/components/dockingview/dockingview.ts +2 -3
- package/src/components/filedrop/filedrop.ts +3 -2
- package/src/components/form/form.ts +4 -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.ts +33 -47
- package/src/components/menu/menu.ts +5 -4
- package/src/components/messages/messages.module.scss +29 -5
- package/src/components/messages/messages.ts +42 -50
- package/src/components/monaco/monaco.ts +1 -2
- package/src/components/notification/notification.ts +3 -2
- package/src/components/panel/panel.ts +2 -2
- package/src/components/popup/popup.ts +4 -4
- package/src/components/progress/progress.ts +1 -2
- package/src/components/propgrid/progrid.module.scss +2 -3
- package/src/components/propgrid/propgrid.ts +2 -2
- package/src/components/radio/radio.ts +1 -2
- package/src/components/rating/rating.ts +3 -3
- 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/timeline/timeline.module.scss +147 -0
- package/src/components/timeline/timeline.ts +146 -0
- package/src/components/tooltips/tooltips.ts +2 -2
- package/src/components/treeview/treeview.ts +19 -25
- package/src/components/video/video.ts +1 -2
- package/src/components/viewport/viewport.ts +4 -3
- package/src/core/component.ts +46 -26
- package/src/core/core_application.ts +29 -1
- package/src/core/core_i18n.ts +39 -0
- package/src/core/core_shortcuts.ts +2 -1
- package/src/core/core_svg.ts +1 -0
- package/src/core/core_tools.ts +83 -24
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// :: MESSAGEBOX ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
3
3
|
|
|
4
4
|
import { _tr } from '../../core/core_i18n';
|
|
5
|
-
import { asap,
|
|
5
|
+
import { asap, sprintf, unsafeHtml, UnsafeHtml } from '../../core/core_tools';
|
|
6
6
|
|
|
7
7
|
import { HBox, VBox } from '../boxes/boxes';
|
|
8
8
|
import { Icon } from '../icon/icon';
|
|
@@ -41,16 +41,19 @@ export interface MessageBoxProps extends DialogProps {
|
|
|
41
41
|
* --msgbox-log-border
|
|
42
42
|
* --msgbox-log-border-focus
|
|
43
43
|
* --msgbox-log-error-color
|
|
44
|
+
* --msgbox-log-error-background
|
|
44
45
|
* --msgbox-log-warning-color
|
|
46
|
+
* --msgbox-log-warning-background
|
|
45
47
|
* --msgbox-log-scrollbar
|
|
46
48
|
* ```
|
|
47
49
|
* --msgbox-caption-* and --msgbox-icon-color are the ones of an error; a question, an InputBox
|
|
48
50
|
* and a PromptBox have the title bar of a Dialog and their icon in --msgbox-question-icon-color
|
|
49
51
|
*/
|
|
50
52
|
|
|
51
|
-
@class_ns( "x4" )
|
|
52
53
|
export class MessageBox extends Dialog<DialogProps>
|
|
53
54
|
{
|
|
55
|
+
static classPrefix = "x4";
|
|
56
|
+
|
|
54
57
|
constructor(props: DialogProps) {
|
|
55
58
|
super(props);
|
|
56
59
|
}
|
|
@@ -139,9 +142,10 @@ interface InputOptions {
|
|
|
139
142
|
trim?: boolean;
|
|
140
143
|
}
|
|
141
144
|
|
|
142
|
-
@class_ns( "x4" )
|
|
143
145
|
export class InputBox extends Dialog<DialogProps>
|
|
144
146
|
{
|
|
147
|
+
static classPrefix = "x4";
|
|
148
|
+
|
|
145
149
|
constructor(props: DialogProps) {
|
|
146
150
|
super(props);
|
|
147
151
|
}
|
|
@@ -208,9 +212,10 @@ export class InputBox extends Dialog<DialogProps>
|
|
|
208
212
|
// :: PROMPT ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
209
213
|
|
|
210
214
|
|
|
211
|
-
@class_ns( "x4" )
|
|
212
215
|
export class PromptBox extends Dialog<DialogProps>
|
|
213
216
|
{
|
|
217
|
+
static classPrefix = "x4";
|
|
218
|
+
|
|
214
219
|
constructor(props: DialogProps) {
|
|
215
220
|
super(props);
|
|
216
221
|
}
|
|
@@ -284,21 +289,21 @@ export class PromptBox extends Dialog<DialogProps>
|
|
|
284
289
|
|
|
285
290
|
/**
|
|
286
291
|
* a modal box that follows a long task: a title, a bar, and the lines of what is done
|
|
287
|
-
* in a <pre
|
|
288
|
-
*
|
|
289
|
-
* Ctrl+A selects the lines.
|
|
292
|
+
* in a <pre>, in a fixed font, a <div> each: a string is text, an UnsafeHtml is html. An
|
|
293
|
+
* error, a warning are coloured on all their width, a bar on their left. addSection puts
|
|
294
|
+
* the lines that follow in a section that folds. Ctrl+A selects the lines.
|
|
290
295
|
* done( ) shows its button OK: after an error or a warning it waits for it, their counts
|
|
291
296
|
* on the left of the bar; else it closes the box after 5s, the seconds left in the button.
|
|
292
297
|
*/
|
|
293
298
|
|
|
294
|
-
@class_ns( "x4" )
|
|
295
299
|
export class ProgressionBox extends Dialog {
|
|
300
|
+
static classPrefix = "x4";
|
|
296
301
|
|
|
297
302
|
// an error or a warning: done( ) waits for OK
|
|
298
|
-
|
|
299
|
-
|
|
303
|
+
private _errors = 0;
|
|
304
|
+
private _warnings = 0;
|
|
300
305
|
|
|
301
|
-
|
|
306
|
+
private _section: Component; // the last section (a <details>): the lines go in it
|
|
302
307
|
|
|
303
308
|
constructor( title: string ) {
|
|
304
309
|
super( {
|
|
@@ -348,7 +353,7 @@ export class ProgressionBox extends Dialog {
|
|
|
348
353
|
this.query<Progress>( "#prog").setValue( perc );
|
|
349
354
|
this.addClass( "error" ); // the title bar in red, as the one of an error of MessageBox
|
|
350
355
|
|
|
351
|
-
this
|
|
356
|
+
this._errors++;
|
|
352
357
|
}
|
|
353
358
|
|
|
354
359
|
/** a line at the end, with the icon of a warning: done( ) then waits for the button OK */
|
|
@@ -357,7 +362,7 @@ export class ProgressionBox extends Dialog {
|
|
|
357
362
|
this._addLine( text, "warning" );
|
|
358
363
|
this.query<Progress>( "#prog").setValue( perc );
|
|
359
364
|
|
|
360
|
-
this
|
|
365
|
+
this._warnings++;
|
|
361
366
|
}
|
|
362
367
|
|
|
363
368
|
/**
|
|
@@ -369,10 +374,10 @@ export class ProgressionBox extends Dialog {
|
|
|
369
374
|
const summary = new Component( { tag: "summary", content: new Component( { tag: "span", cls: "alert" } ) } );
|
|
370
375
|
summary.appendContent( title );
|
|
371
376
|
|
|
372
|
-
this
|
|
377
|
+
this._section = new Component( { tag: "details", attrs: { open: true }, content: summary } );
|
|
373
378
|
|
|
374
379
|
const log = this.query( "#sub-text" );
|
|
375
|
-
log.appendContent( this
|
|
380
|
+
log.appendContent( this._section );
|
|
376
381
|
log.dom.scrollTop = log.dom.scrollHeight;
|
|
377
382
|
this.query<Progress>( "#prog").setValue( perc );
|
|
378
383
|
}
|
|
@@ -380,7 +385,7 @@ export class ProgressionBox extends Dialog {
|
|
|
380
385
|
/** the text in place of all the lines */
|
|
381
386
|
|
|
382
387
|
setText( text: string | UnsafeHtml, perc: number ) {
|
|
383
|
-
this
|
|
388
|
+
this._section = null;
|
|
384
389
|
this.query( "#sub-text" ).setContent( text );
|
|
385
390
|
this.query<Progress>( "#prog").setValue( perc );
|
|
386
391
|
}
|
|
@@ -388,44 +393,31 @@ export class ProgressionBox extends Dialog {
|
|
|
388
393
|
/** as at the start: no line, no error, no button OK */
|
|
389
394
|
|
|
390
395
|
clear( ) {
|
|
391
|
-
this
|
|
392
|
-
this
|
|
396
|
+
this._errors = 0;
|
|
397
|
+
this._warnings = 0;
|
|
393
398
|
this.clearInterval( "close" );
|
|
394
399
|
this.query( "#btnbar" ).show( false );
|
|
395
400
|
this.removeClass( "error" );
|
|
396
401
|
this.query<Label>( "#alerts" ).setText( "" );
|
|
397
402
|
this.query<Label>( "#alerts" ).setIcon( null );
|
|
398
|
-
this
|
|
403
|
+
this._section = null;
|
|
399
404
|
this.query( "#sub-text" ).clearContent( );
|
|
400
405
|
}
|
|
401
406
|
|
|
402
|
-
// the line after the others (in the last section), the last one shown
|
|
403
|
-
//
|
|
407
|
+
// the line after the others (in the last section), the last one shown: a <div>, of the
|
|
408
|
+
// class of its kind for an error, a warning
|
|
404
409
|
private _addLine( text: string | UnsafeHtml, kind?: "error" | "warning" ) {
|
|
405
410
|
const log = this.query( "#sub-text" );
|
|
406
|
-
const target = this
|
|
411
|
+
const target = this._section ?? log;
|
|
407
412
|
|
|
408
|
-
|
|
409
|
-
if( target.dom.lastChild && target.dom.lastChild.nodeName!="SUMMARY" ) {
|
|
410
|
-
target.appendContent( "\n" );
|
|
411
|
-
}
|
|
413
|
+
target.appendContent( new Component( { cls: kind ? "line " + kind : "line", content: text } ) );
|
|
412
414
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
// the title of the section: the icon of the worst, in its colour
|
|
420
|
-
const alert = this.#section?.query( ".alert" );
|
|
421
|
-
if( alert && !alert.hasClass( "error" ) ) {
|
|
422
|
-
alert.setClass( "warning", kind=="warning" );
|
|
423
|
-
alert.setClass( "error", kind=="error" );
|
|
424
|
-
alert.setContent( unsafeHtml( icon ) );
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
target.appendContent( text );
|
|
415
|
+
// the title of the section: the icon of the worst, in its colour
|
|
416
|
+
const alert = this._section?.query( ".alert" );
|
|
417
|
+
if( kind && alert && !alert.hasClass( "error" ) ) {
|
|
418
|
+
alert.setClass( "warning", kind=="warning" );
|
|
419
|
+
alert.setClass( "error", kind=="error" );
|
|
420
|
+
alert.setContent( unsafeHtml( kind=="error" ? icons.danger : icons.warning ) );
|
|
429
421
|
}
|
|
430
422
|
|
|
431
423
|
log.dom.scrollTop = log.dom.scrollHeight;
|
|
@@ -449,22 +441,22 @@ export class ProgressionBox extends Dialog {
|
|
|
449
441
|
const ok = this.query<Button>( "#ok" );
|
|
450
442
|
this.query( "#btnbar" ).show( true );
|
|
451
443
|
|
|
452
|
-
if( this
|
|
444
|
+
if( this._errors || this._warnings ) {
|
|
453
445
|
const tr = _tr.global.progression;
|
|
454
446
|
const counts = [];
|
|
455
|
-
if( this
|
|
456
|
-
counts.push( sprintf( this
|
|
447
|
+
if( this._errors ) {
|
|
448
|
+
counts.push( sprintf( this._errors>1 ? tr.errors : tr.error, this._errors ) );
|
|
457
449
|
}
|
|
458
|
-
if( this
|
|
459
|
-
counts.push( sprintf( this
|
|
450
|
+
if( this._warnings ) {
|
|
451
|
+
counts.push( sprintf( this._warnings>1 ? tr.warnings : tr.warning, this._warnings ) );
|
|
460
452
|
}
|
|
461
453
|
|
|
462
454
|
// on the left, the icon of the worst
|
|
463
455
|
const alerts = this.query<Label>( "#alerts" );
|
|
464
456
|
alerts.setText( counts.join( " / " ) );
|
|
465
|
-
alerts.setIcon( this
|
|
466
|
-
alerts.setClass( "error", this
|
|
467
|
-
alerts.setClass( "warning", this
|
|
457
|
+
alerts.setIcon( this._errors ? icons.danger : icons.warning );
|
|
458
|
+
alerts.setClass( "error", this._errors>0 );
|
|
459
|
+
alerts.setClass( "warning", this._errors==0 );
|
|
468
460
|
|
|
469
461
|
ok.setText( _tr.global.ok );
|
|
470
462
|
return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { class_ns } from '../../core/core_tools';
|
|
2
1
|
import { Component, ComponentProps } from '../../core/component';
|
|
3
2
|
|
|
4
3
|
import Monaco from './bin/monaco';
|
|
@@ -17,8 +16,8 @@ interface MonacoEditorProps extends ComponentProps {
|
|
|
17
16
|
options?: Monaco.editor.IEditorOptions & Monaco.editor.IGlobalEditorOptions;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
@class_ns( "x4" )
|
|
21
19
|
export class MonacoEditor extends Component<MonacoEditorProps> {
|
|
20
|
+
static classPrefix = "x4";
|
|
22
21
|
|
|
23
22
|
private static _initCount = 0;
|
|
24
23
|
private static _basePath: string = "monaco/";
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
17
|
import { ComponentProps } from '../../core/component';
|
|
18
|
-
import { asap,
|
|
18
|
+
import { asap, Rect, UnsafeHtml } from '../../core/core_tools';
|
|
19
19
|
|
|
20
20
|
import { Popup } from '../popup/popup';
|
|
21
21
|
import { HBox, VBox } from '../boxes/boxes';
|
|
@@ -61,8 +61,9 @@ interface NotificationProps extends ComponentProps {
|
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
@class_ns( "x4" )
|
|
65
64
|
export class Notification extends Popup {
|
|
65
|
+
static classPrefix = "x4";
|
|
66
|
+
|
|
66
67
|
private static list = new Set<Notification>( );
|
|
67
68
|
|
|
68
69
|
constructor( props: NotificationProps ) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
17
|
import { Component, ComponentContent, ComponentProps } from '../../core/component';
|
|
18
|
-
import { UnsafeHtml, Constructor
|
|
18
|
+
import { UnsafeHtml, Constructor } from '../../core/core_tools';
|
|
19
19
|
|
|
20
20
|
import { VBox } from '../boxes/boxes';
|
|
21
21
|
import { Label } from '../label/label';
|
|
@@ -37,8 +37,8 @@ interface PanelProps extends ComponentProps {
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
@class_ns( "x4" )
|
|
41
40
|
export class Panel extends VBox<PanelProps> {
|
|
41
|
+
static classPrefix = "x4";
|
|
42
42
|
|
|
43
43
|
private _title: Label;
|
|
44
44
|
private _body: Component;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { Component, ComponentEvent, ComponentEvents, ComponentProps, componentFromDOM, makeUniqueComponentId } from "../../core/component"
|
|
18
18
|
|
|
19
19
|
import { CSizer } from '../sizers/sizer';
|
|
20
|
-
import { Rect, Point,
|
|
20
|
+
import { Rect, Point, asap } from '../../core/core_tools';
|
|
21
21
|
import { Box } from '../boxes/boxes'
|
|
22
22
|
|
|
23
23
|
import "./popup.module.scss"
|
|
@@ -54,7 +54,7 @@ function getRoot( ) {
|
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
function dismissLast( e: UIEvent ) {
|
|
57
|
-
if( autoclose_list.some( x => x.
|
|
57
|
+
if( autoclose_list.some( x => x.contains( e.target as Node ) ) ) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -70,8 +70,8 @@ function dismissLast( e: UIEvent ) {
|
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
|
|
73
|
-
@class_ns( "x4" )
|
|
74
73
|
export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = PopupEvents> extends Box<P,E> {
|
|
74
|
+
static classPrefix = "x4";
|
|
75
75
|
|
|
76
76
|
private _isshown = false;
|
|
77
77
|
protected _ismodal = false;
|
|
@@ -224,7 +224,7 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = Po
|
|
|
224
224
|
// modal: the focus goes back to the element that had it when it opened, unless the
|
|
225
225
|
// user put it elsewhere (read before the popup leaves the page and its focus with it)
|
|
226
226
|
const active = document.activeElement;
|
|
227
|
-
const giveBack = this._ismodal && this._prevFocus && ( !active || active===document.body || this.
|
|
227
|
+
const giveBack = this._ismodal && this._prevFocus && ( !active || active===document.body || this.contains( active ) );
|
|
228
228
|
|
|
229
229
|
this.__hide( );
|
|
230
230
|
this.__remove( );
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
|
-
import { class_ns } from '../../core/core_tools';
|
|
18
17
|
import { Component, ComponentProps } from '../../core/component';
|
|
19
18
|
|
|
20
19
|
import "./progress.module.scss";
|
|
@@ -33,8 +32,8 @@ interface ProgressProps extends ComponentProps {
|
|
|
33
32
|
* ```
|
|
34
33
|
*/
|
|
35
34
|
|
|
36
|
-
@class_ns( "x4" )
|
|
37
35
|
export class Progress extends Component<ProgressProps> {
|
|
36
|
+
static classPrefix = "x4";
|
|
38
37
|
|
|
39
38
|
private _bar: Component;
|
|
40
39
|
|
|
@@ -117,9 +117,8 @@
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// A row has no box of its own: its two cells go straight on the columns
|
|
120
|
-
// of the grid, which is how all the titles get the same width.
|
|
121
|
-
//
|
|
122
|
-
// and bottom line, is carried by its cells.
|
|
120
|
+
// of the grid, which is how all the titles get the same width. What a row
|
|
121
|
+
// looked like, background and bottom line, is carried by its cells.
|
|
123
122
|
.row {
|
|
124
123
|
display: contents;
|
|
125
124
|
|
|
@@ -21,7 +21,7 @@ import { HBox, VBox } from "../boxes/boxes"
|
|
|
21
21
|
import { Input } from "../input/input"
|
|
22
22
|
import { ListboxID, ListItem } from "../listbox/listbox"
|
|
23
23
|
import { Label, SimpleText } from "../label/label"
|
|
24
|
-
import { asap,
|
|
24
|
+
import { asap, isFunction, isNumber } from '../../core/core_tools';
|
|
25
25
|
import { Icon, ScrollView } from '../components'
|
|
26
26
|
import { ColorInput } from '../colorinput/colorinput'
|
|
27
27
|
import { EvColorChange } from '../colorpicker/colorpicker'
|
|
@@ -84,8 +84,8 @@ export interface PropertyProps extends ComponentProps {
|
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
86
|
|
|
87
|
-
@class_ns( "x4" )
|
|
88
87
|
export class PropertyGrid extends VBox {
|
|
88
|
+
static classPrefix = "x4";
|
|
89
89
|
|
|
90
90
|
private root: Component;
|
|
91
91
|
private groups: PropertyGroup[];
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
17
|
import { Component, ComponentEvents, ComponentProps, EvChange, makeUniqueComponentId } from '../../core/component';
|
|
18
|
-
import { class_ns } from '../../core/core_tools';
|
|
19
18
|
import { EventCallback } from '../../core/core_events';
|
|
20
19
|
|
|
21
20
|
import { Label } from '../label/label';
|
|
@@ -57,8 +56,8 @@ interface RadioProps extends ComponentProps {
|
|
|
57
56
|
* ```
|
|
58
57
|
*/
|
|
59
58
|
|
|
60
|
-
@class_ns( "x4" )
|
|
61
59
|
export class Radio extends Component<RadioProps,RadioEvents> {
|
|
60
|
+
static classPrefix = "x4";
|
|
62
61
|
|
|
63
62
|
private _check: HBox;
|
|
64
63
|
private _input: Input;
|
|
@@ -18,7 +18,7 @@ import { Component, ComponentEvents, ComponentProps, EvChange } from '../../core
|
|
|
18
18
|
import { EventCallback } from '../../core/core_events';
|
|
19
19
|
import { HBox } from '../boxes/boxes';
|
|
20
20
|
import { Icon } from '../icon/icon';
|
|
21
|
-
import {
|
|
21
|
+
import { IComponentInterface, IFormElement } from '../../core/core_tools';
|
|
22
22
|
|
|
23
23
|
import icons from "../assets/icons"
|
|
24
24
|
|
|
@@ -49,8 +49,8 @@ export interface RatingProps extends ComponentProps {
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
|
-
@class_ns( "x4" )
|
|
53
52
|
export class Rating extends HBox<RatingProps,RatingEventMap> {
|
|
53
|
+
static classPrefix = "x4";
|
|
54
54
|
|
|
55
55
|
private m_els: Component[];
|
|
56
56
|
|
|
@@ -104,7 +104,7 @@ export class Rating extends HBox<RatingProps,RatingEventMap> {
|
|
|
104
104
|
|
|
105
105
|
// the star clicked: its svg, or the Icon itself
|
|
106
106
|
private _on_click( ev: MouseEvent ) {
|
|
107
|
-
const n = this.m_els.findIndex( c => c.
|
|
107
|
+
const n = this.m_els.findIndex( c => c.contains( ev.target as Node ) );
|
|
108
108
|
if( n>=0 ) {
|
|
109
109
|
// the star of the value, clicked again: none is lit
|
|
110
110
|
this.setValue( n+1===this.props.value ? 0 : n+1 );
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { EventCallback } from '../../core/core_events';
|
|
19
19
|
import { Component, ComponentEvents, ComponentProps, EvChange, EvFocus } from '../../core/component';
|
|
20
|
-
import {
|
|
20
|
+
import { IComponentInterface, IFormElement, isArray } from '../../core/core_tools';
|
|
21
21
|
|
|
22
22
|
import { ListboxID, ListItem } from '../components';
|
|
23
23
|
|
|
@@ -57,8 +57,8 @@ interface SelectEvents extends ComponentEvents {
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
|
-
@class_ns( "x4" )
|
|
61
60
|
export class Select extends Component<SelectProps,SelectEvents> {
|
|
61
|
+
static classPrefix = "x4";
|
|
62
62
|
|
|
63
63
|
private _items: ListItem[];
|
|
64
64
|
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
:root {
|
|
18
18
|
--settingsview-toc-width: 210px;
|
|
19
|
-
--settingsview-section-background: var( --
|
|
20
|
-
--settingsview-section-title-background:
|
|
19
|
+
--settingsview-section-background: var( --background-primary );
|
|
20
|
+
--settingsview-section-title-background: transparent;
|
|
21
|
+
--settingsview-section-title-color: var( --accent-background );
|
|
21
22
|
--settingsview-hover-background: var( --color-primary-a20 );
|
|
22
23
|
--settingsview-marker: var( --accent-background );
|
|
23
24
|
}
|
|
@@ -92,13 +93,13 @@
|
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
// a section:
|
|
96
|
+
// a section: no frame, its title in the accent colour on a line
|
|
96
97
|
.section {
|
|
97
98
|
flex-shrink: 0;
|
|
98
99
|
width: 100%;
|
|
99
100
|
max-width: 900px;
|
|
100
101
|
padding: 0 8px 10px;
|
|
101
|
-
border:
|
|
102
|
+
border: none;
|
|
102
103
|
background: var( --settingsview-section-background );
|
|
103
104
|
overflow: hidden;
|
|
104
105
|
scroll-margin-top: 20px; // brought to the top: below the padding of the view
|
|
@@ -115,7 +116,7 @@
|
|
|
115
116
|
background: var( --settingsview-section-title-background );
|
|
116
117
|
font-size: 1.1rem;
|
|
117
118
|
font-weight: 600;
|
|
118
|
-
--label-color: var( --
|
|
119
|
+
--label-color: var( --settingsview-section-title-color );
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
> .description {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import { Component, ComponentEvent, ComponentEvents } from '../../core/component';
|
|
18
18
|
import { EventCallback } from '../../core/core_events';
|
|
19
|
-
import { class_ns } from '../../core/core_tools';
|
|
20
19
|
|
|
21
20
|
import { BoxProps, HBox, VBox } from '../boxes/boxes';
|
|
22
21
|
import { Input } from '../input/input';
|
|
@@ -43,8 +42,8 @@ export interface SettingItemProps extends BoxProps {
|
|
|
43
42
|
* together, put the items in a Form and give the controls a name.
|
|
44
43
|
*/
|
|
45
44
|
|
|
46
|
-
@class_ns( "x4" )
|
|
47
45
|
export class SettingItem extends VBox<SettingItemProps> {
|
|
46
|
+
static classPrefix = "x4";
|
|
48
47
|
|
|
49
48
|
constructor( props: SettingItemProps ) {
|
|
50
49
|
// the content goes under the name and the description, not in the box itself
|
|
@@ -112,13 +111,14 @@ function normalize( text: string ) {
|
|
|
112
111
|
* --settingsview-toc-width
|
|
113
112
|
* --settingsview-section-background
|
|
114
113
|
* --settingsview-section-title-background
|
|
114
|
+
* --settingsview-section-title-color
|
|
115
115
|
* --settingsview-hover-background
|
|
116
116
|
* --settingsview-marker
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
|
-
@class_ns( "x4" )
|
|
121
120
|
export class SettingsView<P extends SettingsViewProps = SettingsViewProps> extends VBox<P,SettingsViewEvents> {
|
|
121
|
+
static classPrefix = "x4";
|
|
122
122
|
|
|
123
123
|
// fields, not refs: refs belong to the classes that derive from this one
|
|
124
124
|
private _search: Input = null;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
17
|
import { Component, ComponentEvent, ComponentEvents, ComponentProps, componentFromDOM } from '../../core/component';
|
|
18
|
-
import {
|
|
18
|
+
import { Point } from '../../core/core_tools';
|
|
19
19
|
|
|
20
20
|
import "./sizer.module.scss"
|
|
21
21
|
|
|
@@ -43,8 +43,8 @@ type SizerType = "left" | "top" | "right" | "bottom" | "top-left" | "top-right"
|
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
@class_ns( "x4" )
|
|
47
46
|
export class CSizer extends Component<ComponentProps,CSizerEvent> {
|
|
47
|
+
static classPrefix = "x4";
|
|
48
48
|
|
|
49
49
|
private _type: SizerType;
|
|
50
50
|
private _ref: Component;
|
|
@@ -98,6 +98,15 @@ export class CSizer extends Component<ComponentProps,CSizerEvent> {
|
|
|
98
98
|
this._ref = null;
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
+
// cancelled by the browser (a touch taken by a scroll, a gesture...): no pointerup will
|
|
102
|
+
// come, the moves after are not a resize. The browser releases the capture itself
|
|
103
|
+
this.addDOMEvent( "pointercancel", ( ) => {
|
|
104
|
+
if( this._ref ) {
|
|
105
|
+
this.fire( "stop", { })
|
|
106
|
+
this._ref = null;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
101
110
|
this.addDOMEvent( "pointermove", ( e: PointerEvent ) => {
|
|
102
111
|
this._onMouseMove( e );
|
|
103
112
|
});
|
|
@@ -153,36 +162,17 @@ export class CSizer extends Component<ComponentProps,CSizerEvent> {
|
|
|
153
162
|
size = nr.width = (pt.x-rc.left);
|
|
154
163
|
}
|
|
155
164
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return c.getStyleValue( "flexGrow" )!==undefined;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if( this._type.includes("-prev") ) {
|
|
169
|
-
if( isFlex(this.prevElement() ) ) {
|
|
170
|
-
this._ref.setStyleValue( "flex", `0 0 ${size}px` );
|
|
165
|
+
// between two boxes: the neighbour sized by the basis of its flex; without a neighbour
|
|
166
|
+
// (the sizer first or last in its box), the box itself by its size
|
|
167
|
+
if( this._type.includes("-prev") || this._type.includes("-next") ) {
|
|
168
|
+
const neighbour = this._type.includes("-prev") ? this.prevElement( ) : this.nextElement( );
|
|
169
|
+
if( neighbour ) {
|
|
170
|
+
this._ref.setStyleValue( "flex", `0 0 ${size}px` );
|
|
171
171
|
}
|
|
172
172
|
else {
|
|
173
173
|
this._ref.setStyle( nr );
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
else if( this._type.includes("-next") ) {
|
|
177
|
-
if( isFlex(this.nextElement() ) ) {
|
|
178
|
-
this._ref.setStyleValue( "flex", `0 0 ${size}px` );
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
this._ref.setStyle( nr );
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
176
|
else {
|
|
187
177
|
this._ref.setStyle( nr );
|
|
188
178
|
}
|
|
@@ -195,15 +185,17 @@ export class CSizer extends Component<ComponentProps,CSizerEvent> {
|
|
|
195
185
|
}
|
|
196
186
|
}
|
|
197
187
|
|
|
198
|
-
@class_ns( "x4" )
|
|
199
188
|
export class HSizer extends CSizer {
|
|
189
|
+
static classPrefix = "x4";
|
|
190
|
+
|
|
200
191
|
constructor( next = true ) {
|
|
201
192
|
super( next ? "hsize-next" : "hsize-prev" );
|
|
202
193
|
}
|
|
203
194
|
}
|
|
204
195
|
|
|
205
|
-
@class_ns( "x4" )
|
|
206
196
|
export class VSizer extends CSizer {
|
|
197
|
+
static classPrefix = "x4";
|
|
198
|
+
|
|
207
199
|
constructor( next = true ) {
|
|
208
200
|
super( next ? "vsize-next" : "vsize-prev" );
|
|
209
201
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { EventCallback } from '../../core/core_events';
|
|
18
18
|
import { Component, ComponentEvents, ComponentProps, EvChange } from '../../core/component';
|
|
19
|
-
import {
|
|
19
|
+
import { IComponentInterface, IFormElement, Rect } from '../../core/core_tools';
|
|
20
20
|
|
|
21
21
|
import { HBox } from '../boxes/boxes';
|
|
22
22
|
import { Input } from '../input/input';
|
|
@@ -49,8 +49,8 @@ interface SliderProps extends ComponentProps {
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
|
-
@class_ns( "x4" )
|
|
53
52
|
export class Slider extends Component<SliderProps,SliderEvents> {
|
|
53
|
+
static classPrefix = "x4";
|
|
54
54
|
|
|
55
55
|
private _mdown = false;
|
|
56
56
|
private _irect: Rect = null;
|