react-resizable-panels 1.0.3 → 1.0.4
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.md +4 -0
- package/dist/react-resizable-panels.browser.cjs.js +1 -1
- package/dist/react-resizable-panels.browser.development.cjs.js +1 -1
- package/dist/react-resizable-panels.browser.development.esm.js +1 -1
- package/dist/react-resizable-panels.browser.esm.js +1 -1
- package/dist/react-resizable-panels.cjs.js +1 -1
- package/dist/react-resizable-panels.development.cjs.js +1 -1
- package/dist/react-resizable-panels.development.esm.js +1 -1
- package/dist/react-resizable-panels.development.node.cjs.js +1 -1
- package/dist/react-resizable-panels.development.node.esm.js +1 -1
- package/dist/react-resizable-panels.esm.js +1 -1
- package/dist/react-resizable-panels.node.cjs.js +1 -1
- package/dist/react-resizable-panels.node.esm.js +1 -1
- package/package.json +1 -1
- package/src/Panel.test.tsx +12 -0
- package/src/PanelGroup.ts +5 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/Panel.test.tsx
CHANGED
|
@@ -89,13 +89,19 @@ describe("PanelGroup", () => {
|
|
|
89
89
|
assert(mostRecentLayout);
|
|
90
90
|
|
|
91
91
|
verifyExpandedPanelGroupLayout(mostRecentLayout, [50, 50]);
|
|
92
|
+
expect(leftPanelRef.current?.isCollapsed()).toBe(false);
|
|
93
|
+
expect(rightPanelRef.current?.isCollapsed()).toBe(false);
|
|
92
94
|
act(() => {
|
|
93
95
|
leftPanelRef.current?.collapse();
|
|
94
96
|
});
|
|
97
|
+
expect(leftPanelRef.current?.isCollapsed()).toBe(true);
|
|
98
|
+
expect(rightPanelRef.current?.isCollapsed()).toBe(false);
|
|
95
99
|
verifyExpandedPanelGroupLayout(mostRecentLayout, [0, 100]);
|
|
96
100
|
act(() => {
|
|
97
101
|
leftPanelRef.current?.expand();
|
|
98
102
|
});
|
|
103
|
+
expect(leftPanelRef.current?.isCollapsed()).toBe(false);
|
|
104
|
+
expect(rightPanelRef.current?.isCollapsed()).toBe(false);
|
|
99
105
|
verifyExpandedPanelGroupLayout(mostRecentLayout, [50, 50]);
|
|
100
106
|
});
|
|
101
107
|
|
|
@@ -103,14 +109,20 @@ describe("PanelGroup", () => {
|
|
|
103
109
|
assert(mostRecentLayout);
|
|
104
110
|
|
|
105
111
|
verifyExpandedPanelGroupLayout(mostRecentLayout, [50, 50]);
|
|
112
|
+
expect(leftPanelRef.current?.isCollapsed()).toBe(false);
|
|
113
|
+
expect(rightPanelRef.current?.isCollapsed()).toBe(false);
|
|
106
114
|
act(() => {
|
|
107
115
|
rightPanelRef.current?.collapse();
|
|
108
116
|
});
|
|
109
117
|
verifyExpandedPanelGroupLayout(mostRecentLayout, [100, 0]);
|
|
118
|
+
expect(leftPanelRef.current?.isCollapsed()).toBe(false);
|
|
119
|
+
expect(rightPanelRef.current?.isCollapsed()).toBe(true);
|
|
110
120
|
act(() => {
|
|
111
121
|
rightPanelRef.current?.expand();
|
|
112
122
|
});
|
|
113
123
|
verifyExpandedPanelGroupLayout(mostRecentLayout, [50, 50]);
|
|
124
|
+
expect(leftPanelRef.current?.isCollapsed()).toBe(false);
|
|
125
|
+
expect(rightPanelRef.current?.isCollapsed()).toBe(false);
|
|
114
126
|
});
|
|
115
127
|
|
|
116
128
|
it("should re-expand to the most recent size before collapsing", () => {
|
package/src/PanelGroup.ts
CHANGED
|
@@ -454,11 +454,11 @@ function PanelGroupWithForwardedRef({
|
|
|
454
454
|
const isPanelCollapsed = useCallback((panelData: PanelData) => {
|
|
455
455
|
const { layout, panelDataArray } = eagerValuesRef.current;
|
|
456
456
|
|
|
457
|
-
const {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
);
|
|
457
|
+
const {
|
|
458
|
+
collapsedSize = 0,
|
|
459
|
+
collapsible,
|
|
460
|
+
panelSize,
|
|
461
|
+
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
462
462
|
|
|
463
463
|
return collapsible === true && panelSize === collapsedSize;
|
|
464
464
|
}, []);
|