@openfin/core 33.76.31 → 33.76.38
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 +1 -1
- package/README.md +29 -4
- package/fin.d.ts +2 -2
- package/{src → out}/GlobalOpenFin.d.ts +1 -1
- package/out/mock-alpha.d.ts +16112 -0
- package/out/mock-beta.d.ts +16112 -0
- package/out/mock-public.d.ts +16112 -0
- package/out/mock.d.ts +16797 -0
- package/out/mock.js +17104 -0
- package/package.json +30 -23
- package/LICENSE +0 -13
- package/NOTICE +0 -16
- package/openfin-core-33.76.31.tgz +0 -0
- package/src/OpenFin.d.ts +0 -3080
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +0 -28
- package/src/api/api-exposer/api-consumer.js +0 -28
- package/src/api/api-exposer/api-exposer.d.ts +0 -35
- package/src/api/api-exposer/api-exposer.js +0 -38
- package/src/api/api-exposer/decorators.d.ts +0 -10
- package/src/api/api-exposer/decorators.js +0 -18
- package/src/api/api-exposer/index.d.ts +0 -4
- package/src/api/api-exposer/index.js +0 -20
- package/src/api/api-exposer/strategies/index.d.ts +0 -1
- package/src/api/api-exposer/strategies/index.js +0 -17
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
- package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
- package/src/api/application/Factory.d.ts +0 -148
- package/src/api/application/Factory.js +0 -230
- package/src/api/application/Instance.d.ts +0 -321
- package/src/api/application/Instance.js +0 -453
- package/src/api/application/index.d.ts +0 -3
- package/src/api/application/index.js +0 -19
- package/src/api/base.d.ts +0 -48
- package/src/api/base.js +0 -177
- package/src/api/clipboard/index.d.ts +0 -92
- package/src/api/clipboard/index.js +0 -120
- package/src/api/events/application.d.ts +0 -146
- package/src/api/events/application.js +0 -2
- package/src/api/events/base.d.ts +0 -42
- package/src/api/events/base.js +0 -2
- package/src/api/events/channel.d.ts +0 -30
- package/src/api/events/channel.js +0 -2
- package/src/api/events/emitterMap.d.ts +0 -11
- package/src/api/events/emitterMap.js +0 -35
- package/src/api/events/eventAggregator.d.ts +0 -5
- package/src/api/events/eventAggregator.js +0 -35
- package/src/api/events/externalApplication.d.ts +0 -19
- package/src/api/events/externalApplication.js +0 -2
- package/src/api/events/frame.d.ts +0 -30
- package/src/api/events/frame.js +0 -2
- package/src/api/events/globalHotkey.d.ts +0 -20
- package/src/api/events/globalHotkey.js +0 -2
- package/src/api/events/platform.d.ts +0 -26
- package/src/api/events/platform.js +0 -2
- package/src/api/events/system.d.ts +0 -113
- package/src/api/events/system.js +0 -2
- package/src/api/events/typedEventEmitter.d.ts +0 -20
- package/src/api/events/typedEventEmitter.js +0 -2
- package/src/api/events/view.d.ts +0 -82
- package/src/api/events/view.js +0 -2
- package/src/api/events/webcontents.d.ts +0 -266
- package/src/api/events/webcontents.js +0 -2
- package/src/api/events/window.d.ts +0 -352
- package/src/api/events/window.js +0 -2
- package/src/api/external-application/Factory.d.ts +0 -27
- package/src/api/external-application/Factory.js +0 -40
- package/src/api/external-application/Instance.d.ts +0 -102
- package/src/api/external-application/Instance.js +0 -109
- package/src/api/external-application/index.d.ts +0 -3
- package/src/api/external-application/index.js +0 -19
- package/src/api/fin.d.ts +0 -51
- package/src/api/fin.js +0 -42
- package/src/api/frame/Factory.d.ts +0 -37
- package/src/api/frame/Factory.js +0 -69
- package/src/api/frame/Instance.d.ts +0 -123
- package/src/api/frame/Instance.js +0 -130
- package/src/api/frame/index.d.ts +0 -3
- package/src/api/frame/index.js +0 -19
- package/src/api/global-hotkey/index.d.ts +0 -38
- package/src/api/global-hotkey/index.js +0 -64
- package/src/api/interappbus/channel/channel.d.ts +0 -28
- package/src/api/interappbus/channel/channel.js +0 -77
- package/src/api/interappbus/channel/channels-docs.d.ts +0 -340
- package/src/api/interappbus/channel/channels-docs.js +0 -398
- package/src/api/interappbus/channel/client.d.ts +0 -24
- package/src/api/interappbus/channel/client.js +0 -89
- package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
- package/src/api/interappbus/channel/connection-manager.js +0 -246
- package/src/api/interappbus/channel/index.d.ts +0 -25
- package/src/api/interappbus/channel/index.js +0 -169
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
- package/src/api/interappbus/channel/protocols/index.js +0 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
- package/src/api/interappbus/channel/protocols/strategy.js +0 -2
- package/src/api/interappbus/channel/provider.d.ts +0 -34
- package/src/api/interappbus/channel/provider.js +0 -166
- package/src/api/interappbus/index.d.ts +0 -85
- package/src/api/interappbus/index.js +0 -175
- package/src/api/interop/Factory.d.ts +0 -37
- package/src/api/interop/Factory.js +0 -76
- package/src/api/interop/InteropBroker.d.ts +0 -437
- package/src/api/interop/InteropBroker.js +0 -1085
- package/src/api/interop/InteropClient.d.ts +0 -278
- package/src/api/interop/InteropClient.js +0 -459
- package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
- package/src/api/interop/SessionContextGroupBroker.js +0 -108
- package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
- package/src/api/interop/SessionContextGroupClient.js +0 -86
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
- package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
- package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -208
- package/src/api/interop/fdc3/fdc3-1.2.js +0 -438
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -301
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -482
- package/src/api/interop/fdc3/fdc3.d.ts +0 -12
- package/src/api/interop/fdc3/fdc3.js +0 -35
- package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
- package/src/api/interop/fdc3/overrideCheck.js +0 -32
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
- package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
- package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
- package/src/api/interop/fdc3/utils.d.ts +0 -45
- package/src/api/interop/fdc3/utils.js +0 -239
- package/src/api/interop/fdc3/versions.d.ts +0 -1
- package/src/api/interop/fdc3/versions.js +0 -2
- package/src/api/interop/index.d.ts +0 -4
- package/src/api/interop/index.js +0 -20
- package/src/api/interop/utils.d.ts +0 -18
- package/src/api/interop/utils.js +0 -61
- package/src/api/me.d.ts +0 -40
- package/src/api/me.js +0 -134
- package/src/api/platform/Factory.d.ts +0 -115
- package/src/api/platform/Factory.js +0 -184
- package/src/api/platform/Instance.d.ts +0 -150
- package/src/api/platform/Instance.js +0 -332
- package/src/api/platform/common-utils.d.ts +0 -7
- package/src/api/platform/common-utils.js +0 -16
- package/src/api/platform/index.d.ts +0 -3
- package/src/api/platform/index.js +0 -19
- package/src/api/platform/layout/Factory.d.ts +0 -114
- package/src/api/platform/layout/Factory.js +0 -174
- package/src/api/platform/layout/Instance.d.ts +0 -57
- package/src/api/platform/layout/Instance.js +0 -126
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
- package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
- package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
- package/src/api/platform/layout/entities/layout-entities.d.ts +0 -235
- package/src/api/platform/layout/entities/layout-entities.js +0 -312
- package/src/api/platform/layout/entities/shapes.d.ts +0 -6
- package/src/api/platform/layout/entities/shapes.js +0 -2
- package/src/api/platform/layout/index.d.ts +0 -2
- package/src/api/platform/layout/index.js +0 -18
- package/src/api/platform/layout/layout.constants.d.ts +0 -1
- package/src/api/platform/layout/layout.constants.js +0 -4
- package/src/api/platform/layout/shapes.d.ts +0 -16
- package/src/api/platform/layout/shapes.js +0 -2
- package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
- package/src/api/platform/layout/utils/layout-traversal.js +0 -65
- package/src/api/platform/provider.d.ts +0 -163
- package/src/api/platform/provider.js +0 -2
- package/src/api/snapshot-source/Factory.d.ts +0 -38
- package/src/api/snapshot-source/Factory.js +0 -66
- package/src/api/snapshot-source/Instance.d.ts +0 -31
- package/src/api/snapshot-source/Instance.js +0 -132
- package/src/api/snapshot-source/index.d.ts +0 -3
- package/src/api/snapshot-source/index.js +0 -19
- package/src/api/snapshot-source/utils.d.ts +0 -2
- package/src/api/snapshot-source/utils.js +0 -6
- package/src/api/system/index.d.ts +0 -517
- package/src/api/system/index.js +0 -895
- package/src/api/view/Factory.d.ts +0 -50
- package/src/api/view/Factory.js +0 -103
- package/src/api/view/Instance.d.ts +0 -487
- package/src/api/view/Instance.js +0 -557
- package/src/api/view/index.d.ts +0 -3
- package/src/api/view/index.js +0 -19
- package/src/api/webcontents/main.d.ts +0 -32
- package/src/api/webcontents/main.js +0 -156
- package/src/api/window/Factory.d.ts +0 -45
- package/src/api/window/Factory.js +0 -91
- package/src/api/window/Instance.d.ts +0 -1090
- package/src/api/window/Instance.js +0 -1349
- package/src/api/window/index.d.ts +0 -3
- package/src/api/window/index.js +0 -19
- package/src/browser.d.ts +0 -10
- package/src/browser.js +0 -36
- package/src/environment/browser.d.ts +0 -29
- package/src/environment/browser.js +0 -60
- package/src/environment/environment.d.ts +0 -33
- package/src/environment/environment.js +0 -4
- package/src/environment/mockEnvironment.d.ts +0 -27
- package/src/environment/mockEnvironment.js +0 -61
- package/src/environment/node-env.d.ts +0 -29
- package/src/environment/node-env.js +0 -72
- package/src/fdc3.d.ts +0 -3
- package/src/fdc3.js +0 -9
- package/src/mock.d.ts +0 -3
- package/src/mock.js +0 -18
- package/src/namespaces.d.ts +0 -21
- package/src/namespaces.js +0 -24
- package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
- package/src/shapes/ERROR_BOX_TYPES.js +0 -2
- package/src/shapes/WebOptions.d.ts +0 -13
- package/src/shapes/WebOptions.js +0 -2
- package/src/shapes/WindowOptions.d.ts +0 -43
- package/src/shapes/WindowOptions.js +0 -2
- package/src/shapes/protocol.d.ts +0 -200
- package/src/shapes/protocol.js +0 -2
- package/src/transport/mockWire.d.ts +0 -11
- package/src/transport/mockWire.js +0 -26
- package/src/transport/transport-errors.d.ts +0 -31
- package/src/transport/transport-errors.js +0 -79
- package/src/transport/transport.d.ts +0 -73
- package/src/transport/transport.js +0 -219
- package/src/transport/wire.d.ts +0 -77
- package/src/transport/wire.js +0 -36
- package/src/util/asyncFilter.d.ts +0 -1
- package/src/util/asyncFilter.js +0 -7
- package/src/util/channel-api-relay.d.ts +0 -13
- package/src/util/channel-api-relay.js +0 -47
- package/src/util/errors.d.ts +0 -10
- package/src/util/errors.js +0 -12
- package/src/util/exhaustive.d.ts +0 -1
- package/src/util/exhaustive.js +0 -7
- package/src/util/http.d.ts +0 -11
- package/src/util/http.js +0 -90
- package/src/util/inaccessibleObject.d.ts +0 -2
- package/src/util/inaccessibleObject.js +0 -49
- package/src/util/lazy.d.ts +0 -34
- package/src/util/lazy.js +0 -54
- package/src/util/normalize-config.d.ts +0 -3
- package/src/util/normalize-config.js +0 -52
- package/src/util/promises.d.ts +0 -5
- package/src/util/promises.js +0 -27
- package/src/util/ref-counter.d.ts +0 -7
- package/src/util/ref-counter.js +0 -52
- package/src/util/reversible-map.d.ts +0 -11
- package/src/util/reversible-map.js +0 -49
- package/src/util/runtimeVersioning.d.ts +0 -3
- package/src/util/runtimeVersioning.js +0 -25
- package/src/util/utilTypes.d.ts +0 -8
- package/src/util/utilTypes.js +0 -2
- package/src/util/validate.d.ts +0 -3
- package/src/util/validate.js +0 -11
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../../OpenFin';
|
|
2
|
-
import { Transport } from '../../../transport/transport';
|
|
3
|
-
import { Base } from '../../base';
|
|
4
|
-
type Identity = OpenFin.Identity;
|
|
5
|
-
type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
6
|
-
type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
|
|
7
|
-
/**
|
|
8
|
-
* @lends Platform#Layout
|
|
9
|
-
*/
|
|
10
|
-
export declare class Layout extends Base {
|
|
11
|
-
#private;
|
|
12
|
-
init: (options?: InitLayoutOptions) => Promise<Layout>;
|
|
13
|
-
identity: Identity;
|
|
14
|
-
private platform;
|
|
15
|
-
wire: Transport;
|
|
16
|
-
constructor(identity: OpenFin.Identity, wire: Transport);
|
|
17
|
-
/**
|
|
18
|
-
* Returns the configuration of the window's layout. Returns the same information that is returned for all windows in getSnapshot.
|
|
19
|
-
* @return { Promise<LayoutConfig> }
|
|
20
|
-
* @tutorial Layout.getConfig
|
|
21
|
-
*/
|
|
22
|
-
getConfig(): Promise<any>;
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves the top level content item of the layout.
|
|
25
|
-
* @return {Promise<TabStack | ColumnOrRow>}
|
|
26
|
-
*/
|
|
27
|
-
getRootItem(): Promise<OpenFin.ColumnOrRow | OpenFin.TabStack>;
|
|
28
|
-
/**
|
|
29
|
-
* Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout
|
|
30
|
-
* will be destroyed.
|
|
31
|
-
* @param { LayoutConfig } layout New layout to implement in the target window.
|
|
32
|
-
* Please see explanation of a layout {@link https://developers.openfin.co/docs/platform-api#section-layout here}.
|
|
33
|
-
* @return { Promise<void> }
|
|
34
|
-
* @tutorial Layout.replace
|
|
35
|
-
*/
|
|
36
|
-
replace: (layout: OpenFin.LayoutOptions) => Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Replaces the specified view with a view with the provided configuration.
|
|
39
|
-
* The old view is stripped of its listeners and either closed or attached to the provider window
|
|
40
|
-
* depending on `detachOnClose` view option.
|
|
41
|
-
* @param { Identity } viewToReplace Identity of the view to be replaced
|
|
42
|
-
* @param { View~options } newView Creation options of the new view.
|
|
43
|
-
* @return { Promise<void> }
|
|
44
|
-
* @tutorial Layout.replaceView
|
|
45
|
-
*/
|
|
46
|
-
replaceView: (viewToReplace: Identity, newView: OpenFin.PlatformViewCreationOptions) => Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Replaces a Platform window's layout with a preset layout arrangement using the existing Views attached to the window.
|
|
49
|
-
* The preset options are `columns`, `grid`, `rows`, and `tabs`.
|
|
50
|
-
* @param { PresetLayoutOptions } options Mandatory object with `presetType` property that sets which preset layout arrangement to use.
|
|
51
|
-
* The preset options are `columns`, `grid`, `rows`, and `tabs`.
|
|
52
|
-
* @return { Promise<void> }
|
|
53
|
-
* @tutorial Layout.applyPreset
|
|
54
|
-
*/
|
|
55
|
-
applyPreset: (options: PresetLayoutOptions) => Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
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");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var _Layout_layoutClient;
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.Layout = void 0;
|
|
10
|
-
const lazy_1 = require("../../../util/lazy");
|
|
11
|
-
const validate_1 = require("../../../util/validate");
|
|
12
|
-
const base_1 = require("../../base");
|
|
13
|
-
const common_utils_1 = require("../common-utils");
|
|
14
|
-
const layout_entities_1 = require("./entities/layout-entities");
|
|
15
|
-
const layout_constants_1 = require("./layout.constants");
|
|
16
|
-
/**
|
|
17
|
-
* @lends Platform#Layout
|
|
18
|
-
*/
|
|
19
|
-
class Layout extends base_1.Base {
|
|
20
|
-
// eslint-disable-next-line no-shadow
|
|
21
|
-
constructor(identity, wire) {
|
|
22
|
-
super(wire);
|
|
23
|
-
/**
|
|
24
|
-
* @internal
|
|
25
|
-
* Lazily constructed {@link LayoutEntitiesClient} bound to this platform's client and identity
|
|
26
|
-
* The client is for {@link LayoutEntitiesController}
|
|
27
|
-
*/
|
|
28
|
-
_Layout_layoutClient.set(this, new lazy_1.Lazy(async () => layout_entities_1.LayoutNode.newLayoutEntitiesClient(await this.platform.getClient(), layout_constants_1.LAYOUT_CONTROLLER_ID, this.identity)));
|
|
29
|
-
/**
|
|
30
|
-
* Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout
|
|
31
|
-
* will be destroyed.
|
|
32
|
-
* @param { LayoutConfig } layout New layout to implement in the target window.
|
|
33
|
-
* Please see explanation of a layout {@link https://developers.openfin.co/docs/platform-api#section-layout here}.
|
|
34
|
-
* @return { Promise<void> }
|
|
35
|
-
* @tutorial Layout.replace
|
|
36
|
-
*/
|
|
37
|
-
this.replace = async (layout) => {
|
|
38
|
-
this.wire.sendAction('layout-replace').catch((e) => {
|
|
39
|
-
// don't expose
|
|
40
|
-
});
|
|
41
|
-
const client = await this.platform.getClient();
|
|
42
|
-
await client.dispatch('replace-layout', {
|
|
43
|
-
target: this.identity,
|
|
44
|
-
opts: { layout }
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Replaces the specified view with a view with the provided configuration.
|
|
49
|
-
* The old view is stripped of its listeners and either closed or attached to the provider window
|
|
50
|
-
* depending on `detachOnClose` view option.
|
|
51
|
-
* @param { Identity } viewToReplace Identity of the view to be replaced
|
|
52
|
-
* @param { View~options } newView Creation options of the new view.
|
|
53
|
-
* @return { Promise<void> }
|
|
54
|
-
* @tutorial Layout.replaceView
|
|
55
|
-
*/
|
|
56
|
-
this.replaceView = async (viewToReplace, newView) => {
|
|
57
|
-
this.wire.sendAction('layout-replace-view').catch((e) => {
|
|
58
|
-
// don't expose
|
|
59
|
-
});
|
|
60
|
-
const client = await this.platform.getClient();
|
|
61
|
-
await client.dispatch('replace-view', {
|
|
62
|
-
target: this.identity,
|
|
63
|
-
opts: { viewToReplace, newView }
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Replaces a Platform window's layout with a preset layout arrangement using the existing Views attached to the window.
|
|
68
|
-
* The preset options are `columns`, `grid`, `rows`, and `tabs`.
|
|
69
|
-
* @param { PresetLayoutOptions } options Mandatory object with `presetType` property that sets which preset layout arrangement to use.
|
|
70
|
-
* The preset options are `columns`, `grid`, `rows`, and `tabs`.
|
|
71
|
-
* @return { Promise<void> }
|
|
72
|
-
* @tutorial Layout.applyPreset
|
|
73
|
-
*/
|
|
74
|
-
this.applyPreset = async (options) => {
|
|
75
|
-
this.wire.sendAction('layout-apply-preset').catch((e) => {
|
|
76
|
-
// don't expose
|
|
77
|
-
});
|
|
78
|
-
const client = await this.platform.getClient();
|
|
79
|
-
const { presetType } = options;
|
|
80
|
-
if (!presetType || !(0, common_utils_1.isValidPresetType)(presetType)) {
|
|
81
|
-
throw new Error('Cannot apply preset layout, please include an applicable presetType property in the PresetLayoutOptions.');
|
|
82
|
-
}
|
|
83
|
-
await client.dispatch('apply-preset-layout', {
|
|
84
|
-
target: this.identity,
|
|
85
|
-
opts: { presetType }
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
const errorMsg = (0, validate_1.validateIdentity)(identity);
|
|
89
|
-
if (errorMsg) {
|
|
90
|
-
throw new Error(errorMsg);
|
|
91
|
-
}
|
|
92
|
-
this.identity = identity;
|
|
93
|
-
this.platform = this.fin.Platform.wrapSync({ uuid: identity.uuid });
|
|
94
|
-
if (identity.uuid === this.fin.me.uuid && identity.name === this.fin.me.name) {
|
|
95
|
-
this.init = this.fin.Platform.Layout.init;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Returns the configuration of the window's layout. Returns the same information that is returned for all windows in getSnapshot.
|
|
100
|
-
* @return { Promise<LayoutConfig> }
|
|
101
|
-
* @tutorial Layout.getConfig
|
|
102
|
-
*/
|
|
103
|
-
async getConfig() {
|
|
104
|
-
this.wire.sendAction('layout-get-config').catch((e) => {
|
|
105
|
-
// don't expose
|
|
106
|
-
});
|
|
107
|
-
const client = await this.platform.getClient();
|
|
108
|
-
return client.dispatch('get-frame-snapshot', {
|
|
109
|
-
target: this.identity
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Retrieves the top level content item of the layout.
|
|
114
|
-
* @return {Promise<TabStack | ColumnOrRow>}
|
|
115
|
-
*/
|
|
116
|
-
async getRootItem() {
|
|
117
|
-
this.wire.sendAction('layout-get-root-item').catch(() => {
|
|
118
|
-
// don't expose
|
|
119
|
-
});
|
|
120
|
-
const client = await __classPrivateFieldGet(this, _Layout_layoutClient, "f").getValue();
|
|
121
|
-
const root = await client.getRoot();
|
|
122
|
-
return layout_entities_1.LayoutNode.getEntity(root, client);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.Layout = Layout;
|
|
126
|
-
_Layout_layoutClient = new WeakMap();
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare class LayoutContentCache {
|
|
2
|
-
private contentItemCache;
|
|
3
|
-
private contentItemCacheId;
|
|
4
|
-
private createCacheKey;
|
|
5
|
-
hasKey: (id: string) => boolean;
|
|
6
|
-
getItemOrUndefined: (id: string) => GoldenLayout.ContentItem | undefined;
|
|
7
|
-
getContentItemOrThrow: (id: string, expectedType?: string[]) => GoldenLayout.ContentItem;
|
|
8
|
-
getOrCreateEntityId: (contentItem: GoldenLayout.ContentItem) => string;
|
|
9
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LayoutContentCache = void 0;
|
|
4
|
-
const reversible_map_1 = require("../../../../util/reversible-map");
|
|
5
|
-
class LayoutContentCache {
|
|
6
|
-
constructor() {
|
|
7
|
-
// ContentItems currently do not have a unique id, this helps us to lookup items by value
|
|
8
|
-
this.contentItemCache = new reversible_map_1.ReversibleMap();
|
|
9
|
-
this.contentItemCacheId = 0;
|
|
10
|
-
this.createCacheKey = () => {
|
|
11
|
-
const key = `entity-${this.contentItemCacheId.toString()}`;
|
|
12
|
-
this.contentItemCacheId += 1;
|
|
13
|
-
return key;
|
|
14
|
-
};
|
|
15
|
-
this.hasKey = (id) => {
|
|
16
|
-
return this.contentItemCache.hasKey(id);
|
|
17
|
-
};
|
|
18
|
-
this.getItemOrUndefined = (id) => {
|
|
19
|
-
try {
|
|
20
|
-
return this.getContentItemOrThrow(id);
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
this.getContentItemOrThrow = (id, expectedType) => {
|
|
27
|
-
if (!this.contentItemCache.hasKey(id)) {
|
|
28
|
-
throw new Error('Layout component has been destroyed or detached from the current layout.');
|
|
29
|
-
}
|
|
30
|
-
const contentItem = this.contentItemCache.getValue(id);
|
|
31
|
-
if (expectedType && !expectedType.includes(contentItem.type)) {
|
|
32
|
-
throw new Error(`Layout item is not the expected type. Expected ${expectedType.join(', ')}, got ${contentItem.type}.`);
|
|
33
|
-
}
|
|
34
|
-
return contentItem;
|
|
35
|
-
};
|
|
36
|
-
this.getOrCreateEntityId = (contentItem) => {
|
|
37
|
-
if (this.contentItemCache.hasValue(contentItem)) {
|
|
38
|
-
return this.contentItemCache.getKey(contentItem);
|
|
39
|
-
}
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
|
-
const onItemDestroyed = ({ origin, ...rest }) => {
|
|
42
|
-
if (origin === contentItem) {
|
|
43
|
-
this.contentItemCache.deleteValue(contentItem);
|
|
44
|
-
contentItem.unbind('itemDestroyed', onItemDestroyed);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
contentItem.on('itemDestroyed', onItemDestroyed);
|
|
48
|
-
const key = this.createCacheKey();
|
|
49
|
-
this.contentItemCache.setUnique(key, contentItem);
|
|
50
|
-
return key;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.LayoutContentCache = LayoutContentCache;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../../../OpenFin';
|
|
2
|
-
import type { LayoutContentCache } from './layout-content-cache';
|
|
3
|
-
type ViewCreationOrReference = OpenFin.Identity | OpenFin.PlatformViewCreationOptions;
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
* Controller for the layout entities apis, allowing alterations to be applied
|
|
7
|
-
* to an instance of layout manager in a structured manner.
|
|
8
|
-
*/
|
|
9
|
-
export declare class LayoutEntitiesController {
|
|
10
|
-
private layoutManager;
|
|
11
|
-
private layoutContentCache;
|
|
12
|
-
private wire;
|
|
13
|
-
constructor(layoutManager: any, layoutContentCache: LayoutContentCache);
|
|
14
|
-
private analytics;
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
* @returns the root contentItem of the layout.
|
|
18
|
-
*/
|
|
19
|
-
getRoot: () => OpenFin.LayoutEntityDefinition;
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
* Retrieves the containing stack of a given view identity.
|
|
23
|
-
* @param view Identity of the view to retrieve the stack of.
|
|
24
|
-
* @returns Stack containing the given view.
|
|
25
|
-
* @throws If the view does not belong to a stack within the layout manager.
|
|
26
|
-
*/
|
|
27
|
-
getStackByView: (view: OpenFin.Identity) => Promise<OpenFin.LayoutEntityDefinition | undefined>;
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
* Returns all views belonging to a given stack
|
|
31
|
-
*
|
|
32
|
-
* NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
|
|
33
|
-
* when the amount of new views to add overflows the width of the container. This results
|
|
34
|
-
* in tabs being re-ordered in the UI, while the underlying content item array remains in the
|
|
35
|
-
* original order specified. So calling getStackViews() will return this underlying array order,
|
|
36
|
-
* with indexes that will not match up to the render-order of the tabs.
|
|
37
|
-
*
|
|
38
|
-
* @param id - Entity id of the stack.
|
|
39
|
-
* @returns A list of view identities in order of appearance.
|
|
40
|
-
* @throws if the content item associated with the entity id does not exist or is not a stack.
|
|
41
|
-
*/
|
|
42
|
-
getStackViews: (id: string) => OpenFin.Identity[];
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
* Retrieves the content of a column or row and adds each to the
|
|
46
|
-
* entity cache to allow them to be addressed externally.
|
|
47
|
-
* @param id Entity id of the Column Or Row to retrieve the content of.
|
|
48
|
-
* @returns Array of layout entity definitions
|
|
49
|
-
* @throws if the entity associated with {@link id} is not in the entity cache, does not belogn to a layout, or is not a column/row.
|
|
50
|
-
*/
|
|
51
|
-
getContent(id: string): OpenFin.LayoutEntityDefinition[];
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
* Retrieves the parent content item of the given entity, and adds it to the entity cache
|
|
55
|
-
* so it can be addressed externally.
|
|
56
|
-
* @param id Entity id associated with a layout content item.
|
|
57
|
-
* @returns An entity definition for the given entity's parent, or undefined if the entity is the top level
|
|
58
|
-
* content item or has been removed from the layout entirely.
|
|
59
|
-
*/
|
|
60
|
-
getParent(id: string): OpenFin.LayoutEntityDefinition | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
* @param id Entity id associated with a layout content item.
|
|
64
|
-
* @returns true if the given entity is the root content item, false otherwise.
|
|
65
|
-
*/
|
|
66
|
-
isRoot: (id: string) => boolean;
|
|
67
|
-
/**
|
|
68
|
-
* @internal
|
|
69
|
-
* Checks whether the given entity exists.
|
|
70
|
-
* @param entityId Id of a content item within the layout
|
|
71
|
-
* @returns True if the content item exists and belongs to the layout.
|
|
72
|
-
*/
|
|
73
|
-
exists: (entityId: string) => boolean;
|
|
74
|
-
/**
|
|
75
|
-
* @internal
|
|
76
|
-
* Adds an existing view to the stack, or creates and adds a view to the given stack.
|
|
77
|
-
*
|
|
78
|
-
* NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
|
|
79
|
-
* when the amount of new views to add overflows the width of the container. This results
|
|
80
|
-
* in tabs being re-ordered in the UI, while the underlying content item array remains in the
|
|
81
|
-
* original order specified. So calling getStackViews() will return this underlying array order,
|
|
82
|
-
* with indexes that will not match up to the render-order of the tabs.
|
|
83
|
-
*
|
|
84
|
-
* @param stackEntityId Entity id of the stack content item within the layout.
|
|
85
|
-
* @param viewCreationOrReference View identity or creation options
|
|
86
|
-
* @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)
|
|
87
|
-
* @returns Promise resolving with the identity of the newly added view.
|
|
88
|
-
* @throws If the view does not exist, fails to create, or the stack does not exist.
|
|
89
|
-
*/
|
|
90
|
-
addViewToStack: (stackEntityId: string, viewCreationOrReference: ViewCreationOrReference, { index }?: OpenFin.AddViewToStackOptions) => Promise<OpenFin.Identity>;
|
|
91
|
-
private findViewInStack;
|
|
92
|
-
/**
|
|
93
|
-
* @internal
|
|
94
|
-
* Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
|
|
95
|
-
* option closeOnLastViewRemoved is set to false.
|
|
96
|
-
*
|
|
97
|
-
* @param stackEntityId Entity id of a stack content item to remove the view from.
|
|
98
|
-
* @param view Identity of the view to remove.
|
|
99
|
-
* @throws If the stack does not exist or the view does not exist or belong to the stack.
|
|
100
|
-
*/
|
|
101
|
-
removeViewFromStack: (stackEntityId: string, view: OpenFin.Identity) => Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* @internal
|
|
104
|
-
* Creates a new adjacent 'stack' and adds the views to it at the specified position
|
|
105
|
-
* @param targetId Entity id of the content item to add a stack adjacent to it
|
|
106
|
-
* @param views List of identities or view creation options of the views to include in the stack
|
|
107
|
-
* @param options Creation options, defaults to { position: 'right' }
|
|
108
|
-
* @returns the Entity Id of the new stack
|
|
109
|
-
*/
|
|
110
|
-
createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], { position }?: {
|
|
111
|
-
position?: OpenFin.LayoutPosition;
|
|
112
|
-
}) => Promise<string>;
|
|
113
|
-
getAdjacentStacks: ({ targetId, edge }: {
|
|
114
|
-
targetId: string;
|
|
115
|
-
edge: OpenFin.LayoutPosition;
|
|
116
|
-
}) => Promise<Pick<OpenFin.LayoutEntityDefinition, 'entityId'>[]>;
|
|
117
|
-
setStackActiveView: (stackEntityId: string, viewIdentity: OpenFin.Identity) => Promise<void>;
|
|
118
|
-
}
|
|
119
|
-
export {};
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.LayoutEntitiesController = void 0;
|
|
10
|
-
const decorators_1 = require("../../../api-exposer/decorators");
|
|
11
|
-
const layout_traversal_1 = require("../utils/layout-traversal");
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
* Controller for the layout entities apis, allowing alterations to be applied
|
|
15
|
-
* to an instance of layout manager in a structured manner.
|
|
16
|
-
*/
|
|
17
|
-
class LayoutEntitiesController {
|
|
18
|
-
constructor(
|
|
19
|
-
// workaround to prevent importing entire GoldenLayouts, also re-written at build time to type any
|
|
20
|
-
layoutManager, layoutContentCache) {
|
|
21
|
-
this.layoutManager = layoutManager;
|
|
22
|
-
this.layoutContentCache = layoutContentCache;
|
|
23
|
-
this.analytics = (topic) => {
|
|
24
|
-
this.wire.sendAction(`layout-controller-${topic}`).catch(() => {
|
|
25
|
-
// don't expose
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
* @returns the root contentItem of the layout.
|
|
31
|
-
*/
|
|
32
|
-
this.getRoot = () => {
|
|
33
|
-
this.analytics('get-root');
|
|
34
|
-
const root = this.layoutManager.layout.root.contentItems[0];
|
|
35
|
-
return {
|
|
36
|
-
// TODO: fix typing
|
|
37
|
-
type: root.type,
|
|
38
|
-
entityId: this.layoutContentCache.getOrCreateEntityId(root)
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* @internal
|
|
43
|
-
* Retrieves the containing stack of a given view identity.
|
|
44
|
-
* @param view Identity of the view to retrieve the stack of.
|
|
45
|
-
* @returns Stack containing the given view.
|
|
46
|
-
* @throws If the view does not belong to a stack within the layout manager.
|
|
47
|
-
*/
|
|
48
|
-
this.getStackByView = async (view) => {
|
|
49
|
-
var _a, _b, _c, _d;
|
|
50
|
-
this.analytics('get-stack-by-view');
|
|
51
|
-
const viewComponent = this.layoutManager.getViewComponent(view);
|
|
52
|
-
if (!viewComponent || ((_b = (_a = viewComponent.container) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent.type) !== 'stack') {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
const stack = (_d = (_c = viewComponent.container) === null || _c === void 0 ? void 0 : _c.parent) === null || _d === void 0 ? void 0 : _d.parent;
|
|
56
|
-
return { entityId: this.layoutContentCache.getOrCreateEntityId(stack), type: 'stack' };
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
* Returns all views belonging to a given stack
|
|
61
|
-
*
|
|
62
|
-
* NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
|
|
63
|
-
* when the amount of new views to add overflows the width of the container. This results
|
|
64
|
-
* in tabs being re-ordered in the UI, while the underlying content item array remains in the
|
|
65
|
-
* original order specified. So calling getStackViews() will return this underlying array order,
|
|
66
|
-
* with indexes that will not match up to the render-order of the tabs.
|
|
67
|
-
*
|
|
68
|
-
* @param id - Entity id of the stack.
|
|
69
|
-
* @returns A list of view identities in order of appearance.
|
|
70
|
-
* @throws if the content item associated with the entity id does not exist or is not a stack.
|
|
71
|
-
*/
|
|
72
|
-
this.getStackViews = (id) => {
|
|
73
|
-
this.analytics('get-stack-views');
|
|
74
|
-
const stack = this.layoutContentCache.getContentItemOrThrow(id, ['stack']);
|
|
75
|
-
const views = stack.contentItems.map((ci) => {
|
|
76
|
-
var _a;
|
|
77
|
-
return ({
|
|
78
|
-
name: (_a = ci.config.componentState) === null || _a === void 0 ? void 0 : _a.name,
|
|
79
|
-
uuid: this.layoutManager.ofWindow.identity.uuid
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
return views;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* @internal
|
|
86
|
-
* @param id Entity id associated with a layout content item.
|
|
87
|
-
* @returns true if the given entity is the root content item, false otherwise.
|
|
88
|
-
*/
|
|
89
|
-
this.isRoot = (id) => {
|
|
90
|
-
var _a;
|
|
91
|
-
this.analytics('is-root');
|
|
92
|
-
const ci = this.layoutContentCache.getContentItemOrThrow(id);
|
|
93
|
-
return !!((_a = ci.parent) === null || _a === void 0 ? void 0 : _a.isRoot);
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* @internal
|
|
97
|
-
* Checks whether the given entity exists.
|
|
98
|
-
* @param entityId Id of a content item within the layout
|
|
99
|
-
* @returns True if the content item exists and belongs to the layout.
|
|
100
|
-
*/
|
|
101
|
-
this.exists = (entityId) => {
|
|
102
|
-
this.analytics('exists');
|
|
103
|
-
return this.layoutContentCache.hasKey(entityId);
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* @internal
|
|
107
|
-
* Adds an existing view to the stack, or creates and adds a view to the given stack.
|
|
108
|
-
*
|
|
109
|
-
* NOTE: Due to (TODO: ticket) Golden Layouts has an issue which changes the order of tabs
|
|
110
|
-
* when the amount of new views to add overflows the width of the container. This results
|
|
111
|
-
* in tabs being re-ordered in the UI, while the underlying content item array remains in the
|
|
112
|
-
* original order specified. So calling getStackViews() will return this underlying array order,
|
|
113
|
-
* with indexes that will not match up to the render-order of the tabs.
|
|
114
|
-
*
|
|
115
|
-
* @param stackEntityId Entity id of the stack content item within the layout.
|
|
116
|
-
* @param viewCreationOrReference View identity or creation options
|
|
117
|
-
* @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)
|
|
118
|
-
* @returns Promise resolving with the identity of the newly added view.
|
|
119
|
-
* @throws If the view does not exist, fails to create, or the stack does not exist.
|
|
120
|
-
*/
|
|
121
|
-
this.addViewToStack = async (stackEntityId, viewCreationOrReference, { index } = { index: 0 }) => {
|
|
122
|
-
this.analytics('add-view-to-stack');
|
|
123
|
-
const currentStack = this.layoutContentCache.getContentItemOrThrow(stackEntityId);
|
|
124
|
-
if (index && index > currentStack.contentItems.length + 1) {
|
|
125
|
-
throw new Error(`Index '${index}' out of range, please exclude the index or specify a number between 0 and ${currentStack.contentItems.length}`);
|
|
126
|
-
}
|
|
127
|
-
const location = {
|
|
128
|
-
id: stackEntityId,
|
|
129
|
-
index
|
|
130
|
-
};
|
|
131
|
-
const { identity } = await this.layoutManager.platform.createView(viewCreationOrReference, {
|
|
132
|
-
...this.layoutManager.ofWindow.identity,
|
|
133
|
-
location,
|
|
134
|
-
});
|
|
135
|
-
return identity;
|
|
136
|
-
};
|
|
137
|
-
this.findViewInStack = (stack, viewIdentity) => {
|
|
138
|
-
return stack.contentItems.find((ci) => { var _a, _b; return ((_b = (_a = ci.config) === null || _a === void 0 ? void 0 : _a.componentState) === null || _b === void 0 ? void 0 : _b.name) === viewIdentity.name; });
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* @internal
|
|
142
|
-
* Removes a view from the given stack. If it's the only view, the stack will be destroyed, unless window creation
|
|
143
|
-
* option closeOnLastViewRemoved is set to false.
|
|
144
|
-
*
|
|
145
|
-
* @param stackEntityId Entity id of a stack content item to remove the view from.
|
|
146
|
-
* @param view Identity of the view to remove.
|
|
147
|
-
* @throws If the stack does not exist or the view does not exist or belong to the stack.
|
|
148
|
-
*/
|
|
149
|
-
this.removeViewFromStack = async (stackEntityId, view) => {
|
|
150
|
-
this.analytics('remove-view-from-stack');
|
|
151
|
-
const stack = this.layoutContentCache.getContentItemOrThrow(stackEntityId, ['stack']);
|
|
152
|
-
const viewInstance = this.findViewInStack(stack, view);
|
|
153
|
-
if (!viewInstance) {
|
|
154
|
-
throw new Error(`Tried to remove a view ('${view.name}') which does not belong to the stack.`);
|
|
155
|
-
}
|
|
156
|
-
await this.layoutManager.platform.closeView(view);
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* @internal
|
|
160
|
-
* Creates a new adjacent 'stack' and adds the views to it at the specified position
|
|
161
|
-
* @param targetId Entity id of the content item to add a stack adjacent to it
|
|
162
|
-
* @param views List of identities or view creation options of the views to include in the stack
|
|
163
|
-
* @param options Creation options, defaults to { position: 'right' }
|
|
164
|
-
* @returns the Entity Id of the new stack
|
|
165
|
-
*/
|
|
166
|
-
this.createAdjacentStack = async (targetId, views, { position = 'right' } = {}) => {
|
|
167
|
-
this.analytics('create-adjacent-stack');
|
|
168
|
-
if (!Array.isArray(views) || views.length === 0) {
|
|
169
|
-
throw new Error('The parameter "views" must be an array with at least 1 element.');
|
|
170
|
-
}
|
|
171
|
-
if (!['top', 'bottom', 'left', 'right'].includes(position)) {
|
|
172
|
-
throw new Error(`Invalid position '${position}' specified.`);
|
|
173
|
-
}
|
|
174
|
-
const currentStack = this.layoutContentCache.getContentItemOrThrow(targetId);
|
|
175
|
-
const { parent } = currentStack;
|
|
176
|
-
const containerType = ['top', 'bottom'].includes(position) ? 'column' : 'row';
|
|
177
|
-
const newContainer = this.layoutManager.layout.createContentItem({
|
|
178
|
-
type: containerType,
|
|
179
|
-
});
|
|
180
|
-
const newStack = this.layoutManager.layout.createContentItem({
|
|
181
|
-
type: 'stack'
|
|
182
|
-
});
|
|
183
|
-
parent.replaceChild(currentStack, newContainer);
|
|
184
|
-
newContainer.addChild(currentStack);
|
|
185
|
-
const offset = ['left', 'top'].includes(position) ? -1 : 1;
|
|
186
|
-
const newStackIndex = newContainer.contentItems.indexOf(currentStack) + offset;
|
|
187
|
-
newContainer.addChild(newStack, newStackIndex);
|
|
188
|
-
const entityId = this.layoutContentCache.getOrCreateEntityId(newStack);
|
|
189
|
-
// !! reverse the views list so we can utilize index=0 (prepending each tab)
|
|
190
|
-
// which will maintain correct order in the underlying GL structure and avoids the reflow bug
|
|
191
|
-
await Promise.all(views.reverse().map((view) => this.addViewToStack(entityId, view)));
|
|
192
|
-
return entityId;
|
|
193
|
-
};
|
|
194
|
-
this.getAdjacentStacks = async ({ targetId, edge }) => {
|
|
195
|
-
this.analytics('get-adjacent-stacks');
|
|
196
|
-
const contentItem = this.layoutContentCache.getContentItemOrThrow(targetId);
|
|
197
|
-
// call utils helper to traverse and return adjacent stacks
|
|
198
|
-
return (0, layout_traversal_1.getAdjacentStacks)(contentItem, edge).map((stack) => ({
|
|
199
|
-
entityId: this.layoutContentCache.getOrCreateEntityId(stack),
|
|
200
|
-
}));
|
|
201
|
-
};
|
|
202
|
-
this.setStackActiveView = async (stackEntityId, viewIdentity) => {
|
|
203
|
-
this.analytics('set-stack-active-view');
|
|
204
|
-
const stack = this.layoutContentCache.getContentItemOrThrow(stackEntityId, ['stack']);
|
|
205
|
-
const view = this.findViewInStack(stack, viewIdentity);
|
|
206
|
-
if (!view) {
|
|
207
|
-
throw new Error(`Tried to set a view ('${viewIdentity.name}') as active when it does not belong to the stack.`);
|
|
208
|
-
}
|
|
209
|
-
stack.setActiveContentItem(view, true);
|
|
210
|
-
};
|
|
211
|
-
this.wire = this.layoutManager.platform.wire;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* @internal
|
|
215
|
-
* Retrieves the content of a column or row and adds each to the
|
|
216
|
-
* entity cache to allow them to be addressed externally.
|
|
217
|
-
* @param id Entity id of the Column Or Row to retrieve the content of.
|
|
218
|
-
* @returns Array of layout entity definitions
|
|
219
|
-
* @throws if the entity associated with {@link id} is not in the entity cache, does not belogn to a layout, or is not a column/row.
|
|
220
|
-
*/
|
|
221
|
-
getContent(id) {
|
|
222
|
-
this.analytics('get-content');
|
|
223
|
-
const ci = this.layoutContentCache.getContentItemOrThrow(id, ['column', 'row']);
|
|
224
|
-
return ci.contentItems.map((item) => ({
|
|
225
|
-
type: item.type,
|
|
226
|
-
entityId: this.layoutContentCache.getOrCreateEntityId(item)
|
|
227
|
-
}));
|
|
228
|
-
}
|
|
229
|
-
;
|
|
230
|
-
/**
|
|
231
|
-
* @internal
|
|
232
|
-
* Retrieves the parent content item of the given entity, and adds it to the entity cache
|
|
233
|
-
* so it can be addressed externally.
|
|
234
|
-
* @param id Entity id associated with a layout content item.
|
|
235
|
-
* @returns An entity definition for the given entity's parent, or undefined if the entity is the top level
|
|
236
|
-
* content item or has been removed from the layout entirely.
|
|
237
|
-
*/
|
|
238
|
-
getParent(id) {
|
|
239
|
-
this.analytics('get-parent');
|
|
240
|
-
const ci = this.layoutContentCache.getContentItemOrThrow(id);
|
|
241
|
-
if (ci.parent && !ci.parent.isRoot && ci.parent.contentItems.includes(ci)) {
|
|
242
|
-
return {
|
|
243
|
-
type: ci.parent.type,
|
|
244
|
-
entityId: this.layoutContentCache.getOrCreateEntityId(ci.parent)
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
;
|
|
250
|
-
}
|
|
251
|
-
__decorate([
|
|
252
|
-
(0, decorators_1.expose)()
|
|
253
|
-
], LayoutEntitiesController.prototype, "getRoot", void 0);
|
|
254
|
-
__decorate([
|
|
255
|
-
(0, decorators_1.expose)()
|
|
256
|
-
], LayoutEntitiesController.prototype, "getStackByView", void 0);
|
|
257
|
-
__decorate([
|
|
258
|
-
(0, decorators_1.expose)()
|
|
259
|
-
], LayoutEntitiesController.prototype, "getStackViews", void 0);
|
|
260
|
-
__decorate([
|
|
261
|
-
(0, decorators_1.expose)()
|
|
262
|
-
], LayoutEntitiesController.prototype, "getContent", null);
|
|
263
|
-
__decorate([
|
|
264
|
-
(0, decorators_1.expose)()
|
|
265
|
-
], LayoutEntitiesController.prototype, "getParent", null);
|
|
266
|
-
__decorate([
|
|
267
|
-
(0, decorators_1.expose)()
|
|
268
|
-
], LayoutEntitiesController.prototype, "isRoot", void 0);
|
|
269
|
-
__decorate([
|
|
270
|
-
(0, decorators_1.expose)()
|
|
271
|
-
], LayoutEntitiesController.prototype, "exists", void 0);
|
|
272
|
-
__decorate([
|
|
273
|
-
(0, decorators_1.expose)()
|
|
274
|
-
], LayoutEntitiesController.prototype, "addViewToStack", void 0);
|
|
275
|
-
__decorate([
|
|
276
|
-
(0, decorators_1.expose)()
|
|
277
|
-
], LayoutEntitiesController.prototype, "removeViewFromStack", void 0);
|
|
278
|
-
__decorate([
|
|
279
|
-
(0, decorators_1.expose)()
|
|
280
|
-
], LayoutEntitiesController.prototype, "createAdjacentStack", void 0);
|
|
281
|
-
__decorate([
|
|
282
|
-
(0, decorators_1.expose)()
|
|
283
|
-
], LayoutEntitiesController.prototype, "getAdjacentStacks", void 0);
|
|
284
|
-
__decorate([
|
|
285
|
-
(0, decorators_1.expose)()
|
|
286
|
-
], LayoutEntitiesController.prototype, "setStackActiveView", void 0);
|
|
287
|
-
exports.LayoutEntitiesController = LayoutEntitiesController;
|