x4js 1.4.2 → 1.4.5
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.js +10 -6
- package/lib/base64.js +5 -1
- package/lib/base_component.js +7 -3
- package/lib/button.js +24 -18
- package/lib/calendar.js +44 -39
- package/lib/canvas.js +9 -5
- package/lib/cardview.js +11 -7
- package/lib/checkbox.js +12 -8
- package/lib/color.js +7 -3
- package/lib/colorpicker.js +86 -80
- package/lib/combobox.js +26 -22
- package/lib/component.js +65 -48
- package/lib/datastore.js +29 -20
- package/lib/dialog.js +41 -36
- package/lib/dom_events.js +2 -1
- 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.js +7 -3
- package/lib/i18n.js +11 -5
- package/lib/icon.js +16 -11
- package/lib/image.js +7 -3
- package/lib/index.d.ts +55 -0
- package/lib/index.js +71 -1
- package/lib/input.js +6 -2
- package/lib/label.js +15 -11
- package/lib/layout.js +23 -13
- package/lib/link.js +9 -5
- package/lib/listview.js +34 -27
- package/lib/md5.js +5 -1
- package/lib/menu.js +27 -19
- package/lib/messagebox.js +22 -17
- package/lib/panel.js +13 -9
- package/lib/popup.js +25 -20
- 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.d.ts +1 -8
- package/lib/router.js +4 -0
- package/lib/settings.js +8 -4
- package/lib/sidebarview.js +12 -8
- package/lib/smartedit.js +16 -11
- package/lib/spreadsheet.js +35 -31
- package/lib/styles.js +15 -9
- 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.js +97 -51
- package/lib/tooltips.js +14 -9
- package/lib/treeview.js +30 -26
- package/lib/x4_events.js +21 -9
- package/package.json +2 -1
- package/src/index.ts +55 -0
- package/src/router.ts +1 -1
- package/tsconfig.json +2 -1
package/lib/gridview.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,25 +23,28 @@
|
|
|
22
23
|
*
|
|
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/>.
|
|
24
25
|
**/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.GridView = exports.EvGridCheck = void 0;
|
|
25
28
|
const T_UPDATE = Symbol('update');
|
|
26
29
|
/**
|
|
27
30
|
* todo: sizable column
|
|
28
31
|
* todo: button in a column
|
|
29
32
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return BasicEvent({ rec, chk });
|
|
33
|
+
const layout_1 = require("./layout");
|
|
34
|
+
const component_1 = require("./component");
|
|
35
|
+
const label_1 = require("./label");
|
|
36
|
+
const i18n_1 = require("./i18n");
|
|
37
|
+
const tools_1 = require("./tools");
|
|
38
|
+
const datastore_1 = require("./datastore");
|
|
39
|
+
const x4_events_1 = require("./x4_events");
|
|
40
|
+
function EvGridCheck(rec, chk) {
|
|
41
|
+
return (0, x4_events_1.BasicEvent)({ rec, chk });
|
|
39
42
|
}
|
|
43
|
+
exports.EvGridCheck = EvGridCheck;
|
|
40
44
|
/**
|
|
41
45
|
* gridview class
|
|
42
46
|
*/
|
|
43
|
-
|
|
47
|
+
class GridView extends layout_1.VLayout {
|
|
44
48
|
m_dataview;
|
|
45
49
|
m_data_cx;
|
|
46
50
|
m_columns;
|
|
@@ -77,7 +81,7 @@ export class GridView extends VLayout {
|
|
|
77
81
|
this.m_itemHeight = 0;
|
|
78
82
|
this.m_recycler = [];
|
|
79
83
|
this.m_rowClassifier = props.calcRowClass;
|
|
80
|
-
this.m_empty_text = props.empty_text ?? _tr.global.empty_list;
|
|
84
|
+
this.m_empty_text = props.empty_text ?? i18n_1._tr.global.empty_list;
|
|
81
85
|
//this.setDomEvent('create', this._handleCreate, this);
|
|
82
86
|
this.setDomEvent('click', (e) => this._itemClick(e));
|
|
83
87
|
this.setDomEvent('dblclick', (e) => this._itemDblClick(e));
|
|
@@ -185,7 +189,7 @@ export class GridView extends VLayout {
|
|
|
185
189
|
*/
|
|
186
190
|
setStore(store) {
|
|
187
191
|
this.m_selection = undefined;
|
|
188
|
-
if (store instanceof DataStore) {
|
|
192
|
+
if (store instanceof datastore_1.DataStore) {
|
|
189
193
|
this.m_dataview = store.createView();
|
|
190
194
|
}
|
|
191
195
|
else {
|
|
@@ -230,14 +234,14 @@ export class GridView extends VLayout {
|
|
|
230
234
|
/** @ignore */
|
|
231
235
|
render() {
|
|
232
236
|
this.m_recycler = [];
|
|
233
|
-
this.m_container = new Component({
|
|
237
|
+
this.m_container = new component_1.Component({
|
|
234
238
|
cls: 'content',
|
|
235
239
|
});
|
|
236
|
-
this.m_empty_msg = new Label({
|
|
240
|
+
this.m_empty_msg = new label_1.Label({
|
|
237
241
|
cls: 'empty-msg',
|
|
238
242
|
text: ''
|
|
239
243
|
});
|
|
240
|
-
this.m_view_el = new Component({
|
|
244
|
+
this.m_view_el = new component_1.Component({
|
|
241
245
|
cls: '@scroll-view',
|
|
242
246
|
flex: 1,
|
|
243
247
|
dom_events: {
|
|
@@ -251,9 +255,9 @@ export class GridView extends VLayout {
|
|
|
251
255
|
if (col.cls) {
|
|
252
256
|
cls += ' ' + col.cls;
|
|
253
257
|
}
|
|
254
|
-
let comp = new Component({
|
|
258
|
+
let comp = new component_1.Component({
|
|
255
259
|
cls,
|
|
256
|
-
content: new Component({
|
|
260
|
+
content: new component_1.Component({
|
|
257
261
|
tag: 'span',
|
|
258
262
|
content: col.title
|
|
259
263
|
}),
|
|
@@ -264,7 +268,7 @@ export class GridView extends VLayout {
|
|
|
264
268
|
},
|
|
265
269
|
dom_events: {
|
|
266
270
|
click: (ev) => {
|
|
267
|
-
let t = flyWrap(ev.target);
|
|
271
|
+
let t = (0, component_1.flyWrap)(ev.target);
|
|
268
272
|
if (!t.hasClass('@sizer-overlay')) { // avoid sizer click
|
|
269
273
|
this._sortCol(col);
|
|
270
274
|
ev.preventDefault();
|
|
@@ -275,13 +279,13 @@ export class GridView extends VLayout {
|
|
|
275
279
|
const resizeCol = (ev) => {
|
|
276
280
|
this._on_col_resize(index, ev.size.width);
|
|
277
281
|
if (this.m_footer) {
|
|
278
|
-
let col = Component.getElement(this.m_footer.dom.childNodes[index]);
|
|
282
|
+
let col = component_1.Component.getElement(this.m_footer.dom.childNodes[index]);
|
|
279
283
|
if (col) {
|
|
280
284
|
col.setStyleValue('width', ev.size.width);
|
|
281
285
|
}
|
|
282
286
|
}
|
|
283
287
|
};
|
|
284
|
-
new SizerOverlay({
|
|
288
|
+
new component_1.SizerOverlay({
|
|
285
289
|
target: comp,
|
|
286
290
|
sens: 'right',
|
|
287
291
|
events: { resize: (e) => resizeCol(e) }
|
|
@@ -294,7 +298,7 @@ export class GridView extends VLayout {
|
|
|
294
298
|
this.m_columns.forEach((col) => {
|
|
295
299
|
full_width += col.width ?? 0;
|
|
296
300
|
});
|
|
297
|
-
this.m_header = new HLayout({
|
|
301
|
+
this.m_header = new layout_1.HLayout({
|
|
298
302
|
cls: '@header',
|
|
299
303
|
content: cols,
|
|
300
304
|
style: {
|
|
@@ -310,7 +314,7 @@ export class GridView extends VLayout {
|
|
|
310
314
|
if (col.cls) {
|
|
311
315
|
cls += ' ' + col.cls;
|
|
312
316
|
}
|
|
313
|
-
let comp = new Component({
|
|
317
|
+
let comp = new component_1.Component({
|
|
314
318
|
cls,
|
|
315
319
|
data: { col: index },
|
|
316
320
|
flex: col.flex,
|
|
@@ -320,7 +324,7 @@ export class GridView extends VLayout {
|
|
|
320
324
|
});
|
|
321
325
|
return comp;
|
|
322
326
|
});
|
|
323
|
-
this.m_footer = new HLayout({
|
|
327
|
+
this.m_footer = new layout_1.HLayout({
|
|
324
328
|
cls: '@footer',
|
|
325
329
|
content: foots,
|
|
326
330
|
style: {
|
|
@@ -402,7 +406,7 @@ export class GridView extends VLayout {
|
|
|
402
406
|
}
|
|
403
407
|
}
|
|
404
408
|
else {
|
|
405
|
-
row = new HLayout(props);
|
|
409
|
+
row = new layout_1.HLayout(props);
|
|
406
410
|
}
|
|
407
411
|
if (!row.dom) {
|
|
408
412
|
this.m_container.appendChild(row);
|
|
@@ -429,7 +433,7 @@ export class GridView extends VLayout {
|
|
|
429
433
|
});
|
|
430
434
|
// if items height make scroll visible, update header width
|
|
431
435
|
if (((count + 1) * this.m_itemHeight) >= height) {
|
|
432
|
-
let w = Component.getScrollbarSize();
|
|
436
|
+
let w = component_1.Component.getScrollbarSize();
|
|
433
437
|
this.m_header.setStyleValue("paddingRight", w);
|
|
434
438
|
this.m_footer?.setStyleValue("paddingRight", w);
|
|
435
439
|
}
|
|
@@ -492,10 +496,10 @@ export class GridView extends VLayout {
|
|
|
492
496
|
else {
|
|
493
497
|
text = rec.getField(col.id);
|
|
494
498
|
}
|
|
495
|
-
cell = new Component({
|
|
499
|
+
cell = new component_1.Component({
|
|
496
500
|
cls,
|
|
497
501
|
width: col.width,
|
|
498
|
-
content: html `<span>${text}</span>`,
|
|
502
|
+
content: (0, component_1.html) `<span>${text}</span>`,
|
|
499
503
|
flex: col.flex
|
|
500
504
|
});
|
|
501
505
|
}
|
|
@@ -589,7 +593,7 @@ export class GridView extends VLayout {
|
|
|
589
593
|
_rowFromTarget(dom) {
|
|
590
594
|
let self = this.dom;
|
|
591
595
|
while (dom && dom != self) {
|
|
592
|
-
let itm = Component.getElement(dom);
|
|
596
|
+
let itm = component_1.Component.getElement(dom);
|
|
593
597
|
if (itm) {
|
|
594
598
|
let id = itm.getData('row-id');
|
|
595
599
|
if (id !== undefined) {
|
|
@@ -614,7 +618,7 @@ export class GridView extends VLayout {
|
|
|
614
618
|
if (hit) {
|
|
615
619
|
this._selectItem(hit.id, hit.itm);
|
|
616
620
|
let rec = this.m_dataview.getById(hit.id);
|
|
617
|
-
this.emit('dblClick', EvDblClick(rec));
|
|
621
|
+
this.emit('dblClick', (0, component_1.EvDblClick)(rec));
|
|
618
622
|
if (this.m_hasMarks) {
|
|
619
623
|
this._toggleMark(rec);
|
|
620
624
|
}
|
|
@@ -624,7 +628,7 @@ export class GridView extends VLayout {
|
|
|
624
628
|
_itemMenu(e) {
|
|
625
629
|
let dom = e.target, self = this.dom;
|
|
626
630
|
while (dom && dom != self) {
|
|
627
|
-
let itm = Component.getElement(dom), id = itm?.getData('row-id');
|
|
631
|
+
let itm = component_1.Component.getElement(dom), id = itm?.getData('row-id');
|
|
628
632
|
if (id !== undefined) {
|
|
629
633
|
this._selectItem(id, itm);
|
|
630
634
|
let idx = itm.getData('row-idx');
|
|
@@ -671,17 +675,17 @@ export class GridView extends VLayout {
|
|
|
671
675
|
dom_item.addClass('@selected');
|
|
672
676
|
}
|
|
673
677
|
let rec = this.m_dataview.getById(item);
|
|
674
|
-
this.emit('selectionChange', EvSelectionChange(rec));
|
|
678
|
+
this.emit('selectionChange', (0, x4_events_1.EvSelectionChange)(rec));
|
|
675
679
|
}
|
|
676
680
|
else {
|
|
677
|
-
this.emit('selectionChange', EvSelectionChange(null));
|
|
681
|
+
this.emit('selectionChange', (0, x4_events_1.EvSelectionChange)(null));
|
|
678
682
|
}
|
|
679
683
|
}
|
|
680
684
|
/**
|
|
681
685
|
*
|
|
682
686
|
*/
|
|
683
687
|
_showItemContextMenu(event, item) {
|
|
684
|
-
this.emit('contextMenu', EvContextMenu(event, item));
|
|
688
|
+
this.emit('contextMenu', (0, x4_events_1.EvContextMenu)(event, item));
|
|
685
689
|
}
|
|
686
690
|
/**
|
|
687
691
|
*
|
|
@@ -727,7 +731,7 @@ export class GridView extends VLayout {
|
|
|
727
731
|
data = data.replace(/[îï]/gm, 'i');
|
|
728
732
|
data = data.replace(/[ûüù]/gm, 'u');
|
|
729
733
|
data = data.replace(/ /gm, ' '); // non breaking space
|
|
730
|
-
downloadData(data, 'text/csv', filename);
|
|
734
|
+
(0, tools_1.downloadData)(data, 'text/csv', filename);
|
|
731
735
|
}
|
|
732
736
|
set empty_text(text) {
|
|
733
737
|
this.m_empty_msg.text = text;
|
|
@@ -737,7 +741,7 @@ export class GridView extends VLayout {
|
|
|
737
741
|
if (this.m_marks.has(rec.getID())) {
|
|
738
742
|
cls = ' checked';
|
|
739
743
|
}
|
|
740
|
-
return new Component({ cls: '@grid-checkbox' + cls });
|
|
744
|
+
return new component_1.Component({ cls: '@grid-checkbox' + cls });
|
|
741
745
|
}
|
|
742
746
|
_toggleMark(rec) {
|
|
743
747
|
let id = rec.getID();
|
|
@@ -784,3 +788,4 @@ export class GridView extends VLayout {
|
|
|
784
788
|
});
|
|
785
789
|
}
|
|
786
790
|
}
|
|
791
|
+
exports.GridView = GridView;
|
package/lib/hosts/host.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* @file host.ts
|
|
3
4
|
* @author Etienne Cochard
|
|
@@ -16,9 +17,11 @@
|
|
|
16
17
|
*
|
|
17
18
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
19
|
**/
|
|
19
|
-
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.host = exports.Host = void 0;
|
|
22
|
+
class Host {
|
|
20
23
|
constructor() {
|
|
21
|
-
host = this;
|
|
24
|
+
exports.host = this;
|
|
22
25
|
}
|
|
23
26
|
makePath(...els) {
|
|
24
27
|
return els.join('/');
|
|
@@ -66,4 +69,5 @@ export class Host {
|
|
|
66
69
|
throw 'not imp';
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
|
-
|
|
72
|
+
exports.Host = Host;
|
|
73
|
+
exports.host = null;
|
package/lib/i18n.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,6 +23,8 @@
|
|
|
22
23
|
*
|
|
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/>.
|
|
24
25
|
**/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.extendTranslation = exports.selectLanguage = exports.isLanguage = exports._tr = void 0;
|
|
25
28
|
/**
|
|
26
29
|
* language definition
|
|
27
30
|
* x4 specific strings
|
|
@@ -93,7 +96,7 @@ let all_langs = {
|
|
|
93
96
|
* @example ```typescript
|
|
94
97
|
* console.log( _tr.global.ok );
|
|
95
98
|
*/
|
|
96
|
-
|
|
99
|
+
exports._tr = all_langs['fr'];
|
|
97
100
|
/**
|
|
98
101
|
* check if the language is known
|
|
99
102
|
* @param name - language name to test
|
|
@@ -101,21 +104,23 @@ export let _tr = all_langs['fr'];
|
|
|
101
104
|
* if( isLanguage('fr') ) {
|
|
102
105
|
* }
|
|
103
106
|
*/
|
|
104
|
-
|
|
107
|
+
function isLanguage(name) {
|
|
105
108
|
return all_langs[name] !== undefined;
|
|
106
109
|
}
|
|
110
|
+
exports.isLanguage = isLanguage;
|
|
107
111
|
/**
|
|
108
112
|
* select the current language
|
|
109
113
|
* @param name - language name
|
|
110
114
|
* @example ```typescript
|
|
111
115
|
* selectLanguage( 'en' );
|
|
112
116
|
*/
|
|
113
|
-
|
|
117
|
+
function selectLanguage(name) {
|
|
114
118
|
if (!isLanguage(name)) {
|
|
115
119
|
return;
|
|
116
120
|
}
|
|
117
|
-
_tr = all_langs[name];
|
|
121
|
+
exports._tr = all_langs[name];
|
|
118
122
|
}
|
|
123
|
+
exports.selectLanguage = selectLanguage;
|
|
119
124
|
/**
|
|
120
125
|
* define a translation
|
|
121
126
|
* you can also patch 'global' elements witch are defined by x4
|
|
@@ -136,12 +141,13 @@ export function selectLanguage(name) {
|
|
|
136
141
|
* console.log( _tr.this_is_an_example ); // 'en' do not define this, so we get 'fr' one
|
|
137
142
|
*
|
|
138
143
|
*/
|
|
139
|
-
|
|
144
|
+
function extendTranslation(name, definition) {
|
|
140
145
|
if (!isLanguage(name)) {
|
|
141
146
|
return;
|
|
142
147
|
}
|
|
143
148
|
_patch(all_langs[name], definition);
|
|
144
149
|
}
|
|
150
|
+
exports.extendTranslation = extendTranslation;
|
|
145
151
|
function _patch(obj, by) {
|
|
146
152
|
for (let n in by) {
|
|
147
153
|
if (obj[n] instanceof Object) {
|
package/lib/icon.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,14 +23,17 @@
|
|
|
22
23
|
*
|
|
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/>.
|
|
24
25
|
**/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Icon = exports.EvLoaded = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const styles_1 = require("./styles");
|
|
30
|
+
const tools_1 = require("./tools");
|
|
31
|
+
const x4_events_1 = require("./x4_events");
|
|
32
|
+
function EvLoaded(url, svg, context = null) {
|
|
33
|
+
return (0, x4_events_1.BasicEvent)({ url, svg, context });
|
|
31
34
|
}
|
|
32
|
-
|
|
35
|
+
exports.EvLoaded = EvLoaded;
|
|
36
|
+
class Loader extends x4_events_1.EventSource {
|
|
33
37
|
svgs;
|
|
34
38
|
constructor() {
|
|
35
39
|
super();
|
|
@@ -64,7 +68,7 @@ const svgLoader = new Loader();
|
|
|
64
68
|
/**
|
|
65
69
|
* standard icon
|
|
66
70
|
*/
|
|
67
|
-
|
|
71
|
+
class Icon extends component_1.Component {
|
|
68
72
|
m_icon;
|
|
69
73
|
m_iconName;
|
|
70
74
|
constructor(props) {
|
|
@@ -109,7 +113,7 @@ export class Icon extends Component {
|
|
|
109
113
|
}
|
|
110
114
|
else {
|
|
111
115
|
name = icon;
|
|
112
|
-
icon = Stylesheet.getVar('icon-' + icon);
|
|
116
|
+
icon = styles_1.Stylesheet.getVar('icon-' + icon);
|
|
113
117
|
if (icon == '' || icon === undefined) {
|
|
114
118
|
// name your icon 'icon-xxx'
|
|
115
119
|
// ex:
|
|
@@ -123,7 +127,7 @@ export class Icon extends Component {
|
|
|
123
127
|
if (this.m_icon === icon) {
|
|
124
128
|
return;
|
|
125
129
|
}
|
|
126
|
-
let css = Component.getCss(), rulename;
|
|
130
|
+
let css = component_1.Component.getCss(), rulename;
|
|
127
131
|
if (remove_old && this.m_icon) {
|
|
128
132
|
rulename = 'icon-' + name;
|
|
129
133
|
this.removeClass(rulename);
|
|
@@ -159,7 +163,7 @@ export class Icon extends Component {
|
|
|
159
163
|
//console.log( 'set=', ev.url, 'url=', url );
|
|
160
164
|
if (ev.url == url) {
|
|
161
165
|
this.addClass('@svg-icon');
|
|
162
|
-
this.setContent(HtmlString.from(ev.svg), false);
|
|
166
|
+
this.setContent(tools_1.HtmlString.from(ev.svg), false);
|
|
163
167
|
svgLoader.off('loaded', set);
|
|
164
168
|
}
|
|
165
169
|
};
|
|
@@ -171,3 +175,4 @@ export class Icon extends Component {
|
|
|
171
175
|
*/
|
|
172
176
|
static icon_cache = [];
|
|
173
177
|
}
|
|
178
|
+
exports.Icon = Icon;
|
package/lib/image.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,7 +23,9 @@
|
|
|
22
23
|
*
|
|
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/>.
|
|
24
25
|
**/
|
|
25
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Image = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
26
29
|
const emptyImageSrc = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
27
30
|
function _isStaticImage(src) {
|
|
28
31
|
return src.substr(0, 5) == 'data:';
|
|
@@ -30,7 +33,7 @@ function _isStaticImage(src) {
|
|
|
30
33
|
/**
|
|
31
34
|
* Standard image class
|
|
32
35
|
*/
|
|
33
|
-
|
|
36
|
+
class Image extends component_1.Component {
|
|
34
37
|
m_created;
|
|
35
38
|
m_lazysrc; // expected
|
|
36
39
|
constructor(props) {
|
|
@@ -51,7 +54,7 @@ export class Image extends Component {
|
|
|
51
54
|
/** @ignore */
|
|
52
55
|
render() {
|
|
53
56
|
let mp = this.m_props;
|
|
54
|
-
const img = new Component({
|
|
57
|
+
const img = new component_1.Component({
|
|
55
58
|
tag: 'img',
|
|
56
59
|
attrs: {
|
|
57
60
|
draggable: false,
|
|
@@ -147,3 +150,4 @@ export class Image extends Component {
|
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
}
|
|
153
|
+
exports.Image = Image;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export * from "./application";
|
|
2
|
+
export * from "./base_component";
|
|
3
|
+
export * from "./base64";
|
|
4
|
+
export * from "./button";
|
|
5
|
+
export * from "./calendar";
|
|
6
|
+
export * from "./canvas";
|
|
7
|
+
export * from "./cardview";
|
|
8
|
+
export * from "./checkbox";
|
|
9
|
+
export * from "./color";
|
|
10
|
+
export * from "./colorpicker";
|
|
11
|
+
export * from "./combobox";
|
|
12
|
+
export * from "./component";
|
|
13
|
+
export * from "./datastore";
|
|
14
|
+
export * from "./dialog";
|
|
15
|
+
export * from "./dom_events";
|
|
16
|
+
export * from "./drag_manager";
|
|
17
|
+
export * from "./drawtext";
|
|
18
|
+
export * from "./fileupload";
|
|
19
|
+
export * from "./form";
|
|
20
|
+
export * from "./formatters";
|
|
21
|
+
export * from "./gridview";
|
|
22
|
+
export * from "./i18n";
|
|
23
|
+
export * from "./icon";
|
|
24
|
+
export * from "./image";
|
|
25
|
+
export * from "./input";
|
|
26
|
+
export * from "./label";
|
|
27
|
+
export * from "./layout";
|
|
28
|
+
export * from "./link";
|
|
29
|
+
export * from "./listview";
|
|
30
|
+
export * from "./md5";
|
|
31
|
+
export * from "./menu";
|
|
32
|
+
export * from "./messagebox";
|
|
33
|
+
export * from "./panel";
|
|
34
|
+
export * from "./popup";
|
|
35
|
+
export * from "./property_editor";
|
|
36
|
+
export * from "./radiobtn";
|
|
37
|
+
export * from "./rating";
|
|
38
|
+
export * from "./request";
|
|
39
|
+
export * from "./router";
|
|
40
|
+
export * from "./settings";
|
|
41
|
+
export * from "./sidebarview";
|
|
42
|
+
export * from "./smartedit";
|
|
43
|
+
export * from "./spreadsheet";
|
|
44
|
+
export * from "./styles";
|
|
45
|
+
export * from "./svgcomponent";
|
|
46
|
+
export * from "./tabbar";
|
|
47
|
+
export * from "./tabview";
|
|
48
|
+
export * from "./textarea";
|
|
49
|
+
export * from "./textedit";
|
|
50
|
+
export * from "./texthiliter";
|
|
51
|
+
export * from "./toaster";
|
|
52
|
+
export * from "./tools";
|
|
53
|
+
export * from "./tooltips";
|
|
54
|
+
export * from "./treeview";
|
|
55
|
+
export * from "./x4_events";
|
package/lib/index.js
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
-
|
|
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.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,12 +23,14 @@
|
|
|
22
23
|
*
|
|
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/>.
|
|
24
25
|
**/
|
|
25
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Input = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
26
29
|
/**
|
|
27
30
|
* base class for elements implementing an input
|
|
28
31
|
* CARE derived classes must set this.ui.input
|
|
29
32
|
*/
|
|
30
|
-
|
|
33
|
+
class Input extends component_1.Component {
|
|
31
34
|
constructor(props) {
|
|
32
35
|
super(props);
|
|
33
36
|
}
|
|
@@ -170,3 +173,4 @@ export class Input extends Component {
|
|
|
170
173
|
};
|
|
171
174
|
}
|
|
172
175
|
}
|
|
176
|
+
exports.Input = Input;
|
package/lib/label.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,15 +23,17 @@
|
|
|
22
23
|
*
|
|
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/>.
|
|
24
25
|
**/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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");
|
|
28
31
|
/**
|
|
29
32
|
* Standard label
|
|
30
33
|
*/
|
|
31
|
-
|
|
34
|
+
class Label extends component_1.Component {
|
|
32
35
|
constructor(param) {
|
|
33
|
-
if (typeof (param) === 'string' || param instanceof HtmlString) {
|
|
36
|
+
if (typeof (param) === 'string' || param instanceof tools_1.HtmlString) {
|
|
34
37
|
super({ text: param });
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
@@ -40,8 +43,8 @@ export class Label extends Component {
|
|
|
40
43
|
/** @ignore */
|
|
41
44
|
render(props) {
|
|
42
45
|
let text = this.m_props.text;
|
|
43
|
-
if (this.m_props.multiline && !(text instanceof HtmlString)) {
|
|
44
|
-
text = new HtmlString(text.replace(/\n/g, '<br/>'));
|
|
46
|
+
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
47
|
+
text = new tools_1.HtmlString(text.replace(/\n/g, '<br/>'));
|
|
45
48
|
}
|
|
46
49
|
if (!props.icon) {
|
|
47
50
|
this.setContent(text);
|
|
@@ -50,8 +53,8 @@ export class Label extends Component {
|
|
|
50
53
|
this.setProp('tag', 'span');
|
|
51
54
|
this.addClass('@hlayout');
|
|
52
55
|
this.setContent([
|
|
53
|
-
new Icon({ icon: props.icon }),
|
|
54
|
-
new Component({ content: text, ref: 'text' })
|
|
56
|
+
new icon_1.Icon({ icon: props.icon }),
|
|
57
|
+
new component_1.Component({ content: text, ref: 'text' })
|
|
55
58
|
]);
|
|
56
59
|
}
|
|
57
60
|
this.addClass(props.align ?? 'left');
|
|
@@ -65,8 +68,8 @@ export class Label extends Component {
|
|
|
65
68
|
if (props.text !== txt) {
|
|
66
69
|
props.text = txt;
|
|
67
70
|
let text = this.m_props.text;
|
|
68
|
-
if (this.m_props.multiline && !(text instanceof HtmlString)) {
|
|
69
|
-
text = new HtmlString(text.replace('/\n/g', '<br/>'));
|
|
71
|
+
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
72
|
+
text = new tools_1.HtmlString(text.replace('/\n/g', '<br/>'));
|
|
70
73
|
}
|
|
71
74
|
if (this.dom) {
|
|
72
75
|
let comp = this;
|
|
@@ -84,3 +87,4 @@ export class Label extends Component {
|
|
|
84
87
|
return this.m_props.text;
|
|
85
88
|
}
|
|
86
89
|
}
|
|
90
|
+
exports.Label = Label;
|