implement column width adjustment with local storage support#84
Open
Veronikya wants to merge 1 commit into
Open
implement column width adjustment with local storage support#84Veronikya wants to merge 1 commit into
Veronikya wants to merge 1 commit into
Conversation
d67e8c3 to
8af478e
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.
PR: feat(base-ui): add drag-to-resize column widths persisted in localStorage
Summary
Adds drag-to-resize column widths to the base-ui Table component. User-adjusted widths are persisted in browser
localStorageand automatically restored on page reload.localStorage, keyed bytableId + viewId— each view maintains its own independent column widthsChanges
base-ui/src/plugins/GridViewPlugin/utils/columnWidthStorage.ts(new)localStorage wrapper module with three exported functions:
getColumnWidths(tableId, viewId)saveColumnWidths(tableId, viewId, widths)clearColumnWidths(tableId, viewId)Storage key format:
serenibase_col_widths_<tableId>_<viewId>base-ui/src/plugins/GridViewPlugin/hooks/useTableViewConfig.tstableIdparameter (used to build the localStorage key)localColumnWidthsstate (loaded from localStorage on mount)handleColumnWidthChange(columnId, width)— updates local state and writes to localStorage; does not call the backendbase-ui/src/plugins/GridViewPlugin/components/Table/Table.tsxresizingColumnIndex,liveColumnWidths(for live preview during drag)handleResizeMouseDown— on mousedown, registers globalmousemove/mouseuplisteners; mousemove updatesliveColumnWidthsfor real-time preview; mouseup callshandleColumnWidthChangeto persistcolumnWidthsuseMemo with 5-level priority (see Summary)cursor: col-resize)Test Plan
pnpm test -- --run)Verification
Files Changed