rc-pagination
Advanced tools
Comparing version 1.4.2 to 1.5.0
@@ -0,10 +1,14 @@ | ||
1.5.0 / 2016-03-02 | ||
================== | ||
* Add `defaultPageSize` and fix `pageSize` to a controlled prop | ||
1.3.0 / 2015-11-25 | ||
================== | ||
* Add `defaultCurrent` prop | ||
* Add `defaultCurrent` prop | ||
1.2.0 | ||
================== | ||
### 1.2.0 | ||
* Allow specifying the page size for **sizeChanger** |
@@ -19,5 +19,5 @@ 'use strict'; | ||
next_page: 'Next Page', | ||
prev_5: 'Previsous 5 Pages', | ||
prev_5: 'Previous 5 Pages', | ||
next_5: 'Next 5 Pages' | ||
}; | ||
module.exports = exports['default']; |
@@ -95,3 +95,2 @@ 'use strict'; | ||
var Option = Select.Option; | ||
var defaultOption = props.pageSize || props.pageSizeOptions[0]; | ||
var options = props.pageSizeOptions.map(function (opt, i) { | ||
@@ -111,3 +110,3 @@ return React.createElement( | ||
optionLabelProp: 'children', | ||
defaultValue: '' + defaultOption, onChange: _this2._changeSize }, | ||
value: buildOptionText(props.pageSize), onChange: _this2._changeSize }, | ||
options | ||
@@ -114,0 +113,0 @@ ); |
@@ -40,6 +40,11 @@ 'use strict'; | ||
var pageSize = props.defaultPageSize; | ||
if ('pageSize' in props) { | ||
pageSize = props.pageSize; | ||
} | ||
this.state = { | ||
current: current, | ||
_current: current, | ||
pageSize: props.pageSize | ||
pageSize: pageSize | ||
}; | ||
@@ -120,19 +125,20 @@ | ||
value: function _changePageSize(size) { | ||
var current = this.state.current; | ||
if (typeof size === 'number') { | ||
var current = this.state.current; | ||
this.setState({ | ||
pageSize: size | ||
}); | ||
if (this.state.current > this._calcPage(size)) { | ||
current = this._calcPage(size); | ||
if (!('pageSize' in this.props)) { | ||
this.setState({ | ||
current: current, | ||
_current: current | ||
pageSize: size | ||
}); | ||
if (this.state.current > this._calcPage(size)) { | ||
current = this._calcPage(size); | ||
this.setState({ | ||
current: current, | ||
_current: current | ||
}); | ||
} | ||
} | ||
this.props.onShowSizeChange(current, size); | ||
} | ||
this.props.onShowSizeChange(current, size); | ||
} | ||
@@ -329,3 +335,3 @@ }, { | ||
current: this.state.current, | ||
pageSize: this.props.pageSize, | ||
pageSize: this.state.pageSize, | ||
pageSizeOptions: this.props.pageSizeOptions, | ||
@@ -345,2 +351,3 @@ quickGo: this.props.showQuickJumper ? this._handleChange.bind(this) : null }) | ||
pageSize: React.PropTypes.number, | ||
defaultPageSize: React.PropTypes.number, | ||
onChange: React.PropTypes.func, | ||
@@ -359,3 +366,3 @@ showSizeChanger: React.PropTypes.bool, | ||
total: 0, | ||
pageSize: 10, | ||
defaultPageSize: 10, | ||
onChange: noop, | ||
@@ -362,0 +369,0 @@ className: '', |
{ | ||
"name": "rc-pagination", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"description": "pagination ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -72,2 +72,3 @@ # rc-pagination | ||
| total | items total count | Number | 0 | | ||
| defaultPageSize | default items per page | Number | 10 | | ||
| pageSize | items per page | Number | 10 | | ||
@@ -82,2 +83,3 @@ | onChange | page change callback | Function | noop | | ||
| simple | when set, show simple pager | Object | null | | ||
| locale | to set l10n config | Object | [zh_CN](https://github.com/react-component/pagination/blob/master/src/locale/zh_CN.js) | | ||
@@ -84,0 +86,0 @@ ## Test Case |
31896
762
95