@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "30.74.6",
3
+ "version": "30.74.8",
4
4
  "license": "SEE LICENSE IN LICENSE.MD",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
@@ -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, _LayoutModule_layoutManager, "f")) {
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[], options: {
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, options) => {
155
- if (views.length === 0) {
156
- throw new Error('Cannot create stack with empty view array.');
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: (a: GoldenLayout.ContentItem, b: GoldenLayout.ContentItem, edge: OpenFin.LayoutPosition) => boolean;
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 = (a, b, edge) => {
21
+ const doShareEdge = (from, to, edge) => {
22
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) {
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
- return ((boundsB.left >= boundsA.left && boundsB.left < boundsA.right) ||
30
- (boundsB.right > boundsA.left && boundsB.right <= boundsA.right));
29
+ const horizontallyOutOfBounds = boundsFrom.right < boundsTo.left || boundsFrom.left > boundsTo.right;
30
+ return !horizontallyOutOfBounds;
31
31
  }
32
- return ((boundsB.top >= boundsA.top && boundsB.top < boundsA.bottom) ||
33
- (boundsB.bottom > boundsA.top && boundsB.bottom <= boundsA.bottom));
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) => {