@aptre/flex-layout 0.1.10 → 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/README.md +1 -0
- package/dist/DragDrop.d.ts +15 -0
- package/{declarations → dist}/DropInfo.d.ts +1 -7
- package/{declarations → dist}/I18nLabel.d.ts +2 -2
- package/{declarations → dist}/Rect.d.ts +2 -5
- package/{declarations → dist}/Types.d.ts +2 -1
- package/dist/index.mjs +25 -6
- package/{declarations → dist}/model/Actions.d.ts +2 -14
- 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/{declarations → dist}/model/IJsonModel.d.ts +5 -1
- package/{declarations → dist}/model/Model.d.ts +2 -6
- package/{declarations → dist}/model/Node.d.ts +2 -12
- package/{declarations → dist}/model/TabNode.d.ts +1 -0
- package/{declarations → dist}/model/TabSetNode.d.ts +2 -4
- package/dist/view/Icons.d.ts +7 -0
- package/{declarations → dist}/view/Layout.d.ts +39 -86
- package/package.json +12 -7
- package/style/_base.scss +3 -1
- package/style/dark.css +4 -1
- package/style/dark.css.map +1 -1
- package/style/dark.scss +1 -0
- package/style/gray.css +5 -2
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -1
- package/style/light.css +5 -2
- package/style/light.css.map +1 -1
- package/style/light.scss +2 -1
- package/style/underline.css +5 -2
- package/style/underline.css.map +1 -1
- package/style/underline.scss +2 -1
- package/typedoc/assets/navigation.js +1 -1
- package/typedoc/assets/search.js +1 -1
- package/typedoc/assets/style.css +11 -0
- package/typedoc/classes/Action.html +3 -105
- package/typedoc/classes/Actions.html +48 -465
- package/typedoc/classes/BorderNode.html +4 -318
- package/typedoc/classes/BorderSet.html +2 -84
- package/typedoc/classes/DockLocation.html +3 -128
- package/typedoc/classes/DragDrop.html +3 -207
- package/typedoc/classes/DropInfo.html +3 -123
- package/typedoc/classes/Layout.html +43 -516
- package/typedoc/classes/Model.html +25 -359
- package/typedoc/classes/Node.html +2 -183
- package/typedoc/classes/Orientation.html +3 -117
- package/typedoc/classes/Rect.html +4 -269
- package/typedoc/classes/RowNode.html +3 -233
- package/typedoc/classes/SplitterNode.html +3 -200
- package/typedoc/classes/TabNode.html +6 -331
- package/typedoc/classes/TabSetNode.html +4 -394
- package/typedoc/enums/CLASSES.html +2 -381
- package/typedoc/enums/I18nLabel.html +2 -121
- package/typedoc/enums/ICloseType.html +2 -85
- package/typedoc/index.html +5 -74
- package/typedoc/interfaces/IBorderAttributes.html +2 -127
- package/typedoc/interfaces/ICustomDropDestination.html +2 -121
- package/typedoc/interfaces/IDraggable.html +1 -67
- package/typedoc/interfaces/IDropTarget.html +1 -68
- package/typedoc/interfaces/IFontValues.html +2 -93
- package/typedoc/interfaces/IGlobalAttributes.html +2 -261
- package/typedoc/interfaces/IIcons.html +3 -181
- package/typedoc/interfaces/IJsonBorderNode.html +2 -147
- package/typedoc/interfaces/IJsonModel.html +2 -89
- package/typedoc/interfaces/IJsonRowNode.html +2 -108
- package/typedoc/interfaces/IJsonTabNode.html +3 -174
- package/typedoc/interfaces/IJsonTabSetNode.html +2 -223
- package/typedoc/interfaces/ILayoutProps.html +2 -314
- package/typedoc/interfaces/ILayoutState.html +2 -109
- package/typedoc/interfaces/IRowAttributes.html +2 -99
- package/typedoc/interfaces/ITabAttributes.html +3 -155
- package/typedoc/interfaces/ITabRenderValues.html +2 -93
- package/typedoc/interfaces/ITabSetAttributes.html +2 -191
- package/typedoc/interfaces/ITabSetRenderValues.html +2 -101
- package/typedoc/interfaces/ITitleObject.html +2 -85
- package/typedoc/types/CustomDragCallback.html +1 -80
- package/typedoc/types/DragRectRenderCallback.html +1 -76
- package/typedoc/types/FloatingTabPlaceholderRenderCallback.html +1 -86
- package/typedoc/types/IBorderLocation.html +1 -59
- package/typedoc/types/IInsets.html +1 -70
- package/typedoc/types/ITabLocation.html +1 -59
- package/typedoc/types/IconFactory.html +1 -72
- package/typedoc/types/NodeMouseEvent.html +1 -74
- package/typedoc/types/ShowOverflowMenuCallback.html +1 -94
- package/typedoc/types/TabSetPlaceHolderCallback.html +1 -72
- package/typedoc/types/TitleFactory.html +1 -72
- package/declarations/DragDrop.d.ts +0 -29
- package/declarations/model/ICloseType.d.ts +0 -5
- package/declarations/model/IDraggable.d.ts +0 -1
- package/declarations/model/IDropTarget.d.ts +0 -1
- package/declarations/view/Icons.d.ts +0 -6
- /package/{declarations → dist}/Attribute.d.ts +0 -0
- /package/{declarations → dist}/AttributeDefinitions.d.ts +0 -0
- /package/{declarations → dist}/DockLocation.d.ts +0 -0
- /package/{declarations → dist}/Orientation.d.ts +0 -0
- /package/{declarations → dist}/PopupMenu.d.ts +0 -0
- /package/{declarations → dist}/index.d.ts +0 -0
- /package/{declarations → dist}/model/Action.d.ts +0 -0
- /package/{declarations → dist}/model/BorderNode.d.ts +0 -0
- /package/{declarations → dist}/model/BorderSet.d.ts +0 -0
- /package/{declarations → dist}/model/RowNode.d.ts +0 -0
- /package/{declarations → dist}/model/SplitterNode.d.ts +0 -0
- /package/{declarations → dist}/model/Utils.d.ts +0 -0
- /package/{declarations → dist}/view/BorderButton.d.ts +0 -0
- /package/{declarations → dist}/view/BorderTabSet.d.ts +0 -0
- /package/{declarations → dist}/view/ErrorBoundary.d.ts +0 -0
- /package/{declarations → dist}/view/FloatingWindow.d.ts +0 -0
- /package/{declarations → dist}/view/FloatingWindowTab.d.ts +0 -0
- /package/{declarations → dist}/view/Splitter.d.ts +0 -0
- /package/{declarations → dist}/view/Tab.d.ts +0 -0
- /package/{declarations → dist}/view/TabButton.d.ts +0 -0
- /package/{declarations → dist}/view/TabButtonStamp.d.ts +0 -0
- /package/{declarations → dist}/view/TabFloating.d.ts +0 -0
- /package/{declarations → dist}/view/TabOverflowHook.d.ts +0 -0
- /package/{declarations → dist}/view/TabSet.d.ts +0 -0
- /package/{declarations → dist}/view/Utils.d.ts +0 -0
package/README.md
CHANGED
|
@@ -350,6 +350,7 @@ Inherited defaults will take their value from the associated global attributes (
|
|
|
350
350
|
| floating | false | |
|
|
351
351
|
| className | *inherited* | class applied to tab button |
|
|
352
352
|
| contentClassName | *inherited* | class applied to tab content |
|
|
353
|
+
| tabsetClassName | undefined | class applied to parent tabset when this is the only tab and it is stretched to fill the tabset |
|
|
353
354
|
| icon | *inherited* | |
|
|
354
355
|
| enableRenderOnDemand | *inherited* | whether to avoid rendering component until tab is visible |
|
|
355
356
|
| borderWidth | *inherited* | width when added to border, -1 will use border size |
|
|
@@ -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
|
+
}
|
|
@@ -8,11 +8,5 @@ export declare class DropInfo {
|
|
|
8
8
|
location: DockLocation;
|
|
9
9
|
index: number;
|
|
10
10
|
className: string;
|
|
11
|
-
constructor(
|
|
12
|
-
node: Node & IDropTarget,
|
|
13
|
-
rect: Rect,
|
|
14
|
-
location: DockLocation,
|
|
15
|
-
index: number,
|
|
16
|
-
className: string
|
|
17
|
-
);
|
|
11
|
+
constructor(node: Node & IDropTarget, rect: Rect, location: DockLocation, index: number, className: string);
|
|
18
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare enum I18nLabel {
|
|
2
2
|
Close_Tab = "Close",
|
|
3
3
|
Close_Tabset = "Close tabset",
|
|
4
|
-
Move_Tab = "Move: "
|
|
4
|
+
Move_Tab = "Move: ",// no longer used
|
|
5
5
|
Move_Tabset = "Move tabset",
|
|
6
6
|
Maximize = "Maximize tabset",
|
|
7
7
|
Restore = "Restore tabset",
|
|
@@ -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
|
}
|
|
@@ -7,7 +7,7 @@ export declare class Rect {
|
|
|
7
7
|
constructor(x: number, y: number, width: number, height: number);
|
|
8
8
|
static fromElement(element: Element): Rect;
|
|
9
9
|
clone(): Rect;
|
|
10
|
-
equals(rect: Rect): boolean;
|
|
10
|
+
equals(rect: Rect | null | undefined): boolean;
|
|
11
11
|
getBottom(): number;
|
|
12
12
|
getRight(): number;
|
|
13
13
|
getCenter(): {
|
|
@@ -15,10 +15,7 @@ export declare class Rect {
|
|
|
15
15
|
y: number;
|
|
16
16
|
};
|
|
17
17
|
positionElement(element: HTMLElement, position?: string): void;
|
|
18
|
-
styleWithPosition(
|
|
19
|
-
style: Record<string, any>,
|
|
20
|
-
position?: string
|
|
21
|
-
): Record<string, any>;
|
|
18
|
+
styleWithPosition(style: Record<string, any>, position?: string): Record<string, any>;
|
|
22
19
|
contains(x: number, y: number): boolean;
|
|
23
20
|
removeInsets(insets: {
|
|
24
21
|
top: number;
|
|
@@ -57,6 +57,7 @@ export declare enum CLASSES {
|
|
|
57
57
|
FLEXLAYOUT__TAB_BORDER = "flexlayout__tab_border",
|
|
58
58
|
FLEXLAYOUT__TAB_BORDER_ = "flexlayout__tab_border_",
|
|
59
59
|
FLEXLAYOUT__TAB_BUTTON = "flexlayout__tab_button",
|
|
60
|
+
FLEXLAYOUT__TAB_BUTTON_STRETCH = "flexlayout__tab_button_stretch",
|
|
60
61
|
FLEXLAYOUT__TAB_BUTTON_CONTENT = "flexlayout__tab_button_content",
|
|
61
62
|
FLEXLAYOUT__TAB_BUTTON_LEADING = "flexlayout__tab_button_leading",
|
|
62
63
|
FLEXLAYOUT__TAB_BUTTON_OVERFLOW = "flexlayout__tab_button_overflow",
|
|
@@ -74,5 +75,5 @@ export declare enum CLASSES {
|
|
|
74
75
|
FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE = "flexlayout__tab_toolbar_button-close",
|
|
75
76
|
FLEXLAYOUT__POPUP_MENU_CONTAINER = "flexlayout__popup_menu_container",
|
|
76
77
|
FLEXLAYOUT__POPUP_MENU_ITEM = "flexlayout__popup_menu_item",
|
|
77
|
-
FLEXLAYOUT__POPUP_MENU = "flexlayout__popup_menu"
|
|
78
|
+
FLEXLAYOUT__POPUP_MENU = "flexlayout__popup_menu"
|
|
78
79
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1225,6 +1225,7 @@ var TabNode = class _TabNode extends Node {
|
|
|
1225
1225
|
attributeDefinitions.add("component", void 0).setType(Attribute.STRING);
|
|
1226
1226
|
attributeDefinitions.add("config", void 0).setType("any");
|
|
1227
1227
|
attributeDefinitions.add("floating", false).setType(Attribute.BOOLEAN);
|
|
1228
|
+
attributeDefinitions.add("tabsetClassName", void 0).setType(Attribute.STRING);
|
|
1228
1229
|
attributeDefinitions.addInherited("enableClose", "tabEnableClose").setType(Attribute.BOOLEAN);
|
|
1229
1230
|
attributeDefinitions.addInherited("closeType", "tabCloseType").setType("ICloseType");
|
|
1230
1231
|
attributeDefinitions.addInherited("enableDrag", "tabEnableDrag").setType(Attribute.BOOLEAN);
|
|
@@ -1313,6 +1314,9 @@ var TabNode = class _TabNode extends Node {
|
|
|
1313
1314
|
getContentClassName() {
|
|
1314
1315
|
return this._getAttr("contentClassName");
|
|
1315
1316
|
}
|
|
1317
|
+
getTabSetClassName() {
|
|
1318
|
+
return this._getAttr("tabsetClassName");
|
|
1319
|
+
}
|
|
1316
1320
|
isEnableRenderOnDemand() {
|
|
1317
1321
|
return this._getAttr("enableRenderOnDemand");
|
|
1318
1322
|
}
|
|
@@ -2297,7 +2301,7 @@ function adjustSelectedIndex(parent, removedIndex) {
|
|
|
2297
2301
|
}
|
|
2298
2302
|
}
|
|
2299
2303
|
function randomUUID() {
|
|
2300
|
-
return (
|
|
2304
|
+
return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
|
|
2301
2305
|
}
|
|
2302
2306
|
|
|
2303
2307
|
// src/model/BorderNode.ts
|
|
@@ -3930,6 +3934,12 @@ var TabSet = (props) => {
|
|
|
3930
3934
|
if (node.isMaximized() && !showHeader) {
|
|
3931
3935
|
tabStripClasses += " " + cm("flexlayout__tabset-maximized" /* FLEXLAYOUT__TABSET_MAXIMIZED */);
|
|
3932
3936
|
}
|
|
3937
|
+
if (isTabStretch) {
|
|
3938
|
+
const tabNode = node.getChildren()[0];
|
|
3939
|
+
if (tabNode.getTabSetClassName() !== void 0) {
|
|
3940
|
+
tabStripClasses += " " + tabNode.getTabSetClassName();
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3933
3943
|
if (showHeader) {
|
|
3934
3944
|
const headerToolbar = /* @__PURE__ */ React11.createElement(
|
|
3935
3945
|
"div",
|
|
@@ -4189,6 +4199,9 @@ var MaximizeIcon = () => {
|
|
|
4189
4199
|
var OverflowIcon = () => {
|
|
4190
4200
|
return /* @__PURE__ */ React15.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style, viewBox: "0 0 24 24", fill: "var(--color-icon)" }, /* @__PURE__ */ React15.createElement("path", { d: "M0 0h24v24H0z", fill: "none" }), /* @__PURE__ */ React15.createElement("path", { stroke: "var(--color-icon)", d: "M7 10l5 5 5-5z" }));
|
|
4191
4201
|
};
|
|
4202
|
+
var EdgeIcon = () => {
|
|
4203
|
+
return /* @__PURE__ */ React15.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", style: { display: "block", width: 10, height: 10 }, preserveAspectRatio: "none", viewBox: "0 0 100 100" }, /* @__PURE__ */ React15.createElement("path", { fill: "var(--color-edge-icon)", stroke: "var(--color-edge-icon)", d: "M10 30 L90 30 l-40 40 Z" }));
|
|
4204
|
+
};
|
|
4192
4205
|
var PopoutIcon = () => {
|
|
4193
4206
|
return (
|
|
4194
4207
|
// <svg xmlns="http://www.w3.org/2000/svg" style={style} viewBox="0 0 24 24" fill="var(--color-icon)"><path d="M0 0h24v24H0z" fill="none"/><path stroke="var(--color-icon)" d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z"/></svg>
|
|
@@ -4209,7 +4222,8 @@ var defaultIcons = {
|
|
|
4209
4222
|
popout: /* @__PURE__ */ React16.createElement(PopoutIcon, null),
|
|
4210
4223
|
maximize: /* @__PURE__ */ React16.createElement(MaximizeIcon, null),
|
|
4211
4224
|
restore: /* @__PURE__ */ React16.createElement(RestoreIcon, null),
|
|
4212
|
-
more: /* @__PURE__ */ React16.createElement(OverflowIcon, null)
|
|
4225
|
+
more: /* @__PURE__ */ React16.createElement(OverflowIcon, null),
|
|
4226
|
+
edgeArrow: /* @__PURE__ */ React16.createElement(EdgeIcon, null)
|
|
4213
4227
|
};
|
|
4214
4228
|
var isDesktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
|
|
4215
4229
|
var defaultSupportsPopout = isDesktop;
|
|
@@ -4670,6 +4684,7 @@ var Layout = class extends React16.Component {
|
|
|
4670
4684
|
}
|
|
4671
4685
|
}
|
|
4672
4686
|
const edges = [];
|
|
4687
|
+
const arrowIcon = this.icons.edgeArrow;
|
|
4673
4688
|
if (this.state.showEdges) {
|
|
4674
4689
|
const r = this.centerRect;
|
|
4675
4690
|
const length = this.edgeRectLength;
|
|
@@ -4684,7 +4699,8 @@ var Layout = class extends React16.Component {
|
|
|
4684
4699
|
key: "North",
|
|
4685
4700
|
style: { top: r.y, left: r.x + r.width / 2 - offset, width: length, height: width, borderBottomLeftRadius: radius, borderBottomRightRadius: radius },
|
|
4686
4701
|
className: className + " " + this.getClassName("flexlayout__edge_rect_top" /* FLEXLAYOUT__EDGE_RECT_TOP */)
|
|
4687
|
-
}
|
|
4702
|
+
},
|
|
4703
|
+
/* @__PURE__ */ React16.createElement("div", { style: { transform: "rotate(180deg)" } }, arrowIcon)
|
|
4688
4704
|
)
|
|
4689
4705
|
);
|
|
4690
4706
|
edges.push(
|
|
@@ -4694,7 +4710,8 @@ var Layout = class extends React16.Component {
|
|
|
4694
4710
|
key: "West",
|
|
4695
4711
|
style: { top: r.y + r.height / 2 - offset, left: r.x, width, height: length, borderTopRightRadius: radius, borderBottomRightRadius: radius },
|
|
4696
4712
|
className: className + " " + this.getClassName("flexlayout__edge_rect_left" /* FLEXLAYOUT__EDGE_RECT_LEFT */)
|
|
4697
|
-
}
|
|
4713
|
+
},
|
|
4714
|
+
/* @__PURE__ */ React16.createElement("div", { style: { transform: "rotate(90deg)" } }, arrowIcon)
|
|
4698
4715
|
)
|
|
4699
4716
|
);
|
|
4700
4717
|
edges.push(
|
|
@@ -4704,7 +4721,8 @@ var Layout = class extends React16.Component {
|
|
|
4704
4721
|
key: "South",
|
|
4705
4722
|
style: { top: r.y + r.height - width, left: r.x + r.width / 2 - offset, width: length, height: width, borderTopLeftRadius: radius, borderTopRightRadius: radius },
|
|
4706
4723
|
className: className + " " + this.getClassName("flexlayout__edge_rect_bottom" /* FLEXLAYOUT__EDGE_RECT_BOTTOM */)
|
|
4707
|
-
}
|
|
4724
|
+
},
|
|
4725
|
+
/* @__PURE__ */ React16.createElement("div", null, arrowIcon)
|
|
4708
4726
|
)
|
|
4709
4727
|
);
|
|
4710
4728
|
edges.push(
|
|
@@ -4714,7 +4732,8 @@ var Layout = class extends React16.Component {
|
|
|
4714
4732
|
key: "East",
|
|
4715
4733
|
style: { top: r.y + r.height / 2 - offset, left: r.x + r.width - width, width, height: length, borderTopLeftRadius: radius, borderBottomLeftRadius: radius },
|
|
4716
4734
|
className: className + " " + this.getClassName("flexlayout__edge_rect_right" /* FLEXLAYOUT__EDGE_RECT_RIGHT */)
|
|
4717
|
-
}
|
|
4735
|
+
},
|
|
4736
|
+
/* @__PURE__ */ React16.createElement("div", { style: { transform: "rotate(-90deg)" } }, arrowIcon)
|
|
4718
4737
|
)
|
|
4719
4738
|
);
|
|
4720
4739
|
}
|
|
@@ -27,13 +27,7 @@ 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(
|
|
31
|
-
json: any,
|
|
32
|
-
toNodeId: string,
|
|
33
|
-
location: DockLocation,
|
|
34
|
-
index: number,
|
|
35
|
-
select?: boolean
|
|
36
|
-
): Action;
|
|
30
|
+
static addNode(json: any, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action;
|
|
37
31
|
/**
|
|
38
32
|
* Moves a node (tab or tabset) from one location to another
|
|
39
33
|
* @param fromNodeId the id of the node to move
|
|
@@ -43,13 +37,7 @@ export declare class Actions {
|
|
|
43
37
|
* @param select (optional) whether to select the moved tab(s) in new tabset, overriding autoSelectTab
|
|
44
38
|
* @returns {Action} the action
|
|
45
39
|
*/
|
|
46
|
-
static moveNode(
|
|
47
|
-
fromNodeId: string,
|
|
48
|
-
toNodeId: string,
|
|
49
|
-
location: DockLocation,
|
|
50
|
-
index: number,
|
|
51
|
-
select?: boolean
|
|
52
|
-
): Action;
|
|
40
|
+
static moveNode(fromNodeId: string, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action;
|
|
53
41
|
/**
|
|
54
42
|
* Deletes a tab node from the layout
|
|
55
43
|
* @param tabsetNodeId the id of the tab node to delete
|
|
@@ -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
|
+
}
|
|
@@ -24,7 +24,8 @@ export interface IJsonTabSetNode extends ITabSetAttributes {
|
|
|
24
24
|
maximized?: boolean;
|
|
25
25
|
children: IJsonTabNode[];
|
|
26
26
|
}
|
|
27
|
-
export interface IJsonTabNode extends ITabAttributes {
|
|
27
|
+
export interface IJsonTabNode extends ITabAttributes {
|
|
28
|
+
}
|
|
28
29
|
export interface IGlobalAttributes {
|
|
29
30
|
borderAutoSelectTabWhenClosed?: boolean;
|
|
30
31
|
borderAutoSelectTabWhenOpen?: boolean;
|
|
@@ -64,6 +65,7 @@ export interface IGlobalAttributes {
|
|
|
64
65
|
tabSetEnableDrag?: boolean;
|
|
65
66
|
tabSetEnableDrop?: boolean;
|
|
66
67
|
tabSetEnableMaximize?: boolean;
|
|
68
|
+
tabSetEnableSingleTabStretch?: boolean;
|
|
67
69
|
tabSetEnableTabStrip?: boolean;
|
|
68
70
|
tabSetHeaderHeight?: number;
|
|
69
71
|
tabSetMarginInsets?: IInsets;
|
|
@@ -91,6 +93,7 @@ export interface ITabSetAttributes {
|
|
|
91
93
|
enableDrag?: boolean;
|
|
92
94
|
enableDrop?: boolean;
|
|
93
95
|
enableMaximize?: boolean;
|
|
96
|
+
enableSingleTabStretch?: boolean;
|
|
94
97
|
enableTabStrip?: boolean;
|
|
95
98
|
headerHeight?: number;
|
|
96
99
|
height?: number;
|
|
@@ -117,6 +120,7 @@ export interface ITabAttributes {
|
|
|
117
120
|
component?: string;
|
|
118
121
|
config?: any;
|
|
119
122
|
contentClassName?: string;
|
|
123
|
+
tabsetClassName?: string;
|
|
120
124
|
enableClose?: boolean;
|
|
121
125
|
enableDrag?: boolean;
|
|
122
126
|
enableFloat?: boolean;
|
|
@@ -73,18 +73,14 @@ 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(
|
|
77
|
-
onAllowDrop: (dragNode: Node, dropInfo: DropInfo) => boolean
|
|
78
|
-
): void;
|
|
76
|
+
setOnAllowDrop(onAllowDrop: (dragNode: Node, dropInfo: DropInfo) => boolean): void;
|
|
79
77
|
/**
|
|
80
78
|
* set callback called when a new TabSet is created.
|
|
81
79
|
* The tabNode can be undefined if it's the auto created first tabset in the root row (when the last
|
|
82
80
|
* tab is deleted, the root tabset can be recreated)
|
|
83
81
|
* @param onCreateTabSet
|
|
84
82
|
*/
|
|
85
|
-
setOnCreateTabSet(
|
|
86
|
-
onCreateTabSet: (tabNode?: TabNode) => ITabSetAttributes
|
|
87
|
-
): void;
|
|
83
|
+
setOnCreateTabSet(onCreateTabSet: (tabNode?: TabNode) => ITabSetAttributes): void;
|
|
88
84
|
static toTypescriptInterfaces(): void;
|
|
89
85
|
toString(): string;
|
|
90
86
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { Orientation } from "../Orientation";
|
|
2
2
|
import { Rect } from "../Rect";
|
|
3
|
-
import {
|
|
4
|
-
IJsonBorderNode,
|
|
5
|
-
IJsonRowNode,
|
|
6
|
-
IJsonTabNode,
|
|
7
|
-
IJsonTabSetNode,
|
|
8
|
-
} from "./IJsonModel";
|
|
3
|
+
import { IJsonBorderNode, IJsonRowNode, IJsonTabNode, IJsonTabSetNode } from "./IJsonModel";
|
|
9
4
|
import { Model } from "./Model";
|
|
10
5
|
export declare abstract class Node {
|
|
11
6
|
getId(): string;
|
|
@@ -18,10 +13,5 @@ export declare abstract class Node {
|
|
|
18
13
|
getOrientation(): Orientation;
|
|
19
14
|
setEventListener(event: string, callback: (params: any) => void): void;
|
|
20
15
|
removeEventListener(event: string): void;
|
|
21
|
-
abstract toJson():
|
|
22
|
-
| IJsonRowNode
|
|
23
|
-
| IJsonBorderNode
|
|
24
|
-
| IJsonTabSetNode
|
|
25
|
-
| IJsonTabNode
|
|
26
|
-
| undefined;
|
|
16
|
+
abstract toJson(): IJsonRowNode | IJsonBorderNode | IJsonTabSetNode | IJsonTabNode | undefined;
|
|
27
17
|
}
|
|
@@ -31,6 +31,7 @@ export declare class TabNode extends Node implements IDraggable {
|
|
|
31
31
|
isEnableRename(): boolean;
|
|
32
32
|
getClassName(): string | undefined;
|
|
33
33
|
getContentClassName(): string | undefined;
|
|
34
|
+
getTabSetClassName(): string | undefined;
|
|
34
35
|
isEnableRenderOnDemand(): boolean;
|
|
35
36
|
toJson(): IJsonTabNode;
|
|
36
37
|
}
|
|
@@ -2,10 +2,7 @@ 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
|
|
6
|
-
extends Node
|
|
7
|
-
implements IDraggable, IDropTarget
|
|
8
|
-
{
|
|
5
|
+
export declare class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
9
6
|
static readonly TYPE = "tabset";
|
|
10
7
|
getName(): string | undefined;
|
|
11
8
|
getSelected(): number;
|
|
@@ -31,6 +28,7 @@ export declare class TabSetNode
|
|
|
31
28
|
isEnableDivide(): boolean;
|
|
32
29
|
isEnableMaximize(): boolean;
|
|
33
30
|
isEnableClose(): boolean;
|
|
31
|
+
isEnableSingleTabStretch(): boolean;
|
|
34
32
|
canMaximize(): boolean;
|
|
35
33
|
isEnableTabStrip(): boolean;
|
|
36
34
|
isAutoSelectTab(): boolean;
|
|
@@ -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;
|
|
@@ -9,35 +9,17 @@ 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
|
-
|
|
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;
|
|
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;
|
|
41
23
|
export type TabSetPlaceHolderCallback = (node: TabSetNode) => React.ReactNode;
|
|
42
24
|
export type IconFactory = (node: TabNode) => React.ReactNode;
|
|
43
25
|
export type TitleFactory = (node: TabNode) => ITitleObject | React.ReactNode;
|
|
@@ -51,41 +33,27 @@ export interface ILayoutProps {
|
|
|
51
33
|
icons?: IIcons;
|
|
52
34
|
onAction?: (action: Action) => Action | undefined;
|
|
53
35
|
onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void;
|
|
54
|
-
onRenderTabSet?: (
|
|
55
|
-
tabSetNode: TabSetNode | BorderNode,
|
|
56
|
-
renderValues: ITabSetRenderValues
|
|
57
|
-
) => void;
|
|
36
|
+
onRenderTabSet?: (tabSetNode: TabSetNode | BorderNode, renderValues: ITabSetRenderValues) => void;
|
|
58
37
|
onModelChange?: (model: Model, action: Action) => void;
|
|
59
|
-
onExternalDrag?: (event: React.DragEvent<HTMLDivElement>) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onDrop?: (node?: Node, event?: Event) => void;
|
|
65
|
-
};
|
|
38
|
+
onExternalDrag?: (event: React.DragEvent<HTMLDivElement>) => undefined | {
|
|
39
|
+
dragText: string;
|
|
40
|
+
json: any;
|
|
41
|
+
onDrop?: (node?: Node, event?: Event) => void;
|
|
42
|
+
};
|
|
66
43
|
classNameMapper?: (defaultClassName: string) => string;
|
|
67
44
|
i18nMapper?: (id: I18nLabel, param?: string) => string | undefined;
|
|
68
45
|
supportsPopout?: boolean | undefined;
|
|
69
46
|
popoutURL?: string | undefined;
|
|
70
47
|
realtimeResize?: boolean | undefined;
|
|
71
|
-
onTabDrag?: (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
| {
|
|
81
|
-
x: number;
|
|
82
|
-
y: number;
|
|
83
|
-
width: number;
|
|
84
|
-
height: number;
|
|
85
|
-
callback: CustomDragCallback;
|
|
86
|
-
invalidated?: () => void;
|
|
87
|
-
cursor?: string | undefined;
|
|
88
|
-
};
|
|
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
|
+
};
|
|
89
57
|
onRenderDragRect?: DragRectRenderCallback;
|
|
90
58
|
onRenderFloatingTabPlaceholder?: FloatingTabPlaceholderRenderCallback;
|
|
91
59
|
onContextMenu?: NodeMouseEvent;
|
|
@@ -129,21 +97,15 @@ export interface ILayoutState {
|
|
|
129
97
|
}
|
|
130
98
|
export interface IIcons {
|
|
131
99
|
close?: React.ReactNode | ((tabNode: TabNode) => React.ReactNode);
|
|
132
|
-
closeTabset?:
|
|
133
|
-
| React.ReactNode
|
|
134
|
-
| ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
100
|
+
closeTabset?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
135
101
|
popout?: React.ReactNode | ((tabNode: TabNode) => React.ReactNode);
|
|
136
102
|
maximize?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
137
103
|
restore?: React.ReactNode | ((tabSetNode: TabSetNode) => React.ReactNode);
|
|
138
|
-
more?:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
node: TabNode;
|
|
144
|
-
index: number;
|
|
145
|
-
}[]
|
|
146
|
-
) => React.ReactNode);
|
|
104
|
+
more?: React.ReactNode | ((tabSetNode: TabSetNode | BorderNode, hiddenTabs: {
|
|
105
|
+
node: TabNode;
|
|
106
|
+
index: number;
|
|
107
|
+
}[]) => React.ReactNode);
|
|
108
|
+
edgeArrow?: React.ReactNode;
|
|
147
109
|
}
|
|
148
110
|
export interface ICustomDropDestination {
|
|
149
111
|
rect: Rect;
|
|
@@ -159,33 +121,28 @@ export interface ICustomDropDestination {
|
|
|
159
121
|
/**
|
|
160
122
|
* A React component that hosts a multi-tabbed layout
|
|
161
123
|
*/
|
|
162
|
-
export declare class Layout extends React.Component<
|
|
163
|
-
ILayoutProps,
|
|
164
|
-
ILayoutState
|
|
165
|
-
> {
|
|
124
|
+
export declare class Layout extends React.Component<ILayoutProps, ILayoutState> {
|
|
166
125
|
constructor(props: ILayoutProps);
|
|
167
126
|
/**
|
|
168
127
|
* Adds a new tab to the given tabset
|
|
169
128
|
* @param tabsetId the id of the tabset where the new tab will be added
|
|
170
129
|
* @param json the json for the new tab node
|
|
130
|
+
* @returns the added tab node or undefined
|
|
171
131
|
*/
|
|
172
|
-
addTabToTabSet(tabsetId: string, json: IJsonTabNode):
|
|
132
|
+
addTabToTabSet(tabsetId: string, json: IJsonTabNode): TabNode | undefined;
|
|
173
133
|
/**
|
|
174
134
|
* Adds a new tab to the active tabset (if there is one)
|
|
175
135
|
* @param json the json for the new tab node
|
|
136
|
+
* @returns the added tab node or undefined
|
|
176
137
|
*/
|
|
177
|
-
addTabToActiveTabSet(json: IJsonTabNode):
|
|
138
|
+
addTabToActiveTabSet(json: IJsonTabNode): TabNode | undefined;
|
|
178
139
|
/**
|
|
179
140
|
* Adds a new tab by dragging a labeled panel to the drop location, dragging starts immediatelly
|
|
180
141
|
* @param dragText the text to show on the drag panel
|
|
181
142
|
* @param json the json for the new tab node
|
|
182
143
|
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
183
144
|
*/
|
|
184
|
-
addTabWithDragAndDrop(
|
|
185
|
-
dragText: string | undefined,
|
|
186
|
-
json: IJsonTabNode,
|
|
187
|
-
onDrop?: (node?: Node, event?: Event) => void
|
|
188
|
-
): void;
|
|
145
|
+
addTabWithDragAndDrop(dragText: string | undefined, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
|
|
189
146
|
/**
|
|
190
147
|
* Move a tab/tabset using drag and drop
|
|
191
148
|
* @param node the tab or tabset to drag
|
|
@@ -200,9 +157,5 @@ export declare class Layout extends React.Component<
|
|
|
200
157
|
* @param json the json for the new tab node
|
|
201
158
|
* @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)
|
|
202
159
|
*/
|
|
203
|
-
addTabWithDragAndDropIndirect(
|
|
204
|
-
dragText: string | undefined,
|
|
205
|
-
json: IJsonTabNode,
|
|
206
|
-
onDrop?: (node?: Node, event?: Event) => void
|
|
207
|
-
): void;
|
|
160
|
+
addTabWithDragAndDropIndirect(dragText: string | undefined, json: IJsonTabNode, onDrop?: (node?: Node, event?: Event) => void): void;
|
|
208
161
|
}
|
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.1
|
|
5
|
+
"version": "0.2.1",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -14,17 +14,22 @@
|
|
|
14
14
|
"dock",
|
|
15
15
|
"popout",
|
|
16
16
|
"tabs",
|
|
17
|
-
"drag-and-drop",
|
|
18
17
|
"tabset",
|
|
19
18
|
"splitter",
|
|
20
19
|
"drag",
|
|
21
20
|
"drop",
|
|
22
21
|
"reactjs",
|
|
23
|
-
"
|
|
22
|
+
"flexlayout",
|
|
23
|
+
"flex layout",
|
|
24
|
+
"layout manager",
|
|
25
|
+
"drag and drop",
|
|
26
|
+
"split view",
|
|
27
|
+
"docking library",
|
|
28
|
+
"docking layout"
|
|
24
29
|
],
|
|
25
30
|
"main": "./dist/index.mjs",
|
|
26
31
|
"module": "./dist/index.mjs",
|
|
27
|
-
"types": "./
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
28
33
|
"exports": {
|
|
29
34
|
".": "./dist/index.mjs",
|
|
30
35
|
"./style": "./style/",
|
|
@@ -52,12 +57,13 @@
|
|
|
52
57
|
"dist/"
|
|
53
58
|
],
|
|
54
59
|
"scripts": {
|
|
55
|
-
"build": "npm run build:style && npm run build:doc && npm run build:lib",
|
|
56
|
-
"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",
|
|
57
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",
|
|
58
63
|
"build:lib:min": "npm run build:lib -- --minify",
|
|
59
64
|
"build:doc": "typedoc --out typedoc --exclude \"**/examples/**/*.tsx\" --excludeInternal --disableSources --excludePrivate --excludeProtected --readme none ./src",
|
|
60
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/",
|
|
61
67
|
"test": "tsc --project tsconfig.json --noEmit",
|
|
62
68
|
"lint": "eslint src/*",
|
|
63
69
|
"format": "prettier --write './style/*.scss' './{src,declarations}/**/(*.ts|*.tsx|*.html)' package.json"
|
|
@@ -80,7 +86,6 @@
|
|
|
80
86
|
"prismjs": "^1.28.0",
|
|
81
87
|
"react": "^18.0.0",
|
|
82
88
|
"react-dom": "^18.0.0",
|
|
83
|
-
"react-scripts": "5.0.1",
|
|
84
89
|
"rimraf": "^5.0.5",
|
|
85
90
|
"sass": "^1.50.0",
|
|
86
91
|
"typedoc": "^0.25.0",
|
package/style/_base.scss
CHANGED
|
@@ -60,9 +60,11 @@
|
|
|
60
60
|
&__edge_rect {
|
|
61
61
|
position: absolute;
|
|
62
62
|
z-index: 1000;
|
|
63
|
-
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
64
63
|
background-color: var(--color-edge-marker);
|
|
65
64
|
pointer-events: none;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
&__drag_rect {
|
package/style/dark.css
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
--color-popup-selected: var(--color-text);
|
|
47
47
|
--color-popup-selected-background: var(--color-4);
|
|
48
48
|
--color-edge-marker: gray;
|
|
49
|
+
--color-edge-icon: #eee;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.flexlayout__layout {
|
|
@@ -97,9 +98,11 @@
|
|
|
97
98
|
.flexlayout__edge_rect {
|
|
98
99
|
position: absolute;
|
|
99
100
|
z-index: 1000;
|
|
100
|
-
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
101
101
|
background-color: var(--color-edge-marker);
|
|
102
102
|
pointer-events: none;
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
justify-content: center;
|
|
103
106
|
}
|
|
104
107
|
.flexlayout__drag_rect {
|
|
105
108
|
position: absolute;
|