@aptre/flex-layout 0.1.1 → 0.1.3
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/declarations/DragDrop.d.ts +18 -4
- package/declarations/DropInfo.d.ts +7 -1
- package/declarations/I18nLabel.d.ts +1 -1
- package/declarations/Rect.d.ts +4 -1
- package/declarations/Types.d.ts +1 -1
- package/declarations/index.d.ts +22 -22
- package/declarations/model/Actions.d.ts +14 -2
- package/declarations/model/ICloseType.d.ts +1 -1
- package/declarations/model/IDraggable.d.ts +1 -2
- package/declarations/model/IDropTarget.d.ts +1 -2
- package/declarations/model/IJsonModel.d.ts +6 -7
- package/declarations/model/Model.d.ts +6 -2
- package/declarations/model/Node.d.ts +12 -2
- package/declarations/model/TabSetNode.d.ts +4 -1
- package/declarations/view/Layout.d.ts +89 -39
- package/dist/index.mjs +1471 -361
- package/package.json +6 -1
- package/style/_base.scss +20 -18
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -3
- package/style/gray.css.map +1 -1
- package/style/gray.scss +4 -5
- package/style/light.css.map +1 -1
- package/style/light.scss +2 -2
- package/style/underline.css.map +1 -1
- package/style/underline.scss +8 -8
- package/typedoc/classes/Rect.html +1 -1
|
@@ -5,10 +5,24 @@ export declare class DragDrop {
|
|
|
5
5
|
resizeGlass(): void;
|
|
6
6
|
hideGlass(): void;
|
|
7
7
|
setGlassCursorOverride(cursor: string | undefined): void;
|
|
8
|
-
startDrag(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
startDrag(
|
|
9
|
+
event:
|
|
10
|
+
| Event
|
|
11
|
+
| React.MouseEvent<HTMLDivElement, MouseEvent>
|
|
12
|
+
| React.TouchEvent<HTMLDivElement>
|
|
13
|
+
| React.DragEvent<Element>
|
|
14
|
+
| undefined,
|
|
15
|
+
fDragStart:
|
|
16
|
+
| ((pos: { clientX: number; clientY: number }) => boolean)
|
|
17
|
+
| undefined,
|
|
18
|
+
fDragMove: ((event: React.MouseEvent<Element>) => void) | undefined,
|
|
19
|
+
fDragEnd: ((event: Event) => void) | undefined,
|
|
20
|
+
fDragCancel?: ((wasDragging: boolean) => void) | undefined,
|
|
21
|
+
fClick?: ((event: Event) => void) | undefined,
|
|
22
|
+
fDblClick?: ((event: Event) => void) | undefined,
|
|
23
|
+
currentDocument?: Document,
|
|
24
|
+
rootElement?: HTMLDivElement
|
|
25
|
+
): void;
|
|
12
26
|
isDragging(): boolean;
|
|
13
27
|
isActive(): boolean;
|
|
14
28
|
toString(): string;
|
|
@@ -8,5 +8,11 @@ export declare class DropInfo {
|
|
|
8
8
|
location: DockLocation;
|
|
9
9
|
index: number;
|
|
10
10
|
className: string;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(
|
|
12
|
+
node: Node & IDropTarget,
|
|
13
|
+
rect: Rect,
|
|
14
|
+
location: DockLocation,
|
|
15
|
+
index: number,
|
|
16
|
+
className: string
|
|
17
|
+
);
|
|
12
18
|
}
|
|
@@ -10,5 +10,5 @@ export declare enum I18nLabel {
|
|
|
10
10
|
Floating_Window_Message = "This panel is shown in a floating window",
|
|
11
11
|
Floating_Window_Show_Window = "Show window",
|
|
12
12
|
Floating_Window_Dock_Window = "Dock window",
|
|
13
|
-
Error_rendering_component = "Error rendering component"
|
|
13
|
+
Error_rendering_component = "Error rendering component",
|
|
14
14
|
}
|
package/declarations/Rect.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ export declare class Rect {
|
|
|
15
15
|
y: number;
|
|
16
16
|
};
|
|
17
17
|
positionElement(element: HTMLElement, position?: string): void;
|
|
18
|
-
styleWithPosition(
|
|
18
|
+
styleWithPosition(
|
|
19
|
+
style: Record<string, any>,
|
|
20
|
+
position?: string
|
|
21
|
+
): Record<string, any>;
|
|
19
22
|
contains(x: number, y: number): boolean;
|
|
20
23
|
removeInsets(insets: {
|
|
21
24
|
top: number;
|
package/declarations/Types.d.ts
CHANGED
|
@@ -74,5 +74,5 @@ export declare enum CLASSES {
|
|
|
74
74
|
FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE = "flexlayout__tab_toolbar_button-close",
|
|
75
75
|
FLEXLAYOUT__POPUP_MENU_CONTAINER = "flexlayout__popup_menu_container",
|
|
76
76
|
FLEXLAYOUT__POPUP_MENU_ITEM = "flexlayout__popup_menu_item",
|
|
77
|
-
FLEXLAYOUT__POPUP_MENU = "flexlayout__popup_menu"
|
|
77
|
+
FLEXLAYOUT__POPUP_MENU = "flexlayout__popup_menu",
|
|
78
78
|
}
|
package/declarations/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
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";
|
|
@@ -27,7 +27,13 @@ export declare class Actions {
|
|
|
27
27
|
* @param select (optional) whether to select the new tab, overriding autoSelectTab
|
|
28
28
|
* @returns {Action} the action
|
|
29
29
|
*/
|
|
30
|
-
static addNode(
|
|
30
|
+
static addNode(
|
|
31
|
+
json: any,
|
|
32
|
+
toNodeId: string,
|
|
33
|
+
location: DockLocation,
|
|
34
|
+
index: number,
|
|
35
|
+
select?: boolean
|
|
36
|
+
): Action;
|
|
31
37
|
/**
|
|
32
38
|
* Moves a node (tab or tabset) from one location to another
|
|
33
39
|
* @param fromNodeId the id of the node to move
|
|
@@ -37,7 +43,13 @@ export declare class Actions {
|
|
|
37
43
|
* @param select (optional) whether to select the moved tab(s) in new tabset, overriding autoSelectTab
|
|
38
44
|
* @returns {Action} the action
|
|
39
45
|
*/
|
|
40
|
-
static moveNode(
|
|
46
|
+
static moveNode(
|
|
47
|
+
fromNodeId: string,
|
|
48
|
+
toNodeId: string,
|
|
49
|
+
location: DockLocation,
|
|
50
|
+
index: number,
|
|
51
|
+
select?: boolean
|
|
52
|
+
): Action;
|
|
41
53
|
/**
|
|
42
54
|
* Deletes a tab node from the layout
|
|
43
55
|
* @param tabsetNodeId the id of the tab node to delete
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export interface IDraggable {
|
|
2
|
-
}
|
|
1
|
+
export interface IDraggable {}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export interface IDropTarget {
|
|
2
|
-
}
|
|
1
|
+
export interface IDropTarget {}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ICloseType } from
|
|
1
|
+
import { ICloseType } from "./ICloseType";
|
|
2
2
|
export type IBorderLocation = "top" | "bottom" | "left" | "right";
|
|
3
3
|
export type ITabLocation = "top" | "bottom";
|
|
4
4
|
export type IInsets = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
left: number;
|
|
9
9
|
};
|
|
10
10
|
export interface IJsonModel {
|
|
11
11
|
global?: IGlobalAttributes;
|
|
@@ -24,8 +24,7 @@ export interface IJsonTabSetNode extends ITabSetAttributes {
|
|
|
24
24
|
maximized?: boolean;
|
|
25
25
|
children: IJsonTabNode[];
|
|
26
26
|
}
|
|
27
|
-
export interface IJsonTabNode extends ITabAttributes {
|
|
28
|
-
}
|
|
27
|
+
export interface IJsonTabNode extends ITabAttributes {}
|
|
29
28
|
export interface IGlobalAttributes {
|
|
30
29
|
borderAutoSelectTabWhenClosed?: boolean;
|
|
31
30
|
borderAutoSelectTabWhenOpen?: boolean;
|
|
@@ -73,14 +73,18 @@ export declare class Model {
|
|
|
73
73
|
* Sets a function to allow/deny dropping a node
|
|
74
74
|
* @param onAllowDrop function that takes the drag node and DropInfo and returns true if the drop is allowed
|
|
75
75
|
*/
|
|
76
|
-
setOnAllowDrop(
|
|
76
|
+
setOnAllowDrop(
|
|
77
|
+
onAllowDrop: (dragNode: Node, dropInfo: DropInfo) => boolean
|
|
78
|
+
): void;
|
|
77
79
|
/**
|
|
78
80
|
* set callback called when a new TabSet is created.
|
|
79
81
|
* The tabNode can be undefined if it's the auto created first tabset in the root row (when the last
|
|
80
82
|
* tab is deleted, the root tabset can be recreated)
|
|
81
83
|
* @param onCreateTabSet
|
|
82
84
|
*/
|
|
83
|
-
setOnCreateTabSet(
|
|
85
|
+
setOnCreateTabSet(
|
|
86
|
+
onCreateTabSet: (tabNode?: TabNode) => ITabSetAttributes
|
|
87
|
+
): void;
|
|
84
88
|
static toTypescriptInterfaces(): void;
|
|
85
89
|
toString(): string;
|
|
86
90
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Orientation } from "../Orientation";
|
|
2
2
|
import { Rect } from "../Rect";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
IJsonBorderNode,
|
|
5
|
+
IJsonRowNode,
|
|
6
|
+
IJsonTabNode,
|
|
7
|
+
IJsonTabSetNode,
|
|
8
|
+
} from "./IJsonModel";
|
|
4
9
|
import { Model } from "./Model";
|
|
5
10
|
export declare abstract class Node {
|
|
6
11
|
getId(): string;
|
|
@@ -13,5 +18,10 @@ export declare abstract class Node {
|
|
|
13
18
|
getOrientation(): Orientation;
|
|
14
19
|
setEventListener(event: string, callback: (params: any) => void): void;
|
|
15
20
|
removeEventListener(event: string): void;
|
|
16
|
-
abstract toJson():
|
|
21
|
+
abstract toJson():
|
|
22
|
+
| IJsonRowNode
|
|
23
|
+
| IJsonBorderNode
|
|
24
|
+
| IJsonTabSetNode
|
|
25
|
+
| IJsonTabNode
|
|
26
|
+
| undefined;
|
|
17
27
|
}
|
|
@@ -2,7 +2,10 @@ import { IDraggable } from "./IDraggable";
|
|
|
2
2
|
import { IDropTarget } from "./IDropTarget";
|
|
3
3
|
import { IJsonTabSetNode } from "./IJsonModel";
|
|
4
4
|
import { Node } from "./Node";
|
|
5
|
-
export declare class TabSetNode
|
|
5
|
+
export declare class TabSetNode
|
|
6
|
+
extends Node
|
|
7
|
+
implements IDraggable, IDropTarget
|
|
8
|
+
{
|
|
6
9
|
static readonly TYPE = "tabset";
|
|
7
10
|
getName(): string | undefined;
|
|
8
11
|
getSelected(): number;
|
|
@@ -9,17 +9,35 @@ import { TabNode } from "../model/TabNode";
|
|
|
9
9
|
import { TabSetNode } from "../model/TabSetNode";
|
|
10
10
|
import { Rect } from "../Rect";
|
|
11
11
|
import { IJsonTabNode } from "../model/IJsonModel";
|
|
12
|
-
export type CustomDragCallback = (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
node
|
|
22
|
-
|
|
12
|
+
export type CustomDragCallback = (
|
|
13
|
+
dragging: TabNode | IJsonTabNode,
|
|
14
|
+
over: TabNode,
|
|
15
|
+
x: number,
|
|
16
|
+
y: number,
|
|
17
|
+
location: DockLocation
|
|
18
|
+
) => void;
|
|
19
|
+
export type DragRectRenderCallback = (
|
|
20
|
+
content: React.ReactElement | undefined,
|
|
21
|
+
node?: Node,
|
|
22
|
+
json?: IJsonTabNode
|
|
23
|
+
) => React.ReactElement | undefined;
|
|
24
|
+
export type FloatingTabPlaceholderRenderCallback = (
|
|
25
|
+
dockPopout: () => void,
|
|
26
|
+
showPopout: () => void
|
|
27
|
+
) => React.ReactElement | undefined;
|
|
28
|
+
export type NodeMouseEvent = (
|
|
29
|
+
node: TabNode | TabSetNode | BorderNode,
|
|
30
|
+
event: React.MouseEvent<HTMLElement, MouseEvent>
|
|
31
|
+
) => void;
|
|
32
|
+
export type ShowOverflowMenuCallback = (
|
|
33
|
+
node: TabSetNode | BorderNode,
|
|
34
|
+
mouseEvent: React.MouseEvent<HTMLElement, MouseEvent>,
|
|
35
|
+
items: {
|
|
36
|
+
index: number;
|
|
37
|
+
node: TabNode;
|
|
38
|
+
}[],
|
|
39
|
+
onSelect: (item: { index: number; node: TabNode }) => void
|
|
40
|
+
) => void;
|
|
23
41
|
export type TabSetPlaceHolderCallback = (node: TabSetNode) => React.ReactNode;
|
|
24
42
|
export type IconFactory = (node: TabNode) => React.ReactNode;
|
|
25
43
|
export type TitleFactory = (node: TabNode) => ITitleObject | React.ReactNode;
|
|
@@ -33,27 +51,41 @@ export interface ILayoutProps {
|
|
|
33
51
|
icons?: IIcons;
|
|
34
52
|
onAction?: (action: Action) => Action | undefined;
|
|
35
53
|
onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void;
|
|
36
|
-
onRenderTabSet?: (
|
|
54
|
+
onRenderTabSet?: (
|
|
55
|
+
tabSetNode: TabSetNode | BorderNode,
|
|
56
|
+
renderValues: ITabSetRenderValues
|
|
57
|
+
) => void;
|
|
37
58
|
onModelChange?: (model: Model, action: Action) => void;
|
|
38
|
-
onExternalDrag?: (event: React.DragEvent<HTMLDivElement>) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
59
|
+
onExternalDrag?: (event: React.DragEvent<HTMLDivElement>) =>
|
|
60
|
+
| undefined
|
|
61
|
+
| {
|
|
62
|
+
dragText: string;
|
|
63
|
+
json: any;
|
|
64
|
+
onDrop?: (node?: Node, event?: Event) => void;
|
|
65
|
+
};
|
|
43
66
|
classNameMapper?: (defaultClassName: string) => string;
|
|
44
67
|
i18nMapper?: (id: I18nLabel, param?: string) => string | undefined;
|
|
45
68
|
supportsPopout?: boolean | undefined;
|
|
46
69
|
popoutURL?: string | undefined;
|
|
47
70
|
realtimeResize?: boolean | undefined;
|
|
48
|
-
onTabDrag?: (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
onTabDrag?: (
|
|
72
|
+
dragging: TabNode | IJsonTabNode,
|
|
73
|
+
over: TabNode,
|
|
74
|
+
x: number,
|
|
75
|
+
y: number,
|
|
76
|
+
location: DockLocation,
|
|
77
|
+
refresh: () => void
|
|
78
|
+
) =>
|
|
79
|
+
| undefined
|
|
80
|
+
| {
|
|
81
|
+
x: number;
|
|
82
|
+
y: number;
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
callback: CustomDragCallback;
|
|
86
|
+
invalidated?: () => void;
|
|
87
|
+
cursor?: string | undefined;
|
|
88
|
+
};
|
|
57
89
|
onRenderDragRect?: DragRectRenderCallback;
|
|
58
90
|
onRenderFloatingTabPlaceholder?: FloatingTabPlaceholderRenderCallback;
|
|
59
91
|
onContextMenu?: NodeMouseEvent;
|
|
@@ -96,15 +128,22 @@ export interface ILayoutState {
|
|
|
96
128
|
showEdges?: boolean;
|
|
97
129
|
}
|
|
98
130
|
export interface IIcons {
|
|
99
|
-
close?:
|
|
100
|
-
closeTabset?:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
131
|
+
close?: React.ReactNode | ((tabNode: TabNode) => React.ReactNode);
|
|
132
|
+
closeTabset?:
|
|
133
|
+
| React.ReactNode
|
|
134
|
+
| ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
135
|
+
popout?: React.ReactNode | ((tabNode: TabNode) => React.ReactNode);
|
|
136
|
+
maximize?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
137
|
+
restore?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
138
|
+
more?:
|
|
139
|
+
| React.ReactNode
|
|
140
|
+
| ((
|
|
141
|
+
tabSetNode: TabSetNode | BorderNode,
|
|
142
|
+
hiddenTabs: {
|
|
143
|
+
node: TabNode;
|
|
144
|
+
index: number;
|
|
145
|
+
}[]
|
|
146
|
+
) => React.ReactNode);
|
|
108
147
|
}
|
|
109
148
|
export interface ICustomDropDestination {
|
|
110
149
|
rect: Rect;
|
|
@@ -120,7 +159,10 @@ export interface ICustomDropDestination {
|
|
|
120
159
|
/**
|
|
121
160
|
* A React component that hosts a multi-tabbed layout
|
|
122
161
|
*/
|
|
123
|
-
export declare class Layout extends React.Component<
|
|
162
|
+
export declare class Layout extends React.Component<
|
|
163
|
+
ILayoutProps,
|
|
164
|
+
ILayoutState
|
|
165
|
+
> {
|
|
124
166
|
constructor(props: ILayoutProps);
|
|
125
167
|
/**
|
|
126
168
|
* Adds a new tab to the given tabset
|
|
@@ -139,13 +181,17 @@ export declare class Layout extends React.Component<ILayoutProps, ILayoutState>
|
|
|
139
181
|
* @param json the json for the new tab node
|
|
140
182
|
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
141
183
|
*/
|
|
142
|
-
addTabWithDragAndDrop(
|
|
184
|
+
addTabWithDragAndDrop(
|
|
185
|
+
dragText: string | undefined,
|
|
186
|
+
json: IJsonTabNode,
|
|
187
|
+
onDrop?: (node?: Node, event?: Event) => void
|
|
188
|
+
): void;
|
|
143
189
|
/**
|
|
144
190
|
* Move a tab/tabset using drag and drop
|
|
145
191
|
* @param node the tab or tabset to drag
|
|
146
192
|
* @param dragText the text to show on the drag panel
|
|
147
193
|
*/
|
|
148
|
-
moveTabWithDragAndDrop(node:
|
|
194
|
+
moveTabWithDragAndDrop(node: TabNode | TabSetNode, dragText?: string): void;
|
|
149
195
|
/**
|
|
150
196
|
* Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you
|
|
151
197
|
* mouse down on the panel
|
|
@@ -154,5 +200,9 @@ export declare class Layout extends React.Component<ILayoutProps, ILayoutState>
|
|
|
154
200
|
* @param json the json for the new tab node
|
|
155
201
|
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
156
202
|
*/
|
|
157
|
-
addTabWithDragAndDropIndirect(
|
|
203
|
+
addTabWithDragAndDropIndirect(
|
|
204
|
+
dragText: string | undefined,
|
|
205
|
+
json: IJsonTabNode,
|
|
206
|
+
onDrop?: (node?: Node, event?: Event) => void
|
|
207
|
+
): void;
|
|
158
208
|
}
|