eclipsesource / jsonforms-vuetify-renderers

https://jsonforms-vuetify-renderers.netlify.app/
Other
25 stars 26 forks source link

provide template renderer - fixes #85 #86

Closed kchobantonov closed 1 year ago

kchobantonov commented 1 year ago

Provide a general layout renderer that is based on vue templates. The template renderer can be extended to recognize new components, data, etc.

Also provide Template renderer and Slot renderer that are used with uischemas - for work with that feature a new name property was introduced to UISchemaElement (as new property - not changing the jsonforms core definition which at some point will be nice to be moved there - e.g. able to name the UISchemaElements)

netlify[bot] commented 1 year ago

Deploy Preview for jsonforms-vuetify-renderers ready!

Name Link
Latest commit a2847a84b5a732c234c1ec571e18531f86e0aef3
Latest deploy log https://app.netlify.com/sites/jsonforms-vuetify-renderers/deploys/6393e1cf0711580008fd90d5
Deploy Preview https://deploy-preview-86--jsonforms-vuetify-renderers.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

kchobantonov commented 1 year ago

@sdirix @lucas-koehler here is the rewritten template-renderer but this time it does not depend on the vue-template-compiler directly which means that if you do not want to use it then you won't be having the target JS file enlarged with the vue-template-compiler

At the moment the example application is using the advancedVuetifyRenderers that included this new renderer - the code is in example/src/store/modules/app.ts

If you build the example application under the dist/js folder you will see the npm.vue-template-compiler...js dependency - but if you change this code in app.ts

// import {
//   createAjv,
//   extendedVuetifyRenderers as vuetifyRenderers,
// } from '@jsonforms/vue2-vuetify';

// async load of compiler to enable code split
const compileToFunctions = () =>
  import('vue-template-compiler').then((module) => {
    const { compileToFunctions } = module;
    return compileToFunctions;
  });
import { createAjv, advancedVuetifyRenderers } from '@jsonforms/vue2-vuetify';
const vuetifyRenderers = advancedVuetifyRenderers(compileToFunctions);

to this

 import {
   createAjv,
   extendedVuetifyRenderers as vuetifyRenderers,
 } from '@jsonforms/vue2-vuetify';

// async load of compiler to enable code split
//const compileToFunctions = () =>
// import('vue-template-compiler').then((module) => {
//    const { compileToFunctions } = module;
//    return compileToFunctions;
//  });
// import { createAjv, advancedVuetifyRenderers } from '@jsonforms/vue2-vuetify';
// const vuetifyRenderers = advancedVuetifyRenderers(compileToFunctions);

then you won't see the npm.vue-template-compiler dependency and the demo page template-renderer won't show all elements and will say that it can't find a renderer.

kchobantonov commented 1 year ago

Fixes #85

kchobantonov commented 1 year ago

@sdirix @lucas-koehler this PR is ready - I have added additional TemplateRenderer and SlotRenderer so we can reuse the schemas defined in uischemas.json (also provided in the tabs to be viewed and edited - of course the tester is a string version of the JS function although for the Template/Slot renderers this is no needed but for the Root Object demo I'm showing how we can use the tester function.

Please review and if possible I would liked to include this into the final release

Check the Template/Slot renderer demo https://deploy-preview-86--jsonforms-vuetify-renderers.netlify.app/#/example/template-slot

sdirix commented 1 year ago

Please review and if possible I would liked to include this into the final release

Thanks for all your contributions. We'll take a look as soon as possible for us. We now did the 3.0 release as the main packages are already released for a while and we should not trail too much behind.

However going forward we plan to stable release more often than before, so the changes in the pipeline don't need to wait for a year for a stable release.

kchobantonov commented 1 year ago

@lucas-koehler will you have time to review this PR as well as the one for the file support before we release ? @sdirix are you planning to include those 2 open PRs before releasing the next version or you want to release with the changes for the controls which was merged already and later on have another release if you need more time to review and consider those 2 PRs?

sdirix commented 1 year ago

HI @kchobantonov, I just released the 3.1.0-alpha.0 version of the renderer set which also aligns it again with the other packages which were already released as 3.1.0-alpha.0.

Next I would like to suggest that we take a look at the file renderer PR. However that will not happen before January 2023.

Regarding the template renderers I'm still not sure whether it makes sense to add them to the base JSON Forms Vuetify renderer set. As discussed previously, the use case is not really a core use case of the renderer set nor do we use the feature ourselves. The template renderers are probably most useful in the webcomponent variant of the renderer set as it's not easy to add custom renderers there. You might want to consider including them in the webcomponent release and/or releasing them standalone.

lucas-koehler commented 1 year ago

We decided not to introduce the template renderer into this repository's core renderer set as discussed above. If you release it on you own, gladly reference it in the community section of the JSON Forms website :)