flexlayout-react 0.7.15 → 0.8.0
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/ChangeLog.txt +23 -0
- package/README.md +157 -330
- package/Screenshot_light.png +0 -0
- package/Screenshot_rounded.png +0 -0
- package/declarations/Attribute.d.ts +1 -1
- package/declarations/AttributeDefinitions.d.ts +1 -1
- package/declarations/DockLocation.d.ts +12 -12
- package/declarations/DropInfo.d.ts +12 -12
- package/declarations/I18nLabel.d.ts +12 -14
- package/declarations/Orientation.d.ts +7 -7
- package/declarations/PopupMenu.d.ts +1 -1
- package/declarations/Rect.d.ts +41 -28
- package/declarations/Types.d.ts +95 -79
- package/declarations/examples/demo/Utils.d.ts +4 -0
- package/declarations/index.d.ts +21 -22
- package/declarations/model/Action.d.ts +5 -5
- package/declarations/model/Actions.d.ts +127 -110
- package/declarations/model/BorderNode.d.ts +30 -34
- package/declarations/model/BorderSet.d.ts +3 -4
- package/declarations/model/ICloseType.d.ts +5 -5
- package/declarations/model/IDraggable.d.ts +2 -2
- package/declarations/model/IDropTarget.d.ts +2 -2
- package/declarations/model/IJsonModel.d.ts +811 -149
- package/declarations/model/LayoutWindow.d.ts +28 -0
- package/declarations/model/Model.d.ts +91 -86
- package/declarations/model/Node.d.ts +17 -17
- package/declarations/model/RowNode.d.ts +10 -11
- package/declarations/model/TabNode.d.ts +44 -37
- package/declarations/model/TabSetNode.d.ts +44 -41
- package/declarations/model/Utils.d.ts +1 -1
- package/declarations/model/WindowLayout.d.ts +24 -0
- package/declarations/src/Attribute.d.ts +1 -0
- package/declarations/src/AttributeDefinitions.d.ts +1 -0
- package/declarations/src/DockLocation.d.ts +12 -0
- package/declarations/src/DropInfo.d.ts +12 -0
- package/declarations/src/I18nLabel.d.ts +10 -0
- package/declarations/src/Orientation.d.ts +7 -0
- package/declarations/src/PopupMenu.d.ts +1 -0
- package/declarations/src/Rect.d.ts +31 -0
- package/declarations/src/Types.d.ts +92 -0
- package/declarations/src/index.d.ts +20 -0
- package/declarations/src/model/Action.d.ts +5 -0
- package/declarations/src/model/Actions.d.ts +110 -0
- package/declarations/src/model/BorderNode.d.ts +28 -0
- package/declarations/src/model/BorderSet.d.ts +3 -0
- package/declarations/src/model/ICloseType.d.ts +5 -0
- package/declarations/src/model/IDraggable.d.ts +2 -0
- package/declarations/src/model/IDropTarget.d.ts +2 -0
- package/declarations/src/model/IJsonModel.d.ts +153 -0
- package/declarations/src/model/Model.d.ts +98 -0
- package/declarations/src/model/Node.d.ts +16 -0
- package/declarations/src/model/RowNode.d.ts +11 -0
- package/declarations/src/model/TabNode.d.ts +36 -0
- package/declarations/src/model/TabSetNode.d.ts +37 -0
- package/declarations/src/model/Utils.d.ts +1 -0
- package/declarations/src/view/BorderButton.d.ts +1 -0
- package/declarations/src/view/BorderTab.d.ts +2 -0
- package/declarations/src/view/BorderTabSet.d.ts +1 -0
- package/declarations/src/view/DragContainer.d.ts +1 -0
- package/declarations/src/view/ErrorBoundary.d.ts +1 -0
- package/declarations/src/view/FloatingWindow.d.ts +1 -0
- package/declarations/src/view/Icons.d.ts +7 -0
- package/declarations/src/view/Layout.d.ts +113 -0
- package/declarations/src/view/Overlay.d.ts +1 -0
- package/declarations/src/view/PopupMenu.d.ts +1 -0
- package/declarations/src/view/Row.d.ts +1 -0
- package/declarations/src/view/Splitter.d.ts +1 -0
- package/declarations/src/view/Tab.d.ts +1 -0
- package/declarations/src/view/TabButton.d.ts +1 -0
- package/declarations/src/view/TabButtonStamp.d.ts +1 -0
- package/declarations/src/view/TabOverflowHook.d.ts +1 -0
- package/declarations/src/view/TabSet.d.ts +1 -0
- package/declarations/src/view/Utils.d.ts +4 -0
- package/declarations/view/BorderButton.d.ts +1 -1
- package/declarations/view/BorderTab.d.ts +2 -0
- package/declarations/view/BorderTabSet.d.ts +1 -1
- package/declarations/view/DragContainer.d.ts +1 -0
- package/declarations/view/ErrorBoundary.d.ts +1 -1
- package/declarations/view/ExtendedResizeObserver.d.ts +23 -0
- package/declarations/view/FloatingWindow.d.ts +1 -1
- package/declarations/view/Icons.d.ts +8 -7
- package/declarations/view/Layout.d.ts +139 -161
- package/declarations/view/Overlay.d.ts +1 -0
- package/declarations/view/PopoutWindow.d.ts +1 -0
- package/declarations/view/PopupMenu.d.ts +1 -0
- package/declarations/view/Row.d.ts +1 -0
- package/declarations/view/SizeTracker.d.ts +10 -0
- package/declarations/view/Splitter.d.ts +1 -1
- package/declarations/view/Tab.d.ts +1 -1
- package/declarations/view/TabButton.d.ts +1 -1
- package/declarations/view/TabButtonStamp.d.ts +1 -1
- package/declarations/view/TabOverflowHook.d.ts +1 -1
- package/declarations/view/TabSet.d.ts +1 -1
- package/declarations/view/Utils.d.ts +11 -1
- package/dist/bundles/demo.js +232052 -0
- package/dist/bundles/demo.js.map +1 -0
- package/dist/flexlayout.js +122 -92
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +42 -31
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +131 -108
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +120 -124
- package/lib/DockLocation.js.map +1 -1
- package/lib/DropInfo.js +9 -13
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +13 -18
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +22 -26
- package/lib/Orientation.js.map +1 -1
- package/lib/Rect.js +104 -72
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +96 -83
- package/lib/Types.js.map +1 -1
- package/lib/index.js +21 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +6 -10
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +169 -155
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +385 -406
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +66 -121
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +6 -9
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +1 -2
- package/lib/model/IDropTarget.js +1 -2
- package/lib/model/IJsonModel.js +1 -2
- package/lib/model/LayoutWindow.js +83 -0
- package/lib/model/LayoutWindow.js.map +1 -0
- package/lib/model/Model.js +614 -496
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +217 -228
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +491 -504
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/TabNode.js +289 -184
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +457 -446
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +47 -82
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +124 -138
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTab.js +47 -0
- package/lib/view/BorderTab.js.map +1 -0
- package/lib/view/BorderTabSet.js +134 -128
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/DragContainer.js +16 -0
- package/lib/view/DragContainer.js.map +1 -0
- package/lib/view/ErrorBoundary.js +23 -27
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/Icons.js +40 -45
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +918 -907
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Overlay.js +9 -0
- package/lib/view/Overlay.js.map +1 -0
- package/lib/view/PopoutWindow.js +129 -0
- package/lib/view/PopoutWindow.js.map +1 -0
- package/lib/view/PopupMenu.js +71 -0
- package/lib/view/PopupMenu.js.map +1 -0
- package/lib/view/Row.js +45 -0
- package/lib/view/Row.js.map +1 -0
- package/lib/view/SizeTracker.js +11 -0
- package/lib/view/SizeTracker.js.map +1 -0
- package/lib/view/Splitter.js +191 -147
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +86 -60
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +122 -135
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +16 -21
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabOverflowHook.js +150 -149
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +267 -234
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +126 -68
- package/lib/view/Utils.js.map +1 -1
- package/package.json +36 -30
- package/src/Attribute.ts +23 -0
- package/src/AttributeDefinitions.ts +38 -15
- package/src/DockLocation.ts +13 -13
- package/src/I18nLabel.ts +7 -9
- package/src/Rect.ts +53 -1
- package/src/Types.ts +16 -0
- package/src/index.ts +1 -2
- package/src/model/Actions.ts +49 -29
- package/src/model/BorderNode.ts +208 -214
- package/src/model/BorderSet.ts +42 -91
- package/src/model/IJsonModel.ts +883 -103
- package/src/model/LayoutWindow.ts +121 -0
- package/src/model/Model.ts +488 -366
- package/src/model/Node.ts +98 -111
- package/src/model/RowNode.ts +323 -319
- package/src/model/TabNode.ts +294 -110
- package/src/model/TabSetNode.ts +300 -242
- package/src/model/Utils.ts +6 -32
- package/src/view/BorderButton.tsx +32 -52
- package/src/view/BorderTab.tsx +70 -0
- package/src/view/BorderTabSet.tsx +64 -52
- package/src/view/DragContainer.tsx +32 -0
- package/src/view/Icons.tsx +6 -0
- package/src/view/Layout.tsx +1051 -1046
- package/src/view/Overlay.tsx +22 -0
- package/src/view/PopoutWindow.tsx +152 -0
- package/src/{PopupMenu.tsx → view/PopupMenu.tsx} +36 -31
- package/src/view/Row.tsx +68 -0
- package/src/view/SizeTracker.tsx +20 -0
- package/src/view/Splitter.tsx +167 -112
- package/src/view/Tab.tsx +76 -42
- package/src/view/TabButton.tsx +36 -55
- package/src/view/TabButtonStamp.tsx +5 -9
- package/src/view/TabOverflowHook.tsx +14 -9
- package/src/view/TabSet.tsx +217 -176
- package/src/view/Utils.tsx +119 -39
- package/style/_base.scss +140 -34
- package/style/dark.css +685 -580
- package/style/dark.css.map +1 -1
- package/style/dark.scss +3 -1
- package/style/gray.css +668 -563
- package/style/gray.css.map +1 -1
- package/style/gray.scss +2 -0
- package/style/light.css +669 -564
- 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 +194 -0
- package/style/underline.css +690 -585
- package/style/underline.css.map +1 -1
- package/style/underline.scss +2 -0
- package/cypress.config.ts +0 -16
- package/lib/DragDrop.js +0 -316
- package/lib/DragDrop.js.map +0 -1
- package/lib/PopupMenu.js +0 -68
- package/lib/PopupMenu.js.map +0 -1
- package/lib/model/SplitterNode.js +0 -72
- package/lib/model/SplitterNode.js.map +0 -1
- package/lib/view/FloatingWindow.js +0 -123
- package/lib/view/FloatingWindow.js.map +0 -1
- package/lib/view/FloatingWindowTab.js +0 -19
- package/lib/view/FloatingWindowTab.js.map +0 -1
- package/lib/view/TabFloating.js +0 -66
- package/lib/view/TabFloating.js.map +0 -1
- package/src/DragDrop.ts +0 -392
- package/src/model/SplitterNode.ts +0 -78
- package/src/view/FloatingWindow.tsx +0 -140
- package/src/view/FloatingWindowTab.tsx +0 -29
- package/src/view/TabFloating.tsx +0 -101
package/lib/view/Utils.js
CHANGED
|
@@ -1,69 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TabNode } from "../model/TabNode";
|
|
3
|
+
import { TabSetNode } from "../model/TabSetNode";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export function isDesktop() {
|
|
6
|
+
const desktop = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(hover: hover) and (pointer: fine)").matches;
|
|
7
|
+
return desktop;
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export function getRenderStateEx(layout, node, iconAngle) {
|
|
11
|
+
let leadingContent = undefined;
|
|
12
|
+
let titleContent = node.getName();
|
|
13
|
+
let name = node.getName();
|
|
14
|
+
if (iconAngle === undefined) {
|
|
15
|
+
iconAngle = 0;
|
|
16
|
+
}
|
|
17
|
+
if (leadingContent === undefined && node.getIcon() !== undefined) {
|
|
18
|
+
if (iconAngle !== 0) {
|
|
19
|
+
leadingContent = React.createElement("img", { style: { width: "1em", height: "1em", transform: "rotate(" + iconAngle + "deg)" }, src: node.getIcon(), alt: "leadingContent" });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
leadingContent = React.createElement("img", { style: { width: "1em", height: "1em" }, src: node.getIcon(), alt: "leadingContent" });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
let buttons = [];
|
|
26
|
+
// allow customization of leading contents (icon) and contents
|
|
27
|
+
const renderState = { leading: leadingContent, content: titleContent, name, buttons };
|
|
28
|
+
layout.customizeTab(node, renderState);
|
|
29
|
+
node.setRenderedName(renderState.name);
|
|
30
|
+
return renderState;
|
|
31
|
+
}
|
|
32
|
+
/** @internal */
|
|
33
|
+
export function isAuxMouseEvent(event) {
|
|
34
|
+
let auxEvent = false;
|
|
35
|
+
if (event.nativeEvent instanceof MouseEvent) {
|
|
36
|
+
if (event.nativeEvent.button !== 0 || event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) {
|
|
37
|
+
auxEvent = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return auxEvent;
|
|
41
|
+
}
|
|
42
|
+
export function enablePointerOnIFrames(enable, currentDocument) {
|
|
43
|
+
const iframes = [
|
|
44
|
+
...getElementsByTagName('iframe', currentDocument),
|
|
45
|
+
...getElementsByTagName('webview', currentDocument),
|
|
46
|
+
];
|
|
47
|
+
for (const iframe of iframes) {
|
|
48
|
+
iframe.style.pointerEvents = enable ? 'auto' : 'none';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
;
|
|
52
|
+
export function getElementsByTagName(tag, currentDocument) {
|
|
53
|
+
return [...currentDocument.getElementsByTagName(tag)];
|
|
54
|
+
}
|
|
55
|
+
export function startDrag(doc, event, drag, dragEnd, dragCancel) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
const pointerMove = (ev) => {
|
|
58
|
+
ev.preventDefault();
|
|
59
|
+
drag(ev.clientX, ev.clientY);
|
|
60
|
+
};
|
|
61
|
+
const pointerCancel = (ev) => {
|
|
62
|
+
ev.preventDefault();
|
|
63
|
+
dragCancel();
|
|
64
|
+
};
|
|
65
|
+
const pointerUp = () => {
|
|
66
|
+
doc.removeEventListener("pointermove", pointerMove);
|
|
67
|
+
doc.removeEventListener("pointerup", pointerUp);
|
|
68
|
+
doc.removeEventListener("pointercancel", pointerCancel);
|
|
69
|
+
dragEnd();
|
|
70
|
+
};
|
|
71
|
+
doc.addEventListener("pointermove", pointerMove);
|
|
72
|
+
doc.addEventListener("pointerup", pointerUp);
|
|
73
|
+
doc.addEventListener('pointercancel', pointerCancel);
|
|
74
|
+
}
|
|
75
|
+
export function canDockToWindow(node) {
|
|
76
|
+
if (node instanceof TabNode) {
|
|
77
|
+
return node.isEnablePopout();
|
|
78
|
+
}
|
|
79
|
+
else if (node instanceof TabSetNode) {
|
|
80
|
+
for (const child of node.getChildren()) {
|
|
81
|
+
if (child.isEnablePopout() === false) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
export function keepOnScreen(rect) {
|
|
90
|
+
rect.snap(10);
|
|
91
|
+
const availableScreenWidth = window.screen.availWidth;
|
|
92
|
+
const availableScreenHeight = window.screen.availHeight;
|
|
93
|
+
if (rect.x + rect.width > availableScreenWidth || rect.y + rect.height > availableScreenHeight) {
|
|
94
|
+
// Adjust the rectangle to fit within the available screen space
|
|
95
|
+
rect.x = Math.max(0, Math.min(rect.x, availableScreenWidth - rect.width));
|
|
96
|
+
rect.y = Math.max(0, Math.min(rect.y, availableScreenHeight - rect.height));
|
|
97
|
+
}
|
|
98
|
+
return rect;
|
|
99
|
+
}
|
|
100
|
+
export function isOnScreen(rect) {
|
|
101
|
+
const availableScreenWidth = window.screen.availWidth;
|
|
102
|
+
const availableScreenHeight = window.screen.availHeight;
|
|
103
|
+
return (rect.x >= 0 && rect.getRight() <= availableScreenWidth &&
|
|
104
|
+
rect.y >= 0 || rect.getBottom() <= availableScreenHeight);
|
|
105
|
+
}
|
|
106
|
+
export function copyInlineStyles(source, target) {
|
|
107
|
+
// Get the inline style attribute from the source element
|
|
108
|
+
const sourceStyle = source.getAttribute('style');
|
|
109
|
+
const targetStyle = target.getAttribute('style');
|
|
110
|
+
if (sourceStyle === targetStyle)
|
|
111
|
+
return false;
|
|
112
|
+
// console.log("copyInlineStyles", sourceStyle);
|
|
113
|
+
if (sourceStyle) {
|
|
114
|
+
// Set the style attribute on the target element
|
|
115
|
+
target.setAttribute('style', sourceStyle);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// If the source has no inline style, clear the target's style attribute
|
|
119
|
+
target.removeAttribute('style');
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
export function isSafari() {
|
|
124
|
+
const userAgent = navigator.userAgent;
|
|
125
|
+
return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
|
|
126
|
+
}
|
|
69
127
|
//# sourceMappingURL=Utils.js.map
|
package/lib/view/Utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/view/Utils.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/view/Utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,gBAAgB;AAChB,MAAM,UAAU,SAAS;IACrB,MAAM,OAAO,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,oCAAoC,CAAC,CAAC,OAAO,CAAC;IACtI,OAAO,OAAO,CAAC;AACnB,CAAC;AACD,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAC5B,MAAsB,EACtB,IAAa,EACb,SAAkB;IAElB,IAAI,cAAc,GAAG,SAAS,CAAC;IAC/B,IAAI,YAAY,GAAoB,IAAI,CAAC,OAAO,EAAE,CAAC;IACnD,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC1B,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,SAAS,GAAG,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,cAAc,KAAK,SAAS,IAAI,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CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flexlayout-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "A multi-tab docking layout manager",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./declarations/index.d.ts",
|
|
@@ -25,17 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
27
|
"start": "webpack serve",
|
|
28
|
-
"build": "npm run css && npm run
|
|
29
|
-
"build:
|
|
28
|
+
"build": "npm run css && npm run doc && npm run build:demo && npm run build:esm && npm run build:umd && npm run build:umd:min",
|
|
29
|
+
"build:esm": "tsc -p tsconfig2.json",
|
|
30
30
|
"build:umd": "webpack --mode=development --config webpack_build.config.js",
|
|
31
31
|
"build:umd:min": "webpack --mode=production --config webpack_build_min.config.js",
|
|
32
32
|
"build:demo": "webpack",
|
|
33
33
|
"lint:eslint": "eslint src/*",
|
|
34
34
|
"doc": "typedoc --out typedoc --exclude \"**/examples/**/*.tsx\" --excludeInternal --disableSources --excludePrivate --excludeProtected --readme none ./src",
|
|
35
|
-
"css": "sass style/underline.scss style/underline.css && sass style/gray.scss style/gray.css && sass style/light.scss style/light.css && sass style/light.scss test/style/light.css && sass style/dark.scss style/dark.css"
|
|
36
|
-
"cypress": "cypress open-ct",
|
|
37
|
-
"cypress-firefox": "cypress open-ct --browser firefox",
|
|
38
|
-
"test": "cypress run --component"
|
|
35
|
+
"css": "sass style/rounded.scss style/rounded.css && sass style/underline.scss style/underline.css && sass style/gray.scss style/gray.css && sass style/light.scss style/light.css && sass style/light.scss test/style/light.css && sass style/dark.scss style/dark.css"
|
|
39
36
|
},
|
|
40
37
|
"author": "Caplin Systems Ltd",
|
|
41
38
|
"repository": "https://github.com/caplin/FlexLayout",
|
|
@@ -48,29 +45,38 @@
|
|
|
48
45
|
"extends": "react-app"
|
|
49
46
|
},
|
|
50
47
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
48
|
+
"@emotion/react": "^11.13.3",
|
|
49
|
+
"@emotion/styled": "^11.13.0",
|
|
50
|
+
"@fontsource/roboto": "^5.0.14",
|
|
51
|
+
"@mui/material": "^6.0.1",
|
|
52
|
+
"@types/node": "^22.5.0",
|
|
53
|
+
"@types/prismjs": "^1.26.4",
|
|
54
|
+
"@types/react": "^18.3.4",
|
|
55
|
+
"@types/react-dom": "^18.3.0",
|
|
56
|
+
"ag-grid-community": "^32.1.0",
|
|
57
|
+
"ag-grid-react": "^32.1.0",
|
|
58
|
+
"chart.js": "^4.4.4",
|
|
59
|
+
"css-loader": "^7.1.2",
|
|
60
|
+
"html-webpack-plugin": "^5.6.0",
|
|
61
|
+
"ol": "^10.1.0",
|
|
62
|
+
"prettier": "^3.3.3",
|
|
63
|
+
"prismjs": "^1.29.0",
|
|
64
|
+
"react": "^18.3.1",
|
|
65
|
+
"react-chartjs-2": "^5.2.0",
|
|
66
|
+
"react-dom": "^18.3.1",
|
|
64
67
|
"react-scripts": "5.0.1",
|
|
65
|
-
"sass": "^1.
|
|
66
|
-
"source-map-loader": "^
|
|
67
|
-
"style-loader": "^
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"webpack
|
|
73
|
-
"webpack-
|
|
68
|
+
"sass": "^1.77.8",
|
|
69
|
+
"source-map-loader": "^5.0.0",
|
|
70
|
+
"style-loader": "^4.0.0",
|
|
71
|
+
"styled-components": "^6.1.13",
|
|
72
|
+
"ts-loader": "~9.5.1",
|
|
73
|
+
"typedoc": "^0.26.6",
|
|
74
|
+
"typescript": "^5.5.4",
|
|
75
|
+
"webpack": "^5.94.0",
|
|
76
|
+
"webpack-cli": "^5.1.4",
|
|
77
|
+
"webpack-dev-server": "^5.0.4",
|
|
78
|
+
"@mui/x-data-grid": "^7.15.0"
|
|
74
79
|
},
|
|
75
|
-
"dependencies": {
|
|
80
|
+
"dependencies": {
|
|
81
|
+
}
|
|
76
82
|
}
|
package/src/Attribute.ts
CHANGED
|
@@ -5,15 +5,20 @@ export class Attribute {
|
|
|
5
5
|
static BOOLEAN = "boolean";
|
|
6
6
|
|
|
7
7
|
name: string;
|
|
8
|
+
alias: string | undefined;
|
|
8
9
|
modelName?: string;
|
|
10
|
+
pairedAttr?: Attribute;
|
|
11
|
+
pairedType?: string;
|
|
9
12
|
defaultValue: any;
|
|
10
13
|
alwaysWriteJson?: boolean;
|
|
11
14
|
type?: string;
|
|
12
15
|
required: boolean;
|
|
13
16
|
fixed: boolean;
|
|
17
|
+
description?: string;
|
|
14
18
|
|
|
15
19
|
constructor(name: string, modelName: string | undefined, defaultValue: any, alwaysWriteJson?: boolean) {
|
|
16
20
|
this.name = name;
|
|
21
|
+
this.alias = undefined;
|
|
17
22
|
this.modelName = modelName;
|
|
18
23
|
this.defaultValue = defaultValue;
|
|
19
24
|
this.alwaysWriteJson = alwaysWriteJson;
|
|
@@ -28,6 +33,15 @@ export class Attribute {
|
|
|
28
33
|
return this;
|
|
29
34
|
}
|
|
30
35
|
|
|
36
|
+
setAlias(value: string) {
|
|
37
|
+
this.alias = value;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setDescription(value: string) {
|
|
42
|
+
this.description = value;
|
|
43
|
+
}
|
|
44
|
+
|
|
31
45
|
setRequired() {
|
|
32
46
|
this.required = true;
|
|
33
47
|
return this;
|
|
@@ -38,4 +52,13 @@ export class Attribute {
|
|
|
38
52
|
return this;
|
|
39
53
|
}
|
|
40
54
|
|
|
55
|
+
// sets modelAttr for nodes, and nodeAttr for model
|
|
56
|
+
setpairedAttr(value: Attribute) {
|
|
57
|
+
this.pairedAttr = value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
setPairedType(value: string) {
|
|
61
|
+
this.pairedType = value;
|
|
62
|
+
}
|
|
63
|
+
|
|
41
64
|
}
|
|
@@ -3,17 +3,17 @@ import { Attribute } from "./Attribute";
|
|
|
3
3
|
/** @internal */
|
|
4
4
|
export class AttributeDefinitions {
|
|
5
5
|
attributes: Attribute[];
|
|
6
|
-
nameToAttribute:
|
|
6
|
+
nameToAttribute: Map<string, Attribute>;
|
|
7
7
|
|
|
8
8
|
constructor() {
|
|
9
9
|
this.attributes = [];
|
|
10
|
-
this.nameToAttribute =
|
|
10
|
+
this.nameToAttribute = new Map();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
addWithAll(name: string, modelName: string | undefined, defaultValue: any, alwaysWriteJson?: boolean) {
|
|
14
14
|
const attr = new Attribute(name, modelName, defaultValue, alwaysWriteJson);
|
|
15
15
|
this.attributes.push(attr);
|
|
16
|
-
this.nameToAttribute
|
|
16
|
+
this.nameToAttribute.set(name, attr);
|
|
17
17
|
return attr;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -30,7 +30,7 @@ export class AttributeDefinitions {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
getModelName(name: string) {
|
|
33
|
-
const conversion = this.nameToAttribute
|
|
33
|
+
const conversion = this.nameToAttribute.get(name);
|
|
34
34
|
if (conversion !== undefined) {
|
|
35
35
|
return conversion.modelName;
|
|
36
36
|
}
|
|
@@ -48,7 +48,10 @@ export class AttributeDefinitions {
|
|
|
48
48
|
|
|
49
49
|
fromJson(jsonObj: any, obj: any) {
|
|
50
50
|
for (const attr of this.attributes) {
|
|
51
|
-
|
|
51
|
+
let fromValue = jsonObj[attr.name];
|
|
52
|
+
if (fromValue === undefined && attr.alias) {
|
|
53
|
+
fromValue = jsonObj[attr.alias];
|
|
54
|
+
}
|
|
52
55
|
if (fromValue === undefined) {
|
|
53
56
|
obj[attr.name] = attr.defaultValue;
|
|
54
57
|
} else {
|
|
@@ -76,6 +79,17 @@ export class AttributeDefinitions {
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
82
|
+
pairAttributes(type: string, childAttributes: AttributeDefinitions) {
|
|
83
|
+
for (const attr of childAttributes.attributes) {
|
|
84
|
+
if (attr.modelName && this.nameToAttribute.has(attr.modelName)) {
|
|
85
|
+
const pairedAttr = this.nameToAttribute.get(attr.modelName)!;
|
|
86
|
+
pairedAttr.setpairedAttr(attr);
|
|
87
|
+
attr.setpairedAttr(pairedAttr);
|
|
88
|
+
pairedAttr.setPairedType(type);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
79
93
|
toTypescriptInterface(name: string, parentAttributes: AttributeDefinitions | undefined) {
|
|
80
94
|
const lines = [];
|
|
81
95
|
const sorted = this.attributes.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -92,27 +106,36 @@ export class AttributeDefinitions {
|
|
|
92
106
|
defaultValue = attr.defaultValue;
|
|
93
107
|
} else if (attr.modelName !== undefined
|
|
94
108
|
&& parentAttributes !== undefined
|
|
95
|
-
&& parentAttributes.nameToAttribute
|
|
109
|
+
&& parentAttributes.nameToAttribute.get(attr.modelName) !== undefined) {
|
|
96
110
|
inherited = attr.modelName;
|
|
97
|
-
attr = parentAttributes.nameToAttribute
|
|
111
|
+
attr = parentAttributes.nameToAttribute.get(inherited)!;
|
|
98
112
|
defaultValue = attr.defaultValue;
|
|
99
113
|
type = attr.type;
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
let defValue = JSON.stringify(defaultValue);
|
|
103
117
|
|
|
104
|
-
const required = attr.required
|
|
118
|
+
const required = attr.required ? "" : "?";
|
|
105
119
|
|
|
120
|
+
let sb = "\t/**\n\t ";
|
|
121
|
+
if (c.description) {
|
|
122
|
+
sb += c.description;
|
|
123
|
+
} else if (c.pairedType && c.pairedAttr?.description) {
|
|
124
|
+
sb += `Value for ${c.pairedType} attribute ${c.pairedAttr.name} if not overridden`
|
|
125
|
+
sb += "\n\n\t ";
|
|
126
|
+
sb += c.pairedAttr?.description;
|
|
127
|
+
}
|
|
128
|
+
sb += "\n\n\t ";
|
|
106
129
|
if (c.fixed) {
|
|
107
|
-
|
|
130
|
+
sb += `Fixed value: ${defValue}`;
|
|
131
|
+
} else if (inherited) {
|
|
132
|
+
sb += `Default: inherited from Global attribute ${c.modelName} (default ${defValue})`;
|
|
108
133
|
} else {
|
|
109
|
-
|
|
110
|
-
(inherited !== undefined ? " - inherited from global " + inherited : "");
|
|
111
|
-
|
|
112
|
-
lines.push("\t" + c.name + required + ": " + type + ";" +
|
|
113
|
-
(comment.length > 0 ? " // " + comment : "")
|
|
114
|
-
);
|
|
134
|
+
sb += `Default: ${defValue}`;
|
|
115
135
|
}
|
|
136
|
+
sb += "\n\t */";
|
|
137
|
+
lines.push(sb);
|
|
138
|
+
lines.push("\t" + c.name + required + ": " + type + ";\n");
|
|
116
139
|
}
|
|
117
140
|
lines.push("}");
|
|
118
141
|
|
package/src/DockLocation.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Orientation } from "./Orientation";
|
|
|
2
2
|
import { Rect } from "./Rect";
|
|
3
3
|
|
|
4
4
|
export class DockLocation {
|
|
5
|
-
static values
|
|
5
|
+
static values = new Map<string, DockLocation>();
|
|
6
6
|
static TOP = new DockLocation("top", Orientation.VERT, 0);
|
|
7
7
|
static BOTTOM = new DockLocation("bottom", Orientation.VERT, 1);
|
|
8
8
|
static LEFT = new DockLocation("left", Orientation.HORZ, 0);
|
|
@@ -11,7 +11,7 @@ export class DockLocation {
|
|
|
11
11
|
|
|
12
12
|
/** @internal */
|
|
13
13
|
static getByName(name: string): DockLocation {
|
|
14
|
-
return DockLocation.values
|
|
14
|
+
return DockLocation.values.get(name)!;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** @internal */
|
|
@@ -51,26 +51,26 @@ export class DockLocation {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/** @internal */
|
|
54
|
-
|
|
54
|
+
name: string;
|
|
55
55
|
/** @internal */
|
|
56
|
-
|
|
56
|
+
orientation: Orientation;
|
|
57
57
|
/** @internal */
|
|
58
|
-
|
|
58
|
+
indexPlus: number;
|
|
59
59
|
|
|
60
60
|
/** @internal */
|
|
61
|
-
constructor(
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
DockLocation.values
|
|
61
|
+
constructor(_name: string, _orientation: Orientation, _indexPlus: number) {
|
|
62
|
+
this.name = _name;
|
|
63
|
+
this.orientation = _orientation;
|
|
64
|
+
this.indexPlus = _indexPlus;
|
|
65
|
+
DockLocation.values.set(this.name, this);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
getName() {
|
|
69
|
-
return this.
|
|
69
|
+
return this.name;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
getOrientation() {
|
|
73
|
-
return this.
|
|
73
|
+
return this.orientation;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/** @internal */
|
|
@@ -128,6 +128,6 @@ export class DockLocation {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
toString() {
|
|
131
|
-
return "(DockLocation: name=" + this.
|
|
131
|
+
return "(DockLocation: name=" + this.name + ", orientation=" + this.orientation + ")";
|
|
132
132
|
}
|
|
133
133
|
}
|
package/src/I18nLabel.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
export enum I18nLabel {
|
|
2
2
|
Close_Tab = "Close",
|
|
3
|
-
Close_Tabset = "Close
|
|
4
|
-
|
|
5
|
-
Move_Tabset = "Move
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Close_Tabset = "Close tab set",
|
|
4
|
+
Active_Tabset = "Active tab set",
|
|
5
|
+
Move_Tabset = "Move tab set",
|
|
6
|
+
Move_Tabs = "Move tabs(?)",
|
|
7
|
+
Maximize = "Maximize tab set",
|
|
8
|
+
Restore = "Restore tab set",
|
|
9
|
+
Popout_Tab = "Popout selected tab",
|
|
9
10
|
Overflow_Menu_Tooltip = "Hidden tabs",
|
|
10
|
-
Floating_Window_Message = "This panel is shown in a floating window",
|
|
11
|
-
Floating_Window_Show_Window = "Show window",
|
|
12
|
-
Floating_Window_Dock_Window = "Dock window",
|
|
13
11
|
Error_rendering_component = "Error rendering component",
|
|
14
12
|
}
|
package/src/Rect.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IJsonRect } from "./model/IJsonModel";
|
|
1
2
|
import { Orientation } from "./Orientation";
|
|
2
3
|
|
|
3
4
|
export class Rect {
|
|
@@ -5,6 +6,10 @@ export class Rect {
|
|
|
5
6
|
return new Rect(0, 0, 0, 0);
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
static fromJson(json: IJsonRect): Rect {
|
|
10
|
+
return new Rect(json.x, json.y, json.width, json.height);
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
x: number;
|
|
9
14
|
y: number;
|
|
10
15
|
width: number;
|
|
@@ -17,11 +22,54 @@ export class Rect {
|
|
|
17
22
|
this.height = height;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
toJson() {
|
|
26
|
+
return {x: this.x, y: this.y, width: this.width, height: this.height};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
snap(round: number) {
|
|
30
|
+
this.x = Math.round(this.x / round) * round;
|
|
31
|
+
this.y = Math.round(this.y / round) * round;
|
|
32
|
+
this.width = Math.round(this.width / round) * round;
|
|
33
|
+
this.height= Math.round(this.height / round) * round;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static getBoundingClientRect(element: Element) {
|
|
21
37
|
let { x, y, width, height } = element.getBoundingClientRect();
|
|
22
38
|
return new Rect(x, y, width, height);
|
|
23
39
|
}
|
|
24
40
|
|
|
41
|
+
static getContentRect(element: HTMLElement) {
|
|
42
|
+
const rect = element.getBoundingClientRect();
|
|
43
|
+
const style = window.getComputedStyle(element);
|
|
44
|
+
|
|
45
|
+
const paddingLeft = parseFloat(style.paddingLeft);
|
|
46
|
+
const paddingRight = parseFloat(style.paddingRight);
|
|
47
|
+
const paddingTop = parseFloat(style.paddingTop);
|
|
48
|
+
const paddingBottom = parseFloat(style.paddingBottom);
|
|
49
|
+
const borderLeftWidth = parseFloat(style.borderLeftWidth);
|
|
50
|
+
const borderRightWidth = parseFloat(style.borderRightWidth);
|
|
51
|
+
const borderTopWidth = parseFloat(style.borderTopWidth);
|
|
52
|
+
const borderBottomWidth = parseFloat(style.borderBottomWidth);
|
|
53
|
+
|
|
54
|
+
const contentWidth = rect.width - borderLeftWidth - paddingLeft - paddingRight - borderRightWidth;
|
|
55
|
+
const contentHeight = rect.height - borderTopWidth - paddingTop - paddingBottom - borderBottomWidth;
|
|
56
|
+
|
|
57
|
+
return new Rect(
|
|
58
|
+
rect.left + borderLeftWidth + paddingLeft,
|
|
59
|
+
rect.top + borderTopWidth + paddingTop,
|
|
60
|
+
contentWidth,
|
|
61
|
+
contentHeight,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static fromDomRect(domRect: DOMRect) {
|
|
66
|
+
return new Rect(domRect.x, domRect.y, domRect.width, domRect.height);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
relativeTo(r: Rect | DOMRect) {
|
|
70
|
+
return new Rect(this.x - r.x, this.y - r.y, this.width, this.height);
|
|
71
|
+
}
|
|
72
|
+
|
|
25
73
|
clone() {
|
|
26
74
|
return new Rect(this.x, this.y, this.width, this.height);
|
|
27
75
|
}
|
|
@@ -30,6 +78,10 @@ export class Rect {
|
|
|
30
78
|
return this.x === rect?.x && this.y === rect?.y && this.width === rect?.width && this.height === rect?.height
|
|
31
79
|
}
|
|
32
80
|
|
|
81
|
+
equalSize(rect: Rect | null | undefined) {
|
|
82
|
+
return this.width === rect?.width && this.height === rect?.height
|
|
83
|
+
}
|
|
84
|
+
|
|
33
85
|
getBottom() {
|
|
34
86
|
return this.y + this.height;
|
|
35
87
|
}
|