@aptre/flex-layout 0.2.4 → 0.3.0-beta.2
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/README.md +154 -311
- package/dist/DockLocation.d.ts +2 -2
- package/dist/DropInfo.d.ts +4 -4
- package/dist/I18nLabel.d.ts +7 -9
- package/dist/Rect.d.ts +14 -1
- package/dist/Types.d.ts +16 -0
- package/dist/index.d.ts +21 -22
- package/dist/index.mjs +4529 -4618
- package/dist/model/Actions.d.ts +40 -23
- package/dist/model/BorderNode.d.ts +10 -14
- package/dist/model/BorderSet.d.ts +1 -2
- package/dist/model/IJsonModel.d.ts +697 -35
- package/dist/model/LayoutWindow.d.ts +28 -0
- package/dist/model/Model.d.ts +29 -24
- package/dist/model/Node.d.ts +5 -5
- package/dist/model/RowNode.d.ts +5 -6
- package/dist/model/TabNode.d.ts +15 -8
- package/dist/model/TabSetNode.d.ts +13 -10
- package/dist/view/BorderTab.d.ts +2 -0
- package/dist/view/Icons.d.ts +1 -0
- package/dist/view/Layout.d.ts +95 -116
- package/dist/view/Row.d.ts +1 -0
- package/dist/view/SizeTracker.d.ts +10 -0
- package/dist/view/Utils.d.ts +11 -1
- package/package.json +21 -25
- package/style/_base.scss +138 -32
- package/style/dark.css +145 -40
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -1
- package/style/gray.css +144 -39
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -0
- package/style/light.css +147 -42
- package/style/light.css.map +1 -1
- package/style/light.scss +4 -2
- package/style/rounded.css +697 -0
- package/style/rounded.css.map +1 -0
- package/style/rounded.scss +193 -0
- package/style/underline.css +145 -40
- package/style/underline.css.map +1 -1
- package/style/underline.scss +2 -0
- package/tsconfig.json +3 -3
- package/typedoc/assets/hierarchy.js +1 -0
- package/typedoc/assets/highlight.css +18 -18
- package/typedoc/assets/icons.js +17 -14
- package/typedoc/assets/icons.svg +1 -1
- package/typedoc/assets/main.js +5 -4
- package/typedoc/assets/navigation.js +1 -1
- package/typedoc/assets/search.js +1 -1
- package/typedoc/assets/style.css +1422 -1224
- package/typedoc/classes/Action.html +2 -2
- package/typedoc/classes/Actions.html +65 -52
- package/typedoc/classes/BorderNode.html +26 -30
- package/typedoc/classes/BorderSet.html +2 -2
- package/typedoc/classes/DockLocation.html +9 -9
- package/typedoc/classes/DropInfo.html +3 -3
- package/typedoc/classes/Layout.html +99 -83
- package/typedoc/classes/LayoutWindow.html +12 -0
- package/typedoc/classes/Model.html +44 -40
- package/typedoc/classes/Node.html +12 -12
- package/typedoc/classes/Orientation.html +5 -5
- package/typedoc/classes/Rect.html +18 -11
- package/typedoc/classes/RowNode.html +16 -17
- package/typedoc/classes/TabNode.html +40 -34
- package/typedoc/classes/TabSetNode.html +40 -41
- package/typedoc/enums/CLASSES.html +94 -78
- package/typedoc/enums/I18nLabel.html +11 -13
- package/typedoc/enums/ICloseType.html +4 -4
- package/typedoc/hierarchy.html +1 -1
- package/typedoc/index.html +1 -51
- package/typedoc/interfaces/IBorderAttributes.html +32 -9
- package/typedoc/interfaces/IDraggable.html +1 -1
- package/typedoc/interfaces/IDropTarget.html +1 -1
- package/typedoc/interfaces/IGlobalAttributes.html +190 -47
- package/typedoc/interfaces/IIcons.html +5 -4
- package/typedoc/interfaces/IJsonBorderNode.html +32 -9
- package/typedoc/interfaces/IJsonModel.html +3 -2
- package/typedoc/interfaces/IJsonPopout.html +3 -0
- package/typedoc/interfaces/IJsonRect.html +5 -0
- package/typedoc/interfaces/IJsonRowNode.html +8 -5
- package/typedoc/interfaces/IJsonTabNode.html +73 -15
- package/typedoc/interfaces/IJsonTabSetNode.html +68 -23
- package/typedoc/interfaces/ILayoutProps.html +36 -22
- package/typedoc/interfaces/IRowAttributes.html +8 -5
- package/typedoc/interfaces/ITabAttributes.html +73 -15
- package/typedoc/interfaces/ITabRenderValues.html +5 -3
- package/typedoc/interfaces/ITabSetAttributes.html +63 -24
- package/typedoc/interfaces/ITabSetRenderValues.html +8 -7
- package/typedoc/types/DragRectRenderCallback.html +1 -1
- package/typedoc/types/IBorderLocation.html +1 -1
- package/typedoc/types/ITabLocation.html +1 -1
- package/typedoc/types/NodeMouseEvent.html +1 -1
- package/typedoc/types/ShowOverflowMenuCallback.html +1 -1
- package/typedoc/types/TabSetPlaceHolderCallback.html +1 -1
- package/typedoc/variables/FlexLayoutVersion.html +1 -0
- package/dist/DragDrop.d.ts +0 -15
- package/dist/model/SplitterNode.d.ts +0 -5
- package/typedoc/classes/DragDrop.html +0 -10
- package/typedoc/classes/SplitterNode.html +0 -13
- package/typedoc/interfaces/ICustomDropDestination.html +0 -10
- package/typedoc/interfaces/IFontValues.html +0 -5
- package/typedoc/interfaces/ILayoutState.html +0 -9
- package/typedoc/interfaces/ITitleObject.html +0 -3
- package/typedoc/types/CustomDragCallback.html +0 -1
- package/typedoc/types/FloatingTabPlaceholderRenderCallback.html +0 -1
- package/typedoc/types/IInsets.html +0 -1
- package/typedoc/types/IconFactory.html +0 -1
- package/typedoc/types/TitleFactory.html +0 -1
- /package/dist/{PopupMenu.d.ts → view/DragContainer.d.ts} +0 -0
- /package/dist/view/{FloatingWindow.d.ts → Overlay.d.ts} +0 -0
- /package/dist/view/{FloatingWindowTab.d.ts → PopoutWindow.d.ts} +0 -0
- /package/dist/view/{TabFloating.d.ts → PopupMenu.d.ts} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Rect } from "../Rect";
|
|
2
|
+
import { IJsonPopout } from "./IJsonModel";
|
|
3
|
+
import { Model } from "./Model";
|
|
4
|
+
import { RowNode } from "./RowNode";
|
|
5
|
+
import { Node } from "./Node";
|
|
6
|
+
import { TabSetNode } from "./TabSetNode";
|
|
7
|
+
import { LayoutInternal } from "../view/Layout";
|
|
8
|
+
export declare class LayoutWindow {
|
|
9
|
+
private _windowId;
|
|
10
|
+
private _layout;
|
|
11
|
+
private _rect;
|
|
12
|
+
private _window?;
|
|
13
|
+
private _root?;
|
|
14
|
+
private _maximizedTabSet?;
|
|
15
|
+
private _activeTabSet?;
|
|
16
|
+
private _toScreenRectFunction;
|
|
17
|
+
constructor(windowId: string, rect: Rect);
|
|
18
|
+
visitNodes(fn: (node: Node, level: number) => void): void;
|
|
19
|
+
get windowId(): string;
|
|
20
|
+
get rect(): Rect;
|
|
21
|
+
get layout(): LayoutInternal | undefined;
|
|
22
|
+
get window(): Window | undefined;
|
|
23
|
+
get root(): RowNode | undefined;
|
|
24
|
+
get maximizedTabSet(): TabSetNode | undefined;
|
|
25
|
+
get activeTabSet(): TabSetNode | undefined;
|
|
26
|
+
toJson(): IJsonPopout;
|
|
27
|
+
static fromJson(windowJson: IJsonPopout, model: Model, windowId: string): LayoutWindow;
|
|
28
|
+
}
|
package/dist/model/Model.d.ts
CHANGED
|
@@ -1,47 +1,51 @@
|
|
|
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
|
|
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
|
+
import { LayoutWindow } from "./LayoutWindow";
|
|
9
10
|
/**
|
|
10
11
|
* Class containing the Tree of Nodes used by the FlexLayout component
|
|
11
12
|
*/
|
|
12
13
|
export declare class Model {
|
|
14
|
+
static MAIN_WINDOW_ID: string;
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
16
|
+
* Update the node tree by performing the given action,
|
|
17
|
+
* Actions should be generated via static methods on the Actions class
|
|
18
|
+
* @param action the action to perform
|
|
19
|
+
* @returns added Node for Actions.addNode, windowId for createWindow
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
doAction(action: Action): any;
|
|
19
22
|
/**
|
|
20
23
|
* Get the currently active tabset node
|
|
21
24
|
*/
|
|
22
|
-
getActiveTabset(): TabSetNode | undefined;
|
|
25
|
+
getActiveTabset(windowId?: string): TabSetNode | undefined;
|
|
23
26
|
/**
|
|
24
27
|
* Get the currently maximized tabset node
|
|
25
28
|
*/
|
|
26
|
-
getMaximizedTabset(): TabSetNode | undefined;
|
|
29
|
+
getMaximizedTabset(windowId?: string): TabSetNode | undefined;
|
|
27
30
|
/**
|
|
28
31
|
* Gets the root RowNode of the model
|
|
29
32
|
* @returns {RowNode}
|
|
30
33
|
*/
|
|
31
|
-
getRoot(): RowNode;
|
|
34
|
+
getRoot(windowId?: string): RowNode;
|
|
32
35
|
isRootOrientationVertical(): boolean;
|
|
33
|
-
isUseVisibility(): boolean;
|
|
34
36
|
isEnableRotateBorderIcons(): boolean;
|
|
35
37
|
/**
|
|
36
38
|
* Gets the
|
|
37
39
|
* @returns {BorderSet|*}
|
|
38
40
|
*/
|
|
39
41
|
getBorderSet(): BorderSet;
|
|
42
|
+
getwindowsMap(): Map<string, LayoutWindow>;
|
|
40
43
|
/**
|
|
41
44
|
* Visits all the nodes in the model and calls the given function for each
|
|
42
45
|
* @param fn a function that takes visited node and a integer level as parameters
|
|
43
46
|
*/
|
|
44
47
|
visitNodes(fn: (node: Node, level: number) => void): void;
|
|
48
|
+
visitWindowNodes(windowId: string, fn: (node: Node, level: number) => void): void;
|
|
45
49
|
/**
|
|
46
50
|
* Gets a node by its id
|
|
47
51
|
* @param id the id to find
|
|
@@ -52,23 +56,22 @@ export declare class Model {
|
|
|
52
56
|
* @param node The top node you want to begin searching from, deafults to the root node
|
|
53
57
|
* @returns The first Tab Set
|
|
54
58
|
*/
|
|
55
|
-
getFirstTabSet(node?: Node):
|
|
59
|
+
getFirstTabSet(node?: Node): TabSetNode;
|
|
56
60
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @
|
|
60
|
-
* @returns added Node for Actions.addNode; undefined otherwise
|
|
61
|
+
* Loads the model from the given json object
|
|
62
|
+
* @param json the json model to load
|
|
63
|
+
* @returns {Model} a new Model object
|
|
61
64
|
*/
|
|
62
|
-
|
|
65
|
+
static fromJson(json: IJsonModel): Model;
|
|
63
66
|
/**
|
|
64
67
|
* Converts the model to a json object
|
|
65
68
|
* @returns {IJsonModel} json object that represents this model
|
|
66
69
|
*/
|
|
67
70
|
toJson(): IJsonModel;
|
|
68
71
|
getSplitterSize(): number;
|
|
69
|
-
isLegacyOverflowMenu(): boolean;
|
|
70
72
|
getSplitterExtra(): number;
|
|
71
73
|
isEnableEdgeDock(): boolean;
|
|
74
|
+
isSplitterEnableHandle(): boolean;
|
|
72
75
|
/**
|
|
73
76
|
* Sets a function to allow/deny dropping a node
|
|
74
77
|
* @param onAllowDrop function that takes the drag node and DropInfo and returns true if the drop is allowed
|
|
@@ -81,6 +84,8 @@ export declare class Model {
|
|
|
81
84
|
* @param onCreateTabSet
|
|
82
85
|
*/
|
|
83
86
|
setOnCreateTabSet(onCreateTabSet: (tabNode?: TabNode) => ITabSetAttributes): void;
|
|
84
|
-
|
|
87
|
+
addChangeListener(listener: (action: Action) => void): void;
|
|
88
|
+
removeChangeListener(listener: (action: Action) => void): void;
|
|
85
89
|
toString(): string;
|
|
90
|
+
static toTypescriptInterfaces(): void;
|
|
86
91
|
}
|
package/dist/model/Node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Orientation } from "../Orientation
|
|
2
|
-
import { Rect } from "../Rect
|
|
3
|
-
import { IJsonBorderNode, IJsonRowNode, IJsonTabNode, IJsonTabSetNode } from "./IJsonModel
|
|
4
|
-
import { Model } from "./Model
|
|
1
|
+
import { Orientation } from "../Orientation";
|
|
2
|
+
import { Rect } from "../Rect";
|
|
3
|
+
import { IJsonBorderNode, IJsonRowNode, IJsonTabNode, IJsonTabSetNode } from "./IJsonModel";
|
|
4
|
+
import { Model } from "./Model";
|
|
5
5
|
export declare abstract class Node {
|
|
6
6
|
getId(): string;
|
|
7
7
|
getModel(): Model;
|
|
@@ -9,7 +9,7 @@ export declare abstract class Node {
|
|
|
9
9
|
getParent(): Node | undefined;
|
|
10
10
|
getChildren(): Node[];
|
|
11
11
|
getRect(): Rect;
|
|
12
|
-
|
|
12
|
+
getPath(): string;
|
|
13
13
|
getOrientation(): Orientation;
|
|
14
14
|
setEventListener(event: string, callback: (params: any) => void): void;
|
|
15
15
|
removeEventListener(event: string): void;
|
package/dist/model/RowNode.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { IDropTarget } from "./IDropTarget
|
|
2
|
-
import { IJsonRowNode } from "./IJsonModel
|
|
3
|
-
import { Node } from "./Node
|
|
1
|
+
import { IDropTarget } from "./IDropTarget";
|
|
2
|
+
import { IJsonRowNode } from "./IJsonModel";
|
|
3
|
+
import { Node } from "./Node";
|
|
4
4
|
export declare class RowNode extends Node implements IDropTarget {
|
|
5
5
|
static readonly TYPE = "row";
|
|
6
6
|
getWeight(): number;
|
|
7
|
-
getWidth(): number | undefined;
|
|
8
|
-
getHeight(): number | undefined;
|
|
9
7
|
toJson(): IJsonRowNode;
|
|
10
|
-
|
|
8
|
+
setWindowId(windowId: string): void;
|
|
9
|
+
normalizeWeights(): void;
|
|
11
10
|
}
|
package/dist/model/TabNode.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Node } from "./Node.js";
|
|
1
|
+
import { IDraggable } from "./IDraggable";
|
|
2
|
+
import { IJsonTabNode } from "./IJsonModel";
|
|
3
|
+
import { Node } from "./Node";
|
|
5
4
|
export declare class TabNode extends Node implements IDraggable {
|
|
6
5
|
static readonly TYPE = "tab";
|
|
7
|
-
getWindow(): Window | undefined;
|
|
8
|
-
getTabRect(): Rect | undefined;
|
|
9
6
|
getName(): string;
|
|
10
7
|
getHelpText(): string | undefined;
|
|
11
8
|
getComponent(): string | undefined;
|
|
9
|
+
getWindowId(): string;
|
|
10
|
+
getWindow(): Window | undefined;
|
|
12
11
|
/**
|
|
13
12
|
* Returns the config attribute that can be used to store node specific data that
|
|
14
13
|
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
@@ -22,16 +21,24 @@ export declare class TabNode extends Node implements IDraggable {
|
|
|
22
21
|
* NOT be saved in the json.
|
|
23
22
|
*/
|
|
24
23
|
getExtraData(): Record<string, any>;
|
|
25
|
-
|
|
24
|
+
isPoppedOut(): boolean;
|
|
25
|
+
isSelected(): boolean;
|
|
26
26
|
getIcon(): string | undefined;
|
|
27
27
|
isEnableClose(): boolean;
|
|
28
28
|
getCloseType(): number;
|
|
29
|
-
|
|
29
|
+
isEnablePopout(): boolean;
|
|
30
|
+
isEnablePopoutIcon(): boolean;
|
|
31
|
+
isEnablePopoutOverlay(): boolean;
|
|
30
32
|
isEnableDrag(): boolean;
|
|
31
33
|
isEnableRename(): boolean;
|
|
34
|
+
isEnableWindowReMount(): boolean;
|
|
32
35
|
getClassName(): string | undefined;
|
|
33
36
|
getContentClassName(): string | undefined;
|
|
34
37
|
getTabSetClassName(): string | undefined;
|
|
35
38
|
isEnableRenderOnDemand(): boolean;
|
|
39
|
+
getMinWidth(): number;
|
|
40
|
+
getMinHeight(): number;
|
|
41
|
+
getMaxWidth(): number;
|
|
42
|
+
getMaxHeight(): number;
|
|
36
43
|
toJson(): IJsonTabNode;
|
|
37
44
|
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { IDraggable } from "./IDraggable
|
|
2
|
-
import { IDropTarget } from "./IDropTarget
|
|
3
|
-
import { IJsonTabSetNode } from "./IJsonModel
|
|
4
|
-
import { Node } from "./Node
|
|
1
|
+
import { IDraggable } from "./IDraggable";
|
|
2
|
+
import { IDropTarget } from "./IDropTarget";
|
|
3
|
+
import { IJsonTabSetNode } from "./IJsonModel";
|
|
4
|
+
import { Node } from "./Node";
|
|
5
5
|
export declare class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
6
6
|
static readonly TYPE = "tabset";
|
|
7
7
|
getName(): string | undefined;
|
|
8
|
+
isEnableActiveIcon(): boolean;
|
|
8
9
|
getSelected(): number;
|
|
9
10
|
getSelectedNode(): Node | undefined;
|
|
10
11
|
getWeight(): number;
|
|
11
|
-
|
|
12
|
+
getAttrMinWidth(): number;
|
|
13
|
+
getAttrMinHeight(): number;
|
|
12
14
|
getMinWidth(): number;
|
|
13
|
-
getHeight(): number | undefined;
|
|
14
15
|
getMinHeight(): number;
|
|
16
|
+
getAttrMaxWidth(): number;
|
|
17
|
+
getAttrMaxHeight(): number;
|
|
18
|
+
getMaxWidth(): number;
|
|
19
|
+
getMaxHeight(): number;
|
|
15
20
|
/**
|
|
16
21
|
* Returns the config attribute that can be used to store node specific data that
|
|
17
22
|
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
@@ -24,18 +29,16 @@ export declare class TabSetNode extends Node implements IDraggable, IDropTarget
|
|
|
24
29
|
isActive(): boolean;
|
|
25
30
|
isEnableDeleteWhenEmpty(): boolean;
|
|
26
31
|
isEnableDrop(): boolean;
|
|
32
|
+
isEnableTabWrap(): boolean;
|
|
27
33
|
isEnableDrag(): boolean;
|
|
28
34
|
isEnableDivide(): boolean;
|
|
29
35
|
isEnableMaximize(): boolean;
|
|
30
36
|
isEnableClose(): boolean;
|
|
31
37
|
isEnableSingleTabStretch(): boolean;
|
|
32
|
-
canMaximize(): boolean;
|
|
33
38
|
isEnableTabStrip(): boolean;
|
|
34
39
|
isAutoSelectTab(): boolean;
|
|
35
40
|
getClassNameTabStrip(): string | undefined;
|
|
36
|
-
getClassNameHeader(): string | undefined;
|
|
37
|
-
getHeaderHeight(): number;
|
|
38
|
-
getTabStripHeight(): number;
|
|
39
41
|
getTabLocation(): string;
|
|
40
42
|
toJson(): IJsonTabSetNode;
|
|
43
|
+
getWindowId(): string;
|
|
41
44
|
}
|
package/dist/view/Icons.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare const OverflowIcon: () => React.JSX.Element;
|
|
|
5
5
|
export declare const EdgeIcon: () => React.JSX.Element;
|
|
6
6
|
export declare const PopoutIcon: () => React.JSX.Element;
|
|
7
7
|
export declare const RestoreIcon: () => React.JSX.Element;
|
|
8
|
+
export declare const AsterickIcon: () => React.JSX.Element;
|
package/dist/view/Layout.d.ts
CHANGED
|
@@ -1,100 +1,130 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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.js";
|
|
11
|
-
import { IJsonTabNode } from "../model/IJsonModel.js";
|
|
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;
|
|
2
|
+
import { I18nLabel } from "../I18nLabel";
|
|
3
|
+
import { Action } from "../model/Action";
|
|
4
|
+
import { BorderNode } from "../model/BorderNode";
|
|
5
|
+
import { IJsonTabNode } from "../model/IJsonModel";
|
|
6
|
+
import { Model } from "../model/Model";
|
|
7
|
+
import { Node } from "../model/Node";
|
|
8
|
+
import { TabNode } from "../model/TabNode";
|
|
9
|
+
import { TabSetNode } from "../model/TabSetNode";
|
|
26
10
|
export interface ILayoutProps {
|
|
11
|
+
/** the model for this layout */
|
|
27
12
|
model: Model;
|
|
13
|
+
/** factory function for creating the tab components */
|
|
28
14
|
factory: (node: TabNode) => React.ReactNode;
|
|
29
|
-
|
|
30
|
-
fontFamily?: string;
|
|
31
|
-
iconFactory?: IconFactory;
|
|
32
|
-
titleFactory?: TitleFactory;
|
|
15
|
+
/** object mapping keys among close, maximize, restore, more, popout to React nodes to use in place of the default icons, can alternatively return functions for creating the React nodes */
|
|
33
16
|
icons?: IIcons;
|
|
17
|
+
/** function called whenever the layout generates an action to update the model (allows for intercepting actions before they are dispatched to the model, for example, asking the user to confirm a tab close.) Returning undefined from the function will halt the action, otherwise return the action to continue */
|
|
34
18
|
onAction?: (action: Action) => Action | undefined;
|
|
19
|
+
/** function called when rendering a tab, allows leading (icon), content section, buttons and name used in overflow menu to be customized */
|
|
35
20
|
onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void;
|
|
21
|
+
/** function called when rendering a tabset, allows header and buttons to be customized */
|
|
36
22
|
onRenderTabSet?: (tabSetNode: TabSetNode | BorderNode, renderValues: ITabSetRenderValues) => void;
|
|
23
|
+
/** function called when model has changed */
|
|
37
24
|
onModelChange?: (model: Model, action: Action) => void;
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
/** function called when an external object (not a tab) gets dragged onto the layout, with a single dragenter argument. Should return either undefined to reject the drag/drop or an object with keys dragText, jsonDrop, to create a tab via drag (similar to a call to addTabToTabSet). Function onDropis passed the added tabNodeand thedrop DragEvent`, unless the drag was canceled. */
|
|
26
|
+
onExternalDrag?: (event: React.DragEvent<HTMLElement>) => undefined | {
|
|
40
27
|
json: any;
|
|
41
|
-
onDrop?: (node?: Node, event?:
|
|
28
|
+
onDrop?: (node?: Node, event?: React.DragEvent<HTMLElement>) => void;
|
|
42
29
|
};
|
|
30
|
+
/** function called with default css class name, return value is class name that will be used. Mainly for use with css modules. */
|
|
43
31
|
classNameMapper?: (defaultClassName: string) => string;
|
|
32
|
+
/** function called for each I18nLabel to allow user translation, currently used for tab and tabset move messages, return undefined to use default values */
|
|
44
33
|
i18nMapper?: (id: I18nLabel, param?: string) => string | undefined;
|
|
34
|
+
/** if left undefined will do simple check based on userAgent */
|
|
45
35
|
supportsPopout?: boolean | undefined;
|
|
36
|
+
/** URL of popout window relative to origin, defaults to popout.html */
|
|
46
37
|
popoutURL?: string | undefined;
|
|
38
|
+
/** boolean value, defaults to false, resize tabs as splitters are dragged. Warning: this can cause resizing to become choppy when tabs are slow to draw */
|
|
47
39
|
realtimeResize?: boolean | undefined;
|
|
48
|
-
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
width: number;
|
|
52
|
-
height: number;
|
|
53
|
-
callback: CustomDragCallback;
|
|
54
|
-
invalidated?: () => void;
|
|
55
|
-
cursor?: string | undefined;
|
|
56
|
-
};
|
|
40
|
+
/** callback for rendering the drag rectangles */
|
|
57
41
|
onRenderDragRect?: DragRectRenderCallback;
|
|
58
|
-
|
|
42
|
+
/** callback for handling context actions on tabs and tabsets */
|
|
59
43
|
onContextMenu?: NodeMouseEvent;
|
|
44
|
+
/** callback for handling mouse clicks on tabs and tabsets with alt, meta, shift keys, also handles center mouse clicks */
|
|
60
45
|
onAuxMouseClick?: NodeMouseEvent;
|
|
46
|
+
/** callback for handling the display of the tab overflow menu */
|
|
61
47
|
onShowOverflowMenu?: ShowOverflowMenuCallback;
|
|
48
|
+
/** callback for rendering a placeholder when a tabset is empty */
|
|
62
49
|
onTabSetPlaceHolder?: TabSetPlaceHolderCallback;
|
|
50
|
+
/** Name given to popout windows, defaults to 'Popout Window' */
|
|
51
|
+
popoutWindowName?: string;
|
|
63
52
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
/**
|
|
54
|
+
* A React component that hosts a multi-tabbed layout
|
|
55
|
+
*/
|
|
56
|
+
export declare class Layout extends React.Component<ILayoutProps> {
|
|
57
|
+
/** re-render the layout */
|
|
58
|
+
redraw(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Adds a new tab to the given tabset
|
|
61
|
+
* @param tabsetId the id of the tabset where the new tab will be added
|
|
62
|
+
* @param json the json for the new tab node
|
|
63
|
+
* @returns the added tab node or undefined
|
|
64
|
+
*/
|
|
65
|
+
addTabToTabSet(tabsetId: string, json: IJsonTabNode): TabNode | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Adds a new tab by dragging an item to the drop location, must be called from within an HTML
|
|
68
|
+
* drag start handler. You can use the setDragComponent() method to set the drag image before calling this
|
|
69
|
+
* method.
|
|
70
|
+
* @param event the drag start event
|
|
71
|
+
* @param json the json for the new tab node
|
|
72
|
+
* @param onDrop a callback to call when the drag is complete
|
|
73
|
+
*/
|
|
74
|
+
addTabWithDragAndDrop(event: DragEvent, json: IJsonTabNode, onDrop?: (node?: Node, event?: React.DragEvent<HTMLElement>) => void): void;
|
|
75
|
+
/**
|
|
76
|
+
* Move a tab/tabset using drag and drop, must be called from within an HTML
|
|
77
|
+
* drag start handler
|
|
78
|
+
* @param event the drag start event
|
|
79
|
+
* @param node the tab or tabset to drag
|
|
80
|
+
*/
|
|
81
|
+
moveTabWithDragAndDrop(event: DragEvent, node: TabNode | TabSetNode): void;
|
|
82
|
+
/**
|
|
83
|
+
* Adds a new tab to the active tabset (if there is one)
|
|
84
|
+
* @param json the json for the new tab node
|
|
85
|
+
* @returns the added tab node or undefined
|
|
86
|
+
*/
|
|
87
|
+
addTabToActiveTabSet(json: IJsonTabNode): TabNode | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the drag image from a react component for a drag event
|
|
90
|
+
* @param event the drag event
|
|
91
|
+
* @param component the react component to be used for the drag image
|
|
92
|
+
* @param x the x position of the drag cursor on the image
|
|
93
|
+
* @param y the x position of the drag cursor on the image
|
|
94
|
+
*/
|
|
95
|
+
setDragComponent(event: DragEvent, component: React.ReactNode, x: number, y: number): void;
|
|
96
|
+
/** Get the root div element of the layout */
|
|
97
|
+
getRootDiv(): HTMLDivElement | null;
|
|
69
98
|
}
|
|
99
|
+
export declare const FlexLayoutVersion = "0.8.1";
|
|
100
|
+
export type DragRectRenderCallback = (content: React.ReactNode | undefined, node?: Node, json?: IJsonTabNode) => React.ReactNode | undefined;
|
|
101
|
+
export type NodeMouseEvent = (node: TabNode | TabSetNode | BorderNode, event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
102
|
+
export type ShowOverflowMenuCallback = (node: TabSetNode | BorderNode, mouseEvent: React.MouseEvent<HTMLElement, MouseEvent>, items: {
|
|
103
|
+
index: number;
|
|
104
|
+
node: TabNode;
|
|
105
|
+
}[], onSelect: (item: {
|
|
106
|
+
index: number;
|
|
107
|
+
node: TabNode;
|
|
108
|
+
}) => void) => void;
|
|
109
|
+
export type TabSetPlaceHolderCallback = (node: TabSetNode) => React.ReactNode;
|
|
70
110
|
export interface ITabSetRenderValues {
|
|
71
|
-
|
|
72
|
-
centerContent?: React.ReactNode;
|
|
111
|
+
/** components that will be added after the tabs */
|
|
73
112
|
stickyButtons: React.ReactNode[];
|
|
113
|
+
/** components that will be added at the end of the tabset */
|
|
74
114
|
buttons: React.ReactNode[];
|
|
75
|
-
|
|
115
|
+
/** position to insert overflow button within [...stickyButtons, ...buttons]
|
|
116
|
+
* if left undefined position will be after the sticky buttons (if any)
|
|
117
|
+
*/
|
|
76
118
|
overflowPosition: number | undefined;
|
|
77
119
|
}
|
|
78
120
|
export interface ITabRenderValues {
|
|
121
|
+
/** the icon or other leading component */
|
|
79
122
|
leading: React.ReactNode;
|
|
123
|
+
/** the main tab text/component */
|
|
80
124
|
content: React.ReactNode;
|
|
81
|
-
|
|
125
|
+
/** a set of react components to add to the tab after the content */
|
|
82
126
|
buttons: React.ReactNode[];
|
|
83
127
|
}
|
|
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
128
|
export interface IIcons {
|
|
99
129
|
close?: React.ReactNode | ((tabNode: TabNode) => React.ReactNode);
|
|
100
130
|
closeTabset?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
@@ -106,56 +136,5 @@ export interface IIcons {
|
|
|
106
136
|
index: number;
|
|
107
137
|
}[]) => React.ReactNode);
|
|
108
138
|
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;
|
|
139
|
+
activeTabset?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
161
140
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Rect } from "../Rect";
|
|
3
|
+
export interface ISizeTrackerProps {
|
|
4
|
+
rect: Rect;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
forceRevision: number;
|
|
7
|
+
tabsRevision: number;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const SizeTracker: React.MemoExoticComponent<({ children }: ISizeTrackerProps) => React.JSX.Element>;
|
package/dist/view/Utils.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Node } from "../model/Node";
|
|
3
|
+
import { Rect } from "../Rect";
|
|
4
|
+
export declare function enablePointerOnIFrames(enable: boolean, currentDocument: Document): void;
|
|
5
|
+
export declare function getElementsByTagName(tag: string, currentDocument: Document): Element[];
|
|
6
|
+
export declare function startDrag(doc: Document, event: React.PointerEvent<HTMLElement>, drag: (x: number, y: number) => void, dragEnd: () => void, dragCancel: () => void): void;
|
|
7
|
+
export declare function canDockToWindow(node: Node): boolean;
|
|
8
|
+
export declare function keepOnScreen(rect: Rect): Rect;
|
|
9
|
+
export declare function isOnScreen(rect: Rect): boolean;
|
|
10
|
+
export declare function copyInlineStyles(source: HTMLElement, target: HTMLElement): boolean;
|
|
11
|
+
export declare function isSafari(): boolean;
|
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.3.0-beta.2",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"LICENSE",
|
|
55
55
|
"tsconfig.json",
|
|
56
56
|
"style/",
|
|
57
|
-
"declarations/",
|
|
58
57
|
"typedoc/",
|
|
59
58
|
"dist/"
|
|
60
59
|
],
|
|
@@ -67,8 +66,7 @@
|
|
|
67
66
|
"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",
|
|
68
67
|
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist/",
|
|
69
68
|
"test": "tsc --project tsconfig.json --noEmit",
|
|
70
|
-
"lint": "
|
|
71
|
-
"lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint -c .eslintrc.cjs ./",
|
|
69
|
+
"lint": "eslint src/*",
|
|
72
70
|
"format": "prettier --write './style/*.scss' './{src,declarations}/**/(*.ts|*.tsx|*.html)' package.json",
|
|
73
71
|
"release:version": "npm version patch -m \"release: v%s\" --no-git-tag-version",
|
|
74
72
|
"release:commit": "git reset && git add package.json && git commit -s -m \"release: v$npm_package_version\" && git tag v$npm_package_version",
|
|
@@ -79,29 +77,27 @@
|
|
|
79
77
|
"react": "^18.0.0",
|
|
80
78
|
"react-dom": "^18.0.0"
|
|
81
79
|
},
|
|
82
|
-
"dependencies": {
|
|
83
|
-
"ulidx": "^2.3.0"
|
|
84
|
-
},
|
|
80
|
+
"dependencies": {},
|
|
85
81
|
"devDependencies": {
|
|
86
|
-
"@
|
|
82
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
83
|
+
"@eslint/js": "^9.16.0",
|
|
84
|
+
"@types/node": "^22.10.1",
|
|
87
85
|
"@types/prismjs": "^1.26.0",
|
|
88
|
-
"@types/react": "^18.
|
|
89
|
-
"@types/react-dom": "^18.
|
|
90
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
91
|
-
"@typescript-eslint/parser": "^
|
|
92
|
-
"esbuild": "^0.
|
|
93
|
-
"eslint": "^
|
|
94
|
-
"eslint-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"eslint-plugin-unused-imports": "^4.0.0",
|
|
98
|
-
"prettier": "^3.2.5",
|
|
86
|
+
"@types/react": "^18.2.31",
|
|
87
|
+
"@types/react-dom": "^18.0.1",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
89
|
+
"@typescript-eslint/parser": "^8.17.0",
|
|
90
|
+
"esbuild": "^0.24.0",
|
|
91
|
+
"eslint": "^9.16.0",
|
|
92
|
+
"eslint-plugin-react": "^7.37.2",
|
|
93
|
+
"globals": "^15.13.0",
|
|
94
|
+
"prettier": "^3.0.0",
|
|
99
95
|
"prismjs": "^1.28.0",
|
|
100
|
-
"react": "^18.
|
|
101
|
-
"react-dom": "^18.
|
|
102
|
-
"rimraf": "^
|
|
103
|
-
"sass": "^1.
|
|
104
|
-
"typedoc": "^0.
|
|
105
|
-
"typescript": "^5.
|
|
96
|
+
"react": "^18.0.0",
|
|
97
|
+
"react-dom": "^18.0.0",
|
|
98
|
+
"rimraf": "^6.0.1",
|
|
99
|
+
"sass": "^1.50.0",
|
|
100
|
+
"typedoc": "^0.27.2",
|
|
101
|
+
"typescript": "^5.0.0"
|
|
106
102
|
}
|
|
107
103
|
}
|