Best way to build on core renderers

Hi all,

I am relatively new to some of these technologies, and so this question might not be specific to JSONForms, but here goes: I am trying to make slight modifications to core renderers, such changing a line or two. My approach has been to copy the code of the renderer into my custom file. This works fine in some cases, but in others the core renderers have “import” statements that reference other files using relative paths.

For example, I am trying to create a slightly modified version of this renderer: jsonforms/packages/material-renderers/src/complex/MaterialArrayControlRenderer.tsx at master · eclipsesource/jsonforms · GitHub

However on line 37 it imports DeleteDialog using a relative path: jsonforms/packages/material-renderers/src/complex/MaterialArrayControlRenderer.tsx at master · eclipsesource/jsonforms · GitHub

The only way I have found for this to work is to copy all of the code from DeleteDialog into a local file. But that seems really inefficient, and also cascades, because each file may import still more local files - so I’m ending up with entire folders full of local files that aren’t changed at all.

Does anyone know if there is a way - perhaps to focus on this specific example - for my custom render to import DeleteDialog in a way that does not rely on a local file?

I hope this makes sense but let me know if I’m not explaining it well. Thank you for any tips!

Hi @brockfanning,

The DeleteDialog is sadly not exported so there is no way to access it. Copying is the correct solution for now.

If you encounter such an issue then feel free to open a PR to export the component in question.

Cheers,
Stefan

Just following up to say that I believe many things have been exported since I posted this. Unless I’m mistaken, I can now do things like:

import { DeleteDialog } from '@jsonforms/material-renderers';

So I think I’m all set here. But I will submit a PR if I notice anything still yet to be exported. Thank you!

Yes, for the latest version 3.1.0 we overhauled the exports of the React Material renderers. We definitely export much more now, including the DeleteDialog :+1: