@web-atoms/core 2.3.0 → 2.3.3
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/dist/core/AtomComponent.d.ts +19 -28
- package/dist/core/AtomComponent.d.ts.map +1 -1
- package/dist/core/AtomComponent.js +8 -18
- package/dist/core/AtomComponent.js.map +1 -1
- package/dist/core/Hacks.d.ts +7 -0
- package/dist/core/Hacks.d.ts.map +1 -0
- package/dist/core/Hacks.js +66 -0
- package/dist/core/Hacks.js.map +1 -0
- package/dist/core/InjectProperty.d.ts +1 -1
- package/dist/core/InjectProperty.d.ts.map +1 -1
- package/dist/core/InjectProperty.js.map +1 -1
- package/dist/core/WatchProperty.d.ts +1 -1
- package/dist/core/WatchProperty.d.ts.map +1 -1
- package/dist/core/WatchProperty.js.map +1 -1
- package/dist/services/http/RestService.d.ts.map +1 -1
- package/dist/services/http/RestService.js +2 -13
- package/dist/services/http/RestService.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/controls/AtomControl.d.ts +1 -1
- package/dist/web/controls/AtomControl.d.ts.map +1 -1
- package/dist/web/controls/AtomControl.js +7 -9
- package/dist/web/controls/AtomControl.js.map +1 -1
- package/dist/web/controls/AtomGridView.js +5 -5
- package/dist/web/controls/AtomGridView.js.map +1 -1
- package/package.json +1 -1
- package/src/core/AtomComponent.ts +32 -60
- package/src/core/Hacks.ts +62 -0
- package/src/core/InjectProperty.ts +1 -1
- package/src/core/WatchProperty.ts +1 -1
- package/src/services/http/RestService.ts +9 -10
- package/src/web/controls/AtomControl.ts +4 -9
- package/src/web/controls/AtomGridView.ts +2 -2
- package/dist/core/AtomBridge.d.ts +0 -60
- package/dist/core/AtomBridge.d.ts.map +0 -1
- package/dist/core/AtomBridge.js +0 -308
- package/dist/core/AtomBridge.js.map +0 -1
- package/dist/xf/XFApp.d.ts +0 -11
- package/dist/xf/XFApp.d.ts.map +0 -1
- package/dist/xf/XFApp.js +0 -65
- package/dist/xf/XFApp.js.map +0 -1
- package/dist/xf/controls/AtomXFControl.d.ts +0 -27
- package/dist/xf/controls/AtomXFControl.d.ts.map +0 -1
- package/dist/xf/controls/AtomXFControl.js +0 -246
- package/dist/xf/controls/AtomXFControl.js.map +0 -1
- package/dist/xf/services/XFBusyIndicatorService.d.ts +0 -6
- package/dist/xf/services/XFBusyIndicatorService.d.ts.map +0 -1
- package/dist/xf/services/XFBusyIndicatorService.js +0 -31
- package/dist/xf/services/XFBusyIndicatorService.js.map +0 -1
- package/dist/xf/services/XFNavigationService.d.ts +0 -21
- package/dist/xf/services/XFNavigationService.d.ts.map +0 -1
- package/dist/xf/services/XFNavigationService.js +0 -139
- package/dist/xf/services/XFNavigationService.js.map +0 -1
- package/src/core/AtomBridge.ts +0 -430
- package/src/xf/XFApp.ts +0 -58
- package/src/xf/controls/AtomXFControl.ts +0 -297
- package/src/xf/services/XFBusyIndicatorService.ts +0 -18
- package/src/xf/services/XFNavigationService.ts +0 -162
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { App } from "../App";
|
|
2
|
-
import {
|
|
3
|
-
import { ArrayHelper, CancelToken, IAnyInstanceType, IAtomElement,
|
|
2
|
+
import { ArrayHelper, CancelToken, IAnyInstanceType,
|
|
4
3
|
IDisposable, ignoreValue, INotifyPropertyChanged, PathList } from "../core/types";
|
|
5
4
|
import { Inject } from "../di/Inject";
|
|
6
|
-
import {
|
|
5
|
+
import type { AtomControl } from "../web/controls/AtomControl";
|
|
7
6
|
import { AtomDisposableList } from "./AtomDisposableList";
|
|
8
|
-
import { AtomOnce } from "./AtomOnce";
|
|
9
7
|
import { AtomWatcher, ObjectProperty } from "./AtomWatcher";
|
|
10
|
-
import
|
|
8
|
+
import { bindSymbol } from "./Bind";
|
|
9
|
+
import { visitDescendents, watchProperty } from "./Hacks";
|
|
11
10
|
import { InheritedProperty } from "./InheritedProperty";
|
|
12
11
|
import { IValueConverter } from "./IValueConverter";
|
|
13
12
|
import { PropertyMap } from "./PropertyMap";
|
|
14
|
-
import XNode, {
|
|
15
|
-
|
|
13
|
+
import XNode, {
|
|
14
|
+
IElementAttributes, isControl, isFactorySymbol, xnodeSymbol } from "./XNode";
|
|
16
15
|
|
|
17
|
-
interface IEventObject
|
|
16
|
+
interface IEventObject {
|
|
18
17
|
|
|
19
|
-
element:
|
|
18
|
+
element: HTMLElement;
|
|
20
19
|
|
|
21
20
|
name?: string;
|
|
22
21
|
|
|
@@ -28,38 +27,10 @@ interface IEventObject<T> {
|
|
|
28
27
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
export interface IAtomComponent<T> {
|
|
32
|
-
element: T;
|
|
33
|
-
data: any;
|
|
34
|
-
viewModel: any;
|
|
35
|
-
localViewModel: any;
|
|
36
|
-
app: App;
|
|
37
|
-
setLocalValue(e: T, name: string, value: any): void;
|
|
38
|
-
hasProperty(name: string);
|
|
39
|
-
runAfterInit(f: () => void ): void;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
43
|
-
|
|
44
30
|
const localBindSymbol = bindSymbol;
|
|
45
31
|
const localXNodeSymbol = xnodeSymbol;
|
|
46
32
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const isFactory = isFactorySymbol;
|
|
50
|
-
|
|
51
|
-
const isAtomControl = isControl;
|
|
52
|
-
|
|
53
|
-
const localBridge = AtomBridge;
|
|
54
|
-
|
|
55
|
-
const renderFirst = AtomBridge.platform === "xf";
|
|
56
|
-
|
|
57
|
-
const attached = attachedSymbol;
|
|
58
|
-
|
|
59
|
-
const constructorNeedsArguments = constructorNeedsArgumentsSymbol;
|
|
60
|
-
|
|
61
|
-
export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComponent<T>>
|
|
62
|
-
implements IAtomComponent<IAtomElement>,
|
|
33
|
+
export abstract class AtomComponent implements
|
|
63
34
|
INotifyPropertyChanged {
|
|
64
35
|
|
|
65
36
|
public static readonly [isControl] = true;
|
|
@@ -69,7 +40,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
69
40
|
// public element: T;
|
|
70
41
|
public readonly disposables: AtomDisposableList;
|
|
71
42
|
|
|
72
|
-
public readonly element:
|
|
43
|
+
public readonly element: HTMLElement;
|
|
73
44
|
|
|
74
45
|
@InheritedProperty
|
|
75
46
|
public data: any;
|
|
@@ -145,7 +116,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
145
116
|
// AtomBridge.refreshInherited(this, "localViewModel");
|
|
146
117
|
// }
|
|
147
118
|
|
|
148
|
-
public abstract get parent():
|
|
119
|
+
public abstract get parent(): AtomControl;
|
|
149
120
|
|
|
150
121
|
/** Do not ever use, only available as intellisense feature for
|
|
151
122
|
* vs code editor.
|
|
@@ -159,13 +130,13 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
159
130
|
// return AtomBridge.instance.templateParent(this.element);
|
|
160
131
|
// }
|
|
161
132
|
|
|
162
|
-
private readonly eventHandlers: Array<IEventObject
|
|
133
|
+
private readonly eventHandlers: Array<IEventObject>;
|
|
163
134
|
|
|
164
|
-
private readonly bindings: Array<PropertyBinding
|
|
135
|
+
private readonly bindings: Array<PropertyBinding>;
|
|
165
136
|
|
|
166
137
|
constructor(
|
|
167
138
|
@Inject public readonly app: App,
|
|
168
|
-
element
|
|
139
|
+
element = null as HTMLElement) {
|
|
169
140
|
this.disposables = new AtomDisposableList();
|
|
170
141
|
this.bindings = [];
|
|
171
142
|
this.eventHandlers = [];
|
|
@@ -178,10 +149,10 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
178
149
|
app.callLater(() => a.dispose());
|
|
179
150
|
}
|
|
180
151
|
|
|
181
|
-
public abstract atomParent(e:
|
|
152
|
+
public abstract atomParent(e: HTMLElement): AtomControl;
|
|
182
153
|
|
|
183
154
|
public bind(
|
|
184
|
-
element:
|
|
155
|
+
element: HTMLElement,
|
|
185
156
|
name: string,
|
|
186
157
|
path: PathList[],
|
|
187
158
|
twoWays?: boolean | string[],
|
|
@@ -210,7 +181,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
210
181
|
* @param element T
|
|
211
182
|
* @param name string
|
|
212
183
|
*/
|
|
213
|
-
public unbind(element:
|
|
184
|
+
public unbind(element: HTMLElement, name?: string): void {
|
|
214
185
|
const toDelete = this.bindings.filter( (x) => x.element === element && (!name || (x.name === name)));
|
|
215
186
|
for (const iterator of toDelete) {
|
|
216
187
|
iterator.dispose();
|
|
@@ -219,7 +190,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
219
190
|
}
|
|
220
191
|
|
|
221
192
|
public bindEvent(
|
|
222
|
-
element:
|
|
193
|
+
element: HTMLElement,
|
|
223
194
|
name?: string,
|
|
224
195
|
method?: EventListenerOrEventListenerObject,
|
|
225
196
|
key?: string,
|
|
@@ -230,7 +201,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
230
201
|
if (!method) {
|
|
231
202
|
return;
|
|
232
203
|
}
|
|
233
|
-
const be: IEventObject
|
|
204
|
+
const be: IEventObject = {
|
|
234
205
|
element,
|
|
235
206
|
name,
|
|
236
207
|
handler: method
|
|
@@ -281,7 +252,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
281
252
|
}
|
|
282
253
|
|
|
283
254
|
public unbindEvent(
|
|
284
|
-
element:
|
|
255
|
+
element: HTMLElement,
|
|
285
256
|
name?: string,
|
|
286
257
|
method?: EventListenerOrEventListenerObject,
|
|
287
258
|
key?: string): void {
|
|
@@ -335,7 +306,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
335
306
|
* @param name string
|
|
336
307
|
* @param value any
|
|
337
308
|
*/
|
|
338
|
-
public setPrimitiveValue(element:
|
|
309
|
+
public setPrimitiveValue(element: HTMLElement, name: string, value: any): void {
|
|
339
310
|
const p = value as Promise<any>;
|
|
340
311
|
if (p && p.then && p.catch) {
|
|
341
312
|
// tslint:disable-next-line: no-console
|
|
@@ -372,7 +343,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
372
343
|
}
|
|
373
344
|
}
|
|
374
345
|
|
|
375
|
-
public setLocalValue(element:
|
|
346
|
+
public setLocalValue(element: HTMLElement, name: string, value: any): void {
|
|
376
347
|
|
|
377
348
|
// if value is a promise
|
|
378
349
|
const p = value as Promise<any>;
|
|
@@ -404,14 +375,14 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
404
375
|
}
|
|
405
376
|
}
|
|
406
377
|
|
|
407
|
-
public dispose(e?:
|
|
378
|
+
public dispose(e?: HTMLElement): void {
|
|
408
379
|
|
|
409
380
|
if (this.mInvalidated) {
|
|
410
381
|
clearTimeout(this.mInvalidated);
|
|
411
382
|
this.mInvalidated = 0;
|
|
412
383
|
}
|
|
413
384
|
|
|
414
|
-
|
|
385
|
+
visitDescendents(e || this.element as any, (ex, ac) => {
|
|
415
386
|
if (ac) {
|
|
416
387
|
ac.dispose();
|
|
417
388
|
return false;
|
|
@@ -451,7 +422,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
451
422
|
}
|
|
452
423
|
}
|
|
453
424
|
|
|
454
|
-
public abstract append(element:
|
|
425
|
+
public abstract append(element: HTMLElement | AtomControl): AtomControl;
|
|
455
426
|
|
|
456
427
|
// tslint:disable-next-line:no-empty
|
|
457
428
|
public onPropertyChanged(name: string): void {
|
|
@@ -629,8 +600,9 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
629
600
|
|
|
630
601
|
}
|
|
631
602
|
|
|
632
|
-
protected setElementValue(element:
|
|
633
|
-
|
|
603
|
+
protected setElementValue(element: HTMLElement, name: string, value: any): void {
|
|
604
|
+
// setValue(element, name, value);
|
|
605
|
+
element[name] = value;
|
|
634
606
|
}
|
|
635
607
|
|
|
636
608
|
protected resolve<TService>(
|
|
@@ -667,7 +639,7 @@ export abstract class AtomComponent<T extends IAtomElement, TC extends IAtomComp
|
|
|
667
639
|
|
|
668
640
|
}
|
|
669
641
|
|
|
670
|
-
export class PropertyBinding
|
|
642
|
+
export class PropertyBinding implements IDisposable {
|
|
671
643
|
|
|
672
644
|
public path: ObjectProperty[][];
|
|
673
645
|
|
|
@@ -681,8 +653,8 @@ export class PropertyBinding<T extends IAtomElement> implements IDisposable {
|
|
|
681
653
|
private disposed: boolean;
|
|
682
654
|
|
|
683
655
|
constructor(
|
|
684
|
-
private target:
|
|
685
|
-
public readonly element:
|
|
656
|
+
private target: AtomControl | any,
|
|
657
|
+
public readonly element: HTMLElement,
|
|
686
658
|
public readonly name: string,
|
|
687
659
|
path: PathList[],
|
|
688
660
|
private twoWays: boolean | string[],
|
|
@@ -763,7 +735,7 @@ export class PropertyBinding<T extends IAtomElement> implements IDisposable {
|
|
|
763
735
|
events = this.twoWays;
|
|
764
736
|
}
|
|
765
737
|
|
|
766
|
-
this.twoWaysDisposable =
|
|
738
|
+
this.twoWaysDisposable = watchProperty(
|
|
767
739
|
this.element,
|
|
768
740
|
this.name,
|
|
769
741
|
events,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AtomControl } from "../web/controls/AtomControl";
|
|
2
|
+
import { ChildEnumerator } from "../web/core/AtomUI";
|
|
3
|
+
import { AtomBinder } from "./AtomBinder";
|
|
4
|
+
import { IDisposable } from "./types";
|
|
5
|
+
|
|
6
|
+
export const visitDescendents = (element: HTMLElement, action: (e: HTMLElement, ac: AtomControl) => boolean): void => {
|
|
7
|
+
|
|
8
|
+
for (const iterator of ChildEnumerator.enumerate(element)) {
|
|
9
|
+
const eAny = iterator as any;
|
|
10
|
+
const ac = eAny ? eAny.atomControl : undefined;
|
|
11
|
+
if (!action(iterator, ac)) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
visitDescendents(iterator, action);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const refreshInherited = (target: AtomControl, name: string, fieldName?: string ) => {
|
|
19
|
+
AtomBinder.refreshValue(target, name);
|
|
20
|
+
if (!fieldName) {
|
|
21
|
+
fieldName = "m" + name[0].toUpperCase() + name.substr(1);
|
|
22
|
+
}
|
|
23
|
+
if (!target.element) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
visitDescendents(target.element, (e, ac) => {
|
|
27
|
+
if (ac) {
|
|
28
|
+
if (ac[fieldName] === undefined) {
|
|
29
|
+
refreshInherited(ac as any, name, fieldName);
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const watchProperty = (element: HTMLElement, name: string, events: string[], f: (v: any) => void): IDisposable => {
|
|
38
|
+
if (events.indexOf("change") === -1) {
|
|
39
|
+
events.push("change");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const l = (e) => {
|
|
43
|
+
const e1 = element as HTMLInputElement;
|
|
44
|
+
const v = e1.type === "checkbox" ? e1.checked : e1.value;
|
|
45
|
+
f(v);
|
|
46
|
+
};
|
|
47
|
+
for (const iterator of events) {
|
|
48
|
+
element.addEventListener(iterator, l , false);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
dispose: () => {
|
|
53
|
+
for (const iterator of events) {
|
|
54
|
+
element.removeEventListener(iterator, l, false);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const setValue = (element: HTMLElement, name: string, value: any) => {
|
|
61
|
+
element[name] = value;
|
|
62
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AtomComponent } from "./AtomComponent";
|
|
2
2
|
|
|
3
|
-
export default function InjectProperty(target: AtomComponent
|
|
3
|
+
export default function InjectProperty(target: AtomComponent, key: string): void {
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(target, key, {
|
|
6
6
|
get: function() {
|
|
@@ -2,7 +2,7 @@ import { AtomBinder } from "./AtomBinder";
|
|
|
2
2
|
import type { AtomComponent } from "./AtomComponent";
|
|
3
3
|
import { AtomWatcher } from "./AtomWatcher";
|
|
4
4
|
|
|
5
|
-
export default function WatchProperty(target: AtomComponent
|
|
5
|
+
export default function WatchProperty(target: AtomComponent, key: string, descriptor: any): any {
|
|
6
6
|
|
|
7
7
|
const { get } = descriptor;
|
|
8
8
|
const isSetup = Symbol.for(`isSetup${key}`);
|
|
@@ -2,7 +2,6 @@ import { AjaxOptions } from "./AjaxOptions";
|
|
|
2
2
|
|
|
3
3
|
import { App } from "../../App";
|
|
4
4
|
import { Atom } from "../../Atom";
|
|
5
|
-
import { AtomBridge } from "../../core/AtomBridge";
|
|
6
5
|
import { CancelToken, INameValuePairs } from "../../core/types";
|
|
7
6
|
import { Inject } from "../../di/Inject";
|
|
8
7
|
import { TypeKey } from "../../di/TypeKey";
|
|
@@ -637,15 +636,15 @@ export class BaseService {
|
|
|
637
636
|
throw new Error("cancelled");
|
|
638
637
|
}
|
|
639
638
|
|
|
640
|
-
if (AtomBridge.instance.ajax) {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
639
|
+
// if (AtomBridge.instance.ajax) {
|
|
640
|
+
// return await new Promise<AjaxOptions>((resolve, reject) => {
|
|
641
|
+
// AtomBridge.instance.ajax(url, options, (r) => {
|
|
642
|
+
// resolve(options);
|
|
643
|
+
// }, (e) => {
|
|
644
|
+
// reject(e);
|
|
645
|
+
// }, null);
|
|
646
|
+
// });
|
|
647
|
+
// }
|
|
649
648
|
|
|
650
649
|
const xhr = new XMLHttpRequest();
|
|
651
650
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { App } from "../../App";
|
|
2
2
|
import { AtomBinder } from "../../core/AtomBinder";
|
|
3
|
-
import { AtomBridge, AtomElementBridge } from "../../core/AtomBridge";
|
|
4
3
|
import { AtomComponent } from "../../core/AtomComponent";
|
|
5
4
|
import { AtomDispatcher } from "../../core/AtomDispatcher";
|
|
6
5
|
import { BindableProperty } from "../../core/BindableProperty";
|
|
7
6
|
import Command from "../../core/Command";
|
|
8
7
|
import FormattedString from "../../core/FormattedString";
|
|
8
|
+
import { refreshInherited, visitDescendents } from "../../core/Hacks";
|
|
9
9
|
import WebImage from "../../core/WebImage";
|
|
10
10
|
import XNode, { elementFactorySymbol, isControl } from "../../core/XNode";
|
|
11
11
|
import { TypeKey } from "../../di/TypeKey";
|
|
@@ -31,8 +31,6 @@ if (typeof bridge !== "undefined" && bridge.platform) {
|
|
|
31
31
|
throw new Error("AtomControl of Web should not be used with Xamarin Forms");
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const bridgeInstance = AtomBridge.instance;
|
|
35
|
-
|
|
36
34
|
declare global {
|
|
37
35
|
// tslint:disable-next-line:interface-name
|
|
38
36
|
export interface HTMLElement {
|
|
@@ -257,7 +255,7 @@ export type PropertyRegistration = ((value) => ({[key: string]: any})) & {
|
|
|
257
255
|
/**
|
|
258
256
|
* AtomControl class represents UI Component for a web browser.
|
|
259
257
|
*/
|
|
260
|
-
export class AtomControl extends AtomComponent
|
|
258
|
+
export class AtomControl extends AtomComponent {
|
|
261
259
|
|
|
262
260
|
public static from<T = AtomControl>(e1: Element | EventTarget): T {
|
|
263
261
|
let e = e1 as any;
|
|
@@ -338,7 +336,7 @@ export class AtomControl extends AtomComponent<HTMLElement, AtomControl> {
|
|
|
338
336
|
}
|
|
339
337
|
public set theme(v: AtomStyleSheet) {
|
|
340
338
|
this.mTheme = v;
|
|
341
|
-
|
|
339
|
+
refreshInherited(this, "theme");
|
|
342
340
|
}
|
|
343
341
|
|
|
344
342
|
/**
|
|
@@ -400,7 +398,7 @@ export class AtomControl extends AtomComponent<HTMLElement, AtomControl> {
|
|
|
400
398
|
|
|
401
399
|
public updateSize(): void {
|
|
402
400
|
this.onUpdateSize();
|
|
403
|
-
|
|
401
|
+
visitDescendents(this.element, (e, ac) => {
|
|
404
402
|
if (ac) {
|
|
405
403
|
ac.updateSize();
|
|
406
404
|
return false;
|
|
@@ -572,7 +570,6 @@ export class AtomControl extends AtomComponent<HTMLElement, AtomControl> {
|
|
|
572
570
|
const forName = attributes?.for;
|
|
573
571
|
const ctrl = new (name)(app,
|
|
574
572
|
forName ? document.createElement(forName) : undefined);
|
|
575
|
-
ctrl.creator = creator;
|
|
576
573
|
const element = ctrl.element ;
|
|
577
574
|
e?.appendChild(element);
|
|
578
575
|
ctrl.render(iterator, element, creator);
|
|
@@ -734,5 +731,3 @@ window.addEventListener("click", (e) => {
|
|
|
734
731
|
control.dispatchClickEvent(e, data);
|
|
735
732
|
}
|
|
736
733
|
});
|
|
737
|
-
|
|
738
|
-
bridgeInstance.controlFactory = AtomControl;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AtomBridge } from "../../core/AtomBridge";
|
|
2
1
|
import { BindableProperty } from "../../core/BindableProperty";
|
|
2
|
+
import { visitDescendents } from "../../core/Hacks";
|
|
3
3
|
import { IRect } from "../../core/types";
|
|
4
4
|
import { AtomControl } from "./AtomControl";
|
|
5
5
|
|
|
@@ -263,7 +263,7 @@ export class AtomGridView extends AtomControl {
|
|
|
263
263
|
host.style.left = `${colStart}px`;
|
|
264
264
|
host.style.width = `${colSize}px`;
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
visitDescendents(host, (el, ac) => {
|
|
267
267
|
if (ac) {
|
|
268
268
|
ac.invalidate();
|
|
269
269
|
return false;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { AjaxOptions } from "../services/http/AjaxOptions";
|
|
2
|
-
import { IAtomElement, IDisposable, IUIAtomControl } from "./types";
|
|
3
|
-
import XNode from "./XNode";
|
|
4
|
-
export declare abstract class BaseElementBridge<T extends IAtomElement> {
|
|
5
|
-
controlFactory: any;
|
|
6
|
-
createBusyIndicator: () => IDisposable;
|
|
7
|
-
ajax: (url: string, options: AjaxOptions, success: (r: any) => void, failed: (r: any) => void, progress: (p: any) => void) => void;
|
|
8
|
-
reset: () => void;
|
|
9
|
-
abstract create(type: string | ((n: any, ...nodes: XNode[]) => XNode) | (new (...a: any[]) => any), node?: any, app?: any): T;
|
|
10
|
-
abstract attachControl(element: T, control: IUIAtomControl): void;
|
|
11
|
-
abstract addEventHandler(element: T, name: string, handler: EventListenerOrEventListenerObject, capture?: boolean): IDisposable;
|
|
12
|
-
abstract atomParent(element: T, climbUp?: boolean): IUIAtomControl;
|
|
13
|
-
abstract elementParent(element: T): T;
|
|
14
|
-
abstract templateParent(element: T): IUIAtomControl;
|
|
15
|
-
abstract visitDescendents(element: T, action: (e: T, ac: IUIAtomControl) => boolean): void;
|
|
16
|
-
abstract dispose(element: T): void;
|
|
17
|
-
abstract appendChild(parent: T, child: T): void;
|
|
18
|
-
abstract getValue(element: HTMLElement, name: string): any;
|
|
19
|
-
abstract setValue(element: T, name: string, value: any): void;
|
|
20
|
-
abstract watchProperty(element: T, name: string, events: string[], f: (v: any) => void): IDisposable;
|
|
21
|
-
abstract loadContent(element: T, text: string): void;
|
|
22
|
-
abstract findChild(element: T, name: string): T;
|
|
23
|
-
abstract close(element: T, success: () => void, error: (e: any) => void): void;
|
|
24
|
-
refreshInherited(target: {
|
|
25
|
-
element: T;
|
|
26
|
-
}, name: string, fieldName?: string): void;
|
|
27
|
-
createNode(target: any, node: XNode, binder: Function, xNodeClass: Function, creator: Function): any;
|
|
28
|
-
}
|
|
29
|
-
export declare class AtomElementBridge extends BaseElementBridge<HTMLElement> {
|
|
30
|
-
addEventHandler(element: HTMLElement, name: string, handler: EventListenerOrEventListenerObject, capture?: boolean): IDisposable;
|
|
31
|
-
atomParent(element: HTMLElement, climbUp?: boolean): IUIAtomControl;
|
|
32
|
-
elementParent(element: HTMLElement): HTMLElement;
|
|
33
|
-
templateParent(element: HTMLElement): IUIAtomControl;
|
|
34
|
-
visitDescendents(element: HTMLElement, action: (e: HTMLElement, ac: IUIAtomControl) => boolean): void;
|
|
35
|
-
dispose(element: HTMLElement): void;
|
|
36
|
-
appendChild(parent: HTMLElement, child: HTMLElement): void;
|
|
37
|
-
setValue(element: HTMLElement, name: string, value: any): void;
|
|
38
|
-
getValue(element: HTMLElement, name: string): any;
|
|
39
|
-
watchProperty(element: HTMLElement, name: string, events: string[], f: (v: any) => void): IDisposable;
|
|
40
|
-
attachControl(element: HTMLElement, control: IUIAtomControl): void;
|
|
41
|
-
create(type: string): HTMLElement;
|
|
42
|
-
loadContent(element: HTMLElement, text: string): void;
|
|
43
|
-
findChild(element: HTMLElement, name: string): HTMLElement;
|
|
44
|
-
close(element: HTMLElement, success: () => void, error: (e: any) => void): void;
|
|
45
|
-
toTemplate(element: any, creator: any): any;
|
|
46
|
-
createNode(target: any, node: XNode, binder: Function, xNodeClass: Function, creator: Function): any;
|
|
47
|
-
}
|
|
48
|
-
export declare class AtomBridge {
|
|
49
|
-
static platform: "web" | "xf";
|
|
50
|
-
static instance: BaseElementBridge<IAtomElement>;
|
|
51
|
-
static createNode(iterator: XNode, app: any): {
|
|
52
|
-
element?: any;
|
|
53
|
-
control?: any;
|
|
54
|
-
};
|
|
55
|
-
static toTemplate(app: any, n: XNode, creator: any): any;
|
|
56
|
-
static refreshInherited(target: {
|
|
57
|
-
element: any;
|
|
58
|
-
}, name: string, fieldName?: string): void;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=AtomBridge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AtomBridge.d.ts","sourceRoot":"","sources":["../../src/core/AtomBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqC,cAAc,EAAE,MAAM,SAAS,CAAC;AACvG,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