From d93bc1a1350ebda93544628c99e23828f56d1ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Przoda=C5=82a?= Date: Mon, 15 May 2017 07:35:11 +0200 Subject: [PATCH 1/4] 2.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 02d6acd..c403685 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-components-form", - "version": "2.0.0", + "version": "2.1.0", "description": "React form components", "main": "main.js", "jsnext:main": "src/index.js", From 5c5392dfb643a112e8a68c82b525d48e8b6958d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Przoda=C5=82a?= Date: Tue, 16 May 2017 07:53:09 +0200 Subject: [PATCH 2/4] fix for validation when object field is in objectField --- Bootstrap.js | 2 +- main.js | 2 +- src/components/ObjectField.jsx | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Bootstrap.js b/Bootstrap.js index 1fdcc13..77acac0 100644 --- a/Bootstrap.js +++ b/Bootstrap.js @@ -8,4 +8,4 @@ object-assign (c) Sindre Sorhus @license MIT */ -var a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(e,t){for(var r,o,l=n(e),u=1;u0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,l=e.error,u=e.value,c=e.label,y=e.placeholder,m=e.errorStyles,h=void 0===m?{}:m,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,l&&h.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(u),placeholder:y,className:r},g)),l&&s.default.createElement(p.default,o({errors:i},h)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,l.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),x={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:l,element:u(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:m};o.prototype=Error.prototype,e.exports=x},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=l,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),l=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?u.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,m=0,h=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subForm,o=e.id;return n?u.default.createElement("div",{className:r},t):u.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(u.default.Component);p.childContextTypes={setModel:l.PropTypes.func,getModel:l.PropTypes.func,getSchema:l.PropTypes.func,submitForm:l.PropTypes.func,getErrors:l.PropTypes.func,getPath:l.PropTypes.func,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.propTypes={model:l.PropTypes.shape({}),schema:l.PropTypes.shape({}),onError:l.PropTypes.func,onSubmit:l.PropTypes.func.isRequired,validateOnChange:l.PropTypes.bool,customValidation:l.PropTypes.func,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,l=e.error,u=e.value,c=e.label,y=e.placeholder,m=e.errorStyles,h=void 0===m?{}:m,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,l&&h.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(u),placeholder:y,className:r},g)),l&&s.default.createElement(p.default,o({errors:i},h)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,l.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),x={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:l,element:u(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:m};o.prototype=Error.prototype,e.exports=x},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=l,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),l=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?u.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,m=0,h=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subform,o=e.id;return n?u.default.createElement("div",{className:r},t):u.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(u.default.Component);p.childContextTypes={setModel:l.PropTypes.func,getModel:l.PropTypes.func,getSchema:l.PropTypes.func,submitForm:l.PropTypes.func,getErrors:l.PropTypes.func,getPath:l.PropTypes.func,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.propTypes={model:l.PropTypes.shape({}),schema:l.PropTypes.shape({}),onError:l.PropTypes.func,onSubmit:l.PropTypes.func.isRequired,validateOnChange:l.PropTypes.bool,customValidation:l.PropTypes.func,subform:l.PropTypes.bool,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,u=e.error,l=e.value,c=e.label,y=e.placeholder,h=e.errorStyles,m=void 0===h?{}:h,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,u&&m.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(l),placeholder:y,className:r},g)),u&&s.default.createElement(p.default,o({errors:i},m)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,u.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),j={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:u,element:l(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:h};o.prototype=Error.prototype,e.exports=j},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=u,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),u=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?l.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,h=0,m=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subForm,o=e.id;return n?l.default.createElement("div",{className:r},t):l.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(l.default.Component);p.childContextTypes={setModel:u.PropTypes.func,getModel:u.PropTypes.func,getSchema:u.PropTypes.func,submitForm:u.PropTypes.func,getErrors:u.PropTypes.func,getPath:u.PropTypes.func,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.propTypes={model:u.PropTypes.shape({}),schema:u.PropTypes.shape({}),onError:u.PropTypes.func,onSubmit:u.PropTypes.func.isRequired,validateOnChange:u.PropTypes.bool,customValidation:u.PropTypes.func,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t-1&&this.eventsListeners[e].splice(r,1)}}},{key:"callEvent",value:function(e,t){var r=[];if(this.eventsListeners[e]&&Array.isArray(this.eventsListeners[e]))return this.eventsListeners[e].forEach(function(e){var n=e(t);n&&r.push(n)}),r}}]),e}();t.default=a},,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(42);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})})}])}); \ No newline at end of file +var a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(e,t){for(var r,o,u=n(e),l=1;l0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,u=e.error,l=e.value,c=e.label,y=e.placeholder,h=e.errorStyles,m=void 0===h?{}:h,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,u&&m.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(l),placeholder:y,className:r},g)),u&&s.default.createElement(p.default,o({errors:i},m)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,u.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),j={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:u,element:l(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:h};o.prototype=Error.prototype,e.exports=j},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=u,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),u=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?l.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,h=0,m=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subform,o=e.id;return n?l.default.createElement("div",{className:r},t):l.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(l.default.Component);p.childContextTypes={setModel:u.PropTypes.func,getModel:u.PropTypes.func,getSchema:u.PropTypes.func,submitForm:u.PropTypes.func,getErrors:u.PropTypes.func,getPath:u.PropTypes.func,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.propTypes={model:u.PropTypes.shape({}),schema:u.PropTypes.shape({}),onError:u.PropTypes.func,onSubmit:u.PropTypes.func.isRequired,validateOnChange:u.PropTypes.bool,customValidation:u.PropTypes.func,subform:u.PropTypes.bool,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t-1&&this.eventsListeners[e].splice(r,1)}}},{key:"callEvent",value:function(e,t){var r=[];if(this.eventsListeners[e]&&Array.isArray(this.eventsListeners[e]))return this.eventsListeners[e].forEach(function(e){var n=e(t);n&&r.push(n)}),r}}]),e}();t.default=a},,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(42);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})})}])}); \ No newline at end of file diff --git a/src/components/ObjectField.jsx b/src/components/ObjectField.jsx index 8e1a760..aa61d6d 100644 --- a/src/components/ObjectField.jsx +++ b/src/components/ObjectField.jsx @@ -45,12 +45,8 @@ export class ObjectField extends React.Component { getErrors(name) { const { getErrors } = this.context; const errors = getErrors(this.props.name); - if(Array.isArray(errors)){ - const returnedErrors = []; - errors.forEach(error => { - if (error[name]) returnedErrors.push(error[name]); - }); - return returnedErrors; + if(Array.isArray(errors) && errors.length === 1){ + return errors[0][name] || []; } return errors[name] || []; } From d2857103cf70c8b24439d76be756dd7ee19c2119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Przoda=C5=82a?= Date: Tue, 16 May 2017 07:54:22 +0200 Subject: [PATCH 3/4] 2.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c403685..a237b67 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-components-form", - "version": "2.1.0", + "version": "2.1.1", "description": "React form components", "main": "main.js", "jsnext:main": "src/index.js", From f98b0045fc8ae9d343e30ee28aa4a15c92b836be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Przoda=C5=82a?= Date: Tue, 16 May 2017 07:55:53 +0200 Subject: [PATCH 4/4] up version --- Bootstrap.js | 2 +- main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bootstrap.js b/Bootstrap.js index 77acac0..8b0c583 100644 --- a/Bootstrap.js +++ b/Bootstrap.js @@ -8,4 +8,4 @@ object-assign (c) Sindre Sorhus @license MIT */ -var a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(e,t){for(var r,o,l=n(e),u=1;u0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,l=e.error,u=e.value,c=e.label,y=e.placeholder,m=e.errorStyles,h=void 0===m?{}:m,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,l&&h.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(u),placeholder:y,className:r},g)),l&&s.default.createElement(p.default,o({errors:i},h)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,l.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),x={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:l,element:u(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:m};o.prototype=Error.prototype,e.exports=x},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=l,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),l=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?u.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,m=0,h=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subform,o=e.id;return n?u.default.createElement("div",{className:r},t):u.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(u.default.Component);p.childContextTypes={setModel:l.PropTypes.func,getModel:l.PropTypes.func,getSchema:l.PropTypes.func,submitForm:l.PropTypes.func,getErrors:l.PropTypes.func,getPath:l.PropTypes.func,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.propTypes={model:l.PropTypes.shape({}),schema:l.PropTypes.shape({}),onError:l.PropTypes.func,onSubmit:l.PropTypes.func.isRequired,validateOnChange:l.PropTypes.bool,customValidation:l.PropTypes.func,subform:l.PropTypes.bool,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,l=e.error,u=e.value,c=e.label,y=e.placeholder,m=e.errorStyles,h=void 0===m?{}:m,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,l&&h.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(u),placeholder:y,className:r},g)),l&&s.default.createElement(p.default,o({errors:i},h)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,l.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),x={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:l,element:u(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:m};o.prototype=Error.prototype,e.exports=x},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=l,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),l=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?u.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,m=0,h=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subform,o=e.id;return n?u.default.createElement("div",{className:r},t):u.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(u.default.Component);p.childContextTypes={setModel:l.PropTypes.func,getModel:l.PropTypes.func,getSchema:l.PropTypes.func,submitForm:l.PropTypes.func,getErrors:l.PropTypes.func,getPath:l.PropTypes.func,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.propTypes={model:l.PropTypes.shape({}),schema:l.PropTypes.shape({}),onError:l.PropTypes.func,onSubmit:l.PropTypes.func.isRequired,validateOnChange:l.PropTypes.bool,customValidation:l.PropTypes.func,subform:l.PropTypes.bool,eventsListener:l.PropTypes.shape({callEvent:l.PropTypes.func,registerEvent:l.PropTypes.func,registerEventListener:l.PropTypes.func,unregisterEvent:l.PropTypes.func,unregisterEventListener:l.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,u=e.error,l=e.value,c=e.label,y=e.placeholder,h=e.errorStyles,m=void 0===h?{}:h,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,u&&m.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(l),placeholder:y,className:r},g)),u&&s.default.createElement(p.default,o({errors:i},m)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,u.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),j={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:u,element:l(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:h};o.prototype=Error.prototype,e.exports=j},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=u,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),u=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?l.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,h=0,m=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subform,o=e.id;return n?l.default.createElement("div",{className:r},t):l.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(l.default.Component);p.childContextTypes={setModel:u.PropTypes.func,getModel:u.PropTypes.func,getSchema:u.PropTypes.func,submitForm:u.PropTypes.func,getErrors:u.PropTypes.func,getPath:u.PropTypes.func,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.propTypes={model:u.PropTypes.shape({}),schema:u.PropTypes.shape({}),onError:u.PropTypes.func,onSubmit:u.PropTypes.func.isRequired,validateOnChange:u.PropTypes.bool,customValidation:u.PropTypes.func,subform:u.PropTypes.bool,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t-1&&this.eventsListeners[e].splice(r,1)}}},{key:"callEvent",value:function(e,t){var r=[];if(this.eventsListeners[e]&&Array.isArray(this.eventsListeners[e]))return this.eventsListeners[e].forEach(function(e){var n=e(t);n&&r.push(n)}),r}}]),e}();t.default=a},,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(42);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})})}])}); \ No newline at end of file +var a=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(e,t){for(var r,o,u=n(e),l=1;l0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getDate(),r=e.getMonth(),n=e.getFullYear();return r<10&&(0===r&&(r+=1),r="0"+r),n+"-"+r+"-"+t},y=t.DateField=function(e){var t=e.wrapperClassName,r=e.className,n=e.onChange,a=e.name,i=e.errors,u=e.error,l=e.value,c=e.label,y=e.placeholder,h=e.errorStyles,m=void 0===h?{}:h,v=e.fieldAttributes,g=void 0===v?{}:v;return s.default.createElement("div",{className:(0,f.default)(t,u&&m.fieldClassName)},c&&s.default.createElement("label",null,c),s.default.createElement("input",o({type:"date",name:a,onChange:function(e){return n(new Date(e.target.value))},value:d(l),placeholder:y,className:r},g)),u&&s.default.createElement(p.default,o({errors:i},m)))};y.propTypes={wrapperClassName:a.PropTypes.string,className:a.PropTypes.string,name:a.PropTypes.string,onChange:a.PropTypes.func.isRequired,errors:a.PropTypes.oneOfType([a.PropTypes.arrayOf(a.PropTypes.string),a.PropTypes.arrayOf(a.PropTypes.arrayOf(a.PropTypes.string)),a.PropTypes.string,a.PropTypes.shape({})]),error:a.PropTypes.bool,value:a.PropTypes.shape({}),label:a.PropTypes.string,placeholder:a.PropTypes.string,errorStyles:a.PropTypes.shape({className:a.PropTypes.string,itemClassName:a.PropTypes.string}),fieldAttributes:a.PropTypes.shape({})},t.default=(0,u.default)(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;var o=Object.assign||function(e){for(var t=1;t>"),j={array:s("array"),bool:s("boolean"),func:s("function"),number:s("number"),object:s("object"),string:s("string"),symbol:s("symbol"),any:i(),arrayOf:u,element:l(),instanceOf:p,node:y(),objectOf:f,oneOf:c,oneOfType:d,shape:h};o.prototype=Error.prototype,e.exports=j},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=u,this.updater=r||i}function o(){}var a=r(8),s=r(11),i=r(12),u=r(10);o.prototype=s.prototype,n.prototype=new o,n.prototype.constructor=n,a(n.prototype,s.prototype),n.prototype.isPureReactComponent=!0,e.exports=n},function(e,t,r){"use strict";e.exports="15.4.2"},function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||o("143"),e}var o=r(7),a=r(5);r(6);e.exports=n},function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?l.escape(e.key):t.toString(36)}function o(e,t,r,a){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||"object"===f&&e.$$typeof===i)return r(a,e,""===t?p+n(e,0):t),1;var d,y,h=0,m=""===t?p:t+c;if(Array.isArray(e))for(var v=0;v=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t0?void(this.props.onError&&this.props.onError(e,t)):(this.props.onSubmit(t),t)}},{key:"getChildContext",value:function(){return{setModel:this.setModel,getModel:this.getModel,getSchema:this.getSchema,submitForm:this.submitForm,getErrors:this.getErrors,getPath:this.getPath,eventsListener:this.eventsListener}}},{key:"handleFormSubmit",value:function(e){e.preventDefault(),e.stopPropagation(),this.submitForm()}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.className,n=e.subform,o=e.id;return n?l.default.createElement("div",{className:r},t):l.default.createElement("form",{onSubmit:this.handleFormSubmit,id:o,className:r},t)}}]),t}(l.default.Component);p.childContextTypes={setModel:u.PropTypes.func,getModel:u.PropTypes.func,getSchema:u.PropTypes.func,submitForm:u.PropTypes.func,getErrors:u.PropTypes.func,getPath:u.PropTypes.func,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.propTypes={model:u.PropTypes.shape({}),schema:u.PropTypes.shape({}),onError:u.PropTypes.func,onSubmit:u.PropTypes.func.isRequired,validateOnChange:u.PropTypes.bool,customValidation:u.PropTypes.func,subform:u.PropTypes.bool,eventsListener:u.PropTypes.shape({callEvent:u.PropTypes.func,registerEvent:u.PropTypes.func,registerEventListener:u.PropTypes.func,unregisterEvent:u.PropTypes.func,unregisterEventListener:u.PropTypes.func})},p.defaultProps={id:"form"},t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ListField=void 0;var i=Object.assign||function(e){for(var t=1;t-1&&this.eventsListeners[e].splice(r,1)}}},{key:"callEvent",value:function(e,t){var r=[];if(this.eventsListeners[e]&&Array.isArray(this.eventsListeners[e]))return this.eventsListeners[e].forEach(function(e){var n=e(t);n&&r.push(n)}),r}}]),e}();t.default=a},,,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(42);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})})}])}); \ No newline at end of file