@aptre/flex-layout 0.2.0 → 0.2.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/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/index.mjs +260 -52
- 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 +11 -8
- package/tsconfig.json +1 -0
- package/typedoc/assets/main.js +2 -2
- package/typedoc/assets/style.css +35 -15
- package/typedoc/classes/Action.html +1 -1
- package/typedoc/classes/Actions.html +1 -1
- package/typedoc/classes/BorderNode.html +2 -2
- package/typedoc/classes/BorderSet.html +1 -1
- package/typedoc/classes/DockLocation.html +1 -1
- package/typedoc/classes/DragDrop.html +1 -1
- package/typedoc/classes/DropInfo.html +1 -1
- package/typedoc/classes/Layout.html +13 -13
- package/typedoc/classes/Model.html +1 -1
- package/typedoc/classes/Node.html +2 -2
- package/typedoc/classes/Orientation.html +1 -1
- package/typedoc/classes/Rect.html +1 -1
- package/typedoc/classes/RowNode.html +2 -2
- package/typedoc/classes/SplitterNode.html +2 -2
- package/typedoc/classes/TabNode.html +3 -3
- package/typedoc/classes/TabSetNode.html +2 -2
- package/typedoc/enums/CLASSES.html +1 -1
- package/typedoc/enums/I18nLabel.html +1 -1
- package/typedoc/enums/ICloseType.html +1 -1
- package/typedoc/hierarchy.html +1 -0
- package/typedoc/index.html +1 -1
- package/typedoc/interfaces/IBorderAttributes.html +2 -2
- package/typedoc/interfaces/ICustomDropDestination.html +2 -2
- package/typedoc/interfaces/IDraggable.html +1 -1
- package/typedoc/interfaces/IDropTarget.html +1 -1
- package/typedoc/interfaces/IFontValues.html +2 -2
- package/typedoc/interfaces/IGlobalAttributes.html +2 -2
- package/typedoc/interfaces/IIcons.html +2 -2
- package/typedoc/interfaces/IJsonBorderNode.html +2 -2
- package/typedoc/interfaces/IJsonModel.html +2 -2
- package/typedoc/interfaces/IJsonRowNode.html +2 -2
- package/typedoc/interfaces/IJsonTabNode.html +2 -2
- package/typedoc/interfaces/IJsonTabSetNode.html +2 -2
- package/typedoc/interfaces/ILayoutProps.html +2 -2
- package/typedoc/interfaces/ILayoutState.html +2 -2
- package/typedoc/interfaces/IRowAttributes.html +2 -2
- package/typedoc/interfaces/ITabAttributes.html +2 -2
- package/typedoc/interfaces/ITabRenderValues.html +2 -2
- package/typedoc/interfaces/ITabSetAttributes.html +2 -2
- package/typedoc/interfaces/ITabSetRenderValues.html +2 -2
- package/typedoc/interfaces/ITitleObject.html +2 -2
- package/typedoc/types/CustomDragCallback.html +1 -1
- package/typedoc/types/DragRectRenderCallback.html +1 -1
- package/typedoc/types/FloatingTabPlaceholderRenderCallback.html +1 -1
- package/typedoc/types/IBorderLocation.html +1 -1
- package/typedoc/types/IInsets.html +1 -1
- package/typedoc/types/ITabLocation.html +1 -1
- package/typedoc/types/IconFactory.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/types/TitleFactory.html +1 -1
|
@@ -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(): string;
|
|
@@ -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.2",
|
|
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"
|
|
@@ -71,21 +72,23 @@
|
|
|
71
72
|
"react": "^18.0.0",
|
|
72
73
|
"react-dom": "^18.0.0"
|
|
73
74
|
},
|
|
74
|
-
"
|
|
75
|
-
"
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"ulidx": "^2.2.1"
|
|
76
77
|
},
|
|
77
|
-
"dependencies": {},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/node": "^20.8.7",
|
|
80
80
|
"@types/prismjs": "^1.26.0",
|
|
81
81
|
"@types/react": "^18.2.31",
|
|
82
82
|
"@types/react-dom": "^18.0.1",
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
84
|
+
"@typescript-eslint/parser": "^6.15.0",
|
|
83
85
|
"esbuild": "^0.19.5",
|
|
86
|
+
"eslint": "^8.56.0",
|
|
87
|
+
"eslint-plugin-react": "^7.33.2",
|
|
84
88
|
"prettier": "^3.0.0",
|
|
85
89
|
"prismjs": "^1.28.0",
|
|
86
90
|
"react": "^18.0.0",
|
|
87
91
|
"react-dom": "^18.0.0",
|
|
88
|
-
"react-scripts": "5.0.1",
|
|
89
92
|
"rimraf": "^5.0.5",
|
|
90
93
|
"sass": "^1.50.0",
|
|
91
94
|
"typedoc": "^0.25.0",
|