react-resizable-panels 2.0.17 → 2.0.19
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/Panel.d.ts +1 -1
- package/dist/react-resizable-panels.browser.cjs.js +14 -10
- package/dist/react-resizable-panels.browser.development.cjs.js +14 -10
- package/dist/react-resizable-panels.browser.development.esm.js +14 -10
- package/dist/react-resizable-panels.browser.esm.js +14 -10
- package/dist/react-resizable-panels.cjs.js +14 -10
- package/dist/react-resizable-panels.development.cjs.js +14 -10
- package/dist/react-resizable-panels.development.esm.js +14 -10
- package/dist/react-resizable-panels.development.node.cjs.js +14 -10
- package/dist/react-resizable-panels.development.node.esm.js +14 -10
- package/dist/react-resizable-panels.esm.js +14 -10
- package/dist/react-resizable-panels.node.cjs.js +14 -10
- package/dist/react-resizable-panels.node.esm.js +14 -10
- package/package.json +1 -1
- package/src/Panel.test.tsx +105 -0
- package/src/Panel.ts +3 -3
- package/src/PanelGroup.ts +54 -47
- package/src/PanelGroupContext.ts +1 -1
- package/src/PanelResizeHandle.ts +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.19
|
|
4
|
+
|
|
5
|
+
- Add optional `minSize` override param to panel `expand` imperative API
|
|
6
|
+
|
|
7
|
+
## 2.0.18
|
|
8
|
+
|
|
9
|
+
- Inline object `hitAreaMargins` will not trigger re-initialization logic unless inner values change (#342)
|
|
10
|
+
|
|
3
11
|
## 2.0.17
|
|
4
12
|
|
|
5
13
|
- Prevent pointer events handled by resize handles from triggering elements behind/underneath (#338)
|
|
@@ -157,8 +157,8 @@ function PanelWithForwardedRef({
|
|
|
157
157
|
collapse: () => {
|
|
158
158
|
collapsePanel(panelDataRef.current);
|
|
159
159
|
},
|
|
160
|
-
expand:
|
|
161
|
-
expandPanel(panelDataRef.current);
|
|
160
|
+
expand: minSize => {
|
|
161
|
+
expandPanel(panelDataRef.current, minSize);
|
|
162
162
|
},
|
|
163
163
|
getId() {
|
|
164
164
|
return panelId;
|
|
@@ -1722,7 +1722,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1722
1722
|
}, []);
|
|
1723
1723
|
|
|
1724
1724
|
// External APIs are safe to memoize via committed values ref
|
|
1725
|
-
const expandPanel = useCallback(panelData => {
|
|
1725
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1726
1726
|
const {
|
|
1727
1727
|
onLayout
|
|
1728
1728
|
} = committedValuesRef.current;
|
|
@@ -1735,9 +1735,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1735
1735
|
const {
|
|
1736
1736
|
collapsedSize = 0,
|
|
1737
1737
|
panelSize = 0,
|
|
1738
|
-
minSize = 0,
|
|
1738
|
+
minSize: minSizeFromProps = 0,
|
|
1739
1739
|
pivotIndices
|
|
1740
1740
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1741
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1741
1742
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1742
1743
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1743
1744
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2208,6 +2209,7 @@ function PanelResizeHandle({
|
|
|
2208
2209
|
tagName: Type = "div",
|
|
2209
2210
|
...rest
|
|
2210
2211
|
}) {
|
|
2212
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2211
2213
|
const elementRef = useRef(null);
|
|
2212
2214
|
|
|
2213
2215
|
// Use a ref to guard against users passing inline props
|
|
@@ -2247,8 +2249,12 @@ function PanelResizeHandle({
|
|
|
2247
2249
|
setResizeHandler(() => resizeHandler);
|
|
2248
2250
|
}
|
|
2249
2251
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2252
|
+
|
|
2253
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2254
|
+
// so that inline object values won't trigger re-renders
|
|
2255
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2256
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2250
2257
|
useEffect(() => {
|
|
2251
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2252
2258
|
if (disabled || resizeHandler == null) {
|
|
2253
2259
|
return;
|
|
2254
2260
|
}
|
|
@@ -2298,12 +2304,10 @@ function PanelResizeHandle({
|
|
|
2298
2304
|
}
|
|
2299
2305
|
};
|
|
2300
2306
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
// Fine inputs (e.g. mouse)
|
|
2304
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2307
|
+
coarse: coarseHitAreaMargins,
|
|
2308
|
+
fine: fineHitAreaMargins
|
|
2305
2309
|
}, setResizeHandlerState);
|
|
2306
|
-
}, [direction, disabled,
|
|
2310
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2307
2311
|
useWindowSplitterResizeHandlerBehavior({
|
|
2308
2312
|
disabled,
|
|
2309
2313
|
handleId: resizeHandleId,
|
|
@@ -163,8 +163,8 @@ function PanelWithForwardedRef({
|
|
|
163
163
|
collapse: () => {
|
|
164
164
|
collapsePanel(panelDataRef.current);
|
|
165
165
|
},
|
|
166
|
-
expand:
|
|
167
|
-
expandPanel(panelDataRef.current);
|
|
166
|
+
expand: minSize => {
|
|
167
|
+
expandPanel(panelDataRef.current, minSize);
|
|
168
168
|
},
|
|
169
169
|
getId() {
|
|
170
170
|
return panelId;
|
|
@@ -1828,7 +1828,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1828
1828
|
}, []);
|
|
1829
1829
|
|
|
1830
1830
|
// External APIs are safe to memoize via committed values ref
|
|
1831
|
-
const expandPanel = useCallback(panelData => {
|
|
1831
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1832
1832
|
const {
|
|
1833
1833
|
onLayout
|
|
1834
1834
|
} = committedValuesRef.current;
|
|
@@ -1841,9 +1841,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1841
1841
|
const {
|
|
1842
1842
|
collapsedSize = 0,
|
|
1843
1843
|
panelSize = 0,
|
|
1844
|
-
minSize = 0,
|
|
1844
|
+
minSize: minSizeFromProps = 0,
|
|
1845
1845
|
pivotIndices
|
|
1846
1846
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1847
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1847
1848
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1848
1849
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1849
1850
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2314,6 +2315,7 @@ function PanelResizeHandle({
|
|
|
2314
2315
|
tagName: Type = "div",
|
|
2315
2316
|
...rest
|
|
2316
2317
|
}) {
|
|
2318
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2317
2319
|
const elementRef = useRef(null);
|
|
2318
2320
|
|
|
2319
2321
|
// Use a ref to guard against users passing inline props
|
|
@@ -2353,8 +2355,12 @@ function PanelResizeHandle({
|
|
|
2353
2355
|
setResizeHandler(() => resizeHandler);
|
|
2354
2356
|
}
|
|
2355
2357
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2358
|
+
|
|
2359
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2360
|
+
// so that inline object values won't trigger re-renders
|
|
2361
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2362
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2356
2363
|
useEffect(() => {
|
|
2357
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2358
2364
|
if (disabled || resizeHandler == null) {
|
|
2359
2365
|
return;
|
|
2360
2366
|
}
|
|
@@ -2404,12 +2410,10 @@ function PanelResizeHandle({
|
|
|
2404
2410
|
}
|
|
2405
2411
|
};
|
|
2406
2412
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
// Fine inputs (e.g. mouse)
|
|
2410
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2413
|
+
coarse: coarseHitAreaMargins,
|
|
2414
|
+
fine: fineHitAreaMargins
|
|
2411
2415
|
}, setResizeHandlerState);
|
|
2412
|
-
}, [direction, disabled,
|
|
2416
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2413
2417
|
useWindowSplitterResizeHandlerBehavior({
|
|
2414
2418
|
disabled,
|
|
2415
2419
|
handleId: resizeHandleId,
|
|
@@ -139,8 +139,8 @@ function PanelWithForwardedRef({
|
|
|
139
139
|
collapse: () => {
|
|
140
140
|
collapsePanel(panelDataRef.current);
|
|
141
141
|
},
|
|
142
|
-
expand:
|
|
143
|
-
expandPanel(panelDataRef.current);
|
|
142
|
+
expand: minSize => {
|
|
143
|
+
expandPanel(panelDataRef.current, minSize);
|
|
144
144
|
},
|
|
145
145
|
getId() {
|
|
146
146
|
return panelId;
|
|
@@ -1804,7 +1804,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1804
1804
|
}, []);
|
|
1805
1805
|
|
|
1806
1806
|
// External APIs are safe to memoize via committed values ref
|
|
1807
|
-
const expandPanel = useCallback(panelData => {
|
|
1807
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1808
1808
|
const {
|
|
1809
1809
|
onLayout
|
|
1810
1810
|
} = committedValuesRef.current;
|
|
@@ -1817,9 +1817,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1817
1817
|
const {
|
|
1818
1818
|
collapsedSize = 0,
|
|
1819
1819
|
panelSize = 0,
|
|
1820
|
-
minSize = 0,
|
|
1820
|
+
minSize: minSizeFromProps = 0,
|
|
1821
1821
|
pivotIndices
|
|
1822
1822
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1823
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1823
1824
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1824
1825
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1825
1826
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2290,6 +2291,7 @@ function PanelResizeHandle({
|
|
|
2290
2291
|
tagName: Type = "div",
|
|
2291
2292
|
...rest
|
|
2292
2293
|
}) {
|
|
2294
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2293
2295
|
const elementRef = useRef(null);
|
|
2294
2296
|
|
|
2295
2297
|
// Use a ref to guard against users passing inline props
|
|
@@ -2329,8 +2331,12 @@ function PanelResizeHandle({
|
|
|
2329
2331
|
setResizeHandler(() => resizeHandler);
|
|
2330
2332
|
}
|
|
2331
2333
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2334
|
+
|
|
2335
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2336
|
+
// so that inline object values won't trigger re-renders
|
|
2337
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2338
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2332
2339
|
useEffect(() => {
|
|
2333
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2334
2340
|
if (disabled || resizeHandler == null) {
|
|
2335
2341
|
return;
|
|
2336
2342
|
}
|
|
@@ -2380,12 +2386,10 @@ function PanelResizeHandle({
|
|
|
2380
2386
|
}
|
|
2381
2387
|
};
|
|
2382
2388
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
// Fine inputs (e.g. mouse)
|
|
2386
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2389
|
+
coarse: coarseHitAreaMargins,
|
|
2390
|
+
fine: fineHitAreaMargins
|
|
2387
2391
|
}, setResizeHandlerState);
|
|
2388
|
-
}, [direction, disabled,
|
|
2392
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2389
2393
|
useWindowSplitterResizeHandlerBehavior({
|
|
2390
2394
|
disabled,
|
|
2391
2395
|
handleId: resizeHandleId,
|
|
@@ -133,8 +133,8 @@ function PanelWithForwardedRef({
|
|
|
133
133
|
collapse: () => {
|
|
134
134
|
collapsePanel(panelDataRef.current);
|
|
135
135
|
},
|
|
136
|
-
expand:
|
|
137
|
-
expandPanel(panelDataRef.current);
|
|
136
|
+
expand: minSize => {
|
|
137
|
+
expandPanel(panelDataRef.current, minSize);
|
|
138
138
|
},
|
|
139
139
|
getId() {
|
|
140
140
|
return panelId;
|
|
@@ -1698,7 +1698,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1698
1698
|
}, []);
|
|
1699
1699
|
|
|
1700
1700
|
// External APIs are safe to memoize via committed values ref
|
|
1701
|
-
const expandPanel = useCallback(panelData => {
|
|
1701
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1702
1702
|
const {
|
|
1703
1703
|
onLayout
|
|
1704
1704
|
} = committedValuesRef.current;
|
|
@@ -1711,9 +1711,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1711
1711
|
const {
|
|
1712
1712
|
collapsedSize = 0,
|
|
1713
1713
|
panelSize = 0,
|
|
1714
|
-
minSize = 0,
|
|
1714
|
+
minSize: minSizeFromProps = 0,
|
|
1715
1715
|
pivotIndices
|
|
1716
1716
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1717
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1717
1718
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1718
1719
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1719
1720
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2184,6 +2185,7 @@ function PanelResizeHandle({
|
|
|
2184
2185
|
tagName: Type = "div",
|
|
2185
2186
|
...rest
|
|
2186
2187
|
}) {
|
|
2188
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2187
2189
|
const elementRef = useRef(null);
|
|
2188
2190
|
|
|
2189
2191
|
// Use a ref to guard against users passing inline props
|
|
@@ -2223,8 +2225,12 @@ function PanelResizeHandle({
|
|
|
2223
2225
|
setResizeHandler(() => resizeHandler);
|
|
2224
2226
|
}
|
|
2225
2227
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2228
|
+
|
|
2229
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2230
|
+
// so that inline object values won't trigger re-renders
|
|
2231
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2232
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2226
2233
|
useEffect(() => {
|
|
2227
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2228
2234
|
if (disabled || resizeHandler == null) {
|
|
2229
2235
|
return;
|
|
2230
2236
|
}
|
|
@@ -2274,12 +2280,10 @@ function PanelResizeHandle({
|
|
|
2274
2280
|
}
|
|
2275
2281
|
};
|
|
2276
2282
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
// Fine inputs (e.g. mouse)
|
|
2280
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2283
|
+
coarse: coarseHitAreaMargins,
|
|
2284
|
+
fine: fineHitAreaMargins
|
|
2281
2285
|
}, setResizeHandlerState);
|
|
2282
|
-
}, [direction, disabled,
|
|
2286
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2283
2287
|
useWindowSplitterResizeHandlerBehavior({
|
|
2284
2288
|
disabled,
|
|
2285
2289
|
handleId: resizeHandleId,
|
|
@@ -159,8 +159,8 @@ function PanelWithForwardedRef({
|
|
|
159
159
|
collapse: () => {
|
|
160
160
|
collapsePanel(panelDataRef.current);
|
|
161
161
|
},
|
|
162
|
-
expand:
|
|
163
|
-
expandPanel(panelDataRef.current);
|
|
162
|
+
expand: minSize => {
|
|
163
|
+
expandPanel(panelDataRef.current, minSize);
|
|
164
164
|
},
|
|
165
165
|
getId() {
|
|
166
166
|
return panelId;
|
|
@@ -1724,7 +1724,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1724
1724
|
}, []);
|
|
1725
1725
|
|
|
1726
1726
|
// External APIs are safe to memoize via committed values ref
|
|
1727
|
-
const expandPanel = useCallback(panelData => {
|
|
1727
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1728
1728
|
const {
|
|
1729
1729
|
onLayout
|
|
1730
1730
|
} = committedValuesRef.current;
|
|
@@ -1737,9 +1737,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1737
1737
|
const {
|
|
1738
1738
|
collapsedSize = 0,
|
|
1739
1739
|
panelSize = 0,
|
|
1740
|
-
minSize = 0,
|
|
1740
|
+
minSize: minSizeFromProps = 0,
|
|
1741
1741
|
pivotIndices
|
|
1742
1742
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1743
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1743
1744
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1744
1745
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1745
1746
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2210,6 +2211,7 @@ function PanelResizeHandle({
|
|
|
2210
2211
|
tagName: Type = "div",
|
|
2211
2212
|
...rest
|
|
2212
2213
|
}) {
|
|
2214
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2213
2215
|
const elementRef = useRef(null);
|
|
2214
2216
|
|
|
2215
2217
|
// Use a ref to guard against users passing inline props
|
|
@@ -2249,8 +2251,12 @@ function PanelResizeHandle({
|
|
|
2249
2251
|
setResizeHandler(() => resizeHandler);
|
|
2250
2252
|
}
|
|
2251
2253
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2254
|
+
|
|
2255
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2256
|
+
// so that inline object values won't trigger re-renders
|
|
2257
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2258
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2252
2259
|
useEffect(() => {
|
|
2253
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2254
2260
|
if (disabled || resizeHandler == null) {
|
|
2255
2261
|
return;
|
|
2256
2262
|
}
|
|
@@ -2300,12 +2306,10 @@ function PanelResizeHandle({
|
|
|
2300
2306
|
}
|
|
2301
2307
|
};
|
|
2302
2308
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
// Fine inputs (e.g. mouse)
|
|
2306
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2309
|
+
coarse: coarseHitAreaMargins,
|
|
2310
|
+
fine: fineHitAreaMargins
|
|
2307
2311
|
}, setResizeHandlerState);
|
|
2308
|
-
}, [direction, disabled,
|
|
2312
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2309
2313
|
useWindowSplitterResizeHandlerBehavior({
|
|
2310
2314
|
disabled,
|
|
2311
2315
|
handleId: resizeHandleId,
|
|
@@ -170,8 +170,8 @@ function PanelWithForwardedRef({
|
|
|
170
170
|
collapse: () => {
|
|
171
171
|
collapsePanel(panelDataRef.current);
|
|
172
172
|
},
|
|
173
|
-
expand:
|
|
174
|
-
expandPanel(panelDataRef.current);
|
|
173
|
+
expand: minSize => {
|
|
174
|
+
expandPanel(panelDataRef.current, minSize);
|
|
175
175
|
},
|
|
176
176
|
getId() {
|
|
177
177
|
return panelId;
|
|
@@ -1835,7 +1835,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1835
1835
|
}, []);
|
|
1836
1836
|
|
|
1837
1837
|
// External APIs are safe to memoize via committed values ref
|
|
1838
|
-
const expandPanel = useCallback(panelData => {
|
|
1838
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1839
1839
|
const {
|
|
1840
1840
|
onLayout
|
|
1841
1841
|
} = committedValuesRef.current;
|
|
@@ -1848,9 +1848,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1848
1848
|
const {
|
|
1849
1849
|
collapsedSize = 0,
|
|
1850
1850
|
panelSize = 0,
|
|
1851
|
-
minSize = 0,
|
|
1851
|
+
minSize: minSizeFromProps = 0,
|
|
1852
1852
|
pivotIndices
|
|
1853
1853
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1854
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1854
1855
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1855
1856
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1856
1857
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2321,6 +2322,7 @@ function PanelResizeHandle({
|
|
|
2321
2322
|
tagName: Type = "div",
|
|
2322
2323
|
...rest
|
|
2323
2324
|
}) {
|
|
2325
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2324
2326
|
const elementRef = useRef(null);
|
|
2325
2327
|
|
|
2326
2328
|
// Use a ref to guard against users passing inline props
|
|
@@ -2360,8 +2362,12 @@ function PanelResizeHandle({
|
|
|
2360
2362
|
setResizeHandler(() => resizeHandler);
|
|
2361
2363
|
}
|
|
2362
2364
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2365
|
+
|
|
2366
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2367
|
+
// so that inline object values won't trigger re-renders
|
|
2368
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2369
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2363
2370
|
useEffect(() => {
|
|
2364
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2365
2371
|
if (disabled || resizeHandler == null) {
|
|
2366
2372
|
return;
|
|
2367
2373
|
}
|
|
@@ -2411,12 +2417,10 @@ function PanelResizeHandle({
|
|
|
2411
2417
|
}
|
|
2412
2418
|
};
|
|
2413
2419
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
// Fine inputs (e.g. mouse)
|
|
2417
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2420
|
+
coarse: coarseHitAreaMargins,
|
|
2421
|
+
fine: fineHitAreaMargins
|
|
2418
2422
|
}, setResizeHandlerState);
|
|
2419
|
-
}, [direction, disabled,
|
|
2423
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2420
2424
|
useWindowSplitterResizeHandlerBehavior({
|
|
2421
2425
|
disabled,
|
|
2422
2426
|
handleId: resizeHandleId,
|
|
@@ -146,8 +146,8 @@ function PanelWithForwardedRef({
|
|
|
146
146
|
collapse: () => {
|
|
147
147
|
collapsePanel(panelDataRef.current);
|
|
148
148
|
},
|
|
149
|
-
expand:
|
|
150
|
-
expandPanel(panelDataRef.current);
|
|
149
|
+
expand: minSize => {
|
|
150
|
+
expandPanel(panelDataRef.current, minSize);
|
|
151
151
|
},
|
|
152
152
|
getId() {
|
|
153
153
|
return panelId;
|
|
@@ -1811,7 +1811,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1811
1811
|
}, []);
|
|
1812
1812
|
|
|
1813
1813
|
// External APIs are safe to memoize via committed values ref
|
|
1814
|
-
const expandPanel = useCallback(panelData => {
|
|
1814
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1815
1815
|
const {
|
|
1816
1816
|
onLayout
|
|
1817
1817
|
} = committedValuesRef.current;
|
|
@@ -1824,9 +1824,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1824
1824
|
const {
|
|
1825
1825
|
collapsedSize = 0,
|
|
1826
1826
|
panelSize = 0,
|
|
1827
|
-
minSize = 0,
|
|
1827
|
+
minSize: minSizeFromProps = 0,
|
|
1828
1828
|
pivotIndices
|
|
1829
1829
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1830
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1830
1831
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1831
1832
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1832
1833
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2297,6 +2298,7 @@ function PanelResizeHandle({
|
|
|
2297
2298
|
tagName: Type = "div",
|
|
2298
2299
|
...rest
|
|
2299
2300
|
}) {
|
|
2301
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2300
2302
|
const elementRef = useRef(null);
|
|
2301
2303
|
|
|
2302
2304
|
// Use a ref to guard against users passing inline props
|
|
@@ -2336,8 +2338,12 @@ function PanelResizeHandle({
|
|
|
2336
2338
|
setResizeHandler(() => resizeHandler);
|
|
2337
2339
|
}
|
|
2338
2340
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2341
|
+
|
|
2342
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2343
|
+
// so that inline object values won't trigger re-renders
|
|
2344
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2345
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2339
2346
|
useEffect(() => {
|
|
2340
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2341
2347
|
if (disabled || resizeHandler == null) {
|
|
2342
2348
|
return;
|
|
2343
2349
|
}
|
|
@@ -2387,12 +2393,10 @@ function PanelResizeHandle({
|
|
|
2387
2393
|
}
|
|
2388
2394
|
};
|
|
2389
2395
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
// Fine inputs (e.g. mouse)
|
|
2393
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2396
|
+
coarse: coarseHitAreaMargins,
|
|
2397
|
+
fine: fineHitAreaMargins
|
|
2394
2398
|
}, setResizeHandlerState);
|
|
2395
|
-
}, [direction, disabled,
|
|
2399
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2396
2400
|
useWindowSplitterResizeHandlerBehavior({
|
|
2397
2401
|
disabled,
|
|
2398
2402
|
handleId: resizeHandleId,
|
|
@@ -132,8 +132,8 @@ function PanelWithForwardedRef({
|
|
|
132
132
|
collapse: () => {
|
|
133
133
|
collapsePanel(panelDataRef.current);
|
|
134
134
|
},
|
|
135
|
-
expand:
|
|
136
|
-
expandPanel(panelDataRef.current);
|
|
135
|
+
expand: minSize => {
|
|
136
|
+
expandPanel(panelDataRef.current, minSize);
|
|
137
137
|
},
|
|
138
138
|
getId() {
|
|
139
139
|
return panelId;
|
|
@@ -1659,7 +1659,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1659
1659
|
}, []);
|
|
1660
1660
|
|
|
1661
1661
|
// External APIs are safe to memoize via committed values ref
|
|
1662
|
-
const expandPanel = useCallback(panelData => {
|
|
1662
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1663
1663
|
const {
|
|
1664
1664
|
onLayout
|
|
1665
1665
|
} = committedValuesRef.current;
|
|
@@ -1672,9 +1672,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1672
1672
|
const {
|
|
1673
1673
|
collapsedSize = 0,
|
|
1674
1674
|
panelSize = 0,
|
|
1675
|
-
minSize = 0,
|
|
1675
|
+
minSize: minSizeFromProps = 0,
|
|
1676
1676
|
pivotIndices
|
|
1677
1677
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1678
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1678
1679
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1679
1680
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1680
1681
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2089,6 +2090,7 @@ function PanelResizeHandle({
|
|
|
2089
2090
|
tagName: Type = "div",
|
|
2090
2091
|
...rest
|
|
2091
2092
|
}) {
|
|
2093
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2092
2094
|
const elementRef = useRef(null);
|
|
2093
2095
|
|
|
2094
2096
|
// Use a ref to guard against users passing inline props
|
|
@@ -2125,8 +2127,12 @@ function PanelResizeHandle({
|
|
|
2125
2127
|
setResizeHandler(() => resizeHandler);
|
|
2126
2128
|
}
|
|
2127
2129
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2130
|
+
|
|
2131
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2132
|
+
// so that inline object values won't trigger re-renders
|
|
2133
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2134
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2128
2135
|
useEffect(() => {
|
|
2129
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2130
2136
|
if (disabled || resizeHandler == null) {
|
|
2131
2137
|
return;
|
|
2132
2138
|
}
|
|
@@ -2176,12 +2182,10 @@ function PanelResizeHandle({
|
|
|
2176
2182
|
}
|
|
2177
2183
|
};
|
|
2178
2184
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
// Fine inputs (e.g. mouse)
|
|
2182
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2185
|
+
coarse: coarseHitAreaMargins,
|
|
2186
|
+
fine: fineHitAreaMargins
|
|
2183
2187
|
}, setResizeHandlerState);
|
|
2184
|
-
}, [direction, disabled,
|
|
2188
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2185
2189
|
useWindowSplitterResizeHandlerBehavior({
|
|
2186
2190
|
disabled,
|
|
2187
2191
|
handleId: resizeHandleId,
|
|
@@ -108,8 +108,8 @@ function PanelWithForwardedRef({
|
|
|
108
108
|
collapse: () => {
|
|
109
109
|
collapsePanel(panelDataRef.current);
|
|
110
110
|
},
|
|
111
|
-
expand:
|
|
112
|
-
expandPanel(panelDataRef.current);
|
|
111
|
+
expand: minSize => {
|
|
112
|
+
expandPanel(panelDataRef.current, minSize);
|
|
113
113
|
},
|
|
114
114
|
getId() {
|
|
115
115
|
return panelId;
|
|
@@ -1635,7 +1635,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1635
1635
|
}, []);
|
|
1636
1636
|
|
|
1637
1637
|
// External APIs are safe to memoize via committed values ref
|
|
1638
|
-
const expandPanel = useCallback(panelData => {
|
|
1638
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1639
1639
|
const {
|
|
1640
1640
|
onLayout
|
|
1641
1641
|
} = committedValuesRef.current;
|
|
@@ -1648,9 +1648,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1648
1648
|
const {
|
|
1649
1649
|
collapsedSize = 0,
|
|
1650
1650
|
panelSize = 0,
|
|
1651
|
-
minSize = 0,
|
|
1651
|
+
minSize: minSizeFromProps = 0,
|
|
1652
1652
|
pivotIndices
|
|
1653
1653
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1654
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1654
1655
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1655
1656
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1656
1657
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2065,6 +2066,7 @@ function PanelResizeHandle({
|
|
|
2065
2066
|
tagName: Type = "div",
|
|
2066
2067
|
...rest
|
|
2067
2068
|
}) {
|
|
2069
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2068
2070
|
const elementRef = useRef(null);
|
|
2069
2071
|
|
|
2070
2072
|
// Use a ref to guard against users passing inline props
|
|
@@ -2101,8 +2103,12 @@ function PanelResizeHandle({
|
|
|
2101
2103
|
setResizeHandler(() => resizeHandler);
|
|
2102
2104
|
}
|
|
2103
2105
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2106
|
+
|
|
2107
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2108
|
+
// so that inline object values won't trigger re-renders
|
|
2109
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2110
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2104
2111
|
useEffect(() => {
|
|
2105
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2106
2112
|
if (disabled || resizeHandler == null) {
|
|
2107
2113
|
return;
|
|
2108
2114
|
}
|
|
@@ -2152,12 +2158,10 @@ function PanelResizeHandle({
|
|
|
2152
2158
|
}
|
|
2153
2159
|
};
|
|
2154
2160
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
// Fine inputs (e.g. mouse)
|
|
2158
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2161
|
+
coarse: coarseHitAreaMargins,
|
|
2162
|
+
fine: fineHitAreaMargins
|
|
2159
2163
|
}, setResizeHandlerState);
|
|
2160
|
-
}, [direction, disabled,
|
|
2164
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2161
2165
|
useWindowSplitterResizeHandlerBehavior({
|
|
2162
2166
|
disabled,
|
|
2163
2167
|
handleId: resizeHandleId,
|
|
@@ -135,8 +135,8 @@ function PanelWithForwardedRef({
|
|
|
135
135
|
collapse: () => {
|
|
136
136
|
collapsePanel(panelDataRef.current);
|
|
137
137
|
},
|
|
138
|
-
expand:
|
|
139
|
-
expandPanel(panelDataRef.current);
|
|
138
|
+
expand: minSize => {
|
|
139
|
+
expandPanel(panelDataRef.current, minSize);
|
|
140
140
|
},
|
|
141
141
|
getId() {
|
|
142
142
|
return panelId;
|
|
@@ -1700,7 +1700,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1700
1700
|
}, []);
|
|
1701
1701
|
|
|
1702
1702
|
// External APIs are safe to memoize via committed values ref
|
|
1703
|
-
const expandPanel = useCallback(panelData => {
|
|
1703
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1704
1704
|
const {
|
|
1705
1705
|
onLayout
|
|
1706
1706
|
} = committedValuesRef.current;
|
|
@@ -1713,9 +1713,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1713
1713
|
const {
|
|
1714
1714
|
collapsedSize = 0,
|
|
1715
1715
|
panelSize = 0,
|
|
1716
|
-
minSize = 0,
|
|
1716
|
+
minSize: minSizeFromProps = 0,
|
|
1717
1717
|
pivotIndices
|
|
1718
1718
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1719
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1719
1720
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1720
1721
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1721
1722
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2186,6 +2187,7 @@ function PanelResizeHandle({
|
|
|
2186
2187
|
tagName: Type = "div",
|
|
2187
2188
|
...rest
|
|
2188
2189
|
}) {
|
|
2190
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2189
2191
|
const elementRef = useRef(null);
|
|
2190
2192
|
|
|
2191
2193
|
// Use a ref to guard against users passing inline props
|
|
@@ -2225,8 +2227,12 @@ function PanelResizeHandle({
|
|
|
2225
2227
|
setResizeHandler(() => resizeHandler);
|
|
2226
2228
|
}
|
|
2227
2229
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2230
|
+
|
|
2231
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2232
|
+
// so that inline object values won't trigger re-renders
|
|
2233
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2234
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2228
2235
|
useEffect(() => {
|
|
2229
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2230
2236
|
if (disabled || resizeHandler == null) {
|
|
2231
2237
|
return;
|
|
2232
2238
|
}
|
|
@@ -2276,12 +2282,10 @@ function PanelResizeHandle({
|
|
|
2276
2282
|
}
|
|
2277
2283
|
};
|
|
2278
2284
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
// Fine inputs (e.g. mouse)
|
|
2282
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2285
|
+
coarse: coarseHitAreaMargins,
|
|
2286
|
+
fine: fineHitAreaMargins
|
|
2283
2287
|
}, setResizeHandlerState);
|
|
2284
|
-
}, [direction, disabled,
|
|
2288
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2285
2289
|
useWindowSplitterResizeHandlerBehavior({
|
|
2286
2290
|
disabled,
|
|
2287
2291
|
handleId: resizeHandleId,
|
|
@@ -121,8 +121,8 @@ function PanelWithForwardedRef({
|
|
|
121
121
|
collapse: () => {
|
|
122
122
|
collapsePanel(panelDataRef.current);
|
|
123
123
|
},
|
|
124
|
-
expand:
|
|
125
|
-
expandPanel(panelDataRef.current);
|
|
124
|
+
expand: minSize => {
|
|
125
|
+
expandPanel(panelDataRef.current, minSize);
|
|
126
126
|
},
|
|
127
127
|
getId() {
|
|
128
128
|
return panelId;
|
|
@@ -1558,7 +1558,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1558
1558
|
}, []);
|
|
1559
1559
|
|
|
1560
1560
|
// External APIs are safe to memoize via committed values ref
|
|
1561
|
-
const expandPanel = useCallback(panelData => {
|
|
1561
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1562
1562
|
const {
|
|
1563
1563
|
onLayout
|
|
1564
1564
|
} = committedValuesRef.current;
|
|
@@ -1571,9 +1571,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1571
1571
|
const {
|
|
1572
1572
|
collapsedSize = 0,
|
|
1573
1573
|
panelSize = 0,
|
|
1574
|
-
minSize = 0,
|
|
1574
|
+
minSize: minSizeFromProps = 0,
|
|
1575
1575
|
pivotIndices
|
|
1576
1576
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1577
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1577
1578
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1578
1579
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1579
1580
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -1988,6 +1989,7 @@ function PanelResizeHandle({
|
|
|
1988
1989
|
tagName: Type = "div",
|
|
1989
1990
|
...rest
|
|
1990
1991
|
}) {
|
|
1992
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
1991
1993
|
const elementRef = useRef(null);
|
|
1992
1994
|
|
|
1993
1995
|
// Use a ref to guard against users passing inline props
|
|
@@ -2024,8 +2026,12 @@ function PanelResizeHandle({
|
|
|
2024
2026
|
setResizeHandler(() => resizeHandler);
|
|
2025
2027
|
}
|
|
2026
2028
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2029
|
+
|
|
2030
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2031
|
+
// so that inline object values won't trigger re-renders
|
|
2032
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2033
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2027
2034
|
useEffect(() => {
|
|
2028
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2029
2035
|
if (disabled || resizeHandler == null) {
|
|
2030
2036
|
return;
|
|
2031
2037
|
}
|
|
@@ -2075,12 +2081,10 @@ function PanelResizeHandle({
|
|
|
2075
2081
|
}
|
|
2076
2082
|
};
|
|
2077
2083
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
// Fine inputs (e.g. mouse)
|
|
2081
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2084
|
+
coarse: coarseHitAreaMargins,
|
|
2085
|
+
fine: fineHitAreaMargins
|
|
2082
2086
|
}, setResizeHandlerState);
|
|
2083
|
-
}, [direction, disabled,
|
|
2087
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2084
2088
|
useWindowSplitterResizeHandlerBehavior({
|
|
2085
2089
|
disabled,
|
|
2086
2090
|
handleId: resizeHandleId,
|
|
@@ -97,8 +97,8 @@ function PanelWithForwardedRef({
|
|
|
97
97
|
collapse: () => {
|
|
98
98
|
collapsePanel(panelDataRef.current);
|
|
99
99
|
},
|
|
100
|
-
expand:
|
|
101
|
-
expandPanel(panelDataRef.current);
|
|
100
|
+
expand: minSize => {
|
|
101
|
+
expandPanel(panelDataRef.current, minSize);
|
|
102
102
|
},
|
|
103
103
|
getId() {
|
|
104
104
|
return panelId;
|
|
@@ -1534,7 +1534,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1534
1534
|
}, []);
|
|
1535
1535
|
|
|
1536
1536
|
// External APIs are safe to memoize via committed values ref
|
|
1537
|
-
const expandPanel = useCallback(panelData => {
|
|
1537
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1538
1538
|
const {
|
|
1539
1539
|
onLayout
|
|
1540
1540
|
} = committedValuesRef.current;
|
|
@@ -1547,9 +1547,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1547
1547
|
const {
|
|
1548
1548
|
collapsedSize = 0,
|
|
1549
1549
|
panelSize = 0,
|
|
1550
|
-
minSize = 0,
|
|
1550
|
+
minSize: minSizeFromProps = 0,
|
|
1551
1551
|
pivotIndices
|
|
1552
1552
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1553
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1553
1554
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1554
1555
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1555
1556
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -1964,6 +1965,7 @@ function PanelResizeHandle({
|
|
|
1964
1965
|
tagName: Type = "div",
|
|
1965
1966
|
...rest
|
|
1966
1967
|
}) {
|
|
1968
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
1967
1969
|
const elementRef = useRef(null);
|
|
1968
1970
|
|
|
1969
1971
|
// Use a ref to guard against users passing inline props
|
|
@@ -2000,8 +2002,12 @@ function PanelResizeHandle({
|
|
|
2000
2002
|
setResizeHandler(() => resizeHandler);
|
|
2001
2003
|
}
|
|
2002
2004
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2005
|
+
|
|
2006
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
2007
|
+
// so that inline object values won't trigger re-renders
|
|
2008
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2009
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2003
2010
|
useEffect(() => {
|
|
2004
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2005
2011
|
if (disabled || resizeHandler == null) {
|
|
2006
2012
|
return;
|
|
2007
2013
|
}
|
|
@@ -2051,12 +2057,10 @@ function PanelResizeHandle({
|
|
|
2051
2057
|
}
|
|
2052
2058
|
};
|
|
2053
2059
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
// Fine inputs (e.g. mouse)
|
|
2057
|
-
fine: (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5
|
|
2060
|
+
coarse: coarseHitAreaMargins,
|
|
2061
|
+
fine: fineHitAreaMargins
|
|
2058
2062
|
}, setResizeHandlerState);
|
|
2059
|
-
}, [direction, disabled,
|
|
2063
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2060
2064
|
useWindowSplitterResizeHandlerBehavior({
|
|
2061
2065
|
disabled,
|
|
2062
2066
|
handleId: resizeHandleId,
|
package/package.json
CHANGED
package/src/Panel.test.tsx
CHANGED
|
@@ -193,6 +193,111 @@ describe("PanelGroup", () => {
|
|
|
193
193
|
expect(leftPanelRef.current?.isCollapsed()).toBe(false);
|
|
194
194
|
expect(leftPanelRef.current?.isExpanded()).toBe(true);
|
|
195
195
|
});
|
|
196
|
+
|
|
197
|
+
describe("when a panel is mounted in a collapsed state", () => {
|
|
198
|
+
beforeEach(() => {
|
|
199
|
+
act(() => {
|
|
200
|
+
root.unmount();
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("should expand to the panel's minSize", () => {
|
|
205
|
+
const panelRef = createRef<ImperativePanelHandle>();
|
|
206
|
+
|
|
207
|
+
root = createRoot(container);
|
|
208
|
+
|
|
209
|
+
function renderPanelGroup() {
|
|
210
|
+
act(() => {
|
|
211
|
+
root.render(
|
|
212
|
+
<PanelGroup direction="horizontal">
|
|
213
|
+
<Panel
|
|
214
|
+
collapsible
|
|
215
|
+
defaultSize={0}
|
|
216
|
+
minSize={5}
|
|
217
|
+
ref={panelRef}
|
|
218
|
+
/>
|
|
219
|
+
<PanelResizeHandle />
|
|
220
|
+
<Panel />
|
|
221
|
+
</PanelGroup>
|
|
222
|
+
);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Re-render and confirmed collapsed by default
|
|
227
|
+
renderPanelGroup();
|
|
228
|
+
act(() => {
|
|
229
|
+
panelRef.current?.collapse();
|
|
230
|
+
});
|
|
231
|
+
expect(panelRef.current?.getSize()).toEqual(0);
|
|
232
|
+
|
|
233
|
+
// Toggling a panel should expand to the minSize (since there's no previous size to restore to)
|
|
234
|
+
act(() => {
|
|
235
|
+
panelRef.current?.expand();
|
|
236
|
+
});
|
|
237
|
+
expect(panelRef.current?.getSize()).toEqual(5);
|
|
238
|
+
|
|
239
|
+
// Collapse again
|
|
240
|
+
act(() => {
|
|
241
|
+
panelRef.current?.collapse();
|
|
242
|
+
});
|
|
243
|
+
expect(panelRef.current?.getSize()).toEqual(0);
|
|
244
|
+
|
|
245
|
+
// Toggling the panel should expand to the minSize override if one is specified
|
|
246
|
+
// Note this only works because the previous non-collapsed size is less than the minSize override
|
|
247
|
+
act(() => {
|
|
248
|
+
panelRef.current?.expand(15);
|
|
249
|
+
});
|
|
250
|
+
expect(panelRef.current?.getSize()).toEqual(15);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("should support the (optional) default size", () => {
|
|
254
|
+
const panelRef = createRef<ImperativePanelHandle>();
|
|
255
|
+
|
|
256
|
+
root = createRoot(container);
|
|
257
|
+
|
|
258
|
+
function renderPanelGroup() {
|
|
259
|
+
act(() => {
|
|
260
|
+
root.render(
|
|
261
|
+
<PanelGroup autoSaveId="test" direction="horizontal">
|
|
262
|
+
<Panel
|
|
263
|
+
collapsible
|
|
264
|
+
defaultSize={0}
|
|
265
|
+
minSize={0}
|
|
266
|
+
ref={panelRef}
|
|
267
|
+
/>
|
|
268
|
+
<PanelResizeHandle />
|
|
269
|
+
<Panel />
|
|
270
|
+
</PanelGroup>
|
|
271
|
+
);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Re-render and confirmed collapsed by default
|
|
276
|
+
renderPanelGroup();
|
|
277
|
+
act(() => {
|
|
278
|
+
panelRef.current?.collapse();
|
|
279
|
+
});
|
|
280
|
+
expect(panelRef.current?.getSize()).toEqual(0);
|
|
281
|
+
|
|
282
|
+
// In this case, toggling the panel to expanded will not change its size
|
|
283
|
+
act(() => {
|
|
284
|
+
panelRef.current?.expand();
|
|
285
|
+
});
|
|
286
|
+
expect(panelRef.current?.getSize()).toEqual(0);
|
|
287
|
+
|
|
288
|
+
// But we can override the toggle behavior by passing an explicit min size
|
|
289
|
+
act(() => {
|
|
290
|
+
panelRef.current?.expand(10);
|
|
291
|
+
});
|
|
292
|
+
expect(panelRef.current?.getSize()).toEqual(10);
|
|
293
|
+
|
|
294
|
+
// Toggling an already-expanded panel should not do anything even if we pass a default size
|
|
295
|
+
act(() => {
|
|
296
|
+
panelRef.current?.expand(15);
|
|
297
|
+
});
|
|
298
|
+
expect(panelRef.current?.getSize()).toEqual(10);
|
|
299
|
+
});
|
|
300
|
+
});
|
|
196
301
|
});
|
|
197
302
|
|
|
198
303
|
describe("resize", () => {
|
package/src/Panel.ts
CHANGED
|
@@ -46,7 +46,7 @@ export type PanelData = {
|
|
|
46
46
|
|
|
47
47
|
export type ImperativePanelHandle = {
|
|
48
48
|
collapse: () => void;
|
|
49
|
-
expand: () => void;
|
|
49
|
+
expand: (minSize?: number) => void;
|
|
50
50
|
getId(): string;
|
|
51
51
|
getSize(): number;
|
|
52
52
|
isCollapsed: () => boolean;
|
|
@@ -200,8 +200,8 @@ export function PanelWithForwardedRef({
|
|
|
200
200
|
collapse: () => {
|
|
201
201
|
collapsePanel(panelDataRef.current);
|
|
202
202
|
},
|
|
203
|
-
expand: () => {
|
|
204
|
-
expandPanel(panelDataRef.current);
|
|
203
|
+
expand: (minSize?: number) => {
|
|
204
|
+
expandPanel(panelDataRef.current, minSize);
|
|
205
205
|
},
|
|
206
206
|
getId() {
|
|
207
207
|
return panelId;
|
package/src/PanelGroup.ts
CHANGED
|
@@ -386,65 +386,72 @@ function PanelGroupWithForwardedRef({
|
|
|
386
386
|
}, []);
|
|
387
387
|
|
|
388
388
|
// External APIs are safe to memoize via committed values ref
|
|
389
|
-
const expandPanel = useCallback(
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
const expandPanel = useCallback(
|
|
390
|
+
(panelData: PanelData, minSizeOverride?: number) => {
|
|
391
|
+
const { onLayout } = committedValuesRef.current;
|
|
392
|
+
const { layout: prevLayout, panelDataArray } = eagerValuesRef.current;
|
|
392
393
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
if (panelData.constraints.collapsible) {
|
|
395
|
+
const panelConstraintsArray = panelDataArray.map(
|
|
396
|
+
(panelData) => panelData.constraints
|
|
397
|
+
);
|
|
397
398
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
399
|
+
const {
|
|
400
|
+
collapsedSize = 0,
|
|
401
|
+
panelSize = 0,
|
|
402
|
+
minSize: minSizeFromProps = 0,
|
|
403
|
+
pivotIndices,
|
|
404
|
+
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
404
405
|
|
|
405
|
-
|
|
406
|
-
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
407
|
-
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(
|
|
408
|
-
panelData.id
|
|
409
|
-
);
|
|
406
|
+
const minSize = minSizeOverride ?? minSizeFromProps;
|
|
410
407
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
408
|
+
if (fuzzyNumbersEqual(panelSize, collapsedSize)) {
|
|
409
|
+
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
410
|
+
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(
|
|
411
|
+
panelData.id
|
|
412
|
+
);
|
|
415
413
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
414
|
+
const baseSize =
|
|
415
|
+
prevPanelSize != null && prevPanelSize >= minSize
|
|
416
|
+
? prevPanelSize
|
|
417
|
+
: minSize;
|
|
418
|
+
|
|
419
|
+
const isLastPanel =
|
|
420
|
+
findPanelDataIndex(panelDataArray, panelData) ===
|
|
421
|
+
panelDataArray.length - 1;
|
|
422
|
+
const delta = isLastPanel
|
|
423
|
+
? panelSize - baseSize
|
|
424
|
+
: baseSize - panelSize;
|
|
425
|
+
|
|
426
|
+
const nextLayout = adjustLayoutByDelta({
|
|
427
|
+
delta,
|
|
428
|
+
initialLayout: prevLayout,
|
|
429
|
+
panelConstraints: panelConstraintsArray,
|
|
430
|
+
pivotIndices,
|
|
431
|
+
prevLayout,
|
|
432
|
+
trigger: "imperative-api",
|
|
433
|
+
});
|
|
420
434
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
initialLayout: prevLayout,
|
|
424
|
-
panelConstraints: panelConstraintsArray,
|
|
425
|
-
pivotIndices,
|
|
426
|
-
prevLayout,
|
|
427
|
-
trigger: "imperative-api",
|
|
428
|
-
});
|
|
435
|
+
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
436
|
+
setLayout(nextLayout);
|
|
429
437
|
|
|
430
|
-
|
|
431
|
-
setLayout(nextLayout);
|
|
438
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
432
439
|
|
|
433
|
-
|
|
440
|
+
if (onLayout) {
|
|
441
|
+
onLayout(nextLayout);
|
|
442
|
+
}
|
|
434
443
|
|
|
435
|
-
|
|
436
|
-
|
|
444
|
+
callPanelCallbacks(
|
|
445
|
+
panelDataArray,
|
|
446
|
+
nextLayout,
|
|
447
|
+
panelIdToLastNotifiedSizeMapRef.current
|
|
448
|
+
);
|
|
437
449
|
}
|
|
438
|
-
|
|
439
|
-
callPanelCallbacks(
|
|
440
|
-
panelDataArray,
|
|
441
|
-
nextLayout,
|
|
442
|
-
panelIdToLastNotifiedSizeMapRef.current
|
|
443
|
-
);
|
|
444
450
|
}
|
|
445
451
|
}
|
|
446
|
-
}
|
|
447
|
-
|
|
452
|
+
},
|
|
453
|
+
[]
|
|
454
|
+
);
|
|
448
455
|
|
|
449
456
|
// External APIs are safe to memoize via committed values ref
|
|
450
457
|
const getPanelSize = useCallback((panelData: PanelData) => {
|
package/src/PanelGroupContext.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type TPanelGroupContext = {
|
|
|
16
16
|
collapsePanel: (panelData: PanelData) => void;
|
|
17
17
|
direction: "horizontal" | "vertical";
|
|
18
18
|
dragState: DragState | null;
|
|
19
|
-
expandPanel: (panelData: PanelData) => void;
|
|
19
|
+
expandPanel: (panelData: PanelData, minSizeOverride?: number) => void;
|
|
20
20
|
getPanelSize: (panelData: PanelData) => number;
|
|
21
21
|
getPanelStyle: (
|
|
22
22
|
panelData: PanelData,
|
package/src/PanelResizeHandle.ts
CHANGED
|
@@ -110,6 +110,11 @@ export function PanelResizeHandle({
|
|
|
110
110
|
}
|
|
111
111
|
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
112
112
|
|
|
113
|
+
// Extract hit area margins before passing them to the effect's dependency array
|
|
114
|
+
// so that inline object values won't trigger re-renders
|
|
115
|
+
const coarseHitAreaMargins = hitAreaMargins?.coarse ?? 15;
|
|
116
|
+
const fineHitAreaMargins = hitAreaMargins?.fine ?? 5;
|
|
117
|
+
|
|
113
118
|
useEffect(() => {
|
|
114
119
|
if (disabled || resizeHandler == null) {
|
|
115
120
|
return;
|
|
@@ -168,17 +173,16 @@ export function PanelResizeHandle({
|
|
|
168
173
|
element,
|
|
169
174
|
direction,
|
|
170
175
|
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// Fine inputs (e.g. mouse)
|
|
174
|
-
fine: hitAreaMargins?.fine ?? 5,
|
|
176
|
+
coarse: coarseHitAreaMargins,
|
|
177
|
+
fine: fineHitAreaMargins,
|
|
175
178
|
},
|
|
176
179
|
setResizeHandlerState
|
|
177
180
|
);
|
|
178
181
|
}, [
|
|
182
|
+
coarseHitAreaMargins,
|
|
179
183
|
direction,
|
|
180
184
|
disabled,
|
|
181
|
-
|
|
185
|
+
fineHitAreaMargins,
|
|
182
186
|
registerResizeHandleWithParentGroup,
|
|
183
187
|
resizeHandleId,
|
|
184
188
|
resizeHandler,
|