@maif/react-forms 1.0.35 → 1.0.38
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 +2 -12
- package/lib/esm/index.js +614 -819
- package/lib/index.js +616 -820
- package/package.json +11 -4
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -10
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -10
- package/.github/workflows/build-playground.yml +0 -34
- package/.github/workflows/generate-release-note.yml +0 -48
- package/.github/workflows/release.yml +0 -73
- package/docs/asset-manifest.json +0 -24
- package/docs/index.html +0 -1
- package/docs/manifest.json +0 -25
- package/docs/robots.txt +0 -3
- package/docs/static/css/2.6902daba.chunk.css +0 -11
- package/docs/static/css/2.6902daba.chunk.css.map +0 -1
- package/docs/static/css/main.8693c9f3.chunk.css +0 -2
- package/docs/static/css/main.8693c9f3.chunk.css.map +0 -1
- package/docs/static/js/2.bc3a307f.chunk.js +0 -3
- package/docs/static/js/2.bc3a307f.chunk.js.LICENSE.txt +0 -147
- package/docs/static/js/2.bc3a307f.chunk.js.map +0 -1
- package/docs/static/js/main.a5abf7f1.chunk.js +0 -2
- package/docs/static/js/main.a5abf7f1.chunk.js.map +0 -1
- package/docs/static/js/runtime-main.368a22f5.js +0 -2
- package/docs/static/js/runtime-main.368a22f5.js.map +0 -1
- package/docs/static/media/fa-brands-400.2285773e.woff +0 -0
- package/docs/static/media/fa-brands-400.23f19bb0.eot +0 -0
- package/docs/static/media/fa-brands-400.2f517e09.svg +0 -3717
- package/docs/static/media/fa-brands-400.527940b1.ttf +0 -0
- package/docs/static/media/fa-brands-400.d878b0a6.woff2 +0 -0
- package/docs/static/media/fa-regular-400.4689f52c.svg +0 -801
- package/docs/static/media/fa-regular-400.491974d1.ttf +0 -0
- package/docs/static/media/fa-regular-400.77206a6b.eot +0 -0
- package/docs/static/media/fa-regular-400.7a333762.woff2 +0 -0
- package/docs/static/media/fa-regular-400.bb58e57c.woff +0 -0
- package/docs/static/media/fa-solid-900.1551f4f6.woff2 +0 -0
- package/docs/static/media/fa-solid-900.7a8b4f13.svg +0 -5034
- package/docs/static/media/fa-solid-900.9bbb245e.eot +0 -0
- package/docs/static/media/fa-solid-900.be9ee23c.ttf +0 -0
- package/docs/static/media/fa-solid-900.eeccf4f6.woff +0 -0
- package/examples/.env +0 -2
- package/examples/README.md +0 -0
- package/examples/package.json +0 -43
- package/examples/public/index.html +0 -43
- package/examples/public/manifest.json +0 -25
- package/examples/public/robots.txt +0 -3
- package/examples/src/App.css +0 -10
- package/examples/src/Playground.js +0 -158
- package/examples/src/WrapperError.js +0 -21
- package/examples/src/index.css +0 -13
- package/examples/src/index.js +0 -11
- package/examples/src/reportWebVitals.js +0 -13
- package/examples/src/schema/basic.json +0 -15
- package/examples/src/schema/constrainedBasic.json +0 -28
- package/examples/src/schema/constraintsWithRef.json +0 -44
- package/examples/src/schema/dynamicForm.json +0 -57
- package/examples/src/schema/formArray.js +0 -30
- package/examples/src/schema/formInForm.json +0 -39
- package/examples/src/schema/selector.json +0 -14
- package/jest-sync.config.json +0 -17
- package/rollup.config.js +0 -64
- package/scripts/build.sh +0 -34
- package/test/array.spec.js +0 -78
- package/test/bool.spec.js +0 -29
- package/test/date.spec.js +0 -41
- package/test/number.spec.js +0 -124
- package/test/object.spec.js +0 -14
- package/test/string.spec.js +0 -87
- package/test/testUtils.js +0 -30
- package/test-setup.js +0 -9
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ export const Example = () => {
|
|
|
70
70
|
- `code`: if the type is `string`, display a code input (draw with [react-ace](https://github.com/securingsincity/react-ace)) (add a props.setRef to get ace editor ref)
|
|
71
71
|
- `singleLineCode`: renders text input with syntax highlighting (draw with [react-ace](https://github.com/securingsincity/react-ace)) (add a props.setRef to get ace editor ref)
|
|
72
72
|
- `markdown`: if the type is `string`, display a markdown input
|
|
73
|
-
- `
|
|
73
|
+
- `textarea`: if the type is `string`, display a textarea
|
|
74
74
|
- `email`: if the type is `string`, display an email input
|
|
75
75
|
- `password`: if the type is `string`, display a password input
|
|
76
76
|
- `hidden`: if the type is `string`, add an hidden input in your form
|
|
@@ -219,10 +219,10 @@ httpClient = {(url, method) => fetch(url, {
|
|
|
219
219
|
```
|
|
220
220
|
## constraints
|
|
221
221
|
Possible constraints are provided by import `constraints` from **@maif/react-form** or can be wrotes on json
|
|
222
|
+
By default all fields of the form are nullable (they can accept `null` or `undefined` value).
|
|
222
223
|
|
|
223
224
|
- [mixed](#mixed)
|
|
224
225
|
- [`constraints.required(message?:string)`](#constraintsrequiredmessagestring)
|
|
225
|
-
- [`constraints.nullable()`](#constraintsnullable)
|
|
226
226
|
- [`constraints.test(name: string, message?:string, test: (val: any) => boolean | Promise<boolean>)`](#constraintstestname-string-messagestring-test-val-any--boolean--promiseboolean)
|
|
227
227
|
- [`constraints.when(ref: string, test: (val: any) => boolean, then: any = [], otherwise: any = [])`](#constraintswhenref-string-test-val-any--boolean-then-any---otherwise-any--)
|
|
228
228
|
- [`constraints.oneOf(arrayOfValues: any[], message?:string)`](#constraintsoneofarrayofvalues-any-messagestring)
|
|
@@ -247,16 +247,6 @@ the following methods works for all type types of value.
|
|
|
247
247
|
{type: 'required', message: "this field is required"}
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
#### `constraints.nullable()`
|
|
251
|
-
Indicates the `null` is a valid value for the schema. Without `nullable` `null` will be treated as an error.
|
|
252
|
-
|
|
253
|
-
```javascript
|
|
254
|
-
constraints.nullable()
|
|
255
|
-
```
|
|
256
|
-
```javascript
|
|
257
|
-
{type: 'nullable'}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
250
|
#### `constraints.test(name: string, message?:string, test: (val: any) => boolean | Promise<boolean>)`
|
|
261
251
|
Adds a test function to the validation chain. The test must provide a `name`, an error `message` and a validation function that takes in entry the current value and must return a boolean result. The test can return a promise that resolve a boolean result
|
|
262
252
|
|