Skip to content

expose renderers prop to allow custom internal renderers#969

Merged
lukasmasuch merged 3 commits intoglideapps:mainfrom
BrianHung:custom-renderers-internal
Jun 19, 2025
Merged

expose renderers prop to allow custom internal renderers#969
lukasmasuch merged 3 commits intoglideapps:mainfrom
BrianHung:custom-renderers-internal

Conversation

@BrianHung
Copy link
Collaborator

@BrianHung BrianHung commented Jun 23, 2024

Possibly solves #946.

In general, this PR allows developers to override rendering behavior for internal cells.

Internal cell renderers are already exposed.

Ideally, we could consolidate customRenderers into renderers, and only require rowMarkers and a basic text cell, the other renderers being optional.

@lukasmasuch lukasmasuch requested a review from Copilot June 18, 2025 11:08
Copy link
Contributor

Copilot AI left a 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 exposes a custom renderers prop to allow developers to override internal cell rendering behavior, potentially consolidating customRenderers into renderers while still supporting legacy internal cell renderers.

  • Updated dependency installation script to include @testing-library/dom.
  • Added a new test to verify that custom renderers can override internal cells.
  • Modified the DataEditorAll component to accept a custom renderers prop.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
setup-react-18-test.sh Updated dependency list to include @testing-library/dom.
packages/core/test/data-editor.test.tsx Added test to check custom renderer override functionality.
packages/core/src/index.ts Exposed InternalCellRenderer type for enhanced type-safety.
packages/core/src/data-editor-all.tsx Modified DataEditorAll to support a custom renderers prop.
Comments suppressed due to low confidence (1)

packages/core/test/data-editor.test.tsx:2590

  • [nitpick] Review the need for the explicit type assertion to InternalCellRenderer; if possible, adjust the markerCellRenderer type to allow overriding the draw function without a type assertion.
                        draw: spy

Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Might be good to also list this in the API.md and maybe add one example to the custom drawing story or a new story.

@lukasmasuch lukasmasuch merged commit d64788c into glideapps:main Jun 19, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants