@alifd/field
Advanced tools
Comparing version 1.6.4 to 1.6.5
@@ -26,3 +26,3 @@ "use strict"; | ||
function Field(com) { | ||
var _this = this; | ||
var _this2 = this; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -54,3 +54,3 @@ (0, _classCallCheck2.default)(this, Field); | ||
['init', 'getValue', 'getValues', 'setValue', 'setValues', 'getError', 'getErrors', 'setError', 'setErrors', 'validateCallback', 'validatePromise', 'getState', 'reset', 'resetToDefault', 'remove', 'spliceArray', 'addArrayValue', 'deleteArrayValue', 'getNames'].forEach(function (m) { | ||
_this[m] = _this[m].bind(_this); | ||
_this2[m] = _this2[m].bind(_this2); | ||
}); | ||
@@ -73,3 +73,3 @@ } | ||
value: function init(name) { | ||
var _this2 = this; | ||
var _this3 = this; | ||
var fieldOption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -129,3 +129,3 @@ var rprops = arguments.length > 2 ? arguments[2] : undefined; | ||
if (!('value' in field)) { | ||
this._proxyFieldValue(field, name); | ||
this._proxyFieldValue(field); | ||
} | ||
@@ -147,3 +147,3 @@ } else { | ||
// when parseName is true, field should not store value locally. To prevent sync issues | ||
this._proxyFieldValue(field, name); | ||
this._proxyFieldValue(field); | ||
field.value = _initValue; | ||
@@ -184,4 +184,4 @@ } else { | ||
} | ||
_this2._callNativePropsEvent.apply(_this2, [action, originalProps].concat(args)); | ||
_this2._validate(name, actionRule, action); | ||
_this3._callNativePropsEvent.apply(_this3, [action, originalProps].concat(args)); | ||
_this3._validate(name, actionRule, action); | ||
}; | ||
@@ -199,14 +199,14 @@ }; | ||
} | ||
_this2._updateFieldValue.apply(_this2, [name].concat(args)); | ||
_this3._updateFieldValue.apply(_this3, [name].concat(args)); | ||
// clear validate error | ||
_this2._resetError(name); | ||
_this2._callNativePropsEvent.apply(_this2, [trigger, originalProps].concat(args)); | ||
_this3._resetError(name); | ||
_this3._callNativePropsEvent.apply(_this3, [trigger, originalProps].concat(args)); | ||
// call global onChange | ||
_this2.options.onChange(name, field.value); | ||
_this3.options.onChange(name, field.value); | ||
// validate while onChange | ||
var rule = rulesMap[trigger]; | ||
rule && _this2._validate(name, rule, trigger); | ||
_this2._reRender(name, trigger); | ||
rule && _this3._validate(name, rule, trigger); | ||
_this3._reRender(name, trigger); | ||
}; | ||
@@ -238,3 +238,5 @@ | ||
if (!(name in this.fieldsMeta)) { | ||
this.fieldsMeta[name] = (0, _extends2.default)({}, initMeta); | ||
this.fieldsMeta[name] = (0, _extends2.default)({ | ||
name: name | ||
}, initMeta); | ||
} | ||
@@ -245,4 +247,4 @@ return this.fieldsMeta[name]; | ||
key: "_proxyFieldValue", | ||
value: function _proxyFieldValue(field, name) { | ||
var _this3 = this; | ||
value: function _proxyFieldValue(field) { | ||
var _this = this; | ||
Object.defineProperty(field, 'value', { | ||
@@ -252,6 +254,7 @@ configurable: true, | ||
get: function get() { | ||
return (0, _utils.getIn)(_this3.values, name); | ||
return (0, _utils.getIn)(_this.values, this.name); | ||
}, | ||
set: function set(v) { | ||
_this3.values = (0, _utils.setIn)(_this3.values, name, v); | ||
// 此处this解释同上 | ||
_this.values = (0, _utils.setIn)(_this.values, this.name, v); | ||
return true; | ||
@@ -1002,2 +1005,4 @@ } | ||
_this13.fieldsMeta[i.to] = _this13.fieldsMeta[i.from]; | ||
// 移位后,同步调整name | ||
_this13.fieldsMeta[i.to].name = i.to; | ||
}); | ||
@@ -1004,0 +1009,0 @@ }); |
{ | ||
"name": "@alifd/field", | ||
"version": "1.6.4", | ||
"version": "1.6.5", | ||
"description": "Fields can be used to manage data when it comes to form data manipulation and validation. After being associated with a component, the form data can be automatically written back, read, and verified.", | ||
@@ -88,3 +88,3 @@ "files": [ | ||
}, | ||
"homepage": "https://unpkg.com/@alifd/field@1.6.4/build/index.html", | ||
"homepage": "https://unpkg.com/@alifd/field@1.6.5/build/index.html", | ||
"bugs": "https://github.com/alibaba-fusion/field/issues", | ||
@@ -91,0 +91,0 @@ "publishConfig": { |
Sorry, the diff of this file is too big to display
1832069
5416