Socket
Socket
Sign inDemoInstall

rc-pagination

Package Overview
Dependencies
Maintainers
3
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-pagination - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4-beta

lib/KeyCode.js

145

lib/Options.js

@@ -5,13 +5,14 @@ 'use strict';

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var React = require('react');
var Select = require('rc-select');
var Option = Select.Option;
var KEYCODE = require('./KeyCode');
var Options = (function (_React$Component) {
_inherits(Options, _React$Component);
function Options(props) {

@@ -23,3 +24,9 @@ var _this = this;

_get(Object.getPrototypeOf(Options.prototype), 'constructor', this).call(this, props);
['_quickGo', '_changeSize'].map(function (method) {
this.state = {
current: props.current,
_current: props.current
};
['_handleChange', '_changeSize', '_go', '_buildOptionText'].forEach(function (method) {
return _this[method] = _this[method].bind(_this);

@@ -29,51 +36,91 @@ });

_inherits(Options, _React$Component);
_createClass(Options, [{
key: '_buildOptionText',
value: function _buildOptionText(value) {
return value + ' ' + this.props.locale.items_per_page;
}
}, {
key: '_changeSize',
value: function _changeSize(value) {
this.props.changeSize(Number(value));
}
}, {
key: '_handleChange',
value: function _handleChange(evt) {
var _val = evt.target.value;
_createClass(Options, [{
this.setState({
_current: _val
});
}
}, {
key: '_go',
value: function _go(e) {
var _val = e.target.value;
if (_val === '') {
return;
}
var val = Number(this.state._current);
if (isNaN(val)) {
val = this.state.current;
}
if (e.keyCode === KEYCODE.ENTER) {
var c = this.props.quickGo(val);
this.setState({
_current: c,
current: c
});
}
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
var props = this.props;
var state = this.state;
var locale = props.locale;
var prefixCls = props.rootPrefixCls + '-options';
var changeSize = props.changeSize;
var quickGo = props.quickGo;
var buildOptionText = props.buildOptionText || this._buildOptionText;
var Select = props.selectComponentClass;
var changeSelect = null;
var goInput = null;
if (changeSize) {
changeSelect = React.createElement(
Select,
{ prefixCls: props.selectPrefixCls, showSearch: false,
className: prefixCls + '-size-changer',
defaultValue: '10', onChange: this._changeSize },
React.createElement(
Option,
{ value: '10' },
'10 条/页'
),
React.createElement(
Option,
{ value: '20' },
'20 条/页'
),
React.createElement(
Option,
{ value: '30' },
'30 条/页'
),
React.createElement(
Option,
{ value: '40' },
'40 条/页'
)
);
if (!(changeSize || quickGo)) {
return null;
}
if (changeSize && Select) {
(function () {
var Option = Select.Option;
var defaultOption = props.pageSizeOptions[0];
var options = props.pageSizeOptions.map(function (opt, i) {
return React.createElement(
Option,
{ key: i, value: opt },
buildOptionText(opt)
);
});
changeSelect = React.createElement(
Select,
{
prefixCls: props.selectPrefixCls, showSearch: false,
className: prefixCls + '-size-changer',
optionLabelProp: 'children',
defaultValue: defaultOption, onChange: _this2._changeSize },
options
);
})();
}
if (quickGo) {
goInput = React.createElement(
'div',
{ className: prefixCls + '-quick-jumper' },
'跳至',
React.createElement('input', { type: 'text', value: props.current, onChange: this._quickGo }),
'页'
{ title: 'Quick jump to page', className: prefixCls + '-quick-jumper' },
locale.jump_to,
React.createElement('input', { type: 'text', value: state._current, onChange: this._handleChange.bind(this), onKeyUp: this._go.bind(this) }),
locale.page
);

@@ -89,12 +136,2 @@ }

}
}, {
key: '_changeSize',
value: function _changeSize(value) {
this.props.changeSize(Number(value));
}
}, {
key: '_quickGo',
value: function _quickGo(evt) {
this.props.quickGo(Number(evt.target.value));
}
}]);

@@ -108,7 +145,13 @@

quickGo: React.PropTypes.func,
selectComponentClass: React.PropTypes.func,
current: React.PropTypes.number,
pageSizeOptions: React.PropTypes.arrayOf(React.PropTypes.string),
buildOptionText: React.PropTypes.func,
locale: React.PropTypes.object
};
sizeChangerClass: React.PropTypes.bool,
current: React.PropTypes.number
Options.defaultProps = {
pageSizeOptions: ['10', '20', '30', '40']
};
module.exports = Options;

@@ -5,7 +5,7 @@ 'use strict';

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

@@ -15,2 +15,4 @@ var React = require('react');

var Pager = (function (_React$Component) {
_inherits(Pager, _React$Component);
function Pager() {

@@ -22,4 +24,2 @@ _classCallCheck(this, Pager);

_inherits(Pager, _React$Component);
_createClass(Pager, [{

@@ -29,2 +29,3 @@ key: 'render',

var props = this.props;
var locale = props.locale;
var prefixCls = props.rootPrefixCls + '-item';

@@ -36,5 +37,14 @@ var cls = prefixCls + ' ' + prefixCls + '-' + props.page;

}
var title = undefined;
if (props.page === 1) {
title = locale.first_page;
} else if (props.last) {
title = locale.last_page + ': ' + props.page;
} else {
title = props.page;
}
return React.createElement(
'li',
{ className: cls, onClick: props.onClick },
{ title: title, className: cls, onClick: props.onClick },
React.createElement(

@@ -54,5 +64,7 @@ 'a',

page: React.PropTypes.number,
active: React.PropTypes.bool
active: React.PropTypes.bool,
last: React.PropTypes.bool,
locale: React.PropTypes.object
};
module.exports = Pager;

@@ -5,7 +5,7 @@ 'use strict';

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

@@ -15,2 +15,4 @@ var React = require('react');

var Options = require('./Options');
var KEYCODE = require('./KeyCode');
var LOCALE = require('./locale/zh_CN');

@@ -20,2 +22,4 @@ function noop() {}

var Pagination = (function (_React$Component) {
_inherits(Pagination, _React$Component);
function Pagination(props) {

@@ -28,8 +32,20 @@ var _this = this;

var hasOnChange = props.onChange !== noop;
var hasCurrent = props.current !== -1;
if (hasCurrent && !hasOnChange) {
console.warn('Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.');
}
var current = props.defaultCurrent;
if ('current' in props) {
current = props.current;
}
this.state = {
current: props.current,
current: current,
_current: current,
pageSize: props.pageSize
};
['render', '_handleChange', '_simpleChange', '_changePageSize', '_isValid', '_prev', '_next', '_hasPrev', '_hasNext', '_jumpPrev', '_jumpNext', '_canJumpPrev', '_canJumpNext'].map(function (method) {
['render', '_handleChange', '_handleKeyUp', '_handleKeyDown', '_changePageSize', '_isValid', '_prev', '_next', '_hasPrev', '_hasNext', '_jumpPrev', '_jumpNext'].forEach(function (method) {
return _this[method] = _this[method].bind(_this);

@@ -39,4 +55,2 @@ });

_inherits(Pagination, _React$Component);
_createClass(Pagination, [{

@@ -57,6 +71,135 @@ key: 'componentWillReceiveProps',

}
// private methods
}, {
key: '_calcPage',
value: function _calcPage(p) {
var pageSize = p;
if (typeof pageSize === 'undefined') {
pageSize = this.state.pageSize;
}
return Math.floor((this.props.total - 1) / pageSize) + 1;
}
}, {
key: '_isValid',
value: function _isValid(page) {
return typeof page === 'number' && page >= 1 && page !== this.state.current;
}
}, {
key: '_handleKeyDown',
value: function _handleKeyDown(evt) {
if (evt.keyCode === KEYCODE.ARROW_UP || evt.keyCode === KEYCODE.ARROW_DOWN) {
evt.preventDefault();
}
}
}, {
key: '_handleKeyUp',
value: function _handleKeyUp(evt) {
var _val = evt.target.value;
var val = undefined;
if (_val === '') {
val = _val;
} else if (isNaN(Number(_val))) {
val = this.state._current;
} else {
val = Number(_val);
}
this.setState({
_current: val
});
if (evt.keyCode === KEYCODE.ENTER) {
this._handleChange(val);
} else if (evt.keyCode === KEYCODE.ARROW_UP) {
this._handleChange(val - 1);
} else if (evt.keyCode === KEYCODE.ARROW_DOWN) {
this._handleChange(val + 1);
}
}
}, {
key: '_changePageSize',
value: function _changePageSize(size) {
if (typeof size === 'number') {
var current = this.state.current;
this.setState({
pageSize: size
});
if (this.state.current > this._calcPage(size)) {
current = this._calcPage(size);
this.setState({
current: current,
_current: current
});
}
this.props.onShowSizeChange(current, size);
}
}
}, {
key: '_handleChange',
value: function _handleChange(p) {
var page = p;
if (this._isValid(page)) {
if (page > this._calcPage()) {
page = this._calcPage();
}
if (!('current' in this.props)) {
this.setState({
current: page,
_current: page
});
}
this.props.onChange(page);
return page;
}
return this.state.current;
}
}, {
key: '_prev',
value: function _prev() {
if (this._hasPrev()) {
this._handleChange(this.state.current - 1);
}
}
}, {
key: '_next',
value: function _next() {
if (this._hasNext()) {
this._handleChange(this.state.current + 1);
}
}
}, {
key: '_jumpPrev',
value: function _jumpPrev() {
this._handleChange(Math.max(1, this.state.current - 5));
}
}, {
key: '_jumpNext',
value: function _jumpNext() {
this._handleChange(Math.min(this._calcPage(), this.state.current + 5));
}
}, {
key: '_hasPrev',
value: function _hasPrev() {
return this.state.current > 1;
}
}, {
key: '_hasNext',
value: function _hasNext() {
return this.state.current < this._calcPage();
}
}, {
key: 'render',
value: function render() {
var props = this.props;
var locale = props.locale;

@@ -68,2 +211,4 @@ var prefixCls = props.prefixCls;

var jumpNext = null;
var firstPager = null;
var lastPager = null;

@@ -76,13 +221,9 @@ if (props.simple) {

'li',
{ onClick: this._prev, className: (this._hasPrev() ? '' : prefixCls + '-disabled ') + (prefixCls + '-prev') },
React.createElement(
'a',
null,
'‹'
)
{ title: locale.prev_page, onClick: this._prev, className: (this._hasPrev() ? '' : prefixCls + '-disabled ') + (prefixCls + '-prev') },
React.createElement('a', null)
),
React.createElement(
'div',
{ className: prefixCls + '-simple-pager' },
React.createElement('input', { type: 'text', value: this.state.current, onChange: this._simpleChange }),
{ title: this.state.current + '/' + allPages, className: prefixCls + '-simple-pager' },
React.createElement('input', { type: 'text', value: this.state._current, onKeyDown: this._handleKeyDown, onKeyUp: this._handleKeyUp, onChange: this._handleKeyUp }),
React.createElement(

@@ -97,8 +238,4 @@ 'span',

'li',
{ onClick: this._next, className: (this._hasNext() ? '' : prefixCls + '-disabled ') + (prefixCls + '-next') },
React.createElement(
'a',
null,
'›'
)
{ title: locale.next_page, onClick: this._next, className: (this._hasNext() ? '' : prefixCls + '-disabled ') + (prefixCls + '-next') },
React.createElement('a', null)
)

@@ -111,3 +248,3 @@ );

var active = this.state.current === i;
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
pagerList.push(React.createElement(Pager, { locale: locale, rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
}

@@ -117,3 +254,3 @@ } else {

'li',
{ key: 'prev', onClick: this._jumpPrev, className: prefixCls + '-jump-prev' },
{ title: locale.prev_5, key: 'prev', onClick: this._jumpPrev, className: prefixCls + '-jump-prev' },
React.createElement('a', null)

@@ -123,36 +260,45 @@ );

'li',
{ key: 'next', onClick: this._jumpNext, className: prefixCls + '-jump-next' },
{ title: locale.next_5, key: 'next', onClick: this._jumpNext, className: prefixCls + '-jump-next' },
React.createElement('a', null)
);
lastPager = React.createElement(Pager, {
locale: props.locale,
last: true, rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, allPages), key: allPages, page: allPages, active: false });
firstPager = React.createElement(Pager, {
locale: props.locale,
rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, 1), key: 1, page: 1, active: false });
var current = this.state.current;
// TODO: need optimization
if (current <= 5) {
// do not show first •••
for (var i = 1; i <= 5; i++) {
var active = current === i;
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
}
var left = Math.max(1, current - 2);
var right = Math.min(current + 2, allPages);
if (current - 1 <= 2) {
right = 1 + 4;
}
if (allPages - current <= 2) {
left = allPages - 4;
}
for (var i = left; i <= right; i++) {
var active = current === i;
pagerList.push(React.createElement(Pager, {
locale: props.locale,
rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
}
if (current - 1 >= 4) {
pagerList.unshift(jumpPrev);
}
if (allPages - current >= 4) {
pagerList.push(jumpNext);
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, allPages), key: allPages, page: allPages, active: false }));
} else if (allPages - current < 5) {
// do not show last •••
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, 1), key: 1, page: 1, active: false }));
pagerList.push(jumpPrev);
for (var i = allPages - 4; i <= allPages; i++) {
var active = current === i;
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
}
} else {
// show both •••
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, 1), key: 1, page: 1, active: false }));
pagerList.push(jumpPrev);
for (var i = current - 2; i <= current + 2; i++) {
var active = current === i;
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
}
pagerList.push(jumpNext);
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, allPages), key: allPages, page: allPages, active: false }));
}
if (left !== 1) {
pagerList.unshift(firstPager);
}
if (right !== allPages) {
pagerList.push(lastPager);
}
}

@@ -166,8 +312,4 @@

'li',
{ onClick: this._prev, className: (this._hasPrev() ? '' : prefixCls + '-disabled ') + (prefixCls + '-prev') },
React.createElement(
'a',
null,
'‹'
)
{ title: locale.prev_page, onClick: this._prev, className: (this._hasPrev() ? '' : prefixCls + '-disabled ') + (prefixCls + '-prev') },
React.createElement('a', null)
),

@@ -177,97 +319,16 @@ pagerList,

'li',
{ onClick: this._next, className: (this._hasNext() ? '' : prefixCls + '-disabled ') + (prefixCls + '-next') },
React.createElement(
'a',
null,
'›'
)
{ title: locale.next_page, onClick: this._next, className: (this._hasNext() ? '' : prefixCls + '-disabled ') + (prefixCls + '-next') },
React.createElement('a', null)
),
React.createElement(Options, { rootPrefixCls: prefixCls,
React.createElement(Options, {
locale: props.locale,
rootPrefixCls: prefixCls,
selectComponentClass: props.selectComponentClass,
selectPrefixCls: props.selectPrefixCls,
changeSize: this.props.showSizeChanger ? this._changePageSize.bind(this) : null, current: this.state.current, quickGo: this.props.showQuickJumper ? this._handleChange.bind(this) : null })
changeSize: this.props.showSizeChanger ? this._changePageSize.bind(this) : null,
current: this.state.current,
pageSizeOptions: this.props.pageSizeOptions,
quickGo: this.props.showQuickJumper ? this._handleChange.bind(this) : null })
);
}
}, {
key: '_calcPage',
// private methods
value: function _calcPage() {
return Math.floor((this.props.total - 1) / this.state.pageSize);
}
}, {
key: '_isValid',
value: function _isValid(page) {
return typeof page === 'number'; // && page >= 1 && page <= this._calcPage();
}
}, {
key: '_changePageSize',
value: function _changePageSize(size) {
if (typeof size === 'number') {
this.setState({
pageSize: size
});
}
}
}, {
key: '_simpleChange',
value: function _simpleChange(evt) {
this._handleChange(Number(evt.target.value));
}
}, {
key: '_handleChange',
value: function _handleChange(page) {
if (this._isValid(page)) {
this.setState({ current: page });
this.props.onChange(page);
}
}
}, {
key: '_prev',
value: function _prev() {
if (this._hasPrev()) {
this._handleChange(this.state.current - 1);
}
}
}, {
key: '_next',
value: function _next() {
if (this._hasNext()) {
this._handleChange(this.state.current + 1);
}
}
}, {
key: '_jumpPrev',
value: function _jumpPrev() {
if (this._canJumpPrev()) {
this._handleChange(this.state.current - 5);
}
}
}, {
key: '_jumpNext',
value: function _jumpNext() {
if (this._canJumpNext()) {
this._handleChange(this.state.current + 5);
}
}
}, {
key: '_hasPrev',
value: function _hasPrev() {
return this.state.current > 1;
}
}, {
key: '_hasNext',
value: function _hasNext() {
return this.state.current < this._calcPage();
}
}, {
key: '_canJumpPrev',
value: function _canJumpPrev() {
return this.state.current > 5;
}
}, {
key: '_canJumpNext',
value: function _canJumpNext() {
return this._calcPage() - this.state.current > 5;
}
}]);

@@ -280,2 +341,3 @@

current: React.PropTypes.number,
defaultCurrent: React.PropTypes.number,
total: React.PropTypes.number,

@@ -285,7 +347,12 @@ pageSize: React.PropTypes.number,

showSizeChanger: React.PropTypes.bool,
showQuickJumper: React.PropTypes.bool
onShowSizeChange: React.PropTypes.func,
selectComponentClass: React.PropTypes.func,
showQuickJumper: React.PropTypes.bool,
pageSizeOptions: React.PropTypes.arrayOf(React.PropTypes.string),
locale: React.PropTypes.object
};
Pagination.defaultProps = {
current: 1,
defaultCurrent: 1,
total: 0,

@@ -297,6 +364,9 @@ pageSize: 10,

prefixCls: 'rc-pagination',
selectComponentClass: null,
showQuickJumper: false,
showSizeChanger: false
showSizeChanger: false,
onShowSizeChange: noop,
locale: LOCALE
};
module.exports = Pagination;
{
"name": "rc-pagination",
"version": "1.3.3",
"version": "1.3.4-beta",
"description": "pagination ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

@@ -69,3 +69,4 @@ # rc-pagination

|------------------|------------------------------------|---------------|--------------------------|
| current | current page | Number | 1 |
| defaultCurrent | uncontrolled current page | Number | 1 |
| current | current page | Number | undefined |
| total | items total count | Number | 0 |

@@ -72,0 +73,0 @@ | pageSize | items per page | Number | 10 |

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc