lib/InputRender.js
function renderInput(Form, Input, Icon) {
    var _class, _temp2;

    return _temp2 = _class = function (_Component) {
        _inherits(InputRender, _Component);

        function InputRender() {
            var _temp, _this, _ret;

            _classCallCheck(this, InputRender);

            for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
                args[_key] = arguments[_key];
            }

            return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = {
                value: _this.props.value,
                editable: false
            }, _this.handleChange = function (e) {
                var value = e;
                _this.setState({ value: value });
            }, _this.check = function () {
                if (typeof _this.flag === "undefined" || _this.flag) {
                    _this.props.check(_this.flag, _this.obj);
                    _this.setState({ editable: false });
                    if (_this.props.onChange) {
                        _this.props.onChange(_this.state.value);
                    }
                    _this.flag = undefined;
                }
            }, _this.checkValidate = function (flag, obj) {
                _this.flag = flag;
                _this.obj = obj;
            }, _this.edit = function () {
                _this.setState({ editable: true });
            }, _this.handleKeydown = function (event) {
                if (event.keyCode == 13) {
                    _this.check();
                } else if (event.keyCode == 9) {}
            }, _this.formatCurrency = function (money) {
                if (money && money != null && !!Number(money)) {
                    money = String(money);
                    var left = money.split(".")[0],
                        right = money.split(".")[1];
                    right = right ? right.length >= 2 ? "." + right.substr(0, 2) : "." + right + "0" : ".00";
                    var temp = left.split("").reverse().join("").match(/(\d{1,3})/g);
                    return (Number(money) < 0 ? "-" : "") + temp.join(",").split("").reverse().join("") + right;
                } else if (money === 0) {
                    //注意===在这里的使用，如果传入的money为0,if中会将其判定为boolean类型，故而要另外做===判断
                    return "0.00";
                } else {
                    return "";
                }
            }, _temp), _possibleConstructorReturn(_this, _ret);
        }
        //货币的格式化方法


        InputRender.prototype.render = function render() {
            var _state = this.state,
                value = _state.value,
                editable = _state.editable;

            var _props = this.props,
                name = _props.name,
                placeholder = _props.placeholder,
                isclickTrigger = _props.isclickTrigger,
                format = _props.format,
                formItemClassName = _props.formItemClassName,
                mesClassName = _props.mesClassName,
                check = _props.check,
                other = _objectWithoutProperties(_props, ["name", "placeholder", "isclickTrigger", "format", "formItemClassName", "mesClassName", "check"]);

            var cellContent = "";
            if (editable) {
                cellContent = isclickTrigger ? _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-input-wrapper" },
                    _react2["default"].createElement(
                        Form.FormItem,
                        _extends({
                            className: "formItem-style " + formItemClassName,
                            mesClassName: "errMessage-style " + mesClassName,
                            change: this.handleChange,
                            blur: this.check,
                            check: this.checkValidate
                        }, other),
                        _react2["default"].createElement(Input, {
                            name: name,
                            placeholder: placeholder,
                            onKeyDown: this.handleKeydown,
                            autoFocus: true,
                            value: value
                        })
                    )
                ) : _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-input-wrapper" },
                    _react2["default"].createElement(
                        Form.FormItem,
                        _extends({
                            className: "formItem-style " + formItemClassName,
                            mesClassName: "errMessage-style " + mesClassName,
                            change: this.handleChange,
                            blur: this.check,
                            check: this.checkValidate
                        }, other),
                        _react2["default"].createElement(Input, {
                            name: name,
                            placeholder: placeholder,
                            onKeyDown: this.handleKeydown,
                            autoFocus: true,
                            value: value
                        })
                    ),
                    _react2["default"].createElement(Icon, {
                        type: "uf-correct",
                        className: "editable-cell-icon-check",
                        onClick: this.check
                    })
                );
            } else {
                if (format && format === "Currency") {
                    value = this.formatCurrency(value);
                }
                cellContent = isclickTrigger ? _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-text-wrapper", onClick: this.edit },
                    value || " "
                ) : _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-text-wrapper" },
                    value || " ",
                    _react2["default"].createElement(Icon, {
                        type: "uf-pencil",
                        className: "editable-cell-icon",
                        onClick: this.edit
                    })
                );
            }
            return _react2["default"].createElement(
                "div",
                { className: "editable-cell" },
                cellContent
            );
        };

        return InputRender;
    }(_react.Component), _class.propTypes = {
        check: _propTypes2["default"].func
    }, _class.defaultProps = {
        check: function check() {
            return "";
        }
    }, _temp2;
}
function renderInput(Form, Input, Icon) {
    var _class, _temp2;

    return _temp2 = _class = function (_Component) {
        _inherits(InputRender, _Component);

        function InputRender() {
            var _temp, _this, _ret;

            _classCallCheck(this, InputRender);

            for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
                args[_key] = arguments[_key];
            }

            return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = {
                value: _this.props.value,
                editable: false
            }, _this.handleChange = function (e) {
                var value = e;
                _this.setState({ value: value });
            }, _this.check = function () {
                if (typeof _this.flag === "undefined" || _this.flag) {
                    _this.props.check(_this.flag, _this.obj);
                    _this.setState({ editable: false });
                    if (_this.props.onChange) {
                        _this.props.onChange(_this.state.value);
                    }
                    _this.flag = undefined;
                }
            }, _this.checkValidate = function (flag, obj) {
                _this.flag = flag;
                _this.obj = obj;
            }, _this.edit = function () {
                _this.setState({ editable: true });
            }, _this.handleKeydown = function (event) {
                if (event.keyCode == 13) {
                    _this.check();
                } else if (event.keyCode == 9) {}
            }, _this.formatCurrency = function (money) {
                if (money && money != null && !!Number(money)) {
                    money = String(money);
                    var left = money.split(".")[0],
                        right = money.split(".")[1];
                    right = right ? right.length >= 2 ? "." + right.substr(0, 2) : "." + right + "0" : ".00";
                    var temp = left.split("").reverse().join("").match(/(\d{1,3})/g);
                    return (Number(money) < 0 ? "-" : "") + temp.join(",").split("").reverse().join("") + right;
                } else if (money === 0) {
                    //注意===在这里的使用，如果传入的money为0,if中会将其判定为boolean类型，故而要另外做===判断
                    return "0.00";
                } else {
                    return "";
                }
            }, _temp), _possibleConstructorReturn(_this, _ret);
        }
        //货币的格式化方法


        InputRender.prototype.render = function render() {
            var _state = this.state,
                value = _state.value,
                editable = _state.editable;

            var _props = this.props,
                name = _props.name,
                placeholder = _props.placeholder,
                isclickTrigger = _props.isclickTrigger,
                format = _props.format,
                formItemClassName = _props.formItemClassName,
                mesClassName = _props.mesClassName,
                check = _props.check,
                other = _objectWithoutProperties(_props, ["name", "placeholder", "isclickTrigger", "format", "formItemClassName", "mesClassName", "check"]);

            var cellContent = "";
            if (editable) {
                cellContent = isclickTrigger ? _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-input-wrapper" },
                    _react2["default"].createElement(
                        Form.FormItem,
                        _extends({
                            className: "formItem-style " + formItemClassName,
                            mesClassName: "errMessage-style " + mesClassName,
                            change: this.handleChange,
                            blur: this.check,
                            check: this.checkValidate
                        }, other),
                        _react2["default"].createElement(Input, {
                            name: name,
                            placeholder: placeholder,
                            onKeyDown: this.handleKeydown,
                            autoFocus: true,
                            value: value
                        })
                    )
                ) : _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-input-wrapper" },
                    _react2["default"].createElement(
                        Form.FormItem,
                        _extends({
                            className: "formItem-style " + formItemClassName,
                            mesClassName: "errMessage-style " + mesClassName,
                            change: this.handleChange,
                            blur: this.check,
                            check: this.checkValidate
                        }, other),
                        _react2["default"].createElement(Input, {
                            name: name,
                            placeholder: placeholder,
                            onKeyDown: this.handleKeydown,
                            autoFocus: true,
                            value: value
                        })
                    ),
                    _react2["default"].createElement(Icon, {
                        type: "uf-correct",
                        className: "editable-cell-icon-check",
                        onClick: this.check
                    })
                );
            } else {
                if (format && format === "Currency") {
                    value = this.formatCurrency(value);
                }
                cellContent = isclickTrigger ? _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-text-wrapper", onClick: this.edit },
                    value || " "
                ) : _react2["default"].createElement(
                    "div",
                    { className: "editable-cell-text-wrapper" },
                    value || " ",
                    _react2["default"].createElement(Icon, {
                        type: "uf-pencil",
                        className: "editable-cell-icon",
                        onClick: this.edit
                    })
                );
            }
            return _react2["default"].createElement(
                "div",
                { className: "editable-cell" },
                cellContent
            );
        };

        return InputRender;
    }(_react.Component), _class.propTypes = {
        check: _propTypes2["default"].func
    }, _class.defaultProps = {
        check: function check() {
            return "";
        }
    }, _temp2;
}
function renderInput ( Form , Input , Icon ) { var _class , _temp2 ; return _temp2 = _class = function ( _Component ) { _inherits ( InputRender , _Component ) ; function InputRender ( ) { var _temp , _this , _ret ; _classCallCheck ( this , InputRender ) ; for ( var _len = arguments . length , args = Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) { args [ _key ] = arguments [ _key ] ; } return _ret = ( _temp = ( _this = _possibleConstructorReturn ( this , _Component . call . apply ( _Component , [ this ] . concat ( args ) ) ) , _this ) , _this . state = { value : _this . props . value , editable : false } , _this . handleChange = function ( e ) { var value = e ; _this . setState ( { value : value } ) ; } , _this . check = function ( ) { if ( typeof _this . flag === "undefined" || _this . flag ) { _this . props . check ( _this . flag , _this . obj ) ; _this . setState ( { editable : false } ) ; if ( _this . props . onChange ) { _this . props . onChange ( _this . state . value ) ; } _this . flag = undefined ; } } , _this . checkValidate = function ( flag , obj ) { _this . flag = flag ; _this . obj = obj ; } , _this . edit = function ( ) { _this . setState ( { editable : true } ) ; } , _this . handleKeydown = function ( event ) { if ( event . keyCode == 13 ) { _this . check ( ) ; } else if ( event . keyCode == 9 ) { } } , _this . formatCurrency = function ( money ) { if ( money && money != null && ! ! Number ( money ) ) { money = String ( money ) ; var left = money . split ( "." ) [ 0 ] , right = money . split ( "." ) [ 1 ] ; right = right ? right . length >= 2 ? "." + right . substr ( 0 , 2 ) : "." + right + "0" : ".00" ; var temp = left . split ( "" ) . reverse ( ) . join ( "" ) . match ( / (\d{1,3}) / g ) ; return ( Number ( money ) < 0 ? "-" : "" ) + temp . join ( "," ) . split ( "" ) . reverse ( ) . join ( "" ) + right ; } else if ( money === 0 ) { //注意===在这里的使用，如果传入的money为0,if中会将其判定为boolean类型，故而要另外做===判断 return "0.00" ; } else { return "" ; } } , _temp ) , _possibleConstructorReturn ( _this , _ret ) ; } //货币的格式化方法 InputRender . prototype . render = function render ( ) { var _state = this . state , value = _state . value , editable = _state . editable ; var _props = this . props , name = _props . name , placeholder = _props . placeholder , isclickTrigger = _props . isclickTrigger , format = _props . format , formItemClassName = _props . formItemClassName , mesClassName = _props . mesClassName , check = _props . check , other = _objectWithoutProperties ( _props , [ "name" , "placeholder" , "isclickTrigger" , "format" , "formItemClassName" , "mesClassName" , "check" ] ) ; var cellContent = "" ; if ( editable ) { cellContent = isclickTrigger ? _react2 [ "default" ] . createElement ( "div" , { className : "editable-cell-input-wrapper" } , _react2 [ "default" ] . createElement ( Form . FormItem , _extends ( { className : "formItem-style " + formItemClassName , mesClassName : "errMessage-style " + mesClassName , change : this . handleChange , blur : this . check , check : this . checkValidate } , other ) , _react2 [ "default" ] . createElement ( Input , { name : name , placeholder : placeholder , onKeyDown : this . handleKeydown , autoFocus : true , value : value } ) ) ) : _react2 [ "default" ] . createElement ( "div" , { className : "editable-cell-input-wrapper" } , _react2 [ "default" ] . createElement ( Form . FormItem , _extends ( { className : "formItem-style " + formItemClassName , mesClassName : "errMessage-style " + mesClassName , change : this . handleChange , blur : this . check , check : this . checkValidate } , other ) , _react2 [ "default" ] . createElement ( Input , { name : name , placeholder : placeholder , onKeyDown : this . handleKeydown , autoFocus : true , value : value } ) ) , _react2 [ "default" ] . createElement ( Icon , { type : "uf-correct" , className : "editable-cell-icon-check" , onClick : this . check } ) ) ; } else { if ( format && format === "Currency" ) { value = this . formatCurrency ( value ) ; } cellContent = isclickTrigger ? _react2 [ "default" ] . createElement ( "div" , { className : "editable-cell-text-wrapper" , onClick : this . edit } , value || " " ) : _react2 [ "default" ] . createElement ( "div" , { className : "editable-cell-text-wrapper" } , value || " " , _react2 [ "default" ] . createElement ( Icon , { type : "uf-pencil" , className : "editable-cell-icon" , onClick : this . edit } ) ) ; } return _react2 [ "default" ] . createElement ( "div" , { className : "editable-cell" } , cellContent ) ; } ; return InputRender ; } ( _react . Component ) , _class . propTypes = { check : _propTypes2 [ "default" ] . func } , _class . defaultProps = { check : function check ( ) { return "" ; } } , _temp2 ; }
渲染输入框
@param Form
@param Input
@param Icon
@returns {InputRender}
渲染输入框