x4js 2.0.20 → 2.0.22
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/lib/cjs/x4.css +1 -1
- package/lib/cjs/x4.js +2 -2
- package/lib/esm/x4.css +1 -1
- package/lib/esm/x4.mjs +2 -2
- package/lib/styles/x4.css +1 -1
- package/lib/types/x4js.d.ts +93 -77
- package/package.json +1 -1
- package/src/components/boxes/boxes.ts +33 -1
- package/src/components/canvas/canvas.ts +9 -3
- package/src/components/combobox/combobox.module.scss +13 -0
- package/src/components/combobox/combobox.ts +7 -0
- package/src/components/form/form.ts +4 -4
- package/src/components/gridview/gridview.ts +12 -9
- package/src/components/header/header.module.scss +2 -1
- package/src/components/header/header.ts +17 -5
- package/src/components/icon/icon.module.scss +1 -0
- package/src/components/label/label.module.scss +6 -1
- package/src/components/listbox/listbox.module.scss +35 -31
- package/src/components/listbox/listbox.ts +50 -12
- package/src/components/messages/messages.ts +14 -0
- package/src/components/notification/notification.ts +1 -1
- package/src/components/popup/popup.ts +13 -2
- package/src/components/propgrid/propgrid.ts +4 -2
- package/src/components/sizers/sizer.ts +4 -4
- package/src/components/tabs/tabs.module.scss +2 -2
- package/src/components/tabs/tabs.ts +28 -4
- package/src/components/textedit/textedit.ts +1 -1
- package/src/components/treeview/treeview.module.scss +9 -1
- package/src/components/treeview/treeview.ts +52 -13
- package/src/core/component.ts +46 -9
- package/src/core/core_data.ts +8 -8
- package/src/core/core_state.ts +1 -1
- package/src/core/core_tools.ts +2 -0
- package/lib/src/components/base.scss +0 -25
- package/lib/src/components/boxes/boxes.module.scss +0 -54
- package/lib/src/components/boxes/boxes.ts +0 -370
- package/lib/src/components/breadcrumb/breadcrumb.scss +0 -56
- package/lib/src/components/breadcrumb/breadcrumb.ts +0 -93
- package/lib/src/components/breadcrumb/chevron-right.svg +0 -1
- package/lib/src/components/btngroup/btngroup.module.scss +0 -41
- package/lib/src/components/btngroup/btngroup.ts +0 -153
- package/lib/src/components/button/button.module.scss +0 -173
- package/lib/src/components/button/button.ts +0 -185
- package/lib/src/components/calendar/calendar-check-sharp-light.svg +0 -1
- package/lib/src/components/calendar/calendar.module.scss +0 -163
- package/lib/src/components/calendar/calendar.ts +0 -327
- package/lib/src/components/calendar/chevron-left-sharp-light.svg +0 -1
- package/lib/src/components/calendar/chevron-right-sharp-light.svg +0 -1
- package/lib/src/components/canvas/canvas.module.scss +0 -25
- package/lib/src/components/canvas/canvas.ts +0 -189
- package/lib/src/components/canvas/canvas_ex.ts +0 -276
- package/lib/src/components/checkbox/check.svg +0 -4
- package/lib/src/components/checkbox/checkbox.module.scss +0 -142
- package/lib/src/components/checkbox/checkbox.ts +0 -140
- package/lib/src/components/colorinput/colorinput.module.scss +0 -65
- package/lib/src/components/colorinput/colorinput.ts +0 -91
- package/lib/src/components/colorinput/crosshairs-simple-sharp-light.svg +0 -1
- package/lib/src/components/colorpicker/colorpicker.module.scss +0 -133
- package/lib/src/components/colorpicker/colorpicker.ts +0 -482
- package/lib/src/components/combobox/combobox.module.scss +0 -133
- package/lib/src/components/combobox/combobox.ts +0 -275
- package/lib/src/components/combobox/updown.svg +0 -4
- package/lib/src/components/components.ts +0 -42
- package/lib/src/components/dialog/dialog.module.scss +0 -104
- package/lib/src/components/dialog/dialog.ts +0 -229
- package/lib/src/components/dialog/xmark-sharp-light.svg +0 -1
- package/lib/src/components/filedrop/cloud-arrow-up.svg +0 -1
- package/lib/src/components/filedrop/filedrop.module.scss +0 -70
- package/lib/src/components/filedrop/filedrop.ts +0 -131
- package/lib/src/components/form/form.module.scss +0 -38
- package/lib/src/components/form/form.ts +0 -172
- package/lib/src/components/gridview/arrow-down-light.svg +0 -1
- package/lib/src/components/gridview/arrow-up-light.svg +0 -1
- package/lib/src/components/gridview/gridview.module.scss +0 -324
- package/lib/src/components/gridview/gridview.ts +0 -1175
- package/lib/src/components/header/header.module.scss +0 -40
- package/lib/src/components/header/header.ts +0 -130
- package/lib/src/components/icon/icon.module.scss +0 -31
- package/lib/src/components/icon/icon.ts +0 -137
- package/lib/src/components/image/image.module.scss +0 -28
- package/lib/src/components/image/image.ts +0 -168
- package/lib/src/components/input/input.module.scss +0 -74
- package/lib/src/components/input/input.ts +0 -422
- package/lib/src/components/keyboard/arrow-up.svg +0 -1
- package/lib/src/components/keyboard/delete-left.svg +0 -1
- package/lib/src/components/keyboard/eye-slash.svg +0 -1
- package/lib/src/components/keyboard/keyboard.module.scss +0 -134
- package/lib/src/components/keyboard/keyboard.ts +0 -526
- package/lib/src/components/label/label.module.scss +0 -76
- package/lib/src/components/label/label.ts +0 -97
- package/lib/src/components/link/link.ts +0 -81
- package/lib/src/components/listbox/listbox.module.scss +0 -161
- package/lib/src/components/listbox/listbox.ts +0 -539
- package/lib/src/components/menu/caret-right-solid.svg +0 -1
- package/lib/src/components/menu/menu.module.scss +0 -117
- package/lib/src/components/menu/menu.ts +0 -174
- package/lib/src/components/messages/circle-exclamation.svg +0 -1
- package/lib/src/components/messages/messages.module.scss +0 -92
- package/lib/src/components/messages/messages.ts +0 -215
- package/lib/src/components/messages/pen-field.svg +0 -1
- package/lib/src/components/normalize.scss +0 -391
- package/lib/src/components/notification/circle-check-solid.svg +0 -1
- package/lib/src/components/notification/circle-exclamation-solid.svg +0 -1
- package/lib/src/components/notification/circle-notch-light.svg +0 -1
- package/lib/src/components/notification/notification.module.scss +0 -84
- package/lib/src/components/notification/notification.ts +0 -107
- package/lib/src/components/notification/xmark-sharp-light.svg +0 -1
- package/lib/src/components/panel/panel.module.scss +0 -60
- package/lib/src/components/panel/panel.ts +0 -58
- package/lib/src/components/popup/popup.module.scss +0 -51
- package/lib/src/components/popup/popup.ts +0 -442
- package/lib/src/components/progress/progress.module.scss +0 -57
- package/lib/src/components/progress/progress.ts +0 -44
- package/lib/src/components/propgrid/folder-closed.svg +0 -1
- package/lib/src/components/propgrid/folder-open.svg +0 -1
- package/lib/src/components/propgrid/progrid.module.scss +0 -112
- package/lib/src/components/propgrid/propgrid.ts +0 -288
- package/lib/src/components/propgrid/updown.svg +0 -4
- package/lib/src/components/radio/radio.module.scss +0 -147
- package/lib/src/components/radio/radio.svg +0 -4
- package/lib/src/components/radio/radio.ts +0 -142
- package/lib/src/components/rating/rating.module.scss +0 -23
- package/lib/src/components/rating/rating.ts +0 -131
- package/lib/src/components/rating/star-sharp-light.svg +0 -1
- package/lib/src/components/rating/star-sharp-solid.svg +0 -1
- package/lib/src/components/select/select.module.scss +0 -9
- package/lib/src/components/select/select.ts +0 -134
- package/lib/src/components/shared.scss +0 -137
- package/lib/src/components/sizers/sizer.module.scss +0 -90
- package/lib/src/components/sizers/sizer.ts +0 -132
- package/lib/src/components/slider/slider.module.scss +0 -118
- package/lib/src/components/slider/slider.ts +0 -198
- package/lib/src/components/switch/switch.module.scss +0 -127
- package/lib/src/components/switch/switch.ts +0 -62
- package/lib/src/components/tabs/tabs.module.scss +0 -45
- package/lib/src/components/tabs/tabs.ts +0 -205
- package/lib/src/components/textarea/textarea.module.scss +0 -63
- package/lib/src/components/textarea/textarea.ts +0 -125
- package/lib/src/components/textedit/textedit.module.scss +0 -116
- package/lib/src/components/textedit/textedit.ts +0 -115
- package/lib/src/components/themes.scss +0 -88
- package/lib/src/components/tickline/tickline.module.scss +0 -26
- package/lib/src/components/tickline/tickline.ts +0 -82
- package/lib/src/components/tooltips/circle-info-sharp-light.svg +0 -1
- package/lib/src/components/tooltips/comments-question.svg +0 -1
- package/lib/src/components/tooltips/tooltips.scss +0 -72
- package/lib/src/components/tooltips/tooltips.ts +0 -109
- package/lib/src/components/treeview/chevron-down-light.svg +0 -1
- package/lib/src/components/treeview/treeview.module.scss +0 -185
- package/lib/src/components/treeview/treeview.ts +0 -445
- package/lib/src/components/viewport/viewport.module.scss +0 -32
- package/lib/src/components/viewport/viewport.ts +0 -41
- package/lib/src/core/component.ts +0 -1066
- package/lib/src/core/core_application.ts +0 -265
- package/lib/src/core/core_colors.ts +0 -250
- package/lib/src/core/core_data.ts +0 -1310
- package/lib/src/core/core_dom.ts +0 -471
- package/lib/src/core/core_dragdrop.ts +0 -201
- package/lib/src/core/core_element.ts +0 -115
- package/lib/src/core/core_events.ts +0 -177
- package/lib/src/core/core_i18n.ts +0 -393
- package/lib/src/core/core_react.ts +0 -79
- package/lib/src/core/core_router.ts +0 -237
- package/lib/src/core/core_state.ts +0 -62
- package/lib/src/core/core_styles.ts +0 -214
- package/lib/src/core/core_svg.ts +0 -712
- package/lib/src/core/core_tools.ts +0 -906
- package/lib/src/types/scss.d.ts +0 -4
- package/lib/src/types/svg.d.ts +0 -1
- package/lib/src/types/x4react.d.ts +0 -9
- package/lib/src/x4.scss +0 -19
- package/lib/src/x4.ts +0 -35
- package/lib/src/x4tsx.d.ts +0 -25
|
@@ -122,6 +122,18 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
removeItem( name: string ) {
|
|
126
|
+
const index = this._items.findIndex( x => x.name==name );
|
|
127
|
+
if( index>=0 ) {
|
|
128
|
+
const pg = this._items[index];
|
|
129
|
+
if( pg?.page ) {
|
|
130
|
+
this.removeChild( pg.page );
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this._items.splice( index, 1 );
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
125
137
|
select( name: string ) {
|
|
126
138
|
let sel = this.query( `:scope > .selected` );
|
|
127
139
|
if( sel ) {
|
|
@@ -143,7 +155,7 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
|
|
|
143
155
|
sel.setClass( "selected", true );
|
|
144
156
|
}
|
|
145
157
|
|
|
146
|
-
asap( ( ) => this.fire( "pageChange", { selection: pg.name, empty: !sel } ) );
|
|
158
|
+
asap( ( ) => this.fire( "pageChange", { selection: [pg.name], empty: !sel } ) );
|
|
147
159
|
}
|
|
148
160
|
|
|
149
161
|
return pg?.page;
|
|
@@ -177,6 +189,26 @@ export class StackBox<P extends StackBoxProps = StackBoxProps, E extends StackeB
|
|
|
177
189
|
return pg ? pg.content : null;
|
|
178
190
|
}
|
|
179
191
|
|
|
192
|
+
/**
|
|
193
|
+
*
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
getPageCount( ) {
|
|
197
|
+
return this._items.length;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
*
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
enumPageNames( ) {
|
|
205
|
+
return this._items.map( x => x.name );
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
*
|
|
210
|
+
*/
|
|
211
|
+
|
|
180
212
|
getItem( name: string ) {
|
|
181
213
|
const pg = this._items.find( x => x.name==name );
|
|
182
214
|
return pg;
|
|
@@ -30,8 +30,9 @@ interface CanvasEventMap extends ComponentEvents {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface CanvasProps extends ComponentProps {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
paint_cb: (ctx: CanvasEx ) => void; // simple callback
|
|
34
|
+
paint: EventCallback<EvPaint> // or standard event (slower)
|
|
35
|
+
clear?: boolean; // clear background before painting
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
|
|
@@ -179,7 +180,12 @@ export class Canvas extends Component<CanvasProps, CanvasEventMap> {
|
|
|
179
180
|
|
|
180
181
|
protected paint(ctx: CanvasEx ) {
|
|
181
182
|
try {
|
|
182
|
-
this.
|
|
183
|
+
if( this.props.paint_cb ) {
|
|
184
|
+
this.props.paint_cb( ctx );
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
this.fire('paint', { ctx } );
|
|
188
|
+
}
|
|
183
189
|
}
|
|
184
190
|
catch (x) {
|
|
185
191
|
console.assert(false, x);
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
--combobox-btn-background: inherit;
|
|
27
27
|
--combobox-btn-color: var( --text-secondary );
|
|
28
28
|
--combobox-btn-color-hover: var( --text-primary );
|
|
29
|
+
|
|
30
|
+
--combo-tree-indent: 1em;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
.x4dropdownlist {
|
|
@@ -33,6 +35,8 @@
|
|
|
33
35
|
@extend .hbox;
|
|
34
36
|
|
|
35
37
|
max-height: 250px;
|
|
38
|
+
max-width: 50vw;
|
|
39
|
+
|
|
36
40
|
position: absolute;
|
|
37
41
|
background-color: var( --dropdown-background );
|
|
38
42
|
border: 1px solid var( --dropdown-border );
|
|
@@ -47,6 +51,15 @@
|
|
|
47
51
|
|
|
48
52
|
.x4item {
|
|
49
53
|
white-space: nowrap;
|
|
54
|
+
|
|
55
|
+
&.level-1 { padding-left: calc(var(--combo-tree-indent) * 1 ); }
|
|
56
|
+
&.level-2 { padding-left: calc(var(--combo-tree-indent) * 2 ); }
|
|
57
|
+
&.level-3 { padding-left: calc(var(--combo-tree-indent) * 3 ); }
|
|
58
|
+
&.level-4 { padding-left: calc(var(--combo-tree-indent) * 4 ); }
|
|
59
|
+
&.level-5 { padding-left: calc(var(--combo-tree-indent) * 5 ); }
|
|
60
|
+
&.level-6 { padding-left: calc(var(--combo-tree-indent) * 6 ); }
|
|
61
|
+
&.level-7 { padding-left: calc(var(--combo-tree-indent) * 7 ); }
|
|
62
|
+
&.level-8 { padding-left: calc(var(--combo-tree-indent) * 8 ); }
|
|
50
63
|
}
|
|
51
64
|
}
|
|
52
65
|
}
|
|
@@ -128,6 +128,9 @@ export class Combobox extends Component<ComboboxProps,ComboboxEvents> {
|
|
|
128
128
|
|
|
129
129
|
const _select = ( sel: ListboxID ) => {
|
|
130
130
|
const itm = list.getItem(sel);
|
|
131
|
+
if( itm ) {
|
|
132
|
+
list.select( sel, false );
|
|
133
|
+
}
|
|
131
134
|
|
|
132
135
|
//TODO: unsafehtml
|
|
133
136
|
//@ts-ignore
|
|
@@ -270,6 +273,10 @@ export class Combobox extends Component<ComboboxProps,ComboboxEvents> {
|
|
|
270
273
|
|
|
271
274
|
return super.queryInterface( name );
|
|
272
275
|
}
|
|
276
|
+
|
|
277
|
+
getInput( ) {
|
|
278
|
+
return this._input;
|
|
279
|
+
}
|
|
273
280
|
}
|
|
274
281
|
|
|
275
282
|
|
|
@@ -20,7 +20,7 @@ import { Box, BoxProps } from '../boxes/boxes';
|
|
|
20
20
|
import "./form.module.scss"
|
|
21
21
|
|
|
22
22
|
//type FormValue = string | number | boolean;
|
|
23
|
-
export type FormValues = Record<string,
|
|
23
|
+
export type FormValues = Record<string,any>;
|
|
24
24
|
|
|
25
25
|
export interface FormProps extends BoxProps {
|
|
26
26
|
autoComplete?: boolean;
|
|
@@ -81,8 +81,8 @@ export class Form<P extends FormProps = FormProps> extends Box<P> {
|
|
|
81
81
|
*
|
|
82
82
|
*/
|
|
83
83
|
|
|
84
|
-
getValues( ):
|
|
85
|
-
const result:
|
|
84
|
+
getValues<T extends FormValues = FormValues>( ): T {
|
|
85
|
+
const result: any = {}
|
|
86
86
|
const items = this._get_inputs( );
|
|
87
87
|
|
|
88
88
|
items.forEach( x => {
|
|
@@ -94,7 +94,7 @@ export class Form<P extends FormProps = FormProps> extends Box<P> {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
return result;
|
|
97
|
+
return result as T;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { Component, ComponentContent, ComponentEvents, ComponentProps, EvClick, EvContextMenu, EvDblClick, EvSelectionChange, componentFromDOM } from '../../core/component';
|
|
19
19
|
import { class_ns, isNumber, isString, setWaitCursor } from '../../core/core_tools';
|
|
20
|
-
import { DataModel, DataStore, DataView, DataRecord,
|
|
20
|
+
import { DataModel, DataStore, DataView, DataRecord, EvViewChange } from '../../core/core_data';
|
|
21
21
|
import { EventCallback } from '../../core/core_events';
|
|
22
22
|
import { kbNav } from '../../core/core_tools';
|
|
23
23
|
|
|
@@ -43,7 +43,7 @@ const SCROLL_LIMIT = 200;
|
|
|
43
43
|
*
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
-
interface GridColumn {
|
|
46
|
+
export interface GridColumn {
|
|
47
47
|
id: any;
|
|
48
48
|
title: string;
|
|
49
49
|
width: number;
|
|
@@ -499,14 +499,15 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
|
|
|
499
499
|
|
|
500
500
|
private _sortCol(col: number, ascending?: boolean ) {
|
|
501
501
|
|
|
502
|
-
setWaitCursor(true);
|
|
503
|
-
|
|
504
502
|
// to allow cursor
|
|
505
503
|
this.setTimeout("sort", 50, () => {
|
|
506
504
|
let asc = true;
|
|
507
505
|
|
|
508
506
|
// already sorted ?
|
|
509
|
-
const scol = this.query(`.col-header [data-col="${col}"`);
|
|
507
|
+
const scol = this.query(`.col-header .cell[data-col="${col}"]`);
|
|
508
|
+
if( !scol ) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
510
511
|
|
|
511
512
|
if( ascending===undefined ) {
|
|
512
513
|
if (scol.hasClass("sorted")) {
|
|
@@ -541,6 +542,8 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
|
|
|
541
542
|
}
|
|
542
543
|
}
|
|
543
544
|
|
|
545
|
+
setWaitCursor(true);
|
|
546
|
+
|
|
544
547
|
this._dataview.sort([{
|
|
545
548
|
field: cdata.id,
|
|
546
549
|
ascending: asc,
|
|
@@ -828,7 +831,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
|
|
|
828
831
|
}
|
|
829
832
|
}
|
|
830
833
|
|
|
831
|
-
const maxr = this._dataview.getCount();
|
|
834
|
+
const maxr = this._dataview ? this._dataview.getCount() : 0;
|
|
832
835
|
let maxh = maxr;
|
|
833
836
|
|
|
834
837
|
if (maxr < SCROLL_LIMIT) {
|
|
@@ -874,7 +877,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
|
|
|
874
877
|
|
|
875
878
|
// WHEEL
|
|
876
879
|
this.addDOMEvent("wheel", (ev: WheelEvent) => {
|
|
877
|
-
if (ev.deltaY && this._dataview.getCount() >= SCROLL_LIMIT) {
|
|
880
|
+
if (ev.deltaY && this._dataview && this._dataview.getCount() >= SCROLL_LIMIT) {
|
|
878
881
|
this._viewport.dom.scrollBy(0, ev.deltaY < 0 ? -1 : 1);
|
|
879
882
|
ev.stopPropagation();
|
|
880
883
|
ev.preventDefault();
|
|
@@ -1032,7 +1035,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
|
|
|
1032
1035
|
const rc = this.getBoundingRect();
|
|
1033
1036
|
|
|
1034
1037
|
// rows
|
|
1035
|
-
const rowc = this._dataview.getCount();
|
|
1038
|
+
const rowc = this._dataview ? this._dataview.getCount() : 0;
|
|
1036
1039
|
const mul = rowc < SCROLL_LIMIT ? this._row_height : 1;
|
|
1037
1040
|
|
|
1038
1041
|
const start = Math.floor(this._top / mul);
|
|
@@ -1132,7 +1135,7 @@ export class Gridview<P extends GridviewProps = GridviewProps, E extends Gridvie
|
|
|
1132
1135
|
});
|
|
1133
1136
|
|
|
1134
1137
|
const rec = this._dataview.getByIndex( rowid );
|
|
1135
|
-
this.fire("selectionChange", { selection: rec, empty: false } );
|
|
1138
|
+
this.fire("selectionChange", { selection: [rec], empty: false } );
|
|
1136
1139
|
}
|
|
1137
1140
|
|
|
1138
1141
|
/**
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
:root {
|
|
4
4
|
--header-background-hover: rgba(100,100,100,0.1);
|
|
5
5
|
--header-sizer-hover: var( --border-hover );
|
|
6
|
+
--header-color: var( --text-primary );
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.x4header {
|
|
9
|
-
@extend .flex;
|
|
10
10
|
width: 100%;
|
|
11
11
|
|
|
12
12
|
overflow: hidden;
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
white-space: nowrap;
|
|
27
27
|
text-overflow: ellipsis;
|
|
28
28
|
overflow: hidden;
|
|
29
|
+
color: var( --header-color );
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
&:hover {
|
|
@@ -15,10 +15,18 @@ interface HeaderItem {
|
|
|
15
15
|
|
|
16
16
|
interface HeaderProps extends Omit<ComponentProps,"content"> {
|
|
17
17
|
items: HeaderItem[]
|
|
18
|
+
target?: Component; // target element to set header col variable width var( --hdr-item-{name}-width )
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
/**
|
|
22
|
+
* by default when a header item is resized, the 'target' style '--{name}-width' is updated
|
|
23
|
+
* if you listbox has a header and 3 cols named A, B, C then in your css, use
|
|
21
24
|
*
|
|
25
|
+
* .my-listbox {
|
|
26
|
+
* --A-width: 10px;
|
|
27
|
+
* --B-width: 50px;
|
|
28
|
+
* --C-width: 100px;
|
|
29
|
+
* }
|
|
22
30
|
*/
|
|
23
31
|
|
|
24
32
|
@class_ns( "x4" )
|
|
@@ -94,13 +102,13 @@ export class Header extends HBox<HeaderProps> {
|
|
|
94
102
|
|
|
95
103
|
const rc = this.getBoundingRect( );
|
|
96
104
|
|
|
97
|
-
let
|
|
105
|
+
let rest = (rc.width-filled-10);
|
|
98
106
|
const unit = Math.ceil( rest/count );
|
|
99
107
|
|
|
100
|
-
console.log( "filled", filled );
|
|
101
|
-
console.log( "count", count );
|
|
102
|
-
console.log( "rest", rest );
|
|
103
|
-
console.log( "unit", unit );
|
|
108
|
+
//console.log( "filled", filled );
|
|
109
|
+
//console.log( "count", count );
|
|
110
|
+
//console.log( "rest", rest );
|
|
111
|
+
//console.log( "unit", unit );
|
|
104
112
|
|
|
105
113
|
let fullw = 0;
|
|
106
114
|
this._els.forEach( c => {
|
|
@@ -116,6 +124,10 @@ export class Header extends HBox<HeaderProps> {
|
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
c.setWidth( width );
|
|
127
|
+
|
|
128
|
+
const item = c.getInternalData<HeaderItem>( 'data' );
|
|
129
|
+
this.props.target?.setStyleVariable( `--${item.name}-width`, width + "px");
|
|
130
|
+
|
|
119
131
|
fullw += width;
|
|
120
132
|
} );
|
|
121
133
|
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
--label-background: transparent;
|
|
21
21
|
--label-color: var( --text-ternary );
|
|
22
22
|
--label-icon-color: rgb(0 0 0 / 44%);
|
|
23
|
+
--label-color-disa: var( --disabled-color-dark );
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.x4label {
|
|
@@ -66,11 +67,15 @@
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
|
|
70
70
|
.x4simpletext {
|
|
71
71
|
text-align: left;
|
|
72
72
|
&.al-center { text-align: center; }
|
|
73
73
|
&.al-right { text-align: right; }
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
[disabled] .x4label,
|
|
77
|
+
[disabled] .x4simpletext {
|
|
78
|
+
color: var(--label-color-disa);
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
outline: none;
|
|
47
47
|
|
|
48
48
|
&>.x4header {
|
|
49
|
-
border-bottom: 1px solid var( --
|
|
49
|
+
border-bottom: 1px solid var( --border );
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
&>.body {
|
|
@@ -59,45 +59,45 @@
|
|
|
59
59
|
|
|
60
60
|
&> .x4viewport {
|
|
61
61
|
display: table;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.x4item {
|
|
65
|
+
@extend .flex;
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
padding: 4px;
|
|
67
|
-
background-color: transparent;
|
|
68
|
-
color: var( --color-gray-9 );
|
|
67
|
+
padding: 4px;
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
color: var( --text-primary );
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
71
|
+
&> .x4label {
|
|
72
|
+
color: inherit;
|
|
73
|
+
padding: 2px 6px;
|
|
74
|
+
|
|
75
|
+
#icon {
|
|
76
|
+
color: var( --listbox-icon-color );
|
|
77
|
+
fill: var( --listbox-icon-color );
|
|
78
78
|
}
|
|
79
|
+
}
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
&:hover {
|
|
82
|
+
background-color: var( --listbox-item-background-hover );
|
|
83
|
+
}
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
&.selected {
|
|
86
|
+
background-color: var( --listbox-item-background-sel );
|
|
87
|
+
color: var( --listbox-item-color-sel );
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
89
|
+
&> .x4label {
|
|
90
|
+
#icon {
|
|
91
|
+
color: var( --listbox-item-color-sel );
|
|
92
|
+
fill: var( --listbox-item-color-sel );
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
//&:active{
|
|
97
|
-
//background-color: var( --color-80 );
|
|
98
|
-
//color: var(--color-0);
|
|
99
|
-
//}
|
|
100
95
|
}
|
|
96
|
+
|
|
97
|
+
//&:active{
|
|
98
|
+
//background-color: var( --color-80 );
|
|
99
|
+
//color: var(--color-0);
|
|
100
|
+
//}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -138,6 +138,10 @@
|
|
|
138
138
|
&:focus {
|
|
139
139
|
background-color: var( --ol-button-background-hover );
|
|
140
140
|
}
|
|
141
|
+
|
|
142
|
+
&:disabled {
|
|
143
|
+
color: var( --disabled-color-dark );
|
|
144
|
+
}
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
}
|
|
@@ -16,9 +16,11 @@
|
|
|
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, class_ns, isArray, UnsafeHtml } from '../../core/core_tools';
|
|
19
|
+
import { kbNav, class_ns, isArray, UnsafeHtml, asap } from '../../core/core_tools';
|
|
20
20
|
|
|
21
21
|
import { ScrollView, Viewport } from '../viewport/viewport';
|
|
22
|
+
import { Header } from '../header/header';
|
|
23
|
+
|
|
22
24
|
import { HBox } from '../boxes/boxes';
|
|
23
25
|
import { Label } from '../label/label';
|
|
24
26
|
|
|
@@ -55,7 +57,7 @@ interface ListboxEvents extends ComponentEvents {
|
|
|
55
57
|
interface ListboxProps extends Omit<ComponentProps,'content'> {
|
|
56
58
|
items?: ListItem[];
|
|
57
59
|
renderer?: ( item: ListItem ) => Component;
|
|
58
|
-
|
|
60
|
+
header?: Header;
|
|
59
61
|
footer?: Component,
|
|
60
62
|
checkable?: true,
|
|
61
63
|
multisel?: true,
|
|
@@ -98,8 +100,12 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
|
98
100
|
props.footer.setAttribute( "id", "footer" );
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
if( props.header ) {
|
|
104
|
+
props.header.setAttribute( "id", "header" );
|
|
105
|
+
}
|
|
106
|
+
|
|
101
107
|
this.setContent( [
|
|
102
|
-
|
|
108
|
+
props.header ? props.header : null,
|
|
103
109
|
scroller,
|
|
104
110
|
props.footer,
|
|
105
111
|
] );
|
|
@@ -342,7 +348,12 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
|
342
348
|
|
|
343
349
|
if( !ids.length ) {
|
|
344
350
|
if( this._multisel.size ) {
|
|
345
|
-
|
|
351
|
+
if( notify ) {
|
|
352
|
+
this.clearSelection( );
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
this._clearSelection( );
|
|
356
|
+
}
|
|
346
357
|
}
|
|
347
358
|
|
|
348
359
|
return;
|
|
@@ -361,7 +372,9 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
|
361
372
|
}
|
|
362
373
|
});
|
|
363
374
|
|
|
364
|
-
|
|
375
|
+
if( notify ) {
|
|
376
|
+
this.fire( "selectionChange", { selection: this.getSelection(), empty: this._multisel.size==0 } );
|
|
377
|
+
}
|
|
365
378
|
}
|
|
366
379
|
}
|
|
367
380
|
|
|
@@ -411,15 +424,29 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
|
411
424
|
|
|
412
425
|
this.clearSelection( );
|
|
413
426
|
this._view.clearContent( );
|
|
414
|
-
this._items = items;
|
|
427
|
+
this._items = items ?? [];
|
|
415
428
|
|
|
416
|
-
|
|
429
|
+
let upsel = false;
|
|
430
|
+
|
|
431
|
+
if( this._items.length ) {
|
|
417
432
|
const content = items.map( x => this.renderItem(x) );
|
|
418
433
|
this._view.setContent( content );
|
|
419
434
|
|
|
420
435
|
if( keepSel ) {
|
|
421
436
|
this.select( oldSel );
|
|
422
437
|
}
|
|
438
|
+
else {
|
|
439
|
+
upsel = true;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
upsel = true;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if( upsel ) {
|
|
447
|
+
this.setTimeout( "sel", 100, ( ) => {
|
|
448
|
+
this.fire( "selectionChange", { selection: [], empty: true } );
|
|
449
|
+
} );
|
|
423
450
|
}
|
|
424
451
|
}
|
|
425
452
|
|
|
@@ -452,7 +479,7 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
|
452
479
|
*
|
|
453
480
|
*/
|
|
454
481
|
|
|
455
|
-
filter( filter: string ) {
|
|
482
|
+
filter( filter: string | RegExp ) {
|
|
456
483
|
const childs = this._view.enumChildComponents( false );
|
|
457
484
|
|
|
458
485
|
if( !filter ) {
|
|
@@ -460,13 +487,24 @@ export class Listbox extends Component<ListboxProps,ListboxEvents> {
|
|
|
460
487
|
}
|
|
461
488
|
else {
|
|
462
489
|
// get list of visible items
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
490
|
+
let filtred: Set<ListboxID>;
|
|
491
|
+
|
|
492
|
+
if( filter instanceof RegExp ) {
|
|
493
|
+
const f = filter as RegExp;
|
|
494
|
+
filtred = new Set( this._items
|
|
495
|
+
.filter( x => f.test(x.text as string) )
|
|
496
|
+
.map( x => x.id ) );
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
const f = filter.toUpperCase( );
|
|
500
|
+
filtred = new Set( this._items
|
|
501
|
+
.filter( x => x.text.toUpperCase().includes(f) )
|
|
502
|
+
.map( x => x.id ) );
|
|
503
|
+
}
|
|
466
504
|
|
|
467
505
|
// now hide all elements not in list
|
|
468
506
|
childs.forEach( x => {
|
|
469
|
-
x.show( filtred.
|
|
507
|
+
x.show( filtred.has( x.getInternalData( "id" ) ) );
|
|
470
508
|
});
|
|
471
509
|
}
|
|
472
510
|
}
|
|
@@ -209,7 +209,21 @@ export class PromptBox extends Dialog<DialogProps>
|
|
|
209
209
|
|
|
210
210
|
box.show();
|
|
211
211
|
} );
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
static show( msg: string | UnsafeHtml, editor: Component, title: string, callback: ( btn: string ) => boolean | Promise<boolean> | Promise<void> ) {
|
|
212
215
|
|
|
216
|
+
const box = this._create( msg, editor, title );
|
|
217
|
+
|
|
218
|
+
box.on( "btnclick", ( ev ) => {
|
|
219
|
+
asap( async ( ) => {
|
|
220
|
+
if( await callback( ev.button )!==false ) {
|
|
221
|
+
box.close()
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
box.show();
|
|
213
227
|
}
|
|
214
228
|
}
|
|
215
229
|
|
|
@@ -178,8 +178,19 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = Po
|
|
|
178
178
|
this.__remove( );
|
|
179
179
|
|
|
180
180
|
if( this._ismodal ) {
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
// modal1.show()
|
|
182
|
+
// modal2.show()
|
|
183
|
+
// modal1.hide()
|
|
184
|
+
if( modal_stack[modal_stack.length-1]!=this ) {
|
|
185
|
+
const idx = modal_stack.findIndex( x => x===this );
|
|
186
|
+
if( idx>=0 ) {
|
|
187
|
+
modal_stack.splice( idx, 1 );
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
modal_stack.pop( );
|
|
192
|
+
this._hideModalMask( );
|
|
193
|
+
}
|
|
183
194
|
}
|
|
184
195
|
|
|
185
196
|
// remove from popup list
|
|
@@ -81,7 +81,7 @@ export class PropertyGrid extends VBox {
|
|
|
81
81
|
|
|
82
82
|
setItems( _grps: PropertyGroup[] ) {
|
|
83
83
|
|
|
84
|
-
this.groups = _grps;
|
|
84
|
+
this.groups = _grps.filter( x => !!x );
|
|
85
85
|
//this.groups.sort( (a,b) => {return a.title>b.title ? 1 : 0} );
|
|
86
86
|
|
|
87
87
|
let items: Component[] = [];
|
|
@@ -89,7 +89,9 @@ export class PropertyGrid extends VBox {
|
|
|
89
89
|
for( const g of this.groups ) {
|
|
90
90
|
items.push( this.makeGroupHeader(g) );
|
|
91
91
|
g.items.forEach( i => {
|
|
92
|
-
|
|
92
|
+
if( i ) {
|
|
93
|
+
items.push( this.makePropertyRow(i) );
|
|
94
|
+
}
|
|
93
95
|
});
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -23,7 +23,7 @@ import "./sizer.module.scss"
|
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
interface EvSizeChange extends ComponentEvent {
|
|
26
|
+
export interface EvSizeChange extends ComponentEvent {
|
|
27
27
|
size: number;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ interface CSizerEvent extends ComponentEvents {
|
|
|
33
33
|
stop: ComponentEvent;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
type SizerType = "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
36
|
+
type SizerType = "left" | "top" | "right" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right" ;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
*
|
|
@@ -117,11 +117,11 @@ export class CSizer extends Component<ComponentProps,CSizerEvent> {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
if( this._type.includes("right") ) {
|
|
120
|
-
//nr.left = rc.left;
|
|
121
120
|
nr.width = (pt.x-rc.left);
|
|
122
|
-
|
|
121
|
+
}
|
|
123
122
|
|
|
124
123
|
this._ref.setStyle( nr );
|
|
124
|
+
//this._ref.setStyleValue( "flexGrow", 0 );
|
|
125
125
|
|
|
126
126
|
const nrc = this._ref.getBoundingRect( );
|
|
127
127
|
this.fire( "resize", { size: horz ? nrc.width : nrc.height })
|