@aptre/flex-layout 0.2.0 → 0.2.1
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/Attribute.d.ts +1 -0
- package/dist/AttributeDefinitions.d.ts +1 -0
- package/dist/DockLocation.d.ts +12 -0
- package/dist/DragDrop.d.ts +15 -0
- package/dist/DropInfo.d.ts +12 -0
- package/dist/I18nLabel.d.ts +14 -0
- package/dist/Orientation.d.ts +7 -0
- package/dist/PopupMenu.d.ts +1 -0
- package/dist/Rect.d.ts +28 -0
- package/dist/Types.d.ts +79 -0
- package/dist/index.d.ts +22 -0
- package/dist/model/Action.d.ts +5 -0
- package/dist/model/Actions.d.ts +110 -0
- package/dist/model/BorderNode.d.ts +34 -0
- package/dist/model/BorderSet.d.ts +4 -0
- package/dist/model/ICloseType.d.ts +5 -0
- package/dist/model/IDraggable.d.ts +2 -0
- package/dist/model/IDropTarget.d.ts +2 -0
- package/dist/model/IJsonModel.d.ts +149 -0
- package/dist/model/Model.d.ts +86 -0
- package/dist/model/Node.d.ts +17 -0
- package/dist/model/RowNode.d.ts +11 -0
- package/dist/model/SplitterNode.d.ts +5 -0
- package/dist/model/TabNode.d.ts +37 -0
- package/dist/model/TabSetNode.d.ts +41 -0
- package/dist/model/Utils.d.ts +1 -0
- package/dist/view/BorderButton.d.ts +1 -0
- package/dist/view/BorderTabSet.d.ts +1 -0
- package/dist/view/ErrorBoundary.d.ts +1 -0
- package/dist/view/FloatingWindow.d.ts +1 -0
- package/dist/view/FloatingWindowTab.d.ts +1 -0
- package/dist/view/Icons.d.ts +7 -0
- package/dist/view/Layout.d.ts +161 -0
- package/dist/view/Splitter.d.ts +1 -0
- package/dist/view/Tab.d.ts +1 -0
- package/dist/view/TabButton.d.ts +1 -0
- package/dist/view/TabButtonStamp.d.ts +1 -0
- package/dist/view/TabFloating.d.ts +1 -0
- package/dist/view/TabOverflowHook.d.ts +1 -0
- package/dist/view/TabSet.d.ts +1 -0
- package/dist/view/Utils.d.ts +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Orientation } from "./Orientation";
|
|
2
|
+
export declare class DockLocation {
|
|
3
|
+
static values: Record<string, DockLocation>;
|
|
4
|
+
static TOP: DockLocation;
|
|
5
|
+
static BOTTOM: DockLocation;
|
|
6
|
+
static LEFT: DockLocation;
|
|
7
|
+
static RIGHT: DockLocation;
|
|
8
|
+
static CENTER: DockLocation;
|
|
9
|
+
getName(): string;
|
|
10
|
+
getOrientation(): Orientation;
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare class DragDrop {
|
|
3
|
+
static instance: DragDrop;
|
|
4
|
+
addGlass(fCancel: ((wasDragging: boolean) => void) | undefined): void;
|
|
5
|
+
resizeGlass(): void;
|
|
6
|
+
hideGlass(): void;
|
|
7
|
+
setGlassCursorOverride(cursor: string | undefined): void;
|
|
8
|
+
startDrag(event: Event | React.MouseEvent<HTMLDivElement, MouseEvent> | React.TouchEvent<HTMLDivElement> | React.DragEvent<Element> | undefined, fDragStart: ((pos: {
|
|
9
|
+
clientX: number;
|
|
10
|
+
clientY: number;
|
|
11
|
+
}) => boolean) | undefined, fDragMove: ((event: React.MouseEvent<Element>) => void) | undefined, fDragEnd: ((event: Event) => void) | undefined, fDragCancel?: ((wasDragging: boolean) => void) | undefined, fClick?: ((event: Event) => void) | undefined, fDblClick?: ((event: Event) => void) | undefined, currentDocument?: Document, rootElement?: HTMLDivElement): void;
|
|
12
|
+
isDragging(): boolean;
|
|
13
|
+
isActive(): boolean;
|
|
14
|
+
toString(): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DockLocation } from "./DockLocation";
|
|
2
|
+
import { IDropTarget } from "./model/IDropTarget";
|
|
3
|
+
import { Node } from "./model/Node";
|
|
4
|
+
import { Rect } from "./Rect";
|
|
5
|
+
export declare class DropInfo {
|
|
6
|
+
node: Node & IDropTarget;
|
|
7
|
+
rect: Rect;
|
|
8
|
+
location: DockLocation;
|
|
9
|
+
index: number;
|
|
10
|
+
className: string;
|
|
11
|
+
constructor(node: Node & IDropTarget, rect: Rect, location: DockLocation, index: number, className: string);
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum I18nLabel {
|
|
2
|
+
Close_Tab = "Close",
|
|
3
|
+
Close_Tabset = "Close tabset",
|
|
4
|
+
Move_Tab = "Move: ",// no longer used
|
|
5
|
+
Move_Tabset = "Move tabset",
|
|
6
|
+
Maximize = "Maximize tabset",
|
|
7
|
+
Restore = "Restore tabset",
|
|
8
|
+
Float_Tab = "Show selected tab in floating window",
|
|
9
|
+
Overflow_Menu_Tooltip = "Hidden tabs",
|
|
10
|
+
Floating_Window_Message = "This panel is shown in a floating window",
|
|
11
|
+
Floating_Window_Show_Window = "Show window",
|
|
12
|
+
Floating_Window_Dock_Window = "Dock window",
|
|
13
|
+
Error_rendering_component = "Error rendering component"
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Rect.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare class Rect {
|
|
2
|
+
static empty(): Rect;
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
8
|
+
static fromElement(element: Element): Rect;
|
|
9
|
+
clone(): Rect;
|
|
10
|
+
equals(rect: Rect | null | undefined): boolean;
|
|
11
|
+
getBottom(): number;
|
|
12
|
+
getRight(): number;
|
|
13
|
+
getCenter(): {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
positionElement(element: HTMLElement, position?: string): void;
|
|
18
|
+
styleWithPosition(style: Record<string, any>, position?: string): Record<string, any>;
|
|
19
|
+
contains(x: number, y: number): boolean;
|
|
20
|
+
removeInsets(insets: {
|
|
21
|
+
top: number;
|
|
22
|
+
left: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
right: number;
|
|
25
|
+
}): Rect;
|
|
26
|
+
centerInRect(outerRect: Rect): void;
|
|
27
|
+
toString(): string;
|
|
28
|
+
}
|
package/dist/Types.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export declare enum CLASSES {
|
|
2
|
+
FLEXLAYOUT__BORDER = "flexlayout__border",
|
|
3
|
+
FLEXLAYOUT__BORDER_ = "flexlayout__border_",
|
|
4
|
+
FLEXLAYOUT__BORDER_BUTTON = "flexlayout__border_button",
|
|
5
|
+
FLEXLAYOUT__BORDER_BUTTON_ = "flexlayout__border_button_",
|
|
6
|
+
FLEXLAYOUT__BORDER_BUTTON_CONTENT = "flexlayout__border_button_content",
|
|
7
|
+
FLEXLAYOUT__BORDER_BUTTON_LEADING = "flexlayout__border_button_leading",
|
|
8
|
+
FLEXLAYOUT__BORDER_BUTTON_TRAILING = "flexlayout__border_button_trailing",
|
|
9
|
+
FLEXLAYOUT__BORDER_BUTTON__SELECTED = "flexlayout__border_button--selected",
|
|
10
|
+
FLEXLAYOUT__BORDER_BUTTON__UNSELECTED = "flexlayout__border_button--unselected",
|
|
11
|
+
FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW = "flexlayout__border_toolbar_button_overflow",
|
|
12
|
+
FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_ = "flexlayout__border_toolbar_button_overflow_",
|
|
13
|
+
FLEXLAYOUT__BORDER_INNER = "flexlayout__border_inner",
|
|
14
|
+
FLEXLAYOUT__BORDER_INNER_ = "flexlayout__border_inner_",
|
|
15
|
+
FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER = "flexlayout__border_inner_tab_container",
|
|
16
|
+
FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_ = "flexlayout__border_inner_tab_container_",
|
|
17
|
+
FLEXLAYOUT__BORDER_TAB_DIVIDER = "flexlayout__border_tab_divider",
|
|
18
|
+
FLEXLAYOUT__BORDER_SIZER = "flexlayout__border_sizer",
|
|
19
|
+
FLEXLAYOUT__BORDER_TOOLBAR = "flexlayout__border_toolbar",
|
|
20
|
+
FLEXLAYOUT__BORDER_TOOLBAR_ = "flexlayout__border_toolbar_",
|
|
21
|
+
FLEXLAYOUT__BORDER_TOOLBAR_BUTTON = "flexlayout__border_toolbar_button",
|
|
22
|
+
FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT = "flexlayout__border_toolbar_button-float",
|
|
23
|
+
FLEXLAYOUT__DRAG_RECT = "flexlayout__drag_rect",
|
|
24
|
+
FLEXLAYOUT__EDGE_RECT = "flexlayout__edge_rect",
|
|
25
|
+
FLEXLAYOUT__EDGE_RECT_TOP = "flexlayout__edge_rect_top",
|
|
26
|
+
FLEXLAYOUT__EDGE_RECT_LEFT = "flexlayout__edge_rect_left",
|
|
27
|
+
FLEXLAYOUT__EDGE_RECT_BOTTOM = "flexlayout__edge_rect_bottom",
|
|
28
|
+
FLEXLAYOUT__EDGE_RECT_RIGHT = "flexlayout__edge_rect_right",
|
|
29
|
+
FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER = "flexlayout__error_boundary_container",
|
|
30
|
+
FLEXLAYOUT__ERROR_BOUNDARY_CONTENT = "flexlayout__error_boundary_content",
|
|
31
|
+
FLEXLAYOUT__FLOATING_WINDOW_CONTENT = "flexlayout__floating_window_content",
|
|
32
|
+
FLEXLAYOUT__FLOATING_WINDOW_TAB = "flexlayout__floating_window_tab",
|
|
33
|
+
FLEXLAYOUT__LAYOUT = "flexlayout__layout",
|
|
34
|
+
FLEXLAYOUT__OUTLINE_RECT = "flexlayout__outline_rect",
|
|
35
|
+
FLEXLAYOUT__OUTLINE_RECT_EDGE = "flexlayout__outline_rect_edge",
|
|
36
|
+
FLEXLAYOUT__SPLITTER = "flexlayout__splitter",
|
|
37
|
+
FLEXLAYOUT__SPLITTER_EXTRA = "flexlayout__splitter_extra",
|
|
38
|
+
FLEXLAYOUT__SPLITTER_ = "flexlayout__splitter_",
|
|
39
|
+
FLEXLAYOUT__SPLITTER_BORDER = "flexlayout__splitter_border",
|
|
40
|
+
FLEXLAYOUT__SPLITTER_DRAG = "flexlayout__splitter_drag",
|
|
41
|
+
FLEXLAYOUT__TAB = "flexlayout__tab",
|
|
42
|
+
FLEXLAYOUT__TABSET = "flexlayout__tabset",
|
|
43
|
+
FLEXLAYOUT__TABSET_HEADER = "flexlayout__tabset_header",
|
|
44
|
+
FLEXLAYOUT__TABSET_HEADER_SIZER = "flexlayout__tabset_header_sizer",
|
|
45
|
+
FLEXLAYOUT__TABSET_HEADER_CONTENT = "flexlayout__tabset_header_content",
|
|
46
|
+
FLEXLAYOUT__TABSET_MAXIMIZED = "flexlayout__tabset-maximized",
|
|
47
|
+
FLEXLAYOUT__TABSET_SELECTED = "flexlayout__tabset-selected",
|
|
48
|
+
FLEXLAYOUT__TABSET_SIZER = "flexlayout__tabset_sizer",
|
|
49
|
+
FLEXLAYOUT__TABSET_TAB_DIVIDER = "flexlayout__tabset_tab_divider",
|
|
50
|
+
FLEXLAYOUT__TABSET_CONTENT = "flexlayout__tabset_content",
|
|
51
|
+
FLEXLAYOUT__TABSET_TABBAR_INNER = "flexlayout__tabset_tabbar_inner",
|
|
52
|
+
FLEXLAYOUT__TABSET_TABBAR_INNER_ = "flexlayout__tabset_tabbar_inner_",
|
|
53
|
+
FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER = "flexlayout__tabset_tabbar_inner_tab_container",
|
|
54
|
+
FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_ = "flexlayout__tabset_tabbar_inner_tab_container_",
|
|
55
|
+
FLEXLAYOUT__TABSET_TABBAR_OUTER = "flexlayout__tabset_tabbar_outer",
|
|
56
|
+
FLEXLAYOUT__TABSET_TABBAR_OUTER_ = "flexlayout__tabset_tabbar_outer_",
|
|
57
|
+
FLEXLAYOUT__TAB_BORDER = "flexlayout__tab_border",
|
|
58
|
+
FLEXLAYOUT__TAB_BORDER_ = "flexlayout__tab_border_",
|
|
59
|
+
FLEXLAYOUT__TAB_BUTTON = "flexlayout__tab_button",
|
|
60
|
+
FLEXLAYOUT__TAB_BUTTON_STRETCH = "flexlayout__tab_button_stretch",
|
|
61
|
+
FLEXLAYOUT__TAB_BUTTON_CONTENT = "flexlayout__tab_button_content",
|
|
62
|
+
FLEXLAYOUT__TAB_BUTTON_LEADING = "flexlayout__tab_button_leading",
|
|
63
|
+
FLEXLAYOUT__TAB_BUTTON_OVERFLOW = "flexlayout__tab_button_overflow",
|
|
64
|
+
FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT = "flexlayout__tab_button_overflow_count",
|
|
65
|
+
FLEXLAYOUT__TAB_BUTTON_TEXTBOX = "flexlayout__tab_button_textbox",
|
|
66
|
+
FLEXLAYOUT__TAB_BUTTON_TRAILING = "flexlayout__tab_button_trailing",
|
|
67
|
+
FLEXLAYOUT__TAB_BUTTON_STAMP = "flexlayout__tab_button_stamp",
|
|
68
|
+
FLEXLAYOUT__TAB_FLOATING = "flexlayout__tab_floating",
|
|
69
|
+
FLEXLAYOUT__TAB_FLOATING_INNER = "flexlayout__tab_floating_inner",
|
|
70
|
+
FLEXLAYOUT__TAB_TOOLBAR = "flexlayout__tab_toolbar",
|
|
71
|
+
FLEXLAYOUT__TAB_TOOLBAR_BUTTON = "flexlayout__tab_toolbar_button",
|
|
72
|
+
FLEXLAYOUT__TAB_TOOLBAR_BUTTON_ = "flexlayout__tab_toolbar_button-",
|
|
73
|
+
FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT = "flexlayout__tab_toolbar_button-float",
|
|
74
|
+
FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER = "flexlayout__tab_toolbar_sticky_buttons_container",
|
|
75
|
+
FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE = "flexlayout__tab_toolbar_button-close",
|
|
76
|
+
FLEXLAYOUT__POPUP_MENU_CONTAINER = "flexlayout__popup_menu_container",
|
|
77
|
+
FLEXLAYOUT__POPUP_MENU_ITEM = "flexlayout__popup_menu_item",
|
|
78
|
+
FLEXLAYOUT__POPUP_MENU = "flexlayout__popup_menu"
|
|
79
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from "./view/Layout";
|
|
2
|
+
export * from "./model/Action";
|
|
3
|
+
export * from "./model/Actions";
|
|
4
|
+
export * from "./model/BorderNode";
|
|
5
|
+
export * from "./model/BorderSet";
|
|
6
|
+
export * from "./model/ICloseType";
|
|
7
|
+
export * from "./model/IDraggable";
|
|
8
|
+
export * from "./model/IDropTarget";
|
|
9
|
+
export * from "./model/IJsonModel";
|
|
10
|
+
export * from "./model/Model";
|
|
11
|
+
export * from "./model/Node";
|
|
12
|
+
export * from "./model/RowNode";
|
|
13
|
+
export * from "./model/SplitterNode";
|
|
14
|
+
export * from "./model/TabNode";
|
|
15
|
+
export * from "./model/TabSetNode";
|
|
16
|
+
export * from "./DockLocation";
|
|
17
|
+
export * from "./DragDrop";
|
|
18
|
+
export * from "./DropInfo";
|
|
19
|
+
export * from "./I18nLabel";
|
|
20
|
+
export * from "./Orientation";
|
|
21
|
+
export * from "./Rect";
|
|
22
|
+
export * from "./Types";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { DockLocation } from "../DockLocation";
|
|
2
|
+
import { Action } from "./Action";
|
|
3
|
+
/**
|
|
4
|
+
* The Action creator class for FlexLayout model actions
|
|
5
|
+
*/
|
|
6
|
+
export declare class Actions {
|
|
7
|
+
static ADD_NODE: string;
|
|
8
|
+
static MOVE_NODE: string;
|
|
9
|
+
static DELETE_TAB: string;
|
|
10
|
+
static DELETE_TABSET: string;
|
|
11
|
+
static RENAME_TAB: string;
|
|
12
|
+
static SELECT_TAB: string;
|
|
13
|
+
static SET_ACTIVE_TABSET: string;
|
|
14
|
+
static ADJUST_SPLIT: string;
|
|
15
|
+
static ADJUST_BORDER_SPLIT: string;
|
|
16
|
+
static MAXIMIZE_TOGGLE: string;
|
|
17
|
+
static UPDATE_MODEL_ATTRIBUTES: string;
|
|
18
|
+
static UPDATE_NODE_ATTRIBUTES: string;
|
|
19
|
+
static FLOAT_TAB: string;
|
|
20
|
+
static UNFLOAT_TAB: string;
|
|
21
|
+
/**
|
|
22
|
+
* Adds a tab node to the given tabset node
|
|
23
|
+
* @param json the json for the new tab node e.g {type:"tab", component:"table"}
|
|
24
|
+
* @param toNodeId the new tab node will be added to the tabset with this node id
|
|
25
|
+
* @param location the location where the new tab will be added, one of the DockLocation enum values.
|
|
26
|
+
* @param index for docking to the center this value is the index of the tab, use -1 to add to the end.
|
|
27
|
+
* @param select (optional) whether to select the new tab, overriding autoSelectTab
|
|
28
|
+
* @returns {Action} the action
|
|
29
|
+
*/
|
|
30
|
+
static addNode(json: any, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action;
|
|
31
|
+
/**
|
|
32
|
+
* Moves a node (tab or tabset) from one location to another
|
|
33
|
+
* @param fromNodeId the id of the node to move
|
|
34
|
+
* @param toNodeId the id of the node to receive the moved node
|
|
35
|
+
* @param location the location where the moved node will be added, one of the DockLocation enum values.
|
|
36
|
+
* @param index for docking to the center this value is the index of the tab, use -1 to add to the end.
|
|
37
|
+
* @param select (optional) whether to select the moved tab(s) in new tabset, overriding autoSelectTab
|
|
38
|
+
* @returns {Action} the action
|
|
39
|
+
*/
|
|
40
|
+
static moveNode(fromNodeId: string, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action;
|
|
41
|
+
/**
|
|
42
|
+
* Deletes a tab node from the layout
|
|
43
|
+
* @param tabsetNodeId the id of the tab node to delete
|
|
44
|
+
* @returns {Action} the action
|
|
45
|
+
*/
|
|
46
|
+
static deleteTab(tabNodeId: string): Action;
|
|
47
|
+
/**
|
|
48
|
+
* Deletes a tabset node and all it's child tab nodes from the layout
|
|
49
|
+
* @param tabsetNodeId the id of the tabset node to delete
|
|
50
|
+
* @returns {Action} the action
|
|
51
|
+
*/
|
|
52
|
+
static deleteTabset(tabsetNodeId: string): Action;
|
|
53
|
+
/**
|
|
54
|
+
* Change the given nodes tab text
|
|
55
|
+
* @param tabNodeId the id of the node to rename
|
|
56
|
+
* @param text the test of the tab
|
|
57
|
+
* @returns {Action} the action
|
|
58
|
+
*/
|
|
59
|
+
static renameTab(tabNodeId: string, text: string): Action;
|
|
60
|
+
/**
|
|
61
|
+
* Selects the given tab in its parent tabset
|
|
62
|
+
* @param tabNodeId the id of the node to set selected
|
|
63
|
+
* @returns {Action} the action
|
|
64
|
+
*/
|
|
65
|
+
static selectTab(tabNodeId: string): Action;
|
|
66
|
+
/**
|
|
67
|
+
* Set the given tabset node as the active tabset
|
|
68
|
+
* @param tabsetNodeId the id of the tabset node to set as active
|
|
69
|
+
* @returns {Action} the action
|
|
70
|
+
*/
|
|
71
|
+
static setActiveTabset(tabsetNodeId: string | undefined): Action;
|
|
72
|
+
/**
|
|
73
|
+
* Adjust the splitter between two tabsets
|
|
74
|
+
* @example
|
|
75
|
+
* Actions.adjustSplit({node1: "1", weight1:30, pixelWidth1:300, node2: "2", weight2:70, pixelWidth2:700});
|
|
76
|
+
*
|
|
77
|
+
* @param splitSpec an object the defines the new split between two tabsets, see example below.
|
|
78
|
+
* @returns {Action} the action
|
|
79
|
+
*/
|
|
80
|
+
static adjustSplit(splitSpec: {
|
|
81
|
+
node1Id: string;
|
|
82
|
+
weight1: number;
|
|
83
|
+
pixelWidth1: number;
|
|
84
|
+
node2Id: string;
|
|
85
|
+
weight2: number;
|
|
86
|
+
pixelWidth2: number;
|
|
87
|
+
}): Action;
|
|
88
|
+
static adjustBorderSplit(nodeId: string, pos: number): Action;
|
|
89
|
+
/**
|
|
90
|
+
* Maximizes the given tabset
|
|
91
|
+
* @param tabsetNodeId the id of the tabset to maximize
|
|
92
|
+
* @returns {Action} the action
|
|
93
|
+
*/
|
|
94
|
+
static maximizeToggle(tabsetNodeId: string): Action;
|
|
95
|
+
/**
|
|
96
|
+
* Updates the global model jsone attributes
|
|
97
|
+
* @param attributes the json for the model attributes to update (merge into the existing attributes)
|
|
98
|
+
* @returns {Action} the action
|
|
99
|
+
*/
|
|
100
|
+
static updateModelAttributes(attributes: any): Action;
|
|
101
|
+
/**
|
|
102
|
+
* Updates the given nodes json attributes
|
|
103
|
+
* @param nodeId the id of the node to update
|
|
104
|
+
* @param attributes the json attributes to update (merge with the existing attributes)
|
|
105
|
+
* @returns {Action} the action
|
|
106
|
+
*/
|
|
107
|
+
static updateNodeAttributes(nodeId: string, attributes: any): Action;
|
|
108
|
+
static floatTab(nodeId: string): Action;
|
|
109
|
+
static unFloatTab(nodeId: string): Action;
|
|
110
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DockLocation } from "../DockLocation";
|
|
2
|
+
import { Orientation } from "../Orientation";
|
|
3
|
+
import { Rect } from "../Rect";
|
|
4
|
+
import { IDropTarget } from "./IDropTarget";
|
|
5
|
+
import { IJsonBorderNode } from "./IJsonModel";
|
|
6
|
+
import { Node } from "./Node";
|
|
7
|
+
export declare class BorderNode extends Node implements IDropTarget {
|
|
8
|
+
static readonly TYPE = "border";
|
|
9
|
+
getLocation(): DockLocation;
|
|
10
|
+
getTabHeaderRect(): Rect | undefined;
|
|
11
|
+
getRect(): Rect;
|
|
12
|
+
getContentRect(): Rect | undefined;
|
|
13
|
+
isEnableDrop(): boolean;
|
|
14
|
+
isAutoSelectTab(whenOpen?: boolean): boolean;
|
|
15
|
+
getClassName(): string | undefined;
|
|
16
|
+
getBorderBarSize(): number;
|
|
17
|
+
getSize(): any;
|
|
18
|
+
getMinSize(): number;
|
|
19
|
+
getSelected(): number;
|
|
20
|
+
getSelectedNode(): Node | undefined;
|
|
21
|
+
getOrientation(): Orientation;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the config attribute that can be used to store node specific data that
|
|
24
|
+
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
25
|
+
* than directly, for example:
|
|
26
|
+
* this.state.model.doAction(
|
|
27
|
+
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
28
|
+
*/
|
|
29
|
+
getConfig(): any;
|
|
30
|
+
isMaximized(): boolean;
|
|
31
|
+
isShowing(): boolean;
|
|
32
|
+
isAutoHide(): boolean;
|
|
33
|
+
toJson(): IJsonBorderNode;
|
|
34
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare enum ICloseType {
|
|
2
|
+
Visible = 1,// close if selected or hovered, i.e. when x is visible (will only close selected on mobile, where css hover is not available)
|
|
3
|
+
Always = 2,// close always (both selected and unselected when x rect tapped e.g where a custom image has been added for close)
|
|
4
|
+
Selected = 3
|
|
5
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { ICloseType } from "./ICloseType";
|
|
2
|
+
export type IBorderLocation = "top" | "bottom" | "left" | "right";
|
|
3
|
+
export type ITabLocation = "top" | "bottom";
|
|
4
|
+
export type IInsets = {
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
left: number;
|
|
9
|
+
};
|
|
10
|
+
export interface IJsonModel {
|
|
11
|
+
global?: IGlobalAttributes;
|
|
12
|
+
borders?: IJsonBorderNode[];
|
|
13
|
+
layout: IJsonRowNode;
|
|
14
|
+
}
|
|
15
|
+
export interface IJsonBorderNode extends IBorderAttributes {
|
|
16
|
+
location: IBorderLocation;
|
|
17
|
+
children: IJsonTabNode[];
|
|
18
|
+
}
|
|
19
|
+
export interface IJsonRowNode extends IRowAttributes {
|
|
20
|
+
children: (IJsonRowNode | IJsonTabSetNode)[];
|
|
21
|
+
}
|
|
22
|
+
export interface IJsonTabSetNode extends ITabSetAttributes {
|
|
23
|
+
active?: boolean;
|
|
24
|
+
maximized?: boolean;
|
|
25
|
+
children: IJsonTabNode[];
|
|
26
|
+
}
|
|
27
|
+
export interface IJsonTabNode extends ITabAttributes {
|
|
28
|
+
}
|
|
29
|
+
export interface IGlobalAttributes {
|
|
30
|
+
borderAutoSelectTabWhenClosed?: boolean;
|
|
31
|
+
borderAutoSelectTabWhenOpen?: boolean;
|
|
32
|
+
borderBarSize?: number;
|
|
33
|
+
borderClassName?: string;
|
|
34
|
+
borderEnableAutoHide?: boolean;
|
|
35
|
+
borderEnableDrop?: boolean;
|
|
36
|
+
borderMinSize?: number;
|
|
37
|
+
borderSize?: number;
|
|
38
|
+
enableEdgeDock?: boolean;
|
|
39
|
+
enableRotateBorderIcons?: boolean;
|
|
40
|
+
enableUseVisibility?: boolean;
|
|
41
|
+
legacyOverflowMenu?: boolean;
|
|
42
|
+
marginInsets?: IInsets;
|
|
43
|
+
rootOrientationVertical?: boolean;
|
|
44
|
+
splitterExtra?: number;
|
|
45
|
+
splitterSize?: number;
|
|
46
|
+
tabBorderHeight?: number;
|
|
47
|
+
tabBorderWidth?: number;
|
|
48
|
+
tabClassName?: string;
|
|
49
|
+
tabCloseType?: ICloseType;
|
|
50
|
+
tabContentClassName?: string;
|
|
51
|
+
tabDragSpeed?: number;
|
|
52
|
+
tabEnableClose?: boolean;
|
|
53
|
+
tabEnableDrag?: boolean;
|
|
54
|
+
tabEnableFloat?: boolean;
|
|
55
|
+
tabEnableRename?: boolean;
|
|
56
|
+
tabEnableRenderOnDemand?: boolean;
|
|
57
|
+
tabIcon?: string;
|
|
58
|
+
tabSetAutoSelectTab?: boolean;
|
|
59
|
+
tabSetBorderInsets?: IInsets;
|
|
60
|
+
tabSetClassNameHeader?: string;
|
|
61
|
+
tabSetClassNameTabStrip?: string;
|
|
62
|
+
tabSetEnableClose?: boolean;
|
|
63
|
+
tabSetEnableDeleteWhenEmpty?: boolean;
|
|
64
|
+
tabSetEnableDivide?: boolean;
|
|
65
|
+
tabSetEnableDrag?: boolean;
|
|
66
|
+
tabSetEnableDrop?: boolean;
|
|
67
|
+
tabSetEnableMaximize?: boolean;
|
|
68
|
+
tabSetEnableSingleTabStretch?: boolean;
|
|
69
|
+
tabSetEnableTabStrip?: boolean;
|
|
70
|
+
tabSetHeaderHeight?: number;
|
|
71
|
+
tabSetMarginInsets?: IInsets;
|
|
72
|
+
tabSetMinHeight?: number;
|
|
73
|
+
tabSetMinWidth?: number;
|
|
74
|
+
tabSetTabLocation?: ITabLocation;
|
|
75
|
+
tabSetTabStripHeight?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface IRowAttributes {
|
|
78
|
+
height?: number;
|
|
79
|
+
id?: string;
|
|
80
|
+
type: "row";
|
|
81
|
+
weight?: number;
|
|
82
|
+
width?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface ITabSetAttributes {
|
|
85
|
+
autoSelectTab?: boolean;
|
|
86
|
+
borderInsets?: IInsets;
|
|
87
|
+
classNameHeader?: string;
|
|
88
|
+
classNameTabStrip?: string;
|
|
89
|
+
config?: any;
|
|
90
|
+
enableClose?: boolean;
|
|
91
|
+
enableDeleteWhenEmpty?: boolean;
|
|
92
|
+
enableDivide?: boolean;
|
|
93
|
+
enableDrag?: boolean;
|
|
94
|
+
enableDrop?: boolean;
|
|
95
|
+
enableMaximize?: boolean;
|
|
96
|
+
enableSingleTabStretch?: boolean;
|
|
97
|
+
enableTabStrip?: boolean;
|
|
98
|
+
headerHeight?: number;
|
|
99
|
+
height?: number;
|
|
100
|
+
id?: string;
|
|
101
|
+
marginInsets?: IInsets;
|
|
102
|
+
minHeight?: number;
|
|
103
|
+
minWidth?: number;
|
|
104
|
+
name?: string;
|
|
105
|
+
selected?: number;
|
|
106
|
+
tabLocation?: ITabLocation;
|
|
107
|
+
tabStripHeight?: number;
|
|
108
|
+
type: "tabset";
|
|
109
|
+
weight?: number;
|
|
110
|
+
width?: number;
|
|
111
|
+
maximized?: boolean;
|
|
112
|
+
active?: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface ITabAttributes {
|
|
115
|
+
altName?: string;
|
|
116
|
+
borderHeight?: number;
|
|
117
|
+
borderWidth?: number;
|
|
118
|
+
className?: string;
|
|
119
|
+
closeType?: ICloseType;
|
|
120
|
+
component?: string;
|
|
121
|
+
config?: any;
|
|
122
|
+
contentClassName?: string;
|
|
123
|
+
tabsetClassName?: string;
|
|
124
|
+
enableClose?: boolean;
|
|
125
|
+
enableDrag?: boolean;
|
|
126
|
+
enableFloat?: boolean;
|
|
127
|
+
enableRename?: boolean;
|
|
128
|
+
enableRenderOnDemand?: boolean;
|
|
129
|
+
floating?: boolean;
|
|
130
|
+
helpText?: string;
|
|
131
|
+
icon?: string;
|
|
132
|
+
id?: string;
|
|
133
|
+
name?: string;
|
|
134
|
+
type?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface IBorderAttributes {
|
|
137
|
+
autoSelectTabWhenClosed?: boolean;
|
|
138
|
+
autoSelectTabWhenOpen?: boolean;
|
|
139
|
+
barSize?: number;
|
|
140
|
+
className?: string;
|
|
141
|
+
config?: any;
|
|
142
|
+
enableAutoHide?: boolean;
|
|
143
|
+
enableDrop?: boolean;
|
|
144
|
+
minSize?: number;
|
|
145
|
+
selected?: number;
|
|
146
|
+
show?: boolean;
|
|
147
|
+
size?: number;
|
|
148
|
+
type: "border";
|
|
149
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { DropInfo } from "../DropInfo";
|
|
2
|
+
import { Action } from "./Action";
|
|
3
|
+
import { BorderSet } from "./BorderSet";
|
|
4
|
+
import { IJsonModel, ITabSetAttributes } from "./IJsonModel";
|
|
5
|
+
import { Node } from "./Node";
|
|
6
|
+
import { RowNode } from "./RowNode";
|
|
7
|
+
import { TabNode } from "./TabNode";
|
|
8
|
+
import { TabSetNode } from "./TabSetNode";
|
|
9
|
+
/**
|
|
10
|
+
* Class containing the Tree of Nodes used by the FlexLayout component
|
|
11
|
+
*/
|
|
12
|
+
export declare class Model {
|
|
13
|
+
/**
|
|
14
|
+
* Loads the model from the given json object
|
|
15
|
+
* @param json the json model to load
|
|
16
|
+
* @returns {Model} a new Model object
|
|
17
|
+
*/
|
|
18
|
+
static fromJson(json: IJsonModel): Model;
|
|
19
|
+
/**
|
|
20
|
+
* Get the currently active tabset node
|
|
21
|
+
*/
|
|
22
|
+
getActiveTabset(): TabSetNode | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Get the currently maximized tabset node
|
|
25
|
+
*/
|
|
26
|
+
getMaximizedTabset(): TabSetNode | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the root RowNode of the model
|
|
29
|
+
* @returns {RowNode}
|
|
30
|
+
*/
|
|
31
|
+
getRoot(): RowNode;
|
|
32
|
+
isRootOrientationVertical(): boolean;
|
|
33
|
+
isUseVisibility(): boolean;
|
|
34
|
+
isEnableRotateBorderIcons(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the
|
|
37
|
+
* @returns {BorderSet|*}
|
|
38
|
+
*/
|
|
39
|
+
getBorderSet(): BorderSet;
|
|
40
|
+
/**
|
|
41
|
+
* Visits all the nodes in the model and calls the given function for each
|
|
42
|
+
* @param fn a function that takes visited node and a integer level as parameters
|
|
43
|
+
*/
|
|
44
|
+
visitNodes(fn: (node: Node, level: number) => void): void;
|
|
45
|
+
/**
|
|
46
|
+
* Gets a node by its id
|
|
47
|
+
* @param id the id to find
|
|
48
|
+
*/
|
|
49
|
+
getNodeById(id: string): Node | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Finds the first/top left tab set of the given node.
|
|
52
|
+
* @param node The top node you want to begin searching from, deafults to the root node
|
|
53
|
+
* @returns The first Tab Set
|
|
54
|
+
*/
|
|
55
|
+
getFirstTabSet(node?: Node): Node;
|
|
56
|
+
/**
|
|
57
|
+
* Update the node tree by performing the given action,
|
|
58
|
+
* Actions should be generated via static methods on the Actions class
|
|
59
|
+
* @param action the action to perform
|
|
60
|
+
* @returns added Node for Actions.addNode; undefined otherwise
|
|
61
|
+
*/
|
|
62
|
+
doAction(action: Action): Node | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Converts the model to a json object
|
|
65
|
+
* @returns {IJsonModel} json object that represents this model
|
|
66
|
+
*/
|
|
67
|
+
toJson(): IJsonModel;
|
|
68
|
+
getSplitterSize(): number;
|
|
69
|
+
isLegacyOverflowMenu(): boolean;
|
|
70
|
+
getSplitterExtra(): number;
|
|
71
|
+
isEnableEdgeDock(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Sets a function to allow/deny dropping a node
|
|
74
|
+
* @param onAllowDrop function that takes the drag node and DropInfo and returns true if the drop is allowed
|
|
75
|
+
*/
|
|
76
|
+
setOnAllowDrop(onAllowDrop: (dragNode: Node, dropInfo: DropInfo) => boolean): void;
|
|
77
|
+
/**
|
|
78
|
+
* set callback called when a new TabSet is created.
|
|
79
|
+
* The tabNode can be undefined if it's the auto created first tabset in the root row (when the last
|
|
80
|
+
* tab is deleted, the root tabset can be recreated)
|
|
81
|
+
* @param onCreateTabSet
|
|
82
|
+
*/
|
|
83
|
+
setOnCreateTabSet(onCreateTabSet: (tabNode?: TabNode) => ITabSetAttributes): void;
|
|
84
|
+
static toTypescriptInterfaces(): void;
|
|
85
|
+
toString(): string;
|
|
86
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Orientation } from "../Orientation";
|
|
2
|
+
import { Rect } from "../Rect";
|
|
3
|
+
import { IJsonBorderNode, IJsonRowNode, IJsonTabNode, IJsonTabSetNode } from "./IJsonModel";
|
|
4
|
+
import { Model } from "./Model";
|
|
5
|
+
export declare abstract class Node {
|
|
6
|
+
getId(): string;
|
|
7
|
+
getModel(): Model;
|
|
8
|
+
getType(): string;
|
|
9
|
+
getParent(): Node | undefined;
|
|
10
|
+
getChildren(): Node[];
|
|
11
|
+
getRect(): Rect;
|
|
12
|
+
isVisible(): boolean;
|
|
13
|
+
getOrientation(): Orientation;
|
|
14
|
+
setEventListener(event: string, callback: (params: any) => void): void;
|
|
15
|
+
removeEventListener(event: string): void;
|
|
16
|
+
abstract toJson(): IJsonRowNode | IJsonBorderNode | IJsonTabSetNode | IJsonTabNode | undefined;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDropTarget } from "./IDropTarget";
|
|
2
|
+
import { IJsonRowNode } from "./IJsonModel";
|
|
3
|
+
import { Node } from "./Node";
|
|
4
|
+
export declare class RowNode extends Node implements IDropTarget {
|
|
5
|
+
static readonly TYPE = "row";
|
|
6
|
+
getWeight(): number;
|
|
7
|
+
getWidth(): number | undefined;
|
|
8
|
+
getHeight(): number | undefined;
|
|
9
|
+
toJson(): IJsonRowNode;
|
|
10
|
+
isEnableDrop(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Rect } from "../Rect";
|
|
2
|
+
import { IDraggable } from "./IDraggable";
|
|
3
|
+
import { IJsonTabNode } from "./IJsonModel";
|
|
4
|
+
import { Node } from "./Node";
|
|
5
|
+
export declare class TabNode extends Node implements IDraggable {
|
|
6
|
+
static readonly TYPE = "tab";
|
|
7
|
+
getWindow(): Window | undefined;
|
|
8
|
+
getTabRect(): Rect | undefined;
|
|
9
|
+
getName(): string;
|
|
10
|
+
getHelpText(): string | undefined;
|
|
11
|
+
getComponent(): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the config attribute that can be used to store node specific data that
|
|
14
|
+
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
15
|
+
* than directly, for example:
|
|
16
|
+
* this.state.model.doAction(
|
|
17
|
+
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
18
|
+
*/
|
|
19
|
+
getConfig(): any;
|
|
20
|
+
/**
|
|
21
|
+
* Returns an object that can be used to store transient node specific data that will
|
|
22
|
+
* NOT be saved in the json.
|
|
23
|
+
*/
|
|
24
|
+
getExtraData(): Record<string, any>;
|
|
25
|
+
isFloating(): boolean;
|
|
26
|
+
getIcon(): string | undefined;
|
|
27
|
+
isEnableClose(): boolean;
|
|
28
|
+
getCloseType(): number;
|
|
29
|
+
isEnableFloat(): boolean;
|
|
30
|
+
isEnableDrag(): boolean;
|
|
31
|
+
isEnableRename(): boolean;
|
|
32
|
+
getClassName(): string | undefined;
|
|
33
|
+
getContentClassName(): string | undefined;
|
|
34
|
+
getTabSetClassName(): string | undefined;
|
|
35
|
+
isEnableRenderOnDemand(): boolean;
|
|
36
|
+
toJson(): IJsonTabNode;
|
|
37
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IDraggable } from "./IDraggable";
|
|
2
|
+
import { IDropTarget } from "./IDropTarget";
|
|
3
|
+
import { IJsonTabSetNode } from "./IJsonModel";
|
|
4
|
+
import { Node } from "./Node";
|
|
5
|
+
export declare class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
6
|
+
static readonly TYPE = "tabset";
|
|
7
|
+
getName(): string | undefined;
|
|
8
|
+
getSelected(): number;
|
|
9
|
+
getSelectedNode(): Node | undefined;
|
|
10
|
+
getWeight(): number;
|
|
11
|
+
getWidth(): number | undefined;
|
|
12
|
+
getMinWidth(): number;
|
|
13
|
+
getHeight(): number | undefined;
|
|
14
|
+
getMinHeight(): number;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the config attribute that can be used to store node specific data that
|
|
17
|
+
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
18
|
+
* than directly, for example:
|
|
19
|
+
* this.state.model.doAction(
|
|
20
|
+
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
21
|
+
*/
|
|
22
|
+
getConfig(): any;
|
|
23
|
+
isMaximized(): boolean;
|
|
24
|
+
isActive(): boolean;
|
|
25
|
+
isEnableDeleteWhenEmpty(): boolean;
|
|
26
|
+
isEnableDrop(): boolean;
|
|
27
|
+
isEnableDrag(): boolean;
|
|
28
|
+
isEnableDivide(): boolean;
|
|
29
|
+
isEnableMaximize(): boolean;
|
|
30
|
+
isEnableClose(): boolean;
|
|
31
|
+
isEnableSingleTabStretch(): boolean;
|
|
32
|
+
canMaximize(): boolean;
|
|
33
|
+
isEnableTabStrip(): boolean;
|
|
34
|
+
isAutoSelectTab(): boolean;
|
|
35
|
+
getClassNameTabStrip(): string | undefined;
|
|
36
|
+
getClassNameHeader(): string | undefined;
|
|
37
|
+
getHeaderHeight(): number;
|
|
38
|
+
getTabStripHeight(): number;
|
|
39
|
+
getTabLocation(): string;
|
|
40
|
+
toJson(): IJsonTabSetNode;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function randomUUID(): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare const CloseIcon: () => React.JSX.Element;
|
|
3
|
+
export declare const MaximizeIcon: () => React.JSX.Element;
|
|
4
|
+
export declare const OverflowIcon: () => React.JSX.Element;
|
|
5
|
+
export declare const EdgeIcon: () => React.JSX.Element;
|
|
6
|
+
export declare const PopoutIcon: () => React.JSX.Element;
|
|
7
|
+
export declare const RestoreIcon: () => React.JSX.Element;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DockLocation } from "../DockLocation";
|
|
3
|
+
import { I18nLabel } from "../I18nLabel";
|
|
4
|
+
import { Action } from "../model/Action";
|
|
5
|
+
import { BorderNode } from "../model/BorderNode";
|
|
6
|
+
import { Model } from "../model/Model";
|
|
7
|
+
import { Node } from "../model/Node";
|
|
8
|
+
import { TabNode } from "../model/TabNode";
|
|
9
|
+
import { TabSetNode } from "../model/TabSetNode";
|
|
10
|
+
import { Rect } from "../Rect";
|
|
11
|
+
import { IJsonTabNode } from "../model/IJsonModel";
|
|
12
|
+
export type CustomDragCallback = (dragging: TabNode | IJsonTabNode, over: TabNode, x: number, y: number, location: DockLocation) => void;
|
|
13
|
+
export type DragRectRenderCallback = (content: React.ReactElement | undefined, node?: Node, json?: IJsonTabNode) => React.ReactElement | undefined;
|
|
14
|
+
export type FloatingTabPlaceholderRenderCallback = (dockPopout: () => void, showPopout: () => void) => React.ReactElement | undefined;
|
|
15
|
+
export type NodeMouseEvent = (node: TabNode | TabSetNode | BorderNode, event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
16
|
+
export type ShowOverflowMenuCallback = (node: TabSetNode | BorderNode, mouseEvent: React.MouseEvent<HTMLElement, MouseEvent>, items: {
|
|
17
|
+
index: number;
|
|
18
|
+
node: TabNode;
|
|
19
|
+
}[], onSelect: (item: {
|
|
20
|
+
index: number;
|
|
21
|
+
node: TabNode;
|
|
22
|
+
}) => void) => void;
|
|
23
|
+
export type TabSetPlaceHolderCallback = (node: TabSetNode) => React.ReactNode;
|
|
24
|
+
export type IconFactory = (node: TabNode) => React.ReactNode;
|
|
25
|
+
export type TitleFactory = (node: TabNode) => ITitleObject | React.ReactNode;
|
|
26
|
+
export interface ILayoutProps {
|
|
27
|
+
model: Model;
|
|
28
|
+
factory: (node: TabNode) => React.ReactNode;
|
|
29
|
+
font?: IFontValues;
|
|
30
|
+
fontFamily?: string;
|
|
31
|
+
iconFactory?: IconFactory;
|
|
32
|
+
titleFactory?: TitleFactory;
|
|
33
|
+
icons?: IIcons;
|
|
34
|
+
onAction?: (action: Action) => Action | undefined;
|
|
35
|
+
onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void;
|
|
36
|
+
onRenderTabSet?: (tabSetNode: TabSetNode | BorderNode, renderValues: ITabSetRenderValues) => void;
|
|
37
|
+
onModelChange?: (model: Model, action: Action) => void;
|
|
38
|
+
onExternalDrag?: (event: React.DragEvent<HTMLDivElement>) => undefined | {
|
|
39
|
+
dragText: string;
|
|
40
|
+
json: any;
|
|
41
|
+
onDrop?: (node?: Node, event?: Event) => void;
|
|
42
|
+
};
|
|
43
|
+
classNameMapper?: (defaultClassName: string) => string;
|
|
44
|
+
i18nMapper?: (id: I18nLabel, param?: string) => string | undefined;
|
|
45
|
+
supportsPopout?: boolean | undefined;
|
|
46
|
+
popoutURL?: string | undefined;
|
|
47
|
+
realtimeResize?: boolean | undefined;
|
|
48
|
+
onTabDrag?: (dragging: TabNode | IJsonTabNode, over: TabNode, x: number, y: number, location: DockLocation, refresh: () => void) => undefined | {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
callback: CustomDragCallback;
|
|
54
|
+
invalidated?: () => void;
|
|
55
|
+
cursor?: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
onRenderDragRect?: DragRectRenderCallback;
|
|
58
|
+
onRenderFloatingTabPlaceholder?: FloatingTabPlaceholderRenderCallback;
|
|
59
|
+
onContextMenu?: NodeMouseEvent;
|
|
60
|
+
onAuxMouseClick?: NodeMouseEvent;
|
|
61
|
+
onShowOverflowMenu?: ShowOverflowMenuCallback;
|
|
62
|
+
onTabSetPlaceHolder?: TabSetPlaceHolderCallback;
|
|
63
|
+
}
|
|
64
|
+
export interface IFontValues {
|
|
65
|
+
size?: string;
|
|
66
|
+
family?: string;
|
|
67
|
+
style?: string;
|
|
68
|
+
weight?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ITabSetRenderValues {
|
|
71
|
+
headerContent?: React.ReactNode;
|
|
72
|
+
centerContent?: React.ReactNode;
|
|
73
|
+
stickyButtons: React.ReactNode[];
|
|
74
|
+
buttons: React.ReactNode[];
|
|
75
|
+
headerButtons: React.ReactNode[];
|
|
76
|
+
overflowPosition: number | undefined;
|
|
77
|
+
}
|
|
78
|
+
export interface ITabRenderValues {
|
|
79
|
+
leading: React.ReactNode;
|
|
80
|
+
content: React.ReactNode;
|
|
81
|
+
name: string;
|
|
82
|
+
buttons: React.ReactNode[];
|
|
83
|
+
}
|
|
84
|
+
export interface ITitleObject {
|
|
85
|
+
titleContent: React.ReactNode;
|
|
86
|
+
name: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ILayoutState {
|
|
89
|
+
rect: Rect;
|
|
90
|
+
calculatedHeaderBarSize: number;
|
|
91
|
+
calculatedTabBarSize: number;
|
|
92
|
+
calculatedBorderBarSize: number;
|
|
93
|
+
editingTab?: TabNode;
|
|
94
|
+
showHiddenBorder: DockLocation;
|
|
95
|
+
portal?: React.ReactPortal;
|
|
96
|
+
showEdges?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface IIcons {
|
|
99
|
+
close?: React.ReactNode | ((tabNode: TabNode) => React.ReactNode);
|
|
100
|
+
closeTabset?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
101
|
+
popout?: React.ReactNode | ((tabNode: TabNode) => React.ReactNode);
|
|
102
|
+
maximize?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
103
|
+
restore?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
104
|
+
more?: React.ReactNode | ((tabSetNode: TabSetNode | BorderNode, hiddenTabs: {
|
|
105
|
+
node: TabNode;
|
|
106
|
+
index: number;
|
|
107
|
+
}[]) => React.ReactNode);
|
|
108
|
+
edgeArrow?: React.ReactNode;
|
|
109
|
+
}
|
|
110
|
+
export interface ICustomDropDestination {
|
|
111
|
+
rect: Rect;
|
|
112
|
+
callback: CustomDragCallback;
|
|
113
|
+
invalidated: (() => void) | undefined;
|
|
114
|
+
dragging: TabNode | IJsonTabNode;
|
|
115
|
+
over: TabNode;
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
location: DockLocation;
|
|
119
|
+
cursor: string | undefined;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A React component that hosts a multi-tabbed layout
|
|
123
|
+
*/
|
|
124
|
+
export declare class Layout extends React.Component<ILayoutProps, ILayoutState> {
|
|
125
|
+
constructor(props: ILayoutProps);
|
|
126
|
+
/**
|
|
127
|
+
* Adds a new tab to the given tabset
|
|
128
|
+
* @param tabsetId the id of the tabset where the new tab will be added
|
|
129
|
+
* @param json the json for the new tab node
|
|
130
|
+
* @returns the added tab node or undefined
|
|
131
|
+
*/
|
|
132
|
+
addTabToTabSet(tabsetId: string, json: IJsonTabNode): TabNode | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Adds a new tab to the active tabset (if there is one)
|
|
135
|
+
* @param json the json for the new tab node
|
|
136
|
+
* @returns the added tab node or undefined
|
|
137
|
+
*/
|
|
138
|
+
addTabToActiveTabSet(json: IJsonTabNode): TabNode | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Adds a new tab by dragging a labeled panel to the drop location, dragging starts immediatelly
|
|
141
|
+
* @param dragText the text to show on the drag panel
|
|
142
|
+
* @param json the json for the new tab node
|
|
143
|
+
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
144
|
+
*/
|
|
145
|
+
addTabWithDragAndDrop(dragText: string | undefined, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
|
|
146
|
+
/**
|
|
147
|
+
* Move a tab/tabset using drag and drop
|
|
148
|
+
* @param node the tab or tabset to drag
|
|
149
|
+
* @param dragText the text to show on the drag panel
|
|
150
|
+
*/
|
|
151
|
+
moveTabWithDragAndDrop(node: TabNode | TabSetNode, dragText?: string): void;
|
|
152
|
+
/**
|
|
153
|
+
* Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you
|
|
154
|
+
* mouse down on the panel
|
|
155
|
+
*
|
|
156
|
+
* @param dragText the text to show on the drag panel
|
|
157
|
+
* @param json the json for the new tab node
|
|
158
|
+
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
159
|
+
*/
|
|
160
|
+
addTabWithDragAndDropIndirect(dragText: string | undefined, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
|
|
161
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@aptre/flex-layout",
|
|
3
3
|
"author": "Caplin Systems Ltd",
|
|
4
4
|
"description": "A multi-tab docking layout manager",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.1",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"main": "./dist/index.mjs",
|
|
31
31
|
"module": "./dist/index.mjs",
|
|
32
|
-
"types": "./
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
33
|
"exports": {
|
|
34
34
|
".": "./dist/index.mjs",
|
|
35
35
|
"./style": "./style/",
|
|
@@ -57,12 +57,13 @@
|
|
|
57
57
|
"dist/"
|
|
58
58
|
],
|
|
59
59
|
"scripts": {
|
|
60
|
-
"build": "npm run build:style && npm run build:doc && npm run build:lib",
|
|
61
|
-
"build:min": "npm run build:style && npm run build:doc && npm run build:lib:min",
|
|
60
|
+
"build": "npm run build:style && npm run build:doc && npm run build:lib && npm run build:types",
|
|
61
|
+
"build:min": "npm run build:style && npm run build:doc && npm run build:lib:min && npm run build:types",
|
|
62
62
|
"build:lib": "rimraf ./dist && esbuild --bundle --external:react --external:react-dom --format=esm --target=es2022 --platform=browser --outfile=./dist/index.mjs ./src/index.ts",
|
|
63
63
|
"build:lib:min": "npm run build:lib -- --minify",
|
|
64
64
|
"build:doc": "typedoc --out typedoc --exclude \"**/examples/**/*.tsx\" --excludeInternal --disableSources --excludePrivate --excludeProtected --readme none ./src",
|
|
65
65
|
"build:style": "sass style/underline.scss style/underline.css && sass style/gray.scss style/gray.css && sass style/light.scss style/light.css && sass style/dark.scss style/dark.css",
|
|
66
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist/",
|
|
66
67
|
"test": "tsc --project tsconfig.json --noEmit",
|
|
67
68
|
"lint": "eslint src/*",
|
|
68
69
|
"format": "prettier --write './style/*.scss' './{src,declarations}/**/(*.ts|*.tsx|*.html)' package.json"
|
|
@@ -85,7 +86,6 @@
|
|
|
85
86
|
"prismjs": "^1.28.0",
|
|
86
87
|
"react": "^18.0.0",
|
|
87
88
|
"react-dom": "^18.0.0",
|
|
88
|
-
"react-scripts": "5.0.1",
|
|
89
89
|
"rimraf": "^5.0.5",
|
|
90
90
|
"sass": "^1.50.0",
|
|
91
91
|
"typedoc": "^0.25.0",
|