@uform/core
Advanced tools
Comparing version 0.1.0-beta.6 to 0.1.0-beta.7
@@ -154,3 +154,3 @@ "use strict"; | ||
this.updateFieldsValue(); | ||
this.updateFieldsValue(false); | ||
}; | ||
@@ -531,24 +531,36 @@ | ||
_proto.updateFieldsValue = function updateFieldsValue() { | ||
_proto.updateFieldsValue = function updateFieldsValue(validate) { | ||
var _this11 = this; | ||
if (this.state.dirty && this.initialized) { | ||
this.internalValidate(this.state.values, true).then(function () { | ||
_this11.formNotify(); | ||
if (validate === void 0) { | ||
validate = true; | ||
} | ||
(0, _utils.each)(_this11.fields, function (field, name) { | ||
var newValue = _this11.getValue(name); | ||
var update = function update() { | ||
(0, _utils.each)(_this11.fields, function (field, name) { | ||
var newValue = _this11.getValue(name); | ||
field.updateState(function (state) { | ||
state.value = newValue; | ||
field.updateState(function (state) { | ||
state.value = newValue; | ||
}); | ||
if (field.dirty) { | ||
(0, _utils.raf)(function () { | ||
if (_this11.destructed) return; | ||
field.notify(); | ||
}); | ||
} | ||
}); | ||
}; | ||
if (field.dirty) { | ||
(0, _utils.raf)(function () { | ||
if (_this11.destructed) return; | ||
field.notify(); | ||
}); | ||
} | ||
if (this.state.dirty && this.initialized) { | ||
if (validate) { | ||
this.internalValidate(this.state.values, true).then(function () { | ||
_this11.formNotify(); | ||
update(); | ||
}); | ||
}); | ||
} else { | ||
update(); | ||
} | ||
} | ||
@@ -555,0 +567,0 @@ }; |
{ | ||
"name": "@uform/core", | ||
"version": "0.1.0-beta.6", | ||
"version": "0.1.0-beta.7", | ||
"license": "MIT", | ||
@@ -28,3 +28,3 @@ "main": "lib", | ||
}, | ||
"gitHead": "0d0cfef39f9ab55f8df71d3f409cbfcad1dec652" | ||
"gitHead": "1314b59984b62cc23831e4c6b17610c16cfe4525" | ||
} |
@@ -72,3 +72,3 @@ import { | ||
} | ||
this.updateFieldsValue() | ||
this.updateFieldsValue(false) | ||
} | ||
@@ -451,20 +451,27 @@ | ||
updateFieldsValue() { | ||
if (this.state.dirty && this.initialized) { | ||
this.internalValidate(this.state.values, true).then(() => { | ||
this.formNotify() | ||
each(this.fields, (field, name) => { | ||
let newValue = this.getValue(name) | ||
field.updateState(state => { | ||
state.value = newValue | ||
updateFieldsValue(validate = true) { | ||
const update = () => { | ||
each(this.fields, (field, name) => { | ||
let newValue = this.getValue(name) | ||
field.updateState(state => { | ||
state.value = newValue | ||
}) | ||
if (field.dirty) { | ||
raf(() => { | ||
if (this.destructed) return | ||
field.notify() | ||
}) | ||
if (field.dirty) { | ||
raf(() => { | ||
if (this.destructed) return | ||
field.notify() | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
if (this.state.dirty && this.initialized) { | ||
if (validate) { | ||
this.internalValidate(this.state.values, true).then(() => { | ||
this.formNotify() | ||
update() | ||
}) | ||
} else { | ||
update() | ||
} | ||
} | ||
} | ||
@@ -471,0 +478,0 @@ |
72895
2238