import { DockLocation } from "./DockLocation"; import { IGlobalAttributes, ITabGroupAttributes, IJsonRect, IJsonRowNode, IJsonTabNode, IRowAttributes, ISubLayoutAttributes, ITabAttributes, ITabSetAttributes, IBorderAttributes } from "./IJsonModel"; import { ILayoutType } from "./IJsonModel"; import { Rect } from "./Rect"; /** Action creators for FlexLayout model mutations. */ export declare class Actions { static ADD_TAB: string; static DELETE_TAB: string; static RENAME_TAB: string; static SET_TAB_PINNED: string; static SET_BORDER_TYPE: string; static SELECT_TAB: string; static MOVE_NODE: string; static DELETE_TABSET: string; static SET_ACTIVE_TABSET: string; static ADJUST_WEIGHTS: string; static ADJUST_BORDER_SPLIT: string; static MAXIMIZE_TOGGLE: string; static UPDATE_MODEL_ATTRIBUTES: string; static UPDATE_NODE_ATTRIBUTES: string; static UPDATE_SUBLAYOUT_ATTRIBUTES: string; static POPOUT_TAB: string; static POPOUT_TABSET: string; static CLOSE_POPOUT: string; static MOVE_FLOAT_TO_FRONT: string; static MOVE_FLOAT: string; static DOCK_FLOAT_TO_LAYOUT: string; static POPOUT_FLOAT: string; static CREATE_SUBLAYOUT: string; static ADD_TAB_TO_NEW_GROUP: string; static UNGROUP: string; static REMOVE_TAB_FROM_GROUP: string; static GROUP: string; /** * Groups multiple actions into a single {@link GroupAction}. When performed, the model applies * the contained actions in sequence between a single `onBeforeAction`/`onAfterAction` listener * pair, so the batch is a single undo step and a single entry in an action log. * @param actions the actions to perform together, in order * @returns {GroupAction} the group action */ static group(actions: Action[]): GroupAction; /** * Adds a tab node to the given tabset node * @param json the json for the new tab node e.g {type:"tab", component:"table"} * @param toNodeId the new tab node will be added to the tabset with this node id * @param location the location where the new tab will be added, one of the DockLocation enum values. * @param index for docking to the center this value is the index of the tab, use -1 to add to the end. * @param select (optional) whether to select the new tab, overriding autoSelectTab * @returns {Action} the action */ static addTab(json: IJsonTabNode, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action; /** @deprecated use 'addTab' instead */ static addNode(json: IJsonTabNode, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action; /** * Moves a node (tab or tabset) from one location to another * @param fromNodeId the id of the node to move * @param toNodeId the id of the node to receive the moved node * @param location the location where the moved node will be added, one of the DockLocation enum values. * @param index for docking to the center this value is the index of the tab, use -1 to add to the end. * @param select (optional) whether to select the moved tab(s) in new tabset, overriding autoSelectTab * @returns {Action} the action */ static moveNode(fromNodeId: string, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action; /** * Deletes a tab node from the layout * @param tabNodeId the id of the tab node to delete * @returns {Action} the action */ static deleteTab(tabNodeId: string): Action; /** * Deletes a tabset node and all it's child tab nodes from the layout * @param tabsetNodeId the id of the tabset node to delete * @returns {Action} the action */ static deleteTabset(tabsetNodeId: string): Action; /** * Change the given nodes tab text * @param tabNodeId the id of the tab node to rename * @param text the test of the tab * @returns {Action} the action */ static renameTab(tabNodeId: string, text: string): Action; /** * Pins or unpins the given tab; pinning moves it to the end of the pinned group at the * start of its tabset's tabstrip, unpinning moves it to the start of the unpinned tabs. * Only applies to tabs in tabsets (ignored for border tabs). * @param tabNodeId the id of the tab node to pin/unpin * @param pinned the new pinned state * @returns {Action} the action */ static setTabPinned(tabNodeId: string, pinned: boolean): Action; /** * Sets the display type of the given border. In 'overlay' mode the selected tab's panel * overlays the main layout area instead of insetting it (Visual Studio style auto hide), * and is deselected by a pointer-down in the main layout area. * @param borderNodeId the id of the border node (border ids are "border_" + location, e.g. "border_left") * @param borderType the new border type * @returns {Action} the action */ static setBorderType(borderNodeId: string, borderType: "split" | "overlay"): Action; /** * Selects the given tab in its parent tabset * @param tabNodeId the id of the tab node to set selected * @returns {Action} the action */ static selectTab(tabNodeId: string): Action; /** * Set the given tabset node as the active tabset * @param tabsetNodeId the id of the tabset node to set as active * @returns {Action} the action */ static setActiveTabset(tabsetNodeId: string | undefined, layoutId?: string | undefined): Action; /** * Adjust the weights of a row, used when the splitter is moved * @param nodeId the id of the row node whose childrens weights are being adjusted * @param weights an array of weights to be applied to the children * @returns {Action} the action */ static adjustWeights(nodeId: string, weights: number[]): Action; /** * Adjust the size of the border * @param nodeId the id of the border node to adjust * @param size the new border size * @returns {Action} the action */ static adjustBorderSplit(nodeId: string, size: number): Action; /** * Maximizes the given tabset * @param tabsetNodeId the id of the tabset to maximize * @returns {Action} the action */ static maximizeToggle(tabsetNodeId: string, layoutId?: string | undefined): Action; /** * Updates the global model jsone attributes * @param attributes the json for the model attributes to update (merge into the existing attributes) * @returns {Action} the action */ static updateModelAttributes(attributes: IGlobalAttributes): Action; /** * Updates the given nodes json attributes * @param nodeId the id of the node to update * @param attributes the json attributes to update (merge with the existing attributes) * @returns {Action} the action */ static updateNodeAttributes(nodeId: string, attributes: IRowAttributes | ITabSetAttributes | ITabAttributes | ITabGroupAttributes | IBorderAttributes): Action; /** * Updates the given sublayout's json attributes * @param layoutId the id of the sublayout to update * @param attributes the json attributes to update (merge with the existing attributes) * @returns {Action} the action */ static updateSubLayoutAttributes(layoutId: string, attributes: ISubLayoutAttributes): Action; /** * Pops out the given tab node into a new browser window or floating panel * @param nodeId the tab node to popout * @param type the type of window to create, either "window" (native browser window) or "float" (simulated div based window) * @returns {Action} the action */ static popoutTab(nodeId: string, type?: ILayoutType): Action; /** * Pops out the given tabset node into a new browser window or floating panel * @param nodeId the tabset node to popout * @param type the type of window to create, either "window" (native browser window) or "float" (simulated div based window) * @returns {Action} the action */ static popoutTabset(nodeId: string, type?: ILayoutType): Action; /** * Closes the popout * @param layoutId the id of the popout to close * @returns {Action} the action */ static closePopout(layoutId: string): Action; /** * Moves a floating panel popout to the front of the display * @param layoutId the id of the floating panel popout to move * @returns {Action} the action */ static movePopoutToFront(layoutId: string): Action; /** * Moves a floating panel * @param layoutId the id of the floating panel to move * @param rect the new rectangle * @returns {Action} the action */ static moveFloat(layoutId: string, rect: Rect): Action; /** * Converts a floating panel into a native popout window (the reverse of closePopout). The * layout keeps its id and content; the given rect should be in screen coordinates. * @param layoutId the id of the float layout to popout * @param rect optional the screen rectangle for the new window * @returns {Action} the action */ static popoutFloat(layoutId: string, rect?: IJsonRect): Action; /** * Docks a floating panel's whole layout into another layout. * @param layoutId the id of the float layout to dock * @param toNodeId the id of a tabset or root row in the target layout to dock into * @param location the location where the moved layout will be added, one of the DockLocation enum values (CENTER is ignored) * @param index for docking to the center this value is the index of the tab, use -1 to add to the end * @returns {Action} the action */ static dockFloatToLayout(layoutId: string, toNodeId: string, location: DockLocation, index: number): Action; /** * Creates a new empty popout window with the given layout (alias for createSubLayout) * @param layout the json layout for the new window * @param rect the window rectangle in screen coordinates * @param type the type of the popout either "window", "float" * @returns {Action} the action */ static createPopout(layout: IJsonRowNode, rect: IJsonRect, type: ILayoutType): Action; /** * Creates a new group in the tab's parent tabset/border and moves the tab into it. The group is * inserted at the tab's position, so the tab becomes the first (and initially only) member. * @param tabNodeId the id of the tab to move into the new group * @param name optional name for the new group * @param color optional color for the new group (a css color) * @returns {Action} the action */ static addTabToNewGroup(tabNodeId: string, name?: string, color?: string): Action; /** * Moves every tab of the given group back into the group's parent tabset/border (at the group's * position) and deletes the now-empty group. The group's color/name is lost. * @param groupNodeId the id of the group to ungroup * @returns {Action} the action */ static ungroup(groupNodeId: string): Action; /** * Moves a tab out of its group into the group's parent tabset/border, directly after the group. * The group is deleted if it becomes empty. * @param tabNodeId the id of the tab to remove from its group * @returns {Action} the action */ static removeTabFromGroup(tabNodeId: string): Action; /** * Creates a new sublayout with the given layout * @param layout the json layout for the new window * @param rect the window rectangle in screen coordinates * @param type the type of the sublayout either "window", "float" or "tab" * @returns {Action} the action */ static createSubLayout(layout: IJsonRowNode, rect: IJsonRect, type: ILayoutType): Action; } export declare class Action { type: string; data: Record; adjusting: boolean; userData: any; constructor(type: string, data: Record); setAdjusting(adjusting: boolean): Action; setUserData(userData: any): Action; isAdjusting(): boolean; /** serializes the action for display/logging as a plain {type, data} object, including userData when set */ toJSON(): { type: string; data: Record; userData?: undefined; } | { type: string; data: Record; userData: any; }; } /** * A batch of actions that the model applies together between a single `onBeforeAction` / * `onAfterAction` listener pair. Create with {@link Actions.group}. The `data` field holds the * contained actions, so an action log can show the batch as a json array of the individual actions. */ export declare class GroupAction extends Action { /** the actions to perform, in order */ actions: Action[]; constructor(actions: Action[]); }