x4js 1.4.16 → 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 +4 -2
- package/lib/application.js +20 -17
- 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 -4
- package/lib/index.js +4 -4
- 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 +6 -5
- 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 +24 -21
- 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 +4 -4
- 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 +5 -3
- 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 +11 -1
package/lib/icon.js
CHANGED
|
@@ -32,9 +32,9 @@ exports.Icon = exports.EvLoaded = void 0;
|
|
|
32
32
|
const component_1 = require("./component");
|
|
33
33
|
const styles_1 = require("./styles");
|
|
34
34
|
const tools_1 = require("./tools");
|
|
35
|
-
const
|
|
35
|
+
const x4events_1 = require("./x4events");
|
|
36
36
|
function EvLoaded(url, svg, context = null) {
|
|
37
|
-
return (0,
|
|
37
|
+
return (0, x4events_1.BasicEvent)({ url, svg, context });
|
|
38
38
|
}
|
|
39
39
|
exports.EvLoaded = EvLoaded;
|
|
40
40
|
function trimQuotes(str) {
|
|
@@ -46,7 +46,7 @@ function trimQuotes(str) {
|
|
|
46
46
|
}
|
|
47
47
|
return str;
|
|
48
48
|
}
|
|
49
|
-
class Loader extends
|
|
49
|
+
class Loader extends x4events_1.EventSource {
|
|
50
50
|
svgs;
|
|
51
51
|
constructor() {
|
|
52
52
|
super();
|
|
@@ -115,6 +115,7 @@ class Icon extends component_1.Component {
|
|
|
115
115
|
if (typeof (icon) === 'number') {
|
|
116
116
|
icon = icon.toString(16);
|
|
117
117
|
name = icon;
|
|
118
|
+
console.error("deprecation error: invalid icon name");
|
|
118
119
|
}
|
|
119
120
|
else {
|
|
120
121
|
// var( <var-name> )
|
|
@@ -122,7 +123,7 @@ class Icon extends component_1.Component {
|
|
|
122
123
|
// in the .css
|
|
123
124
|
// --------------------------
|
|
124
125
|
// :root {
|
|
125
|
-
// --chevron-up:
|
|
126
|
+
// --chevron-up: data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96z"/></svg>';
|
|
126
127
|
// }
|
|
127
128
|
//
|
|
128
129
|
// var( "--chevron-up" )
|
|
@@ -150,14 +151,6 @@ class Icon extends component_1.Component {
|
|
|
150
151
|
this._setSVG(url);
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
153
|
-
// svgpath( <svg-path> )
|
|
154
|
-
// svgpath( "M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96z" )
|
|
155
|
-
const reSvg3 = /\s*svgpath\s*\(\s*(.+)\s*\)\s*/gi;
|
|
156
|
-
let match_pth = reSvg3.exec(icon);
|
|
157
|
-
if (match_pth) {
|
|
158
|
-
const pth = this._setSVGPath(match_pth[1].trim());
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
154
|
// data( <direct> )
|
|
162
155
|
// data( "data:image/svg+xml;utf8,<svg...></svg>" )
|
|
163
156
|
const reSvg4 = /^\s*(data\:image\/.+)\s*$/gi;
|
|
@@ -166,6 +159,8 @@ class Icon extends component_1.Component {
|
|
|
166
159
|
this._setSVG(match_dta[1]);
|
|
167
160
|
return;
|
|
168
161
|
}
|
|
162
|
+
// cls( "fas fa-angle-up" )
|
|
163
|
+
//
|
|
169
164
|
const reCls = /\s*cls\s*\(\s*(.+)\s*\)\s*/gi;
|
|
170
165
|
let match_cls = reCls.exec(icon);
|
|
171
166
|
if (match_cls) {
|
|
@@ -173,6 +168,8 @@ class Icon extends component_1.Component {
|
|
|
173
168
|
this.addClass(classes);
|
|
174
169
|
return;
|
|
175
170
|
}
|
|
171
|
+
// url( "www.google.com" )
|
|
172
|
+
//
|
|
176
173
|
const reUrl = /\s*url\s*\(\s*(.+)\s*\)\s*/gi;
|
|
177
174
|
let match_url = reUrl.exec(icon);
|
|
178
175
|
if (match_url) {
|
|
@@ -187,13 +184,13 @@ class Icon extends component_1.Component {
|
|
|
187
184
|
}
|
|
188
185
|
else {
|
|
189
186
|
// todo: deprecated
|
|
187
|
+
console.error("deprecation error: invalid icon name");
|
|
190
188
|
name = icon;
|
|
191
189
|
icon = styles_1.Stylesheet.getVar('icon-' + icon);
|
|
192
190
|
if (icon == '' || icon === undefined) {
|
|
193
191
|
// name your icon 'icon-xxx'
|
|
194
192
|
// ex:
|
|
195
193
|
// :root { --icon-zoom-p: f00e; }
|
|
196
|
-
console.assert(false);
|
|
197
194
|
icon = '0';
|
|
198
195
|
}
|
|
199
196
|
}
|
package/lib/image.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.Image = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
34
|
const emptyImageSrc = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
|
34
35
|
function _isStaticImage(src) {
|
|
@@ -126,7 +127,7 @@ class Image extends component_1.Component {
|
|
|
126
127
|
Image.lazy_images_waiting.forEach((el) => {
|
|
127
128
|
let dom = el.dom, src = el.src;
|
|
128
129
|
// skip deleted elements
|
|
129
|
-
if (!dom ||
|
|
130
|
+
if (!dom || dom.offsetParent === null) {
|
|
130
131
|
// do not append to newList
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
@@ -134,8 +135,8 @@ class Image extends component_1.Component {
|
|
|
134
135
|
// if it is visible & inserted inside the document
|
|
135
136
|
if (!done && dom.offsetParent !== null &&
|
|
136
137
|
rc.bottom >= 0 && rc.right >= 0 &&
|
|
137
|
-
rc.top <= (window.innerHeight ||
|
|
138
|
-
rc.left <= (window.innerWidth ||
|
|
138
|
+
rc.top <= (window.innerHeight || x4dom_1.x4document.documentElement.clientHeight) &&
|
|
139
|
+
rc.left <= (window.innerWidth || x4dom_1.x4document.documentElement.clientWidth)) {
|
|
139
140
|
// ok, we load the image
|
|
140
141
|
let img = dom.firstChild;
|
|
141
142
|
img.setAttribute('src', src);
|
package/lib/index.d.ts
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
**/
|
|
29
29
|
export * from "./application";
|
|
30
30
|
export * from "./base_component";
|
|
31
|
-
export * from "./base64";
|
|
32
31
|
export * from "./button";
|
|
33
32
|
export * from "./calendar";
|
|
34
33
|
export * from "./canvas";
|
|
@@ -67,7 +66,6 @@ export * from "./request";
|
|
|
67
66
|
export * from "./router";
|
|
68
67
|
export * from "./settings";
|
|
69
68
|
export * from "./sidebarview";
|
|
70
|
-
export * from "./smartedit";
|
|
71
69
|
export * from "./spreadsheet";
|
|
72
70
|
export * from "./styles";
|
|
73
71
|
export * from "./svgcomponent";
|
|
@@ -75,9 +73,8 @@ export * from "./tabbar";
|
|
|
75
73
|
export * from "./tabview";
|
|
76
74
|
export * from "./textarea";
|
|
77
75
|
export * from "./textedit";
|
|
78
|
-
export * from "./texthiliter";
|
|
79
76
|
export * from "./toaster";
|
|
80
77
|
export * from "./tools";
|
|
81
78
|
export * from "./tooltips";
|
|
82
79
|
export * from "./treeview";
|
|
83
|
-
export * from "./
|
|
80
|
+
export * from "./x4events";
|
package/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
__exportStar(require("./application"), exports);
|
|
46
46
|
__exportStar(require("./base_component"), exports);
|
|
47
|
-
|
|
47
|
+
//export * from "./base64"
|
|
48
48
|
__exportStar(require("./button"), exports);
|
|
49
49
|
__exportStar(require("./calendar"), exports);
|
|
50
50
|
__exportStar(require("./canvas"), exports);
|
|
@@ -83,7 +83,7 @@ __exportStar(require("./request"), exports);
|
|
|
83
83
|
__exportStar(require("./router"), exports);
|
|
84
84
|
__exportStar(require("./settings"), exports);
|
|
85
85
|
__exportStar(require("./sidebarview"), exports);
|
|
86
|
-
|
|
86
|
+
//export * from "./smartedit"
|
|
87
87
|
__exportStar(require("./spreadsheet"), exports);
|
|
88
88
|
__exportStar(require("./styles"), exports);
|
|
89
89
|
__exportStar(require("./svgcomponent"), exports);
|
|
@@ -91,9 +91,9 @@ __exportStar(require("./tabbar"), exports);
|
|
|
91
91
|
__exportStar(require("./tabview"), exports);
|
|
92
92
|
__exportStar(require("./textarea"), exports);
|
|
93
93
|
__exportStar(require("./textedit"), exports);
|
|
94
|
-
|
|
94
|
+
//export * from "./texthiliter"
|
|
95
95
|
__exportStar(require("./toaster"), exports);
|
|
96
96
|
__exportStar(require("./tools"), exports);
|
|
97
97
|
__exportStar(require("./tooltips"), exports);
|
|
98
98
|
__exportStar(require("./treeview"), exports);
|
|
99
|
-
__exportStar(require("./
|
|
99
|
+
__exportStar(require("./x4events"), exports);
|
package/lib/input.js
CHANGED
|
@@ -50,7 +50,7 @@ class Input extends component_1.Component {
|
|
|
50
50
|
autofocus: props.autoFocus,
|
|
51
51
|
readonly: props.readOnly,
|
|
52
52
|
autocomplete: 'new-password',
|
|
53
|
-
|
|
53
|
+
tabIndex: props.tabIndex,
|
|
54
54
|
spellcheck: props.spellcheck === false ? 'false' : undefined,
|
|
55
55
|
min: props.min,
|
|
56
56
|
max: props.max,
|
package/lib/link.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, HtmlString } from './component';
|
|
30
|
-
import { EvClick, EventCallback } from './
|
|
30
|
+
import { EvClick, EventCallback } from './x4events';
|
|
31
31
|
interface LinkEventMap extends CEventMap {
|
|
32
32
|
click: EvClick;
|
|
33
33
|
}
|
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 {
|
|
@@ -53,7 +54,7 @@ function parseRoute(str, loose = false) {
|
|
|
53
54
|
const o = tmp.indexOf('?', 1);
|
|
54
55
|
const ext = tmp.indexOf('.', 1);
|
|
55
56
|
keys.push(tmp.substring(1, o >= 0 ? o : ext >= 0 ? ext : tmp.length));
|
|
56
|
-
pattern += o
|
|
57
|
+
pattern += o >= 0 && ext < 0 ? '(?:/([^\/]+?))?' : '/([^\/]+?)';
|
|
57
58
|
if (ext >= 0) {
|
|
58
59
|
pattern += (o >= 0 ? '?' : '') + '\\' + tmp.substring(ext);
|
|
59
60
|
}
|
|
@@ -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
|
}
|