x4js 1.4.16 → 1.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application.d.ts +4 -2
- package/lib/application.js +20 -17
- package/lib/base_component.d.ts +1 -1
- package/lib/base_component.js +3 -3
- package/lib/button.d.ts +1 -1
- package/lib/button.js +3 -3
- package/lib/calendar.d.ts +1 -1
- package/lib/calendar.js +5 -4
- package/lib/canvas.d.ts +1 -1
- package/lib/canvas.js +2 -2
- package/lib/cardview.d.ts +1 -1
- package/lib/cardview.js +2 -2
- package/lib/checkbox.d.ts +1 -1
- package/lib/checkbox.js +2 -2
- package/lib/colorpicker.d.ts +1 -1
- package/lib/colorpicker.js +5 -5
- package/lib/combobox.d.ts +1 -1
- package/lib/combobox.js +3 -3
- package/lib/component.d.ts +1 -5
- package/lib/component.js +35 -39
- package/lib/datastore.d.ts +1 -1
- package/lib/datastore.js +5 -5
- package/lib/dialog.d.ts +1 -1
- package/lib/dialog.js +4 -3
- package/lib/drag_manager.js +30 -1
- package/lib/fileupload.js +2 -1
- package/lib/form.d.ts +1 -1
- package/lib/gridview.d.ts +1 -5
- package/lib/gridview.js +8 -7
- package/lib/i18n.d.ts +35 -33
- package/lib/i18n.js +180 -93
- package/lib/icon.d.ts +1 -1
- package/lib/icon.js +10 -13
- package/lib/image.js +4 -3
- package/lib/index.d.ts +1 -4
- package/lib/index.js +4 -4
- package/lib/input.js +1 -1
- package/lib/link.d.ts +1 -1
- package/lib/link.js +2 -2
- package/lib/listview.d.ts +1 -1
- package/lib/listview.js +10 -9
- package/lib/menu.d.ts +1 -1
- package/lib/menu.js +5 -4
- package/lib/popup.d.ts +1 -1
- package/lib/popup.js +13 -12
- package/lib/property_editor.d.ts +1 -1
- package/lib/property_editor.js +2 -2
- package/lib/radiobtn.d.ts +1 -1
- package/lib/radiobtn.js +4 -3
- package/lib/rating.d.ts +1 -1
- package/lib/rating.js +2 -2
- package/lib/router.d.ts +1 -1
- package/lib/router.js +6 -5
- package/lib/spreadsheet.d.ts +1 -1
- package/lib/spreadsheet.js +9 -8
- package/lib/styles.js +6 -5
- package/lib/svgcomponent.d.ts +1 -1
- package/lib/svgcomponent.js +4 -1
- package/lib/tabbar.d.ts +1 -1
- package/lib/tabbar.js +2 -2
- package/lib/textarea.d.ts +1 -1
- package/lib/textarea.js +2 -2
- package/lib/textedit.d.ts +1 -1
- package/lib/textedit.js +5 -4
- package/lib/tools.d.ts +1 -0
- package/lib/tools.js +15 -6
- package/lib/tooltips.js +6 -5
- package/lib/treeview.d.ts +1 -1
- package/lib/treeview.js +8 -8
- package/lib/x4dom.d.ts +21 -0
- package/lib/x4dom.js +7 -0
- package/lib/x4events.d.ts +266 -0
- package/lib/x4events.js +389 -0
- package/package.json +4 -3
- package/src/application.ts +24 -21
- package/src/base_component.ts +1 -1
- package/src/button.ts +1 -1
- package/src/calendar.ts +5 -3
- package/src/canvas.ts +1 -1
- package/src/cardview.ts +1 -1
- package/src/checkbox.ts +1 -1
- package/src/colorpicker.ts +1 -1
- package/src/combobox.ts +1 -1
- package/src/component.ts +34 -39
- package/src/datastore.ts +1 -1
- package/src/dialog.ts +4 -2
- package/src/drag_manager.ts +4 -1
- package/src/fileupload.ts +2 -1
- package/src/form.ts +1 -1
- package/src/gridview.ts +4 -3
- package/src/hosts/electron.ts +4 -1
- package/src/i18n.ts +234 -97
- package/src/icon.ts +9 -12
- package/src/image.ts +5 -3
- package/src/index.ts +4 -4
- package/src/input.ts +1 -1
- package/src/layout.ts +1 -1
- package/src/link.ts +1 -1
- package/src/listview.ts +6 -4
- package/src/menu.ts +5 -3
- package/src/popup.ts +14 -12
- package/src/property_editor.ts +1 -1
- package/src/radiobtn.ts +4 -2
- package/src/rating.ts +1 -1
- package/src/router.ts +5 -3
- package/src/smartedit.ts +3 -2
- package/src/spreadsheet.ts +8 -6
- package/src/styles.ts +7 -5
- package/src/svgcomponent.ts +4 -1
- package/src/tabbar.ts +1 -1
- package/src/textarea.ts +1 -1
- package/src/textedit.ts +4 -2
- package/src/tools.ts +15 -5
- package/src/tooltips.ts +7 -5
- package/src/treeview.ts +1 -1
- package/src/x4dom.ts +57 -0
- package/src/{x4_events.ts → x4events.ts} +1 -1
- package/tsconfig.json +11 -1
package/src/application.ts
CHANGED
|
@@ -27,13 +27,16 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
-
import {
|
|
30
|
+
import { x4document } from './x4dom'
|
|
31
|
+
import { EvMessage } from './x4events'
|
|
31
32
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component'
|
|
32
33
|
import { Component } from './component'
|
|
33
34
|
import { Settings } from './settings'
|
|
34
35
|
import { deferCall } from './tools'
|
|
35
36
|
import { _tr } from './i18n'
|
|
36
37
|
|
|
38
|
+
const _x4_touch_time = Symbol( );
|
|
39
|
+
|
|
37
40
|
|
|
38
41
|
interface ApplicationEventMap extends BaseComponentEventMap {
|
|
39
42
|
message: EvMessage;
|
|
@@ -92,6 +95,9 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
92
95
|
|
|
93
96
|
private m_local_storage: Settings;
|
|
94
97
|
private m_user_data: any;
|
|
98
|
+
|
|
99
|
+
private m_touch_time: number;
|
|
100
|
+
private m_touch_count: number;
|
|
95
101
|
|
|
96
102
|
constructor( props : P ) {
|
|
97
103
|
console.assert( Application.self===null, 'application is a singleton' );
|
|
@@ -104,6 +110,9 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
104
110
|
let settings_name = `${this.m_app_name}.${this.m_app_version}.settings`;
|
|
105
111
|
this.m_local_storage = new Settings( settings_name );
|
|
106
112
|
this.m_user_data = {};
|
|
113
|
+
|
|
114
|
+
this.m_touch_time = 0;
|
|
115
|
+
this.m_touch_count = 0;
|
|
107
116
|
|
|
108
117
|
(Application.self as any) = this;
|
|
109
118
|
|
|
@@ -165,7 +174,7 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
165
174
|
this.mainView.addClass( 'x4-root-element' );
|
|
166
175
|
|
|
167
176
|
deferCall( ( ) => {
|
|
168
|
-
const dest = this.m_props.renderTo ??
|
|
177
|
+
const dest = this.m_props.renderTo ?? x4document.body;
|
|
169
178
|
while (dest.firstChild) {
|
|
170
179
|
dest.removeChild(dest.firstChild);
|
|
171
180
|
}
|
|
@@ -178,7 +187,7 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
178
187
|
}
|
|
179
188
|
|
|
180
189
|
public setTitle( title: string ) {
|
|
181
|
-
|
|
190
|
+
x4document.title = this.m_app_name + ' > ' + title;
|
|
182
191
|
}
|
|
183
192
|
|
|
184
193
|
public disableZoomWheel( ) {
|
|
@@ -195,37 +204,31 @@ export class Application<P extends ApplicationProps = ApplicationProps, E extend
|
|
|
195
204
|
public enterModal( enter: boolean ) {
|
|
196
205
|
}
|
|
197
206
|
|
|
198
|
-
public
|
|
199
|
-
|
|
207
|
+
public enableTouchDblClick( ) {
|
|
208
|
+
x4document.addEventListener( 'touchstart', ( ev: TouchEvent ) => {
|
|
200
209
|
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if( !me.__last_touch || (me.__last_touch-now) > 700 ) {
|
|
205
|
-
me.__touch_cnt = 1;
|
|
210
|
+
let now = Date.now( );
|
|
211
|
+
if( (now-this.m_touch_time) > 700 ) {
|
|
212
|
+
this.m_touch_count = 1;
|
|
206
213
|
}
|
|
207
214
|
else {
|
|
208
|
-
|
|
215
|
+
this.m_touch_count++;
|
|
209
216
|
}
|
|
210
217
|
|
|
211
|
-
|
|
218
|
+
this.m_touch_time = now;
|
|
212
219
|
|
|
213
|
-
if(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
let fake = {
|
|
217
|
-
type: "dblclick",
|
|
218
|
-
};
|
|
220
|
+
if( this.m_touch_count==2 ) {
|
|
221
|
+
this.m_touch_count = 0;
|
|
219
222
|
|
|
223
|
+
// dirty fake dblclick event
|
|
220
224
|
const tch = ev.touches[0];
|
|
225
|
+
let fake: any = {type: "dblclick" };
|
|
221
226
|
for( const n in tch ) {
|
|
222
227
|
fake[n] = tch[n];
|
|
223
228
|
}
|
|
224
229
|
|
|
225
|
-
//
|
|
230
|
+
// ignore -> private: dirty x2
|
|
226
231
|
(Component as any)._dispatchEvent( fake );
|
|
227
|
-
|
|
228
|
-
ev.preventDefault( );
|
|
229
232
|
ev.stopPropagation( );
|
|
230
233
|
}
|
|
231
234
|
});
|
package/src/base_component.ts
CHANGED
package/src/button.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
import { Component, CProps, CEventMap, HtmlString } from './component'
|
|
32
|
-
import { EventCallback, EvClick, EvChange } from './
|
|
32
|
+
import { EventCallback, EvClick, EvChange } from './x4events'
|
|
33
33
|
|
|
34
34
|
import { Icon, IconID } from './icon'
|
|
35
35
|
import { Label } from './label'
|
package/src/calendar.ts
CHANGED
|
@@ -27,10 +27,12 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
+
import { x4document } from './x4dom'
|
|
31
|
+
|
|
30
32
|
import { Button } from './button';
|
|
31
33
|
import { Popup } from './popup';
|
|
32
34
|
import { Component, CProps, ContainerEventMap, Flex } from './component'
|
|
33
|
-
import { EvChange, EventCallback } from './
|
|
35
|
+
import { EvChange, EventCallback } from './x4events'
|
|
34
36
|
|
|
35
37
|
import { _tr } from './i18n';
|
|
36
38
|
import { Label } from './label';
|
|
@@ -307,13 +309,13 @@ export class PopupCalendar extends Popup {
|
|
|
307
309
|
|
|
308
310
|
/** @ignore */
|
|
309
311
|
show(modal?: boolean) {
|
|
310
|
-
|
|
312
|
+
x4document.addEventListener('mousedown', this._handleClick);
|
|
311
313
|
super.show(modal);
|
|
312
314
|
}
|
|
313
315
|
|
|
314
316
|
/** @ignore */
|
|
315
317
|
close() {
|
|
316
|
-
|
|
318
|
+
x4document.removeEventListener('mousedown', this._handleClick);
|
|
317
319
|
super.close();
|
|
318
320
|
}
|
|
319
321
|
|
package/src/canvas.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
30
|
import { Component, CProps, CEventMap, html } from './component'
|
|
31
|
-
import { BasicEvent, EventCallback } from './
|
|
31
|
+
import { BasicEvent, EventCallback } from './x4events'
|
|
32
32
|
|
|
33
33
|
interface EvPaint extends BasicEvent {
|
|
34
34
|
ctx: CanvasPainter;
|
package/src/cardview.ts
CHANGED
package/src/checkbox.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
30
|
import { CEventMap, Component, CProps } from './component'
|
|
31
|
-
import { EvChange, EventCallback } from './
|
|
31
|
+
import { EvChange, EventCallback } from './x4events'
|
|
32
32
|
import { HtmlString } from './tools'
|
|
33
33
|
|
|
34
34
|
import { Input } from './input'
|
package/src/colorpicker.ts
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
import { Container, Component, ContainerProps, ContainerEventMap } from './component'
|
|
36
36
|
import { CheckBox } from './checkbox'
|
|
37
37
|
import { Dialog, DialogBoxEventMap, DialogProps } from './dialog'
|
|
38
|
-
import { EvChange, EventCallback } from './
|
|
38
|
+
import { EvChange, EventCallback } from './x4events'
|
|
39
39
|
import { VLayout, HLayout } from './layout'
|
|
40
40
|
import { Label } from './label'
|
|
41
41
|
import { Color } from './color'
|
package/src/combobox.ts
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
import { Component, CProps, ContainerEventMap } from './component'
|
|
35
|
-
import { EvChange, EvSelectionChange, EventCallback } from './
|
|
35
|
+
import { EvChange, EvSelectionChange, EventCallback } from './x4events'
|
|
36
36
|
|
|
37
37
|
import { Input } from './input'
|
|
38
38
|
import { Label } from './label'
|
package/src/component.ts
CHANGED
|
@@ -34,9 +34,11 @@
|
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
import { pascalCase, Rect, isString, isArray, Size, Point, isNumber, asap, HtmlString, isHtmlString, Constructor, getMousePos } from './tools';
|
|
37
|
+
import { x4document } from './x4dom';
|
|
38
|
+
|
|
37
39
|
import { Stylesheet, ComputedStyle } from './styles';
|
|
38
40
|
import { _tr } from './i18n';
|
|
39
|
-
import { BasicEvent, EventCallback } from './
|
|
41
|
+
import { BasicEvent, EventCallback } from './x4events';
|
|
40
42
|
import { BaseComponent, BaseComponentProps, BaseComponentEventMap } from './base_component';
|
|
41
43
|
import { IDOMEvents, X4ElementEventMap } from './dom_events';
|
|
42
44
|
|
|
@@ -725,21 +727,12 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
725
727
|
}
|
|
726
728
|
}
|
|
727
729
|
|
|
728
|
-
///@deprecated
|
|
729
|
-
//private build(): void {}
|
|
730
|
-
/**
|
|
731
|
-
* @deprecated
|
|
732
|
-
*/
|
|
733
|
-
|
|
734
|
-
private Build(): void { }
|
|
735
|
-
|
|
736
730
|
public _build(): HTMLElement {
|
|
737
731
|
if (this.m_dom) {
|
|
738
732
|
return this.m_dom;
|
|
739
733
|
}
|
|
740
734
|
|
|
741
735
|
this._createDOM();
|
|
742
|
-
|
|
743
736
|
return this.m_dom;
|
|
744
737
|
}
|
|
745
738
|
|
|
@@ -800,10 +793,10 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
800
793
|
let vdom = this.m_iprops;
|
|
801
794
|
|
|
802
795
|
if (props.ns) {
|
|
803
|
-
this.m_dom = <HTMLElement>
|
|
796
|
+
this.m_dom = <HTMLElement>x4document.createElementNS(props.ns, props.tag ?? 'div');
|
|
804
797
|
}
|
|
805
798
|
else {
|
|
806
|
-
this.m_dom =
|
|
799
|
+
this.m_dom = x4document.createElement( (props.tag ?? 'div') as any );
|
|
807
800
|
}
|
|
808
801
|
|
|
809
802
|
this.m_dom[_x4_el_sym] = this;
|
|
@@ -880,7 +873,7 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
880
873
|
// wait for dom insertion inside document.body
|
|
881
874
|
if (!Component.__createObserver) {
|
|
882
875
|
Component.__createObserver = new MutationObserver(Component._observeCreation);
|
|
883
|
-
Component.__createObserver.observe(
|
|
876
|
+
Component.__createObserver.observe(x4document.body, { childList: true, subtree: true });
|
|
884
877
|
}
|
|
885
878
|
|
|
886
879
|
return this.m_dom;
|
|
@@ -1190,10 +1183,10 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1190
1183
|
Component.__privateEvents[name] = true; // todo count it
|
|
1191
1184
|
|
|
1192
1185
|
if (passiveEvents[name]) {
|
|
1193
|
-
|
|
1186
|
+
x4document.addEventListener(name as any, Component._dispatchEvent, { passive: false, capture: true });
|
|
1194
1187
|
}
|
|
1195
1188
|
else {
|
|
1196
|
-
|
|
1189
|
+
x4document.addEventListener(name as any, Component._dispatchEvent, true);
|
|
1197
1190
|
}
|
|
1198
1191
|
}
|
|
1199
1192
|
|
|
@@ -1415,8 +1408,8 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1415
1408
|
*
|
|
1416
1409
|
*/
|
|
1417
1410
|
|
|
1418
|
-
private static dispatchCaptures(event:
|
|
1419
|
-
Component.__capture.handler(event);
|
|
1411
|
+
private static dispatchCaptures(event: Event) {
|
|
1412
|
+
Component.__capture.handler(event as UIEvent);
|
|
1420
1413
|
}
|
|
1421
1414
|
|
|
1422
1415
|
/**
|
|
@@ -1447,12 +1440,12 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1447
1440
|
|
|
1448
1441
|
// todo: review that
|
|
1449
1442
|
|
|
1450
|
-
let iframes =
|
|
1443
|
+
let iframes = x4document.querySelectorAll<HTMLIFrameElement>("iframe");
|
|
1451
1444
|
iframes.forEach( f => {
|
|
1452
1445
|
flyWrap(f).setStyleValue( 'pointer-events', 'none' );
|
|
1453
1446
|
});
|
|
1454
1447
|
|
|
1455
|
-
let overs =
|
|
1448
|
+
let overs = x4document.querySelectorAll(":hover");
|
|
1456
1449
|
|
|
1457
1450
|
let cursor = null;
|
|
1458
1451
|
if (overs.length) {
|
|
@@ -1461,7 +1454,7 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1461
1454
|
cursor = style.cursor;
|
|
1462
1455
|
}
|
|
1463
1456
|
|
|
1464
|
-
Component.__capture_mask =
|
|
1457
|
+
Component.__capture_mask = x4document.createElement('div');
|
|
1465
1458
|
let mask = flyWrap(Component.__capture_mask);
|
|
1466
1459
|
mask.addClass('@capture-mask');
|
|
1467
1460
|
|
|
@@ -1469,15 +1462,15 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1469
1462
|
mask.setStyleValue('cursor', cursor);
|
|
1470
1463
|
}
|
|
1471
1464
|
|
|
1472
|
-
|
|
1465
|
+
x4document.body.appendChild(mask.dom);
|
|
1473
1466
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1467
|
+
x4document.addEventListener('mousedown', Component.dispatchCaptures);
|
|
1468
|
+
x4document.addEventListener('mousemove', Component.dispatchCaptures);
|
|
1469
|
+
x4document.addEventListener('mouseup', Component.dispatchCaptures);
|
|
1477
1470
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1471
|
+
x4document.addEventListener('touchstart', Component.dispatchCaptures);
|
|
1472
|
+
x4document.addEventListener('touchmove', Component.dispatchCaptures);
|
|
1473
|
+
x4document.addEventListener('touchend', Component.dispatchCaptures);
|
|
1481
1474
|
|
|
1482
1475
|
Component.__capture = {
|
|
1483
1476
|
initiator,
|
|
@@ -1490,13 +1483,13 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1490
1483
|
|
|
1491
1484
|
console.assert(!!Component.__capture);
|
|
1492
1485
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1486
|
+
x4document.removeEventListener('touchstart', Component.dispatchCaptures);
|
|
1487
|
+
x4document.removeEventListener('touchmove', Component.dispatchCaptures);
|
|
1488
|
+
x4document.removeEventListener('touchend', Component.dispatchCaptures);
|
|
1496
1489
|
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1490
|
+
x4document.removeEventListener('mousedown', Component.dispatchCaptures);
|
|
1491
|
+
x4document.removeEventListener('mousemove', Component.dispatchCaptures);
|
|
1492
|
+
x4document.removeEventListener('mouseup', Component.dispatchCaptures);
|
|
1500
1493
|
|
|
1501
1494
|
Component.__capture.iframes.forEach( f => {
|
|
1502
1495
|
flyWrap(f).setStyleValue( 'pointer-events', null );
|
|
@@ -1504,7 +1497,7 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1504
1497
|
|
|
1505
1498
|
Component.__capture = null;
|
|
1506
1499
|
if (Component.__capture_mask) {
|
|
1507
|
-
|
|
1500
|
+
x4document.body.removeChild(Component.__capture_mask);
|
|
1508
1501
|
Component.__capture_mask = null;
|
|
1509
1502
|
}
|
|
1510
1503
|
}
|
|
@@ -1525,7 +1518,9 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1525
1518
|
let right = undefined;
|
|
1526
1519
|
|
|
1527
1520
|
let pn = this.dom.parentElement;
|
|
1528
|
-
|
|
1521
|
+
const bdy = x4document.body;
|
|
1522
|
+
|
|
1523
|
+
while( pn && pn!=bdy ) {
|
|
1529
1524
|
|
|
1530
1525
|
const pr = pn.getBoundingClientRect( );
|
|
1531
1526
|
|
|
@@ -1696,18 +1691,18 @@ export class Component<P extends CProps<BaseComponentEventMap> = CProps<BaseComp
|
|
|
1696
1691
|
static getScrollbarSize() {
|
|
1697
1692
|
|
|
1698
1693
|
if (Component.__sb_width === undefined) {
|
|
1699
|
-
let outerDiv =
|
|
1694
|
+
let outerDiv = x4document.createElement('div');
|
|
1700
1695
|
outerDiv.style.cssText = 'overflow:auto;position:absolute;top:0;width:100px;height:100px';
|
|
1701
1696
|
|
|
1702
|
-
let innerDiv =
|
|
1697
|
+
let innerDiv = x4document.createElement('div');
|
|
1703
1698
|
innerDiv.style.width = '200px';
|
|
1704
1699
|
innerDiv.style.height = '200px';
|
|
1705
1700
|
|
|
1706
1701
|
outerDiv.appendChild(innerDiv);
|
|
1707
|
-
|
|
1702
|
+
x4document.body.appendChild(outerDiv);
|
|
1708
1703
|
|
|
1709
1704
|
Component.__sb_width = outerDiv.offsetWidth - outerDiv.clientWidth;
|
|
1710
|
-
|
|
1705
|
+
x4document.body.removeChild(outerDiv);
|
|
1711
1706
|
}
|
|
1712
1707
|
|
|
1713
1708
|
return Component.__sb_width;
|
package/src/datastore.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
import { ajaxRequest } from './request';
|
|
31
31
|
import { isArray, isString } from './tools';
|
|
32
|
-
import { BasicEvent, EvChange, EventSource, EventMap, MapEvents } from './
|
|
32
|
+
import { BasicEvent, EvChange, EventSource, EventMap, MapEvents } from './x4events';
|
|
33
33
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component';
|
|
34
34
|
|
|
35
35
|
export type ChangeCallback = (type: string, id?: any) => void;
|
package/src/dialog.ts
CHANGED
|
@@ -27,13 +27,15 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
+
import { x4document } from './x4dom'
|
|
31
|
+
|
|
30
32
|
import { Popup, PopupProps, PopupEventMap, EvMove } from './popup'
|
|
31
33
|
import { Icon, IconID } from './icon'
|
|
32
34
|
import { HLayout } from './layout'
|
|
33
35
|
import { Label } from './label'
|
|
34
36
|
import { Form, FormButtons } from './form'
|
|
35
37
|
import { Component, ComponentContent, EvSize, flyWrap } from './component'
|
|
36
|
-
import { BasicEvent, EventCallback } from './
|
|
38
|
+
import { BasicEvent, EventCallback } from './x4events'
|
|
37
39
|
import { Rect, getMousePos, isFunction, isTouchDevice, isString, Size } from './tools'
|
|
38
40
|
|
|
39
41
|
interface Geometry {
|
|
@@ -458,7 +460,7 @@ export class Dialog<P extends DialogProps = DialogProps, E extends DialogBoxEven
|
|
|
458
460
|
|
|
459
461
|
let { x, y } = getMousePos(event, true);
|
|
460
462
|
|
|
461
|
-
let wrc = flyWrap(
|
|
463
|
+
let wrc = flyWrap(x4document.body).getBoundingRect();
|
|
462
464
|
let rc = this.getBoundingRect(true);
|
|
463
465
|
let trc = this.m_el_title.getBoundingRect();
|
|
464
466
|
|
package/src/drag_manager.ts
CHANGED
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
|
+
|
|
30
|
+
import { x4document } from './x4dom'
|
|
31
|
+
|
|
29
32
|
import { Component } from './component';
|
|
30
33
|
import { Point } from './tools';
|
|
31
34
|
|
|
@@ -61,7 +64,7 @@ class DragManager {
|
|
|
61
64
|
this.dragGhost = el.dom.cloneNode(true) as HTMLElement;
|
|
62
65
|
|
|
63
66
|
this.dragGhost.classList.add('dragged');
|
|
64
|
-
|
|
67
|
+
x4document.body.appendChild(this.dragGhost);
|
|
65
68
|
|
|
66
69
|
el.addClass( 'dragging' );
|
|
67
70
|
|
package/src/fileupload.ts
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
**/
|
|
29
29
|
|
|
30
|
+
import { x4document } from './x4dom'
|
|
30
31
|
import { Component, CProps } from './component'
|
|
31
32
|
|
|
32
33
|
import { HLayout } from './layout'
|
|
@@ -157,7 +158,7 @@ function _createFileInput() {
|
|
|
157
158
|
});
|
|
158
159
|
|
|
159
160
|
// ajoute un input type:file caché pour pouvoir choir un fichier a ouvrir
|
|
160
|
-
|
|
161
|
+
x4document.body.appendChild(g_file_input._build());
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
g_file_input.clearDomEvent('change');
|
package/src/form.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { Button } from './button'
|
|
|
33
33
|
import { Input } from './input'
|
|
34
34
|
import { TextEdit } from './textedit'
|
|
35
35
|
import { ajaxRequest, RequestProps } from './request'
|
|
36
|
-
import { EventCallback } from './
|
|
36
|
+
import { EventCallback } from './x4events'
|
|
37
37
|
import { EvBtnClick } from './dialog'
|
|
38
38
|
|
|
39
39
|
import { _tr } from './i18n'
|
package/src/gridview.ts
CHANGED
|
@@ -34,6 +34,7 @@ const T_UPDATE = Symbol('update');
|
|
|
34
34
|
* todo: button in a column
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
+
import { x4document } from './x4dom'
|
|
37
38
|
|
|
38
39
|
import { HLayout, VLayout } from './layout'
|
|
39
40
|
import { Component, ContainerEventMap, EvSize, EvDblClick, CProps, flyWrap, html, HtmlString, SizerOverlay, Flex } from './component'
|
|
@@ -43,7 +44,7 @@ import * as Formatters from './formatters'
|
|
|
43
44
|
import { downloadData } from './tools'
|
|
44
45
|
import { DataView, DataStore, Record } from './datastore'
|
|
45
46
|
|
|
46
|
-
import { EvContextMenu, EvSelectionChange, BasicEvent, EventDisposer } from "./
|
|
47
|
+
import { EvContextMenu, EvSelectionChange, BasicEvent, EventDisposer } from "./x4events";
|
|
47
48
|
import { Icon } from './icon.js';
|
|
48
49
|
|
|
49
50
|
export interface EvGridCheck extends BasicEvent {
|
|
@@ -618,10 +619,10 @@ export class GridView extends VLayout<GridViewProps, GridViewEventMap> {
|
|
|
618
619
|
*/
|
|
619
620
|
|
|
620
621
|
private _computeItemHeight() {
|
|
621
|
-
let gr =
|
|
622
|
+
let gr = x4document.createElement('div');
|
|
622
623
|
gr.classList.add('x-row');
|
|
623
624
|
|
|
624
|
-
let gv =
|
|
625
|
+
let gv = x4document.createElement('div');
|
|
625
626
|
gv.classList.add('x-grid-view');
|
|
626
627
|
gv.style.position = 'absolute';
|
|
627
628
|
gv.style.top = '-1000px';
|
package/src/hosts/electron.ts
CHANGED
|
@@ -17,11 +17,14 @@
|
|
|
17
17
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
18
|
**/
|
|
19
19
|
|
|
20
|
+
import { x4document } from '../dom-gen'
|
|
20
21
|
import { FileStat, PathType, PartType, Host } from './host'
|
|
21
22
|
|
|
22
23
|
export * from './host';
|
|
23
24
|
|
|
25
|
+
declare const require;
|
|
24
26
|
declare const host_require;
|
|
27
|
+
|
|
25
28
|
if( !globalThis.host_require ) {
|
|
26
29
|
globalThis.host_require = require;
|
|
27
30
|
}
|
|
@@ -154,7 +157,7 @@ export class ElectronHost extends Host {
|
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
createCanvas = ( ) => {
|
|
157
|
-
return
|
|
160
|
+
return x4document.createElement('canvas');
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
|