x4js 1.4.3 → 1.4.6
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 +3 -2
- package/lib/application.js +15 -7
- package/lib/base64.js +5 -1
- package/lib/base_component.js +7 -3
- package/lib/button.js +24 -18
- package/lib/calendar.js +44 -39
- package/lib/canvas.js +9 -5
- package/lib/cardview.js +11 -7
- package/lib/checkbox.js +12 -8
- package/lib/color.js +7 -3
- package/lib/colorpicker.js +86 -80
- package/lib/combobox.js +26 -22
- package/lib/component.js +65 -48
- package/lib/datastore.js +29 -20
- package/lib/dialog.js +41 -36
- package/lib/dom_events.js +2 -1
- package/lib/drag_manager.js +4 -1
- package/lib/drawtext.js +9 -5
- package/lib/fileupload.js +19 -12
- package/lib/form.js +29 -25
- package/lib/formatters.js +19 -10
- package/lib/gridview.js +40 -35
- package/lib/hosts/host.js +7 -3
- package/lib/i18n.js +11 -5
- package/lib/icon.js +16 -11
- package/lib/image.js +7 -3
- package/lib/index.d.ts +55 -0
- package/lib/index.js +71 -56
- package/lib/input.js +6 -2
- package/lib/label.js +15 -11
- package/lib/layout.js +23 -13
- package/lib/link.js +9 -5
- package/lib/listview.js +34 -27
- package/lib/md5.js +5 -1
- package/lib/menu.js +27 -19
- package/lib/messagebox.js +22 -17
- package/lib/panel.js +13 -9
- package/lib/popup.js +25 -20
- package/lib/property_editor.js +20 -16
- package/lib/radiobtn.js +13 -9
- package/lib/rating.js +13 -9
- package/lib/request.js +16 -9
- package/lib/router.d.ts +1 -8
- package/lib/router.js +4 -0
- package/lib/settings.js +8 -4
- package/lib/sidebarview.js +12 -8
- package/lib/smartedit.js +16 -11
- package/lib/spreadsheet.js +35 -31
- package/lib/styles.js +15 -9
- package/lib/svgcomponent.js +8 -3
- package/lib/tabbar.js +10 -6
- package/lib/tabview.js +10 -6
- package/lib/textarea.js +10 -6
- package/lib/textedit.js +39 -35
- package/lib/texthiliter.js +8 -4
- package/lib/toaster.js +8 -4
- package/lib/tools.js +97 -51
- package/lib/tooltips.js +14 -9
- package/lib/treeview.js +30 -26
- package/lib/x4_events.js +21 -9
- package/package.json +2 -1
- package/src/application.ts +8 -4
- package/src/index.ts +55 -0
- package/src/router.ts +1 -1
- package/tsconfig.json +2 -1
- package/lib/list.txt +0 -56
- package/list.txt +0 -0
package/lib/label.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,15 +23,17 @@
|
|
|
22
23
|
*
|
|
23
24
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
25
|
**/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Label = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const tools_1 = require("./tools");
|
|
30
|
+
const icon_1 = require("./icon");
|
|
28
31
|
/**
|
|
29
32
|
* Standard label
|
|
30
33
|
*/
|
|
31
|
-
|
|
34
|
+
class Label extends component_1.Component {
|
|
32
35
|
constructor(param) {
|
|
33
|
-
if (typeof (param) === 'string' || param instanceof HtmlString) {
|
|
36
|
+
if (typeof (param) === 'string' || param instanceof tools_1.HtmlString) {
|
|
34
37
|
super({ text: param });
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
@@ -40,8 +43,8 @@ export class Label extends Component {
|
|
|
40
43
|
/** @ignore */
|
|
41
44
|
render(props) {
|
|
42
45
|
let text = this.m_props.text;
|
|
43
|
-
if (this.m_props.multiline && !(text instanceof HtmlString)) {
|
|
44
|
-
text = new HtmlString(text.replace(/\n/g, '<br/>'));
|
|
46
|
+
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
47
|
+
text = new tools_1.HtmlString(text.replace(/\n/g, '<br/>'));
|
|
45
48
|
}
|
|
46
49
|
if (!props.icon) {
|
|
47
50
|
this.setContent(text);
|
|
@@ -50,8 +53,8 @@ export class Label extends Component {
|
|
|
50
53
|
this.setProp('tag', 'span');
|
|
51
54
|
this.addClass('@hlayout');
|
|
52
55
|
this.setContent([
|
|
53
|
-
new Icon({ icon: props.icon }),
|
|
54
|
-
new Component({ content: text, ref: 'text' })
|
|
56
|
+
new icon_1.Icon({ icon: props.icon }),
|
|
57
|
+
new component_1.Component({ content: text, ref: 'text' })
|
|
55
58
|
]);
|
|
56
59
|
}
|
|
57
60
|
this.addClass(props.align ?? 'left');
|
|
@@ -65,8 +68,8 @@ export class Label extends Component {
|
|
|
65
68
|
if (props.text !== txt) {
|
|
66
69
|
props.text = txt;
|
|
67
70
|
let text = this.m_props.text;
|
|
68
|
-
if (this.m_props.multiline && !(text instanceof HtmlString)) {
|
|
69
|
-
text = new HtmlString(text.replace('/\n/g', '<br/>'));
|
|
71
|
+
if (this.m_props.multiline && !(text instanceof tools_1.HtmlString)) {
|
|
72
|
+
text = new tools_1.HtmlString(text.replace('/\n/g', '<br/>'));
|
|
70
73
|
}
|
|
71
74
|
if (this.dom) {
|
|
72
75
|
let comp = this;
|
|
@@ -84,3 +87,4 @@ export class Label extends Component {
|
|
|
84
87
|
return this.m_props.text;
|
|
85
88
|
}
|
|
86
89
|
}
|
|
90
|
+
exports.Label = Label;
|
package/lib/layout.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,24 +23,29 @@
|
|
|
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
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ScrollView = exports.TableLayout = exports.GridLayout = exports.AutoLayout = exports.VLayout = exports.HLayout = exports.AbsLayout = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const tools_1 = require("./tools");
|
|
27
30
|
// ============================================================================
|
|
28
31
|
// [ABSLAYOUT]
|
|
29
32
|
// ============================================================================
|
|
30
|
-
|
|
33
|
+
class AbsLayout extends component_1.Container {
|
|
31
34
|
}
|
|
35
|
+
exports.AbsLayout = AbsLayout;
|
|
32
36
|
// ============================================================================
|
|
33
37
|
// [HLAYOUT]
|
|
34
38
|
// ============================================================================
|
|
35
|
-
|
|
39
|
+
class HLayout extends component_1.Container {
|
|
36
40
|
}
|
|
41
|
+
exports.HLayout = HLayout;
|
|
37
42
|
// ============================================================================
|
|
38
43
|
// [VLAYOUT]
|
|
39
44
|
// ============================================================================
|
|
40
|
-
|
|
45
|
+
class VLayout extends component_1.Container {
|
|
41
46
|
}
|
|
42
|
-
|
|
47
|
+
exports.VLayout = VLayout;
|
|
48
|
+
class AutoLayout extends component_1.Container {
|
|
43
49
|
constructor(props) {
|
|
44
50
|
super(props);
|
|
45
51
|
this.setDomEvent('sizechange', () => this._updateLayout());
|
|
@@ -69,7 +75,8 @@ export class AutoLayout extends Container {
|
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
exports.AutoLayout = AutoLayout;
|
|
79
|
+
class GridLayout extends component_1.Container {
|
|
73
80
|
constructor(props) {
|
|
74
81
|
/// @ts-ignore
|
|
75
82
|
// Argument of type 'GridLayoutProps' is not assignable to parameter of type 'P'.
|
|
@@ -92,7 +99,8 @@ export class GridLayout extends Container {
|
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
|
-
|
|
102
|
+
exports.GridLayout = GridLayout;
|
|
103
|
+
class TableLayout extends component_1.Container {
|
|
96
104
|
m_cells;
|
|
97
105
|
constructor(props) {
|
|
98
106
|
super(props);
|
|
@@ -107,7 +115,7 @@ export class TableLayout extends Container {
|
|
|
107
115
|
let idx = _mkid(row, col);
|
|
108
116
|
this.m_cells.set(idx, cell);
|
|
109
117
|
if (this.dom && cell.item && update) {
|
|
110
|
-
if (cell.item instanceof Component) {
|
|
118
|
+
if (cell.item instanceof component_1.Component) {
|
|
111
119
|
cell.item.update();
|
|
112
120
|
}
|
|
113
121
|
else {
|
|
@@ -184,7 +192,7 @@ export class TableLayout extends Container {
|
|
|
184
192
|
if (cdata && cdata.cls) {
|
|
185
193
|
cls += ' ' + cdata.cls;
|
|
186
194
|
}
|
|
187
|
-
let cc = new Component({
|
|
195
|
+
let cc = new component_1.Component({
|
|
188
196
|
tag: 'td',
|
|
189
197
|
content: cell?.item,
|
|
190
198
|
width: cell?.width,
|
|
@@ -211,7 +219,7 @@ export class TableLayout extends Container {
|
|
|
211
219
|
cols.push(cc);
|
|
212
220
|
}
|
|
213
221
|
let rdata = this._getCell(r, 999, false);
|
|
214
|
-
let rr = new Component({
|
|
222
|
+
let rr = new component_1.Component({
|
|
215
223
|
tag: 'tr',
|
|
216
224
|
data: { row: r },
|
|
217
225
|
content: cols,
|
|
@@ -222,6 +230,7 @@ export class TableLayout extends Container {
|
|
|
222
230
|
this.setContent(rows);
|
|
223
231
|
}
|
|
224
232
|
}
|
|
233
|
+
exports.TableLayout = TableLayout;
|
|
225
234
|
/**
|
|
226
235
|
* @ignore
|
|
227
236
|
*/
|
|
@@ -237,7 +246,7 @@ function _getid(key) {
|
|
|
237
246
|
col: (key % 1000) | 0
|
|
238
247
|
};
|
|
239
248
|
}
|
|
240
|
-
|
|
249
|
+
class ScrollView extends component_1.Component {
|
|
241
250
|
constructor(props) {
|
|
242
251
|
super(props);
|
|
243
252
|
this.setContent(props.content);
|
|
@@ -248,7 +257,7 @@ export class ScrollView extends Component {
|
|
|
248
257
|
}
|
|
249
258
|
else {
|
|
250
259
|
let container;
|
|
251
|
-
if (isArray(content)) {
|
|
260
|
+
if ((0, tools_1.isArray)(content)) {
|
|
252
261
|
container = new VLayout({ content });
|
|
253
262
|
}
|
|
254
263
|
else {
|
|
@@ -259,3 +268,4 @@ export class ScrollView extends Component {
|
|
|
259
268
|
}
|
|
260
269
|
}
|
|
261
270
|
}
|
|
271
|
+
exports.ScrollView = ScrollView;
|
package/lib/link.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \/ / / _
|
|
@@ -22,19 +23,21 @@
|
|
|
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
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Link = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const x4_events_1 = require("./x4_events");
|
|
27
30
|
/**
|
|
28
31
|
* Standard Link
|
|
29
32
|
*/
|
|
30
|
-
|
|
33
|
+
class Link extends component_1.Component {
|
|
31
34
|
constructor(props) {
|
|
32
35
|
super(props);
|
|
33
36
|
this.setDomEvent('click', () => this._handleClick());
|
|
34
37
|
this.mapPropEvents(props, 'click');
|
|
35
38
|
}
|
|
36
39
|
_handleClick() {
|
|
37
|
-
this.emit('click', EvClick());
|
|
40
|
+
this.emit('click', (0, x4_events_1.EvClick)());
|
|
38
41
|
}
|
|
39
42
|
/** @ignore */
|
|
40
43
|
render(props) {
|
|
@@ -45,7 +48,7 @@ export class Link extends Component {
|
|
|
45
48
|
this.setAttribute('href', href);
|
|
46
49
|
this.setAttribute('target', props.target);
|
|
47
50
|
if (text) {
|
|
48
|
-
this.setContent(isHtmlString(text) ? text : html `<span>${text}</span>`);
|
|
51
|
+
this.setContent((0, component_1.isHtmlString)(text) ? text : (0, component_1.html) `<span>${text}</span>`);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
set text(text) {
|
|
@@ -53,3 +56,4 @@ export class Link extends Component {
|
|
|
53
56
|
this.update();
|
|
54
57
|
}
|
|
55
58
|
}
|
|
59
|
+
exports.Link = Link;
|
package/lib/listview.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \_/ / / _
|
|
@@ -22,27 +23,30 @@
|
|
|
22
23
|
*
|
|
23
24
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
25
|
**/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.PopupListView = exports.EvCancel = exports.ListView = exports.ListViewItem = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const layout_1 = require("./layout");
|
|
30
|
+
const popup_1 = require("./popup");
|
|
31
|
+
const tools_1 = require("./tools");
|
|
32
|
+
const menu_1 = require("./menu");
|
|
33
|
+
const x4_events_1 = require("./x4_events");
|
|
31
34
|
/**
|
|
32
35
|
* item definition
|
|
33
36
|
*/
|
|
34
|
-
|
|
37
|
+
class ListViewItem {
|
|
35
38
|
id;
|
|
36
39
|
text; // if you need pure text
|
|
37
40
|
html; // if text is html
|
|
38
41
|
icon;
|
|
39
42
|
data;
|
|
40
43
|
}
|
|
44
|
+
exports.ListViewItem = ListViewItem;
|
|
41
45
|
;
|
|
42
46
|
/**
|
|
43
47
|
* Standard listview class
|
|
44
48
|
*/
|
|
45
|
-
|
|
49
|
+
class ListView extends layout_1.VLayout {
|
|
46
50
|
m_selection;
|
|
47
51
|
m_defer_sel;
|
|
48
52
|
m_container;
|
|
@@ -115,7 +119,7 @@ export class ListView extends VLayout {
|
|
|
115
119
|
_handleKey(ev) {
|
|
116
120
|
let moveSel = (sens) => {
|
|
117
121
|
let items;
|
|
118
|
-
if (isFunction(this.m_props.items)) {
|
|
122
|
+
if ((0, tools_1.isFunction)(this.m_props.items)) {
|
|
119
123
|
items = this.m_props.items();
|
|
120
124
|
this.m_props.items = items;
|
|
121
125
|
}
|
|
@@ -160,11 +164,11 @@ export class ListView extends VLayout {
|
|
|
160
164
|
_buildContent() {
|
|
161
165
|
let props = this.m_props;
|
|
162
166
|
if (props.virtual) {
|
|
163
|
-
this.m_container = new Container({
|
|
167
|
+
this.m_container = new component_1.Container({
|
|
164
168
|
cls: '@scroll-container',
|
|
165
169
|
content: []
|
|
166
170
|
});
|
|
167
|
-
this.m_view = new Container({
|
|
171
|
+
this.m_view = new component_1.Container({
|
|
168
172
|
cls: '@scroll-view',
|
|
169
173
|
flex: 1,
|
|
170
174
|
content: this.m_container,
|
|
@@ -175,7 +179,7 @@ export class ListView extends VLayout {
|
|
|
175
179
|
});
|
|
176
180
|
this.setContent([
|
|
177
181
|
this.m_view,
|
|
178
|
-
props.gadgets ? new HLayout({
|
|
182
|
+
props.gadgets ? new layout_1.HLayout({
|
|
179
183
|
cls: 'gadgets',
|
|
180
184
|
content: props.gadgets
|
|
181
185
|
}) : null,
|
|
@@ -183,7 +187,7 @@ export class ListView extends VLayout {
|
|
|
183
187
|
}
|
|
184
188
|
else {
|
|
185
189
|
this.m_view = undefined;
|
|
186
|
-
this.m_container = new VLayout({
|
|
190
|
+
this.m_container = new layout_1.VLayout({
|
|
187
191
|
cls: '@scroll-container',
|
|
188
192
|
content: []
|
|
189
193
|
});
|
|
@@ -219,7 +223,7 @@ export class ListView extends VLayout {
|
|
|
219
223
|
let props = this.m_props;
|
|
220
224
|
let items = [];
|
|
221
225
|
let list_items = props.items;
|
|
222
|
-
if (isFunction(list_items)) {
|
|
226
|
+
if ((0, tools_1.isFunction)(list_items)) {
|
|
223
227
|
list_items = list_items();
|
|
224
228
|
}
|
|
225
229
|
let selId = this.m_selection?.item.id;
|
|
@@ -305,7 +309,7 @@ export class ListView extends VLayout {
|
|
|
305
309
|
return this.m_props.renderItem(item);
|
|
306
310
|
}
|
|
307
311
|
else {
|
|
308
|
-
return new HLayout({ content: item.text });
|
|
312
|
+
return new layout_1.HLayout({ content: item.text });
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
315
|
/** @ignore */
|
|
@@ -313,18 +317,18 @@ export class ListView extends VLayout {
|
|
|
313
317
|
let dom = e.target, self = this.dom, list_items = this.m_props.items; // already created by build
|
|
314
318
|
// go up until we find something interesting
|
|
315
319
|
while (dom && dom != self) {
|
|
316
|
-
let itm = Component.getElement(dom), id = itm?.getData('item-id');
|
|
320
|
+
let itm = component_1.Component.getElement(dom), id = itm?.getData('item-id');
|
|
317
321
|
if (id !== undefined) {
|
|
318
322
|
// find the element
|
|
319
323
|
let item = list_items.find((item) => item.id == id);
|
|
320
324
|
if (item) {
|
|
321
325
|
let event;
|
|
322
326
|
if (e.type == 'click') {
|
|
323
|
-
event = EvClick(item);
|
|
327
|
+
event = (0, x4_events_1.EvClick)(item);
|
|
324
328
|
this.emit('click', event);
|
|
325
329
|
}
|
|
326
330
|
else {
|
|
327
|
-
event = EvDblClick(item);
|
|
331
|
+
event = (0, component_1.EvDblClick)(item);
|
|
328
332
|
this.emit('dblClick', event);
|
|
329
333
|
}
|
|
330
334
|
if (!event.defaultPrevented) {
|
|
@@ -345,19 +349,19 @@ export class ListView extends VLayout {
|
|
|
345
349
|
e.preventDefault();
|
|
346
350
|
let dom = e.target, self = this.dom, list_items = this.m_props.items; // already created by build;
|
|
347
351
|
while (dom && dom != self) {
|
|
348
|
-
let itm = Component.getElement(dom), id = itm?.getData('item-id');
|
|
352
|
+
let itm = component_1.Component.getElement(dom), id = itm?.getData('item-id');
|
|
349
353
|
if (id) {
|
|
350
354
|
// find the element
|
|
351
355
|
let item = list_items.find((item) => item.id == id);
|
|
352
356
|
if (item) {
|
|
353
357
|
this._selectItem(item, itm);
|
|
354
|
-
this.emit('contextMenu', EvContextMenu(e, item));
|
|
358
|
+
this.emit('contextMenu', (0, x4_events_1.EvContextMenu)(e, item));
|
|
355
359
|
}
|
|
356
360
|
return;
|
|
357
361
|
}
|
|
358
362
|
dom = dom.parentElement;
|
|
359
363
|
}
|
|
360
|
-
this.emit('contextMenu', EvContextMenu(e, null));
|
|
364
|
+
this.emit('contextMenu', (0, x4_events_1.EvContextMenu)(e, null));
|
|
361
365
|
}
|
|
362
366
|
/**
|
|
363
367
|
* @ignore
|
|
@@ -375,7 +379,7 @@ export class ListView extends VLayout {
|
|
|
375
379
|
this.m_selection.citem.addClass('@selected');
|
|
376
380
|
}
|
|
377
381
|
if (notify) {
|
|
378
|
-
this.emit('selectionChange', EvSelectionChange(item));
|
|
382
|
+
this.emit('selectionChange', (0, x4_events_1.EvSelectionChange)(item));
|
|
379
383
|
}
|
|
380
384
|
}
|
|
381
385
|
/**
|
|
@@ -389,7 +393,7 @@ export class ListView extends VLayout {
|
|
|
389
393
|
this._selectItem(null, null);
|
|
390
394
|
}
|
|
391
395
|
else {
|
|
392
|
-
if (isFunction(this.m_props.items)) {
|
|
396
|
+
if ((0, tools_1.isFunction)(this.m_props.items)) {
|
|
393
397
|
this.m_defer_sel = id;
|
|
394
398
|
}
|
|
395
399
|
else {
|
|
@@ -470,13 +474,15 @@ export class ListView extends VLayout {
|
|
|
470
474
|
}
|
|
471
475
|
}
|
|
472
476
|
}
|
|
473
|
-
|
|
474
|
-
|
|
477
|
+
exports.ListView = ListView;
|
|
478
|
+
function EvCancel(context = null) {
|
|
479
|
+
return (0, x4_events_1.BasicEvent)({ context });
|
|
475
480
|
}
|
|
481
|
+
exports.EvCancel = EvCancel;
|
|
476
482
|
/**
|
|
477
483
|
*
|
|
478
484
|
*/
|
|
479
|
-
|
|
485
|
+
class PopupListView extends popup_1.Popup {
|
|
480
486
|
m_list;
|
|
481
487
|
constructor(props) {
|
|
482
488
|
super({ tabIndex: false });
|
|
@@ -502,7 +508,7 @@ export class PopupListView extends Popup {
|
|
|
502
508
|
return;
|
|
503
509
|
}
|
|
504
510
|
// menu: ok
|
|
505
|
-
let dest = Component.getElement(newfocus, MenuItem);
|
|
511
|
+
let dest = component_1.Component.getElement(newfocus, menu_1.MenuItem);
|
|
506
512
|
if (dest) {
|
|
507
513
|
return;
|
|
508
514
|
}
|
|
@@ -530,3 +536,4 @@ export class PopupListView extends Popup {
|
|
|
530
536
|
this.m_list.selection = itemId;
|
|
531
537
|
}
|
|
532
538
|
}
|
|
539
|
+
exports.PopupListView = PopupListView;
|
package/lib/md5.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \_/ / / _
|
|
@@ -22,6 +23,8 @@
|
|
|
22
23
|
*
|
|
23
24
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
24
25
|
**/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Md5 = void 0;
|
|
25
28
|
/*
|
|
26
29
|
TypeScript Md5
|
|
27
30
|
==============
|
|
@@ -48,7 +51,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
48
51
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
49
52
|
THE SOFTWARE.
|
|
50
53
|
*/
|
|
51
|
-
|
|
54
|
+
class Md5 {
|
|
52
55
|
static hashStr(str, raw = false) {
|
|
53
56
|
return this.onePassHasher
|
|
54
57
|
.start()
|
|
@@ -390,6 +393,7 @@ export class Md5 {
|
|
|
390
393
|
return raw ? this._state : Md5._hex(this._state);
|
|
391
394
|
}
|
|
392
395
|
}
|
|
396
|
+
exports.Md5 = Md5;
|
|
393
397
|
/*
|
|
394
398
|
if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') {
|
|
395
399
|
console.error('Md5 self test failed.');
|
package/lib/menu.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \_/ / / _
|
|
@@ -22,21 +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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.MenuBar = exports.MenuItem = exports.Menu = exports.MenuTitle = exports.MenuSeparator = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const x4_events_1 = require("./x4_events");
|
|
30
|
+
const popup_1 = require("./popup");
|
|
31
|
+
const icon_1 = require("./icon");
|
|
32
|
+
const label_1 = require("./label");
|
|
33
|
+
const layout_1 = require("./layout");
|
|
34
|
+
const tools_1 = require("./tools");
|
|
32
35
|
// ============================================================================
|
|
33
36
|
// [MENU]
|
|
34
37
|
// ============================================================================
|
|
35
|
-
|
|
38
|
+
class MenuSeparator extends component_1.Component {
|
|
36
39
|
}
|
|
37
|
-
|
|
40
|
+
exports.MenuSeparator = MenuSeparator;
|
|
41
|
+
class MenuTitle extends label_1.Label {
|
|
38
42
|
}
|
|
39
|
-
|
|
43
|
+
exports.MenuTitle = MenuTitle;
|
|
44
|
+
class Menu extends popup_1.Popup {
|
|
40
45
|
static watchCount = 0;
|
|
41
46
|
static rootMenu = null;
|
|
42
47
|
m_subMenu;
|
|
@@ -129,7 +134,7 @@ export class Menu extends Popup {
|
|
|
129
134
|
let elOn = ev.target;
|
|
130
135
|
while (elOn) {
|
|
131
136
|
// is mouse on a menu
|
|
132
|
-
let mouseon = Component.getElement(elOn);
|
|
137
|
+
let mouseon = component_1.Component.getElement(elOn);
|
|
133
138
|
if (mouseon && (mouseon instanceof Menu /*|| elOn.$el instanceof Menubar*/)) {
|
|
134
139
|
return;
|
|
135
140
|
}
|
|
@@ -152,7 +157,7 @@ export class Menu extends Popup {
|
|
|
152
157
|
}
|
|
153
158
|
let x, y, align, offset;
|
|
154
159
|
if (args.length == 1) {
|
|
155
|
-
({ x, y } = getMousePos(args[0], true));
|
|
160
|
+
({ x, y } = (0, tools_1.getMousePos)(args[0], true));
|
|
156
161
|
}
|
|
157
162
|
else {
|
|
158
163
|
[x, y, align, offset] = args;
|
|
@@ -163,11 +168,12 @@ export class Menu extends Popup {
|
|
|
163
168
|
super.displayAt(x, y, align, offset);
|
|
164
169
|
}
|
|
165
170
|
}
|
|
166
|
-
|
|
171
|
+
exports.Menu = Menu;
|
|
172
|
+
class MenuItem extends component_1.Component {
|
|
167
173
|
m_menu;
|
|
168
174
|
m_isOpen;
|
|
169
175
|
constructor(a, b) {
|
|
170
|
-
if (isString(a)) {
|
|
176
|
+
if ((0, tools_1.isString)(a)) {
|
|
171
177
|
super({
|
|
172
178
|
text: a,
|
|
173
179
|
click: b
|
|
@@ -202,8 +208,8 @@ export class MenuItem extends Component {
|
|
|
202
208
|
//@bug: do not kill focus on click
|
|
203
209
|
// this.setAttribute( 'tabindex', '0' );
|
|
204
210
|
this.setContent([
|
|
205
|
-
icon < 0 ? null : new Icon({ icon }),
|
|
206
|
-
new Label({ flex: 1, text })
|
|
211
|
+
icon < 0 ? null : new icon_1.Icon({ icon }),
|
|
212
|
+
new label_1.Label({ flex: 1, text })
|
|
207
213
|
]);
|
|
208
214
|
}
|
|
209
215
|
get id() {
|
|
@@ -221,7 +227,7 @@ export class MenuItem extends Component {
|
|
|
221
227
|
}
|
|
222
228
|
_click(ev) {
|
|
223
229
|
if (!this.isPopup) {
|
|
224
|
-
this.emit('click', EvClick());
|
|
230
|
+
this.emit('click', (0, x4_events_1.EvClick)());
|
|
225
231
|
Menu._discardAll();
|
|
226
232
|
}
|
|
227
233
|
}
|
|
@@ -232,7 +238,7 @@ export class MenuItem extends Component {
|
|
|
232
238
|
}
|
|
233
239
|
let doClose = this.m_isOpen;
|
|
234
240
|
// if parent menu has an opened sub menu, close it
|
|
235
|
-
let parent_menu = Component.getElement(this.dom, Menu);
|
|
241
|
+
let parent_menu = component_1.Component.getElement(this.dom, Menu);
|
|
236
242
|
if (parent_menu) {
|
|
237
243
|
parent_menu.hideSubMenu();
|
|
238
244
|
}
|
|
@@ -258,10 +264,11 @@ export class MenuItem extends Component {
|
|
|
258
264
|
}
|
|
259
265
|
}
|
|
260
266
|
}
|
|
267
|
+
exports.MenuItem = MenuItem;
|
|
261
268
|
/**
|
|
262
269
|
*
|
|
263
270
|
*/
|
|
264
|
-
|
|
271
|
+
class MenuBar extends layout_1.HLayout {
|
|
265
272
|
m_items;
|
|
266
273
|
constructor(props, opener) {
|
|
267
274
|
super(props);
|
|
@@ -274,3 +281,4 @@ export class MenuBar extends HLayout {
|
|
|
274
281
|
this.setContent(this.m_items);
|
|
275
282
|
}
|
|
276
283
|
}
|
|
284
|
+
exports.MenuBar = MenuBar;
|
package/lib/messagebox.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.PromptDialogBox = exports.MessageBox = void 0;
|
|
28
|
+
const dialog_1 = require("./dialog");
|
|
29
|
+
const tools_1 = require("./tools");
|
|
30
|
+
const layout_1 = require("./layout");
|
|
31
|
+
const icon_1 = require("./icon");
|
|
32
|
+
const label_1 = require("./label");
|
|
33
|
+
const textedit_1 = require("./textedit");
|
|
34
|
+
class MessageBox extends dialog_1.Dialog {
|
|
32
35
|
m_label;
|
|
33
36
|
constructor(props) {
|
|
34
37
|
// remove overloaded elements from DialogBoxProps
|
|
@@ -38,11 +41,11 @@ export class MessageBox extends Dialog {
|
|
|
38
41
|
props.buttons = undefined;
|
|
39
42
|
super(props);
|
|
40
43
|
let msg = props.message;
|
|
41
|
-
this.form.updateContent(new HLayout({
|
|
44
|
+
this.form.updateContent(new layout_1.HLayout({
|
|
42
45
|
style: { padding: 8 },
|
|
43
46
|
content: [
|
|
44
|
-
new Icon({ cls: 'icon', icon }),
|
|
45
|
-
this.m_label = new Label({ cls: 'text', text: msg, multiline: true })
|
|
47
|
+
new icon_1.Icon({ cls: 'icon', icon }),
|
|
48
|
+
this.m_label = new label_1.Label({ cls: 'text', text: msg, multiline: true })
|
|
46
49
|
]
|
|
47
50
|
}), buttons);
|
|
48
51
|
this.on('btnClick', (ev) => {
|
|
@@ -50,7 +53,7 @@ export class MessageBox extends Dialog {
|
|
|
50
53
|
if (!this.m_props.click) {
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
asap(() => {
|
|
56
|
+
(0, tools_1.asap)(() => {
|
|
54
57
|
this.m_props.click(ev.button);
|
|
55
58
|
});
|
|
56
59
|
});
|
|
@@ -63,7 +66,7 @@ export class MessageBox extends Dialog {
|
|
|
63
66
|
*/
|
|
64
67
|
static show(props) {
|
|
65
68
|
let msg;
|
|
66
|
-
if (isString(props) || isHtmlString(props)) {
|
|
69
|
+
if ((0, tools_1.isString)(props) || (0, tools_1.isHtmlString)(props)) {
|
|
67
70
|
msg = new MessageBox({ message: props, click: () => { } });
|
|
68
71
|
}
|
|
69
72
|
else {
|
|
@@ -85,7 +88,8 @@ export class MessageBox extends Dialog {
|
|
|
85
88
|
}).show();
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
exports.MessageBox = MessageBox;
|
|
92
|
+
class PromptDialogBox extends dialog_1.Dialog {
|
|
89
93
|
m_edit;
|
|
90
94
|
constructor(props) {
|
|
91
95
|
// remove overloaded elements from DialogBoxProps
|
|
@@ -94,14 +98,14 @@ export class PromptDialogBox extends Dialog {
|
|
|
94
98
|
props.buttons = undefined;
|
|
95
99
|
props.width = props.width ?? 500;
|
|
96
100
|
super(props);
|
|
97
|
-
this.form.updateContent(new HLayout({
|
|
101
|
+
this.form.updateContent(new layout_1.HLayout({
|
|
98
102
|
cls: 'panel',
|
|
99
103
|
content: [
|
|
100
104
|
//icon ? new Icon({
|
|
101
105
|
// cls: 'icon',
|
|
102
106
|
// icon: icon
|
|
103
107
|
//}) : null,
|
|
104
|
-
this.m_edit = new TextEdit({
|
|
108
|
+
this.m_edit = new textedit_1.TextEdit({
|
|
105
109
|
flex: 1,
|
|
106
110
|
autoFocus: true,
|
|
107
111
|
label: props.message,
|
|
@@ -114,7 +118,7 @@ export class PromptDialogBox extends Dialog {
|
|
|
114
118
|
if (ev.button === 'ok') {
|
|
115
119
|
// no prevent default -> always close the messagebox
|
|
116
120
|
// asap to allow
|
|
117
|
-
asap(() => {
|
|
121
|
+
(0, tools_1.asap)(() => {
|
|
118
122
|
this.m_props.click(this.m_edit.value);
|
|
119
123
|
});
|
|
120
124
|
}
|
|
@@ -129,7 +133,7 @@ export class PromptDialogBox extends Dialog {
|
|
|
129
133
|
*/
|
|
130
134
|
static show(props, inputCallback) {
|
|
131
135
|
let msg;
|
|
132
|
-
if (isString(props) || isHtmlString(props)) {
|
|
136
|
+
if ((0, tools_1.isString)(props) || (0, tools_1.isHtmlString)(props)) {
|
|
133
137
|
msg = new PromptDialogBox({ message: props, click: inputCallback });
|
|
134
138
|
}
|
|
135
139
|
else {
|
|
@@ -139,3 +143,4 @@ export class PromptDialogBox extends Dialog {
|
|
|
139
143
|
return msg;
|
|
140
144
|
}
|
|
141
145
|
}
|
|
146
|
+
exports.PromptDialogBox = PromptDialogBox;
|