Socket
Socket
Sign inDemoInstall

rc-pagination

Package Overview
Dependencies
Maintainers
1
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.0.10 to 1.1.0

15

lib/Options.js

@@ -16,4 +16,2 @@ 'use strict';

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

@@ -30,2 +28,4 @@ var _this = this;

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

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

var props = this.props;
var prefixCls = props.rootPrefixCls + '-options';
var changeSize = props.changeSize;

@@ -43,7 +44,7 @@ var quickGo = props.quickGo;

if (changeSize) {
var changerClass = props.sizeChangerClass;
changeSelect = React.createElement(
Select,
{ prefixCls: changerClass ? 'ant-select' : 'rc-select', showSearch: false, className: 'size-changer', defaultValue: '10', onChange: this._changeSize },
{ prefixCls: props.selectPrefixCls, showSearch: false,
className: prefixCls + '-size-changer',
defaultValue: '10', onChange: this._changeSize },
React.createElement(

@@ -75,3 +76,3 @@ Option,

'div',
{ className: 'quick-jumper' },
{ className: prefixCls + '-quick-jumper' },
'跳至',

@@ -85,3 +86,3 @@ React.createElement('input', { type: 'text', value: props.current, onChange: this._quickGo }),

'div',
{ className: 'options' },
{ className: '' + prefixCls },
changeSelect,

@@ -88,0 +89,0 @@ goInput

@@ -14,4 +14,2 @@ 'use strict';

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

@@ -23,2 +21,4 @@ _classCallCheck(this, Pager);

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

@@ -28,7 +28,7 @@ key: 'render',

var props = this.props;
var prefixCls = 'rc-pagination-item';
var prefixCls = props.rootPrefixCls + '-item';
var cls = prefixCls + ' ' + prefixCls + '-' + props.page;
if (props.active) {
cls = cls + ' active';
cls = cls + ' ' + prefixCls + '-active';
}

@@ -35,0 +35,0 @@ return React.createElement(

@@ -18,4 +18,2 @@ 'use strict';

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

@@ -38,13 +36,25 @@ var _this = this;

_inherits(Pagination, _React$Component);
_createClass(Pagination, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if ('current' in nextProps) {
this.setState({
current: nextProps.current
});
}
if ('pageSize' in nextProps) {
this.setState({
pageSize: nextProps.pageSize
});
}
}
}, {
key: 'render',
value: function render() {
var prefixCls = 'rc-pagination';
var props = this.props;
if (props.className) {
prefixCls = prefixCls + ' ' + props.className;
}
var prefixCls = props.prefixCls;
var allPages = this._calcPage();

@@ -58,6 +68,6 @@ var pagerList = [];

'ul',
{ className: prefixCls + ' simple' },
{ className: prefixCls + ' ' + prefixCls + '-simple ' + props.className },
React.createElement(
'li',
{ onClick: this._prev, className: (this._hasPrev() ? '' : 'disabled ') + 'prev' },
{ onClick: this._prev, className: (this._hasPrev() ? '' : prefixCls + '-disabled ') + (prefixCls + '-prev') },
React.createElement(

@@ -71,7 +81,7 @@ 'a',

'div',
{ className: 'simple-pager' },
{ className: prefixCls + '-simple-pager' },
React.createElement('input', { type: 'text', value: this.state.current, onChange: this._simpleChange }),
React.createElement(
'span',
{ className: 'slash' },
{ className: prefixCls + '-slash' },
'/'

@@ -83,3 +93,3 @@ ),

'li',
{ onClick: this._next, className: (this._hasNext() ? '' : 'disabled ') + 'next' },
{ onClick: this._next, className: (this._hasNext() ? '' : prefixCls + '-disabled ') + (prefixCls + '-next') },
React.createElement(

@@ -97,3 +107,3 @@ 'a',

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

@@ -103,3 +113,3 @@ } else {

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

@@ -109,3 +119,3 @@ );

'li',
{ key: 'next', onClick: this._jumpNext, className: 'jump-next' },
{ key: 'next', onClick: this._jumpNext, className: prefixCls + '-jump-next' },
React.createElement('a', null)

@@ -121,24 +131,24 @@ );

var active = current === i;
pagerList.push(React.createElement(Pager, { onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
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, { onClick: this._handleChange.bind(this, allPages), key: allPages, page: allPages, active: false }));
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, { onClick: this._handleChange.bind(this, 1), key: 1, page: 1, active: false }));
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, { onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
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, { onClick: this._handleChange.bind(this, 1), key: 1, page: 1, active: false }));
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, { onClick: this._handleChange.bind(this, i), key: i, page: i, active: active }));
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, { onClick: this._handleChange.bind(this, allPages), key: allPages, page: allPages, active: false }));
pagerList.push(React.createElement(Pager, { rootPrefixCls: prefixCls, onClick: this._handleChange.bind(this, allPages), key: allPages, page: allPages, active: false }));
}

@@ -149,6 +159,7 @@ }

'ul',
{ className: prefixCls },
{ className: prefixCls + ' ' + props.className,
unselectable: 'unselectable' },
React.createElement(
'li',
{ onClick: this._prev, className: (this._hasPrev() ? '' : 'disabled ') + 'prev' },
{ onClick: this._prev, className: (this._hasPrev() ? '' : prefixCls + '-disabled ') + (prefixCls + '-prev') },
React.createElement(

@@ -163,3 +174,3 @@ 'a',

'li',
{ onClick: this._next, className: (this._hasNext() ? '' : 'disabled ') + 'next' },
{ onClick: this._next, className: (this._hasNext() ? '' : prefixCls + '-disabled ') + (prefixCls + '-next') },
React.createElement(

@@ -171,3 +182,5 @@ 'a',

),
React.createElement(Options, { sizeChangerClass: props.className, changeSize: this.props.showSizeChanger ? this._changePageSize.bind(this) : null, current: this.state.current, quickGo: this.props.showQuickJumper ? this._handleChange.bind(this) : null })
React.createElement(Options, { rootPrefixCls: prefixCls,
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 })
);

@@ -268,3 +281,2 @@ }

onChange: React.PropTypes.func,
showSizeChanger: React.PropTypes.bool,

@@ -279,3 +291,5 @@ showQuickJumper: React.PropTypes.bool

onChange: noop,
className: '',
selectPrefixCls: 'rc-select',
prefixCls: 'rc-pagination',
showQuickJumper: false,

@@ -282,0 +296,0 @@ showSizeChanger: false

{
"name": "rc-pagination",
"version": "1.0.10",
"version": "1.1.0",
"description": "pagination ui component for react",

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

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