@aptre/flex-layout 0.4.0 → 0.4.2
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 +36 -12
- package/dist/test/setup.d.ts +1 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1671,7 +1671,15 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
/** @internal */
|
|
1673
1673
|
setContentRect(rect) {
|
|
1674
|
+
const changed = !this.contentRect.equals(rect);
|
|
1674
1675
|
this.contentRect = rect;
|
|
1676
|
+
if (changed && rect.width > 0 && rect.height > 0) {
|
|
1677
|
+
for (const child of this.children) {
|
|
1678
|
+
if (child instanceof TabNode) {
|
|
1679
|
+
child.setRect(rect);
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1675
1683
|
}
|
|
1676
1684
|
/** @internal */
|
|
1677
1685
|
getContentRect() {
|
|
@@ -3177,7 +3185,15 @@ var BorderNode = class _BorderNode extends Node {
|
|
|
3177
3185
|
}
|
|
3178
3186
|
/** @internal */
|
|
3179
3187
|
setContentRect(r) {
|
|
3188
|
+
const changed = !this.contentRect.equals(r);
|
|
3180
3189
|
this.contentRect = r;
|
|
3190
|
+
if (changed && r.width > 0 && r.height > 0) {
|
|
3191
|
+
for (const child of this.children) {
|
|
3192
|
+
if (child instanceof TabNode) {
|
|
3193
|
+
child.setRect(r);
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3181
3197
|
}
|
|
3182
3198
|
/** @internal */
|
|
3183
3199
|
isEnableDrop() {
|
|
@@ -4499,9 +4515,12 @@ var TabSet = (props) => {
|
|
|
4499
4515
|
node.setTabStripRect(layout.getBoundingClientRect(tabStripRef.current));
|
|
4500
4516
|
}
|
|
4501
4517
|
const newContentRect = Rect.getContentRect(contentRef.current).relativeTo(layout.getDomRect());
|
|
4502
|
-
|
|
4518
|
+
const oldContentRect = node.getContentRect();
|
|
4519
|
+
if (!oldContentRect.equals(newContentRect)) {
|
|
4503
4520
|
node.setContentRect(newContentRect);
|
|
4504
|
-
|
|
4521
|
+
const oldWasEmpty = oldContentRect.width === 0 && oldContentRect.height === 0;
|
|
4522
|
+
const shouldRedraw = !isFirstRender.current || oldWasEmpty;
|
|
4523
|
+
if (shouldRedraw) {
|
|
4505
4524
|
layout.redrawInternal("tabset content rect " + newContentRect);
|
|
4506
4525
|
}
|
|
4507
4526
|
}
|
|
@@ -5922,11 +5941,13 @@ function TabContainer({
|
|
|
5922
5941
|
style: {
|
|
5923
5942
|
position: "absolute",
|
|
5924
5943
|
inset: 0,
|
|
5925
|
-
// CRITICAL:
|
|
5926
|
-
//
|
|
5927
|
-
//
|
|
5928
|
-
|
|
5929
|
-
//
|
|
5944
|
+
// CRITICAL: The container itself always has pointer-events: none
|
|
5945
|
+
// so it doesn't block clicks on elements beneath it (like FlexLayout's tab bar).
|
|
5946
|
+
// Individual tab panels have pointer-events: auto to receive clicks.
|
|
5947
|
+
// During drag, we also disable pointer events on the children to prevent
|
|
5948
|
+
// dragleave events on the Layout element.
|
|
5949
|
+
pointerEvents: "none",
|
|
5950
|
+
// Ensure tab container doesn't block FlexLayout's tab bar interactions
|
|
5930
5951
|
zIndex: 0
|
|
5931
5952
|
},
|
|
5932
5953
|
"data-layout-path": "/tab-container"
|
|
@@ -5934,6 +5955,7 @@ function TabContainer({
|
|
|
5934
5955
|
Array.from(tabs.entries()).map(([nodeId, tabInfo]) => {
|
|
5935
5956
|
const { node, rect, visible } = tabInfo;
|
|
5936
5957
|
const contentClassName = node.getContentClassName();
|
|
5958
|
+
const hasValidDimensions = rect.width > 0 && rect.height > 0;
|
|
5937
5959
|
return /* @__PURE__ */ React20.createElement(
|
|
5938
5960
|
"div",
|
|
5939
5961
|
{
|
|
@@ -5944,11 +5966,13 @@ function TabContainer({
|
|
|
5944
5966
|
style: {
|
|
5945
5967
|
position: "absolute",
|
|
5946
5968
|
display: visible ? "flex" : "none",
|
|
5947
|
-
left: rect.x,
|
|
5948
|
-
top: rect.y,
|
|
5949
|
-
width: rect.width,
|
|
5950
|
-
height: rect.height,
|
|
5951
|
-
overflow: "auto"
|
|
5969
|
+
left: hasValidDimensions ? rect.x : 0,
|
|
5970
|
+
top: hasValidDimensions ? rect.y : 0,
|
|
5971
|
+
width: hasValidDimensions ? rect.width : "100%",
|
|
5972
|
+
height: hasValidDimensions ? rect.height : "100%",
|
|
5973
|
+
overflow: "auto",
|
|
5974
|
+
// Tab panels receive pointer events when visible and not dragging
|
|
5975
|
+
pointerEvents: visible && !isDragging ? "auto" : "none"
|
|
5952
5976
|
}
|
|
5953
5977
|
},
|
|
5954
5978
|
renderTab(node)
|
package/dist/test/setup.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
getItem: (key: string) => string;
|
|
3
|
-
setItem: (key: string, value: string) => void;
|
|
4
|
-
removeItem: (key: string) => void;
|
|
5
|
-
clear: () => void;
|
|
6
|
-
readonly length: number;
|
|
7
|
-
key: (index: number) => string;
|
|
8
|
-
};
|
|
1
|
+
import "../../style/light.css";
|