@deephaven/golden-layout
Version:
A multi-screen javascript Layout manager
83 lines • 2.68 kB
TypeScript
import type { PopoutConfig, ItemConfig } from '../config';
import type LayoutManager from '../LayoutManager';
import { EventEmitter } from '../utils';
type BrowserDimensions = {
width: number;
height: number;
top: number;
left: number;
};
/**
* Pops a content item out into a new browser window.
* This is achieved by
*
* - Creating a new configuration with the content item as root element
* - Serializing and minifying the configuration
* - Opening the current window's URL with the configuration as a GET parameter
* - GoldenLayout when opened in the new window will look for the GET parameter
* and use it instead of the provided configuration
*
* @param config GoldenLayout item config
* @param dimensions A map with width, height, top and left
* @param parentId The id of the element the item will be appended to on popIn
* @param indexInParent The position of this element within its parent
* @param layoutManager
*/
export default class BrowserPopout extends EventEmitter {
isInitialised: boolean;
private _config;
private _dimensions;
private _parentId;
private _indexInParent;
private _layoutManager;
private _popoutWindow;
private _id;
constructor(config: ItemConfig[], dimensions: BrowserDimensions, parentId: string, indexInParent: number, layoutManager: LayoutManager);
toConfig(): PopoutConfig;
getGlInstance(): LayoutManager | undefined;
getWindow(): (Window & {
__glInstance: LayoutManager;
}) | null;
close(): void;
/**
* Returns the popped out item to its original position. If the original
* parent isn't available anymore it falls back to the layout's topmost element
*/
popIn(): void;
/**
* Creates the URL and window parameter
* and opens a new window
*/
_createWindow(): void;
/**
* Serialises a map of key:values to a window options string
*
* @param windowOptions
*
* @returns serialised window options
*/
_serializeWindowOptions(windowOptions: Record<string, unknown>): string;
/**
* Creates the URL for the new window, including the
* config GET parameter
*
* @returns URL
*/
_createUrl(): string;
/**
* Move the newly created window roughly to
* where the component used to be.
*/
_positionWindow(): void;
/**
* Callback when the new window is opened and the GoldenLayout instance
* within it is initialised
*/
_onInitialised(): void;
/**
* Invoked 50ms after the window unload event
*/
_onClose(): void;
}
export {};
//# sourceMappingURL=BrowserPopout.d.ts.map