react-resizable-panels 2.0.9 → 2.0.11
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 +8 -0
- package/dist/declarations/src/utils/assert.d.ts +1 -1
- package/dist/react-resizable-panels.browser.cjs.js +55 -57
- package/dist/react-resizable-panels.browser.development.cjs.js +57 -59
- package/dist/react-resizable-panels.browser.development.esm.js +57 -59
- package/dist/react-resizable-panels.browser.esm.js +55 -57
- package/dist/react-resizable-panels.cjs.js +55 -57
- package/dist/react-resizable-panels.development.cjs.js +57 -59
- package/dist/react-resizable-panels.development.esm.js +57 -59
- package/dist/react-resizable-panels.development.node.cjs.js +53 -55
- package/dist/react-resizable-panels.development.node.esm.js +53 -55
- package/dist/react-resizable-panels.esm.js +55 -57
- package/dist/react-resizable-panels.node.cjs.js +51 -53
- package/dist/react-resizable-panels.node.esm.js +51 -53
- package/package.json +1 -1
- package/src/Panel.test.tsx +23 -23
- package/src/PanelGroup.test.tsx +32 -3
- package/src/PanelGroup.ts +25 -7
- package/src/PanelResizeHandle.test.tsx +3 -3
- package/src/PanelResizeHandle.ts +1 -1
- package/src/hooks/useWindowSplitterBehavior.ts +5 -2
- package/src/hooks/useWindowSplitterPanelGroupBehavior.ts +5 -5
- package/src/utils/adjustLayoutByDelta.ts +47 -20
- package/src/utils/assert.ts +1 -1
- package/src/utils/calculateAriaValues.ts +1 -1
- package/src/utils/calculateDragOffsetPercentage.ts +6 -3
- package/src/utils/calculateUnsafeDefaultLayout.ts +2 -2
- package/src/utils/callPanelCallbacks.ts +1 -1
- package/src/utils/events/getResizeEventCoordinates.ts +5 -5
- package/src/utils/resizePanel.ts +4 -1
- package/src/utils/test-utils.ts +1 -1
- package/src/utils/validatePanelConstraints.ts +4 -1
- package/src/utils/validatePanelGroupLayout.ts +3 -3
- package/src/vendor/stacking-order.ts +5 -2
|
@@ -260,15 +260,15 @@ function isTouchEvent(event) {
|
|
|
260
260
|
function getResizeEventCoordinates(event) {
|
|
261
261
|
if (isMouseEvent(event)) {
|
|
262
262
|
return {
|
|
263
|
-
x: event.
|
|
264
|
-
y: event.
|
|
263
|
+
x: event.clientX,
|
|
264
|
+
y: event.clientY
|
|
265
265
|
};
|
|
266
266
|
} else if (isTouchEvent(event)) {
|
|
267
267
|
const touch = event.touches[0];
|
|
268
|
-
if (touch && touch.
|
|
268
|
+
if (touch && touch.clientX && touch.clientY) {
|
|
269
269
|
return {
|
|
270
|
-
x: touch.
|
|
271
|
-
y: touch.
|
|
270
|
+
x: touch.clientX,
|
|
271
|
+
y: touch.clientY
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -314,7 +314,7 @@ function compare(a, b) {
|
|
|
314
314
|
b = ancestors.b.pop();
|
|
315
315
|
common_ancestor = a;
|
|
316
316
|
}
|
|
317
|
-
assert(common_ancestor);
|
|
317
|
+
assert(common_ancestor, "Stacking order can only be calculated for elements with a common ancestor");
|
|
318
318
|
const z_indexes = {
|
|
319
319
|
a: get_z_index(find_stacking_context(ancestors.a)),
|
|
320
320
|
b: get_z_index(find_stacking_context(ancestors.b))
|
|
@@ -372,7 +372,7 @@ function find_stacking_context(nodes) {
|
|
|
372
372
|
let i = nodes.length;
|
|
373
373
|
while (i--) {
|
|
374
374
|
const node = nodes[i];
|
|
375
|
-
assert(node);
|
|
375
|
+
assert(node, "Missing node");
|
|
376
376
|
if (creates_stacking_context(node)) return node;
|
|
377
377
|
}
|
|
378
378
|
return null;
|
|
@@ -659,7 +659,7 @@ function updateResizeHandlerStates(action, event) {
|
|
|
659
659
|
});
|
|
660
660
|
}
|
|
661
661
|
|
|
662
|
-
function assert(expectedCondition, message
|
|
662
|
+
function assert(expectedCondition, message) {
|
|
663
663
|
if (!expectedCondition) {
|
|
664
664
|
console.error(message);
|
|
665
665
|
throw Error(message);
|
|
@@ -690,7 +690,7 @@ function resizePanel({
|
|
|
690
690
|
size
|
|
691
691
|
}) {
|
|
692
692
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
693
|
-
assert(panelConstraints != null);
|
|
693
|
+
assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
694
694
|
let {
|
|
695
695
|
collapsedSize = 0,
|
|
696
696
|
collapsible,
|
|
@@ -728,8 +728,8 @@ function adjustLayoutByDelta({
|
|
|
728
728
|
}
|
|
729
729
|
const nextLayout = [...prevLayout];
|
|
730
730
|
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
731
|
-
assert(firstPivotIndex != null);
|
|
732
|
-
assert(secondPivotIndex != null);
|
|
731
|
+
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
732
|
+
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
733
733
|
let deltaApplied = 0;
|
|
734
734
|
|
|
735
735
|
//const DEBUG = [];
|
|
@@ -755,19 +755,18 @@ function adjustLayoutByDelta({
|
|
|
755
755
|
// Check if we should expand a collapsed panel
|
|
756
756
|
const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
757
757
|
const panelConstraints = panelConstraintsArray[index];
|
|
758
|
-
assert(panelConstraints);
|
|
758
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
759
|
+
const {
|
|
760
|
+
collapsedSize = 0,
|
|
761
|
+
collapsible,
|
|
762
|
+
minSize = 0
|
|
763
|
+
} = panelConstraints;
|
|
759
764
|
|
|
760
765
|
//DEBUG.push(`edge case check 1: ${index}`);
|
|
761
766
|
//DEBUG.push(` -> collapsible? ${constraints.collapsible}`);
|
|
762
|
-
if (
|
|
767
|
+
if (collapsible) {
|
|
763
768
|
const prevSize = prevLayout[index];
|
|
764
|
-
assert(prevSize != null);
|
|
765
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
766
|
-
assert(panelConstraints);
|
|
767
|
-
const {
|
|
768
|
-
collapsedSize = 0,
|
|
769
|
-
minSize = 0
|
|
770
|
-
} = panelConstraints;
|
|
769
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
771
770
|
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
772
771
|
const localDelta = minSize - prevSize;
|
|
773
772
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -784,22 +783,18 @@ function adjustLayoutByDelta({
|
|
|
784
783
|
// Check if we should collapse a panel at its minimum size
|
|
785
784
|
const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
786
785
|
const panelConstraints = panelConstraintsArray[index];
|
|
787
|
-
assert(panelConstraints);
|
|
786
|
+
assert(panelConstraints, `No panel constraints found for index ${index}`);
|
|
788
787
|
const {
|
|
789
|
-
|
|
788
|
+
collapsedSize = 0,
|
|
789
|
+
collapsible,
|
|
790
|
+
minSize = 0
|
|
790
791
|
} = panelConstraints;
|
|
791
792
|
|
|
792
793
|
//DEBUG.push(`edge case check 2: ${index}`);
|
|
793
794
|
//DEBUG.push(` -> collapsible? ${collapsible}`);
|
|
794
795
|
if (collapsible) {
|
|
795
796
|
const prevSize = prevLayout[index];
|
|
796
|
-
assert(prevSize != null);
|
|
797
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
798
|
-
assert(panelConstraints);
|
|
799
|
-
const {
|
|
800
|
-
collapsedSize = 0,
|
|
801
|
-
minSize = 0
|
|
802
|
-
} = panelConstraints;
|
|
797
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
803
798
|
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
804
799
|
const localDelta = prevSize - collapsedSize;
|
|
805
800
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -829,7 +824,7 @@ function adjustLayoutByDelta({
|
|
|
829
824
|
//DEBUG.push("pre calc...");
|
|
830
825
|
while (true) {
|
|
831
826
|
const prevSize = prevLayout[index];
|
|
832
|
-
assert(prevSize != null);
|
|
827
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
833
828
|
const maxSafeSize = resizePanel({
|
|
834
829
|
panelConstraints: panelConstraintsArray,
|
|
835
830
|
panelIndex: index,
|
|
@@ -860,7 +855,7 @@ function adjustLayoutByDelta({
|
|
|
860
855
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
861
856
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
862
857
|
const prevSize = prevLayout[index];
|
|
863
|
-
assert(prevSize != null);
|
|
858
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
864
859
|
const unsafeSize = prevSize - deltaRemaining;
|
|
865
860
|
const safeSize = resizePanel({
|
|
866
861
|
panelConstraints: panelConstraintsArray,
|
|
@@ -897,7 +892,7 @@ function adjustLayoutByDelta({
|
|
|
897
892
|
// Now distribute the applied delta to the panels in the other direction
|
|
898
893
|
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
899
894
|
const prevSize = prevLayout[pivotIndex];
|
|
900
|
-
assert(prevSize != null);
|
|
895
|
+
assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
901
896
|
const unsafeSize = prevSize + deltaApplied;
|
|
902
897
|
const safeSize = resizePanel({
|
|
903
898
|
panelConstraints: panelConstraintsArray,
|
|
@@ -915,7 +910,7 @@ function adjustLayoutByDelta({
|
|
|
915
910
|
let index = pivotIndex;
|
|
916
911
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
917
912
|
const prevSize = nextLayout[index];
|
|
918
|
-
assert(prevSize != null);
|
|
913
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
919
914
|
const unsafeSize = prevSize + deltaRemaining;
|
|
920
915
|
const safeSize = resizePanel({
|
|
921
916
|
panelConstraints: panelConstraintsArray,
|
|
@@ -961,7 +956,7 @@ function calculateAriaValues({
|
|
|
961
956
|
let totalMinSize = 0;
|
|
962
957
|
let totalMaxSize = 0;
|
|
963
958
|
const firstIndex = pivotIndices[0];
|
|
964
|
-
assert(firstIndex != null);
|
|
959
|
+
assert(firstIndex != null, "No pivot index found");
|
|
965
960
|
|
|
966
961
|
// A panel's effective min/max sizes also need to account for other panel's sizes.
|
|
967
962
|
panelsArray.forEach((panelData, index) => {
|
|
@@ -1080,7 +1075,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1080
1075
|
}
|
|
1081
1076
|
} else {
|
|
1082
1077
|
const panelData = panelDataArray[index];
|
|
1083
|
-
assert(panelData);
|
|
1078
|
+
assert(panelData, `No panel data found for index "${index}"`);
|
|
1084
1079
|
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
1085
1080
|
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
1086
1081
|
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
@@ -1101,17 +1096,17 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1101
1096
|
return;
|
|
1102
1097
|
}
|
|
1103
1098
|
const eagerValues = eagerValuesRef.current;
|
|
1104
|
-
assert(eagerValues);
|
|
1099
|
+
assert(eagerValues, `Eager values not found`);
|
|
1105
1100
|
const {
|
|
1106
1101
|
panelDataArray
|
|
1107
1102
|
} = eagerValues;
|
|
1108
1103
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1109
1104
|
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
1110
1105
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1111
|
-
assert(handles);
|
|
1106
|
+
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
1112
1107
|
const cleanupFunctions = handles.map(handle => {
|
|
1113
1108
|
const handleId = handle.getAttribute("data-panel-resize-handle-id");
|
|
1114
|
-
assert(handleId);
|
|
1109
|
+
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
1115
1110
|
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
1116
1111
|
if (idBefore == null || idAfter == null) {
|
|
1117
1112
|
return () => {};
|
|
@@ -1127,7 +1122,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1127
1122
|
const index = panelDataArray.findIndex(panelData => panelData.id === idBefore);
|
|
1128
1123
|
if (index >= 0) {
|
|
1129
1124
|
const panelData = panelDataArray[index];
|
|
1130
|
-
assert(panelData);
|
|
1125
|
+
assert(panelData, `No panel data found for index ${index}`);
|
|
1131
1126
|
const size = layout[index];
|
|
1132
1127
|
const {
|
|
1133
1128
|
collapsedSize = 0,
|
|
@@ -1186,15 +1181,15 @@ function getResizeEventCursorPosition(direction, event) {
|
|
|
1186
1181
|
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
1187
1182
|
const isHorizontal = direction === "horizontal";
|
|
1188
1183
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
1189
|
-
assert(handleElement);
|
|
1184
|
+
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
1190
1185
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
1191
|
-
assert(groupId);
|
|
1186
|
+
assert(groupId, `Resize handle element has no group id attribute`);
|
|
1192
1187
|
let {
|
|
1193
1188
|
initialCursorPosition
|
|
1194
1189
|
} = initialDragState;
|
|
1195
1190
|
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1196
1191
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1197
|
-
assert(groupElement);
|
|
1192
|
+
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
1198
1193
|
const groupRect = groupElement.getBoundingClientRect();
|
|
1199
1194
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
1200
1195
|
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
@@ -1255,7 +1250,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1255
1250
|
// Distribute default sizes first
|
|
1256
1251
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1257
1252
|
const panelConstraints = panelConstraintsArray[index];
|
|
1258
|
-
assert(panelConstraints);
|
|
1253
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1259
1254
|
const {
|
|
1260
1255
|
defaultSize
|
|
1261
1256
|
} = panelConstraints;
|
|
@@ -1269,7 +1264,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1269
1264
|
// Remaining size should be distributed evenly between panels without default sizes
|
|
1270
1265
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1271
1266
|
const panelConstraints = panelConstraintsArray[index];
|
|
1272
|
-
assert(panelConstraints);
|
|
1267
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1273
1268
|
const {
|
|
1274
1269
|
defaultSize
|
|
1275
1270
|
} = panelConstraints;
|
|
@@ -1289,7 +1284,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1289
1284
|
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
1290
1285
|
layout.forEach((size, index) => {
|
|
1291
1286
|
const panelData = panelsArray[index];
|
|
1292
|
-
assert(panelData);
|
|
1287
|
+
assert(panelData, `Panel data not found for index ${index}`);
|
|
1293
1288
|
const {
|
|
1294
1289
|
callbacks,
|
|
1295
1290
|
constraints,
|
|
@@ -1473,7 +1468,7 @@ function validatePanelConstraints({
|
|
|
1473
1468
|
{
|
|
1474
1469
|
const warnings = [];
|
|
1475
1470
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
1476
|
-
assert(panelConstraints);
|
|
1471
|
+
assert(panelConstraints, `No panel constraints found for index ${panelIndex}`);
|
|
1477
1472
|
const {
|
|
1478
1473
|
collapsedSize = 0,
|
|
1479
1474
|
collapsible = false,
|
|
@@ -1527,7 +1522,7 @@ function validatePanelGroupLayout({
|
|
|
1527
1522
|
}
|
|
1528
1523
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1529
1524
|
const unsafeSize = nextLayout[index];
|
|
1530
|
-
assert(unsafeSize != null);
|
|
1525
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1531
1526
|
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
1532
1527
|
nextLayout[index] = safeSize;
|
|
1533
1528
|
}
|
|
@@ -1537,7 +1532,7 @@ function validatePanelGroupLayout({
|
|
|
1537
1532
|
// First pass: Validate the proposed layout given each panel's constraints
|
|
1538
1533
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1539
1534
|
const unsafeSize = nextLayout[index];
|
|
1540
|
-
assert(unsafeSize != null);
|
|
1535
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1541
1536
|
const safeSize = resizePanel({
|
|
1542
1537
|
panelConstraints,
|
|
1543
1538
|
panelIndex: index,
|
|
@@ -1554,7 +1549,7 @@ function validatePanelGroupLayout({
|
|
|
1554
1549
|
if (!fuzzyNumbersEqual(remainingSize, 0)) {
|
|
1555
1550
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1556
1551
|
const prevSize = nextLayout[index];
|
|
1557
|
-
assert(prevSize != null);
|
|
1552
|
+
assert(prevSize != null, `No layout data found for index ${index}`);
|
|
1558
1553
|
const unsafeSize = prevSize + remainingSize;
|
|
1559
1554
|
const safeSize = resizePanel({
|
|
1560
1555
|
panelConstraints,
|
|
@@ -1731,7 +1726,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1731
1726
|
const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
|
|
1732
1727
|
for (let panelIndex = 0; panelIndex < panelConstraints.length; panelIndex++) {
|
|
1733
1728
|
const panelData = panelDataArray[panelIndex];
|
|
1734
|
-
assert(panelData);
|
|
1729
|
+
assert(panelData, `Panel data not found for index ${panelIndex}`);
|
|
1735
1730
|
const isValid = validatePanelConstraints({
|
|
1736
1731
|
panelConstraints,
|
|
1737
1732
|
panelId: panelData.id,
|
|
@@ -1762,7 +1757,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1762
1757
|
panelSize,
|
|
1763
1758
|
pivotIndices
|
|
1764
1759
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1765
|
-
assert(panelSize != null);
|
|
1760
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1766
1761
|
if (panelSize !== collapsedSize) {
|
|
1767
1762
|
// Store size before collapse;
|
|
1768
1763
|
// This is the size that gets restored if the expand() API is used.
|
|
@@ -1839,7 +1834,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1839
1834
|
const {
|
|
1840
1835
|
panelSize
|
|
1841
1836
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1842
|
-
assert(panelSize != null);
|
|
1837
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1843
1838
|
return panelSize;
|
|
1844
1839
|
}, []);
|
|
1845
1840
|
|
|
@@ -1883,7 +1878,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1883
1878
|
collapsible,
|
|
1884
1879
|
panelSize
|
|
1885
1880
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1886
|
-
assert(panelSize != null);
|
|
1881
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1887
1882
|
return !collapsible || panelSize > collapsedSize;
|
|
1888
1883
|
}, []);
|
|
1889
1884
|
const registerPanel = useCallback(panelData => {
|
|
@@ -2050,7 +2045,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2050
2045
|
panelSize,
|
|
2051
2046
|
pivotIndices
|
|
2052
2047
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
2053
|
-
assert(panelSize != null);
|
|
2048
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
2054
2049
|
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
2055
2050
|
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
2056
2051
|
const nextLayout = adjustLayoutByDelta({
|
|
@@ -2087,7 +2082,10 @@ function PanelGroupWithForwardedRef({
|
|
|
2087
2082
|
const {
|
|
2088
2083
|
panelSize: prevPanelSize
|
|
2089
2084
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
2090
|
-
|
|
2085
|
+
if (prevPanelSize == null) {
|
|
2086
|
+
// It's possible that the panels in this group have changed since the last render
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
2091
2089
|
if (prevCollapsible && nextCollapsible && prevPanelSize === prevCollapsedSize) {
|
|
2092
2090
|
if (prevCollapsedSize !== nextCollapsedSize) {
|
|
2093
2091
|
resizePanel(panelData, nextCollapsedSize);
|
|
@@ -2109,7 +2107,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2109
2107
|
return;
|
|
2110
2108
|
}
|
|
2111
2109
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
2112
|
-
assert(handleElement);
|
|
2110
|
+
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
2113
2111
|
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
2114
2112
|
setDragState({
|
|
2115
2113
|
dragHandleId,
|
|
@@ -2238,10 +2236,10 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
2238
2236
|
{
|
|
2239
2237
|
event.preventDefault();
|
|
2240
2238
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
2241
|
-
assert(groupId);
|
|
2239
|
+
assert(groupId, `No group element found for id "${groupId}"`);
|
|
2242
2240
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
2243
2241
|
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
2244
|
-
assert(index !== null);
|
|
2242
|
+
assert(index !== null, `No resize element found for id "${handleId}"`);
|
|
2245
2243
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
2246
2244
|
const nextHandle = handles[nextIndex];
|
|
2247
2245
|
nextHandle.focus();
|
|
@@ -2313,7 +2311,7 @@ function PanelResizeHandle({
|
|
|
2313
2311
|
return;
|
|
2314
2312
|
}
|
|
2315
2313
|
const element = elementRef.current;
|
|
2316
|
-
assert(element);
|
|
2314
|
+
assert(element, "Element ref not attached");
|
|
2317
2315
|
const setResizeHandlerState = (action, isActive, event) => {
|
|
2318
2316
|
if (isActive) {
|
|
2319
2317
|
switch (action) {
|