x4js 1.4.4 → 1.4.7
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/application.d.ts +96 -0
- package/lib/application.js +146 -0
- package/lib/base64.d.ts +31 -0
- package/lib/base64.js +139 -0
- package/lib/base_component.d.ts +64 -0
- package/lib/base_component.js +81 -0
- package/lib/button.d.ts +145 -0
- package/lib/button.js +241 -0
- package/lib/calendar.d.ts +77 -0
- package/lib/calendar.js +241 -0
- package/lib/canvas.d.ts +88 -0
- package/lib/canvas.js +358 -0
- package/lib/cardview.d.ts +83 -0
- package/lib/cardview.js +156 -0
- package/lib/checkbox.d.ts +72 -0
- package/lib/checkbox.js +130 -0
- package/lib/color.d.ts +144 -0
- package/lib/color.js +588 -0
- package/lib/colorpicker.js +86 -80
- package/lib/combobox.js +26 -22
- package/lib/component.d.ts +572 -0
- package/lib/component.js +1729 -0
- package/lib/datastore.js +29 -20
- package/lib/dialog.js +41 -36
- package/lib/dom_events.d.ts +284 -0
- package/lib/dom_events.js +14 -0
- package/lib/drag_manager.js +4 -1
- package/lib/drawtext.js +9 -5
- package/lib/fileupload.js +19 -12
- package/lib/form.js +29 -25
- package/lib/formatters.js +19 -10
- package/lib/gridview.js +40 -35
- package/lib/hosts/host.d.ts +44 -0
- package/lib/hosts/host.js +73 -0
- package/lib/i18n.d.ts +67 -0
- package/lib/i18n.js +175 -0
- package/lib/icon.d.ts +56 -0
- package/lib/icon.js +178 -0
- package/lib/image.js +7 -3
- package/lib/index.js +71 -55
- package/lib/input.d.ts +86 -0
- package/lib/input.js +176 -0
- package/lib/label.d.ts +54 -0
- package/lib/label.js +90 -0
- package/lib/layout.d.ts +77 -0
- package/lib/layout.js +271 -0
- package/lib/link.js +9 -5
- package/lib/listview.js +34 -27
- package/lib/md5.js +5 -1
- package/lib/menu.d.ts +122 -0
- package/lib/menu.js +284 -0
- package/lib/messagebox.js +22 -17
- package/lib/panel.js +13 -9
- package/lib/popup.d.ts +71 -0
- package/lib/popup.js +378 -0
- package/lib/property_editor.js +20 -16
- package/lib/radiobtn.js +13 -9
- package/lib/rating.js +13 -9
- package/lib/request.js +16 -9
- package/lib/router.js +5 -1
- package/lib/settings.d.ts +33 -0
- package/lib/settings.js +67 -0
- package/lib/sidebarview.js +12 -8
- package/lib/smartedit.js +16 -11
- package/lib/spreadsheet.js +35 -31
- package/lib/styles.d.ts +81 -0
- package/lib/styles.js +268 -0
- package/lib/svgcomponent.js +8 -3
- package/lib/tabbar.js +10 -6
- package/lib/tabview.js +10 -6
- package/lib/textarea.js +10 -6
- package/lib/textedit.js +39 -35
- package/lib/texthiliter.js +8 -4
- package/lib/toaster.js +8 -4
- package/lib/tools.d.ts +382 -0
- package/lib/tools.js +1142 -0
- package/lib/tooltips.js +14 -9
- package/lib/treeview.js +30 -26
- package/lib/x4_events.d.ts +253 -0
- package/lib/x4_events.js +375 -0
- package/package.json +1 -1
- package/src/application.ts +9 -4
- package/src/x4.less +143 -107
- package/tsconfig.json +1 -1
- package/x4.css +1541 -0
package/lib/index.js
CHANGED
|
@@ -1,55 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./application"), exports);
|
|
18
|
+
__exportStar(require("./base_component"), exports);
|
|
19
|
+
__exportStar(require("./base64"), exports);
|
|
20
|
+
__exportStar(require("./button"), exports);
|
|
21
|
+
__exportStar(require("./calendar"), exports);
|
|
22
|
+
__exportStar(require("./canvas"), exports);
|
|
23
|
+
__exportStar(require("./cardview"), exports);
|
|
24
|
+
__exportStar(require("./checkbox"), exports);
|
|
25
|
+
__exportStar(require("./color"), exports);
|
|
26
|
+
__exportStar(require("./colorpicker"), exports);
|
|
27
|
+
__exportStar(require("./combobox"), exports);
|
|
28
|
+
__exportStar(require("./component"), exports);
|
|
29
|
+
__exportStar(require("./datastore"), exports);
|
|
30
|
+
__exportStar(require("./dialog"), exports);
|
|
31
|
+
__exportStar(require("./dom_events"), exports);
|
|
32
|
+
__exportStar(require("./drag_manager"), exports);
|
|
33
|
+
__exportStar(require("./drawtext"), exports);
|
|
34
|
+
__exportStar(require("./fileupload"), exports);
|
|
35
|
+
__exportStar(require("./form"), exports);
|
|
36
|
+
__exportStar(require("./formatters"), exports);
|
|
37
|
+
__exportStar(require("./gridview"), exports);
|
|
38
|
+
__exportStar(require("./i18n"), exports);
|
|
39
|
+
__exportStar(require("./icon"), exports);
|
|
40
|
+
__exportStar(require("./image"), exports);
|
|
41
|
+
__exportStar(require("./input"), exports);
|
|
42
|
+
__exportStar(require("./label"), exports);
|
|
43
|
+
__exportStar(require("./layout"), exports);
|
|
44
|
+
__exportStar(require("./link"), exports);
|
|
45
|
+
__exportStar(require("./listview"), exports);
|
|
46
|
+
__exportStar(require("./md5"), exports);
|
|
47
|
+
__exportStar(require("./menu"), exports);
|
|
48
|
+
__exportStar(require("./messagebox"), exports);
|
|
49
|
+
__exportStar(require("./panel"), exports);
|
|
50
|
+
__exportStar(require("./popup"), exports);
|
|
51
|
+
__exportStar(require("./property_editor"), exports);
|
|
52
|
+
__exportStar(require("./radiobtn"), exports);
|
|
53
|
+
__exportStar(require("./rating"), exports);
|
|
54
|
+
__exportStar(require("./request"), exports);
|
|
55
|
+
__exportStar(require("./router"), exports);
|
|
56
|
+
__exportStar(require("./settings"), exports);
|
|
57
|
+
__exportStar(require("./sidebarview"), exports);
|
|
58
|
+
__exportStar(require("./smartedit"), exports);
|
|
59
|
+
__exportStar(require("./spreadsheet"), exports);
|
|
60
|
+
__exportStar(require("./styles"), exports);
|
|
61
|
+
__exportStar(require("./svgcomponent"), exports);
|
|
62
|
+
__exportStar(require("./tabbar"), exports);
|
|
63
|
+
__exportStar(require("./tabview"), exports);
|
|
64
|
+
__exportStar(require("./textarea"), exports);
|
|
65
|
+
__exportStar(require("./textedit"), exports);
|
|
66
|
+
__exportStar(require("./texthiliter"), exports);
|
|
67
|
+
__exportStar(require("./toaster"), exports);
|
|
68
|
+
__exportStar(require("./tools"), exports);
|
|
69
|
+
__exportStar(require("./tooltips"), exports);
|
|
70
|
+
__exportStar(require("./treeview"), exports);
|
|
71
|
+
__exportStar(require("./x4_events"), exports);
|
package/lib/input.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file input.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* This program is free software; you can redistribute it and/or modify
|
|
14
|
+
* it under the terms of the GNU General Public License as published by
|
|
15
|
+
* the Free Software Foundation; either version 3 of the License, or
|
|
16
|
+
* (at your option) any later version.
|
|
17
|
+
*
|
|
18
|
+
* This program is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* GNU General Public License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
|
+
**/
|
|
25
|
+
import { Component, CProps, CEventMap } from './component';
|
|
26
|
+
export declare type EditType = 'text' | 'number' | 'email' | 'date' | 'password' | 'file' | 'checkbox' | 'radio';
|
|
27
|
+
export interface ValueHook {
|
|
28
|
+
get(): any;
|
|
29
|
+
set(v: any): void;
|
|
30
|
+
}
|
|
31
|
+
export interface InputEventMap extends CEventMap {
|
|
32
|
+
}
|
|
33
|
+
export interface InputProps<P extends InputEventMap = InputEventMap> extends CProps<P> {
|
|
34
|
+
value?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
type?: EditType;
|
|
37
|
+
placeHolder?: string;
|
|
38
|
+
autoFocus?: boolean;
|
|
39
|
+
readOnly?: boolean;
|
|
40
|
+
tabIndex?: number | boolean;
|
|
41
|
+
pattern?: string;
|
|
42
|
+
uppercase?: boolean;
|
|
43
|
+
spellcheck?: boolean;
|
|
44
|
+
value_hook?: ValueHook;
|
|
45
|
+
min?: number;
|
|
46
|
+
max?: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* base class for elements implementing an input
|
|
50
|
+
* CARE derived classes must set this.ui.input
|
|
51
|
+
*/
|
|
52
|
+
export declare class Input extends Component<InputProps, InputEventMap> {
|
|
53
|
+
constructor(props: InputProps);
|
|
54
|
+
/** @ignore */
|
|
55
|
+
render(props: InputProps): void;
|
|
56
|
+
getType(): EditType;
|
|
57
|
+
/**
|
|
58
|
+
* return the current editor value
|
|
59
|
+
*/
|
|
60
|
+
get value(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Change the editor value
|
|
63
|
+
* @param value - new value to set
|
|
64
|
+
*/
|
|
65
|
+
set value(value: string);
|
|
66
|
+
getStoreValue(): any;
|
|
67
|
+
setStoreValue(v: any): void;
|
|
68
|
+
set readOnly(ro: boolean);
|
|
69
|
+
/**
|
|
70
|
+
* select all the text
|
|
71
|
+
*/
|
|
72
|
+
selectAll(): void;
|
|
73
|
+
/**
|
|
74
|
+
* select a part of the text
|
|
75
|
+
* @param start
|
|
76
|
+
* @param length
|
|
77
|
+
*/
|
|
78
|
+
select(start: number, length?: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* get the selection as { start, length }
|
|
81
|
+
*/
|
|
82
|
+
getSelection(): {
|
|
83
|
+
start: number;
|
|
84
|
+
length: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
package/lib/input.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ___ ___ __
|
|
4
|
+
* \ \/ / / _
|
|
5
|
+
* \ / /_| |_
|
|
6
|
+
* / \____ _|
|
|
7
|
+
* /__/\__\ |_|
|
|
8
|
+
*
|
|
9
|
+
* @file input.ts
|
|
10
|
+
* @author Etienne Cochard
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
13
|
+
*
|
|
14
|
+
* This program is free software; you can redistribute it and/or modify
|
|
15
|
+
* it under the terms of the GNU General Public License as published by
|
|
16
|
+
* the Free Software Foundation; either version 3 of the License, or
|
|
17
|
+
* (at your option) any later version.
|
|
18
|
+
*
|
|
19
|
+
* This program is distributed in the hope that it will be useful,
|
|
20
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
+
* GNU General Public License for more details.
|
|
23
|
+
*
|
|
24
|
+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
25
|
+
**/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Input = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
/**
|
|
30
|
+
* base class for elements implementing an input
|
|
31
|
+
* CARE derived classes must set this.ui.input
|
|
32
|
+
*/
|
|
33
|
+
class Input extends component_1.Component {
|
|
34
|
+
constructor(props) {
|
|
35
|
+
super(props);
|
|
36
|
+
}
|
|
37
|
+
/** @ignore */
|
|
38
|
+
render(props) {
|
|
39
|
+
this.setProp('tag', 'input');
|
|
40
|
+
this._setTabIndex(props.tabIndex);
|
|
41
|
+
this.setAttributes({
|
|
42
|
+
value: props.value,
|
|
43
|
+
type: props.type || 'text',
|
|
44
|
+
name: props.name,
|
|
45
|
+
placeholder: props.placeHolder,
|
|
46
|
+
autofocus: props.autoFocus,
|
|
47
|
+
readonly: props.readOnly,
|
|
48
|
+
autocomplete: 'new-password',
|
|
49
|
+
tabindex: props.tabIndex,
|
|
50
|
+
spellcheck: props.spellcheck === false ? 'false' : undefined,
|
|
51
|
+
min: props.min,
|
|
52
|
+
max: props.max,
|
|
53
|
+
...props.attrs
|
|
54
|
+
});
|
|
55
|
+
if (props.uppercase) {
|
|
56
|
+
this.setStyleValue('textTransform', 'uppercase');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
getType() {
|
|
60
|
+
return this.m_props.type;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* return the current editor value
|
|
64
|
+
*/
|
|
65
|
+
get value() {
|
|
66
|
+
if (this.dom) {
|
|
67
|
+
this.m_props.value = this.dom.value;
|
|
68
|
+
}
|
|
69
|
+
if (this.m_props.uppercase) {
|
|
70
|
+
let upper = this.m_props.value.toUpperCase(); // todo: locale ?
|
|
71
|
+
if (this.dom && upper != this.m_props.value) {
|
|
72
|
+
this.dom.value = upper; // update the input
|
|
73
|
+
}
|
|
74
|
+
this.m_props.value = upper;
|
|
75
|
+
}
|
|
76
|
+
return this.m_props.value;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Change the editor value
|
|
80
|
+
* @param value - new value to set
|
|
81
|
+
*/
|
|
82
|
+
set value(value) {
|
|
83
|
+
this.m_props.value = value;
|
|
84
|
+
if (this.dom) {
|
|
85
|
+
this.dom.value = value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getStoreValue() {
|
|
89
|
+
if (this.m_props.value_hook) {
|
|
90
|
+
return this.m_props.value_hook.get();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
let type = this.getAttribute('type');
|
|
94
|
+
if (type) {
|
|
95
|
+
type = type.toLowerCase();
|
|
96
|
+
}
|
|
97
|
+
let value, dom = this.dom;
|
|
98
|
+
if (type === "file") {
|
|
99
|
+
value = [];
|
|
100
|
+
let files = dom.files;
|
|
101
|
+
for (let file = 0; file < files.length; file++) {
|
|
102
|
+
value.push(files[file].name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else if (type === 'checkbox') {
|
|
106
|
+
if (dom.checked) {
|
|
107
|
+
value = 1;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
value = 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (type === 'radio') {
|
|
114
|
+
if (dom.checked) {
|
|
115
|
+
value = this.value;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else if (type === 'date') {
|
|
119
|
+
debugger;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
value = this.value;
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
setStoreValue(v) {
|
|
128
|
+
if (this.m_props.value_hook) {
|
|
129
|
+
return this.m_props.value_hook.set(v);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
let type = this.getAttribute('type'), dom = this.dom;
|
|
133
|
+
if (type) {
|
|
134
|
+
type = type.toLowerCase();
|
|
135
|
+
}
|
|
136
|
+
if (type === 'checkbox') {
|
|
137
|
+
let newval = v !== null && v !== '0' && v !== 0 && v !== false;
|
|
138
|
+
if (newval !== dom.checked) {
|
|
139
|
+
dom.setAttribute('checked', '' + newval);
|
|
140
|
+
dom.dispatchEvent(new Event('change'));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
this.value = v;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
set readOnly(ro) {
|
|
149
|
+
this.setAttribute('readonly', ro);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* select all the text
|
|
153
|
+
*/
|
|
154
|
+
selectAll() {
|
|
155
|
+
this.dom.select();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* select a part of the text
|
|
159
|
+
* @param start
|
|
160
|
+
* @param length
|
|
161
|
+
*/
|
|
162
|
+
select(start, length = 9999) {
|
|
163
|
+
this.dom.setSelectionRange(start, start + length);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* get the selection as { start, length }
|
|
167
|
+
*/
|
|
168
|
+
getSelection() {
|
|
169
|
+
let idom = this.dom;
|
|
170
|
+
return {
|
|
171
|
+
start: idom.selectionStart,
|
|
172
|
+
length: idom.selectionEnd - idom.selectionStart,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.Input = Input;
|
package/lib/label.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file label.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* This program is free software; you can redistribute it and/or modify
|
|
14
|
+
* it under the terms of the GNU General Public License as published by
|
|
15
|
+
* the Free Software Foundation; either version 3 of the License, or
|
|
16
|
+
* (at your option) any later version.
|
|
17
|
+
*
|
|
18
|
+
* This program is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* GNU General Public License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
|
+
**/
|
|
25
|
+
import { Component, CProps } from './component';
|
|
26
|
+
import { HtmlString } from './tools';
|
|
27
|
+
import { IconID } from './icon';
|
|
28
|
+
export interface LabelProps extends CProps {
|
|
29
|
+
text: string | HtmlString;
|
|
30
|
+
icon?: IconID;
|
|
31
|
+
align?: 'left' | 'right' | 'center';
|
|
32
|
+
multiline?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Standard label
|
|
36
|
+
*/
|
|
37
|
+
export declare class Label extends Component<LabelProps> {
|
|
38
|
+
/**
|
|
39
|
+
* double constructor, from string/html or as usual
|
|
40
|
+
*/
|
|
41
|
+
constructor(props: LabelProps);
|
|
42
|
+
constructor(text: string | HtmlString);
|
|
43
|
+
/** @ignore */
|
|
44
|
+
render(props: LabelProps): void;
|
|
45
|
+
/**
|
|
46
|
+
* change the displayed text
|
|
47
|
+
* @param text - new text
|
|
48
|
+
*/
|
|
49
|
+
set text(txt: string | HtmlString);
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
get text(): string | HtmlString;
|
|
54
|
+
}
|
package/lib/label.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ___ ___ __
|
|
4
|
+
* \ \/ / / _
|
|
5
|
+
* \ / /_| |_
|
|
6
|
+
* / \____ _|
|
|
7
|
+
* /__/\__\ |_|
|
|
8
|
+
*
|
|
9
|
+
* @file label.ts
|
|
10
|
+
* @author Etienne Cochard
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
13
|
+
*
|
|
14
|
+
* This program is free software; you can redistribute it and/or modify
|
|
15
|
+
* it under the terms of the GNU General Public License as published by
|
|
16
|
+
* the Free Software Foundation; either version 3 of the License, or
|
|
17
|
+
* (at your option) any later version.
|
|
18
|
+
*
|
|
19
|
+
* This program is distributed in the hope that it will be useful,
|
|
20
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22
|
+
* GNU General Public License for more details.
|
|
23
|
+
*
|
|
24
|
+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
25
|
+
**/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Label = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const tools_1 = require("./tools");
|
|
30
|
+
const icon_1 = require("./icon");
|
|
31
|
+
/**
|
|
32
|
+
* Standard label
|
|
33
|
+
*/
|
|
34
|
+
class Label extends component_1.Component {
|
|
35
|
+
constructor(param) {
|
|
36
|
+
if (typeof (param) === 'string' || param instanceof tools_1.HtmlString) {
|
|
37
|
+
super({ text: param });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
super(param);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** @ignore */
|
|
44
|
+
render(props) {
|
|
45
|
+
let text = this.m_props.text;
|
|
46
|
+
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
47
|
+
text = new tools_1.HtmlString(text.replace(/\n/g, '<br/>'));
|
|
48
|
+
}
|
|
49
|
+
if (!props.icon) {
|
|
50
|
+
this.setContent(text);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.setProp('tag', 'span');
|
|
54
|
+
this.addClass('@hlayout');
|
|
55
|
+
this.setContent([
|
|
56
|
+
new icon_1.Icon({ icon: props.icon }),
|
|
57
|
+
new component_1.Component({ content: text, ref: 'text' })
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
this.addClass(props.align ?? 'left');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* change the displayed text
|
|
64
|
+
* @param text - new text
|
|
65
|
+
*/
|
|
66
|
+
set text(txt) {
|
|
67
|
+
let props = this.m_props;
|
|
68
|
+
if (props.text !== txt) {
|
|
69
|
+
props.text = txt;
|
|
70
|
+
let text = this.m_props.text;
|
|
71
|
+
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
72
|
+
text = new tools_1.HtmlString(text.replace('/\n/g', '<br/>'));
|
|
73
|
+
}
|
|
74
|
+
if (this.dom) {
|
|
75
|
+
let comp = this;
|
|
76
|
+
if (this.m_props.icon) {
|
|
77
|
+
comp = this.itemWithRef('text');
|
|
78
|
+
}
|
|
79
|
+
comp.setContent(text);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
get text() {
|
|
87
|
+
return this.m_props.text;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Label = Label;
|
package/lib/layout.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file layout.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright (c) 2019-2021 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* This program is free software; you can redistribute it and/or modify
|
|
14
|
+
* it under the terms of the GNU General Public License as published by
|
|
15
|
+
* the Free Software Foundation; either version 3 of the License, or
|
|
16
|
+
* (at your option) any later version.
|
|
17
|
+
*
|
|
18
|
+
* This program is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* GNU General Public License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>..
|
|
24
|
+
*/
|
|
25
|
+
import { Component, CProps, ComponentContent, Container, ContainerProps, ContainerEventMap } from './component';
|
|
26
|
+
export declare class AbsLayout<P extends ContainerProps = ContainerProps, E extends ContainerEventMap = ContainerEventMap> extends Container<P, E> {
|
|
27
|
+
}
|
|
28
|
+
export declare class HLayout<P extends ContainerProps = ContainerProps, E extends ContainerEventMap = ContainerEventMap> extends Container<P, E> {
|
|
29
|
+
}
|
|
30
|
+
export declare class VLayout<P extends ContainerProps = ContainerProps, E extends ContainerEventMap = ContainerEventMap> extends Container<P, E> {
|
|
31
|
+
}
|
|
32
|
+
interface AutoLayoutProps extends CProps {
|
|
33
|
+
defaultLayout: 'horizontal' | 'vertical';
|
|
34
|
+
switchSize: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class AutoLayout extends Container<AutoLayoutProps> {
|
|
37
|
+
constructor(props: AutoLayoutProps);
|
|
38
|
+
componentCreated(): void;
|
|
39
|
+
private _updateLayout;
|
|
40
|
+
}
|
|
41
|
+
export interface GridLayoutProps extends ContainerProps {
|
|
42
|
+
colSizes?: string;
|
|
43
|
+
rowSizes?: string;
|
|
44
|
+
colGap?: number;
|
|
45
|
+
template?: string[];
|
|
46
|
+
}
|
|
47
|
+
export declare class GridLayout<P extends GridLayoutProps = GridLayoutProps> extends Container<P> {
|
|
48
|
+
constructor(props: GridLayoutProps);
|
|
49
|
+
/** @ignore */
|
|
50
|
+
render(): void;
|
|
51
|
+
}
|
|
52
|
+
export interface TableLayoutProps extends CProps {
|
|
53
|
+
rows: number;
|
|
54
|
+
columns: number;
|
|
55
|
+
}
|
|
56
|
+
export declare class TableLayout extends Container<TableLayoutProps> {
|
|
57
|
+
private m_cells;
|
|
58
|
+
constructor(props: TableLayoutProps);
|
|
59
|
+
private _getCell;
|
|
60
|
+
private _setCell;
|
|
61
|
+
setCell(row: number, col: number, item: ComponentContent): void;
|
|
62
|
+
merge(row: number, col: number, rowCount: number, colCount: number): void;
|
|
63
|
+
setCellWidth(row: number, col: number, width?: number): void;
|
|
64
|
+
setCellHeight(row: number, col: number, height?: number): void;
|
|
65
|
+
setCellClass(row: number, col: number, cls: string): void;
|
|
66
|
+
setColClass(col: any, cls: any): void;
|
|
67
|
+
setRowClass(row: any, cls: any): void;
|
|
68
|
+
getCell(row: any, col: any): ComponentContent;
|
|
69
|
+
render(): void;
|
|
70
|
+
}
|
|
71
|
+
interface ScrollViewProps extends CProps {
|
|
72
|
+
}
|
|
73
|
+
export declare class ScrollView extends Component<ScrollViewProps> {
|
|
74
|
+
constructor(props: ScrollViewProps);
|
|
75
|
+
setContent(content: ComponentContent): void;
|
|
76
|
+
}
|
|
77
|
+
export {};
|