Closed leomerida15 closed 1 month ago
Hey this looks very interesting - I think splitting the general logic from being shadcn-specific sounds good. I don't know if this is the most intuitive method of doing it and integrating with the local shadcn components I'd definitely take a look if you publish the package.
First of all, thank you very much for this repository. I really like it. I think it's one of the best I've seen for tackling the problem of generating forms quickly. I'd love to be a contributor. That's why I created this class because I'm the company's technology director and we use multiple component libraries. I'll be publishing this package on npm and I think you might want to add it to this repository so that you can make the library more apprehensive about the component library.
current form
diagram:
How would the implementation be:
How to access the content: it is essentially a "Map" constructor so you can use all its methods but with the keys well typed so that the editor offers you suggestions, For now it only uses two different methods than "Map".
exists: it is different from ".has()" it receives a string and checks if it exists in the keys, if it exists it returns the same key that you inserted but typed as if it exists in the keys of the list, and if it does not exist it returns "fallback"
, in this way the props can be changed dynamically according to the component library and if the InputMap instance is exposed to the developer, he could add a custom component using an append method, so new components could be added without having to edit the current code of the repository, it happened to me that I add my custom components but when I reinstall auto-from to get the new functions my changes are deleted or I have to add it again to the old objects.
This way you can get the list of keys that exist in the component list