Hi there! I am on a project that has been using JSONForms with React and MUI for quite some time now to great effect. Thanks for all of your work on this so far!
I am currently encountering an issue as I attempt to implement a new piece of functionality for our users. I am hoping to render a string of the HTML out of our previously completed forms in read only mode for use elsewhere within our backend. I have the rest of the stuff around this figured out, and was hoping to leverage the React DOM renderToString
function to do this, sort of analogous to a server side rendering/isomorphic javascript approach. The issue that we’re currently stuck on is that I cannot get the whole form to render out within this context. We are using React and MUI, and upon finding this thread, it seems that between the use of the use of the deprecated hidden component and that component now being inaccessible from the MUI theme (so it isnt possible switch it to using the css implementation via the prop), that doing a server side rendering setup like this is not currently possible.
I did find the 3.3 milestone on github which shows that there is a plan to remove this at some point in the future. My question is, if my understanding of this situation is correct, is there any sort of available workaround in the meantime? My thoughts so far are:
- Implement my own version of the
MaterialLayoutRenderer
component: this is where that<Hidden>
lives. I could copy over the component to use as a base, implement the change for the time being, and that should get me off to the races. This seems a bit goofy, but this would keep us on track with our deliverable dates, with the only overhead being removing this once 3.3 comes out. - We had started with the material renderers as a base, but at this point are using custom renderers for everything. Could I possibly switch to the React Vanilla renderers package? My renderers themselves contain a bunch of MUI elements, but that should be encapsulated enough that I can figure out any discrepancies from there. As long as it wont break the form overall, I should be safe to make that change.
- Alternatively, is there a way hand over a schema and data to JSONforms core and render out a form with its data appropriately, just in read only mode? If I can isolate things into this use case I can get away with using a stripped down version of the form with no real MUI styling for this use case, so I can lose the specific UI appearance. Its also just in read only mode, so I don’t need any amount of interactivity. I just need to make sure that I get the same schema rules (like
SHOW
andHIDE
, along with someif...then
uses) applied and the questions and the data appropriately correlated. Ultimately I just need to correctly represent the contents of a previously completed form for use in our backend, so if this is possible, it may even be simpler.
Please let me know if that makes sense, or if any other clarification is needed. Thank you!