You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-23Lines changed: 29 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ Formule is a **powerful, user-friendly, extensible and mobile-friendly form buil
6
6
7
7
It originated from the need of a flexible tool for physicists at CERN to create their custom forms in the [CERN Analysis Preservation](https://github.com/cernanalysispreservation/analysispreservation.cern.ch) application (a process that was originally done by the CAP team who had to manually define the JSON schemas for every member experiment) in a zero-code fashion. This tool proved to be very useful for us to more easily scalate and expand, reaching a wider audience here at CERN. So, we thought it could also be useful for other people and decided to decouple it from CAP and release it as an open source library.
8
8
9
-
>[!WARNING]
10
-
>react-formule has just come out and is undergoing active development, so please feel free to share any issue you find with us and/or to contribute!
9
+
>[!WARNING]
10
+
>react-formule has just come out and is undergoing active development, so please feel free to share any issue you find with us and/or to contribute!
11
11
12
12
## :carousel_horse: How it looks like
13
13
@@ -21,19 +21,20 @@ Formule consists of the following main components:
21
21
22
22
-**`FormuleContext`**: Formule components need to be wrapped by a FormuleContext. It also allows you to provide an antd theme and your own custom fields and widgets.
23
23
- The form editor, which has been split into three different components that work together for more flexibility:
24
-
-**`SelectOrEdit`** (or, separately, **`SelectFieldType`** and **`PropertyEditor`**): You can select fields to add to the form and customize their properties.
25
-
-**`SchemaPreview`**: A tree view of the fields where you can rearrange or select fields to be edited.
26
-
-**`FormPreview`**: A live, iteractive preview of the form.
24
+
-**`SelectOrEdit`** (or, separately, **`SelectFieldType`** and **`PropertyEditor`**): You can select fields to add to the form and customize their properties.
25
+
-**`SchemaPreview`**: A tree view of the fields where you can rearrange or select fields to be edited.
26
+
-**`FormPreview`**: A live, iteractive preview of the form.
27
27
-**`FormuleForm`**: You can use it to display a form (JSON Schema) generated by Formule.
28
28
29
29
It also exports the following functions:
30
30
31
-
-**`initFormuleSchema`**: Inits the JSONSchema, *needs* to be run on startup.
31
+
-**`initFormuleSchema`**: Inits the JSONSchema, _needs_ to be run on startup.
32
32
-**`getFormuleState`**: Formule has its own internal redux state. You can retrieve it at any moment if you so require for more advanced use cases. If you want to continuosly synchronize the Formule state in your app, you can pass a callback function to FormuleContext instead (see below), which will be called every time the form state changes.
33
33
34
34
### Field types
35
35
36
36
Formule includes a variety of predefined field types, grouped in three categories:
-`Object`: Use it of you want to group fields or to add several of them inside of a `List`.
@@ -45,23 +46,25 @@ Formule includes a variety of predefined field types, grouped in three categorie
45
46
46
47
You can freely remove some of these predefined fields and add your own custom fields and widgets following the JSON Schema specifications. More details below.
47
48
48
-
All of these items contain different settings that you can tinker with, separated into **Schema Settings** (*generally* affecting how the field *works*) and **UI Schema Settings** (*generally* affecting how the field *looks* like).
49
+
All of these items contain different settings that you can tinker with, separated into **Schema Settings** (_generally_ affecting how the field _works_) and **UI Schema Settings** (_generally_ affecting how the field _looks_ like).
If you want to disable the [DnD](https://github.com/react-dnd/react-dnd) functionality, you can pass `dnd={false}` to `FormuleContext`. This will enable an alternative, button-based method to add and move fields.
If you want to run some logic in your application every time the current Formule state changes in any way (e.g. to run some action every time a new field is added to the form) you can pass a function to be called back when that happens:
Alternatively, you can pull the current state on demand by calling `getFormuleState` at any moment.
@@ -114,4 +119,5 @@ Alternatively, you can pull the current state on demand by calling `getFormuleSt
114
119
> For more examples, feel free to browse around the [CERN Analysis Preservation](https://github.com/cernanalysispreservation/analysispreservation.cern.ch) repository, where we use all the features mentioned above.
115
120
116
121
## :space_invader: Local demo & how to contribute
117
-
You can also clone the repo and run `formule-demo` to play around. Follow the instructions in its [README](./formule-demo/README.md): it will explain how to install `react-formule` as a local dependency (with either `yarn link` or, better, `yalc`) so that you can modify Formule and test the changes live in your host app, which will be ideal if you want to troubleshoot or contribute to the project.
122
+
123
+
You can also clone the repo and run `formule-demo` to play around. Follow the instructions in its [README](./formule-demo/README.md): it will explain how to install `react-formule` as a local dependency (with either `yarn link` or, better, `yalc`) so that you can modify Formule and test the changes live in your host app, which will be ideal if you want to troubleshoot or contribute to the project.
0 commit comments