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
|
@@ -284,15 +284,15 @@ function isTouchEvent(event) {
|
|
|
284
284
|
function getResizeEventCoordinates(event) {
|
|
285
285
|
if (isMouseEvent(event)) {
|
|
286
286
|
return {
|
|
287
|
-
x: event.
|
|
288
|
-
y: event.
|
|
287
|
+
x: event.clientX,
|
|
288
|
+
y: event.clientY
|
|
289
289
|
};
|
|
290
290
|
} else if (isTouchEvent(event)) {
|
|
291
291
|
const touch = event.touches[0];
|
|
292
|
-
if (touch && touch.
|
|
292
|
+
if (touch && touch.clientX && touch.clientY) {
|
|
293
293
|
return {
|
|
294
|
-
x: touch.
|
|
295
|
-
y: touch.
|
|
294
|
+
x: touch.clientX,
|
|
295
|
+
y: touch.clientY
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
}
|
|
@@ -338,7 +338,7 @@ function compare(a, b) {
|
|
|
338
338
|
b = ancestors.b.pop();
|
|
339
339
|
common_ancestor = a;
|
|
340
340
|
}
|
|
341
|
-
assert(common_ancestor);
|
|
341
|
+
assert(common_ancestor, "Stacking order can only be calculated for elements with a common ancestor");
|
|
342
342
|
const z_indexes = {
|
|
343
343
|
a: get_z_index(find_stacking_context(ancestors.a)),
|
|
344
344
|
b: get_z_index(find_stacking_context(ancestors.b))
|
|
@@ -396,7 +396,7 @@ function find_stacking_context(nodes) {
|
|
|
396
396
|
let i = nodes.length;
|
|
397
397
|
while (i--) {
|
|
398
398
|
const node = nodes[i];
|
|
399
|
-
assert(node);
|
|
399
|
+
assert(node, "Missing node");
|
|
400
400
|
if (creates_stacking_context(node)) return node;
|
|
401
401
|
}
|
|
402
402
|
return null;
|
|
@@ -683,7 +683,7 @@ function updateResizeHandlerStates(action, event) {
|
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
685
|
|
|
686
|
-
function assert(expectedCondition, message
|
|
686
|
+
function assert(expectedCondition, message) {
|
|
687
687
|
if (!expectedCondition) {
|
|
688
688
|
console.error(message);
|
|
689
689
|
throw Error(message);
|
|
@@ -714,7 +714,7 @@ function resizePanel({
|
|
|
714
714
|
size
|
|
715
715
|
}) {
|
|
716
716
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
717
|
-
assert(panelConstraints != null);
|
|
717
|
+
assert(panelConstraints != null, `Panel constraints not found for index ${panelIndex}`);
|
|
718
718
|
let {
|
|
719
719
|
collapsedSize = 0,
|
|
720
720
|
collapsible,
|
|
@@ -752,8 +752,8 @@ function adjustLayoutByDelta({
|
|
|
752
752
|
}
|
|
753
753
|
const nextLayout = [...prevLayout];
|
|
754
754
|
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
755
|
-
assert(firstPivotIndex != null);
|
|
756
|
-
assert(secondPivotIndex != null);
|
|
755
|
+
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
756
|
+
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
757
757
|
let deltaApplied = 0;
|
|
758
758
|
|
|
759
759
|
//const DEBUG = [];
|
|
@@ -779,19 +779,18 @@ function adjustLayoutByDelta({
|
|
|
779
779
|
// Check if we should expand a collapsed panel
|
|
780
780
|
const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
781
781
|
const panelConstraints = panelConstraintsArray[index];
|
|
782
|
-
assert(panelConstraints);
|
|
782
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
783
|
+
const {
|
|
784
|
+
collapsedSize = 0,
|
|
785
|
+
collapsible,
|
|
786
|
+
minSize = 0
|
|
787
|
+
} = panelConstraints;
|
|
783
788
|
|
|
784
789
|
//DEBUG.push(`edge case check 1: ${index}`);
|
|
785
790
|
//DEBUG.push(` -> collapsible? ${constraints.collapsible}`);
|
|
786
|
-
if (
|
|
791
|
+
if (collapsible) {
|
|
787
792
|
const prevSize = prevLayout[index];
|
|
788
|
-
assert(prevSize != null);
|
|
789
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
790
|
-
assert(panelConstraints);
|
|
791
|
-
const {
|
|
792
|
-
collapsedSize = 0,
|
|
793
|
-
minSize = 0
|
|
794
|
-
} = panelConstraints;
|
|
793
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
795
794
|
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
796
795
|
const localDelta = minSize - prevSize;
|
|
797
796
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -808,22 +807,18 @@ function adjustLayoutByDelta({
|
|
|
808
807
|
// Check if we should collapse a panel at its minimum size
|
|
809
808
|
const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
810
809
|
const panelConstraints = panelConstraintsArray[index];
|
|
811
|
-
assert(panelConstraints);
|
|
810
|
+
assert(panelConstraints, `No panel constraints found for index ${index}`);
|
|
812
811
|
const {
|
|
813
|
-
|
|
812
|
+
collapsedSize = 0,
|
|
813
|
+
collapsible,
|
|
814
|
+
minSize = 0
|
|
814
815
|
} = panelConstraints;
|
|
815
816
|
|
|
816
817
|
//DEBUG.push(`edge case check 2: ${index}`);
|
|
817
818
|
//DEBUG.push(` -> collapsible? ${collapsible}`);
|
|
818
819
|
if (collapsible) {
|
|
819
820
|
const prevSize = prevLayout[index];
|
|
820
|
-
assert(prevSize != null);
|
|
821
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
822
|
-
assert(panelConstraints);
|
|
823
|
-
const {
|
|
824
|
-
collapsedSize = 0,
|
|
825
|
-
minSize = 0
|
|
826
|
-
} = panelConstraints;
|
|
821
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
827
822
|
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
828
823
|
const localDelta = prevSize - collapsedSize;
|
|
829
824
|
//DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
@@ -853,7 +848,7 @@ function adjustLayoutByDelta({
|
|
|
853
848
|
//DEBUG.push("pre calc...");
|
|
854
849
|
while (true) {
|
|
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 maxSafeSize = resizePanel({
|
|
858
853
|
panelConstraints: panelConstraintsArray,
|
|
859
854
|
panelIndex: index,
|
|
@@ -884,7 +879,7 @@ function adjustLayoutByDelta({
|
|
|
884
879
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
885
880
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
886
881
|
const prevSize = prevLayout[index];
|
|
887
|
-
assert(prevSize != null);
|
|
882
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
888
883
|
const unsafeSize = prevSize - deltaRemaining;
|
|
889
884
|
const safeSize = resizePanel({
|
|
890
885
|
panelConstraints: panelConstraintsArray,
|
|
@@ -921,7 +916,7 @@ function adjustLayoutByDelta({
|
|
|
921
916
|
// Now distribute the applied delta to the panels in the other direction
|
|
922
917
|
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
923
918
|
const prevSize = prevLayout[pivotIndex];
|
|
924
|
-
assert(prevSize != null);
|
|
919
|
+
assert(prevSize != null, `Previous layout not found for panel index ${pivotIndex}`);
|
|
925
920
|
const unsafeSize = prevSize + deltaApplied;
|
|
926
921
|
const safeSize = resizePanel({
|
|
927
922
|
panelConstraints: panelConstraintsArray,
|
|
@@ -939,7 +934,7 @@ function adjustLayoutByDelta({
|
|
|
939
934
|
let index = pivotIndex;
|
|
940
935
|
while (index >= 0 && index < panelConstraintsArray.length) {
|
|
941
936
|
const prevSize = nextLayout[index];
|
|
942
|
-
assert(prevSize != null);
|
|
937
|
+
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
943
938
|
const unsafeSize = prevSize + deltaRemaining;
|
|
944
939
|
const safeSize = resizePanel({
|
|
945
940
|
panelConstraints: panelConstraintsArray,
|
|
@@ -985,7 +980,7 @@ function calculateAriaValues({
|
|
|
985
980
|
let totalMinSize = 0;
|
|
986
981
|
let totalMaxSize = 0;
|
|
987
982
|
const firstIndex = pivotIndices[0];
|
|
988
|
-
assert(firstIndex != null);
|
|
983
|
+
assert(firstIndex != null, "No pivot index found");
|
|
989
984
|
|
|
990
985
|
// A panel's effective min/max sizes also need to account for other panel's sizes.
|
|
991
986
|
panelsArray.forEach((panelData, index) => {
|
|
@@ -1104,7 +1099,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1104
1099
|
}
|
|
1105
1100
|
} else {
|
|
1106
1101
|
const panelData = panelDataArray[index];
|
|
1107
|
-
assert(panelData);
|
|
1102
|
+
assert(panelData, `No panel data found for index "${index}"`);
|
|
1108
1103
|
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
1109
1104
|
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
1110
1105
|
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
@@ -1125,17 +1120,17 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1125
1120
|
return;
|
|
1126
1121
|
}
|
|
1127
1122
|
const eagerValues = eagerValuesRef.current;
|
|
1128
|
-
assert(eagerValues);
|
|
1123
|
+
assert(eagerValues, `Eager values not found`);
|
|
1129
1124
|
const {
|
|
1130
1125
|
panelDataArray
|
|
1131
1126
|
} = eagerValues;
|
|
1132
1127
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1133
1128
|
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
1134
1129
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1135
|
-
assert(handles);
|
|
1130
|
+
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
1136
1131
|
const cleanupFunctions = handles.map(handle => {
|
|
1137
1132
|
const handleId = handle.getAttribute("data-panel-resize-handle-id");
|
|
1138
|
-
assert(handleId);
|
|
1133
|
+
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
1139
1134
|
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
1140
1135
|
if (idBefore == null || idAfter == null) {
|
|
1141
1136
|
return () => {};
|
|
@@ -1151,7 +1146,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1151
1146
|
const index = panelDataArray.findIndex(panelData => panelData.id === idBefore);
|
|
1152
1147
|
if (index >= 0) {
|
|
1153
1148
|
const panelData = panelDataArray[index];
|
|
1154
|
-
assert(panelData);
|
|
1149
|
+
assert(panelData, `No panel data found for index ${index}`);
|
|
1155
1150
|
const size = layout[index];
|
|
1156
1151
|
const {
|
|
1157
1152
|
collapsedSize = 0,
|
|
@@ -1210,15 +1205,15 @@ function getResizeEventCursorPosition(direction, event) {
|
|
|
1210
1205
|
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
1211
1206
|
const isHorizontal = direction === "horizontal";
|
|
1212
1207
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
1213
|
-
assert(handleElement);
|
|
1208
|
+
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
1214
1209
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
1215
|
-
assert(groupId);
|
|
1210
|
+
assert(groupId, `Resize handle element has no group id attribute`);
|
|
1216
1211
|
let {
|
|
1217
1212
|
initialCursorPosition
|
|
1218
1213
|
} = initialDragState;
|
|
1219
1214
|
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1220
1215
|
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1221
|
-
assert(groupElement);
|
|
1216
|
+
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
1222
1217
|
const groupRect = groupElement.getBoundingClientRect();
|
|
1223
1218
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
1224
1219
|
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
@@ -1279,7 +1274,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1279
1274
|
// Distribute default sizes first
|
|
1280
1275
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1281
1276
|
const panelConstraints = panelConstraintsArray[index];
|
|
1282
|
-
assert(panelConstraints);
|
|
1277
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1283
1278
|
const {
|
|
1284
1279
|
defaultSize
|
|
1285
1280
|
} = panelConstraints;
|
|
@@ -1293,7 +1288,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1293
1288
|
// Remaining size should be distributed evenly between panels without default sizes
|
|
1294
1289
|
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1295
1290
|
const panelConstraints = panelConstraintsArray[index];
|
|
1296
|
-
assert(panelConstraints);
|
|
1291
|
+
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1297
1292
|
const {
|
|
1298
1293
|
defaultSize
|
|
1299
1294
|
} = panelConstraints;
|
|
@@ -1313,7 +1308,7 @@ function calculateUnsafeDefaultLayout({
|
|
|
1313
1308
|
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
1314
1309
|
layout.forEach((size, index) => {
|
|
1315
1310
|
const panelData = panelsArray[index];
|
|
1316
|
-
assert(panelData);
|
|
1311
|
+
assert(panelData, `Panel data not found for index ${index}`);
|
|
1317
1312
|
const {
|
|
1318
1313
|
callbacks,
|
|
1319
1314
|
constraints,
|
|
@@ -1497,7 +1492,7 @@ function validatePanelConstraints({
|
|
|
1497
1492
|
{
|
|
1498
1493
|
const warnings = [];
|
|
1499
1494
|
const panelConstraints = panelConstraintsArray[panelIndex];
|
|
1500
|
-
assert(panelConstraints);
|
|
1495
|
+
assert(panelConstraints, `No panel constraints found for index ${panelIndex}`);
|
|
1501
1496
|
const {
|
|
1502
1497
|
collapsedSize = 0,
|
|
1503
1498
|
collapsible = false,
|
|
@@ -1551,7 +1546,7 @@ function validatePanelGroupLayout({
|
|
|
1551
1546
|
}
|
|
1552
1547
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1553
1548
|
const unsafeSize = nextLayout[index];
|
|
1554
|
-
assert(unsafeSize != null);
|
|
1549
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1555
1550
|
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
1556
1551
|
nextLayout[index] = safeSize;
|
|
1557
1552
|
}
|
|
@@ -1561,7 +1556,7 @@ function validatePanelGroupLayout({
|
|
|
1561
1556
|
// First pass: Validate the proposed layout given each panel's constraints
|
|
1562
1557
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1563
1558
|
const unsafeSize = nextLayout[index];
|
|
1564
|
-
assert(unsafeSize != null);
|
|
1559
|
+
assert(unsafeSize != null, `No layout data found for index ${index}`);
|
|
1565
1560
|
const safeSize = resizePanel({
|
|
1566
1561
|
panelConstraints,
|
|
1567
1562
|
panelIndex: index,
|
|
@@ -1578,7 +1573,7 @@ function validatePanelGroupLayout({
|
|
|
1578
1573
|
if (!fuzzyNumbersEqual(remainingSize, 0)) {
|
|
1579
1574
|
for (let index = 0; index < panelConstraints.length; index++) {
|
|
1580
1575
|
const prevSize = nextLayout[index];
|
|
1581
|
-
assert(prevSize != null);
|
|
1576
|
+
assert(prevSize != null, `No layout data found for index ${index}`);
|
|
1582
1577
|
const unsafeSize = prevSize + remainingSize;
|
|
1583
1578
|
const safeSize = resizePanel({
|
|
1584
1579
|
panelConstraints,
|
|
@@ -1755,7 +1750,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1755
1750
|
const panelConstraints = panelDataArray.map(panelData => panelData.constraints);
|
|
1756
1751
|
for (let panelIndex = 0; panelIndex < panelConstraints.length; panelIndex++) {
|
|
1757
1752
|
const panelData = panelDataArray[panelIndex];
|
|
1758
|
-
assert(panelData);
|
|
1753
|
+
assert(panelData, `Panel data not found for index ${panelIndex}`);
|
|
1759
1754
|
const isValid = validatePanelConstraints({
|
|
1760
1755
|
panelConstraints,
|
|
1761
1756
|
panelId: panelData.id,
|
|
@@ -1786,7 +1781,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1786
1781
|
panelSize,
|
|
1787
1782
|
pivotIndices
|
|
1788
1783
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1789
|
-
assert(panelSize != null);
|
|
1784
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1790
1785
|
if (panelSize !== collapsedSize) {
|
|
1791
1786
|
// Store size before collapse;
|
|
1792
1787
|
// This is the size that gets restored if the expand() API is used.
|
|
@@ -1863,7 +1858,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1863
1858
|
const {
|
|
1864
1859
|
panelSize
|
|
1865
1860
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1866
|
-
assert(panelSize != null);
|
|
1861
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1867
1862
|
return panelSize;
|
|
1868
1863
|
}, []);
|
|
1869
1864
|
|
|
@@ -1907,7 +1902,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1907
1902
|
collapsible,
|
|
1908
1903
|
panelSize
|
|
1909
1904
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1910
|
-
assert(panelSize != null);
|
|
1905
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1911
1906
|
return !collapsible || panelSize > collapsedSize;
|
|
1912
1907
|
}, []);
|
|
1913
1908
|
const registerPanel = useCallback(panelData => {
|
|
@@ -2074,7 +2069,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2074
2069
|
panelSize,
|
|
2075
2070
|
pivotIndices
|
|
2076
2071
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
2077
|
-
assert(panelSize != null);
|
|
2072
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
2078
2073
|
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
2079
2074
|
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
2080
2075
|
const nextLayout = adjustLayoutByDelta({
|
|
@@ -2111,7 +2106,10 @@ function PanelGroupWithForwardedRef({
|
|
|
2111
2106
|
const {
|
|
2112
2107
|
panelSize: prevPanelSize
|
|
2113
2108
|
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
2114
|
-
|
|
2109
|
+
if (prevPanelSize == null) {
|
|
2110
|
+
// It's possible that the panels in this group have changed since the last render
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2115
2113
|
if (prevCollapsible && nextCollapsible && prevPanelSize === prevCollapsedSize) {
|
|
2116
2114
|
if (prevCollapsedSize !== nextCollapsedSize) {
|
|
2117
2115
|
resizePanel(panelData, nextCollapsedSize);
|
|
@@ -2133,7 +2131,7 @@ function PanelGroupWithForwardedRef({
|
|
|
2133
2131
|
return;
|
|
2134
2132
|
}
|
|
2135
2133
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
2136
|
-
assert(handleElement);
|
|
2134
|
+
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
2137
2135
|
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
2138
2136
|
setDragState({
|
|
2139
2137
|
dragHandleId,
|
|
@@ -2262,10 +2260,10 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
2262
2260
|
{
|
|
2263
2261
|
event.preventDefault();
|
|
2264
2262
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
2265
|
-
assert(groupId);
|
|
2263
|
+
assert(groupId, `No group element found for id "${groupId}"`);
|
|
2266
2264
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
2267
2265
|
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
2268
|
-
assert(index !== null);
|
|
2266
|
+
assert(index !== null, `No resize element found for id "${handleId}"`);
|
|
2269
2267
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
2270
2268
|
const nextHandle = handles[nextIndex];
|
|
2271
2269
|
nextHandle.focus();
|
|
@@ -2337,7 +2335,7 @@ function PanelResizeHandle({
|
|
|
2337
2335
|
return;
|
|
2338
2336
|
}
|
|
2339
2337
|
const element = elementRef.current;
|
|
2340
|
-
assert(element);
|
|
2338
|
+
assert(element, "Element ref not attached");
|
|
2341
2339
|
const setResizeHandlerState = (action, isActive, event) => {
|
|
2342
2340
|
if (isActive) {
|
|
2343
2341
|
switch (action) {
|