x4js 1.5.12 → 1.5.14
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/checkbox.js +2 -1
- package/lib/cjs/svgcomponent.js +22 -4
- package/lib/cjs/treeview.js +2 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/checkbox.js +2 -1
- package/lib/esm/svgcomponent.js +23 -5
- package/lib/esm/treeview.js +2 -1
- package/lib/esm/version.js +1 -1
- package/lib/src/checkbox.ts +2 -1
- package/lib/src/svgcomponent.ts +29 -5
- package/lib/src/treeview.ts +4 -2
- package/lib/src/version.ts +1 -1
- package/lib/src/x4.less +33 -28
- package/lib/styles/x4.css +10 -6
- package/lib/styles/x4.less +33 -28
- package/lib/types/svgcomponent.d.ts +10 -0
- package/lib/types/treeview.d.ts +1 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/checkbox.js
CHANGED
|
@@ -69,6 +69,7 @@ class CheckBox extends component_1.Component {
|
|
|
69
69
|
change: this._change.bind(this),
|
|
70
70
|
}
|
|
71
71
|
}),
|
|
72
|
+
props.slider ? new component_1.Component({ cls: '@slide-el' }) : null,
|
|
72
73
|
new label_1.Label({
|
|
73
74
|
text: (_d = props.text) !== null && _d !== void 0 ? _d : '',
|
|
74
75
|
width: labelWidth < 0 ? undefined : labelWidth,
|
|
@@ -80,7 +81,7 @@ class CheckBox extends component_1.Component {
|
|
|
80
81
|
attrs: {
|
|
81
82
|
"for": uid
|
|
82
83
|
}
|
|
83
|
-
})
|
|
84
|
+
}),
|
|
84
85
|
]);
|
|
85
86
|
}
|
|
86
87
|
/**
|
package/lib/cjs/svgcomponent.js
CHANGED
|
@@ -169,6 +169,24 @@ class SVGItem {
|
|
|
169
169
|
this.attr("clip-path", `url(#${id})`);
|
|
170
170
|
return this;
|
|
171
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
transform(tr) {
|
|
176
|
+
this.attr("transform", tr);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
*
|
|
180
|
+
*/
|
|
181
|
+
rotate(deg, cx, cy) {
|
|
182
|
+
this.transform(`rotate( ${deg} ${cx} ${cy} )`);
|
|
183
|
+
}
|
|
184
|
+
translate(dx, dy) {
|
|
185
|
+
this.transform(`translate( ${dx} ${dy} )`);
|
|
186
|
+
}
|
|
187
|
+
scale(x) {
|
|
188
|
+
this.transform(`scale( ${x} )`);
|
|
189
|
+
}
|
|
172
190
|
}
|
|
173
191
|
/**
|
|
174
192
|
*
|
|
@@ -302,10 +320,10 @@ class SVGGradient extends SVGItem {
|
|
|
302
320
|
super('linearGradient');
|
|
303
321
|
this.m_id = 'gx-' + SVGGradient.g_id;
|
|
304
322
|
this.attr('id', this.m_id);
|
|
305
|
-
this.attr('x1', num(x1) + '');
|
|
306
|
-
this.attr('x2', num(x2) + '');
|
|
307
|
-
this.attr('y1', num(y1) + '');
|
|
308
|
-
this.attr('y2', num(y2) + '');
|
|
323
|
+
this.attr('x1', (0, tools_1.isString)(x1) ? x1 : num(x1) + '');
|
|
324
|
+
this.attr('x2', (0, tools_1.isString)(x2) ? x2 : num(x2) + '');
|
|
325
|
+
this.attr('y1', (0, tools_1.isString)(y1) ? y1 : num(y1) + '');
|
|
326
|
+
this.attr('y2', (0, tools_1.isString)(y2) ? y2 : num(y2) + '');
|
|
309
327
|
this.m_stops = [];
|
|
310
328
|
SVGGradient.g_id++;
|
|
311
329
|
}
|
package/lib/cjs/treeview.js
CHANGED
package/lib/cjs/version.js
CHANGED
package/lib/esm/checkbox.js
CHANGED
|
@@ -65,6 +65,7 @@ export class CheckBox extends Component {
|
|
|
65
65
|
change: this._change.bind(this),
|
|
66
66
|
}
|
|
67
67
|
}),
|
|
68
|
+
props.slider ? new Component({ cls: '@slide-el' }) : null,
|
|
68
69
|
new Label({
|
|
69
70
|
text: props.text ?? '',
|
|
70
71
|
width: labelWidth < 0 ? undefined : labelWidth,
|
|
@@ -76,7 +77,7 @@ export class CheckBox extends Component {
|
|
|
76
77
|
attrs: {
|
|
77
78
|
"for": uid
|
|
78
79
|
}
|
|
79
|
-
})
|
|
80
|
+
}),
|
|
80
81
|
]);
|
|
81
82
|
}
|
|
82
83
|
/**
|
package/lib/esm/svgcomponent.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
import { Component, _x4_unitless } from './component';
|
|
30
|
-
import { isNumber } from "./tools";
|
|
30
|
+
import { isNumber, isString } from "./tools";
|
|
31
31
|
const reNumber = /^-?\d+(\.\d+)?$/;
|
|
32
32
|
// degrees to radian
|
|
33
33
|
function d2r(d) {
|
|
@@ -169,6 +169,24 @@ class SVGItem {
|
|
|
169
169
|
this.attr("clip-path", `url(#${id})`);
|
|
170
170
|
return this;
|
|
171
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
transform(tr) {
|
|
176
|
+
this.attr("transform", tr);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
*
|
|
180
|
+
*/
|
|
181
|
+
rotate(deg, cx, cy) {
|
|
182
|
+
this.transform(`rotate( ${deg} ${cx} ${cy} )`);
|
|
183
|
+
}
|
|
184
|
+
translate(dx, dy) {
|
|
185
|
+
this.transform(`translate( ${dx} ${dy} )`);
|
|
186
|
+
}
|
|
187
|
+
scale(x) {
|
|
188
|
+
this.transform(`scale( ${x} )`);
|
|
189
|
+
}
|
|
172
190
|
}
|
|
173
191
|
/**
|
|
174
192
|
*
|
|
@@ -307,10 +325,10 @@ class SVGGradient extends SVGItem {
|
|
|
307
325
|
super('linearGradient');
|
|
308
326
|
this.m_id = 'gx-' + SVGGradient.g_id;
|
|
309
327
|
this.attr('id', this.m_id);
|
|
310
|
-
this.attr('x1', num(x1) + '');
|
|
311
|
-
this.attr('x2', num(x2) + '');
|
|
312
|
-
this.attr('y1', num(y1) + '');
|
|
313
|
-
this.attr('y2', num(y2) + '');
|
|
328
|
+
this.attr('x1', isString(x1) ? x1 : num(x1) + '');
|
|
329
|
+
this.attr('x2', isString(x2) ? x2 : num(x2) + '');
|
|
330
|
+
this.attr('y1', isString(y1) ? y1 : num(y1) + '');
|
|
331
|
+
this.attr('y2', isString(y2) ? y2 : num(y2) + '');
|
|
314
332
|
this.m_stops = [];
|
|
315
333
|
SVGGradient.g_id++;
|
|
316
334
|
}
|
package/lib/esm/treeview.js
CHANGED
package/lib/esm/version.js
CHANGED
package/lib/src/checkbox.ts
CHANGED
|
@@ -103,6 +103,7 @@ export class CheckBox extends Component<CheckBoxProps, CheckBoxEventMap> {
|
|
|
103
103
|
change: this._change.bind(this),
|
|
104
104
|
}
|
|
105
105
|
}),
|
|
106
|
+
props.slider ? new Component( { cls: '@slide-el' } ) : null,
|
|
106
107
|
new Label({
|
|
107
108
|
text: props.text ?? '',
|
|
108
109
|
width: labelWidth < 0 ? undefined : labelWidth,
|
|
@@ -114,7 +115,7 @@ export class CheckBox extends Component<CheckBoxProps, CheckBoxEventMap> {
|
|
|
114
115
|
attrs: {
|
|
115
116
|
"for": uid
|
|
116
117
|
}
|
|
117
|
-
})
|
|
118
|
+
}),
|
|
118
119
|
]);
|
|
119
120
|
}
|
|
120
121
|
|
package/lib/src/svgcomponent.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
30
|
import { Component, CProps, _x4_unitless } from './component'
|
|
31
|
-
import { isNumber } from "./tools"
|
|
31
|
+
import { isNumber, isString } from "./tools"
|
|
32
32
|
|
|
33
33
|
const reNumber = /^-?\d+(\.\d+)?$/;
|
|
34
34
|
|
|
@@ -208,6 +208,30 @@ abstract class SVGItem {
|
|
|
208
208
|
this.attr( "clip-path", `url(#${id})` );
|
|
209
209
|
return this;
|
|
210
210
|
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
*
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
transform( tr: string ) {
|
|
217
|
+
this.attr( "transform", tr );
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
*
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
rotate( deg: number, cx: number, cy: number ) {
|
|
225
|
+
this.transform( `rotate( ${deg} ${cx} ${cy} )` );
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
translate( dx: number, dy: number ) {
|
|
229
|
+
this.transform( `translate( ${dx} ${dy} )` );
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
scale( x: number ) {
|
|
233
|
+
this.transform( `scale( ${x} )` );
|
|
234
|
+
}
|
|
211
235
|
}
|
|
212
236
|
|
|
213
237
|
/**
|
|
@@ -371,10 +395,10 @@ class SVGGradient extends SVGItem {
|
|
|
371
395
|
|
|
372
396
|
this.m_id = 'gx-'+SVGGradient.g_id;
|
|
373
397
|
this.attr( 'id', this.m_id );
|
|
374
|
-
this.attr( 'x1', num(x1)+'' );
|
|
375
|
-
this.attr( 'x2', num(x2)+'' );
|
|
376
|
-
this.attr( 'y1', num(y1)+'' );
|
|
377
|
-
this.attr( 'y2', num(y2)+'' );
|
|
398
|
+
this.attr( 'x1', isString(x1) ? x1 : num(x1)+'' );
|
|
399
|
+
this.attr( 'x2', isString(x2) ? x2 : num(x2)+'' );
|
|
400
|
+
this.attr( 'y1', isString(y1) ? y1 : num(y1)+'' );
|
|
401
|
+
this.attr( 'y2', isString(y2) ? y2 : num(y2)+'' );
|
|
378
402
|
|
|
379
403
|
this.m_stops = [];
|
|
380
404
|
SVGGradient.g_id++;
|
package/lib/src/treeview.ts
CHANGED
|
@@ -49,6 +49,7 @@ export interface HierarchicalNode {
|
|
|
49
49
|
cls?: string;
|
|
50
50
|
leaf?: boolean
|
|
51
51
|
icon?: string;
|
|
52
|
+
data?: any;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
export interface TreeNode {
|
|
@@ -659,8 +660,9 @@ export class TreeView extends VLayout<TreeViewProps, TreeViewEventMap> {
|
|
|
659
660
|
id: node.id,
|
|
660
661
|
text: node.name,
|
|
661
662
|
parent: node.parent,
|
|
662
|
-
cls: node.cls
|
|
663
|
-
icon: node.icon
|
|
663
|
+
cls: node.cls,
|
|
664
|
+
icon: node.icon,
|
|
665
|
+
data: node.data,
|
|
664
666
|
};
|
|
665
667
|
|
|
666
668
|
if (!node.leaf) {
|
package/lib/src/version.ts
CHANGED
package/lib/src/x4.less
CHANGED
|
@@ -812,41 +812,46 @@ textarea {
|
|
|
812
812
|
height: 1px;
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
.x-
|
|
816
|
-
box-sizing: border-box;
|
|
817
|
-
position: absolute;
|
|
818
|
-
left: 0px;
|
|
819
|
-
top: 3px;
|
|
820
|
-
content: "";
|
|
821
|
-
display: inline-block;
|
|
815
|
+
.x-slide-el {
|
|
822
816
|
width: 2.4em;
|
|
823
817
|
height: 1.4em;
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
818
|
+
|
|
819
|
+
&:before {
|
|
820
|
+
box-sizing: border-box;
|
|
821
|
+
position: absolute;
|
|
822
|
+
left: 0px;
|
|
823
|
+
top: 0px;
|
|
824
|
+
content: "";
|
|
825
|
+
display: inline-block;
|
|
826
|
+
width: 2.4em;
|
|
827
|
+
height: 1.4em;
|
|
828
|
+
border-radius: 1.4rem;
|
|
829
|
+
padding: 2px;
|
|
830
|
+
background-color: @BLACK30;
|
|
831
|
+
transition: all .2s;
|
|
832
|
+
border: 1px solid @WHITE50
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// circle
|
|
836
|
+
&:after {
|
|
837
|
+
box-sizing: border-box;
|
|
838
|
+
content: "";
|
|
839
|
+
top: 2px;
|
|
840
|
+
height: calc(1.4em - 4px);
|
|
841
|
+
width: calc(1.4em - 4px);
|
|
842
|
+
border-radius: 50%;
|
|
843
|
+
background-color: #fff;
|
|
844
|
+
transition: all .2s;
|
|
845
|
+
position: absolute;
|
|
846
|
+
left: 2px;
|
|
847
|
+
}
|
|
843
848
|
}
|
|
844
849
|
|
|
845
|
-
input:checked + .x-
|
|
850
|
+
input:checked + .x-slide-el:before {
|
|
846
851
|
background-color: var( --x4-selection-color );
|
|
847
852
|
}
|
|
848
853
|
|
|
849
|
-
input:checked + .x-
|
|
854
|
+
input:checked + .x-slide-el:after {
|
|
850
855
|
left: calc( 1em + 2px);
|
|
851
856
|
background-color: white;
|
|
852
857
|
}
|
package/lib/styles/x4.css
CHANGED
|
@@ -646,11 +646,15 @@ textarea::selection {
|
|
|
646
646
|
width: 1px;
|
|
647
647
|
height: 1px;
|
|
648
648
|
}
|
|
649
|
-
.x-check-box.slider .x-
|
|
649
|
+
.x-check-box.slider .x-slide-el {
|
|
650
|
+
width: 2.4em;
|
|
651
|
+
height: 1.4em;
|
|
652
|
+
}
|
|
653
|
+
.x-check-box.slider .x-slide-el:before {
|
|
650
654
|
box-sizing: border-box;
|
|
651
655
|
position: absolute;
|
|
652
656
|
left: 0px;
|
|
653
|
-
top:
|
|
657
|
+
top: 0px;
|
|
654
658
|
content: "";
|
|
655
659
|
display: inline-block;
|
|
656
660
|
width: 2.4em;
|
|
@@ -661,10 +665,10 @@ textarea::selection {
|
|
|
661
665
|
transition: all 0.2s;
|
|
662
666
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
663
667
|
}
|
|
664
|
-
.x-check-box.slider .x-
|
|
668
|
+
.x-check-box.slider .x-slide-el:after {
|
|
665
669
|
box-sizing: border-box;
|
|
666
670
|
content: "";
|
|
667
|
-
top:
|
|
671
|
+
top: 2px;
|
|
668
672
|
height: calc(1.4em - 4px);
|
|
669
673
|
width: calc(1.4em - 4px);
|
|
670
674
|
border-radius: 50%;
|
|
@@ -673,10 +677,10 @@ textarea::selection {
|
|
|
673
677
|
position: absolute;
|
|
674
678
|
left: 2px;
|
|
675
679
|
}
|
|
676
|
-
.x-check-box.slider input:checked + .x-
|
|
680
|
+
.x-check-box.slider input:checked + .x-slide-el:before {
|
|
677
681
|
background-color: var(--x4-selection-color);
|
|
678
682
|
}
|
|
679
|
-
.x-check-box.slider input:checked + .x-
|
|
683
|
+
.x-check-box.slider input:checked + .x-slide-el:after {
|
|
680
684
|
left: calc(1em + 2px);
|
|
681
685
|
background-color: white;
|
|
682
686
|
}
|
package/lib/styles/x4.less
CHANGED
|
@@ -812,41 +812,46 @@ textarea {
|
|
|
812
812
|
height: 1px;
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
.x-
|
|
816
|
-
box-sizing: border-box;
|
|
817
|
-
position: absolute;
|
|
818
|
-
left: 0px;
|
|
819
|
-
top: 3px;
|
|
820
|
-
content: "";
|
|
821
|
-
display: inline-block;
|
|
815
|
+
.x-slide-el {
|
|
822
816
|
width: 2.4em;
|
|
823
817
|
height: 1.4em;
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
818
|
+
|
|
819
|
+
&:before {
|
|
820
|
+
box-sizing: border-box;
|
|
821
|
+
position: absolute;
|
|
822
|
+
left: 0px;
|
|
823
|
+
top: 0px;
|
|
824
|
+
content: "";
|
|
825
|
+
display: inline-block;
|
|
826
|
+
width: 2.4em;
|
|
827
|
+
height: 1.4em;
|
|
828
|
+
border-radius: 1.4rem;
|
|
829
|
+
padding: 2px;
|
|
830
|
+
background-color: @BLACK30;
|
|
831
|
+
transition: all .2s;
|
|
832
|
+
border: 1px solid @WHITE50
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// circle
|
|
836
|
+
&:after {
|
|
837
|
+
box-sizing: border-box;
|
|
838
|
+
content: "";
|
|
839
|
+
top: 2px;
|
|
840
|
+
height: calc(1.4em - 4px);
|
|
841
|
+
width: calc(1.4em - 4px);
|
|
842
|
+
border-radius: 50%;
|
|
843
|
+
background-color: #fff;
|
|
844
|
+
transition: all .2s;
|
|
845
|
+
position: absolute;
|
|
846
|
+
left: 2px;
|
|
847
|
+
}
|
|
843
848
|
}
|
|
844
849
|
|
|
845
|
-
input:checked + .x-
|
|
850
|
+
input:checked + .x-slide-el:before {
|
|
846
851
|
background-color: var( --x4-selection-color );
|
|
847
852
|
}
|
|
848
853
|
|
|
849
|
-
input:checked + .x-
|
|
854
|
+
input:checked + .x-slide-el:after {
|
|
850
855
|
left: calc( 1em + 2px);
|
|
851
856
|
background-color: white;
|
|
852
857
|
}
|
|
@@ -84,6 +84,16 @@ declare abstract class SVGItem {
|
|
|
84
84
|
*
|
|
85
85
|
*/
|
|
86
86
|
clip(id: string): this;
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
transform(tr: string): void;
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
rotate(deg: number, cx: number, cy: number): void;
|
|
95
|
+
translate(dx: number, dy: number): void;
|
|
96
|
+
scale(x: number): void;
|
|
87
97
|
}
|
|
88
98
|
/**
|
|
89
99
|
*
|
package/lib/types/treeview.d.ts
CHANGED
package/lib/types/version.d.ts
CHANGED