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
|
@@ -253,15 +253,15 @@ function isTouchEvent(event) {
|
|
|
253
253
|
function getResizeEventCoordinates(event) {
|
|
254
254
|
if (isMouseEvent(event)) {
|
|
255
255
|
return {
|
|
256
|
-
x: event.
|
|
257
|
-
y: event.
|
|
256
|
+
x: event.clientX,
|
|
257
|
+
y: event.clientY
|
|
258
258
|
};
|
|
259
259
|
} else if (isTouchEvent(event)) {
|
|
260
260
|
const touch = event.touches[0];
|
|
261
|
-
if (touch && touch.
|
|
261
|
+
if (touch && touch.clientX && touch.clientY) {
|
|
262
262
|
return {
|
|
263
|
-
x: touch.
|
|
264
|
-
y: touch.
|
|
263
|
+
x: touch.clientX,
|
|
264
|
+
y: touch.clientY
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -307,7 +307,7 @@ function compare(a, b) {
|
|
|
307
307
|
b = ancestors.b.pop();
|
|
308
308
|
common_ancestor = a;
|
|
309
309
|
}
|
|
310
|
-
assert(common_ancestor);
|
|
310
|
+
assert(common_ancestor, "Stacking order can only be calculated for elements with a common ancestor");
|
|
311
311
|
const z_indexes = {
|
|
312
312
|
a: get_z_index(find_stacking_context(ancestors.a)),
|
|
313
313
|
b: get_z_index(find_stacking_context(ancestors.b))
|
|
@@ -365,7 +365,7 @@ function find_stacking_context(nodes) {
|
|
|
365
365
|
let i = nodes.length;
|
|
366
366
|
while (i--) {
|
|
367
367
|
const node = nodes[i];
|
|
368
|
-
assert(node);
|
|
368
|
+
assert(node, "Missing node");
|
|
369
369
|
if (creates_stacking_context(node)) return node;
|
|
370
370
|
}
|
|
371
371
|
return null;
|
|
@@ -652,7 +652,7 @@ function updateResizeHandlerStates(action, event) {
|
|
|
652
652
|
});
|
|
653
653
|
}
|
|
654
654
|
|
|
655
|
-
function assert(expectedCondition, message
|
|
655
|
+
function assert(expectedCondition, message) {
|
|
656
656
|
if (!expectedCondition) {
|
|
657
657
|
console.error(message);
|
|
658
658
|
throw Error(message);
|
|
@@ -683,7 +683,7 @@ function resizePanel({
|
|
|
683
683
|
size
|
|
684
684
|
}) {
|
|
685
685
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
686
|
-
assert(panelConstraints != null);
|
|
686
|
+
assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
687
687
|
let {
|
|
688
688
|
collapsedSize = 0,
|
|
689
689
|
collapsible,
|
|
@@ -721,8 +721,8 @@ function adjustLayoutByDelta({
|
|
|
721
721
|
}
|
|
722
722
|
const nextLayout = [...prevLayout];
|
|
723
723
|
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
724
|
-
assert(firstPivotIndex != null);
|
|
725
|
-
assert(secondPivotIndex != null);
|
|
724
|
+
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
725
|
+
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
726
726
|
let deltaApplied = 0;
|
|
727
727
|
|
|
728
728
|
//const DEBUG = [];
|
|
@@ -748,19 +748,18 @@ function adjustLayoutByDelta({
|
|
|
748
748
|
// Check if we should expand a collapsed panel
|
|
749
749
|
const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
750
750
|
const panelConstraints = panelConstraintsArray[index];
|
|
751
|
-
assert(panelConstraints);
|
|
751
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
752
|
+
const {
|
|
753
|
+
collapsedSize = 0,
|
|
754
|
+
collapsible,
|
|
755
|
+
minSize = 0
|
|
756
|
+
} = panelConstraints;
|
|
752
757
|
|
|
753
758
|
//DEBUG.push(`edge case check 1: ${index}`);
|
|
754
759
|
//DEBUG.push(` -> collapsible? ${constraints.collapsible}`);
|
|
755
|
-
if (
|
|
760
|
+
if (collapsible) {
|
|
756
761
|
const prevSize = prevLayout[index];
|
|
757
|
-
assert(prevSize != null);
|
|
758
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
759
|
-
assert(panelConstraints);
|
|
760
|
-
const {
|
|
761
|
-
collapsedSize = 0,
|
|
762
|
-
minSize = 0
|
|
763
|
-
} = panelConstraints;
|
|
762
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
764
763
|
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
765
764
|
const localDelta = minSize - prevSize;
|
|
766
765
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -777,22 +776,18 @@ function adjustLayoutByDelta({
|
|
|
777
776
|
// Check if we should collapse a panel at its minimum size
|
|
778
777
|
const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
779
778
|
const panelConstraints = panelConstraintsArray[index];
|
|
780
|
-
assert(panelConstraints);
|
|
779
|
+
assert(panelConstraints, `No panel constraints found for index ${index}`);
|
|
781
780
|
const {
|
|
782
|
-
|
|
781
|
+
collapsedSize = 0,
|
|
782
|
+
collapsible,
|
|
783
|
+
minSize = 0
|
|
783
784
|
} = panelConstraints;
|
|
784
785
|
|
|
785
786
|
//DEBUG.push(`edge case check 2: ${index}`);
|
|
786
787
|
//DEBUG.push(` -> collapsible? ${collapsible}`);
|
|
787
788
|
if (collapsible) {
|
|
788
789
|
const prevSize = prevLayout[index];
|
|
789
|
-
assert(prevSize != null);
|
|
790
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
791
|
-
assert(panelConstraints);
|
|
792
|
-
const {
|
|
793
|
-
collapsedSize = 0,
|
|
794
|
-
minSize = 0
|
|
795
|
-
} = panelConstraints;
|
|
790
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
796
791
|
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
797
792
|
const localDelta = prevSize - collapsedSize;
|
|
798
793
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -822,7 +817,7 @@ function adjustLayoutByDelta({
|
|
|
822
817
|
//DEBUG.push("pre calc...");
|
|
823
818
|
while (true) {
|
|
824
819
|
const prevSize = prevLayout[index];
|
|
825
|
-
assert(prevSize != null);
|
|
820
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
826
821
|
const maxSafeSize = resizePanel({
|
|
827
822
|
panelConstraints: panelConstraintsArray,
|
|
828
823
|
panelIndex: index,
|
|
@@ -853,7 +848,7 @@ function adjustLayoutByDelta({
|
|
|
853
848
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
854
849
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
855
850
|
const prevSize = prevLayout[index];
|
|
856
|
-
assert(prevSize != null);
|
|
851
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
857
852
|
const unsafeSize = prevSize - deltaRemaining;
|
|
858
853
|
const safeSize = resizePanel({
|
|
859
854
|
panelConstraints: panelConstraintsArray,
|
|
@@ -890,7 +885,7 @@ function adjustLayoutByDelta({
|
|
|
890
885
|
// Now distribute the applied delta to the panels in the other direction
|
|
891
886
|
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
892
887
|
const prevSize = prevLayout[pivotIndex];
|
|
893
|
-
assert(prevSize != null);
|
|
888
|
+
assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
894
889
|
const unsafeSize = prevSize + deltaApplied;
|
|
895
890
|
const safeSize = resizePanel({
|
|
896
891
|
panelConstraints: panelConstraintsArray,
|
|
@@ -908,7 +903,7 @@ function adjustLayoutByDelta({
|
|
|
908
903
|
let index = pivotIndex;
|
|
909
904
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
910
905
|
const prevSize = nextLayout[index];
|
|
911
|
-
assert(prevSize != null);
|
|
906
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
912
907
|
const unsafeSize = prevSize + deltaRemaining;
|
|
913
908
|
const safeSize = resizePanel({
|
|
914
909
|
panelConstraints: panelConstraintsArray,
|
|
@@ -954,7 +949,7 @@ function calculateAriaValues({
|
|
|
954
949
|
let totalMinSize = 0;
|
|
955
950
|
let totalMaxSize = 0;
|
|
956
951
|
const firstIndex = pivotIndices[0];
|
|
957
|
-
assert(firstIndex != null);
|
|
952
|
+
assert(firstIndex != null, "No pivot index found");
|
|
958
953
|
|
|
959
954
|
// A panel's effective min/max sizes also need to account for other panel's sizes.
|
|
960
955
|
panelsArray.forEach((panelData, index) => {
|
|
@@ -1073,7 +1068,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1073
1068
|
}
|
|
1074
1069
|
} else {
|
|
1075
1070
|
const panelData = panelDataArray[index];
|
|
1076
|
-
assert(panelData);
|
|
1071
|
+
assert(panelData, `No panel data found for index "${index}"`);
|
|
1077
1072
|
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
1078
1073
|
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
1079
1074
|
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
@@ -1094,17 +1089,17 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1094
1089
|
return;
|
|
1095
1090
|
}
|
|
1096
1091
|
const eagerValues = eagerValuesRef.current;
|
|
1097
|
-
assert(eagerValues);
|
|
1092
|
+
assert(eagerValues, `Eager values not found`);
|
|
1098
1093
|
const {
|
|
1099
1094
|
panelDataArray
|
|
1100
1095
|
} = eagerValues;
|
|
1101
1096
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1102
1097
|
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
1103
1098
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1104
|
-
assert(handles);
|
|
1099
|
+
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
1105
1100
|
const cleanupFunctions = handles.map(handle => {
|
|
1106
1101
|
const handleId = handle.getAttribute("data-panel-resize-handle-id");
|
|
1107
|
-
assert(handleId);
|
|
1102
|
+
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
1108
1103
|
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
1109
1104
|
if (idBefore == null || idAfter == null) {
|
|
1110
1105
|
return () => {};
|
|
@@ -1120,7 +1115,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1120
1115
|
const index = panelDataArray.findIndex(panelData => panelData.id === idBefore);
|
|
1121
1116
|
if (index >= 0) {
|
|
1122
1117
|
const panelData = panelDataArray[index];
|
|
1123
|
-
assert(panelData);
|
|
1118
|
+
assert(panelData, `No panel data found for index ${index}`);
|
|
1124
1119
|
const size = layout[index];
|
|
1125
1120
|
const {
|
|
1126
1121
|
collapsedSize = 0,
|
|
@@ -1179,15 +1174,15 @@ function getResizeEventCursorPosition(direction, event) {
|
|
|
1179
1174
|
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
1180
1175
|
const isHorizontal = direction === "horizontal";
|
|
1181
1176
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
1182
|
-
assert(handleElement);
|
|
1177
|
+
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
1183
1178
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
1184
|
-
assert(groupId);
|
|
1179
|
+
assert(groupId, `Resize handle element has no group id attribute`);
|
|
1185
1180
|
let {
|
|
1186
1181
|
initialCursorPosition
|
|
1187
1182
|
} = initialDragState;
|
|
1188
1183
|
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1189
1184
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1190
|
-
assert(groupElement);
|
|
1185
|
+
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
1191
1186
|
const groupRect = groupElement.getBoundingClientRect();
|
|
1192
1187
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
1193
1188
|
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
@@ -1248,7 +1243,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1248
1243
|
// Distribute default sizes first
|
|
1249
1244
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1250
1245
|
const panelConstraints = panelConstraintsArray[index];
|
|
1251
|
-
assert(panelConstraints);
|
|
1246
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1252
1247
|
const {
|
|
1253
1248
|
defaultSize
|
|
1254
1249
|
} = panelConstraints;
|
|
@@ -1262,7 +1257,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1262
1257
|
// Remaining size should be distributed evenly between panels without default sizes
|
|
1263
1258
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1264
1259
|
const panelConstraints = panelConstraintsArray[index];
|
|
1265
|
-
assert(panelConstraints);
|
|
1260
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1266
1261
|
const {
|
|
1267
1262
|
defaultSize
|
|
1268
1263
|
} = panelConstraints;
|
|
@@ -1282,7 +1277,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1282
1277
|
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
1283
1278
|
layout.forEach((size, index) => {
|
|
1284
1279
|
const panelData = panelsArray[index];
|
|
1285
|
-
assert(panelData);
|
|
1280
|
+
assert(panelData, `Panel data not found for index ${index}`);
|
|
1286
1281
|
const {
|
|
1287
1282
|
callbacks,
|
|
1288
1283
|
constraints,
|
|
@@ -1466,7 +1461,7 @@ function validatePanelConstraints({
|
|
|
1466
1461
|
{
|
|
1467
1462
|
const warnings = [];
|
|
1468
1463
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
1469
|
-
assert(panelConstraints);
|
|
1464
|
+
assert(panelConstraints, `No panel constraints found for index ${panelIndex}`);
|
|
1470
1465
|
const {
|
|
1471
1466
|
collapsedSize = 0,
|
|
1472
1467
|
collapsible = false,
|
|
@@ -1520,7 +1515,7 @@ function validatePanelGroupLayout({
|
|
|
1520
1515
|
}
|
|
1521
1516
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1522
1517
|
const unsafeSize = nextLayout[index];
|
|
1523
|
-
assert(unsafeSize != null);
|
|
1518
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1524
1519
|
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
1525
1520
|
nextLayout[index] = safeSize;
|
|
1526
1521
|
}
|
|
@@ -1530,7 +1525,7 @@ function validatePanelGroupLayout({
|
|
|
1530
1525
|
// First pass: Validate the proposed layout given each panel's constraints
|
|
1531
1526
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1532
1527
|
const unsafeSize = nextLayout[index];
|
|
1533
|
-
assert(unsafeSize != null);
|
|
1528
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1534
1529
|
const safeSize = resizePanel({
|
|
1535
1530
|
panelConstraints,
|
|
1536
1531
|
panelIndex: index,
|
|
@@ -1547,7 +1542,7 @@ function validatePanelGroupLayout({
|
|
|
1547
1542
|
if (!fuzzyNumbersEqual(remainingSize, 0)) {
|
|
1548
1543
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1549
1544
|
const prevSize = nextLayout[index];
|
|
1550
|
-
assert(prevSize != null);
|
|
1545
|
+
assert(prevSize != null, `No layout data found for index ${index}`);
|
|
1551
1546
|
const unsafeSize = prevSize + remainingSize;
|
|
1552
1547
|
const safeSize = resizePanel({
|
|
1553
1548
|
panelConstraints,
|
|
@@ -1724,7 +1719,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1724
1719
|
const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
|
|
1725
1720
|
for (let panelIndex = 0; panelIndex < panelConstraints.length; panelIndex++) {
|
|
1726
1721
|
const panelData = panelDataArray[panelIndex];
|
|
1727
|
-
assert(panelData);
|
|
1722
|
+
assert(panelData, `Panel data not found for index ${panelIndex}`);
|
|
1728
1723
|
const isValid = validatePanelConstraints({
|
|
1729
1724
|
panelConstraints,
|
|
1730
1725
|
panelId: panelData.id,
|
|
@@ -1755,7 +1750,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1755
1750
|
panelSize,
|
|
1756
1751
|
pivotIndices
|
|
1757
1752
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1758
|
-
assert(panelSize != null);
|
|
1753
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1759
1754
|
if (panelSize !== collapsedSize) {
|
|
1760
1755
|
// Store size before collapse;
|
|
1761
1756
|
// This is the size that gets restored if the expand() API is used.
|
|
@@ -1832,7 +1827,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1832
1827
|
const {
|
|
1833
1828
|
panelSize
|
|
1834
1829
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1835
|
-
assert(panelSize != null);
|
|
1830
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1836
1831
|
return panelSize;
|
|
1837
1832
|
}, []);
|
|
1838
1833
|
|
|
@@ -1876,7 +1871,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1876
1871
|
collapsible,
|
|
1877
1872
|
panelSize
|
|
1878
1873
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1879
|
-
assert(panelSize != null);
|
|
1874
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1880
1875
|
return !collapsible || panelSize > collapsedSize;
|
|
1881
1876
|
}, []);
|
|
1882
1877
|
const registerPanel = useCallback(panelData => {
|
|
@@ -2043,7 +2038,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2043
2038
|
panelSize,
|
|
2044
2039
|
pivotIndices
|
|
2045
2040
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
2046
|
-
assert(panelSize != null);
|
|
2041
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
2047
2042
|
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
2048
2043
|
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
2049
2044
|
const nextLayout = adjustLayoutByDelta({
|
|
@@ -2080,7 +2075,10 @@ function PanelGroupWithForwardedRef({
|
|
|
2080
2075
|
const {
|
|
2081
2076
|
panelSize: prevPanelSize
|
|
2082
2077
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
2083
|
-
|
|
2078
|
+
if (prevPanelSize == null) {
|
|
2079
|
+
// It's possible that the panels in this group have changed since the last render
|
|
2080
|
+
return;
|
|
2081
|
+
}
|
|
2084
2082
|
if (prevCollapsible && nextCollapsible && prevPanelSize === prevCollapsedSize) {
|
|
2085
2083
|
if (prevCollapsedSize !== nextCollapsedSize) {
|
|
2086
2084
|
resizePanel(panelData, nextCollapsedSize);
|
|
@@ -2102,7 +2100,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2102
2100
|
return;
|
|
2103
2101
|
}
|
|
2104
2102
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
2105
|
-
assert(handleElement);
|
|
2103
|
+
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
2106
2104
|
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
2107
2105
|
setDragState({
|
|
2108
2106
|
dragHandleId,
|
|
@@ -2231,10 +2229,10 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
2231
2229
|
{
|
|
2232
2230
|
event.preventDefault();
|
|
2233
2231
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
2234
|
-
assert(groupId);
|
|
2232
|
+
assert(groupId, `No group element found for id "${groupId}"`);
|
|
2235
2233
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
2236
2234
|
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
2237
|
-
assert(index !== null);
|
|
2235
|
+
assert(index !== null, `No resize element found for id "${handleId}"`);
|
|
2238
2236
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
2239
2237
|
const nextHandle = handles[nextIndex];
|
|
2240
2238
|
nextHandle.focus();
|
|
@@ -2306,7 +2304,7 @@ function PanelResizeHandle({
|
|
|
2306
2304
|
return;
|
|
2307
2305
|
}
|
|
2308
2306
|
const element = elementRef.current;
|
|
2309
|
-
assert(element);
|
|
2307
|
+
assert(element, "Element ref not attached");
|
|
2310
2308
|
const setResizeHandlerState = (action, isActive, event) => {
|
|
2311
2309
|
if (isActive) {
|
|
2312
2310
|
switch (action) {
|