-
Notifications
You must be signed in to change notification settings - Fork 544
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): improve form control and input validation trigger #487
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2ee8a64
refactor(FormGroup): use inject instead of cloning slots
romhml 1aa9e4e
refactor(FormGroup): use inject instead of cloning slots
romhml 62acdd6
fix(FormGroup): fixed size value
romhml 5c58e3a
refactor(FormGroup): use computed size in all input components
romhml 7f0984a
feat(Form): give more control over Form API and trigger validation on…
romhml 8360589
docs(Form): add example for backend validation
romhml d75b867
refactor(Form)!: trigger validation automatically on submit
romhml ae51fe5
docs(Form): update examples
romhml 9718d92
feat(Form): reduce debounce time on input validation
romhml 5f8c891
feat(Form): distinguish blur and change events
romhml 272ef71
docs(Form): update examples
romhml effd03e
refactor(Form): extend SubmitEvent instead of overriding it
romhml fc25c7f
docs(Form): document validate-on prop
romhml 83564cc
docs(Form): added api documentation
romhml 4f623f8
fix(Inputs): fix invalid colors if error
romhml c95fcf4
chore(Form): apply suggestions
romhml 2d5b3aa
chore(Form): remove useless refs in form examples
romhml a1256d9
docs(Form): restore custom component example
romhml 65ce02f
Merge branch 'dev' into pr/487
benjamincanac 1a949d4
docs(Form): improve API section
benjamincanac b1acea9
fix(FormGroup): handle `error` as boolean
benjamincanac 92d297d
docs(ComponentCard): improve boolean rendering
benjamincanac c8469ba
docs(FormGroup): improve with `v-slot` example
benjamincanac caebf48
fix(useFormGroup): prevent err when no name provided
benjamincanac ae9cbbb
fix(FormGroup): only provide `props.size` to not override defaults
benjamincanac 9d4620f
Merge branch 'dev' into form-improvements
benjamincanac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<template> | ||
<UFormGroup v-slot="{ error }" label="Email" :error="!email && 'You must enter an email'" help="This is a nice email!"> | ||
<UInput v-model="email" type="email" placeholder="Enter email" :trailing-icon="error && 'i-heroicons-exclamation-triangle-20-solid'" /> | ||
</UFormGroup> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const email = ref('') | ||
</script> |
Oops, something went wrong.
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.
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.
Why remove the type here?
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.
It's no longer needed since the example does not rely on
form.value.validate
now that validation happens automatically on submit. It was required on previous examples to get the right return type.The ref itself is also useless, I'll remove it.
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.
Maybe to type the
clear
method?