@openfin/core 30.74.6 → 30.74.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/platform/layout/Factory.js +5 -3
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +2 -2
- package/src/api/platform/layout/controllers/layout-entities-controller.js +4 -5
- package/src/api/platform/layout/utils/layout-traversal.d.ts +1 -1
- package/src/api/platform/layout/utils/layout-traversal.js +8 -8
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
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");
|
|
11
11
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
12
|
};
|
|
13
|
-
var _LayoutModule_layoutManager;
|
|
13
|
+
var _LayoutModule_layoutManager, _LayoutModule_layoutInitializationAttempted;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.LayoutModule = void 0;
|
|
16
16
|
/* eslint-disable no-undef, import/prefer-default-export */
|
|
@@ -91,6 +91,7 @@ class LayoutModule extends base_1.Base {
|
|
|
91
91
|
constructor() {
|
|
92
92
|
super(...arguments);
|
|
93
93
|
_LayoutModule_layoutManager.set(this, void 0);
|
|
94
|
+
_LayoutModule_layoutInitializationAttempted.set(this, false);
|
|
94
95
|
/**
|
|
95
96
|
* Initialize the window's Layout. Must be called from a custom window that has a 'layout' option set upon creation of that window.
|
|
96
97
|
* If a containerId is not provided, this method attempts to find an element with the id `layout-container`.
|
|
@@ -109,9 +110,10 @@ class LayoutModule extends base_1.Base {
|
|
|
109
110
|
if (!this.fin.me.isWindow) {
|
|
110
111
|
throw new Error('Layout.init can only be called from a Window context.');
|
|
111
112
|
}
|
|
112
|
-
else if (__classPrivateFieldGet(this,
|
|
113
|
+
else if (__classPrivateFieldGet(this, _LayoutModule_layoutInitializationAttempted, "f")) {
|
|
113
114
|
throw new Error('Layout for this window already initialized, please use Layout.replace call to replace the layout.');
|
|
114
115
|
}
|
|
116
|
+
__classPrivateFieldSet(this, _LayoutModule_layoutInitializationAttempted, true, "f");
|
|
115
117
|
// We need to go through environment to make sure it is only imported/bundled in OpenFin.
|
|
116
118
|
const ManagerConstructor = await this.wire.environment.getManagerConstructor();
|
|
117
119
|
const viewOverlay = new view_overlay_1.ViewOverlay(this.wire);
|
|
@@ -203,4 +205,4 @@ class LayoutModule extends base_1.Base {
|
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
exports.LayoutModule = LayoutModule;
|
|
206
|
-
_LayoutModule_layoutManager = new WeakMap();
|
|
208
|
+
_LayoutModule_layoutManager = new WeakMap(), _LayoutModule_layoutInitializationAttempted = new WeakMap();
|
|
@@ -102,10 +102,10 @@ export declare class LayoutEntitiesController {
|
|
|
102
102
|
* Creates a new adjacent 'stack' and adds the views to it at the specified position
|
|
103
103
|
* @param targetId Entity id of the content item to add a stack adjacent to it
|
|
104
104
|
* @param views List of identities or view creation options of the views to include in the stack
|
|
105
|
-
* @param options Creation options, defaults to position: 'right'
|
|
105
|
+
* @param options Creation options, defaults to { position: 'right' }
|
|
106
106
|
* @returns the Entity Id of the new stack
|
|
107
107
|
*/
|
|
108
|
-
createAdjacentStack: (targetId: string, views: ViewCreationOrReference[],
|
|
108
|
+
createAdjacentStack: (targetId: string, views: ViewCreationOrReference[], { position }?: {
|
|
109
109
|
position?: OpenFin.LayoutPosition;
|
|
110
110
|
}) => Promise<string>;
|
|
111
111
|
getAdjacentStacks: ({ targetId, edge }: {
|
|
@@ -148,14 +148,13 @@ class LayoutEntitiesController {
|
|
|
148
148
|
* Creates a new adjacent 'stack' and adds the views to it at the specified position
|
|
149
149
|
* @param targetId Entity id of the content item to add a stack adjacent to it
|
|
150
150
|
* @param views List of identities or view creation options of the views to include in the stack
|
|
151
|
-
* @param options Creation options, defaults to position: 'right'
|
|
151
|
+
* @param options Creation options, defaults to { position: 'right' }
|
|
152
152
|
* @returns the Entity Id of the new stack
|
|
153
153
|
*/
|
|
154
|
-
this.createAdjacentStack = async (targetId, views,
|
|
155
|
-
if (views.length === 0) {
|
|
156
|
-
throw new Error('
|
|
154
|
+
this.createAdjacentStack = async (targetId, views, { position = 'right' } = {}) => {
|
|
155
|
+
if (!Array.isArray(views) || views.length === 0) {
|
|
156
|
+
throw new Error('The parameter "views" must be an array with at least 1 element.');
|
|
157
157
|
}
|
|
158
|
-
const { position = 'right' } = options;
|
|
159
158
|
if (!['top', 'bottom', 'left', 'right'].includes(position)) {
|
|
160
159
|
throw new Error(`Invalid position '${position}' specified.`);
|
|
161
160
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type * as OpenFin from '../../../../OpenFin';
|
|
2
2
|
export declare const getAdjacentItem: (component: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => GoldenLayout.ContentItem | undefined;
|
|
3
|
-
export declare const doShareEdge: (
|
|
3
|
+
export declare const doShareEdge: (from: GoldenLayout.ContentItem, to: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => boolean;
|
|
4
4
|
export declare const getAdjacentStacks: (item: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => GoldenLayout.ContentItem[];
|
|
@@ -18,19 +18,19 @@ const getAdjacentItem = (component, edge) => {
|
|
|
18
18
|
return (0, exports.getAdjacentItem)(parent, edge);
|
|
19
19
|
};
|
|
20
20
|
exports.getAdjacentItem = getAdjacentItem;
|
|
21
|
-
const doShareEdge = (
|
|
21
|
+
const doShareEdge = (from, to, edge) => {
|
|
22
22
|
var _a, _b;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
23
|
+
const boundsFrom = (_a = from.element.get(0)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
24
|
+
const boundsTo = (_b = to.element.get(0)) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
25
|
+
if (!boundsFrom || !boundsTo) {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
if (['top', 'bottom'].includes(edge)) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const horizontallyOutOfBounds = boundsFrom.right < boundsTo.left || boundsFrom.left > boundsTo.right;
|
|
30
|
+
return !horizontallyOutOfBounds;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const verticallyOutOfBounds = boundsFrom.bottom < boundsTo.top || boundsFrom.top > boundsTo.bottom;
|
|
33
|
+
return !verticallyOutOfBounds;
|
|
34
34
|
};
|
|
35
35
|
exports.doShareEdge = doShareEdge;
|
|
36
36
|
const getAdjacentStacks = (item, edge) => {
|