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.
@@ -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
  /**
@@ -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
  }
@@ -489,7 +489,8 @@ class TreeView extends layout_1.VLayout {
489
489
  text: node.name,
490
490
  parent: node.parent,
491
491
  cls: node.cls,
492
- icon: node.icon
492
+ icon: node.icon,
493
+ data: node.data,
493
494
  };
494
495
  if (!node.leaf) {
495
496
  elem.children = [];
@@ -29,4 +29,4 @@
29
29
  **/
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.x4js_version = void 0;
32
- exports.x4js_version = "1.5.12";
32
+ exports.x4js_version = "1.5.14";
@@ -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
  /**
@@ -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
  }
@@ -482,7 +482,8 @@ export class TreeView extends VLayout {
482
482
  text: node.name,
483
483
  parent: node.parent,
484
484
  cls: node.cls,
485
- icon: node.icon
485
+ icon: node.icon,
486
+ data: node.data,
486
487
  };
487
488
  if (!node.leaf) {
488
489
  elem.children = [];
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export const x4js_version = "1.5.12";
29
+ export const x4js_version = "1.5.14";
@@ -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
 
@@ -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++;
@@ -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) {
@@ -27,4 +27,4 @@
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
29
 
30
- export const x4js_version = "1.5.12";
30
+ export const x4js_version = "1.5.14";
package/lib/src/x4.less CHANGED
@@ -812,41 +812,46 @@ textarea {
812
812
  height: 1px;
813
813
  }
814
814
 
815
- .x-label:before {
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
- border-radius: 1.4rem;
825
- padding: 2px;
826
- background-color: @BLACK30;
827
- transition: all .2s;
828
- border: 1px solid @WHITE50
829
- }
830
-
831
- // circle
832
- .x-label:after {
833
- box-sizing: border-box;
834
- content: "";
835
- top: 5px;
836
- height: calc(1.4em - 4px);
837
- width: calc(1.4em - 4px);
838
- border-radius: 50%;
839
- background-color: #fff;
840
- transition: all .2s;
841
- position: absolute;
842
- left: 2px;
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-label:before {
850
+ input:checked + .x-slide-el:before {
846
851
  background-color: var( --x4-selection-color );
847
852
  }
848
853
 
849
- input:checked + .x-label:after {
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-label:before {
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: 3px;
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-label:after {
668
+ .x-check-box.slider .x-slide-el:after {
665
669
  box-sizing: border-box;
666
670
  content: "";
667
- top: 5px;
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-label:before {
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-label:after {
683
+ .x-check-box.slider input:checked + .x-slide-el:after {
680
684
  left: calc(1em + 2px);
681
685
  background-color: white;
682
686
  }
@@ -812,41 +812,46 @@ textarea {
812
812
  height: 1px;
813
813
  }
814
814
 
815
- .x-label:before {
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
- border-radius: 1.4rem;
825
- padding: 2px;
826
- background-color: @BLACK30;
827
- transition: all .2s;
828
- border: 1px solid @WHITE50
829
- }
830
-
831
- // circle
832
- .x-label:after {
833
- box-sizing: border-box;
834
- content: "";
835
- top: 5px;
836
- height: calc(1.4em - 4px);
837
- width: calc(1.4em - 4px);
838
- border-radius: 50%;
839
- background-color: #fff;
840
- transition: all .2s;
841
- position: absolute;
842
- left: 2px;
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-label:before {
850
+ input:checked + .x-slide-el:before {
846
851
  background-color: var( --x4-selection-color );
847
852
  }
848
853
 
849
- input:checked + .x-label:after {
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
  *
@@ -41,6 +41,7 @@ export interface HierarchicalNode {
41
41
  cls?: string;
42
42
  leaf?: boolean;
43
43
  icon?: string;
44
+ data?: any;
44
45
  }
45
46
  export interface TreeNode {
46
47
  id: any;
@@ -26,4 +26,4 @@
26
26
  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
27
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  **/
29
- export declare const x4js_version = "1.5.12";
29
+ export declare const x4js_version = "1.5.14";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x4js",
3
- "version": "1.5.12",
3
+ "version": "1.5.14",
4
4
  "description": "X4js core files",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",