Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/ui / dist / forms / input / plugins / Text / TextAreaInput.js
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

const tslib_1 = require("tslib");

const react_1 = tslib_1.__importDefault(require("react"));

const TextArea_1 = tslib_1.__importDefault(require("../../../../inputs/TextArea"));

const _validators_1 = require("../../../deps/_validators");

const InputChain_1 = require("../../InputChain");

class TextAreaInput extends InputChain_1.InputChain {
  static isSatisfiedByProps(props) {
    return props.type === 'textarea';
  }

  validate() {
    console.log('TextAreaInput_validate');
    const {
      maxLength,
      minLength
    } = this.entries();
    const value = this.getValue(); // as long as we configured one

    if (maxLength || minLength) {
      this.isValid = _validators_1.validators.isValidLength(value, minLength, maxLength);
    }
  }

  render() {
    const state = this.get('state');
    const props = this.get('props');
    const attributes = Object.assign({}, props, {
      state,
      onChange: event => {
        this.setValue(event.target.value);
        this.validate();
      }
    });
    return react_1.default.createElement(TextArea_1.default, Object.assign({}, attributes));
  }

}

exports.TextAreaInput = TextAreaInput;
exports.default = TextAreaInput; //# sourceMappingURL=TextAreaInput.js.map