@alisowski/react-resizable-panels
Advanced tools
Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "@alisowski/react-resizable-panels", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -233,2 +233,3 @@ import { isDevelopment } from "#is-development"; | ||
const collapsed = new Set(); | ||
let numPanelsWithSizes = 0; | ||
@@ -241,3 +242,3 @@ let remainingSize = 100; | ||
const panel = panelsArray[index]; | ||
const { defaultSize } = panel.current; | ||
const { defaultSize, collapsedSize, id } = panel.current; | ||
@@ -253,2 +254,10 @@ if (defaultSize != null) { | ||
remainingSize -= sizes[index]; | ||
if ( | ||
collapsedSize && | ||
sizes[index] === | ||
normalizePixelValue(units, groupSizePixels, collapsedSize) | ||
) { | ||
collapsed.add(id); | ||
} | ||
} | ||
@@ -261,3 +270,3 @@ } | ||
const panel = panelsArray[index]; | ||
let { defaultSize, id, maxSize, minSize } = panel.current; | ||
let { defaultSize, maxSize, minSize, collapsedSize, id } = panel.current; | ||
if (defaultSize != null) { | ||
@@ -283,2 +292,9 @@ continue; | ||
remainingSize -= size; | ||
if ( | ||
collapsedSize && | ||
size === normalizePixelValue(units, groupSizePixels, collapsedSize) | ||
) { | ||
collapsed.add(id); | ||
} | ||
} | ||
@@ -297,3 +313,3 @@ | ||
maxSize = panelsArray.reduce((accumulated, otherPanel) => { | ||
const { minSize, id } = otherPanel.current; | ||
const { minSize, collapsedSize, id } = otherPanel.current; | ||
@@ -304,5 +320,7 @@ if (minSize == null || panel.current.id === id) { | ||
return ( | ||
accumulated - normalizePixelValue(units, groupSizePixels, minSize) | ||
); | ||
const currentSize = collapsed.has(id) | ||
? normalizePixelValue(units, groupSizePixels, collapsedSize) | ||
: normalizePixelValue(units, groupSizePixels, minSize); | ||
return accumulated - currentSize; | ||
}, 100); | ||
@@ -614,2 +632,3 @@ } else { | ||
const collapsed = new Set(); | ||
let remainingSize = 0; | ||
@@ -629,2 +648,8 @@ | ||
); | ||
const collapsedSize = normalizePixelValue( | ||
units, | ||
groupSizePixels, | ||
panel.current.collapsedSize | ||
); | ||
if (nextSize != safeNextSize) { | ||
@@ -640,2 +665,6 @@ remainingSize += nextSize - safeNextSize; | ||
} | ||
if (safeNextSize === collapsedSize) { | ||
collapsed.add(panel.current.id); | ||
} | ||
} | ||
@@ -655,3 +684,3 @@ | ||
maxSize = panelsArray.reduce((accumulated, otherPanel) => { | ||
const { minSize, id } = otherPanel.current; | ||
const { minSize, collapsedSize, id } = otherPanel.current; | ||
@@ -662,5 +691,7 @@ if (minSize == null || panel.current.id === id) { | ||
return ( | ||
accumulated - normalizePixelValue(units, groupSizePixels, minSize) | ||
); | ||
const currentSize = collapsed.has(id) | ||
? normalizePixelValue(units, groupSizePixels, collapsedSize) | ||
: normalizePixelValue(units, groupSizePixels, minSize); | ||
return accumulated - currentSize; | ||
}, 100); | ||
@@ -667,0 +698,0 @@ } else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
809687
22354