提交 465c8c2c 编写于 作者: Y yiminghe

add input-number

上级 63dca064
# 基本
- order: 0
数字输入框
---
````jsx
var InputNumber = antd.InputNumber;
function onChange(v){
console.log('changed',v);
}
React.render(
<div><InputNumber min={1} max={10} defaultValue={3} onChange={onChange} style={{width:100}}/></div>
, document.getElementById('components-inputnumber-demo-basic'));
````
var InputNumber = require('rc-input-number');
var React = require('react');
var AntInputNumber = React.createClass({
getDefaultProps() {
return {
prefixCls: 'ant-input-number'
};
},
render() {
return <InputNumber {...this.props}/>;
}
});
module.exports = AntInputNumber;
# InputNumber
- category: Components
- chinese: 数字输入框
---
通过鼠标或键盘,输入范围内的数值。
## 何时使用
- 当需要获取标准数值时。
## API
属性如下
| 成员 | 说明 | 类型 | 默认值 |
|-------------|----------------|--------------------|--------------|
| min | 最小值 | Number | -Infinity |
| max | 最大值 | Number | Infinity |
| value | 当前值 | Number | |
| defaultValue | 初始值 | Number | |
| onChange | 变化回调 | Function | |
| disabled | 禁用 | Boolean | |
| style | 根节点样式 | Object |
\ No newline at end of file
# InputNumber
- category: Components
- chinese: 数字输入框
---
通过鼠标或键盘,输入范围内的数值。
## 何时使用
- 当需要获取标准数值时。
...@@ -12,7 +12,8 @@ var antd = { ...@@ -12,7 +12,8 @@ var antd = {
Select: require('./components/select'), Select: require('./components/select'),
Popconfirm: require('./components/popconfirm'), Popconfirm: require('./components/popconfirm'),
confirm: require('./components/modal/confirm'), confirm: require('./components/modal/confirm'),
Steps: require('./components/steps') Steps: require('./components/steps'),
InputNumber: require('./components/input-number')
}; };
module.exports = window.antd = antd; module.exports = window.antd = antd;
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
{% block styles %}{% endblock %} {% block styles %}{% endblock %}
<link rel="stylesheet" href="/static/style.css"> <link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="/static/tomorrow.css"> <link rel="stylesheet" href="/static/tomorrow.css">
<script src="https://a.alipayobjects.com/??jquery/jquery/1.11.1/jquery.js,es5-shim/4.0.5/es5-shim.js,es5-shim/4.0.5/es5-sham.js,html5shiv/3.7.2/src/html5shiv.js,react/0.13.3/react.min.js,bluebird/2.9.30/bluebird.js"></script> <script src="https://a.alipayobjects.com/??jquery/jquery/1.11.1/jquery.js,es5-shim/4.0.5/es5-shim.js,es5-shim/4.0.5/es5-sham.js,html5shiv/3.7.2/src/html5shiv.js,react/0.13.3/react.js,bluebird/2.9.30/bluebird.js"></script>
<script src="/static/script.js"></script> <script src="/static/script.js"></script>
{% block scripts %}{% endblock %} {% block scripts %}{% endblock %}
</head> </head>
......
...@@ -11,4 +11,5 @@ ...@@ -11,4 +11,5 @@
@import "form"; @import "form";
@import "loading"; @import "loading";
@import "progress"; @import "progress";
@import "steps"; @import "steps";
\ No newline at end of file @import "inputNumber";
\ No newline at end of file
@inputNumberPrefixCls: ant-input-number;
@import "../mixins/iconfont";
.@{inputNumberPrefixCls} {
margin: 0;
padding: 0;
line-height: 26px;
font-size: 12px;
height: 26px;
display: inline-block;
vertical-align: middle;
border: 1px solid #D9D9D9;
border-radius: 5px;
&-handler {
text-align: center;
line-height: 12px;
height: 12px;
overflow: hidden;
}
&-handler-up-inner, &-handler-down-inner {
color: #666666;
user-select: none;
-webkit-user-select: none;
}
&:hover {
border-color: #23c0fa;
.@{inputNumberPrefixCls}-handler-up, .@{inputNumberPrefixCls}-handler-wrap {
border-color: #23c0fa;
}
}
&-disabled:hover {
border-color: #d9d9d9;
.@{inputNumberPrefixCls}-handler-up, .@{inputNumberPrefixCls}-handler-wrap {
border-color: #d9d9d9;
}
}
&-input-wrap {
overflow: hidden;
height: 26px;
}
&-input {
width: 100%;
text-align: center;
outline: 0;
-moz-appearance: textfield;
line-height: 26px;
height: 24px;
transition: all 0.3s ease;
color: #666666;
border: 0;
border-radius: 5px;
padding: 0;
}
&-handler-wrap {
float: right;
border-left: 1px solid #D9D9D9;
width: 20px;
height: 26px;
}
&-handler-up {
border-bottom: 1px solid #D9D9D9;
&-inner {
.iconfont-mixin();
top:-2px;
&:before {
content: "\e611";
transform: rotate(270deg) scale(0.8);
}
}
}
&-handler-down {
&-inner {
.iconfont-mixin();
&:before {
content: "\e611";
transform: rotate(90deg) scale(0.8);
}
}
}
.handler-disabled() {
opacity: 0.72;
&:hover {
color: #999;
border-color: #d9d9d9;
}
}
&-handler-down-disabled, &-handler-up-disabled {
.handler-disabled();
}
&-disabled {
.@{inputNumberPrefixCls}-input {
opacity: 0.72;
cursor: not-allowed;
background-color: #f3f3f3;
}
.@{inputNumberPrefixCls}-handler {
.handler-disabled();
}
}
}
@import "../mixins/iconfont";
// font-face // font-face
// @icon-url: 字体源文件的地址 // @icon-url: 字体源文件的地址
@font-face { @font-face {
...@@ -10,22 +12,7 @@ ...@@ -10,22 +12,7 @@
} }
.@{iconfont-css-prefix} { .@{iconfont-css-prefix} {
position: relative; .iconfont-mixin();
display: inline-block;
font-style: normal;
vertical-align: baseline;
text-align: center;
text-transform: none;
text-rendering: auto;
// 更好地渲染字体
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0px;
-moz-osx-font-smoothing: grayscale;
&:before {
display: block;
font-family: "anticon" !important;
}
} }
// 方向性图标 // 方向性图标
.@{iconfont-css-prefix}-step-backward:before {content:"\e662";} .@{iconfont-css-prefix}-step-backward:before {content:"\e662";}
......
.iconfont-mixin() {
position: relative;
display: inline-block;
font-style: normal;
vertical-align: baseline;
text-align: center;
text-transform: none;
text-rendering: auto;
// 更好地渲染字体
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0px;
-moz-osx-font-smoothing: grayscale;
&:before {
display: block;
font-family: "anticon" !important;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册