flexlayout-react 0.8.2 → 0.8.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/ChangeLog.txt +5 -0
- package/README.md +3 -3
- package/declarations/model/IJsonModel.d.ts +1 -1
- package/declarations/view/Utils.d.ts +0 -3
- package/dist/flexlayout.js +7 -7
- package/dist/flexlayout_min.js +1 -1
- package/lib/model/LayoutWindow.js +1 -3
- package/lib/model/LayoutWindow.js.map +1 -1
- package/lib/model/Model.js +0 -9
- package/lib/model/Model.js.map +1 -1
- package/lib/model/TabSetNode.js +1 -1
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/view/Layout.js +1 -1
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Tab.js +5 -0
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabOverflowHook.js +2 -0
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/Utils.js +0 -17
- package/lib/view/Utils.js.map +1 -1
- package/package.json +1 -1
- package/src/model/IJsonModel.ts +1 -1
- package/src/model/LayoutWindow.ts +1 -3
- package/src/model/Model.ts +0 -9
- package/src/model/TabSetNode.ts +1 -1
- package/src/view/Layout.tsx +1 -1
- package/src/view/Tab.tsx +6 -0
- package/src/view/TabOverflowHook.tsx +1 -0
- package/src/view/Utils.tsx +0 -24
|
@@ -4,7 +4,6 @@ import { Model } from "./Model";
|
|
|
4
4
|
import { RowNode } from "./RowNode";
|
|
5
5
|
import { Node } from "./Node";
|
|
6
6
|
import { TabSetNode } from "./TabSetNode";
|
|
7
|
-
import { keepOnScreen } from "../view/Utils";
|
|
8
7
|
import { LayoutInternal } from "../view/Layout";
|
|
9
8
|
|
|
10
9
|
export class LayoutWindow {
|
|
@@ -112,8 +111,7 @@ export class LayoutWindow {
|
|
|
112
111
|
static fromJson(windowJson: IJsonPopout, model: Model, windowId: string): LayoutWindow {
|
|
113
112
|
const count = model.getwindowsMap().size;
|
|
114
113
|
let rect = windowJson.rect ? Rect.fromJson(windowJson.rect) : new Rect(50 + 50 * count, 50 + 50 * count, 600, 400);
|
|
115
|
-
rect
|
|
116
|
-
// snapping prevents issue where window moves 1 pixel per save/restore on Chrome
|
|
114
|
+
rect.snap(10); // snapping prevents issue where window moves 1 pixel per save/restore on Chrome
|
|
117
115
|
const layoutWindow = new LayoutWindow(windowId, rect);
|
|
118
116
|
layoutWindow.root = RowNode.fromJson(windowJson.layout, model, layoutWindow);
|
|
119
117
|
return layoutWindow;
|
package/src/model/Model.ts
CHANGED
|
@@ -16,7 +16,6 @@ import { TabNode } from "./TabNode";
|
|
|
16
16
|
import { TabSetNode } from "./TabSetNode";
|
|
17
17
|
import { randomUUID } from "./Utils";
|
|
18
18
|
import { LayoutWindow } from "./LayoutWindow";
|
|
19
|
-
import { isOnScreen } from "../view/Utils";
|
|
20
19
|
|
|
21
20
|
/** @internal */
|
|
22
21
|
export const DefaultMin = 0;
|
|
@@ -406,18 +405,10 @@ export class Model {
|
|
|
406
405
|
model.borders = BorderSet.fromJson(json.borders, model);
|
|
407
406
|
}
|
|
408
407
|
if (json.popouts) {
|
|
409
|
-
let i= 0;
|
|
410
|
-
let top = 100;
|
|
411
|
-
let left = 100;
|
|
412
408
|
for (const windowId in json.popouts) {
|
|
413
409
|
const windowJson = json.popouts[windowId];
|
|
414
410
|
const layoutWindow = LayoutWindow.fromJson(windowJson, model, windowId);
|
|
415
411
|
model.windows.set(windowId, layoutWindow);
|
|
416
|
-
// offscreen windows will reload cascaded (since cannot reposition)
|
|
417
|
-
if (!isOnScreen(layoutWindow.rect)) {
|
|
418
|
-
layoutWindow.rect = new Rect(top + i*50, left+ i*50, 600, 400);
|
|
419
|
-
i++;
|
|
420
|
-
}
|
|
421
412
|
}
|
|
422
413
|
}
|
|
423
414
|
|
package/src/model/TabSetNode.ts
CHANGED
|
@@ -560,7 +560,7 @@ export class TabSetNode extends Node implements IDraggable, IDropTarget {
|
|
|
560
560
|
);
|
|
561
561
|
|
|
562
562
|
attributeDefinitions.addInherited("enableTabWrap", "tabSetEnableTabWrap").setDescription(
|
|
563
|
-
`
|
|
563
|
+
`wrap tabs onto multiple lines`
|
|
564
564
|
);
|
|
565
565
|
attributeDefinitions.addInherited("tabLocation", "tabSetTabLocation").setDescription(
|
|
566
566
|
`the location of the tabs either top or bottom`
|
package/src/view/Layout.tsx
CHANGED
|
@@ -406,7 +406,7 @@ export class LayoutInternal extends React.Component<ILayoutInternalProps, ILayou
|
|
|
406
406
|
const borderSetContentComponents = new Map<DockLocation, React.ReactNode>();
|
|
407
407
|
for (const [_, location] of DockLocation.values) {
|
|
408
408
|
const border = borders.get(location);
|
|
409
|
-
const showBorder = border && (
|
|
409
|
+
const showBorder = border && border.isShowing() && (
|
|
410
410
|
!border.isAutoHide() ||
|
|
411
411
|
(border.isAutoHide() && (border.getChildren().length > 0 || this.state.showHiddenBorder === location)));
|
|
412
412
|
if (showBorder) {
|
package/src/view/Tab.tsx
CHANGED
|
@@ -95,6 +95,12 @@ export const Tab = (props: ITabProps) => {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
if (parentNode instanceof BorderNode) {
|
|
99
|
+
if (!parentNode.isShowing()) {
|
|
100
|
+
style.display = "none";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
98
104
|
let className = cm(CLASSES.FLEXLAYOUT__TAB);
|
|
99
105
|
if (parentNode instanceof BorderNode) {
|
|
100
106
|
className += " " + cm(CLASSES.FLEXLAYOUT__TAB_BORDER);
|
|
@@ -154,6 +154,7 @@ export const useTabOverflow = (
|
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
const onMouseWheel = (event: React.WheelEvent<HTMLElement>) => {
|
|
157
|
+
if (node.getChildren().length===0) return;
|
|
157
158
|
let delta = 0;
|
|
158
159
|
if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {
|
|
159
160
|
delta = -event.deltaX;
|
package/src/view/Utils.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import { Node } from "../model/Node";
|
|
|
3
3
|
import { TabNode } from "../model/TabNode";
|
|
4
4
|
import { LayoutInternal } from "./Layout";
|
|
5
5
|
import { TabSetNode } from "../model/TabSetNode";
|
|
6
|
-
import { Rect } from "../Rect";
|
|
7
6
|
|
|
8
7
|
/** @internal */
|
|
9
8
|
export function isDesktop() {
|
|
@@ -112,29 +111,6 @@ export function canDockToWindow(node: Node) {
|
|
|
112
111
|
return false;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
export function keepOnScreen(rect: Rect) {
|
|
116
|
-
rect.snap(10);
|
|
117
|
-
|
|
118
|
-
const availableScreenWidth = window.screen.availWidth;
|
|
119
|
-
const availableScreenHeight = window.screen.availHeight;
|
|
120
|
-
|
|
121
|
-
if (rect.x + rect.width > availableScreenWidth || rect.y + rect.height > availableScreenHeight) {
|
|
122
|
-
// Adjust the rectangle to fit within the available screen space
|
|
123
|
-
rect.x = Math.max(0, Math.min(rect.x, availableScreenWidth - rect.width));
|
|
124
|
-
rect.y = Math.max(0, Math.min(rect.y, availableScreenHeight - rect.height));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return rect;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function isOnScreen(rect: Rect) {
|
|
131
|
-
const availableScreenWidth = window.screen.availWidth;
|
|
132
|
-
const availableScreenHeight = window.screen.availHeight;
|
|
133
|
-
|
|
134
|
-
return (rect.x >= 0 && rect.getRight() <= availableScreenWidth &&
|
|
135
|
-
rect.y >= 0 || rect.getBottom() <= availableScreenHeight);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
114
|
export function copyInlineStyles(source: HTMLElement, target: HTMLElement): boolean {
|
|
139
115
|
// Get the inline style attribute from the source element
|
|
140
116
|
const sourceStyle = source.getAttribute('style');
|