x4js 2.2.10 → 2.2.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "2.2.10",
3
+ "version": "2.2.13",
4
4
  "type": "module",
5
5
  "main": "src/x4.ts",
6
6
  "module": "src/x4.ts",
@@ -42,4 +42,5 @@ export * from "./textedit/textedit"
42
42
  export * from "./tickline/tickline"
43
43
  export * from "./tooltips/tooltips"
44
44
  export * from "./treeview/treeview"
45
+ export * from "./video/video"
45
46
  export * from "./viewport/viewport"
@@ -139,4 +139,20 @@ export class Radio extends Component<RadioProps,RadioEvents> {
139
139
  getValue( ) {
140
140
  return this._input.getValue( );
141
141
  }
142
+
143
+ /**
144
+ * check the corresponding value in the item group
145
+ * you can call this method on any element of the group
146
+ *
147
+ * ie: A, B, C, D, E
148
+ * A.checkValue( "E" ) is ok, as E.CheckValue("E" )
149
+ */
150
+
151
+ checkValue( vname: string ) {
152
+ const grp = this.props.name;
153
+ const el = this.parentElement().query<Radio>( `input[name="${grp}"][value="${vname}"]` );
154
+ if( el ) {
155
+ el.setCheck( true );
156
+ }
157
+ }
142
158
  }
@@ -38,12 +38,12 @@ interface CellRef {
38
38
  row: number;
39
39
  }
40
40
 
41
- export type CellClassifier = ( row: number, col: number ) => string; // return the cell computed class
41
+ export type SSCellClassifier = ( row: number, col: number ) => string; // return the cell computed class
42
42
  export type RowClassifier = (row: number ) => string; // return the row computed class
43
43
  //export type CellRenderer = (row: number, col: number, content: any) => Component;
44
44
 
45
45
  export interface SpreadsheetColumn extends Omit<GridColumn,"classifier"> {
46
- cellClassifier?: CellClassifier;
46
+ cellClassifier?: SSCellClassifier;
47
47
  }
48
48
 
49
49
 
@@ -12,6 +12,8 @@
12
12
  *
13
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
+ *
16
+ * 2026-05-26: added resize types
15
17
  **/
16
18
 
17
19
  import { BaseProps } from '../input/input';
@@ -30,7 +32,7 @@ import { class_ns, IFormElement } from '../../core/core_tools';
30
32
  interface TextAreaProps extends BaseProps {
31
33
  label?: string;
32
34
  value?: string;
33
- resize?: boolean;
35
+ resize?: boolean | "none" | "vertical" | "horizontal" | "both";
34
36
  readonly?: boolean;
35
37
  trim?: boolean;
36
38
  }
@@ -48,8 +50,8 @@ class SimpleTextArea extends Component<TextAreaProps> {
48
50
  this.setAttribute( "name", props.name );
49
51
  this.setAttribute( "value", props.value+'' );
50
52
 
51
- if( !props.resize ) {
52
- this.setAttribute( "resize", false );
53
+ if( props.resize!==undefined ) {
54
+ this.setStyleValue( "resize", props.resize===false ? "none" : props.resize as string );
53
55
  }
54
56
 
55
57
  if( props.readonly ) {
@@ -0,0 +1,30 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|.2
7
+ *
8
+ * @file video.module.scss
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2026 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+
18
+
19
+ .x4video {
20
+ background-color: black;
21
+ position: relative;
22
+
23
+ .vplayer {
24
+ position: absolute;
25
+ left: 0;
26
+ top: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ }
30
+ }
@@ -0,0 +1,130 @@
1
+ /**
2
+ * ___ ___ __
3
+ * \ \/ / / _
4
+ * \ / /_| |_
5
+ * / \____ _|
6
+ * /__/\__\ |_|.2
7
+ *
8
+ * @file video.ts
9
+ * @author Etienne Cochard
10
+ *
11
+ * @copyright (c) 2026 R-libre ingenierie
12
+ *
13
+ * Use of this source code is governed by an MIT-style license
14
+ * that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.
15
+ **/
16
+
17
+ import { Box, Component, ComponentProps } from 'x4js';
18
+
19
+ import "./video.module.scss"
20
+
21
+ interface VideoProps extends ComponentProps {
22
+ autoplay?: boolean;
23
+ muted?: boolean;
24
+ playsInline?: boolean;
25
+ stream: MediaStream;
26
+ }
27
+
28
+ /**
29
+ *
30
+ */
31
+
32
+ export class Video extends Box {
33
+
34
+ private _vplayer: HTMLVideoElement;
35
+
36
+ constructor( props: VideoProps ) {
37
+ super( props );
38
+
39
+ const el = new Component( { cls: "vplayer", tag: 'video', } );
40
+ this.setContent( el );
41
+
42
+ this._vplayer = el.dom as HTMLVideoElement;
43
+
44
+ if( props.autoplay !== undefined ) {
45
+ this.autoPlay = props.autoplay;
46
+ }
47
+
48
+ if( props.muted !== undefined ) {
49
+ this.mute( props.muted );
50
+ }
51
+
52
+ if( props.playsInline !== undefined ) {
53
+ this.playsInline = props.playsInline;
54
+ }
55
+
56
+ this.stream = props.stream;
57
+ }
58
+
59
+ get player( ) {
60
+ return this._vplayer;
61
+ }
62
+
63
+ get volume( ) {
64
+ return this.player.volume;
65
+ }
66
+
67
+ set volume( vol: number ) {
68
+ this.player.volume = vol;
69
+ }
70
+
71
+ get autoPlay( ) {
72
+ return this.player.autoplay;
73
+ }
74
+
75
+ set autoPlay( set: boolean ) {
76
+ this.player.autoplay = set;
77
+ }
78
+
79
+ get playsInline( ) {
80
+ return this.player.playsInline;
81
+ }
82
+
83
+ set playsInline( set: boolean ) {
84
+ this.player.playsInline = set;
85
+ }
86
+
87
+ set stream( stream: MediaStream ) {
88
+ this.player.srcObject = stream;
89
+ }
90
+
91
+ get videoWidth( ) {
92
+ return this.player.videoWidth;
93
+ }
94
+
95
+ get videoHeight( ) {
96
+ return this.player.videoHeight;
97
+ }
98
+
99
+ get loop( ) {
100
+ return this.player.loop;
101
+ }
102
+
103
+ set loop( set: boolean ) {
104
+ this.player.loop = set;
105
+ }
106
+
107
+ get duration( ) {
108
+ return this.player.duration;
109
+ }
110
+
111
+ get muted( ) {
112
+ return this.player.muted;
113
+ }
114
+
115
+ mute( set: boolean ) {
116
+ this.player.muted = set;
117
+ }
118
+
119
+ get paused( ) {
120
+ return this.player.paused;
121
+ }
122
+
123
+ pause( ) {
124
+ this.player.pause( );
125
+ }
126
+
127
+ play( ) {
128
+ this.player.play( );
129
+ }
130
+ }