Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var TextValidator = /** @class */ (function (_super) {
__extends(TextValidator, _super);
function TextValidator() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
isValid: true,
};
return _this;
}
TextValidator.prototype.render = function () {
var _a = this.props, error = _a.error, errorMessages = _a.errorMessages, validators = _a.validators, requiredError = _a.requiredError, helperText = _a.helperText, validatorListener = _a.validatorListener, withRequiredValidator = _a.withRequiredValidator, label = _a.label, id = _a.id, rest = __rest(_a, ["error", "errorMessages", "validators", "requiredError", "helperText", "validatorListener", "withRequiredValidator", "label", "id"]);
var isValid = this.state.isValid;
return (React.createElement(TextField_1.default, __assign({}, rest, { id: id, label: label || uno_react_1.humanize(id), error: !isValid || error, helperText: (!isValid && this.getErrorMessage()) || helperText })));
};
return TextValidator;
}(react_form_validator_core_1.ValidatorComponent));
exports.TextValidator = TextValidator;
//# sourceMappingURL=TextValidator.js.map
validatorListener = _this$props.validatorListener,
withRequiredValidator = _this$props.withRequiredValidator,
label = _this$props.label,
id = _this$props.id,
rest = (0, _objectWithoutProperties2.default)(_this$props, ["error", "errorMessages", "validators", "requiredError", "helperText", "validatorListener", "withRequiredValidator", "label", "id"]);
var isValid = this.state.isValid;
return React.createElement(_TextField.default, (0, _extends2.default)({}, rest, {
id: id,
label: label || (0, _humanize.default)(id),
error: !isValid || error,
helperText: !isValid && this.getErrorMessage() || helperText
}));
}
}]);
return TextValidator;
}(_reactFormValidatorCore.ValidatorComponent);
exports.default = TextValidator;