/*
* @Author: zhouningyi
* @Date: 2016-12-26 11:55:57
*/

import React, { Component, PropTypes } from 'react';
import Utils     from './../../lib/utils';
import UiBase    from './../uiBase';

import InputBase from './Base';

import styles from './index.css';

export default class Input extends UiBase {
  static propTypes = {
    data:           PropTypes.any.isRequired,
    onChange:       PropTypes.func.isRequired,
    onFinishChange: PropTypes.func,
  }
  constructor(props: any) {
    super(props)
    props = this.props;
  }
  onInputChange = (v) => {
    this.onChange(v);
  }
  _genUI(){
    const {onFinishChange, heightPhi} = this.props;
    let {step, validate, id, name, key, value, valueType, disable} = this.state.data;
    const height = this._getDefaultHeight() * heightPhi + 'px';
    const style = Object.assign({height}, this._getSelectorStyle());
    // this.state.isOpenEditor = true; ///////测试
    return(
      <InputBase
        isActive={this.state.isActive}
        id={id}
        name={name}
        value={value}
        onChange={this.onInputChange}
        onFinishChange={onFinishChange}
        type={valueType}
        style={style}
        disabled={disable}
      />
    );
  }
}
