-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Implemented custom AutoField prototype. #800
Conversation
Codecov Report
@@ Coverage Diff @@
## master #800 +/- ##
==========================================
- Coverage 97.54% 97.48% -0.06%
==========================================
Files 175 176 +1
Lines 3420 3339 -81
Branches 658 651 -7
==========================================
- Hits 3336 3255 -81
Misses 8 8
Partials 76 76
Continue to review full report at Codecov.
|
1.) |
{
BoolField: MyCustomBoolField,
...
} Then if someone would only want to override (or create a new theme), one would pass overridden map and wouldn't have to change the If component return logic is more complicated than based on the default, one could write its own |
|
I meant only that if you have your own implementation of return 'options' in component && component.options?.kind === 'leaf'
? createElement(component.Component, props)
: createElement(component, originalProps); then It's lost. |
I've updated the description. If everything will be fine, I'll update all themes. |
This change provides a new implementation of
AutoField
and an accordingAutoFieldContext
to override field detection implementation. Internally acreateAutoField
was added as well in order to reduce the amount of boilerplate theme code to a minimum.Open questions:
AutoFieldContext
a good name? MaybeAutoField.context
orAutoField.componentDetectorContext
is a better one?createAutoField
- should we consider it an internal API for now/forever?useContext
or implement it in their own project. Another solution would be to treat the provided one with a higher priority and fallback to the default one.Closes #640.
Update 2020-12-21:
AutoFieldContext
toAutoField.componentDetectorContext
in order to reduce API surface. We may change it in the future.createAutoField
,AutoField.componentDetectorContext
, andAutoField.defaultComponentDetector
are considered internal for now.AutoField.defaultComponentDetector
.