Comparing version 0.3.0 to 0.3.1
@@ -32,2 +32,3 @@ /// <reference types="react" /> | ||
onChange: (e: React.ChangeEvent<any>) => void; | ||
onBlur: (e: any) => void; | ||
onChangeValue: (name: string, value: any) => void; | ||
@@ -34,0 +35,0 @@ setError: (e: any) => void; |
@@ -63,9 +63,11 @@ import * as tslib_1 from "tslib"; | ||
: value; | ||
// Set changed fields as touched | ||
setTouched(tslib_1.__assign({}, touched, (_b = {}, _b[name] = true, _b))); | ||
// Set form fields by name | ||
setValues(tslib_1.__assign({}, values, (_c = {}, _c[name] = val, _c))); | ||
setValues(tslib_1.__assign({}, values, (_b = {}, _b[name] = val, _b))); | ||
// Validate against schema | ||
validateFormData(tslib_1.__assign({}, values, (_d = {}, _d[name] = val, _d)), validationSchema, setErrors); | ||
var _b, _c, _d; | ||
validateFormData(tslib_1.__assign({}, values, (_c = {}, _c[name] = val, _c)), validationSchema, setErrors); | ||
var _b, _c; | ||
}, onBlur: function (e) { | ||
e.persist(); | ||
setTouched(tslib_1.__assign({}, values, (_a = {}, _a[e.target.name] = true, _a))); | ||
var _a; | ||
}, onChangeValue: function (name, value) { | ||
@@ -99,2 +101,6 @@ // Set changed fields as touched | ||
}, resetForm: function (nextProps) { | ||
setSubmitting(false); | ||
setErrors({}); | ||
setTouched({}); | ||
setError(undefined); | ||
if (nextProps) { | ||
@@ -107,2 +113,6 @@ setValues(mapPropsToValues(nextProps)); | ||
}, onReset: function () { | ||
setSubmitting(false); | ||
setErrors({}); | ||
setTouched({}); | ||
setError(undefined); | ||
setValues(mapPropsToValues(rest)); | ||
@@ -109,0 +119,0 @@ }, setValues: setValues, |
@@ -32,2 +32,3 @@ /// <reference types="react" /> | ||
onChange: (e: React.ChangeEvent<any>) => void; | ||
onBlur: (e: any) => void; | ||
onChangeValue: (name: string, value: any) => void; | ||
@@ -34,0 +35,0 @@ setError: (e: any) => void; |
{ | ||
"name": "formik", | ||
"description": "An elegant way to handle forms in React", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Jared Palmer <jared@palmer.net>", |
@@ -32,2 +32,3 @@ /// <reference types="react" /> | ||
onChange: (e: React.ChangeEvent<any>) => void; | ||
onBlur: (e: any) => void; | ||
onChangeValue: (name: string, value: any) => void; | ||
@@ -34,0 +35,0 @@ setError: (e: any) => void; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
151947
591