react-resizable-panels 1.0.7 → 1.0.8
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 +6 -0
- package/dist/declarations/src/Panel.d.ts +3 -3
- package/dist/declarations/src/PanelGroup.d.ts +2 -2
- package/dist/declarations/src/PanelResizeHandle.d.ts +2 -2
- package/dist/declarations/src/utils/dom/calculateAvailablePanelSizeInPixels.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getAvailableGroupSizePixels.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getPanelElement.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getPanelElementsForGroup.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getPanelGroupElement.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElement.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElementIndex.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElementsForGroup.d.ts +1 -1
- package/dist/declarations/src/utils/dom/getResizeHandlePanelIds.d.ts +1 -1
- package/dist/declarations/src/vendor/react.d.ts +2 -2
- package/dist/react-resizable-panels.browser.cjs.js +74 -51
- package/dist/react-resizable-panels.browser.development.cjs.js +76 -52
- package/dist/react-resizable-panels.browser.development.esm.js +76 -52
- package/dist/react-resizable-panels.browser.esm.js +74 -51
- package/dist/react-resizable-panels.cjs.js +74 -51
- package/dist/react-resizable-panels.development.cjs.js +76 -52
- package/dist/react-resizable-panels.development.esm.js +76 -52
- package/dist/react-resizable-panels.development.node.cjs.js +71 -50
- package/dist/react-resizable-panels.development.node.esm.js +71 -50
- package/dist/react-resizable-panels.esm.js +74 -51
- package/dist/react-resizable-panels.node.cjs.js +69 -49
- package/dist/react-resizable-panels.node.esm.js +69 -49
- package/package.json +1 -1
- package/src/Panel.test.tsx +3 -2
- package/src/Panel.ts +2 -2
- package/src/PanelGroup.test.tsx +3 -2
- package/src/PanelGroup.ts +48 -28
- package/src/PanelGroupContext.ts +4 -2
- package/src/PanelResizeHandle.test.tsx +3 -3
- package/src/PanelResizeHandle.ts +4 -2
- package/src/hooks/useWindowSplitterBehavior.ts +14 -5
- package/src/hooks/useWindowSplitterPanelGroupBehavior.ts +23 -7
- package/src/utils/calculateDeltaPercentage.ts +4 -2
- package/src/utils/calculateDragOffsetPercentage.ts +4 -3
- package/src/utils/determinePivotIndices.ts +7 -2
- package/src/utils/dom/calculateAvailablePanelSizeInPixels.ts +8 -3
- package/src/utils/dom/getAvailableGroupSizePixels.ts +8 -7
- package/src/utils/dom/getPanelElement.ts +5 -2
- package/src/utils/dom/getPanelElementsForGroup.ts +7 -2
- package/src/utils/dom/getPanelGroupElement.ts +14 -2
- package/src/utils/dom/getResizeHandleElement.ts +5 -2
- package/src/utils/dom/getResizeHandleElementIndex.ts +3 -2
- package/src/utils/dom/getResizeHandleElementsForGroup.ts +3 -2
- package/src/utils/dom/getResizeHandlePanelIds.ts +4 -3
- package/src/utils/validatePanelConstraints.test.ts +45 -0
- package/src/utils/validatePanelConstraints.ts +5 -1
- package/src/vendor/react.ts +2 -0
|
@@ -497,41 +497,48 @@ function calculateAriaValues({
|
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
-
function getResizeHandleElementsForGroup(groupId) {
|
|
501
|
-
return Array.from(
|
|
500
|
+
function getResizeHandleElementsForGroup(groupId, panelGroupElement) {
|
|
501
|
+
return Array.from(panelGroupElement.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${groupId}"]`));
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
-
function getResizeHandleElementIndex(groupId, id) {
|
|
505
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
504
|
+
function getResizeHandleElementIndex(groupId, id, panelGroupElement) {
|
|
505
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
506
506
|
const index = handles.findIndex(handle => handle.getAttribute("data-panel-resize-handle-id") === id);
|
|
507
507
|
return index !== null && index !== void 0 ? index : null;
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
function determinePivotIndices(groupId, dragHandleId) {
|
|
511
|
-
const index = getResizeHandleElementIndex(groupId, dragHandleId);
|
|
510
|
+
function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
|
|
511
|
+
const index = getResizeHandleElementIndex(groupId, dragHandleId, panelGroupElement);
|
|
512
512
|
return index != null ? [index, index + 1] : [-1, -1];
|
|
513
513
|
}
|
|
514
514
|
|
|
515
|
-
function getPanelGroupElement(id) {
|
|
516
|
-
|
|
515
|
+
function getPanelGroupElement(id, rootElement) {
|
|
516
|
+
var _dataset;
|
|
517
|
+
//If the root element is the PanelGroup
|
|
518
|
+
if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
|
|
519
|
+
return rootElement;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
//Else query children
|
|
523
|
+
const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
|
|
517
524
|
if (element) {
|
|
518
525
|
return element;
|
|
519
526
|
}
|
|
520
527
|
return null;
|
|
521
528
|
}
|
|
522
529
|
|
|
523
|
-
function getResizeHandleElement(id) {
|
|
524
|
-
const element =
|
|
530
|
+
function getResizeHandleElement(id, panelGroupElement) {
|
|
531
|
+
const element = panelGroupElement.querySelector(`[data-panel-resize-handle-id="${id}"]`);
|
|
525
532
|
if (element) {
|
|
526
533
|
return element;
|
|
527
534
|
}
|
|
528
535
|
return null;
|
|
529
536
|
}
|
|
530
537
|
|
|
531
|
-
function getResizeHandlePanelIds(groupId, handleId, panelsArray) {
|
|
538
|
+
function getResizeHandlePanelIds(groupId, handleId, panelsArray, panelGroupElement) {
|
|
532
539
|
var _panelsArray$index$id, _panelsArray$index, _panelsArray$id, _panelsArray;
|
|
533
|
-
const handle = getResizeHandleElement(handleId);
|
|
534
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
540
|
+
const handle = getResizeHandleElement(handleId, panelGroupElement);
|
|
541
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
535
542
|
const index = handle ? handles.indexOf(handle) : -1;
|
|
536
543
|
const idBefore = (_panelsArray$index$id = (_panelsArray$index = panelsArray[index]) === null || _panelsArray$index === void 0 ? void 0 : _panelsArray$index.id) !== null && _panelsArray$index$id !== void 0 ? _panelsArray$index$id : null;
|
|
537
544
|
const idAfter = (_panelsArray$id = (_panelsArray = panelsArray[index + 1]) === null || _panelsArray === void 0 ? void 0 : _panelsArray.id) !== null && _panelsArray$id !== void 0 ? _panelsArray$id : null;
|
|
@@ -546,13 +553,17 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
546
553
|
groupId,
|
|
547
554
|
layout,
|
|
548
555
|
panelDataArray,
|
|
556
|
+
panelGroupElement,
|
|
549
557
|
setLayout
|
|
550
558
|
}) {
|
|
551
559
|
useRef({
|
|
552
560
|
didWarnAboutMissingResizeHandle: false
|
|
553
561
|
});
|
|
554
562
|
useIsomorphicLayoutEffect(() => {
|
|
555
|
-
|
|
563
|
+
if (!panelGroupElement) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const resizeHandleElements = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
556
567
|
for (let index = 0; index < panelDataArray.length - 1; index++) {
|
|
557
568
|
const {
|
|
558
569
|
valueMax,
|
|
@@ -581,21 +592,24 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
581
592
|
resizeHandleElement.removeAttribute("aria-valuenow");
|
|
582
593
|
});
|
|
583
594
|
};
|
|
584
|
-
}, [groupId, layout, panelDataArray]);
|
|
595
|
+
}, [groupId, layout, panelDataArray, panelGroupElement]);
|
|
585
596
|
useEffect(() => {
|
|
597
|
+
if (!panelGroupElement) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
586
600
|
const eagerValues = eagerValuesRef.current;
|
|
587
601
|
assert(eagerValues);
|
|
588
602
|
const {
|
|
589
603
|
panelDataArray
|
|
590
604
|
} = eagerValues;
|
|
591
|
-
const groupElement = getPanelGroupElement(groupId);
|
|
605
|
+
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
592
606
|
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
593
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
607
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
594
608
|
assert(handles);
|
|
595
609
|
const cleanupFunctions = handles.map(handle => {
|
|
596
610
|
const handleId = handle.getAttribute("data-panel-resize-handle-id");
|
|
597
611
|
assert(handleId);
|
|
598
|
-
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray);
|
|
612
|
+
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
599
613
|
if (idBefore == null || idAfter == null) {
|
|
600
614
|
return () => {};
|
|
601
615
|
}
|
|
@@ -622,7 +636,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
622
636
|
delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
|
|
623
637
|
layout,
|
|
624
638
|
panelConstraints: panelDataArray.map(panelData => panelData.constraints),
|
|
625
|
-
pivotIndices: determinePivotIndices(groupId, handleId),
|
|
639
|
+
pivotIndices: determinePivotIndices(groupId, handleId, panelGroupElement),
|
|
626
640
|
trigger: "keyboard"
|
|
627
641
|
});
|
|
628
642
|
if (layout !== nextLayout) {
|
|
@@ -642,7 +656,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
642
656
|
return () => {
|
|
643
657
|
cleanupFunctions.forEach(cleanupFunction => cleanupFunction());
|
|
644
658
|
};
|
|
645
|
-
}, [committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
659
|
+
}, [panelGroupElement, committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
646
660
|
}
|
|
647
661
|
|
|
648
662
|
function areEqual(arrayA, arrayB) {
|
|
@@ -680,9 +694,9 @@ function getResizeEventCursorPosition(direction, event) {
|
|
|
680
694
|
}
|
|
681
695
|
}
|
|
682
696
|
|
|
683
|
-
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState) {
|
|
697
|
+
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
684
698
|
const isHorizontal = direction === "horizontal";
|
|
685
|
-
const handleElement = getResizeHandleElement(dragHandleId);
|
|
699
|
+
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
686
700
|
assert(handleElement);
|
|
687
701
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
688
702
|
assert(groupId);
|
|
@@ -690,7 +704,7 @@ function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDr
|
|
|
690
704
|
initialCursorPosition
|
|
691
705
|
} = initialDragState;
|
|
692
706
|
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
693
|
-
const groupElement = getPanelGroupElement(groupId);
|
|
707
|
+
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
694
708
|
assert(groupElement);
|
|
695
709
|
const groupRect = groupElement.getBoundingClientRect();
|
|
696
710
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
@@ -700,7 +714,7 @@ function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDr
|
|
|
700
714
|
}
|
|
701
715
|
|
|
702
716
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX
|
|
703
|
-
function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy) {
|
|
717
|
+
function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy, panelGroupElement) {
|
|
704
718
|
if (isKeyDown(event)) {
|
|
705
719
|
const isHorizontal = direction === "horizontal";
|
|
706
720
|
let delta = 0;
|
|
@@ -737,7 +751,7 @@ function calculateDeltaPercentage(event, dragHandleId, direction, initialDragSta
|
|
|
737
751
|
if (initialDragState == null) {
|
|
738
752
|
return 0;
|
|
739
753
|
}
|
|
740
|
-
return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState);
|
|
754
|
+
return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement);
|
|
741
755
|
}
|
|
742
756
|
}
|
|
743
757
|
|
|
@@ -1089,6 +1103,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1089
1103
|
...rest
|
|
1090
1104
|
}) {
|
|
1091
1105
|
const groupId = useUniqueId(idFromProps);
|
|
1106
|
+
const panelGroupElementRef = useRef(null);
|
|
1092
1107
|
const [dragState, setDragState] = useState(null);
|
|
1093
1108
|
const [layout, setLayout] = useState([]);
|
|
1094
1109
|
const panelIdToLastNotifiedSizeMapRef = useRef({});
|
|
@@ -1157,7 +1172,8 @@ function PanelGroupWithForwardedRef({
|
|
|
1157
1172
|
groupId,
|
|
1158
1173
|
layout,
|
|
1159
1174
|
panelDataArray: eagerValuesRef.current.panelDataArray,
|
|
1160
|
-
setLayout
|
|
1175
|
+
setLayout,
|
|
1176
|
+
panelGroupElement: panelGroupElementRef.current
|
|
1161
1177
|
});
|
|
1162
1178
|
useEffect(() => {
|
|
1163
1179
|
const {
|
|
@@ -1400,6 +1416,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1400
1416
|
const registerResizeHandle = useCallback(dragHandleId => {
|
|
1401
1417
|
return function resizeHandler(event) {
|
|
1402
1418
|
event.preventDefault();
|
|
1419
|
+
const panelGroupElement = panelGroupElementRef.current;
|
|
1420
|
+
if (!panelGroupElement) {
|
|
1421
|
+
return () => null;
|
|
1422
|
+
}
|
|
1403
1423
|
const {
|
|
1404
1424
|
direction,
|
|
1405
1425
|
dragState,
|
|
@@ -1414,8 +1434,8 @@ function PanelGroupWithForwardedRef({
|
|
|
1414
1434
|
const {
|
|
1415
1435
|
initialLayout
|
|
1416
1436
|
} = dragState !== null && dragState !== void 0 ? dragState : {};
|
|
1417
|
-
const pivotIndices = determinePivotIndices(groupId, dragHandleId);
|
|
1418
|
-
let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy);
|
|
1437
|
+
const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
|
|
1438
|
+
let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
|
|
1419
1439
|
if (delta === 0) {
|
|
1420
1440
|
return;
|
|
1421
1441
|
}
|
|
@@ -1510,7 +1530,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1510
1530
|
const {
|
|
1511
1531
|
layout
|
|
1512
1532
|
} = eagerValuesRef.current;
|
|
1513
|
-
|
|
1533
|
+
if (!panelGroupElementRef.current) {
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
1514
1537
|
assert(handleElement);
|
|
1515
1538
|
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1516
1539
|
setDragState({
|
|
@@ -1555,7 +1578,8 @@ function PanelGroupWithForwardedRef({
|
|
|
1555
1578
|
resizePanel,
|
|
1556
1579
|
startDragging,
|
|
1557
1580
|
stopDragging,
|
|
1558
|
-
unregisterPanel
|
|
1581
|
+
unregisterPanel,
|
|
1582
|
+
panelGroupElement: panelGroupElementRef.current
|
|
1559
1583
|
}), [collapsePanel, dragState, direction, expandPanel, getPanelSize, getPanelStyle, groupId, isPanelCollapsed, isPanelExpanded, registerPanel, registerResizeHandle, resizePanel, startDragging, stopDragging, unregisterPanel]);
|
|
1560
1584
|
const style = {
|
|
1561
1585
|
display: "flex",
|
|
@@ -1574,6 +1598,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1574
1598
|
...style,
|
|
1575
1599
|
...styleFromProps
|
|
1576
1600
|
},
|
|
1601
|
+
ref: panelGroupElementRef,
|
|
1577
1602
|
// CSS selectors
|
|
1578
1603
|
"data-panel-group": "",
|
|
1579
1604
|
"data-panel-group-direction": direction,
|
|
@@ -1608,13 +1633,14 @@ function panelDataHelper(panelDataArray, panelData, layout) {
|
|
|
1608
1633
|
function useWindowSplitterResizeHandlerBehavior({
|
|
1609
1634
|
disabled,
|
|
1610
1635
|
handleId,
|
|
1611
|
-
resizeHandler
|
|
1636
|
+
resizeHandler,
|
|
1637
|
+
panelGroupElement
|
|
1612
1638
|
}) {
|
|
1613
1639
|
useEffect(() => {
|
|
1614
|
-
if (disabled || resizeHandler == null) {
|
|
1640
|
+
if (disabled || resizeHandler == null || panelGroupElement == null) {
|
|
1615
1641
|
return;
|
|
1616
1642
|
}
|
|
1617
|
-
const handleElement = getResizeHandleElement(handleId);
|
|
1643
|
+
const handleElement = getResizeHandleElement(handleId, panelGroupElement);
|
|
1618
1644
|
if (handleElement == null) {
|
|
1619
1645
|
return;
|
|
1620
1646
|
}
|
|
@@ -1639,8 +1665,8 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
1639
1665
|
event.preventDefault();
|
|
1640
1666
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
1641
1667
|
assert(groupId);
|
|
1642
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
1643
|
-
const index = getResizeHandleElementIndex(groupId, handleId);
|
|
1668
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1669
|
+
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
1644
1670
|
assert(index !== null);
|
|
1645
1671
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
1646
1672
|
const nextHandle = handles[nextIndex];
|
|
@@ -1653,7 +1679,7 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
1653
1679
|
return () => {
|
|
1654
1680
|
handleElement.removeEventListener("keydown", onKeyDown);
|
|
1655
1681
|
};
|
|
1656
|
-
}, [disabled, handleId, resizeHandler]);
|
|
1682
|
+
}, [panelGroupElement, disabled, handleId, resizeHandler]);
|
|
1657
1683
|
}
|
|
1658
1684
|
|
|
1659
1685
|
function PanelResizeHandle({
|
|
@@ -1686,7 +1712,8 @@ function PanelResizeHandle({
|
|
|
1686
1712
|
groupId,
|
|
1687
1713
|
registerResizeHandle,
|
|
1688
1714
|
startDragging,
|
|
1689
|
-
stopDragging
|
|
1715
|
+
stopDragging,
|
|
1716
|
+
panelGroupElement
|
|
1690
1717
|
} = panelGroupContext;
|
|
1691
1718
|
const resizeHandleId = useUniqueId(idFromProps);
|
|
1692
1719
|
const isDragging = (dragState === null || dragState === void 0 ? void 0 : dragState.dragHandleId) === resizeHandleId;
|
|
@@ -1745,7 +1772,8 @@ function PanelResizeHandle({
|
|
|
1745
1772
|
useWindowSplitterResizeHandlerBehavior({
|
|
1746
1773
|
disabled,
|
|
1747
1774
|
handleId: resizeHandleId,
|
|
1748
|
-
resizeHandler
|
|
1775
|
+
resizeHandler,
|
|
1776
|
+
panelGroupElement
|
|
1749
1777
|
});
|
|
1750
1778
|
const style = {
|
|
1751
1779
|
cursor: getCursorStyle(direction),
|
|
@@ -1801,13 +1829,12 @@ function PanelResizeHandle({
|
|
|
1801
1829
|
}
|
|
1802
1830
|
PanelResizeHandle.displayName = "PanelResizeHandle";
|
|
1803
1831
|
|
|
1804
|
-
function calculateAvailablePanelSizeInPixels(groupId) {
|
|
1805
|
-
const panelGroupElement = getPanelGroupElement(groupId);
|
|
1832
|
+
function calculateAvailablePanelSizeInPixels(groupId, panelGroupElement) {
|
|
1806
1833
|
if (panelGroupElement == null) {
|
|
1807
1834
|
return NaN;
|
|
1808
1835
|
}
|
|
1809
1836
|
const direction = panelGroupElement.getAttribute("data-panel-group-direction");
|
|
1810
|
-
const resizeHandles = getResizeHandleElementsForGroup(groupId);
|
|
1837
|
+
const resizeHandles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1811
1838
|
if (direction === "horizontal") {
|
|
1812
1839
|
return panelGroupElement.offsetWidth - resizeHandles.reduce((accumulated, handle) => {
|
|
1813
1840
|
return accumulated + handle.offsetWidth;
|
|
@@ -1819,13 +1846,9 @@ function calculateAvailablePanelSizeInPixels(groupId) {
|
|
|
1819
1846
|
}
|
|
1820
1847
|
}
|
|
1821
1848
|
|
|
1822
|
-
function getAvailableGroupSizePixels(groupId) {
|
|
1823
|
-
const panelGroupElement = getPanelGroupElement(groupId);
|
|
1824
|
-
if (panelGroupElement == null) {
|
|
1825
|
-
return NaN;
|
|
1826
|
-
}
|
|
1849
|
+
function getAvailableGroupSizePixels(groupId, panelGroupElement) {
|
|
1827
1850
|
const direction = panelGroupElement.getAttribute("data-panel-group-direction");
|
|
1828
|
-
const resizeHandles = getResizeHandleElementsForGroup(groupId);
|
|
1851
|
+
const resizeHandles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1829
1852
|
if (direction === "horizontal") {
|
|
1830
1853
|
return panelGroupElement.offsetWidth - resizeHandles.reduce((accumulated, handle) => {
|
|
1831
1854
|
return accumulated + handle.offsetWidth;
|
|
@@ -1837,16 +1860,16 @@ function getAvailableGroupSizePixels(groupId) {
|
|
|
1837
1860
|
}
|
|
1838
1861
|
}
|
|
1839
1862
|
|
|
1840
|
-
function getPanelElement(id) {
|
|
1841
|
-
const element =
|
|
1863
|
+
function getPanelElement(id, panelGroupElement) {
|
|
1864
|
+
const element = panelGroupElement.querySelector(`[data-panel-id="${id}"]`);
|
|
1842
1865
|
if (element) {
|
|
1843
1866
|
return element;
|
|
1844
1867
|
}
|
|
1845
1868
|
return null;
|
|
1846
1869
|
}
|
|
1847
1870
|
|
|
1848
|
-
function getPanelElementsForGroup(groupId) {
|
|
1849
|
-
return Array.from(
|
|
1871
|
+
function getPanelElementsForGroup(groupId, panelGroupElement) {
|
|
1872
|
+
return Array.from(panelGroupElement.querySelectorAll(`[data-panel][data-panel-group-id="${groupId}"]`));
|
|
1850
1873
|
}
|
|
1851
1874
|
|
|
1852
1875
|
export { Panel, PanelGroup, PanelResizeHandle, assert, calculateAvailablePanelSizeInPixels, getAvailableGroupSizePixels, getPanelElement, getPanelElementsForGroup, getPanelGroupElement, getResizeHandleElement, getResizeHandleElementIndex, getResizeHandleElementsForGroup, getResizeHandlePanelIds };
|
|
@@ -454,41 +454,48 @@ function adjustLayoutByDelta({
|
|
|
454
454
|
return nextLayout;
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
-
function getResizeHandleElementsForGroup(groupId) {
|
|
458
|
-
return Array.from(
|
|
457
|
+
function getResizeHandleElementsForGroup(groupId, panelGroupElement) {
|
|
458
|
+
return Array.from(panelGroupElement.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${groupId}"]`));
|
|
459
459
|
}
|
|
460
460
|
|
|
461
|
-
function getResizeHandleElementIndex(groupId, id) {
|
|
462
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
461
|
+
function getResizeHandleElementIndex(groupId, id, panelGroupElement) {
|
|
462
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
463
463
|
const index = handles.findIndex(handle => handle.getAttribute("data-panel-resize-handle-id") === id);
|
|
464
464
|
return index !== null && index !== void 0 ? index : null;
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
function determinePivotIndices(groupId, dragHandleId) {
|
|
468
|
-
const index = getResizeHandleElementIndex(groupId, dragHandleId);
|
|
467
|
+
function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
|
|
468
|
+
const index = getResizeHandleElementIndex(groupId, dragHandleId, panelGroupElement);
|
|
469
469
|
return index != null ? [index, index + 1] : [-1, -1];
|
|
470
470
|
}
|
|
471
471
|
|
|
472
|
-
function getPanelGroupElement(id) {
|
|
473
|
-
|
|
472
|
+
function getPanelGroupElement(id, rootElement) {
|
|
473
|
+
var _dataset;
|
|
474
|
+
//If the root element is the PanelGroup
|
|
475
|
+
if (rootElement instanceof HTMLElement && (rootElement === null || rootElement === void 0 ? void 0 : (_dataset = rootElement.dataset) === null || _dataset === void 0 ? void 0 : _dataset.panelGroupId) == id) {
|
|
476
|
+
return rootElement;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
//Else query children
|
|
480
|
+
const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
|
|
474
481
|
if (element) {
|
|
475
482
|
return element;
|
|
476
483
|
}
|
|
477
484
|
return null;
|
|
478
485
|
}
|
|
479
486
|
|
|
480
|
-
function getResizeHandleElement(id) {
|
|
481
|
-
const element =
|
|
487
|
+
function getResizeHandleElement(id, panelGroupElement) {
|
|
488
|
+
const element = panelGroupElement.querySelector(`[data-panel-resize-handle-id="${id}"]`);
|
|
482
489
|
if (element) {
|
|
483
490
|
return element;
|
|
484
491
|
}
|
|
485
492
|
return null;
|
|
486
493
|
}
|
|
487
494
|
|
|
488
|
-
function getResizeHandlePanelIds(groupId, handleId, panelsArray) {
|
|
495
|
+
function getResizeHandlePanelIds(groupId, handleId, panelsArray, panelGroupElement) {
|
|
489
496
|
var _panelsArray$index$id, _panelsArray$index, _panelsArray$id, _panelsArray;
|
|
490
|
-
const handle = getResizeHandleElement(handleId);
|
|
491
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
497
|
+
const handle = getResizeHandleElement(handleId, panelGroupElement);
|
|
498
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
492
499
|
const index = handle ? handles.indexOf(handle) : -1;
|
|
493
500
|
const idBefore = (_panelsArray$index$id = (_panelsArray$index = panelsArray[index]) === null || _panelsArray$index === void 0 ? void 0 : _panelsArray$index.id) !== null && _panelsArray$index$id !== void 0 ? _panelsArray$index$id : null;
|
|
494
501
|
const idAfter = (_panelsArray$id = (_panelsArray = panelsArray[index + 1]) === null || _panelsArray === void 0 ? void 0 : _panelsArray.id) !== null && _panelsArray$id !== void 0 ? _panelsArray$id : null;
|
|
@@ -503,25 +510,29 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
503
510
|
groupId,
|
|
504
511
|
layout,
|
|
505
512
|
panelDataArray,
|
|
513
|
+
panelGroupElement,
|
|
506
514
|
setLayout
|
|
507
515
|
}) {
|
|
508
516
|
useRef({
|
|
509
517
|
didWarnAboutMissingResizeHandle: false
|
|
510
518
|
});
|
|
511
519
|
useEffect(() => {
|
|
520
|
+
if (!panelGroupElement) {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
512
523
|
const eagerValues = eagerValuesRef.current;
|
|
513
524
|
assert(eagerValues);
|
|
514
525
|
const {
|
|
515
526
|
panelDataArray
|
|
516
527
|
} = eagerValues;
|
|
517
|
-
const groupElement = getPanelGroupElement(groupId);
|
|
528
|
+
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
518
529
|
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
519
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
530
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
520
531
|
assert(handles);
|
|
521
532
|
const cleanupFunctions = handles.map(handle => {
|
|
522
533
|
const handleId = handle.getAttribute("data-panel-resize-handle-id");
|
|
523
534
|
assert(handleId);
|
|
524
|
-
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray);
|
|
535
|
+
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
525
536
|
if (idBefore == null || idAfter == null) {
|
|
526
537
|
return () => {};
|
|
527
538
|
}
|
|
@@ -548,7 +559,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
548
559
|
delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
|
|
549
560
|
layout,
|
|
550
561
|
panelConstraints: panelDataArray.map(panelData => panelData.constraints),
|
|
551
|
-
pivotIndices: determinePivotIndices(groupId, handleId),
|
|
562
|
+
pivotIndices: determinePivotIndices(groupId, handleId, panelGroupElement),
|
|
552
563
|
trigger: "keyboard"
|
|
553
564
|
});
|
|
554
565
|
if (layout !== nextLayout) {
|
|
@@ -568,7 +579,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
568
579
|
return () => {
|
|
569
580
|
cleanupFunctions.forEach(cleanupFunction => cleanupFunction());
|
|
570
581
|
};
|
|
571
|
-
}, [committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
582
|
+
}, [panelGroupElement, committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
572
583
|
}
|
|
573
584
|
|
|
574
585
|
function areEqual(arrayA, arrayB) {
|
|
@@ -606,9 +617,9 @@ function getResizeEventCursorPosition(direction, event) {
|
|
|
606
617
|
}
|
|
607
618
|
}
|
|
608
619
|
|
|
609
|
-
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState) {
|
|
620
|
+
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
610
621
|
const isHorizontal = direction === "horizontal";
|
|
611
|
-
const handleElement = getResizeHandleElement(dragHandleId);
|
|
622
|
+
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
612
623
|
assert(handleElement);
|
|
613
624
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
614
625
|
assert(groupId);
|
|
@@ -616,7 +627,7 @@ function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDr
|
|
|
616
627
|
initialCursorPosition
|
|
617
628
|
} = initialDragState;
|
|
618
629
|
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
619
|
-
const groupElement = getPanelGroupElement(groupId);
|
|
630
|
+
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
620
631
|
assert(groupElement);
|
|
621
632
|
const groupRect = groupElement.getBoundingClientRect();
|
|
622
633
|
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
@@ -626,7 +637,7 @@ function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDr
|
|
|
626
637
|
}
|
|
627
638
|
|
|
628
639
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX
|
|
629
|
-
function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy) {
|
|
640
|
+
function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy, panelGroupElement) {
|
|
630
641
|
if (isKeyDown(event)) {
|
|
631
642
|
const isHorizontal = direction === "horizontal";
|
|
632
643
|
let delta = 0;
|
|
@@ -663,7 +674,7 @@ function calculateDeltaPercentage(event, dragHandleId, direction, initialDragSta
|
|
|
663
674
|
if (initialDragState == null) {
|
|
664
675
|
return 0;
|
|
665
676
|
}
|
|
666
|
-
return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState);
|
|
677
|
+
return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement);
|
|
667
678
|
}
|
|
668
679
|
}
|
|
669
680
|
|
|
@@ -968,6 +979,7 @@ function PanelGroupWithForwardedRef({
|
|
|
968
979
|
...rest
|
|
969
980
|
}) {
|
|
970
981
|
const groupId = useUniqueId(idFromProps);
|
|
982
|
+
const panelGroupElementRef = useRef(null);
|
|
971
983
|
const [dragState, setDragState] = useState(null);
|
|
972
984
|
const [layout, setLayout] = useState([]);
|
|
973
985
|
const panelIdToLastNotifiedSizeMapRef = useRef({});
|
|
@@ -1028,7 +1040,8 @@ function PanelGroupWithForwardedRef({
|
|
|
1028
1040
|
groupId,
|
|
1029
1041
|
layout,
|
|
1030
1042
|
panelDataArray: eagerValuesRef.current.panelDataArray,
|
|
1031
|
-
setLayout
|
|
1043
|
+
setLayout,
|
|
1044
|
+
panelGroupElement: panelGroupElementRef.current
|
|
1032
1045
|
});
|
|
1033
1046
|
useEffect(() => {
|
|
1034
1047
|
const {
|
|
@@ -1223,6 +1236,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1223
1236
|
const registerResizeHandle = useCallback(dragHandleId => {
|
|
1224
1237
|
return function resizeHandler(event) {
|
|
1225
1238
|
event.preventDefault();
|
|
1239
|
+
const panelGroupElement = panelGroupElementRef.current;
|
|
1240
|
+
if (!panelGroupElement) {
|
|
1241
|
+
return () => null;
|
|
1242
|
+
}
|
|
1226
1243
|
const {
|
|
1227
1244
|
direction,
|
|
1228
1245
|
dragState,
|
|
@@ -1237,8 +1254,8 @@ function PanelGroupWithForwardedRef({
|
|
|
1237
1254
|
const {
|
|
1238
1255
|
initialLayout
|
|
1239
1256
|
} = dragState !== null && dragState !== void 0 ? dragState : {};
|
|
1240
|
-
const pivotIndices = determinePivotIndices(groupId, dragHandleId);
|
|
1241
|
-
let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy);
|
|
1257
|
+
const pivotIndices = determinePivotIndices(groupId, dragHandleId, panelGroupElement);
|
|
1258
|
+
let delta = calculateDeltaPercentage(event, dragHandleId, direction, dragState, keyboardResizeBy, panelGroupElement);
|
|
1242
1259
|
if (delta === 0) {
|
|
1243
1260
|
return;
|
|
1244
1261
|
}
|
|
@@ -1333,7 +1350,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1333
1350
|
const {
|
|
1334
1351
|
layout
|
|
1335
1352
|
} = eagerValuesRef.current;
|
|
1336
|
-
|
|
1353
|
+
if (!panelGroupElementRef.current) {
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
1337
1357
|
assert(handleElement);
|
|
1338
1358
|
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1339
1359
|
setDragState({
|
|
@@ -1378,7 +1398,8 @@ function PanelGroupWithForwardedRef({
|
|
|
1378
1398
|
resizePanel,
|
|
1379
1399
|
startDragging,
|
|
1380
1400
|
stopDragging,
|
|
1381
|
-
unregisterPanel
|
|
1401
|
+
unregisterPanel,
|
|
1402
|
+
panelGroupElement: panelGroupElementRef.current
|
|
1382
1403
|
}), [collapsePanel, dragState, direction, expandPanel, getPanelSize, getPanelStyle, groupId, isPanelCollapsed, isPanelExpanded, registerPanel, registerResizeHandle, resizePanel, startDragging, stopDragging, unregisterPanel]);
|
|
1383
1404
|
const style = {
|
|
1384
1405
|
display: "flex",
|
|
@@ -1397,6 +1418,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1397
1418
|
...style,
|
|
1398
1419
|
...styleFromProps
|
|
1399
1420
|
},
|
|
1421
|
+
ref: panelGroupElementRef,
|
|
1400
1422
|
// CSS selectors
|
|
1401
1423
|
"data-panel-group": "",
|
|
1402
1424
|
"data-panel-group-direction": direction,
|
|
@@ -1431,13 +1453,14 @@ function panelDataHelper(panelDataArray, panelData, layout) {
|
|
|
1431
1453
|
function useWindowSplitterResizeHandlerBehavior({
|
|
1432
1454
|
disabled,
|
|
1433
1455
|
handleId,
|
|
1434
|
-
resizeHandler
|
|
1456
|
+
resizeHandler,
|
|
1457
|
+
panelGroupElement
|
|
1435
1458
|
}) {
|
|
1436
1459
|
useEffect(() => {
|
|
1437
|
-
if (disabled || resizeHandler == null) {
|
|
1460
|
+
if (disabled || resizeHandler == null || panelGroupElement == null) {
|
|
1438
1461
|
return;
|
|
1439
1462
|
}
|
|
1440
|
-
const handleElement = getResizeHandleElement(handleId);
|
|
1463
|
+
const handleElement = getResizeHandleElement(handleId, panelGroupElement);
|
|
1441
1464
|
if (handleElement == null) {
|
|
1442
1465
|
return;
|
|
1443
1466
|
}
|
|
@@ -1462,8 +1485,8 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
1462
1485
|
event.preventDefault();
|
|
1463
1486
|
const groupId = handleElement.getAttribute("data-panel-group-id");
|
|
1464
1487
|
assert(groupId);
|
|
1465
|
-
const handles = getResizeHandleElementsForGroup(groupId);
|
|
1466
|
-
const index = getResizeHandleElementIndex(groupId, handleId);
|
|
1488
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1489
|
+
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
1467
1490
|
assert(index !== null);
|
|
1468
1491
|
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
1469
1492
|
const nextHandle = handles[nextIndex];
|
|
@@ -1476,7 +1499,7 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
1476
1499
|
return () => {
|
|
1477
1500
|
handleElement.removeEventListener("keydown", onKeyDown);
|
|
1478
1501
|
};
|
|
1479
|
-
}, [disabled, handleId, resizeHandler]);
|
|
1502
|
+
}, [panelGroupElement, disabled, handleId, resizeHandler]);
|
|
1480
1503
|
}
|
|
1481
1504
|
|
|
1482
1505
|
function PanelResizeHandle({
|
|
@@ -1509,7 +1532,8 @@ function PanelResizeHandle({
|
|
|
1509
1532
|
groupId,
|
|
1510
1533
|
registerResizeHandle,
|
|
1511
1534
|
startDragging,
|
|
1512
|
-
stopDragging
|
|
1535
|
+
stopDragging,
|
|
1536
|
+
panelGroupElement
|
|
1513
1537
|
} = panelGroupContext;
|
|
1514
1538
|
const resizeHandleId = useUniqueId(idFromProps);
|
|
1515
1539
|
const isDragging = (dragState === null || dragState === void 0 ? void 0 : dragState.dragHandleId) === resizeHandleId;
|
|
@@ -1568,7 +1592,8 @@ function PanelResizeHandle({
|
|
|
1568
1592
|
useWindowSplitterResizeHandlerBehavior({
|
|
1569
1593
|
disabled,
|
|
1570
1594
|
handleId: resizeHandleId,
|
|
1571
|
-
resizeHandler
|
|
1595
|
+
resizeHandler,
|
|
1596
|
+
panelGroupElement
|
|
1572
1597
|
});
|
|
1573
1598
|
const style = {
|
|
1574
1599
|
cursor: getCursorStyle(direction),
|
|
@@ -1624,13 +1649,12 @@ function PanelResizeHandle({
|
|
|
1624
1649
|
}
|
|
1625
1650
|
PanelResizeHandle.displayName = "PanelResizeHandle";
|
|
1626
1651
|
|
|
1627
|
-
function calculateAvailablePanelSizeInPixels(groupId) {
|
|
1628
|
-
const panelGroupElement = getPanelGroupElement(groupId);
|
|
1652
|
+
function calculateAvailablePanelSizeInPixels(groupId, panelGroupElement) {
|
|
1629
1653
|
if (panelGroupElement == null) {
|
|
1630
1654
|
return NaN;
|
|
1631
1655
|
}
|
|
1632
1656
|
const direction = panelGroupElement.getAttribute("data-panel-group-direction");
|
|
1633
|
-
const resizeHandles = getResizeHandleElementsForGroup(groupId);
|
|
1657
|
+
const resizeHandles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1634
1658
|
if (direction === "horizontal") {
|
|
1635
1659
|
return panelGroupElement.offsetWidth - resizeHandles.reduce((accumulated, handle) => {
|
|
1636
1660
|
return accumulated + handle.offsetWidth;
|
|
@@ -1642,13 +1666,9 @@ function calculateAvailablePanelSizeInPixels(groupId) {
|
|
|
1642
1666
|
}
|
|
1643
1667
|
}
|
|
1644
1668
|
|
|
1645
|
-
function getAvailableGroupSizePixels(groupId) {
|
|
1646
|
-
const panelGroupElement = getPanelGroupElement(groupId);
|
|
1647
|
-
if (panelGroupElement == null) {
|
|
1648
|
-
return NaN;
|
|
1649
|
-
}
|
|
1669
|
+
function getAvailableGroupSizePixels(groupId, panelGroupElement) {
|
|
1650
1670
|
const direction = panelGroupElement.getAttribute("data-panel-group-direction");
|
|
1651
|
-
const resizeHandles = getResizeHandleElementsForGroup(groupId);
|
|
1671
|
+
const resizeHandles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1652
1672
|
if (direction === "horizontal") {
|
|
1653
1673
|
return panelGroupElement.offsetWidth - resizeHandles.reduce((accumulated, handle) => {
|
|
1654
1674
|
return accumulated + handle.offsetWidth;
|
|
@@ -1660,16 +1680,16 @@ function getAvailableGroupSizePixels(groupId) {
|
|
|
1660
1680
|
}
|
|
1661
1681
|
}
|
|
1662
1682
|
|
|
1663
|
-
function getPanelElement(id) {
|
|
1664
|
-
const element =
|
|
1683
|
+
function getPanelElement(id, panelGroupElement) {
|
|
1684
|
+
const element = panelGroupElement.querySelector(`[data-panel-id="${id}"]`);
|
|
1665
1685
|
if (element) {
|
|
1666
1686
|
return element;
|
|
1667
1687
|
}
|
|
1668
1688
|
return null;
|
|
1669
1689
|
}
|
|
1670
1690
|
|
|
1671
|
-
function getPanelElementsForGroup(groupId) {
|
|
1672
|
-
return Array.from(
|
|
1691
|
+
function getPanelElementsForGroup(groupId, panelGroupElement) {
|
|
1692
|
+
return Array.from(panelGroupElement.querySelectorAll(`[data-panel][data-panel-group-id="${groupId}"]`));
|
|
1673
1693
|
}
|
|
1674
1694
|
|
|
1675
1695
|
exports.Panel = Panel;
|