-
Notifications
You must be signed in to change notification settings - Fork 87
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(v2): edit checkbox field in form builder #3581
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Divider between drawer elements was not extending all the way to the drawer edge as per the design.
This commit contains a couple of significant changes. First, useEditFieldForm is updated to take a transform prop, which allows the shape of the form inputs to be different from the field. This allows e.g. for checkbox field options to be read as a string from the form, then transformed into a string[] in the field. Second, the useEffect in useEditFieldForm is removed. Its purpose was to ensure that the edit field drawer correctly rerendered when the field being edited changed, but it was implicitly relying on useDebounce to be called first in order to work properly. Instead, a (still hacky but) more explicit implementation using component keys was chosen, which is explained in the code comments.
This CSS property was causing the content of the drawer to wrongly overflow in the x direction.
The form reset was causing a bug where if customMax or customMin was undefined, the field would be saved correctly, but the UI would show the customMin or customMax value reverting to its previous value.
karrui
approved these changes
Mar 16, 2022
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.
lgtm, much cleaner!
...te/builder-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/EditCheckbox.tsx
Show resolved
Hide resolved
...-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/common/useEditFieldForm.ts
Outdated
Show resolved
Hide resolved
...-and-design/BuilderAndDesignDrawer/EditFieldDrawer/edit-fieldtype/common/useEditFieldForm.ts
Outdated
Show resolved
Hide resolved
This was referenced Oct 4, 2022
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR reimplements the checkbox field editor originally implemented in #3131, with the refactors from #3547 included. There are a few significant differences from the original implementation:
ValidationOptions
validation did not allow one ofcustomMin
orcustomMax
to be set without setting the other. This PR fixes this.Known issues
When the sidebar drawer is closed, clicking on a field results in the drawer opening to the field list, rather than directly to the editing page for that field. This will be addressed separately.fixed in fix: ensure clicking field opens to field editor #3583Next steps
Field duplication and deletion will be implemented together with the relevant mocks before submitting the form builder for design review.
While design review is happening, I will concurrently work on the edit pages for the other fields.