x4js 1.4.18 → 1.4.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/application.d.ts +1 -1
- package/lib/application.js +4 -3
- package/lib/base_component.d.ts +1 -1
- package/lib/base_component.js +3 -3
- package/lib/button.d.ts +1 -1
- package/lib/button.js +3 -3
- package/lib/calendar.d.ts +1 -1
- package/lib/calendar.js +5 -4
- package/lib/canvas.d.ts +1 -1
- package/lib/canvas.js +2 -2
- package/lib/cardview.d.ts +1 -1
- package/lib/cardview.js +2 -2
- package/lib/checkbox.d.ts +1 -1
- package/lib/checkbox.js +2 -2
- package/lib/colorpicker.d.ts +1 -1
- package/lib/colorpicker.js +5 -5
- package/lib/combobox.d.ts +1 -1
- package/lib/combobox.js +3 -3
- package/lib/component.d.ts +1 -5
- package/lib/component.js +35 -39
- package/lib/datastore.d.ts +1 -1
- package/lib/datastore.js +5 -5
- package/lib/dialog.d.ts +1 -1
- package/lib/dialog.js +4 -3
- package/lib/drag_manager.js +30 -1
- package/lib/fileupload.js +2 -1
- package/lib/form.d.ts +1 -1
- package/lib/gridview.d.ts +1 -5
- package/lib/gridview.js +8 -7
- package/lib/i18n.d.ts +35 -33
- package/lib/i18n.js +180 -93
- package/lib/icon.d.ts +1 -1
- package/lib/icon.js +10 -13
- package/lib/image.js +4 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/input.js +1 -1
- package/lib/link.d.ts +1 -1
- package/lib/link.js +2 -2
- package/lib/listview.d.ts +1 -1
- package/lib/listview.js +10 -9
- package/lib/menu.d.ts +1 -1
- package/lib/menu.js +5 -4
- package/lib/popup.d.ts +1 -1
- package/lib/popup.js +13 -12
- package/lib/property_editor.d.ts +1 -1
- package/lib/property_editor.js +2 -2
- package/lib/radiobtn.d.ts +1 -1
- package/lib/radiobtn.js +4 -3
- package/lib/rating.d.ts +1 -1
- package/lib/rating.js +2 -2
- package/lib/router.d.ts +1 -1
- package/lib/router.js +5 -4
- package/lib/spreadsheet.d.ts +1 -1
- package/lib/spreadsheet.js +9 -8
- package/lib/styles.js +6 -5
- package/lib/svgcomponent.d.ts +1 -1
- package/lib/svgcomponent.js +4 -1
- package/lib/tabbar.d.ts +1 -1
- package/lib/tabbar.js +2 -2
- package/lib/textarea.d.ts +1 -1
- package/lib/textarea.js +2 -2
- package/lib/textedit.d.ts +1 -1
- package/lib/textedit.js +5 -4
- package/lib/tools.d.ts +1 -0
- package/lib/tools.js +15 -6
- package/lib/tooltips.js +6 -5
- package/lib/treeview.d.ts +1 -1
- package/lib/treeview.js +8 -8
- package/lib/x4dom.d.ts +21 -0
- package/lib/x4dom.js +7 -0
- package/lib/x4events.d.ts +266 -0
- package/lib/x4events.js +389 -0
- package/package.json +4 -3
- package/src/application.ts +5 -4
- package/src/base_component.ts +1 -1
- package/src/button.ts +1 -1
- package/src/calendar.ts +5 -3
- package/src/canvas.ts +1 -1
- package/src/cardview.ts +1 -1
- package/src/checkbox.ts +1 -1
- package/src/colorpicker.ts +1 -1
- package/src/combobox.ts +1 -1
- package/src/component.ts +34 -39
- package/src/datastore.ts +1 -1
- package/src/dialog.ts +4 -2
- package/src/drag_manager.ts +4 -1
- package/src/fileupload.ts +2 -1
- package/src/form.ts +1 -1
- package/src/gridview.ts +4 -3
- package/src/hosts/electron.ts +4 -1
- package/src/i18n.ts +234 -97
- package/src/icon.ts +9 -12
- package/src/image.ts +5 -3
- package/src/index.ts +1 -1
- package/src/input.ts +1 -1
- package/src/layout.ts +1 -1
- package/src/link.ts +1 -1
- package/src/listview.ts +6 -4
- package/src/menu.ts +5 -3
- package/src/popup.ts +14 -12
- package/src/property_editor.ts +1 -1
- package/src/radiobtn.ts +4 -2
- package/src/rating.ts +1 -1
- package/src/router.ts +4 -2
- package/src/smartedit.ts +3 -2
- package/src/spreadsheet.ts +8 -6
- package/src/styles.ts +7 -5
- package/src/svgcomponent.ts +4 -1
- package/src/tabbar.ts +1 -1
- package/src/textarea.ts +1 -1
- package/src/textedit.ts +4 -2
- package/src/tools.ts +15 -5
- package/src/tooltips.ts +7 -5
- package/src/treeview.ts +1 -1
- package/src/x4dom.ts +57 -0
- package/src/{x4_events.ts → x4events.ts} +1 -1
- package/tsconfig.json +5 -1
package/lib/link.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.Link = void 0;
|
|
32
32
|
const component_1 = require("./component");
|
|
33
|
-
const
|
|
33
|
+
const x4events_1 = require("./x4events");
|
|
34
34
|
/**
|
|
35
35
|
* Standard Link
|
|
36
36
|
*/
|
|
@@ -41,7 +41,7 @@ class Link extends component_1.Component {
|
|
|
41
41
|
this.mapPropEvents(props, 'click');
|
|
42
42
|
}
|
|
43
43
|
_handleClick() {
|
|
44
|
-
this.emit('click', (0,
|
|
44
|
+
this.emit('click', (0, x4events_1.EvClick)());
|
|
45
45
|
}
|
|
46
46
|
/** @ignore */
|
|
47
47
|
render(props) {
|
package/lib/listview.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ import { IconID } from './icon';
|
|
|
31
31
|
import { VLayout } from './layout';
|
|
32
32
|
import { Popup, PopupEventMap, PopupProps } from './popup';
|
|
33
33
|
import { HtmlString } from './tools';
|
|
34
|
-
import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent } from "./
|
|
34
|
+
import { EvContextMenu, EvSelectionChange, EvClick, EventCallback, BasicEvent } from "./x4events";
|
|
35
35
|
/**
|
|
36
36
|
* item definition
|
|
37
37
|
*/
|
package/lib/listview.js
CHANGED
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.PopupListView = exports.EvCancel = exports.ListView = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
34
|
const layout_1 = require("./layout");
|
|
34
35
|
const popup_1 = require("./popup");
|
|
35
36
|
const tools_1 = require("./tools");
|
|
36
37
|
const menu_1 = require("./menu");
|
|
37
|
-
const
|
|
38
|
+
const x4events_1 = require("./x4events");
|
|
38
39
|
;
|
|
39
40
|
/**
|
|
40
41
|
* Standard listview class
|
|
@@ -317,7 +318,7 @@ class ListView extends layout_1.VLayout {
|
|
|
317
318
|
if (item) {
|
|
318
319
|
let event;
|
|
319
320
|
if (e.type == 'click') {
|
|
320
|
-
event = (0,
|
|
321
|
+
event = (0, x4events_1.EvClick)(item);
|
|
321
322
|
this.emit('click', event);
|
|
322
323
|
}
|
|
323
324
|
else {
|
|
@@ -348,13 +349,13 @@ class ListView extends layout_1.VLayout {
|
|
|
348
349
|
let item = list_items.find((item) => item.id == id);
|
|
349
350
|
if (item) {
|
|
350
351
|
this._selectItem(item, itm);
|
|
351
|
-
this.emit('contextMenu', (0,
|
|
352
|
+
this.emit('contextMenu', (0, x4events_1.EvContextMenu)(e, item));
|
|
352
353
|
}
|
|
353
354
|
return;
|
|
354
355
|
}
|
|
355
356
|
dom = dom.parentElement;
|
|
356
357
|
}
|
|
357
|
-
this.emit('contextMenu', (0,
|
|
358
|
+
this.emit('contextMenu', (0, x4events_1.EvContextMenu)(e, null));
|
|
358
359
|
}
|
|
359
360
|
/**
|
|
360
361
|
* @ignore
|
|
@@ -372,7 +373,7 @@ class ListView extends layout_1.VLayout {
|
|
|
372
373
|
this.m_selection.citem.addClass('@selected');
|
|
373
374
|
}
|
|
374
375
|
if (notify) {
|
|
375
|
-
this.emit('selectionChange', (0,
|
|
376
|
+
this.emit('selectionChange', (0, x4events_1.EvSelectionChange)(item));
|
|
376
377
|
}
|
|
377
378
|
}
|
|
378
379
|
/**
|
|
@@ -469,7 +470,7 @@ class ListView extends layout_1.VLayout {
|
|
|
469
470
|
}
|
|
470
471
|
exports.ListView = ListView;
|
|
471
472
|
function EvCancel(context = null) {
|
|
472
|
-
return (0,
|
|
473
|
+
return (0, x4events_1.BasicEvent)({ context });
|
|
473
474
|
}
|
|
474
475
|
exports.EvCancel = EvCancel;
|
|
475
476
|
/**
|
|
@@ -510,16 +511,16 @@ class PopupListView extends popup_1.Popup {
|
|
|
510
511
|
};
|
|
511
512
|
// todo: move into popup
|
|
512
513
|
show(modal) {
|
|
513
|
-
|
|
514
|
+
x4dom_1.x4document.addEventListener('mousedown', this._handleClick);
|
|
514
515
|
super.show(modal);
|
|
515
516
|
}
|
|
516
517
|
hide() {
|
|
517
|
-
|
|
518
|
+
x4dom_1.x4document.removeEventListener('mousedown', this._handleClick);
|
|
518
519
|
super.hide();
|
|
519
520
|
}
|
|
520
521
|
// todo: move into popup
|
|
521
522
|
close() {
|
|
522
|
-
|
|
523
|
+
x4dom_1.x4document.removeEventListener('mousedown', this._handleClick);
|
|
523
524
|
super.close();
|
|
524
525
|
}
|
|
525
526
|
get selection() {
|
package/lib/menu.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
import { CEventMap, Component, CProps } from './component';
|
|
30
|
-
import { EvClick, EventCallback } from './
|
|
30
|
+
import { EvClick, EventCallback } from './x4events';
|
|
31
31
|
import { Popup, PopupProps } from './popup';
|
|
32
32
|
import { IconID } from './icon';
|
|
33
33
|
import { Label } from './label';
|
package/lib/menu.js
CHANGED
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.MenuBar = exports.MenuItem = exports.Menu = exports.MenuTitle = exports.MenuSeparator = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
|
-
const
|
|
34
|
+
const x4events_1 = require("./x4events");
|
|
34
35
|
const popup_1 = require("./popup");
|
|
35
36
|
const icon_1 = require("./icon");
|
|
36
37
|
const label_1 = require("./label");
|
|
@@ -119,7 +120,7 @@ class Menu extends popup_1.Popup {
|
|
|
119
120
|
//console.log( 'addmenu' );
|
|
120
121
|
if (Menu.watchCount == 0) {
|
|
121
122
|
Menu.rootMenu = menu;
|
|
122
|
-
|
|
123
|
+
x4dom_1.x4document.addEventListener('mousedown', Menu._mouseWatcher);
|
|
123
124
|
}
|
|
124
125
|
Menu.watchCount++;
|
|
125
126
|
}
|
|
@@ -128,7 +129,7 @@ class Menu extends popup_1.Popup {
|
|
|
128
129
|
console.assert(Menu.watchCount > 0);
|
|
129
130
|
Menu.watchCount--;
|
|
130
131
|
if (Menu.watchCount == 0) {
|
|
131
|
-
|
|
132
|
+
x4dom_1.x4document.removeEventListener('mousedown', Menu._mouseWatcher);
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
static _mouseWatcher(ev) {
|
|
@@ -234,7 +235,7 @@ class MenuItem extends component_1.Component {
|
|
|
234
235
|
}
|
|
235
236
|
_click(ev) {
|
|
236
237
|
if (!this.isPopup) {
|
|
237
|
-
this.emit('click', (0,
|
|
238
|
+
this.emit('click', (0, x4events_1.EvClick)());
|
|
238
239
|
Menu._discardAll();
|
|
239
240
|
}
|
|
240
241
|
}
|
package/lib/popup.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
import { Container, CProps, ContainerEventMap, EvSize } from './component';
|
|
30
30
|
import { Point } from './tools';
|
|
31
|
-
import { BasicEvent } from './
|
|
31
|
+
import { BasicEvent } from './x4events';
|
|
32
32
|
export interface EvMove extends BasicEvent {
|
|
33
33
|
pos: Point;
|
|
34
34
|
}
|
package/lib/popup.js
CHANGED
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.Popup = exports.EvMove = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
34
|
const tools_1 = require("./tools");
|
|
34
|
-
const
|
|
35
|
+
const x4events_1 = require("./x4events");
|
|
35
36
|
const application_1 = require("./application");
|
|
36
37
|
function EvMove(pos) {
|
|
37
|
-
return (0,
|
|
38
|
+
return (0, x4events_1.BasicEvent)({ pos });
|
|
38
39
|
}
|
|
39
40
|
exports.EvMove = EvMove;
|
|
40
41
|
/**
|
|
@@ -63,11 +64,11 @@ class Popup extends component_1.Container {
|
|
|
63
64
|
}
|
|
64
65
|
if (this.m_hasMask) {
|
|
65
66
|
// remove the focus
|
|
66
|
-
const focus =
|
|
67
|
+
const focus = x4dom_1.x4document.activeElement;
|
|
67
68
|
if (focus) {
|
|
68
69
|
focus.blur();
|
|
69
70
|
}
|
|
70
|
-
this.m_ui_mask =
|
|
71
|
+
this.m_ui_mask = x4dom_1.x4document.body.lastChild;
|
|
71
72
|
while (this.m_ui_mask) {
|
|
72
73
|
if (this.m_ui_mask.nodeType == 1) { // only element nodes
|
|
73
74
|
let elUI = (0, component_1.flyWrap)(this.m_ui_mask);
|
|
@@ -99,11 +100,11 @@ class Popup extends component_1.Container {
|
|
|
99
100
|
left: 0,
|
|
100
101
|
top: 0
|
|
101
102
|
});
|
|
102
|
-
|
|
103
|
+
x4dom_1.x4document.body.appendChild(this._build());
|
|
103
104
|
this.removeClass('@hidden');
|
|
104
105
|
this.centerOnScreen();
|
|
105
106
|
if (modal) {
|
|
106
|
-
let focus =
|
|
107
|
+
let focus = x4dom_1.x4document.activeElement;
|
|
107
108
|
if (!this.dom.contains(focus)) {
|
|
108
109
|
const autofocus = this.queryItem('[autofocus]');
|
|
109
110
|
if (autofocus) {
|
|
@@ -125,7 +126,7 @@ class Popup extends component_1.Container {
|
|
|
125
126
|
}
|
|
126
127
|
centerOnScreen() {
|
|
127
128
|
let rc = this.getBoundingRect();
|
|
128
|
-
let x = (
|
|
129
|
+
let x = (x4dom_1.x4document.body.clientWidth - rc.width) / 2, y = (x4dom_1.x4document.body.clientHeight - rc.height) / 2;
|
|
129
130
|
this.setStyleValue('left', x);
|
|
130
131
|
this.setStyleValue('top', y);
|
|
131
132
|
}
|
|
@@ -144,7 +145,7 @@ class Popup extends component_1.Container {
|
|
|
144
145
|
valign = 'b';
|
|
145
146
|
}
|
|
146
147
|
// @TODO: this is a minimal overflow problem solution
|
|
147
|
-
let rc =
|
|
148
|
+
let rc = x4dom_1.x4document.body.getBoundingClientRect(), rm = this.getBoundingRect();
|
|
148
149
|
if (halign == 'r') {
|
|
149
150
|
x -= rm.width;
|
|
150
151
|
}
|
|
@@ -321,7 +322,7 @@ function x4handleKeyDown(e) {
|
|
|
321
322
|
if (el && (el.hasAttribute('wants-tab') || el.hasAttribute('wants-enter'))) {
|
|
322
323
|
return;
|
|
323
324
|
}
|
|
324
|
-
let topStack =
|
|
325
|
+
let topStack = x4dom_1.x4document.body;
|
|
325
326
|
if (Popup.modal_stack.length) {
|
|
326
327
|
topStack = Popup.modal_stack[Popup.modal_stack.length - 1];
|
|
327
328
|
}
|
|
@@ -335,7 +336,7 @@ function x4handleKeyDown(e) {
|
|
|
335
336
|
*/
|
|
336
337
|
function _nextTab(root, el, prev) {
|
|
337
338
|
// first check if the focus is one of our child (disabled...)
|
|
338
|
-
let focusEl =
|
|
339
|
+
let focusEl = x4dom_1.x4document.activeElement;
|
|
339
340
|
if (!root.contains(focusEl)) {
|
|
340
341
|
return;
|
|
341
342
|
}
|
|
@@ -374,7 +375,7 @@ function _nextTab(root, el, prev) {
|
|
|
374
375
|
}
|
|
375
376
|
function installKBHandler() {
|
|
376
377
|
// set on body to be called after document (where all component domevent go)
|
|
377
|
-
|
|
378
|
+
x4dom_1.x4document.body.addEventListener('keydown', x4handleKeyDown, true);
|
|
378
379
|
}
|
|
379
380
|
// too early ?
|
|
380
|
-
|
|
381
|
+
x4dom_1.x4document.body ? installKBHandler() : window.addEventListener('load', installKBHandler);
|
package/lib/property_editor.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
import { CEventMap, Component, CProps } from './component';
|
|
30
|
-
import { EvChange, EventCallback } from './
|
|
30
|
+
import { EvChange, EventCallback } from './x4events';
|
|
31
31
|
import { InputProps } from './input';
|
|
32
32
|
import { Spreadsheet } from './spreadsheet';
|
|
33
33
|
import { Record } from './datastore';
|
package/lib/property_editor.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.PropertyEditor = void 0;
|
|
32
32
|
const component_1 = require("./component");
|
|
33
|
-
const
|
|
33
|
+
const x4events_1 = require("./x4events");
|
|
34
34
|
const input_1 = require("./input");
|
|
35
35
|
const textedit_1 = require("./textedit");
|
|
36
36
|
const checkbox_1 = require("./checkbox");
|
|
@@ -145,7 +145,7 @@ class PropertyEditor extends component_1.Component {
|
|
|
145
145
|
else {
|
|
146
146
|
fld.value = text;
|
|
147
147
|
}
|
|
148
|
-
this.emit('change', (0,
|
|
148
|
+
this.emit('change', (0, x4events_1.EvChange)(text, fld));
|
|
149
149
|
}
|
|
150
150
|
_renderCell(text, rec) {
|
|
151
151
|
let fld = this.m_fields[rec.row];
|
package/lib/radiobtn.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
import { Component, CProps, CEventMap } from './component';
|
|
30
|
-
import { EvChange, EventCallback } from './
|
|
30
|
+
import { EvChange, EventCallback } from './x4events';
|
|
31
31
|
import { IconID } from './icon';
|
|
32
32
|
import { Input } from './input';
|
|
33
33
|
interface RadioBtnEventMap extends CEventMap {
|
package/lib/radiobtn.js
CHANGED
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.RadioBtn = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
|
-
const
|
|
34
|
+
const x4events_1 = require("./x4events");
|
|
34
35
|
const input_1 = require("./input");
|
|
35
36
|
const label_1 = require("./label");
|
|
36
37
|
/**
|
|
@@ -90,14 +91,14 @@ class RadioBtn extends component_1.Component {
|
|
|
90
91
|
_change() {
|
|
91
92
|
let props = this.m_props;
|
|
92
93
|
let query = '.x-input[name=' + props.name + ']';
|
|
93
|
-
let nlist =
|
|
94
|
+
let nlist = x4dom_1.x4document.querySelectorAll(query); //todo: document ?
|
|
94
95
|
nlist.forEach((dom) => {
|
|
95
96
|
let radio = component_1.Component.getElement(dom, RadioBtn);
|
|
96
97
|
radio.removeClass('checked');
|
|
97
98
|
});
|
|
98
99
|
let dom = this.m_ui_input.dom;
|
|
99
100
|
this.setClass('checked', dom.checked);
|
|
100
|
-
this.emit('change', (0,
|
|
101
|
+
this.emit('change', (0, x4events_1.EvChange)(true));
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* @return the checked value
|
package/lib/rating.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
import { CProps, ContainerEventMap } from './component';
|
|
30
30
|
import { HLayout } from './layout';
|
|
31
|
-
import { EvChange, EventCallback } from './
|
|
31
|
+
import { EvChange, EventCallback } from './x4events';
|
|
32
32
|
interface RatingEventMap extends ContainerEventMap {
|
|
33
33
|
change: EvChange;
|
|
34
34
|
}
|
package/lib/rating.js
CHANGED
|
@@ -32,7 +32,7 @@ exports.Rating = void 0;
|
|
|
32
32
|
const component_1 = require("./component");
|
|
33
33
|
const layout_1 = require("./layout");
|
|
34
34
|
const input_1 = require("./input");
|
|
35
|
-
const
|
|
35
|
+
const x4events_1 = require("./x4events");
|
|
36
36
|
class Rating extends layout_1.HLayout {
|
|
37
37
|
m_els;
|
|
38
38
|
m_input;
|
|
@@ -95,7 +95,7 @@ class Rating extends layout_1.HLayout {
|
|
|
95
95
|
on = false;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
this.emit('change', (0,
|
|
98
|
+
this.emit('change', (0, x4events_1.EvChange)(this.m_props.value));
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
exports.Rating = Rating;
|
package/lib/router.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
|
-
import { EventSource, EvError, EventMap } from "./
|
|
29
|
+
import { EventSource, EvError, EventMap } from "./x4events";
|
|
30
30
|
declare type RouteHandler = (params: any, path: string) => void;
|
|
31
31
|
interface RouterEventMap extends EventMap {
|
|
32
32
|
error: EvError;
|
package/lib/router.js
CHANGED
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.Router = void 0;
|
|
32
|
-
const
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
33
|
+
const x4events_1 = require("./x4events");
|
|
33
34
|
function parseRoute(str, loose = false) {
|
|
34
35
|
if (str instanceof RegExp) {
|
|
35
36
|
return {
|
|
@@ -67,13 +68,13 @@ function parseRoute(str, loose = false) {
|
|
|
67
68
|
pattern: new RegExp(`^${pattern}${loose ? '(?=$|\/)' : '\/?$'}`, 'i')
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
|
-
class Router extends
|
|
71
|
+
class Router extends x4events_1.EventSource {
|
|
71
72
|
routes;
|
|
72
73
|
constructor() {
|
|
73
74
|
super();
|
|
74
75
|
this.routes = [];
|
|
75
76
|
window.addEventListener('popstate', (event) => {
|
|
76
|
-
const url =
|
|
77
|
+
const url = x4dom_1.x4document.location.pathname;
|
|
77
78
|
const found = this._find(url);
|
|
78
79
|
found.handlers.forEach(h => {
|
|
79
80
|
h(found.params, url);
|
|
@@ -92,7 +93,7 @@ class Router extends x4_events_1.EventSource {
|
|
|
92
93
|
if (!found || found.handlers.length == 0) {
|
|
93
94
|
//window.history.pushState({}, '', 'error')
|
|
94
95
|
console.log('route not found: ' + uri);
|
|
95
|
-
this.signal("error", (0,
|
|
96
|
+
this.signal("error", (0, x4events_1.EvError)(404, "route not found"));
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
99
|
window.history.pushState({}, '', uri);
|
package/lib/spreadsheet.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { Component, EvDblClick, ContainerEventMap, ContainerProps } from './comp
|
|
|
30
30
|
import { InputProps } from './input';
|
|
31
31
|
import { VLayout } from './layout';
|
|
32
32
|
import * as Formatters from './formatters';
|
|
33
|
-
import { EvContextMenu, EvChange, EvSelectionChange, EventCallback } from './
|
|
33
|
+
import { EvContextMenu, EvChange, EvSelectionChange, EventCallback } from './x4events';
|
|
34
34
|
export interface EditorFactory {
|
|
35
35
|
(props: InputProps, row: number, col: number): Component;
|
|
36
36
|
}
|
package/lib/spreadsheet.js
CHANGED
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.Spreadsheet = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
34
|
const layout_1 = require("./layout");
|
|
34
35
|
const textedit_1 = require("./textedit");
|
|
35
36
|
const tools_1 = require("./tools");
|
|
36
37
|
const tools_2 = require("./tools");
|
|
37
|
-
const
|
|
38
|
+
const x4events_1 = require("./x4events");
|
|
38
39
|
const combobox_1 = require("./combobox");
|
|
39
40
|
class CellData {
|
|
40
41
|
text;
|
|
@@ -89,7 +90,7 @@ class Spreadsheet extends layout_1.VLayout {
|
|
|
89
90
|
else {
|
|
90
91
|
this.m_row_limit = props.maxrows;
|
|
91
92
|
}
|
|
92
|
-
this.setAttribute('
|
|
93
|
+
this.setAttribute('tabindex', 0);
|
|
93
94
|
this.setDomEvent('click', (e) => this._itemClick(e));
|
|
94
95
|
this.setDomEvent('dblclick', (e) => this._itemDblClick(e));
|
|
95
96
|
this.setDomEvent('keydown', (e) => this._handleKey(e));
|
|
@@ -247,7 +248,7 @@ class Spreadsheet extends layout_1.VLayout {
|
|
|
247
248
|
let itm = component_1.Component.getElement(dom), row = itm.getData('row-id'), col = itm.getData('col-id');
|
|
248
249
|
if (row !== undefined) {
|
|
249
250
|
this._selectItem(row, col);
|
|
250
|
-
this.emit('contextMenu', (0,
|
|
251
|
+
this.emit('contextMenu', (0, x4events_1.EvContextMenu)(e, { row, col, item: itm }));
|
|
251
252
|
e.preventDefault();
|
|
252
253
|
return;
|
|
253
254
|
}
|
|
@@ -323,11 +324,11 @@ class Spreadsheet extends layout_1.VLayout {
|
|
|
323
324
|
* - scroll width
|
|
324
325
|
*/
|
|
325
326
|
_computeItemHeight() {
|
|
326
|
-
let g1 =
|
|
327
|
+
let g1 = x4dom_1.x4document.createElement('div');
|
|
327
328
|
g1.classList.add('x-spreadsheet');
|
|
328
|
-
let g2 =
|
|
329
|
+
let g2 = x4dom_1.x4document.createElement('div');
|
|
329
330
|
g2.classList.add('content');
|
|
330
|
-
let g3 =
|
|
331
|
+
let g3 = x4dom_1.x4document.createElement('div');
|
|
331
332
|
g3.classList.add('x-cell');
|
|
332
333
|
g3.append(' ');
|
|
333
334
|
g2.appendChild(g3);
|
|
@@ -795,7 +796,7 @@ class Spreadsheet extends layout_1.VLayout {
|
|
|
795
796
|
if (newSel) {
|
|
796
797
|
newSel.addClass('@selected');
|
|
797
798
|
}
|
|
798
|
-
this.emit('selectionChange', (0,
|
|
799
|
+
this.emit('selectionChange', (0, x4events_1.EvSelectionChange)({ row, col }));
|
|
799
800
|
}
|
|
800
801
|
/**
|
|
801
802
|
* return the row count
|
|
@@ -1007,7 +1008,7 @@ class Spreadsheet extends layout_1.VLayout {
|
|
|
1007
1008
|
let col = this.m_editor.getData('col');
|
|
1008
1009
|
let old = this.m_editor.getData('old-value');
|
|
1009
1010
|
this.setCellText(row, col, text);
|
|
1010
|
-
const ev = (0,
|
|
1011
|
+
const ev = (0, x4events_1.EvChange)(text, { row, col, oldValue: old, id });
|
|
1011
1012
|
this.emit('change', ev);
|
|
1012
1013
|
if (ev.defaultPrevented) {
|
|
1013
1014
|
this.setCellText(row, col, old);
|
package/lib/styles.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.ComputedStyle = exports.CSSParser = exports.Stylesheet = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const tools_1 = require("./tools");
|
|
33
34
|
/**
|
|
34
35
|
* -- [ @STYLESHEET ] -----------------------------------------------------------------
|
|
@@ -38,8 +39,8 @@ class Stylesheet {
|
|
|
38
39
|
m_rules = new Map();
|
|
39
40
|
constructor() {
|
|
40
41
|
function getStyleSheet(name) {
|
|
41
|
-
for (let i = 0; i <
|
|
42
|
-
let sheet =
|
|
42
|
+
for (let i = 0; i < x4dom_1.x4document.styleSheets.length; i++) {
|
|
43
|
+
let sheet = x4dom_1.x4document.styleSheets[i];
|
|
43
44
|
if (sheet.title === name) {
|
|
44
45
|
return sheet;
|
|
45
46
|
}
|
|
@@ -47,9 +48,9 @@ class Stylesheet {
|
|
|
47
48
|
}
|
|
48
49
|
this.m_sheet = getStyleSheet('@dynamic-css');
|
|
49
50
|
if (!this.m_sheet) {
|
|
50
|
-
let dom =
|
|
51
|
+
let dom = x4dom_1.x4document.createElement('style');
|
|
51
52
|
dom.setAttribute('id', '@dynamic-css');
|
|
52
|
-
|
|
53
|
+
x4dom_1.x4document.head.appendChild(dom);
|
|
53
54
|
this.m_sheet = dom.sheet;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -98,7 +99,7 @@ class Stylesheet {
|
|
|
98
99
|
*/
|
|
99
100
|
static getVar(name) {
|
|
100
101
|
if (!Stylesheet.doc_style) {
|
|
101
|
-
Stylesheet.doc_style = getComputedStyle(
|
|
102
|
+
Stylesheet.doc_style = getComputedStyle(x4dom_1.x4document.documentElement);
|
|
102
103
|
}
|
|
103
104
|
if (name[0] != '-') {
|
|
104
105
|
name = '--' + name;
|
package/lib/svgcomponent.d.ts
CHANGED
package/lib/svgcomponent.js
CHANGED
|
@@ -76,8 +76,11 @@ class SVGItem {
|
|
|
76
76
|
* change the stroke color
|
|
77
77
|
* @param color
|
|
78
78
|
*/
|
|
79
|
-
stroke(color) {
|
|
79
|
+
stroke(color, width) {
|
|
80
80
|
this.attr('stroke', color);
|
|
81
|
+
if (width !== undefined) {
|
|
82
|
+
this.attr('stroke-width', width + 'px');
|
|
83
|
+
}
|
|
81
84
|
return this;
|
|
82
85
|
}
|
|
83
86
|
/**
|
package/lib/tabbar.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
import { Component, Container, ContainerEventMap, CProps, EventHandler } from './component';
|
|
30
|
-
import { EvChange } from './
|
|
30
|
+
import { EvChange } from './x4events';
|
|
31
31
|
import { IconID } from './icon.js';
|
|
32
32
|
interface TabBarEventMap extends ContainerEventMap {
|
|
33
33
|
change: EvChange;
|
package/lib/tabbar.js
CHANGED
|
@@ -31,7 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
exports.TabBar = void 0;
|
|
32
32
|
const component_1 = require("./component");
|
|
33
33
|
const button_1 = require("./button");
|
|
34
|
-
const
|
|
34
|
+
const x4events_1 = require("./x4events");
|
|
35
35
|
class TabBar extends component_1.Container {
|
|
36
36
|
m_pages;
|
|
37
37
|
m_curPage;
|
|
@@ -95,7 +95,7 @@ class TabBar extends component_1.Container {
|
|
|
95
95
|
}
|
|
96
96
|
this.m_curPage = p;
|
|
97
97
|
if (notify) {
|
|
98
|
-
this.signal('change', (0,
|
|
98
|
+
this.signal('change', (0, x4events_1.EvChange)(p ? p.id : null));
|
|
99
99
|
}
|
|
100
100
|
if (this.m_curPage) {
|
|
101
101
|
this.m_curPage.btn.addClass('selected');
|
package/lib/textarea.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
import { Component, CProps, CEventMap } from './component';
|
|
30
|
-
import { EvChange, EventCallback } from './
|
|
30
|
+
import { EvChange, EventCallback } from './x4events';
|
|
31
31
|
interface TextAreaEventMap extends CEventMap {
|
|
32
32
|
change: EvChange;
|
|
33
33
|
}
|
package/lib/textarea.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.TextArea = void 0;
|
|
32
32
|
const component_1 = require("./component");
|
|
33
|
-
const
|
|
33
|
+
const x4events_1 = require("./x4events");
|
|
34
34
|
const tools_1 = require("./tools");
|
|
35
35
|
class TextArea extends component_1.Component {
|
|
36
36
|
constructor(props) {
|
|
@@ -74,7 +74,7 @@ class TextArea extends component_1.Component {
|
|
|
74
74
|
this.setProp('tag', 'textarea');
|
|
75
75
|
}
|
|
76
76
|
_change() {
|
|
77
|
-
this.emit('change', (0,
|
|
77
|
+
this.emit('change', (0, x4events_1.EvChange)(this.value));
|
|
78
78
|
}
|
|
79
79
|
componentCreated() {
|
|
80
80
|
this.value = this.m_props.text;
|
package/lib/textedit.d.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import { Component, EvFocus, HtmlString } from './component';
|
|
30
30
|
import { Input, InputProps, InputEventMap } from './input';
|
|
31
31
|
import { IconID } from './icon';
|
|
32
|
-
import { EvClick, EvChange, EventCallback } from './
|
|
32
|
+
import { EvClick, EvChange, EventCallback } from './x4events';
|
|
33
33
|
declare type ValidationFunction = (value: string) => string;
|
|
34
34
|
interface TextEditEventMap extends InputEventMap {
|
|
35
35
|
click: EvClick;
|
package/lib/textedit.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.TextEdit = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
34
|
const input_1 = require("./input");
|
|
34
35
|
const button_1 = require("./button");
|
|
@@ -37,7 +38,7 @@ const label_1 = require("./label");
|
|
|
37
38
|
const calendar_1 = require("./calendar");
|
|
38
39
|
const tools_1 = require("./tools");
|
|
39
40
|
const tooltips_1 = require("./tooltips");
|
|
40
|
-
const
|
|
41
|
+
const x4events_1 = require("./x4events");
|
|
41
42
|
const i18n_1 = require("./i18n");
|
|
42
43
|
/** @ignore */
|
|
43
44
|
const reEmail = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
@@ -181,7 +182,7 @@ class TextEdit extends component_1.Component {
|
|
|
181
182
|
super.disable();
|
|
182
183
|
}
|
|
183
184
|
_btnClick() {
|
|
184
|
-
this.emit('click', (0,
|
|
185
|
+
this.emit('click', (0, x4events_1.EvClick)(this.value));
|
|
185
186
|
}
|
|
186
187
|
/**
|
|
187
188
|
* select the value format for input/output on textedit of type date
|
|
@@ -223,7 +224,7 @@ class TextEdit extends component_1.Component {
|
|
|
223
224
|
showError(text) {
|
|
224
225
|
if (!this.m_error_tip) {
|
|
225
226
|
this.m_error_tip = new tooltips_1.Tooltip({ cls: 'error' });
|
|
226
|
-
|
|
227
|
+
x4dom_1.x4document.body.appendChild(this.m_error_tip._build());
|
|
227
228
|
}
|
|
228
229
|
let rc = this.m_ui_input.getBoundingRect();
|
|
229
230
|
this.m_error_tip.text = text;
|
|
@@ -279,7 +280,7 @@ class TextEdit extends component_1.Component {
|
|
|
279
280
|
*/
|
|
280
281
|
_change() {
|
|
281
282
|
let value = this.m_ui_input.value;
|
|
282
|
-
this.emit('change', (0,
|
|
283
|
+
this.emit('change', (0, x4events_1.EvChange)(value));
|
|
283
284
|
}
|
|
284
285
|
/**
|
|
285
286
|
* getting focus
|
package/lib/tools.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare function parseIntlFloat(num: string): number;
|
|
|
50
50
|
* @param {String} str
|
|
51
51
|
*/
|
|
52
52
|
export declare function pascalCase(string: string): string;
|
|
53
|
+
export declare function camelCase(text: string): string;
|
|
53
54
|
export declare type Constructor<T> = new (...args: any[]) => T;
|
|
54
55
|
export declare class Point {
|
|
55
56
|
x: number;
|