()
| 623 | } |
| 624 | |
| 625 | validate() { |
| 626 | const value = []; |
| 627 | let errors = []; |
| 628 | let hasError = false; |
| 629 | let result; |
| 630 | |
| 631 | if (this.typeInfo.isMaybe && this.isValueNully()) { |
| 632 | this.removeErrors(); |
| 633 | return new t.ValidationResult({ errors: [], value: null }); |
| 634 | } |
| 635 | |
| 636 | for (let i = 0, len = this.state.value.length; i < len; i++) { |
| 637 | result = this.refs[i].validate(); |
| 638 | errors = errors.concat(result.errors); |
| 639 | value.push(result.value); |
| 640 | } |
| 641 | |
| 642 | // handle subtype |
| 643 | if (this.typeInfo.isSubtype && errors.length === 0) { |
| 644 | result = t.validate(value, this.props.type, this.getValidationOptions()); |
| 645 | hasError = !result.isValid(); |
| 646 | errors = errors.concat(result.errors); |
| 647 | } |
| 648 | |
| 649 | this.setState({ hasError: hasError }); |
| 650 | return new t.ValidationResult({ errors: errors, value: value }); |
| 651 | } |
| 652 | |
| 653 | onChange(value, keys, path, kind) { |
| 654 | const allkeys = toSameLength(value, keys, this.props.ctx.uidGenerator); |
no test coverage detected