@deephaven/golden-layout
Version:
A multi-screen javascript Layout manager
109 lines • 3.5 kB
TypeScript
import { ReactComponentConfig, ComponentConfig } from '../config';
import type Tab from '../controls/Tab';
import type { Component } from '../items';
import type LayoutManager from '../LayoutManager';
import EventEmitter from '../utils/EventEmitter';
export type CloseOptions = {
force?: boolean;
};
export default class ItemContainer<C extends ComponentConfig | ReactComponentConfig = ComponentConfig> extends EventEmitter {
width?: number;
height?: number;
title?: string;
parent: Component;
layoutManager: LayoutManager;
tab?: Tab;
_config: C & {
componentState: Record<string, unknown>;
};
isHidden: boolean;
beforeCloseHandler: ((options?: CloseOptions) => boolean) | null;
_element: JQuery<HTMLElement>;
_contentElement: JQuery<HTMLElement>;
constructor(config: C, parent: Component, layoutManager: LayoutManager);
/**
* Get the inner DOM element the container's content
* is intended to live in
*/
getElement(): JQuery<HTMLElement>;
/**
* Hide the container. Notifies the containers content first
* and then hides the DOM node. If the container is already hidden
* this should have no effect
*/
hide(): void;
/**
* Shows a previously hidden container. Notifies the
* containers content first and then shows the DOM element.
* If the container is already visible this has no effect.
*/
show(): void;
/**
* Set the size from within the container. Traverses up
* the item tree until it finds a row or column element
* and resizes its items accordingly.
*
* If this container isn't a descendant of a row or column
* it returns false
* @todo Rework!!!
* @param width The new width in pixel
* @param height The new height in pixel
*
* @returns resizeSuccesful
*/
setSize(width: number, height: number): boolean;
/**
* Closes the container if it is closable. Can be called by
* both the component within at as well as the contentItem containing
* it. Emits a close event before the container itself is closed.
* @param options Options to pass into the beforeClose handler
*/
close(options?: CloseOptions): void;
/**
* Sets the beforeCloseHandler to callback
* @param callback Callback function to call before closing
*/
beforeClose(callback: ((options?: CloseOptions) => boolean) | null): void;
/**
* Returns the current state object
*
* @returns state
*/
getState(): Record<string, unknown>;
/**
* Returns the object's config
*
* @returns id
*/
getConfig(): C & {
componentState: Record<string, unknown>;
};
/**
* Merges the provided state into the current one
*
* @param state
*/
extendState(state: string): void;
/**
* Notifies the layout manager of a stateupdate
*
* @param state
*/
setState(state: Record<string, unknown>): void;
/**
* Set's the components title
*
* @param title
*/
setTitle(title: string): void;
/**
* Set's the containers size. Called by the container's component.
* To set the size programmatically from within the container please
* use the public setSize method
*
* @param width in px
* @param height in px
*/
_$setSize(width?: number, height?: number): void;
}
//# sourceMappingURL=ItemContainer.d.ts.map