Repository navigation
Conversation
`editable` now decides whether a cell can be filled, pasted into, and is `aria-readonly`, and defaults to whether `renderEditCell` is set. The editor only opens on editable cells of columns with `renderEditCell`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…editable` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4269 +/- ##
=======================================
Coverage 99.27% 99.27%
=======================================
Files 44 44
Lines 2204 2210 +6
Branches 965 968 +3
=======================================
+ Hits 2188 2194 +6
Misses 16 16
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Column.editablenow means what its name says: it decides whether a cell's value can change through the grid, by drag-filling and pasting, and whether the cell isaria-readonly.renderEditCellonly decides whether an editor can open. Until now both requiredrenderEditCell, so a column whose cells change through their ownrenderCellcontent, like a checkbox or a dropdown, couldn't be filled or pasted into without a fake editor (#3116). The default doesn't change: withouteditable, a column is editable when it hasrenderEditCell.Supersedes #3862, which made the same change on a smaller scale.
Breaking change
editableno longer requiresrenderEditCell. A column witheditable: trueand no editor is drag-fillable and pasteable, shows the drag handle whenonFillis set, and isn'taria-readonly. Columns withouteditablebehave as before: editable only whenrenderEditCellis set.Semantics
"Editor" covers typing, Enter, double-click, and
setActivePosition(position, { enableEditor: true }), which all go through the same check. "Fill" covers the drag handle on the active cell and the target cells. "Read-only" coversaria-readonly="true"andRenderCellContentProps.isCellEditable: false. Changes are in bold.editable,renderEditCelleditable, norenderEditCelleditable: true,renderEditCelleditable: true, norenderEditCelleditable: false, anyrenderEditCelleditable,renderEditCelleditable, norenderEditCellTests for each changed row:
editable: true, norenderEditCell:dragFill.test.tsx"should allow dragFill on an editable column without renderEditCell",copyPaste.test.tsx"should allow paste on editable cells without renderEditCell", andcolumn/renderEditCell.test.tsx"should not open an editor on an editable column without renderEditCell", which types, presses Enter, double-clicks, and callssetActivePositionwithenableEditor, and checksaria-readonlyandisCellEditable.editable,renderEditCell:dragFill.test.tsx"should not show the drag handle on a cell whose editable function returns false".editable, norenderEditCell:dragFill.test.tsx"should only fill the editable cells of a column without renderEditCell", the function column in the paste test above, andcolumn/renderEditCell.test.tsx"should set aria-readonly and isCellEditable from editable without renderEditCell".renderEditCellare checked alongside: "should not show the drag handle on a column that is not editable" (noeditable, andeditable: () => false), and the read-only columns in the paste andaria-readonlytests.Changes
isCellEditableUtilresolveseditablefor the row when it's set, and falls back torenderEditCell != nullotherwise. A newcanOpenEditorUtiladds therenderEditCell != nullcheck, andDataGridroutes typing, Enter, double-click, andenableEditorthrough it, so keyboard input on an editable cell without an editor does nothing. Both are pure and don't allocate. The plan called the helpercanOpenEditor; it'scanOpenEditorUtilto matchisCellEditableUtil, with acanOpenEditor(position)wrapper inDataGridlikeisCellEditable(position).isCellEditableUtilinstead ofrenderEditCell == null || editable === false, which ignored a functioneditable. The existing "should allow drag up using mouse" test dragged from a cell whoseeditablefunction returnsfalse; it now drags from the editable cell above it.RenderCellContentProps.isCellEditablefollows the new semantics, so a column witheditable: trueand no editor reportstrueto its content renderer, which can enable its own controls to match.editable,renderEditCell,onFill,onCellPaste,onCellDoubleClick, andRenderCellContentProps.isCellEditable, plus a shorteditableexample.CommonFeaturesiseditable: true. That demo had noonFill, so it gets one too, which also lets its columns with editors be drag-filled.Verification
vp run cipasses.vp testondragFill,copyPaste, andcolumn/renderEditCellpasses in Chromium, Firefox, and WebKit. Withsrc/restored tomain, the new tests fail; with only theenableEditorpath left ungated, the editor test fails at itssetActivePositionstep.vp packcompiles every component. The public types don't change, only their JSDoc. I didn't check the demo by hand withvp dev.🤖 Generated with Claude Code