mobx-react-form
Advanced tools
Comparing version 1.13.28 to 1.14.0
107
lib/Field.js
@@ -78,3 +78,3 @@ 'use strict'; | ||
var _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _class2, _temp, _initialiseProps; | ||
var _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _class2, _temp, _initialiseProps; | ||
@@ -437,12 +437,2 @@ var _mobx = require('mobx'); | ||
}, { | ||
key: 'focus', | ||
get: function get() { | ||
return this.$focus; | ||
} | ||
}, { | ||
key: 'touched', | ||
get: function get() { | ||
return this.$touched; | ||
} | ||
}, { | ||
key: 'rules', | ||
@@ -476,3 +466,3 @@ get: function get() { | ||
get: function get() { | ||
return !(0, _isEqual3.default)(this.$default, this.value); | ||
return this.hasNestedFields ? this.check('isDirty', true) : !(0, _isEqual3.default)(this.$default, this.value); | ||
} | ||
@@ -482,3 +472,3 @@ }, { | ||
get: function get() { | ||
return (0, _isEqual3.default)(this.$default, this.value); | ||
return this.hasNestedFields ? this.check('isPristine', true) : (0, _isEqual3.default)(this.$default, this.value); | ||
} | ||
@@ -488,3 +478,3 @@ }, { | ||
get: function get() { | ||
return (0, _isEqual3.default)(this.$default, this.value); | ||
return this.hasNestedFields ? this.check('isDefault', true) : (0, _isEqual3.default)(this.$default, this.value); | ||
} | ||
@@ -494,7 +484,22 @@ }, { | ||
get: function get() { | ||
if (this.hasNestedFields) return this.check('isEmpty', true); | ||
if ((0, _isBoolean3.default)(this.value)) return !!this.$value; | ||
if ((0, _isNumber3.default)(this.value)) return false; | ||
if ((0, _isBoolean3.default)(this.value)) return !this.$value; | ||
return (0, _isEmpty3.default)(this.value); | ||
} | ||
}, { | ||
key: 'focus', | ||
get: function get() { | ||
return this.hasNestedFields ? this.check('focus', true) : this.$focus; | ||
} | ||
}, { | ||
key: 'touched', | ||
get: function get() { | ||
return this.hasNestedFields ? this.check('touched', true) : this.$touched; | ||
} | ||
}, { | ||
key: 'changed', | ||
get: function get() { | ||
return this.hasNestedFields ? this.check('changed', true) : this.$changed; | ||
} | ||
/* ------------------------------------------------------------------ */ | ||
@@ -545,15 +550,19 @@ /* EVENTS */ | ||
_initDefineProp(this, 'errorSync', _descriptor8, this); | ||
_initDefineProp(this, '$changed', _descriptor8, this); | ||
_initDefineProp(this, 'errorAsync', _descriptor9, this); | ||
_initDefineProp(this, 'errorSync', _descriptor9, this); | ||
_initDefineProp(this, 'showError', _descriptor10, this); | ||
_initDefineProp(this, 'errorAsync', _descriptor10, this); | ||
_initDefineProp(this, 'validationErrorStack', _descriptor11, this); | ||
_initDefineProp(this, 'showError', _descriptor11, this); | ||
_initDefineProp(this, 'validationFunctionsData', _descriptor12, this); | ||
_initDefineProp(this, 'validationErrorStack', _descriptor12, this); | ||
_initDefineProp(this, 'validationAsyncData', _descriptor13, this); | ||
_initDefineProp(this, 'validationFunctionsData', _descriptor13, this); | ||
this.sync = function (e) { | ||
_initDefineProp(this, 'validationAsyncData', _descriptor14, this); | ||
this.sync = (0, _mobx.action)(function (e) { | ||
_this.$changed = true; | ||
// assume "e" is the value | ||
@@ -573,12 +582,9 @@ if ((0, _isNil3.default)(e.target)) { | ||
_this.value = e.target.value; | ||
}; | ||
this.onChange = function (e) { | ||
}); | ||
this.onChange = (0, _mobx.action)(function (e) { | ||
_this.sync(e); | ||
}; | ||
this.onToggle = function (e) { | ||
}); | ||
this.onToggle = (0, _mobx.action)(function (e) { | ||
_this.sync(e); | ||
}; | ||
}); | ||
this.onFocus = (0, _mobx.action)(function () { | ||
@@ -591,14 +597,11 @@ _this.$focus = true; | ||
}); | ||
this.onClear = function (e) { | ||
this.onClear = (0, _mobx.action)(function (e) { | ||
e.preventDefault(); | ||
_this.clear(true); | ||
}; | ||
this.onReset = function (e) { | ||
}); | ||
this.onReset = (0, _mobx.action)(function (e) { | ||
e.preventDefault(); | ||
_this.reset(true); | ||
}; | ||
this.onAdd = function (e) { | ||
}); | ||
this.onAdd = (0, _mobx.action)(function (e) { | ||
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
@@ -608,5 +611,4 @@ | ||
_this.add(key); | ||
}; | ||
this.onDel = function (e) { | ||
}); | ||
this.onDel = (0, _mobx.action)(function (e) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
@@ -616,3 +618,3 @@ | ||
_this.del(path || _this.path); | ||
}; | ||
}); | ||
}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, '$label', [_mobx.observable], { | ||
@@ -647,8 +649,13 @@ enumerable: true, | ||
} | ||
}), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, 'errorSync', [_mobx.observable], { | ||
}), _descriptor8 = _applyDecoratedDescriptor(_class.prototype, '$changed', [_mobx.observable], { | ||
enumerable: true, | ||
initializer: function initializer() { | ||
return false; | ||
} | ||
}), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, 'errorSync', [_mobx.observable], { | ||
enumerable: true, | ||
initializer: function initializer() { | ||
return null; | ||
} | ||
}), _descriptor9 = _applyDecoratedDescriptor(_class.prototype, 'errorAsync', [_mobx.observable], { | ||
}), _descriptor10 = _applyDecoratedDescriptor(_class.prototype, 'errorAsync', [_mobx.observable], { | ||
enumerable: true, | ||
@@ -658,3 +665,3 @@ initializer: function initializer() { | ||
} | ||
}), _descriptor10 = _applyDecoratedDescriptor(_class.prototype, 'showError', [_mobx.observable], { | ||
}), _descriptor11 = _applyDecoratedDescriptor(_class.prototype, 'showError', [_mobx.observable], { | ||
enumerable: true, | ||
@@ -664,3 +671,3 @@ initializer: function initializer() { | ||
} | ||
}), _descriptor11 = _applyDecoratedDescriptor(_class.prototype, 'validationErrorStack', [_mobx.observable], { | ||
}), _descriptor12 = _applyDecoratedDescriptor(_class.prototype, 'validationErrorStack', [_mobx.observable], { | ||
enumerable: true, | ||
@@ -670,3 +677,3 @@ initializer: function initializer() { | ||
} | ||
}), _descriptor12 = _applyDecoratedDescriptor(_class.prototype, 'validationFunctionsData', [_mobx.observable], { | ||
}), _descriptor13 = _applyDecoratedDescriptor(_class.prototype, 'validationFunctionsData', [_mobx.observable], { | ||
enumerable: true, | ||
@@ -676,3 +683,3 @@ initializer: function initializer() { | ||
} | ||
}), _descriptor13 = _applyDecoratedDescriptor(_class.prototype, 'validationAsyncData', [_mobx.observable], { | ||
}), _descriptor14 = _applyDecoratedDescriptor(_class.prototype, 'validationAsyncData', [_mobx.observable], { | ||
enumerable: true, | ||
@@ -682,4 +689,4 @@ initializer: function initializer() { | ||
} | ||
}), _applyDecoratedDescriptor(_class.prototype, 'initNestedFields', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'initNestedFields'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'setupField', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'setupField'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'setInvalid', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'setInvalid'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'setValidationAsyncData', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'setValidationAsyncData'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'resetValidation', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'resetValidation'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'clear', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'clear'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'reset', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'reset'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'showErrors', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'showErrors'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'showAsyncErrors', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'showAsyncErrors'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasIncrementalNestedFields', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasIncrementalNestedFields'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasNestedFields', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasNestedFields'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'value', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'value'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'label', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'label'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'related', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'related'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'disabled', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'disabled'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'default', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'default'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'initial', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'initial'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'focus', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'focus'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'touched', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'touched'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'rules', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'rules'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'validate', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'validate'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'error', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'error'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasError', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasError'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isValid', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isValid'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDirty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDirty'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isPristine', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isPristine'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDefault', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDefault'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isEmpty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isEmpty'), _class.prototype)), _class); | ||
}), _applyDecoratedDescriptor(_class.prototype, 'initNestedFields', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'initNestedFields'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'setupField', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'setupField'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'setInvalid', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'setInvalid'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'setValidationAsyncData', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'setValidationAsyncData'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'resetValidation', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'resetValidation'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'clear', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'clear'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'reset', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'reset'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'showErrors', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'showErrors'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'showAsyncErrors', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'showAsyncErrors'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasIncrementalNestedFields', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasIncrementalNestedFields'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasNestedFields', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasNestedFields'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'value', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'value'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'label', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'label'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'related', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'related'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'disabled', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'disabled'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'default', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'default'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'initial', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'initial'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'rules', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'rules'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'validate', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'validate'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'error', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'error'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasError', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasError'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isValid', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isValid'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDirty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDirty'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isPristine', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isPristine'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDefault', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDefault'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isEmpty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isEmpty'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'focus', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'focus'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'touched', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'touched'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'changed', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'changed'), _class.prototype)), _class); | ||
exports.default = Field; | ||
module.exports = exports['default']; |
@@ -166,3 +166,6 @@ 'use strict'; | ||
isDefault: 'every', | ||
isEmpty: 'every' | ||
isEmpty: 'every', | ||
focus: 'some', | ||
touched: 'some', | ||
changed: 'some' | ||
}; | ||
@@ -169,0 +172,0 @@ |
@@ -8,10 +8,2 @@ 'use strict'; | ||
var _every2 = require('lodash/every'); | ||
var _every3 = _interopRequireDefault(_every2); | ||
var _some2 = require('lodash/some'); | ||
var _some3 = _interopRequireDefault(_some2); | ||
var _has2 = require('lodash/has'); | ||
@@ -397,3 +389,3 @@ | ||
get: function get() { | ||
return (0, _some3.default)(this.deepCheck('some', 'hasError', this.fields)) || (0, _isString3.default)(this.validator.genericErrorMessage); | ||
return this.check('hasError', true) || (0, _isString3.default)(this.validator.genericErrorMessage); | ||
} | ||
@@ -403,3 +395,3 @@ }, { | ||
get: function get() { | ||
return (0, _every3.default)(this.deepCheck('every', 'isValid', this.fields)) && !(0, _isString3.default)(this.validator.genericErrorMessage); | ||
return this.check('isValid', true) && !(0, _isString3.default)(this.validator.genericErrorMessage); | ||
} | ||
@@ -409,3 +401,3 @@ }, { | ||
get: function get() { | ||
return (0, _some3.default)(this.deepCheck('some', 'isDirty', this.fields)); | ||
return this.check('isDirty', true); | ||
} | ||
@@ -415,3 +407,3 @@ }, { | ||
get: function get() { | ||
return (0, _every3.default)(this.deepCheck('every', 'isPristine', this.fields)); | ||
return this.check('isPristine', true); | ||
} | ||
@@ -421,3 +413,3 @@ }, { | ||
get: function get() { | ||
return (0, _every3.default)(this.deepCheck('every', 'isDefault', this.fields)); | ||
return this.check('isDefault', true); | ||
} | ||
@@ -427,5 +419,20 @@ }, { | ||
get: function get() { | ||
return (0, _every3.default)(this.deepCheck('every', 'isEmpty', this.fields)); | ||
return this.check('isEmpty', true); | ||
} | ||
}, { | ||
key: 'focus', | ||
get: function get() { | ||
return this.check('focus', true); | ||
} | ||
}, { | ||
key: 'touched', | ||
get: function get() { | ||
return this.check('touched', true); | ||
} | ||
}, { | ||
key: 'changed', | ||
get: function get() { | ||
return this.check('changed', true); | ||
} | ||
}, { | ||
key: 'error', | ||
@@ -471,4 +478,4 @@ get: function get() { | ||
} | ||
}), _applyDecoratedDescriptor(_class.prototype, 'clear', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'clear'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'reset', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'reset'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'submit', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'submit'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasError', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasError'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isValid', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isValid'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDirty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDirty'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isPristine', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isPristine'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDefault', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDefault'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isEmpty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isEmpty'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'error', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'error'), _class.prototype)), _class); | ||
}), _applyDecoratedDescriptor(_class.prototype, 'clear', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'clear'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'reset', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'reset'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'submit', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'submit'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hasError', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'hasError'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isValid', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isValid'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDirty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDirty'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isPristine', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isPristine'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isDefault', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isDefault'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'isEmpty', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'isEmpty'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'focus', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'focus'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'touched', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'touched'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'changed', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'changed'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'error', [_mobx.computed], Object.getOwnPropertyDescriptor(_class.prototype, 'error'), _class.prototype)), _class); | ||
exports.default = Form; | ||
module.exports = exports['default']; |
@@ -7,2 +7,10 @@ 'use strict'; | ||
var _has2 = require('lodash/has'); | ||
var _has3 = _interopRequireDefault(_has2); | ||
var _partial2 = require('lodash/partial'); | ||
var _partial3 = _interopRequireDefault(_partial2); | ||
var _trimEnd2 = require('lodash/trimEnd'); | ||
@@ -46,9 +54,5 @@ | ||
var _mixins = require('./mixins'); | ||
var _mixins2 = _interopRequireDefault(_mixins); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var computed = ['error', 'hasError', 'isValid', 'isDirty', 'isPristine', 'isDefault', 'isEmpty', 'focus', 'touched']; | ||
var computed = ['error', 'hasError', 'isValid', 'isDirty', 'isPristine', 'isDefault', 'isEmpty', 'focus', 'touched', 'changed']; | ||
var props = ['value', 'label', 'disabled', 'initial', 'default', 'related']; | ||
@@ -132,8 +136,12 @@ var iprops = ['values', 'labels', 'disabled', 'initials', 'defaults', 'related']; | ||
var hasSome = function hasSome(obj, keys) { | ||
return (0, _some3.default)(keys, (0, _partial3.default)(_has3.default, obj)); | ||
}; | ||
var hasUnifiedProps = function hasUnifiedProps(field) { | ||
return _mixins2.default.hasSome(field, props) || _mixins2.default.hasSome(field, vprops); | ||
return hasSome(field, props) || hasSome(field, vprops); | ||
}; | ||
var hasSeparatedProps = function hasSeparatedProps(initial) { | ||
return _mixins2.default.hasSome(initial, iprops) || _mixins2.default.hasSome(initial, vprops); | ||
return hasSome(initial, iprops) || hasSome(initial, vprops); | ||
}; | ||
@@ -140,0 +148,0 @@ |
{ | ||
"name": "mobx-react-form", | ||
"license": "MIT", | ||
"version": "1.13.28", | ||
"version": "1.14.0", | ||
"author": "Claudio Savino <claudio.savino@me.com> (https://twitter.com/foxhound87)", | ||
@@ -13,3 +13,3 @@ "description": "Automagically manage React forms state and automatic validation with MobX.", | ||
"clean:all": "npm run clean:build && npm run clean:modules", | ||
"lint": "eslint . demo --ext .jsx,.js --ignore-path .gitignore", | ||
"lint": "eslint . --ext .jsx,.js --ignore-path .gitignore", | ||
"build": "npm-run-all --parallel build:*", | ||
@@ -16,0 +16,0 @@ "build:main": "babel -d lib/ src/", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1946558
14154
22