refactor(table): add grouped and pinned column headers to table component#8392
Draft
LWS49 wants to merge 1 commit into
Draft
refactor(table): add grouped and pinned column headers to table component#8392LWS49 wants to merge 1 commit into
LWS49 wants to merge 1 commit into
Conversation
218771e to
3a8b328
Compare
3a8b328 to
4065e11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for multi-level grouped headers and pinned (sticky) columns to the table component. It introduces a new header building system that handles complex column hierarchies while maintaining proper column ordering and pinning behavior.
Key Changes
New
buildHeaderRowsfunction (builder/buildHeaderRows.ts): Core logic that transforms a flat column array into a multi-row header structure, handling:groupPathpropertycolSpan/rowSpancalculation for group cellswidthPxon pinned columns, inconsistent grouping depths, non-contiguous groups)New
computePinOffsetsfunction (MuiTableAdapter/gridSxStyles.ts): Calculates sticky positioning offsets for pinned columns (cumulative from left, reverse cumulative from right)Updated
MuiTableHeadercomponent: Refactored to render multi-row headers with proper sticky positioning, pin attributes, and sort/filter UI only on leaf cellsNew
useStickyHeaderOffsetshook (MuiTableAdapter/useStickyHeaderOffsets.ts): Dynamically computestopoffsets for sticky header rows based on their heightsEnhanced
ColumnTemplateinterface: AddedgroupPathandpin/widthPxproperties to support grouped and pinned columnsUpdated
MuiTableRowcomponent: Added pinned column support with proper sticky positioning and offset calculationNew grid styling (
gridSxStyles.ts): Comprehensive styling for grouped headers, pinned columns, and their interactions (borders, z-index, sticky behavior)Comprehensive test coverage:
buildHeaderRowscovering flat/grouped/pinned scenarios and edge cases<Table />component with various configurationsNotable Implementation Details
maxHeightprop onTableTemplateenables scroll-contained tables with sticky headers