-
Notifications
You must be signed in to change notification settings - Fork 457
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(form): add support for disabling array input capabilities #7615
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
No changes to documentation |
Component Testing Report Updated Jan 17, 2025 10:28 AM (UTC) ❌ Failed Tests (2) -- expand for details
|
⚡️ Editor Performance ReportUpdated Fri, 17 Jan 2025 10:29:59 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
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.
Nice work, looks good to me!
!disableActions.includes('add') && | ||
!(disableActions.includes('addAfter') && disableActions.includes('addBefore')) && ( |
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.
Q: This seems different to the other conditions added elsewhere in this PR (eg here) where we only allow after if add and addAfter are not disabled.
Is it intended for this to be different?
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.
Great catch! Fixed in 991d357
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.
Nice one @bjoerge
Description
This adds support for the
disableActions
option on array fields for disabling various array input capabilities like:add
– Removes the ability to add new items to the arrayaddBefore
– Removes the "Add item before"-menu item from the array item menuaddAfter
– Removes the "Add item after"-menu item from the array item menuremove
– Removes the ability to remove items from the arrayduplicate
– Removes the ability to duplicate array itemscopy
– Removes the ability to copy items from the arrayUsage example:
Things to note:
add
will also implicitly disableaddBefore
andaddAfter
, thus disable inserting new items to the array entirely (although items can still be inserted viaduplicate
).copy
here(?), but including it for completeness. If all known actions are disabled, the menu items and "add"-affordances will be removed from the UI.copy
will also disable thecopy
field action (for the entire array). In the same vein, disablingadd
will remove the "paste" field action. However, any other field actions that may have been added by plugins etc. may still be able to manipulate the array in ways disallowed bydisableActions
What to review
Does it make sense?
Testing
I've also added a basic e2e test that asserts that menu items and add button doesn't appear when all capabilities are disabled
Notes for release
disableActions
option on array fields for disabling various array input capabilities