Comparing version 1.0.0-rc.32 to 1.0.0-rc.33
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj;};/* global Package */var _lodash=require('lodash.clonedeep');var _lodash2=_interopRequireDefault(_lodash);var _invariant=require('invariant');var _invariant2=_interopRequireDefault(_invariant);var _Bridge2=require('./Bridge');var _Bridge3=_interopRequireDefault(_Bridge2);var _joinName=require('../helpers/joinName');var _joinName2=_interopRequireDefault(_joinName);var _filterDOMProps=require('../helpers/filterDOMProps');var _filterDOMProps2=_interopRequireDefault(_filterDOMProps);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Match=((typeof global==='undefined'?'undefined':_typeof(global))==='object'?global:window).Match;var SimpleSchema=((typeof global==='undefined'?'undefined':_typeof(global))==='object'?global:window).SimpleSchema;try{if((typeof Package==='undefined'?'undefined':_typeof(Package))==='object'){if(Match===undefined){Match=Package['check'];Match=Match.Match;}if(SimpleSchema===undefined){SimpleSchema=Package['aldeed:simple-schema'];SimpleSchema=SimpleSchema.SimpleSchema;}}SimpleSchema.extendOptions({uniforms:Match.Optional(Match.OneOf(String,Function,Match.ObjectIncluding({component:Match.Optional(Match.OneOf(String,Function))})))});// There's no possibility to retrieve them at runtime | ||
_filterDOMProps2.default.register('allowedValues','autoValue','blackbox','custom','decimal','defaultValue','exclusiveMax','exclusiveMin','label','max','maxCount','min','minCount','optional','regEx','trim','type');}catch(_){/* Ignore it. */}var SimpleSchemaBridge=function(_Bridge){_inherits(SimpleSchemaBridge,_Bridge);function SimpleSchemaBridge(){_classCallCheck(this,SimpleSchemaBridge);return _possibleConstructorReturn(this,Object.getPrototypeOf(SimpleSchemaBridge).apply(this,arguments));}_createClass(SimpleSchemaBridge,[{key:'getError',value:function getError(name,error){return error&&error.details&&error.details.find&&error.details.find(function(error){return error.name===name;});}},{key:'getErrorMessage',value:function getErrorMessage(name,error){var scopedError=this.getError(name,error);if(scopedError){return this.schema.messageForError(scopedError.type,scopedError.name,null,scopedError.details&&scopedError.details.value);}return'';}},{key:'getErrorMessages',value:function getErrorMessages(error){var _this2=this;if(error){if(Array.isArray(error.details)){return error.details.map(function(error){return _this2.schema.messageForError(error.type,error.name,null,error.details&&error.details.value);});}if(error.message){return[error.message];}}if(error!==undefined){return[error];}return[];}},{key:'getField',value:function getField(name){var definition=this.schema.getDefinition(name);(0,_invariant2.default)(definition,'Field not found in schema: "%s"',name);return definition;}},{key:'getInitialValue',value:function getInitialValue(name){var _this3=this;var props=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var field=this.getField(name);if(field.type===Array){var _ret=function(){var item=_this3.getInitialValue((0,_joinName2.default)(name,'0'));var items=Math.max(props.initialCount||0,field.minCount||0);return{v:[].concat(_toConsumableArray(Array(items))).map(function(){return item;})};}();if((typeof _ret==='undefined'?'undefined':_typeof(_ret))==="object")return _ret.v;}if(field.type===Object){return{};}return field.defaultValue;}},{key:'getProps',value:function getProps(name,props){// Type should be omitted. | ||
_filterDOMProps2.default.register('allowedValues','autoValue','blackbox','custom','decimal','defaultValue','exclusiveMax','exclusiveMin','label','max','maxCount','min','minCount','optional','regEx','trim','type');}catch(_){/* Ignore it. */}var SimpleSchemaBridge=function(_Bridge){_inherits(SimpleSchemaBridge,_Bridge);function SimpleSchemaBridge(){_classCallCheck(this,SimpleSchemaBridge);return _possibleConstructorReturn(this,(SimpleSchemaBridge.__proto__||Object.getPrototypeOf(SimpleSchemaBridge)).apply(this,arguments));}_createClass(SimpleSchemaBridge,[{key:'getError',value:function getError(name,error){return error&&error.details&&error.details.find&&error.details.find(function(error){return error.name===name;});}},{key:'getErrorMessage',value:function getErrorMessage(name,error){var scopedError=this.getError(name,error);if(scopedError){return this.schema.messageForError(scopedError.type,scopedError.name,null,scopedError.details&&scopedError.details.value);}return'';}},{key:'getErrorMessages',value:function getErrorMessages(error){var _this2=this;if(error){if(Array.isArray(error.details)){return error.details.map(function(error){return _this2.schema.messageForError(error.type,error.name,null,error.details&&error.details.value);});}if(error.message){return[error.message];}}if(error!==undefined){return[error];}return[];}},{key:'getField',value:function getField(name){var definition=this.schema.getDefinition(name);(0,_invariant2.default)(definition,'Field not found in schema: "%s"',name);return definition;}},{key:'getInitialValue',value:function getInitialValue(name){var _this3=this;var props=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var field=this.getField(name);if(field.type===Array){var _ret=function(){var item=_this3.getInitialValue((0,_joinName2.default)(name,'0'));var items=Math.max(props.initialCount||0,field.minCount||0);return{v:[].concat(_toConsumableArray(Array(items))).map(function(){return item;})};}();if((typeof _ret==='undefined'?'undefined':_typeof(_ret))==="object")return _ret.v;}if(field.type===Object){return{};}return field.defaultValue;}},{key:'getProps',value:function getProps(name,props){// Type should be omitted. | ||
// eslint-disable-next-line no-unused-vars | ||
var _getField=this.getField(name);var optional=_getField.optional;var type=_getField.type;var uniforms=_getField.uniforms;var field=_objectWithoutProperties(_getField,['optional','type','uniforms']);field=_extends({},field,{required:!optional});if(uniforms){if(typeof uniforms==='string'||typeof uniforms==='function'){field=_extends({},field,{component:uniforms});}else{field=_extends({},field,uniforms);}}if(type===Array){try{var itemProps=this.getProps(name+'.$',props);if(itemProps.allowedValues&&!props.allowedValues){field.allowedValues=itemProps.allowedValues;}if(itemProps.transform&&!props.transform){field.transform=itemProps.transform;}}catch(e){/* do nothing */}}var options=props.options||field.options;if(options){if(typeof options==='function'){options=options();}if(!Array.isArray(options)){field=_extends({},field,{transform:function transform(value){return options[value];},allowedValues:Object.keys(options)});}else{field=_extends({},field,{transform:function transform(value){return options.find(function(option){return option.value===value;}).label;},allowedValues:options.map(function(options){return options.value;})});}}return field;}},{key:'getSubfields',value:function getSubfields(name){return this.schema.objectKeys(SimpleSchema._makeGeneric(name));}},{key:'getType',value:function getType(name){return this.getField(name).type;}},{key:'getValidator',value:function getValidator(){var options=arguments.length<=0||arguments[0]===undefined?{clean:true}:arguments[0];var validator=this.schema.validator(options);return function(model){return validator((0,_lodash2.default)(_extends({},model)));};}}],[{key:'check',value:function check(schema){return SimpleSchema&&schema&&schema.getDefinition&&schema.messageForError&&schema.objectKeys&&schema.validator;}}]);return SimpleSchemaBridge;}(_Bridge3.default);exports.default=SimpleSchemaBridge; |
@@ -1,2 +0,2 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _lodash=require('lodash.get');var _lodash2=_interopRequireDefault(_lodash);var _lodash3=require('lodash.isequal');var _lodash4=_interopRequireDefault(_lodash3);var _react=require('react');var _BaseForm=require('../forms/BaseForm');var _BaseForm2=_interopRequireDefault(_BaseForm);var _joinName=require('../../helpers/joinName');var _joinName2=_interopRequireDefault(_joinName);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var BaseField=function(_Component){_inherits(BaseField,_Component);function BaseField(){_classCallCheck(this,BaseField);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(BaseField).apply(this,arguments));_this.randomId=_this.context.uniforms.randomId();_this.findValue=_this.findValue.bind(_this);_this.findField=_this.findField.bind(_this);_this.findError=_this.findError.bind(_this);_this.getFieldProps=_this.getFieldProps.bind(_this);_this.getChildContextName=_this.getChildContextName.bind(_this);_this.getChildContextError=_this.getChildContextError.bind(_this);_this.getChildContextModel=_this.getChildContextModel.bind(_this);_this.getChildContextState=_this.getChildContextState.bind(_this);_this.getChildContextSchema=_this.getChildContextSchema.bind(_this);_this.getChildContextOnChange=_this.getChildContextOnChange.bind(_this);return _this;}_createClass(BaseField,[{key:'shouldComponentUpdate',value:function shouldComponentUpdate(nextProps,nextState,_ref){var nextContext=_ref.uniforms;var prevProps=this.props;var prevContext=this.context.uniforms;if(!(0,_lodash4.default)(prevProps,nextProps)){return true;}var prevName=(0,_joinName2.default)(prevContext.name,prevProps.name);var nextName=(0,_joinName2.default)(nextContext.name,nextProps.name);if(prevName!==nextName){return true;}if(nextName.indexOf('.')!==-1){var prevParentValue=(0,_lodash2.default)(prevContext.model,prevName.replace(/(.+)\..+$/,'$1'));var nextParentValue=(0,_lodash2.default)(nextContext.model,nextName.replace(/(.+)\..+$/,'$1'));if(Array.isArray(nextParentValue)&&!(0,_lodash4.default)(prevParentValue,nextParentValue)){return true;}}var prevValue=(0,_lodash2.default)(prevContext.model,prevName);var nextValue=(0,_lodash2.default)(nextContext.model,nextName);if(!(0,_lodash4.default)(prevValue,nextValue)){return true;}if(prevContext.error!==nextContext.error){var prevError=prevContext.error&&prevContext.schema.getError(prevName,prevContext.error);var nextError=nextContext.error&&nextContext.schema.getError(nextName,nextContext.error);if(!(0,_lodash4.default)(prevError,nextError)){return true;}// TODO: This is a workaround for List and Nest fields | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _lodash=require('lodash.get');var _lodash2=_interopRequireDefault(_lodash);var _lodash3=require('lodash.isequal');var _lodash4=_interopRequireDefault(_lodash3);var _react=require('react');var _BaseForm=require('../forms/BaseForm');var _BaseForm2=_interopRequireDefault(_BaseForm);var _joinName=require('../../helpers/joinName');var _joinName2=_interopRequireDefault(_joinName);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var BaseField=function(_Component){_inherits(BaseField,_Component);function BaseField(){_classCallCheck(this,BaseField);var _this=_possibleConstructorReturn(this,(BaseField.__proto__||Object.getPrototypeOf(BaseField)).apply(this,arguments));_this.randomId=_this.context.uniforms.randomId();_this.findValue=_this.findValue.bind(_this);_this.findField=_this.findField.bind(_this);_this.findError=_this.findError.bind(_this);_this.getFieldProps=_this.getFieldProps.bind(_this);_this.getChildContextName=_this.getChildContextName.bind(_this);_this.getChildContextError=_this.getChildContextError.bind(_this);_this.getChildContextModel=_this.getChildContextModel.bind(_this);_this.getChildContextState=_this.getChildContextState.bind(_this);_this.getChildContextSchema=_this.getChildContextSchema.bind(_this);_this.getChildContextOnChange=_this.getChildContextOnChange.bind(_this);return _this;}_createClass(BaseField,[{key:'shouldComponentUpdate',value:function shouldComponentUpdate(nextProps,nextState,_ref){var nextContext=_ref.uniforms;var prevProps=this.props;var prevContext=this.context.uniforms;if(!(0,_lodash4.default)(prevProps,nextProps)){return true;}var prevName=(0,_joinName2.default)(prevContext.name,prevProps.name);var nextName=(0,_joinName2.default)(nextContext.name,nextProps.name);if(prevName!==nextName){return true;}if(nextName.indexOf('.')!==-1){var prevParentValue=(0,_lodash2.default)(prevContext.model,prevName.replace(/(.+)\..+$/,'$1'));var nextParentValue=(0,_lodash2.default)(nextContext.model,nextName.replace(/(.+)\..+$/,'$1'));if(Array.isArray(nextParentValue)&&!(0,_lodash4.default)(prevParentValue,nextParentValue)){return true;}}var prevValue=(0,_lodash2.default)(prevContext.model,prevName);var nextValue=(0,_lodash2.default)(nextContext.model,nextName);if(!(0,_lodash4.default)(prevValue,nextValue)){return true;}if(prevContext.error!==nextContext.error){var prevError=prevContext.error&&prevContext.schema.getError(prevName,prevContext.error);var nextError=nextContext.error&&nextContext.schema.getError(nextName,nextContext.error);if(!(0,_lodash4.default)(prevError,nextError)){return true;}// TODO: This is a workaround for List and Nest fields | ||
// Those should update, if their child error has changed | ||
@@ -3,0 +3,0 @@ // eslint-disable-next-line max-len |
@@ -1,1 +0,1 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _lodash=require('lodash.clonedeep');var _lodash2=_interopRequireDefault(_lodash);var _lodash3=require('lodash.isequal');var _lodash4=_interopRequireDefault(_lodash3);var _lodash5=require('lodash.set');var _lodash6=_interopRequireDefault(_lodash5);var _react=require('react');var _ValidatedQuickForm=require('./ValidatedQuickForm');var _ValidatedQuickForm2=_interopRequireDefault(_ValidatedQuickForm);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Auto=function Auto(parent){var _class,_temp;return _temp=_class=function(_parent){_inherits(_class,_parent);function _class(){_classCallCheck(this,_class);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(_class).apply(this,arguments));_this.state=_extends({},_this.state,{model:_this.props.model,modelSync:_this.props.model});return _this;}_createClass(_class,[{key:'componentWillReceiveProps',value:function componentWillReceiveProps(_ref){var model=_ref.model;_get(Object.getPrototypeOf(_class.prototype),'componentWillReceiveProps',this).apply(this,arguments);if(!(0,_lodash4.default)(this.props.model,model)){this.setState({model:model,modelSync:model});}}},{key:'getChildContextModel',value:function getChildContextModel(){return this.state.modelSync;}},{key:'getNativeFormProps',value:function getNativeFormProps(){var _get$call=_get(Object.getPrototypeOf(_class.prototype),'getNativeFormProps',this).call(this);var onChangeModel=_get$call.onChangeModel;var props=_objectWithoutProperties(_get$call,['onChangeModel']);return props;}},{key:'getModel',value:function getModel(){return this.state.model;}},{key:'onChange',value:function onChange(key,value){var _this2=this,_arguments=arguments;this.setState(function(state){return{modelSync:(0,_lodash6.default)((0,_lodash2.default)(state.modelSync),key,value)};},function(){_get(Object.getPrototypeOf(_class.prototype),'onChange',_this2).apply(_this2,_arguments);_this2.setState({model:_this2.state.modelSync},function(){if(_this2.props.onChangeModel){_this2.props.onChangeModel(_this2.state.model);}});});}},{key:'onReset',value:function onReset(){_get(Object.getPrototypeOf(_class.prototype),'onReset',this).call(this);this.setState(function(){return{model:{},modelSync:{}};});}},{key:'onValidate',value:function onValidate(){return this.onValidateModel(this.getChildContextModel());}}]);return _class;}(parent),_class.Auto=Auto,_class.displayName='Auto'+parent.displayName,_class.propTypes=_extends({},parent.propTypes,{onChangeModel:_react.PropTypes.func}),_temp;};exports.default=Auto(_ValidatedQuickForm2.default); | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _lodash=require('lodash.clonedeep');var _lodash2=_interopRequireDefault(_lodash);var _lodash3=require('lodash.isequal');var _lodash4=_interopRequireDefault(_lodash3);var _lodash5=require('lodash.set');var _lodash6=_interopRequireDefault(_lodash5);var _react=require('react');var _ValidatedQuickForm=require('./ValidatedQuickForm');var _ValidatedQuickForm2=_interopRequireDefault(_ValidatedQuickForm);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Auto=function Auto(parent){var _class,_temp;return _temp=_class=function(_parent){_inherits(_class,_parent);function _class(){_classCallCheck(this,_class);var _this=_possibleConstructorReturn(this,(_class.__proto__||Object.getPrototypeOf(_class)).apply(this,arguments));_this.state=_extends({},_this.state,{model:_this.props.model,modelSync:_this.props.model});return _this;}_createClass(_class,[{key:'componentWillReceiveProps',value:function componentWillReceiveProps(_ref){var model=_ref.model;_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'componentWillReceiveProps',this).apply(this,arguments);if(!(0,_lodash4.default)(this.props.model,model)){this.setState({model:model,modelSync:model});}}},{key:'getChildContextModel',value:function getChildContextModel(){return this.state.modelSync;}},{key:'getNativeFormProps',value:function getNativeFormProps(){var _get$call=_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'getNativeFormProps',this).call(this);var onChangeModel=_get$call.onChangeModel;var props=_objectWithoutProperties(_get$call,['onChangeModel']);return props;}},{key:'getModel',value:function getModel(){return this.state.model;}},{key:'onChange',value:function onChange(key,value){var _this2=this,_arguments=arguments;this.setState(function(state){return{modelSync:(0,_lodash6.default)((0,_lodash2.default)(state.modelSync),key,value)};},function(){_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'onChange',_this2).apply(_this2,_arguments);_this2.setState({model:_this2.state.modelSync},function(){if(_this2.props.onChangeModel){_this2.props.onChangeModel(_this2.state.model);}});});}},{key:'onReset',value:function onReset(){_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'onReset',this).call(this);this.setState(function(){return{model:{},modelSync:{}};});}},{key:'onValidate',value:function onValidate(){return this.onValidateModel(this.getChildContextModel());}}]);return _class;}(parent),_class.Auto=Auto,_class.displayName='Auto'+parent.displayName,_class.propTypes=_extends({},parent.propTypes,{onChangeModel:_react.PropTypes.func}),_temp;};exports.default=Auto(_ValidatedQuickForm2.default); |
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require('react');var _react2=_interopRequireDefault(_react);var _lodash=require('lodash.clonedeep');var _lodash2=_interopRequireDefault(_lodash);var _lodash3=require('lodash.get');var _lodash4=_interopRequireDefault(_lodash3);var _lodash5=require('lodash.set');var _lodash6=_interopRequireDefault(_lodash5);var _changedKeys=require('../../helpers/changedKeys');var _changedKeys2=_interopRequireDefault(_changedKeys);var _bridges=require('../../bridges');var _bridges2=_interopRequireDefault(_bridges);var _randomIds=require('../../helpers/randomIds');var _randomIds2=_interopRequireDefault(_randomIds);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}// Silent `Uncaught (in promise)` warnings | ||
// TODO: Find a better way to do it | ||
/* eslint-disable */var unhandledPromiseHandlerCount=0;var unhandledPromiseHandlerAllowed=typeof window!=='undefined';var unhandledPromiseHandler=function unhandledPromiseHandler(event){return event&&event.reason&&event.reason.__uniformsPromiseMark&&event.preventDefault();};var unhandledPromiseHandlerAdd=function unhandledPromiseHandlerAdd(){return unhandledPromiseHandlerAllowed&&++unhandledPromiseHandlerCount===1&&window.addEventListener('unhandledrejection',unhandledPromiseHandler);};var unhandledPromiseHandlerDel=function unhandledPromiseHandlerDel(){return unhandledPromiseHandlerAllowed&&--unhandledPromiseHandlerCount===0&&window.removeEventListener('unhandledrejection',unhandledPromiseHandler);};/* eslint-enable */var BaseForm=function(_Component){_inherits(BaseForm,_Component);function BaseForm(){_classCallCheck(this,BaseForm);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(BaseForm).apply(this,arguments));_this.state={bridge:(0,_bridges2.default)(_this.props.schema),changed:null,changedMap:{},resetCount:0};_this.delayId=null;_this.randomId=(0,_randomIds2.default)(_this.props.id);_this.onReset=_this.reset=_this.onReset.bind(_this);_this.onChange=_this.change=_this.onChange.bind(_this);_this.onSubmit=_this.submit=_this.onSubmit.bind(_this);_this.getModel=_this.getModel.bind(_this);_this.getChangedKeys=_this.getChangedKeys.bind(_this);_this.getNativeFormProps=_this.getNativeFormProps.bind(_this);_this.getChildContextName=_this.getChildContextName.bind(_this);_this.getChildContextError=_this.getChildContextError.bind(_this);_this.getChildContextModel=_this.getChildContextModel.bind(_this);_this.getChildContextState=_this.getChildContextState.bind(_this);_this.getChildContextSchema=_this.getChildContextSchema.bind(_this);_this.getChildContextOnChange=_this.getChildContextOnChange.bind(_this);return _this;}_createClass(BaseForm,[{key:'getChildContext',value:function getChildContext(){return{uniforms:{name:this.getChildContextName(),error:this.getChildContextError(),model:this.getChildContextModel(),state:this.getChildContextState(),schema:this.getChildContextSchema(),onChange:this.getChildContextOnChange(),randomId:this.randomId}};}},{key:'getChildContextName',value:function getChildContextName(){return[];}},{key:'getChildContextError',value:function getChildContextError(){return this.props.error;}},{key:'getChildContextModel',value:function getChildContextModel(){return this.props.model;}},{key:'getChildContextState',value:function getChildContextState(){return{changed:!!this.state.changed,changedMap:this.state.changedMap,label:!!this.props.label,disabled:!!this.props.disabled,placeholder:!!this.props.placeholder};}},{key:'getChildContextSchema',value:function getChildContextSchema(){return this.state.bridge;}},{key:'getChildContextOnChange',value:function getChildContextOnChange(){return this.onChange;}},{key:'getModel',value:function getModel(){return this.getChildContextModel();}},{key:'componentWillMount',value:function componentWillMount(){var _this2=this;this.setState({},function(){return _this2.setState({changed:false});});}},{key:'componentDidMount',value:function componentDidMount(){unhandledPromiseHandlerAdd();}},{key:'componentWillUnmount',value:function componentWillUnmount(){unhandledPromiseHandlerDel();}},{key:'componentWillReceiveProps',value:function componentWillReceiveProps(_ref){var schema=_ref.schema;if(this.props.schema!==schema){this.setState({bridge:(0,_bridges2.default)(schema)});}}},{key:'render',value:function render(){return _react2.default.createElement('form',this.getNativeFormProps());}},{key:'getChangedKeys',value:function getChangedKeys(root,valueA,valueB){return(0,_changedKeys2.default)(root,valueA,valueB);}},{key:'getNativeFormProps',value:function getNativeFormProps(){var _props=this.props;var autosave=_props.autosave;var autosaveDelay=_props.autosaveDelay;var disabled=_props.disabled;var error=_props.error;var label=_props.label;var model=_props.model;var onChange=_props.onChange;var onSubmit=_props.onSubmit;var onSubmitFailure=_props.onSubmitFailure;var onSubmitSuccess=_props.onSubmitSuccess;var placeholder=_props.placeholder;var schema=_props.schema;var props=_objectWithoutProperties(_props,['autosave','autosaveDelay','disabled','error','label','model','onChange','onSubmit','onSubmitFailure','onSubmitSuccess','placeholder','schema']);return _extends({},props,{onSubmit:this.onSubmit,key:'reset-'+this.state.resetCount});}},{key:'onChange',value:function onChange(key,value){var _this3=this;// Do not set `changed` before componentDidMount | ||
/* eslint-disable */var unhandledPromiseHandlerCount=0;var unhandledPromiseHandlerAllowed=typeof window!=='undefined';var unhandledPromiseHandler=function unhandledPromiseHandler(event){return event&&event.reason&&event.reason.__uniformsPromiseMark&&event.preventDefault();};var unhandledPromiseHandlerAdd=function unhandledPromiseHandlerAdd(){return unhandledPromiseHandlerAllowed&&++unhandledPromiseHandlerCount===1&&window.addEventListener('unhandledrejection',unhandledPromiseHandler);};var unhandledPromiseHandlerDel=function unhandledPromiseHandlerDel(){return unhandledPromiseHandlerAllowed&&--unhandledPromiseHandlerCount===0&&window.removeEventListener('unhandledrejection',unhandledPromiseHandler);};/* eslint-enable */var BaseForm=function(_Component){_inherits(BaseForm,_Component);function BaseForm(){_classCallCheck(this,BaseForm);var _this=_possibleConstructorReturn(this,(BaseForm.__proto__||Object.getPrototypeOf(BaseForm)).apply(this,arguments));_this.state={bridge:(0,_bridges2.default)(_this.props.schema),changed:null,changedMap:{},resetCount:0};_this.delayId=null;_this.randomId=(0,_randomIds2.default)(_this.props.id);_this.onReset=_this.reset=_this.onReset.bind(_this);_this.onChange=_this.change=_this.onChange.bind(_this);_this.onSubmit=_this.submit=_this.onSubmit.bind(_this);_this.getModel=_this.getModel.bind(_this);_this.getChangedKeys=_this.getChangedKeys.bind(_this);_this.getNativeFormProps=_this.getNativeFormProps.bind(_this);_this.getChildContextName=_this.getChildContextName.bind(_this);_this.getChildContextError=_this.getChildContextError.bind(_this);_this.getChildContextModel=_this.getChildContextModel.bind(_this);_this.getChildContextState=_this.getChildContextState.bind(_this);_this.getChildContextSchema=_this.getChildContextSchema.bind(_this);_this.getChildContextOnChange=_this.getChildContextOnChange.bind(_this);return _this;}_createClass(BaseForm,[{key:'getChildContext',value:function getChildContext(){return{uniforms:{name:this.getChildContextName(),error:this.getChildContextError(),model:this.getChildContextModel(),state:this.getChildContextState(),schema:this.getChildContextSchema(),onChange:this.getChildContextOnChange(),randomId:this.randomId}};}},{key:'getChildContextName',value:function getChildContextName(){return[];}},{key:'getChildContextError',value:function getChildContextError(){return this.props.error;}},{key:'getChildContextModel',value:function getChildContextModel(){return this.props.model;}},{key:'getChildContextState',value:function getChildContextState(){return{changed:!!this.state.changed,changedMap:this.state.changedMap,label:!!this.props.label,disabled:!!this.props.disabled,placeholder:!!this.props.placeholder};}},{key:'getChildContextSchema',value:function getChildContextSchema(){return this.state.bridge;}},{key:'getChildContextOnChange',value:function getChildContextOnChange(){return this.onChange;}},{key:'getModel',value:function getModel(){return this.getChildContextModel();}},{key:'componentWillMount',value:function componentWillMount(){var _this2=this;this.setState({},function(){return _this2.setState({changed:false});});}},{key:'componentDidMount',value:function componentDidMount(){unhandledPromiseHandlerAdd();}},{key:'componentWillUnmount',value:function componentWillUnmount(){unhandledPromiseHandlerDel();}},{key:'componentWillReceiveProps',value:function componentWillReceiveProps(_ref){var schema=_ref.schema;if(this.props.schema!==schema){this.setState({bridge:(0,_bridges2.default)(schema)});}}},{key:'render',value:function render(){return _react2.default.createElement('form',this.getNativeFormProps());}},{key:'getChangedKeys',value:function getChangedKeys(root,valueA,valueB){return(0,_changedKeys2.default)(root,valueA,valueB);}},{key:'getNativeFormProps',value:function getNativeFormProps(){var _props=this.props;var autosave=_props.autosave;var autosaveDelay=_props.autosaveDelay;var disabled=_props.disabled;var error=_props.error;var label=_props.label;var model=_props.model;var onChange=_props.onChange;var onSubmit=_props.onSubmit;var onSubmitFailure=_props.onSubmitFailure;var onSubmitSuccess=_props.onSubmitSuccess;var placeholder=_props.placeholder;var schema=_props.schema;var props=_objectWithoutProperties(_props,['autosave','autosaveDelay','disabled','error','label','model','onChange','onSubmit','onSubmitFailure','onSubmitSuccess','placeholder','schema']);return _extends({},props,{onSubmit:this.onSubmit,key:'reset-'+this.state.resetCount});}},{key:'onChange',value:function onChange(key,value){var _this3=this;// Do not set `changed` before componentDidMount | ||
if(this.state.changed!==null){this.setState({changed:true});this.getChangedKeys(key,value,(0,_lodash4.default)(this.getModel(),key)).forEach(function(key){return _this3.setState(function(state){return(0,_lodash4.default)(state.changedMap,key)?{}:{changedMap:(0,_lodash6.default)((0,_lodash2.default)(state.changedMap),key,{})};});});}if(this.props.onChange){this.props.onChange(key,value);}// Do not call `onSubmit` before componentDidMount | ||
if(this.state.changed!==null&&this.props.autosave){if(this.delayId){this.delayId=clearTimeout(this.delayId);}if(this.props.autosaveDelay>0){this.delayId=setTimeout(this.onSubmit,this.props.autosaveDelay);}else{this.onSubmit();}}}},{key:'onReset',value:function onReset(){this.setState(function(state){return{changed:false,changedMap:{},resetCount:state.resetCount+1};});}},{key:'onSubmit',value:function onSubmit(event){if(event){event.preventDefault();event.stopPropagation();}var promise=Promise.resolve(this.props.onSubmit&&this.props.onSubmit(this.getModel()));promise.then(this.props.onSubmitSuccess,this.props.onSubmitFailure);return promise;}}]);return BaseForm;}(_react.Component);BaseForm.displayName='Form';BaseForm.defaultProps={model:{},label:true,autosave:false,autosaveDelay:0,noValidate:true};BaseForm.propTypes={error:_react.PropTypes.object,model:_react.PropTypes.object,schema:_react.PropTypes.any.isRequired,onChange:_react.PropTypes.func,onSubmit:_react.PropTypes.func,onSubmitFailure:_react.PropTypes.func,onSubmitSuccess:_react.PropTypes.func,label:_react.PropTypes.bool,disabled:_react.PropTypes.bool,placeholder:_react.PropTypes.bool,autosave:_react.PropTypes.bool,autosaveDelay:_react.PropTypes.number};BaseForm.childContextTypes={uniforms:_react.PropTypes.shape({name:_react.PropTypes.arrayOf(_react.PropTypes.string).isRequired,error:_react.PropTypes.object,model:_react.PropTypes.object.isRequired,schema:_react.PropTypes.shape({getError:_react.PropTypes.func.isRequired,getErrorMessage:_react.PropTypes.func.isRequired,getErrorMessages:_react.PropTypes.func.isRequired,getField:_react.PropTypes.func.isRequired,getInitialValue:_react.PropTypes.func.isRequired,getProps:_react.PropTypes.func.isRequired,getSubfields:_react.PropTypes.func.isRequired,getType:_react.PropTypes.func.isRequired,getValidator:_react.PropTypes.func.isRequired}).isRequired,state:_react.PropTypes.shape({changed:_react.PropTypes.bool.isRequired,changedMap:_react.PropTypes.object.isRequired,label:_react.PropTypes.bool.isRequired,disabled:_react.PropTypes.bool.isRequired,placeholder:_react.PropTypes.bool.isRequired}).isRequired,onChange:_react.PropTypes.func.isRequired,randomId:_react.PropTypes.func.isRequired}).isRequired};exports.default=BaseForm; |
@@ -1,1 +0,1 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _react=require('react');var _react2=_interopRequireDefault(_react);var _BaseForm=require('./BaseForm');var _BaseForm2=_interopRequireDefault(_BaseForm);var _nothing=require('../../helpers/nothing');var _nothing2=_interopRequireDefault(_nothing);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Quick=function Quick(parent){var _class,_temp;return _temp=_class=function(_parent){_inherits(_class,_parent);function _class(){_classCallCheck(this,_class);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(_class).apply(this,arguments));_this.getAutoField=_this.getAutoField.bind(_this);_this.getErrorsField=_this.getErrorsField.bind(_this);_this.getSubmitField=_this.getSubmitField.bind(_this);return _this;}_createClass(_class,[{key:'getNativeFormProps',value:function getNativeFormProps(){var _get$call=_get(Object.getPrototypeOf(_class.prototype),'getNativeFormProps',this).call(this);var autoField=_get$call.autoField;var errorsField=_get$call.errorsField;var submitField=_get$call.submitField;var props=_objectWithoutProperties(_get$call,['autoField','errorsField','submitField']);return props;}},{key:'render',value:function render(){var nativeFormProps=this.getNativeFormProps();if(nativeFormProps.children){return _get(Object.getPrototypeOf(_class.prototype),'render',this).call(this);}var AutoField=this.props.autoField||this.getAutoField();var ErrorsField=this.props.errorsField||this.getErrorsField();var SubmitField=this.props.submitField||this.getSubmitField();return _react2.default.createElement('form',nativeFormProps,this.getChildContextSchema().getSubfields().map(function(key){return _react2.default.createElement(AutoField,{key:key,name:key});}),_react2.default.createElement(ErrorsField,null),_react2.default.createElement(SubmitField,null));}},{key:'getAutoField',value:function getAutoField(){return function(){return _nothing2.default;};}},{key:'getErrorsField',value:function getErrorsField(){return function(){return _nothing2.default;};}},{key:'getSubmitField',value:function getSubmitField(){return function(){return _nothing2.default;};}}]);return _class;}(parent),_class.Quick=Quick,_class.displayName='Quick'+parent.displayName,_class.propTypes=_extends({},parent.propTypes,{autoField:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.string]),errorsField:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.string]),submitField:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.string])}),_temp;};exports.default=Quick(_BaseForm2.default); | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _react=require('react');var _react2=_interopRequireDefault(_react);var _BaseForm=require('./BaseForm');var _BaseForm2=_interopRequireDefault(_BaseForm);var _nothing=require('../../helpers/nothing');var _nothing2=_interopRequireDefault(_nothing);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Quick=function Quick(parent){var _class,_temp;return _temp=_class=function(_parent){_inherits(_class,_parent);function _class(){_classCallCheck(this,_class);var _this=_possibleConstructorReturn(this,(_class.__proto__||Object.getPrototypeOf(_class)).apply(this,arguments));_this.getAutoField=_this.getAutoField.bind(_this);_this.getErrorsField=_this.getErrorsField.bind(_this);_this.getSubmitField=_this.getSubmitField.bind(_this);return _this;}_createClass(_class,[{key:'getNativeFormProps',value:function getNativeFormProps(){var _get$call=_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'getNativeFormProps',this).call(this);var autoField=_get$call.autoField;var errorsField=_get$call.errorsField;var submitField=_get$call.submitField;var props=_objectWithoutProperties(_get$call,['autoField','errorsField','submitField']);return props;}},{key:'render',value:function render(){var nativeFormProps=this.getNativeFormProps();if(nativeFormProps.children){return _get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'render',this).call(this);}var AutoField=this.props.autoField||this.getAutoField();var ErrorsField=this.props.errorsField||this.getErrorsField();var SubmitField=this.props.submitField||this.getSubmitField();return _react2.default.createElement('form',nativeFormProps,this.getChildContextSchema().getSubfields().map(function(key){return _react2.default.createElement(AutoField,{key:key,name:key});}),_react2.default.createElement(ErrorsField,null),_react2.default.createElement(SubmitField,null));}},{key:'getAutoField',value:function getAutoField(){return function(){return _nothing2.default;};}},{key:'getErrorsField',value:function getErrorsField(){return function(){return _nothing2.default;};}},{key:'getSubmitField',value:function getSubmitField(){return function(){return _nothing2.default;};}}]);return _class;}(parent),_class.Quick=Quick,_class.displayName='Quick'+parent.displayName,_class.propTypes=_extends({},parent.propTypes,{autoField:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.string]),errorsField:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.string]),submitField:_react.PropTypes.oneOfType([_react.PropTypes.func,_react.PropTypes.string])}),_temp;};exports.default=Quick(_BaseForm2.default); |
@@ -1,1 +0,1 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _lodash=require('lodash.clonedeep');var _lodash2=_interopRequireDefault(_lodash);var _lodash3=require('lodash.isequal');var _lodash4=_interopRequireDefault(_lodash3);var _lodash5=require('lodash.set');var _lodash6=_interopRequireDefault(_lodash5);var _react=require('react');var _BaseForm=require('./BaseForm');var _BaseForm2=_interopRequireDefault(_BaseForm);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Validated=function Validated(parent){var _class,_temp;return _temp=_class=function(_parent){_inherits(_class,_parent);function _class(){_classCallCheck(this,_class);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(_class).apply(this,arguments));_this.state=_extends({},_this.state,{error:null,validate:false,validator:_this.getChildContextSchema().getValidator(_this.props.validator)});_this.onValidate=_this.validate=_this.onValidate.bind(_this);_this.onValidateModel=_this.validateModel=_this.onValidateModel.bind(_this);return _this;}_createClass(_class,[{key:'getChildContextError',value:function getChildContextError(){return _get(Object.getPrototypeOf(_class.prototype),'getChildContextError',this).call(this)||this.state.error;}},{key:'getNativeFormProps',value:function getNativeFormProps(){var _get$call=_get(Object.getPrototypeOf(_class.prototype),'getNativeFormProps',this).call(this);var onValidate=_get$call.onValidate;var validator=_get$call.validator;var validate=_get$call.validate;var props=_objectWithoutProperties(_get$call,['onValidate','validator','validate']);return props;}},{key:'componentWillReceiveProps',value:function componentWillReceiveProps(_ref){var _this2=this;var model=_ref.model;var schema=_ref.schema;var validate=_ref.validate;var validator=_ref.validator;_get(Object.getPrototypeOf(_class.prototype),'componentWillReceiveProps',this).apply(this,arguments);if(this.props.schema!==schema||this.props.validator!==validator){this.setState({validator:this.getChildContextSchema().getValidator(validator)},function(){if(validate==='onChange'||validate==='onChangeAfterSubmit'&&_this2.state.validate){_this2.onValidate();}});}else if(!(0,_lodash4.default)(this.props.model,model)){if(validate==='onChange'||validate==='onChangeAfterSubmit'&&this.state.validate){this.onValidate();}}}},{key:'onChange',value:function onChange(key,value){if(this.props.validate==='onChange'||this.props.validate==='onChangeAfterSubmit'&&this.state.validate){this.onValidate(key,value);}_get(Object.getPrototypeOf(_class.prototype),'onChange',this).apply(this,arguments);}},{key:'onReset',value:function onReset(){_get(Object.getPrototypeOf(_class.prototype),'onReset',this).call(this);this.setState(function(){return{error:null,validate:false};});}},{key:'onSubmit',value:function onSubmit(event){var _this3=this;if(event){event.preventDefault();event.stopPropagation();}return new Promise(function(resolve){return _this3.setState({validate:true},function(){return resolve(_this3.onValidate().then(function(){return _get(Object.getPrototypeOf(_class.prototype),'onSubmit',_this3).call(_this3);}));});});}},{key:'onValidate',value:function onValidate(key,value){var model=this.getModel();if(model&&key){model=(0,_lodash6.default)((0,_lodash2.default)(model),key,(0,_lodash2.default)(value));}return this.onValidateModel(model);}},{key:'onValidateModel',value:function onValidateModel(model){var _this4=this;var catched=this.props.error||null;try{this.state.validator(model);}catch(error){catched=error;}var markAndHandle=function markAndHandle(){var error=arguments.length<=0||arguments[0]===undefined?catched:arguments[0];var resolve=arguments[1];var reject=arguments[2];return _this4.setState({error:error},function(){if(error){error.__uniformsPromiseMark=true;reject(error);}else{resolve();}});};return new Promise(function(resolve,reject){return _this4.props.onValidate?_this4.props.onValidate(model,catched,function(error){return markAndHandle(error,resolve,reject);}):markAndHandle(catched,resolve,reject);});}}]);return _class;}(parent),_class.Validated=Validated,_class.displayName='Validated'+parent.displayName,_class.defaultProps=_extends({},parent.defaultProps,{validate:'onChangeAfterSubmit'}),_class.propTypes=_extends({},parent.propTypes,{onValidate:_react.PropTypes.func,validator:_react.PropTypes.any,validate:_react.PropTypes.oneOf(['onChange','onChangeAfterSubmit','onSubmit'])}),_temp;};exports.default=Validated(_BaseForm2.default); | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};var _lodash=require('lodash.clonedeep');var _lodash2=_interopRequireDefault(_lodash);var _lodash3=require('lodash.isequal');var _lodash4=_interopRequireDefault(_lodash3);var _lodash5=require('lodash.set');var _lodash6=_interopRequireDefault(_lodash5);var _react=require('react');var _BaseForm=require('./BaseForm');var _BaseForm2=_interopRequireDefault(_BaseForm);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Validated=function Validated(parent){var _class,_temp;return _temp=_class=function(_parent){_inherits(_class,_parent);function _class(){_classCallCheck(this,_class);var _this=_possibleConstructorReturn(this,(_class.__proto__||Object.getPrototypeOf(_class)).apply(this,arguments));_this.state=_extends({},_this.state,{error:null,validate:false,validator:_this.getChildContextSchema().getValidator(_this.props.validator)});_this.onValidate=_this.validate=_this.onValidate.bind(_this);_this.onValidateModel=_this.validateModel=_this.onValidateModel.bind(_this);return _this;}_createClass(_class,[{key:'getChildContextError',value:function getChildContextError(){return _get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'getChildContextError',this).call(this)||this.state.error;}},{key:'getNativeFormProps',value:function getNativeFormProps(){var _get$call=_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'getNativeFormProps',this).call(this);var onValidate=_get$call.onValidate;var validator=_get$call.validator;var validate=_get$call.validate;var props=_objectWithoutProperties(_get$call,['onValidate','validator','validate']);return props;}},{key:'componentWillReceiveProps',value:function componentWillReceiveProps(_ref){var _this2=this;var model=_ref.model;var schema=_ref.schema;var validate=_ref.validate;var validator=_ref.validator;_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'componentWillReceiveProps',this).apply(this,arguments);if(this.props.schema!==schema||this.props.validator!==validator){this.setState({validator:this.getChildContextSchema().getValidator(validator)},function(){if(validate==='onChange'||validate==='onChangeAfterSubmit'&&_this2.state.validate){_this2.onValidate();}});}else if(!(0,_lodash4.default)(this.props.model,model)){if(validate==='onChange'||validate==='onChangeAfterSubmit'&&this.state.validate){this.onValidate();}}}},{key:'onChange',value:function onChange(key,value){if(this.props.validate==='onChange'||this.props.validate==='onChangeAfterSubmit'&&this.state.validate){this.onValidate(key,value);}_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'onChange',this).apply(this,arguments);}},{key:'onReset',value:function onReset(){_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'onReset',this).call(this);this.setState(function(){return{error:null,validate:false};});}},{key:'onSubmit',value:function onSubmit(event){var _this3=this;if(event){event.preventDefault();event.stopPropagation();}return new Promise(function(resolve){return _this3.setState({validate:true},function(){return resolve(_this3.onValidate().then(function(){return _get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'onSubmit',_this3).call(_this3);}));});});}},{key:'onValidate',value:function onValidate(key,value){var model=this.getModel();if(model&&key){model=(0,_lodash6.default)((0,_lodash2.default)(model),key,(0,_lodash2.default)(value));}return this.onValidateModel(model);}},{key:'onValidateModel',value:function onValidateModel(model){var _this4=this;var catched=this.props.error||null;try{this.state.validator(model);}catch(error){catched=error;}var markAndHandle=function markAndHandle(){var error=arguments.length<=0||arguments[0]===undefined?catched:arguments[0];var resolve=arguments[1];var reject=arguments[2];return _this4.setState({error:error},function(){if(error){error.__uniformsPromiseMark=true;reject(error);}else{resolve();}});};return new Promise(function(resolve,reject){return _this4.props.onValidate?_this4.props.onValidate(model,catched,function(error){return markAndHandle(error,resolve,reject);}):markAndHandle(catched,resolve,reject);});}}]);return _class;}(parent),_class.Validated=Validated,_class.displayName='Validated'+parent.displayName,_class.defaultProps=_extends({},parent.defaultProps,{validate:'onChangeAfterSubmit'}),_class.propTypes=_extends({},parent.propTypes,{onValidate:_react.PropTypes.func,validator:_react.PropTypes.any,validate:_react.PropTypes.oneOf(['onChange','onChangeAfterSubmit','onSubmit'])}),_temp;};exports.default=Validated(_BaseForm2.default); |
@@ -1,3 +0,3 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};exports.default=connectField;var _react=require('react');var _BaseField=require('../components/fields/BaseField');var _BaseField2=_interopRequireDefault(_BaseField);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}function connectField(component){var _class,_temp;var _ref=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var _ref$mapProps=_ref.mapProps;var mapProps=_ref$mapProps===undefined?function(x){return x;}:_ref$mapProps;var _ref$baseField=_ref.baseField;var baseField=_ref$baseField===undefined?_BaseField2.default:_ref$baseField;var _ref$ensureValue=_ref.ensureValue;var ensureValue=_ref$ensureValue===undefined?true:_ref$ensureValue;var _ref$initialValue=_ref.initialValue;var initialValue=_ref$initialValue===undefined?true:_ref$initialValue;var _ref$includeParent=_ref.includeParent;var includeParent=_ref$includeParent===undefined?false:_ref$includeParent;var _ref$includeInChain=_ref.includeInChain;var includeInChain=_ref$includeInChain===undefined?true:_ref$includeInChain;return _temp=_class=function(_baseField){_inherits(_class,_baseField);function _class(){_classCallCheck(this,_class);return _possibleConstructorReturn(this,Object.getPrototypeOf(_class).apply(this,arguments));}_createClass(_class,[{key:'getChildContextName',value:function getChildContextName(){return includeInChain?_get(Object.getPrototypeOf(_class.prototype),'getChildContextName',this).call(this):this.context.uniforms.name;}},{key:'render',value:function render(){return(0,_react.createElement)(component,mapProps(this.getFieldProps(undefined,{ensureValue:ensureValue,includeParent:includeParent})));}},{key:'componentWillMount',value:function componentWillMount(){if(initialValue){var props=this.getFieldProps(undefined,{explicitInitialValue:true,includeParent:false});// https://github.com/vazco/uniforms/issues/52 | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _get=function get(object,property,receiver){if(object===null)object=Function.prototype;var desc=Object.getOwnPropertyDescriptor(object,property);if(desc===undefined){var parent=Object.getPrototypeOf(object);if(parent===null){return undefined;}else{return get(parent,property,receiver);}}else if("value"in desc){return desc.value;}else{var getter=desc.get;if(getter===undefined){return undefined;}return getter.call(receiver);}};exports.default=connectField;var _react=require('react');var _BaseField=require('../components/fields/BaseField');var _BaseField2=_interopRequireDefault(_BaseField);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}function connectField(component){var _class,_temp;var _ref=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];var _ref$mapProps=_ref.mapProps;var mapProps=_ref$mapProps===undefined?function(x){return x;}:_ref$mapProps;var _ref$baseField=_ref.baseField;var baseField=_ref$baseField===undefined?_BaseField2.default:_ref$baseField;var _ref$ensureValue=_ref.ensureValue;var ensureValue=_ref$ensureValue===undefined?true:_ref$ensureValue;var _ref$initialValue=_ref.initialValue;var initialValue=_ref$initialValue===undefined?true:_ref$initialValue;var _ref$includeParent=_ref.includeParent;var includeParent=_ref$includeParent===undefined?false:_ref$includeParent;var _ref$includeInChain=_ref.includeInChain;var includeInChain=_ref$includeInChain===undefined?true:_ref$includeInChain;return _temp=_class=function(_baseField){_inherits(_class,_baseField);function _class(){_classCallCheck(this,_class);return _possibleConstructorReturn(this,(_class.__proto__||Object.getPrototypeOf(_class)).apply(this,arguments));}_createClass(_class,[{key:'getChildContextName',value:function getChildContextName(){return includeInChain?_get(_class.prototype.__proto__||Object.getPrototypeOf(_class.prototype),'getChildContextName',this).call(this):this.context.uniforms.name;}},{key:'render',value:function render(){return(0,_react.createElement)(component,mapProps(this.getFieldProps(undefined,{ensureValue:ensureValue,includeParent:includeParent})));}},{key:'componentWillMount',value:function componentWillMount(){if(initialValue){var props=this.getFieldProps(undefined,{explicitInitialValue:true,includeParent:false});// https://github.com/vazco/uniforms/issues/52 | ||
// If field is initially rendered with value, we treat it as an initial value. | ||
if(this.props.value!==undefined){props.onChange(this.props.value);return;}if(props.value===undefined&&props.required){props.onChange(props.initialValue);}}}}]);return _class;}(baseField),_class.displayName=(baseField.displayName||baseField.name)+'('+(component.displayName||component.name)+')',_temp;} |
{ | ||
"name": "uniforms", | ||
"version": "1.0.0-rc.32", | ||
"version": "1.0.0-rc.33", | ||
"main": "lib/index.js", | ||
@@ -31,3 +31,3 @@ "jsnext:main": "src/index.js", | ||
"lint": "eslint src test", | ||
"prepublish": "npm run lint && npm run test && npm run build", | ||
"prepublish": "npm run build", | ||
"pretest": "npm run lint", | ||
@@ -38,16 +38,16 @@ "reset": "rimraf node_modules", | ||
"devDependencies": { | ||
"babel-cli": "^6.11.4", | ||
"babel-cli": "^6.14.0", | ||
"babel-eslint": "^6.1.2", | ||
"babel-plugin-istanbul": "^2.0.0", | ||
"babel-preset-es2015": "^6.13.2", | ||
"babel-plugin-istanbul": "^2.0.2", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-preset-react": "^6.11.1", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"chai": "^3.5.0", | ||
"cross-env": "^2.0.0", | ||
"cross-env": "^2.0.1", | ||
"enzyme": "^2.4.1", | ||
"eslint": "^3.3.1", | ||
"eslint-config-vazco": "2.0.0", | ||
"eslint": "^3.5.0", | ||
"eslint-config-vazco": "2.0.1", | ||
"eslint-plugin-babel": "^3.3.0", | ||
"eslint-plugin-react": "^6.1.2", | ||
"jsdom": "^9.4.2", | ||
"eslint-plugin-react": "^6.2.0", | ||
"jsdom": "^9.5.0", | ||
"mocha": "^3.0.2", | ||
@@ -54,0 +54,0 @@ "mock-require": "^1.3.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100810
1198