choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
94 lines (75 loc) • 2.53 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
function _createSuper(Derived) {
function isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
return function () {
var Super = _getPrototypeOf(Derived),
result;
if (isNativeReflectConstruct()) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
import React, { PureComponent } from 'react';
import Button from '../button/Button';
import { ButtonColor, FuncType } from '../button/enum';
var Pager =
/*#__PURE__*/
function (_PureComponent) {
_inherits(Pager, _PureComponent);
var _super = _createSuper(Pager);
function Pager() {
var _this;
_classCallCheck(this, Pager);
_this = _super.apply(this, arguments);
_this.handleClick = function () {
var _this$props = _this.props,
page = _this$props.page,
onClick = _this$props.onClick;
if (onClick) {
onClick(page);
}
};
return _this;
}
_createClass(Pager, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
active = _this$props2.active,
renderer = _this$props2.renderer,
page = _this$props2.page,
type = _this$props2.type,
disabled = _this$props2.disabled,
className = _this$props2.className;
return React.createElement(Button, {
className: className,
funcType: active ? FuncType.raised : FuncType.flat,
onClick: this.handleClick,
color: active ? ButtonColor.primary : undefined,
disabled: disabled
}, renderer(page, type));
}
}]);
return Pager;
}(PureComponent);
export { Pager as default };
Pager.displayName = 'Pager';
//# sourceMappingURL=Pager.js.map