diff --git a/src/components/FormItem/KeyValueInput/index.jsx b/src/components/FormItem/KeyValueInput/index.jsx index ada4a07a..e193006f 100644 --- a/src/components/FormItem/KeyValueInput/index.jsx +++ b/src/components/FormItem/KeyValueInput/index.jsx @@ -27,6 +27,8 @@ export default class index extends Component { keySpan: PropTypes.number, valueSpan: PropTypes.number, middleComponent: PropTypes.node, + isTextarea: PropTypes.bool, + textareaRows: PropTypes.number, }; static defaultProps = { @@ -38,6 +40,8 @@ export default class index extends Component { keyReadonly: false, valueReadonly: false, middleComponent: , + isTextarea: false, + textareaRows: 2, }; constructor(props) { @@ -80,6 +84,22 @@ export default class index extends Component { }); }; + renderInput(value, placeholder, readOnly) { + const { isTextarea = false, textareaRows } = this.props; + const props = { + value, + placeholder, + onChange: this.onValueChange, + readOnly, + required: true, + }; + if (isTextarea) { + props.rows = textareaRows; + return ; + } + return ; + } + render() { const { key, value } = this.state; const { @@ -106,13 +126,7 @@ export default class index extends Component { {component} - + {this.renderInput(value, valuePlaceholder, valueReadonly)} );