react-mui-form-validator 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/Readme.md +1 -0
  2. package/lib/index.js +25 -30
  3. package/package.json +1 -1
package/Readme.md CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  ## Validation component for material-ui forms
2
3
 
3
4
  [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)
package/lib/index.js CHANGED
@@ -17617,42 +17617,37 @@ var ValidatorComponent = class extends React62.Component {
17617
17617
  getErrorMessage = () => {
17618
17618
  const { errorMessages } = this.state;
17619
17619
  const type = typeof errorMessages;
17620
- if (errorMessages) {
17621
- if (type === "string") {
17622
- return errorMessages;
17623
- } else if (type === "object") {
17624
- if (this.invalid.length > 0) {
17625
- return errorMessages[this.invalid[0]];
17626
- }
17620
+ if (type === "string") {
17621
+ return errorMessages;
17622
+ } else if (type === "object") {
17623
+ if (this.invalid.length > 0) {
17624
+ return errorMessages[this.invalid[0]];
17627
17625
  }
17628
17626
  }
17629
17627
  return true;
17630
17628
  };
17631
17629
  validate = async (value, dryRun = false) => {
17632
- let valid = false;
17633
- if (this.state.validators) {
17634
- const validations2 = Promise.all(
17635
- this.state.validators.map(
17636
- (validator2) => ValidatorForm_default.getValidator(value, validator2)
17637
- )
17638
- );
17639
- const results = await validations2;
17640
- this.invalid = [];
17641
- valid = true;
17642
- results.forEach((result, key) => {
17643
- if (!result) {
17644
- valid = false;
17645
- this.invalid.push(key);
17646
- }
17647
- });
17648
- if (!dryRun) {
17649
- this.setState({ isValid: valid }, () => {
17650
- if (this.props.validatorListener)
17651
- this.props.validatorListener(
17652
- this.state.isValid === void 0 ? false : this.state.isValid
17653
- );
17654
- });
17630
+ const validations2 = Promise.all(
17631
+ this.state.validators.map(
17632
+ (validator2) => ValidatorForm_default.getValidator(value, validator2)
17633
+ )
17634
+ );
17635
+ const results = await validations2;
17636
+ this.invalid = [];
17637
+ let valid = true;
17638
+ results.forEach((result, key) => {
17639
+ if (!result) {
17640
+ valid = false;
17641
+ this.invalid.push(key);
17655
17642
  }
17643
+ });
17644
+ if (!dryRun) {
17645
+ this.setState({ isValid: valid }, () => {
17646
+ if (this.props.validatorListener)
17647
+ this.props.validatorListener(
17648
+ this.state.isValid === void 0 ? false : this.state.isValid
17649
+ );
17650
+ });
17656
17651
  }
17657
17652
  return valid;
17658
17653
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mui-form-validator",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Validator for forms designed with material-ui components.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",