@openfin/core 28.71.6 → 28.71.9
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/OpenFin.d.ts +40 -1
- package/package.json +1 -1
- package/src/api/application/Instance.d.ts +6 -0
- package/src/api/application/Instance.js +8 -0
- package/src/api/interop/Factory.js +8 -2
- package/src/api/interop/InteropBroker.d.ts +4 -2
- package/src/api/interop/InteropBroker.js +49 -27
- package/src/api/platform/layout/Factory.js +5 -1
- package/src/api/platform/layout/SplitterController/bounds-observer.d.ts +17 -0
- package/src/api/platform/layout/SplitterController/bounds-observer.js +49 -0
- package/src/api/platform/layout/SplitterController/index.d.ts +29 -0
- package/src/api/platform/layout/SplitterController/index.js +81 -0
- package/src/api/platform/layout/SplitterController/overlay.d.ts +23 -0
- package/src/api/platform/layout/SplitterController/overlay.js +30 -0
- package/src/api/system/index.d.ts +7 -0
- package/src/api/system/index.js +9 -0
- package/src/api/view/Instance.d.ts +1 -0
- package/src/api/view/Instance.js +1 -0
- package/src/api/window/Instance.d.ts +18 -0
- package/src/api/window/Instance.js +18 -0
- package/src/shapes/protocol.d.ts +39 -92
package/OpenFin.d.ts
CHANGED
|
@@ -254,6 +254,19 @@ declare namespace OpenFin {
|
|
|
254
254
|
|
|
255
255
|
export type WindowOptions = MutableWindowOptions & ConstWindowOptions;
|
|
256
256
|
|
|
257
|
+
export interface ShowViewOnWindowResizeOptions {
|
|
258
|
+
enabled?: boolean;
|
|
259
|
+
paintIntervalMs?: number;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface ShowViewOnSplitterDragOptions {
|
|
263
|
+
enabled?: boolean;
|
|
264
|
+
}
|
|
265
|
+
export type ViewVisibilityOptions = {
|
|
266
|
+
showViewsOnWindowResize?: ShowViewOnWindowResizeOptions;
|
|
267
|
+
showViewsOnSplitterDrag?: ShowViewOnSplitterDragOptions;
|
|
268
|
+
}
|
|
269
|
+
|
|
257
270
|
export type WindowState = 'maximized' | 'minimized' | 'normal';
|
|
258
271
|
|
|
259
272
|
export type ConstWindowOptions = {
|
|
@@ -294,6 +307,8 @@ declare namespace OpenFin {
|
|
|
294
307
|
y: number;
|
|
295
308
|
experimental?: any;
|
|
296
309
|
fdc3InteropApi?: string;
|
|
310
|
+
// Platform only
|
|
311
|
+
viewVisibility?: ViewVisibilityOptions;
|
|
297
312
|
};
|
|
298
313
|
|
|
299
314
|
export type MutableWindowOptions = {
|
|
@@ -301,7 +316,9 @@ declare namespace OpenFin {
|
|
|
301
316
|
alwaysOnTop: boolean;
|
|
302
317
|
aspectRatio: number;
|
|
303
318
|
contextMenu: boolean;
|
|
319
|
+
// DEPRECATED
|
|
304
320
|
contextMenuSettings: ContextMenuSettings;
|
|
321
|
+
contextMenuOptions: ContextMenuOptions;
|
|
305
322
|
cornerRounding: Partial<CornerRounding>;
|
|
306
323
|
customContext: any;
|
|
307
324
|
customData: any;
|
|
@@ -401,6 +418,7 @@ declare namespace OpenFin {
|
|
|
401
418
|
green: number;
|
|
402
419
|
};
|
|
403
420
|
|
|
421
|
+
// DEPRECATED
|
|
404
422
|
export type ContextMenuSettings = {
|
|
405
423
|
enable: boolean;
|
|
406
424
|
devtools?: boolean;
|
|
@@ -469,7 +487,10 @@ declare namespace OpenFin {
|
|
|
469
487
|
|
|
470
488
|
export type MutableViewOptions = {
|
|
471
489
|
autoResize: AutoResizeOptions;
|
|
490
|
+
contextMenu: boolean;
|
|
491
|
+
// DEPRECATED
|
|
472
492
|
contextMenuSettings: ContextMenuSettings;
|
|
493
|
+
contextMenuOptions: ContextMenuOptions;
|
|
473
494
|
backgroundColor: string;
|
|
474
495
|
customData: any;
|
|
475
496
|
customContext: any;
|
|
@@ -1324,6 +1345,7 @@ declare namespace OpenFin {
|
|
|
1324
1345
|
* Defaults to 'normal' unless a 'submenu' key exists
|
|
1325
1346
|
*/
|
|
1326
1347
|
type?: 'normal' | 'separator' | 'submenu' | 'checkbox';
|
|
1348
|
+
role?: 'cut' | 'copy' | 'paste' | 'toggleDevTools' | 'reload';
|
|
1327
1349
|
label?: string;
|
|
1328
1350
|
/**
|
|
1329
1351
|
* If false, the menu item will be greyed out and unclickable.
|
|
@@ -1348,7 +1370,7 @@ declare namespace OpenFin {
|
|
|
1348
1370
|
/**
|
|
1349
1371
|
* Data to be returned if the user selects the element. Must be serializable
|
|
1350
1372
|
*/
|
|
1351
|
-
data
|
|
1373
|
+
data?: any;
|
|
1352
1374
|
|
|
1353
1375
|
/**
|
|
1354
1376
|
* Image Data URI with image dimensions inferred from the encoded string
|
|
@@ -1668,4 +1690,21 @@ declare namespace OpenFin {
|
|
|
1668
1690
|
export type PlatformEvents = import('./src/api/events/platform').PlatformEvents;
|
|
1669
1691
|
|
|
1670
1692
|
export type ExternalApplicationEvents = import('./src/api/events/externalApplication').ExternalApplicationEvents;
|
|
1693
|
+
|
|
1694
|
+
export type ContextMenuOptions = {
|
|
1695
|
+
template: Array<PrebuiltContextMenuItems>;
|
|
1696
|
+
enabled?: boolean;
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
export type PrebuiltContextMenuItems =
|
|
1700
|
+
| 'separator'
|
|
1701
|
+
| 'cut'
|
|
1702
|
+
| 'copy'
|
|
1703
|
+
| 'paste'
|
|
1704
|
+
| 'spellCheck'
|
|
1705
|
+
| 'inspect'
|
|
1706
|
+
| 'reload'
|
|
1707
|
+
| 'navigateForward'
|
|
1708
|
+
| 'navigateBack'
|
|
1709
|
+
| 'print';
|
|
1671
1710
|
}
|
package/package.json
CHANGED
|
@@ -264,6 +264,12 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvents>
|
|
|
264
264
|
* @tutorial Application.getTrayIconInfo
|
|
265
265
|
*/
|
|
266
266
|
getTrayIconInfo(): Promise<OpenFin.TrayInfo>;
|
|
267
|
+
/**
|
|
268
|
+
* @summary Checks if the application has an associated tray icon.
|
|
269
|
+
* @return {Promise.<boolean>}
|
|
270
|
+
* @tutorial Application.hasTrayIcon
|
|
271
|
+
*/
|
|
272
|
+
hasTrayIcon(): Promise<boolean>;
|
|
267
273
|
/**
|
|
268
274
|
* Closes the application by terminating its process.
|
|
269
275
|
* @return {Promise.<void>}
|
|
@@ -363,6 +363,14 @@ class Application extends base_1.EmitterBase {
|
|
|
363
363
|
getTrayIconInfo() {
|
|
364
364
|
return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
|
|
365
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* @summary Checks if the application has an associated tray icon.
|
|
368
|
+
* @return {Promise.<boolean>}
|
|
369
|
+
* @tutorial Application.hasTrayIcon
|
|
370
|
+
*/
|
|
371
|
+
hasTrayIcon() {
|
|
372
|
+
return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
|
|
373
|
+
}
|
|
366
374
|
/**
|
|
367
375
|
* Closes the application by terminating its process.
|
|
368
376
|
* @return {Promise.<void>}
|
|
@@ -29,10 +29,16 @@ class InteropModule extends base_1.Base {
|
|
|
29
29
|
this.wire.sendAction('interop-init').catch((e) => {
|
|
30
30
|
// don't expose, analytics-only call
|
|
31
31
|
});
|
|
32
|
-
const provider = await this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
|
|
33
32
|
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
34
33
|
const options = await this.fin.Application.getCurrentSync().getInfo();
|
|
35
|
-
|
|
34
|
+
let provider;
|
|
35
|
+
const getProvider = () => {
|
|
36
|
+
if (!provider) {
|
|
37
|
+
provider = this.fin.InterApplicationBus.Channel.create(`interop-broker-${name}`);
|
|
38
|
+
}
|
|
39
|
+
return provider;
|
|
40
|
+
};
|
|
41
|
+
return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration || {});
|
|
36
42
|
}
|
|
37
43
|
/**
|
|
38
44
|
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
|
|
@@ -124,13 +124,14 @@ import Identity = OpenFin.Identity;
|
|
|
124
124
|
* @class
|
|
125
125
|
*/
|
|
126
126
|
export declare class InteropBroker extends Base {
|
|
127
|
-
private
|
|
127
|
+
private getProvider;
|
|
128
128
|
private interopClients;
|
|
129
129
|
private contextGroupsById;
|
|
130
130
|
private intentClientMap;
|
|
131
131
|
private lastContextMap;
|
|
132
132
|
private sessionContextGroupMap;
|
|
133
|
-
|
|
133
|
+
private channel;
|
|
134
|
+
constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
|
|
134
135
|
/**
|
|
135
136
|
* SetContextOptions interface
|
|
136
137
|
* @typedef { object } SetContextOptions
|
|
@@ -345,6 +346,7 @@ export declare class InteropBroker extends Base {
|
|
|
345
346
|
static isContextTypeCompatible(contextType: string, registeredContextType: string | undefined): boolean;
|
|
346
347
|
private setContextGroupMap;
|
|
347
348
|
private static setCurrentContextGroupInClientOptions;
|
|
349
|
+
private setupChannelProvider;
|
|
348
350
|
private wireChannel;
|
|
349
351
|
/**
|
|
350
352
|
* Can be used to completely prevent a connection. Return false to prevent connections. Allows all connections by default.
|
|
@@ -171,9 +171,9 @@ let contextGroups = [
|
|
|
171
171
|
* @class
|
|
172
172
|
*/
|
|
173
173
|
class InteropBroker extends base_1.Base {
|
|
174
|
-
constructor(wire,
|
|
174
|
+
constructor(wire, getProvider, options) {
|
|
175
175
|
super(wire);
|
|
176
|
-
this.
|
|
176
|
+
this.getProvider = getProvider;
|
|
177
177
|
this.interopClients = new Map();
|
|
178
178
|
this.contextGroupsById = new Map();
|
|
179
179
|
if (options.contextGroups) {
|
|
@@ -183,7 +183,7 @@ class InteropBroker extends base_1.Base {
|
|
|
183
183
|
this.lastContextMap = new Map();
|
|
184
184
|
this.sessionContextGroupMap = new Map();
|
|
185
185
|
this.setContextGroupMap();
|
|
186
|
-
this.
|
|
186
|
+
this.setupChannelProvider();
|
|
187
187
|
}
|
|
188
188
|
/*
|
|
189
189
|
Client API
|
|
@@ -321,19 +321,24 @@ class InteropBroker extends base_1.Base {
|
|
|
321
321
|
await this.addClientToContextGroup({ contextGroupId }, target);
|
|
322
322
|
}
|
|
323
323
|
// Sanity check here in case a single app has multiple connections
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
324
|
+
try {
|
|
325
|
+
const allConnections = this.channel.connections.filter((x) => x.uuid === target.uuid && x.name === target.name);
|
|
326
|
+
if (!allConnections.length) {
|
|
327
|
+
throw new Error(`Given Identity ${target.uuid} ${target.name} is not connected to the Interop Broker.`);
|
|
328
|
+
}
|
|
329
|
+
if (allConnections.length > 1) {
|
|
330
|
+
// Should figure out how we want to handle this situation. In the meantime, just change context group for all connections.
|
|
331
|
+
console.warn(`More than one connection found for identity ${target.uuid} ${target.name}`);
|
|
332
|
+
}
|
|
333
|
+
const promises = [];
|
|
334
|
+
for (const connection of allConnections) {
|
|
335
|
+
promises.push(this.addClientToContextGroup({ contextGroupId }, connection));
|
|
336
|
+
}
|
|
337
|
+
await Promise.all(promises);
|
|
331
338
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
promises.push(this.addClientToContextGroup({ contextGroupId }, connection));
|
|
339
|
+
catch (error) {
|
|
340
|
+
throw new Error(error);
|
|
335
341
|
}
|
|
336
|
-
await Promise.all(promises);
|
|
337
342
|
}
|
|
338
343
|
else {
|
|
339
344
|
// No target provided, add the sender to the context group.
|
|
@@ -402,19 +407,24 @@ class InteropBroker extends base_1.Base {
|
|
|
402
407
|
if (InteropBroker.hasEndpointId(target)) {
|
|
403
408
|
await this.removeClientFromContextGroup(target);
|
|
404
409
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
try {
|
|
411
|
+
// Sanity check here in case a single app has multiple connections
|
|
412
|
+
const allConnections = this.channel.connections.filter((x) => x.uuid === target.uuid && x.name === target.name);
|
|
413
|
+
if (!allConnections.length) {
|
|
414
|
+
throw new Error(`No connection found for given Identity ${target.uuid} ${target.name}`);
|
|
415
|
+
}
|
|
416
|
+
if (allConnections.length > 1) {
|
|
417
|
+
console.warn(`More than one connection found for identity ${target.uuid} ${target.name}`);
|
|
418
|
+
}
|
|
419
|
+
const promises = [];
|
|
420
|
+
for (const connection of allConnections) {
|
|
421
|
+
promises.push(this.removeClientFromContextGroup(connection));
|
|
422
|
+
}
|
|
423
|
+
await Promise.all(promises);
|
|
412
424
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
promises.push(this.removeClientFromContextGroup(connection));
|
|
425
|
+
catch (error) {
|
|
426
|
+
throw new Error(error);
|
|
416
427
|
}
|
|
417
|
-
await Promise.all(promises);
|
|
418
428
|
}
|
|
419
429
|
else {
|
|
420
430
|
// No target provided, remove the sender from the context group.
|
|
@@ -706,8 +716,10 @@ class InteropBroker extends base_1.Base {
|
|
|
706
716
|
}
|
|
707
717
|
// Used to invoke a client's context handler
|
|
708
718
|
invokeContextHandler(clientIdentity, handlerId, context) {
|
|
709
|
-
this.
|
|
710
|
-
|
|
719
|
+
this.getProvider().then((channel) => {
|
|
720
|
+
channel.dispatch(clientIdentity, handlerId, context).catch((e) => {
|
|
721
|
+
console.error(`Error invoking context handler ${handlerId} for context type ${context.type} in client ${clientIdentity.uuid}/${clientIdentity.name}/${clientIdentity.endpointId}`, e);
|
|
722
|
+
});
|
|
711
723
|
});
|
|
712
724
|
}
|
|
713
725
|
// Used to remove a context handler for a client
|
|
@@ -826,6 +838,16 @@ class InteropBroker extends base_1.Base {
|
|
|
826
838
|
console.warn(`Setting Current Context Group: Entity with identity ${clientIdentity.uuid}, ${clientIdentity.name} is not a window or view. It is a ${entityInfo.entityType} instead.`);
|
|
827
839
|
}
|
|
828
840
|
}
|
|
841
|
+
async setupChannelProvider() {
|
|
842
|
+
try {
|
|
843
|
+
const channel = await this.getProvider();
|
|
844
|
+
this.channel = channel;
|
|
845
|
+
this.wireChannel(channel);
|
|
846
|
+
}
|
|
847
|
+
catch (error) {
|
|
848
|
+
throw new Error(`Error setting up Interop Broker Channel Provider: ${error}`);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
829
851
|
// Setup Channel Connection Logic
|
|
830
852
|
wireChannel(channel) {
|
|
831
853
|
channel.onConnection((clientIdentity, payload) => {
|
|
@@ -18,6 +18,8 @@ exports.LayoutModule = void 0;
|
|
|
18
18
|
/* eslint-disable no-undef, import/prefer-default-export */
|
|
19
19
|
const Instance_1 = require("./Instance");
|
|
20
20
|
const base_1 = require("../../base");
|
|
21
|
+
const SplitterController_1 = require("./SplitterController");
|
|
22
|
+
const overlay_1 = require("./SplitterController/overlay");
|
|
21
23
|
/**
|
|
22
24
|
* InitLayoutOptions interface
|
|
23
25
|
* @typedef { object } InitLayoutOptions
|
|
@@ -105,7 +107,9 @@ class LayoutModule extends base_1.Base {
|
|
|
105
107
|
}
|
|
106
108
|
// We need to go through environment to make sure it is only imported/bundled in OpenFin.
|
|
107
109
|
const ManagerConstructor = await this.wire.environment.getManagerConstructor();
|
|
108
|
-
|
|
110
|
+
const overlay = new overlay_1.Overlay(this.wire);
|
|
111
|
+
const splitterController = new SplitterController_1.SplitterController(overlay);
|
|
112
|
+
__classPrivateFieldSet(this, _layoutManager, new ManagerConstructor(splitterController));
|
|
109
113
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
110
114
|
// @ts-ignore - layout warning here for backwards compatibility, can remove layout check in .52
|
|
111
115
|
let { layout, containerId } = options;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observes the bounding client box rectangle of the given element for changes.
|
|
3
|
+
*
|
|
4
|
+
* This solution only works for 2 scenarios, though could be updated to support more
|
|
5
|
+
* (e.g. via polling).
|
|
6
|
+
*
|
|
7
|
+
* MutationObserver will only pick up changes to bounds if they are specified via fixed
|
|
8
|
+
* style rules in the element's attribtues.
|
|
9
|
+
*
|
|
10
|
+
* ResizeObserver will pick up all changes to an element's width and height but will not capture
|
|
11
|
+
* any changes to position.
|
|
12
|
+
*
|
|
13
|
+
* @param element The element to observe the bounding box for (i.e. position, width, height)
|
|
14
|
+
* @param onChange Called every time the bounding box changes.
|
|
15
|
+
* @returns Function which disposes the observers when invoked.
|
|
16
|
+
*/
|
|
17
|
+
export declare const observeBounds: (element: Element, onChange: (bounds: DOMRect) => void) => () => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.observeBounds = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Observes the bounding client box rectangle of the given element for changes.
|
|
6
|
+
*
|
|
7
|
+
* This solution only works for 2 scenarios, though could be updated to support more
|
|
8
|
+
* (e.g. via polling).
|
|
9
|
+
*
|
|
10
|
+
* MutationObserver will only pick up changes to bounds if they are specified via fixed
|
|
11
|
+
* style rules in the element's attribtues.
|
|
12
|
+
*
|
|
13
|
+
* ResizeObserver will pick up all changes to an element's width and height but will not capture
|
|
14
|
+
* any changes to position.
|
|
15
|
+
*
|
|
16
|
+
* @param element The element to observe the bounding box for (i.e. position, width, height)
|
|
17
|
+
* @param onChange Called every time the bounding box changes.
|
|
18
|
+
* @returns Function which disposes the observers when invoked.
|
|
19
|
+
*/
|
|
20
|
+
exports.observeBounds = (element, onChange) => {
|
|
21
|
+
let lastBounds;
|
|
22
|
+
const isDomRectEqual = (a, b) => {
|
|
23
|
+
if (a.top !== b.top
|
|
24
|
+
|| a.left !== b.left
|
|
25
|
+
|| a.width !== b.width
|
|
26
|
+
|| a.height !== b.height
|
|
27
|
+
|| a.x !== b.x
|
|
28
|
+
|| a.y !== b.y) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
33
|
+
const checkBounds = () => {
|
|
34
|
+
const currentBounds = element.getBoundingClientRect();
|
|
35
|
+
if (!lastBounds || !isDomRectEqual(lastBounds, currentBounds)) {
|
|
36
|
+
lastBounds = currentBounds;
|
|
37
|
+
onChange(element.getBoundingClientRect());
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const resizeObserver = new ResizeObserver(() => checkBounds());
|
|
41
|
+
const mutationObserver = new MutationObserver(() => checkBounds());
|
|
42
|
+
resizeObserver.observe(element, { box: 'content-box' });
|
|
43
|
+
mutationObserver.observe(element, { attributes: true, attributeFilter: ['style'] });
|
|
44
|
+
checkBounds();
|
|
45
|
+
return () => {
|
|
46
|
+
resizeObserver.disconnect();
|
|
47
|
+
mutationObserver.disconnect();
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Overlay } from './overlay';
|
|
2
|
+
export declare type SplitterItem = GoldenLayout.ContentItem & {
|
|
3
|
+
viewEventsAdded: boolean;
|
|
4
|
+
isVertical: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Utility class for managing Golden Layout splitter drag interactions.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SplitterController {
|
|
10
|
+
private readonly overlay;
|
|
11
|
+
constructor(overlay: Overlay);
|
|
12
|
+
private teardown?;
|
|
13
|
+
private tryTeardown;
|
|
14
|
+
/**
|
|
15
|
+
* Disables the pointer events on the splitters, preventing them from being dragged.
|
|
16
|
+
*/
|
|
17
|
+
preventSplitterResize: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Ends a splitter drag move, if one is in progress.
|
|
20
|
+
*/
|
|
21
|
+
endMove: () => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Initialises a splitter drag move, rendering a view on top of the splitter
|
|
24
|
+
* to allow it to render on top of the views within a layout (as they will always
|
|
25
|
+
* have a higher z-index to the platform window itself).
|
|
26
|
+
* @param splitterItem The Golden Layout splitter item that is currently being dragged.
|
|
27
|
+
*/
|
|
28
|
+
startMove: (splitterItem: SplitterItem) => Promise<void>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SplitterController = void 0;
|
|
4
|
+
const bounds_observer_1 = require("./bounds-observer");
|
|
5
|
+
const applyBoundsOffset = (bounds, offsets = {}) => {
|
|
6
|
+
const sum = (bound, offset) => {
|
|
7
|
+
return bound + (offset || 0);
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
left: sum(bounds.left, offsets.left),
|
|
11
|
+
top: sum(bounds.top, offsets.top),
|
|
12
|
+
width: sum(bounds.width, offsets.width),
|
|
13
|
+
height: sum(bounds.height, offsets.height)
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Utility class for managing Golden Layout splitter drag interactions.
|
|
18
|
+
*/
|
|
19
|
+
class SplitterController {
|
|
20
|
+
// eslint-disable-next-line
|
|
21
|
+
constructor(overlay) {
|
|
22
|
+
this.overlay = overlay;
|
|
23
|
+
this.tryTeardown = () => {
|
|
24
|
+
if (this.teardown) {
|
|
25
|
+
this.teardown();
|
|
26
|
+
this.teardown = undefined;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Disables the pointer events on the splitters, preventing them from being dragged.
|
|
31
|
+
*/
|
|
32
|
+
this.preventSplitterResize = () => {
|
|
33
|
+
document.querySelectorAll('.lm_splitter').forEach((splitter) => {
|
|
34
|
+
splitter.style.pointerEvents = 'none';
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Ends a splitter drag move, if one is in progress.
|
|
39
|
+
*/
|
|
40
|
+
this.endMove = async () => {
|
|
41
|
+
try {
|
|
42
|
+
this.overlay.detachOverlay();
|
|
43
|
+
this.tryTeardown();
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw new Error(`Failed to end splitter move: ${error.stack}`);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Initialises a splitter drag move, rendering a view on top of the splitter
|
|
51
|
+
* to allow it to render on top of the views within a layout (as they will always
|
|
52
|
+
* have a higher z-index to the platform window itself).
|
|
53
|
+
* @param splitterItem The Golden Layout splitter item that is currently being dragged.
|
|
54
|
+
*/
|
|
55
|
+
this.startMove = async (splitterItem) => {
|
|
56
|
+
try {
|
|
57
|
+
if (this.teardown) {
|
|
58
|
+
console.warn('Splitter move started before other move has been torn down.');
|
|
59
|
+
this.tryTeardown();
|
|
60
|
+
}
|
|
61
|
+
const splitterDiv = splitterItem.element.get(0);
|
|
62
|
+
const { backgroundColor } = getComputedStyle(splitterDiv);
|
|
63
|
+
const initialVisibility = splitterDiv.style.visibility;
|
|
64
|
+
splitterDiv.style.visibility = 'hidden';
|
|
65
|
+
const onBoundsChange = (bounds) => {
|
|
66
|
+
const offsetBounds = applyBoundsOffset(bounds, { height: splitterItem.isVertical ? 0 : 2 });
|
|
67
|
+
this.overlay.renderOverlay({ bounds: offsetBounds, backgroundColor });
|
|
68
|
+
};
|
|
69
|
+
const teardownBoundsObserver = bounds_observer_1.observeBounds(splitterDiv, onBoundsChange);
|
|
70
|
+
this.teardown = () => {
|
|
71
|
+
teardownBoundsObserver();
|
|
72
|
+
splitterDiv.style.visibility = initialVisibility;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new Error(`Failed to start splitter move: ${error.stack}`);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.SplitterController = SplitterController;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Transport from "../../../../transport/transport";
|
|
2
|
+
/**
|
|
3
|
+
* Api client allowing an empty electron BrowserView to be rendered
|
|
4
|
+
* in the current window with the specified bounds.
|
|
5
|
+
*
|
|
6
|
+
* Please note, only one Overlay can be rendered at a time per runtime.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Overlay {
|
|
9
|
+
private wire;
|
|
10
|
+
constructor(wire: Transport);
|
|
11
|
+
/**
|
|
12
|
+
* Renders the overlay at the specified position relative to the calling window.
|
|
13
|
+
* @param options Bounds and background color to display in the overlay.
|
|
14
|
+
*/
|
|
15
|
+
renderOverlay: (options: {
|
|
16
|
+
bounds: OpenFin.Bounds;
|
|
17
|
+
backgroundColor: string;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Removes the overlay from the current window.
|
|
21
|
+
*/
|
|
22
|
+
detachOverlay: () => Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Overlay = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Api client allowing an empty electron BrowserView to be rendered
|
|
6
|
+
* in the current window with the specified bounds.
|
|
7
|
+
*
|
|
8
|
+
* Please note, only one Overlay can be rendered at a time per runtime.
|
|
9
|
+
*/
|
|
10
|
+
class Overlay {
|
|
11
|
+
// eslint-disable-next-line
|
|
12
|
+
constructor(wire) {
|
|
13
|
+
this.wire = wire;
|
|
14
|
+
/**
|
|
15
|
+
* Renders the overlay at the specified position relative to the calling window.
|
|
16
|
+
* @param options Bounds and background color to display in the overlay.
|
|
17
|
+
*/
|
|
18
|
+
this.renderOverlay = async (options) => {
|
|
19
|
+
const { bounds, backgroundColor } = options;
|
|
20
|
+
await this.wire.sendAction('render-overlay', { bounds, backgroundColor });
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Removes the overlay from the current window.
|
|
24
|
+
*/
|
|
25
|
+
this.detachOverlay = async () => {
|
|
26
|
+
await this.wire.sendAction('detach-overlay');
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.Overlay = Overlay;
|
|
@@ -13,6 +13,7 @@ import EntityInfo = OpenFin.EntityInfo;
|
|
|
13
13
|
import Entity = OpenFin.ApplicationType;
|
|
14
14
|
import ApplicationState = OpenFin.ApplicationState;
|
|
15
15
|
import ApplicationWindowInfo = OpenFin.ApplicationWindowInfo;
|
|
16
|
+
import PrinterInfo = OpenFin.PrinterInfo;
|
|
16
17
|
/**
|
|
17
18
|
* AppAssetInfo interface
|
|
18
19
|
* @typedef { object } AppAssetInfo
|
|
@@ -957,4 +958,10 @@ export default class System extends EmitterBase<SystemEvents> {
|
|
|
957
958
|
* @tutorial System.registerUsage
|
|
958
959
|
*/
|
|
959
960
|
registerUsage({ data, type }: OpenFin.RegisterUsageData): Promise<void>;
|
|
961
|
+
/**
|
|
962
|
+
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
963
|
+
* @return { Promise.Array.<PrinterInfo> }
|
|
964
|
+
* @tutorial System.getPrinters
|
|
965
|
+
*/
|
|
966
|
+
getPrinters(): Promise<PrinterInfo[]>;
|
|
960
967
|
}
|
package/src/api/system/index.js
CHANGED
|
@@ -1237,5 +1237,14 @@ class System extends base_1.EmitterBase {
|
|
|
1237
1237
|
async registerUsage({ data, type }) {
|
|
1238
1238
|
await this.wire.sendAction('register-usage', { data, type });
|
|
1239
1239
|
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
1242
|
+
* @return { Promise.Array.<PrinterInfo> }
|
|
1243
|
+
* @tutorial System.getPrinters
|
|
1244
|
+
*/
|
|
1245
|
+
async getPrinters() {
|
|
1246
|
+
const { payload } = await this.wire.sendAction('system-get-printers');
|
|
1247
|
+
return payload.data;
|
|
1248
|
+
}
|
|
1240
1249
|
}
|
|
1241
1250
|
exports.default = System;
|
package/src/api/view/Instance.js
CHANGED
|
@@ -333,6 +333,23 @@ import WindowEvents = OpenFin.WindowEvents;
|
|
|
333
333
|
* @property {boolean} [waitForPageLoad=false]
|
|
334
334
|
* When set to `true`, the window will not appear until the `window` object's `load` event fires.
|
|
335
335
|
* When set to `false`, the window will appear immediately without waiting for content to be loaded.
|
|
336
|
+
*
|
|
337
|
+
* @property {ViewVisibility} [viewVisibility]
|
|
338
|
+
* _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
|
|
339
|
+
*/
|
|
340
|
+
/**
|
|
341
|
+
* @typedef {Object} ViewVisibility _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
|
|
342
|
+
* @property {ShowViewsOnWindowResize} [showViewsOnWindowResize] Enables views to be shown when a Platform Window is being resized by the user.
|
|
343
|
+
* @property {ShowViewsOnSplitterDrag} [showViewsOnSplitterDrag] Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
|
|
344
|
+
*/
|
|
345
|
+
/**
|
|
346
|
+
* @typedef {Object} ShowViewsOnWindowResize _Platform Windows Only_. Enables views to be shown when a Platform Window is being resized by the user.
|
|
347
|
+
* @property {boolean} [enabled=false] Enables or disables showing Views when a Platform Window is being resized.
|
|
348
|
+
* @property {number} [paintIntervalMs=0] Number of miliseconds to wait between view repaints.
|
|
349
|
+
*/
|
|
350
|
+
/**
|
|
351
|
+
* @typedef {Object} ShowViewsOnSplitterDrag _Platform Windows Only_. Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
|
|
352
|
+
* @property {boolean} [enabled=false] Enables or disables showing views when the layout splitter is being dragged.
|
|
336
353
|
*/
|
|
337
354
|
/**
|
|
338
355
|
* @typedef {object} CapturePageOptions
|
|
@@ -610,6 +627,7 @@ export declare class _Window extends WebContents<WindowEvents> {
|
|
|
610
627
|
*/
|
|
611
628
|
/**
|
|
612
629
|
* Returns an array with all system printers
|
|
630
|
+
* @deprecated use System.getPrinters instead
|
|
613
631
|
* @function getPrinters
|
|
614
632
|
* @memberOf Window
|
|
615
633
|
* @instance
|
|
@@ -340,6 +340,23 @@ const view_1 = require("../view");
|
|
|
340
340
|
* @property {boolean} [waitForPageLoad=false]
|
|
341
341
|
* When set to `true`, the window will not appear until the `window` object's `load` event fires.
|
|
342
342
|
* When set to `false`, the window will appear immediately without waiting for content to be loaded.
|
|
343
|
+
*
|
|
344
|
+
* @property {ViewVisibility} [viewVisibility]
|
|
345
|
+
* _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
|
|
346
|
+
*/
|
|
347
|
+
/**
|
|
348
|
+
* @typedef {Object} ViewVisibility _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user.
|
|
349
|
+
* @property {ShowViewsOnWindowResize} [showViewsOnWindowResize] Enables views to be shown when a Platform Window is being resized by the user.
|
|
350
|
+
* @property {ShowViewsOnSplitterDrag} [showViewsOnSplitterDrag] Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
|
|
351
|
+
*/
|
|
352
|
+
/**
|
|
353
|
+
* @typedef {Object} ShowViewsOnWindowResize _Platform Windows Only_. Enables views to be shown when a Platform Window is being resized by the user.
|
|
354
|
+
* @property {boolean} [enabled=false] Enables or disables showing Views when a Platform Window is being resized.
|
|
355
|
+
* @property {number} [paintIntervalMs=0] Number of miliseconds to wait between view repaints.
|
|
356
|
+
*/
|
|
357
|
+
/**
|
|
358
|
+
* @typedef {Object} ShowViewsOnSplitterDrag _Platform Windows Only_. Allows views to be shown when they are resized by the user dragging the splitter between layout stacks.
|
|
359
|
+
* @property {boolean} [enabled=false] Enables or disables showing views when the layout splitter is being dragged.
|
|
343
360
|
*/
|
|
344
361
|
/**
|
|
345
362
|
* @typedef {object} CapturePageOptions
|
|
@@ -620,6 +637,7 @@ class _Window extends main_1.WebContents {
|
|
|
620
637
|
*/
|
|
621
638
|
/**
|
|
622
639
|
* Returns an array with all system printers
|
|
640
|
+
* @deprecated use System.getPrinters instead
|
|
623
641
|
* @function getPrinters
|
|
624
642
|
* @memberOf Window
|
|
625
643
|
* @instance
|
package/src/shapes/protocol.d.ts
CHANGED
|
@@ -68,98 +68,29 @@ export interface ProtocolMap extends ProtocolMapBase {
|
|
|
68
68
|
request: OpenFin.Identity;
|
|
69
69
|
response: void;
|
|
70
70
|
};
|
|
71
|
-
'fdc3-add-context-listener':
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
'fdc3-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
'
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
'
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
'interop-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
'interop-client-set-context': {
|
|
96
|
-
request: void;
|
|
97
|
-
response: void;
|
|
98
|
-
};
|
|
99
|
-
'interop-client-add-context-handler': {
|
|
100
|
-
request: void;
|
|
101
|
-
response: void;
|
|
102
|
-
};
|
|
103
|
-
'interop-client-get-context-groups': {
|
|
104
|
-
request: void;
|
|
105
|
-
response: void;
|
|
106
|
-
};
|
|
107
|
-
'interop-client-join-context-group': {
|
|
108
|
-
request: void;
|
|
109
|
-
response: void;
|
|
110
|
-
};
|
|
111
|
-
'interop-client-remove-from-context-group': {
|
|
112
|
-
request: void;
|
|
113
|
-
response: void;
|
|
114
|
-
};
|
|
115
|
-
'interop-client-get-all-clients-in-context-group': {
|
|
116
|
-
request: void;
|
|
117
|
-
response: void;
|
|
118
|
-
};
|
|
119
|
-
'interop-client-get-info-for-context-group': {
|
|
120
|
-
request: void;
|
|
121
|
-
response: void;
|
|
122
|
-
};
|
|
123
|
-
'interop-broker-add-client-to-context-group': {
|
|
124
|
-
request: void;
|
|
125
|
-
response: void;
|
|
126
|
-
};
|
|
127
|
-
'interop-broker-get-all-clients-in-context-group': {
|
|
128
|
-
request: void;
|
|
129
|
-
response: void;
|
|
130
|
-
};
|
|
131
|
-
'interop-broker-get-context-groups': {
|
|
132
|
-
request: void;
|
|
133
|
-
response: void;
|
|
134
|
-
};
|
|
135
|
-
'interop-broker-get-info-for-context-group': {
|
|
136
|
-
request: void;
|
|
137
|
-
response: void;
|
|
138
|
-
};
|
|
139
|
-
'interop-broker-is-action-authorized': {
|
|
140
|
-
request: void;
|
|
141
|
-
response: void;
|
|
142
|
-
};
|
|
143
|
-
'interop-broker-is-connection-authorized': {
|
|
144
|
-
request: void;
|
|
145
|
-
response: void;
|
|
146
|
-
};
|
|
147
|
-
'interop-broker-join-context-group': {
|
|
148
|
-
request: void;
|
|
149
|
-
response: void;
|
|
150
|
-
};
|
|
151
|
-
'interop-broker-remove-client-from-context-group': {
|
|
152
|
-
request: void;
|
|
153
|
-
response: void;
|
|
154
|
-
};
|
|
155
|
-
'interop-broker-remove-from-context-group': {
|
|
156
|
-
request: void;
|
|
157
|
-
response: void;
|
|
158
|
-
};
|
|
159
|
-
'interop-broker-set-context': {
|
|
160
|
-
request: void;
|
|
161
|
-
response: void;
|
|
162
|
-
};
|
|
71
|
+
'fdc3-add-context-listener': VoidCall;
|
|
72
|
+
'fdc3-broadcast': VoidCall;
|
|
73
|
+
'fdc3-get-system-channels': VoidCall;
|
|
74
|
+
'fdc3-join-channel': VoidCall;
|
|
75
|
+
'fdc3-leave-current-channel': VoidCall;
|
|
76
|
+
'interop-connect-sync': VoidCall;
|
|
77
|
+
'interop-client-set-context': VoidCall;
|
|
78
|
+
'interop-client-add-context-handler': VoidCall;
|
|
79
|
+
'interop-client-get-context-groups': VoidCall;
|
|
80
|
+
'interop-client-join-context-group': VoidCall;
|
|
81
|
+
'interop-client-remove-from-context-group': VoidCall;
|
|
82
|
+
'interop-client-get-all-clients-in-context-group': VoidCall;
|
|
83
|
+
'interop-client-get-info-for-context-group': VoidCall;
|
|
84
|
+
'interop-broker-add-client-to-context-group': VoidCall;
|
|
85
|
+
'interop-broker-get-all-clients-in-context-group': VoidCall;
|
|
86
|
+
'interop-broker-get-context-groups': VoidCall;
|
|
87
|
+
'interop-broker-get-info-for-context-group': VoidCall;
|
|
88
|
+
'interop-broker-is-action-authorized': VoidCall;
|
|
89
|
+
'interop-broker-is-connection-authorized': VoidCall;
|
|
90
|
+
'interop-broker-join-context-group': VoidCall;
|
|
91
|
+
'interop-broker-remove-client-from-context-group': VoidCall;
|
|
92
|
+
'interop-broker-remove-from-context-group': VoidCall;
|
|
93
|
+
'interop-broker-set-context': VoidCall;
|
|
163
94
|
'query-permission-for-current-context': {
|
|
164
95
|
request: {
|
|
165
96
|
apiName: string;
|
|
@@ -188,7 +119,23 @@ export interface ProtocolMap extends ProtocolMapBase {
|
|
|
188
119
|
};
|
|
189
120
|
response: void;
|
|
190
121
|
};
|
|
122
|
+
'render-overlay': {
|
|
123
|
+
request: {
|
|
124
|
+
bounds: OpenFin.Bounds;
|
|
125
|
+
backgroundColor: string;
|
|
126
|
+
};
|
|
127
|
+
response: void;
|
|
128
|
+
};
|
|
129
|
+
'detach-overlay': VoidCall;
|
|
130
|
+
'system-get-printers': {
|
|
131
|
+
request: void;
|
|
132
|
+
response: OpenFin.PrinterInfo[];
|
|
133
|
+
};
|
|
191
134
|
}
|
|
135
|
+
declare type VoidCall = {
|
|
136
|
+
request: void;
|
|
137
|
+
response: void;
|
|
138
|
+
};
|
|
192
139
|
interface ProtocolMapBase {
|
|
193
140
|
[action: string]: {
|
|
194
141
|
request: any;
|