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

Disable vanilla array buttons when readonly #2303

Merged

Conversation

joefreeman
Copy link
Contributor

This updates the vanilla array controls (TableArrayControl and ArrayControlRenderer) to disable the buttons (for adding/removing/moving items) when the control is set to readonly (otherwise the data can be updated while readonly).

To (manually) test this, I've updated the examples to support setting the readonly property of the <JsonForms>, and added toggle actions to a couple of the array examples. (Not sure if there's a better way to do this?)

Copy link

netlify bot commented Mar 14, 2024

Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit 5e519d7
🔍 Latest deploy log https://app.netlify.com/sites/jsonforms-examples/deploys/66e2c4439a1892000856da21
😎 Deploy Preview https://deploy-preview-2303--jsonforms-examples.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.

Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution ❤️! Works for me!

Adapting the examples is great and allows to easily test the new functionality manually, thanks 👍!

Please also add a unit test so that the new behavior is safe from regressions.

@sdirix sdirix added this to the 3.4 milestone Sep 11, 2024
@lucas-koehler
Copy link
Contributor

@sdirix @joefreeman I added tests that check that buttons are rendered with expected enabled and disabled state for enabled/disabled controls.

@coveralls
Copy link

Coverage Status

coverage: 83.285% (+0.001%) from 83.284%
when pulling 5e519d7 on joefreeman:disable-readonly-array-buttons
into a23e990 on eclipsesource:master.

@lucas-koehler lucas-koehler merged commit 52b843a into eclipsesource:master Sep 13, 2024
8 checks passed
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.

4 participants