@openfin/core 30.73.28 → 31.74.2
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/LICENSE.md +4 -0
- package/package.json +2 -2
- package/src/OpenFin.d.ts +1929 -407
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +28 -0
- package/src/api/api-exposer/api-consumer.js +28 -0
- package/src/api/api-exposer/api-exposer.d.ts +35 -0
- package/src/api/api-exposer/api-exposer.js +38 -0
- package/src/api/api-exposer/decorators.d.ts +10 -0
- package/src/api/api-exposer/decorators.js +18 -0
- package/src/api/api-exposer/index.d.ts +4 -0
- package/src/api/api-exposer/index.js +20 -0
- package/src/api/api-exposer/strategies/index.d.ts +1 -0
- package/src/api/api-exposer/strategies/index.js +17 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
- package/src/api/application/Factory.d.ts +1 -0
- package/src/api/application/Factory.js +2 -2
- package/src/api/application/Instance.d.ts +2 -1
- package/src/api/application/Instance.js +1 -0
- package/src/api/base.d.ts +4 -4
- package/src/api/clipboard/index.d.ts +1 -0
- package/src/api/clipboard/index.js +1 -0
- package/src/api/events/application.d.ts +22 -22
- package/src/api/events/base.d.ts +6 -9
- package/src/api/events/channel.d.ts +5 -5
- package/src/api/events/emitterMap.d.ts +1 -1
- package/src/api/events/externalApplication.d.ts +3 -3
- package/src/api/events/frame.d.ts +5 -5
- package/src/api/events/globalHotkey.d.ts +3 -3
- package/src/api/events/platform.d.ts +6 -7
- package/src/api/events/system.d.ts +20 -21
- package/src/api/events/typedEventEmitter.d.ts +1 -1
- package/src/api/events/view.d.ts +17 -14
- package/src/api/events/webcontents.d.ts +40 -18
- package/src/api/events/window.d.ts +65 -57
- package/src/api/external-application/Instance.d.ts +1 -1
- package/src/api/fin.d.ts +2 -2
- package/src/api/frame/Instance.d.ts +2 -2
- package/src/api/global-hotkey/index.d.ts +1 -1
- package/src/api/interappbus/channel/channel.d.ts +5 -5
- package/src/api/interappbus/channel/channel.js +3 -3
- package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
- package/src/api/interappbus/channel/channels-docs.js +7 -0
- package/src/api/interappbus/channel/client.d.ts +5 -4
- package/src/api/interappbus/channel/client.js +24 -17
- package/src/api/interappbus/channel/connection-manager.d.ts +2 -2
- package/src/api/interappbus/channel/connection-manager.js +12 -12
- package/src/api/interappbus/channel/index.d.ts +3 -3
- package/src/api/interappbus/channel/index.js +6 -8
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +2 -2
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +2 -2
- package/src/api/interappbus/channel/protocols/combined/strategy.js +5 -5
- package/src/api/interappbus/channel/protocols/index.d.ts +7 -4
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +4 -4
- package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -3
- package/src/api/interappbus/channel/provider.d.ts +6 -6
- package/src/api/interappbus/channel/provider.js +24 -24
- package/src/api/interappbus/index.d.ts +1 -1
- package/src/api/interop/Factory.d.ts +1 -2
- package/src/api/interop/Factory.js +20 -4
- package/src/api/interop/InteropBroker.d.ts +16 -48
- package/src/api/interop/InteropBroker.js +38 -48
- package/src/api/interop/InteropClient.d.ts +10 -9
- package/src/api/interop/InteropClient.js +9 -8
- package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +2 -1
- package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +16 -2
- package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -21
- package/src/api/interop/fdc3/fdc3-1.2.js +27 -12
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +13 -12
- package/src/api/interop/fdc3/fdc3-2.0.js +33 -26
- package/src/api/interop/fdc3/fdc3.d.ts +4 -5
- package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
- package/src/api/interop/fdc3/overrideCheck.js +32 -0
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +3 -3
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +5 -5
- package/src/api/interop/fdc3/utils.d.ts +17 -0
- package/src/api/interop/fdc3/utils.js +52 -18
- package/src/api/interop/fdc3/versions.d.ts +1 -0
- package/src/api/interop/fdc3/versions.js +2 -0
- package/src/api/interop/utils.d.ts +0 -1
- package/src/api/interop/utils.js +1 -9
- package/src/api/me.d.ts +4 -4
- package/src/api/platform/Factory.d.ts +6 -1
- package/src/api/platform/Factory.js +10 -9
- package/src/api/platform/Instance.d.ts +5 -3
- package/src/api/platform/Instance.js +5 -3
- package/src/api/platform/common-utils.d.ts +1 -1
- package/src/api/platform/layout/Factory.d.ts +5 -1
- package/src/api/platform/layout/Factory.js +15 -3
- package/src/api/platform/layout/Instance.d.ts +10 -4
- package/src/api/platform/layout/Instance.js +26 -1
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
- package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
- package/src/api/platform/layout/controllers/splitter-controller.d.ts +1 -1
- package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
- package/src/api/platform/layout/entities/layout-entities.js +216 -0
- package/src/api/platform/layout/entities/shapes.d.ts +6 -0
- package/src/api/platform/layout/entities/shapes.js +2 -0
- package/src/api/platform/layout/layout.constants.d.ts +1 -0
- package/src/api/platform/layout/layout.constants.js +4 -0
- package/src/api/platform/layout/shapes.d.ts +4 -1
- package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
- package/src/api/platform/layout/utils/layout-traversal.js +65 -0
- package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
- package/src/api/platform/provider.d.ts +162 -0
- package/src/api/platform/provider.js +2 -0
- package/src/api/snapshot-source/Factory.d.ts +1 -0
- package/src/api/snapshot-source/Factory.js +1 -0
- package/src/api/snapshot-source/Instance.d.ts +1 -1
- package/src/api/system/index.d.ts +14 -484
- package/src/api/system/index.js +6 -476
- package/src/api/view/Instance.d.ts +20 -6
- package/src/api/view/Instance.js +48 -8
- package/src/api/webcontents/main.d.ts +18 -4
- package/src/api/window/Instance.d.ts +21 -1
- package/src/api/window/Instance.js +20 -0
- package/src/browser.js +1 -1
- package/src/environment/browser.d.ts +1 -1
- package/src/environment/environment.d.ts +1 -1
- package/src/environment/node-env.d.ts +1 -1
- package/src/environment/openfin-env.d.ts +1 -1
- package/src/mock.d.ts +1 -1
- package/src/mock.js +6 -3
- package/src/namespaces.d.ts +21 -0
- package/src/namespaces.js +24 -0
- package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -1
- package/src/shapes/protocol.d.ts +3 -3
- package/src/transport/fin_store.d.ts +1 -1
- package/src/transport/transport-errors.d.ts +7 -2
- package/src/transport/transport-errors.js +1 -2
- package/src/transport/transport.d.ts +11 -8
- package/src/transport/transport.js +12 -6
- package/src/transport/wire.d.ts +14 -13
- package/src/util/channel-api-relay.d.ts +13 -0
- package/src/util/channel-api-relay.js +37 -0
- package/src/util/errors.d.ts +2 -2
- package/src/util/http.js +4 -2
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
- package/src/util/lazy.d.ts +16 -0
- package/src/util/lazy.js +26 -0
- package/src/util/promises.d.ts +1 -1
- package/src/util/reversible-map.d.ts +11 -0
- package/src/util/reversible-map.js +49 -0
- package/src/util/utilTypes.d.ts +1 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type * as OpenFin from '../../../../OpenFin';
|
|
2
|
+
import { LayoutEntitiesClient } from '../shapes';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
|
|
6
|
+
* for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class LayoutNode {
|
|
9
|
+
#private;
|
|
10
|
+
/** @internal */
|
|
11
|
+
protected constructor(client: LayoutEntitiesClient, entityId: string);
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
* The type of this node, one of: 'row' | 'column' | 'stack';
|
|
15
|
+
*/
|
|
16
|
+
readonly abstract type: OpenFin.LayoutEntityTypes;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
* This instance's unique id used when calling the layout-entities-controller api client
|
|
20
|
+
*/
|
|
21
|
+
protected readonly entityId: string;
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
* Encapsulates Api consumption of {@link LayoutEntitiesController} with a relayed dispatch
|
|
25
|
+
* @param client
|
|
26
|
+
* @param controllerId
|
|
27
|
+
* @param identity
|
|
28
|
+
* @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
|
|
29
|
+
*/
|
|
30
|
+
static newLayoutEntitiesClient: (client: OpenFin.ChannelClient, controllerId: string, identity: OpenFin.Identity) => Promise<LayoutEntitiesClient>;
|
|
31
|
+
static getEntity: (definition: OpenFin.LayoutEntityDefinition, client: LayoutEntitiesClient) => ColumnOrRow | TabStack;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if this {@link ColumnOrRow} or {@link TabStack} is the top level content item in the current layout.
|
|
34
|
+
* @returns Promise resolving true if this is the root, or false otherwise.
|
|
35
|
+
*/
|
|
36
|
+
isRoot: () => Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Determines if this {@link ColumnOrRow} or {@link TabStack} is the top level
|
|
39
|
+
* content item in the current layout.
|
|
40
|
+
* @returns Promise resolving true if this is the root, or false otherwise.
|
|
41
|
+
*/
|
|
42
|
+
exists: () => Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves the parent {@link ColumnOrRow} or {@link TabStack} of this item, if one exists.
|
|
45
|
+
* @returns Promise resolving with the {@link ColumnOrRow} or {@link TabStack} that contains this item, or undefined if this is the root content item.
|
|
46
|
+
*/
|
|
47
|
+
getParent: () => Promise<ColumnOrRow | TabStack | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Given a list of view creation options or references and a layout position, creates an adjacent {@link TabStack}
|
|
50
|
+
*
|
|
51
|
+
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
|
52
|
+
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
53
|
+
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
|
54
|
+
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
|
55
|
+
*
|
|
56
|
+
* @param views List of identities or view creation options of the views to include in the stack
|
|
57
|
+
* @param options Creation options, defaults to position: 'right'
|
|
58
|
+
* @returns an instance of {@link TabStack} containing the given views
|
|
59
|
+
* @experimental
|
|
60
|
+
*/
|
|
61
|
+
createAdjacentStack: (views: OpenFin.PlatformViewCreationOptions[], options: {
|
|
62
|
+
position?: OpenFin.LayoutPosition;
|
|
63
|
+
}) => Promise<TabStack>;
|
|
64
|
+
/**
|
|
65
|
+
* Finds the immediate adjacent layout item given an edge Position
|
|
66
|
+
* @param edge
|
|
67
|
+
* @returns an array of {@link TabStack} found, if none found returns an empty array.
|
|
68
|
+
*/
|
|
69
|
+
getAdjacentStacks: (edge: OpenFin.LayoutPosition) => Promise<TabStack[]>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A {@link TabStack} is used to manage the state of a TabStack within an OpenFin Layout and
|
|
73
|
+
* traverse to its parent Content Item.
|
|
74
|
+
*/
|
|
75
|
+
export declare class TabStack extends LayoutNode {
|
|
76
|
+
#private;
|
|
77
|
+
/** @internal */
|
|
78
|
+
constructor(client: LayoutEntitiesClient, entityId: string);
|
|
79
|
+
/**
|
|
80
|
+
* Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
|
|
81
|
+
*/
|
|
82
|
+
readonly type = "stack";
|
|
83
|
+
/**
|
|
84
|
+
* Retrieves a list of all views belonging to this {@link TabStack}.
|
|
85
|
+
*
|
|
86
|
+
* Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
|
|
87
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
88
|
+
* If that happens and then getViews() is called, it will return the identities in a different order than
|
|
89
|
+
* than the currently rendered tab order.
|
|
90
|
+
*
|
|
91
|
+
* @returns Resolves with a list containing the {@link OpenFin.Identity identities} of each view belonging to the {@link TabStack}.
|
|
92
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
93
|
+
* @experimental
|
|
94
|
+
*/
|
|
95
|
+
getViews: () => Promise<OpenFin.Identity[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Adds or creates a view in this {@link TabStack}.
|
|
98
|
+
*
|
|
99
|
+
* Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
|
100
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
101
|
+
*
|
|
102
|
+
* @param view The identity of an existing view to add, or options to create a view.
|
|
103
|
+
* @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)
|
|
104
|
+
* @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
|
|
105
|
+
* @throws If the view does not exist or fails to create.
|
|
106
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
107
|
+
* @experimental
|
|
108
|
+
*/
|
|
109
|
+
addView: (view: OpenFin.Identity | OpenFin.PlatformViewCreationOptions, options?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
|
|
110
|
+
/**
|
|
111
|
+
* Removes a view from this {@link TabStack}.
|
|
112
|
+
* @param view {@link OpenFin.Identiy Identity} of the view to remove.
|
|
113
|
+
* @throws If the view does not exist or does not belong to the stack.
|
|
114
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
115
|
+
*/
|
|
116
|
+
removeView: (view: OpenFin.Identity) => Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Sets the active view of the {@link TabStack} without focusing it.
|
|
119
|
+
* @param view {@link OpenFin.Identity Identity} of the view to activate.
|
|
120
|
+
* @returns Promise which resolves with void once the view has been activated.
|
|
121
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
122
|
+
* @throws If the view does not exist.
|
|
123
|
+
* @tutorial TabStack.setActiveView
|
|
124
|
+
* @experimental
|
|
125
|
+
*/
|
|
126
|
+
setActiveView: (view: OpenFin.Identity) => Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A {@link ColumnOrRow} is used to manage the state of a ColumnOrRow within an OpenFin Layout.
|
|
130
|
+
*/
|
|
131
|
+
export declare class ColumnOrRow extends LayoutNode {
|
|
132
|
+
#private;
|
|
133
|
+
/** @internal */
|
|
134
|
+
constructor(client: LayoutEntitiesClient, entityId: string, type: 'row' | 'column');
|
|
135
|
+
/**
|
|
136
|
+
* The type of this {@link ColumnOrRow}. Either 'row' or 'column'.
|
|
137
|
+
*/
|
|
138
|
+
readonly type: 'column' | 'row';
|
|
139
|
+
/**
|
|
140
|
+
* Retrieves a list of all content items belonging to this {@link ColumnOrRow} in order of appearance.
|
|
141
|
+
* @returns Resolves with a list containing {@link ColumnOrRow} and {@link TabStack} items belonging to this {@link ColumnOrRow}.
|
|
142
|
+
*/
|
|
143
|
+
getContent: () => Promise<(ColumnOrRow | TabStack)[]>;
|
|
144
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _a, _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ColumnOrRow = exports.TabStack = exports.LayoutNode = void 0;
|
|
16
|
+
const api_exposer_1 = require("../../../api-exposer");
|
|
17
|
+
const channel_api_relay_1 = require("../../../../util/channel-api-relay");
|
|
18
|
+
/*
|
|
19
|
+
This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
|
|
20
|
+
intertwined, and share members via parent abstract class LayoutNode. To prevent circular
|
|
21
|
+
refs, we define and export all the classes here.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
* Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
|
|
26
|
+
* for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
|
|
27
|
+
*/
|
|
28
|
+
class LayoutNode {
|
|
29
|
+
/** @internal */
|
|
30
|
+
constructor(client, entityId) {
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
* ApiClient for {@link LayoutEntitiesController}
|
|
34
|
+
*/
|
|
35
|
+
_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
|
+
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
|
+
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
|
+
this.getParent = async () => {
|
|
52
|
+
const parent = await __classPrivateFieldGet(this, _LayoutNode_client, "f").getParent(this.entityId);
|
|
53
|
+
if (!parent) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return LayoutNode.getEntity(parent, __classPrivateFieldGet(this, _LayoutNode_client, "f"));
|
|
57
|
+
};
|
|
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
|
+
this.createAdjacentStack = async (views, options) => {
|
|
72
|
+
const entityId = await __classPrivateFieldGet(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
|
73
|
+
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet(this, _LayoutNode_client, "f"));
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Finds the immediate adjacent layout item given an edge Position
|
|
77
|
+
* @param edge
|
|
78
|
+
* @returns an array of {@link TabStack} found, if none found returns an empty array.
|
|
79
|
+
*/
|
|
80
|
+
this.getAdjacentStacks = async (edge) => {
|
|
81
|
+
const adjacentStacks = await __classPrivateFieldGet(this, _LayoutNode_client, "f").getAdjacentStacks({
|
|
82
|
+
targetId: this.entityId,
|
|
83
|
+
edge
|
|
84
|
+
});
|
|
85
|
+
return adjacentStacks.map(stack => LayoutNode.getEntity({
|
|
86
|
+
type: 'stack',
|
|
87
|
+
entityId: stack.entityId
|
|
88
|
+
}, __classPrivateFieldGet(this, _LayoutNode_client, "f")));
|
|
89
|
+
};
|
|
90
|
+
__classPrivateFieldSet(this, _LayoutNode_client, client, "f");
|
|
91
|
+
this.entityId = entityId;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.LayoutNode = LayoutNode;
|
|
95
|
+
_a = LayoutNode, _LayoutNode_client = new WeakMap();
|
|
96
|
+
/**
|
|
97
|
+
* @internal
|
|
98
|
+
* Encapsulates Api consumption of {@link LayoutEntitiesController} with a relayed dispatch
|
|
99
|
+
* @param client
|
|
100
|
+
* @param controllerId
|
|
101
|
+
* @param identity
|
|
102
|
+
* @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
|
|
103
|
+
*/
|
|
104
|
+
LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
|
|
105
|
+
const dispatch = (0, channel_api_relay_1.createRelayedDispatch)(client, identity, 'layout-relay', 'You are trying to interact with a layout component on a window that has been destroyed.');
|
|
106
|
+
const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
|
|
107
|
+
return consumer.consume({ id: controllerId });
|
|
108
|
+
};
|
|
109
|
+
LayoutNode.getEntity = (definition, client) => {
|
|
110
|
+
const { entityId, type } = definition;
|
|
111
|
+
switch (type) {
|
|
112
|
+
case 'column':
|
|
113
|
+
case 'row':
|
|
114
|
+
return new ColumnOrRow(client, entityId, type);
|
|
115
|
+
case 'stack':
|
|
116
|
+
return new TabStack(client, entityId);
|
|
117
|
+
default:
|
|
118
|
+
throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* A {@link TabStack} is used to manage the state of a TabStack within an OpenFin Layout and
|
|
123
|
+
* traverse to its parent Content Item.
|
|
124
|
+
*/
|
|
125
|
+
class TabStack extends LayoutNode {
|
|
126
|
+
/** @internal */
|
|
127
|
+
constructor(client, entityId) {
|
|
128
|
+
super(client, entityId);
|
|
129
|
+
/**
|
|
130
|
+
* @internal
|
|
131
|
+
* ApiClient for {@link LayoutEntitiesController}
|
|
132
|
+
*/
|
|
133
|
+
_TabStack_client.set(this, void 0);
|
|
134
|
+
/**
|
|
135
|
+
* Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
|
|
136
|
+
*/
|
|
137
|
+
this.type = 'stack';
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves a list of all views belonging to this {@link TabStack}.
|
|
140
|
+
*
|
|
141
|
+
* Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
|
|
142
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
143
|
+
* If that happens and then getViews() is called, it will return the identities in a different order than
|
|
144
|
+
* than the currently rendered tab order.
|
|
145
|
+
*
|
|
146
|
+
* @returns Resolves with a list containing the {@link OpenFin.Identity identities} of each view belonging to the {@link TabStack}.
|
|
147
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
148
|
+
* @experimental
|
|
149
|
+
*/
|
|
150
|
+
this.getViews = () => __classPrivateFieldGet(this, _TabStack_client, "f").getStackViews(this.entityId);
|
|
151
|
+
/**
|
|
152
|
+
* Adds or creates a view in this {@link TabStack}.
|
|
153
|
+
*
|
|
154
|
+
* Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
|
155
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
|
156
|
+
*
|
|
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.
|
|
160
|
+
* @throws If the view does not exist or fails to create.
|
|
161
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
162
|
+
* @experimental
|
|
163
|
+
*/
|
|
164
|
+
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
|
165
|
+
/**
|
|
166
|
+
* Removes a view from this {@link TabStack}.
|
|
167
|
+
* @param view {@link OpenFin.Identiy Identity} of the view to remove.
|
|
168
|
+
* @throws If the view does not exist or does not belong to the stack.
|
|
169
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
170
|
+
*/
|
|
171
|
+
this.removeView = async (view) => {
|
|
172
|
+
await __classPrivateFieldGet(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Sets the active view of the {@link TabStack} without focusing it.
|
|
176
|
+
* @param view {@link OpenFin.Identity Identity} of the view to activate.
|
|
177
|
+
* @returns Promise which resolves with void once the view has been activated.
|
|
178
|
+
* @throws If the {@link TabStack} has been destroyed.
|
|
179
|
+
* @throws If the view does not exist.
|
|
180
|
+
* @tutorial TabStack.setActiveView
|
|
181
|
+
* @experimental
|
|
182
|
+
*/
|
|
183
|
+
this.setActiveView = async (view) => {
|
|
184
|
+
await __classPrivateFieldGet(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
|
185
|
+
};
|
|
186
|
+
__classPrivateFieldSet(this, _TabStack_client, client, "f");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.TabStack = TabStack;
|
|
190
|
+
_TabStack_client = new WeakMap();
|
|
191
|
+
/**
|
|
192
|
+
* A {@link ColumnOrRow} is used to manage the state of a ColumnOrRow within an OpenFin Layout.
|
|
193
|
+
*/
|
|
194
|
+
class ColumnOrRow extends LayoutNode {
|
|
195
|
+
/** @internal */
|
|
196
|
+
constructor(client, entityId, type) {
|
|
197
|
+
super(client, entityId);
|
|
198
|
+
/**
|
|
199
|
+
* @internal
|
|
200
|
+
* ApiClient for {@link LayoutEntitiesController}
|
|
201
|
+
*/
|
|
202
|
+
_ColumnOrRow_client.set(this, void 0);
|
|
203
|
+
/**
|
|
204
|
+
* Retrieves a list of all content items belonging to this {@link ColumnOrRow} in order of appearance.
|
|
205
|
+
* @returns Resolves with a list containing {@link ColumnOrRow} and {@link TabStack} items belonging to this {@link ColumnOrRow}.
|
|
206
|
+
*/
|
|
207
|
+
this.getContent = async () => {
|
|
208
|
+
const contentItemEntities = await __classPrivateFieldGet(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
|
209
|
+
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet(this, _ColumnOrRow_client, "f")));
|
|
210
|
+
};
|
|
211
|
+
__classPrivateFieldSet(this, _ColumnOrRow_client, client, "f");
|
|
212
|
+
this.type = type;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.ColumnOrRow = ColumnOrRow;
|
|
216
|
+
_ColumnOrRow_client = new WeakMap();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type LayoutEntityTypes = Exclude<GoldenLayout.ItemType, 'component' | 'root'>;
|
|
2
|
+
export type LayoutPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export type LayoutEntityDefinition<TLayoutEntityType extends LayoutEntityTypes = LayoutEntityTypes> = {
|
|
4
|
+
type: TLayoutEntityType;
|
|
5
|
+
entityId: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LAYOUT_CONTROLLER_ID = "layout-entities";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ApiClient } from '../../api-exposer';
|
|
1
2
|
import type * as OpenFin from '../../../OpenFin';
|
|
2
|
-
|
|
3
|
+
import { LayoutEntitiesController } from './controllers/layout-entities-controller';
|
|
4
|
+
type LayoutPresetType = OpenFin.LayoutPresetType;
|
|
3
5
|
export interface InitLayoutOptions {
|
|
4
6
|
containerId?: string;
|
|
5
7
|
}
|
|
@@ -10,4 +12,5 @@ export interface DragPayload {
|
|
|
10
12
|
'view-config': OpenFin.ViewCreationOptions;
|
|
11
13
|
'view-identity': [string, string, string];
|
|
12
14
|
}
|
|
15
|
+
export type LayoutEntitiesClient = ApiClient<LayoutEntitiesController>;
|
|
13
16
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type * as OpenFin from '../../../../OpenFin';
|
|
2
|
+
export declare const getAdjacentItem: (component: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => GoldenLayout.ContentItem | undefined;
|
|
3
|
+
export declare const doShareEdge: (a: GoldenLayout.ContentItem, b: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => boolean;
|
|
4
|
+
export declare const getAdjacentStacks: (item: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => GoldenLayout.ContentItem[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAdjacentStacks = exports.doShareEdge = exports.getAdjacentItem = void 0;
|
|
4
|
+
const getAdjacentItem = (component, edge) => {
|
|
5
|
+
const { parent } = component;
|
|
6
|
+
if (parent.isRoot) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const targetType = ['top', 'bottom'].includes(edge) ? 'column' : 'row';
|
|
10
|
+
const edgeSiblingOffset = ['top', 'left'].includes(edge) ? -1 : 1;
|
|
11
|
+
if (parent.type === targetType) {
|
|
12
|
+
const componentIndex = parent.contentItems.indexOf(component);
|
|
13
|
+
const targetIndex = componentIndex + edgeSiblingOffset;
|
|
14
|
+
if (targetIndex >= 0 && targetIndex < parent.contentItems.length) {
|
|
15
|
+
return parent.contentItems[targetIndex];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return (0, exports.getAdjacentItem)(parent, edge);
|
|
19
|
+
};
|
|
20
|
+
exports.getAdjacentItem = getAdjacentItem;
|
|
21
|
+
const doShareEdge = (a, b, edge) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const boundsA = (_a = a.element.get(0)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
24
|
+
const boundsB = (_b = b.element.get(0)) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
25
|
+
if (!boundsA || !boundsB) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (['top', 'bottom'].includes(edge)) {
|
|
29
|
+
return ((boundsB.left >= boundsA.left && boundsB.left < boundsA.right) ||
|
|
30
|
+
(boundsB.right > boundsA.left && boundsB.right <= boundsA.right));
|
|
31
|
+
}
|
|
32
|
+
return ((boundsB.top >= boundsA.top && boundsB.top < boundsA.bottom) ||
|
|
33
|
+
(boundsB.bottom > boundsA.top && boundsB.bottom <= boundsA.bottom));
|
|
34
|
+
};
|
|
35
|
+
exports.doShareEdge = doShareEdge;
|
|
36
|
+
const getAdjacentStacks = (item, edge) => {
|
|
37
|
+
const targetContainer = ['top', 'bottom'].includes(edge) ? 'row' : 'column';
|
|
38
|
+
const findEdgeStacks = (component) => {
|
|
39
|
+
if (component.type === 'stack') {
|
|
40
|
+
if ((0, exports.doShareEdge)(item, component, edge)) {
|
|
41
|
+
return [component];
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
if (component.type === 'root') {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
if (component.type === targetContainer) {
|
|
49
|
+
return component.contentItems.map((contentItem) => findEdgeStacks(contentItem)).flat();
|
|
50
|
+
}
|
|
51
|
+
if (component.type !== targetContainer) {
|
|
52
|
+
if (['top', 'right'].includes(edge)) {
|
|
53
|
+
return findEdgeStacks(component.contentItems[component.contentItems.length - 1]);
|
|
54
|
+
}
|
|
55
|
+
return findEdgeStacks(component.contentItems[0]);
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
};
|
|
59
|
+
const edgeItem = (0, exports.getAdjacentItem)(item, edge);
|
|
60
|
+
if (edgeItem) {
|
|
61
|
+
return findEdgeStacks(edgeItem);
|
|
62
|
+
}
|
|
63
|
+
return [];
|
|
64
|
+
};
|
|
65
|
+
exports.getAdjacentStacks = getAdjacentStacks;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as OpenFin from '../../../../OpenFin';
|
|
2
|
-
import Transport from '../../../../transport/transport';
|
|
2
|
+
import { Transport } from '../../../../transport/transport';
|
|
3
3
|
/**
|
|
4
4
|
* Api client allowing an empty electron BrowserView to be rendered
|
|
5
5
|
* in the current window with the specified bounds.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { WindowOptionsChangedEvent } from '../events/window';
|
|
2
|
+
import * as OpenFin from '../../OpenFin';
|
|
3
|
+
/**
|
|
4
|
+
* This class handles Platform actions. It does not need to be used directly by developers.
|
|
5
|
+
* However, its methods can be overriden by passing an `overrideCallback` to {@link Platform#init Platform.init}
|
|
6
|
+
* in order to implement custom Platform behavior. (See {@tutorial Platform.init})
|
|
7
|
+
*
|
|
8
|
+
* For an overview of Provider customization, see
|
|
9
|
+
* {@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior}.
|
|
10
|
+
*/
|
|
11
|
+
export interface PlatformProvider {
|
|
12
|
+
/**
|
|
13
|
+
* Handles requests to create a window in the current platform.
|
|
14
|
+
* @param { WindowOption } payload Window options for the window to be created.
|
|
15
|
+
* @param { Identity } [identity] If {@link Platform#createWindow Platform.createWindow} was called, the identity of the caller will be here.
|
|
16
|
+
* If `createWindow` was called as part of applying a snapshot or creating a view without a target window, `identity` will be undefined.
|
|
17
|
+
*/
|
|
18
|
+
createWindow(options: OpenFin.PlatformWindowCreationOptions, identity?: OpenFin.Identity): Promise<OpenFin.Window>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the current state of windows and their views and returns a snapshot object containing that info.
|
|
21
|
+
* @param { undefined } payload Undefined unless you've defined a custom `getSnapshot` protocol.
|
|
22
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#getSnapshot Platform.getSnapshot}.
|
|
23
|
+
* @return { Promise<Snapshot> } Snapshot of current platform state.
|
|
24
|
+
*/
|
|
25
|
+
getSnapshot(payload: undefined, identity: OpenFin.Identity): Promise<OpenFin.Snapshot>;
|
|
26
|
+
/**
|
|
27
|
+
* **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
|
|
28
|
+
* Gets the current state of a single view and returns an object with the options needed to restore that view as part of a snapshot.
|
|
29
|
+
* @param { Identity } payload Identity of the view.
|
|
30
|
+
* @return { Promise<ViewState> }
|
|
31
|
+
* @internal
|
|
32
|
+
* @experimental
|
|
33
|
+
*/
|
|
34
|
+
getViewSnapshot(payload: {
|
|
35
|
+
viewIdentity: OpenFin.Identity;
|
|
36
|
+
}): Promise<OpenFin.ViewState>;
|
|
37
|
+
/**
|
|
38
|
+
* Called when a snapshot is being applied and some windows in that snapshot would be fully or partially off-screen.
|
|
39
|
+
* Returns an array of windows with modified positions, such that any off-screen windows are positioned in the top left
|
|
40
|
+
* corner of the main monitor.
|
|
41
|
+
* @param { Snapshot } snapshot The snapshot to be applied.
|
|
42
|
+
* @param { WindowOptions[] } outOfBoundsWindows An array of WindowOptions for any windows that would be off-screen.
|
|
43
|
+
* @return { Promise<WindowOptions[]> } An array of WindowOptions with their position modified to fit on screen.
|
|
44
|
+
*/
|
|
45
|
+
positionOutOfBoundsWindows(snapshot: OpenFin.Snapshot, outOfBoundsWindows: OpenFin.WindowCreationOptions[]): Promise<OpenFin.WindowCreationOptions[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Handles requests to apply a snapshot to the current Platform.
|
|
48
|
+
* @param { ApplySnapshotPayload } payload Payload containing the snapshot to be applied, as well as any options.
|
|
49
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#applySnapshot Platform.applySnapshot}.
|
|
50
|
+
* Undefined if called internally (e.g. when opening the initial snapshot).
|
|
51
|
+
* @return { Promise<void> }
|
|
52
|
+
*/
|
|
53
|
+
applySnapshot(payload: OpenFin.ApplySnapshotPayload, identity?: OpenFin.Identity): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Closes the current Platform and all child windows and views.
|
|
56
|
+
* @param { undefined } payload Undefined unless you have implemented a custom quite protocol.
|
|
57
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#quit Platform.quit}.
|
|
58
|
+
* @return { Promise<void> }
|
|
59
|
+
*/
|
|
60
|
+
quit(payload: undefined, identity: OpenFin.Identity): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Closes a view
|
|
63
|
+
* @param { CloseViewPayload } payload Specifies the `target` view to be closed.
|
|
64
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#closeView Platform.closeView}.
|
|
65
|
+
*/
|
|
66
|
+
closeView(payload: OpenFin.CloseViewPayload, identity?: OpenFin.Identity): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new view and attaches it to a specified target window.
|
|
69
|
+
* @param { CreateViewPayload } payload Creation options for the new view.
|
|
70
|
+
* @param { Identity } identity Identity of the entity that called {@link Platform#createView Platform.createView}.
|
|
71
|
+
* @return { Promise<void> }
|
|
72
|
+
*/
|
|
73
|
+
createView(payload: OpenFin.CreateViewPayload, identity: OpenFin.Identity): Promise<OpenFin.View>;
|
|
74
|
+
/** Handles requests to fetch manifests in the current platform.
|
|
75
|
+
* @param { FetchManifestPayload } payload Payload containing the manifestUrl to be fetched.
|
|
76
|
+
* @param { Identity } callerIdentity If {@link Platform#fetchManifest Platform.fetchManifest}
|
|
77
|
+
* was called, the identity of the caller will be here.
|
|
78
|
+
* If `fetchManifest` was called internally, `callerIdentity` will be the provider's identity.
|
|
79
|
+
*/
|
|
80
|
+
fetchManifest(payload: OpenFin.FetchManifestPayload, callerIdentity: OpenFin.Identity): Promise<any>;
|
|
81
|
+
/**
|
|
82
|
+
* Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout will be destroyed.
|
|
83
|
+
* @param { ReplaceLayoutPayload } payload Contains the `target` window and an `opts` object with a `layout` property to apply.
|
|
84
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#replaceLayout Platform.replaceLayout}.
|
|
85
|
+
* Undefined if `replaceLayout` is called internally (e.g. while applying a snapshot).
|
|
86
|
+
* @return { Promise<void> }
|
|
87
|
+
*/
|
|
88
|
+
replaceLayout(payload: OpenFin.ReplaceLayoutPayload, identity?: OpenFin.Identity): Promise<void>;
|
|
89
|
+
replaceView(payload: OpenFin.ReplaceViewPayload, identity?: OpenFin.Identity): Promise<void>;
|
|
90
|
+
launchIntoPlatform(payload: OpenFin.LaunchIntoPlatformPayload): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Handles requests to set a window's context. `target` may be a window or a view.
|
|
93
|
+
* If it is a window, that window's `customContext` will be updated.
|
|
94
|
+
* If it is a view, the `customContext` of that view's current host window will be updated.
|
|
95
|
+
* @param { SetWindowContextPayload } payload Object containing the requested `context` update,
|
|
96
|
+
* the `target`'s identity, and the target's `entityType`.
|
|
97
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#setWindowContext Platform.setWindowContext}.
|
|
98
|
+
* Undefined if `setWindowContext` is called internally (e.g. while applying a snapshot).
|
|
99
|
+
* @return { Promise<any> } The new context.
|
|
100
|
+
*/
|
|
101
|
+
setWindowContext(payload: OpenFin.SetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Handles requests to get a window's context. `target` may be a window or a view.
|
|
104
|
+
* If it is a window, that window's `customContext` will be returned.
|
|
105
|
+
* If it is a view, the `customContext` of that view's current host window will be returned.
|
|
106
|
+
* @param { GetWindowContextPayload } payload Object containing the requested `context` update,
|
|
107
|
+
* the `target`'s identity, and the target's `entityType`.
|
|
108
|
+
* @param { Identity } [identity] Identity of the entity that called {@link Platform#getWindowContext Platform.getWindowContext}.
|
|
109
|
+
* Undefined when `getWindowContext` is called internally
|
|
110
|
+
* (e.g. when getting a window's context for the purpose of raising a "host-context-changed" event on a reparented view).
|
|
111
|
+
* @return { Promise<any> } The new context.
|
|
112
|
+
*/
|
|
113
|
+
getWindowContext(payload: OpenFin.GetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
|
|
114
|
+
/**
|
|
115
|
+
* Called when a window's `customContext` is updated. Responsible for raising the `host-context-updated` event on that window's child views.
|
|
116
|
+
* @param { WindowOptionsChangedEvent<'window', 'options-changed'> } payload The event payload for the window whose context has changed.
|
|
117
|
+
* The new context will be contained as `payload.diff.customContext.newVal`.
|
|
118
|
+
* @return { Promise<HostContextChangedPayload> } The event that it raised.
|
|
119
|
+
*/
|
|
120
|
+
onWindowContextUpdated(payload: WindowOptionsChangedEvent): Promise<OpenFin.HostContextChangedPayload | undefined>;
|
|
121
|
+
/**
|
|
122
|
+
* Closes a Window.
|
|
123
|
+
* By default it will fire any before unload handler set by a View in the Window.
|
|
124
|
+
* This can be disabled by setting skipBeforeUnload in the options object of the payload.
|
|
125
|
+
* This method is called by {@link Platform#closeWindow Platform.closeWindow}.
|
|
126
|
+
* @param {CloseWindowPayload} payload Object that contains the Window Identity and related options.
|
|
127
|
+
* @param {Identity} callerIdentity
|
|
128
|
+
* @returns {Promise<void>}
|
|
129
|
+
*/
|
|
130
|
+
closeWindow(payload: OpenFin.CloseWindowPayload, callerIdentity: OpenFin.Identity): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Gets all the Views attached to a Window that should close along with it. This is meant to be overridable
|
|
133
|
+
* in the case where you want to return other Views that may not be attached to the Window that is closing.
|
|
134
|
+
* @param winId Identity of the Window that is closing
|
|
135
|
+
* @returns { Promise<View> }
|
|
136
|
+
*/
|
|
137
|
+
getViewsForWindowClose(windowId: OpenFin.Identity): Promise<OpenFin.View[]>;
|
|
138
|
+
/**
|
|
139
|
+
* It takes in an array of Views and returns an object specifying which of them are trying to prevent an unload and which are not.
|
|
140
|
+
* @param {View[]} views Array of Views
|
|
141
|
+
* @returns { Promise<ViewStatuses> }
|
|
142
|
+
*/
|
|
143
|
+
checkViewsForPreventUnload(views: OpenFin.View[]): Promise<OpenFin.ViewStatuses>;
|
|
144
|
+
/**
|
|
145
|
+
* Handle the decision of whether a Window or specific View should close when trying to prevent an unload. This is meant to be overridden.
|
|
146
|
+
* Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
|
|
147
|
+
* Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload.
|
|
148
|
+
* By default it will always return all Views passed into it as meaning to close.
|
|
149
|
+
* @param {ViewsPreventingUnloadPayload} payload
|
|
150
|
+
* @tutorial PlatformProvider.getUserDecisionForBeforeUnload
|
|
151
|
+
* @returns {Promise<BeforeUnloadUserDecision>}
|
|
152
|
+
*/
|
|
153
|
+
getUserDecisionForBeforeUnload(payload: OpenFin.ViewsPreventingUnloadPayload): Promise<OpenFin.BeforeUnloadUserDecision>;
|
|
154
|
+
/**
|
|
155
|
+
* Handles the closing of a Window and/or its Views. Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
|
|
156
|
+
* The return of {@link PlatformProvider#getUserDecisionForBeforeUnload PlatformProvider.getUserDecisionForBeforeUnload} is passed into this method.
|
|
157
|
+
* @param {Identity} winId Identity of the Window
|
|
158
|
+
* @param {BeforeUnloadUserDecision} userDecision Decision object
|
|
159
|
+
* @returns {Promise<void>}
|
|
160
|
+
*/
|
|
161
|
+
handleViewsAndWindowClose(windowId: OpenFin.Identity, userDecision: OpenFin.BeforeUnloadUserDecision): Promise<void>;
|
|
162
|
+
}
|