How to wrap all possible renderers in one component with additional input

Hello, I am using JSONForms to display multiple forms that vary. I have created my custom renderer in which I can set certain parameter that changes the renderer to default one (through updating schema). But as the renderer changes I can’t go back to my custom renderer, since defult one does not have the possibility to change said parameter back. Is there any way to wrap all default renderers and have also an input indicating if I want to use defult one or my custom component? What I need is a renderer that has said input changing parameter in schema and based on that parameter I would like to display my custom renderer or default one corresponding to schema type. I’m not sure how to make it work in Angular.

Best regards,
Pawel

Hi @Pawel,

I’m not sure I fully understand the question. Normally I would try to avoid modifying the schema just for UI purposes, especially dynamically at runtime.

The testers (which in the end decide which controls are rendered) are currently handed over (starting from 3.0.0-rc.0:

  • the current (sub)schema
  • the uischema to render
  • a context containing the rootschema and the global config.

Is this information enough for your use cases or is there something missing? Can you give some example schemas to better understand what you are trying to accomplish?

Hi,

to meet conditions mentioned above I tried to use JSONForms library inside custom renderer, and it works like expected but I have another problem - after updating value of one control whole form is re-rendered, is there any way to avoid it?
This is what I’m using to update:

const path = composeWithUi(this.uischema as ControlElement, this.path);
this.jsonFormsService.updateCore(Actions.update(path, () => value));

or is there any way of knowing if the form has done re-rendering?

The code looks fine.

The form needs to rerender as the data has changed. Usually I would expect that only the parts which are affected by the change actually rerender but maybe this is not the case for the Angular renderers at the moment.

We are aware of some performance problems which are currently worked on. So if it works for you I would recommend to just ignore the rerender for now and wait for the changes to come in to see whether you actually have a problem then.