Skip to content
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

feat(Datagrid): add opt out ability for editable cells #5425

Conversation

matthewgallo
Copy link
Member

@matthewgallo matthewgallo commented Jun 6, 2024

Closes #5379

Currently there is no way to opt out of inline editing at the cell level. You can disable editing for an entire column in the table but it isn't possible to have one or more non editable cells in a column with other editable cells. This PR adds that behavior, I added a note in the EditableCell story about which cell is non editable for demonstration purposes.

Example story can be viewed here.

I also found a bug within editable cell Datagrids where if you attempt to go into edit mode (Enter key) from a non-editable cell, the inline edit context's reducer updates the state to be in edit mode. This prevents you from actually going into edit mode within an editable cell because the context thinks we're already in edit mode. I've included this fix here as well since it was a very small change.

What did you change?

packages/ibm-products/src/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js
packages/ibm-products/src/components/Datagrid/Extensions/EditableCell/EditableCell.docs-page.js
packages/ibm-products/src/components/Datagrid/Extensions/EditableCell/EditableCell.stories.jsx
packages/ibm-products/src/components/Datagrid/useInlineEdit.js
packages/ibm-products/src/components/Datagrid/utils/makeData.js

How did you test and verify your work?

Storybook

@matthewgallo matthewgallo requested a review from a team as a code owner June 6, 2024 13:24
@matthewgallo matthewgallo requested review from kennylam and emyarod and removed request for a team June 6, 2024 13:24
Copy link

netlify bot commented Jun 6, 2024

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit 4e4cf02
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/667435ce980eff00088a58b4
😎 Deploy Preview https://deploy-preview-5425--carbon-for-ibm-products.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AustinGitHub
Copy link
Contributor

I checked out the changes on my local env and this works, thank you!

emyarod
emyarod previously approved these changes Jun 6, 2024
Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me!

emyarod
emyarod previously approved these changes Jun 17, 2024
Copy link
Member

@emyarod emyarod left a comment

Choose a reason for hiding this comment

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

looks good to me!

Copy link
Member

@kennylam kennylam left a comment

Choose a reason for hiding this comment

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

LGTM!

@matthewgallo matthewgallo added this pull request to the merge queue Jun 20, 2024
Merged via the queue into carbon-design-system:main with commit 648571e Jun 20, 2024
17 checks passed
@matthewgallo matthewgallo deleted the 5379-datagrid-opt-out-of-inline-edit branch June 20, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Datagrid doesn't have a way to enable/disable inline edit per cell for specific use cases
4 participants