x4js 2.2.21 → 2.2.23
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 +3 -2
- package/src/components/boxes/boxes.module.scss +5 -0
- package/src/components/dialog/dialog.ts +1 -1
- package/src/components/propgrid/progrid.module.scss +4 -0
- package/src/components/propgrid/propgrid.ts +20 -5
- package/src/components/radio/radio.ts +7 -6
- package/src/components/select/select.ts +13 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x4js",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/x4.ts",
|
|
6
6
|
"module": "src/x4.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
".": "./src/x4.ts"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build-publish": "
|
|
12
|
+
"build-publish": "deno run --allow-all ./publish.ts",
|
|
13
13
|
"build-doc": "typedoc",
|
|
14
14
|
"build-types": "npx tsc --declaration --emitDeclarationOnly --outFile types/x4.d.ts"
|
|
15
15
|
},
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"typescript": "^5.8.3"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"tsx": "^4.22.4",
|
|
38
39
|
"typedoc": "^0.28.19",
|
|
39
40
|
"typedoc-plugin-markdown": "^4.12.0"
|
|
40
41
|
}
|
|
@@ -166,7 +166,7 @@ export class Dialog<P extends DialogProps = DialogProps, E extends DialogEvents
|
|
|
166
166
|
*/
|
|
167
167
|
|
|
168
168
|
override setContent(form: Form) {
|
|
169
|
-
this.dom.replaceChild(
|
|
169
|
+
this.dom.replaceChild(form.dom,this.form.dom);
|
|
170
170
|
this.form = form;
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -19,7 +19,7 @@ import { Button } from "../button/button"
|
|
|
19
19
|
import { Component, ComponentProps, EvChange, EvFocus } from "../../core/component"
|
|
20
20
|
import { HBox, VBox } from "../boxes/boxes"
|
|
21
21
|
import { Input, InputProps } from "../input/input"
|
|
22
|
-
import { ListItem } from "../listbox/listbox"
|
|
22
|
+
import { ListboxID, ListItem } from "../listbox/listbox"
|
|
23
23
|
import { Label, SimpleText } from "../label/label"
|
|
24
24
|
import { class_ns, isFunction } from '../../core/core_tools';
|
|
25
25
|
import { Icon } from '../components'
|
|
@@ -88,9 +88,14 @@ export class PropertyGrid extends VBox {
|
|
|
88
88
|
|
|
89
89
|
for( const g of this.groups ) {
|
|
90
90
|
items.push( this.makeGroupHeader(g) );
|
|
91
|
-
g.items.forEach( i => {
|
|
91
|
+
g.items.forEach( (i,idx) => {
|
|
92
92
|
if( i ) {
|
|
93
|
-
|
|
93
|
+
const row = this.makePropertyRow(i);
|
|
94
|
+
if( idx&1 ) {
|
|
95
|
+
row.addClass( "event" )
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
items.push( row );
|
|
94
99
|
}
|
|
95
100
|
});
|
|
96
101
|
}
|
|
@@ -106,6 +111,10 @@ export class PropertyGrid extends VBox {
|
|
|
106
111
|
|
|
107
112
|
makeGroupHeader( g: PropertyGroup ) {
|
|
108
113
|
|
|
114
|
+
if( g.title===null ) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
const toggle = (e: Component) => {
|
|
110
119
|
|
|
111
120
|
let visible: boolean;
|
|
@@ -175,7 +184,7 @@ export class PropertyGrid extends VBox {
|
|
|
175
184
|
}
|
|
176
185
|
else if (item.type === 'options') {
|
|
177
186
|
editor = new Select( {
|
|
178
|
-
value: value as
|
|
187
|
+
value: value as ListboxID,
|
|
179
188
|
id: item.name,
|
|
180
189
|
items: item.options,
|
|
181
190
|
name: item.name,
|
|
@@ -189,7 +198,7 @@ export class PropertyGrid extends VBox {
|
|
|
189
198
|
type: 'password',
|
|
190
199
|
id: item.name,
|
|
191
200
|
name: item.name,
|
|
192
|
-
value: value
|
|
201
|
+
value: String(value),
|
|
193
202
|
focus: ( e: EvFocus ) => {
|
|
194
203
|
if( e.focus_out ) {
|
|
195
204
|
item.callback?.( item.name, (editor as Input).getValue() );
|
|
@@ -296,5 +305,11 @@ export class PropertyGrid extends VBox {
|
|
|
296
305
|
}
|
|
297
306
|
}
|
|
298
307
|
}
|
|
308
|
+
|
|
309
|
+
loadProperties( props: any ) {
|
|
310
|
+
for( const p in props ) {
|
|
311
|
+
this.setPropValue( p, props[p] );
|
|
312
|
+
}
|
|
313
|
+
}
|
|
299
314
|
}
|
|
300
315
|
|
|
@@ -21,9 +21,7 @@ import { EventCallback } from '../../core/core_events';
|
|
|
21
21
|
import { Label } from '../label/label';
|
|
22
22
|
import { Input } from '../input/input'
|
|
23
23
|
import { HBox } from '../boxes/boxes';
|
|
24
|
-
import { svgLoader } from '../components';
|
|
25
24
|
|
|
26
|
-
import icon from "./radio.svg";
|
|
27
25
|
import "./radio.module.scss";
|
|
28
26
|
|
|
29
27
|
/**
|
|
@@ -86,10 +84,13 @@ export class Radio extends Component<RadioProps,RadioEvents> {
|
|
|
86
84
|
} ),
|
|
87
85
|
])
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
const drawing = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 5 5" aria-hidden="true"><circle class="fa-primary" cx="2.5" cy="2.5" r="2.5" ></circle><circle class="fa-secondary" cx="2.5" cy="2.5" r="1.25"></circle></svg>`
|
|
88
|
+
this._check.dom.insertAdjacentHTML( "beforeend", drawing );
|
|
89
|
+
|
|
90
|
+
//svgLoader.load( icon ).then( svg => {
|
|
91
|
+
// this._check.dom.insertAdjacentHTML( "beforeend", svg );
|
|
92
|
+
// // no error because intenral data image
|
|
93
|
+
//});
|
|
93
94
|
|
|
94
95
|
this.addDOMEvent('click', (e) => this._on_click(e)); // for outside click
|
|
95
96
|
}
|
|
@@ -19,7 +19,7 @@ import { EventCallback } from '../../core/core_events';
|
|
|
19
19
|
import { Component, ComponentEvent, ComponentProps, EvChange, EvFocus } from '../../core/component';
|
|
20
20
|
import { class_ns } from '../../core/core_tools';
|
|
21
21
|
|
|
22
|
-
import { ListItem } from '../components';
|
|
22
|
+
import { ListboxID, ListItem } from '../components';
|
|
23
23
|
|
|
24
24
|
import "./select.module.scss"
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ import "./select.module.scss"
|
|
|
29
29
|
|
|
30
30
|
export interface SelectProps extends ComponentProps {
|
|
31
31
|
name?: string;
|
|
32
|
-
value:
|
|
32
|
+
value: ListboxID;
|
|
33
33
|
items: ListItem[];
|
|
34
34
|
multiple?: boolean;
|
|
35
35
|
change?: EventCallback<EvChange>;
|
|
@@ -49,6 +49,8 @@ interface SelectEvents extends ComponentEvent {
|
|
|
49
49
|
@class_ns( "x4" )
|
|
50
50
|
export class Select extends Component<SelectProps,SelectEvents> {
|
|
51
51
|
|
|
52
|
+
private _items: ListItem[];
|
|
53
|
+
|
|
52
54
|
constructor( props: SelectProps ) {
|
|
53
55
|
super( { tag: "select", ...props } );
|
|
54
56
|
|
|
@@ -104,6 +106,7 @@ export class Select extends Component<SelectProps,SelectEvents> {
|
|
|
104
106
|
*/
|
|
105
107
|
|
|
106
108
|
setItems( items: ListItem[] ) {
|
|
109
|
+
this._items = [...items];
|
|
107
110
|
this.setContent( items.map( x => {
|
|
108
111
|
return new Component( {
|
|
109
112
|
tag: "option",
|
|
@@ -117,17 +120,20 @@ export class Select extends Component<SelectProps,SelectEvents> {
|
|
|
117
120
|
* @returns
|
|
118
121
|
*/
|
|
119
122
|
|
|
120
|
-
public getValue( ) {
|
|
121
|
-
|
|
123
|
+
public getValue( ) : ListboxID {
|
|
124
|
+
const el = (this.dom as HTMLSelectElement);
|
|
125
|
+
const sel = this._items[el.selectedIndex];
|
|
126
|
+
return sel?.id;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
/**
|
|
125
|
-
*
|
|
126
130
|
* @param value
|
|
127
131
|
*/
|
|
128
132
|
|
|
129
|
-
public setValue( value:
|
|
130
|
-
(this.dom as HTMLSelectElement).value = value+"";
|
|
133
|
+
public setValue( value: ListboxID ) {
|
|
134
|
+
//(this.dom as HTMLSelectElement).value = value+"";
|
|
135
|
+
const el = (this.dom as HTMLSelectElement);
|
|
136
|
+
el.selectedIndex = this._items.findIndex( x => x.id===value );
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
|