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/input.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file input.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.Input = void 0;
|
|
32
|
-
const component_1 = require("./component");
|
|
33
|
-
/**
|
|
34
|
-
* base class for elements implementing an input
|
|
35
|
-
* CARE derived classes must set this.ui.input
|
|
36
|
-
*/
|
|
37
|
-
class Input extends component_1.Component {
|
|
38
|
-
constructor(props) {
|
|
39
|
-
super(props);
|
|
40
|
-
}
|
|
41
|
-
/** @ignore */
|
|
42
|
-
render(props) {
|
|
43
|
-
var _a;
|
|
44
|
-
this.setTag('input');
|
|
45
|
-
this._setTabIndex(props.tabIndex);
|
|
46
|
-
this.setAttributes(Object.assign({ value: props.value, type: props.type || 'text', name: props.name, placeholder: props.placeHolder, autofocus: props.autoFocus, readonly: props.readOnly, autocomplete: 'new-password', tabIndex: props.tabIndex, spellcheck: props.spellcheck === false ? 'false' : undefined, min: props.min, max: props.max }, props.attrs));
|
|
47
|
-
this.m_props.autosel = (_a = props.autosel) !== null && _a !== void 0 ? _a : true;
|
|
48
|
-
if (props.uppercase) {
|
|
49
|
-
this.setStyleValue('textTransform', 'uppercase');
|
|
50
|
-
}
|
|
51
|
-
if (this.m_props.autosel) {
|
|
52
|
-
this.setDomEvent("focus", () => {
|
|
53
|
-
this.selectAll();
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
getType() {
|
|
58
|
-
return this.m_props.type;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* return the current editor value
|
|
62
|
-
*/
|
|
63
|
-
get value() {
|
|
64
|
-
if (this.dom) {
|
|
65
|
-
this.m_props.value = this.dom.value;
|
|
66
|
-
}
|
|
67
|
-
if (this.m_props.uppercase) {
|
|
68
|
-
let upper = this.m_props.value.toUpperCase(); // todo: locale ?
|
|
69
|
-
if (this.dom && upper != this.m_props.value) {
|
|
70
|
-
this.dom.value = upper; // update the input
|
|
71
|
-
}
|
|
72
|
-
this.m_props.value = upper;
|
|
73
|
-
}
|
|
74
|
-
return this.m_props.value;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Change the editor value
|
|
78
|
-
* @param value - new value to set
|
|
79
|
-
*/
|
|
80
|
-
set value(value) {
|
|
81
|
-
this.m_props.value = value;
|
|
82
|
-
if (this.dom) {
|
|
83
|
-
this.dom.value = value;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
getStoreValue() {
|
|
87
|
-
if (this.m_props.value_hook) {
|
|
88
|
-
return this.m_props.value_hook.get();
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
let type = this.getAttribute('type');
|
|
92
|
-
if (type) {
|
|
93
|
-
type = type.toLowerCase();
|
|
94
|
-
}
|
|
95
|
-
let value, dom = this.dom;
|
|
96
|
-
if (type === "file") {
|
|
97
|
-
value = [];
|
|
98
|
-
let files = dom.files;
|
|
99
|
-
for (let file = 0; file < files.length; file++) {
|
|
100
|
-
value.push(files[file].name);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else if (type === 'checkbox') {
|
|
104
|
-
if (dom.checked) {
|
|
105
|
-
value = 1;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
value = 0;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else if (type === 'radio') {
|
|
112
|
-
if (dom.checked) {
|
|
113
|
-
value = this.value;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else if (type === 'date') {
|
|
117
|
-
debugger;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
value = this.value;
|
|
121
|
-
}
|
|
122
|
-
return value;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
setStoreValue(v) {
|
|
126
|
-
if (this.m_props.value_hook) {
|
|
127
|
-
return this.m_props.value_hook.set(v);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
let type = this.getAttribute('type'), dom = this.dom;
|
|
131
|
-
if (type) {
|
|
132
|
-
type = type.toLowerCase();
|
|
133
|
-
}
|
|
134
|
-
if (type === 'checkbox') {
|
|
135
|
-
let newval = v !== null && v !== '0' && v !== 0 && v !== false;
|
|
136
|
-
if (newval !== dom.checked) {
|
|
137
|
-
dom.setAttribute('checked', '' + newval);
|
|
138
|
-
dom.dispatchEvent(new Event('change'));
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
this.value = v;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
set readOnly(ro) {
|
|
147
|
-
this.setAttribute('readonly', ro);
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* select all the text
|
|
151
|
-
*/
|
|
152
|
-
selectAll() {
|
|
153
|
-
this.dom.select();
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* select a part of the text
|
|
157
|
-
* @param start
|
|
158
|
-
* @param length
|
|
159
|
-
*/
|
|
160
|
-
select(start, length = 9999) {
|
|
161
|
-
this.dom.setSelectionRange(start, start + length);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* get the selection as { start, length }
|
|
165
|
-
*/
|
|
166
|
-
getSelection() {
|
|
167
|
-
let idom = this.dom;
|
|
168
|
-
return {
|
|
169
|
-
start: idom.selectionStart,
|
|
170
|
-
length: idom.selectionEnd - idom.selectionStart,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.Input = Input;
|
package/lib/cjs/label.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file label.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.Label = void 0;
|
|
32
|
-
const component_1 = require("./component");
|
|
33
|
-
const tools_1 = require("./tools");
|
|
34
|
-
const icon_1 = require("./icon");
|
|
35
|
-
/**
|
|
36
|
-
* Standard label
|
|
37
|
-
*/
|
|
38
|
-
class Label extends component_1.Component {
|
|
39
|
-
constructor(param) {
|
|
40
|
-
if (typeof (param) === 'string' || param instanceof tools_1.HtmlString) {
|
|
41
|
-
super({ text: param });
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
super(param);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/** @ignore */
|
|
48
|
-
render(props) {
|
|
49
|
-
var _a;
|
|
50
|
-
let text = this.m_props.text;
|
|
51
|
-
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
52
|
-
text = new tools_1.HtmlString((0, tools_1.escapeHtml)(text, true));
|
|
53
|
-
}
|
|
54
|
-
if (!props.icon) {
|
|
55
|
-
this.setContent(text);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
this.setTag('span');
|
|
59
|
-
this.addClass('@hlayout');
|
|
60
|
-
this.setContent([
|
|
61
|
-
new icon_1.Icon({ icon: props.icon }),
|
|
62
|
-
new component_1.Component({ content: text, ref: 'text' })
|
|
63
|
-
]);
|
|
64
|
-
}
|
|
65
|
-
this.addClass((_a = props.align) !== null && _a !== void 0 ? _a : 'left');
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* change the displayed text
|
|
69
|
-
* @param text - new text
|
|
70
|
-
*/
|
|
71
|
-
set text(txt) {
|
|
72
|
-
let props = this.m_props;
|
|
73
|
-
if (props.text !== txt) {
|
|
74
|
-
props.text = txt;
|
|
75
|
-
let text = this.m_props.text;
|
|
76
|
-
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
77
|
-
text = new tools_1.HtmlString((0, tools_1.escapeHtml)(text, true));
|
|
78
|
-
}
|
|
79
|
-
if (this.dom) {
|
|
80
|
-
let comp = this;
|
|
81
|
-
if (this.m_props.icon) {
|
|
82
|
-
comp = this.itemWithRef('text');
|
|
83
|
-
}
|
|
84
|
-
comp.setContent(text);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
*/
|
|
91
|
-
get text() {
|
|
92
|
-
return this.m_props.text;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.Label = Label;
|
package/lib/cjs/layout.js
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file layout.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.Masonry = exports.ScrollView = exports.TableLayout = exports.GridLayout = exports.AutoLayout = exports.VLayout = exports.HLayout = exports.AbsLayout = void 0;
|
|
32
|
-
const component_1 = require("./component");
|
|
33
|
-
const tools_1 = require("./tools");
|
|
34
|
-
// ============================================================================
|
|
35
|
-
// [ABSLAYOUT]
|
|
36
|
-
// ============================================================================
|
|
37
|
-
class AbsLayout extends component_1.Container {
|
|
38
|
-
}
|
|
39
|
-
exports.AbsLayout = AbsLayout;
|
|
40
|
-
// ============================================================================
|
|
41
|
-
// [HLAYOUT]
|
|
42
|
-
// ============================================================================
|
|
43
|
-
class HLayout extends component_1.Container {
|
|
44
|
-
}
|
|
45
|
-
exports.HLayout = HLayout;
|
|
46
|
-
// ============================================================================
|
|
47
|
-
// [VLAYOUT]
|
|
48
|
-
// ============================================================================
|
|
49
|
-
class VLayout extends component_1.Container {
|
|
50
|
-
}
|
|
51
|
-
exports.VLayout = VLayout;
|
|
52
|
-
class AutoLayout extends component_1.Container {
|
|
53
|
-
constructor(props) {
|
|
54
|
-
super(props);
|
|
55
|
-
this.setDomEvent('sizechange', () => this._updateLayout());
|
|
56
|
-
}
|
|
57
|
-
componentCreated() {
|
|
58
|
-
super.componentCreated();
|
|
59
|
-
this._updateLayout();
|
|
60
|
-
}
|
|
61
|
-
_updateLayout() {
|
|
62
|
-
let horz = this.m_props.defaultLayout == 'horizontal' ? true : false;
|
|
63
|
-
if (this.m_props.switchSize <= 0 && window.screen.height > window.screen.width) {
|
|
64
|
-
horz = !horz;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
let rc = this.getBoundingRect();
|
|
68
|
-
if ((horz && rc.width < this.m_props.switchSize) || (!horz && rc.height < this.m_props.switchSize)) {
|
|
69
|
-
horz = !horz;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (horz) {
|
|
73
|
-
this.removeClass('@vlayout');
|
|
74
|
-
this.addClass('@hlayout');
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
this.addClass('@vlayout');
|
|
78
|
-
this.removeClass('@hlayout');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.AutoLayout = AutoLayout;
|
|
83
|
-
class GridLayout extends component_1.Container {
|
|
84
|
-
constructor(props) {
|
|
85
|
-
/// @ts-ignore
|
|
86
|
-
// Argument of type 'GridLayoutProps' is not assignable to parameter of type 'P'.
|
|
87
|
-
// 'GridLayoutProps' is assignable to the constraint of type 'P', but 'P' could be instantiated with a different subtype of constraint 'GridLayoutProps'.
|
|
88
|
-
super(props);
|
|
89
|
-
}
|
|
90
|
-
/** @ignore */
|
|
91
|
-
render() {
|
|
92
|
-
if (this.m_props.colSizes) {
|
|
93
|
-
this.setStyleValue('grid-template-columns', this.m_props.colSizes);
|
|
94
|
-
}
|
|
95
|
-
if (this.m_props.rowSizes) {
|
|
96
|
-
this.setStyleValue('grid-template-rows', this.m_props.rowSizes);
|
|
97
|
-
}
|
|
98
|
-
if (this.m_props.colGap) {
|
|
99
|
-
this.setStyleValue('grid-gap', this.m_props.colGap);
|
|
100
|
-
}
|
|
101
|
-
if (this.m_props.template) {
|
|
102
|
-
this.setStyleValue('grid-template-areas', this.m_props.template.join('\n'));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.GridLayout = GridLayout;
|
|
107
|
-
class TableLayout extends component_1.Container {
|
|
108
|
-
constructor(props) {
|
|
109
|
-
super(props);
|
|
110
|
-
this.setTag('table');
|
|
111
|
-
this.m_cells = new Map();
|
|
112
|
-
}
|
|
113
|
-
_getCell(row, col, create = true) {
|
|
114
|
-
var _a;
|
|
115
|
-
let idx = _mkid(row, col);
|
|
116
|
-
return (_a = this.m_cells.get(idx)) !== null && _a !== void 0 ? _a : (create ? { item: undefined } : null);
|
|
117
|
-
}
|
|
118
|
-
_setCell(row, col, cell, update = false) {
|
|
119
|
-
let idx = _mkid(row, col);
|
|
120
|
-
this.m_cells.set(idx, cell);
|
|
121
|
-
if (this.dom && cell.item && update) {
|
|
122
|
-
if (cell.item instanceof component_1.Component) {
|
|
123
|
-
cell.item.update();
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
this.enumChilds((c) => {
|
|
127
|
-
let crow = c.getData('row');
|
|
128
|
-
if (crow == row) {
|
|
129
|
-
let ccol = c.getData('col');
|
|
130
|
-
if (ccol == col) {
|
|
131
|
-
c.setContent(cell.item);
|
|
132
|
-
c.update();
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
setCell(row, col, item) {
|
|
141
|
-
let cell = this._getCell(row, col);
|
|
142
|
-
cell.item = item;
|
|
143
|
-
this._setCell(row, col, cell, true);
|
|
144
|
-
}
|
|
145
|
-
merge(row, col, rowCount, colCount) {
|
|
146
|
-
let cell = this._getCell(row, col);
|
|
147
|
-
cell.rowSpan = rowCount;
|
|
148
|
-
cell.colSpan = colCount;
|
|
149
|
-
this._setCell(row, col, cell);
|
|
150
|
-
}
|
|
151
|
-
setCellWidth(row, col, width) {
|
|
152
|
-
let cell = this._getCell(row, col);
|
|
153
|
-
cell.width = width;
|
|
154
|
-
this._setCell(row, col, cell);
|
|
155
|
-
}
|
|
156
|
-
setCellHeight(row, col, height) {
|
|
157
|
-
let cell = this._getCell(row, col);
|
|
158
|
-
cell.height = height;
|
|
159
|
-
this._setCell(row, col, cell);
|
|
160
|
-
}
|
|
161
|
-
setCellClass(row, col, cls) {
|
|
162
|
-
let cell = this._getCell(row, col);
|
|
163
|
-
cell.cls = cls;
|
|
164
|
-
this._setCell(row, col, cell);
|
|
165
|
-
}
|
|
166
|
-
setColClass(col, cls) {
|
|
167
|
-
let cell = this._getCell(-1, col);
|
|
168
|
-
cell.cls = cls;
|
|
169
|
-
this._setCell(-1, col, cell);
|
|
170
|
-
}
|
|
171
|
-
setRowClass(row, cls) {
|
|
172
|
-
let cell = this._getCell(row, 999);
|
|
173
|
-
cell.cls = cls;
|
|
174
|
-
this._setCell(row, 999, cell);
|
|
175
|
-
}
|
|
176
|
-
getCell(row, col) {
|
|
177
|
-
let cell = this._getCell(row, col);
|
|
178
|
-
return cell === null || cell === void 0 ? void 0 : cell.item;
|
|
179
|
-
}
|
|
180
|
-
render() {
|
|
181
|
-
var _a, _b;
|
|
182
|
-
let rows = [];
|
|
183
|
-
let skip = [];
|
|
184
|
-
for (let r = 0; r < this.m_props.rows; r++) {
|
|
185
|
-
let cols = [];
|
|
186
|
-
for (let c = 0; c < this.m_props.columns; c++) {
|
|
187
|
-
let idx = _mkid(r, c);
|
|
188
|
-
if (skip.indexOf(idx) >= 0) {
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
let cell = this.m_cells.get(idx);
|
|
192
|
-
let cdata = this.m_cells.get(_mkid(-1, c));
|
|
193
|
-
let cls = '';
|
|
194
|
-
if (cell && cell.cls) {
|
|
195
|
-
cls = cell.cls;
|
|
196
|
-
}
|
|
197
|
-
if (cdata && cdata.cls) {
|
|
198
|
-
cls += ' ' + cdata.cls;
|
|
199
|
-
}
|
|
200
|
-
let cc = new component_1.Component({
|
|
201
|
-
tag: 'td',
|
|
202
|
-
content: cell === null || cell === void 0 ? void 0 : cell.item,
|
|
203
|
-
width: cell === null || cell === void 0 ? void 0 : cell.width,
|
|
204
|
-
height: cell === null || cell === void 0 ? void 0 : cell.height,
|
|
205
|
-
data: { row: r, col: c },
|
|
206
|
-
cls
|
|
207
|
-
});
|
|
208
|
-
if (cell) {
|
|
209
|
-
let rs = (_a = cell.rowSpan) !== null && _a !== void 0 ? _a : 0, cs = (_b = cell.colSpan) !== null && _b !== void 0 ? _b : 0;
|
|
210
|
-
if (rs > 0) {
|
|
211
|
-
cc.setAttribute('rowspan', rs + 1);
|
|
212
|
-
}
|
|
213
|
-
if (cs > 0) {
|
|
214
|
-
cc.setAttribute('colspan', cs + 1);
|
|
215
|
-
}
|
|
216
|
-
if (rs || cs) {
|
|
217
|
-
for (let sr = 0; sr <= rs; sr++) {
|
|
218
|
-
for (let sc = 0; sc <= cs; sc++) {
|
|
219
|
-
skip.push(_mkid(sr + r, sc + c));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
cols.push(cc);
|
|
225
|
-
}
|
|
226
|
-
let rdata = this._getCell(r, 999, false);
|
|
227
|
-
let rr = new component_1.Component({
|
|
228
|
-
tag: 'tr',
|
|
229
|
-
data: { row: r },
|
|
230
|
-
content: cols,
|
|
231
|
-
cls: rdata === null || rdata === void 0 ? void 0 : rdata.cls
|
|
232
|
-
});
|
|
233
|
-
rows.push(rr);
|
|
234
|
-
}
|
|
235
|
-
this.setContent(rows);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
exports.TableLayout = TableLayout;
|
|
239
|
-
/**
|
|
240
|
-
* @ignore
|
|
241
|
-
*/
|
|
242
|
-
function _mkid(row, col) {
|
|
243
|
-
return row * 1000 + col;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* @ignore
|
|
247
|
-
*/
|
|
248
|
-
function _getid(key) {
|
|
249
|
-
return {
|
|
250
|
-
row: Math.floor(key / 1000) | 0,
|
|
251
|
-
col: (key % 1000) | 0
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
class ScrollView extends component_1.Component {
|
|
255
|
-
constructor(props) {
|
|
256
|
-
super(props);
|
|
257
|
-
this.setContent(props.content);
|
|
258
|
-
}
|
|
259
|
-
setContent(content) {
|
|
260
|
-
if (!content) {
|
|
261
|
-
super.setContent(null);
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
let container;
|
|
265
|
-
if ((0, tools_1.isArray)(content)) {
|
|
266
|
-
container = new VLayout({ content });
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
container = content;
|
|
270
|
-
}
|
|
271
|
-
container.addClass('@scroll-container');
|
|
272
|
-
super.setContent(container);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
exports.ScrollView = ScrollView;
|
|
277
|
-
// :: MASONERY ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
278
|
-
// from a nice article of Andy Barefoot
|
|
279
|
-
// https://medium.com/@andybarefoot/a-masonry-style-layout-using-css-grid-8c663d355ebb
|
|
280
|
-
class Masonry extends component_1.Container {
|
|
281
|
-
constructor(props) {
|
|
282
|
-
const items = props.items;
|
|
283
|
-
props.items = undefined;
|
|
284
|
-
super(props);
|
|
285
|
-
this.setDomEvent('sizechange', () => {
|
|
286
|
-
this.resizeAllItems();
|
|
287
|
-
});
|
|
288
|
-
if (items) {
|
|
289
|
-
items.forEach(i => {
|
|
290
|
-
this.addItem(i);
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
resizeItem(item) {
|
|
295
|
-
const style = this.getComputedStyle();
|
|
296
|
-
const rowHeight = style.parse('grid-auto-rows');
|
|
297
|
-
const rowGap = style.parse('grid-row-gap');
|
|
298
|
-
let content = item.queryItem('.content');
|
|
299
|
-
if (!content) {
|
|
300
|
-
content = item;
|
|
301
|
-
}
|
|
302
|
-
if (content && (rowHeight + rowGap)) {
|
|
303
|
-
const rc = content.getBoundingRect();
|
|
304
|
-
const rowSpan = Math.ceil((rc.height + rowGap) / (rowHeight + rowGap));
|
|
305
|
-
item.setStyleValue('gridRowEnd', "span " + rowSpan);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
resizeAllItems() {
|
|
309
|
-
this.queryAll(".item", (itm) => {
|
|
310
|
-
;
|
|
311
|
-
this.resizeItem(itm);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
addItem(itm) {
|
|
315
|
-
itm.addClass('content');
|
|
316
|
-
this.appendChild(new component_1.Container({
|
|
317
|
-
cls: 'item',
|
|
318
|
-
content: itm
|
|
319
|
-
}));
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
exports.Masonry = Masonry;
|
package/lib/cjs/link.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file link.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.Link = void 0;
|
|
32
|
-
const component_1 = require("./component");
|
|
33
|
-
const x4events_1 = require("./x4events");
|
|
34
|
-
/**
|
|
35
|
-
* Standard Link
|
|
36
|
-
*/
|
|
37
|
-
class Link extends component_1.Component {
|
|
38
|
-
constructor(props) {
|
|
39
|
-
super(props);
|
|
40
|
-
this.setDomEvent('click', () => this._handleClick());
|
|
41
|
-
this.mapPropEvents(props, 'click');
|
|
42
|
-
}
|
|
43
|
-
_handleClick() {
|
|
44
|
-
this.emit('click', (0, x4events_1.EvClick)());
|
|
45
|
-
}
|
|
46
|
-
/** @ignore */
|
|
47
|
-
render(props) {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
let text = (_a = props.text) !== null && _a !== void 0 ? _a : '';
|
|
50
|
-
let href = (_b = props.href) !== null && _b !== void 0 ? _b : '#';
|
|
51
|
-
this.setTag('a');
|
|
52
|
-
this.setAttribute('tabindex', 0);
|
|
53
|
-
this.setAttribute('href', href);
|
|
54
|
-
this.setAttribute('target', props.target);
|
|
55
|
-
if (text) {
|
|
56
|
-
this.setContent((0, component_1.isHtmlString)(text) ? text : (0, component_1.html) `<span>${text}</span>`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
set text(text) {
|
|
60
|
-
this.m_props.text = text;
|
|
61
|
-
this.update();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.Link = Link;
|