cern-sis / react-formule

User-friendly, extensible form builder for React based on JSON Schema and RJSF
https://cern-sis.github.io/react-formule/
MIT License
7 stars 3 forks source link

Add preview/published version of fields #40

Open miguelgrc opened 1 month ago

miguelgrc commented 1 month ago

Right now we don't have a way to preview the published/saved forms' data without displaying it inside of the corresponding fields set as readonly. We need to add a way to display for example the content of a text field as pure text instead of a filled-in text field, or a URL as an actual hyperlink instead of an url field.

A way of implementing this would be to have alternative "preview" implementations of those fields in alternative fields/index.js and widgets/index.js and to pass those to the RJSF form in Form.jsx instead of the normal implementations when a isPreview or isPublished (tbd) property is present. For users we could either add and expose a new FormulePreviewForm to be used when they want to render the form in this fashion, or alternatively add some isPreview prop to be passed directly to FormuleForm (by default it should show the published version).

Would be needed at least for Text, TextArea, Url, RichEditor and Latex.