@web-atoms/core 2.2.194 → 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 +9 -19
- 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 -8
- 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 +33 -61
- 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 -8
- 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,297 +0,0 @@
|
|
|
1
|
-
import { AtomBinder } from "../../core/AtomBinder";
|
|
2
|
-
import { AtomBridge, BaseElementBridge } from "../../core/AtomBridge";
|
|
3
|
-
import { AtomComponent } from "../../core/AtomComponent";
|
|
4
|
-
import Bind, { bindSymbol } from "../../core/Bind";
|
|
5
|
-
import { IAtomElement } from "../../core/types";
|
|
6
|
-
import XNode, { attachedProperties, attachedSymbol, constructorNeedsArgumentsSymbol, elementFactorySymbol, isControl, isFactorySymbol, isTemplateSymbol, xnodeSymbol } from "../../core/XNode";
|
|
7
|
-
import { TypeKey } from "../../di/TypeKey";
|
|
8
|
-
import { NavigationService } from "../../services/NavigationService";
|
|
9
|
-
import { AtomStyle } from "../../web/styles/AtomStyle";
|
|
10
|
-
import { AtomStyleSheet } from "../../web/styles/AtomStyleSheet";
|
|
11
|
-
|
|
12
|
-
declare var UMD: any;
|
|
13
|
-
|
|
14
|
-
UMD.defaultApp = "@web-atoms/core/dist/xf/XFApp";
|
|
15
|
-
UMD.viewPrefix = "xf";
|
|
16
|
-
AtomBridge.platform = "xf";
|
|
17
|
-
|
|
18
|
-
const defaultStyleSheets: { [key: string]: AtomStyle } = {};
|
|
19
|
-
|
|
20
|
-
const isAtomControl = isControl;
|
|
21
|
-
|
|
22
|
-
const isTemplate = isTemplateSymbol;
|
|
23
|
-
|
|
24
|
-
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
25
|
-
|
|
26
|
-
const localBindSymbol = bindSymbol;
|
|
27
|
-
const localXNodeSymbol = xnodeSymbol;
|
|
28
|
-
|
|
29
|
-
const elementFactory = elementFactorySymbol;
|
|
30
|
-
|
|
31
|
-
const isFactory = isFactorySymbol;
|
|
32
|
-
|
|
33
|
-
const localBridge = AtomBridge;
|
|
34
|
-
|
|
35
|
-
const renderFirst = AtomBridge.platform === "xf";
|
|
36
|
-
|
|
37
|
-
const attached = attachedSymbol;
|
|
38
|
-
|
|
39
|
-
const constructorNeedsArguments = constructorNeedsArgumentsSymbol;
|
|
40
|
-
|
|
41
|
-
export class AtomXFControl extends AtomComponent<IAtomElement, AtomXFControl> {
|
|
42
|
-
|
|
43
|
-
public defaultControlStyle: any;
|
|
44
|
-
|
|
45
|
-
private mControlStyle: AtomStyle;
|
|
46
|
-
public get controlStyle(): AtomStyle {
|
|
47
|
-
if (this.mControlStyle === undefined) {
|
|
48
|
-
const key = TypeKey.get(this.defaultControlStyle || this.constructor);
|
|
49
|
-
|
|
50
|
-
this.mControlStyle = defaultStyleSheets[key];
|
|
51
|
-
if (this.mControlStyle) {
|
|
52
|
-
return this.mControlStyle;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (this.defaultControlStyle) {
|
|
56
|
-
this.mControlStyle = defaultStyleSheets[key] ||
|
|
57
|
-
( defaultStyleSheets[key] = this.theme.createNamedStyle(this.defaultControlStyle, key, 0));
|
|
58
|
-
}
|
|
59
|
-
this.mControlStyle = this.mControlStyle || null;
|
|
60
|
-
}
|
|
61
|
-
return this.mControlStyle;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public set controlStyle(v: AtomStyle) {
|
|
65
|
-
if (v instanceof AtomStyle) {
|
|
66
|
-
this.mControlStyle = v;
|
|
67
|
-
} else {
|
|
68
|
-
const key = TypeKey.get(v);
|
|
69
|
-
this.mControlStyle = defaultStyleSheets[key] ||
|
|
70
|
-
( defaultStyleSheets[key] = this.theme.createNamedStyle(v, key, 0));
|
|
71
|
-
}
|
|
72
|
-
AtomBinder.refreshValue(this, "controlStyle");
|
|
73
|
-
// this.invalidate();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public get theme(): AtomStyleSheet {
|
|
77
|
-
return this.mTheme ||
|
|
78
|
-
this.mCachedTheme ||
|
|
79
|
-
(this.mCachedTheme = (this.parent ? this.parent.theme : this.app.resolve(AtomStyleSheet, false, null) ));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public get parent(): AtomXFControl {
|
|
83
|
-
let e = this.element as any;
|
|
84
|
-
e = e.parent;
|
|
85
|
-
while (e) {
|
|
86
|
-
const ac = e.atomControl;
|
|
87
|
-
if (ac) {
|
|
88
|
-
return ac;
|
|
89
|
-
}
|
|
90
|
-
e = e.parent;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
protected get factory() {
|
|
95
|
-
return AtomXFControl;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private mTheme: AtomStyleSheet;
|
|
99
|
-
private mCachedTheme: AtomStyleSheet;
|
|
100
|
-
|
|
101
|
-
public atomParent(e: IAtomElement): AtomXFControl {
|
|
102
|
-
// return AtomBridge.instance.atomParent(e, false) as any;
|
|
103
|
-
let e1 = e as any;
|
|
104
|
-
while (e1) {
|
|
105
|
-
const ac = e1.atomControl;
|
|
106
|
-
if (ac) {
|
|
107
|
-
return ac;
|
|
108
|
-
}
|
|
109
|
-
e1 = e1.parent;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
public append(element: any): AtomXFControl {
|
|
114
|
-
this.element.appendChild(element.element || element);
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// public dispose(e?: IAtomElement): void {
|
|
119
|
-
// const el = this.element;
|
|
120
|
-
// super.dispose(e);
|
|
121
|
-
// AtomBridge.instance.dispose(el);
|
|
122
|
-
// }
|
|
123
|
-
|
|
124
|
-
public invokeEvent(event: { type: string, detail?: any }): void {
|
|
125
|
-
(AtomBridge.instance as any).invokeEvent(this.element, event.type, event);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public staticResource(name: string) {
|
|
129
|
-
return (AtomBridge.instance as any).getStaticResource(this.element, name);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public loadXaml(text: string) {
|
|
133
|
-
(AtomBridge.instance as any).loadXaml(this.element, text);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
protected setElementValue(element: any, name: string, value: any): void {
|
|
137
|
-
if (name.startsWith(":")) {
|
|
138
|
-
// value is a function...
|
|
139
|
-
attachedProperties[name](element, value);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
if (/^event/.test(name)) {
|
|
143
|
-
this.bindEvent(element, name.substr(5), async () => {
|
|
144
|
-
try {
|
|
145
|
-
const p = value() as Promise<any>;
|
|
146
|
-
if (p) {
|
|
147
|
-
await p;
|
|
148
|
-
}
|
|
149
|
-
} catch (e) {
|
|
150
|
-
if (/canceled|cancelled/i.test(e)) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const nav: NavigationService = this.app.resolve(NavigationService);
|
|
154
|
-
nav.alert(e, "Error").catch(() => {
|
|
155
|
-
// nothing...
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (/^(class|styleClass)$/i.test(name)) {
|
|
162
|
-
let classes: string[];
|
|
163
|
-
if (typeof value === "object") {
|
|
164
|
-
classes = [];
|
|
165
|
-
for (const key in value) {
|
|
166
|
-
if (value.hasOwnProperty(key)) {
|
|
167
|
-
const e1 = value[key];
|
|
168
|
-
if (e1) {
|
|
169
|
-
classes.push(key);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
classes = value.toString().split(" ");
|
|
175
|
-
}
|
|
176
|
-
value = classes.join(",");
|
|
177
|
-
name = "class";
|
|
178
|
-
}
|
|
179
|
-
// AtomBridge.instance.setValue(element, name, value);
|
|
180
|
-
element[name] = value;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
protected createNode(app, e, iterator, creator) {
|
|
184
|
-
let name = iterator.name;
|
|
185
|
-
const attributes = iterator.attributes;
|
|
186
|
-
if (typeof name === "string") {
|
|
187
|
-
e.appendChild(name);
|
|
188
|
-
return e;
|
|
189
|
-
// throw new Error("not supported");
|
|
190
|
-
// // document.createElement...
|
|
191
|
-
// // const element = document.createElement(name);
|
|
192
|
-
// // tslint:disable-next-line: no-console
|
|
193
|
-
// console.log(`Creating ${name}`);
|
|
194
|
-
// const element = document.createElement(name);
|
|
195
|
-
// e?.appendChild(element);
|
|
196
|
-
// this.render(iterator, element, creator);
|
|
197
|
-
// return element;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (objectHasOwnProperty.call(name, elementFactory)) {
|
|
201
|
-
|
|
202
|
-
if (objectHasOwnProperty.call(name, constructorNeedsArguments)) {
|
|
203
|
-
|
|
204
|
-
const templateFactory = name[isTemplate];
|
|
205
|
-
if (templateFactory) {
|
|
206
|
-
const template = this.toTemplate(app, iterator, creator);
|
|
207
|
-
return templateFactory(template);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// look for Arguments..
|
|
211
|
-
const firstChild = iterator.children?.[0];
|
|
212
|
-
const childName = firstChild?.name;
|
|
213
|
-
let pv: any[];
|
|
214
|
-
if (childName === "WebAtoms.AtomX:Arguments") {
|
|
215
|
-
pv = [];
|
|
216
|
-
for (const child of firstChild.children) {
|
|
217
|
-
pv.push(this.createNode(app, e, child, creator));
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
pv = iterator.children;
|
|
221
|
-
name = name[constructorNeedsArguments];
|
|
222
|
-
}
|
|
223
|
-
const element1 = name(... pv);
|
|
224
|
-
e?.appendChild(element1);
|
|
225
|
-
return element1;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const element = new (name)();
|
|
229
|
-
this.render(iterator, element, creator);
|
|
230
|
-
e?.appendChild(element);
|
|
231
|
-
return element;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (name[isAtomControl]) {
|
|
235
|
-
const ctrl = new (name)(app);
|
|
236
|
-
const element = ctrl.element ;
|
|
237
|
-
ctrl.render(iterator, element, creator);
|
|
238
|
-
e?.appendChild(element);
|
|
239
|
-
return element;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const a = name[attached];
|
|
243
|
-
if (a) {
|
|
244
|
-
const child = this.createNode(app, null, iterator.children[0], creator);
|
|
245
|
-
a(e, child);
|
|
246
|
-
return e;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
throw new Error(`not implemented create for ${name}`);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
protected toTemplate(app, iterator, creator): any {
|
|
253
|
-
const childNode = iterator.children[0];
|
|
254
|
-
|
|
255
|
-
const name = childNode.name;
|
|
256
|
-
if (typeof name === "string") {
|
|
257
|
-
throw new Error(`Creating Template from string not supported, are you missing something?`);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (name[isAtomControl]) {
|
|
261
|
-
return class Template extends (name as any) {
|
|
262
|
-
|
|
263
|
-
constructor(a, e) {
|
|
264
|
-
super(a ?? app, e);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
public create() {
|
|
268
|
-
super.create();
|
|
269
|
-
this.render(childNode, null, creator);
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return class ElementTemplate extends AtomXFControl {
|
|
275
|
-
constructor(a, e) {
|
|
276
|
-
super(a ?? app, e ?? new (name)());
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
public create() {
|
|
280
|
-
super.create();
|
|
281
|
-
this.render(childNode, null, creator);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
declare var bridge;
|
|
288
|
-
bridge.controlFactory = AtomXFControl;
|
|
289
|
-
|
|
290
|
-
// add custom event...
|
|
291
|
-
|
|
292
|
-
declare var global;
|
|
293
|
-
|
|
294
|
-
global.CustomEvent = function(type: string, { detail }) {
|
|
295
|
-
this.type = type;
|
|
296
|
-
this.detail = detail;
|
|
297
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AtomBridge } from "../../core/AtomBridge";
|
|
2
|
-
import { IDisposable } from "../../core/types";
|
|
3
|
-
import { RegisterSingleton } from "../../di/RegisterSingleton";
|
|
4
|
-
import { BusyIndicatorService } from "../../services/BusyIndicatorService";
|
|
5
|
-
|
|
6
|
-
@RegisterSingleton
|
|
7
|
-
export default class XFBusyIndicatorService extends BusyIndicatorService {
|
|
8
|
-
|
|
9
|
-
public createIndicator(): IDisposable {
|
|
10
|
-
const popup = AtomBridge.instance.createBusyIndicator();
|
|
11
|
-
return {
|
|
12
|
-
dispose: () => {
|
|
13
|
-
popup.dispose();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { App } from "../../App";
|
|
2
|
-
import { AtomBridge } from "../../core/AtomBridge";
|
|
3
|
-
import { AtomDisposableList } from "../../core/AtomDisposableList";
|
|
4
|
-
import { AtomLoader } from "../../core/AtomLoader";
|
|
5
|
-
import { AtomUri } from "../../core/AtomUri";
|
|
6
|
-
import { INameValuePairs } from "../../core/types";
|
|
7
|
-
import { Inject } from "../../di/Inject";
|
|
8
|
-
import { RegisterSingleton } from "../../di/RegisterSingleton";
|
|
9
|
-
import { JsonService } from "../../services/JsonService";
|
|
10
|
-
import { IPageOptions, NavigationService, NotifyType } from "../../services/NavigationService";
|
|
11
|
-
import ReferenceService, { ObjectReference } from "../../services/ReferenceService";
|
|
12
|
-
import { AtomWindowViewModel } from "../../view-model/AtomWindowViewModel";
|
|
13
|
-
import { AtomControl } from "../../web/controls/AtomControl";
|
|
14
|
-
import { AtomUI } from "../../web/core/AtomUI";
|
|
15
|
-
|
|
16
|
-
interface IDeviceNavigationService {
|
|
17
|
-
getLocation(): string;
|
|
18
|
-
setLocation(v: string): void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare var bridge: {
|
|
22
|
-
navigationService: IDeviceNavigationService;
|
|
23
|
-
alert(message: string, title: string, success: () => void, failed: (r) => void);
|
|
24
|
-
confirm(message: string, title: string, success: (r: boolean) => void, failed: (e) => void);
|
|
25
|
-
getTitle(): string;
|
|
26
|
-
setTitle(v: string): void;
|
|
27
|
-
setRoot(e: any): void;
|
|
28
|
-
pushPage(e: any, options: IPageOptions, success: () => void, failed: (r) => void);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
@RegisterSingleton
|
|
32
|
-
export default class XFNavigationService extends NavigationService {
|
|
33
|
-
|
|
34
|
-
private stack: string[] = [];
|
|
35
|
-
|
|
36
|
-
public get title(): string {
|
|
37
|
-
// return bridge.getTitle();
|
|
38
|
-
// throw new Error("Not supported");
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
public set title(v: string) {
|
|
42
|
-
// bridge.setTitle(v);
|
|
43
|
-
// throw new Error("Not supported");
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// private mLocation: ILocation;
|
|
47
|
-
public get location(): AtomUri {
|
|
48
|
-
return new AtomUri( bridge.navigationService.getLocation() );
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public set location(v: AtomUri) {
|
|
52
|
-
bridge.navigationService.setLocation(v.toString());
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
constructor(
|
|
56
|
-
@Inject app: App,
|
|
57
|
-
@Inject private jsonService: JsonService) {
|
|
58
|
-
super(app);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public alert(message: string | any, title?: string): Promise<void> {
|
|
62
|
-
if (typeof message !== "string") {
|
|
63
|
-
message = message.toString();
|
|
64
|
-
}
|
|
65
|
-
return new Promise((resolve, reject) => {
|
|
66
|
-
bridge.alert(message, title, () => {
|
|
67
|
-
resolve();
|
|
68
|
-
}, (f) => {
|
|
69
|
-
reject(f);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
public confirm(message: string, title?: string): Promise<boolean> {
|
|
74
|
-
return new Promise((resolve, reject) => {
|
|
75
|
-
bridge.confirm(message, title, (r) => {
|
|
76
|
-
resolve(r);
|
|
77
|
-
}, (f) => {
|
|
78
|
-
reject(f);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public async notify(message: string, title?: string, type?: NotifyType, delay?: number): Promise<void> {
|
|
84
|
-
// display toast pending..
|
|
85
|
-
// tslint:disable-next-line: no-console
|
|
86
|
-
console.warn("Display toast not yet implemented");
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public navigate(url: string): void {
|
|
90
|
-
const uri = new AtomUri(url);
|
|
91
|
-
this.stack.push(url);
|
|
92
|
-
this.app.runAsync(async () => {
|
|
93
|
-
const { view: popup } = await AtomLoader.loadView<AtomControl>(uri, this.app, true);
|
|
94
|
-
bridge.setRoot(popup.element);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public back(): void {
|
|
99
|
-
if (this.stack.length) {
|
|
100
|
-
const url = this.stack.pop();
|
|
101
|
-
this.app.runAsync(async () => {
|
|
102
|
-
const uri = new AtomUri(url);
|
|
103
|
-
const { view: popup } = await AtomLoader.loadView<AtomControl>(uri, this.app, true);
|
|
104
|
-
bridge.setRoot(popup.element);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public refresh(): void {
|
|
110
|
-
AtomBridge.instance.reset();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
protected async openWindow<T>(
|
|
114
|
-
url: AtomUri,
|
|
115
|
-
options?: IPageOptions): Promise<T> {
|
|
116
|
-
|
|
117
|
-
const { view: popup, disposables, returnPromise, id } =
|
|
118
|
-
await AtomLoader.loadView(url, this.app, true,
|
|
119
|
-
() => this.app.resolve(AtomWindowViewModel, true));
|
|
120
|
-
|
|
121
|
-
if (options && options.onInit) {
|
|
122
|
-
options.onInit(popup);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const cancelToken = options.cancelToken;
|
|
126
|
-
if (cancelToken) {
|
|
127
|
-
if (cancelToken.cancelled) {
|
|
128
|
-
this.app.callLater(() => {
|
|
129
|
-
this.remove(popup, true);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
cancelToken.registerForCancel(() => {
|
|
133
|
-
this.remove(popup, true);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
const ve = popup.element;
|
|
137
|
-
AtomBridge.instance.setValue(ve, "name", id);
|
|
138
|
-
|
|
139
|
-
bridge.pushPage(
|
|
140
|
-
ve,
|
|
141
|
-
options || {},
|
|
142
|
-
() => {
|
|
143
|
-
// reject("cancelled");
|
|
144
|
-
// do nothing...
|
|
145
|
-
},
|
|
146
|
-
(e) => {
|
|
147
|
-
this.remove(popup, true);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
disposables.add(() => {
|
|
151
|
-
(AtomBridge.instance as any).popPage(ve, () => {
|
|
152
|
-
// do nothing
|
|
153
|
-
}, (e) => {
|
|
154
|
-
// tslint:disable-next-line: no-console
|
|
155
|
-
console.error(e);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
return returnPromise;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
}
|