@deephaven/golden-layout 0.85.3-core-plugins.6 → 0.85.3
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.d.ts +11 -23
- package/dist/LayoutManager.d.ts.map +1 -1
- package/dist/LayoutManager.js +21 -49
- package/dist/LayoutManager.js.map +1 -1
- package/dist/config/Config.d.ts +2 -2
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.js.map +1 -1
- package/dist/config/ItemConfig.d.ts +14 -38
- package/dist/config/ItemConfig.d.ts.map +1 -1
- package/dist/config/ItemConfig.js +0 -2
- package/dist/config/ItemConfig.js.map +1 -1
- package/dist/controls/BrowserPopout.d.ts +2 -2
- package/dist/controls/BrowserPopout.d.ts.map +1 -1
- package/dist/controls/BrowserPopout.js.map +1 -1
- package/dist/controls/DragSource.d.ts +3 -3
- package/dist/controls/DragSource.d.ts.map +1 -1
- package/dist/controls/DragSource.js.map +1 -1
- package/dist/controls/Header.d.ts +3 -3
- package/dist/controls/Header.d.ts.map +1 -1
- package/dist/controls/Header.js.map +1 -1
- package/dist/items/AbstractContentItem.d.ts +12 -5
- package/dist/items/AbstractContentItem.d.ts.map +1 -1
- package/dist/items/AbstractContentItem.js.map +1 -1
- package/dist/items/Component.d.ts +2 -2
- package/dist/items/Component.d.ts.map +1 -1
- package/dist/items/Component.js +1 -2
- package/dist/items/Component.js.map +1 -1
- package/dist/items/Root.d.ts +5 -3
- package/dist/items/Root.d.ts.map +1 -1
- package/dist/items/Root.js.map +1 -1
- package/dist/items/RowOrColumn.d.ts +6 -5
- package/dist/items/RowOrColumn.d.ts.map +1 -1
- package/dist/items/RowOrColumn.js +1 -2
- package/dist/items/RowOrColumn.js.map +1 -1
- package/dist/items/Stack.d.ts +21 -7
- package/dist/items/Stack.d.ts.map +1 -1
- package/dist/items/Stack.js +4 -7
- package/dist/items/Stack.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/utils/EventUtils.d.ts +0 -27
- package/dist/utils/EventUtils.d.ts.map +0 -1
- package/dist/utils/EventUtils.js +0 -41
- package/dist/utils/EventUtils.js.map +0 -1
- package/dist/utils/EventUtils.test.d.ts +0 -2
- package/dist/utils/EventUtils.test.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,GAAG;QACvB,KAAK,EAAE,MAAM,CAAC;QAEd,MAAM,EAAE,MAAM,CAAC;QAEf,IAAI,EAAE,MAAM,CAAC;QAEb,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAElC;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K,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,aAAa,EAAE,MAsC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","names":["defaultConfig","Object","freeze","openPopouts","settings","hasHeaders","constrainDragToContainer","reorderEnabled","selectionEnabled","popoutWholeStack","blockedPopoutsThrowError","closePopoutsOnUnload","showPopoutIcon","showMaximiseIcon","showCloseIcon","responsiveMode","tabOverlapAllowance","tabControlOffset","dimensions","borderWidth","borderGrabWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","popin","tabDropdown","tabNextLabel","tabPreviousLabel","content"],"sources":["../../src/config/Config.ts"],"sourcesContent":["import type { ItemConfig } from './ItemConfig';\n\nexport type Config = {\n settings: Partial<Settings>;\n dimensions: Dimensions;\n labels: Labels;\n content:
|
|
1
|
+
{"version":3,"file":"Config.js","names":["defaultConfig","Object","freeze","openPopouts","settings","hasHeaders","constrainDragToContainer","reorderEnabled","selectionEnabled","popoutWholeStack","blockedPopoutsThrowError","closePopoutsOnUnload","showPopoutIcon","showMaximiseIcon","showCloseIcon","responsiveMode","tabOverlapAllowance","tabControlOffset","dimensions","borderWidth","borderGrabWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","popin","tabDropdown","tabNextLabel","tabPreviousLabel","content"],"sources":["../../src/config/Config.ts"],"sourcesContent":["import type { ItemConfig, ItemConfigType } from './ItemConfig';\n\nexport type Config = {\n settings: Partial<Settings>;\n dimensions: Dimensions;\n labels: Labels;\n content: ItemConfigType[];\n maximisedItemId?: string;\n openPopouts?: PopoutConfig[];\n};\n\nexport type PopoutConfig = Config & {\n parentId: string;\n indexInParent: number;\n dimensions: Dimensions & {\n width: number;\n\n height: number;\n\n left: number;\n\n top: number;\n };\n};\n\nexport interface Settings {\n /**\n * Turns headers on or off. If false, the layout will be displayed with splitters only.\n * Default: true\n */\n hasHeaders: boolean;\n\n /**\n * Constrains the area in which items can be dragged to the layout's container. Will be set to false\n * automatically when layout.createDragSource() is called.\n * Default: true\n */\n constrainDragToContainer: boolean;\n\n /**\n * If true, the user can re-arrange the layout by dragging items by their tabs to the desired location.\n * Default: true\n */\n reorderEnabled: boolean;\n\n /**\n * If true, the user can select items by clicking on their header. This sets the value of layout.selectedItem to\n * the clicked item, highlights its header and the layout emits a 'selectionChanged' event.\n * Default: false\n */\n selectionEnabled: boolean;\n\n /**\n * Decides what will be opened in a new window if the user clicks the popout icon. If true the entire stack will\n * be transferred to the new window, if false only the active component will be opened.\n * Default: false\n */\n popoutWholeStack: boolean;\n\n /**\n * Specifies if an error is thrown when a popout is blocked by the browser (e.g. by opening it programmatically).\n * If false, the popout call will fail silently.\n * Default: true\n */\n blockedPopoutsThrowError: boolean;\n\n /**\n * Specifies if all popouts should be closed when the page that created them is closed. Popouts don't have a\n * strong dependency on their parent and can exist on their own, but can be quite annoying to close by hand. In\n * addition, any changes made to popouts won't be stored after the parent is closed.\n * Default: true\n */\n closePopoutsOnUnload: boolean;\n\n /**\n * Specifies if the popout icon should be displayed in the header-bar.\n * Default: true\n */\n showPopoutIcon: boolean;\n\n /**\n * Specifies if the maximise icon should be displayed in the header-bar.\n * Default: true\n */\n showMaximiseIcon: boolean;\n\n /**\n * Specifies if the close icon should be displayed in the header-bar.\n * Default: true\n */\n showCloseIcon: boolean;\n\n responsiveMode: 'onload' | 'always' | 'none'; // Can be onload, always, or none.\n\n /**\n * Maximum pixel overlap per tab\n */\n tabOverlapAllowance: number;\n\n tabControlOffset: number;\n\n /**\n * The default config to apply to Components\n */\n defaultComponentConfig: Partial<Omit<ItemConfig, 'type'>>;\n}\n\nexport interface Dimensions {\n /**\n * The width of the borders between the layout items in pixel. Please note: The actual draggable area is wider\n * than the visible one, making it safe to set this to small values without affecting usability.\n * Default: 5\n */\n borderWidth: number;\n\n borderGrabWidth: number;\n\n /**\n * The minimum height an item can be resized to (in pixel).\n * Default: 10\n */\n minItemHeight: number;\n\n /**\n * The minimum width an item can be resized to (in pixel).\n * Default: 10\n */\n minItemWidth: number;\n\n /**\n * The height of the header elements in pixel. This can be changed, but your theme's header css needs to be\n * adjusted accordingly.\n * Default: 20\n */\n headerHeight: number;\n\n /**\n * The width of the element that appears when an item is dragged (in pixel).\n * Default: 300\n */\n dragProxyWidth: number;\n\n /**\n * The height of the element that appears when an item is dragged (in pixel).\n * Default: 200\n */\n dragProxyHeight: number;\n}\n\nexport interface Labels {\n /**\n * The tooltip text that appears when hovering over the close icon.\n * Default: 'close'\n */\n close: string;\n\n /**\n * The tooltip text that appears when hovering over the maximise icon.\n * Default: 'maximise'\n */\n maximise: string;\n\n /**\n * The tooltip text that appears when hovering over the minimise icon.\n * Default: 'minimise'\n */\n minimise: string;\n\n /**\n * The tooltip text that appears when hovering over the popout icon.\n * Default: 'open in new window'\n */\n popout: string;\n\n tabDropdown: string;\n\n tabNextLabel: string;\n\n tabPreviousLabel: string;\n\n popin: string;\n}\n\nexport const defaultConfig: Config = Object.freeze({\n openPopouts: [],\n settings: {\n hasHeaders: true,\n constrainDragToContainer: true,\n reorderEnabled: true,\n selectionEnabled: false,\n popoutWholeStack: false,\n blockedPopoutsThrowError: true,\n closePopoutsOnUnload: true,\n showPopoutIcon: true,\n showMaximiseIcon: true,\n showCloseIcon: true,\n responsiveMode: 'onload' as const, // Can be onload, always, or none.\n tabOverlapAllowance: 0, // maximum pixel overlap per tab\n // reorderOnTabMenuClick: true, // Deephaven disabled\n tabControlOffset: 10,\n },\n dimensions: {\n borderWidth: 5,\n borderGrabWidth: 10,\n minItemHeight: 10,\n minItemWidth: 10,\n headerHeight: 20,\n dragProxyWidth: 300,\n dragProxyHeight: 200,\n },\n labels: {\n close: 'Close',\n maximise: 'Maximize',\n minimise: 'Minimize',\n popout: 'Open in new window',\n popin: 'Pop in',\n tabDropdown: 'Additional tabs',\n tabNextLabel: 'Next',\n tabPreviousLabel: 'Previous',\n },\n content: [],\n});\n"],"mappings":"AAuLA,OAAO,IAAMA,aAAqB,GAAGC,MAAM,CAACC,MAAM,CAAC;EACjDC,WAAW,EAAE,EAAE;EACfC,QAAQ,EAAE;IACRC,UAAU,EAAE,IAAI;IAChBC,wBAAwB,EAAE,IAAI;IAC9BC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,KAAK;IACvBC,gBAAgB,EAAE,KAAK;IACvBC,wBAAwB,EAAE,IAAI;IAC9BC,oBAAoB,EAAE,IAAI;IAC1BC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,IAAI;IACtBC,aAAa,EAAE,IAAI;IACnBC,cAAc,EAAE,QAAiB;IAAE;IACnCC,mBAAmB,EAAE,CAAC;IAAE;IACxB;IACAC,gBAAgB,EAAE;EACpB,CAAC;EACDC,UAAU,EAAE;IACVC,WAAW,EAAE,CAAC;IACdC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,EAAE;IACjBC,YAAY,EAAE,EAAE;IAChBC,YAAY,EAAE,EAAE;IAChBC,cAAc,EAAE,GAAG;IACnBC,eAAe,EAAE;EACnB,CAAC;EACDC,MAAM,EAAE;IACNC,KAAK,EAAE,OAAO;IACdC,QAAQ,EAAE,UAAU;IACpBC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,oBAAoB;IAC5BC,KAAK,EAAE,QAAQ;IACfC,WAAW,EAAE,iBAAiB;IAC9BC,YAAY,EAAE,MAAM;IACpBC,gBAAgB,EAAE;EACpB,CAAC;EACDC,OAAO,EAAE;AACX,CAAC,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export type ItemConfigType = ItemConfig;
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
import type { StackHeaderConfig } from '../items/Stack';
|
|
2
|
+
export type ItemConfigType = ItemConfig | ComponentConfig | ReactComponentConfig;
|
|
3
|
+
export interface ItemConfig {
|
|
4
|
+
/**
|
|
5
|
+
* The type of the item.
|
|
6
|
+
*/
|
|
7
|
+
type: 'default' | 'root' | 'row' | 'column' | 'stack' | 'component' | 'react-component';
|
|
5
8
|
/**
|
|
6
9
|
* An array of configurations for items that will be created as children of this item.
|
|
7
10
|
*/
|
|
8
|
-
content?: ItemConfig[];
|
|
11
|
+
content?: (ItemConfig | ItemConfigType)[];
|
|
9
12
|
/**
|
|
10
13
|
* The width of this item, relative to the other children of its parent in percent
|
|
11
14
|
*/
|
|
@@ -33,35 +36,9 @@ export interface ItemConfigAttributes {
|
|
|
33
36
|
title?: string;
|
|
34
37
|
isFocusOnShow?: boolean;
|
|
35
38
|
reorderEnabled?: boolean;
|
|
36
|
-
header?:
|
|
37
|
-
}
|
|
38
|
-
export interface DefaultItemConfig extends ItemConfigAttributes {
|
|
39
|
-
type: 'default';
|
|
40
|
-
}
|
|
41
|
-
export interface RowItemConfig extends ItemConfigAttributes {
|
|
42
|
-
type: 'row';
|
|
43
|
-
}
|
|
44
|
-
export interface ColumnItemConfig extends ItemConfigAttributes {
|
|
45
|
-
type: 'column';
|
|
46
|
-
}
|
|
47
|
-
export interface RootItemConfig extends ItemConfigAttributes {
|
|
48
|
-
type: 'root';
|
|
49
|
-
}
|
|
50
|
-
export interface StackItemHeaderConfig {
|
|
51
|
-
show?: boolean | 'top' | 'left' | 'right' | 'bottom';
|
|
52
|
-
popout?: string;
|
|
53
|
-
maximise?: string;
|
|
54
|
-
close?: string;
|
|
55
|
-
minimise?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface StackItemConfig extends ItemConfigAttributes {
|
|
58
|
-
type: 'stack';
|
|
59
|
-
activeItemIndex?: number;
|
|
60
|
-
header?: StackItemHeaderConfig;
|
|
61
|
-
hasHeaders?: boolean;
|
|
39
|
+
header?: StackHeaderConfig;
|
|
62
40
|
}
|
|
63
|
-
export interface ComponentConfig extends
|
|
64
|
-
type: 'component';
|
|
41
|
+
export interface ComponentConfig extends ItemConfig {
|
|
65
42
|
/**
|
|
66
43
|
* The name of the component as specified in layout.registerComponent. Mandatory if type is 'component'.
|
|
67
44
|
*/
|
|
@@ -72,8 +49,7 @@ export interface ComponentConfig extends ItemConfigAttributes {
|
|
|
72
49
|
*/
|
|
73
50
|
componentState: Record<string, unknown>;
|
|
74
51
|
}
|
|
75
|
-
export interface ReactComponentConfig extends
|
|
76
|
-
type: 'react-component';
|
|
52
|
+
export interface ReactComponentConfig extends ItemConfig {
|
|
77
53
|
componentName?: string;
|
|
78
54
|
/**
|
|
79
55
|
* The name of the component as specified in layout.registerComponent. Mandatory if type is 'react-component'
|
|
@@ -84,7 +60,7 @@ export interface ReactComponentConfig extends ItemConfigAttributes {
|
|
|
84
60
|
*/
|
|
85
61
|
props?: any;
|
|
86
62
|
}
|
|
87
|
-
export declare function isGLComponentConfig(item:
|
|
88
|
-
export declare function isReactComponentConfig(item:
|
|
89
|
-
export declare const itemDefaultConfig:
|
|
63
|
+
export declare function isGLComponentConfig(item: ItemConfigType): item is ComponentConfig;
|
|
64
|
+
export declare function isReactComponentConfig(item: ItemConfigType): item is ReactComponentConfig;
|
|
65
|
+
export declare const itemDefaultConfig: ItemConfig;
|
|
90
66
|
//# sourceMappingURL=ItemConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemConfig.d.ts","sourceRoot":"","sources":["../../src/config/ItemConfig.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ItemConfig.d.ts","sourceRoot":"","sources":["../../src/config/ItemConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,MAAM,cAAc,GACtB,UAAU,GACV,eAAe,GACf,oBAAoB,CAAC;AAEzB,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EACA,SAAS,GACT,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,GACP,WAAW,GACX,iBAAiB,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,cAAc,CAAC,EAAE,CAAC;IAE1C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,GACnB,IAAI,IAAI,eAAe,CAEzB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,GACnB,IAAI,IAAI,oBAAoB,CAE9B;AAED,eAAO,MAAM,iBAAiB,EAAE,UAM9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemConfig.js","names":["isGLComponentConfig","item","componentName","undefined","isReactComponentConfig","component","itemDefaultConfig","Object","freeze","type","isClosable","isFocusOnShow","reorderEnabled","title"],"sources":["../../src/config/ItemConfig.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"ItemConfig.js","names":["isGLComponentConfig","item","componentName","undefined","isReactComponentConfig","component","itemDefaultConfig","Object","freeze","type","isClosable","isFocusOnShow","reorderEnabled","title"],"sources":["../../src/config/ItemConfig.ts"],"sourcesContent":["import type { StackHeaderConfig } from '../items/Stack';\n\nexport type ItemConfigType =\n | ItemConfig\n | ComponentConfig\n | ReactComponentConfig;\n\nexport interface ItemConfig {\n /**\n * The type of the item.\n */\n type:\n | 'default'\n | 'root'\n | 'row'\n | 'column'\n | 'stack'\n | 'component'\n | 'react-component';\n\n /**\n * An array of configurations for items that will be created as children of this item.\n */\n content?: (ItemConfig | ItemConfigType)[];\n\n /**\n * The width of this item, relative to the other children of its parent in percent\n */\n width?: number;\n\n minWidth?: number;\n\n /**\n * The height of this item, relative to the other children of its parent in percent\n */\n height?: number;\n\n minHeight?: number;\n\n /**\n * A String or an Array of Strings. Used to retrieve the item using item.getItemsById()\n */\n id?: string | string[];\n\n /**\n * Determines if the item is closable. If false, the x on the items tab will be hidden and container.close()\n * will return false\n * Default: true\n */\n isClosable?: boolean;\n\n /**\n * The title of the item as displayed on its tab and on popout windows\n * Default: componentName or ''\n */\n title?: string;\n\n isFocusOnShow?: boolean;\n\n reorderEnabled?: boolean;\n\n header?: StackHeaderConfig;\n}\n\nexport interface ComponentConfig extends ItemConfig {\n /**\n * The name of the component as specified in layout.registerComponent. Mandatory if type is 'component'.\n */\n componentName: string;\n\n /**\n * A serialisable object. Will be passed to the component constructor function and will be the value returned by\n * container.getState().\n */\n componentState: Record<string, unknown>;\n}\n\nexport interface ReactComponentConfig extends ItemConfig {\n componentName?: string;\n /**\n * The name of the component as specified in layout.registerComponent. Mandatory if type is 'react-component'\n */\n component: string;\n\n /**\n * Properties that will be passed to the component and accessible using this.props.\n */\n props?: any;\n}\n\nexport function isGLComponentConfig(\n item: ItemConfigType\n): item is ComponentConfig {\n return (item as ComponentConfig).componentName !== undefined;\n}\n\nexport function isReactComponentConfig(\n item: ItemConfigType\n): item is ReactComponentConfig {\n return (item as ReactComponentConfig).component !== undefined;\n}\n\nexport const itemDefaultConfig: ItemConfig = Object.freeze({\n type: 'default',\n isClosable: true,\n isFocusOnShow: true,\n reorderEnabled: true,\n title: '',\n});\n"],"mappings":"AA0FA,OAAO,SAASA,mBAAmBA,CACjCC,IAAoB,EACK;EACzB,OAAQA,IAAI,CAAqBC,aAAa,KAAKC,SAAS;AAC9D;AAEA,OAAO,SAASC,sBAAsBA,CACpCH,IAAoB,EACU;EAC9B,OAAQA,IAAI,CAA0BI,SAAS,KAAKF,SAAS;AAC/D;AAEA,OAAO,IAAMG,iBAA6B,GAAGC,MAAM,CAACC,MAAM,CAAC;EACzDC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE,IAAI;EAChBC,aAAa,EAAE,IAAI;EACnBC,cAAc,EAAE,IAAI;EACpBC,KAAK,EAAE;AACT,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PopoutConfig,
|
|
1
|
+
import type { PopoutConfig, ItemConfigType } from '../config';
|
|
2
2
|
import type LayoutManager from '../LayoutManager';
|
|
3
3
|
import { EventEmitter } from '../utils';
|
|
4
4
|
type BrowserDimensions = {
|
|
@@ -32,7 +32,7 @@ export default class BrowserPopout extends EventEmitter {
|
|
|
32
32
|
private _layoutManager;
|
|
33
33
|
private _popoutWindow;
|
|
34
34
|
private _id;
|
|
35
|
-
constructor(config:
|
|
35
|
+
constructor(config: ItemConfigType[], dimensions: BrowserDimensions, parentId: string, indexInParent: number, layoutManager: LayoutManager);
|
|
36
36
|
toConfig(): PopoutConfig;
|
|
37
37
|
getGlInstance(): LayoutManager | undefined;
|
|
38
38
|
getWindow(): (Window & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserPopout.d.ts","sourceRoot":"","sources":["../../src/controls/BrowserPopout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"BrowserPopout.d.ts","sourceRoot":"","sources":["../../src/controls/BrowserPopout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAA6B,YAAY,EAAE,MAAM,UAAU,CAAC;AAGnE,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,YAAY;IACrD,aAAa,UAAS;IAEtB,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,aAAa,CACd;IACP,OAAO,CAAC,GAAG,CAAQ;gBAGjB,MAAM,EAAE,cAAc,EAAE,EACxB,UAAU,EAAE,iBAAiB,EAC7B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,aAAa;IAY9B,QAAQ;IAkBR,aAAa;IAIb,SAAS;;;IAIT,KAAK;IAUL;;;OAGG;IACH,KAAK;IA2CL;;;OAGG;IACH,aAAa;IA+Db;;;;;;OAMG;IACH,uBAAuB,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAW9D;;;;;OAKG;IACH,UAAU;IAwBV;;;OAGG;IACH,eAAe;IAKf;;;OAGG;IACH,cAAc;IAMd;;OAEG;IACH,QAAQ;CAGT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserPopout.js","names":["$","getUniqueId","minifyConfig","EventEmitter","BrowserPopout","constructor","config","dimensions","parentId","indexInParent","layoutManager","_defineProperty","_config","_dimensions","_parentId","_indexInParent","_layoutManager","_createWindow","toConfig","_this$getGlInstance","_this$getGlInstance2","_ref","_this$_popoutWindow$s","_this$_popoutWindow","_this$_popoutWindow2","_ref2","_this$_popoutWindow$s2","_this$_popoutWindow3","_this$_popoutWindow4","_this$getGlInstance3","isInitialised","Error","width","getGlInstance","height","left","_popoutWindow","screenX","screenLeft","top","screenY","screenTop","content","_this$_popoutWindow5","__glInstance","getWindow","close","_this$getGlInstance4","_$closeWindow","_this$getWindow","e","popIn","_parentItem","index","childConfig","parentItem","_this$getGlInstance5","extend","root","getItemsById","_this$_layoutManager$","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","_this$_popoutWindow6","_onInitialised","clearInterval","windowOptions","windowOptionsString","key","push","join","storageKey","localStorage","setItem","JSON","stringify","urlParts","document","href","split","_this$_popoutWindow7","_this$_popoutWindow8","moveTo","focus","_this$getGlInstance6","emit","setTimeout"],"sources":["../../src/controls/BrowserPopout.ts"],"sourcesContent":["import $ from 'jquery';\nimport type { Config, PopoutConfig, ItemConfig } 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: ItemConfig[];\n private _dimensions: BrowserDimensions;\n private _parentId: string;\n private _indexInParent: number;\n private _layoutManager: LayoutManager;\n private _popoutWindow: (Window & { __glInstance: LayoutManager }) | null =\n null;\n private _id = null;\n\n constructor(\n config: ItemConfig[],\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: ItemConfig | 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;EAYtDE,WAAWA,CACTC,MAAoB,EACpBC,UAA6B,EAC7BC,QAAgB,EAChBC,aAAqB,EACrBC,aAA4B,EAC5B;IACA,KAA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AAG,CAAC;;IAElD;IACA,IAAIH,QAAQ,CAAC7C,MAAM,KAAK,CAAC,EAAE;MACzB,OAAO6C,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,GAAGL,UAAU;;MAE/C;IACF,CAAC,MAAM;MACL,OAAOM,QAAQ,CAAC/B,QAAQ,CAACgC,IAAI,GAAG,aAAa,GAAGP,UAAU;IAC5D;EACF;;EAEA;AACF;AACA;AACA;EACEb,eAAeA,CAAA,EAAG;IAAA,IAAAsB,oBAAA,EAAAC,oBAAA;IAChB,CAAAD,oBAAA,OAAI,CAAC3E,aAAa,cAAA2E,oBAAA,uBAAlBA,oBAAA,CAAoBE,MAAM,CAAC,IAAI,CAACpG,WAAW,CAACsB,IAAI,EAAE,IAAI,CAACtB,WAAW,CAAC0B,GAAG,CAAC;IACvE,CAAAyE,oBAAA,OAAI,CAAC5E,aAAa,cAAA4E,oBAAA,uBAAlBA,oBAAA,CAAoBE,KAAK,CAAC,CAAC;EAC7B;;EAEA;AACF;AACA;AACA;EACEnB,cAAcA,CAAA,EAAG;IAAA,IAAAoB,oBAAA;IACf,IAAI,CAACrF,aAAa,GAAG,IAAI;IACzB,CAAAqF,oBAAA,OAAI,CAAClF,aAAa,CAAC,CAAC,cAAAkF,oBAAA,uBAApBA,oBAAA,CAAsB3B,EAAE,CAAC,OAAO,EAAE,IAAI,CAACrC,KAAK,EAAE,IAAI,CAAC;IACnD,IAAI,CAACiE,IAAI,CAAC,aAAa,CAAC;EAC1B;;EAEA;AACF;AACA;EACEzB,QAAQA,CAAA,EAAG;IACT0B,UAAU,CAAC,IAAI,CAACD,IAAI,CAAC1B,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC;EAChD;AACF"}
|
|
1
|
+
{"version":3,"file":"BrowserPopout.js","names":["$","getUniqueId","minifyConfig","EventEmitter","BrowserPopout","constructor","config","dimensions","parentId","indexInParent","layoutManager","_defineProperty","_config","_dimensions","_parentId","_indexInParent","_layoutManager","_createWindow","toConfig","_this$getGlInstance","_this$getGlInstance2","_ref","_this$_popoutWindow$s","_this$_popoutWindow","_this$_popoutWindow2","_ref2","_this$_popoutWindow$s2","_this$_popoutWindow3","_this$_popoutWindow4","_this$getGlInstance3","isInitialised","Error","width","getGlInstance","height","left","_popoutWindow","screenX","screenLeft","top","screenY","screenTop","content","_this$_popoutWindow5","__glInstance","getWindow","close","_this$getGlInstance4","_$closeWindow","_this$getWindow","e","popIn","_parentItem","index","childConfig","parentItem","_this$getGlInstance5","extend","root","getItemsById","_this$_layoutManager$","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","_this$_popoutWindow6","_onInitialised","clearInterval","windowOptions","windowOptionsString","key","push","join","storageKey","localStorage","setItem","JSON","stringify","urlParts","document","href","split","_this$_popoutWindow7","_this$_popoutWindow8","moveTo","focus","_this$getGlInstance6","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: (Window & { __glInstance: LayoutManager }) | null =\n 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;EAYtDE,WAAWA,CACTC,MAAwB,EACxBC,UAA6B,EAC7BC,QAAgB,EAChBC,aAAqB,EACrBC,aAA4B,EAC5B;IACA,KAAK,CAAC,CAAC;IAACC,eAAA,wBAlBM,KAAK;IAAAA,eAAA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KAAK,CAAC,EAAE;MACzB,OAAO6C,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,GAAGL,UAAU;;MAE/C;IACF,CAAC,MAAM;MACL,OAAOM,QAAQ,CAAC/B,QAAQ,CAACgC,IAAI,GAAG,aAAa,GAAGP,UAAU;IAC5D;EACF;;EAEA;AACF;AACA;AACA;EACEb,eAAeA,CAAA,EAAG;IAAA,IAAAsB,oBAAA,EAAAC,oBAAA;IAChB,CAAAD,oBAAA,OAAI,CAAC3E,aAAa,cAAA2E,oBAAA,uBAAlBA,oBAAA,CAAoBE,MAAM,CAAC,IAAI,CAACpG,WAAW,CAACsB,IAAI,EAAE,IAAI,CAACtB,WAAW,CAAC0B,GAAG,CAAC;IACvE,CAAAyE,oBAAA,OAAI,CAAC5E,aAAa,cAAA4E,oBAAA,uBAAlBA,oBAAA,CAAoBE,KAAK,CAAC,CAAC;EAC7B;;EAEA;AACF;AACA;AACA;EACEnB,cAAcA,CAAA,EAAG;IAAA,IAAAoB,oBAAA;IACf,IAAI,CAACrF,aAAa,GAAG,IAAI;IACzB,CAAAqF,oBAAA,OAAI,CAAClF,aAAa,CAAC,CAAC,cAAAkF,oBAAA,uBAApBA,oBAAA,CAAsB3B,EAAE,CAAC,OAAO,EAAE,IAAI,CAACrC,KAAK,EAAE,IAAI,CAAC;IACnD,IAAI,CAACiE,IAAI,CAAC,aAAa,CAAC;EAC1B;;EAEA;AACF;AACA;EACEzB,QAAQA,CAAA,EAAG;IACT0B,UAAU,CAAC,IAAI,CAACD,IAAI,CAAC1B,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC;EAChD;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="jquery" />
|
|
2
2
|
/// <reference types="jquery" />
|
|
3
3
|
/// <reference types="bootstrap" />
|
|
4
|
-
import type {
|
|
4
|
+
import type { ItemConfigType } from '../config';
|
|
5
5
|
import type LayoutManager from '../LayoutManager';
|
|
6
6
|
import { DragListener } from '../utils';
|
|
7
7
|
/**
|
|
@@ -14,10 +14,10 @@ import { DragListener } from '../utils';
|
|
|
14
14
|
*/
|
|
15
15
|
export default class DragSource {
|
|
16
16
|
_element: JQuery<HTMLElement>;
|
|
17
|
-
_itemConfig:
|
|
17
|
+
_itemConfig: ItemConfigType | (() => ItemConfigType);
|
|
18
18
|
_layoutManager: LayoutManager;
|
|
19
19
|
_dragListener: DragListener;
|
|
20
|
-
constructor(element: JQuery<HTMLElement>, itemConfig:
|
|
20
|
+
constructor(element: JQuery<HTMLElement>, itemConfig: ItemConfigType | (() => ItemConfigType), layoutManager: LayoutManager);
|
|
21
21
|
/**
|
|
22
22
|
* Called initially and after every drag
|
|
23
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragSource.d.ts","sourceRoot":"","sources":["../../src/controls/DragSource.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"DragSource.d.ts","sourceRoot":"","sources":["../../src/controls/DragSource.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9B,WAAW,EAAE,cAAc,GAAG,CAAC,MAAM,cAAc,CAAC,CAAC;IACrD,cAAc,EAAE,aAAa,CAAC;IAC9B,aAAa,EAAE,YAAY,CAAC;gBAG1B,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,EAC5B,UAAU,EAAE,cAAc,GAAG,CAAC,MAAM,cAAc,CAAC,EACnD,aAAa,EAAE,aAAa;IAS9B;;OAEG;IACH,mBAAmB;IAOnB;;;;;OAKG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;CAiBlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragSource.js","names":["$","DragListener","DragProxy","DragSource","constructor","element","itemConfig","layoutManager","_defineProperty","_element","_itemConfig","_layoutManager","_dragListener","_createDragListener","on","_onDragStart","x","y","contentItem","_$normalizeContentItem","extend","dragProxy"],"sources":["../../src/controls/DragSource.ts"],"sourcesContent":["import $ from 'jquery';\nimport type {
|
|
1
|
+
{"version":3,"file":"DragSource.js","names":["$","DragListener","DragProxy","DragSource","constructor","element","itemConfig","layoutManager","_defineProperty","_element","_itemConfig","_layoutManager","_dragListener","_createDragListener","on","_onDragStart","x","y","contentItem","_$normalizeContentItem","extend","dragProxy"],"sources":["../../src/controls/DragSource.ts"],"sourcesContent":["import $ from 'jquery';\nimport type { ItemConfigType } from '../config';\nimport type LayoutManager from '../LayoutManager';\nimport { DragListener } from '../utils';\nimport DragProxy from './DragProxy';\n\n/**\n * Allows for any DOM item to create a component on drag\n * start tobe dragged into the Layout\n *\n * @param element\n * @param itemConfig the configuration for the contentItem that will be created\n * @param layoutManager\n */\nexport default class DragSource {\n _element: JQuery<HTMLElement>;\n _itemConfig: ItemConfigType | (() => ItemConfigType);\n _layoutManager: LayoutManager;\n _dragListener: DragListener;\n\n constructor(\n element: JQuery<HTMLElement>,\n itemConfig: ItemConfigType | (() => ItemConfigType),\n layoutManager: LayoutManager\n ) {\n this._element = element;\n this._itemConfig = itemConfig;\n this._layoutManager = layoutManager;\n\n this._dragListener = this._createDragListener();\n }\n\n /**\n * Called initially and after every drag\n */\n _createDragListener() {\n this._dragListener = new DragListener(this._element, true);\n this._dragListener.on('dragStart', this._onDragStart, this);\n this._dragListener.on('dragStop', this._createDragListener, this);\n return this._dragListener;\n }\n\n /**\n * Callback for the DragListener's dragStart event\n *\n * @param x the x position of the mouse on dragStart\n * @param y the x position of the mouse on dragStart\n */\n _onDragStart(x: number, y: number) {\n let itemConfig = this._itemConfig;\n if (typeof itemConfig === 'function') {\n itemConfig = itemConfig();\n }\n const contentItem = this._layoutManager._$normalizeContentItem(\n $.extend(true, {}, itemConfig)\n ),\n dragProxy = new DragProxy(\n x,\n y,\n this._dragListener,\n this._layoutManager,\n contentItem,\n null\n );\n }\n}\n"],"mappings":";;;AAAA,OAAOA,CAAC,MAAM,QAAQ;AAAC,SAGdC,YAAY;AAAA,OACdC,SAAS;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,UAAU,CAAC;EAM9BC,WAAWA,CACTC,OAA4B,EAC5BC,UAAmD,EACnDC,aAA4B,EAC5B;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACA,IAAI,CAACC,QAAQ,GAAGJ,OAAO;IACvB,IAAI,CAACK,WAAW,GAAGJ,UAAU;IAC7B,IAAI,CAACK,cAAc,GAAGJ,aAAa;IAEnC,IAAI,CAACK,aAAa,GAAG,IAAI,CAACC,mBAAmB,CAAC,CAAC;EACjD;;EAEA;AACF;AACA;EACEA,mBAAmBA,CAAA,EAAG;IACpB,IAAI,CAACD,aAAa,GAAG,IAAIX,YAAY,CAAC,IAAI,CAACQ,QAAQ,EAAE,IAAI,CAAC;IAC1D,IAAI,CAACG,aAAa,CAACE,EAAE,CAAC,WAAW,EAAE,IAAI,CAACC,YAAY,EAAE,IAAI,CAAC;IAC3D,IAAI,CAACH,aAAa,CAACE,EAAE,CAAC,UAAU,EAAE,IAAI,CAACD,mBAAmB,EAAE,IAAI,CAAC;IACjE,OAAO,IAAI,CAACD,aAAa;EAC3B;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEG,YAAYA,CAACC,CAAS,EAAEC,CAAS,EAAE;IACjC,IAAIX,UAAU,GAAG,IAAI,CAACI,WAAW;IACjC,IAAI,OAAOJ,UAAU,KAAK,UAAU,EAAE;MACpCA,UAAU,GAAGA,UAAU,CAAC,CAAC;IAC3B;IACA,IAAMY,WAAW,GAAG,IAAI,CAACP,cAAc,CAACQ,sBAAsB,CAC1DnB,CAAC,CAACoB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EAAEd,UAAU,CAC/B,CAAC;MACDe,SAAS,GAAG,IAAInB,SAAS,CACvBc,CAAC,EACDC,CAAC,EACD,IAAI,CAACL,aAAa,EAClB,IAAI,CAACD,cAAc,EACnBO,WAAW,EACX,IACF,CAAC;EACL;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="jquery" />
|
|
2
2
|
/// <reference types="bootstrap" />
|
|
3
3
|
/// <reference types="jquery" />
|
|
4
|
-
import { StackItemHeaderConfig } from '../config';
|
|
5
4
|
import type { AbstractContentItem, Stack } from '../items';
|
|
5
|
+
import type { StackHeaderConfig } from '../items/Stack';
|
|
6
6
|
import type LayoutManager from '../LayoutManager';
|
|
7
7
|
import { EventEmitter } from '../utils';
|
|
8
8
|
import HeaderButton from './HeaderButton';
|
|
@@ -72,7 +72,7 @@ export default class Header extends EventEmitter {
|
|
|
72
72
|
*
|
|
73
73
|
* @returns previous header position
|
|
74
74
|
*/
|
|
75
|
-
position(position?: 'top' | 'left' | 'right' | 'bottom'): boolean | "
|
|
75
|
+
position(position?: 'top' | 'left' | 'right' | 'bottom'): boolean | "left" | "top" | "right" | "bottom" | undefined;
|
|
76
76
|
_attachWheelListener(): void;
|
|
77
77
|
_detachWheelListener(): void;
|
|
78
78
|
_handleWheelEvent(event: WheelEvent): void;
|
|
@@ -104,7 +104,7 @@ export default class Header extends EventEmitter {
|
|
|
104
104
|
*
|
|
105
105
|
* @returns when exists
|
|
106
106
|
*/
|
|
107
|
-
_getHeaderSetting<N extends 'show' | 'popout' | 'maximise' | 'close' | 'minimise'>(name: N):
|
|
107
|
+
_getHeaderSetting<N extends 'show' | 'popout' | 'maximise' | 'close' | 'minimise'>(name: N): StackHeaderConfig[N];
|
|
108
108
|
/**
|
|
109
109
|
* Creates the popout, maximise and close buttons in the header's top right corner
|
|
110
110
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/controls/Header.ts"],"names":[],"mappings":";;;AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/controls/Header.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,YAAY;IAC9C,OAAO,CAAC,MAAM,CAAC,SAAS,CAQb;IAEX,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAI3B;IAEX,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAEvB;IAEX,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,sBAAuB;IAE9B,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACnC,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC1C,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAQ;IAEnD,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAEvC,MAAM,EAAE,KAAK,CAAC;IAEd,IAAI,EAAE,GAAG,EAAE,CAAM;IACjB,iBAAiB,EAAE,mBAAmB,GAAG,IAAI,CAAQ;IACrD,WAAW,EAAE,YAAY,GAAG,IAAI,CAAQ;IAExC,iBAAiB,EAAE,YAAY,GAAG,IAAI,CAAQ;IAC9C,aA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