@aptre/flex-layout 0.5.8 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +32 -21
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -5934,7 +5934,7 @@ var DragState = class {
|
|
|
5934
5934
|
|
|
5935
5935
|
// src/view/OptimizedLayout.tsx
|
|
5936
5936
|
import * as React20 from "react";
|
|
5937
|
-
import { memo as memo2, useCallback, useEffect as useEffect6, useMemo, useState as useState4 } from "react";
|
|
5937
|
+
import { memo as memo2, useCallback, useEffect as useEffect6, useLayoutEffect as useLayoutEffect9, useMemo, useRef as useRef12, useState as useState4 } from "react";
|
|
5938
5938
|
function createTabInfo(node) {
|
|
5939
5939
|
const parent = node.getParent();
|
|
5940
5940
|
const contentRect = parent?.getContentRect() ?? Rect.empty();
|
|
@@ -5988,16 +5988,32 @@ var TabPanel = memo2(function TabPanel2({
|
|
|
5988
5988
|
contentClassName,
|
|
5989
5989
|
className,
|
|
5990
5990
|
renderTab,
|
|
5991
|
-
|
|
5991
|
+
model,
|
|
5992
5992
|
isMaximized,
|
|
5993
5993
|
hasMaximizedTabset
|
|
5994
5994
|
}) {
|
|
5995
|
+
const selfRef = useRef12(null);
|
|
5995
5996
|
const hasValidDimensions = rect.width > 0 && rect.height > 0;
|
|
5996
5997
|
const content = useMemo(() => renderTab(node), [renderTab, node]);
|
|
5997
|
-
|
|
5998
|
+
useLayoutEffect9(() => {
|
|
5999
|
+
const element = selfRef.current;
|
|
6000
|
+
if (!element) return;
|
|
6001
|
+
const onPointerDown = () => {
|
|
6002
|
+
const parent = node.getParent();
|
|
6003
|
+
if (parent instanceof TabSetNode) {
|
|
6004
|
+
model.doAction(Actions.setActiveTabset(parent.getId(), Model.MAIN_WINDOW_ID));
|
|
6005
|
+
}
|
|
6006
|
+
};
|
|
6007
|
+
element.addEventListener("pointerdown", onPointerDown, true);
|
|
6008
|
+
return () => {
|
|
6009
|
+
element.removeEventListener("pointerdown", onPointerDown, true);
|
|
6010
|
+
};
|
|
6011
|
+
}, [node, model, nodeId]);
|
|
6012
|
+
const isSelected = visible || node.isSelected();
|
|
6013
|
+
let isHidden = !isSelected;
|
|
5998
6014
|
let zIndex;
|
|
5999
6015
|
if (hasMaximizedTabset) {
|
|
6000
|
-
if (isMaximized &&
|
|
6016
|
+
if (isMaximized && isSelected) {
|
|
6001
6017
|
zIndex = 11;
|
|
6002
6018
|
isHidden = false;
|
|
6003
6019
|
} else {
|
|
@@ -6007,6 +6023,7 @@ var TabPanel = memo2(function TabPanel2({
|
|
|
6007
6023
|
return /* @__PURE__ */ React20.createElement(
|
|
6008
6024
|
"div",
|
|
6009
6025
|
{
|
|
6026
|
+
ref: selfRef,
|
|
6010
6027
|
role: "tabpanel",
|
|
6011
6028
|
"data-tab-id": nodeId,
|
|
6012
6029
|
className: className + (contentClassName ? " " + contentClassName : ""),
|
|
@@ -6021,8 +6038,7 @@ var TabPanel = memo2(function TabPanel2({
|
|
|
6021
6038
|
zIndex,
|
|
6022
6039
|
// Tab panels receive pointer events when visible and not dragging
|
|
6023
6040
|
pointerEvents: !isHidden && !isDragging ? "auto" : "none"
|
|
6024
|
-
}
|
|
6025
|
-
onPointerDown
|
|
6041
|
+
}
|
|
6026
6042
|
},
|
|
6027
6043
|
content
|
|
6028
6044
|
);
|
|
@@ -6032,23 +6048,15 @@ function TabContainer({
|
|
|
6032
6048
|
renderTab,
|
|
6033
6049
|
isDragging,
|
|
6034
6050
|
classNameMapper,
|
|
6035
|
-
model
|
|
6051
|
+
model,
|
|
6052
|
+
maximizedTabsetId
|
|
6036
6053
|
}) {
|
|
6054
|
+
void maximizedTabsetId;
|
|
6037
6055
|
const className = classNameMapper ? classNameMapper("flexlayout__tab") : "flexlayout__tab";
|
|
6038
6056
|
const maximizedTabset = model.getMaximizedTabset(Model.MAIN_WINDOW_ID);
|
|
6039
6057
|
const hasMaximizedTabset = maximizedTabset !== void 0;
|
|
6040
|
-
const
|
|
6041
|
-
|
|
6042
|
-
const parent = node.getParent();
|
|
6043
|
-
if (parent instanceof TabSetNode) {
|
|
6044
|
-
if (!parent.isActive()) {
|
|
6045
|
-
model.doAction(Actions.setActiveTabset(parent.getId(), Model.MAIN_WINDOW_ID));
|
|
6046
|
-
}
|
|
6047
|
-
}
|
|
6048
|
-
},
|
|
6049
|
-
[model]
|
|
6050
|
-
);
|
|
6051
|
-
return /* @__PURE__ */ React20.createElement("div", { className: "flexlayout__optimized_layout_tab_container", "data-layout-path": "/tab-container" }, Array.from(tabs.entries()).map(([nodeId, tabInfo]) => {
|
|
6058
|
+
const containerStyle = hasMaximizedTabset ? { zIndex: 10 } : {};
|
|
6059
|
+
return /* @__PURE__ */ React20.createElement("div", { className: "flexlayout__optimized_layout_tab_container", "data-layout-path": "/tab-container", style: containerStyle }, Array.from(tabs.entries()).map(([nodeId, tabInfo]) => {
|
|
6052
6060
|
const parent = tabInfo.node.getParent();
|
|
6053
6061
|
const isMaximized = parent instanceof TabSetNode && parent.isMaximized();
|
|
6054
6062
|
return /* @__PURE__ */ React20.createElement(
|
|
@@ -6063,7 +6071,7 @@ function TabContainer({
|
|
|
6063
6071
|
contentClassName: tabInfo.node.getContentClassName(),
|
|
6064
6072
|
className,
|
|
6065
6073
|
renderTab,
|
|
6066
|
-
|
|
6074
|
+
model,
|
|
6067
6075
|
isMaximized,
|
|
6068
6076
|
hasMaximizedTabset
|
|
6069
6077
|
}
|
|
@@ -6073,6 +6081,7 @@ function TabContainer({
|
|
|
6073
6081
|
function OptimizedLayout({ model, renderTab, classNameMapper, onDragStateChange, onModelChange: userOnModelChange, ...layoutProps }) {
|
|
6074
6082
|
const [isDragging, setIsDragging] = useState4(false);
|
|
6075
6083
|
const [tabs, setTabs] = useState4(() => /* @__PURE__ */ new Map());
|
|
6084
|
+
const [maximizedTabsetId, setMaximizedTabsetId] = useState4(() => model.getMaximizedTabset(Model.MAIN_WINDOW_ID)?.getId());
|
|
6076
6085
|
const syncTabsWithModel = useCallback(
|
|
6077
6086
|
(prevTabs) => {
|
|
6078
6087
|
const modelTabNodes = /* @__PURE__ */ new Map();
|
|
@@ -6148,6 +6157,8 @@ function OptimizedLayout({ model, renderTab, classNameMapper, onDragStateChange,
|
|
|
6148
6157
|
);
|
|
6149
6158
|
const handleModelChange = useCallback(
|
|
6150
6159
|
(changedModel, action) => {
|
|
6160
|
+
const newMaximizedId = changedModel.getMaximizedTabset(Model.MAIN_WINDOW_ID)?.getId();
|
|
6161
|
+
setMaximizedTabsetId(newMaximizedId);
|
|
6151
6162
|
setTabs((prevTabs) => {
|
|
6152
6163
|
const synced = syncTabsWithModel(prevTabs);
|
|
6153
6164
|
let hasVisibilityChange = false;
|
|
@@ -6173,7 +6184,7 @@ function OptimizedLayout({ model, renderTab, classNameMapper, onDragStateChange,
|
|
|
6173
6184
|
},
|
|
6174
6185
|
[handleTabMount, handleRectChange, handleVisibilityChange]
|
|
6175
6186
|
);
|
|
6176
|
-
return /* @__PURE__ */ React20.createElement("div", { className: "flexlayout__optimized_layout" }, /* @__PURE__ */ React20.createElement(Layout, { model, factory, classNameMapper, onDragStateChange: handleDragStateChange, onModelChange: handleModelChange, ...layoutProps }), /* @__PURE__ */ React20.createElement(TabContainer, { tabs, renderTab, isDragging, classNameMapper, model }));
|
|
6187
|
+
return /* @__PURE__ */ React20.createElement("div", { className: "flexlayout__optimized_layout" }, /* @__PURE__ */ React20.createElement(Layout, { model, factory, classNameMapper, onDragStateChange: handleDragStateChange, onModelChange: handleModelChange, ...layoutProps }), /* @__PURE__ */ React20.createElement(TabContainer, { tabs, renderTab, isDragging, classNameMapper, model, maximizedTabsetId }));
|
|
6177
6188
|
}
|
|
6178
6189
|
|
|
6179
6190
|
// src/model/walk.ts
|
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.5.
|
|
5
|
+
"version": "0.5.10",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"release:minor": "npm run release:version:minor && npm run release:commit",
|
|
79
79
|
"release:version": "npm version patch -m \"release: v%s\" --no-git-tag-version",
|
|
80
80
|
"release:version:minor": "npm version minor -m \"release: v%s\" --no-git-tag-version",
|
|
81
|
-
"release:commit": "git reset && git add package.json && git commit -s -m \"release: v$
|
|
81
|
+
"release:commit": "git reset && git add package.json && git commit -s -m \"release: v$(node -p \"require('./package.json').version\")\" && git tag v$(node -p \"require('./package.json').version\")",
|
|
82
82
|
"release:publish": "git push && git push --tags && npm run build && npm publish"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|