function PaginationBoxView(props) { _classCallCheck(this, PaginationBoxView); var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(PaginationBoxView).call(this, props)); _this.handlePreviousPage = function (evt) { evt.preventDefault ? evt.preventDefault() : evt.returnValue = false; if (_this.state.selected > 0) { _this.handlePageSelected(_this.state.selected - 1, evt); } }; _this.handleNextPage = function (evt) { evt.preventDefault ? evt.preventDefault() : evt.returnValue = false; if (_this.state.selected < _this.props.pageCount - 1) { _this.handlePageSelected(_this.state.selected + 1, evt); } }; _this.handlePageSelected = function (selected, evt) { evt.preventDefault ? evt.preventDefault() : evt.returnValue = false; if (_this.state.selected === selected) return; _this.setState({ selected: selected }); // Call the callback with the new selected item: _this.callCallback(selected); }; _this.callCallback = function (selectedItem) { if (typeof _this.props.onPageChange !== "undefined" && typeof _this.props.onPageChange === "function") { _this.props.onPageChange({ selected: selectedItem }); } }; _this.pagination = function () { var items = {}; if (_this.props.pageCount <= _this.props.pageRangeDisplayed) { for (var index = 0; index < _this.props.pageCount; index++) { items['key' + index] = _this.getPageElement(index); } } else { var leftSide = _this.props.pageRangeDisplayed / 2; var rightSide = _this.props.pageRangeDisplayed - leftSide; if (_this.state.selected > _this.props.pageCount - _this.props.pageRangeDisplayed / 2) { rightSide = _this.props.pageCount - _this.state.selected; leftSide = _this.props.pageRangeDisplayed - rightSide; } else if (_this.state.selected < _this.props.pageRangeDisplayed / 2) { leftSide = _this.state.selected; rightSide = _this.props.pageRangeDisplayed - leftSide; } var _index = void 0; var page = void 0; var breakView = void 0; for (_index = 0; _index < _this.props.pageCount; _index++) { page = _index + 1; var pageView = _this.getPageElement(_index); if (page <= _this.props.marginPagesDisplayed) { items['key' + _index] = pageView; continue; } if (page > _this.props.pageCount - _this.props.marginPagesDisplayed) { items['key' + _index] = pageView; continue; } if (_index >= _this.state.selected - leftSide && _index <= _this.state.selected + rightSide) { items['key' + _index] = pageView; continue; } var keys = Object.keys(items); var breakLabelKey = keys[keys.length - 1]; var breakLabelValue = items[breakLabelKey]; if (_this.props.breakLabel && breakLabelValue !== breakView) { breakView = _react2.default.createElement(_BreakView2.default, { breakLabel: _this.props.breakLabel, breakClassName: _this.props.breakClassName }); items['key' + _index] = breakView; } } } return items; }; _this.state = { selected: props.initialPage ? props.initialPage : props.forcePage ? props.forcePage : 0 }; return _this; }
n/a
propTypes.containerClassName = function () { [native code] }
n/a
propTypes.disableInitialCallback = function () { [native code] }
n/a
propTypes.hrefBuilder = function () { [native code] }
n/a
propTypes.initialPage = function () { [native code] }
n/a
propTypes.previousLabel = function () { [native code] }
n/a
activeClassName = function () { [native code] }
n/a
breakClassName = function () { [native code] }
n/a
breakLabel = function () { [native code] }
n/a
containerClassName = function () { [native code] }
n/a
disableInitialCallback = function () { [native code] }
n/a
disabledClassName = function () { [native code] }
n/a
forcePage = function () { [native code] }
n/a
hrefBuilder = function () { [native code] }
...
this.setState({ selected: nextProps.forcePage });
}
}
}, {
key: 'hrefBuilder',
value: function hrefBuilder(pageIndex) {
if (this.props.hrefBuilder && pageIndex !== this.state.selected && pageIndex >= 0 && pageIndex
< this.props.pageCount) {
return this.props.hrefBuilder(pageIndex + 1);
}
}
}, {
key: 'getPageElement',
value: function getPageElement(index) {
return _react2.default.createElement(_PageView2.default, {
onClick: this.handlePageSelected.bind(null, index),
...
initialPage = function () { [native code] }
n/a
marginPagesDisplayed = function () { [native code] }
n/a
nextClassName = function () { [native code] }
n/a
nextLabel = function () { [native code] }
n/a
nextLinkClassName = function () { [native code] }
n/a
onPageChange = function () { [native code] }
...
// Call the callback with the new selected item:
_this.callCallback(selected);
};
_this.callCallback = function (selectedItem) {
if (typeof _this.props.onPageChange !== "undefined" && typeof _this.props.onPageChange === "function"
;) {
_this.props.onPageChange({ selected: selectedItem });
}
};
_this.pagination = function () {
var items = {};
if (_this.props.pageCount <= _this.props.pageRangeDisplayed) {
...
pageClassName = function () { [native code] }
n/a
pageCount = function () { [native code] }
n/a
pageLinkClassName = function () { [native code] }
n/a
pageRangeDisplayed = function () { [native code] }
n/a
previousClassName = function () { [native code] }
n/a
previousLabel = function () { [native code] }
n/a
previousLinkClassName = function () { [native code] }
n/a
containerClassName = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a
disableInitialCallback = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a
hrefBuilder = function () { [native code] }
...
this.setState({ selected: nextProps.forcePage });
}
}
}, {
key: 'hrefBuilder',
value: function hrefBuilder(pageIndex) {
if (this.props.hrefBuilder && pageIndex !== this.state.selected && pageIndex >= 0 && pageIndex
< this.props.pageCount) {
return this.props.hrefBuilder(pageIndex + 1);
}
}
}, {
key: 'getPageElement',
value: function getPageElement(index) {
return _react2.default.createElement(_PageView2.default, {
onClick: this.handlePageSelected.bind(null, index),
...
isRequired = function () { [native code] }
n/a
initialPage = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a
previousLabel = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a