x4js 1.5.15 → 1.5.17
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/cjs/app_sockets.js +74 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/treeview.js +19 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/app_sockets.js +70 -0
- package/lib/esm/index.mjs +1 -0
- package/lib/esm/treeview.js +19 -0
- package/lib/esm/version.js +1 -1
- package/lib/{src/version.ts → types/app_sockets.d.ts} +29 -30
- package/lib/types/index.d.ts +1 -0
- package/lib/types/treeview.d.ts +8 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/lib/src/MIT-license.md +0 -14
- package/lib/src/action.ts +0 -88
- package/lib/src/alpha.jpg +0 -0
- package/lib/src/application.ts +0 -251
- package/lib/src/autocomplete.ts +0 -197
- package/lib/src/base64.ts +0 -166
- package/lib/src/base_component.ts +0 -152
- package/lib/src/button.ts +0 -355
- package/lib/src/calendar.ts +0 -328
- package/lib/src/canvas.ts +0 -505
- package/lib/src/cardview.ts +0 -227
- package/lib/src/checkbox.ts +0 -188
- package/lib/src/color.ts +0 -752
- package/lib/src/colorpicker.ts +0 -1639
- package/lib/src/combobox.ts +0 -465
- package/lib/src/component.ts +0 -2329
- package/lib/src/datastore.ts +0 -1322
- package/lib/src/dialog.ts +0 -656
- package/lib/src/dom_events.ts +0 -315
- package/lib/src/drag_manager.ts +0 -199
- package/lib/src/drawtext.ts +0 -355
- package/lib/src/fileupload.ts +0 -213
- package/lib/src/form.ts +0 -375
- package/lib/src/formatters.ts +0 -105
- package/lib/src/gridview.ts +0 -1185
- package/lib/src/i18n.ts +0 -346
- package/lib/src/icon.ts +0 -335
- package/lib/src/image.ts +0 -204
- package/lib/src/index.ts +0 -88
- package/lib/src/input.ts +0 -249
- package/lib/src/label.ts +0 -128
- package/lib/src/layout.ts +0 -430
- package/lib/src/link.ts +0 -86
- package/lib/src/listview.ts +0 -765
- package/lib/src/md5.ts +0 -438
- package/lib/src/menu.ts +0 -425
- package/lib/src/messagebox.ts +0 -224
- package/lib/src/panel.ts +0 -86
- package/lib/src/popup.ts +0 -494
- package/lib/src/property_editor.ts +0 -337
- package/lib/src/radiobtn.ts +0 -197
- package/lib/src/rating.ts +0 -135
- package/lib/src/request.ts +0 -300
- package/lib/src/router.ts +0 -185
- package/lib/src/settings.ts +0 -77
- package/lib/src/sidebarview.ts +0 -103
- package/lib/src/spreadsheet.ts +0 -1449
- package/lib/src/styles.ts +0 -343
- package/lib/src/svgcomponent.ts +0 -577
- package/lib/src/tabbar.ts +0 -151
- package/lib/src/tabview.ts +0 -110
- package/lib/src/textarea.ts +0 -235
- package/lib/src/textedit.ts +0 -544
- package/lib/src/toaster.ts +0 -80
- package/lib/src/tools.ts +0 -1473
- package/lib/src/tooltips.ts +0 -191
- package/lib/src/treeview.ts +0 -693
- package/lib/src/x4.less +0 -2243
- package/lib/src/x4dom.ts +0 -57
- package/lib/src/x4events.ts +0 -585
- package/lib/src/x4react.ts +0 -90
- package/lib/x4.css +0 -1780
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ___ ___ __
|
|
4
|
+
* \ \/ / / _
|
|
5
|
+
* \ / /_| |_
|
|
6
|
+
* / \____ _|
|
|
7
|
+
* /__/\__\ |_|
|
|
8
|
+
*
|
|
9
|
+
* @file app_sockets.ts
|
|
10
|
+
* @author Etienne Cochard
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
* in the Software without restriction, including without limitation the rights
|
|
17
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
18
|
+
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
19
|
+
* subject to the following conditions:
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all copies
|
|
21
|
+
* or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
24
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
25
|
+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
26
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
28
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
+
**/
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.setupWSMessaging = void 0;
|
|
32
|
+
const application_1 = require("./application");
|
|
33
|
+
/**
|
|
34
|
+
* WEB SOCKETS
|
|
35
|
+
*
|
|
36
|
+
* les messages reçus par l'application sont retransmis au websocket.
|
|
37
|
+
* comme ça, tous les clients connectés sur le serveur recevront une copie du message.
|
|
38
|
+
* ca permet de mettre a jour les clients dynamiquement
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
const msg_sent = Symbol('msg_sent');
|
|
42
|
+
function setupWSMessaging(closeCB) {
|
|
43
|
+
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
|
44
|
+
const sockets = new WebSocket(`${protocol}${window.location.hostname}:${window.location.port}`, 'messaging');
|
|
45
|
+
const app = application_1.Application.instance();
|
|
46
|
+
// pour tous les messages recus par l'application
|
|
47
|
+
// on transmet aux autres
|
|
48
|
+
app.on('global', (e) => {
|
|
49
|
+
if (e[msg_sent]) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
sockets.send(JSON.stringify({
|
|
53
|
+
msg: e.msg,
|
|
54
|
+
params: e.params,
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
// reception d'un message
|
|
58
|
+
sockets.onmessage = (e) => {
|
|
59
|
+
if (e.data != 'ping') {
|
|
60
|
+
const message = JSON.parse(e.data);
|
|
61
|
+
message[msg_sent] = true;
|
|
62
|
+
app.signal('global', message);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
// perte du socket
|
|
66
|
+
sockets.onclose = (ev) => {
|
|
67
|
+
console.log('websocket closed:', ev);
|
|
68
|
+
closeCB();
|
|
69
|
+
};
|
|
70
|
+
sockets.onerror = (ev) => {
|
|
71
|
+
console.log('websocket error:', ev);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.setupWSMessaging = setupWSMessaging;
|
package/lib/cjs/index.js
CHANGED
|
@@ -99,4 +99,5 @@ __exportStar(require("./tooltips"), exports);
|
|
|
99
99
|
__exportStar(require("./treeview"), exports);
|
|
100
100
|
__exportStar(require("./x4events"), exports);
|
|
101
101
|
__exportStar(require("./x4react"), exports);
|
|
102
|
+
__exportStar(require("./app_sockets"), exports);
|
|
102
103
|
__exportStar(require("./version"), exports);
|
package/lib/cjs/treeview.js
CHANGED
|
@@ -294,6 +294,16 @@ class TreeView extends layout_1.VLayout {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
set selection(id) {
|
|
297
|
+
this.select(id, false);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* care, component should have been created, to select an item at startup,
|
|
301
|
+
* use something like
|
|
302
|
+
* componentCreated( ) {
|
|
303
|
+
* mytree.select( id );
|
|
304
|
+
* }
|
|
305
|
+
*/
|
|
306
|
+
select(id, notify = true) {
|
|
297
307
|
var _a;
|
|
298
308
|
if ((_a = this.m_selection) === null || _a === void 0 ? void 0 : _a.el) {
|
|
299
309
|
this.m_selection.el.removeClass('selected');
|
|
@@ -308,6 +318,15 @@ class TreeView extends layout_1.VLayout {
|
|
|
308
318
|
};
|
|
309
319
|
sel.addClass('selected');
|
|
310
320
|
sel.scrollIntoView();
|
|
321
|
+
if (notify) {
|
|
322
|
+
let nd = sel.getData('node');
|
|
323
|
+
this.emit('selectionchange', (0, x4events_1.EvSelectionChange)(nd));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
if (notify) {
|
|
329
|
+
this.emit('selectionchange', (0, x4events_1.EvSelectionChange)(null));
|
|
311
330
|
}
|
|
312
331
|
}
|
|
313
332
|
}
|
package/lib/cjs/version.js
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file app_sockets.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
* in the Software without restriction, including without limitation the rights
|
|
16
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
17
|
+
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
+
* subject to the following conditions:
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies
|
|
20
|
+
* or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
23
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
24
|
+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
25
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
**/
|
|
29
|
+
import { Application } from "./application";
|
|
30
|
+
/**
|
|
31
|
+
* WEB SOCKETS
|
|
32
|
+
*
|
|
33
|
+
* les messages reçus par l'application sont retransmis au websocket.
|
|
34
|
+
* comme ça, tous les clients connectés sur le serveur recevront une copie du message.
|
|
35
|
+
* ca permet de mettre a jour les clients dynamiquement
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
const msg_sent = Symbol('msg_sent');
|
|
39
|
+
export function setupWSMessaging(closeCB) {
|
|
40
|
+
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
|
41
|
+
const sockets = new WebSocket(`${protocol}${window.location.hostname}:${window.location.port}`, 'messaging');
|
|
42
|
+
const app = Application.instance();
|
|
43
|
+
// pour tous les messages recus par l'application
|
|
44
|
+
// on transmet aux autres
|
|
45
|
+
app.on('global', (e) => {
|
|
46
|
+
if (e[msg_sent]) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
sockets.send(JSON.stringify({
|
|
50
|
+
msg: e.msg,
|
|
51
|
+
params: e.params,
|
|
52
|
+
}));
|
|
53
|
+
});
|
|
54
|
+
// reception d'un message
|
|
55
|
+
sockets.onmessage = (e) => {
|
|
56
|
+
if (e.data != 'ping') {
|
|
57
|
+
const message = JSON.parse(e.data);
|
|
58
|
+
message[msg_sent] = true;
|
|
59
|
+
app.signal('global', message);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
// perte du socket
|
|
63
|
+
sockets.onclose = (ev) => {
|
|
64
|
+
console.log('websocket closed:', ev);
|
|
65
|
+
closeCB();
|
|
66
|
+
};
|
|
67
|
+
sockets.onerror = (ev) => {
|
|
68
|
+
console.log('websocket error:', ev);
|
|
69
|
+
};
|
|
70
|
+
}
|
package/lib/esm/index.mjs
CHANGED
package/lib/esm/treeview.js
CHANGED
|
@@ -290,6 +290,16 @@ export class TreeView extends VLayout {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
set selection(id) {
|
|
293
|
+
this.select(id, false);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* care, component should have been created, to select an item at startup,
|
|
297
|
+
* use something like
|
|
298
|
+
* componentCreated( ) {
|
|
299
|
+
* mytree.select( id );
|
|
300
|
+
* }
|
|
301
|
+
*/
|
|
302
|
+
select(id, notify = true) {
|
|
293
303
|
if (this.m_selection?.el) {
|
|
294
304
|
this.m_selection.el.removeClass('selected');
|
|
295
305
|
}
|
|
@@ -303,6 +313,15 @@ export class TreeView extends VLayout {
|
|
|
303
313
|
};
|
|
304
314
|
sel.addClass('selected');
|
|
305
315
|
sel.scrollIntoView();
|
|
316
|
+
if (notify) {
|
|
317
|
+
let nd = sel.getData('node');
|
|
318
|
+
this.emit('selectionchange', EvSelectionChange(nd));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
if (notify) {
|
|
324
|
+
this.emit('selectionchange', EvSelectionChange(null));
|
|
306
325
|
}
|
|
307
326
|
}
|
|
308
327
|
}
|
package/lib/esm/version.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___
|
|
3
|
-
* \
|
|
4
|
-
* \
|
|
5
|
-
* /
|
|
6
|
-
* /__
|
|
7
|
-
*
|
|
8
|
-
* @file
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
12
|
-
*
|
|
13
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
-
* in the Software without restriction, including without limitation the rights
|
|
16
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
17
|
-
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
-
* subject to the following conditions:
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all copies
|
|
20
|
-
* or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
23
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
24
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
25
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
-
**/
|
|
29
|
-
|
|
30
|
-
export const x4js_version = "1.5.15";
|
|
1
|
+
/**
|
|
2
|
+
* ___ ___ __
|
|
3
|
+
* \ \/ / / _
|
|
4
|
+
* \ / /_| |_
|
|
5
|
+
* / \____ _|
|
|
6
|
+
* /__/\__\ |_|
|
|
7
|
+
*
|
|
8
|
+
* @file app_sockets.ts
|
|
9
|
+
* @author Etienne Cochard
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
* in the Software without restriction, including without limitation the rights
|
|
16
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
17
|
+
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
+
* subject to the following conditions:
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies
|
|
20
|
+
* or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
23
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
24
|
+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
25
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
**/
|
|
29
|
+
export declare function setupWSMessaging(closeCB: () => void): void;
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/treeview.d.ts
CHANGED
|
@@ -105,6 +105,14 @@ export declare class TreeView extends VLayout<TreeViewProps, TreeViewEventMap> {
|
|
|
105
105
|
forEach(cb: (node: TreeNode) => boolean | void): any;
|
|
106
106
|
ensureVisible(id: any): void;
|
|
107
107
|
set selection(id: any);
|
|
108
|
+
/**
|
|
109
|
+
* care, component should have been created, to select an item at startup,
|
|
110
|
+
* use something like
|
|
111
|
+
* componentCreated( ) {
|
|
112
|
+
* mytree.select( id );
|
|
113
|
+
* }
|
|
114
|
+
*/
|
|
115
|
+
select(id: any, notify?: boolean): void;
|
|
108
116
|
private _getNode;
|
|
109
117
|
get selection(): any;
|
|
110
118
|
getNodeWithId(id: any): TreeNode;
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
package/lib/src/MIT-license.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# MIT LICENSE #
|
|
2
|
-
|
|
3
|
-
**Copyright (c) 2019-2022 R-libre ingenierie**
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
-
of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
|
|
9
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
12
|
-
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
13
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
14
|
-
|
package/lib/src/action.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ___ ___ __
|
|
3
|
-
* \ \/ / / _
|
|
4
|
-
* \ / /_| |_
|
|
5
|
-
* / \____ _|
|
|
6
|
-
* /__/\__\ |_|
|
|
7
|
-
*
|
|
8
|
-
* @file action.ts
|
|
9
|
-
* @author Etienne Cochard
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) 2019-2022 R-libre ingenierie
|
|
12
|
-
*
|
|
13
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
-
* in the Software without restriction, including without limitation the rights
|
|
16
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
17
|
-
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
-
* subject to the following conditions:
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all copies
|
|
20
|
-
* or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
23
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
24
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
25
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
26
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
-
**/
|
|
29
|
-
|
|
30
|
-
import { BasicEvent, EvChange } from './x4events'
|
|
31
|
-
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component'
|
|
32
|
-
import { IconID } from "./icon"
|
|
33
|
-
import { EventHandler } from './component';
|
|
34
|
-
|
|
35
|
-
//TODO: implement all
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export interface EvAction extends BasicEvent {
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function EvAction( source: Action ) {
|
|
42
|
-
return BasicEvent<EvAction>({source});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface ActionEventMap extends BaseComponentEventMap {
|
|
46
|
-
run: EvAction;
|
|
47
|
-
change: EvChange;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface ActionProps extends BaseComponentProps<ActionEventMap> {
|
|
51
|
-
id?: any;
|
|
52
|
-
text?: string;
|
|
53
|
-
icon?: IconID;
|
|
54
|
-
disabled?: boolean;
|
|
55
|
-
hidden?: boolean;
|
|
56
|
-
checked?: boolean;
|
|
57
|
-
|
|
58
|
-
run: EventHandler<EvAction>;
|
|
59
|
-
change?: EventHandler<EvChange>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export class Action extends BaseComponent<ActionProps,ActionEventMap> {
|
|
63
|
-
|
|
64
|
-
constructor( props: ActionProps ) {
|
|
65
|
-
super( props );
|
|
66
|
-
|
|
67
|
-
this.mapPropEvents( props, "run" );
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get props( ) {
|
|
71
|
-
return this.m_props;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
set text( t: string ) {
|
|
75
|
-
this.m_props.text = t;
|
|
76
|
-
this.emit( "change", EvChange(this) );
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
set icon( i: IconID ) {
|
|
80
|
-
this.m_props.icon = i;
|
|
81
|
-
this.emit( "change", EvChange(this) );
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
fire( ) {
|
|
85
|
-
this.emit( "run", EvAction(this) );
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
package/lib/src/alpha.jpg
DELETED
|
Binary file
|