-
-
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
[pickers] Allow custom fields to validate the value #14486
Merged
flaviendelangle
merged 17 commits into
mui:master
from
flaviendelangle:clean-validation-api
Sep 11, 2024
Merged
[pickers] Allow custom fields to validate the value #14486
flaviendelangle
merged 17 commits into
mui:master
from
flaviendelangle:clean-validation-api
Sep 11, 2024
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
flaviendelangle
added
the
component: pickers
This is the name of the generic UI component, not the React module!
label
Sep 4, 2024
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 4, 2024 10:04
96e2c3b
to
d0070e1
Compare
Deploy preview: https://deploy-preview-14486--material-ui-x.netlify.app/ Updated pages: |
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 4, 2024 10:10
d0070e1
to
c312072
Compare
flaviendelangle
changed the title
[pickers] Clean the validation internals DX to prepare for publication
[pickers] Clean and publish the validation internals
Sep 4, 2024
flaviendelangle
force-pushed
the
clean-validation-api
branch
6 times, most recently
from
September 4, 2024 11:46
18b2e88
to
2765a2e
Compare
flaviendelangle
changed the title
[pickers] Clean and publish the validation internals
[pickers] Allow custom fields to validate the value
Sep 4, 2024
flaviendelangle
force-pushed
the
clean-validation-api
branch
2 times, most recently
from
September 4, 2024 14:26
aed4748
to
0653dc3
Compare
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 4, 2024 14:28
0653dc3
to
db2fbcc
Compare
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 5, 2024 07:09
b095b86
to
f93a7be
Compare
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 5, 2024 07:21
f93a7be
to
80162f2
Compare
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 5, 2024 11:58
59f49be
to
75f943e
Compare
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 5, 2024 12:11
75f943e
to
d2405b3
Compare
flaviendelangle
force-pushed
the
clean-validation-api
branch
from
September 5, 2024 13:04
d47cf7a
to
0b4c4a1
Compare
4 tasks
github-actions
bot
added
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Sep 9, 2024
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
github-actions
bot
removed
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
Sep 9, 2024
LukasTy
approved these changes
Sep 11, 2024
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 work! 👍
This is a masive improvement! 💙 💯
The new custom field DX looks awesome. 🙌
Merged
2 tasks
3 tasks
arthurbalduini
pushed a commit
to arthurbalduini/mui-x
that referenced
this pull request
Sep 30, 2024
This was referenced Oct 5, 2024
This was referenced Oct 25, 2024
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.
Closes #14495
Changes
useValidation
isSameError
anddefaultErrorState
touseValidation
, instead bind thevalueManager
direction to thevalidator
(when usingvalidateTime
, we always need theisSameError
anddefaultErrorState
of thesingleItemValueManager
timezone
, thevalue
and theonChange
outside of theprops
object passed to theuseValidation
hook. We often override these properties (because we don't want the one in the prop, we want the one with a default value, the one of the internal state, etc...), we were often doingprops: { ...props, timezone, value: state.value }
which was very error prone. Nowprops
only contains the validation props (minDate
, ...), we could even consider renaming it.useValidation
(hasValidationError
andgetValidationErrorForNewValue
) to make sure that people never needutils
orvalueManager
to manage their error,useValidation
should be sufficient.Field components
DateFieldInPickerProps
,TimeFieldInPickerProps
, etc... interfaces that simplifies dramatically how to type custom fields. They contain the props the field actually receives from the picker.New DX
And if you want to
Demo
Extracted PRs
onError
JSDoc #14492useSplitFieldProps
and make it public #14514Follow up