Merge branch 'master' into new-design-spec

This commit is contained in:
afc163 2016-01-11 11:37:09 +08:00
commit 15b2e92df1
6 changed files with 31 additions and 22 deletions

View File

@ -19,15 +19,16 @@
<Pagination onChange={onChange} total={50} />
```
| 参数 | 说明 | 类型 | 默认值 |
|------------------|------------------------------------|----------|----------------|
| current | 当前页数 | Number | 无 |
| defaultCurrent | 默认的当前页数 | Number | 1 |
| total | 数据总数 | Number | 0 |
| pageSize | 每页条数 | Number | 10 |
| onChange | 页码改变的回调,参数是改变后的页码 | Function | noop |
| showSizeChanger | 是否可以改变 pageSize | Bool | false |
| onShowSizeChange | pageSize 变化的回调 | Function | noop |
| showQuickJumper | 是否可以快速跳转至某页 | Bool | false |
| size | 当为「small」时是小尺寸分页 | String | "" |
| simple | 当添加该属性时,显示为简单分页 | Object | 无 |
| 参数 | 说明 | 类型 | 默认值 |
|------------------|------------------------------------|---------------|--------------------------|
| current | 当前页数 | Number | 无 |
| defaultCurrent | 默认的当前页数 | Number | 1 |
| total | 数据总数 | Number | 0 |
| pageSize | 每页条数 | Number | 10 |
| onChange | 页码改变的回调,参数是改变后的页码 | Function | noop |
| showSizeChanger | 是否可以改变 pageSize | Bool | false |
| pageSizeOptions | 指定每页可以显示多少条 | Array<String> | ['10', '20', '30', '40'] |
| onShowSizeChange | pageSize 变化的回调 | Function | noop |
| showQuickJumper | 是否可以快速跳转至某页 | Bool | false |
| size | 当为「small」时是小尺寸分页 | String | "" |
| simple | 当添加该属性时,显示为简单分页 | Object | 无 |

View File

@ -39,6 +39,9 @@ const pagination = {
showSizeChanger: true,
onShowSizeChange: function(current, pageSize) {
console.log('Current: ', current, '; PageSize: ', pageSize);
},
onChange: function(current) {
console.log('Current: ', current);
}
};

View File

@ -19,6 +19,13 @@ const defaultLocale = {
emptyText: '暂无数据',
};
const defaultPagination = {
pageSize: 10,
current: 1,
onChange: noop,
onShowSizeChange: noop,
};
let AntTable = React.createClass({
getInitialState() {
return {
@ -30,10 +37,9 @@ let AntTable = React.createClass({
sortOrder: '',
sorter: null,
radioIndex: null,
pagination: this.hasPagination() ? objectAssign({
pageSize: 10,
current: 1
}, this.props.pagination) : {}
pagination: this.hasPagination() ?
objectAssign({}, defaultPagination, this.props.pagination) :
{},
};
},
@ -253,6 +259,8 @@ let AntTable = React.createClass({
} else {
pagination.current = pagination.current || 1;
}
pagination.onChange(pagination.current);
const newState = {
selectionDirty: false,
pagination
@ -423,9 +431,7 @@ let AntTable = React.createClass({
handleShowSizeChange(current, pageSize) {
const pagination = this.state.pagination;
if (pagination.onShowSizeChange) {
pagination.onShowSizeChange(current, pageSize);
}
pagination.onShowSizeChange(current, pageSize);
let nextPagination = objectAssign(pagination, {
pageSize: pageSize

View File

@ -15,7 +15,6 @@ const AntTimePicker = React.createClass({
align: {
offset: [0, -2],
},
open: false,
disabled: false,
disabledHours: undefined,
disabledMinutes: undefined,

View File

@ -1,5 +1,5 @@
.@{timepicker-prefix-cls}-panel {
min-width: 168px;
max-width: 168px;
z-index: 1070;
position: absolute;

View File

@ -70,7 +70,7 @@ a {
}
&[disabled] {
// color: @grey-200;
color: #ccc;
cursor: not-allowed;
pointer-events: none;
}