Repository URL to install this package:
|
Version:
0.9.5 ▾
|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const exotic_1 = require("exotic");
const TextBox_1 = __importDefault(require("src/inputs/TextBox"));
const _validators_1 = require("src/forms/deps/_validators");
const InputChain_1 = require("src/forms/input/InputChain");
// I think this has everything needed to try
// THIS IS NOT A REACT COMPONENT, BUT BABEL IS HIJACKING IT...
class TextBoxInput extends InputChain_1.InputChain {
constructor() {
super(...arguments);
this.validate = () => {
console.dev('TextInput_validate');
const state = this.get('state');
const props = this.get('props');
/**
* !!!!!!!!
* @note - this uses props.validationType while the others use state
*/
this.isValid = _validators_1.validators.isValid(state.value, props.validationType);
};
}
// 1. checking if it is the right one
// ^ this means nobody ever has to change ObserverInput
// ... it's externally configurable by anyone in a standard pattern :-)
static isSatisfiedByProps(props) {
const typesSupported = ['text', 'confirmPassword', 'telephone'];
// isUndefined(props.type) --> setting the default type as text when the inputType is undefined
return (exotic_1.isUndefined(props.type) ||
typesSupported.includes(props.type) ||
(props.identity !== 'SecurityCode' && props.type === 'password'));
}
render() {
const props = this.get('props');
console.log('TextInput_render', props);
const attributes = Object.assign({}, props);
return react_1.default.createElement(TextBox_1.default, Object.assign({}, attributes));
}
}
exports.TextBoxInput = TextBoxInput;
exports.default = TextBoxInput;
//# sourceMappingURL=TextInput.js.map