UNPKG

@deephaven/golden-layout

Version:

A multi-screen javascript Layout manager

94 lines 3.94 kB
import AbstractContentItem from './AbstractContentItem'; import type LayoutManager from '../LayoutManager'; import type { ItemConfig, StackItemConfig, StackItemHeaderConfig } from '../config'; import { Header } from '../controls'; interface HoverDimensions { hoverArea: { x1: number; y1: number; x2: number; y2: number; }; highlightArea: { x1: number; y1: number; x2: number; y2: number; }; } type ContentAreaDimensions = { header: HoverDimensions; body?: HoverDimensions; top?: HoverDimensions; bottom?: HoverDimensions; left?: HoverDimensions; right?: HoverDimensions; }; type BodySegment = keyof ContentAreaDimensions; export default class Stack extends AbstractContentItem { private _activeContentItem; _header: StackItemHeaderConfig; childElementContainer: JQuery<HTMLElement>; header: Header; parent: AbstractContentItem | null; isStack: boolean; private _dropSegment; _contentAreaDimensions: ContentAreaDimensions | null; private _dropIndex; _side: boolean | 'top' | 'left' | 'right' | 'bottom'; _sided: boolean; config: StackItemConfig; constructor(layoutManager: LayoutManager & { config: LayoutManager['config'] & { header?: StackItemHeaderConfig; }; }, config: StackItemConfig, parent: AbstractContentItem | null); setSize(): void; _$init(): void; setActiveContentItem(contentItem: AbstractContentItem, forceFocus?: boolean): void; getActiveContentItem(): AbstractContentItem | null; addChild(contentItem: AbstractContentItem | ItemConfig, index?: number): void; removeChild(contentItem: AbstractContentItem, keepChild?: boolean): void; /** * Validates that the stack is still closable or not. If a stack is able * to close, but has a non closable component added to it, the stack is no * longer closable until all components are closable. */ _$validateClosability(): void; _$destroy(): void; /** * Ok, this one is going to be the tricky one: The user has dropped {contentItem} onto this stack. * * It was dropped on either the stacks header or the top, right, bottom or left bit of the content area * (which one of those is stored in this._dropSegment). Now, if the user has dropped on the header the case * is relatively clear: We add the item to the existing stack... job done (might be good to have * tab reordering at some point, but lets not sweat it right now) * * If the item was dropped on the content part things are a bit more complicated. If it was dropped on either the * top or bottom region we need to create a new column and place the items accordingly. * Unless, of course if the stack is already within a column... in which case we want * to add the newly created item to the existing column... * either prepend or append it, depending on wether its top or bottom. * * Same thing for rows and left / right drop segments... so in total there are 9 things that can potentially happen * (left, top, right, bottom) * is child of the right parent (row, column) + header drop * * @param contentItem */ _$onDrop(contentItem: AbstractContentItem): void; /** * If the user hovers above the header part of the stack, indicate drop positions for tabs. * otherwise indicate which segment of the body the dragged item would be dropped on * * @param x Absolute Screen X * @param y Absolute Screen Y */ _$highlightDropZone(x: number, y: number): void; _$getArea(): import("./AbstractContentItem").ItemArea<this> | null; _highlightHeaderDropZone(x: number): void; _resetHeaderDropZone(): void; _setupHeaderPosition(): void; _highlightBodyDropZone(segment: BodySegment): void; } export {}; //# sourceMappingURL=Stack.d.ts.map