Closed PawelSuwinski closed 3 months ago
In my opinion, the Guesser should only get you started, and then you should paste its code and customize it. Otherwise, it will become some kind of "god component", which goes against the philosophy of react-admin.
In my opinion, the Guesser should only get you started, and then you should paste its code and customize it. Otherwise, it will become some kind of "god component", which goes against the philosophy of react-admin.
In generall you are right but api-platform Guessers are something more than RA Guessers. There is a override-code message that hints the customization (https://github.com/api-platform/admin/blob/4645fb57ad8a9b443321677ba3cd3fe9c2e8cb33/src/CreateGuesser.tsx#L26) but there are also introsopection, transform, save and other callbacks that form needs, and it was afterall the goal of the api-platform, as a kind of low-code, not to assembly to many things by hand (hydra, schema.org etc). Maybe it should be named in other way then guessers, or all those callbacks should be exported as hooks, but now it is not.
@fzaninotto your comment made me want to do some refactoring (#542) to makes easier to write custom form components, so please give some feedback about that.
Possibility to set guesser's form id using
formId
attribute. It allows to place any input element outside the form.Example of submit button on the AppBar (just to show the idea, whole implementation uses
React.createPortal()
and a bit more code):