-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: introduce defineField and deprecate bind API #4497
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4497 +/- ##
==========================================
- Coverage 97.01% 96.12% -0.89%
==========================================
Files 86 86
Lines 7091 7140 +49
Branches 1342 1333 -9
==========================================
- Hits 6879 6863 -16
- Misses 212 277 +65 ☔ View full report in Codecov by Sentry. |
Hey in relation to original discussion https://github.com/logaretm/vee-validate/discussions/4501| That opened enhancement issue #4508 I just wanted to add some reproductions on my use case: With vee-validate version 4.11.8 and defineComponentBinds With vee-validate version 4..12.0-alpha.1 using new defineField instead and binding model to the v-model of headless ui radio In this stack blitz I was expecting the model value exposed by defineField to work with the RadioGroups v-model. So perhaps it would be nice to expose a binds: on the defineField as you suggested in #4508 that acts as the aggregated version again? |
eeda2a5
to
76b3821
Compare
98b0cf7
to
dd7bd6a
Compare
@timmaier I didn't see your comment, sorry. This API decouples the value from the binds object to solve a few issues:
For your example, the const [selectedPickupDateType] = props.form.defineField('data.type'); I tested that in your example and it works well. Let me know if you have other notes or questions. |
399a8a2
to
3d08d08
Compare
9678f82
to
8d0b70b
Compare
Sorry to comment on a merged PR. Thankyou for the the explanation and reasoning regarding v-bind vs v-model and the array syntax all working now :D. |
🔎 Overview
This PR removes the following functions on the
useForm
API:useFieldModel
defineInputBinds
defineComponentBinds
These methods increased the API surface area and with varying levels of support (useFieldModel being deprecated), it caused some confusion.
Also due to the
defineXXXBinds
functions combining both thevalue
andprops
bindings, it causes limitations when dealing with checkboxes and the difference between the two functions may not be apparent at first glance.So to replace all of those, the
defineField
is being introduced. It works for both HTML and components due to the separation of the value model and the attributes binding objects and events. This way it could utilize thev-model
API without having to worry about the kind of events/prop names to use.I have not decided yet if this is a breaking change to introduce in v5 or if we could do a v4.12 with support for all of these APIs with deprecation notices.
closes #4530
closes #4493
closes #4547