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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \_/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / _ \____ _|
|
|
6
|
+
* /__/ \__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file local_storage.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
|
+
export declare class Settings {
|
|
26
|
+
private m_data;
|
|
27
|
+
private m_name;
|
|
28
|
+
constructor(name?: string);
|
|
29
|
+
set(name: string, value: any): void;
|
|
30
|
+
get(name: string, defValue?: any): any;
|
|
31
|
+
private _save;
|
|
32
|
+
private _load;
|
|
33
|
+
}
|
package/lib/settings.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ___ ___ __
|
|
4
|
+
* \ \_/ / / _
|
|
5
|
+
* \ / /_| |_
|
|
6
|
+
* / _ \____ _|
|
|
7
|
+
* /__/ \__\ |_|
|
|
8
|
+
*
|
|
9
|
+
* @file local_storage.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.Settings = void 0;
|
|
28
|
+
const host_1 = require("./hosts/host");
|
|
29
|
+
class Settings {
|
|
30
|
+
m_data;
|
|
31
|
+
m_name;
|
|
32
|
+
constructor(name) {
|
|
33
|
+
this.m_data = null;
|
|
34
|
+
this.m_name = name ?? 'settings';
|
|
35
|
+
}
|
|
36
|
+
set(name, value) {
|
|
37
|
+
this._load();
|
|
38
|
+
this.m_data[name] = value;
|
|
39
|
+
this._save();
|
|
40
|
+
}
|
|
41
|
+
get(name, defValue) {
|
|
42
|
+
this._load();
|
|
43
|
+
return this.m_data[name] ?? defValue;
|
|
44
|
+
}
|
|
45
|
+
_save() {
|
|
46
|
+
let data = JSON.stringify(this.m_data);
|
|
47
|
+
host_1.host.writeLocalStorage(this.m_name, data);
|
|
48
|
+
}
|
|
49
|
+
_load() {
|
|
50
|
+
if (this.m_data) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.m_data = {};
|
|
54
|
+
let data = host_1.host.readLocalStorage(this.m_name);
|
|
55
|
+
if (data !== null) {
|
|
56
|
+
data = JSON.parse(data);
|
|
57
|
+
if (data) {
|
|
58
|
+
this.m_data = data;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.info('There was an error attempting to read your settings.');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// console.info('There was an error attempting to read your settings.');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.Settings = Settings;
|
package/lib/sidebarview.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \_/ / / _
|
|
@@ -22,23 +23,25 @@
|
|
|
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.SideBarView = void 0;
|
|
28
|
+
const layout_1 = require("./layout");
|
|
29
|
+
const button_1 = require("./button");
|
|
30
|
+
const cardview_1 = require("./cardview");
|
|
28
31
|
/**
|
|
29
32
|
*
|
|
30
33
|
*/
|
|
31
|
-
|
|
34
|
+
class SideBarView extends cardview_1.CardView {
|
|
32
35
|
m_sidebar;
|
|
33
36
|
m_content;
|
|
34
37
|
constructor(props) {
|
|
35
38
|
super(props);
|
|
36
39
|
this.addClass('@hlayout');
|
|
37
|
-
this.m_sidebar = new VLayout({
|
|
40
|
+
this.m_sidebar = new layout_1.VLayout({
|
|
38
41
|
cls: '@side-bar',
|
|
39
42
|
sizable: props.bar_sizable ? 'right' : undefined,
|
|
40
43
|
});
|
|
41
|
-
this.m_content = new HLayout({ flex: 1, cls: '@tab-container' });
|
|
44
|
+
this.m_content = new layout_1.HLayout({ flex: 1, cls: '@tab-container' });
|
|
42
45
|
}
|
|
43
46
|
/** @ignore */
|
|
44
47
|
render() {
|
|
@@ -46,7 +49,7 @@ export class SideBarView extends CardView {
|
|
|
46
49
|
this.m_cards.forEach((p) => {
|
|
47
50
|
tabs.push(p.selector);
|
|
48
51
|
});
|
|
49
|
-
this.m_sidebar.setContent(new VLayout({
|
|
52
|
+
this.m_sidebar.setContent(new layout_1.VLayout({
|
|
50
53
|
flex: 1,
|
|
51
54
|
cls: 'content',
|
|
52
55
|
content: tabs
|
|
@@ -57,7 +60,7 @@ export class SideBarView extends CardView {
|
|
|
57
60
|
]);
|
|
58
61
|
}
|
|
59
62
|
_prepareSelector(card) {
|
|
60
|
-
return new Button({
|
|
63
|
+
return new button_1.Button({
|
|
61
64
|
text: card.title,
|
|
62
65
|
icon: card.icon,
|
|
63
66
|
tooltip: card.title,
|
|
@@ -71,3 +74,4 @@ export class SideBarView extends CardView {
|
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
}
|
|
77
|
+
exports.SideBarView = SideBarView;
|
package/lib/smartedit.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \_/ / / _
|
|
@@ -22,11 +23,13 @@
|
|
|
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
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.PopupTable = exports.SmartEdit = void 0;
|
|
28
|
+
const textedit_1 = require("./textedit");
|
|
29
|
+
const popup_1 = require("./popup");
|
|
30
|
+
const component_1 = require("./component");
|
|
31
|
+
const x4_events_1 = require("./x4_events");
|
|
32
|
+
class SmartEdit extends textedit_1.TextEdit {
|
|
30
33
|
m_popup;
|
|
31
34
|
m_dataview;
|
|
32
35
|
m_field;
|
|
@@ -199,7 +202,7 @@ export class SmartEdit extends TextEdit {
|
|
|
199
202
|
let { row, text } = ev.context;
|
|
200
203
|
if (!this._callTool(row)) {
|
|
201
204
|
this.value = text;
|
|
202
|
-
this.emit('click', EvClick());
|
|
205
|
+
this.emit('click', (0, x4_events_1.EvClick)());
|
|
203
206
|
}
|
|
204
207
|
});
|
|
205
208
|
let i;
|
|
@@ -239,7 +242,8 @@ export class SmartEdit extends TextEdit {
|
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
244
|
}
|
|
242
|
-
|
|
245
|
+
exports.SmartEdit = SmartEdit;
|
|
246
|
+
class PopupTable extends popup_1.Popup {
|
|
243
247
|
m_rows;
|
|
244
248
|
m_cols;
|
|
245
249
|
m_cells;
|
|
@@ -262,11 +266,11 @@ export class PopupTable extends Popup {
|
|
|
262
266
|
});
|
|
263
267
|
this.setDomEvent('mousedown', (e) => {
|
|
264
268
|
e.preventDefault();
|
|
265
|
-
let el = Component.getElement(e.target);
|
|
269
|
+
let el = component_1.Component.getElement(e.target);
|
|
266
270
|
let row = el.getData('row');
|
|
267
271
|
this.m_sel = row;
|
|
268
272
|
this.update();
|
|
269
|
-
this.emit('click', EvClick({ row, text: this.getCell(row, 0).text }));
|
|
273
|
+
this.emit('click', (0, x4_events_1.EvClick)({ row, text: this.getCell(row, 0).text }));
|
|
270
274
|
});
|
|
271
275
|
}
|
|
272
276
|
setRowData(row, data) {
|
|
@@ -303,7 +307,7 @@ export class PopupTable extends Popup {
|
|
|
303
307
|
let data = { row: r };
|
|
304
308
|
for (let c = 0; c < this.m_cols; c++) {
|
|
305
309
|
let cell = this.getCell(r, c);
|
|
306
|
-
let col = new Component({
|
|
310
|
+
let col = new component_1.Component({
|
|
307
311
|
tag: 'td',
|
|
308
312
|
content: cell.text,
|
|
309
313
|
cls: cell.cls,
|
|
@@ -315,7 +319,7 @@ export class PopupTable extends Popup {
|
|
|
315
319
|
if (r === this.m_sel) {
|
|
316
320
|
cls = '@selected';
|
|
317
321
|
}
|
|
318
|
-
let row = new Component({
|
|
322
|
+
let row = new component_1.Component({
|
|
319
323
|
tag: 'tr',
|
|
320
324
|
cls,
|
|
321
325
|
content: cols,
|
|
@@ -376,6 +380,7 @@ export class PopupTable extends Popup {
|
|
|
376
380
|
return this.m_sel;
|
|
377
381
|
}
|
|
378
382
|
}
|
|
383
|
+
exports.PopupTable = PopupTable;
|
|
379
384
|
function _cid(row, col) {
|
|
380
385
|
return row * 1000 + col;
|
|
381
386
|
}
|
package/lib/spreadsheet.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \_/ / / _
|
|
@@ -22,13 +23,15 @@
|
|
|
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
|
-
|
|
31
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Spreadsheet = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const layout_1 = require("./layout");
|
|
30
|
+
const textedit_1 = require("./textedit");
|
|
31
|
+
const tools_1 = require("./tools");
|
|
32
|
+
const tools_2 = require("./tools");
|
|
33
|
+
const x4_events_1 = require("./x4_events");
|
|
34
|
+
const combobox_1 = require("./combobox");
|
|
32
35
|
class CellData {
|
|
33
36
|
text;
|
|
34
37
|
cls;
|
|
@@ -39,7 +42,7 @@ class CellData {
|
|
|
39
42
|
/**
|
|
40
43
|
*
|
|
41
44
|
*/
|
|
42
|
-
|
|
45
|
+
class Spreadsheet extends layout_1.VLayout {
|
|
43
46
|
m_columns;
|
|
44
47
|
m_row_limit;
|
|
45
48
|
m_cells_data;
|
|
@@ -237,10 +240,10 @@ export class Spreadsheet extends VLayout {
|
|
|
237
240
|
_ctxMenu(e) {
|
|
238
241
|
let dom = e.target, self = this.dom;
|
|
239
242
|
while (dom && dom != self) {
|
|
240
|
-
let itm = Component.getElement(dom), row = itm.getData('row-id'), col = itm.getData('col-id');
|
|
243
|
+
let itm = component_1.Component.getElement(dom), row = itm.getData('row-id'), col = itm.getData('col-id');
|
|
241
244
|
if (row !== undefined) {
|
|
242
245
|
this._selectItem(row, col);
|
|
243
|
-
this.emit('contextMenu', EvContextMenu(e, { row, col, item: itm }));
|
|
246
|
+
this.emit('contextMenu', (0, x4_events_1.EvContextMenu)(e, { row, col, item: itm }));
|
|
244
247
|
e.preventDefault();
|
|
245
248
|
return;
|
|
246
249
|
}
|
|
@@ -250,10 +253,10 @@ export class Spreadsheet extends VLayout {
|
|
|
250
253
|
/** @ignore */
|
|
251
254
|
render() {
|
|
252
255
|
this.m_recycler = [];
|
|
253
|
-
this.m_container = new Component({
|
|
256
|
+
this.m_container = new component_1.Component({
|
|
254
257
|
cls: 'content',
|
|
255
258
|
});
|
|
256
|
-
this.m_view = new Component({
|
|
259
|
+
this.m_view = new component_1.Component({
|
|
257
260
|
cls: '@scroll-view',
|
|
258
261
|
flex: 1,
|
|
259
262
|
dom_events: {
|
|
@@ -263,7 +266,7 @@ export class Spreadsheet extends VLayout {
|
|
|
263
266
|
content: this.m_container
|
|
264
267
|
});
|
|
265
268
|
let cols = this.m_columns.map((col, index) => {
|
|
266
|
-
let comp = new Component({
|
|
269
|
+
let comp = new component_1.Component({
|
|
267
270
|
cls: '@cell c' + index,
|
|
268
271
|
content: col.title ? col.title : ' ',
|
|
269
272
|
flex: col.width < 0 ? -col.width : undefined,
|
|
@@ -275,7 +278,7 @@ export class Spreadsheet extends VLayout {
|
|
|
275
278
|
minWidth: col.min_width
|
|
276
279
|
},
|
|
277
280
|
});
|
|
278
|
-
new SizerOverlay({
|
|
281
|
+
new component_1.SizerOverlay({
|
|
279
282
|
target: comp,
|
|
280
283
|
sens: 'right',
|
|
281
284
|
resize: (ev) => {
|
|
@@ -285,7 +288,7 @@ export class Spreadsheet extends VLayout {
|
|
|
285
288
|
col.$col = comp;
|
|
286
289
|
return comp;
|
|
287
290
|
});
|
|
288
|
-
this.m_header = new HLayout({
|
|
291
|
+
this.m_header = new layout_1.HLayout({
|
|
289
292
|
cls: '@header',
|
|
290
293
|
content: cols,
|
|
291
294
|
});
|
|
@@ -383,7 +386,7 @@ export class Spreadsheet extends VLayout {
|
|
|
383
386
|
cell.clearClasses();
|
|
384
387
|
}
|
|
385
388
|
else {
|
|
386
|
-
cell = new Component({
|
|
389
|
+
cell = new component_1.Component({
|
|
387
390
|
cls: '@cell'
|
|
388
391
|
});
|
|
389
392
|
}
|
|
@@ -415,7 +418,7 @@ export class Spreadsheet extends VLayout {
|
|
|
415
418
|
}
|
|
416
419
|
let right_pos = 0;
|
|
417
420
|
if ((count * this.m_itemHeight) > height) {
|
|
418
|
-
let w = Component.getScrollbarSize();
|
|
421
|
+
let w = component_1.Component.getScrollbarSize();
|
|
419
422
|
rc.width -= w;
|
|
420
423
|
right_pos = w;
|
|
421
424
|
}
|
|
@@ -519,7 +522,7 @@ export class Spreadsheet extends VLayout {
|
|
|
519
522
|
if (this.m_editor && this.m_editor.dom.contains(dom)) {
|
|
520
523
|
return;
|
|
521
524
|
}
|
|
522
|
-
let itm = Component.getElement(dom, Component);
|
|
525
|
+
let itm = component_1.Component.getElement(dom, component_1.Component);
|
|
523
526
|
if (!itm) {
|
|
524
527
|
return;
|
|
525
528
|
}
|
|
@@ -534,11 +537,11 @@ export class Spreadsheet extends VLayout {
|
|
|
534
537
|
if (this.m_editor && this.m_editor.dom.contains(dom)) {
|
|
535
538
|
return;
|
|
536
539
|
}
|
|
537
|
-
let itm = Component.getElement(dom), rowIdx = itm.getData('row-id'), colIdx = itm.getData('col-id');
|
|
540
|
+
let itm = component_1.Component.getElement(dom), rowIdx = itm.getData('row-id'), colIdx = itm.getData('col-id');
|
|
538
541
|
if (rowIdx === undefined || colIdx === undefined) {
|
|
539
542
|
return;
|
|
540
543
|
}
|
|
541
|
-
this.emit('dblClick', EvDblClick({ row: rowIdx, col: colIdx }));
|
|
544
|
+
this.emit('dblClick', (0, component_1.EvDblClick)({ row: rowIdx, col: colIdx }));
|
|
542
545
|
this.editCell(rowIdx, colIdx);
|
|
543
546
|
}
|
|
544
547
|
/**
|
|
@@ -788,7 +791,7 @@ export class Spreadsheet extends VLayout {
|
|
|
788
791
|
if (newSel) {
|
|
789
792
|
newSel.addClass('@selected');
|
|
790
793
|
}
|
|
791
|
-
this.emit('selectionChange', EvSelectionChange({ row, col }));
|
|
794
|
+
this.emit('selectionChange', (0, x4_events_1.EvSelectionChange)({ row, col }));
|
|
792
795
|
}
|
|
793
796
|
/**
|
|
794
797
|
* return the row count
|
|
@@ -843,7 +846,7 @@ export class Spreadsheet extends VLayout {
|
|
|
843
846
|
}
|
|
844
847
|
getCellNumber(row, col) {
|
|
845
848
|
let text = this._getCellData(row, col).text;
|
|
846
|
-
return parseIntlFloat(text);
|
|
849
|
+
return (0, tools_1.parseIntlFloat)(text);
|
|
847
850
|
}
|
|
848
851
|
clearRow(row) {
|
|
849
852
|
for (let c = 0; c < this.m_columns.length; c++) {
|
|
@@ -873,7 +876,7 @@ export class Spreadsheet extends VLayout {
|
|
|
873
876
|
let prc = parent.getBoundingClientRect();
|
|
874
877
|
let cell = this._getCellData(row, col, true);
|
|
875
878
|
let edtBuilder = (props, col, row) => {
|
|
876
|
-
return new TextEdit(props);
|
|
879
|
+
return new textedit_1.TextEdit(props);
|
|
877
880
|
};
|
|
878
881
|
if (this.m_columns[col].createEditor) {
|
|
879
882
|
edtBuilder = this.m_columns[col].createEditor;
|
|
@@ -901,20 +904,20 @@ export class Spreadsheet extends VLayout {
|
|
|
901
904
|
this._setupEditor();
|
|
902
905
|
this.m_editor.setData('old-value', cellvalue);
|
|
903
906
|
this.m_editor.focus();
|
|
904
|
-
if (this.m_editor instanceof TextEdit) {
|
|
907
|
+
if (this.m_editor instanceof textedit_1.TextEdit) {
|
|
905
908
|
this.m_editor.selectAll();
|
|
906
909
|
}
|
|
907
910
|
}
|
|
908
911
|
_setupEditor() {
|
|
909
912
|
let movesel = (sensy, sensx) => {
|
|
910
|
-
deferCall(() => {
|
|
913
|
+
(0, tools_2.deferCall)(() => {
|
|
911
914
|
this.killEditor(true);
|
|
912
915
|
this._moveSel(sensy, sensx);
|
|
913
916
|
this.editCurCell();
|
|
914
917
|
});
|
|
915
918
|
};
|
|
916
919
|
// todo: better
|
|
917
|
-
if (this.m_editor instanceof TextEdit) {
|
|
920
|
+
if (this.m_editor instanceof textedit_1.TextEdit) {
|
|
918
921
|
let editor = this.m_editor;
|
|
919
922
|
let input = editor.input;
|
|
920
923
|
input.setDomEvent('blur', () => {
|
|
@@ -952,7 +955,7 @@ export class Spreadsheet extends VLayout {
|
|
|
952
955
|
}
|
|
953
956
|
});
|
|
954
957
|
}
|
|
955
|
-
else if (this.m_editor instanceof ComboBox) {
|
|
958
|
+
else if (this.m_editor instanceof combobox_1.ComboBox) {
|
|
956
959
|
let input = this.m_editor.input;
|
|
957
960
|
input.setDomEvent('blur', () => {
|
|
958
961
|
this.killEditor(true);
|
|
@@ -989,10 +992,10 @@ export class Spreadsheet extends VLayout {
|
|
|
989
992
|
if (this.m_editor) {
|
|
990
993
|
if (save) {
|
|
991
994
|
let text, id;
|
|
992
|
-
if (this.m_editor instanceof TextEdit) {
|
|
995
|
+
if (this.m_editor instanceof textedit_1.TextEdit) {
|
|
993
996
|
text = this.m_editor.value;
|
|
994
997
|
}
|
|
995
|
-
else if (this.m_editor instanceof ComboBox) {
|
|
998
|
+
else if (this.m_editor instanceof combobox_1.ComboBox) {
|
|
996
999
|
id = this.m_editor.value;
|
|
997
1000
|
text = this.m_editor.valueText;
|
|
998
1001
|
}
|
|
@@ -1000,7 +1003,7 @@ export class Spreadsheet extends VLayout {
|
|
|
1000
1003
|
let col = this.m_editor.getData('col');
|
|
1001
1004
|
let old = this.m_editor.getData('old-value');
|
|
1002
1005
|
this.setCellText(row, col, text);
|
|
1003
|
-
const ev = EvChange(text, { row, col, oldValue: old, id });
|
|
1006
|
+
const ev = (0, x4_events_1.EvChange)(text, { row, col, oldValue: old, id });
|
|
1004
1007
|
this.emit('change', ev);
|
|
1005
1008
|
if (ev.defaultPrevented) {
|
|
1006
1009
|
this.setCellText(row, col, old);
|
|
@@ -1008,7 +1011,7 @@ export class Spreadsheet extends VLayout {
|
|
|
1008
1011
|
}
|
|
1009
1012
|
// cannot dipose while handling blur event, so we defer...
|
|
1010
1013
|
let t = this.m_editor;
|
|
1011
|
-
asap(() => {
|
|
1014
|
+
(0, tools_1.asap)(() => {
|
|
1012
1015
|
t.dispose();
|
|
1013
1016
|
});
|
|
1014
1017
|
this.m_editor = null;
|
|
@@ -1056,6 +1059,7 @@ export class Spreadsheet extends VLayout {
|
|
|
1056
1059
|
}
|
|
1057
1060
|
}
|
|
1058
1061
|
}
|
|
1062
|
+
exports.Spreadsheet = Spreadsheet;
|
|
1059
1063
|
/**
|
|
1060
1064
|
* @ignore
|
|
1061
1065
|
*/
|
package/lib/styles.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \_/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / _ \____ _|
|
|
6
|
+
* /__/ \__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file styles.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
|
+
/**
|
|
26
|
+
* -- [ @STYLESHEET ] -----------------------------------------------------------------
|
|
27
|
+
*/
|
|
28
|
+
export declare class Stylesheet {
|
|
29
|
+
private m_sheet;
|
|
30
|
+
private m_rules;
|
|
31
|
+
constructor();
|
|
32
|
+
/**
|
|
33
|
+
* add a new rule to the style sheet
|
|
34
|
+
* @param {string} name - internal rule name
|
|
35
|
+
* @param {string} definition - css definition of the rule
|
|
36
|
+
* @example
|
|
37
|
+
* setRule('xbody', "body { background-color: #ff0000; }" );
|
|
38
|
+
*/
|
|
39
|
+
setRule(name: string, definition: any): void;
|
|
40
|
+
/**
|
|
41
|
+
* return the style variable value
|
|
42
|
+
* @param name - variable name without '--'
|
|
43
|
+
* @example
|
|
44
|
+
* ```
|
|
45
|
+
* let color = Component.getCss( ).getVar( 'button-color' );
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
static getVar(name: string): any;
|
|
49
|
+
static guid: number;
|
|
50
|
+
static doc_style: CSSStyleDeclaration;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* -- [ @CSSPARSER ] -----------------------------------------------------------------
|
|
54
|
+
*
|
|
55
|
+
* adaptation of jss-for-node-js
|
|
56
|
+
*/
|
|
57
|
+
export declare class CSSParser {
|
|
58
|
+
private result;
|
|
59
|
+
parse(css: any): string;
|
|
60
|
+
static mk_string(rules: any): string;
|
|
61
|
+
private parse_json;
|
|
62
|
+
private makePropertyName;
|
|
63
|
+
private makeSelectorName;
|
|
64
|
+
addProperty(scope: string, property: string, value: any): void;
|
|
65
|
+
}
|
|
66
|
+
export declare class ComputedStyle {
|
|
67
|
+
m_style: CSSStyleDeclaration;
|
|
68
|
+
constructor(style: CSSStyleDeclaration);
|
|
69
|
+
/**
|
|
70
|
+
* return the raw value
|
|
71
|
+
*/
|
|
72
|
+
value(name: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* return the interpreted value
|
|
75
|
+
*/
|
|
76
|
+
parse(name: string): number;
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
get style(): CSSStyleDeclaration;
|
|
81
|
+
}
|