@deephaven/golden-layout 0.19.2-beta.5 → 0.20.0
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 +313 -0
- package/dist/LayoutManager.d.ts.map +1 -0
- package/dist/LayoutManager.js +468 -450
- package/dist/LayoutManager.js.map +1 -1
- package/dist/base.d.ts +16 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +6 -6
- package/dist/base.js.map +1 -1
- package/dist/config/Config.d.ts +146 -0
- package/dist/config/Config.d.ts.map +1 -0
- package/dist/config/{defaultConfig.js → Config.js} +6 -6
- package/dist/config/Config.js.map +1 -0
- package/dist/config/ItemConfig.d.ts +66 -0
- package/dist/config/ItemConfig.d.ts.map +1 -0
- package/dist/config/ItemConfig.js +14 -0
- package/dist/config/ItemConfig.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -6
- package/dist/config/index.js.map +1 -1
- package/dist/container/ItemContainer.d.ts +91 -0
- package/dist/container/ItemContainer.d.ts.map +1 -0
- package/dist/container/ItemContainer.js +110 -85
- package/dist/container/ItemContainer.js.map +1 -1
- package/dist/container/index.d.ts +3 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/container/index.js +2 -4
- package/dist/container/index.js.map +1 -1
- package/dist/controls/BrowserPopout.d.ts +83 -0
- package/dist/controls/BrowserPopout.d.ts.map +1 -0
- package/dist/controls/BrowserPopout.js +135 -101
- package/dist/controls/BrowserPopout.js.map +1 -1
- package/dist/controls/DragProxy.d.ts +67 -0
- package/dist/controls/DragProxy.d.ts.map +1 -0
- package/dist/controls/DragProxy.js +135 -110
- package/dist/controls/DragProxy.js.map +1 -1
- package/dist/controls/DragSource.d.ts +30 -0
- package/dist/controls/DragSource.d.ts.map +1 -0
- package/dist/controls/DragSource.js +37 -29
- package/dist/controls/DragSource.js.map +1 -1
- package/dist/controls/DragSourceFromEvent.d.ts +30 -0
- package/dist/controls/DragSourceFromEvent.d.ts.map +1 -0
- package/dist/controls/DragSourceFromEvent.js +49 -36
- package/dist/controls/DragSourceFromEvent.js.map +1 -1
- package/dist/controls/DropTargetIndicator.d.ts +14 -0
- package/dist/controls/DropTargetIndicator.d.ts.map +1 -0
- package/dist/controls/DropTargetIndicator.js +18 -14
- package/dist/controls/DropTargetIndicator.js.map +1 -1
- package/dist/controls/Header.d.ts +145 -0
- package/dist/controls/Header.d.ts.map +1 -0
- package/dist/controls/Header.js +414 -271
- package/dist/controls/Header.js.map +1 -1
- package/dist/controls/HeaderButton.d.ts +9 -0
- package/dist/controls/HeaderButton.d.ts.map +1 -0
- package/dist/controls/HeaderButton.js +19 -13
- package/dist/controls/HeaderButton.js.map +1 -1
- package/dist/controls/Splitter.d.ts +12 -0
- package/dist/controls/Splitter.d.ts.map +1 -0
- package/dist/controls/Splitter.js +36 -20
- package/dist/controls/Splitter.js.map +1 -1
- package/dist/controls/Tab.d.ts +91 -0
- package/dist/controls/Tab.d.ts.map +1 -0
- package/dist/controls/Tab.js +131 -119
- package/dist/controls/Tab.js.map +1 -1
- package/dist/controls/TransitionIndicator.d.ts +25 -0
- package/dist/controls/TransitionIndicator.d.ts.map +1 -0
- package/dist/controls/TransitionIndicator.js +53 -39
- package/dist/controls/TransitionIndicator.js.map +1 -1
- package/dist/controls/index.d.ts +11 -0
- package/dist/controls/index.d.ts.map +1 -0
- package/dist/controls/index.js +10 -22
- package/dist/controls/index.js.map +1 -1
- package/dist/errors/ConfigurationError.d.ts +6 -0
- package/dist/errors/ConfigurationError.d.ts.map +1 -0
- package/dist/errors/ConfigurationError.js +15 -8
- package/dist/errors/ConfigurationError.js.map +1 -1
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +1 -4
- package/dist/errors/index.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/items/AbstractContentItem.d.ts +233 -0
- package/dist/items/AbstractContentItem.d.ts.map +1 -0
- package/dist/items/AbstractContentItem.js +284 -242
- package/dist/items/AbstractContentItem.js.map +1 -1
- package/dist/items/Component.d.ts +30 -0
- package/dist/items/Component.d.ts.map +1 -0
- package/dist/items/Component.js +61 -42
- package/dist/items/Component.js.map +1 -1
- package/dist/items/Root.d.ts +18 -0
- package/dist/items/Root.d.ts.map +1 -0
- package/dist/items/Root.js +68 -38
- package/dist/items/Root.js.map +1 -1
- package/dist/items/RowOrColumn.d.ts +157 -0
- package/dist/items/RowOrColumn.d.ts.map +1 -0
- package/dist/items/RowOrColumn.js +219 -187
- package/dist/items/RowOrColumn.js.map +1 -1
- package/dist/items/Stack.d.ts +108 -0
- package/dist/items/Stack.d.ts.map +1 -0
- package/dist/items/Stack.js +218 -151
- package/dist/items/Stack.js.map +1 -1
- package/dist/items/index.d.ts +8 -0
- package/dist/items/index.d.ts.map +1 -0
- package/dist/items/index.js +7 -12
- package/dist/items/index.js.map +1 -1
- package/dist/utils/BubblingEvent.d.ts +8 -0
- package/dist/utils/BubblingEvent.d.ts.map +1 -0
- package/dist/utils/BubblingEvent.js +18 -9
- package/dist/utils/BubblingEvent.js.map +1 -1
- package/dist/utils/ConfigMinifier.d.ts +21 -0
- package/dist/utils/ConfigMinifier.d.ts.map +1 -0
- package/dist/utils/ConfigMinifier.js +121 -121
- package/dist/utils/ConfigMinifier.js.map +1 -1
- package/dist/utils/DragListener.d.ts +34 -0
- package/dist/utils/DragListener.d.ts.map +1 -0
- package/dist/utils/DragListener.js +103 -70
- package/dist/utils/DragListener.js.map +1 -1
- package/dist/utils/EventEmitter.d.ts +59 -0
- package/dist/utils/EventEmitter.d.ts.map +1 -0
- package/dist/utils/EventEmitter.js +64 -70
- package/dist/utils/EventEmitter.js.map +1 -1
- package/dist/utils/EventHub.d.ts +55 -0
- package/dist/utils/EventHub.d.ts.map +1 -0
- package/dist/utils/EventHub.js +83 -105
- package/dist/utils/EventHub.js.map +1 -1
- package/dist/utils/ReactComponentHandler.d.ts +54 -0
- package/dist/utils/ReactComponentHandler.d.ts.map +1 -0
- package/dist/utils/ReactComponentHandler.js +58 -56
- package/dist/utils/ReactComponentHandler.js.map +1 -1
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -21
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils.d.ts +25 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +21 -145
- package/dist/utils/utils.js.map +1 -1
- package/package.json +9 -5
- package/dist/config/ItemDefaultConfig.js +0 -8
- package/dist/config/ItemDefaultConfig.js.map +0 -1
- package/dist/config/defaultConfig.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
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,oBAAY,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function isGLComponentConfig(item) {
|
|
2
|
+
return item.componentName !== undefined;
|
|
3
|
+
}
|
|
4
|
+
export function isReactComponentConfig(item) {
|
|
5
|
+
return item.component !== undefined;
|
|
6
|
+
}
|
|
7
|
+
export var itemDefaultConfig = Object.freeze({
|
|
8
|
+
type: 'default',
|
|
9
|
+
isClosable: true,
|
|
10
|
+
isFocusOnShow: true,
|
|
11
|
+
reorderEnabled: true,
|
|
12
|
+
title: ''
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=ItemConfig.js.map
|
|
@@ -0,0 +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":["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,mBAAT,CACLC,IADK,EAEoB;EACzB,OAAQA,IAAD,CAA0BC,aAA1B,KAA4CC,SAAnD;AACD;AAED,OAAO,SAASC,sBAAT,CACLH,IADK,EAEyB;EAC9B,OAAQA,IAAD,CAA+BI,SAA/B,KAA6CF,SAApD;AACD;AAED,OAAO,IAAMG,iBAA6B,GAAGC,MAAM,CAACC,MAAP,CAAc;EACzDC,IAAI,EAAE,SADmD;EAEzDC,UAAU,EAAE,IAF6C;EAGzDC,aAAa,EAAE,IAH0C;EAIzDC,cAAc,EAAE,IAJyC;EAKzDC,KAAK,EAAE;AALkD,CAAd,CAAtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
defaultConfig,
|
|
5
|
-
itemDefaultConfig
|
|
6
|
-
};
|
|
1
|
+
export * from "./Config.js";
|
|
2
|
+
export * from "./ItemConfig.js";
|
|
7
3
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/config/index.ts"],"sourcesContent":["export * from './Config';\nexport * from './ItemConfig';\n"],"mappings":""}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ReactComponentConfig, ComponentConfig } from '../config';
|
|
2
|
+
import type Tab from '../controls/Tab';
|
|
3
|
+
import type { Component } from '../items';
|
|
4
|
+
import type LayoutManager from '../LayoutManager';
|
|
5
|
+
import EventEmitter from '../utils/EventEmitter';
|
|
6
|
+
export default class ItemContainer<C extends ComponentConfig | ReactComponentConfig = ComponentConfig> extends EventEmitter {
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
title?: string;
|
|
10
|
+
parent: Component;
|
|
11
|
+
layoutManager: LayoutManager;
|
|
12
|
+
tab?: Tab;
|
|
13
|
+
_config: C & {
|
|
14
|
+
componentState: Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
isHidden: boolean;
|
|
17
|
+
_element: JQuery<HTMLElement>;
|
|
18
|
+
_contentElement: JQuery<HTMLElement>;
|
|
19
|
+
constructor(config: C, parent: Component, layoutManager: LayoutManager);
|
|
20
|
+
/**
|
|
21
|
+
* Get the inner DOM element the container's content
|
|
22
|
+
* is intended to live in
|
|
23
|
+
*/
|
|
24
|
+
getElement(): JQuery<HTMLElement>;
|
|
25
|
+
/**
|
|
26
|
+
* Hide the container. Notifies the containers content first
|
|
27
|
+
* and then hides the DOM node. If the container is already hidden
|
|
28
|
+
* this should have no effect
|
|
29
|
+
*/
|
|
30
|
+
hide(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Shows a previously hidden container. Notifies the
|
|
33
|
+
* containers content first and then shows the DOM element.
|
|
34
|
+
* If the container is already visible this has no effect.
|
|
35
|
+
*/
|
|
36
|
+
show(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Set the size from within the container. Traverses up
|
|
39
|
+
* the item tree until it finds a row or column element
|
|
40
|
+
* and resizes its items accordingly.
|
|
41
|
+
*
|
|
42
|
+
* If this container isn't a descendant of a row or column
|
|
43
|
+
* it returns false
|
|
44
|
+
* @todo Rework!!!
|
|
45
|
+
* @param width The new width in pixel
|
|
46
|
+
* @param height The new height in pixel
|
|
47
|
+
*
|
|
48
|
+
* @returns resizeSuccesful
|
|
49
|
+
*/
|
|
50
|
+
setSize(width: number, height: number): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Closes the container if it is closable. Can be called by
|
|
53
|
+
* both the component within at as well as the contentItem containing
|
|
54
|
+
* it. Emits a close event before the container itself is closed.
|
|
55
|
+
*/
|
|
56
|
+
close(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the current state object
|
|
59
|
+
*
|
|
60
|
+
* @returns state
|
|
61
|
+
*/
|
|
62
|
+
getState(): Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Merges the provided state into the current one
|
|
65
|
+
*
|
|
66
|
+
* @param state
|
|
67
|
+
*/
|
|
68
|
+
extendState(state: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Notifies the layout manager of a stateupdate
|
|
71
|
+
*
|
|
72
|
+
* @param state
|
|
73
|
+
*/
|
|
74
|
+
setState(state: Record<string, unknown>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Set's the components title
|
|
77
|
+
*
|
|
78
|
+
* @param title
|
|
79
|
+
*/
|
|
80
|
+
setTitle(title: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Set's the containers size. Called by the container's component.
|
|
83
|
+
* To set the size programmatically from within the container please
|
|
84
|
+
* use the public setSize method
|
|
85
|
+
*
|
|
86
|
+
* @param width in px
|
|
87
|
+
* @param height in px
|
|
88
|
+
*/
|
|
89
|
+
_$setSize(width?: number, height?: number): void;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=ItemContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemContainer.d.ts","sourceRoot":"","sources":["../../src/container/ItemContainer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EAEpB,eAAe,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAuB,SAAS,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,aAAa,CAChC,CAAC,SAAS,eAAe,GAAG,oBAAoB,GAAG,eAAe,CAClE,SAAQ,YAAY;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,SAAS,CAAC;IAElB,aAAa,EAAE,aAAa,CAAC;IAE7B,GAAG,CAAC,EAAE,GAAG,CAAC;IAGV,OAAO,EAAE,CAAC,GAAG;QAAE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAEzD,QAAQ,UAAS;IAEjB,QAAQ,sBAMN;IAEF,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;gBAEzB,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa;IAYtE;;;OAGG;IACH,UAAU;IAIV;;;;OAIG;IACH,IAAI;IAMJ;;;;OAIG;IACH,IAAI;IAUJ;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IA6CrC;;;;OAIG;IACH,KAAK;IAOL;;;;OAIG;IACH,QAAQ;IAIR;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM;IAIzB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKvC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,SAAI,EAAE,MAAM,SAAI;CAahC"}
|
|
@@ -1,52 +1,69 @@
|
|
|
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
|
+
|
|
1
3
|
import $ from 'jquery';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
import { isGLComponentConfig } from "../config/index.js";
|
|
5
|
+
import EventEmitter from "../utils/EventEmitter.js";
|
|
6
|
+
export default class ItemContainer extends EventEmitter {
|
|
7
|
+
// This type is to make TS happy and allow ReactComponentConfig passed to container generic
|
|
8
|
+
constructor(config, parent, layoutManager) {
|
|
9
|
+
super();
|
|
10
|
+
|
|
11
|
+
_defineProperty(this, "width", void 0);
|
|
12
|
+
|
|
13
|
+
_defineProperty(this, "height", void 0);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "title", void 0);
|
|
16
|
+
|
|
17
|
+
_defineProperty(this, "parent", void 0);
|
|
18
|
+
|
|
19
|
+
_defineProperty(this, "layoutManager", void 0);
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "tab", void 0);
|
|
22
|
+
|
|
23
|
+
_defineProperty(this, "_config", void 0);
|
|
24
|
+
|
|
25
|
+
_defineProperty(this, "isHidden", false);
|
|
26
|
+
|
|
27
|
+
_defineProperty(this, "_element", $(['<div class="lm_item_container">', '<div class="lm_content" tabindex="-1"></div>', '</div>'].join('')));
|
|
28
|
+
|
|
29
|
+
_defineProperty(this, "_contentElement", void 0);
|
|
30
|
+
|
|
31
|
+
this.title = isGLComponentConfig(config) ? config.componentName : '';
|
|
32
|
+
this.parent = parent;
|
|
33
|
+
this.layoutManager = layoutManager;
|
|
34
|
+
this._config = config;
|
|
35
|
+
this._contentElement = this._element.find('.lm_content');
|
|
36
|
+
}
|
|
18
37
|
/**
|
|
19
38
|
* Get the inner DOM element the container's content
|
|
20
39
|
* is intended to live in
|
|
21
|
-
*
|
|
22
|
-
* @returns {DOM element}
|
|
23
40
|
*/
|
|
24
|
-
getElement: function getElement() {
|
|
25
|
-
return this._contentElement;
|
|
26
|
-
},
|
|
27
41
|
|
|
42
|
+
|
|
43
|
+
getElement() {
|
|
44
|
+
return this._contentElement;
|
|
45
|
+
}
|
|
28
46
|
/**
|
|
29
47
|
* Hide the container. Notifies the containers content first
|
|
30
48
|
* and then hides the DOM node. If the container is already hidden
|
|
31
49
|
* this should have no effect
|
|
32
|
-
*
|
|
33
|
-
* @returns {void}
|
|
34
50
|
*/
|
|
35
|
-
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
hide() {
|
|
36
54
|
this.emit('hide');
|
|
37
55
|
this.isHidden = true;
|
|
38
56
|
|
|
39
57
|
this._element.hide();
|
|
40
|
-
}
|
|
41
|
-
|
|
58
|
+
}
|
|
42
59
|
/**
|
|
43
60
|
* Shows a previously hidden container. Notifies the
|
|
44
61
|
* containers content first and then shows the DOM element.
|
|
45
62
|
* If the container is already visible this has no effect.
|
|
46
|
-
*
|
|
47
|
-
* @returns {void}
|
|
48
63
|
*/
|
|
49
|
-
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
show() {
|
|
50
67
|
this.emit('show');
|
|
51
68
|
this.isHidden = false;
|
|
52
69
|
|
|
@@ -56,8 +73,7 @@ utils.copy(ItemContainer.prototype, {
|
|
|
56
73
|
if (this.height != 0 || this.width != 0) {
|
|
57
74
|
this.emit('shown');
|
|
58
75
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
76
|
+
}
|
|
61
77
|
/**
|
|
62
78
|
* Set the size from within the container. Traverses up
|
|
63
79
|
* the item tree until it finds a row or column element
|
|
@@ -66,115 +82,124 @@ utils.copy(ItemContainer.prototype, {
|
|
|
66
82
|
* If this container isn't a descendant of a row or column
|
|
67
83
|
* it returns false
|
|
68
84
|
* @todo Rework!!!
|
|
69
|
-
* @param
|
|
70
|
-
* @param
|
|
85
|
+
* @param width The new width in pixel
|
|
86
|
+
* @param height The new height in pixel
|
|
71
87
|
*
|
|
72
|
-
* @returns
|
|
88
|
+
* @returns resizeSuccesful
|
|
73
89
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
setSize(width, height) {
|
|
93
|
+
var _this$direction, _rowOrColumnChild$con, _rowOrColumnChild$con2;
|
|
94
|
+
|
|
95
|
+
var rowOrColumn = this.parent;
|
|
96
|
+
var rowOrColumnChild = null;
|
|
97
|
+
|
|
98
|
+
while (rowOrColumn && !rowOrColumn.isColumn && !rowOrColumn.isRow) {
|
|
99
|
+
var _rowOrColumn;
|
|
100
|
+
|
|
85
101
|
rowOrColumnChild = rowOrColumn;
|
|
86
102
|
rowOrColumn = rowOrColumn.parent;
|
|
87
103
|
/**
|
|
88
104
|
* No row or column has been found
|
|
89
105
|
*/
|
|
90
106
|
|
|
91
|
-
if (rowOrColumn.isRoot) {
|
|
107
|
+
if ((_rowOrColumn = rowOrColumn) !== null && _rowOrColumn !== void 0 && _rowOrColumn.isRoot) {
|
|
92
108
|
return false;
|
|
93
109
|
}
|
|
94
110
|
}
|
|
95
111
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
if (!rowOrColumn || !rowOrColumnChild) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var direction = rowOrColumn.isColumn ? 'height' : 'width';
|
|
117
|
+
var newSize = direction === 'height' ? height : width;
|
|
118
|
+
var totalPixel = ((_this$direction = this[direction]) !== null && _this$direction !== void 0 ? _this$direction : 0) * (1 / (((_rowOrColumnChild$con = rowOrColumnChild.config[direction]) !== null && _rowOrColumnChild$con !== void 0 ? _rowOrColumnChild$con : 0) / 100));
|
|
119
|
+
var percentage = newSize / totalPixel * 100;
|
|
120
|
+
var delta = (((_rowOrColumnChild$con2 = rowOrColumnChild.config[direction]) !== null && _rowOrColumnChild$con2 !== void 0 ? _rowOrColumnChild$con2 : 0) - percentage) / (rowOrColumn.contentItems.length - 1);
|
|
101
121
|
|
|
102
|
-
for (i = 0; i < rowOrColumn.contentItems.length; i++) {
|
|
122
|
+
for (var i = 0; i < rowOrColumn.contentItems.length; i++) {
|
|
103
123
|
if (rowOrColumn.contentItems[i] === rowOrColumnChild) {
|
|
104
124
|
rowOrColumn.contentItems[i].config[direction] = percentage;
|
|
105
125
|
} else {
|
|
106
|
-
|
|
126
|
+
var _rowOrColumn$contentI;
|
|
127
|
+
|
|
128
|
+
rowOrColumn.contentItems[i].config[direction] = ((_rowOrColumn$contentI = rowOrColumn.contentItems[i].config[direction]) !== null && _rowOrColumn$contentI !== void 0 ? _rowOrColumn$contentI : 0) + delta;
|
|
107
129
|
}
|
|
108
130
|
}
|
|
109
131
|
|
|
110
132
|
rowOrColumn.callDownwards('setSize');
|
|
111
133
|
return true;
|
|
112
|
-
}
|
|
113
|
-
|
|
134
|
+
}
|
|
114
135
|
/**
|
|
115
136
|
* Closes the container if it is closable. Can be called by
|
|
116
137
|
* both the component within at as well as the contentItem containing
|
|
117
138
|
* it. Emits a close event before the container itself is closed.
|
|
118
|
-
*
|
|
119
|
-
* @returns {void}
|
|
120
139
|
*/
|
|
121
|
-
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
close() {
|
|
122
143
|
if (this._config.isClosable) {
|
|
123
144
|
this.emit('close');
|
|
124
145
|
this.parent.close();
|
|
125
146
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
147
|
+
}
|
|
128
148
|
/**
|
|
129
149
|
* Returns the current state object
|
|
130
150
|
*
|
|
131
|
-
* @returns
|
|
151
|
+
* @returns state
|
|
132
152
|
*/
|
|
133
|
-
getState: function getState() {
|
|
134
|
-
return this._config.componentState;
|
|
135
|
-
},
|
|
136
153
|
|
|
154
|
+
|
|
155
|
+
getState() {
|
|
156
|
+
return this._config.componentState;
|
|
157
|
+
}
|
|
137
158
|
/**
|
|
138
159
|
* Merges the provided state into the current one
|
|
139
160
|
*
|
|
140
|
-
* @param
|
|
141
|
-
*
|
|
142
|
-
* @returns {void}
|
|
161
|
+
* @param state
|
|
143
162
|
*/
|
|
144
|
-
extendState: function extendState(state) {
|
|
145
|
-
this.setState($.extend(true, this.getState(), state));
|
|
146
|
-
},
|
|
147
163
|
|
|
164
|
+
|
|
165
|
+
extendState(state) {
|
|
166
|
+
this.setState($.extend(true, this.getState(), state));
|
|
167
|
+
}
|
|
148
168
|
/**
|
|
149
169
|
* Notifies the layout manager of a stateupdate
|
|
150
170
|
*
|
|
151
|
-
* @param
|
|
171
|
+
* @param state
|
|
152
172
|
*/
|
|
153
|
-
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
setState(state) {
|
|
154
176
|
this._config.componentState = state;
|
|
155
177
|
this.parent.emitBubblingEvent('stateChanged');
|
|
156
|
-
}
|
|
157
|
-
|
|
178
|
+
}
|
|
158
179
|
/**
|
|
159
180
|
* Set's the components title
|
|
160
181
|
*
|
|
161
|
-
* @param
|
|
182
|
+
* @param title
|
|
162
183
|
*/
|
|
163
|
-
setTitle: function setTitle(title) {
|
|
164
|
-
this.parent.setTitle(title);
|
|
165
|
-
},
|
|
166
184
|
|
|
185
|
+
|
|
186
|
+
setTitle(title) {
|
|
187
|
+
this.parent.setTitle(title);
|
|
188
|
+
}
|
|
167
189
|
/**
|
|
168
190
|
* Set's the containers size. Called by the container's component.
|
|
169
191
|
* To set the size programmatically from within the container please
|
|
170
192
|
* use the public setSize method
|
|
171
193
|
*
|
|
172
|
-
* @param
|
|
173
|
-
* @param
|
|
174
|
-
*
|
|
175
|
-
* @returns {void}
|
|
194
|
+
* @param width in px
|
|
195
|
+
* @param height in px
|
|
176
196
|
*/
|
|
177
|
-
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
_$setSize() {
|
|
200
|
+
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
201
|
+
var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
202
|
+
|
|
178
203
|
if (width !== this.width || height !== this.height) {
|
|
179
204
|
this.width = width;
|
|
180
205
|
this.height = height;
|
|
@@ -187,6 +212,6 @@ utils.copy(ItemContainer.prototype, {
|
|
|
187
212
|
this.emit('resize');
|
|
188
213
|
}
|
|
189
214
|
}
|
|
190
|
-
|
|
191
|
-
|
|
215
|
+
|
|
216
|
+
}
|
|
192
217
|
//# sourceMappingURL=ItemContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemContainer.js","names":["$","utils","ItemContainer","config","parent","layoutManager","EventEmitter","call","width","height","title","componentName","isHidden","_config","_element","join","_contentElement","find","copy","prototype","getElement","hide","emit","show","setSize","rowOrColumn","rowOrColumnChild","totalPixel","percentage","direction","newSize","delta","i","isColumn","isRow","isRoot","contentItems","length","callDownwards","close","isClosable","getState","componentState","extendState","state","setState","extend","emitBubblingEvent","setTitle","_$setSize","cl","hdelta","offsetWidth","clientWidth","vdelta","offsetHeight","clientHeight"],"sources":["../../src/container/ItemContainer.js"],"sourcesContent":["import $ from 'jquery';\nimport utils from '../utils/index.js';\n\nconst ItemContainer = function (config, parent, layoutManager) {\n utils.EventEmitter.call(this);\n\n this.width = null;\n this.height = null;\n this.title = config.componentName;\n this.parent = parent;\n this.layoutManager = layoutManager;\n this.isHidden = false;\n\n this._config = config;\n this._element = $(\n [\n '<div class=\"lm_item_container\">',\n '<div class=\"lm_content\" tabindex=\"-1\"></div>',\n '</div>',\n ].join('')\n );\n\n this._contentElement = this._element.find('.lm_content');\n};\n\nutils.copy(ItemContainer.prototype, {\n /**\n * Get the inner DOM element the container's content\n * is intended to live in\n *\n * @returns {DOM element}\n */\n getElement: function () {\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 * @returns {void}\n */\n hide: function () {\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 * @returns {void}\n */\n show: function () {\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 {Number} width The new width in pixel\n * @param {Number} height The new height in pixel\n *\n * @returns {Boolean} resizeSuccesful\n */\n setSize: function (width, height) {\n var rowOrColumn = this.parent,\n rowOrColumnChild = this,\n totalPixel,\n percentage,\n direction,\n newSize,\n delta,\n i;\n\n while (!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 direction = rowOrColumn.isColumn ? 'height' : 'width';\n newSize = direction === 'height' ? height : width;\n\n totalPixel =\n this[direction] * (1 / (rowOrColumnChild.config[direction] / 100));\n percentage = (newSize / totalPixel) * 100;\n delta =\n (rowOrColumnChild.config[direction] - percentage) /\n (rowOrColumn.contentItems.length - 1);\n\n for (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] += 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 * @returns {void}\n */\n close: function () {\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 {Object} state\n */\n getState: function () {\n return this._config.componentState;\n },\n\n /**\n * Merges the provided state into the current one\n *\n * @param {Object} state\n *\n * @returns {void}\n */\n extendState: function (state) {\n this.setState($.extend(true, this.getState(), state));\n },\n\n /**\n * Notifies the layout manager of a stateupdate\n *\n * @param {serialisable} state\n */\n setState: function (state) {\n this._config.componentState = state;\n this.parent.emitBubblingEvent('stateChanged');\n },\n\n /**\n * Set's the components title\n *\n * @param {String} title\n */\n setTitle: function (title) {\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 {[Int]} width in px\n * @param {[Int]} height in px\n *\n * @returns {void}\n */\n _$setSize: function (width, height) {\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\nexport default ItemContainer;\n"],"mappings":"AAAA,OAAOA,CAAP,MAAc,QAAd;AACA,OAAOC,KAAP,MAAkB,mBAAlB;;AAEA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAAUC,MAAV,EAAkBC,MAAlB,EAA0BC,aAA1B,EAAyC;EAC7DJ,KAAK,CAACK,YAAN,CAAmBC,IAAnB,CAAwB,IAAxB;EAEA,KAAKC,KAAL,GAAa,IAAb;EACA,KAAKC,MAAL,GAAc,IAAd;EACA,KAAKC,KAAL,GAAaP,MAAM,CAACQ,aAApB;EACA,KAAKP,MAAL,GAAcA,MAAd;EACA,KAAKC,aAAL,GAAqBA,aAArB;EACA,KAAKO,QAAL,GAAgB,KAAhB;EAEA,KAAKC,OAAL,GAAeV,MAAf;EACA,KAAKW,QAAL,GAAgBd,CAAC,CACf,CACE,iCADF,EAEE,8CAFF,EAGE,QAHF,EAIEe,IAJF,CAIO,EAJP,CADe,CAAjB;EAQA,KAAKC,eAAL,GAAuB,KAAKF,QAAL,CAAcG,IAAd,CAAmB,aAAnB,CAAvB;AACD,CApBD;;AAsBAhB,KAAK,CAACiB,IAAN,CAAWhB,aAAa,CAACiB,SAAzB,EAAoC;EACl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CAAS,IAAT,EAAe,KAAKL,QAAL,EAAf,EAAgCG,KAAhC,CAAd;EACD,CAnIiC;;EAqIlC;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAE,kBAAUD,KAAV,EAAiB;IACzB,KAAK/B,OAAL,CAAa6B,cAAb,GAA8BE,KAA9B;IACA,KAAKxC,MAAL,CAAY2C,iBAAZ,CAA8B,cAA9B;EACD,CA7IiC;;EA+IlC;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAE,kBAAUtC,KAAV,EAAiB;IACzB,KAAKN,MAAL,CAAY4C,QAAZ,CAAqBtC,KAArB;EACD,CAtJiC;;EAwJlC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEuC,SAAS,EAAE,mBAAUzC,KAAV,EAAiBC,MAAjB,EAAyB;IAClC,IAAID,KAAK,KAAK,KAAKA,KAAf,IAAwBC,MAAM,KAAK,KAAKA,MAA5C,EAAoD;MAClD,KAAKD,KAAL,GAAaA,KAAb;MACA,KAAKC,MAAL,GAAcA,MAAd;MACA,IAAIyC,EAAE,GAAG,KAAKlC,eAAL,CAAqB,CAArB,CAAT;MACA,IAAImC,MAAM,GAAGD,EAAE,CAACE,WAAH,GAAiBF,EAAE,CAACG,WAAjC;MACA,IAAIC,MAAM,GAAGJ,EAAE,CAACK,YAAH,GAAkBL,EAAE,CAACM,YAAlC;;MACA,KAAKxC,eAAL,CACGR,KADH,CACS,KAAKA,KAAL,GAAa2C,MADtB,EAEG1C,MAFH,CAEU,KAAKA,MAAL,GAAc6C,MAFxB;;MAGA,KAAKhC,IAAL,CAAU,QAAV;IACD;EACF;AA9KiC,CAApC;AAiLA,eAAepB,aAAf"}
|
|
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,SAELD,YAFK,CAEQ;EAYrB;EAeAE,WAAW,CAACC,MAAD,EAAYC,MAAZ,EAA+BC,aAA/B,EAA6D;IACtE;;IADsE;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA,kCAZ7D,KAY6D;;IAAA,kCAV7DP,CAAC,CACV,CACE,iCADF,EAEE,8CAFF,EAGE,QAHF,EAIEQ,IAJF,CAIO,EAJP,CADU,CAU4D;;IAAA;;IAGtE,KAAKC,KAAL,GAAaR,mBAAmB,CAACI,MAAD,CAAnB,GAA8BA,MAAM,CAACK,aAArC,GAAqD,EAAlE;IACA,KAAKJ,MAAL,GAAcA,MAAd;IACA,KAAKC,aAAL,GAAqBA,aAArB;IAEA,KAAKI,OAAL,GAAeN,MAAf;IAEA,KAAKO,eAAL,GAAuB,KAAKC,QAAL,CAAcC,IAAd,CAAmB,aAAnB,CAAvB;EACD;EAED;AACF;AACA;AACA;;;EACEC,UAAU,GAAG;IACX,OAAO,KAAKH,eAAZ;EACD;EAED;AACF;AACA;AACA;AACA;;;EACEI,IAAI,GAAG;IACL,KAAKC,IAAL,CAAU,MAAV;IACA,KAAKC,QAAL,GAAgB,IAAh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IACvC,KAAK/B,OAAL,CAAa6B,cAAb,GAA8BE,KAA9B;IACA,KAAKpC,MAAL,CAAYuC,iBAAZ,CAA8B,cAA9B;EACD;EAED;AACF;AACA;AACA;AACA;;;EACEC,QAAQ,CAACrC,KAAD,EAAgB;IACtB,KAAKH,MAAL,CAAYwC,QAAZ,CAAqBrC,KAArB;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;EACEsC,SAAS,GAAwB;IAAA,IAAvB1B,KAAuB,uEAAf,CAAe;IAAA,IAAZD,MAAY,uEAAH,CAAG;;IAC/B,IAAIC,KAAK,KAAK,KAAKA,KAAf,IAAwBD,MAAM,KAAK,KAAKA,MAA5C,EAAoD;MAClD,KAAKC,KAAL,GAAaA,KAAb;MACA,KAAKD,MAAL,GAAcA,MAAd;MACA,IAAI4B,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/container/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ItemContainer"],"sources":["../../src/container/index.
|
|
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,a;SACXD,OAAO,IAAIE,S"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { PopoutConfig, ItemConfigType } from '../config';
|
|
2
|
+
import type LayoutManager from '../LayoutManager';
|
|
3
|
+
import { EventEmitter } from '../utils';
|
|
4
|
+
declare type BrowserDimensions = {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
top: number;
|
|
8
|
+
left: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Pops a content item out into a new browser window.
|
|
12
|
+
* This is achieved by
|
|
13
|
+
*
|
|
14
|
+
* - Creating a new configuration with the content item as root element
|
|
15
|
+
* - Serializing and minifying the configuration
|
|
16
|
+
* - Opening the current window's URL with the configuration as a GET parameter
|
|
17
|
+
* - GoldenLayout when opened in the new window will look for the GET parameter
|
|
18
|
+
* and use it instead of the provided configuration
|
|
19
|
+
*
|
|
20
|
+
* @param config GoldenLayout item config
|
|
21
|
+
* @param dimensions A map with width, height, top and left
|
|
22
|
+
* @param parentId The id of the element the item will be appended to on popIn
|
|
23
|
+
* @param indexInParent The position of this element within its parent
|
|
24
|
+
* @param layoutManager
|
|
25
|
+
*/
|
|
26
|
+
export default class BrowserPopout extends EventEmitter {
|
|
27
|
+
isInitialised: boolean;
|
|
28
|
+
private _config;
|
|
29
|
+
private _dimensions;
|
|
30
|
+
private _parentId;
|
|
31
|
+
private _indexInParent;
|
|
32
|
+
private _layoutManager;
|
|
33
|
+
private _popoutWindow;
|
|
34
|
+
private _id;
|
|
35
|
+
constructor(config: ItemConfigType[], dimensions: BrowserDimensions, parentId: string, indexInParent: number, layoutManager: LayoutManager);
|
|
36
|
+
toConfig(): PopoutConfig;
|
|
37
|
+
getGlInstance(): LayoutManager | undefined;
|
|
38
|
+
getWindow(): (Window & {
|
|
39
|
+
__glInstance: LayoutManager;
|
|
40
|
+
}) | null;
|
|
41
|
+
close(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the popped out item to its original position. If the original
|
|
44
|
+
* parent isn't available anymore it falls back to the layout's topmost element
|
|
45
|
+
*/
|
|
46
|
+
popIn(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Creates the URL and window parameter
|
|
49
|
+
* and opens a new window
|
|
50
|
+
*/
|
|
51
|
+
_createWindow(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Serialises a map of key:values to a window options string
|
|
54
|
+
*
|
|
55
|
+
* @param windowOptions
|
|
56
|
+
*
|
|
57
|
+
* @returns serialised window options
|
|
58
|
+
*/
|
|
59
|
+
_serializeWindowOptions(windowOptions: Record<string, unknown>): string;
|
|
60
|
+
/**
|
|
61
|
+
* Creates the URL for the new window, including the
|
|
62
|
+
* config GET parameter
|
|
63
|
+
*
|
|
64
|
+
* @returns URL
|
|
65
|
+
*/
|
|
66
|
+
_createUrl(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Move the newly created window roughly to
|
|
69
|
+
* where the component used to be.
|
|
70
|
+
*/
|
|
71
|
+
_positionWindow(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Callback when the new window is opened and the GoldenLayout instance
|
|
74
|
+
* within it is initialised
|
|
75
|
+
*/
|
|
76
|
+
_onInitialised(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Invoked 50ms after the window unload event
|
|
79
|
+
*/
|
|
80
|
+
_onClose(): void;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=BrowserPopout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,kBAA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