Not to get too meta, but you can now use a custom widget to build custom widgets!
Developed by @jarek (who does work at Grist Labs), who has been using this widget to build and test widgets on the fly. Think of it as a “widget fiddle”.
Build with HTML/JavaScript.
Documentation available within the widget itself (via “Open Configuration” > “Help”).
Remember to save your work, as there’s no autosave!
I would love to know how far can we go with this Custom Widget Builder.
I suppose a lot of custom widgets already created depend on external libraries… for example… map widgets, the Advanced Charts widget, etc, right? And therefore those can´t be recreated with the custom widget builder??
This is great! Thanks for sharing, this’ll make quick prototyping a lot easier.
However, might I suggest the following for further improvement:
Store the HTML and JS in a record, via mapped columns, rather than in the widget settings. This would allow us to have a table dedicated to holding custom widgets, and open up easy ways of pulling in other data from the document.
Provide an option for iframeless operation, where ideally you’d have the <head> part of the HTML pre-configured (with the grist plugin api already included, of course) so that users would have to supply just the document body. This DOM could be dynamically appended rather than stuffed into an iframe.
creating a widget through this, the configuration of where the data comes from… is it through the widget itself or the Creator Panel, like when creating a “normal” custom widget, as per instructions here?
@Rogerio_Penna All limitation, that I can think of, were already mentioned, apart from that you can do whatever you want, in the end it just single HTML file rendered inside an iframe. Almost all custom widgets in the gallery can be recreated here (except this one and the one that inspects API, as this widget hijacks the Open configuration button).
The configuration is the same as in the instruction. This widget doesn’t change anything in the configuration.
Thanks for suggestion, but this way, you won’t be able to subscribe to onRecords event as the custom widget would need to be backed by this dedicated table. Alternatively, it could pull files from a different table, but then, it would require a full document access.
I’m not sure I understand it. In the HTML tab, you don’t need to add <html><head> tags at all. A widget with just a JS content (with all HTML removed) is perfectly fine, api library is added for you: