@uform/core
Advanced tools
Comparing version 0.1.0-beta.2 to 0.1.0-beta.5
@@ -96,3 +96,3 @@ "use strict"; | ||
return this.editable; | ||
return this.getEditable(this.context.editable); | ||
}; | ||
@@ -187,2 +187,14 @@ | ||
_proto.changeEditable = function changeEditable(editable) { | ||
if (!(0, _utils.isEmpty)(this.props.editable)) return; | ||
if (this.props['x-props'] && !(0, _utils.isEmpty)(this.props['x-props'].editable)) { | ||
return; | ||
} | ||
this.editable = this.getEditable(editable); | ||
this.dirty = true; | ||
this.notify(); | ||
}; | ||
_proto.remove = function remove() { | ||
@@ -258,5 +270,6 @@ this.value = undefined; | ||
} else { | ||
var prePropsRules = this.getRulesFromProps(this.props); | ||
var propsRules = this.getRulesFromProps(published.props); | ||
if (!(0, _utils.isEmpty)(propsRules) && !(0, _utils.isEqual)(propsRules, this.rules)) { | ||
if (!(0, _utils.isEmpty)(propsRules) && !(0, _utils.isEqual)(prePropsRules, propsRules) && !(0, _utils.isEqual)(propsRules, this.rules)) { | ||
this.rules = propsRules; | ||
@@ -263,0 +276,0 @@ this.errors = []; |
@@ -119,2 +119,3 @@ "use strict"; | ||
this.updateBuffer = {}; | ||
this.editable = opts.editable; | ||
this.schema = opts.schema || {}; | ||
@@ -165,2 +166,9 @@ this.initialize(this.options.initialValues); | ||
_proto.changeEditable = function changeEditable(editable) { | ||
this.editable = editable; | ||
(0, _utils.each)(this.fields, function (field, name) { | ||
field.changeEditable(editable); | ||
}); | ||
}; | ||
_proto.initializeEffects = function initializeEffects() { | ||
@@ -167,0 +175,0 @@ var _this2 = this; |
@@ -37,2 +37,3 @@ "use strict"; | ||
subscribes = _ref.subscribes, | ||
editable = _ref.editable, | ||
effects = _ref.effects, | ||
@@ -60,2 +61,3 @@ onValidateFailed = _ref.onValidateFailed; | ||
onFieldChange: onFieldChange, | ||
editable: editable, | ||
effects: effects, | ||
@@ -62,0 +64,0 @@ onValidateFailed: onValidateFailed, |
{ | ||
"name": "@uform/core", | ||
"version": "0.1.0-beta.2", | ||
"version": "0.1.0-beta.5", | ||
"license": "MIT", | ||
@@ -18,4 +18,4 @@ "main": "lib", | ||
"dependencies": { | ||
"@uform/utils": "^0.1.0-alpha.21", | ||
"@uform/validator": "^0.1.0-alpha.21", | ||
"@uform/utils": "^0.1.0-beta-3", | ||
"@uform/validator": "^0.1.0-beta-3", | ||
"dot-match": "^0.1.18", | ||
@@ -29,3 +29,3 @@ "immer": "^1.7.4", | ||
}, | ||
"gitHead": "1c1dfd2fdf1d0bdbad3a69b311905a11f9673542" | ||
"gitHead": "2032c22f626d7513811c9bb60b9d86514d0eb78d" | ||
} |
@@ -96,3 +96,3 @@ import { | ||
} | ||
return this.editable | ||
return this.getEditable(this.context.editable) | ||
} | ||
@@ -177,2 +177,12 @@ | ||
changeEditable(editable) { | ||
if (!isEmpty(this.props.editable)) return | ||
if (this.props['x-props'] && !isEmpty(this.props['x-props'].editable)) { | ||
return | ||
} | ||
this.editable = this.getEditable(editable) | ||
this.dirty = true | ||
this.notify() | ||
} | ||
remove() { | ||
@@ -230,3 +240,2 @@ this.value = undefined | ||
} | ||
if (!isEqual(published.rules, this.rules)) { | ||
@@ -240,4 +249,9 @@ this.rules = published.rules | ||
} else { | ||
const prePropsRules = this.getRulesFromProps(this.props) | ||
const propsRules = this.getRulesFromProps(published.props) | ||
if (!isEmpty(propsRules) && !isEqual(propsRules, this.rules)) { | ||
if ( | ||
!isEmpty(propsRules) && | ||
!isEqual(prePropsRules, propsRules) && | ||
!isEqual(propsRules, this.rules) | ||
) { | ||
this.rules = propsRules | ||
@@ -244,0 +258,0 @@ this.errors = [] |
@@ -44,2 +44,3 @@ import { | ||
this.updateBuffer = {} | ||
this.editable = opts.editable | ||
this.schema = opts.schema || {} | ||
@@ -84,2 +85,9 @@ this.initialize(this.options.initialValues) | ||
changeEditable(editable) { | ||
this.editable = editable | ||
each(this.fields, (field, name) => { | ||
field.changeEditable(editable) | ||
}) | ||
} | ||
initializeEffects() { | ||
@@ -86,0 +94,0 @@ const { effects } = this.options |
@@ -17,2 +17,3 @@ import { Form } from './form' | ||
subscribes, | ||
editable, | ||
effects, | ||
@@ -36,2 +37,3 @@ onValidateFailed | ||
onFieldChange, | ||
editable, | ||
effects, | ||
@@ -38,0 +40,0 @@ onValidateFailed, |
72617
2221
Updated@uform/utils@^0.1.0-beta-3