feat(Splitter): add support for pixel sizing and constraints#2362
feat(Splitter): add support for pixel sizing and constraints#2362
Conversation
commit: |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughAdd pixel-based sizing support to the Splitter component. Introduces a Changes
Sequence DiagramsequenceDiagram
participant RO as ResizeObserver
participant SG as SplitterGroup
participant UC as Unit Converter
participant Layout as Layout Engine
participant A11y as Accessibility
RO->>SG: Group element resized
SG->>SG: Update groupSizeInPixels
SG->>UC: getGroupSizeInPixels + panelData
UC->>UC: convertPanelConstraintsToPercent<br/>(px → % conversion)
UC->>SG: Return panelConstraintsInPercent
SG->>Layout: recalculateLayoutForPixelPanels<br/>(prevSize, nextSize)
Layout->>Layout: Recompute percent for px panels<br/>Scale non-px panels to 100%
Layout->>SG: Updated layout array
SG->>A11y: getPanelDataWithPercentConstraints()
A11y->>A11y: Update ARIA values & attributes<br/>for accessibility reflection
SG->>SG: Emit layout change events
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
🔇 Additional comments (22)
✏️ Tip: You can disable this entire section by setting Comment |
|
@badmike there's some minor comment from coderabbit, can you tackle them? 😁 |
This pull request adds pixel-based sizing to the Splitter component, allowing panels to be sized in fixed pixels (
px) alongside the existing percentage (%) support. The changes handle pixel sizing across layout calculations, persistence, collapse/expand operations, and panel constraints, with automatic conversion between units as needed.Changes:
Added a new
sizeUnitprop toSplitterPanelto specify whether a panel uses pixel or percent sizing, with corresponding support throughout the sizing logic. [1] [2] [3]Updated layout calculation and persistence logic to convert between percent and pixel units, ensuring fixed-width panels maintain their size during resizing and when persisting state. [1] [2] [3] [4]
Refactored constraint validation to internally normalize all constraints to percent-based values and recalculate layouts when the container size changes. [1] [2] [3]
Updated collapse and expand operations to store and restore panel sizes in their original unit, converting as needed between percent and pixel values. [1] [2] [3]
Updated documentation with descriptions and examples of the new pixel sizing feature. [1] [2]
Closes #836, #2069
Summary by CodeRabbit
Release Notes
New Features
sizeUnitprop, enabling fixed-size panels alongside fluid panelsDocumentation
✏️ Tip: You can customize this high-level summary in your review settings.