-
Notifications
You must be signed in to change notification settings - Fork 102
Add field type extensions #410
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
base: main
Are you sure you want to change the base?
Conversation
daf535e
to
e600a4c
Compare
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.
PR Summary
This PR introduces a field extension behavior system that allows developers to create custom field types with their own rendering logic and CSS classes in the Petal Components library.
- Added new
PetalComponents.Field.Extension
behavior with requiredrender/1
and optionalget_class_for_type/1
callbacks - Implemented persistent term storage for field extensions to optimize performance (6.96x faster than Application.get_env)
- Added support for merging custom assigns with field extensions for flexible customization
- Added comprehensive test coverage for extension fields with datalist support
- Introduced phx-debounce support for form validation with configurable delay
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
5 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
This change enables to extend fields with custom types in order to be able to inject custom body in a field wrapper.
Hi @saleyn. Could you create a standalone component to achieve the same thing or is there a benefit to using this method instead? |
It seems to me that restricting the inputs to a set of predefined types is too limiting as users often need to define custom input handlers. The disadvantage of needing to implement a standalone input component is in uniformity of field styling and naming (e.g. not being able to use |
This change enables to extend fields with custom types in order to be able to inject custom body in a field wrapper.