@uform/core
Advanced tools
Comparing version 0.4.0-beta.0 to 0.4.0-beta.1
@@ -22,2 +22,3 @@ import { Field } from './field'; | ||
private batchUpdateField; | ||
private validating; | ||
private traverse; | ||
@@ -24,0 +25,0 @@ constructor(opts: IFormOptions); |
@@ -422,2 +422,3 @@ "use strict"; | ||
}); | ||
field.pristine = true; | ||
} | ||
@@ -429,2 +430,3 @@ if (field.dirty) { | ||
} | ||
field.pristine = true; | ||
field.notify(); | ||
@@ -476,2 +478,3 @@ }); | ||
var _this = this; | ||
this.validating = true; | ||
return this.internalValidate(this.state.values, true).then(function () { | ||
@@ -481,2 +484,3 @@ return new Promise(function (resolve, reject) { | ||
utils_1.raf(function () { | ||
_this.validating = false; | ||
if (_this.destructed) { | ||
@@ -500,2 +504,6 @@ return; | ||
var _this = this; | ||
if (this.validating) | ||
return new Promise(function (resolve) { | ||
resolve(_this.publishState()); | ||
}); | ||
return this.validate().then(function (formState) { | ||
@@ -502,0 +510,0 @@ _this.dispatchEffect('onFormSubmit', formState); |
@@ -111,3 +111,3 @@ "use strict"; | ||
var item = this.data[this.indexes[key]]; | ||
if (item.values.indexOf(value) === -1) { | ||
if (!item.values.some(function (callback) { return utils_1.isEqual(callback, value); })) { | ||
item.values.push(value); | ||
@@ -114,0 +114,0 @@ } |
{ | ||
"name": "@uform/core", | ||
"version": "0.4.0-beta.0", | ||
"version": "0.4.0-beta.1", | ||
"license": "MIT", | ||
@@ -29,5 +29,5 @@ "main": "lib", | ||
"dependencies": { | ||
"@uform/types": "^0.4.0-beta.0", | ||
"@uform/utils": "^0.4.0-beta.0", | ||
"@uform/validator": "^0.4.0-beta.0", | ||
"@uform/types": "^0.4.0-beta.1", | ||
"@uform/utils": "^0.4.0-beta.1", | ||
"@uform/validator": "^0.4.0-beta.1", | ||
"dot-match": "^0.1.18", | ||
@@ -39,3 +39,3 @@ "rxjs": "^6.3.3" | ||
}, | ||
"gitHead": "197f94a17cb1ba4f3ec8ccb1f8e35a4d684c9f48" | ||
"gitHead": "36cf13d488a1596b2b182daeb48678f874843179" | ||
} |
@@ -85,2 +85,4 @@ import { | ||
private validating: boolean | ||
private traverse: (schema: ISchema) => ISchema | ||
@@ -481,2 +483,3 @@ | ||
}) | ||
field.pristine = true | ||
} | ||
@@ -488,2 +491,3 @@ if (field.dirty) { | ||
} | ||
field.pristine = true | ||
field.notify() | ||
@@ -536,2 +540,3 @@ }) | ||
public validate(): Promise<IFormState> { | ||
this.validating = true | ||
return this.internalValidate(this.state.values, true).then(() => { | ||
@@ -541,2 +546,3 @@ return new Promise((resolve, reject) => { | ||
raf(() => { | ||
this.validating = false | ||
if (this.destructed) { | ||
@@ -559,2 +565,6 @@ return | ||
public submit() { | ||
if (this.validating) | ||
return new Promise<IFormState>(resolve => { | ||
resolve(this.publishState()) | ||
}) | ||
return this.validate().then((formState: IFormState) => { | ||
@@ -561,0 +571,0 @@ this.dispatchEffect('onFormSubmit', formState) |
@@ -6,2 +6,3 @@ import { Path, IFormPathMatcher } from '@uform/types' | ||
getPathSegments, | ||
isEqual, | ||
toArr, | ||
@@ -139,3 +140,3 @@ clone, | ||
const item = this.data[this.indexes[key]] | ||
if (item.values.indexOf(value) === -1) { | ||
if (!item.values.some(callback => isEqual(callback, value))) { | ||
item.values.push(value) | ||
@@ -142,0 +143,0 @@ } |
112667
3364
Updated@uform/types@^0.4.0-beta.1
Updated@uform/utils@^0.4.0-beta.1