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/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;
|
package/lib/tools.js
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.generatePassword = exports.classNames = exports.mix = exports.crc32 = exports.Clipboard = exports.isHtmlString = exports.html = exports.HtmlString = exports.clamp = exports.getMousePos = exports.NetworkError = exports.markdownToHtml = exports.asap = exports.deferCall = exports.waitFontLoading = exports.isNumber = exports.pad = exports.isLiteralObject = exports.isFunction = exports.isArray = exports.isString = exports.downloadData = exports.calcAge = exports.formatIntlDate = exports.parseIntlDate = exports.date_calc_weeknum = exports.date_clone = exports.date_hash = exports.date_sql_utc = exports.date_to_sql = exports.date_diff = exports.date_format = exports._date_set_locale = exports.removeHtmlTags = exports.escapeHtml = exports.sprintf = exports.Rect = exports.Size = exports.Point = exports.pascalCase = exports.parseIntlFloat = exports.roundTo = exports.isTouchDevice = void 0;
|
|
31
|
+
exports.generatePassword = exports.classNames = exports.mix = exports.crc32 = exports.Clipboard = exports.isHtmlString = exports.html = exports.HtmlString = exports.clamp = exports.getMousePos = exports.NetworkError = exports.markdownToHtml = exports.asap = exports.deferCall = exports.waitFontLoading = exports.isNumber = exports.pad = exports.isLiteralObject = exports.isFunction = exports.isArray = exports.isString = exports.downloadData = exports.calcAge = exports.formatIntlDate = exports.parseIntlDate = exports.date_calc_weeknum = exports.date_clone = exports.date_hash = exports.date_sql_utc = exports.date_to_sql = exports.date_diff = exports.date_format = exports._date_set_locale = exports.removeHtmlTags = exports.escapeHtml = exports.sprintf = exports.Rect = exports.Size = exports.Point = exports.camelCase = exports.pascalCase = exports.parseIntlFloat = exports.roundTo = exports.isTouchDevice = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const i18n_1 = require("./i18n"); // you MUST create a file named translation.js
|
|
33
34
|
// :: ENVIRONMENT ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
34
35
|
/**
|
|
@@ -90,6 +91,14 @@ function pascalCase(string) {
|
|
|
90
91
|
return result.replace(/ /g, '-');
|
|
91
92
|
}
|
|
92
93
|
exports.pascalCase = pascalCase;
|
|
94
|
+
function camelCase(text) {
|
|
95
|
+
let result = text.toLowerCase();
|
|
96
|
+
result = result.replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => {
|
|
97
|
+
return chr.toUpperCase();
|
|
98
|
+
});
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
exports.camelCase = camelCase;
|
|
93
102
|
class Point {
|
|
94
103
|
x;
|
|
95
104
|
y;
|
|
@@ -652,11 +661,11 @@ function downloadData(data, mimetype, filename) {
|
|
|
652
661
|
//}
|
|
653
662
|
let blob = new Blob([data], { type: mimetype });
|
|
654
663
|
let url = window.URL.createObjectURL(blob);
|
|
655
|
-
let a =
|
|
664
|
+
let a = x4dom_1.x4document.createElement("a");
|
|
656
665
|
a.style['display'] = "none";
|
|
657
666
|
a.href = url;
|
|
658
667
|
a.download = filename;
|
|
659
|
-
|
|
668
|
+
x4dom_1.x4document.body.appendChild(a);
|
|
660
669
|
a.click();
|
|
661
670
|
window.URL.revokeObjectURL(url);
|
|
662
671
|
}
|
|
@@ -733,20 +742,20 @@ function waitFontLoading(name) {
|
|
|
733
742
|
// we can remove the div.
|
|
734
743
|
// pitfall: if the font is already loaded, ne never end.
|
|
735
744
|
// @review that
|
|
736
|
-
let ct =
|
|
745
|
+
let ct = x4dom_1.x4document.createElement('div');
|
|
737
746
|
ct.style.position = 'absolute';
|
|
738
747
|
ct.style.fontFamily = name;
|
|
739
748
|
ct.style.fontSize = '44px';
|
|
740
749
|
ct.style.opacity = '0.001';
|
|
741
750
|
ct.innerText = 'X';
|
|
742
|
-
|
|
751
|
+
x4dom_1.x4document.body.appendChild(ct);
|
|
743
752
|
return new Promise((resolve) => {
|
|
744
753
|
let irc = ct.getBoundingClientRect();
|
|
745
754
|
let tm = setInterval(() => {
|
|
746
755
|
let nrc = ct.getBoundingClientRect();
|
|
747
756
|
if (nrc.height != irc.height) {
|
|
748
757
|
clearInterval(tm);
|
|
749
|
-
|
|
758
|
+
x4dom_1.x4document.body.removeChild(ct);
|
|
750
759
|
resolve();
|
|
751
760
|
}
|
|
752
761
|
}, 0);
|
package/lib/tooltips.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
**/
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.initTooltips = exports.Tooltip = void 0;
|
|
32
|
+
const x4dom_1 = require("./x4dom");
|
|
32
33
|
const component_1 = require("./component");
|
|
33
34
|
const label_1 = require("./label");
|
|
34
35
|
const icon_1 = require("./icon");
|
|
@@ -66,7 +67,7 @@ class Tooltip extends component_1.Component {
|
|
|
66
67
|
valign = 'b';
|
|
67
68
|
}
|
|
68
69
|
// @TODO: this is a minimal overflow problem solution
|
|
69
|
-
let rc =
|
|
70
|
+
let rc = x4dom_1.x4document.body.getBoundingClientRect(), rm = this.getBoundingRect();
|
|
70
71
|
if (halign == 'r') {
|
|
71
72
|
x -= rm.width;
|
|
72
73
|
}
|
|
@@ -135,7 +136,7 @@ function initTooltips(cb) {
|
|
|
135
136
|
tipTmo = setTimeout(() => {
|
|
136
137
|
if (tooltip === undefined) {
|
|
137
138
|
tooltip = new Tooltip({});
|
|
138
|
-
|
|
139
|
+
x4dom_1.x4document.body.appendChild(tooltip._build());
|
|
139
140
|
}
|
|
140
141
|
tooltip.text = tip;
|
|
141
142
|
tooltip.displayAt(tipTarget.x + 17, tipTarget.y + 17, 'top left');
|
|
@@ -150,8 +151,8 @@ function initTooltips(cb) {
|
|
|
150
151
|
tooltip.hide();
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
x4dom_1.x4document.body.addEventListener('mouseover', handle_mouse);
|
|
155
|
+
x4dom_1.x4document.body.addEventListener('mouseout', handle_mouse);
|
|
156
|
+
x4dom_1.x4document.body.addEventListener('mousemove', handle_mpos);
|
|
156
157
|
}
|
|
157
158
|
exports.initTooltips = initTooltips;
|
package/lib/treeview.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { Component, Container, ContainerEventMap, ContainerProps, EvDblClick, Ev
|
|
|
30
30
|
import { HtmlString } from './tools';
|
|
31
31
|
import { IconID } from './icon';
|
|
32
32
|
import { VLayout } from './layout';
|
|
33
|
-
import { EvClick, BasicEvent, EvDrag, EvSelectionChange, EvContextMenu } from './
|
|
33
|
+
import { EvClick, BasicEvent, EvDrag, EvSelectionChange, EvContextMenu } from './x4events';
|
|
34
34
|
export interface EvExpand extends BasicEvent {
|
|
35
35
|
node: TreeNode;
|
|
36
36
|
}
|
package/lib/treeview.js
CHANGED
|
@@ -33,9 +33,9 @@ const component_1 = require("./component");
|
|
|
33
33
|
const icon_1 = require("./icon");
|
|
34
34
|
const label_1 = require("./label");
|
|
35
35
|
const layout_1 = require("./layout");
|
|
36
|
-
const
|
|
36
|
+
const x4events_1 = require("./x4events");
|
|
37
37
|
function EvExpand(node) {
|
|
38
|
-
return (0,
|
|
38
|
+
return (0, x4events_1.BasicEvent)({ node });
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
*
|
|
@@ -127,7 +127,7 @@ class TreeView extends layout_1.VLayout {
|
|
|
127
127
|
for (let i = 0; i < ev.dataTransfer.items.length; i++) {
|
|
128
128
|
ev.dataTransfer.items[0].getAsString((value) => {
|
|
129
129
|
let data = JSON.parse(value);
|
|
130
|
-
this.emit('drag', (0,
|
|
130
|
+
this.emit('drag', (0, x4events_1.EvDrag)(node, data, parent));
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -346,14 +346,14 @@ class TreeView extends layout_1.VLayout {
|
|
|
346
346
|
this.selection = nd.id;
|
|
347
347
|
if (!onsub) {
|
|
348
348
|
if (ev.type == 'click') {
|
|
349
|
-
this.emit('click', (0,
|
|
349
|
+
this.emit('click', (0, x4events_1.EvClick)(nd));
|
|
350
350
|
}
|
|
351
351
|
else {
|
|
352
352
|
this.emit('dblclick', (0, component_1.EvDblClick)(nd));
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
this.emit('selectionchange', (0,
|
|
356
|
+
this.emit('selectionchange', (0, x4events_1.EvSelectionChange)(nd));
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
359
|
dom = dom.parentElement;
|
|
@@ -361,7 +361,7 @@ class TreeView extends layout_1.VLayout {
|
|
|
361
361
|
if (ev.type == 'click') {
|
|
362
362
|
this.m_selection = null;
|
|
363
363
|
this.update();
|
|
364
|
-
this.emit('selectionchange', (0,
|
|
364
|
+
this.emit('selectionchange', (0, x4events_1.EvSelectionChange)(null));
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
_handleCtxMenu(ev) {
|
|
@@ -380,14 +380,14 @@ class TreeView extends layout_1.VLayout {
|
|
|
380
380
|
}
|
|
381
381
|
this.m_selection = { id: nd.id, el: null };
|
|
382
382
|
this.update();
|
|
383
|
-
this.emit('contextMenu', (0,
|
|
383
|
+
this.emit('contextMenu', (0, x4events_1.EvContextMenu)(ev, nd));
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
386
|
dom = dom.parentElement;
|
|
387
387
|
}
|
|
388
388
|
this.m_selection = null;
|
|
389
389
|
this.update();
|
|
390
|
-
this.emit('contextMenu', (0,
|
|
390
|
+
this.emit('contextMenu', (0, x4events_1.EvContextMenu)(ev, null));
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
393
393
|
* constructs a tree node from an array of strings
|
package/lib/x4dom.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
interface IX4Document {
|
|
5
|
+
createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K];
|
|
6
|
+
createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element;
|
|
7
|
+
createTextNode(data: string): Text;
|
|
8
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
9
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
10
|
+
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
11
|
+
querySelector<E extends Element = Element>(selectors: string): E | null;
|
|
12
|
+
get body(): HTMLElement;
|
|
13
|
+
get activeElement(): Element;
|
|
14
|
+
get location(): Location;
|
|
15
|
+
get styleSheets(): StyleSheetList;
|
|
16
|
+
get head(): HTMLHeadElement;
|
|
17
|
+
get documentElement(): HTMLElement;
|
|
18
|
+
set title(title: string);
|
|
19
|
+
}
|
|
20
|
+
export declare let x4document: IX4Document;
|
|
21
|
+
export {};
|