@aptre/flex-layout 0.5.8 → 0.5.9
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 +20 -16
- 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,12 +5988,27 @@ 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]);
|
|
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]);
|
|
5997
6012
|
let isHidden = !visible;
|
|
5998
6013
|
let zIndex;
|
|
5999
6014
|
if (hasMaximizedTabset) {
|
|
@@ -6007,6 +6022,7 @@ var TabPanel = memo2(function TabPanel2({
|
|
|
6007
6022
|
return /* @__PURE__ */ React20.createElement(
|
|
6008
6023
|
"div",
|
|
6009
6024
|
{
|
|
6025
|
+
ref: selfRef,
|
|
6010
6026
|
role: "tabpanel",
|
|
6011
6027
|
"data-tab-id": nodeId,
|
|
6012
6028
|
className: className + (contentClassName ? " " + contentClassName : ""),
|
|
@@ -6021,8 +6037,7 @@ var TabPanel = memo2(function TabPanel2({
|
|
|
6021
6037
|
zIndex,
|
|
6022
6038
|
// Tab panels receive pointer events when visible and not dragging
|
|
6023
6039
|
pointerEvents: !isHidden && !isDragging ? "auto" : "none"
|
|
6024
|
-
}
|
|
6025
|
-
onPointerDown
|
|
6040
|
+
}
|
|
6026
6041
|
},
|
|
6027
6042
|
content
|
|
6028
6043
|
);
|
|
@@ -6037,17 +6052,6 @@ function TabContainer({
|
|
|
6037
6052
|
const className = classNameMapper ? classNameMapper("flexlayout__tab") : "flexlayout__tab";
|
|
6038
6053
|
const maximizedTabset = model.getMaximizedTabset(Model.MAIN_WINDOW_ID);
|
|
6039
6054
|
const hasMaximizedTabset = maximizedTabset !== void 0;
|
|
6040
|
-
const handlePointerDown = useCallback(
|
|
6041
|
-
(node) => {
|
|
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
6055
|
return /* @__PURE__ */ React20.createElement("div", { className: "flexlayout__optimized_layout_tab_container", "data-layout-path": "/tab-container" }, Array.from(tabs.entries()).map(([nodeId, tabInfo]) => {
|
|
6052
6056
|
const parent = tabInfo.node.getParent();
|
|
6053
6057
|
const isMaximized = parent instanceof TabSetNode && parent.isMaximized();
|
|
@@ -6063,7 +6067,7 @@ function TabContainer({
|
|
|
6063
6067
|
contentClassName: tabInfo.node.getContentClassName(),
|
|
6064
6068
|
className,
|
|
6065
6069
|
renderTab,
|
|
6066
|
-
|
|
6070
|
+
model,
|
|
6067
6071
|
isMaximized,
|
|
6068
6072
|
hasMaximizedTabset
|
|
6069
6073
|
}
|
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.9",
|
|
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": {
|