react-form-with-constraints
Advanced tools
Comparing version 0.10.0-beta.1 to 0.10.0-beta.2
@@ -1,2 +0,2 @@ | ||
## 0.10.0 (2018/09/13) | ||
## v0.10.0 (2018/09/18) | ||
@@ -6,2 +6,3 @@ ### Features | ||
- `resetFields()` | ||
- `validateFieldsWithoutFeedback()` | ||
@@ -12,7 +13,12 @@ ### Breaking Changes | ||
## 0.9.3 (2018/09/12) | ||
### Fixes | ||
- Ignore HTML elements without `ValidityState` instead of `type` | ||
## v0.9.3 (2018/09/12) | ||
### Features | ||
- Use PropTypes.instanceOf() instead of PropTypes.object | ||
- Use `PropTypes.instanceOf()` instead of `PropTypes.object` | ||
- Improve typings | ||
@@ -22,6 +28,7 @@ | ||
- Ignore HTML elements without type | ||
- Ignore HTML elements without `type` | ||
## 0.9.2 (2018/07/13) | ||
## v0.9.2 (2018/07/13) | ||
### Features | ||
@@ -32,4 +39,5 @@ | ||
## 0.9.1 (2018/07/06) | ||
## v0.9.1 (2018/07/06) | ||
### Features | ||
@@ -48,4 +56,5 @@ | ||
## 0.8.0 (2018/04/26) | ||
## v0.8.0 (2018/04/26) | ||
### Features | ||
@@ -70,4 +79,5 @@ | ||
## 0.7.1 (2017/11/27) | ||
## v0.7.1 (2017/11/27) | ||
### Fixes | ||
@@ -78,6 +88,7 @@ | ||
## 0.7.0 (2017/11/26) | ||
## v0.7.0 (2017/11/26) | ||
### Features | ||
- React Native support |
@@ -462,5 +462,5 @@ (function (global, factory) { | ||
FormWithConstraints.prototype.validateForm = function () { | ||
return this.validateFields_lazy(); | ||
return this.validateFieldsWithoutFeedback(); | ||
}; | ||
FormWithConstraints.prototype.validateFields_lazy = function () { | ||
FormWithConstraints.prototype.validateFieldsWithoutFeedback = function () { | ||
var inputsOrNames = []; | ||
@@ -553,3 +553,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
inputs = __spread(this.form.querySelectorAll('[name]')); | ||
inputs = inputs.filter(function (input) { return input.type; }); | ||
inputs = inputs.filter(function (input) { return input.validity !== undefined; }); | ||
inputs | ||
@@ -569,2 +569,5 @@ .filter(function (input) { return input.type !== 'checkbox' && input.type !== 'radio'; }) | ||
var elements = __spread(_this.form.querySelectorAll(query)); | ||
if (elements.filter(function (el) { return el.validity === undefined; }).length > 0) { | ||
throw new Error("'" + query + "' should match an <input>, <select> or <textarea>"); | ||
} | ||
if (elements.filter(function (el) { return el.type !== 'checkbox' && el.type !== 'radio'; }).length > 1) { | ||
@@ -571,0 +574,0 @@ throw new Error("Multiple elements matching '" + query + "' inside the form"); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e.ReactFormWithConstraints={},e.React,e.PropTypes)}(this,function(s,f,i){"use strict";f=f&&f.hasOwnProperty("default")?f.default:f,i=i&&i.hasOwnProperty("default")?i.default:i;var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var p=function(){return(p=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&(i[n[r]]=e[n[r]])}return i}function l(a,o,s,l){return new(s||(s=Promise))(function(e,t){function i(e){try{r(l.next(e))}catch(e){t(e)}}function n(e){try{r(l.throw(e))}catch(e){t(e)}}function r(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(i,n)}r((l=l.apply(a,o||[])).next())})}function v(i,n){var r,a,o,e,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(o=2&t[0]?a.return:t[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,t[1])).done)return o;switch(a=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,a=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(o=0<(o=s.trys).length&&o[o.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]<o[3])){s.label=t[1];break}if(6===t[0]&&s.label<o[1]){s.label=o[1],o=t;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(t);break}o[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(i,s)}catch(e){t=[6,e],a=0}finally{r=o=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function y(e){var t="function"==typeof Symbol&&e[Symbol.iterator],i=0;return t?t.call(e):{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}function a(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,a=i.call(e),o=[];try{for(;(void 0===t||0<t--)&&!(n=a.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(a(arguments[t]));return e}var e,t,o=function(){function e(){this.listeners=new Map}return e.prototype.emit=function(c){for(var f=[],e=1;e<arguments.length;e++)f[e-1]=arguments[e];return l(this,void 0,void 0,function(){var t,i,n,r,a,o,s,l,d,u;return v(this,function(e){switch(e.label){case 0:if(n=this.listeners.get(c),r=new Array,void 0===n)return[3,8];console.assert(0<n.length,"No listener for event '"+c+"'"),e.label=1;case 1:e.trys.push([1,6,7,8]),a=y(n),o=a.next(),e.label=2;case 2:return o.done?[3,5]:(s=o.value,d=(l=r).push,[4,s.apply(void 0,m(f))]);case 3:d.apply(l,[e.sent()]),e.label=4;case 4:return o=a.next(),[3,2];case 5:return[3,8];case 6:return u=e.sent(),t={error:u},[3,8];case 7:try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}return[7];case 8:return[2,r]}})})},e.prototype.addListener=function(e,t){this.listeners.has(e)||this.listeners.set(e,[]);var i=this.listeners.get(e);console.assert(-1===i.indexOf(t),"Listener already added for event '"+e+"'"),i.push(t)},e.prototype.removeListener=function(e,t){var i=this.listeners.get(e);console.assert(void 0!==i,"Unknown event '"+e+"'");var n=i.lastIndexOf(t);console.assert(-1<n,"Listener not found for event '"+e+"'"),i.splice(n,1),0===i.length&&this.listeners.delete(e)},e}(),d="VALIDATE_FIELD_EVENT",u=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.validateFieldEventEmitter=new o,e}return r(e,t),e.prototype.emitValidateFieldEvent=function(e){return this.validateFieldEventEmitter.emit(d,e)},e.prototype.addValidateFieldEventListener=function(e){this.validateFieldEventEmitter.addListener(d,e)},e.prototype.removeValidateFieldEventListener=function(e){this.validateFieldEventEmitter.removeListener(d,e)},e}(e)},c="FIELD_WILL_VALIDATE_EVENT",F=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fieldWillValidateEventEmitter=new o,e}return r(e,t),e.prototype.emitFieldWillValidateEvent=function(e){return this.fieldWillValidateEventEmitter.emit(c,e)},e.prototype.addFieldWillValidateEventListener=function(e){this.fieldWillValidateEventEmitter.addListener(c,e)},e.prototype.removeFieldWillValidateEventListener=function(e){this.fieldWillValidateEventEmitter.removeListener(c,e)},e}(e)},E="FIELD_DID_VALIDATE_EVENT",b=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fieldDidValidateEventEmitter=new o,e}return r(e,t),e.prototype.emitFieldDidValidateEvent=function(e){return this.fieldDidValidateEventEmitter.emit(E,e)},e.prototype.addFieldDidValidateEventListener=function(e){this.fieldDidValidateEventEmitter.addListener(E,e)},e.prototype.removeFieldDidValidateEventListener=function(e){this.fieldDidValidateEventEmitter.removeListener(E,e)},e}(e)},w="FIELD_DID_RESET_EVENT",g=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fieldDidResetEventEmitter=new o,e}return r(e,t),e.prototype.emitFieldDidResetEvent=function(e){return this.fieldDidResetEventEmitter.emit(w,e)},e.prototype.addFieldDidResetEventListener=function(e){this.fieldDidResetEventEmitter.addListener(w,e)},e.prototype.removeFieldDidResetEventListener=function(e){this.fieldDidResetEventEmitter.removeListener(w,e)},e}(e)},V=function(e){void 0===e.props?(e=e,this.name=e.name,this.type=e.type,this.value=e.value,this.validity=new k(e.validity),this.validationMessage=e.validationMessage):(e=e,this.name=e.props.name,this.type=void 0,this.value=e.props.value,this.validity=void 0,this.validationMessage=void 0)},k=function(e){this.badInput=e.badInput,this.customError=e.customError,this.patternMismatch=e.patternMismatch,this.rangeOverflow=e.rangeOverflow,this.rangeUnderflow=e.rangeUnderflow,this.stepMismatch=e.stepMismatch,this.tooLong=e.tooLong,this.tooShort=e.tooShort,this.typeMismatch=e.typeMismatch,this.valid=e.valid,this.valueMissing=e.valueMissing};(t=e||(e={})).Error="error",t.Warning="warning",t.Info="info",t.WhenValid="whenValid";var D,x=e,L=function(){function e(e){this.name=e,this.validations=[]}return e.prototype.addOrReplaceValidation=function(t){var e=this.validations.findIndex(function(e){return e.key===t.key});-1<e?this.validations[e]=t:this.validations.push(t)},e.prototype.clearValidations=function(){!function(e){for(;e.length;)e.pop()}(this.validations)},e.prototype.hasFeedbacksOfType=function(t,i){return this.validations.some(function(e){return(void 0===i||e.key.startsWith(i+"."))&&e.type===t&&!0===e.show})},e.prototype.hasErrors=function(e){return this.hasFeedbacksOfType(x.Error,e)},e.prototype.hasWarnings=function(e){return this.hasFeedbacksOfType(x.Warning,e)},e.prototype.hasInfos=function(e){return this.hasFeedbacksOfType(x.Info,e)},e.prototype.hasFeedbacks=function(e){return this.hasErrors(e)||this.hasWarnings(e)||this.hasInfos(e)},e.prototype.isValid=function(){return!this.hasErrors()},e}();(D=s.FieldEvent||(s.FieldEvent={})).Added="FIELD_ADDED",D.Removed="FIELD_REMOVED";var S,R=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fields=new Array,e}return r(e,t),e.prototype.getField=function(t){var e=this.fields.filter(function(e){return e.name===t});return 1===e.length?e[0]:void 0},e.prototype.addField=function(t){var e=this.fields.filter(function(e){return e.name===t});if(console.assert(0===e.length||1===e.length,"Cannot have more than 1 field matching '"+t+"'"),0===e.length){var i=new L(t);this.fields.push(i),this.emit(s.FieldEvent.Added,i)}},e.prototype.removeField=function(t){var e=this.fields.filter(function(e){return e.name===t}),i=this.fields.indexOf(e[0]);-1<i&&(this.fields.splice(i,1),this.emit(s.FieldEvent.Removed,t))},e.prototype.isValid=function(){return this.fields.every(function(e){return e.isValid()})},e.prototype.hasFeedbacks=function(){return this.fields.some(function(e){return e.hasFeedbacks()})},e}(o),W=function(e){return e.reduce(function(e,t){return e.concat(Array.isArray(t)?W(t):t)},[])},O=function(e){return void 0!==e},I=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.form=null,e.fieldsStore=new R,e.fieldFeedbacksKeyCounter=0,e}return r(e,t),e.prototype.getChildContext=function(){return{form:this}},e.prototype.computeFieldFeedbacksKey=function(){return""+this.fieldFeedbacksKeyCounter++},e.prototype.validateFields=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._validateFields.apply(this,m([!0],e))},e.prototype.validateForm=function(){return this.validateFields_lazy()},e.prototype.validateFields_lazy=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._validateFields.apply(this,m([!1],e))},e.prototype._validateFields=function(u){for(var c=[],e=1;e<arguments.length;e++)c[e-1]=arguments[e];return l(this,void 0,void 0,function(){var t,i,n,r,a,o,s,l,d;return v(this,function(e){switch(e.label){case 0:n=new Array,r=this.normalizeInputs.apply(this,m(c)),e.label=1;case 1:e.trys.push([1,6,7,8]),a=y(r),o=a.next(),e.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,this.validateField(u,new V(s))]);case 3:void 0!==(l=e.sent())&&n.push(l),e.label=4;case 4:return o=a.next(),[3,2];case 5:return[3,8];case 6:return d=e.sent(),t={error:d},[3,8];case 7:try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}return[7];case 8:return[2,n]}})})},e.prototype.validateField=function(r,a){return l(this,void 0,void 0,function(){var t,i,n;return v(this,function(e){switch(e.label){case 0:return t=a.name,void 0!==(i=this.fieldsStore.getField(t))?[3,1]:[3,3];case 1:return!r&&i.hasFeedbacks()?[3,3]:(i.clearValidations(),this.emitFieldWillValidateEvent(t),[4,this.emitValidateFieldEvent(a)]);case 2:n=e.sent(),console.assert(JSON.stringify(W(n).filter(O))===JSON.stringify(i.validations),"FieldsStore does not match emitValidateFieldEvent() result, did the user changed the input rapidly?"),this.emitFieldDidValidateEvent(i),e.label=3;case 3:return[2,i]}})})},e.prototype.normalizeInputs=function(){for(var e,r=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 0===t.length?(e=(e=m(this.form.querySelectorAll("[name]"))).filter(function(e){return e.type})).filter(function(e){return"checkbox"!==e.type&&"radio"!==e.type}).map(function(e){return e.name}).forEach(function(e,t,i){if(i.indexOf(e)!==t)throw new Error("Multiple elements matching '[name=\""+e+"\"]' inside the form")}):e=t.map(function(e){if("string"!=typeof e)return e;var t='[name="'+e+'"]',i=m(r.form.querySelectorAll(t));if(1<i.filter(function(e){return"checkbox"!==e.type&&"radio"!==e.type}).length)throw new Error("Multiple elements matching '"+t+"' inside the form");var n=i[0];if(void 0===n)throw new Error("Could not find field '"+t+"' inside the form");return n}),e},e.prototype.isValid=function(){return this.fieldsStore.isValid()},e.prototype.hasFeedbacks=function(){return this.fieldsStore.hasFeedbacks()},e.prototype.resetFields=function(){for(var u=[],e=0;e<arguments.length;e++)u[e]=arguments[e];return l(this,void 0,void 0,function(){var t,i,n,r,a,o,s,l,d;return v(this,function(e){switch(e.label){case 0:n=new Array,r=this.normalizeInputs.apply(this,m(u)),e.label=1;case 1:e.trys.push([1,6,7,8]),a=y(r),o=a.next(),e.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,this.resetField(new V(s))]);case 3:void 0!==(l=e.sent())&&n.push(l),e.label=4;case 4:return o=a.next(),[3,2];case 5:return[3,8];case 6:return d=e.sent(),t={error:d},[3,8];case 7:try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}return[7];case 8:return[2,n]}})})},e.prototype.resetField=function(n){return l(this,void 0,void 0,function(){var t,i;return v(this,function(e){switch(e.label){case 0:return t=n.name,void 0!==(i=this.fieldsStore.getField(t))?[3,1]:[3,3];case 1:return i.clearValidations(),[4,this.emitFieldDidResetEvent(i)];case 2:e.sent(),e.label=3;case 3:return[2,i]}})})},e.prototype.render=function(){var t=this;return f.createElement("form",p({ref:function(e){return t.form=e}},this.props))},e.childContextTypes={form:i.instanceOf(e).isRequired},e}(g(F(b(u(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(f.Component)))))),M=function(a){function e(e,t){var i=a.call(this,e,t)||this;i.fieldFeedbackKeyCounter=0,i.validate=function(o){return l(i,void 0,void 0,function(){var t,i,n,r,a;return v(this,function(e){switch(e.label){case 0:return t=this.context,i=t.form,n=t.fieldFeedbacks,o.name!==this.fieldName?[3,3]:(a=i.fieldsStore.getField(this.fieldName),n&&("first"===n.props.stop&&a.hasFeedbacks(n.key)||"first-error"===n.props.stop&&a.hasErrors(n.key)||"first-warning"===n.props.stop&&a.hasWarnings(n.key)||"first-info"===n.props.stop&&a.hasInfos(n.key))?[3,3]:[3,1]);case 1:return[4,this._validate(o)];case 2:r=e.sent(),e.label=3;case 3:return[2,r]}})})};var n=t.form,r=t.fieldFeedbacks;if(i.key=r?r.computeFieldFeedbackKey():n.computeFieldFeedbacksKey(),r){if(i.fieldName=r.fieldName,void 0!==e.for)throw new Error("FieldFeedbacks cannot have a parent and a 'for' prop")}else{if(void 0===e.for)throw new Error("FieldFeedbacks cannot be without parent and without 'for' prop");i.fieldName=e.for}return i}return r(e,a),e.prototype.getChildContext=function(){return{fieldFeedbacks:this}},e.prototype.computeFieldFeedbackKey=function(){return this.key+"."+this.fieldFeedbackKeyCounter++},e.prototype.addFieldFeedback=function(){return this.computeFieldFeedbackKey()},e.prototype.componentWillMount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks;t.fieldsStore.addField(this.fieldName),(i||t).addValidateFieldEventListener(this.validate)},e.prototype.componentWillUnmount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks;t.fieldsStore.removeField(this.fieldName),(i||t).removeValidateFieldEventListener(this.validate)},e.prototype._validate=function(i){return l(this,void 0,void 0,function(){var t;return v(this,function(e){switch(e.label){case 0:return[4,this.emitValidateFieldEvent(i)];case 1:return t=e.sent(),[2,W(t)]}})})},e.prototype.render=function(){var e=this.props.children;return void 0!==e?e:null},e.defaultProps={stop:"first-error"},e.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(e)},e.childContextTypes={fieldFeedbacks:i.instanceOf(e).isRequired},e}(u(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(f.Component)));(S=s.Status||(s.Status={}))[S.None=0]="None",S[S.Pending=1]="Pending",S[S.Rejected=2]="Rejected",S[S.Resolved=3]="Resolved";var _=function(e){function t(){var o=null!==e&&e.apply(this,arguments)||this;return o.state={status:s.Status.None},o.validate=function(e){var t,i=o.context,n=i.form,r=i.fieldFeedbacks,a=n.fieldsStore.getField(e.name);return"first"===r.props.stop&&a.hasFeedbacks(r.key)||"first-error"===r.props.stop&&a.hasErrors(r.key)||"first-warning"===r.props.stop&&a.hasWarnings(r.key)||"first-info"===r.props.stop&&a.hasInfos(r.key)?o.setState({status:s.Status.None}):t=o._validate(e),t},o}return r(t,e),t.prototype.getChildContext=function(){return{async:this}},t.prototype.componentWillMount=function(){this.context.fieldFeedbacks.addValidateFieldEventListener(this.validate)},t.prototype.componentWillUnmount=function(){this.context.fieldFeedbacks.removeValidateFieldEventListener(this.validate)},t.prototype._validate=function(n){return l(this,void 0,void 0,function(){var t,i;return v(this,function(e){switch(e.label){case 0:this.setState({status:s.Status.Pending}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.props.promise(n.value)];case 2:return t=e.sent(),this.setState({status:s.Status.Resolved,value:t}),[3,4];case 3:return i=e.sent(),this.setState({status:s.Status.Rejected,value:i}),[3,4];case 4:return[2,this.emitValidateFieldEvent(n)]}})})},t.prototype.render=function(){var e=this.props,t=this.state,i=null;switch(t.status){case s.Status.None:break;case s.Status.Pending:e.pending&&(i=e.pending);break;case s.Status.Resolved:e.then&&(i=e.then(t.value));break;case s.Status.Rejected:e.catch&&(i=e.catch(t.value))}return i},t.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(M).isRequired},t.childContextTypes={async:i.instanceOf(t).isRequired},t}(u(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(f.Component))),N=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={fieldIsValid:void 0},t.fieldWillValidate=function(e){e===t.context.fieldFeedbacks.fieldName&&t.setState({fieldIsValid:void 0})},t.fieldDidValidate=function(e){e.name===t.context.fieldFeedbacks.fieldName&&t.setState({fieldIsValid:e.isValid()})},t.fieldDidReset=function(e){e.name===t.context.fieldFeedbacks.fieldName&&t.setState({fieldIsValid:void 0})},t}return r(t,e),t.prototype.componentWillMount=function(){var e=this.context.form;e.addFieldWillValidateEventListener(this.fieldWillValidate),e.addFieldDidValidateEventListener(this.fieldDidValidate),e.addFieldDidResetEventListener(this.fieldDidReset)},t.prototype.componentWillUnmount=function(){var e=this.context.form;e.removeFieldWillValidateEventListener(this.fieldWillValidate),e.removeFieldDidValidateEventListener(this.fieldDidValidate),e.removeFieldDidResetEventListener(this.fieldDidReset)},t.prototype.render=function(){var e=this.props,t=e.style,i=h(e,["style"]);return this.state.fieldIsValid?f.createElement("span",p({},i,{style:p({display:"block"},t)})):null},t.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(M).isRequired},t}(f.Component),C=function(s){function e(e,t){var l=s.call(this,e,t)||this;l.validate=function(e){var t=l.props.when,i=l.context,n=i.form,r=i.fieldFeedbacks,a=n.fieldsStore.getField(e.name),o=p({},l.state.validation);if("first"===r.props.stop&&a.hasFeedbacks(r.key)||"first-error"===r.props.stop&&a.hasErrors(r.key)||"first-warning"===r.props.stop&&a.hasWarnings(r.key)||"first-info"===r.props.stop&&a.hasInfos(r.key))o.show=void 0;else if(o.show=!1,"function"==typeof t)o.show=t(e.value);else{if("string"!=typeof t)throw new TypeError("Invalid FieldFeedback 'when' type: "+typeof t);if("valid"===t)o.show=void 0;else{var s=e.validity;s.valid||("*"===t?o.show=!0:(s.badInput&&"badInput"===t||s.patternMismatch&&"patternMismatch"===t||s.rangeOverflow&&"rangeOverflow"===t||s.rangeUnderflow&&"rangeUnderflow"===t||s.stepMismatch&&"stepMismatch"===t||s.tooLong&&"tooLong"===t||s.tooShort&&"tooShort"===t||s.typeMismatch&&"typeMismatch"===t||s.valueMissing&&"valueMissing"===t)&&(o.show=!0))}}return a.addOrReplaceValidation(o),l.setState({validation:o,validationMessage:e.validationMessage}),o},l.fieldDidReset=function(e){e.name===l.context.fieldFeedbacks.fieldName&&l.setState(function(e){return{validation:p({},e.validation,{show:void 0}),validationMessage:""}})},l.key=t.fieldFeedbacks.addFieldFeedback();var i=e.error,n=e.warning,r=e.info,a=e.when,o=x.Error;if("valid"===a?o=x.WhenValid:n?o=x.Warning:r&&(o=x.Info),o===x.WhenValid&&(i||n||r))throw new Error('Cannot have an attribute (error, warning...) with FieldFeedback when="valid"');return l.state={validation:{key:l.key,type:o,show:void 0},validationMessage:""},l}return r(e,s),e.prototype.componentWillMount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks,n=e.async;n?n.addValidateFieldEventListener(this.validate):i.addValidateFieldEventListener(this.validate),t.addFieldDidResetEventListener(this.fieldDidReset)},e.prototype.componentWillUnmount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks,n=e.async;n?n.removeValidateFieldEventListener(this.validate):i.removeValidateFieldEventListener(this.validate),t.removeFieldDidResetEventListener(this.fieldDidReset)},e.prototype.render=function(){var e=this.props,t=(e.when,e.error,e.warning,e.info,e.className),i=e.classes,n=e.style,r=e.children,a=h(e,["when","error","warning","info","className","classes","style","children"]),o=this.state,s=o.validation,l=o.validationMessage,d=i[s.type],u=void 0!==t?t+" "+d:d;if(s.type===x.WhenValid)return f.createElement(N,p({"data-feedback":this.key,style:n,className:u},a),r);if(s.show){var c=void 0!==r?r:l;return f.createElement("span",p({"data-feedback":this.key,className:u,style:p({display:"block"},n)},a),c)}return null},e.defaultProps={when:function(){return!0},classes:{error:"error",warning:"warning",info:"info",whenValid:"when-valid"}},e.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(M).isRequired,async:i.instanceOf(_)},e}(f.Component),T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={field:void 0},t.fieldWillValidate=function(e){e===t.props.name&&t.setState({field:void 0})},t.fieldDidValidate=function(e){e.name===t.props.name&&t.setState({field:e})},t.fieldDidReset=function(e){e.name===t.props.name&&t.setState({field:void 0})},t}return r(t,e),t.prototype.componentWillMount=function(){this.context.form.addFieldWillValidateEventListener(this.fieldWillValidate),this.context.form.addFieldDidValidateEventListener(this.fieldDidValidate),this.context.form.addFieldDidResetEventListener(this.fieldDidReset)},t.prototype.componentWillUnmount=function(){this.context.form.removeFieldWillValidateEventListener(this.fieldWillValidate),this.context.form.removeFieldDidValidateEventListener(this.fieldDidValidate),this.context.form.removeFieldDidResetEventListener(this.fieldDidReset)},t.prototype.fieldValidationStates=function(){var e=this.state.field,t=[];return void 0!==e&&(e.hasErrors()&&t.push("hasErrors"),e.hasWarnings()&&t.push("hasWarnings"),e.hasInfos()&&t.push("hasInfos"),e.isValid()&&t.push("isValid")),t},t.prototype.render=function(){var e=this.props,t=e.innerRef,i=e.className,n=e.classes,r=h(e,["innerRef","className","classes"]),a=this.fieldValidationStates(),o=i;return a.forEach(function(e){var t=n[e];void 0!==t&&(void 0!==o?o+=" "+t:o=t)}),f.createElement("input",p({ref:t},r,{className:o}))},t.contextTypes={form:i.instanceOf(I).isRequired},t.defaultProps={classes:{hasErrors:"has-errors",hasWarnings:"has-warnings",hasInfos:"has-infos",isValid:"is-valid"}},t}(f.Component),A=function(e,i){f.Children.forEach(e,function(e){var t=e;t.props&&t.props.children&&"object"==typeof t.props.children&&A(t.props.children,i),i(t)})};s.FieldFeedbackType=x,s.Field=L,s.EventEmitter=o,s.deepForEach=A,s.FormWithConstraints=I,s.FieldFeedbacks=M,s.FieldFeedback=C,s.FieldFeedbackWhenValid=N,s.Async=_,s.FieldsStore=R,s.ValidateFieldEvent=d,s.withValidateFieldEventEmitter=u,s.FieldWillValidateEvent=c,s.withFieldWillValidateEventEmitter=F,s.FieldDidValidateEvent=E,s.withFieldDidValidateEventEmitter=b,s.FieldDidResetEvent=w,s.withFieldDidResetEventEmitter=g,s.InputElement=V,s.IValidityState=k,s.Input=T,Object.defineProperty(s,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","react","prop-types"],t):t(e.ReactFormWithConstraints={},e.React,e.PropTypes)}(this,function(s,f,i){"use strict";f=f&&f.hasOwnProperty("default")?f.default:f,i=i&&i.hasOwnProperty("default")?i.default:i;var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var p=function(){return(p=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&(i[n[r]]=e[n[r]])}return i}function l(a,o,s,l){return new(s||(s=Promise))(function(e,t){function i(e){try{r(l.next(e))}catch(e){t(e)}}function n(e){try{r(l.throw(e))}catch(e){t(e)}}function r(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(i,n)}r((l=l.apply(a,o||[])).next())})}function v(i,n){var r,a,o,e,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,a&&(o=2&t[0]?a.return:t[0]?a.throw||((o=a.return)&&o.call(a),0):a.next)&&!(o=o.call(a,t[1])).done)return o;switch(a=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,a=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(o=0<(o=s.trys).length&&o[o.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]<o[3])){s.label=t[1];break}if(6===t[0]&&s.label<o[1]){s.label=o[1],o=t;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(t);break}o[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(i,s)}catch(e){t=[6,e],a=0}finally{r=o=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function y(e){var t="function"==typeof Symbol&&e[Symbol.iterator],i=0;return t?t.call(e):{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}}}function a(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,a=i.call(e),o=[];try{for(;(void 0===t||0<t--)&&!(n=a.next()).done;)o.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(a(arguments[t]));return e}var e,t,o=function(){function e(){this.listeners=new Map}return e.prototype.emit=function(c){for(var f=[],e=1;e<arguments.length;e++)f[e-1]=arguments[e];return l(this,void 0,void 0,function(){var t,i,n,r,a,o,s,l,d,u;return v(this,function(e){switch(e.label){case 0:if(n=this.listeners.get(c),r=new Array,void 0===n)return[3,8];console.assert(0<n.length,"No listener for event '"+c+"'"),e.label=1;case 1:e.trys.push([1,6,7,8]),a=y(n),o=a.next(),e.label=2;case 2:return o.done?[3,5]:(s=o.value,d=(l=r).push,[4,s.apply(void 0,m(f))]);case 3:d.apply(l,[e.sent()]),e.label=4;case 4:return o=a.next(),[3,2];case 5:return[3,8];case 6:return u=e.sent(),t={error:u},[3,8];case 7:try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}return[7];case 8:return[2,r]}})})},e.prototype.addListener=function(e,t){this.listeners.has(e)||this.listeners.set(e,[]);var i=this.listeners.get(e);console.assert(-1===i.indexOf(t),"Listener already added for event '"+e+"'"),i.push(t)},e.prototype.removeListener=function(e,t){var i=this.listeners.get(e);console.assert(void 0!==i,"Unknown event '"+e+"'");var n=i.lastIndexOf(t);console.assert(-1<n,"Listener not found for event '"+e+"'"),i.splice(n,1),0===i.length&&this.listeners.delete(e)},e}(),d="VALIDATE_FIELD_EVENT",u=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.validateFieldEventEmitter=new o,e}return r(e,t),e.prototype.emitValidateFieldEvent=function(e){return this.validateFieldEventEmitter.emit(d,e)},e.prototype.addValidateFieldEventListener=function(e){this.validateFieldEventEmitter.addListener(d,e)},e.prototype.removeValidateFieldEventListener=function(e){this.validateFieldEventEmitter.removeListener(d,e)},e}(e)},c="FIELD_WILL_VALIDATE_EVENT",F=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fieldWillValidateEventEmitter=new o,e}return r(e,t),e.prototype.emitFieldWillValidateEvent=function(e){return this.fieldWillValidateEventEmitter.emit(c,e)},e.prototype.addFieldWillValidateEventListener=function(e){this.fieldWillValidateEventEmitter.addListener(c,e)},e.prototype.removeFieldWillValidateEventListener=function(e){this.fieldWillValidateEventEmitter.removeListener(c,e)},e}(e)},E="FIELD_DID_VALIDATE_EVENT",b=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fieldDidValidateEventEmitter=new o,e}return r(e,t),e.prototype.emitFieldDidValidateEvent=function(e){return this.fieldDidValidateEventEmitter.emit(E,e)},e.prototype.addFieldDidValidateEventListener=function(e){this.fieldDidValidateEventEmitter.addListener(E,e)},e.prototype.removeFieldDidValidateEventListener=function(e){this.fieldDidValidateEventEmitter.removeListener(E,e)},e}(e)},w="FIELD_DID_RESET_EVENT",g=function(e){return function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fieldDidResetEventEmitter=new o,e}return r(e,t),e.prototype.emitFieldDidResetEvent=function(e){return this.fieldDidResetEventEmitter.emit(w,e)},e.prototype.addFieldDidResetEventListener=function(e){this.fieldDidResetEventEmitter.addListener(w,e)},e.prototype.removeFieldDidResetEventListener=function(e){this.fieldDidResetEventEmitter.removeListener(w,e)},e}(e)},V=function(e){void 0===e.props?(e=e,this.name=e.name,this.type=e.type,this.value=e.value,this.validity=new k(e.validity),this.validationMessage=e.validationMessage):(e=e,this.name=e.props.name,this.type=void 0,this.value=e.props.value,this.validity=void 0,this.validationMessage=void 0)},k=function(e){this.badInput=e.badInput,this.customError=e.customError,this.patternMismatch=e.patternMismatch,this.rangeOverflow=e.rangeOverflow,this.rangeUnderflow=e.rangeUnderflow,this.stepMismatch=e.stepMismatch,this.tooLong=e.tooLong,this.tooShort=e.tooShort,this.typeMismatch=e.typeMismatch,this.valid=e.valid,this.valueMissing=e.valueMissing};(t=e||(e={})).Error="error",t.Warning="warning",t.Info="info",t.WhenValid="whenValid";var D,x=e,L=function(){function e(e){this.name=e,this.validations=[]}return e.prototype.addOrReplaceValidation=function(t){var e=this.validations.findIndex(function(e){return e.key===t.key});-1<e?this.validations[e]=t:this.validations.push(t)},e.prototype.clearValidations=function(){!function(e){for(;e.length;)e.pop()}(this.validations)},e.prototype.hasFeedbacksOfType=function(t,i){return this.validations.some(function(e){return(void 0===i||e.key.startsWith(i+"."))&&e.type===t&&!0===e.show})},e.prototype.hasErrors=function(e){return this.hasFeedbacksOfType(x.Error,e)},e.prototype.hasWarnings=function(e){return this.hasFeedbacksOfType(x.Warning,e)},e.prototype.hasInfos=function(e){return this.hasFeedbacksOfType(x.Info,e)},e.prototype.hasFeedbacks=function(e){return this.hasErrors(e)||this.hasWarnings(e)||this.hasInfos(e)},e.prototype.isValid=function(){return!this.hasErrors()},e}();(D=s.FieldEvent||(s.FieldEvent={})).Added="FIELD_ADDED",D.Removed="FIELD_REMOVED";var S,R=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.fields=new Array,e}return r(e,t),e.prototype.getField=function(t){var e=this.fields.filter(function(e){return e.name===t});return 1===e.length?e[0]:void 0},e.prototype.addField=function(t){var e=this.fields.filter(function(e){return e.name===t});if(console.assert(0===e.length||1===e.length,"Cannot have more than 1 field matching '"+t+"'"),0===e.length){var i=new L(t);this.fields.push(i),this.emit(s.FieldEvent.Added,i)}},e.prototype.removeField=function(t){var e=this.fields.filter(function(e){return e.name===t}),i=this.fields.indexOf(e[0]);-1<i&&(this.fields.splice(i,1),this.emit(s.FieldEvent.Removed,t))},e.prototype.isValid=function(){return this.fields.every(function(e){return e.isValid()})},e.prototype.hasFeedbacks=function(){return this.fields.some(function(e){return e.hasFeedbacks()})},e}(o),W=function(e){return e.reduce(function(e,t){return e.concat(Array.isArray(t)?W(t):t)},[])},O=function(e){return void 0!==e},I=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.form=null,e.fieldsStore=new R,e.fieldFeedbacksKeyCounter=0,e}return r(e,t),e.prototype.getChildContext=function(){return{form:this}},e.prototype.computeFieldFeedbacksKey=function(){return""+this.fieldFeedbacksKeyCounter++},e.prototype.validateFields=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._validateFields.apply(this,m([!0],e))},e.prototype.validateForm=function(){return this.validateFieldsWithoutFeedback()},e.prototype.validateFieldsWithoutFeedback=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._validateFields.apply(this,m([!1],e))},e.prototype._validateFields=function(u){for(var c=[],e=1;e<arguments.length;e++)c[e-1]=arguments[e];return l(this,void 0,void 0,function(){var t,i,n,r,a,o,s,l,d;return v(this,function(e){switch(e.label){case 0:n=new Array,r=this.normalizeInputs.apply(this,m(c)),e.label=1;case 1:e.trys.push([1,6,7,8]),a=y(r),o=a.next(),e.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,this.validateField(u,new V(s))]);case 3:void 0!==(l=e.sent())&&n.push(l),e.label=4;case 4:return o=a.next(),[3,2];case 5:return[3,8];case 6:return d=e.sent(),t={error:d},[3,8];case 7:try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}return[7];case 8:return[2,n]}})})},e.prototype.validateField=function(r,a){return l(this,void 0,void 0,function(){var t,i,n;return v(this,function(e){switch(e.label){case 0:return t=a.name,void 0!==(i=this.fieldsStore.getField(t))?[3,1]:[3,3];case 1:return!r&&i.hasFeedbacks()?[3,3]:(i.clearValidations(),this.emitFieldWillValidateEvent(t),[4,this.emitValidateFieldEvent(a)]);case 2:n=e.sent(),console.assert(JSON.stringify(W(n).filter(O))===JSON.stringify(i.validations),"FieldsStore does not match emitValidateFieldEvent() result, did the user changed the input rapidly?"),this.emitFieldDidValidateEvent(i),e.label=3;case 3:return[2,i]}})})},e.prototype.normalizeInputs=function(){for(var e,r=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 0===t.length?(e=(e=m(this.form.querySelectorAll("[name]"))).filter(function(e){return void 0!==e.validity})).filter(function(e){return"checkbox"!==e.type&&"radio"!==e.type}).map(function(e){return e.name}).forEach(function(e,t,i){if(i.indexOf(e)!==t)throw new Error("Multiple elements matching '[name=\""+e+"\"]' inside the form")}):e=t.map(function(e){if("string"!=typeof e)return e;var t='[name="'+e+'"]',i=m(r.form.querySelectorAll(t));if(0<i.filter(function(e){return void 0===e.validity}).length)throw new Error("'"+t+"' should match an <input>, <select> or <textarea>");if(1<i.filter(function(e){return"checkbox"!==e.type&&"radio"!==e.type}).length)throw new Error("Multiple elements matching '"+t+"' inside the form");var n=i[0];if(void 0===n)throw new Error("Could not find field '"+t+"' inside the form");return n}),e},e.prototype.isValid=function(){return this.fieldsStore.isValid()},e.prototype.hasFeedbacks=function(){return this.fieldsStore.hasFeedbacks()},e.prototype.resetFields=function(){for(var u=[],e=0;e<arguments.length;e++)u[e]=arguments[e];return l(this,void 0,void 0,function(){var t,i,n,r,a,o,s,l,d;return v(this,function(e){switch(e.label){case 0:n=new Array,r=this.normalizeInputs.apply(this,m(u)),e.label=1;case 1:e.trys.push([1,6,7,8]),a=y(r),o=a.next(),e.label=2;case 2:return o.done?[3,5]:(s=o.value,[4,this.resetField(new V(s))]);case 3:void 0!==(l=e.sent())&&n.push(l),e.label=4;case 4:return o=a.next(),[3,2];case 5:return[3,8];case 6:return d=e.sent(),t={error:d},[3,8];case 7:try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}return[7];case 8:return[2,n]}})})},e.prototype.resetField=function(n){return l(this,void 0,void 0,function(){var t,i;return v(this,function(e){switch(e.label){case 0:return t=n.name,void 0!==(i=this.fieldsStore.getField(t))?[3,1]:[3,3];case 1:return i.clearValidations(),[4,this.emitFieldDidResetEvent(i)];case 2:e.sent(),e.label=3;case 3:return[2,i]}})})},e.prototype.render=function(){var t=this;return f.createElement("form",p({ref:function(e){return t.form=e}},this.props))},e.childContextTypes={form:i.instanceOf(e).isRequired},e}(g(F(b(u(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(f.Component)))))),M=function(a){function e(e,t){var i=a.call(this,e,t)||this;i.fieldFeedbackKeyCounter=0,i.validate=function(o){return l(i,void 0,void 0,function(){var t,i,n,r,a;return v(this,function(e){switch(e.label){case 0:return t=this.context,i=t.form,n=t.fieldFeedbacks,o.name!==this.fieldName?[3,3]:(a=i.fieldsStore.getField(this.fieldName),n&&("first"===n.props.stop&&a.hasFeedbacks(n.key)||"first-error"===n.props.stop&&a.hasErrors(n.key)||"first-warning"===n.props.stop&&a.hasWarnings(n.key)||"first-info"===n.props.stop&&a.hasInfos(n.key))?[3,3]:[3,1]);case 1:return[4,this._validate(o)];case 2:r=e.sent(),e.label=3;case 3:return[2,r]}})})};var n=t.form,r=t.fieldFeedbacks;if(i.key=r?r.computeFieldFeedbackKey():n.computeFieldFeedbacksKey(),r){if(i.fieldName=r.fieldName,void 0!==e.for)throw new Error("FieldFeedbacks cannot have a parent and a 'for' prop")}else{if(void 0===e.for)throw new Error("FieldFeedbacks cannot be without parent and without 'for' prop");i.fieldName=e.for}return i}return r(e,a),e.prototype.getChildContext=function(){return{fieldFeedbacks:this}},e.prototype.computeFieldFeedbackKey=function(){return this.key+"."+this.fieldFeedbackKeyCounter++},e.prototype.addFieldFeedback=function(){return this.computeFieldFeedbackKey()},e.prototype.componentWillMount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks;t.fieldsStore.addField(this.fieldName),(i||t).addValidateFieldEventListener(this.validate)},e.prototype.componentWillUnmount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks;t.fieldsStore.removeField(this.fieldName),(i||t).removeValidateFieldEventListener(this.validate)},e.prototype._validate=function(i){return l(this,void 0,void 0,function(){var t;return v(this,function(e){switch(e.label){case 0:return[4,this.emitValidateFieldEvent(i)];case 1:return t=e.sent(),[2,W(t)]}})})},e.prototype.render=function(){var e=this.props.children;return void 0!==e?e:null},e.defaultProps={stop:"first-error"},e.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(e)},e.childContextTypes={fieldFeedbacks:i.instanceOf(e).isRequired},e}(u(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(f.Component)));(S=s.Status||(s.Status={}))[S.None=0]="None",S[S.Pending=1]="Pending",S[S.Rejected=2]="Rejected",S[S.Resolved=3]="Resolved";var N=function(e){function t(){var o=null!==e&&e.apply(this,arguments)||this;return o.state={status:s.Status.None},o.validate=function(e){var t,i=o.context,n=i.form,r=i.fieldFeedbacks,a=n.fieldsStore.getField(e.name);return"first"===r.props.stop&&a.hasFeedbacks(r.key)||"first-error"===r.props.stop&&a.hasErrors(r.key)||"first-warning"===r.props.stop&&a.hasWarnings(r.key)||"first-info"===r.props.stop&&a.hasInfos(r.key)?o.setState({status:s.Status.None}):t=o._validate(e),t},o}return r(t,e),t.prototype.getChildContext=function(){return{async:this}},t.prototype.componentWillMount=function(){this.context.fieldFeedbacks.addValidateFieldEventListener(this.validate)},t.prototype.componentWillUnmount=function(){this.context.fieldFeedbacks.removeValidateFieldEventListener(this.validate)},t.prototype._validate=function(n){return l(this,void 0,void 0,function(){var t,i;return v(this,function(e){switch(e.label){case 0:this.setState({status:s.Status.Pending}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.props.promise(n.value)];case 2:return t=e.sent(),this.setState({status:s.Status.Resolved,value:t}),[3,4];case 3:return i=e.sent(),this.setState({status:s.Status.Rejected,value:i}),[3,4];case 4:return[2,this.emitValidateFieldEvent(n)]}})})},t.prototype.render=function(){var e=this.props,t=this.state,i=null;switch(t.status){case s.Status.None:break;case s.Status.Pending:e.pending&&(i=e.pending);break;case s.Status.Resolved:e.then&&(i=e.then(t.value));break;case s.Status.Rejected:e.catch&&(i=e.catch(t.value))}return i},t.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(M).isRequired},t.childContextTypes={async:i.instanceOf(t).isRequired},t}(u(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(f.Component))),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={fieldIsValid:void 0},t.fieldWillValidate=function(e){e===t.context.fieldFeedbacks.fieldName&&t.setState({fieldIsValid:void 0})},t.fieldDidValidate=function(e){e.name===t.context.fieldFeedbacks.fieldName&&t.setState({fieldIsValid:e.isValid()})},t.fieldDidReset=function(e){e.name===t.context.fieldFeedbacks.fieldName&&t.setState({fieldIsValid:void 0})},t}return r(t,e),t.prototype.componentWillMount=function(){var e=this.context.form;e.addFieldWillValidateEventListener(this.fieldWillValidate),e.addFieldDidValidateEventListener(this.fieldDidValidate),e.addFieldDidResetEventListener(this.fieldDidReset)},t.prototype.componentWillUnmount=function(){var e=this.context.form;e.removeFieldWillValidateEventListener(this.fieldWillValidate),e.removeFieldDidValidateEventListener(this.fieldDidValidate),e.removeFieldDidResetEventListener(this.fieldDidReset)},t.prototype.render=function(){var e=this.props,t=e.style,i=h(e,["style"]);return this.state.fieldIsValid?f.createElement("span",p({},i,{style:p({display:"block"},t)})):null},t.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(M).isRequired},t}(f.Component),C=function(s){function e(e,t){var l=s.call(this,e,t)||this;l.validate=function(e){var t=l.props.when,i=l.context,n=i.form,r=i.fieldFeedbacks,a=n.fieldsStore.getField(e.name),o=p({},l.state.validation);if("first"===r.props.stop&&a.hasFeedbacks(r.key)||"first-error"===r.props.stop&&a.hasErrors(r.key)||"first-warning"===r.props.stop&&a.hasWarnings(r.key)||"first-info"===r.props.stop&&a.hasInfos(r.key))o.show=void 0;else if(o.show=!1,"function"==typeof t)o.show=t(e.value);else{if("string"!=typeof t)throw new TypeError("Invalid FieldFeedback 'when' type: "+typeof t);if("valid"===t)o.show=void 0;else{var s=e.validity;s.valid||("*"===t?o.show=!0:(s.badInput&&"badInput"===t||s.patternMismatch&&"patternMismatch"===t||s.rangeOverflow&&"rangeOverflow"===t||s.rangeUnderflow&&"rangeUnderflow"===t||s.stepMismatch&&"stepMismatch"===t||s.tooLong&&"tooLong"===t||s.tooShort&&"tooShort"===t||s.typeMismatch&&"typeMismatch"===t||s.valueMissing&&"valueMissing"===t)&&(o.show=!0))}}return a.addOrReplaceValidation(o),l.setState({validation:o,validationMessage:e.validationMessage}),o},l.fieldDidReset=function(e){e.name===l.context.fieldFeedbacks.fieldName&&l.setState(function(e){return{validation:p({},e.validation,{show:void 0}),validationMessage:""}})},l.key=t.fieldFeedbacks.addFieldFeedback();var i=e.error,n=e.warning,r=e.info,a=e.when,o=x.Error;if("valid"===a?o=x.WhenValid:n?o=x.Warning:r&&(o=x.Info),o===x.WhenValid&&(i||n||r))throw new Error('Cannot have an attribute (error, warning...) with FieldFeedback when="valid"');return l.state={validation:{key:l.key,type:o,show:void 0},validationMessage:""},l}return r(e,s),e.prototype.componentWillMount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks,n=e.async;n?n.addValidateFieldEventListener(this.validate):i.addValidateFieldEventListener(this.validate),t.addFieldDidResetEventListener(this.fieldDidReset)},e.prototype.componentWillUnmount=function(){var e=this.context,t=e.form,i=e.fieldFeedbacks,n=e.async;n?n.removeValidateFieldEventListener(this.validate):i.removeValidateFieldEventListener(this.validate),t.removeFieldDidResetEventListener(this.fieldDidReset)},e.prototype.render=function(){var e=this.props,t=(e.when,e.error,e.warning,e.info,e.className),i=e.classes,n=e.style,r=e.children,a=h(e,["when","error","warning","info","className","classes","style","children"]),o=this.state,s=o.validation,l=o.validationMessage,d=i[s.type],u=void 0!==t?t+" "+d:d;if(s.type===x.WhenValid)return f.createElement(_,p({"data-feedback":this.key,style:n,className:u},a),r);if(s.show){var c=void 0!==r?r:l;return f.createElement("span",p({"data-feedback":this.key,className:u,style:p({display:"block"},n)},a),c)}return null},e.defaultProps={when:function(){return!0},classes:{error:"error",warning:"warning",info:"info",whenValid:"when-valid"}},e.contextTypes={form:i.instanceOf(I).isRequired,fieldFeedbacks:i.instanceOf(M).isRequired,async:i.instanceOf(N)},e}(f.Component),T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={field:void 0},t.fieldWillValidate=function(e){e===t.props.name&&t.setState({field:void 0})},t.fieldDidValidate=function(e){e.name===t.props.name&&t.setState({field:e})},t.fieldDidReset=function(e){e.name===t.props.name&&t.setState({field:void 0})},t}return r(t,e),t.prototype.componentWillMount=function(){this.context.form.addFieldWillValidateEventListener(this.fieldWillValidate),this.context.form.addFieldDidValidateEventListener(this.fieldDidValidate),this.context.form.addFieldDidResetEventListener(this.fieldDidReset)},t.prototype.componentWillUnmount=function(){this.context.form.removeFieldWillValidateEventListener(this.fieldWillValidate),this.context.form.removeFieldDidValidateEventListener(this.fieldDidValidate),this.context.form.removeFieldDidResetEventListener(this.fieldDidReset)},t.prototype.fieldValidationStates=function(){var e=this.state.field,t=[];return void 0!==e&&(e.hasErrors()&&t.push("hasErrors"),e.hasWarnings()&&t.push("hasWarnings"),e.hasInfos()&&t.push("hasInfos"),e.isValid()&&t.push("isValid")),t},t.prototype.render=function(){var e=this.props,t=e.innerRef,i=e.className,n=e.classes,r=h(e,["innerRef","className","classes"]),a=this.fieldValidationStates(),o=i;return a.forEach(function(e){var t=n[e];void 0!==t&&(void 0!==o?o+=" "+t:o=t)}),f.createElement("input",p({ref:t},r,{className:o}))},t.contextTypes={form:i.instanceOf(I).isRequired},t.defaultProps={classes:{hasErrors:"has-errors",hasWarnings:"has-warnings",hasInfos:"has-infos",isValid:"is-valid"}},t}(f.Component),A=function(e,i){f.Children.forEach(e,function(e){var t=e;t.props&&t.props.children&&"object"==typeof t.props.children&&A(t.props.children,i),i(t)})};s.FieldFeedbackType=x,s.Field=L,s.EventEmitter=o,s.deepForEach=A,s.FormWithConstraints=I,s.FieldFeedbacks=M,s.FieldFeedback=C,s.FieldFeedbackWhenValid=_,s.Async=N,s.FieldsStore=R,s.ValidateFieldEvent=d,s.withValidateFieldEventEmitter=u,s.FieldWillValidateEvent=c,s.withFieldWillValidateEventEmitter=F,s.FieldDidValidateEvent=E,s.withFieldDidValidateEventEmitter=b,s.FieldDidResetEvent=w,s.withFieldDidResetEventEmitter=g,s.InputElement=V,s.IValidityState=k,s.Input=T,Object.defineProperty(s,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=react-form-with-constraints.production.min.js.map |
@@ -49,2 +49,2 @@ "use strict"; | ||
exports.default = Field; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRmllbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvRmllbGQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFDQSwwRUFBb0Q7QUFDcEQsNERBQXNDO0FBR3RDO0lBR0UsZUFBNEIsSUFBWTtRQUFaLFNBQUksR0FBSixJQUFJLENBQVE7UUFDdEMsSUFBSSxDQUFDLFdBQVcsR0FBRyxFQUFFLENBQUM7SUFDeEIsQ0FBQztJQUVELHNDQUFzQixHQUF0QixVQUF1QixVQUFtQztRQUV4RCxJQUFNLENBQUMsR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDLFNBQVMsQ0FBQyxVQUFBLFdBQVcsSUFBSSxPQUFBLFdBQVcsQ0FBQyxHQUFHLEtBQUssVUFBVSxDQUFDLEdBQUcsRUFBbEMsQ0FBa0MsQ0FBQyxDQU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Nob3cgPT09IHRydWVcbiAgICApO1xuICB9XG5cbiAgaGFzRXJyb3JzKGZpZWxkRmVlZGJhY2tzS2V5Pzogc3RyaW5nKSB7XG4gICAgcmV0dXJuIHRoaXMuaGFzRmVlZGJhY2tzT2ZUeXBlKEZpZWxkRmVlZGJhY2tUeXBlLkVycm9yLCBmaWVsZEZlZWRiYWNrc0tleSk7XG4gIH1cblxuICBoYXNXYXJuaW5ncyhmaWVsZEZlZWRiYWNrc0tleT86IHN0cmluZykge1xuICAgIHJldHVybiB0aGlzLmhhc0ZlZWRiYWNrc09mVHlwZShGaWVsZEZlZWRiYWNrVHlwZS5XYXJuaW5nLCBmaWVsZEZlZWRiYWNrc0tleSk7XG4gIH1cblxuICBoYXNJbmZvcyhmaWVsZEZlZWRiYWNrc0tleT86IHN0cmluZykge1xuICAgIHJldHVybiB0aGlzLmhhc0ZlZWRiYWNrc09mVHlwZShGaWVsZEZlZWRiYWNrVHlwZS5JbmZvLCBmaWVsZEZlZWRiYWNrc0tleSk7XG4gIH1cblxuICBoYXNGZWVkYmFja3MoZmllbGRGZWVkYmFja3NLZXk/OiBzdHJpbmcpIHtcbiAgICByZXR1cm4gdGhpcy5oYXNFcnJvcnMoZmllbGRGZWVkYmFja3NLZXkpIHx8XG4gICAgICAgICAgIHRoaXMuaGFzV2FybmluZ3MoZmllbGRGZWVkYmFja3NLZXkpIHx8XG4gICAgICAgICAgIHRoaXMuaGFzSW5mb3MoZmllbGRGZWVkYmFja3NLZXkpO1xuICB9XG5cbiAgaXNWYWxpZCgpIHtcbiAgICByZXR1cm4gIXRoaXMuaGFzRXJyb3JzKCk7XG4gIH1cbn1cbiJdfQ== |
@@ -51,3 +51,3 @@ import React from 'react'; | ||
validateForm(): Promise<Readonly<Field>[]>; | ||
validateFields_lazy(...inputsOrNames: Array<InputElement | string>): Promise<Readonly<Field>[]>; | ||
validateFieldsWithoutFeedback(...inputsOrNames: Array<InputElement | string>): Promise<Readonly<Field>[]>; | ||
private _validateFields; | ||
@@ -54,0 +54,0 @@ private validateField; |
@@ -131,5 +131,5 @@ "use strict"; | ||
FormWithConstraints.prototype.validateForm = function () { | ||
return this.validateFields_lazy(); | ||
return this.validateFieldsWithoutFeedback(); | ||
}; | ||
FormWithConstraints.prototype.validateFields_lazy = function () { | ||
FormWithConstraints.prototype.validateFieldsWithoutFeedback = function () { | ||
var inputsOrNames = []; | ||
@@ -222,3 +222,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
inputs = __spread(this.form.querySelectorAll('[name]')); | ||
inputs = inputs.filter(function (input) { return input.type; }); | ||
inputs = inputs.filter(function (input) { return input.validity !== undefined; }); | ||
inputs | ||
@@ -238,2 +238,5 @@ .filter(function (input) { return input.type !== 'checkbox' && input.type !== 'radio'; }) | ||
var elements = __spread(_this.form.querySelectorAll(query)); | ||
if (elements.filter(function (el) { return el.validity === undefined; }).length > 0) { | ||
throw new Error("'" + query + "' should match an <input>, <select> or <textarea>"); | ||
} | ||
if (elements.filter(function (el) { return el.type !== 'checkbox' && el.type !== 'radio'; }).length > 1) { | ||
@@ -337,2 +340,2 @@ throw new Error("Multiple elements matching '" + query + "' inside the form"); | ||
exports.FormWithConstraints = FormWithConstraints; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRm9ybVdpdGhDb25zdHJhaW50cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9Gb3JtV2l0aENvbnN0cmFpbnRzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsZ0RBQTBCO0FBQzFCLDBEQUFtQztBQUVuQyxpRkFBZ0Y7QUFDaEYseUZBQXdGO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ZhbGlkYXRpb25zKCk7XG4gICAgICBhd2FpdCB0aGlzLmVtaXRGaWVsZERpZFJlc2V0RXZlbnQoZmllbGQpO1xuICAgIH1cblxuICAgIHJldHVybiBmaWVsZDtcbiAgfVxuXG4gIHJlbmRlcigpIHtcbiAgICByZXR1cm4gPGZvcm0gcmVmPXtmb3JtID0+IHRoaXMuZm9ybSA9IGZvcm19IHsuLi50aGlzLnByb3BzfSAvPjtcbiAgfVxufVxuIl19 |
@@ -42,2 +42,2 @@ "use strict"; | ||
exports.IValidityState = IValidityState; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW5wdXRFbGVtZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL0lucHV0RWxlbWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQVVBO0lBU0Usc0JBQVksS0FBb0Q7UUFDOUQsSUFBSyxLQUFhLENBQUMsS0FBSyxLQUFLLFNBQVMsRUFBRTtZQUN0QyxLQUFLLEdBQUcsS0FBcUIsQ0FBQztZQUM5QixJQUFJLENBQUMsSUFBSSxHQUFHLEtBQUssQ0FBQyxJQUFJLENBQUM7WUFDdkIsSUFBSSxDQUFDLElBQUksR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDO1lBQ3ZCLElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQztZQVN6QixJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksY0FBYyxDQUFDLEtBQUssQ0FBQyxRQUF5QixDQUFDLENBQUM7WUFFcEUsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztTQUNsRDthQUFNO1lBQ0wsS0FBSyxHQUFHLEtBQWtCLENBQUM7WUFDM0IsSUFBSSxDQUFDLElBQUksR0FBRyxLQUFLLENBQUMsS0FBTSxDQUFDLElBQUksQ0FBQztZQUM5Qix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biAgcmVhZG9ubHkgdHlwZU1pc21hdGNoOiBib29sZWFuO1xuICByZWFkb25seSB2YWxpZDogYm9vbGVhbjtcbiAgcmVhZG9ubHkgdmFsdWVNaXNzaW5nOiBib29sZWFuO1xuXG4gIGNvbnN0cnVjdG9yKHZhbGlkaXR5OiBWYWxpZGl0eVN0YXRlKSB7XG4gICAgdGhpcy5iYWRJbnB1dCA9IHZhbGlkaXR5LmJhZElucHV0O1xuICAgIHRoaXMuY3VzdG9tRXJyb3IgPSB2YWxpZGl0eS5jdXN0b21FcnJvcjtcbiAgICB0aGlzLnBhdHRlcm5NaXNtYXRjaCA9IHZhbGlkaXR5LnBhdHRlcm5NaXNtYXRjaDtcbiAgICB0aGlzLnJhbmdlT3ZlcmZsb3cgPSB2YWxpZGl0eS5yYW5nZU92ZXJmbG93O1xuICAgIHRoaXMucmFuZ2VVbmRlcmZsb3cgPSB2YWxpZGl0eS5yYW5nZVVuZGVyZmxvdztcbiAgICB0aGlzLnN0ZXBNaXNtYXRjaCA9IHZhbGlkaXR5LnN0ZXBNaXNtYXRjaDtcbiAgICB0aGlzLnRvb0xvbmcgPSB2YWxpZGl0eS50b29Mb25nO1xuICAgIHRoaXMudG9vU2hvcnQgPSB2YWxpZGl0eS50b29TaG9ydDtcbiAgICB0aGlzLnR5cGVNaXNtYXRjaCA9IHZhbGlkaXR5LnR5cGVNaXNtYXRjaDtcbiAgICB0aGlzLnZhbGlkID0gdmFsaWRpdHkudmFsaWQ7XG4gICAgdGhpcy52YWx1ZU1pc3NpbmcgPSB2YWxpZGl0eS52YWx1ZU1pc3Npbmc7XG4gIH1cbn1cbiJdfQ== |
{ | ||
"name": "react-form-with-constraints", | ||
"version": "0.10.0-beta.1", | ||
"version": "0.10.0-beta.2", | ||
"repository": { | ||
@@ -60,3 +60,3 @@ "type": "git", | ||
"rollup-plugin-filesize": "latest", | ||
"rollup-plugin-gzip": "^1.4.0", | ||
"rollup-plugin-gzip": "latest", | ||
"rollup-plugin-strip": "latest", | ||
@@ -69,3 +69,3 @@ "rollup-plugin-typescript2": "latest", | ||
}, | ||
"gitHead": "04800789b7d84c9acb6f1bf2c0da7a6620ec14be" | ||
"gitHead": "3b9e2ec58e3a9a4c2e4be47ea1a0209ba1f36eba" | ||
} |
@@ -41,3 +41,3 @@ # react-form-with-constraints | ||
- Unobtrusive: easy to adapt regular [React code](https://reactjs.org/docs/forms.html) | ||
- Control HTML5 error messages: `<FieldFeedback when="valueMissing">My custom error message</FieldFeedback>` | ||
- HTML5 error messages personalization: `<FieldFeedback when="valueMissing">My custom error message</FieldFeedback>` | ||
- Custom constraints: `<FieldFeedback when={value => ...}>` | ||
@@ -49,5 +49,5 @@ - Warnings and infos: `<FieldFeedback ... warning>`, `<FieldFeedback ... info>` | ||
- Easily extendable | ||
- Support for [React Native](examples/ReactNative) with npm package `react-form-with-constraints-native` | ||
- [Bootstrap 4](examples/Bootstrap4) styling with npm package `react-form-with-constraints-bootstrap4` | ||
- [Material-UI](examples/MaterialUI) integration with npm package `react-form-with-constraints-material-ui` | ||
- Support for [React Native](examples/ReactNative) with npm package `react-form-with-constraints-native` | ||
- ... | ||
@@ -111,3 +111,3 @@ | ||
react-form-with-constraints [works similarly](packages/react-form-with-constraints/src/FieldsStore.ts). | ||
It uses [React context](https://github.com/reactjs/reactjs.org/blob/d59c4f9116138e419812e44b0fdb56644c498d3e/content/docs/context.md) to share the [`FieldsStore`](packages/react-form-with-constraints/src/FieldsStore.ts) object across [`FieldFeedbacks`](packages/react-form-with-constraints/src/FieldFeedbacks.tsx) and [`FieldFeedback`](packages/react-form-with-constraints/src/FieldFeedback.tsx). | ||
It uses [React context](https://reactjs.org/docs/legacy-context.html) to share the [`FieldsStore`](packages/react-form-with-constraints/src/FieldsStore.ts) object across [`FieldFeedbacks`](packages/react-form-with-constraints/src/FieldFeedbacks.tsx) and [`FieldFeedback`](packages/react-form-with-constraints/src/FieldFeedback.tsx). | ||
@@ -168,3 +168,3 @@ ## API | ||
// or simply this.form.isValid(); | ||
// or simply use this.form.isValid() | ||
const formIsValid = fields.every(field => field.isValid()); | ||
@@ -243,3 +243,3 @@ | ||
- [`Async<T>`](packages/react-form-with-constraints/src/Async.tsx) => Async version of `FieldFeedback`, similar API as [react-promise](https://github.com/capaj/react-promise) | ||
- [`Async<T>`](packages/react-form-with-constraints/src/Async.tsx) => Async version of `FieldFeedback` (similar API as [react-promise](https://github.com/capaj/react-promise)) | ||
- `promise: (value: string) => Promise<T>` => a promise you want to wait for | ||
@@ -256,7 +256,11 @@ - `pending?: React.ReactNode` => runs when promise is pending | ||
- `validateFieldsWithoutFeedback(...inputsOrNames: Array<Input | string>): Promise<Field[]>` => | ||
Validates only all non-dirty fields (won't re-validate fields that have been already validated with `validateFields()`), | ||
If you want to force re-validate all fields, use `validateFields()`. | ||
- `validateForm(): Promise<Field[]>` => | ||
Should be called before to submit the `form`. Validates only all non-dirty fields (won't re-validate fields that have been already validated with `validateFields(...)`), | ||
If you want to force re-validate all fields, use `validateFields()` without arguments. | ||
Other name for `validateFieldsWithoutFeedback()`, typically called before to submit the `form`. | ||
Might be removed in the future? | ||
- `isValid(): boolean` => should be called after `validateForm()` or `validateFields()`, tells if the fields are valid | ||
- `isValid(): boolean` => should be called after `validateFields()`, `validateFieldsWithoutFeedback()` or `validateForm()`, tells if the fields are valid | ||
@@ -292,4 +296,7 @@ - `hasFeedbacks(): boolean` => tells if the fields have any kind of feedback | ||
You can use HTML5 attributes like `type="email"`, `required`, `pattern`..., in this case a [recent browser](http://caniuse.com/#feat=forms) is needed,... | ||
react-form-with-constraints needs [`ValidityState`](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState) which is supported by all modern browsers and IE >= 10. | ||
It also needs a polyfill such as [core-js](https://github.com/zloirock/core-js) or [@babel/polyfill](https://babeljs.io/docs/usage/polyfill/) to support IE <= 11, see [React JavaScript Environment Requirements](https://reactjs.org/docs/javascript-environment-requirements.html). | ||
You can use HTML5 attributes like `type="email"`, `required`, [`minlength`](https://caniuse.com/#feat=input-minlength)... | ||
```JSX | ||
@@ -305,3 +312,3 @@ <label htmlFor="username">Username</label> | ||
...or ignore them and rely on `when` functions: | ||
...and/or rely on `when` functions: | ||
@@ -320,7 +327,5 @@ ```JSX | ||
react-form-with-constraints needs a polyfill such as [core-js](https://github.com/zloirock/core-js) or [babel-polyfill](https://babeljs.io/docs/usage/polyfill/) to support IE 11 and lower. See also [React JavaScript Environment Requirements](https://reactjs.org/docs/javascript-environment-requirements.html). | ||
## Notes | ||
- A [`readonly`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) or `disabled` input won't trigger any HTML5 form constraint like [`required`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-required). | ||
- A [`type="hidden"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/hidden#Validation), [`readonly`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) or [`disabled`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-disabled) input won't trigger any HTML5 form constraint validation like [`required`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-required), see https://codepen.io/tkrotoff/pen/gdjVNv | ||
- With `<input type="number">` it's better to use `onInput` instead of `onChange`, see https://github.com/facebook/react/issues/11142 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
321913
3180
323