@openfin/core 31.74.31 → 32.75.1
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/package.json +1 -1
- package/src/OpenFin.d.ts +58 -13
- package/src/api/application/Instance.d.ts +13 -1
- package/src/api/application/Instance.js +39 -7
- package/src/api/base.d.ts +1 -2
- package/src/api/base.js +1 -2
- package/src/api/events/application.d.ts +4 -1
- package/src/api/events/system.d.ts +6 -3
- package/src/api/events/webcontents.d.ts +54 -5
- package/src/api/fin.js +1 -2
- package/src/api/interappbus/channel/client.d.ts +2 -2
- package/src/api/interappbus/channel/index.d.ts +4 -3
- package/src/api/interappbus/channel/index.js +111 -74
- package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
- package/src/api/interappbus/index.js +1 -1
- package/src/api/interop/InteropClient.d.ts +1 -1
- package/src/api/interop/InteropClient.js +1 -1
- package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
- package/src/api/interop/SessionContextGroupBroker.js +5 -4
- package/src/api/interop/SessionContextGroupClient.js +1 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.js +1 -8
- package/src/api/interop/fdc3/fdc3-1.2.js +34 -1
- package/src/api/interop/fdc3/utils.js +24 -4
- package/src/api/me.d.ts +1 -1
- package/src/api/me.js +2 -1
- package/src/api/platform/Factory.d.ts +3 -3
- package/src/api/platform/Factory.js +2 -11
- package/src/api/platform/Instance.d.ts +5 -4
- package/src/api/platform/Instance.js +2 -1
- package/src/api/platform/layout/Factory.d.ts +1 -1
- package/src/api/platform/layout/Factory.js +7 -39
- package/src/api/platform/layout/Instance.js +3 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +6 -2
- package/src/api/platform/layout/controllers/layout-entities-controller.js +40 -8
- package/src/api/platform/layout/entities/layout-entities.d.ts +143 -42
- package/src/api/platform/layout/entities/layout-entities.js +151 -43
- package/src/api/platform/layout/utils/layout-traversal.d.ts +1 -0
- package/src/api/platform/layout/utils/layout-traversal.js +11 -11
- package/src/api/platform/provider.d.ts +2 -1
- package/src/api/system/index.d.ts +9 -0
- package/src/api/system/index.js +78 -40
- package/src/api/view/Instance.d.ts +6 -3
- package/src/api/view/Instance.js +10 -9
- package/src/api/webcontents/main.d.ts +2 -22
- package/src/api/webcontents/main.js +2 -1
- package/src/api/window/Instance.d.ts +10 -0
- package/src/api/window/Instance.js +22 -0
- package/src/environment/browser.d.ts +4 -2
- package/src/environment/browser.js +5 -2
- package/src/environment/environment.d.ts +4 -2
- package/src/environment/mockEnvironment.d.ts +27 -0
- package/src/environment/mockEnvironment.js +61 -0
- package/src/environment/node-env.d.ts +3 -2
- package/src/environment/node-env.js +5 -2
- package/src/environment/openfin-env.d.ts +5 -3
- package/src/environment/openfin-env.js +12 -10
- package/src/mock.js +4 -83
- package/src/shapes/protocol.d.ts +26 -9
- package/src/transport/mockWire.d.ts +11 -0
- package/src/transport/mockWire.js +26 -0
- package/src/transport/transport-errors.d.ts +9 -1
- package/src/transport/transport-errors.js +45 -2
- package/src/transport/transport.d.ts +16 -5
- package/src/transport/transport.js +48 -20
- package/src/util/channel-api-relay.js +11 -1
- package/src/util/errors.d.ts +1 -0
- package/src/util/errors.js +1 -0
- package/src/util/lazy.d.ts +18 -0
- package/src/util/lazy.js +29 -1
- package/src/util/ref-counter.d.ts +1 -1
- package/src/util/ref-counter.js +3 -2
- package/src/api/platform/layout/controllers/splitter-controller.d.ts +0 -30
- package/src/api/platform/layout/controllers/splitter-controller.js +0 -83
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +0 -58
- package/src/api/platform/layout/controllers/tab-drag-controller.js +0 -124
- package/src/api/platform/layout/utils/bounds-observer.d.ts +0 -19
- package/src/api/platform/layout/utils/bounds-observer.js +0 -52
- package/src/api/platform/layout/utils/view-overlay.d.ts +0 -35
- package/src/api/platform/layout/utils/view-overlay.js +0 -49
- package/src/transport/fin_store.d.ts +0 -4
- package/src/transport/fin_store.js +0 -16
|
@@ -21,33 +21,25 @@ const channel_api_relay_1 = require("../../../../util/channel-api-relay");
|
|
|
21
21
|
refs, we define and export all the classes here.
|
|
22
22
|
*/
|
|
23
23
|
/**
|
|
24
|
+
* @ignore
|
|
24
25
|
* @internal
|
|
25
26
|
* Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
|
|
26
27
|
* for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
|
|
27
28
|
*/
|
|
28
29
|
class LayoutNode {
|
|
29
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
30
34
|
constructor(client, entityId) {
|
|
31
35
|
/**
|
|
36
|
+
* @ignore
|
|
32
37
|
* @internal
|
|
33
38
|
* ApiClient for {@link LayoutEntitiesController}
|
|
34
39
|
*/
|
|
35
40
|
_LayoutNode_client.set(this, void 0);
|
|
36
|
-
/**
|
|
37
|
-
* Determines if this {@link ColumnOrRow} or {@link TabStack} is the top level content item in the current layout.
|
|
38
|
-
* @returns Promise resolving true if this is the root, or false otherwise.
|
|
39
|
-
*/
|
|
40
41
|
this.isRoot = () => __classPrivateFieldGet(this, _LayoutNode_client, "f").isRoot(this.entityId);
|
|
41
|
-
/**
|
|
42
|
-
* Determines if this {@link ColumnOrRow} or {@link TabStack} is the top level
|
|
43
|
-
* content item in the current layout.
|
|
44
|
-
* @returns Promise resolving true if this is the root, or false otherwise.
|
|
45
|
-
*/
|
|
46
42
|
this.exists = () => __classPrivateFieldGet(this, _LayoutNode_client, "f").exists(this.entityId);
|
|
47
|
-
/**
|
|
48
|
-
* Retrieves the parent {@link ColumnOrRow} or {@link TabStack} of this item, if one exists.
|
|
49
|
-
* @returns Promise resolving with the {@link ColumnOrRow} or {@link TabStack} that contains this item, or undefined if this is the root content item.
|
|
50
|
-
*/
|
|
51
43
|
this.getParent = async () => {
|
|
52
44
|
const parent = await __classPrivateFieldGet(this, _LayoutNode_client, "f").getParent(this.entityId);
|
|
53
45
|
if (!parent) {
|
|
@@ -55,34 +47,16 @@ class LayoutNode {
|
|
|
55
47
|
}
|
|
56
48
|
return LayoutNode.getEntity(parent, __classPrivateFieldGet(this, _LayoutNode_client, "f"));
|
|
57
49
|
};
|
|
58
|
-
/**
|
|
59
|
-
* Given a list of view creation options or references and a layout position, creates an adjacent {@link TabStack}
|
|
60
|
-
*
|
|
61
|
-
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
|
62
|
-
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
63
|
-
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
|
64
|
-
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
|
65
|
-
*
|
|
66
|
-
* @param views List of identities or view creation options of the views to include in the stack
|
|
67
|
-
* @param options Creation options, defaults to position: 'right'
|
|
68
|
-
* @returns an instance of {@link TabStack} containing the given views
|
|
69
|
-
* @experimental
|
|
70
|
-
*/
|
|
71
50
|
this.createAdjacentStack = async (views, options) => {
|
|
72
51
|
const entityId = await __classPrivateFieldGet(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
|
73
52
|
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet(this, _LayoutNode_client, "f"));
|
|
74
53
|
};
|
|
75
|
-
/**
|
|
76
|
-
* Finds the immediate adjacent layout item given an edge Position
|
|
77
|
-
* @param edgePosition
|
|
78
|
-
* @returns either {@link TabStack} or {@link ColumnOrRow} that was found, or `undefined` if there is no item with that edgePosition
|
|
79
|
-
*/
|
|
80
54
|
this.getAdjacentStacks = async (edge) => {
|
|
81
55
|
const adjacentStacks = await __classPrivateFieldGet(this, _LayoutNode_client, "f").getAdjacentStacks({
|
|
82
56
|
targetId: this.entityId,
|
|
83
57
|
edge
|
|
84
58
|
});
|
|
85
|
-
return adjacentStacks.map(stack => LayoutNode.getEntity({
|
|
59
|
+
return adjacentStacks.map((stack) => LayoutNode.getEntity({
|
|
86
60
|
type: 'stack',
|
|
87
61
|
entityId: stack.entityId
|
|
88
62
|
}, __classPrivateFieldGet(this, _LayoutNode_client, "f")));
|
|
@@ -94,6 +68,7 @@ class LayoutNode {
|
|
|
94
68
|
exports.LayoutNode = LayoutNode;
|
|
95
69
|
_a = LayoutNode, _LayoutNode_client = new WeakMap();
|
|
96
70
|
/**
|
|
71
|
+
* @ignore
|
|
97
72
|
* @internal
|
|
98
73
|
* Encapsulates Api consumption of {@link LayoutEntitiesController} with a relayed dispatch
|
|
99
74
|
* @param client
|
|
@@ -119,10 +94,73 @@ LayoutNode.getEntity = (definition, client) => {
|
|
|
119
94
|
}
|
|
120
95
|
};
|
|
121
96
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
97
|
+
* @typedef {string} LayoutPosition
|
|
98
|
+
* @summary Represents the position of an item in a layout relative to another. Possible values are 'top', 'bottom', 'left' and 'right'.
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* @typedef {object} StackCreationOptions
|
|
102
|
+
* @summary Stack creation options.
|
|
103
|
+
* @property {LayoutPosition} [position] - The position to create the new {@link TabStack} in, relative to the given adjacent {@link TabStack}. Defaults to 'right'.
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* @typedef {object} TabStack~AddViewOptions
|
|
107
|
+
* @summary Options to use when adding a view to a {@link TabStack}
|
|
108
|
+
* @property {number} [index] - Insertion index when adding the view. Defaults to 0.
|
|
109
|
+
*/
|
|
110
|
+
/**
|
|
111
|
+
* A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
|
|
124
112
|
*/
|
|
125
113
|
class TabStack extends LayoutNode {
|
|
114
|
+
/**
|
|
115
|
+
* Determines if this {@link TabStack} is the top level content item in the current layout.
|
|
116
|
+
* @function isRoot
|
|
117
|
+
* @memberof TabStack
|
|
118
|
+
* @instance
|
|
119
|
+
* @tutorial TabStack.isRoot
|
|
120
|
+
* @return {Promise<boolean>} Resolves true if this TabStack is the top level content item, or false if it is not.
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* Determines if this {@link TabStack} exists.
|
|
124
|
+
* @function exists
|
|
125
|
+
* @instance
|
|
126
|
+
* @memberof TabStack
|
|
127
|
+
* @tutorial TabStack.exists
|
|
128
|
+
* @return {Promise<boolean>} Resolves true if this is the TabStack exists, or false if it has been destroyed.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves the parent {@link ColumnOrRow} of this {@link TabStack}, if one exists.
|
|
132
|
+
* @function getParent
|
|
133
|
+
* @instance
|
|
134
|
+
* @memberof TabStack
|
|
135
|
+
* @tutorial TabStack.getParent
|
|
136
|
+
* @return {Promise<ColumnOrRow | TabStack | undefined>} Promise resolving with the {@link ColumnOrRow} that contains this item, or undefined if this {@link TabStack} is the root content item or does not exist.
|
|
137
|
+
*/
|
|
138
|
+
/**
|
|
139
|
+
* Returns all the adjacent stacks that share an edge with the given {@link TabStack}.
|
|
140
|
+
* @function getAdjacentStacks
|
|
141
|
+
* @instance
|
|
142
|
+
* @memberof TabStack
|
|
143
|
+
* @param {LayoutPosition} edge - Edge to check for any adjacent stacks.
|
|
144
|
+
* @returns {Promise<TabStack[]>}
|
|
145
|
+
* @tutorial TabStack.getAdjacentStacks
|
|
146
|
+
*/
|
|
147
|
+
/**
|
|
148
|
+
* Given a list of view creation options or references and a layout position, creates a {@link TabStack} adjacent to the current {@link TabStack}
|
|
149
|
+
*
|
|
150
|
+
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
|
151
|
+
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
152
|
+
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
|
153
|
+
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
|
154
|
+
*
|
|
155
|
+
* @function createAdjacentStack
|
|
156
|
+
* @instance
|
|
157
|
+
* @memberof TabStack
|
|
158
|
+
* @param {View~options} views - List of identities or view creation options of the views to include in the stack
|
|
159
|
+
* @param {StackCreationOptions} options - Creation options.
|
|
160
|
+
* @returns {Promise<TabStack>} The created TabStack.
|
|
161
|
+
* @tutorial TabStack.createAdjacentStack
|
|
162
|
+
* @experimental
|
|
163
|
+
*/
|
|
126
164
|
/** @internal */
|
|
127
165
|
constructor(client, entityId) {
|
|
128
166
|
super(client, entityId);
|
|
@@ -143,8 +181,9 @@ class TabStack extends LayoutNode {
|
|
|
143
181
|
* If that happens and then getViews() is called, it will return the identities in a different order than
|
|
144
182
|
* than the currently rendered tab order.
|
|
145
183
|
*
|
|
146
|
-
* @returns Resolves with a list containing the {@link OpenFin.Identity identities} of each view belonging to the {@link TabStack}.
|
|
184
|
+
* @returns {Promise<Identity[]>} Resolves with a list containing the {@link OpenFin.Identity identities} of each view belonging to the {@link TabStack}.
|
|
147
185
|
* @throws If the {@link TabStack} has been destroyed.
|
|
186
|
+
* @tutorial TabStack.getViews
|
|
148
187
|
* @experimental
|
|
149
188
|
*/
|
|
150
189
|
this.getViews = () => __classPrivateFieldGet(this, _TabStack_client, "f").getStackViews(this.entityId);
|
|
@@ -154,43 +193,112 @@ class TabStack extends LayoutNode {
|
|
|
154
193
|
* Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
|
155
194
|
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
156
195
|
*
|
|
157
|
-
* @param view The identity of an existing view to add, or options to create a view.
|
|
158
|
-
* @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
|
|
159
|
-
* @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
|
|
196
|
+
* @param {View~options} view The identity of an existing view to add, or options to create a view.
|
|
197
|
+
* @param {TabStack~AddViewOptions} options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
|
|
198
|
+
* @returns {Promise<identity>} Resolves with the {@link OpenFin.Identity identity} of the added view.
|
|
160
199
|
* @throws If the view does not exist or fails to create.
|
|
161
200
|
* @throws If the {@link TabStack} has been destroyed.
|
|
201
|
+
* @tutorial TabStack.addView
|
|
162
202
|
* @experimental
|
|
163
203
|
*/
|
|
164
204
|
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
|
165
205
|
/**
|
|
166
206
|
* Removes a view from this {@link TabStack}.
|
|
167
|
-
* @param view
|
|
207
|
+
* @param {Identity} view - Identity of the view to remove.
|
|
168
208
|
* @throws If the view does not exist or does not belong to the stack.
|
|
169
209
|
* @throws If the {@link TabStack} has been destroyed.
|
|
210
|
+
* @return {Promise<void>}
|
|
211
|
+
* @tutorial TabStack.removeView
|
|
170
212
|
*/
|
|
171
213
|
this.removeView = async (view) => {
|
|
172
214
|
await __classPrivateFieldGet(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
|
173
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* Sets the active view of the {@link TabStack} without focusing it.
|
|
218
|
+
* @param {Identity} view - Identity of the view to activate.
|
|
219
|
+
* @returns {Promise<void>} Promise which resolves with void once the view has been activated.
|
|
220
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
221
|
+
* @throws If the view does not exist.
|
|
222
|
+
* @tutorial TabStack.setActiveView
|
|
223
|
+
* @experimental
|
|
224
|
+
*/
|
|
225
|
+
this.setActiveView = async (view) => {
|
|
226
|
+
await __classPrivateFieldGet(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
|
227
|
+
};
|
|
174
228
|
__classPrivateFieldSet(this, _TabStack_client, client, "f");
|
|
175
229
|
}
|
|
176
230
|
}
|
|
177
231
|
exports.TabStack = TabStack;
|
|
178
232
|
_TabStack_client = new WeakMap();
|
|
179
233
|
/**
|
|
180
|
-
* A
|
|
234
|
+
* A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
|
|
181
235
|
*/
|
|
182
236
|
class ColumnOrRow extends LayoutNode {
|
|
183
|
-
/**
|
|
237
|
+
/**
|
|
238
|
+
* Determines if this {@link ColumnOrRow} is the top level content item in the current layout.
|
|
239
|
+
* @function isRoot
|
|
240
|
+
* @memberof ColumnOrRow
|
|
241
|
+
* @instance
|
|
242
|
+
* @tutorial ColumnOrRow.isRoot
|
|
243
|
+
* @return {Promise<boolean>} Resolves true if this TabStack is the top level content item, or false if it is not.
|
|
244
|
+
*/
|
|
245
|
+
/**
|
|
246
|
+
* Determines if this {@link ColumnOrRow} exists.
|
|
247
|
+
* @function exists
|
|
248
|
+
* @instance
|
|
249
|
+
* @memberof ColumnOrRow
|
|
250
|
+
* @tutorial ColumnOrRow.exists
|
|
251
|
+
* @return {Promise<boolean>} Resolves true if the TabStack exists, or false if it has been destroyed.
|
|
252
|
+
*/
|
|
253
|
+
/**
|
|
254
|
+
* Retrieves the parent {@link ColumnOrRow} of this {@link ColumnOrRow}, if one exists.
|
|
255
|
+
* @function getParent
|
|
256
|
+
* @instance
|
|
257
|
+
* @memberof ColumnOrRow
|
|
258
|
+
* @tutorial ColumnOrRow.getParent
|
|
259
|
+
* @return {Promise<ColumnOrRow | undefined>} Promise resolving with the {@link ColumnOrRow} that contains this item, or undefined if this {@link ColumnOrRow} does not exist or is the root content item.
|
|
260
|
+
*/
|
|
261
|
+
/**
|
|
262
|
+
* Returns all the adjacent stacks that share an edge with the given {@link ColumnOrRow}.
|
|
263
|
+
* @function getAdjacentStacks
|
|
264
|
+
* @instance
|
|
265
|
+
* @memberof ColumnOrRow
|
|
266
|
+
* @param {LayoutPosition} edge - Edge to check for any adjacent stacks.
|
|
267
|
+
* @returns {Promise<TabStack[]>}
|
|
268
|
+
* @tutorial ColumnOrRow.getAdjacentStacks
|
|
269
|
+
*/
|
|
270
|
+
/**
|
|
271
|
+
* Given a list of view creation options or references and a layout position, creates a {@link TabStack} adjacent to the given {@link ColumnOrRow}
|
|
272
|
+
*
|
|
273
|
+
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
|
274
|
+
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
275
|
+
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
|
276
|
+
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
|
277
|
+
*
|
|
278
|
+
* @function createAdjacentStack
|
|
279
|
+
* @instance
|
|
280
|
+
* @memberof ColumnOrRow
|
|
281
|
+
* @param {View~options} views - List of identities or view creation options of the views to include in the stack
|
|
282
|
+
* @param {StackCreationOptions} options - Creation options.
|
|
283
|
+
* @returns {Promise<TabStack>} The created TabStack
|
|
284
|
+
* @tutorial ColumnOrRow.createAdjacentStack
|
|
285
|
+
* @experimental
|
|
286
|
+
*/
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
*/
|
|
184
290
|
constructor(client, entityId, type) {
|
|
185
291
|
super(client, entityId);
|
|
186
292
|
/**
|
|
293
|
+
* @ignore
|
|
187
294
|
* @internal
|
|
188
295
|
* ApiClient for {@link LayoutEntitiesController}
|
|
189
296
|
*/
|
|
190
297
|
_ColumnOrRow_client.set(this, void 0);
|
|
191
298
|
/**
|
|
192
299
|
* Retrieves a list of all content items belonging to this {@link ColumnOrRow} in order of appearance.
|
|
193
|
-
* @returns Resolves with a list containing {@link ColumnOrRow} and {@link TabStack} items belonging to this {@link ColumnOrRow}.
|
|
300
|
+
* @returns {Promise<Array<ColumnOrRow | TabStack>>} Resolves with a list containing {@link ColumnOrRow} and {@link TabStack} items belonging to this {@link ColumnOrRow}.
|
|
301
|
+
* @tutorial ColumnOrRow.getContent
|
|
194
302
|
*/
|
|
195
303
|
this.getContent = async () => {
|
|
196
304
|
const contentItemEntities = await __classPrivateFieldGet(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type * as OpenFin from '../../../../OpenFin';
|
|
2
2
|
export declare const getAdjacentItem: (component: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => GoldenLayout.ContentItem | undefined;
|
|
3
|
+
export declare const doShareEdge: (from: GoldenLayout.ContentItem, to: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => boolean;
|
|
3
4
|
export declare const getAdjacentStacks: (item: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => GoldenLayout.ContentItem[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAdjacentStacks = exports.getAdjacentItem = void 0;
|
|
3
|
+
exports.getAdjacentStacks = exports.doShareEdge = exports.getAdjacentItem = void 0;
|
|
4
4
|
const getAdjacentItem = (component, edge) => {
|
|
5
5
|
const { parent } = component;
|
|
6
|
-
// need to handle the case where a stack is the parent content item
|
|
7
6
|
if (parent.isRoot) {
|
|
8
7
|
return undefined;
|
|
9
8
|
}
|
|
@@ -19,25 +18,26 @@ const getAdjacentItem = (component, edge) => {
|
|
|
19
18
|
return (0, exports.getAdjacentItem)(parent, edge);
|
|
20
19
|
};
|
|
21
20
|
exports.getAdjacentItem = getAdjacentItem;
|
|
22
|
-
const doShareEdge = (
|
|
21
|
+
const doShareEdge = (from, to, edge) => {
|
|
23
22
|
var _a, _b;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
23
|
+
const boundsFrom = (_a = from.element.get(0)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
24
|
+
const boundsTo = (_b = to.element.get(0)) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
25
|
+
if (!boundsFrom || !boundsTo) {
|
|
27
26
|
return false;
|
|
28
27
|
}
|
|
29
28
|
if (['top', 'bottom'].includes(edge)) {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const horizontallyOutOfBounds = boundsFrom.right < boundsTo.left || boundsFrom.left > boundsTo.right;
|
|
30
|
+
return !horizontallyOutOfBounds;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const verticallyOutOfBounds = boundsFrom.bottom < boundsTo.top || boundsFrom.top > boundsTo.bottom;
|
|
33
|
+
return !verticallyOutOfBounds;
|
|
35
34
|
};
|
|
35
|
+
exports.doShareEdge = doShareEdge;
|
|
36
36
|
const getAdjacentStacks = (item, edge) => {
|
|
37
37
|
const targetContainer = ['top', 'bottom'].includes(edge) ? 'row' : 'column';
|
|
38
38
|
const findEdgeStacks = (component) => {
|
|
39
39
|
if (component.type === 'stack') {
|
|
40
|
-
if (doShareEdge(item, component, edge)) {
|
|
40
|
+
if ((0, exports.doShareEdge)(item, component, edge)) {
|
|
41
41
|
return [component];
|
|
42
42
|
}
|
|
43
43
|
return [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WindowOptionsChangedEvent } from '../events/window';
|
|
2
1
|
import * as OpenFin from '../../OpenFin';
|
|
2
|
+
type WindowOptionsChangedEvent = OpenFin.WindowEvents.WindowOptionsChangedEvent;
|
|
3
3
|
/**
|
|
4
4
|
* This class handles Platform actions. It does not need to be used directly by developers.
|
|
5
5
|
* However, its methods can be overriden by passing an `overrideCallback` to {@link Platform#init Platform.init}
|
|
@@ -160,3 +160,4 @@ export interface PlatformProvider {
|
|
|
160
160
|
*/
|
|
161
161
|
handleViewsAndWindowClose(windowId: OpenFin.Identity, userDecision: OpenFin.BeforeUnloadUserDecision): Promise<void>;
|
|
162
162
|
}
|
|
163
|
+
export {};
|
|
@@ -460,6 +460,15 @@ export default class System extends EmitterBase<OpenFin.SystemEvent> {
|
|
|
460
460
|
*/
|
|
461
461
|
getServiceConfiguration(serviceIdentifier: OpenFin.ServiceIdentifier): Promise<OpenFin.ServiceConfiguration>;
|
|
462
462
|
protected getSystemAppConfig(name: string): Promise<any>;
|
|
463
|
+
/**
|
|
464
|
+
* Registers a system shutdown handler so user can do some cleanup before system is shutting down.
|
|
465
|
+
* Note: Once system shutdown starts, you are unable to cancel it.
|
|
466
|
+
* @param { SystemShutdownHandler } handler system shutdown handler
|
|
467
|
+
* @return {Promise.<void>}
|
|
468
|
+
* @tutorial System.registerShutdownHandler
|
|
469
|
+
* @experimental
|
|
470
|
+
*/
|
|
471
|
+
registerShutdownHandler(handler: OpenFin.SystemShutdownHandler): Promise<void>;
|
|
463
472
|
/**
|
|
464
473
|
* Signals the RVM to perform a health check and returns the results as json.
|
|
465
474
|
* @return {Promise.<string[]>}
|
package/src/api/system/index.js
CHANGED
|
@@ -512,53 +512,62 @@ class System extends base_1.EmitterBase {
|
|
|
512
512
|
* @tutorial System.downloadAsset
|
|
513
513
|
*/
|
|
514
514
|
// incompatible with standalone node process.
|
|
515
|
-
downloadAsset(appAsset, progressListener) {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
};
|
|
538
|
-
const dlError = (payload) => {
|
|
539
|
-
cleanListeners();
|
|
540
|
-
const { reason, err: error } = payload;
|
|
541
|
-
reject(new transport_errors_1.RuntimeError({ reason, error }));
|
|
542
|
-
};
|
|
543
|
-
const dlComplete = () => {
|
|
544
|
-
cleanListeners();
|
|
545
|
-
resolve();
|
|
515
|
+
async downloadAsset(appAsset, progressListener) {
|
|
516
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function
|
|
517
|
+
const noop = () => { };
|
|
518
|
+
let resolve = noop;
|
|
519
|
+
let reject = noop;
|
|
520
|
+
const downloadCompletePromise = new Promise((y, n) => {
|
|
521
|
+
resolve = y;
|
|
522
|
+
reject = n;
|
|
523
|
+
});
|
|
524
|
+
// node.js environment not supported
|
|
525
|
+
if (this.wire.environment.constructor.name === 'NodeEnvironment') {
|
|
526
|
+
throw new transport_errors_1.NotSupportedError('downloadAsset only supported in an OpenFin Render process');
|
|
527
|
+
}
|
|
528
|
+
const callSite = transport_errors_1.RuntimeError.getCallSite();
|
|
529
|
+
const downloadId = this.wire.environment.getNextMessageId().toString();
|
|
530
|
+
const dlProgressKey = `asset-download-progress-${downloadId}`;
|
|
531
|
+
const dlErrorKey = `asset-download-error-${downloadId}`;
|
|
532
|
+
const dlCompleteKey = `asset-download-complete-${downloadId}`;
|
|
533
|
+
const dlProgress = (progress) => {
|
|
534
|
+
const p = {
|
|
535
|
+
downloadedBytes: progress.downloadedBytes,
|
|
536
|
+
totalBytes: progress.totalBytes
|
|
546
537
|
};
|
|
538
|
+
progressListener(p);
|
|
539
|
+
};
|
|
540
|
+
const cleanListeners = () => {
|
|
547
541
|
// TODO: fix internal types
|
|
548
542
|
// @ts-expect-error
|
|
549
|
-
this.
|
|
543
|
+
this.removeListener(dlProgressKey, dlProgress);
|
|
544
|
+
};
|
|
545
|
+
const dlError = (payload) => {
|
|
546
|
+
cleanListeners();
|
|
547
|
+
const { reason, err: error } = payload;
|
|
548
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }, callSite));
|
|
549
|
+
};
|
|
550
|
+
const dlComplete = () => {
|
|
551
|
+
cleanListeners();
|
|
552
|
+
resolve();
|
|
553
|
+
};
|
|
554
|
+
await Promise.all([
|
|
550
555
|
// TODO: fix internal types
|
|
551
556
|
// @ts-expect-error
|
|
552
|
-
this.
|
|
557
|
+
this.on(dlProgressKey, dlProgress),
|
|
553
558
|
// TODO: fix internal types
|
|
554
559
|
// @ts-expect-error
|
|
555
|
-
this.once(
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
560
|
+
this.once(dlErrorKey, dlError),
|
|
561
|
+
// TODO: fix internal types
|
|
562
|
+
// @ts-expect-error
|
|
563
|
+
this.once(dlCompleteKey, dlComplete)
|
|
564
|
+
]);
|
|
565
|
+
const downloadOptions = Object.assign(appAsset, { downloadId });
|
|
566
|
+
await this.wire.sendAction('download-asset', downloadOptions).catch((err) => {
|
|
567
|
+
cleanListeners();
|
|
568
|
+
throw err;
|
|
561
569
|
});
|
|
570
|
+
return downloadCompletePromise;
|
|
562
571
|
}
|
|
563
572
|
/**
|
|
564
573
|
* Downloads a version of the runtime.
|
|
@@ -568,6 +577,7 @@ class System extends base_1.EmitterBase {
|
|
|
568
577
|
* @tutorial System.downloadRuntime
|
|
569
578
|
*/
|
|
570
579
|
downloadRuntime(options, progressListener) {
|
|
580
|
+
const callsites = transport_errors_1.RuntimeError.getCallSite();
|
|
571
581
|
return new Promise((resolve, reject) => {
|
|
572
582
|
// node.js environment not supported
|
|
573
583
|
if (this.wire.environment.constructor.name === 'NodeEnvironment') {
|
|
@@ -593,7 +603,7 @@ class System extends base_1.EmitterBase {
|
|
|
593
603
|
const dlError = (payload) => {
|
|
594
604
|
cleanListeners();
|
|
595
605
|
const { reason, err: error } = payload;
|
|
596
|
-
reject(new transport_errors_1.RuntimeError({ reason, error }));
|
|
606
|
+
reject(new transport_errors_1.RuntimeError({ reason, error }, callsites));
|
|
597
607
|
};
|
|
598
608
|
const dlComplete = () => {
|
|
599
609
|
cleanListeners();
|
|
@@ -735,6 +745,34 @@ class System extends base_1.EmitterBase {
|
|
|
735
745
|
}
|
|
736
746
|
return this.wire.sendAction('get-system-app-configuration', { name }).then(({ payload }) => payload.data);
|
|
737
747
|
}
|
|
748
|
+
/**
|
|
749
|
+
* Registers a system shutdown handler so user can do some cleanup before system is shutting down.
|
|
750
|
+
* Note: Once system shutdown starts, you are unable to cancel it.
|
|
751
|
+
* @param { SystemShutdownHandler } handler system shutdown handler
|
|
752
|
+
* @return {Promise.<void>}
|
|
753
|
+
* @tutorial System.registerShutdownHandler
|
|
754
|
+
* @experimental
|
|
755
|
+
*/
|
|
756
|
+
async registerShutdownHandler(handler) {
|
|
757
|
+
this.wire.sendAction('system-register-shutdown-handler').catch((e) => {
|
|
758
|
+
// don't expose, analytics-only call
|
|
759
|
+
});
|
|
760
|
+
const SystemShutdownEventName = 'system-shutdown';
|
|
761
|
+
const SystemShutdownHandledEventName = 'system-shutdown-handled';
|
|
762
|
+
const { uuid, name } = this.wire.me;
|
|
763
|
+
const shutdownHandler = (payload) => {
|
|
764
|
+
const proceed = () => {
|
|
765
|
+
// notify core that the app is ready for shutdown
|
|
766
|
+
this.wire.environment.raiseEvent(`application/${SystemShutdownHandledEventName}`, {
|
|
767
|
+
uuid,
|
|
768
|
+
name,
|
|
769
|
+
topic: 'application'
|
|
770
|
+
});
|
|
771
|
+
};
|
|
772
|
+
handler({ proceed });
|
|
773
|
+
};
|
|
774
|
+
this.on(SystemShutdownEventName, shutdownHandler);
|
|
775
|
+
}
|
|
738
776
|
/**
|
|
739
777
|
* Signals the RVM to perform a health check and returns the results as json.
|
|
740
778
|
* @return {Promise.<string[]>}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { Transport } from '../../transport/transport';
|
|
3
|
-
import { ViewEvent } from '../events/view';
|
|
4
3
|
import { WebContents } from '../webcontents/main';
|
|
5
4
|
type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
5
|
+
type ViewEvent = OpenFin.ViewEvent;
|
|
6
6
|
/**
|
|
7
7
|
* @PORTED
|
|
8
8
|
* @typedef {object} View~options
|
|
@@ -144,6 +144,9 @@ type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
|
144
144
|
* @property {string} [processAffinity=<application uuid>]
|
|
145
145
|
* A string to attempt to group renderers together. Will only be used if pages are on the same origin.
|
|
146
146
|
*
|
|
147
|
+
* @property {boolean} [spellCheck=false]
|
|
148
|
+
* Enable spell check in input text fields for the view.
|
|
149
|
+
*
|
|
147
150
|
* @property {Identity} [target]
|
|
148
151
|
* The identity of the window this view should be attached to.
|
|
149
152
|
*
|
|
@@ -447,10 +450,10 @@ export declare class View extends WebContents<ViewEvent> {
|
|
|
447
450
|
getCurrentWindow: () => Promise<OpenFin.Window>;
|
|
448
451
|
/**
|
|
449
452
|
* Retrieves the current {@link TabStack} of the view if it belongs to one.
|
|
450
|
-
* @return {Promise<TabStack
|
|
453
|
+
* @return {Promise<TabStack>} The {@link TabStack} this view belongs to.
|
|
451
454
|
* @throws if this view does not belong to a TabStack or if the window has been destroyed.
|
|
452
455
|
*/
|
|
453
|
-
getCurrentStack: () => Promise<OpenFin.TabStack
|
|
456
|
+
getCurrentStack: () => Promise<OpenFin.TabStack>;
|
|
454
457
|
/**
|
|
455
458
|
* Triggers the before-unload handler for the View, if one is set. Returns `true` if the handler is trying to prevent the View from unloading, and `false` if it isn't.
|
|
456
459
|
* Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will always return false.
|
package/src/api/view/Instance.js
CHANGED
|
@@ -11,7 +11,6 @@ const transport_errors_1 = require("../../transport/transport-errors");
|
|
|
11
11
|
const lazy_1 = require("../../util/lazy");
|
|
12
12
|
const layout_entities_1 = require("../platform/layout/entities/layout-entities");
|
|
13
13
|
const layout_constants_1 = require("../platform/layout/layout.constants");
|
|
14
|
-
const bounds_observer_1 = require("../platform/layout/utils/bounds-observer");
|
|
15
14
|
const main_1 = require("../webcontents/main");
|
|
16
15
|
const window_1 = require("../window");
|
|
17
16
|
/**
|
|
@@ -155,6 +154,9 @@ const window_1 = require("../window");
|
|
|
155
154
|
* @property {string} [processAffinity=<application uuid>]
|
|
156
155
|
* A string to attempt to group renderers together. Will only be used if pages are on the same origin.
|
|
157
156
|
*
|
|
157
|
+
* @property {boolean} [spellCheck=false]
|
|
158
|
+
* Enable spell check in input text fields for the view.
|
|
159
|
+
*
|
|
158
160
|
* @property {Identity} [target]
|
|
159
161
|
* The identity of the window this view should be attached to.
|
|
160
162
|
*
|
|
@@ -459,23 +461,22 @@ class View extends main_1.WebContents {
|
|
|
459
461
|
};
|
|
460
462
|
/**
|
|
461
463
|
* Retrieves the current {@link TabStack} of the view if it belongs to one.
|
|
462
|
-
* @return {Promise<TabStack
|
|
464
|
+
* @return {Promise<TabStack>} The {@link TabStack} this view belongs to.
|
|
463
465
|
* @throws if this view does not belong to a TabStack or if the window has been destroyed.
|
|
464
466
|
*/
|
|
465
467
|
this.getCurrentStack = async () => {
|
|
468
|
+
this.wire.sendAction('view-get-current-stack').catch(() => {
|
|
469
|
+
// don't expose
|
|
470
|
+
});
|
|
466
471
|
try {
|
|
467
472
|
const layoutWindow = await this.getCurrentWindow();
|
|
468
473
|
const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
|
|
469
474
|
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindow.identity);
|
|
470
|
-
const stackDefinition = await client.getStackByView(this.identity);
|
|
475
|
+
const stackDefinition = (await client.getStackByView(this.identity));
|
|
471
476
|
return layout_entities_1.LayoutNode.getEntity(stackDefinition, client);
|
|
472
477
|
}
|
|
473
478
|
catch (error) {
|
|
474
|
-
|
|
475
|
-
// TODO: @pierre to fix
|
|
476
|
-
// @ts-expect-error pending PR !3459 to fix runtime errors
|
|
477
|
-
e.cause = error;
|
|
478
|
-
throw e;
|
|
479
|
+
throw new transport_errors_1.RuntimeError({ reason: 'This view does not belong to a stack.', error });
|
|
479
480
|
}
|
|
480
481
|
};
|
|
481
482
|
/**
|
|
@@ -508,7 +509,7 @@ class View extends main_1.WebContents {
|
|
|
508
509
|
throw new Error('Element not found.');
|
|
509
510
|
}
|
|
510
511
|
const onChange = async (bounds) => this.setBounds(bounds);
|
|
511
|
-
return
|
|
512
|
+
return this.wire.environment.observeBounds(element, onChange);
|
|
512
513
|
};
|
|
513
514
|
}
|
|
514
515
|
/**
|
|
@@ -2,31 +2,11 @@ import type * as OpenFin from '../../OpenFin';
|
|
|
2
2
|
import { EmitterBase } from '../base';
|
|
3
3
|
import { Transport } from '../../transport/transport';
|
|
4
4
|
import { BaseEvent } from '../events/base';
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for page capture.
|
|
7
|
-
*/
|
|
8
|
-
export interface CapturePageOptions {
|
|
9
|
-
/**
|
|
10
|
-
* The area of the window to be captured.
|
|
11
|
-
*/
|
|
12
|
-
area?: OpenFin.Rectangle;
|
|
13
|
-
/**
|
|
14
|
-
* @defaultValue 'png'
|
|
15
|
-
*
|
|
16
|
-
* The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
|
|
17
|
-
*/
|
|
18
|
-
format?: 'bmp' | 'jpg' | 'png';
|
|
19
|
-
/**
|
|
20
|
-
* @defaultValue 100
|
|
21
|
-
*
|
|
22
|
-
* Quality of JPEG image. Between 0 - 100.
|
|
23
|
-
*/
|
|
24
|
-
quality?: number;
|
|
25
|
-
}
|
|
26
5
|
export declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
6
|
+
identity: OpenFin.Identity;
|
|
27
7
|
entityType: string;
|
|
28
8
|
constructor(wire: Transport, identity: OpenFin.Identity, entityType: string);
|
|
29
|
-
capturePage(options?: CapturePageOptions): Promise<string>;
|
|
9
|
+
capturePage(options?: OpenFin.CapturePageOptions): Promise<string>;
|
|
30
10
|
executeJavaScript(code: string): Promise<void>;
|
|
31
11
|
getZoomLevel(): Promise<number>;
|
|
32
12
|
setZoomLevel(level: number): Promise<void>;
|