x4js 1.5.17 → 1.5.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/{README.md → README.txt} +0 -0
- package/lib/cjs/index.js +39 -103
- package/lib/cjs/index.js.map +7 -0
- package/lib/esm/index.mjs +39 -87
- package/lib/esm/index.mjs.map +7 -0
- package/lib/{license.md → licence.md} +0 -0
- package/lib/src/MIT-license.md +14 -0
- package/lib/{types/action.d.ts → src/action.ts} +64 -33
- package/lib/src/alpha.jpg +0 -0
- package/lib/src/app_sockets.ts +81 -0
- package/lib/src/application.ts +251 -0
- package/lib/src/autocomplete.ts +197 -0
- package/lib/src/base64.ts +166 -0
- package/lib/src/base_component.ts +152 -0
- package/lib/src/button.ts +355 -0
- package/lib/src/calendar.ts +328 -0
- package/lib/src/canvas.ts +505 -0
- package/lib/src/cardview.ts +227 -0
- package/lib/src/checkbox.ts +188 -0
- package/lib/src/color.ts +752 -0
- package/lib/src/colorpicker.ts +1639 -0
- package/lib/src/combobox.ts +465 -0
- package/lib/src/component.ts +2329 -0
- package/lib/{esm/dom_events.js → src/copyright.txt} +27 -29
- package/lib/src/datastore.ts +1322 -0
- package/lib/src/dialog.ts +656 -0
- package/lib/src/dom_events.ts +315 -0
- package/lib/src/drag_manager.ts +199 -0
- package/lib/src/drawtext.ts +355 -0
- package/lib/src/fileupload.ts +213 -0
- package/lib/src/form.ts +375 -0
- package/lib/src/formatters.ts +105 -0
- package/lib/src/gridview.ts +1185 -0
- package/lib/src/i18n.ts +346 -0
- package/lib/src/icon.ts +335 -0
- package/lib/src/image.ts +204 -0
- package/lib/src/index.ts +89 -0
- package/lib/src/input.ts +249 -0
- package/lib/src/label.ts +128 -0
- package/lib/src/layout.ts +430 -0
- package/lib/src/link.ts +86 -0
- package/lib/src/listview.ts +765 -0
- package/lib/{esm/md5.js → src/md5.ts} +438 -403
- package/lib/src/menu.ts +425 -0
- package/lib/src/messagebox.ts +224 -0
- package/lib/src/panel.ts +86 -0
- package/lib/src/popup.ts +494 -0
- package/lib/src/property_editor.ts +337 -0
- package/lib/src/radiobtn.ts +197 -0
- package/lib/src/rating.ts +135 -0
- package/lib/src/request.ts +300 -0
- package/lib/src/router.ts +185 -0
- package/lib/src/settings.ts +77 -0
- package/lib/src/sidebarview.ts +103 -0
- package/lib/src/spreadsheet.ts +1449 -0
- package/lib/src/styles.ts +343 -0
- package/lib/src/svgcomponent.ts +577 -0
- package/lib/src/tabbar.ts +151 -0
- package/lib/src/tabview.ts +110 -0
- package/lib/src/textarea.ts +235 -0
- package/lib/src/textedit.ts +544 -0
- package/lib/src/toaster.ts +80 -0
- package/lib/src/tools.ts +1473 -0
- package/lib/src/tooltips.ts +191 -0
- package/lib/src/treeview.ts +716 -0
- package/lib/{esm/version.js → src/version.ts} +30 -29
- package/lib/{styles → src}/x4.less +0 -0
- package/lib/src/x4dom.ts +57 -0
- package/lib/src/x4events.ts +585 -0
- package/lib/src/x4react.ts +90 -0
- package/package.json +52 -49
- package/lib/cjs/action.js +0 -58
- package/lib/cjs/app_sockets.js +0 -74
- package/lib/cjs/application.js +0 -182
- package/lib/cjs/autocomplete.js +0 -155
- package/lib/cjs/base_component.js +0 -124
- package/lib/cjs/button.js +0 -263
- package/lib/cjs/calendar.js +0 -254
- package/lib/cjs/canvas.js +0 -361
- package/lib/cjs/cardview.js +0 -161
- package/lib/cjs/checkbox.js +0 -139
- package/lib/cjs/color.js +0 -591
- package/lib/cjs/colorpicker.js +0 -1468
- package/lib/cjs/combobox.js +0 -349
- package/lib/cjs/component.js +0 -1719
- package/lib/cjs/datastore.js +0 -985
- package/lib/cjs/dialog.js +0 -478
- package/lib/cjs/dom_events.js +0 -30
- package/lib/cjs/drag_manager.js +0 -145
- package/lib/cjs/drawtext.js +0 -276
- package/lib/cjs/fileupload.js +0 -167
- package/lib/cjs/form.js +0 -304
- package/lib/cjs/formatters.js +0 -90
- package/lib/cjs/gridview.js +0 -881
- package/lib/cjs/i18n.js +0 -266
- package/lib/cjs/icon.js +0 -272
- package/lib/cjs/image.js +0 -157
- package/lib/cjs/input.js +0 -174
- package/lib/cjs/label.js +0 -95
- package/lib/cjs/layout.js +0 -322
- package/lib/cjs/link.js +0 -64
- package/lib/cjs/listview.js +0 -546
- package/lib/cjs/md5.js +0 -403
- package/lib/cjs/menu.js +0 -301
- package/lib/cjs/messagebox.js +0 -177
- package/lib/cjs/panel.js +0 -68
- package/lib/cjs/popup.js +0 -383
- package/lib/cjs/property_editor.js +0 -252
- package/lib/cjs/radiobtn.js +0 -140
- package/lib/cjs/rating.js +0 -102
- package/lib/cjs/request.js +0 -246
- package/lib/cjs/router.js +0 -139
- package/lib/cjs/settings.js +0 -69
- package/lib/cjs/sidebarview.js +0 -82
- package/lib/cjs/spreadsheet.js +0 -1084
- package/lib/cjs/styles.js +0 -275
- package/lib/cjs/svgcomponent.js +0 -447
- package/lib/cjs/tabbar.js +0 -111
- package/lib/cjs/tabview.js +0 -85
- package/lib/cjs/textarea.js +0 -165
- package/lib/cjs/textedit.js +0 -415
- package/lib/cjs/toaster.js +0 -64
- package/lib/cjs/tools.js +0 -1197
- package/lib/cjs/tooltips.js +0 -157
- package/lib/cjs/treeview.js +0 -535
- package/lib/cjs/version.js +0 -32
- package/lib/cjs/x4dom.js +0 -32
- package/lib/cjs/x4events.js +0 -384
- package/lib/cjs/x4react.js +0 -72
- package/lib/esm/action.js +0 -53
- package/lib/esm/app_sockets.js +0 -70
- package/lib/esm/application.js +0 -184
- package/lib/esm/autocomplete.js +0 -155
- package/lib/esm/base_component.js +0 -107
- package/lib/esm/button.js +0 -257
- package/lib/esm/calendar.js +0 -249
- package/lib/esm/canvas.js +0 -358
- package/lib/esm/cardview.js +0 -159
- package/lib/esm/checkbox.js +0 -134
- package/lib/esm/color.js +0 -588
- package/lib/esm/colorpicker.js +0 -1475
- package/lib/esm/combobox.js +0 -351
- package/lib/esm/component.js +0 -1711
- package/lib/esm/datastore.js +0 -990
- package/lib/esm/dialog.js +0 -490
- package/lib/esm/drag_manager.js +0 -147
- package/lib/esm/drawtext.js +0 -271
- package/lib/esm/fileupload.js +0 -163
- package/lib/esm/form.js +0 -304
- package/lib/esm/formatters.js +0 -81
- package/lib/esm/gridview.js +0 -889
- package/lib/esm/i18n.js +0 -257
- package/lib/esm/icon.js +0 -261
- package/lib/esm/image.js +0 -154
- package/lib/esm/input.js +0 -182
- package/lib/esm/label.js +0 -90
- package/lib/esm/layout.js +0 -310
- package/lib/esm/link.js +0 -59
- package/lib/esm/listview.js +0 -534
- package/lib/esm/menu.js +0 -300
- package/lib/esm/messagebox.js +0 -161
- package/lib/esm/panel.js +0 -65
- package/lib/esm/popup.js +0 -379
- package/lib/esm/property_editor.js +0 -251
- package/lib/esm/radiobtn.js +0 -136
- package/lib/esm/rating.js +0 -97
- package/lib/esm/request.js +0 -224
- package/lib/esm/router.js +0 -136
- package/lib/esm/settings.js +0 -66
- package/lib/esm/sidebarview.js +0 -79
- package/lib/esm/spreadsheet.js +0 -1097
- package/lib/esm/styles.js +0 -270
- package/lib/esm/svgcomponent.js +0 -450
- package/lib/esm/tabbar.js +0 -107
- package/lib/esm/tabview.js +0 -83
- package/lib/esm/textarea.js +0 -160
- package/lib/esm/textedit.js +0 -412
- package/lib/esm/toaster.js +0 -62
- package/lib/esm/tools.js +0 -1158
- package/lib/esm/tooltips.js +0 -153
- package/lib/esm/treeview.js +0 -527
- package/lib/esm/x4dom.js +0 -29
- package/lib/esm/x4events.js +0 -376
- package/lib/esm/x4react.js +0 -71
- package/lib/types/app_sockets.d.ts +0 -29
- package/lib/types/application.d.ts +0 -104
- package/lib/types/autocomplete.d.ts +0 -58
- package/lib/types/base_component.d.ts +0 -88
- package/lib/types/button.d.ts +0 -151
- package/lib/types/calendar.d.ts +0 -82
- package/lib/types/canvas.d.ts +0 -92
- package/lib/types/cardview.d.ts +0 -87
- package/lib/types/checkbox.d.ts +0 -77
- package/lib/types/color.d.ts +0 -148
- package/lib/types/colorpicker.d.ts +0 -107
- package/lib/types/combobox.d.ts +0 -107
- package/lib/types/component.d.ts +0 -601
- package/lib/types/datastore.d.ts +0 -396
- package/lib/types/dialog.d.ts +0 -175
- package/lib/types/dom_events.d.ts +0 -302
- package/lib/types/drag_manager.d.ts +0 -54
- package/lib/types/drawtext.d.ts +0 -48
- package/lib/types/fileupload.d.ts +0 -64
- package/lib/types/form.d.ts +0 -133
- package/lib/types/formatters.d.ts +0 -35
- package/lib/types/gridview.d.ts +0 -175
- package/lib/types/i18n.d.ts +0 -73
- package/lib/types/icon.d.ts +0 -64
- package/lib/types/image.d.ts +0 -55
- package/lib/types/index.d.ts +0 -84
- package/lib/types/input.d.ts +0 -91
- package/lib/types/label.d.ts +0 -58
- package/lib/types/layout.d.ts +0 -87
- package/lib/types/link.d.ts +0 -50
- package/lib/types/listview.d.ts +0 -178
- package/lib/types/md5.d.ts +0 -61
- package/lib/types/menu.d.ts +0 -130
- package/lib/types/messagebox.d.ts +0 -69
- package/lib/types/panel.d.ts +0 -47
- package/lib/types/popup.d.ts +0 -75
- package/lib/types/property_editor.d.ts +0 -71
- package/lib/types/radiobtn.d.ts +0 -73
- package/lib/types/rating.d.ts +0 -53
- package/lib/types/request.d.ts +0 -52
- package/lib/types/router.d.ts +0 -42
- package/lib/types/settings.d.ts +0 -37
- package/lib/types/sidebarview.d.ts +0 -49
- package/lib/types/spreadsheet.d.ts +0 -222
- package/lib/types/styles.d.ts +0 -85
- package/lib/types/svgcomponent.d.ts +0 -215
- package/lib/types/tabbar.d.ts +0 -58
- package/lib/types/tabview.d.ts +0 -49
- package/lib/types/textarea.d.ts +0 -77
- package/lib/types/textedit.d.ts +0 -123
- package/lib/types/toaster.d.ts +0 -42
- package/lib/types/tools.d.ts +0 -394
- package/lib/types/tooltips.d.ts +0 -46
- package/lib/types/treeview.d.ts +0 -144
- package/lib/types/version.d.ts +0 -29
- package/lib/types/x4dom.d.ts +0 -49
- package/lib/types/x4events.d.ts +0 -269
- package/lib/types/x4react.d.ts +0 -41
package/lib/cjs/component.js
DELETED
|
@@ -1,1719 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ___ ___ __
|
|
4
|
-
* \ \/ / / _
|
|
5
|
-
* \ / /_| |_
|
|
6
|
-
* / \____ _|
|
|
7
|
-
* /__/\__\ |_|
|
|
8
|
-
*
|
|
9
|
-
* @file components.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.Container = exports.SizerOverlay = exports.EvOverlayResize = exports.Separator = exports.EvSize = exports.Space = exports.Flex = exports.flyWrap = exports.Component = exports.EvFocus = exports.EvDblClick = exports._x4_unitless = exports.html = exports.isHtmlString = exports.HtmlString = void 0;
|
|
32
|
-
/**
|
|
33
|
-
* @todo
|
|
34
|
-
* create Container class
|
|
35
|
-
*/
|
|
36
|
-
const tools_1 = require("./tools");
|
|
37
|
-
const x4dom_1 = require("./x4dom");
|
|
38
|
-
const styles_1 = require("./styles");
|
|
39
|
-
const x4events_1 = require("./x4events");
|
|
40
|
-
const base_component_1 = require("./base_component");
|
|
41
|
-
var tools_2 = require("./tools");
|
|
42
|
-
Object.defineProperty(exports, "HtmlString", { enumerable: true, get: function () { return tools_2.HtmlString; } });
|
|
43
|
-
Object.defineProperty(exports, "isHtmlString", { enumerable: true, get: function () { return tools_2.isHtmlString; } });
|
|
44
|
-
Object.defineProperty(exports, "html", { enumerable: true, get: function () { return tools_2.html; } });
|
|
45
|
-
/** @ignore classname prefix for system classes */
|
|
46
|
-
const _x4_ns_prefix = 'x-';
|
|
47
|
-
// -- elements -----------
|
|
48
|
-
/** @ignore where event handlers are stored */
|
|
49
|
-
const _x4_el_store = Symbol();
|
|
50
|
-
/** @ignore where Component is stored in dom */
|
|
51
|
-
const _x4_el_sym = Symbol();
|
|
52
|
-
/** @ignore properties without 'px' unit */
|
|
53
|
-
exports._x4_unitless = {
|
|
54
|
-
animationIterationCount: 1, borderImageOutset: 1, borderImageSlice: 1, borderImageWidth: 1, boxFlex: 1, boxFlexGroup: 1,
|
|
55
|
-
boxOrdinalGroup: 1, columnCount: 1, flex: 1, flexGrow: 1, flexPositive: 1, flexShrink: 1, flexNegative: 1, flexOrder: 1,
|
|
56
|
-
gridRow: 1, gridColumn: 1, fontWeight: 1, lineClamp: 1, lineHeight: 1, opacity: 1, order: 1, orphans: 1, tabSize: 1, widows: 1,
|
|
57
|
-
zIndex: 1, zoom: 1,
|
|
58
|
-
// SVG-related _properties
|
|
59
|
-
fillOpacity: 1, floodOpacity: 1, stopOpacity: 1, strokeDasharray: 1, strokeDashoffset: 1, strokeMiterlimit: 1, strokeOpacity: 1,
|
|
60
|
-
strokeWidth: 1,
|
|
61
|
-
};
|
|
62
|
-
/** @ignore this events must be defined on domNode (do not bubble) */
|
|
63
|
-
const unbubbleEvents = {
|
|
64
|
-
mouseleave: 1, mouseenter: 1, load: 1, unload: 1, scroll: 1, focus: 1, blur: 1, rowexit: 1, beforeunload: 1, stop: 1,
|
|
65
|
-
dragdrop: 1, dragenter: 1, dragexit: 1, draggesture: 1, dragover: 1, contextmenu: 1, create: 2, sizechange: 2
|
|
66
|
-
};
|
|
67
|
-
/** @ignore */
|
|
68
|
-
const passiveEvents = {
|
|
69
|
-
touchstart: 1, touchmove: 1, touchend: 1,
|
|
70
|
-
//pointerdown: 1, pointermove: 1, pointerup: 1,
|
|
71
|
-
};
|
|
72
|
-
/** ignore */
|
|
73
|
-
const reNumber = /^-?\d+(\.\d+)?$/;
|
|
74
|
-
function EvDblClick(context = null) {
|
|
75
|
-
return (0, x4events_1.BasicEvent)({ context });
|
|
76
|
-
}
|
|
77
|
-
exports.EvDblClick = EvDblClick;
|
|
78
|
-
function EvFocus(focus = true, context = null) {
|
|
79
|
-
return (0, x4events_1.BasicEvent)({ focus, context });
|
|
80
|
-
}
|
|
81
|
-
exports.EvFocus = EvFocus;
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
class Component extends base_component_1.BaseComponent {
|
|
86
|
-
constructor(props = null) {
|
|
87
|
-
super(props !== null && props !== void 0 ? props : {});
|
|
88
|
-
this.m_iprops = {
|
|
89
|
-
classes: {},
|
|
90
|
-
dom_events: {},
|
|
91
|
-
uid: Component.__comp_guid++,
|
|
92
|
-
inrender: false,
|
|
93
|
-
};
|
|
94
|
-
// prepare iprops
|
|
95
|
-
if (this.m_props.cls) {
|
|
96
|
-
this.addClass(this.m_props.cls);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
*/
|
|
102
|
-
get uid() {
|
|
103
|
-
return this.m_iprops.uid;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* change the component content
|
|
107
|
-
* @param content new content or null
|
|
108
|
-
*/
|
|
109
|
-
setContent(content, refreshAll = false) {
|
|
110
|
-
this.m_props.content = content !== null && content !== void 0 ? content : [];
|
|
111
|
-
if (this.m_iprops.inrender || !this.m_dom) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (refreshAll) {
|
|
115
|
-
this.update();
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
this._updateContent();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
getContent() {
|
|
122
|
-
return this.m_props.content;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* add a new child to the component content
|
|
126
|
-
* @param content
|
|
127
|
-
*/
|
|
128
|
-
appendChild(content) {
|
|
129
|
-
if (!content) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const append = (c) => {
|
|
133
|
-
if (!this.m_props.content) {
|
|
134
|
-
this.m_props.content = [];
|
|
135
|
-
}
|
|
136
|
-
else if (!(0, tools_1.isArray)(this.m_props.content)) {
|
|
137
|
-
this.m_props.content = [this.m_props.content];
|
|
138
|
-
}
|
|
139
|
-
this.m_props.content.push(c);
|
|
140
|
-
if (this.m_dom) {
|
|
141
|
-
this._appendChild(c);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
if ((0, tools_1.isArray)(content)) {
|
|
145
|
-
content.forEach(append);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
append(content);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
*
|
|
153
|
-
*/
|
|
154
|
-
setTag(tag, namespace) {
|
|
155
|
-
this.m_props.tag = tag;
|
|
156
|
-
if (namespace) {
|
|
157
|
-
this.m_props.ns = namespace;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* get the Component data value
|
|
162
|
-
* @param name name to get
|
|
163
|
-
*/
|
|
164
|
-
getData(name) {
|
|
165
|
-
if (this.m_props.data !== undefined) {
|
|
166
|
-
return this.m_props.data[name.toString()];
|
|
167
|
-
}
|
|
168
|
-
return undefined;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* set the Component data value
|
|
172
|
-
* @param name name to get
|
|
173
|
-
* @param value
|
|
174
|
-
*/
|
|
175
|
-
setData(name, value) {
|
|
176
|
-
let data = this.m_props.data;
|
|
177
|
-
if (data === undefined) {
|
|
178
|
-
data = this.m_props.data = {};
|
|
179
|
-
}
|
|
180
|
-
data[name.toString()] = value;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* return the DOM associated with the Component (if any)
|
|
184
|
-
*/
|
|
185
|
-
get dom() {
|
|
186
|
-
return this.m_dom;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* shows the element
|
|
190
|
-
* @param show
|
|
191
|
-
*/
|
|
192
|
-
show(show) {
|
|
193
|
-
if (show === undefined || show === true) {
|
|
194
|
-
this.removeClass('@hidden');
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
this.addClass('@hidden');
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* hides the element
|
|
202
|
-
*/
|
|
203
|
-
hide() {
|
|
204
|
-
this.addClass('@hidden');
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* enable or disable the element
|
|
208
|
-
* @param enable
|
|
209
|
-
*/
|
|
210
|
-
enable(enable) {
|
|
211
|
-
if (enable === undefined || enable === true) {
|
|
212
|
-
this.removeClass('@disable');
|
|
213
|
-
this.removeAttribute('disabled');
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
this.disable();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* disable the element
|
|
221
|
-
*/
|
|
222
|
-
disable() {
|
|
223
|
-
this.addClass('@disable');
|
|
224
|
-
this.setAttribute('disabled', '');
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* set the focus on the element
|
|
228
|
-
*/
|
|
229
|
-
focus() {
|
|
230
|
-
console.assert(!!this.m_dom);
|
|
231
|
-
this.m_dom.focus();
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* change the object style
|
|
235
|
-
* @param style - style to add
|
|
236
|
-
* @example ```typescript
|
|
237
|
-
* el.setStyle( {left:100} );
|
|
238
|
-
*/
|
|
239
|
-
setStyle(style) {
|
|
240
|
-
for (let s in style) {
|
|
241
|
-
this.setStyleValue(s, style[s]);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* change a style value
|
|
246
|
-
* @param name string style nale
|
|
247
|
-
* @param value any style value or null to remove style
|
|
248
|
-
*/
|
|
249
|
-
setStyleValue(name, value) {
|
|
250
|
-
let style = this.m_props.style;
|
|
251
|
-
if (!style) {
|
|
252
|
-
style = this.m_props.style = {};
|
|
253
|
-
}
|
|
254
|
-
style[name] = value;
|
|
255
|
-
this._setDomStyleValue(name, value);
|
|
256
|
-
}
|
|
257
|
-
_setDomStyleValue(name, value) {
|
|
258
|
-
if (this.m_dom) {
|
|
259
|
-
if (value === undefined) {
|
|
260
|
-
value = null;
|
|
261
|
-
}
|
|
262
|
-
else if (!exports._x4_unitless[name] && ((0, tools_1.isNumber)(value) || reNumber.test(value))) {
|
|
263
|
-
value = value + 'px';
|
|
264
|
-
}
|
|
265
|
-
this.m_dom.style[name] = value;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* compute the element style
|
|
270
|
-
* @return all styles computed
|
|
271
|
-
*/
|
|
272
|
-
getComputedStyle(pseudoElt) {
|
|
273
|
-
if (this.dom) {
|
|
274
|
-
return new styles_1.ComputedStyle(getComputedStyle(this.dom, pseudoElt !== null && pseudoElt !== void 0 ? pseudoElt : null));
|
|
275
|
-
}
|
|
276
|
-
return new styles_1.ComputedStyle(this.m_props.style);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* return a single stype value
|
|
280
|
-
* @param name - value to get
|
|
281
|
-
*/
|
|
282
|
-
getStyleValue(name) {
|
|
283
|
-
return this.getComputedStyle()[name];
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* define the elements attributes
|
|
287
|
-
* @param attrs
|
|
288
|
-
*/
|
|
289
|
-
setAttributes(attrs) {
|
|
290
|
-
for (let a in attrs) {
|
|
291
|
-
this.setAttribute(a, attrs[a]);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* change a single attribute
|
|
296
|
-
* @param name attribute name
|
|
297
|
-
* @param value new value
|
|
298
|
-
*/
|
|
299
|
-
setAttribute(name, value) {
|
|
300
|
-
if (value === false || value === undefined) {
|
|
301
|
-
this.removeAttribute(name);
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
if (value === true) {
|
|
305
|
-
value = '';
|
|
306
|
-
}
|
|
307
|
-
else if ((0, tools_1.isNumber)(value)) {
|
|
308
|
-
value = '' + value;
|
|
309
|
-
}
|
|
310
|
-
let attrs = this.m_props.attrs;
|
|
311
|
-
if (!attrs) {
|
|
312
|
-
attrs = this.m_props.attrs = {};
|
|
313
|
-
}
|
|
314
|
-
attrs[name] = value;
|
|
315
|
-
this._setDomAttribute(name, value);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
_setDomAttribute(name, value) {
|
|
319
|
-
if (this.m_dom) {
|
|
320
|
-
this.m_dom.setAttribute(name, value);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* remove an atrribute
|
|
325
|
-
* @param name name of the attribute
|
|
326
|
-
*/
|
|
327
|
-
removeAttribute(name) {
|
|
328
|
-
let attrs = this.m_props.attrs;
|
|
329
|
-
if (!attrs) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
delete attrs[name];
|
|
333
|
-
if (this.m_dom) {
|
|
334
|
-
this.m_dom.removeAttribute(name);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* get an attribute value
|
|
339
|
-
* @param {string} name - attribute name
|
|
340
|
-
* @return {string} attribute value
|
|
341
|
-
* @example ```typescript
|
|
342
|
-
* let chk = el.getAttribute( 'checked' );
|
|
343
|
-
* @review double cache
|
|
344
|
-
*/
|
|
345
|
-
getAttribute(name) {
|
|
346
|
-
if (this.m_dom) {
|
|
347
|
-
return this.m_dom.getAttribute(name);
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
if (!this.m_props.attrs) {
|
|
351
|
-
return undefined;
|
|
352
|
-
}
|
|
353
|
-
return this.m_props.attrs[name];
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* check if the element has an attribute
|
|
358
|
-
* @param name attribute name
|
|
359
|
-
* @return true is attribute is present
|
|
360
|
-
* @example ```typescript
|
|
361
|
-
* if( el.hasAttribute('checked') ) {
|
|
362
|
-
* }
|
|
363
|
-
*/
|
|
364
|
-
hasAttribute(name) {
|
|
365
|
-
if (this.m_dom) {
|
|
366
|
-
return this.m_dom.hasAttribute(name);
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
return this.m_props.attrs.hasOwnProperty(name);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* a some classnames to the component
|
|
374
|
-
* classes can be separated by a space
|
|
375
|
-
* @param cls class to add
|
|
376
|
-
* @example ```typescript
|
|
377
|
-
* addClass( 'my class name @flex' );
|
|
378
|
-
*/
|
|
379
|
-
addClass(name) {
|
|
380
|
-
if (name === null || name === undefined) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
name = name.trim();
|
|
384
|
-
if (name === '') {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
let add = (c) => {
|
|
388
|
-
if (c === undefined || c === null || c === '') {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
c = this._makeCls(c);
|
|
392
|
-
// update vdom
|
|
393
|
-
classes[c] = true;
|
|
394
|
-
// update dom
|
|
395
|
-
if (this.m_dom) {
|
|
396
|
-
this.m_dom.classList.add(c);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
let classes = this.m_iprops.classes;
|
|
400
|
-
if (name.indexOf(' ') < 0) {
|
|
401
|
-
add(name);
|
|
402
|
-
}
|
|
403
|
-
else {
|
|
404
|
-
let names = name.split(' ');
|
|
405
|
-
names.forEach((n) => add(n));
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Remove a class from the element
|
|
410
|
-
* @param {string|array} name - classes in string form can be space separated
|
|
411
|
-
*
|
|
412
|
-
* @example ```typescript
|
|
413
|
-
* el.removeClass( 'myclass' );
|
|
414
|
-
* el.removeClass( 'myclass1 myclass2' );
|
|
415
|
-
*/
|
|
416
|
-
removeClass(name) {
|
|
417
|
-
if (name === undefined) {
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
let remove = (c) => {
|
|
421
|
-
if (c === undefined || c === null || c === '') {
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
c = this._makeCls(c);
|
|
425
|
-
delete this.m_iprops.classes[c];
|
|
426
|
-
if (this.m_dom) {
|
|
427
|
-
this.m_dom.classList.remove(c);
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
// faster
|
|
431
|
-
if (name.indexOf(' ') < 0) {
|
|
432
|
-
remove(name);
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
// build class list
|
|
436
|
-
let classes = name.trim().split(' ');
|
|
437
|
-
for (let c of classes) {
|
|
438
|
-
if (c !== undefined && c !== null && c !== '') {
|
|
439
|
-
remove(c);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
*
|
|
446
|
-
* @param cls
|
|
447
|
-
* @param set
|
|
448
|
-
*/
|
|
449
|
-
setClass(cls, set) {
|
|
450
|
-
if (set) {
|
|
451
|
-
this.addClass(cls);
|
|
452
|
-
}
|
|
453
|
-
else {
|
|
454
|
-
this.removeClass(cls);
|
|
455
|
-
}
|
|
456
|
-
return this;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Toggle a class from the element (if present remove, if absent add)
|
|
460
|
-
* @param {string|string[]} name - classes in string form can be space separated
|
|
461
|
-
* @example ```typescript
|
|
462
|
-
* el.toggleClass( 'myclass' );
|
|
463
|
-
* el.toggleClass( 'myclass1 myclass2');
|
|
464
|
-
* el.toggleClass( ['myclass1','myclass2']);
|
|
465
|
-
*/
|
|
466
|
-
toggleClass(name) {
|
|
467
|
-
let toggle = (c) => {
|
|
468
|
-
if (c === undefined && c === null && c === '') {
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
c = this._makeCls(c);
|
|
472
|
-
if (this.m_iprops.classes[c]) {
|
|
473
|
-
delete this.m_iprops.classes[c];
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
476
|
-
this.m_iprops.classes[c] = true;
|
|
477
|
-
}
|
|
478
|
-
if (this.m_dom) {
|
|
479
|
-
this.m_dom.classList.toggle(c);
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
// faster
|
|
483
|
-
if (name.indexOf(' ') < 0) {
|
|
484
|
-
toggle(name);
|
|
485
|
-
}
|
|
486
|
-
else {
|
|
487
|
-
// build class list
|
|
488
|
-
let classes = name.trim().split(' ');
|
|
489
|
-
for (let c of classes) {
|
|
490
|
-
toggle(c);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* check if the object has the class
|
|
496
|
-
* @param cls
|
|
497
|
-
*/
|
|
498
|
-
hasClass(cls) {
|
|
499
|
-
let c = this._makeCls(cls);
|
|
500
|
-
if (this.m_dom) {
|
|
501
|
-
return this.dom.classList.contains(c);
|
|
502
|
-
}
|
|
503
|
-
else {
|
|
504
|
-
return !!this.m_iprops.classes[c];
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* remove all classes from the object
|
|
509
|
-
* this is usefull for component recycling & reusing
|
|
510
|
-
*/
|
|
511
|
-
clearClasses() {
|
|
512
|
-
this.m_iprops.classes = {};
|
|
513
|
-
if (this.m_dom) {
|
|
514
|
-
return this.m_dom.classList.value = '';
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
_build() {
|
|
518
|
-
if (this.m_dom) {
|
|
519
|
-
return this.m_dom;
|
|
520
|
-
}
|
|
521
|
-
this._createDOM();
|
|
522
|
-
return this.m_dom;
|
|
523
|
-
}
|
|
524
|
-
render(props) {
|
|
525
|
-
}
|
|
526
|
-
_createDOM() {
|
|
527
|
-
var _a, _b;
|
|
528
|
-
if (this.m_dom) {
|
|
529
|
-
return this.m_dom;
|
|
530
|
-
}
|
|
531
|
-
// setup props
|
|
532
|
-
const props = this.m_props;
|
|
533
|
-
if (props.tabIndex !== undefined) {
|
|
534
|
-
this._setTabIndex(props.tabIndex);
|
|
535
|
-
}
|
|
536
|
-
this.render(props);
|
|
537
|
-
// shortcuts ---------
|
|
538
|
-
if (props.left !== undefined) {
|
|
539
|
-
this.setStyleValue('left', props.left);
|
|
540
|
-
}
|
|
541
|
-
if (props.top !== undefined) {
|
|
542
|
-
this.setStyleValue('top', props.top);
|
|
543
|
-
}
|
|
544
|
-
if (props.width !== undefined) {
|
|
545
|
-
this.setStyleValue('width', props.width);
|
|
546
|
-
}
|
|
547
|
-
if (props.height !== undefined) {
|
|
548
|
-
this.setStyleValue('height', props.height);
|
|
549
|
-
}
|
|
550
|
-
if (props.flex !== undefined) {
|
|
551
|
-
this.addClass('@flex');
|
|
552
|
-
if (props.flex != 1) {
|
|
553
|
-
this.setStyleValue('flex', props.flex);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
if (props.enabled === false) {
|
|
557
|
-
this.disable();
|
|
558
|
-
}
|
|
559
|
-
// shortcut: tip
|
|
560
|
-
if (props.tooltip !== undefined) {
|
|
561
|
-
this.setAttribute('tip', props.tooltip.replace(/\n/gi, '<br/>'));
|
|
562
|
-
}
|
|
563
|
-
// prepare iprops
|
|
564
|
-
if (props.dom_events) {
|
|
565
|
-
for (let ename in props.dom_events) {
|
|
566
|
-
this._setDomEvent(ename, props.dom_events[ename]);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
this._genClassName();
|
|
570
|
-
this.m_props.cls = undefined; // now classes are tranfered to m_iprops
|
|
571
|
-
// create self
|
|
572
|
-
let vdom = this.m_iprops;
|
|
573
|
-
if (props.ns) {
|
|
574
|
-
this.m_dom = x4dom_1.x4document.createElementNS(props.ns, (_a = props.tag) !== null && _a !== void 0 ? _a : 'div');
|
|
575
|
-
}
|
|
576
|
-
else {
|
|
577
|
-
this.m_dom = x4dom_1.x4document.createElement(((_b = props.tag) !== null && _b !== void 0 ? _b : 'div'));
|
|
578
|
-
}
|
|
579
|
-
this.m_dom[_x4_el_sym] = this;
|
|
580
|
-
//let me = Object.getPrototypeOf(this);
|
|
581
|
-
//console.log( 'create', this.m_iprops.uid, me.constructor.name );
|
|
582
|
-
// classes
|
|
583
|
-
this.m_dom.classList.add(...Object.keys(vdom.classes));
|
|
584
|
-
// styles
|
|
585
|
-
let sty = props.style;
|
|
586
|
-
if (sty) {
|
|
587
|
-
for (let s in sty) {
|
|
588
|
-
this._setDomStyleValue(s, sty[s]);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
// attributes
|
|
592
|
-
let att = props.attrs;
|
|
593
|
-
if (att) {
|
|
594
|
-
for (let a in att) {
|
|
595
|
-
const attr = att[a];
|
|
596
|
-
if (attr !== false && attr !== undefined) {
|
|
597
|
-
this._setDomAttribute(a, att[a]);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
// special properties
|
|
602
|
-
if (this.m_props.id) {
|
|
603
|
-
this._setDomAttribute('id', this.m_props.id);
|
|
604
|
-
}
|
|
605
|
-
// events
|
|
606
|
-
let evt = this.m_iprops.dom_events;
|
|
607
|
-
if (evt) {
|
|
608
|
-
for (let e in evt) {
|
|
609
|
-
let handlers = evt[e];
|
|
610
|
-
for (let h of handlers) {
|
|
611
|
-
this.createEvent(e, h);
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
// create children
|
|
616
|
-
let content = props.content;
|
|
617
|
-
if (content) {
|
|
618
|
-
if (!(0, tools_1.isArray)(content)) {
|
|
619
|
-
content = [content];
|
|
620
|
-
}
|
|
621
|
-
content.forEach((el) => {
|
|
622
|
-
if (!el) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
if ((0, tools_1.isString)(el)) {
|
|
626
|
-
this.m_dom.insertAdjacentText('beforeend', el);
|
|
627
|
-
}
|
|
628
|
-
else if ((0, tools_1.isHtmlString)(el)) {
|
|
629
|
-
this.m_dom.insertAdjacentHTML('beforeend', el);
|
|
630
|
-
}
|
|
631
|
-
else if (el instanceof Component) {
|
|
632
|
-
this.m_dom.append(el._build());
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
console.log('unknown element type: ', el);
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
// wait for dom insertion inside document.body
|
|
640
|
-
if (!Component.__createObserver) {
|
|
641
|
-
Component.__createObserver = new MutationObserver(Component._observeCreation);
|
|
642
|
-
Component.__createObserver.observe(x4dom_1.x4document.body, { childList: true, subtree: true });
|
|
643
|
-
}
|
|
644
|
-
return this.m_dom;
|
|
645
|
-
}
|
|
646
|
-
_setTabIndex(tabIndex, defValue = 0) {
|
|
647
|
-
if (tabIndex === true) {
|
|
648
|
-
tabIndex = 0;
|
|
649
|
-
}
|
|
650
|
-
else if (tabIndex === undefined) {
|
|
651
|
-
tabIndex = defValue;
|
|
652
|
-
}
|
|
653
|
-
if (tabIndex !== false && tabIndex !== undefined) {
|
|
654
|
-
this.setAttribute('tabindex', tabIndex);
|
|
655
|
-
}
|
|
656
|
-
this.m_props.tabIndex = tabIndex;
|
|
657
|
-
}
|
|
658
|
-
static _observeCreation(mutations) {
|
|
659
|
-
// notify descendants that we have been created (dom exists)
|
|
660
|
-
for (let mutation of mutations) {
|
|
661
|
-
if (mutation.type == 'childList') {
|
|
662
|
-
for (let i = 0, n = mutation.addedNodes.length; i < n; i++) {
|
|
663
|
-
let add = mutation.addedNodes[i];
|
|
664
|
-
let el = add[_x4_el_sym];
|
|
665
|
-
if (el) {
|
|
666
|
-
el.enumChilds((c) => {
|
|
667
|
-
if (c.dom && c.m_iprops.dom_events && c.m_iprops.dom_events.create) {
|
|
668
|
-
c.dom.dispatchEvent(new Event('create'));
|
|
669
|
-
}
|
|
670
|
-
c.componentCreated();
|
|
671
|
-
}, true);
|
|
672
|
-
if (el.m_iprops.dom_events && el.m_iprops.dom_events.create) {
|
|
673
|
-
el.dom.dispatchEvent(new Event('create'));
|
|
674
|
-
}
|
|
675
|
-
el.componentCreated();
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
dispose() {
|
|
682
|
-
if (this.m_dom) {
|
|
683
|
-
this._dispose(true, true);
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
_dispose(with_dom, timers) {
|
|
687
|
-
let _dom = this.m_dom;
|
|
688
|
-
// free attached resources
|
|
689
|
-
delete _dom[_x4_el_sym];
|
|
690
|
-
delete _dom[_x4_el_store];
|
|
691
|
-
//
|
|
692
|
-
if (with_dom) {
|
|
693
|
-
_dom.remove();
|
|
694
|
-
}
|
|
695
|
-
// notify every child that they will be removed
|
|
696
|
-
this.enumChilds((c) => {
|
|
697
|
-
c._dispose(false, true);
|
|
698
|
-
});
|
|
699
|
-
this.m_dom = null;
|
|
700
|
-
if (timers) {
|
|
701
|
-
this.disposeTimers();
|
|
702
|
-
}
|
|
703
|
-
this.componentDisposed();
|
|
704
|
-
// todo: pb on update this.removeAllListeners( null );
|
|
705
|
-
}
|
|
706
|
-
componentDisposed() {
|
|
707
|
-
}
|
|
708
|
-
componentCreated() {
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
*
|
|
712
|
-
*/
|
|
713
|
-
update(delay = 0) {
|
|
714
|
-
if (this.m_dom) {
|
|
715
|
-
const _update = () => {
|
|
716
|
-
let oldDOM = this.m_dom;
|
|
717
|
-
this._dispose(false, false);
|
|
718
|
-
let newDOM = this._build();
|
|
719
|
-
console.assert(!!oldDOM.parentNode, 'update in componentCreated is not allowed, use updateContent');
|
|
720
|
-
oldDOM.parentNode.replaceChild(newDOM, oldDOM);
|
|
721
|
-
};
|
|
722
|
-
if (delay) {
|
|
723
|
-
this.singleShot(_update, delay);
|
|
724
|
-
}
|
|
725
|
-
else {
|
|
726
|
-
_update();
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* empty the node
|
|
732
|
-
*/
|
|
733
|
-
_empty() {
|
|
734
|
-
//this.m_dom.innerHTML = '';
|
|
735
|
-
const el = this.m_dom;
|
|
736
|
-
if (!el) {
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
while (el.firstChild) {
|
|
740
|
-
el.removeChild(el.firstChild);
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
_updateContent() {
|
|
744
|
-
if (!this.m_dom) {
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
this._empty();
|
|
748
|
-
let content = this.m_props.content;
|
|
749
|
-
// create children
|
|
750
|
-
if (content) {
|
|
751
|
-
if (!(0, tools_1.isArray)(content)) {
|
|
752
|
-
content = [content];
|
|
753
|
-
}
|
|
754
|
-
content.forEach((el) => {
|
|
755
|
-
if (!el) {
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
if ((0, tools_1.isHtmlString)(el)) {
|
|
759
|
-
this.m_dom.insertAdjacentHTML('beforeend', el);
|
|
760
|
-
}
|
|
761
|
-
else if (el instanceof Component) {
|
|
762
|
-
this.m_dom.append(el._build());
|
|
763
|
-
}
|
|
764
|
-
else {
|
|
765
|
-
this.m_dom.insertAdjacentText('beforeend', el + '');
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* @return the bounding rectangle
|
|
772
|
-
* @example ```typescript
|
|
773
|
-
* let rc = el.getBoundingRect( );
|
|
774
|
-
* console.log( rc.left, rc.top, rc.right, rc.bottom );
|
|
775
|
-
*/
|
|
776
|
-
getBoundingRect(withMargins = false) {
|
|
777
|
-
console.assert(this.dom != null, 'cannot get bounding rect of an non DOM element');
|
|
778
|
-
let r = this.dom.getBoundingClientRect();
|
|
779
|
-
let rc = new tools_1.Rect(r.left, r.top, r.width, r.height);
|
|
780
|
-
if (withMargins) {
|
|
781
|
-
let st = this.getComputedStyle();
|
|
782
|
-
let tm = st.parse('marginTop'), bm = st.parse('marginBottom'), lm = st.parse('marginLeft'), rm = st.parse('marginRight');
|
|
783
|
-
rc.left -= lm;
|
|
784
|
-
rc.width += lm + rm;
|
|
785
|
-
rc.top -= tm;
|
|
786
|
-
rc.height += tm + bm;
|
|
787
|
-
}
|
|
788
|
-
return rc;
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* append a new dom event handler
|
|
792
|
-
* @param name - you can specify multiple names separated by a space
|
|
793
|
-
* @param handler
|
|
794
|
-
* @example
|
|
795
|
-
*
|
|
796
|
-
* this.setDomEvent( 'drag drop', this._handleDrag, this );
|
|
797
|
-
* this.setDomEvent( 'dblclick', this._handleDblClick, this );
|
|
798
|
-
*/
|
|
799
|
-
setDomEvent(type, listener) {
|
|
800
|
-
let _listener = listener;
|
|
801
|
-
this._setDomEvent(type, _listener);
|
|
802
|
-
}
|
|
803
|
-
_setDomEvent(type, listener) {
|
|
804
|
-
// add event to the vdom
|
|
805
|
-
if (!this.m_iprops.dom_events) {
|
|
806
|
-
this.m_iprops.dom_events = {};
|
|
807
|
-
}
|
|
808
|
-
let listeners = this.m_iprops.dom_events[type];
|
|
809
|
-
if (!listeners) {
|
|
810
|
-
listeners = this.m_iprops.dom_events[type] = [listener];
|
|
811
|
-
}
|
|
812
|
-
else {
|
|
813
|
-
listeners.push(listener);
|
|
814
|
-
}
|
|
815
|
-
if (this.m_dom) {
|
|
816
|
-
//this.m_dom.addEventListener(type, listener);
|
|
817
|
-
this.createEvent(type, listener);
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
*
|
|
822
|
-
*/
|
|
823
|
-
clearDomEvent(type) {
|
|
824
|
-
if (!this.m_iprops.dom_events) {
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
delete this.m_iprops.dom_events[type];
|
|
828
|
-
let _dom = this.m_dom;
|
|
829
|
-
if (_dom) {
|
|
830
|
-
let store = _dom[_x4_el_store];
|
|
831
|
-
if (store) {
|
|
832
|
-
delete store[type];
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
*
|
|
838
|
-
* @param name
|
|
839
|
-
* @param handler
|
|
840
|
-
*/
|
|
841
|
-
createEvent(name, handler) {
|
|
842
|
-
let _dom = this.m_dom;
|
|
843
|
-
let store = _dom[_x4_el_store];
|
|
844
|
-
if (!store) {
|
|
845
|
-
store = _dom[_x4_el_store] = {};
|
|
846
|
-
}
|
|
847
|
-
if (!store[name]) {
|
|
848
|
-
// no handler for this event...
|
|
849
|
-
store[name] = [handler];
|
|
850
|
-
}
|
|
851
|
-
else {
|
|
852
|
-
// append the handler
|
|
853
|
-
store[name].push(handler);
|
|
854
|
-
}
|
|
855
|
-
if (unbubbleEvents[name] === 1) {
|
|
856
|
-
_dom['on' + name] = Component._dispatchUnbubbleEvent;
|
|
857
|
-
}
|
|
858
|
-
else if (!Component.__privateEvents[name]) {
|
|
859
|
-
Component.__privateEvents[name] = true; // todo count it
|
|
860
|
-
if (passiveEvents[name]) {
|
|
861
|
-
x4dom_1.x4document.addEventListener(name, Component._dispatchEvent, { passive: false, capture: true });
|
|
862
|
-
}
|
|
863
|
-
else {
|
|
864
|
-
x4dom_1.x4document.addEventListener(name, Component._dispatchEvent, true);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
if (name === 'sizechange') {
|
|
868
|
-
if (!Component.__sizeObserver) {
|
|
869
|
-
Component.__sizeObserver = new ResizeObserver(Component._observeSize);
|
|
870
|
-
}
|
|
871
|
-
Component.__sizeObserver.observe(this.m_dom);
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* dispatch a dom event to the appropriated component
|
|
876
|
-
* called by the system
|
|
877
|
-
*/
|
|
878
|
-
static _dispatchEvent(ev) {
|
|
879
|
-
var _a;
|
|
880
|
-
let target = ev.target, noup = unbubbleEvents[ev.type] === 2;
|
|
881
|
-
while (target) {
|
|
882
|
-
if (target[_x4_el_store]) {
|
|
883
|
-
let store = target[_x4_el_store][ev.type];
|
|
884
|
-
if (store) {
|
|
885
|
-
let el = target[_x4_el_sym];
|
|
886
|
-
let root = (_a = el === null || el === void 0 ? void 0 : el.root) !== null && _a !== void 0 ? _a : null;
|
|
887
|
-
if (store instanceof Array) {
|
|
888
|
-
store.some((fn) => {
|
|
889
|
-
fn(ev, root);
|
|
890
|
-
if (!el.dom) {
|
|
891
|
-
return true;
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
else {
|
|
896
|
-
store(ev, root);
|
|
897
|
-
}
|
|
898
|
-
if (ev.cancelBubble || ev.defaultPrevented || noup) {
|
|
899
|
-
break;
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
target = target.parentNode;
|
|
904
|
-
// no need to go above
|
|
905
|
-
if (target == document) {
|
|
906
|
-
break;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* dispatch a dom event to the appropriated component
|
|
912
|
-
* called by the system
|
|
913
|
-
*/
|
|
914
|
-
static _dispatchUnbubbleEvent(ev) {
|
|
915
|
-
var _a;
|
|
916
|
-
let target = ev.currentTarget || ev.target, eventType = ev.type;
|
|
917
|
-
let eventStore = target[_x4_el_store], store = eventStore && eventStore[eventType];
|
|
918
|
-
if (store) {
|
|
919
|
-
let el = target[_x4_el_sym];
|
|
920
|
-
let root = (_a = el === null || el === void 0 ? void 0 : el.root) !== null && _a !== void 0 ? _a : null;
|
|
921
|
-
if (store instanceof Array) {
|
|
922
|
-
store.forEach((fn) => {
|
|
923
|
-
fn(ev, root);
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
else {
|
|
927
|
-
store(ev, root);
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* called when a size change on an observed component
|
|
933
|
-
*/
|
|
934
|
-
static _observeSize(entries) {
|
|
935
|
-
entries.forEach((entry) => {
|
|
936
|
-
let dom = entry.target;
|
|
937
|
-
if (dom.offsetParent !== null) {
|
|
938
|
-
dom.dispatchEvent(new Event('sizechange'));
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* enum all children recursively
|
|
944
|
-
* @param recursive - if true do a full sub-child search
|
|
945
|
-
* @param cb - callback
|
|
946
|
-
* return true to stop enumeration
|
|
947
|
-
*/
|
|
948
|
-
enumChilds(cb, recursive = false) {
|
|
949
|
-
// use dom if available
|
|
950
|
-
if (this.m_dom) {
|
|
951
|
-
let el = this.m_dom.firstChild;
|
|
952
|
-
while (el) {
|
|
953
|
-
// get component (if any)
|
|
954
|
-
let cel = el[_x4_el_sym];
|
|
955
|
-
if (cel) {
|
|
956
|
-
cb(cel);
|
|
957
|
-
if (recursive && cel.enumChilds(cb, true) === true) {
|
|
958
|
-
return true;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
el = el.nextSibling;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
else {
|
|
965
|
-
let content = this.m_props.content;
|
|
966
|
-
if (!content) {
|
|
967
|
-
return;
|
|
968
|
-
}
|
|
969
|
-
if (!(0, tools_1.isArray)(content)) {
|
|
970
|
-
content = [content];
|
|
971
|
-
}
|
|
972
|
-
content.some((el) => {
|
|
973
|
-
if (!el || (0, tools_1.isString)(el) || (0, tools_1.isHtmlString)(el)) {
|
|
974
|
-
return;
|
|
975
|
-
}
|
|
976
|
-
if (cb(el)) {
|
|
977
|
-
return true;
|
|
978
|
-
}
|
|
979
|
-
if (recursive && el.enumChilds(cb, true) === true) {
|
|
980
|
-
return true;
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
return false;
|
|
985
|
-
}
|
|
986
|
-
/**
|
|
987
|
-
* apprend a child to the DOM
|
|
988
|
-
* @param props child to append (or string)
|
|
989
|
-
*/
|
|
990
|
-
_appendChild(el) {
|
|
991
|
-
if ((0, tools_1.isString)(el)) {
|
|
992
|
-
this.m_dom.insertAdjacentText('beforeend', el);
|
|
993
|
-
}
|
|
994
|
-
else if ((0, tools_1.isHtmlString)(el)) {
|
|
995
|
-
this.m_dom.insertAdjacentHTML('beforeend', el);
|
|
996
|
-
}
|
|
997
|
-
else {
|
|
998
|
-
let component = el;
|
|
999
|
-
try {
|
|
1000
|
-
component._build();
|
|
1001
|
-
this.m_dom.appendChild(component.m_dom);
|
|
1002
|
-
}
|
|
1003
|
-
catch (e) {
|
|
1004
|
-
console.error(e);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* generate classes from the component inheritance
|
|
1010
|
-
* @example
|
|
1011
|
-
* Button extends Component will give
|
|
1012
|
-
* x-comp x-button
|
|
1013
|
-
*/
|
|
1014
|
-
_genClassName() {
|
|
1015
|
-
this.addClass('@comp');
|
|
1016
|
-
let me = Object.getPrototypeOf(this);
|
|
1017
|
-
while (me && me.constructor !== Component) {
|
|
1018
|
-
let clsname = me.constructor.name;
|
|
1019
|
-
this.addClass('@' + (0, tools_1.pascalCase)(clsname));
|
|
1020
|
-
me = Object.getPrototypeOf(me);
|
|
1021
|
-
}
|
|
1022
|
-
//done in ctor now
|
|
1023
|
-
//this.addClass(this.m_props.cls);
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* prepend the system class name prefix on a name if needed (if class starts with @)
|
|
1027
|
-
*/
|
|
1028
|
-
_makeCls(cls) {
|
|
1029
|
-
if (cls[0] == '@') {
|
|
1030
|
-
return cls = _x4_ns_prefix + cls.substring(1);
|
|
1031
|
-
}
|
|
1032
|
-
else {
|
|
1033
|
-
return cls;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
/**
|
|
1037
|
-
*
|
|
1038
|
-
*/
|
|
1039
|
-
static dispatchCaptures(event) {
|
|
1040
|
-
Component.__capture.handler(event);
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* capture mouse events
|
|
1044
|
-
* @param capture name of the current capture
|
|
1045
|
-
* @param callback funciton to call on captured mouse events
|
|
1046
|
-
*
|
|
1047
|
-
* @example
|
|
1048
|
-
* Component.setCapture( this, ( ev: MouseEvent, initiator: Component ) => {
|
|
1049
|
-
* if( ev.type=='mousemove' ) {
|
|
1050
|
-
* this.setStyle( {
|
|
1051
|
-
* left: ev.clientX,
|
|
1052
|
-
* top: ev.clientY
|
|
1053
|
-
* } );
|
|
1054
|
-
* }
|
|
1055
|
-
* else if( ev.type=='mouseup' ) {
|
|
1056
|
-
* Component.releaseCapture( );
|
|
1057
|
-
* }
|
|
1058
|
-
* } );
|
|
1059
|
-
*/
|
|
1060
|
-
static setCapture(initiator, listener) {
|
|
1061
|
-
console.assert(!Component.__capture);
|
|
1062
|
-
if (Component.__capture) {
|
|
1063
|
-
debugger;
|
|
1064
|
-
}
|
|
1065
|
-
// todo: review that
|
|
1066
|
-
let iframes = x4dom_1.x4document.querySelectorAll("iframe");
|
|
1067
|
-
iframes.forEach(f => {
|
|
1068
|
-
flyWrap(f).setStyleValue('pointer-events', 'none');
|
|
1069
|
-
});
|
|
1070
|
-
let overs = x4dom_1.x4document.querySelectorAll(":hover");
|
|
1071
|
-
let cursor = null;
|
|
1072
|
-
if (overs.length) {
|
|
1073
|
-
let elementOver = overs[overs.length - 1];
|
|
1074
|
-
let style = window.getComputedStyle(elementOver);
|
|
1075
|
-
cursor = style.cursor;
|
|
1076
|
-
}
|
|
1077
|
-
Component.__capture_mask = x4dom_1.x4document.createElement('div');
|
|
1078
|
-
let mask = flyWrap(Component.__capture_mask);
|
|
1079
|
-
mask.addClass('@capture-mask');
|
|
1080
|
-
if (cursor) {
|
|
1081
|
-
mask.setStyleValue('cursor', cursor);
|
|
1082
|
-
}
|
|
1083
|
-
x4dom_1.x4document.body.appendChild(mask.dom);
|
|
1084
|
-
x4dom_1.x4document.addEventListener('mousedown', Component.dispatchCaptures);
|
|
1085
|
-
x4dom_1.x4document.addEventListener('mousemove', Component.dispatchCaptures);
|
|
1086
|
-
x4dom_1.x4document.addEventListener('mouseup', Component.dispatchCaptures);
|
|
1087
|
-
x4dom_1.x4document.addEventListener('touchstart', Component.dispatchCaptures);
|
|
1088
|
-
x4dom_1.x4document.addEventListener('touchmove', Component.dispatchCaptures);
|
|
1089
|
-
x4dom_1.x4document.addEventListener('touchend', Component.dispatchCaptures);
|
|
1090
|
-
Component.__capture = {
|
|
1091
|
-
initiator,
|
|
1092
|
-
handler: listener,
|
|
1093
|
-
iframes
|
|
1094
|
-
};
|
|
1095
|
-
}
|
|
1096
|
-
static releaseCapture() {
|
|
1097
|
-
console.assert(!!Component.__capture);
|
|
1098
|
-
x4dom_1.x4document.removeEventListener('touchstart', Component.dispatchCaptures);
|
|
1099
|
-
x4dom_1.x4document.removeEventListener('touchmove', Component.dispatchCaptures);
|
|
1100
|
-
x4dom_1.x4document.removeEventListener('touchend', Component.dispatchCaptures);
|
|
1101
|
-
x4dom_1.x4document.removeEventListener('mousedown', Component.dispatchCaptures);
|
|
1102
|
-
x4dom_1.x4document.removeEventListener('mousemove', Component.dispatchCaptures);
|
|
1103
|
-
x4dom_1.x4document.removeEventListener('mouseup', Component.dispatchCaptures);
|
|
1104
|
-
Component.__capture.iframes.forEach(f => {
|
|
1105
|
-
flyWrap(f).setStyleValue('pointer-events', null);
|
|
1106
|
-
});
|
|
1107
|
-
Component.__capture = null;
|
|
1108
|
-
if (Component.__capture_mask) {
|
|
1109
|
-
x4dom_1.x4document.body.removeChild(Component.__capture_mask);
|
|
1110
|
-
Component.__capture_mask = null;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* ensure the component is visible
|
|
1115
|
-
* @param: alignToTop
|
|
1116
|
-
*/
|
|
1117
|
-
scrollIntoView(arg) {
|
|
1118
|
-
if (this.m_dom) {
|
|
1119
|
-
const rel = new tools_1.Rect(this.dom.getBoundingClientRect());
|
|
1120
|
-
let top = undefined;
|
|
1121
|
-
let bot = undefined;
|
|
1122
|
-
let left = undefined;
|
|
1123
|
-
let right = undefined;
|
|
1124
|
-
let pn = this.dom.parentElement;
|
|
1125
|
-
const bdy = x4dom_1.x4document.body;
|
|
1126
|
-
while (pn && pn != bdy) {
|
|
1127
|
-
const pr = pn.getBoundingClientRect();
|
|
1128
|
-
if (top === undefined || top < pr.top) {
|
|
1129
|
-
top = pr.top;
|
|
1130
|
-
}
|
|
1131
|
-
if (bot === undefined || bot > pr.bottom) {
|
|
1132
|
-
bot = pr.bottom;
|
|
1133
|
-
}
|
|
1134
|
-
if (left === undefined || left < pr.left) {
|
|
1135
|
-
left = pr.left;
|
|
1136
|
-
}
|
|
1137
|
-
if (right === undefined || right > pr.right) {
|
|
1138
|
-
right = pr.right;
|
|
1139
|
-
}
|
|
1140
|
-
pn = pn.parentElement;
|
|
1141
|
-
}
|
|
1142
|
-
if (top === undefined || rel.top < top || rel.bottom > bot || rel.left < left || rel.right > right) {
|
|
1143
|
-
//this.m_dom.scrollIntoView( true );
|
|
1144
|
-
this.m_dom.scrollIntoView({ behavior: 'auto', block: 'nearest', inline: 'start' });
|
|
1145
|
-
}
|
|
1146
|
-
//this.m_dom.scrollIntoView(arg);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* search for a given css selector
|
|
1151
|
-
* @param selector
|
|
1152
|
-
* @returns child or null
|
|
1153
|
-
*/
|
|
1154
|
-
queryItem(selector) {
|
|
1155
|
-
let result = this.dom.querySelector(selector);
|
|
1156
|
-
return result ? Component.getElement(result) : null;
|
|
1157
|
-
}
|
|
1158
|
-
queryAll(selector, cb) {
|
|
1159
|
-
let elements = Array.from(this.m_dom.querySelectorAll(selector));
|
|
1160
|
-
if (cb) {
|
|
1161
|
-
elements.forEach((el) => {
|
|
1162
|
-
cb(flyWrap(el));
|
|
1163
|
-
});
|
|
1164
|
-
}
|
|
1165
|
-
return elements;
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* find a child with the given ID
|
|
1169
|
-
* @param id id (without '#')
|
|
1170
|
-
* @returns child or null
|
|
1171
|
-
*
|
|
1172
|
-
* @example
|
|
1173
|
-
* let btn = this.childWithId<Button>( 'myButtonId' );
|
|
1174
|
-
*/
|
|
1175
|
-
itemWithId(id) {
|
|
1176
|
-
let result = this.dom.querySelector('#' + id);
|
|
1177
|
-
return result ? Component.getElement(result) : null;
|
|
1178
|
-
}
|
|
1179
|
-
/**
|
|
1180
|
-
* find a child with given ref
|
|
1181
|
-
* @param ref
|
|
1182
|
-
* @return found child or null
|
|
1183
|
-
*/
|
|
1184
|
-
itemWithRef(ref) {
|
|
1185
|
-
let result = null;
|
|
1186
|
-
this.enumChilds((c) => {
|
|
1187
|
-
if (c.m_props.ref === ref) {
|
|
1188
|
-
result = c;
|
|
1189
|
-
return true;
|
|
1190
|
-
}
|
|
1191
|
-
}, true);
|
|
1192
|
-
return result;
|
|
1193
|
-
}
|
|
1194
|
-
/**
|
|
1195
|
-
*
|
|
1196
|
-
*/
|
|
1197
|
-
get ref() {
|
|
1198
|
-
return this.m_props.ref;
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
*
|
|
1202
|
-
*/
|
|
1203
|
-
static getCss() {
|
|
1204
|
-
if (!Component.__css) {
|
|
1205
|
-
Component.__css = new styles_1.Stylesheet();
|
|
1206
|
-
}
|
|
1207
|
-
return Component.__css;
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* return the parent element
|
|
1211
|
-
* care, object must have been created (dom!=null)
|
|
1212
|
-
*/
|
|
1213
|
-
getParent() {
|
|
1214
|
-
console.assert(!!this.m_dom);
|
|
1215
|
-
let elParent = this.dom.parentNode;
|
|
1216
|
-
return Component.getElement(elParent);
|
|
1217
|
-
}
|
|
1218
|
-
/**
|
|
1219
|
-
* get a component from a DOM element
|
|
1220
|
-
* move up to the hierarchy to find the request class type.
|
|
1221
|
-
* @param dom
|
|
1222
|
-
* @param classname
|
|
1223
|
-
* @returns
|
|
1224
|
-
*
|
|
1225
|
-
* @example
|
|
1226
|
-
*
|
|
1227
|
-
* with a DOM like that:
|
|
1228
|
-
* Button
|
|
1229
|
-
* Label
|
|
1230
|
-
* Icon <- the DOM you have (dom-icon)
|
|
1231
|
-
*
|
|
1232
|
-
* let btn = Component.getElement( dom-icon, Button );
|
|
1233
|
-
*/
|
|
1234
|
-
static getElement(dom, classname) {
|
|
1235
|
-
if (classname) {
|
|
1236
|
-
const srhCls = (0, tools_1.isString)(classname);
|
|
1237
|
-
while (dom) {
|
|
1238
|
-
let el = dom[_x4_el_sym];
|
|
1239
|
-
if (srhCls) {
|
|
1240
|
-
if (el && el.hasClass(classname)) {
|
|
1241
|
-
return el;
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
else if (el instanceof classname) {
|
|
1245
|
-
return el;
|
|
1246
|
-
}
|
|
1247
|
-
dom = dom.parentElement;
|
|
1248
|
-
}
|
|
1249
|
-
return null;
|
|
1250
|
-
}
|
|
1251
|
-
else {
|
|
1252
|
-
return dom ? dom[_x4_el_sym] : null;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
/**
|
|
1256
|
-
* compute the scrollbar size ( width = height)
|
|
1257
|
-
*/
|
|
1258
|
-
static getScrollbarSize() {
|
|
1259
|
-
if (Component.__sb_width === undefined) {
|
|
1260
|
-
let outerDiv = x4dom_1.x4document.createElement('div');
|
|
1261
|
-
outerDiv.style.cssText = 'overflow:auto;position:absolute;top:0;width:100px;height:100px';
|
|
1262
|
-
let innerDiv = x4dom_1.x4document.createElement('div');
|
|
1263
|
-
innerDiv.style.width = '200px';
|
|
1264
|
-
innerDiv.style.height = '200px';
|
|
1265
|
-
outerDiv.appendChild(innerDiv);
|
|
1266
|
-
x4dom_1.x4document.body.appendChild(outerDiv);
|
|
1267
|
-
Component.__sb_width = outerDiv.offsetWidth - outerDiv.clientWidth;
|
|
1268
|
-
x4dom_1.x4document.body.removeChild(outerDiv);
|
|
1269
|
-
}
|
|
1270
|
-
return Component.__sb_width;
|
|
1271
|
-
}
|
|
1272
|
-
/**
|
|
1273
|
-
* check if the Component is visible to the user
|
|
1274
|
-
*/
|
|
1275
|
-
isUserVisible() {
|
|
1276
|
-
if (!this.m_dom) {
|
|
1277
|
-
return false;
|
|
1278
|
-
}
|
|
1279
|
-
return (this.m_dom.offsetParent !== null);
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
exports.Component = Component;
|
|
1283
|
-
Component.__comp_guid = 1000; // component global unique id
|
|
1284
|
-
Component.__privateEvents = {};
|
|
1285
|
-
//private static __intersectionObserver: IntersectionObserver; // visibility observer
|
|
1286
|
-
Component.__capture = null;
|
|
1287
|
-
Component.__capture_mask = null;
|
|
1288
|
-
Component.__css = null;
|
|
1289
|
-
/** @ignore */
|
|
1290
|
-
let fly_element = null;
|
|
1291
|
-
/**
|
|
1292
|
-
* warp <b>temporarily</b> a DOM element to be able to acces to exact API
|
|
1293
|
-
* @param dom dom element to wrap
|
|
1294
|
-
* @review qui libere le fly_element ? -> timeout
|
|
1295
|
-
*/
|
|
1296
|
-
function flyWrap(dom) {
|
|
1297
|
-
if (dom[_x4_el_sym]) {
|
|
1298
|
-
return dom[_x4_el_sym];
|
|
1299
|
-
}
|
|
1300
|
-
let f = fly_element;
|
|
1301
|
-
if (!f) {
|
|
1302
|
-
f = fly_element = new Component({});
|
|
1303
|
-
}
|
|
1304
|
-
f.m_dom = dom;
|
|
1305
|
-
return f;
|
|
1306
|
-
}
|
|
1307
|
-
exports.flyWrap = flyWrap;
|
|
1308
|
-
/**
|
|
1309
|
-
* simple flex spacer
|
|
1310
|
-
*/
|
|
1311
|
-
class Flex extends Component {
|
|
1312
|
-
constructor(props = {}) {
|
|
1313
|
-
if (!props.flex) {
|
|
1314
|
-
props.flex = 1;
|
|
1315
|
-
}
|
|
1316
|
-
super(props);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
exports.Flex = Flex;
|
|
1320
|
-
/**
|
|
1321
|
-
* simple space between 2 elements
|
|
1322
|
-
*/
|
|
1323
|
-
class Space extends Component {
|
|
1324
|
-
constructor(size) {
|
|
1325
|
-
super({});
|
|
1326
|
-
this.m_size = size;
|
|
1327
|
-
}
|
|
1328
|
-
componentCreated() {
|
|
1329
|
-
// try to find if we are in a hz / vt / abs container
|
|
1330
|
-
let dom = this.dom;
|
|
1331
|
-
let style = null;
|
|
1332
|
-
while (dom) {
|
|
1333
|
-
let el = dom[_x4_el_sym];
|
|
1334
|
-
if (el.hasClass('@hlayout')) {
|
|
1335
|
-
style = { width: this.m_size };
|
|
1336
|
-
break;
|
|
1337
|
-
}
|
|
1338
|
-
else if (el.hasClass('@vlayout')) {
|
|
1339
|
-
style = { height: this.m_size };
|
|
1340
|
-
break;
|
|
1341
|
-
}
|
|
1342
|
-
dom = dom.parentElement;
|
|
1343
|
-
}
|
|
1344
|
-
if (!style) {
|
|
1345
|
-
style = { width: this.m_size, height: this.m_size };
|
|
1346
|
-
}
|
|
1347
|
-
this.setStyle(style);
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
exports.Space = Space;
|
|
1351
|
-
function EvSize(size, mode = null, context = null) {
|
|
1352
|
-
return (0, x4events_1.BasicEvent)({ size, mode, context });
|
|
1353
|
-
}
|
|
1354
|
-
exports.EvSize = EvSize;
|
|
1355
|
-
class Separator extends Component {
|
|
1356
|
-
constructor(props) {
|
|
1357
|
-
super(props);
|
|
1358
|
-
this.setDomEvent('mousedown', (e) => this._mousedown(e));
|
|
1359
|
-
this.setDomEvent('touchstart', (e) => this._mousedown(e));
|
|
1360
|
-
this.setDomEvent('dblclick', (e) => this._collapse(e));
|
|
1361
|
-
}
|
|
1362
|
-
render() {
|
|
1363
|
-
this.addClass(this.m_props.orientation);
|
|
1364
|
-
}
|
|
1365
|
-
_collapse(ev) {
|
|
1366
|
-
if (this.m_props.collapsible) {
|
|
1367
|
-
this._findTarget();
|
|
1368
|
-
if (this.m_target) {
|
|
1369
|
-
this.m_target.toggleClass('@collapsed');
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
_mousedown(ev) {
|
|
1374
|
-
if (ev.type == 'touchstart') {
|
|
1375
|
-
let te = ev;
|
|
1376
|
-
if (te.touches.length == 1) {
|
|
1377
|
-
this._startMoving(te.touches[0].pageX, te.touches[0].pageY, ev);
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
else {
|
|
1381
|
-
let me = ev;
|
|
1382
|
-
this._startMoving(me.pageX, me.pageY, ev);
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
_startMoving(x, y, ev) {
|
|
1386
|
-
//if( this.m_props.callback ) {
|
|
1387
|
-
// this.m_props.callback( ev, this );
|
|
1388
|
-
//}
|
|
1389
|
-
//else
|
|
1390
|
-
{
|
|
1391
|
-
this._findTarget();
|
|
1392
|
-
if (this.m_target) {
|
|
1393
|
-
if (this.m_props.orientation == 'horizontal') {
|
|
1394
|
-
if (this.m_props.sizing == 'before') {
|
|
1395
|
-
this.m_delta = x - this.m_irect.right;
|
|
1396
|
-
}
|
|
1397
|
-
else {
|
|
1398
|
-
this.m_delta = x - this.m_irect.left;
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
else {
|
|
1402
|
-
if (this.m_props.sizing == 'before') {
|
|
1403
|
-
this.m_delta = y - this.m_irect.bottom;
|
|
1404
|
-
}
|
|
1405
|
-
else {
|
|
1406
|
-
this.m_delta = y - this.m_irect.top;
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
ev.preventDefault();
|
|
1410
|
-
ev.stopPropagation();
|
|
1411
|
-
this.m_target.addClass('sizing');
|
|
1412
|
-
Component.setCapture(this, (e) => this._pointerMoved(e));
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
_pointerMoved(ev) {
|
|
1417
|
-
let __move = (ex, ey) => {
|
|
1418
|
-
if (this.m_props.orientation == 'horizontal') {
|
|
1419
|
-
let width;
|
|
1420
|
-
if (this.m_props.sizing == 'after') {
|
|
1421
|
-
width = this.m_irect.right - (ex - this.m_delta);
|
|
1422
|
-
}
|
|
1423
|
-
else {
|
|
1424
|
-
width = (ex - this.m_delta) - this.m_irect.left;
|
|
1425
|
-
}
|
|
1426
|
-
if (width > 0) {
|
|
1427
|
-
let size = new tools_1.Size(width, 0);
|
|
1428
|
-
this.emit('resize', EvSize(size));
|
|
1429
|
-
this.m_target.setStyleValue('width', size.width);
|
|
1430
|
-
this.m_target.setStyleValue('flex', null); // for flex>1
|
|
1431
|
-
this.m_target.removeClass('@flex');
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
else {
|
|
1435
|
-
let height;
|
|
1436
|
-
if (this.m_props.sizing == 'after') {
|
|
1437
|
-
height = this.m_irect.bottom - (ey - this.m_delta);
|
|
1438
|
-
}
|
|
1439
|
-
else {
|
|
1440
|
-
height = (ey - this.m_delta) - this.m_irect.top;
|
|
1441
|
-
}
|
|
1442
|
-
if (height > 0) {
|
|
1443
|
-
let size = new tools_1.Size(0, height);
|
|
1444
|
-
this.emit('resize', EvSize(size));
|
|
1445
|
-
this.m_target.setStyleValue('height', size.height);
|
|
1446
|
-
this.m_target.setStyleValue('flex', null); // for flex>1
|
|
1447
|
-
this.m_target.removeClass('@flex');
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
};
|
|
1451
|
-
if (ev.type == 'mousemove') {
|
|
1452
|
-
let mev = ev;
|
|
1453
|
-
__move(mev.pageX, mev.pageY);
|
|
1454
|
-
ev.preventDefault();
|
|
1455
|
-
ev.stopPropagation();
|
|
1456
|
-
}
|
|
1457
|
-
else if (ev.type == 'touchmove') {
|
|
1458
|
-
let tev = ev;
|
|
1459
|
-
__move(tev.touches[0].pageX, tev.touches[0].pageY);
|
|
1460
|
-
ev.preventDefault();
|
|
1461
|
-
ev.stopPropagation();
|
|
1462
|
-
}
|
|
1463
|
-
else if (ev.type == 'mouseup' || ev.type == 'touchend') {
|
|
1464
|
-
this.m_target.removeClass('sizing');
|
|
1465
|
-
Component.releaseCapture();
|
|
1466
|
-
ev.preventDefault();
|
|
1467
|
-
ev.stopPropagation();
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
_findTarget() {
|
|
1471
|
-
if (!this.m_target) {
|
|
1472
|
-
if (this.m_props.sizing == 'before') {
|
|
1473
|
-
let prevDom = this.dom.previousElementSibling;
|
|
1474
|
-
let prevEl = prevDom ? Component.getElement(prevDom) : null;
|
|
1475
|
-
this.m_target = prevEl;
|
|
1476
|
-
}
|
|
1477
|
-
else {
|
|
1478
|
-
let nextDom = this.dom.nextElementSibling;
|
|
1479
|
-
let nextEl = nextDom ? Component.getElement(nextDom) : null;
|
|
1480
|
-
this.m_target = nextEl;
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
if (this.m_target) {
|
|
1484
|
-
this.m_irect = this.m_target.getBoundingRect();
|
|
1485
|
-
}
|
|
1486
|
-
else {
|
|
1487
|
-
this.m_irect = null;
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
exports.Separator = Separator;
|
|
1492
|
-
function EvOverlayResize(ui_event, sens, context = null) {
|
|
1493
|
-
return (0, x4events_1.BasicEvent)({ ui_event, sens, context });
|
|
1494
|
-
}
|
|
1495
|
-
exports.EvOverlayResize = EvOverlayResize;
|
|
1496
|
-
class SizerOverlay extends Component {
|
|
1497
|
-
constructor(props) {
|
|
1498
|
-
super(props);
|
|
1499
|
-
this.addClass(props.sens);
|
|
1500
|
-
this.setDomEvent('mousedown', (e) => this._mousedown(e));
|
|
1501
|
-
this.setDomEvent('touchstart', (e) => this._mousedown(e));
|
|
1502
|
-
this.setDomEvent('dblclick', (e) => this.resetflex(e)); // todo: add option for that
|
|
1503
|
-
props.target.appendChild(this);
|
|
1504
|
-
if (props.resize) {
|
|
1505
|
-
this.on('resize', this.m_props.resize);
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
resetflex(event) {
|
|
1509
|
-
this.m_props.target.addClass('@flex');
|
|
1510
|
-
this.emit('resize', EvSize({ width: -1, height: 0 })); // todo: see that
|
|
1511
|
-
event.preventDefault();
|
|
1512
|
-
event.stopPropagation();
|
|
1513
|
-
}
|
|
1514
|
-
// @review move that in component
|
|
1515
|
-
_mousedown(ev) {
|
|
1516
|
-
ev.preventDefault();
|
|
1517
|
-
ev.stopPropagation();
|
|
1518
|
-
let eev = EvOverlayResize(ev, this.m_props.sens);
|
|
1519
|
-
this.emit('rawresize', eev);
|
|
1520
|
-
if (eev.defaultPrevented) {
|
|
1521
|
-
return;
|
|
1522
|
-
}
|
|
1523
|
-
let pos = (0, tools_1.getMousePos)(ev, true);
|
|
1524
|
-
this.m_irect = this.m_props.target.getBoundingRect();
|
|
1525
|
-
if (this.m_props.sens == 'right') {
|
|
1526
|
-
this.m_delta = pos.x - this.m_irect.right;
|
|
1527
|
-
}
|
|
1528
|
-
else if (this.m_props.sens == 'left') {
|
|
1529
|
-
this.m_delta = pos.x - this.m_irect.left;
|
|
1530
|
-
}
|
|
1531
|
-
else if (this.m_props.sens == 'bottom') {
|
|
1532
|
-
this.m_delta = pos.y - this.m_irect.bottom;
|
|
1533
|
-
}
|
|
1534
|
-
else if (this.m_props.sens == 'top') {
|
|
1535
|
-
this.m_delta = pos.y - this.m_irect.top;
|
|
1536
|
-
}
|
|
1537
|
-
this.m_props.target.addClass('sizing');
|
|
1538
|
-
Component.setCapture(this, (e) => this._handle_mouse(e));
|
|
1539
|
-
}
|
|
1540
|
-
_is_horz() {
|
|
1541
|
-
return this.m_props.sens == 'left' || this.m_props.sens == 'right';
|
|
1542
|
-
}
|
|
1543
|
-
get sens() {
|
|
1544
|
-
return this.m_props.sens;
|
|
1545
|
-
}
|
|
1546
|
-
_handle_mouse(ev) {
|
|
1547
|
-
let __move = (ex, ey) => {
|
|
1548
|
-
if (this._is_horz()) {
|
|
1549
|
-
let width;
|
|
1550
|
-
if (this.m_props.sens == 'left') {
|
|
1551
|
-
width = this.m_irect.right - (ex - this.m_delta);
|
|
1552
|
-
}
|
|
1553
|
-
else {
|
|
1554
|
-
width = (ex - this.m_delta) - this.m_irect.left;
|
|
1555
|
-
}
|
|
1556
|
-
if (width > 0) {
|
|
1557
|
-
let size = {
|
|
1558
|
-
width,
|
|
1559
|
-
height: undefined
|
|
1560
|
-
};
|
|
1561
|
-
this.emit('resize', EvSize(size));
|
|
1562
|
-
this.m_props.target.setStyleValue('width', size.width);
|
|
1563
|
-
this.m_props.target.setStyleValue('flex', null); // for flex>1
|
|
1564
|
-
this.m_props.target.removeClass('@flex');
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
else {
|
|
1568
|
-
let height;
|
|
1569
|
-
if (this.m_props.sens == 'top') {
|
|
1570
|
-
height = this.m_irect.bottom - (ey - this.m_delta);
|
|
1571
|
-
}
|
|
1572
|
-
else {
|
|
1573
|
-
height = (ey - this.m_delta) - this.m_irect.top;
|
|
1574
|
-
}
|
|
1575
|
-
if (height > 0) {
|
|
1576
|
-
let size = new tools_1.Size(0, height);
|
|
1577
|
-
this.emit('resize', EvSize(size));
|
|
1578
|
-
this.m_props.target.setStyleValue('height', size.height);
|
|
1579
|
-
this.m_props.target.setStyleValue('flex', null); // for flex>1
|
|
1580
|
-
this.m_props.target.removeClass('@flex');
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
};
|
|
1584
|
-
if (ev.type == 'mousemove') {
|
|
1585
|
-
let mev = ev;
|
|
1586
|
-
__move(mev.pageX, mev.pageY);
|
|
1587
|
-
ev.preventDefault();
|
|
1588
|
-
ev.stopPropagation();
|
|
1589
|
-
}
|
|
1590
|
-
else if (ev.type == 'touchmove') {
|
|
1591
|
-
let tev = ev;
|
|
1592
|
-
__move(tev.touches[0].pageX, tev.touches[0].pageY);
|
|
1593
|
-
ev.preventDefault();
|
|
1594
|
-
ev.stopPropagation();
|
|
1595
|
-
}
|
|
1596
|
-
else if (ev.type == 'mouseup' || ev.type == 'touchend') {
|
|
1597
|
-
this.m_props.target.removeClass('sizing');
|
|
1598
|
-
Component.releaseCapture();
|
|
1599
|
-
ev.preventDefault();
|
|
1600
|
-
ev.stopPropagation();
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
exports.SizerOverlay = SizerOverlay;
|
|
1605
|
-
function EvShortcut(name) {
|
|
1606
|
-
return (0, x4events_1.BasicEvent)({ name });
|
|
1607
|
-
}
|
|
1608
|
-
/**
|
|
1609
|
-
* you can construct a Container as usual with it's properties but also directly with it's children array
|
|
1610
|
-
*
|
|
1611
|
-
* @example
|
|
1612
|
-
* new Container( [
|
|
1613
|
-
* child1,
|
|
1614
|
-
* child2
|
|
1615
|
-
* ])
|
|
1616
|
-
*/
|
|
1617
|
-
class Container extends Component {
|
|
1618
|
-
constructor(props) {
|
|
1619
|
-
if ((0, tools_1.isArray)(props)) {
|
|
1620
|
-
super({ content: props });
|
|
1621
|
-
}
|
|
1622
|
-
else {
|
|
1623
|
-
super(props);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
/**
|
|
1627
|
-
* add an application shortcut
|
|
1628
|
-
* @param sequence key sequence Shift+Ctrl+Alt+K
|
|
1629
|
-
* @param callback callback to call
|
|
1630
|
-
*/
|
|
1631
|
-
addShortcut(sequence, name, callback = null, immediate = false) {
|
|
1632
|
-
// first time
|
|
1633
|
-
if (!this.m_shortcuts) {
|
|
1634
|
-
this.m_shortcuts = [];
|
|
1635
|
-
this.setDomEvent('keydown', (e) => this._handleKeydown(e));
|
|
1636
|
-
}
|
|
1637
|
-
if (!(0, tools_1.isArray)(sequence)) {
|
|
1638
|
-
sequence = [sequence];
|
|
1639
|
-
}
|
|
1640
|
-
sequence.forEach((seq) => {
|
|
1641
|
-
let reseq = '';
|
|
1642
|
-
let shift = seq.match(/SHIFT/i);
|
|
1643
|
-
if (shift) {
|
|
1644
|
-
seq = seq.replace(/SHIFT/i, '');
|
|
1645
|
-
reseq += 'shift+';
|
|
1646
|
-
}
|
|
1647
|
-
let ctrl = seq.match(/CTRL/i);
|
|
1648
|
-
if (ctrl) {
|
|
1649
|
-
seq = seq.replace(/CTRL/i, '');
|
|
1650
|
-
reseq += 'ctrl+';
|
|
1651
|
-
}
|
|
1652
|
-
let cmd = seq.match(/CMD/i);
|
|
1653
|
-
if (cmd) {
|
|
1654
|
-
seq = seq.replace(/CMD/i, '');
|
|
1655
|
-
reseq += 'cmd+';
|
|
1656
|
-
}
|
|
1657
|
-
let alt = seq.match(/ALT/i);
|
|
1658
|
-
if (alt) {
|
|
1659
|
-
seq = seq.replace(/ALT/i, '');
|
|
1660
|
-
reseq += 'alt+';
|
|
1661
|
-
}
|
|
1662
|
-
reseq += seq.replace('+', '').toLowerCase();
|
|
1663
|
-
this.m_shortcuts.push({
|
|
1664
|
-
sequence: reseq,
|
|
1665
|
-
name,
|
|
1666
|
-
immediate,
|
|
1667
|
-
callback
|
|
1668
|
-
});
|
|
1669
|
-
});
|
|
1670
|
-
}
|
|
1671
|
-
/**
|
|
1672
|
-
* remove all shortcuts for a target
|
|
1673
|
-
*/
|
|
1674
|
-
removeShortcuts() {
|
|
1675
|
-
if (this.m_shortcuts) {
|
|
1676
|
-
this.m_shortcuts = [];
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
/** @ignore this function is binded */
|
|
1680
|
-
_handleKeydown(e) {
|
|
1681
|
-
if (!this.m_shortcuts) {
|
|
1682
|
-
return;
|
|
1683
|
-
}
|
|
1684
|
-
let seq = '';
|
|
1685
|
-
if (e.shiftKey) {
|
|
1686
|
-
seq += 'shift+';
|
|
1687
|
-
}
|
|
1688
|
-
if (e.ctrlKey) {
|
|
1689
|
-
seq += 'ctrl+';
|
|
1690
|
-
}
|
|
1691
|
-
if (e.metaKey) {
|
|
1692
|
-
seq += 'cmd+';
|
|
1693
|
-
}
|
|
1694
|
-
if (e.altKey) {
|
|
1695
|
-
seq += 'alt+';
|
|
1696
|
-
}
|
|
1697
|
-
seq += e.key.toLowerCase();
|
|
1698
|
-
//console.log( seq );
|
|
1699
|
-
this.m_shortcuts.some((sk) => {
|
|
1700
|
-
if (sk.sequence == seq) {
|
|
1701
|
-
if (sk.callback) {
|
|
1702
|
-
if (sk.immediate) {
|
|
1703
|
-
sk.callback(e);
|
|
1704
|
-
}
|
|
1705
|
-
else {
|
|
1706
|
-
(0, tools_1.asap)(() => { sk.callback(e); });
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
else {
|
|
1710
|
-
this.emit('shortcut', EvShortcut(sk.name));
|
|
1711
|
-
}
|
|
1712
|
-
e.preventDefault();
|
|
1713
|
-
e.stopPropagation();
|
|
1714
|
-
return true;
|
|
1715
|
-
}
|
|
1716
|
-
});
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
exports.Container = Container;
|