react-resizable-panels 0.0.43 → 0.0.44
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 +3 -0
- package/dist/react-resizable-panels.d.ts.map +1 -1
- package/dist/react-resizable-panels.js +66 -65
- package/dist/react-resizable-panels.js.map +1 -1
- package/dist/react-resizable-panels.module.js +66 -65
- package/dist/react-resizable-panels.module.js.map +1 -1
- package/package.json +1 -1
- package/src/Panel.ts +41 -30
- package/src/PanelGroup.ts +14 -11
- package/src/hooks/useWindowSplitterBehavior.ts +7 -7
- package/src/types.ts +14 -10
- package/src/utils/coordinates.ts +5 -5
- package/src/utils/group.ts +20 -18
- package/src/utils/serialization.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.44
|
|
4
|
+
* [#142](https://github.com/bvaughn/react-resizable-panels/issues/142): Avoid re-registering `Panel` when props change
|
|
5
|
+
|
|
3
6
|
## 0.0.43
|
|
4
7
|
* Add imperative `getLayout` API to `PanelGroup`
|
|
5
8
|
* [#139](https://github.com/bvaughn/react-resizable-panels/pull/139): Fix edge case bug where simultaneous `localStorage` updates to multiple saved groups would drop some values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";AGEA,iBAAwB,YAAY,GAAG,UAAU,CAAC;AAElD,gCAAgC;IAC9B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C,CAAC;AAEF,0BAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;AAC3D,uBAA8B,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;AAC3D,qBAA4B,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AACnD,mCAA0C,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;
|
|
1
|
+
{"mappings":";AGEA,iBAAwB,YAAY,GAAG,UAAU,CAAC;AAElD,gCAAgC;IAC9B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C,CAAC;AAEF,0BAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;AAC3D,uBAA8B,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;AAC3D,qBAA4B,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AACnD,mCAA0C,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;AEWxE,yBAAyB;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,oCAAoC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,YAAY,IAAI,OAAO,CAAC;IACxB,OAAO,IAAI,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AA+IF,OAAO,MAAM,mHAGZ,CAAC;AU7FF,8BAA8B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,yCAAyC;IACvC,SAAS,EAAE,MAAM,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAAC;AAskBF,OAAO,MAAM,kIAKZ,CAAC;ACpqBF,qCAAqC;IACnC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,UAAU,CAAC,EAAE,2BAA2B,CAAC;IACzC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,kCAAkC,EAChC,QAAe,EACf,SAAS,EAAE,kBAAuB,EAClC,QAAgB,EAChB,EAAE,EAAE,WAAkB,EACtB,UAAU,EACV,KAAK,EAAE,cAAmB,EAC1B,OAAO,EAAE,IAAY,GACtB,EAAE,sBAAsB,0FAoJxB","sources":["packages/react-resizable-panels/src/src/vendor/react.ts","packages/react-resizable-panels/src/src/hooks/useIsomorphicEffect.ts","packages/react-resizable-panels/src/src/hooks/useUniqueId.ts","packages/react-resizable-panels/src/src/types.ts","packages/react-resizable-panels/src/src/PanelContexts.ts","packages/react-resizable-panels/src/src/Panel.ts","packages/react-resizable-panels/src/src/constants.ts","packages/react-resizable-panels/src/src/utils/group.ts","packages/react-resizable-panels/src/src/utils/assert.ts","packages/react-resizable-panels/src/src/hooks/useWindowSplitterBehavior.ts","packages/react-resizable-panels/src/src/utils/arrays.ts","packages/react-resizable-panels/src/src/utils/coordinates.ts","packages/react-resizable-panels/src/src/utils/cursor.ts","packages/react-resizable-panels/src/src/utils/debounce.ts","packages/react-resizable-panels/src/src/utils/serialization.ts","packages/react-resizable-panels/src/src/PanelGroup.ts","packages/react-resizable-panels/src/src/PanelResizeHandle.ts","packages/react-resizable-panels/src/src/index.ts","packages/react-resizable-panels/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import { Panel } from \"./Panel\";\nimport { PanelGroup } from \"./PanelGroup\";\nimport { PanelResizeHandle } from \"./PanelResizeHandle\";\n\nimport type { ImperativePanelHandle, PanelProps } from \"./Panel\";\nimport type { ImperativePanelGroupHandle, PanelGroupProps } from \"./PanelGroup\";\nimport type { PanelResizeHandleProps } from \"./PanelResizeHandle\";\nimport type { PanelGroupStorage } from \"./types\";\n\nexport {\n // TypeScript types\n ImperativePanelGroupHandle,\n ImperativePanelHandle,\n Panel,\n PanelGroup,\n PanelGroupProps,\n PanelGroupStorage,\n PanelProps,\n PanelResizeHandle,\n PanelResizeHandleProps,\n};\n"],"names":[],"version":3,"file":"react-resizable-panels.d.ts.map"}
|
|
@@ -19,7 +19,6 @@ const { createElement: $6e687094f9ca8395$export$c8a8987d4410bf2d , createContext
|
|
|
19
19
|
const $6e687094f9ca8395$export$f680877a34711e37 = $2IMI0$react["useId".toString()];
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
const $129b5b9a317dcc10$var$canUseEffectHooks = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
24
23
|
const $129b5b9a317dcc10$var$useIsomorphicLayoutEffect = $129b5b9a317dcc10$var$canUseEffectHooks ? (0, $6e687094f9ca8395$export$e5c5a5f917a5871c) : ()=>{};
|
|
25
24
|
var $129b5b9a317dcc10$export$2e2bcd8739ae039 = $129b5b9a317dcc10$var$useIsomorphicLayoutEffect;
|
|
@@ -37,6 +36,7 @@ function $b1693d8d8f570e9c$export$2e2bcd8739ae039(idFromParams = null) {
|
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
|
|
39
|
+
|
|
40
40
|
const $b9cf028330e7f243$export$7d8c6d083caec74a = (0, $6e687094f9ca8395$export$fd42f52fd3ae1109)(null);
|
|
41
41
|
// Workaround for Parcel scope hoisting (which renames objects/functions).
|
|
42
42
|
// Casting to :any is required to avoid corrupting the generated TypeScript types.
|
|
@@ -68,37 +68,38 @@ function $45da0e827c614f1d$var$PanelWithForwardedRef({ children: children = null
|
|
|
68
68
|
defaultSize = minSize;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
const style = getPanelStyle(panelId);
|
|
72
|
+
const committedValuesRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
73
|
+
size: $45da0e827c614f1d$var$parseSizeFromStyle(style)
|
|
74
|
+
});
|
|
75
|
+
const panelDataRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
76
|
+
callbacksRef: callbacksRef,
|
|
77
|
+
collapsible: collapsible,
|
|
78
|
+
defaultSize: defaultSize,
|
|
79
|
+
id: panelId,
|
|
80
|
+
maxSize: maxSize,
|
|
81
|
+
minSize: minSize,
|
|
82
|
+
order: order
|
|
83
|
+
});
|
|
71
84
|
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
committedValuesRef.current.size = $45da0e827c614f1d$var$parseSizeFromStyle(style);
|
|
86
|
+
panelDataRef.current.callbacksRef = callbacksRef;
|
|
87
|
+
panelDataRef.current.collapsible = collapsible;
|
|
88
|
+
panelDataRef.current.defaultSize = defaultSize;
|
|
89
|
+
panelDataRef.current.id = panelId;
|
|
90
|
+
panelDataRef.current.maxSize = maxSize;
|
|
91
|
+
panelDataRef.current.minSize = minSize;
|
|
92
|
+
panelDataRef.current.order = order;
|
|
93
|
+
});
|
|
94
|
+
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
95
|
+
registerPanel(panelId, panelDataRef);
|
|
82
96
|
return ()=>{
|
|
83
97
|
unregisterPanel(panelId);
|
|
84
98
|
};
|
|
85
99
|
}, [
|
|
86
|
-
collapsible,
|
|
87
|
-
defaultSize,
|
|
88
|
-
panelId,
|
|
89
|
-
maxSize,
|
|
90
|
-
minSize,
|
|
91
|
-
order,
|
|
92
100
|
registerPanel,
|
|
93
101
|
unregisterPanel
|
|
94
102
|
]);
|
|
95
|
-
const style = getPanelStyle(panelId);
|
|
96
|
-
const committedValuesRef = (0, $6e687094f9ca8395$export$b8f5890fc79d6aca)({
|
|
97
|
-
size: $45da0e827c614f1d$var$parseSizeFromStyle(style)
|
|
98
|
-
});
|
|
99
|
-
(0, $129b5b9a317dcc10$export$2e2bcd8739ae039)(()=>{
|
|
100
|
-
committedValuesRef.current.size = $45da0e827c614f1d$var$parseSizeFromStyle(style);
|
|
101
|
-
});
|
|
102
103
|
(0, $6e687094f9ca8395$export$d5a552a76deda3c2)(forwardedRef, ()=>({
|
|
103
104
|
collapse: ()=>collapsePanel(panelId),
|
|
104
105
|
expand: ()=>expandPanel(panelId),
|
|
@@ -173,7 +174,7 @@ function $cda3cc4b1114cf23$export$f50bae335f53943c(event, panels, idBefore, idAf
|
|
|
173
174
|
// Max-bounds check the panel being expanded first.
|
|
174
175
|
{
|
|
175
176
|
const pivotId = delta < 0 ? idAfter : idBefore;
|
|
176
|
-
const index = panelsArray.findIndex((panel)=>panel.id === pivotId);
|
|
177
|
+
const index = panelsArray.findIndex((panel)=>panel.current.id === pivotId);
|
|
177
178
|
const panel = panelsArray[index];
|
|
178
179
|
const baseSize = baseSizes[index];
|
|
179
180
|
const nextSize = $cda3cc4b1114cf23$var$safeResizePanel(panel, Math.abs(delta), baseSize, event);
|
|
@@ -185,14 +186,14 @@ function $cda3cc4b1114cf23$export$f50bae335f53943c(event, panels, idBefore, idAf
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
let pivotId = delta < 0 ? idBefore : idAfter;
|
|
188
|
-
let index = panelsArray.findIndex((panel)=>panel.id === pivotId);
|
|
189
|
+
let index = panelsArray.findIndex((panel)=>panel.current.id === pivotId);
|
|
189
190
|
while(true){
|
|
190
191
|
const panel = panelsArray[index];
|
|
191
192
|
const baseSize = baseSizes[index];
|
|
192
193
|
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
193
194
|
const nextSize = $cda3cc4b1114cf23$var$safeResizePanel(panel, 0 - deltaRemaining, baseSize, event);
|
|
194
195
|
if (baseSize !== nextSize) {
|
|
195
|
-
if (nextSize === 0 && baseSize > 0) panelSizeBeforeCollapse.set(panel.id, baseSize);
|
|
196
|
+
if (nextSize === 0 && baseSize > 0) panelSizeBeforeCollapse.set(panel.current.id, baseSize);
|
|
196
197
|
deltaApplied += baseSize - nextSize;
|
|
197
198
|
nextSizes[index] = nextSize;
|
|
198
199
|
if (deltaApplied.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)).localeCompare(Math.abs(delta).toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)), undefined, {
|
|
@@ -210,7 +211,7 @@ function $cda3cc4b1114cf23$export$f50bae335f53943c(event, panels, idBefore, idAf
|
|
|
210
211
|
if (deltaApplied === 0) return baseSizes;
|
|
211
212
|
// Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.
|
|
212
213
|
pivotId = delta < 0 ? idAfter : idBefore;
|
|
213
|
-
index = panelsArray.findIndex((panel)=>panel.id === pivotId);
|
|
214
|
+
index = panelsArray.findIndex((panel)=>panel.current.id === pivotId);
|
|
214
215
|
nextSizes[index] = baseSizes[index] + deltaApplied;
|
|
215
216
|
return nextSizes;
|
|
216
217
|
}
|
|
@@ -218,7 +219,7 @@ function $cda3cc4b1114cf23$export$b8e48269e4faa934(panelsArray, prevSizes, nextS
|
|
|
218
219
|
nextSizes.forEach((nextSize, index)=>{
|
|
219
220
|
const prevSize = prevSizes[index];
|
|
220
221
|
if (prevSize !== nextSize) {
|
|
221
|
-
const { callbacksRef: callbacksRef , collapsible: collapsible } = panelsArray[index];
|
|
222
|
+
const { callbacksRef: callbacksRef , collapsible: collapsible } = panelsArray[index].current;
|
|
222
223
|
const { onCollapse: onCollapse , onResize: onResize } = callbacksRef.current;
|
|
223
224
|
if (onResize) onResize(nextSize);
|
|
224
225
|
if (collapsible && onCollapse) {
|
|
@@ -235,14 +236,14 @@ function $cda3cc4b1114cf23$export$5a5b0c1d38c23c3b(id, panelsArray) {
|
|
|
235
236
|
null,
|
|
236
237
|
null
|
|
237
238
|
];
|
|
238
|
-
const index = panelsArray.findIndex((panel)=>panel.id === id);
|
|
239
|
+
const index = panelsArray.findIndex((panel)=>panel.current.id === id);
|
|
239
240
|
if (index < 0) return [
|
|
240
241
|
null,
|
|
241
242
|
null
|
|
242
243
|
];
|
|
243
244
|
const isLastPanel = index === panelsArray.length - 1;
|
|
244
|
-
const idBefore = isLastPanel ? panelsArray[index - 1].id : id;
|
|
245
|
-
const idAfter = isLastPanel ? id : panelsArray[index + 1].id;
|
|
245
|
+
const idBefore = isLastPanel ? panelsArray[index - 1].current.id : id;
|
|
246
|
+
const idAfter = isLastPanel ? id : panelsArray[index + 1].current.id;
|
|
246
247
|
return [
|
|
247
248
|
idBefore,
|
|
248
249
|
idAfter
|
|
@@ -251,7 +252,7 @@ function $cda3cc4b1114cf23$export$5a5b0c1d38c23c3b(id, panelsArray) {
|
|
|
251
252
|
function $cda3cc4b1114cf23$export$6f43503e166de6fb(panels, id, sizes) {
|
|
252
253
|
if (panels.size === 1) return "100";
|
|
253
254
|
const panelsArray = $cda3cc4b1114cf23$export$a861c0ad45885494(panels);
|
|
254
|
-
const index = panelsArray.findIndex((panel)=>panel.id === id);
|
|
255
|
+
const index = panelsArray.findIndex((panel)=>panel.current.id === id);
|
|
255
256
|
const size = sizes[index];
|
|
256
257
|
if (size == null) return "0";
|
|
257
258
|
return size.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879));
|
|
@@ -283,14 +284,14 @@ function $cda3cc4b1114cf23$export$ae14931f0a0256a3(groupId) {
|
|
|
283
284
|
return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${groupId}"]`));
|
|
284
285
|
}
|
|
285
286
|
function $cda3cc4b1114cf23$export$68d3a33c21dfbe27(groupId, handleId, panelsArray) {
|
|
286
|
-
var _panelsArray_index, _panelsArray_;
|
|
287
|
+
var _panelsArray_index, _panelsArray_index_current, _panelsArray_, _panelsArray__current;
|
|
287
288
|
const handle = $cda3cc4b1114cf23$export$2e27d3a347680388(handleId);
|
|
288
289
|
const handles = $cda3cc4b1114cf23$export$ae14931f0a0256a3(groupId);
|
|
289
290
|
const index = handle ? handles.indexOf(handle) : -1;
|
|
290
|
-
var
|
|
291
|
-
const idBefore = (
|
|
292
|
-
var
|
|
293
|
-
const idAfter = (
|
|
291
|
+
var _panelsArray_index_current_id;
|
|
292
|
+
const idBefore = (_panelsArray_index_current_id = (_panelsArray_index = panelsArray[index]) === null || _panelsArray_index === void 0 ? void 0 : (_panelsArray_index_current = _panelsArray_index.current) === null || _panelsArray_index_current === void 0 ? void 0 : _panelsArray_index_current.id) !== null && _panelsArray_index_current_id !== void 0 ? _panelsArray_index_current_id : null;
|
|
293
|
+
var _panelsArray__current_id;
|
|
294
|
+
const idAfter = (_panelsArray__current_id = (_panelsArray_ = panelsArray[index + 1]) === null || _panelsArray_ === void 0 ? void 0 : (_panelsArray__current = _panelsArray_.current) === null || _panelsArray__current === void 0 ? void 0 : _panelsArray__current.id) !== null && _panelsArray__current_id !== void 0 ? _panelsArray__current_id : null;
|
|
294
295
|
return [
|
|
295
296
|
idBefore,
|
|
296
297
|
idAfter
|
|
@@ -298,8 +299,8 @@ function $cda3cc4b1114cf23$export$68d3a33c21dfbe27(groupId, handleId, panelsArra
|
|
|
298
299
|
}
|
|
299
300
|
function $cda3cc4b1114cf23$export$a861c0ad45885494(panels) {
|
|
300
301
|
return Array.from(panels.values()).sort((panelA, panelB)=>{
|
|
301
|
-
const orderA = panelA.order;
|
|
302
|
-
const orderB = panelB.order;
|
|
302
|
+
const orderA = panelA.current.order;
|
|
303
|
+
const orderB = panelB.current.order;
|
|
303
304
|
if (orderA == null && orderB == null) return 0;
|
|
304
305
|
else if (orderA == null) return -1;
|
|
305
306
|
else if (orderB == null) return 1;
|
|
@@ -308,7 +309,7 @@ function $cda3cc4b1114cf23$export$a861c0ad45885494(panels) {
|
|
|
308
309
|
}
|
|
309
310
|
function $cda3cc4b1114cf23$var$safeResizePanel(panel, delta, prevSize, event) {
|
|
310
311
|
const nextSizeUnsafe = prevSize + delta;
|
|
311
|
-
if (panel.collapsible) {
|
|
312
|
+
if (panel.current.collapsible) {
|
|
312
313
|
if (prevSize > 0) {
|
|
313
314
|
if (nextSizeUnsafe <= 0) return 0;
|
|
314
315
|
} else {
|
|
@@ -318,11 +319,11 @@ function $cda3cc4b1114cf23$var$safeResizePanel(panel, delta, prevSize, event) {
|
|
|
318
319
|
// Keyboard events should expand a collapsed panel to the min size,
|
|
319
320
|
// but mouse events should wait until the panel has reached its min size
|
|
320
321
|
// to avoid a visual flickering when dragging between collapsed and min size.
|
|
321
|
-
if (nextSizeUnsafe < panel.minSize) return 0;
|
|
322
|
+
if (nextSizeUnsafe < panel.current.minSize) return 0;
|
|
322
323
|
}
|
|
323
324
|
}
|
|
324
325
|
}
|
|
325
|
-
const nextSize = Math.min(panel.maxSize, Math.max(panel.minSize, nextSizeUnsafe));
|
|
326
|
+
const nextSize = Math.min(panel.current.maxSize, Math.max(panel.current.minSize, nextSizeUnsafe));
|
|
326
327
|
return nextSize;
|
|
327
328
|
}
|
|
328
329
|
|
|
@@ -352,12 +353,12 @@ function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committ
|
|
|
352
353
|
let totalMaxSize = 0;
|
|
353
354
|
// A panel's effective min/max sizes also need to account for other panel's sizes.
|
|
354
355
|
panelsArray.forEach((panelData)=>{
|
|
355
|
-
if (panelData.id === idBefore) {
|
|
356
|
-
maxSize = panelData.maxSize;
|
|
357
|
-
minSize = panelData.minSize;
|
|
356
|
+
if (panelData.current.id === idBefore) {
|
|
357
|
+
maxSize = panelData.current.maxSize;
|
|
358
|
+
minSize = panelData.current.minSize;
|
|
358
359
|
} else {
|
|
359
|
-
totalMinSize += panelData.minSize;
|
|
360
|
-
totalMaxSize += panelData.maxSize;
|
|
360
|
+
totalMinSize += panelData.current.minSize;
|
|
361
|
+
totalMaxSize += panelData.current.maxSize;
|
|
361
362
|
}
|
|
362
363
|
});
|
|
363
364
|
const ariaValueMax = Math.min(maxSize, 100 - totalMinSize);
|
|
@@ -372,13 +373,13 @@ function $a695670cc57a5969$export$d9fcbe062527d159({ committedValuesRef: committ
|
|
|
372
373
|
case "Enter":
|
|
373
374
|
{
|
|
374
375
|
event.preventDefault();
|
|
375
|
-
const index = panelsArray.findIndex((panel)=>panel.id === idBefore);
|
|
376
|
+
const index = panelsArray.findIndex((panel)=>panel.current.id === idBefore);
|
|
376
377
|
if (index >= 0) {
|
|
377
378
|
const panelData = panelsArray[index];
|
|
378
379
|
const size = sizes[index];
|
|
379
380
|
if (size != null) {
|
|
380
381
|
let delta = 0;
|
|
381
|
-
if (size.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)) <= panelData.minSize.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879))) delta = direction === "horizontal" ? width : height;
|
|
382
|
+
if (size.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)) <= panelData.current.minSize.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879))) delta = direction === "horizontal" ? width : height;
|
|
382
383
|
else delta = -(direction === "horizontal" ? width : height);
|
|
383
384
|
const nextSizes = (0, $cda3cc4b1114cf23$export$f50bae335f53943c)(event, panels, idBefore, idAfter, delta, sizes, panelSizeBeforeCollapse.current, null);
|
|
384
385
|
if (sizes !== nextSizes) setSizes(nextSizes);
|
|
@@ -518,11 +519,11 @@ function $47eee9224cfec8e8$export$354b17c0684607ed(event, groupId, handleId, pan
|
|
|
518
519
|
// If expanding from collapsed, they should snap back to their minSize.
|
|
519
520
|
const [idBefore, idAfter] = (0, $cda3cc4b1114cf23$export$68d3a33c21dfbe27)(groupId, handleId, panelsArray);
|
|
520
521
|
const targetPanelId = movement < 0 ? idBefore : idAfter;
|
|
521
|
-
const targetPanelIndex = panelsArray.findIndex((panel)=>panel.id === targetPanelId);
|
|
522
|
+
const targetPanelIndex = panelsArray.findIndex((panel)=>panel.current.id === targetPanelId);
|
|
522
523
|
const targetPanel = panelsArray[targetPanelIndex];
|
|
523
|
-
if (targetPanel.collapsible) {
|
|
524
|
+
if (targetPanel.current.collapsible) {
|
|
524
525
|
const baseSize = baseSizes[targetPanelIndex];
|
|
525
|
-
if (baseSize === 0 || baseSize.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)) === targetPanel.minSize.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879))) movement = movement < 0 ? -targetPanel.minSize * groupSizeInPixels : targetPanel.minSize * groupSizeInPixels;
|
|
526
|
+
if (baseSize === 0 || baseSize.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879)) === targetPanel.current.minSize.toPrecision((0, $9abd79656a89cd3a$export$d6d3992f3becc879))) movement = movement < 0 ? -targetPanel.current.minSize * groupSizeInPixels : targetPanel.current.minSize * groupSizeInPixels;
|
|
526
527
|
}
|
|
527
528
|
return movement;
|
|
528
529
|
} else return $47eee9224cfec8e8$export$ec391ce65b083ed4(event, handleId, direction, dragOffset, dragHandleRect);
|
|
@@ -594,7 +595,7 @@ function $2e8572579e31d898$export$2e2bcd8739ae039(callback, durationMs = 10) {
|
|
|
594
595
|
// Pre-sorting by minSize allows remembering layouts even if panels are re-ordered/dragged.
|
|
595
596
|
function $f9cb001fbb908626$var$getSerializationKey(panels) {
|
|
596
597
|
return panels.map((panel)=>{
|
|
597
|
-
const { minSize: minSize , order: order } = panel;
|
|
598
|
+
const { minSize: minSize , order: order } = panel.current;
|
|
598
599
|
return order ? `${order}:${minSize}` : `${minSize}`;
|
|
599
600
|
}).sort((a, b)=>a.localeCompare(b)).join(",");
|
|
600
601
|
}
|
|
@@ -737,15 +738,15 @@ function $cec4cafe75f3db78$var$PanelGroupWithForwardedRef({ autoSaveId: autoSave
|
|
|
737
738
|
// e.g. if Panel A has a maxSize of 40 then Panels A and B can't both have an implicit default size of 50.
|
|
738
739
|
// For now, these logic edge cases are left to the user to handle via props.
|
|
739
740
|
panelsArray.forEach((panel)=>{
|
|
740
|
-
totalMinSize += panel.minSize;
|
|
741
|
-
if (panel.defaultSize === null) panelsWithNullDefaultSize++;
|
|
742
|
-
else totalDefaultSize += panel.defaultSize;
|
|
741
|
+
totalMinSize += panel.current.minSize;
|
|
742
|
+
if (panel.current.defaultSize === null) panelsWithNullDefaultSize++;
|
|
743
|
+
else totalDefaultSize += panel.current.defaultSize;
|
|
743
744
|
});
|
|
744
745
|
if (totalDefaultSize > 100) throw new Error(`The sum of the defaultSize of all panels in a group cannot exceed 100.`);
|
|
745
746
|
else if (totalMinSize > 100) throw new Error(`The sum of the minSize of all panels in a group cannot exceed 100.`);
|
|
746
747
|
setSizes(panelsArray.map((panel)=>{
|
|
747
|
-
if (panel.defaultSize === null) return (100 - totalDefaultSize) / panelsWithNullDefaultSize;
|
|
748
|
-
return panel.defaultSize;
|
|
748
|
+
if (panel.current.defaultSize === null) return (100 - totalDefaultSize) / panelsWithNullDefaultSize;
|
|
749
|
+
return panel.current.defaultSize;
|
|
749
750
|
}));
|
|
750
751
|
}
|
|
751
752
|
}, [
|
|
@@ -796,11 +797,11 @@ function $cec4cafe75f3db78$var$PanelGroupWithForwardedRef({ autoSaveId: autoSave
|
|
|
796
797
|
disablePointerEventsDuringResize,
|
|
797
798
|
sizes
|
|
798
799
|
]);
|
|
799
|
-
const registerPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id,
|
|
800
|
+
const registerPanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id, panelRef)=>{
|
|
800
801
|
setPanels((prevPanels)=>{
|
|
801
802
|
if (prevPanels.has(id)) return prevPanels;
|
|
802
803
|
const nextPanels = new Map(prevPanels);
|
|
803
|
-
nextPanels.set(id,
|
|
804
|
+
nextPanels.set(id, panelRef);
|
|
804
805
|
return nextPanels;
|
|
805
806
|
});
|
|
806
807
|
}, []);
|
|
@@ -858,7 +859,7 @@ function $cec4cafe75f3db78$var$PanelGroupWithForwardedRef({ autoSaveId: autoSave
|
|
|
858
859
|
const collapsePanel = (0, $6e687094f9ca8395$export$35808ee640e87ca7)((id)=>{
|
|
859
860
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
860
861
|
const panel = panels.get(id);
|
|
861
|
-
if (panel == null || !panel.collapsible) return;
|
|
862
|
+
if (panel == null || !panel.current.collapsible) return;
|
|
862
863
|
const panelsArray = (0, $cda3cc4b1114cf23$export$a861c0ad45885494)(panels);
|
|
863
864
|
const index = panelsArray.indexOf(panel);
|
|
864
865
|
if (index < 0) return;
|
|
@@ -881,7 +882,7 @@ function $cec4cafe75f3db78$var$PanelGroupWithForwardedRef({ autoSaveId: autoSave
|
|
|
881
882
|
const { panels: panels , sizes: prevSizes } = committedValuesRef.current;
|
|
882
883
|
const panel = panels.get(id);
|
|
883
884
|
if (panel == null) return;
|
|
884
|
-
const sizeBeforeCollapse = panelSizeBeforeCollapse.current.get(id) || panel.minSize;
|
|
885
|
+
const sizeBeforeCollapse = panelSizeBeforeCollapse.current.get(id) || panel.current.minSize;
|
|
885
886
|
if (!sizeBeforeCollapse) return;
|
|
886
887
|
const panelsArray = (0, $cda3cc4b1114cf23$export$a861c0ad45885494)(panels);
|
|
887
888
|
const index = panelsArray.indexOf(panel);
|
|
@@ -909,8 +910,8 @@ function $cec4cafe75f3db78$var$PanelGroupWithForwardedRef({ autoSaveId: autoSave
|
|
|
909
910
|
if (index < 0) return;
|
|
910
911
|
const currentSize = prevSizes[index];
|
|
911
912
|
if (currentSize === nextSize) return;
|
|
912
|
-
if (panel.collapsible && nextSize === 0) ;
|
|
913
|
-
else nextSize = Math.min(panel.maxSize, Math.max(panel.minSize, nextSize));
|
|
913
|
+
if (panel.current.collapsible && nextSize === 0) ;
|
|
914
|
+
else nextSize = Math.min(panel.current.maxSize, Math.max(panel.current.minSize, nextSize));
|
|
914
915
|
const [idBefore, idAfter] = (0, $cda3cc4b1114cf23$export$5a5b0c1d38c23c3b)(id, panelsArray);
|
|
915
916
|
if (idBefore == null || idAfter == null) return;
|
|
916
917
|
const isLastPanel = index === panelsArray.length - 1;
|