feat: Form element rendering improvements and alignments#395
Merged
alexgrozav merged 6 commits intomainfrom Oct 31, 2023
Merged
feat: Form element rendering improvements and alignments#395alexgrozav merged 6 commits intomainfrom
alexgrozav merged 6 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This file contains hidden or 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
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.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Feature.
What is the current behavior?
Form elements that rendered multiple options, such as Select, CheckboxGroup, RadioGroup, CheckboxButtons and RadioButtons did not use the same API. The rendering mechanism was individual to each of them as well, not providing an optimal DX.
What is the new behavior?
Form elements that render multiple options, such as Select, CheckboxGroup, RadioGroup, CheckboxButtons and RadioButtons now use an
optionsprop, where each option uses the following format:The
idis required and will be always used to set themodelValueof the form element. The options array usage would look as follows:Each of the above mentioned components now also has a
labelprop that is used as fallback if the option item does not provide alabelfield. The componentlabelprop and optionlabelfield introduce a new concept calledRenderableto Inkline. Which can be one of the following:Label{{address.country}}(option: FormOption) =>Hello ${option.id}`(option: FormOption) => h('strong', {}, option.id)markRaw(MyComponent)Does this PR introduce a breaking change?
The
ISelect,ICheckboxGroupandIRadioGroupwill need to be updated to use the format above.