-
Notifications
You must be signed in to change notification settings - Fork 341
feat: provideEditorCallback access cell location #1038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: provideEditorCallback access cell location #1038
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the provideEditor
API to include a second location
parameter (row/column indices) so callback implementers can know the cell’s position. Key changes:
- Expanded
ProvideEditorCallback
type and documentation to accept(cell, location)
. - Updated all internal renderer call sites to pass the new
[row, col]
argument. - Adjusted unit tests to supply a dummy location for existing smoke tests.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/core/src/internal/data-grid/data-grid-types.ts | Changed ProvideEditorCallback signature to (cell, location: Item) . |
packages/core/src/internal/data-grid-overlay-editor/data-grid-overlay-editor.tsx | Passed cell (location) into provideEditor calls and updated hook deps. |
packages/core/src/data-editor/data-editor.tsx | Updated custom-cell editor invocation to use [x - rowMarkerOffset, y] . |
packages/core/API.md | Reflected new callback signature in API docs. |
packages/core/test/cells.test.tsx | Tests now call provideEditor(cell, [0,0]) instead of single-arg version. |
packages/cells/test/multi-select-cell.test.tsx | Multi-select tests updated to pass [0,0] to provideEditor . |
packages/cells/test/date-picker-cell.test.tsx | Date-picker tests updated to pass [0,0] to provideEditor . |
Comments suppressed due to low confidence (3)
packages/core/src/internal/data-grid/data-grid-types.ts:425
- [nitpick] Consider renaming the parameter
location
to something more explicit (e.g.,cellPosition
orcoords
) to clarify that it represents row and column indices.
location: Item
packages/core/API.md:570
- Update the usage examples in this section to demonstrate calling
provideEditor(cell, [row, col])
, so consumers can see how to pass the new location argument.
export type ProvideEditorCallback<T extends InnerGridCell> = (
packages/cells/test/multi-select-cell.test.tsx:270
- Consider adding a test that verifies the provided location
[row, col]
is actually forwarded to the callback implementation, ensuring editors can rely on the new parameter.
const Editor = renderer.provideEditor?.(getMockCell(), [0, 0]).editor;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable, but its also a breaking change, right? All uses of provideEditor
would need to be adapted to accept the new parameter?
Yeah, it is a breaking change. Maybe we can pass in (cell: GridCell & Item), then it wouldn't be a breaking change with a required second arg. What do you think? |
Most of api is
(cell: Item, value: GridCell)
but that would be a breaking change here.