cerebral-forms
Advanced tools
Comparing version 1.0.0-b-alpha.4ca9aef9 to 1.0.0-b-alpha.544b7c3c
@@ -19,12 +19,7 @@ 'use strict'; | ||
}); | ||
currentPath.pop(); | ||
return allFields; | ||
} else if (object[key] === Object(object[key]) && 'value' in object[key]) { | ||
allFields[currentPath.join('.')] = object[key]; | ||
currentPath.pop(); | ||
return allFields; | ||
} else if (object[key] === Object(object[key])) { | ||
getFormFields(object[key], currentPath, allFields); | ||
} | ||
getFormFields(object[key], currentPath, allFields); | ||
currentPath.pop(); | ||
@@ -31,0 +26,0 @@ |
{ | ||
"name": "cerebral-forms", | ||
"version": "1.0.0-b-alpha.4ca9aef9", | ||
"version": "1.0.0-b-alpha.544b7c3c", | ||
"description": "Signals, actions and state factories to create forms", | ||
@@ -28,7 +28,7 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"cerebral": "^2.0.0-b-alpha.4ca9aef9" | ||
"cerebral": "^2.0.0-b-alpha.544b7c3c" | ||
}, | ||
"devDependencies": { | ||
"@cerebral/monorepo": "^0.0.1-alpha.4ca9aef9", | ||
"cerebral": "^2.0.0-b-alpha.4ca9aef9" | ||
"@cerebral/monorepo": "^0.0.1-alpha.544b7c3c", | ||
"cerebral": "^2.0.0-b-alpha.544b7c3c" | ||
}, | ||
@@ -35,0 +35,0 @@ "nyc": { |
@@ -50,6 +50,4 @@ # cerebral-forms | ||
// Some properties are created for you, set when validation runs | ||
// and you can use them in components. You can also set these | ||
// properties manually, though usually the validate action factory | ||
// is used to handle this | ||
// Some properties are created for you by the validate action factory | ||
// which can be used in the components. | ||
@@ -97,2 +95,22 @@ // Toggled when field is validated | ||
#### Custom global props | ||
You can add custom props to the root to the form state. | ||
For example if you want to show validation errors only | ||
when submitting the form you can add a `showErrors` prop | ||
which you set true when validation fails during form submit. | ||
```js | ||
import {form} from 'cerebral-forms' | ||
export default function MyAction({state}) { | ||
state.set('some.new.form', form({ | ||
name: { | ||
value: '', | ||
}, | ||
showErrors: false | ||
})) | ||
} | ||
``` | ||
#### Set a default value for the whole form | ||
@@ -108,3 +126,3 @@ You can set a default value for a property using a factory: | ||
// You can also set some special properties for the whole form | ||
newForm.showErrors = false | ||
myForm.showErrors = false | ||
@@ -121,22 +139,2 @@ fields.forEach((field) => { | ||
#### Custom global props | ||
You can add custom props to the root to the form state. | ||
For example if you want to show validation errors only | ||
when submitting the form you can add a `showErrors` prop | ||
which you set true when validation fails during form submit. | ||
```js | ||
import {form} from 'cerebral-forms' | ||
export default function MyAction({state}) { | ||
state.set('some.new.form', form({ | ||
name: { | ||
value: '', | ||
}, | ||
showErrors: false | ||
})) | ||
} | ||
``` | ||
### field | ||
@@ -143,0 +141,0 @@ To add a new field you simply merge a new form into the existing one. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
72364
37
576
393