From c1e879cd2dc83128adafe2c53cb9d6927e86a959 Mon Sep 17 00:00:00 2001 From: xjouyi Date: Fri, 23 Sep 2016 09:58:57 +0800 Subject: [PATCH] modify input --- components/input/Input.jsx | 58 ++++++++++++++++--------------- components/input/style/index.less | 2 +- components/input/style/mixin.less | 2 +- lib/input/Input.js | 7 ++-- package.json | 2 +- 5 files changed, 38 insertions(+), 33 deletions(-) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index df99e87..befdc8b 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -25,34 +25,6 @@ function clearNextFrameAction(nextFrameId) { } export default class Input extends Component { - static defaultProps = { - defaultValue: '', - disabled: false, - prefixCls: 'ant-input', - type: 'text', - onPressEnter() {}, - onKeyDown() {}, - autosize: false, - } - - static propTypes = { - type: PropTypes.string, - id: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - ]), - size: PropTypes.oneOf(['small', 'default', 'large']), - disabled: PropTypes.bool, - value: PropTypes.any, - defaultValue: PropTypes.any, - className: PropTypes.string, - addonBefore: PropTypes.node, - addonAfter: PropTypes.node, - prefixCls: PropTypes.string, - autosize: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), - onPressEnter: PropTypes.func, - onKeyDown: PropTypes.func, - } constructor(props) { super(props); @@ -182,3 +154,33 @@ export default class Input extends Component { return this.renderLabledInput(this.renderInput()); } } + + +Input.defaultProps = { + defaultValue: '', + disabled: false, + prefixCls: 'ant-input', + type: 'text', + onPressEnter() {}, + onKeyDown() {}, + autosize: false, +} + +Input.propTypes = { + type: PropTypes.string, + id: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.number, + ]), + size: PropTypes.oneOf(['small', 'default', 'large']), + disabled: PropTypes.bool, + value: PropTypes.any, + defaultValue: PropTypes.any, + className: PropTypes.string, + addonBefore: PropTypes.node, + addonAfter: PropTypes.node, + prefixCls: PropTypes.string, + autosize: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), + onPressEnter: PropTypes.func, + onKeyDown: PropTypes.func, +} diff --git a/components/input/style/index.less b/components/input/style/index.less index 953310e..08be3f6 100644 --- a/components/input/style/index.less +++ b/components/input/style/index.less @@ -5,7 +5,7 @@ // Input styles .ant-input { - .input; + .mkinput; } //== Style for input-group: input with label, with button or dropdown... diff --git a/components/input/style/mixin.less b/components/input/style/mixin.less index 8c80816..db8c713 100644 --- a/components/input/style/mixin.less +++ b/components/input/style/mixin.less @@ -37,7 +37,7 @@ } // Basic style for input -.input() { +.mkinput() { position: relative; display: inline-block; padding: @input-padding-vertical-base @input-padding-horizontal; diff --git a/lib/input/Input.js b/lib/input/Input.js index b598342..121dd02 100644 --- a/lib/input/Input.js +++ b/lib/input/Input.js @@ -187,6 +187,9 @@ var Input = function (_Component) { return Input; }(_react.Component); +exports.default = Input; + + Input.defaultProps = { defaultValue: '', disabled: false, @@ -197,6 +200,7 @@ Input.defaultProps = { autosize: false }; + Input.propTypes = { type: _react.PropTypes.string, id: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]), @@ -211,5 +215,4 @@ Input.propTypes = { autosize: _react.PropTypes.oneOfType([_react.PropTypes.bool, _react.PropTypes.object]), onPressEnter: _react.PropTypes.func, onKeyDown: _react.PropTypes.func -}; -exports.default = Input; \ No newline at end of file +}; \ No newline at end of file diff --git a/package.json b/package.json index 84ec30a..3a5aa88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monkeyui", - "version": "0.1.8", + "version": "0.1.9", "title": "monkeyui", "description": "react components.", "author": "bebeanan",