Skip to content

feat(data-grid): add readOnly - #1032

Merged
sadmann7 merged 2 commits into
mainfrom
add-readonly
Nov 21, 2025
Merged

sadmann7 merged 2 commits into
mainfrom
add-readonly

Conversation

@sadmann7

Copy link
Copy Markdown
Owner

No description provided.

- Add readOnly prop to useDataGrid hook
- Block all data modifications in read-only mode (editing, paste, delete, row operations)
- Allow selection, navigation, copy, and search operations
- Update all cell variants to respect read-only flag
- Add readOnly to TableMeta and CellVariantProps types
Copilot AI review requested due to automatic review settings November 21, 2025 18:11
@vercel

vercel Bot commented Nov 21, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
shadcn-table Ready Ready Preview Comment Nov 21, 2025 6:11pm
tablecn Ready Ready Preview Comment Nov 21, 2025 6:11pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds a readOnly property to the data-grid component, allowing users to create read-only grids that prevent all editing operations. The implementation is comprehensive and well-structured.

Purpose: Add a readOnly mode to the data-grid that disables all data modification operations including cell editing, pasting, deleting, and row operations while maintaining navigation and selection capabilities.

Key Changes:

  • Added readOnly prop to useDataGrid hook and propagated it through the component tree
  • Modified all cell variant components to respect the readOnly flag
  • Blocked editing operations (paste, delete, row add/delete) in read-only mode
  • Added disabled attribute to checkbox cells when read-only

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/types/data-grid.ts Added readOnly to table meta and cell variant props interfaces
src/hooks/use-data-grid.tsx Added readOnly prop with default false, blocks data updates, paste, delete, and row operations
src/components/data-grid/data-grid-cell.tsx Extracts and passes readOnly to all cell variants, removed isEditing from CheckboxCell
src/components/data-grid/data-grid-cell-variants.tsx All cell variants check readOnly before data updates and disable editing UI
public/r/data-grid.json Registry file updated with new component content

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sadmann7
sadmann7 merged commit c85cf51 into main Nov 21, 2025
13 checks passed
@sadmann7
sadmann7 deleted the add-readonly branch November 24, 2025 12:02
noodleman1991 pushed a commit to noodleman1991/tablecn that referenced this pull request Mar 12, 2026
* feat: add read-only mode for data grid

- Add readOnly prop to useDataGrid hook
- Block all data modifications in read-only mode (editing, paste, delete, row operations)
- Allow selection, navigation, copy, and search operations
- Update all cell variants to respect read-only flag
- Add readOnly to TableMeta and CellVariantProps types

* feat(data-grid): add readOnly mode
anhdd-kuro pushed a commit to anhdd-kuro/tablecn that referenced this pull request Apr 8, 2026
* feat: add read-only mode for data grid

- Add readOnly prop to useDataGrid hook
- Block all data modifications in read-only mode (editing, paste, delete, row operations)
- Allow selection, navigation, copy, and search operations
- Update all cell variants to respect read-only flag
- Add readOnly to TableMeta and CellVariantProps types

* feat(data-grid): add readOnly mode

This branch was successfully deployed

2 active deployments
Preview – shadcn-table — af69a35b Deployed Nov 21, 2025 by vercel[bot]
Preview – tablecn — af69a35b Deployed Nov 21, 2025 by vercel[bot]
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.

2 participants