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/treeview.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ___ ___ __
|
|
3
4
|
* \ \_/ / / _
|
|
@@ -22,18 +23,20 @@
|
|
|
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
|
-
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.TreeView = void 0;
|
|
28
|
+
const component_1 = require("./component");
|
|
29
|
+
const icon_1 = require("./icon");
|
|
30
|
+
const label_1 = require("./label");
|
|
31
|
+
const layout_1 = require("./layout");
|
|
32
|
+
const x4_events_1 = require("./x4_events");
|
|
30
33
|
function EvExpand(node) {
|
|
31
|
-
return BasicEvent({ node });
|
|
34
|
+
return (0, x4_events_1.BasicEvent)({ node });
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
*
|
|
35
38
|
*/
|
|
36
|
-
|
|
39
|
+
class TreeView extends layout_1.VLayout {
|
|
37
40
|
m_view;
|
|
38
41
|
m_container;
|
|
39
42
|
m_selection;
|
|
@@ -44,15 +47,15 @@ export class TreeView extends VLayout {
|
|
|
44
47
|
props.gadgets = props.gadgets;
|
|
45
48
|
props.sort = props.sort ?? false;
|
|
46
49
|
this.m_selection = null;
|
|
47
|
-
this.m_container = new Container({ cls: '@scroll-container' });
|
|
48
|
-
this.m_view = new Container({
|
|
50
|
+
this.m_container = new component_1.Container({ cls: '@scroll-container' });
|
|
51
|
+
this.m_view = new component_1.Container({
|
|
49
52
|
cls: '@scroll-view',
|
|
50
53
|
flex: 1,
|
|
51
54
|
content: this.m_container
|
|
52
55
|
});
|
|
53
56
|
this.setContent([
|
|
54
57
|
this.m_view,
|
|
55
|
-
props.gadgets ? new HLayout({
|
|
58
|
+
props.gadgets ? new layout_1.HLayout({
|
|
56
59
|
cls: 'gadgets',
|
|
57
60
|
content: props.gadgets
|
|
58
61
|
}) : null,
|
|
@@ -62,7 +65,7 @@ export class TreeView extends VLayout {
|
|
|
62
65
|
this.setDomEvent('contextmenu', (e) => this._handleCtxMenu(e));
|
|
63
66
|
if (props.canDragItems) {
|
|
64
67
|
this.setDomEvent('dragstart', (ev) => {
|
|
65
|
-
let hit = Component.getElement(ev.target, Component);
|
|
68
|
+
let hit = component_1.Component.getElement(ev.target, component_1.Component);
|
|
66
69
|
let node = hit?.getData("node");
|
|
67
70
|
if (node) {
|
|
68
71
|
ev.dataTransfer.effectAllowed = 'move';
|
|
@@ -87,7 +90,7 @@ export class TreeView extends VLayout {
|
|
|
87
90
|
}
|
|
88
91
|
_dragEnter(ev) {
|
|
89
92
|
ev.preventDefault();
|
|
90
|
-
let hit = Component.getElement(ev.target, Component);
|
|
93
|
+
let hit = component_1.Component.getElement(ev.target, component_1.Component);
|
|
91
94
|
let node = hit?.getData("node");
|
|
92
95
|
if (node) {
|
|
93
96
|
hit.addClass('@drag-over');
|
|
@@ -95,14 +98,14 @@ export class TreeView extends VLayout {
|
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
_dragLeave(ev) {
|
|
98
|
-
let hit = Component.getElement(ev.target, Component);
|
|
101
|
+
let hit = component_1.Component.getElement(ev.target, component_1.Component);
|
|
99
102
|
let node = hit?.getData("node");
|
|
100
103
|
if (node) {
|
|
101
104
|
hit.removeClass('@drag-over');
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
_drop(ev) {
|
|
105
|
-
let hit = Component.getElement(ev.target, Component);
|
|
108
|
+
let hit = component_1.Component.getElement(ev.target, component_1.Component);
|
|
106
109
|
let node = hit?.getData("node");
|
|
107
110
|
if (!node) {
|
|
108
111
|
node = this.m_props.root;
|
|
@@ -120,7 +123,7 @@ export class TreeView extends VLayout {
|
|
|
120
123
|
for (let i = 0; i < ev.dataTransfer.items.length; i++) {
|
|
121
124
|
ev.dataTransfer.items[0].getAsString((value) => {
|
|
122
125
|
let data = JSON.parse(value);
|
|
123
|
-
this.emit('drag', EvDrag(node, data, parent));
|
|
126
|
+
this.emit('drag', (0, x4_events_1.EvDrag)(node, data, parent));
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
129
|
}
|
|
@@ -222,13 +225,13 @@ export class TreeView extends VLayout {
|
|
|
222
225
|
}
|
|
223
226
|
}
|
|
224
227
|
_renderDef(node) {
|
|
225
|
-
return new Label({ cls: 'tree-label', flex: 1, text: node.text });
|
|
228
|
+
return new label_1.Label({ cls: 'tree-label', flex: 1, text: node.text });
|
|
226
229
|
}
|
|
227
230
|
_makeNode(node, cls, icon, level) {
|
|
228
|
-
const item = new HLayout({
|
|
231
|
+
const item = new layout_1.HLayout({
|
|
229
232
|
cls,
|
|
230
233
|
content: [
|
|
231
|
-
new Icon({ cls: 'tree-icon', icon }),
|
|
234
|
+
new icon_1.Icon({ cls: 'tree-icon', icon }),
|
|
232
235
|
this.m_props.renderItem ? this.m_props.renderItem(node) : this._renderDef(node),
|
|
233
236
|
],
|
|
234
237
|
data: {
|
|
@@ -319,7 +322,7 @@ export class TreeView extends VLayout {
|
|
|
319
322
|
onsub = true;
|
|
320
323
|
}
|
|
321
324
|
while (dom != this.dom) {
|
|
322
|
-
let el = Component.getElement(dom);
|
|
325
|
+
let el = component_1.Component.getElement(dom);
|
|
323
326
|
let nd = el?.getData('node');
|
|
324
327
|
if (nd) {
|
|
325
328
|
if (nd.children && !onsub) {
|
|
@@ -339,14 +342,14 @@ export class TreeView extends VLayout {
|
|
|
339
342
|
this.selection = nd.id;
|
|
340
343
|
if (!onsub) {
|
|
341
344
|
if (ev.type == 'click') {
|
|
342
|
-
this.emit('click', EvClick(nd));
|
|
345
|
+
this.emit('click', (0, x4_events_1.EvClick)(nd));
|
|
343
346
|
}
|
|
344
347
|
else {
|
|
345
|
-
this.emit('dblclick', EvDblClick(nd));
|
|
348
|
+
this.emit('dblclick', (0, component_1.EvDblClick)(nd));
|
|
346
349
|
}
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
|
-
this.emit('selectionchange', EvSelectionChange(nd));
|
|
352
|
+
this.emit('selectionchange', (0, x4_events_1.EvSelectionChange)(nd));
|
|
350
353
|
return;
|
|
351
354
|
}
|
|
352
355
|
dom = dom.parentElement;
|
|
@@ -354,7 +357,7 @@ export class TreeView extends VLayout {
|
|
|
354
357
|
if (ev.type == 'click') {
|
|
355
358
|
this.m_selection = null;
|
|
356
359
|
this.update();
|
|
357
|
-
this.emit('selectionchange', EvSelectionChange(null));
|
|
360
|
+
this.emit('selectionchange', (0, x4_events_1.EvSelectionChange)(null));
|
|
358
361
|
}
|
|
359
362
|
}
|
|
360
363
|
_handleCtxMenu(ev) {
|
|
@@ -362,7 +365,7 @@ export class TreeView extends VLayout {
|
|
|
362
365
|
let dom = ev.target;
|
|
363
366
|
let idom = dom;
|
|
364
367
|
while (dom != this.dom) {
|
|
365
|
-
let el = Component.getElement(dom);
|
|
368
|
+
let el = component_1.Component.getElement(dom);
|
|
366
369
|
let nd = el?.getData('node');
|
|
367
370
|
if (nd) {
|
|
368
371
|
if (nd.children) {
|
|
@@ -373,14 +376,14 @@ export class TreeView extends VLayout {
|
|
|
373
376
|
}
|
|
374
377
|
this.m_selection = { id: nd.id, el: null };
|
|
375
378
|
this.update();
|
|
376
|
-
this.emit('contextMenu', EvContextMenu(ev, nd));
|
|
379
|
+
this.emit('contextMenu', (0, x4_events_1.EvContextMenu)(ev, nd));
|
|
377
380
|
return;
|
|
378
381
|
}
|
|
379
382
|
dom = dom.parentElement;
|
|
380
383
|
}
|
|
381
384
|
this.m_selection = null;
|
|
382
385
|
this.update();
|
|
383
|
-
this.emit('contextMenu', EvContextMenu(ev, null));
|
|
386
|
+
this.emit('contextMenu', (0, x4_events_1.EvContextMenu)(ev, null));
|
|
384
387
|
}
|
|
385
388
|
/**
|
|
386
389
|
* constructs a tree node from an array of strings
|
|
@@ -488,3 +491,4 @@ export class TreeView extends VLayout {
|
|
|
488
491
|
return root;
|
|
489
492
|
}
|
|
490
493
|
}
|
|
494
|
+
exports.TreeView = TreeView;
|
package/lib/x4_events.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.EventSource = exports.EvDrag = exports.EvMessage = exports.EvTimer = exports.EvContextMenu = exports.EvSelectionChange = exports.EvChange = exports.EvClick = exports.BasicEvent = void 0;
|
|
25
28
|
// default stopPropagation implementation for Events
|
|
26
29
|
const stopPropagation = function () {
|
|
27
30
|
this.propagationStopped = true;
|
|
@@ -38,34 +41,42 @@ const preventDefault = function () {
|
|
|
38
41
|
* @param params
|
|
39
42
|
* @returns BasicEvent
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
function BasicEvent(params) {
|
|
42
45
|
return {
|
|
43
46
|
stopPropagation,
|
|
44
47
|
preventDefault,
|
|
45
48
|
...params,
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
exports.BasicEvent = BasicEvent;
|
|
52
|
+
function EvClick(context = null) {
|
|
49
53
|
return BasicEvent({ context });
|
|
50
54
|
}
|
|
51
|
-
|
|
55
|
+
exports.EvClick = EvClick;
|
|
56
|
+
function EvChange(value, context = null) {
|
|
52
57
|
return BasicEvent({ value, context });
|
|
53
58
|
}
|
|
54
|
-
|
|
59
|
+
exports.EvChange = EvChange;
|
|
60
|
+
function EvSelectionChange(selection, context = null) {
|
|
55
61
|
return BasicEvent({ selection, context });
|
|
56
62
|
}
|
|
57
|
-
|
|
63
|
+
exports.EvSelectionChange = EvSelectionChange;
|
|
64
|
+
function EvContextMenu(uievent, context = null) {
|
|
58
65
|
return BasicEvent({ uievent, context });
|
|
59
66
|
}
|
|
60
|
-
|
|
67
|
+
exports.EvContextMenu = EvContextMenu;
|
|
68
|
+
function EvTimer(timer, time = 0, context = null) {
|
|
61
69
|
return BasicEvent({ timer, time, context });
|
|
62
70
|
}
|
|
63
|
-
|
|
71
|
+
exports.EvTimer = EvTimer;
|
|
72
|
+
function EvMessage(msg, params, source) {
|
|
64
73
|
return BasicEvent({ msg, params, source });
|
|
65
74
|
}
|
|
66
|
-
|
|
75
|
+
exports.EvMessage = EvMessage;
|
|
76
|
+
function EvDrag(element, data, ctx) {
|
|
67
77
|
return BasicEvent({ element, data, context: ctx });
|
|
68
78
|
}
|
|
79
|
+
exports.EvDrag = EvDrag;
|
|
69
80
|
/**
|
|
70
81
|
* Event emitter class
|
|
71
82
|
* this class allow you to emit and handle events
|
|
@@ -110,7 +121,7 @@ export function EvDrag(element, data, ctx) {
|
|
|
110
121
|
* }
|
|
111
122
|
* ```
|
|
112
123
|
*/
|
|
113
|
-
|
|
124
|
+
class EventSource {
|
|
114
125
|
m_source;
|
|
115
126
|
m_eventRegistry;
|
|
116
127
|
m_defaultHandlers;
|
|
@@ -361,3 +372,4 @@ export class EventSource {
|
|
|
361
372
|
}
|
|
362
373
|
}
|
|
363
374
|
}
|
|
375
|
+
exports.EventSource = EventSource;
|
package/package.json
CHANGED
package/src/application.ts
CHANGED
|
@@ -43,8 +43,9 @@ interface ApplicationEventMap extends BaseComponentEventMap {
|
|
|
43
43
|
export interface ApplicationProps extends BaseComponentProps<ApplicationEventMap> {
|
|
44
44
|
app_name: string; //
|
|
45
45
|
app_version: string; //
|
|
46
|
-
app_uid
|
|
47
|
-
locale
|
|
46
|
+
app_uid?: string;
|
|
47
|
+
locale?: string; // fr-FR
|
|
48
|
+
renderTo?: HTMLElement;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
@@ -113,7 +114,6 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
ApplicationCreated( ) {
|
|
116
|
-
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
public get app_name( ) {
|
|
@@ -160,7 +160,11 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
160
160
|
this.m_mainView = root;
|
|
161
161
|
|
|
162
162
|
deferCall( ( ) => {
|
|
163
|
-
document.body
|
|
163
|
+
const dest = this.m_props.renderTo ?? document.body;
|
|
164
|
+
while (dest.firstChild) {
|
|
165
|
+
dest.removeChild(dest.firstChild);
|
|
166
|
+
}
|
|
167
|
+
dest.appendChild(root._build());
|
|
164
168
|
} );
|
|
165
169
|
}
|
|
166
170
|
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export * from "./application"
|
|
2
|
+
export * from "./base_component"
|
|
3
|
+
export * from "./base64"
|
|
4
|
+
export * from "./button"
|
|
5
|
+
export * from "./calendar"
|
|
6
|
+
export * from "./canvas"
|
|
7
|
+
export * from "./cardview"
|
|
8
|
+
export * from "./checkbox"
|
|
9
|
+
export * from "./color"
|
|
10
|
+
export * from "./colorpicker"
|
|
11
|
+
export * from "./combobox"
|
|
12
|
+
export * from "./component"
|
|
13
|
+
export * from "./datastore"
|
|
14
|
+
export * from "./dialog"
|
|
15
|
+
export * from "./dom_events"
|
|
16
|
+
export * from "./drag_manager"
|
|
17
|
+
export * from "./drawtext"
|
|
18
|
+
export * from "./fileupload"
|
|
19
|
+
export * from "./form"
|
|
20
|
+
export * from "./formatters"
|
|
21
|
+
export * from "./gridview"
|
|
22
|
+
export * from "./i18n"
|
|
23
|
+
export * from "./icon"
|
|
24
|
+
export * from "./image"
|
|
25
|
+
export * from "./input"
|
|
26
|
+
export * from "./label"
|
|
27
|
+
export * from "./layout"
|
|
28
|
+
export * from "./link"
|
|
29
|
+
export * from "./listview"
|
|
30
|
+
export * from "./md5"
|
|
31
|
+
export * from "./menu"
|
|
32
|
+
export * from "./messagebox"
|
|
33
|
+
export * from "./panel"
|
|
34
|
+
export * from "./popup"
|
|
35
|
+
export * from "./property_editor"
|
|
36
|
+
export * from "./radiobtn"
|
|
37
|
+
export * from "./rating"
|
|
38
|
+
export * from "./request"
|
|
39
|
+
export * from "./router"
|
|
40
|
+
export * from "./settings"
|
|
41
|
+
export * from "./sidebarview"
|
|
42
|
+
export * from "./smartedit"
|
|
43
|
+
export * from "./spreadsheet"
|
|
44
|
+
export * from "./styles"
|
|
45
|
+
export * from "./svgcomponent"
|
|
46
|
+
export * from "./tabbar"
|
|
47
|
+
export * from "./tabview"
|
|
48
|
+
export * from "./textarea"
|
|
49
|
+
export * from "./textedit"
|
|
50
|
+
export * from "./texthiliter"
|
|
51
|
+
export * from "./toaster"
|
|
52
|
+
export * from "./tools"
|
|
53
|
+
export * from "./tooltips"
|
|
54
|
+
export * from "./treeview"
|
|
55
|
+
export * from "./x4_events"
|
package/src/router.ts
CHANGED
package/tsconfig.json
CHANGED
package/lib/list.txt
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
application.js
|
|
2
|
-
base_component.js
|
|
3
|
-
base64.js
|
|
4
|
-
button.js
|
|
5
|
-
calendar.js
|
|
6
|
-
canvas.js
|
|
7
|
-
cardview.js
|
|
8
|
-
checkbox.js
|
|
9
|
-
color.js
|
|
10
|
-
colorpicker.js
|
|
11
|
-
combobox.js
|
|
12
|
-
component.js
|
|
13
|
-
datastore.js
|
|
14
|
-
dialog.js
|
|
15
|
-
dom_events.js
|
|
16
|
-
drag_manager.js
|
|
17
|
-
drawtext.js
|
|
18
|
-
fileupload.js
|
|
19
|
-
form.js
|
|
20
|
-
formatters.js
|
|
21
|
-
gridview.js
|
|
22
|
-
i18n.js
|
|
23
|
-
icon.js
|
|
24
|
-
image.js
|
|
25
|
-
index.js
|
|
26
|
-
input.js
|
|
27
|
-
label.js
|
|
28
|
-
layout.js
|
|
29
|
-
link.js
|
|
30
|
-
listview.js
|
|
31
|
-
md5.js
|
|
32
|
-
menu.js
|
|
33
|
-
messagebox.js
|
|
34
|
-
panel.js
|
|
35
|
-
popup.js
|
|
36
|
-
property_editor.js
|
|
37
|
-
radiobtn.js
|
|
38
|
-
rating.js
|
|
39
|
-
request.js
|
|
40
|
-
router.js
|
|
41
|
-
settings.js
|
|
42
|
-
sidebarview.js
|
|
43
|
-
smartedit.js
|
|
44
|
-
spreadsheet.js
|
|
45
|
-
styles.js
|
|
46
|
-
svgcomponent.js
|
|
47
|
-
tabbar.js
|
|
48
|
-
tabview.js
|
|
49
|
-
textarea.js
|
|
50
|
-
textedit.js
|
|
51
|
-
texthiliter.js
|
|
52
|
-
toaster.js
|
|
53
|
-
tools.js
|
|
54
|
-
tooltips.js
|
|
55
|
-
treeview.js
|
|
56
|
-
x4_events.js
|
package/list.txt
DELETED
|
File without changes
|