Skip to content

CarlosNZ/jsonforms-with-figtree-demo

 
 

Repository files navigation

JSON Forms with FigTree Evaluator

Based on JSON Forms React Seed App, this repo demonstrates one way to integrate JSON Forms with FigTree Evaluator in order to allow more complex form logic (such as dynamic drop-down menus and dynamic text labels).

A published demo of this repo is available at https://carlosnz.github.io/jsonforms-with-figtree-demo.

  • Execute npm ci to install the prerequisites. If you want to have the latest released versions use npm install.
  • Execute npm run build to build the application.
  • Execute npm start to start the application.

Please see FigTree documentation for detailed information on how to create FigTree expressions.

The main additions here from the original JSON Forms Seed App are:

  • "TextDisplay" renderer for simply displaying text-only information in the form
  • "useFigTreeEvaluator" hook, which evaluates both the json schema (schema.json) and ui schema (uischema.json) using FigTree. It is re-evaluated whenever data (the form state data) changes.
  • Evaluate visible and enabled parameters on each element (in UI Schema), which are compiled into JSON Forms rules. This allows the visible/enabled rules to be specified using FigTree expressions.
  • schema.json and uischema.json have a number of dynamic elements using FigTree expressions.

Languages

  • TypeScript 73.3%
  • JavaScript 22.5%
  • HTML 2.3%
  • CSS 1.9%