Open josephguillaume opened 1 year ago
It should be possible to do something like this:
const form = document.createElement('rdf-form')
form.addEventListener('register-elements', (event) => {
event.detail.fields = {
'my-field': MyField,
'my-field2': MyField2,
}
})
It should not be needed to rebuild the custom component.
I am also working on a new iteration of some of the ideas of rdf-form. You can see it here: https://github.com/danielbeeke/frm That form system is built upon SHACL. It is no yet finished though. It is easier to extend because it has a config which you can just give extra widgets.
Just trying to understand the design
The documentation states: "The field widget, the widget that will be displayed. It may be a dropdown, radios, a map to select a location or something else. You can also implement your own."
If I understand correctly, widgets are exported in https://github.com/danielbeeke/rdf-form/blob/master/src/plugins.ts and loaded as BaseFields in: https://github.com/danielbeeke/rdf-form/blob/c7de57aba58d14aed05c1b1474983b3b29bdb8f4/src/core/Registry.ts#L21
event.detail.fields
doesn't seem to add anything at this time?Each widget has to extend https://github.com/danielbeeke/rdf-form/blob/master/src/elements/ElementBase.ts and includes html templates constructed as string literals using uhtml
Implementing a widget therefore involves adding an import to plugins.ts and rebuilding the custom component. (There is no dynamic/runtime widget registration).
Does this sound right? Thanks!