@maif/react-forms 1.0.19 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,6 +68,6 @@ jobs:
68
68
  env:
69
69
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70
70
  REPO_OWNER: ${{ github.repository_owner }}
71
- REPO: daikoku
71
+ REPO: react-forms
72
72
  IGNORE_MILESTONE_NOT_FOUND: true
73
73
 
package/README.md CHANGED
@@ -73,7 +73,7 @@ export const Example = () => {
73
73
  - `email`: if the type is `string`, display an email input
74
74
  - `password`: if the type is `string`, display a password input
75
75
  - `hidden`: if the type is `string`, add an hidden input in your form
76
- - `form`: if the type is `object`, display a form in your form draw with given schema and flow.
76
+ - `form`: if the type is `object`, display a form in your form draw with given schema and flow. The form drawn is collapsable, by default on the first input but with `visibleOnCollapse` you can choose which field will be visble or not.
77
77
  - **array**: boolean value to display multiple fields with "add" and "remove" buttons (`false` by default)
78
78
  - **createOption**: if `select` format is choosen, `createOption` property is to render a Creatable component
79
79
  - **onCreateOption**: if `select` format is choosen, `onCreateOption` property is a function called before new option creation
@@ -92,6 +92,10 @@ export const Example = () => {
92
92
  - **help**: the text display hover a help button
93
93
  - **className**: you can customize classnames of field,
94
94
  - **style**: to styling a field, you can provide a json object with css
95
+ - **onChange**: a callback function to the value change.
96
+ ```javascript
97
+ ({rawValues, value, setValue}) => if (value.length) { setValue('entry', false) }
98
+ ```
95
99
  - **render**: a function to completely custom the rendering of form field
96
100
  ```javascript
97
101
  ({rawValues, value, onChange, error}) => <input type="text" className="is-invalid" value={value} onChange={e => onChange(e.target.value)} />
@@ -154,7 +158,7 @@ export const Example = () => {
154
158
 
155
159
  ## Form properties
156
160
  - **schema** (required): the form schema
157
- - **flow** (optional): the flow
161
+ - **flow** (optional): the flow. The order of the schema fields by key (Just a javascript array of strings). Fields can be group on collapsable item, in this case, you can add an object with `label`, `flow` and a boolean `collapse` property. Collapse item can draw inline form thanks to boolean `inline` property
158
162
  - **onSubmit** (required): a function run on the form submission (in case if the form is valid )
159
163
  - **value** (optional): default value
160
164
  - **inputWrapper** (optional): A custom component to wrap all input of the form
@@ -185,6 +189,7 @@ httpClient = {(url, method) => fetch(url, {
185
189
  }
186
190
  })}
187
191
  ```
192
+ - **watch**: a boolean to activate the automatic log of form value. A function can be set up to override the default logger.
188
193
  - **autosubmit**: a boolean to activate the automatic run of the `onSubmit` form properties on every change of values.
189
194
  - **actions**: an object to parameter footer buttons key. By default just `submit` button is displayed.
190
195
  ```javascript