Skip to content

Commit

Permalink
modify input
Browse files Browse the repository at this point in the history
  • Loading branch information
XJouYi committed Sep 23, 2016
1 parent 1fbb4d1 commit c1e879c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
58 changes: 30 additions & 28 deletions components/input/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
}
2 changes: 1 addition & 1 deletion components/input/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// Input styles
.ant-input {
.input;
.mkinput;
}

//== Style for input-group: input with label, with button or dropdown...
Expand Down
2 changes: 1 addition & 1 deletion components/input/style/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}

// Basic style for input
.input() {
.mkinput() {
position: relative;
display: inline-block;
padding: @input-padding-vertical-base @input-padding-horizontal;
Expand Down
7 changes: 5 additions & 2 deletions lib/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ var Input = function (_Component) {
return Input;
}(_react.Component);

exports.default = Input;


Input.defaultProps = {
defaultValue: '',
disabled: false,
Expand All @@ -197,6 +200,7 @@ Input.defaultProps = {

autosize: false
};

Input.propTypes = {
type: _react.PropTypes.string,
id: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]),
Expand All @@ -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;
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monkeyui",
"version": "0.1.8",
"version": "0.1.9",
"title": "monkeyui",
"description": "react components.",
"author": "bebeanan",
Expand Down

0 comments on commit c1e879c

Please sign in to comment.