This example shows how <FrameViewier/> appears for a document called Graduate with a one of field in Create/ Edit and View mode. The value of the @oneOf field is a set, so can be any number of documents all of which have mutually disjointed properties, but which can coexist.
In this example Graduate has a property scored that points to Grades. Grades is defined as @oneOf that is an array of documents which can take any choice within. In this example, Grades can take any choice from grade, marks or report.
Demo
Take a look at the Demo Playground to view the <FrameViewier/> with the OneOfs properties in Create, Edit and View mode.
import { FrameViewer } from'@terminusdb/terminusdb-documents-ui'return <FrameViewerframe={frame} // above defined frame formData={{}} // formData will be emptymode={"Create"} // mode type={"Graduate"}/> // type of document
Edit & View
Note - make sure to provide document values for View mode. The form will be in read only mode for View.
let data = {"@id":"Graduate/efb4f89c825dd2c6404b5998b0d170b1df9a250103d7556833c3017e2107da23","@type":"Graduate","scored": { "@id": "Graduate/efb4f89c825dd2c6404b5998b0d170b1df9a250103d7556833c3017e2107da23/scored/Grades/8079b8089b18a97dab9d4af3bffd496f744841bf7b72caaa4a2a2f189fc496b7",
"@type":"Grades","report": { "@id": "Graduate/efb4f89c825dd2c6404b5998b0d170b1df9a250103d7556833c3017e2107da23/scored/Graduate/efb4f89c825dd2c6404b5998b0d170b1df9a250103d7556833c3017e2107da23/scored/Grades/8079b8089b18a97dab9d4af3bffd496f744841bf7b72caaa4a2a2f189fc496b7/report/GradeReport/d947ef4e4a261ef6e469b9e24c944c58405e49952fe45b8f50852b650481aec1",
"@type":"GradeReport","comments":"Outstanding ","score":"Outstanding" } }}return <FrameViewerframe={frame}mode={"View"}formData={data}type={"Graduate"}/>