Repository URL to install this package:
|
Version:
4.0.116 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const mobx_react_1 = require("xmobx/mobx-react");
const typings_1 = require("./typings");
const styled_1 = require("./styled");
const renderProps_1 = require("./renderProps");
let Pagination = class Pagination extends React.Component {
constructor() {
super(...arguments);
this.state = this.props.state || new typings_1.State(this.props);
this.handlePage = event => {
const val = event.target.value;
this.state.setValue(val);
};
this.handleSize = event => {
const val = event.target.value;
this.state.setSize(val);
};
}
render() {
const {
nowrap,
renderArrows,
renderLimit,
renderSelector
} = this.props;
const Wrapper = nowrap ? React.Fragment : styled_1.PaginationWrapper;
const SelectWrapper = nowrap ? React.Fragment : styled_1.SelectBox;
return React.createElement(Wrapper, null, renderLimit(this.props, this.state, this.handleSize), React.createElement(SelectWrapper, null, renderSelector(this.props, this.state, this.handlePage), renderArrows(this.props, this.state)));
}
};
Pagination.defaultProps = {
renderArrows: renderProps_1.defaultRenderArrows,
renderLimit: renderProps_1.defaultRenderLimit,
renderOption: renderProps_1.defaultRenderOption,
renderSelector: renderProps_1.defaultRenderSelector
};
Pagination = tslib_1.__decorate([mobx_react_1.observer], Pagination);
exports.Pagination = Pagination;
exports.default = Pagination; //# sourceMappingURL=Pagination.js.map