x4js 1.5.18 → 1.5.20
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/{README.md → README.txt} +0 -0
- package/lib/cjs/index.js +39 -103
- package/lib/cjs/index.js.map +7 -0
- package/lib/esm/index.mjs +39 -87
- package/lib/esm/index.mjs.map +7 -0
- package/lib/{license.md → licence.md} +0 -0
- package/lib/src/MIT-license.md +14 -0
- package/lib/{types/action.d.ts → src/action.ts} +64 -33
- package/lib/src/alpha.jpg +0 -0
- package/lib/src/app_sockets.ts +81 -0
- package/lib/src/application.ts +251 -0
- package/lib/src/autocomplete.ts +197 -0
- package/lib/src/base64.ts +166 -0
- package/lib/src/base_component.ts +152 -0
- package/lib/src/button.ts +355 -0
- package/lib/src/calendar.ts +328 -0
- package/lib/src/canvas.ts +505 -0
- package/lib/src/cardview.ts +227 -0
- package/lib/src/checkbox.ts +188 -0
- package/lib/src/color.ts +752 -0
- package/lib/src/colorpicker.ts +1639 -0
- package/lib/src/combobox.ts +465 -0
- package/lib/src/component.ts +2329 -0
- package/lib/{esm/dom_events.js → src/copyright.txt} +27 -29
- package/lib/src/datastore.ts +1322 -0
- package/lib/src/dialog.ts +656 -0
- package/lib/src/dom_events.ts +315 -0
- package/lib/src/drag_manager.ts +199 -0
- package/lib/src/drawtext.ts +355 -0
- package/lib/src/fileupload.ts +213 -0
- package/lib/src/form.ts +375 -0
- package/lib/src/formatters.ts +105 -0
- package/lib/src/gridview.ts +1185 -0
- package/lib/src/i18n.ts +346 -0
- package/lib/src/icon.ts +335 -0
- package/lib/src/image.ts +204 -0
- package/lib/src/index.ts +89 -0
- package/lib/src/input.ts +249 -0
- package/lib/src/label.ts +128 -0
- package/lib/src/layout.ts +430 -0
- package/lib/src/link.ts +86 -0
- package/lib/src/listview.ts +765 -0
- package/lib/{esm/md5.js → src/md5.ts} +438 -403
- package/lib/src/menu.ts +425 -0
- package/lib/src/messagebox.ts +224 -0
- package/lib/src/panel.ts +86 -0
- package/lib/src/popup.ts +494 -0
- package/lib/src/property_editor.ts +337 -0
- package/lib/src/radiobtn.ts +197 -0
- package/lib/src/rating.ts +135 -0
- package/lib/src/request.ts +300 -0
- package/lib/src/router.ts +185 -0
- package/lib/src/settings.ts +77 -0
- package/lib/src/sidebarview.ts +103 -0
- package/lib/src/spreadsheet.ts +1449 -0
- package/lib/src/styles.ts +343 -0
- package/lib/src/svgcomponent.ts +577 -0
- package/lib/src/tabbar.ts +151 -0
- package/lib/src/tabview.ts +110 -0
- package/lib/src/textarea.ts +235 -0
- package/lib/src/textedit.ts +544 -0
- package/lib/src/toaster.ts +80 -0
- package/lib/src/tools.ts +1473 -0
- package/lib/src/tooltips.ts +191 -0
- package/lib/src/treeview.ts +716 -0
- package/lib/{esm/version.js → src/version.ts} +30 -29
- package/lib/{styles → src}/x4.less +0 -0
- package/lib/src/x4dom.ts +57 -0
- package/lib/src/x4events.ts +585 -0
- package/lib/src/x4react.ts +90 -0
- package/package.json +52 -46
- package/lib/cjs/action.js +0 -58
- package/lib/cjs/app_sockets.js +0 -74
- package/lib/cjs/application.js +0 -182
- package/lib/cjs/autocomplete.js +0 -155
- package/lib/cjs/base_component.js +0 -124
- package/lib/cjs/button.js +0 -263
- package/lib/cjs/calendar.js +0 -254
- package/lib/cjs/canvas.js +0 -361
- package/lib/cjs/cardview.js +0 -161
- package/lib/cjs/checkbox.js +0 -139
- package/lib/cjs/color.js +0 -591
- package/lib/cjs/colorpicker.js +0 -1468
- package/lib/cjs/combobox.js +0 -349
- package/lib/cjs/component.js +0 -1719
- package/lib/cjs/datastore.js +0 -985
- package/lib/cjs/dialog.js +0 -478
- package/lib/cjs/dom_events.js +0 -30
- package/lib/cjs/drag_manager.js +0 -145
- package/lib/cjs/drawtext.js +0 -276
- package/lib/cjs/fileupload.js +0 -167
- package/lib/cjs/form.js +0 -304
- package/lib/cjs/formatters.js +0 -90
- package/lib/cjs/gridview.js +0 -881
- package/lib/cjs/i18n.js +0 -266
- package/lib/cjs/icon.js +0 -272
- package/lib/cjs/image.js +0 -157
- package/lib/cjs/input.js +0 -174
- package/lib/cjs/label.js +0 -95
- package/lib/cjs/layout.js +0 -322
- package/lib/cjs/link.js +0 -64
- package/lib/cjs/listview.js +0 -546
- package/lib/cjs/md5.js +0 -403
- package/lib/cjs/menu.js +0 -301
- package/lib/cjs/messagebox.js +0 -177
- package/lib/cjs/panel.js +0 -68
- package/lib/cjs/popup.js +0 -383
- package/lib/cjs/property_editor.js +0 -252
- package/lib/cjs/radiobtn.js +0 -140
- package/lib/cjs/rating.js +0 -102
- package/lib/cjs/request.js +0 -246
- package/lib/cjs/router.js +0 -139
- package/lib/cjs/settings.js +0 -69
- package/lib/cjs/sidebarview.js +0 -82
- package/lib/cjs/spreadsheet.js +0 -1084
- package/lib/cjs/styles.js +0 -275
- package/lib/cjs/svgcomponent.js +0 -447
- package/lib/cjs/tabbar.js +0 -111
- package/lib/cjs/tabview.js +0 -85
- package/lib/cjs/textarea.js +0 -165
- package/lib/cjs/textedit.js +0 -415
- package/lib/cjs/toaster.js +0 -64
- package/lib/cjs/tools.js +0 -1197
- package/lib/cjs/tooltips.js +0 -157
- package/lib/cjs/treeview.js +0 -535
- package/lib/cjs/version.js +0 -32
- package/lib/cjs/x4dom.js +0 -32
- package/lib/cjs/x4events.js +0 -384
- package/lib/cjs/x4react.js +0 -72
- package/lib/esm/action.js +0 -53
- package/lib/esm/app_sockets.js +0 -70
- package/lib/esm/application.js +0 -184
- package/lib/esm/autocomplete.js +0 -155
- package/lib/esm/base_component.js +0 -107
- package/lib/esm/button.js +0 -257
- package/lib/esm/calendar.js +0 -249
- package/lib/esm/canvas.js +0 -358
- package/lib/esm/cardview.js +0 -159
- package/lib/esm/checkbox.js +0 -134
- package/lib/esm/color.js +0 -588
- package/lib/esm/colorpicker.js +0 -1475
- package/lib/esm/combobox.js +0 -351
- package/lib/esm/component.js +0 -1711
- package/lib/esm/datastore.js +0 -990
- package/lib/esm/dialog.js +0 -490
- package/lib/esm/drag_manager.js +0 -147
- package/lib/esm/drawtext.js +0 -271
- package/lib/esm/fileupload.js +0 -163
- package/lib/esm/form.js +0 -304
- package/lib/esm/formatters.js +0 -81
- package/lib/esm/gridview.js +0 -889
- package/lib/esm/i18n.js +0 -257
- package/lib/esm/icon.js +0 -261
- package/lib/esm/image.js +0 -154
- package/lib/esm/input.js +0 -182
- package/lib/esm/label.js +0 -90
- package/lib/esm/layout.js +0 -310
- package/lib/esm/link.js +0 -59
- package/lib/esm/listview.js +0 -534
- package/lib/esm/menu.js +0 -300
- package/lib/esm/messagebox.js +0 -161
- package/lib/esm/panel.js +0 -65
- package/lib/esm/popup.js +0 -379
- package/lib/esm/property_editor.js +0 -251
- package/lib/esm/radiobtn.js +0 -136
- package/lib/esm/rating.js +0 -97
- package/lib/esm/request.js +0 -224
- package/lib/esm/router.js +0 -136
- package/lib/esm/settings.js +0 -66
- package/lib/esm/sidebarview.js +0 -79
- package/lib/esm/spreadsheet.js +0 -1097
- package/lib/esm/styles.js +0 -270
- package/lib/esm/svgcomponent.js +0 -450
- package/lib/esm/tabbar.js +0 -107
- package/lib/esm/tabview.js +0 -83
- package/lib/esm/textarea.js +0 -160
- package/lib/esm/textedit.js +0 -412
- package/lib/esm/toaster.js +0 -62
- package/lib/esm/tools.js +0 -1158
- package/lib/esm/tooltips.js +0 -153
- package/lib/esm/treeview.js +0 -527
- package/lib/esm/x4dom.js +0 -29
- package/lib/esm/x4events.js +0 -376
- package/lib/esm/x4react.js +0 -71
- package/lib/types/app_sockets.d.ts +0 -29
- package/lib/types/application.d.ts +0 -104
- package/lib/types/autocomplete.d.ts +0 -58
- package/lib/types/base_component.d.ts +0 -88
- package/lib/types/button.d.ts +0 -151
- package/lib/types/calendar.d.ts +0 -82
- package/lib/types/canvas.d.ts +0 -92
- package/lib/types/cardview.d.ts +0 -87
- package/lib/types/checkbox.d.ts +0 -77
- package/lib/types/color.d.ts +0 -148
- package/lib/types/colorpicker.d.ts +0 -107
- package/lib/types/combobox.d.ts +0 -107
- package/lib/types/component.d.ts +0 -601
- package/lib/types/datastore.d.ts +0 -396
- package/lib/types/dialog.d.ts +0 -175
- package/lib/types/dom_events.d.ts +0 -302
- package/lib/types/drag_manager.d.ts +0 -54
- package/lib/types/drawtext.d.ts +0 -48
- package/lib/types/fileupload.d.ts +0 -64
- package/lib/types/form.d.ts +0 -133
- package/lib/types/formatters.d.ts +0 -35
- package/lib/types/gridview.d.ts +0 -175
- package/lib/types/i18n.d.ts +0 -73
- package/lib/types/icon.d.ts +0 -64
- package/lib/types/image.d.ts +0 -55
- package/lib/types/index.d.ts +0 -84
- package/lib/types/input.d.ts +0 -91
- package/lib/types/label.d.ts +0 -58
- package/lib/types/layout.d.ts +0 -87
- package/lib/types/link.d.ts +0 -50
- package/lib/types/listview.d.ts +0 -178
- package/lib/types/md5.d.ts +0 -61
- package/lib/types/menu.d.ts +0 -130
- package/lib/types/messagebox.d.ts +0 -69
- package/lib/types/panel.d.ts +0 -47
- package/lib/types/popup.d.ts +0 -75
- package/lib/types/property_editor.d.ts +0 -71
- package/lib/types/radiobtn.d.ts +0 -73
- package/lib/types/rating.d.ts +0 -53
- package/lib/types/request.d.ts +0 -52
- package/lib/types/router.d.ts +0 -42
- package/lib/types/settings.d.ts +0 -37
- package/lib/types/sidebarview.d.ts +0 -49
- package/lib/types/spreadsheet.d.ts +0 -222
- package/lib/types/styles.d.ts +0 -85
- package/lib/types/svgcomponent.d.ts +0 -215
- package/lib/types/tabbar.d.ts +0 -58
- package/lib/types/tabview.d.ts +0 -49
- package/lib/types/textarea.d.ts +0 -77
- package/lib/types/textedit.d.ts +0 -123
- package/lib/types/toaster.d.ts +0 -42
- package/lib/types/tools.d.ts +0 -394
- package/lib/types/tooltips.d.ts +0 -46
- package/lib/types/treeview.d.ts +0 -144
- package/lib/types/version.d.ts +0 -29
- package/lib/types/x4dom.d.ts +0 -49
- package/lib/types/x4events.d.ts +0 -269
- package/lib/types/x4react.d.ts +0 -41
package/lib/cjs/canvas.js
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file canvas.ts
|
|
10
|
-
* @author Etienne Cochard
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
* in the Software without restriction, including without limitation the rights
|
|
17
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
18
|
-
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
19
|
-
* subject to the following conditions:
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all copies
|
|
21
|
-
* or substantial portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
24
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
25
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
28
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
-
**/
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.Canvas = void 0;
|
|
32
|
-
const component_1 = require("./component");
|
|
33
|
-
const x4events_1 = require("./x4events");
|
|
34
|
-
function EvPaint(ctx) {
|
|
35
|
-
return (0, x4events_1.BasicEvent)({ ctx });
|
|
36
|
-
}
|
|
37
|
-
function mkPainter(c2d, w, h) {
|
|
38
|
-
let cp = c2d;
|
|
39
|
-
cp.width = w;
|
|
40
|
-
cp.height = h;
|
|
41
|
-
cp.smoothLine = smoothLine;
|
|
42
|
-
cp.smoothLineEx = smoothLineEx;
|
|
43
|
-
cp.line = line;
|
|
44
|
-
cp.roundRect = roundRect;
|
|
45
|
-
cp.calcTextSize = calcTextSize;
|
|
46
|
-
cp.setFontSize = setFontSize;
|
|
47
|
-
cp.circle = circle;
|
|
48
|
-
return cp;
|
|
49
|
-
}
|
|
50
|
-
function smoothLine(points, path = null, move = true) {
|
|
51
|
-
if (points.length < 2) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (!path) {
|
|
55
|
-
path = this;
|
|
56
|
-
}
|
|
57
|
-
if (points.length == 2) {
|
|
58
|
-
if (move !== false) {
|
|
59
|
-
path.moveTo(points[0].x, points[0].y);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
path.lineTo(points[0].x, points[0].y);
|
|
63
|
-
}
|
|
64
|
-
path.lineTo(points[1].x, points[1].y);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
function midPointBtw(p1, p2) {
|
|
68
|
-
return {
|
|
69
|
-
x: p1.x + (p2.x - p1.x) / 2,
|
|
70
|
-
y: p1.y + (p2.y - p1.y) / 2
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function getQuadraticXY(t, sx, sy, cp1x, cp1y, ex, ey) {
|
|
74
|
-
return {
|
|
75
|
-
x: (1 - t) * (1 - t) * sx + 2 * (1 - t) * t * cp1x + t * t * ex,
|
|
76
|
-
y: (1 - t) * (1 - t) * sy + 2 * (1 - t) * t * cp1y + t * t * ey
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
let p1 = points[0], p2 = points[1], p3 = p1;
|
|
80
|
-
path.moveTo(p1.x, p1.y);
|
|
81
|
-
for (let i = 1, len = points.length; i < len; i++) {
|
|
82
|
-
// we pick the point between pi+1 & pi+2 as the
|
|
83
|
-
// end point and p1 as our control point
|
|
84
|
-
let midPoint = midPointBtw(p1, p2);
|
|
85
|
-
//this.quadraticCurveTo(p1.x, p1.y, midPoint.x, midPoint.y);
|
|
86
|
-
for (let i = 0; i < 8; i++) {
|
|
87
|
-
let { x, y } = getQuadraticXY(i / 8, p3.x, p3.y, p1.x, p1.y, midPoint.x, midPoint.y);
|
|
88
|
-
path.lineTo(x, y);
|
|
89
|
-
}
|
|
90
|
-
p1 = points[i];
|
|
91
|
-
p2 = points[i + 1];
|
|
92
|
-
p3 = midPoint;
|
|
93
|
-
}
|
|
94
|
-
// Draw last line as a straight line while
|
|
95
|
-
// we wait for the next point to be able to calculate
|
|
96
|
-
// the bezier control point
|
|
97
|
-
path.lineTo(p1.x, p1.y);
|
|
98
|
-
}
|
|
99
|
-
function smoothLineEx(_points, tension = 0.5, numOfSeg = 10, path = null, move = true, close = false) {
|
|
100
|
-
let points = [];
|
|
101
|
-
//pts = points.slice(0);
|
|
102
|
-
for (let p = 0, pc = _points.length; p < pc; p++) {
|
|
103
|
-
points.push(_points[p].x);
|
|
104
|
-
points.push(_points[p].y);
|
|
105
|
-
}
|
|
106
|
-
let pts, i = 1, l = points.length, rPos = 0, rLen = (l - 2) * numOfSeg + 2 + (close ? 2 * numOfSeg : 0), res = new Float32Array(rLen), cache = new Float32Array((numOfSeg + 2) * 4), cachePtr = 4;
|
|
107
|
-
pts = points.slice(0);
|
|
108
|
-
if (close) {
|
|
109
|
-
pts.unshift(points[l - 1]); // insert end point as first point
|
|
110
|
-
pts.unshift(points[l - 2]);
|
|
111
|
-
pts.push(points[0], points[1]); // first point as last point
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
pts.unshift(points[1]); // copy 1. point and insert at beginning
|
|
115
|
-
pts.unshift(points[0]);
|
|
116
|
-
pts.push(points[l - 2], points[l - 1]); // duplicate end-points
|
|
117
|
-
}
|
|
118
|
-
// cache inner-loop calculations as they are based on t alone
|
|
119
|
-
cache[0] = 1; // 1,0,0,0
|
|
120
|
-
for (; i < numOfSeg; i++) {
|
|
121
|
-
var st = i / numOfSeg, st2 = st * st, st3 = st2 * st, st23 = st3 * 2, st32 = st2 * 3;
|
|
122
|
-
cache[cachePtr++] = st23 - st32 + 1; // c1
|
|
123
|
-
cache[cachePtr++] = st32 - st23; // c2
|
|
124
|
-
cache[cachePtr++] = st3 - 2 * st2 + st; // c3
|
|
125
|
-
cache[cachePtr++] = st3 - st2; // c4
|
|
126
|
-
}
|
|
127
|
-
cache[cachePtr] = 1; // 0,1,0,0
|
|
128
|
-
// calc. points
|
|
129
|
-
parse(pts, cache, l);
|
|
130
|
-
if (close) {
|
|
131
|
-
//l = points.length;
|
|
132
|
-
pts = [];
|
|
133
|
-
pts.push(points[l - 4], points[l - 3], points[l - 2], points[l - 1]); // second last and last
|
|
134
|
-
pts.push(points[0], points[1], points[2], points[3]); // first and second
|
|
135
|
-
parse(pts, cache, 4);
|
|
136
|
-
}
|
|
137
|
-
function parse(pts, cache, l) {
|
|
138
|
-
for (var i = 2, t; i < l; i += 2) {
|
|
139
|
-
var pt1 = pts[i], pt2 = pts[i + 1], pt3 = pts[i + 2], pt4 = pts[i + 3], t1x = (pt3 - pts[i - 2]) * tension, t1y = (pt4 - pts[i - 1]) * tension, t2x = (pts[i + 4] - pt1) * tension, t2y = (pts[i + 5] - pt2) * tension;
|
|
140
|
-
for (t = 0; t < numOfSeg; t++) {
|
|
141
|
-
var c = t << 2, //t * 4;
|
|
142
|
-
c1 = cache[c], c2 = cache[c + 1], c3 = cache[c + 2], c4 = cache[c + 3];
|
|
143
|
-
res[rPos++] = c1 * pt1 + c2 * pt3 + c3 * t1x + c4 * t2x;
|
|
144
|
-
res[rPos++] = c1 * pt2 + c2 * pt4 + c3 * t1y + c4 * t2y;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
// add last point
|
|
149
|
-
l = close ? 0 : points.length - 2;
|
|
150
|
-
res[rPos++] = points[l];
|
|
151
|
-
res[rPos] = points[l + 1];
|
|
152
|
-
if (!path) {
|
|
153
|
-
path = this;
|
|
154
|
-
}
|
|
155
|
-
// add lines to path
|
|
156
|
-
for (let i = 0, l = res.length; i < l; i += 2) {
|
|
157
|
-
if (i == 0 && move !== false) {
|
|
158
|
-
path.moveTo(res[i], res[i + 1]);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
path.lineTo(res[i], res[i + 1]);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function line(x1, y1, x2, y2, color, lineWidth = 1) {
|
|
166
|
-
this.save();
|
|
167
|
-
this.beginPath();
|
|
168
|
-
this.moveTo(x1, y1);
|
|
169
|
-
this.lineTo(x2, y2);
|
|
170
|
-
this.lineWidth = lineWidth;
|
|
171
|
-
this.strokeStyle = color;
|
|
172
|
-
this.stroke();
|
|
173
|
-
this.restore();
|
|
174
|
-
}
|
|
175
|
-
function roundRect(x, y, width, height, radius) {
|
|
176
|
-
//this.beginPath( );
|
|
177
|
-
this.moveTo(x + radius, y);
|
|
178
|
-
this.lineTo(x + width - radius, y);
|
|
179
|
-
this.quadraticCurveTo(x + width, y, x + width, y + radius);
|
|
180
|
-
this.lineTo(x + width, y + height - radius);
|
|
181
|
-
this.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
|
|
182
|
-
this.lineTo(x + radius, y + height);
|
|
183
|
-
this.quadraticCurveTo(x, y + height, x, y + height - radius);
|
|
184
|
-
this.lineTo(x, y + radius);
|
|
185
|
-
this.quadraticCurveTo(x, y, x + radius, y);
|
|
186
|
-
this.closePath();
|
|
187
|
-
}
|
|
188
|
-
function calcTextSize(text, rounded = false) {
|
|
189
|
-
let fh = this.measureText(text);
|
|
190
|
-
let lh = fh.fontBoundingBoxAscent + fh.fontBoundingBoxDescent;
|
|
191
|
-
if (rounded) {
|
|
192
|
-
return { width: Math.round(fh.width), height: Math.round(lh) };
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
return { width: fh.width, height: lh };
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function setFontSize(fs) {
|
|
199
|
-
let fsize = Math.round(fs) + 'px';
|
|
200
|
-
this.font = this.font.replace(/\d+px/, fsize);
|
|
201
|
-
}
|
|
202
|
-
function circle(x, y, radius) {
|
|
203
|
-
this.moveTo(x + radius, y);
|
|
204
|
-
this.arc(x, y, radius, 0, Math.PI * 2);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
*
|
|
208
|
-
*/
|
|
209
|
-
//export class CanvasProps extends CProps
|
|
210
|
-
//{
|
|
211
|
-
// low level handlers
|
|
212
|
-
//mousedown?: (ev: MouseEvent) => any;
|
|
213
|
-
//mousemove?: (ev: MouseEvent) => any;
|
|
214
|
-
//mouseup?: (ev: MouseEvent) => any;
|
|
215
|
-
//mouseleave?: (ev: MouseEvent) => any;
|
|
216
|
-
//mousewheel?: (ev: WheelEvent) => any;
|
|
217
|
-
//click?: (ev: MouseEvent) => any;
|
|
218
|
-
//dblclick?: (ev: MouseEvent) => any;
|
|
219
|
-
//touchstart?: (ev: TouchEvent) => any;
|
|
220
|
-
//touchmove?: (ev: TouchEvent) => any;
|
|
221
|
-
//touchend?: (ev: TouchEvent) => any;
|
|
222
|
-
//keydown?: (ev: KeyboardEvent) => any;
|
|
223
|
-
//keyup?: (ev: KeyboardEvent) => any;
|
|
224
|
-
//}
|
|
225
|
-
/**
|
|
226
|
-
* Standard Canvas
|
|
227
|
-
*/
|
|
228
|
-
class Canvas extends component_1.Component {
|
|
229
|
-
constructor(props) {
|
|
230
|
-
super(props);
|
|
231
|
-
this.m_iwidth = -1;
|
|
232
|
-
this.m_iheight = -1;
|
|
233
|
-
this.m_scale = 1.0;
|
|
234
|
-
/**
|
|
235
|
-
* redraw the canvas (force a paint)
|
|
236
|
-
*/
|
|
237
|
-
this.$update_rep = 0;
|
|
238
|
-
//if( props.mousedown ) { this.setDomEvent( 'mousedown', props.mousedown ); }
|
|
239
|
-
//if( props.mousemove ) { this.setDomEvent( 'mousemove', props.mousemove ); }
|
|
240
|
-
//if( props.mouseup ) { this.setDomEvent( 'mouseup', props.mouseup ); }
|
|
241
|
-
//if( props.mousewheel ) { this.setDomEvent( 'wheel', props.mousewheel ); }
|
|
242
|
-
//if( props.mouseleave ) { this.setDomEvent( 'mouseleave', props.mouseleave ); }
|
|
243
|
-
//if( props.click ) { this.setDomEvent( 'click', props.click ); }
|
|
244
|
-
//if( props.dblclick ) { this.setDomEvent( 'dblclick', props.dblclick ); }
|
|
245
|
-
//if( props.touchstart ) { this.setDomEvent( 'touchstart', props.touchstart ); }
|
|
246
|
-
//if( props.touchmove ) { this.setDomEvent( 'touchmove', props.touchmove ); }
|
|
247
|
-
//if( props.touchend ) { this.setDomEvent( 'touchend', props.touchend ); }
|
|
248
|
-
//if( props.keydown ) { this.setDomEvent( 'keydown', props.keydown ); this.setAttribute( 'tabindex', 0 ); }
|
|
249
|
-
//if( props.keyup ) { this.setDomEvent( 'keyup', props.keyup ); this.setAttribute( 'tabindex', 0 ); }
|
|
250
|
-
//if( props.paint ) { this.onPaint( props.paint ); }
|
|
251
|
-
this.setDomEvent('sizechange', () => { this._paint(); });
|
|
252
|
-
this.mapPropEvents(props, 'paint');
|
|
253
|
-
}
|
|
254
|
-
/** @ignore */
|
|
255
|
-
render() {
|
|
256
|
-
this.m_iwidth = -1;
|
|
257
|
-
this.m_iheight = -1;
|
|
258
|
-
this.m_canvas = new component_1.Component({
|
|
259
|
-
tag: 'canvas'
|
|
260
|
-
});
|
|
261
|
-
this.setContent(this.m_canvas);
|
|
262
|
-
// this.redraw(10);
|
|
263
|
-
}
|
|
264
|
-
update(delay = 0) {
|
|
265
|
-
this.m_iheight = this.m_iwidth = -1;
|
|
266
|
-
super.update(delay);
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* scale the whole canvas
|
|
270
|
-
*/
|
|
271
|
-
scale(scale) {
|
|
272
|
-
this.m_scale = scale;
|
|
273
|
-
this.m_iwidth = -1; // force recalc
|
|
274
|
-
this.redraw();
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* return the internal canvas
|
|
278
|
-
*/
|
|
279
|
-
get canvas() {
|
|
280
|
-
return this.m_canvas;
|
|
281
|
-
}
|
|
282
|
-
redraw(wait) {
|
|
283
|
-
if (wait !== undefined) {
|
|
284
|
-
if (++this.$update_rep >= 20) {
|
|
285
|
-
this.stopTimer('update');
|
|
286
|
-
this._paint();
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
this.startTimer('update', wait, false, () => this._paint());
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
this.stopTimer('update');
|
|
294
|
-
this._paint();
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
*
|
|
299
|
-
*/
|
|
300
|
-
_paint() {
|
|
301
|
-
this.$update_rep = 0;
|
|
302
|
-
let dom = this.dom;
|
|
303
|
-
if (!this.isUserVisible()) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
let canvas = this.m_canvas.dom, w = dom.clientWidth, h = dom.clientHeight;
|
|
307
|
-
let ctx = canvas.getContext('2d');
|
|
308
|
-
if (w != this.m_iwidth || h != this.m_iheight) {
|
|
309
|
-
// adjustment for HDPI
|
|
310
|
-
let devicePixelRatio = window.devicePixelRatio || 1;
|
|
311
|
-
let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
|
|
312
|
-
ctx.mozBackingStorePixelRatio ||
|
|
313
|
-
ctx.msBackingStorePixelRatio ||
|
|
314
|
-
ctx.oBackingStorePixelRatio ||
|
|
315
|
-
ctx.backingStorePixelRatio || 1;
|
|
316
|
-
let canvas = this.canvas;
|
|
317
|
-
if (devicePixelRatio !== backingStoreRatio || this.m_scale != 1.0) {
|
|
318
|
-
let ratio = devicePixelRatio / backingStoreRatio, rw = w * ratio, rh = h * ratio;
|
|
319
|
-
canvas.setAttribute('width', '' + rw);
|
|
320
|
-
canvas.setAttribute('height', '' + rh);
|
|
321
|
-
canvas.setStyleValue('width', w);
|
|
322
|
-
canvas.setStyleValue('height', h);
|
|
323
|
-
ratio *= this.m_scale;
|
|
324
|
-
ctx.scale(ratio, ratio);
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
canvas.setAttribute('width', '' + w);
|
|
328
|
-
canvas.setAttribute('height', '' + h);
|
|
329
|
-
canvas.setStyleValue('width', w);
|
|
330
|
-
canvas.setStyleValue('height', h);
|
|
331
|
-
ctx.scale(1, 1);
|
|
332
|
-
}
|
|
333
|
-
this.m_iwidth = w;
|
|
334
|
-
this.m_iheight = h;
|
|
335
|
-
}
|
|
336
|
-
if (w && h) {
|
|
337
|
-
let cc = mkPainter(ctx, w, h);
|
|
338
|
-
if (this.m_props.autoClear) {
|
|
339
|
-
cc.clearRect(0, 0, w, h);
|
|
340
|
-
}
|
|
341
|
-
cc.save();
|
|
342
|
-
cc.translate(-0.5, -0.5);
|
|
343
|
-
this.paint(cc);
|
|
344
|
-
cc.restore();
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
paint(ctx) {
|
|
348
|
-
try {
|
|
349
|
-
if (this.m_props.painter) {
|
|
350
|
-
this.m_props.painter(ctx);
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
this.emit('paint', EvPaint(ctx));
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
catch (x) {
|
|
357
|
-
console.assert(false, x);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
exports.Canvas = Canvas;
|
package/lib/cjs/cardview.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file cardview.ts
|
|
10
|
-
* @author Etienne Cochard
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
* in the Software without restriction, including without limitation the rights
|
|
17
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
18
|
-
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
19
|
-
* subject to the following conditions:
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all copies
|
|
21
|
-
* or substantial portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
24
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
25
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
28
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
-
**/
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.CardView = void 0;
|
|
32
|
-
const component_1 = require("./component");
|
|
33
|
-
const x4events_1 = require("./x4events");
|
|
34
|
-
const tools_1 = require("./tools");
|
|
35
|
-
/**
|
|
36
|
-
* Standard CardView class
|
|
37
|
-
* a card view is composed of multiples pages with only one visible at a time.
|
|
38
|
-
* pages can be selected by a component (like tabs ou sidebar).
|
|
39
|
-
* or by code.
|
|
40
|
-
*/
|
|
41
|
-
class CardView extends component_1.Component {
|
|
42
|
-
constructor(props) {
|
|
43
|
-
super(props);
|
|
44
|
-
this.m_cards = [];
|
|
45
|
-
this.m_ipage = props.active;
|
|
46
|
-
this.m_cpage = null;
|
|
47
|
-
this.singleShot(() => {
|
|
48
|
-
this.setPages(props.pages);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
/** @ignore */
|
|
52
|
-
render() {
|
|
53
|
-
let pages = [];
|
|
54
|
-
this.m_cards.forEach((p) => {
|
|
55
|
-
if (p.page) {
|
|
56
|
-
pages.push(p.page);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
this.setContent(pages);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* switch to a specific card
|
|
63
|
-
* @param name - card name as define in constructor
|
|
64
|
-
*/
|
|
65
|
-
switchTo(name) {
|
|
66
|
-
var _a;
|
|
67
|
-
if (this.m_cards.length == 0) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (name === undefined) {
|
|
71
|
-
name = this.m_cards[0].name;
|
|
72
|
-
}
|
|
73
|
-
if (name === ((_a = this.m_cpage) === null || _a === void 0 ? void 0 : _a.name)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
// hide old one
|
|
77
|
-
if (this.m_cpage) {
|
|
78
|
-
if (this.m_cpage.selector) {
|
|
79
|
-
this.m_cpage.selector.removeClass('@active');
|
|
80
|
-
}
|
|
81
|
-
if (this.m_cpage.page && !(this.m_cpage.page instanceof Function)) {
|
|
82
|
-
let page = this.m_cpage.page;
|
|
83
|
-
page.removeClass('@active');
|
|
84
|
-
page.addClass('@hidden');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
this.m_cpage = this.m_cards.find((card) => card.name == name);
|
|
88
|
-
if (this.m_cpage) {
|
|
89
|
-
if (this.m_cpage.page) {
|
|
90
|
-
if ((0, tools_1.isFunction)(this.m_cpage.page)) {
|
|
91
|
-
this.m_cpage.page = this.m_cpage.page();
|
|
92
|
-
console.assert(this.m_cpage.page != null, 'You must return a valid component');
|
|
93
|
-
}
|
|
94
|
-
let page = this.m_cpage.page;
|
|
95
|
-
page.addClass('@active');
|
|
96
|
-
page.removeClass('@hidden');
|
|
97
|
-
if (!page.dom) {
|
|
98
|
-
this._preparePage(page);
|
|
99
|
-
}
|
|
100
|
-
if (this.m_cpage.selector) {
|
|
101
|
-
this.m_cpage.selector.addClass('@active');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
this.emit('change', (0, x4events_1.EvChange)(this.m_cpage.name));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
*/
|
|
110
|
-
setPages(pages) {
|
|
111
|
-
let active = this._initTabs(pages);
|
|
112
|
-
if (active) {
|
|
113
|
-
(0, tools_1.asap)(() => {
|
|
114
|
-
this.switchTo(active);
|
|
115
|
-
this.update();
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
*/
|
|
122
|
-
_initTabs(pages) {
|
|
123
|
-
if (!pages) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
let active = this.m_ipage;
|
|
127
|
-
pages.forEach((p) => {
|
|
128
|
-
if (!p) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
let card = Object.assign({}, p);
|
|
132
|
-
card.selector = this._prepareSelector(p);
|
|
133
|
-
card.active = false;
|
|
134
|
-
this.m_cards.push(card);
|
|
135
|
-
if (!active) {
|
|
136
|
-
active = p.name;
|
|
137
|
-
}
|
|
138
|
-
if (p.active) {
|
|
139
|
-
active = p.name;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
return active;
|
|
143
|
-
}
|
|
144
|
-
_updateSelector() {
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* prepare the cardinfo
|
|
148
|
-
* can be used by derivations to create & set selectors
|
|
149
|
-
*/
|
|
150
|
-
_prepareSelector(card) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
*
|
|
155
|
-
*/
|
|
156
|
-
_preparePage(page) {
|
|
157
|
-
page.setStyleValue('flex', 1);
|
|
158
|
-
page.addClass('@tab-page');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
exports.CardView = CardView;
|
package/lib/cjs/checkbox.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file checkbox.ts
|
|
10
|
-
* @author Etienne Cochard
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
* in the Software without restriction, including without limitation the rights
|
|
17
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
18
|
-
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
19
|
-
* subject to the following conditions:
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all copies
|
|
21
|
-
* or substantial portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
24
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
25
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
28
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
-
**/
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.CheckBox = void 0;
|
|
32
|
-
const component_1 = require("./component");
|
|
33
|
-
const x4events_1 = require("./x4events");
|
|
34
|
-
const input_1 = require("./input");
|
|
35
|
-
const label_1 = require("./label");
|
|
36
|
-
/**
|
|
37
|
-
* Standard CheckBox
|
|
38
|
-
*/
|
|
39
|
-
class CheckBox extends component_1.Component {
|
|
40
|
-
constructor(props) {
|
|
41
|
-
super(props);
|
|
42
|
-
this.setDomEvent('focus', () => this._setFocus());
|
|
43
|
-
this.mapPropEvents(props, 'change');
|
|
44
|
-
if (props.slider) {
|
|
45
|
-
this.addClass('slider');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/** @ignore */
|
|
49
|
-
render(props) {
|
|
50
|
-
// checkbox
|
|
51
|
-
var _a, _b, _c, _d, _e;
|
|
52
|
-
let labelWidth = (_a = props.labelWidth) !== null && _a !== void 0 ? _a : -1;
|
|
53
|
-
let uid = '__cb_' + this.uid;
|
|
54
|
-
this.setTag('label');
|
|
55
|
-
this.addClass('@hlayout');
|
|
56
|
-
this.addClass((_b = props.align) !== null && _b !== void 0 ? _b : 'left');
|
|
57
|
-
this.setContent([
|
|
58
|
-
new input_1.Input({
|
|
59
|
-
ref: 'input',
|
|
60
|
-
type: 'checkbox',
|
|
61
|
-
name: props.name,
|
|
62
|
-
id: uid,
|
|
63
|
-
tabIndex: props.tabIndex,
|
|
64
|
-
value: (_c = props.value) !== null && _c !== void 0 ? _c : 'on',
|
|
65
|
-
attrs: {
|
|
66
|
-
checked: props.checked ? '' : undefined
|
|
67
|
-
},
|
|
68
|
-
dom_events: {
|
|
69
|
-
change: this._change.bind(this),
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
props.slider ? new component_1.Component({ cls: '@slide-el' }) : null,
|
|
73
|
-
new label_1.Label({
|
|
74
|
-
text: (_d = props.text) !== null && _d !== void 0 ? _d : '',
|
|
75
|
-
width: labelWidth < 0 ? undefined : labelWidth,
|
|
76
|
-
flex: labelWidth < 0 ? -labelWidth : undefined,
|
|
77
|
-
align: (_e = props.labelAlign) !== null && _e !== void 0 ? _e : 'left',
|
|
78
|
-
style: {
|
|
79
|
-
order: props.align == 'right' ? -1 : 1,
|
|
80
|
-
},
|
|
81
|
-
attrs: {
|
|
82
|
-
"for": uid
|
|
83
|
-
}
|
|
84
|
-
}),
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* check state changed
|
|
89
|
-
*/
|
|
90
|
-
_change() {
|
|
91
|
-
this.emit('change', (0, x4events_1.EvChange)(this.check));
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* focus gained/loosed
|
|
95
|
-
*/
|
|
96
|
-
_setFocus() {
|
|
97
|
-
let input = this.itemWithRef('input');
|
|
98
|
-
input.focus();
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @return the checked value
|
|
102
|
-
*/
|
|
103
|
-
get check() {
|
|
104
|
-
if (this.dom) {
|
|
105
|
-
let input = this.itemWithRef('input');
|
|
106
|
-
let dom = input.dom;
|
|
107
|
-
return dom.checked;
|
|
108
|
-
}
|
|
109
|
-
return this.m_props.checked;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* change the checked value
|
|
113
|
-
* @param {boolean} ck new checked value
|
|
114
|
-
*/
|
|
115
|
-
set check(ck) {
|
|
116
|
-
if (this.dom) {
|
|
117
|
-
let input = this.itemWithRef('input');
|
|
118
|
-
const dom = input.dom;
|
|
119
|
-
if (dom) {
|
|
120
|
-
dom.checked = ck;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
this.m_props.checked = ck;
|
|
124
|
-
//this._change(); // todo: is it needed when changed by code ? -> no
|
|
125
|
-
}
|
|
126
|
-
get text() {
|
|
127
|
-
return this.itemWithRef('label').text;
|
|
128
|
-
}
|
|
129
|
-
set text(text) {
|
|
130
|
-
this.itemWithRef('label').text = text;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* toggle the checkbox
|
|
134
|
-
*/
|
|
135
|
-
toggle() {
|
|
136
|
-
this.check = !this.check;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.CheckBox = CheckBox;
|