@maif/react-forms 1.1.4 → 1.2.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 +26 -14
- package/lib/esm/index.js +502 -113
- package/lib/index.css +6 -14
- package/lib/index.d.ts +25 -12
- package/lib/index.js +513 -122
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -88,9 +88,9 @@ export const Example = () => {
|
|
|
88
88
|
```
|
|
89
89
|
- **isMulti**: if `select` format is choosen, `isMulti` property is to render a multiselect component
|
|
90
90
|
- **defaultKeyValue**: if `object` format is choosen, this default key/value is set for all added entries
|
|
91
|
-
- **visible**: a boolean option to hide/display form field.
|
|
92
|
-
- **disabled**: A boolean option to enable/disable form field
|
|
93
|
-
- **label**:
|
|
91
|
+
- **visible**: a boolean or [functional boolean](#functional-properties) option to hide/display form field.
|
|
92
|
+
- **disabled**: A boolean or [functional boolean](#functional-properties) option to enable/disable form field
|
|
93
|
+
- **label**: A string or [functional string](#functional-properties) to labelize of form field (you can pass `null` to not render a label)
|
|
94
94
|
- **placeholder**: the placeholder of form field
|
|
95
95
|
- **defaultValue**: A default value to fill field by default
|
|
96
96
|
- **help**: the text display hover a help button
|
|
@@ -114,11 +114,11 @@ export const Example = () => {
|
|
|
114
114
|
- entry [string] is the updated entry of schema
|
|
115
115
|
- value [any] is the actual value of your entry
|
|
116
116
|
- previousValue [any] is the previous value of your entry
|
|
117
|
-
- rawValues [any] is the actual value of
|
|
117
|
+
- rawValues [any] is the actual value of entire form
|
|
118
118
|
- getValue [function] is a function to get value of a form entry
|
|
119
119
|
- setValue [function] is a function to set value of a form entry
|
|
120
120
|
- onSave [function] is a function to update actual entry
|
|
121
|
-
- informations [Information] is an object to get
|
|
121
|
+
- informations [Information] is an object to get informations about the actual entry (path, index and parent informations)
|
|
122
122
|
|
|
123
123
|
- **render**: a function to completely custom the rendering of form field
|
|
124
124
|
```javascript
|
|
@@ -189,6 +189,14 @@ export const Example = () => {
|
|
|
189
189
|
```
|
|
190
190
|
- **constraints**: a JSON array of constraints. see [constraints section](#constraints)
|
|
191
191
|
|
|
192
|
+
### Functional properties
|
|
193
|
+
Some schema properties can be basic value or function which return basic value. This function has an object as param with these following properties :
|
|
194
|
+
- **rawValues**: the actual value of antire form
|
|
195
|
+
- **value**: the actual value of the actual entry
|
|
196
|
+
- **error**: the error of the entry (undefined if there is no error)
|
|
197
|
+
- **informations**: an object to get informations about the actual entry (path, index and parent informations)
|
|
198
|
+
- **getValue**: a function to get value of a form entry
|
|
199
|
+
|
|
192
200
|
|
|
193
201
|
## Form properties
|
|
194
202
|
- **schema** (required): the form schema
|
|
@@ -229,15 +237,19 @@ httpClient = {(url, method) => fetch(url, {
|
|
|
229
237
|
- **actions**: an object to parameter footer buttons key. By default just `submit` button is displayed.
|
|
230
238
|
```javascript
|
|
231
239
|
<Form
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
options={
|
|
241
|
+
autosubmit: true,
|
|
242
|
+
showErrorsOnStart: true,
|
|
243
|
+
actions={
|
|
244
|
+
reset: {
|
|
245
|
+
display: false (value by default)
|
|
246
|
+
label: 'reset' (value by default)
|
|
247
|
+
},
|
|
248
|
+
submit: {
|
|
249
|
+
display: true (value by default)
|
|
250
|
+
label: "save" (value by default)
|
|
251
|
+
}
|
|
252
|
+
}
|
|
241
253
|
}
|
|
242
254
|
/>
|
|
243
255
|
```
|