@maif/react-forms 1.0.60 → 1.1.2
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.
- package/README.md +21 -0
- package/lib/esm/index.js +1290 -2772
- package/lib/index.d.ts +364 -0
- package/lib/index.js +1304 -2786
- package/package.json +23 -15
package/README.md
CHANGED
|
@@ -100,6 +100,26 @@ export const Example = () => {
|
|
|
100
100
|
```javascript
|
|
101
101
|
({rawValues, value, setValue}) => if (value.length) { setValue('entry', false) }
|
|
102
102
|
```
|
|
103
|
+
- **onAfterChange**: a callback function to the value change.
|
|
104
|
+
```javascript
|
|
105
|
+
({entry, value, rawValues, previousValue, getValue, setValue, onChange, informations}) => {
|
|
106
|
+
const otherEntryVal = getValue('otherEntry')
|
|
107
|
+
console.debug({entry, value, rawValues, otherEntryVal})
|
|
108
|
+
setValue('anotherEntry', v + 1)
|
|
109
|
+
const {path, parent, index} = informations
|
|
110
|
+
console.debug({path, parent, index})
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
where :
|
|
114
|
+
- entry [string] is the updated entry of schema
|
|
115
|
+
- value [any] is the actual value of your entry
|
|
116
|
+
- previousValue [any] is the previous value of your entry
|
|
117
|
+
- rawValues [any] is the actual value of antire form
|
|
118
|
+
- getValue [function] is a function to get value of a form entry
|
|
119
|
+
- setValue [function] is a function to set value of a form entry
|
|
120
|
+
- onSave [function] is a function to update actual entry
|
|
121
|
+
- informations [Information] is an object to get information about the actual entry (path, index and parent informations)
|
|
122
|
+
|
|
103
123
|
- **render**: a function to completely custom the rendering of form field
|
|
104
124
|
```javascript
|
|
105
125
|
({rawValues, value, onChange, error, setValue, parent}) => <input type="text" className="is-invalid" value={value} onChange={e => onChange(e.target.value)} />
|
|
@@ -205,6 +225,7 @@ httpClient = {(url, method) => fetch(url, {
|
|
|
205
225
|
```
|
|
206
226
|
- **watch**: a boolean to activate the automatic log of form value. A function can be set up to override the default logger.
|
|
207
227
|
- **autosubmit**: a boolean to activate the automatic run of the `onSubmit` form properties on every change of values.
|
|
228
|
+
- **showErrorsOnStart**: a boolean to display constraints messages, not in error color, when starting the form.
|
|
208
229
|
- **actions**: an object to parameter footer buttons key. By default just `submit` button is displayed.
|
|
209
230
|
```javascript
|
|
210
231
|
<Form
|