@deephaven/golden-layout 0.22.3-beta.18 → 0.22.3-beta.21
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/dist/LayoutManager.js +60 -260
- package/dist/LayoutManager.js.map +1 -1
- package/dist/base.js.map +1 -1
- package/dist/config/Config.js.map +1 -1
- package/dist/config/ItemConfig.js.map +1 -1
- package/dist/container/ItemContainer.js +14 -50
- package/dist/container/ItemContainer.js.map +1 -1
- package/dist/container/index.js.map +1 -1
- package/dist/controls/BrowserPopout.js +17 -63
- package/dist/controls/BrowserPopout.js.map +1 -1
- package/dist/controls/DragProxy.js +13 -73
- package/dist/controls/DragProxy.js.map +1 -1
- package/dist/controls/DragSource.js +3 -19
- package/dist/controls/DragSource.js.map +1 -1
- package/dist/controls/DragSourceFromEvent.js +5 -24
- package/dist/controls/DragSourceFromEvent.js.map +1 -1
- package/dist/controls/DropTargetIndicator.js +0 -7
- package/dist/controls/DropTargetIndicator.js.map +1 -1
- package/dist/controls/Header.js +89 -233
- package/dist/controls/Header.js.map +1 -1
- package/dist/controls/HeaderButton.js +0 -9
- package/dist/controls/HeaderButton.js.map +1 -1
- package/dist/controls/Splitter.js +0 -14
- package/dist/controls/Splitter.js.map +1 -1
- package/dist/controls/Tab.js +21 -62
- package/dist/controls/Tab.js.map +1 -1
- package/dist/controls/TransitionIndicator.js +2 -21
- package/dist/controls/TransitionIndicator.js.map +1 -1
- package/dist/controls/index.js.map +1 -1
- package/dist/errors/ConfigurationError.js +0 -5
- package/dist/errors/ConfigurationError.js.map +1 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/items/AbstractContentItem.js +37 -133
- package/dist/items/AbstractContentItem.js.map +1 -1
- package/dist/items/Component.js +2 -27
- package/dist/items/Component.js.map +1 -1
- package/dist/items/Root.js +1 -26
- package/dist/items/Root.js.map +1 -1
- package/dist/items/RowOrColumn.js +32 -128
- package/dist/items/RowOrColumn.js.map +1 -1
- package/dist/items/Stack.js +27 -115
- package/dist/items/Stack.js.map +1 -1
- package/dist/items/index.js.map +1 -1
- package/dist/utils/BubblingEvent.js +0 -6
- package/dist/utils/BubblingEvent.js.map +1 -1
- package/dist/utils/ConfigMinifier.js +13 -26
- package/dist/utils/ConfigMinifier.js.map +1 -1
- package/dist/utils/DragListener.js +8 -47
- package/dist/utils/DragListener.js.map +1 -1
- package/dist/utils/EventEmitter.js +5 -25
- package/dist/utils/EventEmitter.js.map +1 -1
- package/dist/utils/EventHub.js +8 -27
- package/dist/utils/EventHub.js.map +1 -1
- package/dist/utils/ReactComponentHandler.js +6 -35
- package/dist/utils/ReactComponentHandler.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils.js +5 -11
- package/dist/utils/utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemContainer.js","names":["$","isGLComponentConfig","EventEmitter","ItemContainer","constructor","config","parent","layoutManager","join","title","componentName","_config","_contentElement","_element","find","getElement","hide","emit","isHidden","show","height","width","setSize","rowOrColumn","rowOrColumnChild","isColumn","isRow","isRoot","direction","newSize","totalPixel","percentage","delta","contentItems","length","i","callDownwards","close","isClosable","getState","componentState","extendState","state","setState","extend","emitBubblingEvent","setTitle","_$setSize","cl","hdelta","offsetWidth","clientWidth","vdelta","offsetHeight","clientHeight"],"sources":["../../src/container/ItemContainer.ts"],"sourcesContent":["import $ from 'jquery';\nimport {\n ReactComponentConfig,\n isGLComponentConfig,\n ComponentConfig,\n} from '../config';\nimport type Tab from '../controls/Tab';\nimport type { AbstractContentItem, Component } from '../items';\nimport type LayoutManager from '../LayoutManager';\nimport EventEmitter from '../utils/EventEmitter';\n\nexport default class ItemContainer<\n C extends ComponentConfig | ReactComponentConfig = ComponentConfig\n> extends EventEmitter {\n width?: number;\n height?: number;\n\n title?: string;\n\n parent: Component;\n\n layoutManager: LayoutManager;\n\n tab?: Tab;\n\n // This type is to make TS happy and allow ReactComponentConfig passed to container generic\n _config: C & { componentState: Record<string, unknown> };\n\n isHidden = false;\n\n _element = $(\n [\n '<div class=\"lm_item_container\">',\n '<div class=\"lm_content\" tabindex=\"-1\"></div>',\n '</div>',\n ].join('')\n );\n\n _contentElement: JQuery<HTMLElement>;\n\n constructor(config: C, parent: Component, layoutManager: LayoutManager) {\n super();\n\n this.title = isGLComponentConfig(config) ? config.componentName : '';\n this.parent = parent;\n this.layoutManager = layoutManager;\n\n this._config = config as C & { componentState: Record<string, unknown> };\n\n this._contentElement = this._element.find('.lm_content');\n }\n\n /**\n * Get the inner DOM element the container's content\n * is intended to live in\n */\n getElement() {\n return this._contentElement;\n }\n\n /**\n * Hide the container. Notifies the containers content first\n * and then hides the DOM node. If the container is already hidden\n * this should have no effect\n */\n hide() {\n this.emit('hide');\n this.isHidden = true;\n this._element.hide();\n }\n\n /**\n * Shows a previously hidden container. Notifies the\n * containers content first and then shows the DOM element.\n * If the container is already visible this has no effect.\n */\n show() {\n this.emit('show');\n this.isHidden = false;\n this._element.show();\n // call shown only if the container has a valid size\n if (this.height != 0 || this.width != 0) {\n this.emit('shown');\n }\n }\n\n /**\n * Set the size from within the container. Traverses up\n * the item tree until it finds a row or column element\n * and resizes its items accordingly.\n *\n * If this container isn't a descendant of a row or column\n * it returns false\n * @todo Rework!!!\n * @param width The new width in pixel\n * @param height The new height in pixel\n *\n * @returns resizeSuccesful\n */\n setSize(width: number, height: number) {\n let rowOrColumn: AbstractContentItem | null = this.parent;\n let rowOrColumnChild: AbstractContentItem | null = null;\n\n while (rowOrColumn && !rowOrColumn.isColumn && !rowOrColumn.isRow) {\n rowOrColumnChild = rowOrColumn;\n rowOrColumn = rowOrColumn.parent;\n\n /**\n * No row or column has been found\n */\n if (rowOrColumn?.isRoot) {\n return false;\n }\n }\n\n if (!rowOrColumn || !rowOrColumnChild) {\n return false;\n }\n\n const direction = rowOrColumn.isColumn ? 'height' : 'width';\n const newSize = direction === 'height' ? height : width;\n\n const totalPixel =\n (this[direction] ?? 0) *\n (1 / ((rowOrColumnChild.config[direction] ?? 0) / 100));\n const percentage = (newSize / totalPixel) * 100;\n const delta =\n ((rowOrColumnChild.config[direction] ?? 0) - percentage) /\n (rowOrColumn.contentItems.length - 1);\n\n for (let i = 0; i < rowOrColumn.contentItems.length; i++) {\n if (rowOrColumn.contentItems[i] === rowOrColumnChild) {\n rowOrColumn.contentItems[i].config[direction] = percentage;\n } else {\n rowOrColumn.contentItems[i].config[direction] =\n (rowOrColumn.contentItems[i].config[direction] ?? 0) + delta;\n }\n }\n\n rowOrColumn.callDownwards('setSize');\n\n return true;\n }\n\n /**\n * Closes the container if it is closable. Can be called by\n * both the component within at as well as the contentItem containing\n * it. Emits a close event before the container itself is closed.\n */\n close() {\n if (this._config.isClosable) {\n this.emit('close');\n this.parent.close();\n }\n }\n\n /**\n * Returns the current state object\n *\n * @returns state\n */\n getState() {\n return this._config.componentState;\n }\n\n /**\n * Merges the provided state into the current one\n *\n * @param state\n */\n extendState(state: string) {\n this.setState($.extend(true, this.getState(), state));\n }\n\n /**\n * Notifies the layout manager of a stateupdate\n *\n * @param state\n */\n setState(state: Record<string, unknown>) {\n this._config.componentState = state;\n this.parent.emitBubblingEvent('stateChanged');\n }\n\n /**\n * Set's the components title\n *\n * @param title\n */\n setTitle(title: string) {\n this.parent.setTitle(title);\n }\n\n /**\n * Set's the containers size. Called by the container's component.\n * To set the size programmatically from within the container please\n * use the public setSize method\n *\n * @param width in px\n * @param height in px\n */\n _$setSize(width = 0, height = 0) {\n if (width !== this.width || height !== this.height) {\n this.width = width;\n this.height = height;\n var cl = this._contentElement[0];\n var hdelta = cl.offsetWidth - cl.clientWidth;\n var vdelta = cl.offsetHeight - cl.clientHeight;\n this._contentElement\n .width(this.width - hdelta)\n .height(this.height - vdelta);\n this.emit('resize');\n }\n }\n}\n"],"mappings":";;AAAA,OAAOA,CAAP,MAAc,QAAd;SAGEC,mB;OAMKC,Y;AAEP,eAAe,MAAMC,aAAN,S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AI4B,EAAE,GAAG,KAAKpC,eAAL,CAAqB,CAArB,CAAT;MACA,IAAIqC,MAAM,GAAGD,EAAE,CAACE,WAAH,GAAiBF,EAAE,CAACG,WAAjC;MACA,IAAIC,MAAM,GAAGJ,EAAE,CAACK,YAAH,GAAkBL,EAAE,CAACM,YAAlC;;MACA,KAAK1C,eAAL,CACGS,KADH,CACS,KAAKA,KAAL,GAAa4B,MADtB,EAEG7B,MAFH,CAEU,KAAKA,MAAL,GAAcgC,MAFxB;;MAGA,KAAKnC,IAAL,CAAU,QAAV;IACD;EACF;;AAxMoB"}
|
|
1
|
+
{"version":3,"file":"ItemContainer.js","names":["$","isGLComponentConfig","EventEmitter","ItemContainer","constructor","config","parent","layoutManager","join","title","componentName","_config","_contentElement","_element","find","getElement","hide","emit","isHidden","show","height","width","setSize","rowOrColumn","rowOrColumnChild","isColumn","isRow","isRoot","direction","newSize","totalPixel","percentage","delta","contentItems","length","i","callDownwards","close","isClosable","getState","componentState","extendState","state","setState","extend","emitBubblingEvent","setTitle","_$setSize","cl","hdelta","offsetWidth","clientWidth","vdelta","offsetHeight","clientHeight"],"sources":["../../src/container/ItemContainer.ts"],"sourcesContent":["import $ from 'jquery';\nimport {\n ReactComponentConfig,\n isGLComponentConfig,\n ComponentConfig,\n} from '../config';\nimport type Tab from '../controls/Tab';\nimport type { AbstractContentItem, Component } from '../items';\nimport type LayoutManager from '../LayoutManager';\nimport EventEmitter from '../utils/EventEmitter';\n\nexport default class ItemContainer<\n C extends ComponentConfig | ReactComponentConfig = ComponentConfig\n> extends EventEmitter {\n width?: number;\n height?: number;\n\n title?: string;\n\n parent: Component;\n\n layoutManager: LayoutManager;\n\n tab?: Tab;\n\n // This type is to make TS happy and allow ReactComponentConfig passed to container generic\n _config: C & { componentState: Record<string, unknown> };\n\n isHidden = false;\n\n _element = $(\n [\n '<div class=\"lm_item_container\">',\n '<div class=\"lm_content\" tabindex=\"-1\"></div>',\n '</div>',\n ].join('')\n );\n\n _contentElement: JQuery<HTMLElement>;\n\n constructor(config: C, parent: Component, layoutManager: LayoutManager) {\n super();\n\n this.title = isGLComponentConfig(config) ? config.componentName : '';\n this.parent = parent;\n this.layoutManager = layoutManager;\n\n this._config = config as C & { componentState: Record<string, unknown> };\n\n this._contentElement = this._element.find('.lm_content');\n }\n\n /**\n * Get the inner DOM element the container's content\n * is intended to live in\n */\n getElement() {\n return this._contentElement;\n }\n\n /**\n * Hide the container. Notifies the containers content first\n * and then hides the DOM node. If the container is already hidden\n * this should have no effect\n */\n hide() {\n this.emit('hide');\n this.isHidden = true;\n this._element.hide();\n }\n\n /**\n * Shows a previously hidden container. Notifies the\n * containers content first and then shows the DOM element.\n * If the container is already visible this has no effect.\n */\n show() {\n this.emit('show');\n this.isHidden = false;\n this._element.show();\n // call shown only if the container has a valid size\n if (this.height != 0 || this.width != 0) {\n this.emit('shown');\n }\n }\n\n /**\n * Set the size from within the container. Traverses up\n * the item tree until it finds a row or column element\n * and resizes its items accordingly.\n *\n * If this container isn't a descendant of a row or column\n * it returns false\n * @todo Rework!!!\n * @param width The new width in pixel\n * @param height The new height in pixel\n *\n * @returns resizeSuccesful\n */\n setSize(width: number, height: number) {\n let rowOrColumn: AbstractContentItem | null = this.parent;\n let rowOrColumnChild: AbstractContentItem | null = null;\n\n while (rowOrColumn && !rowOrColumn.isColumn && !rowOrColumn.isRow) {\n rowOrColumnChild = rowOrColumn;\n rowOrColumn = rowOrColumn.parent;\n\n /**\n * No row or column has been found\n */\n if (rowOrColumn?.isRoot) {\n return false;\n }\n }\n\n if (!rowOrColumn || !rowOrColumnChild) {\n return false;\n }\n\n const direction = rowOrColumn.isColumn ? 'height' : 'width';\n const newSize = direction === 'height' ? height : width;\n\n const totalPixel =\n (this[direction] ?? 0) *\n (1 / ((rowOrColumnChild.config[direction] ?? 0) / 100));\n const percentage = (newSize / totalPixel) * 100;\n const delta =\n ((rowOrColumnChild.config[direction] ?? 0) - percentage) /\n (rowOrColumn.contentItems.length - 1);\n\n for (let i = 0; i < rowOrColumn.contentItems.length; i++) {\n if (rowOrColumn.contentItems[i] === rowOrColumnChild) {\n rowOrColumn.contentItems[i].config[direction] = percentage;\n } else {\n rowOrColumn.contentItems[i].config[direction] =\n (rowOrColumn.contentItems[i].config[direction] ?? 0) + delta;\n }\n }\n\n rowOrColumn.callDownwards('setSize');\n\n return true;\n }\n\n /**\n * Closes the container if it is closable. Can be called by\n * both the component within at as well as the contentItem containing\n * it. Emits a close event before the container itself is closed.\n */\n close() {\n if (this._config.isClosable) {\n this.emit('close');\n this.parent.close();\n }\n }\n\n /**\n * Returns the current state object\n *\n * @returns state\n */\n getState() {\n return this._config.componentState;\n }\n\n /**\n * Merges the provided state into the current one\n *\n * @param state\n */\n extendState(state: string) {\n this.setState($.extend(true, this.getState(), state));\n }\n\n /**\n * Notifies the layout manager of a stateupdate\n *\n * @param state\n */\n setState(state: Record<string, unknown>) {\n this._config.componentState = state;\n this.parent.emitBubblingEvent('stateChanged');\n }\n\n /**\n * Set's the components title\n *\n * @param title\n */\n setTitle(title: string) {\n this.parent.setTitle(title);\n }\n\n /**\n * Set's the containers size. Called by the container's component.\n * To set the size programmatically from within the container please\n * use the public setSize method\n *\n * @param width in px\n * @param height in px\n */\n _$setSize(width = 0, height = 0) {\n if (width !== this.width || height !== this.height) {\n this.width = width;\n this.height = height;\n var cl = this._contentElement[0];\n var hdelta = cl.offsetWidth - cl.clientWidth;\n var vdelta = cl.offsetHeight - cl.clientHeight;\n this._contentElement\n .width(this.width - hdelta)\n .height(this.height - vdelta);\n this.emit('resize');\n }\n }\n}\n"],"mappings":";AAAA,OAAOA,CAAC,MAAM,QAAQ;AAAC,SAGrBC,mBAAmB;AAAA,OAMdC,YAAY;AAEnB,eAAe,MAAMC,aAAa,SAExBD,YAAY,CAAC;EAYrB;;EAeAE,WAAW,CAACC,MAAS,EAAEC,MAAiB,EAAEC,aAA4B,EAAE;IACtE,KAAK,EAAE;IAAC;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IA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EAAE,GAAG,IAAI,CAACpC,eAAe,CAAC,CAAC,CAAC;MAChC,IAAIqC,MAAM,GAAGD,EAAE,CAACE,WAAW,GAAGF,EAAE,CAACG,WAAW;MAC5C,IAAIC,MAAM,GAAGJ,EAAE,CAACK,YAAY,GAAGL,EAAE,CAACM,YAAY;MAC9C,IAAI,CAAC1C,eAAe,CACjBS,KAAK,CAAC,IAAI,CAACA,KAAK,GAAG4B,MAAM,CAAC,CAC1B7B,MAAM,CAAC,IAAI,CAACA,MAAM,GAAGgC,MAAM,CAAC;MAC/B,IAAI,CAACnC,IAAI,CAAC,QAAQ,CAAC;IACrB;EACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","ItemContainer","Container"],"sources":["../../src/container/index.ts"],"sourcesContent":["export { default as ItemContainer } from './ItemContainer';\nexport { default as Container } from './ItemContainer';\n"],"mappings":"SAASA,OAAO,IAAIC,
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","ItemContainer","Container"],"sources":["../../src/container/index.ts"],"sourcesContent":["export { default as ItemContainer } from './ItemContainer';\nexport { default as Container } from './ItemContainer';\n"],"mappings":"SAASA,OAAO,IAAIC,aAAa;AAAA,SACxBD,OAAO,IAAIE,SAAS"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
2
|
import $ from 'jquery';
|
|
4
3
|
import { getUniqueId, minifyConfig, EventEmitter } from "../utils/index.js";
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
5
|
* Pops a content item out into a new browser window.
|
|
8
6
|
* This is achieved by
|
|
@@ -22,39 +20,26 @@ import { getUniqueId, minifyConfig, EventEmitter } from "../utils/index.js";
|
|
|
22
20
|
export default class BrowserPopout extends EventEmitter {
|
|
23
21
|
constructor(config, dimensions, parentId, indexInParent, layoutManager) {
|
|
24
22
|
super();
|
|
25
|
-
|
|
26
23
|
_defineProperty(this, "isInitialised", false);
|
|
27
|
-
|
|
28
24
|
_defineProperty(this, "_config", void 0);
|
|
29
|
-
|
|
30
25
|
_defineProperty(this, "_dimensions", void 0);
|
|
31
|
-
|
|
32
26
|
_defineProperty(this, "_parentId", void 0);
|
|
33
|
-
|
|
34
27
|
_defineProperty(this, "_indexInParent", void 0);
|
|
35
|
-
|
|
36
28
|
_defineProperty(this, "_layoutManager", void 0);
|
|
37
|
-
|
|
38
29
|
_defineProperty(this, "_popoutWindow", null);
|
|
39
|
-
|
|
40
30
|
_defineProperty(this, "_id", null);
|
|
41
|
-
|
|
42
31
|
this._config = config;
|
|
43
32
|
this._dimensions = dimensions;
|
|
44
33
|
this._parentId = parentId;
|
|
45
34
|
this._indexInParent = indexInParent;
|
|
46
35
|
this._layoutManager = layoutManager;
|
|
47
|
-
|
|
48
36
|
this._createWindow();
|
|
49
37
|
}
|
|
50
|
-
|
|
51
38
|
toConfig() {
|
|
52
39
|
var _this$getGlInstance, _this$getGlInstance2, _ref, _this$_popoutWindow$s, _this$_popoutWindow, _this$_popoutWindow2, _ref2, _this$_popoutWindow$s2, _this$_popoutWindow3, _this$_popoutWindow4, _this$getGlInstance3;
|
|
53
|
-
|
|
54
40
|
if (this.isInitialised === false) {
|
|
55
41
|
throw new Error("Can't create config, layout not yet initialised");
|
|
56
42
|
}
|
|
57
|
-
|
|
58
43
|
return {
|
|
59
44
|
dimensions: {
|
|
60
45
|
width: (_this$getGlInstance = this.getGlInstance()) === null || _this$getGlInstance === void 0 ? void 0 : _this$getGlInstance.width,
|
|
@@ -67,46 +52,36 @@ export default class BrowserPopout extends EventEmitter {
|
|
|
67
52
|
indexInParent: this._indexInParent
|
|
68
53
|
};
|
|
69
54
|
}
|
|
70
|
-
|
|
71
55
|
getGlInstance() {
|
|
72
56
|
var _this$_popoutWindow5;
|
|
73
|
-
|
|
74
57
|
return (_this$_popoutWindow5 = this._popoutWindow) === null || _this$_popoutWindow5 === void 0 ? void 0 : _this$_popoutWindow5.__glInstance;
|
|
75
58
|
}
|
|
76
|
-
|
|
77
59
|
getWindow() {
|
|
78
60
|
return this._popoutWindow;
|
|
79
61
|
}
|
|
80
|
-
|
|
81
62
|
close() {
|
|
82
63
|
if (this.getGlInstance()) {
|
|
83
64
|
var _this$getGlInstance4;
|
|
84
|
-
|
|
85
65
|
(_this$getGlInstance4 = this.getGlInstance()) === null || _this$getGlInstance4 === void 0 ? void 0 : _this$getGlInstance4._$closeWindow();
|
|
86
66
|
} else {
|
|
87
67
|
try {
|
|
88
68
|
var _this$getWindow;
|
|
89
|
-
|
|
90
69
|
(_this$getWindow = this.getWindow()) === null || _this$getWindow === void 0 ? void 0 : _this$getWindow.close();
|
|
91
70
|
} catch (e) {}
|
|
92
71
|
}
|
|
93
72
|
}
|
|
73
|
+
|
|
94
74
|
/**
|
|
95
75
|
* Returns the popped out item to its original position. If the original
|
|
96
76
|
* parent isn't available anymore it falls back to the layout's topmost element
|
|
97
77
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
78
|
popIn() {
|
|
101
79
|
var _parentItem;
|
|
102
|
-
|
|
103
80
|
var index = this._indexInParent;
|
|
104
81
|
var childConfig = null;
|
|
105
82
|
var parentItem = null;
|
|
106
|
-
|
|
107
83
|
if (this._parentId) {
|
|
108
84
|
var _this$getGlInstance5;
|
|
109
|
-
|
|
110
85
|
/*
|
|
111
86
|
* The $.extend call seems a bit pointless, but it's crucial to
|
|
112
87
|
* copy the config returned by this.getGlInstance().toConfig()
|
|
@@ -118,37 +93,32 @@ export default class BrowserPopout extends EventEmitter {
|
|
|
118
93
|
*/
|
|
119
94
|
childConfig = $.extend(true, {}, (_this$getGlInstance5 = this.getGlInstance()) === null || _this$getGlInstance5 === void 0 ? void 0 : _this$getGlInstance5.toConfig()).content[0];
|
|
120
95
|
parentItem = this._layoutManager.root.getItemsById(this._parentId)[0];
|
|
96
|
+
|
|
121
97
|
/*
|
|
122
98
|
* Fallback if parentItem is not available. Either add it to the topmost
|
|
123
99
|
* item or make it the topmost item if the layout is empty
|
|
124
100
|
*/
|
|
125
|
-
|
|
126
101
|
if (!parentItem) {
|
|
127
102
|
var _this$_layoutManager$;
|
|
128
|
-
|
|
129
103
|
if (((_this$_layoutManager$ = this._layoutManager.root.contentItems.length) !== null && _this$_layoutManager$ !== void 0 ? _this$_layoutManager$ : 0) > 0) {
|
|
130
104
|
parentItem = this._layoutManager.root.contentItems[0];
|
|
131
105
|
} else {
|
|
132
106
|
parentItem = this._layoutManager.root;
|
|
133
107
|
}
|
|
134
|
-
|
|
135
108
|
index = 0;
|
|
136
109
|
}
|
|
137
110
|
}
|
|
138
|
-
|
|
139
111
|
if (!childConfig) {
|
|
140
112
|
return;
|
|
141
113
|
}
|
|
142
|
-
|
|
143
114
|
(_parentItem = parentItem) === null || _parentItem === void 0 ? void 0 : _parentItem.addChild(childConfig, this._indexInParent);
|
|
144
115
|
this.close();
|
|
145
116
|
}
|
|
117
|
+
|
|
146
118
|
/**
|
|
147
119
|
* Creates the URL and window parameter
|
|
148
120
|
* and opens a new window
|
|
149
121
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
122
|
_createWindow() {
|
|
153
123
|
var url = this._createUrl();
|
|
154
124
|
/**
|
|
@@ -156,13 +126,10 @@ export default class BrowserPopout extends EventEmitter {
|
|
|
156
126
|
* same title. The actual title will be set by the new window's
|
|
157
127
|
* GoldenLayout instance if it detects that it is in subWindowMode
|
|
158
128
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
129
|
var title = Math.floor(Math.random() * 1000000).toString(36);
|
|
162
130
|
/**
|
|
163
131
|
* The options as used in the window.open string
|
|
164
132
|
*/
|
|
165
|
-
|
|
166
133
|
var options = this._serializeWindowOptions({
|
|
167
134
|
width: this._dimensions.width,
|
|
168
135
|
height: this._dimensions.height,
|
|
@@ -175,11 +142,10 @@ export default class BrowserPopout extends EventEmitter {
|
|
|
175
142
|
resizable: 'yes',
|
|
176
143
|
scrollbars: 'no',
|
|
177
144
|
status: 'no'
|
|
178
|
-
});
|
|
179
|
-
|
|
145
|
+
});
|
|
180
146
|
|
|
147
|
+
// I'm not entirely sure how __glInstance is mounted to the popout window
|
|
181
148
|
this._popoutWindow = window.open(url, title, options);
|
|
182
|
-
|
|
183
149
|
if (!this._popoutWindow) {
|
|
184
150
|
if (this._layoutManager.config.settings.blockedPopoutsThrowError === true) {
|
|
185
151
|
var error = new Error('Popout blocked');
|
|
@@ -189,25 +155,23 @@ export default class BrowserPopout extends EventEmitter {
|
|
|
189
155
|
return;
|
|
190
156
|
}
|
|
191
157
|
}
|
|
192
|
-
|
|
193
158
|
$(this._popoutWindow).on('load', this._positionWindow.bind(this)).on('unload beforeunload', this._onClose.bind(this));
|
|
159
|
+
|
|
194
160
|
/**
|
|
195
161
|
* Polling the childwindow to find out if GoldenLayout has been initialised
|
|
196
162
|
* doesn't seem optimal, but the alternatives - adding a callback to the parent
|
|
197
163
|
* window or raising an event on the window object - both would introduce knowledge
|
|
198
164
|
* about the parent to the child window which we'd rather avoid
|
|
199
165
|
*/
|
|
200
|
-
|
|
201
166
|
var checkReadyInterval = window.setInterval(() => {
|
|
202
167
|
var _this$_popoutWindow6;
|
|
203
|
-
|
|
204
168
|
if ((_this$_popoutWindow6 = this._popoutWindow) !== null && _this$_popoutWindow6 !== void 0 && _this$_popoutWindow6.__glInstance && this._popoutWindow.__glInstance.isInitialised) {
|
|
205
169
|
this._onInitialised();
|
|
206
|
-
|
|
207
170
|
window.clearInterval(checkReadyInterval);
|
|
208
171
|
}
|
|
209
172
|
}, 10);
|
|
210
173
|
}
|
|
174
|
+
|
|
211
175
|
/**
|
|
212
176
|
* Serialises a map of key:values to a window options string
|
|
213
177
|
*
|
|
@@ -215,80 +179,70 @@ export default class BrowserPopout extends EventEmitter {
|
|
|
215
179
|
*
|
|
216
180
|
* @returns serialised window options
|
|
217
181
|
*/
|
|
218
|
-
|
|
219
|
-
|
|
220
182
|
_serializeWindowOptions(windowOptions) {
|
|
221
183
|
var windowOptionsString = [],
|
|
222
|
-
|
|
223
|
-
|
|
184
|
+
key;
|
|
224
185
|
for (key in windowOptions) {
|
|
225
186
|
windowOptionsString.push(key + '=' + windowOptions[key]);
|
|
226
187
|
}
|
|
227
|
-
|
|
228
188
|
return windowOptionsString.join(',');
|
|
229
189
|
}
|
|
190
|
+
|
|
230
191
|
/**
|
|
231
192
|
* Creates the URL for the new window, including the
|
|
232
193
|
* config GET parameter
|
|
233
194
|
*
|
|
234
195
|
* @returns URL
|
|
235
196
|
*/
|
|
236
|
-
|
|
237
|
-
|
|
238
197
|
_createUrl() {
|
|
239
198
|
var config = {
|
|
240
199
|
content: this._config
|
|
241
200
|
};
|
|
242
201
|
var storageKey = 'gl-window-config-' + getUniqueId();
|
|
243
202
|
config = minifyConfig(config);
|
|
244
|
-
|
|
245
203
|
try {
|
|
246
204
|
localStorage.setItem(storageKey, JSON.stringify(config));
|
|
247
205
|
} catch (e) {
|
|
248
206
|
throw new Error('Error while writing to localStorage ' + e.toString());
|
|
249
207
|
}
|
|
208
|
+
var urlParts = document.location.href.split('?');
|
|
250
209
|
|
|
251
|
-
|
|
252
|
-
|
|
210
|
+
// URL doesn't contain GET-parameters
|
|
253
211
|
if (urlParts.length === 1) {
|
|
254
|
-
return urlParts[0] + '?gl-window=' + storageKey;
|
|
212
|
+
return urlParts[0] + '?gl-window=' + storageKey;
|
|
213
|
+
|
|
214
|
+
// URL contains GET-parameters
|
|
255
215
|
} else {
|
|
256
216
|
return document.location.href + '&gl-window=' + storageKey;
|
|
257
217
|
}
|
|
258
218
|
}
|
|
219
|
+
|
|
259
220
|
/**
|
|
260
221
|
* Move the newly created window roughly to
|
|
261
222
|
* where the component used to be.
|
|
262
223
|
*/
|
|
263
|
-
|
|
264
|
-
|
|
265
224
|
_positionWindow() {
|
|
266
225
|
var _this$_popoutWindow7, _this$_popoutWindow8;
|
|
267
|
-
|
|
268
226
|
(_this$_popoutWindow7 = this._popoutWindow) === null || _this$_popoutWindow7 === void 0 ? void 0 : _this$_popoutWindow7.moveTo(this._dimensions.left, this._dimensions.top);
|
|
269
227
|
(_this$_popoutWindow8 = this._popoutWindow) === null || _this$_popoutWindow8 === void 0 ? void 0 : _this$_popoutWindow8.focus();
|
|
270
228
|
}
|
|
229
|
+
|
|
271
230
|
/**
|
|
272
231
|
* Callback when the new window is opened and the GoldenLayout instance
|
|
273
232
|
* within it is initialised
|
|
274
233
|
*/
|
|
275
|
-
|
|
276
|
-
|
|
277
234
|
_onInitialised() {
|
|
278
235
|
var _this$getGlInstance6;
|
|
279
|
-
|
|
280
236
|
this.isInitialised = true;
|
|
281
237
|
(_this$getGlInstance6 = this.getGlInstance()) === null || _this$getGlInstance6 === void 0 ? void 0 : _this$getGlInstance6.on('popIn', this.popIn, this);
|
|
282
238
|
this.emit('initialised');
|
|
283
239
|
}
|
|
240
|
+
|
|
284
241
|
/**
|
|
285
242
|
* Invoked 50ms after the window unload event
|
|
286
243
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
244
|
_onClose() {
|
|
290
245
|
setTimeout(this.emit.bind(this, 'closed'), 50);
|
|
291
246
|
}
|
|
292
|
-
|
|
293
247
|
}
|
|
294
248
|
//# sourceMappingURL=BrowserPopout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserPopout.js","names":["$","getUniqueId","minifyConfig","EventEmitter","BrowserPopout","constructor","config","dimensions","parentId","indexInParent","layoutManager","_config","_dimensions","_parentId","_indexInParent","_layoutManager","_createWindow","toConfig","isInitialised","Error","width","getGlInstance","height","left","_popoutWindow","screenX","screenLeft","top","screenY","screenTop","content","__glInstance","getWindow","close","_$closeWindow","e","popIn","index","childConfig","parentItem","extend","root","getItemsById","contentItems","length","addChild","url","_createUrl","title","Math","floor","random","toString","options","_serializeWindowOptions","innerWidth","innerHeight","menubar","toolbar","location","personalbar","resizable","scrollbars","status","window","open","settings","blockedPopoutsThrowError","error","type","on","_positionWindow","bind","_onClose","checkReadyInterval","setInterval","_onInitialised","clearInterval","windowOptions","windowOptionsString","key","push","join","storageKey","localStorage","setItem","JSON","stringify","urlParts","document","href","split","moveTo","focus","emit","setTimeout"],"sources":["../../src/controls/BrowserPopout.ts"],"sourcesContent":["import $ from 'jquery';\nimport type { Config, PopoutConfig, ItemConfigType } from '../config';\nimport type Root from '../items/Root';\nimport type LayoutManager from '../LayoutManager';\nimport { getUniqueId, minifyConfig, EventEmitter } from '../utils';\nimport { AbstractContentItem } from '..';\n\ntype BrowserDimensions = {\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\n/**\n * Pops a content item out into a new browser window.\n * This is achieved by\n *\n * - Creating a new configuration with the content item as root element\n * - Serializing and minifying the configuration\n * - Opening the current window's URL with the configuration as a GET parameter\n * - GoldenLayout when opened in the new window will look for the GET parameter\n * and use it instead of the provided configuration\n *\n * @param config GoldenLayout item config\n * @param dimensions A map with width, height, top and left\n * @param parentId The id of the element the item will be appended to on popIn\n * @param indexInParent The position of this element within its parent\n * @param layoutManager\n */\nexport default class BrowserPopout extends EventEmitter {\n isInitialised = false;\n\n private _config: ItemConfigType[];\n private _dimensions: BrowserDimensions;\n private _parentId: string;\n private _indexInParent: number;\n private _layoutManager: LayoutManager;\n private _popoutWindow:\n | (Window & { __glInstance: LayoutManager })\n | null = null;\n private _id = null;\n\n constructor(\n config: ItemConfigType[],\n dimensions: BrowserDimensions,\n parentId: string,\n indexInParent: number,\n layoutManager: LayoutManager\n ) {\n super();\n\n this._config = config;\n this._dimensions = dimensions;\n this._parentId = parentId;\n this._indexInParent = indexInParent;\n this._layoutManager = layoutManager;\n this._createWindow();\n }\n\n toConfig() {\n if (this.isInitialised === false) {\n throw new Error(\"Can't create config, layout not yet initialised\");\n }\n return ({\n dimensions: {\n width: this.getGlInstance()?.width,\n height: this.getGlInstance()?.height,\n left:\n this._popoutWindow?.screenX ?? this._popoutWindow?.screenLeft ?? 0,\n top: this._popoutWindow?.screenY ?? this._popoutWindow?.screenTop ?? 0,\n },\n content: this.getGlInstance()?.toConfig().content,\n parentId: this._parentId,\n indexInParent: this._indexInParent,\n } as unknown) as PopoutConfig;\n }\n\n getGlInstance() {\n return this._popoutWindow?.__glInstance;\n }\n\n getWindow() {\n return this._popoutWindow;\n }\n\n close() {\n if (this.getGlInstance()) {\n this.getGlInstance()?._$closeWindow();\n } else {\n try {\n this.getWindow()?.close();\n } catch (e) {}\n }\n }\n\n /**\n * Returns the popped out item to its original position. If the original\n * parent isn't available anymore it falls back to the layout's topmost element\n */\n popIn() {\n let index = this._indexInParent;\n let childConfig: ItemConfigType | null = null;\n let parentItem: AbstractContentItem | null = null;\n\n if (this._parentId) {\n /*\n * The $.extend call seems a bit pointless, but it's crucial to\n * copy the config returned by this.getGlInstance().toConfig()\n * onto a new object. Internet Explorer keeps the references\n * to objects on the child window, resulting in the following error\n * once the child window is closed:\n *\n * The callee (server [not server application]) is not available and disappeared\n */\n childConfig = $.extend(true, {}, this.getGlInstance()?.toConfig())\n .content[0];\n parentItem = this._layoutManager.root.getItemsById(\n this._parentId\n )[0] as Root;\n\n /*\n * Fallback if parentItem is not available. Either add it to the topmost\n * item or make it the topmost item if the layout is empty\n */\n if (!parentItem) {\n if ((this._layoutManager.root.contentItems.length ?? 0) > 0) {\n parentItem = this._layoutManager.root.contentItems[0];\n } else {\n parentItem = this._layoutManager.root;\n }\n index = 0;\n }\n }\n\n if (!childConfig) {\n return;\n }\n\n parentItem?.addChild(childConfig, this._indexInParent);\n this.close();\n }\n\n /**\n * Creates the URL and window parameter\n * and opens a new window\n */\n _createWindow() {\n const url = this._createUrl();\n /**\n * Bogus title to prevent re-usage of existing window with the\n * same title. The actual title will be set by the new window's\n * GoldenLayout instance if it detects that it is in subWindowMode\n */\n const title = Math.floor(Math.random() * 1000000).toString(36);\n /**\n * The options as used in the window.open string\n */\n const options = this._serializeWindowOptions({\n width: this._dimensions.width,\n height: this._dimensions.height,\n innerWidth: this._dimensions.width,\n innerHeight: this._dimensions.height,\n menubar: 'no',\n toolbar: 'no',\n location: 'no',\n personalbar: 'no',\n resizable: 'yes',\n scrollbars: 'no',\n status: 'no',\n });\n\n // I'm not entirely sure how __glInstance is mounted to the popout window\n this._popoutWindow = window.open(url, title, options) as Window & {\n __glInstance: LayoutManager;\n };\n\n if (!this._popoutWindow) {\n if (\n this._layoutManager.config.settings.blockedPopoutsThrowError === true\n ) {\n const error = new Error('Popout blocked') as Error & { type: string };\n error.type = 'popoutBlocked';\n throw error;\n } else {\n return;\n }\n }\n\n $(this._popoutWindow)\n .on('load', this._positionWindow.bind(this))\n .on('unload beforeunload', this._onClose.bind(this));\n\n /**\n * Polling the childwindow to find out if GoldenLayout has been initialised\n * doesn't seem optimal, but the alternatives - adding a callback to the parent\n * window or raising an event on the window object - both would introduce knowledge\n * about the parent to the child window which we'd rather avoid\n */\n let checkReadyInterval = window.setInterval(() => {\n if (\n this._popoutWindow?.__glInstance &&\n this._popoutWindow.__glInstance.isInitialised\n ) {\n this._onInitialised();\n window.clearInterval(checkReadyInterval);\n }\n }, 10);\n }\n\n /**\n * Serialises a map of key:values to a window options string\n *\n * @param windowOptions\n *\n * @returns serialised window options\n */\n _serializeWindowOptions(windowOptions: Record<string, unknown>) {\n var windowOptionsString = [],\n key;\n\n for (key in windowOptions) {\n windowOptionsString.push(key + '=' + windowOptions[key]);\n }\n\n return windowOptionsString.join(',');\n }\n\n /**\n * Creates the URL for the new window, including the\n * config GET parameter\n *\n * @returns URL\n */\n _createUrl() {\n var config: Partial<Config> = { content: this._config };\n const storageKey = 'gl-window-config-' + getUniqueId();\n\n config = minifyConfig(config);\n\n try {\n localStorage.setItem(storageKey, JSON.stringify(config));\n } catch (e: any) {\n throw new Error('Error while writing to localStorage ' + e.toString());\n }\n\n const urlParts = document.location.href.split('?');\n\n // URL doesn't contain GET-parameters\n if (urlParts.length === 1) {\n return urlParts[0] + '?gl-window=' + storageKey;\n\n // URL contains GET-parameters\n } else {\n return document.location.href + '&gl-window=' + storageKey;\n }\n }\n\n /**\n * Move the newly created window roughly to\n * where the component used to be.\n */\n _positionWindow() {\n this._popoutWindow?.moveTo(this._dimensions.left, this._dimensions.top);\n this._popoutWindow?.focus();\n }\n\n /**\n * Callback when the new window is opened and the GoldenLayout instance\n * within it is initialised\n */\n _onInitialised() {\n this.isInitialised = true;\n this.getGlInstance()?.on('popIn', this.popIn, this);\n this.emit('initialised');\n }\n\n /**\n * Invoked 50ms after the window unload event\n */\n _onClose() {\n setTimeout(this.emit.bind(this, 'closed'), 50);\n }\n}\n"],"mappings":";;AAAA,OAAOA,CAAP,MAAc,QAAd;SAISC,W,EAAaC,Y,EAAcC,Y;;AAUpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,aAAN,SAA4BD,YAA5B,CAAyC;EAatDE,WAAW,CACTC,MADS,EAETC,UAFS,EAGTC,QAHS,EAITC,aAJS,EAKTC,aALS,EAMT;IACA;;IADA,uCAlBc,KAkBd;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA,uCATS,IAST;;IAAA,6BARY,IAQZ;;IAGA,KAAKC,OAAL,GAAeL,MAAf;IACA,KAAKM,WAAL,GAAmBL,UAAnB;IACA,KAAKM,SAAL,GAAiBL,QAAjB;IACA,KAAKM,cAAL,GAAsBL,aAAtB;IACA,KAAKM,cAAL,GAAsBL,aAAtB;;IACA,KAAKM,aAAL;EACD;;EAEDC,QAAQ,GAAG;IAAA;;IACT,IAAI,KAAKC,aAAL,KAAuB,KAA3B,EAAkC;MAChC,MAAM,IAAIC,KAAJ,CAAU,iDAAV,CAAN;IACD;;IACD,OAAQ;MACNZ,UAAU,EAAE;QACVa,KAAK,yBAAE,KAAKC,aAAL,EAAF,wDAAE,oBAAsBD,KADnB;QAEVE,MAAM,0BAAE,KAAKD,aAAL,EAAF,yDAAE,qBAAsBC,MAFpB;QAGVC,IAAI,0DACF,KAAKC,aADH,wDACF,oBAAoBC,OADlB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B,QAArB,CAAD,EAAiC,EAAjC,CAAV;EACD;;AA5PqD"}
|
|
1
|
+
{"version":3,"file":"BrowserPopout.js","names":["$","getUniqueId","minifyConfig","EventEmitter","BrowserPopout","constructor","config","dimensions","parentId","indexInParent","layoutManager","_config","_dimensions","_parentId","_indexInParent","_layoutManager","_createWindow","toConfig","isInitialised","Error","width","getGlInstance","height","left","_popoutWindow","screenX","screenLeft","top","screenY","screenTop","content","__glInstance","getWindow","close","_$closeWindow","e","popIn","index","childConfig","parentItem","extend","root","getItemsById","contentItems","length","addChild","url","_createUrl","title","Math","floor","random","toString","options","_serializeWindowOptions","innerWidth","innerHeight","menubar","toolbar","location","personalbar","resizable","scrollbars","status","window","open","settings","blockedPopoutsThrowError","error","type","on","_positionWindow","bind","_onClose","checkReadyInterval","setInterval","_onInitialised","clearInterval","windowOptions","windowOptionsString","key","push","join","storageKey","localStorage","setItem","JSON","stringify","urlParts","document","href","split","moveTo","focus","emit","setTimeout"],"sources":["../../src/controls/BrowserPopout.ts"],"sourcesContent":["import $ from 'jquery';\nimport type { Config, PopoutConfig, ItemConfigType } from '../config';\nimport type Root from '../items/Root';\nimport type LayoutManager from '../LayoutManager';\nimport { getUniqueId, minifyConfig, EventEmitter } from '../utils';\nimport { AbstractContentItem } from '..';\n\ntype BrowserDimensions = {\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\n/**\n * Pops a content item out into a new browser window.\n * This is achieved by\n *\n * - Creating a new configuration with the content item as root element\n * - Serializing and minifying the configuration\n * - Opening the current window's URL with the configuration as a GET parameter\n * - GoldenLayout when opened in the new window will look for the GET parameter\n * and use it instead of the provided configuration\n *\n * @param config GoldenLayout item config\n * @param dimensions A map with width, height, top and left\n * @param parentId The id of the element the item will be appended to on popIn\n * @param indexInParent The position of this element within its parent\n * @param layoutManager\n */\nexport default class BrowserPopout extends EventEmitter {\n isInitialised = false;\n\n private _config: ItemConfigType[];\n private _dimensions: BrowserDimensions;\n private _parentId: string;\n private _indexInParent: number;\n private _layoutManager: LayoutManager;\n private _popoutWindow:\n | (Window & { __glInstance: LayoutManager })\n | null = null;\n private _id = null;\n\n constructor(\n config: ItemConfigType[],\n dimensions: BrowserDimensions,\n parentId: string,\n indexInParent: number,\n layoutManager: LayoutManager\n ) {\n super();\n\n this._config = config;\n this._dimensions = dimensions;\n this._parentId = parentId;\n this._indexInParent = indexInParent;\n this._layoutManager = layoutManager;\n this._createWindow();\n }\n\n toConfig() {\n if (this.isInitialised === false) {\n throw new Error(\"Can't create config, layout not yet initialised\");\n }\n return ({\n dimensions: {\n width: this.getGlInstance()?.width,\n height: this.getGlInstance()?.height,\n left:\n this._popoutWindow?.screenX ?? this._popoutWindow?.screenLeft ?? 0,\n top: this._popoutWindow?.screenY ?? this._popoutWindow?.screenTop ?? 0,\n },\n content: this.getGlInstance()?.toConfig().content,\n parentId: this._parentId,\n indexInParent: this._indexInParent,\n } as unknown) as PopoutConfig;\n }\n\n getGlInstance() {\n return this._popoutWindow?.__glInstance;\n }\n\n getWindow() {\n return this._popoutWindow;\n }\n\n close() {\n if (this.getGlInstance()) {\n this.getGlInstance()?._$closeWindow();\n } else {\n try {\n this.getWindow()?.close();\n } catch (e) {}\n }\n }\n\n /**\n * Returns the popped out item to its original position. If the original\n * parent isn't available anymore it falls back to the layout's topmost element\n */\n popIn() {\n let index = this._indexInParent;\n let childConfig: ItemConfigType | null = null;\n let parentItem: AbstractContentItem | null = null;\n\n if (this._parentId) {\n /*\n * The $.extend call seems a bit pointless, but it's crucial to\n * copy the config returned by this.getGlInstance().toConfig()\n * onto a new object. Internet Explorer keeps the references\n * to objects on the child window, resulting in the following error\n * once the child window is closed:\n *\n * The callee (server [not server application]) is not available and disappeared\n */\n childConfig = $.extend(true, {}, this.getGlInstance()?.toConfig())\n .content[0];\n parentItem = this._layoutManager.root.getItemsById(\n this._parentId\n )[0] as Root;\n\n /*\n * Fallback if parentItem is not available. Either add it to the topmost\n * item or make it the topmost item if the layout is empty\n */\n if (!parentItem) {\n if ((this._layoutManager.root.contentItems.length ?? 0) > 0) {\n parentItem = this._layoutManager.root.contentItems[0];\n } else {\n parentItem = this._layoutManager.root;\n }\n index = 0;\n }\n }\n\n if (!childConfig) {\n return;\n }\n\n parentItem?.addChild(childConfig, this._indexInParent);\n this.close();\n }\n\n /**\n * Creates the URL and window parameter\n * and opens a new window\n */\n _createWindow() {\n const url = this._createUrl();\n /**\n * Bogus title to prevent re-usage of existing window with the\n * same title. The actual title will be set by the new window's\n * GoldenLayout instance if it detects that it is in subWindowMode\n */\n const title = Math.floor(Math.random() * 1000000).toString(36);\n /**\n * The options as used in the window.open string\n */\n const options = this._serializeWindowOptions({\n width: this._dimensions.width,\n height: this._dimensions.height,\n innerWidth: this._dimensions.width,\n innerHeight: this._dimensions.height,\n menubar: 'no',\n toolbar: 'no',\n location: 'no',\n personalbar: 'no',\n resizable: 'yes',\n scrollbars: 'no',\n status: 'no',\n });\n\n // I'm not entirely sure how __glInstance is mounted to the popout window\n this._popoutWindow = window.open(url, title, options) as Window & {\n __glInstance: LayoutManager;\n };\n\n if (!this._popoutWindow) {\n if (\n this._layoutManager.config.settings.blockedPopoutsThrowError === true\n ) {\n const error = new Error('Popout blocked') as Error & { type: string };\n error.type = 'popoutBlocked';\n throw error;\n } else {\n return;\n }\n }\n\n $(this._popoutWindow)\n .on('load', this._positionWindow.bind(this))\n .on('unload beforeunload', this._onClose.bind(this));\n\n /**\n * Polling the childwindow to find out if GoldenLayout has been initialised\n * doesn't seem optimal, but the alternatives - adding a callback to the parent\n * window or raising an event on the window object - both would introduce knowledge\n * about the parent to the child window which we'd rather avoid\n */\n let checkReadyInterval = window.setInterval(() => {\n if (\n this._popoutWindow?.__glInstance &&\n this._popoutWindow.__glInstance.isInitialised\n ) {\n this._onInitialised();\n window.clearInterval(checkReadyInterval);\n }\n }, 10);\n }\n\n /**\n * Serialises a map of key:values to a window options string\n *\n * @param windowOptions\n *\n * @returns serialised window options\n */\n _serializeWindowOptions(windowOptions: Record<string, unknown>) {\n var windowOptionsString = [],\n key;\n\n for (key in windowOptions) {\n windowOptionsString.push(key + '=' + windowOptions[key]);\n }\n\n return windowOptionsString.join(',');\n }\n\n /**\n * Creates the URL for the new window, including the\n * config GET parameter\n *\n * @returns URL\n */\n _createUrl() {\n var config: Partial<Config> = { content: this._config };\n const storageKey = 'gl-window-config-' + getUniqueId();\n\n config = minifyConfig(config);\n\n try {\n localStorage.setItem(storageKey, JSON.stringify(config));\n } catch (e: any) {\n throw new Error('Error while writing to localStorage ' + e.toString());\n }\n\n const urlParts = document.location.href.split('?');\n\n // URL doesn't contain GET-parameters\n if (urlParts.length === 1) {\n return urlParts[0] + '?gl-window=' + storageKey;\n\n // URL contains GET-parameters\n } else {\n return document.location.href + '&gl-window=' + storageKey;\n }\n }\n\n /**\n * Move the newly created window roughly to\n * where the component used to be.\n */\n _positionWindow() {\n this._popoutWindow?.moveTo(this._dimensions.left, this._dimensions.top);\n this._popoutWindow?.focus();\n }\n\n /**\n * Callback when the new window is opened and the GoldenLayout instance\n * within it is initialised\n */\n _onInitialised() {\n this.isInitialised = true;\n this.getGlInstance()?.on('popIn', this.popIn, this);\n this.emit('initialised');\n }\n\n /**\n * Invoked 50ms after the window unload event\n */\n _onClose() {\n setTimeout(this.emit.bind(this, 'closed'), 50);\n }\n}\n"],"mappings":";AAAA,OAAOA,CAAC,MAAM,QAAQ;AAAC,SAIdC,WAAW,EAAEC,YAAY,EAAEC,YAAY;AAUhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,aAAa,SAASD,YAAY,CAAC;EAatDE,WAAW,CACTC,MAAwB,EACxBC,UAA6B,EAC7BC,QAAgB,EAChBC,aAAqB,EACrBC,aAA4B,EAC5B;IACA,KAAK,EAAE;IAAC,uCAnBM,KAAK;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,uCASV,IAAI;IAAA,6BACD,IAAI;IAWhB,IAAI,CAACC,OAAO,G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