x4js 2.2.60 → 2.2.62
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/package.json +1 -1
- package/src/components/btngroup/btngroup.module.scss +3 -3
- package/src/components/gridview/gridview.module.scss +18 -14
- package/src/components/listbox/listbox.ts +1 -1
- package/src/components/monaco/monaco.ts +4 -5
- package/src/components/popup/popup.ts +7 -5
- package/src/components/propgrid/progrid.module.scss +1 -1
- package/src/components/sizers/sizer.ts +1 -1
- package/src/components/tickline/tickline.module.scss +6 -0
- package/src/components/tickline/tickline.ts +42 -15
- package/src/components/tooltips/tooltips.scss +0 -1
- package/src/core/component.ts +1 -1
- package/src/core/core_data.ts +17 -11
- package/src/core/core_svg.ts +3 -0
- package/src/core/core_tools.ts +10 -3
- package/src/x4.d.ts +26 -13
package/package.json
CHANGED
|
@@ -110,20 +110,24 @@
|
|
|
110
110
|
left: 0;
|
|
111
111
|
top: 0;
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
113
|
+
&:has(.empty) {
|
|
114
|
+
width: 100% !important;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.empty {
|
|
118
|
+
position: absolute;
|
|
119
|
+
left: 50%;
|
|
120
|
+
top: 30px;
|
|
121
|
+
transform: translateX(-50%);
|
|
122
|
+
width: fit-content;
|
|
123
|
+
|
|
124
|
+
#icon {
|
|
125
|
+
height: 64px;
|
|
126
|
+
fill: var( --accent-background );
|
|
127
|
+
opacity: 50%;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
127
131
|
|
|
128
132
|
.row {
|
|
129
133
|
position: absolute;
|
|
@@ -4,11 +4,10 @@ import { Component, ComponentProps } from '../../core/component';
|
|
|
4
4
|
import Monaco from './bin/monaco';
|
|
5
5
|
import "./monaco.module.scss"
|
|
6
6
|
|
|
7
|
-
export type IMonarchLanguage =
|
|
8
|
-
export type CompletionItem =
|
|
9
|
-
export type CompletionItemProvider =
|
|
10
|
-
|
|
11
|
-
export { IRange, }
|
|
7
|
+
export type IMonarchLanguage = Monaco.languages.IMonarchLanguage;
|
|
8
|
+
export type CompletionItem = Monaco.languages.CompletionItem;
|
|
9
|
+
export type CompletionItemProvider = Monaco.languages.CompletionItemProvider;
|
|
10
|
+
export type IRange = Monaco.IRange;
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
interface MonacoEditorProps extends ComponentProps {
|
|
@@ -145,10 +145,11 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = Po
|
|
|
145
145
|
this._do_show( ); // to compute size
|
|
146
146
|
|
|
147
147
|
const fixpos = ( ) => {
|
|
148
|
-
const
|
|
148
|
+
const self = this.dom as HTMLElement;
|
|
149
|
+
|
|
149
150
|
this.setStyle( {
|
|
150
|
-
left: ((
|
|
151
|
-
top: ((
|
|
151
|
+
left: ((document.body.offsetWidth - self.offsetWidth) / 2) +'px',
|
|
152
|
+
top: ((document.body.offsetHeight - self.offsetHeight) / 2) +'px',
|
|
152
153
|
} );
|
|
153
154
|
}
|
|
154
155
|
|
|
@@ -174,13 +175,14 @@ export class Popup<P extends PopupProps = PopupProps, E extends PopupEvents = Po
|
|
|
174
175
|
this.setStyleValue( "left", x );
|
|
175
176
|
this.setStyleValue( "top", y );
|
|
176
177
|
|
|
177
|
-
|
|
178
|
+
//TODO: check is already visible
|
|
178
179
|
this._do_show( ); // to compute size
|
|
179
180
|
|
|
180
|
-
|
|
181
|
+
const rc = this.getBoundingRect( ).scale( 1/zm );
|
|
181
182
|
const sbw = getScrollbarSize( );
|
|
182
183
|
|
|
183
184
|
const screen_width = window.innerWidth - sbw;
|
|
185
|
+
|
|
184
186
|
if( rc.right>screen_width ) {
|
|
185
187
|
this.setStyleValue( "left", screen_width-rc.width );
|
|
186
188
|
}
|
|
@@ -17,10 +17,16 @@
|
|
|
17
17
|
:root {
|
|
18
18
|
--tickline-axis-color: var( --border );
|
|
19
19
|
--tickline-color: var( --accent-color );
|
|
20
|
+
--tickline-width: 1px;
|
|
20
21
|
--tickline-background: white;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.x4tickline {
|
|
24
25
|
position: relative;
|
|
25
26
|
background-color: var( --tickline-background );
|
|
27
|
+
|
|
28
|
+
// .tickline-line {
|
|
29
|
+
// stroke: var( --tickline-color );
|
|
30
|
+
// stroke-width: var( --tickline-width );
|
|
31
|
+
// }
|
|
26
32
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvgBuilder, SvgComponent } from '../../core/core_svg';
|
|
2
2
|
import { Color } from '../../core/core_colors';
|
|
3
3
|
import { Component, ComponentProps } from '../../core/component';
|
|
4
|
-
import { class_ns } from '../../core/core_tools';
|
|
5
4
|
|
|
6
5
|
import "./tickline.module.scss"
|
|
6
|
+
import { class_ns } from '../../core/core_tools';
|
|
7
7
|
|
|
8
8
|
interface TickLineProps extends ComponentProps {
|
|
9
9
|
values: number[];
|
|
@@ -12,6 +12,10 @@ interface TickLineProps extends ComponentProps {
|
|
|
12
12
|
color?: Color;
|
|
13
13
|
background?: Color;
|
|
14
14
|
type: "bars" | "line";
|
|
15
|
+
display?: {
|
|
16
|
+
tooltips?: boolean; // display values tootips
|
|
17
|
+
axis?: boolean; // display axis
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/**
|
|
@@ -22,6 +26,9 @@ interface TickLineProps extends ComponentProps {
|
|
|
22
26
|
* --tickline-color
|
|
23
27
|
* --tickline-background
|
|
24
28
|
* ```
|
|
29
|
+
*
|
|
30
|
+
* by default values are in percent.
|
|
31
|
+
*
|
|
25
32
|
*/
|
|
26
33
|
|
|
27
34
|
@class_ns( "x4" )
|
|
@@ -36,32 +43,39 @@ export class TickLine extends Component<TickLineProps> {
|
|
|
36
43
|
update( ) {
|
|
37
44
|
const props = this.props;
|
|
38
45
|
const vals = props.values;
|
|
46
|
+
const padding = 4;
|
|
39
47
|
|
|
40
48
|
if( !vals.length ) {
|
|
41
49
|
this.clearContent( );
|
|
42
50
|
return;
|
|
43
51
|
}
|
|
44
52
|
|
|
45
|
-
const rc = this.getBoundingRect( );
|
|
46
|
-
|
|
53
|
+
const rc = this.getBoundingRect( ).moveTo(0,0).inflate( -padding );
|
|
54
|
+
|
|
55
|
+
const min = props.min ?? 0;
|
|
47
56
|
const max = props.max ?? 100;
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
if( max<=min || rc.width<=0 || rc.height<=0 ) {
|
|
59
|
+
this.clearContent( );
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const xmul = props.type=="line" ? rc.width/(vals.length-1) : rc.width/vals.length;
|
|
50
64
|
const ymul = rc.height/(max-min);
|
|
51
65
|
|
|
52
|
-
const b
|
|
66
|
+
const b = rc.bottom;
|
|
53
67
|
|
|
54
68
|
const bld = new SvgBuilder( );
|
|
55
69
|
|
|
56
70
|
if( props.background ) {
|
|
57
|
-
bld.rect( 0, 0, rc.width, rc.height )
|
|
71
|
+
bld.rect( 0, 0, rc.width+padding*2, rc.height+padding*2 )
|
|
58
72
|
.fill( props.background.toHexString() );
|
|
59
73
|
}
|
|
60
74
|
|
|
61
|
-
if( min!=0 ) {
|
|
75
|
+
if( min!=0 || props.display?.axis ) {
|
|
62
76
|
bld.path( )
|
|
63
|
-
.moveTo(
|
|
64
|
-
.lineTo( rc.
|
|
77
|
+
.moveTo( rc.left, b-(0-min)*ymul )
|
|
78
|
+
.lineTo( rc.right, b-(0-min)*ymul )
|
|
65
79
|
.stroke( "var(--tickline-axis-color)", 1 )
|
|
66
80
|
.antiAlias( false )
|
|
67
81
|
}
|
|
@@ -70,10 +84,10 @@ export class TickLine extends Component<TickLineProps> {
|
|
|
70
84
|
const pth = bld.path( );
|
|
71
85
|
for( let x=0; x<vals.length; x++ ) {
|
|
72
86
|
if( x==0 ) {
|
|
73
|
-
pth.moveTo( x*xmul, b-(vals[x]-min)*ymul );
|
|
87
|
+
pth.moveTo( rc.left+x*xmul, b-(vals[x]-min)*ymul );
|
|
74
88
|
}
|
|
75
89
|
else {
|
|
76
|
-
pth.lineTo( x*xmul, b-(vals[x]-min)*ymul );
|
|
90
|
+
pth.lineTo( rc.left+x*xmul, b-(vals[x]-min)*ymul );
|
|
77
91
|
}
|
|
78
92
|
}
|
|
79
93
|
|
|
@@ -82,14 +96,27 @@ export class TickLine extends Component<TickLineProps> {
|
|
|
82
96
|
}
|
|
83
97
|
else {
|
|
84
98
|
for( let x=0; x<vals.length; x++ ) {
|
|
85
|
-
bld.rect( x*xmul, b-(
|
|
99
|
+
const r = bld.rect( rc.left+x*xmul, b-(vals[x]-min)*ymul, xmul-1, (vals[x]-min)*ymul )
|
|
86
100
|
.fill( props.color ? props.color.toHexString() : "var(--tickline-color)" )
|
|
87
|
-
|
|
101
|
+
.antiAlias( false );
|
|
102
|
+
|
|
103
|
+
if( props.display?.tooltips ) {
|
|
104
|
+
r.setAttr( 'tooltip', vals[x].toFixed(1) )
|
|
105
|
+
}
|
|
88
106
|
}
|
|
89
107
|
}
|
|
90
108
|
|
|
91
|
-
|
|
92
|
-
|
|
93
109
|
this.setContent( new SvgComponent( {width: "100%", height: "100%", svg: bld, attrs: { viewport:`0 ${props.min??0} ${vals.length} ${props.max??100}` } } ) );
|
|
94
110
|
}
|
|
111
|
+
|
|
112
|
+
setValues( values: number[], options? : { min: number, max: number } ) {
|
|
113
|
+
|
|
114
|
+
options = { min: 0, max: 100, ...options };
|
|
115
|
+
|
|
116
|
+
this.props.values = values;
|
|
117
|
+
this.props.min = options.min;
|
|
118
|
+
this.props.max = options.max;
|
|
119
|
+
|
|
120
|
+
this.update( );
|
|
121
|
+
}
|
|
95
122
|
}
|
package/src/core/component.ts
CHANGED
|
@@ -865,7 +865,7 @@ export class Component<P extends ComponentProps = ComponentProps, E extends Comp
|
|
|
865
865
|
*/
|
|
866
866
|
|
|
867
867
|
isVisible( ) {
|
|
868
|
-
return
|
|
868
|
+
return this.dom.isConnected && this.dom.checkVisibility( {checkVisibilityCSS: true, } );
|
|
869
869
|
}
|
|
870
870
|
|
|
871
871
|
/**
|
package/src/core/core_data.ts
CHANGED
|
@@ -119,17 +119,17 @@ export namespace data {
|
|
|
119
119
|
**/
|
|
120
120
|
|
|
121
121
|
export function id( ) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
122
|
+
return ( ownerCls: any, fldName: string ) => {
|
|
123
|
+
let metas = _getMetas( ownerCls );
|
|
124
|
+
metas.fields.push( {
|
|
125
|
+
name: fldName,
|
|
126
|
+
type: 'any',
|
|
127
|
+
required: true,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
metas.id = fldName;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
* @ignore
|
|
@@ -254,6 +254,12 @@ export namespace data {
|
|
|
254
254
|
|
|
255
255
|
export class DataModel<T = any> {
|
|
256
256
|
|
|
257
|
+
constructor( fields?: FieldInfo[] ) {
|
|
258
|
+
if( fields && fields.length ) {
|
|
259
|
+
this.addField( ...fields );
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
257
263
|
/**
|
|
258
264
|
* dynamic DataModel
|
|
259
265
|
*/
|
package/src/core/core_svg.ts
CHANGED
package/src/core/core_tools.ts
CHANGED
|
@@ -221,7 +221,7 @@ export class Rect implements IRect {
|
|
|
221
221
|
this.left -= dx;
|
|
222
222
|
this.width += dx+dx;
|
|
223
223
|
this.top -= dy;
|
|
224
|
-
this.
|
|
224
|
+
this.height += dy+dy;
|
|
225
225
|
|
|
226
226
|
return this;
|
|
227
227
|
}
|
|
@@ -234,6 +234,13 @@ export class Rect implements IRect {
|
|
|
234
234
|
|
|
235
235
|
return this;
|
|
236
236
|
}
|
|
237
|
+
|
|
238
|
+
moveTo( x: number, y: number ) {
|
|
239
|
+
this.left = x;
|
|
240
|
+
this.top = x;
|
|
241
|
+
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
237
244
|
}
|
|
238
245
|
|
|
239
246
|
/**
|
|
@@ -984,11 +991,11 @@ export function setWaitCursor(wait: boolean) {
|
|
|
984
991
|
|
|
985
992
|
const FOCUSABLE = [
|
|
986
993
|
'button:not([tabindex="-1"])',
|
|
987
|
-
|
|
994
|
+
'[href]',
|
|
988
995
|
'input',
|
|
989
996
|
'select',
|
|
990
997
|
'textarea',
|
|
991
|
-
|
|
998
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
992
999
|
] .map( x => x+':not(:disabled):not([inert])' )
|
|
993
1000
|
.join( ',' );
|
|
994
1001
|
|
package/src/x4.d.ts
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
2
|
* ___ ___ __
|
|
3
3
|
* \ \/ / / _
|
|
4
4
|
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_
|
|
7
|
-
*
|
|
8
|
-
* @file x4.
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
*
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file x4.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
11
|
* @copyright (c) 2026 R-libre ingenierie
|
|
12
12
|
*
|
|
13
|
-
* Use of this source code is governed by an MIT-style license
|
|
13
|
+
* Use of this source code is governed by an MIT-style license
|
|
14
14
|
* that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
|
15
15
|
**/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
export * from "./core/component";
|
|
17
|
+
export * from "./core/core_application";
|
|
18
|
+
export * from "./core/core_colors";
|
|
19
|
+
export * from "./core/core_data";
|
|
20
|
+
export * from "./core/core_dom";
|
|
21
|
+
export * from "./core/core_dragdrop";
|
|
22
|
+
export * from "./core/core_element";
|
|
23
|
+
export * from "./core/core_events";
|
|
24
|
+
export * from "./core/core_i18n";
|
|
25
|
+
export * from "./core/core_pdf";
|
|
26
|
+
export * from "./core/core_react";
|
|
27
|
+
export * from "./core/core_router";
|
|
28
|
+
export * from "./core/core_state";
|
|
29
|
+
export * from "./core/core_styles";
|
|
30
|
+
export * from "./core/core_svg";
|
|
31
|
+
export * from "./core/core_tools";
|
|
32
|
+
export * from "./components/components";
|
|
33
|
+
import "./x4.scss";
|