final-form-calculate
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "final-form-calculate", | ||
"version": "1.1.0", | ||
"description": | ||
"Decorator for calculating field values based on other field values in 🏁 Final Form", | ||
"version": "1.2.0", | ||
"description": "Decorator for calculating field values based on other field values in 🏁 Final Form", | ||
"main": "dist/final-form-calculate.cjs.js", | ||
"jsnext:main": "dist/final-form-calculate.es.js", | ||
"module": "dist/final-form-calculate.es.js", | ||
"files": ["dist"], | ||
"files": [ | ||
"dist" | ||
], | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
@@ -15,4 +17,3 @@ "start": "nps", | ||
}, | ||
"author": | ||
"Erik Rasmussen <rasmussenerik@gmail.com> (http://github.com/erikras)", | ||
"author": "Erik Rasmussen <rasmussenerik@gmail.com> (http://github.com/erikras)", | ||
"license": "MIT", | ||
@@ -60,3 +61,4 @@ "repository": { | ||
"rollup-plugin-replace": "^2.0.0", | ||
"rollup-plugin-uglify": "^3.0.0" | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"typescript": "^2.7.2" | ||
}, | ||
@@ -67,3 +69,6 @@ "peerDependencies": { | ||
"lint-staged": { | ||
"*.{js,json,md,css}": ["prettier --write", "git add"] | ||
"*.{js,json,md,css}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
@@ -70,0 +75,0 @@ "bundlesize": [ |
@@ -55,2 +55,12 @@ # 🏁 Final Form Calculate | ||
{ | ||
field: 'foo', // when the value of foo changes... | ||
updates: { | ||
// ...asynchronously set field "doubleFoo" to twice the value using a promise | ||
doubleFoo: (fooValue, allValues) => | ||
new Promise(resolve => { | ||
setTimeout(() => resolve(fooValue * 2), 100) | ||
}) | ||
} | ||
}, | ||
{ | ||
field: /\.timeFrom/, // when a deeper field matching this pattern changes... | ||
@@ -127,8 +137,8 @@ updates: (value, name, allValues) => { | ||
### `UpdatesByName: { [FieldName]: (value: any, allValues: Object) => any }` | ||
### `UpdatesByName: { [FieldName]: (value: any, allValues: Object) => Promise | any }` | ||
Updater functions for each calculated field. | ||
### `UpdatesForAll: (value: any, field: string, allValues: Object) => { [FieldName]: any }` | ||
### `UpdatesForAll: (value: any, field: string, allValues: Object) => Promise | { [FieldName]: any }` | ||
Takes the value and name of the field that just changed, as well as all the values, and returns an object of fields and new values. |
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
23211
143
34