This module takes a simplified JSON that represents the key data needed to represent a webTemplate as inputs, as returned by ehr-template-processor, and converts it into a React Formsy form, with either standard Formsy stylings or NHS Frontend style stylings.
Simply clone (or add as submodule), and run npm install
.
jsonFormInputObject
: a JSON tree that is the webTemplate property of a response from a get request for a template from a CDR.
A React component containing Formsy inputs that can be placed into a Formsy form.
Say that you are iterating over a flat simplified JSON object as returned by treeTrawlGettingFlatInputs
from ehr-template-processor. Run this function for each member of that list, and it will generate React code for each input.
{resultOfTreeTrawlGettingFlatInputs.map((jsonInputObject) => {
return JsonFormInputToReact(jsonInputObject)
})}
jsonFormInputObject
: an input object as returned as subtrees from the results of treeTrawlGettingFlatInputs
/treeTrawlGettingStructuredInputs
from ehr-template-processor, or as the direct result of inputToJsonFormInput
from that module.
A React component containing NHS styled Formsy inputs that can be placed into a Formsy form.
Say that you are iterating over a flat simplified JSON object as returned by treeTrawlGettingFlatInputs
from ehr-template-processor. Run this function for each member of that list, and it will generate React code for each input.
{resultOfTreeTrawlGettingFlatInputs.map((jsonInputObject) => {
return JsonFormInputToNHSReact(jsonInputObject)
})}
or
return JsonFormInputToNHSReact(inputToJsonFormInput(someSubTreeOfWebTemplate));
Licensed under the MIT License. See LICENSE for more details.