2015-07-23 22:23:11 +08:00
|
|
|
import React from 'react';
|
2016-03-21 21:16:38 +08:00
|
|
|
import RcPagination from 'rc-pagination';
|
2015-12-04 14:19:06 +08:00
|
|
|
import Select from '../select';
|
2015-11-16 14:10:42 +08:00
|
|
|
import zhCN from './locale/zh_CN';
|
2015-07-13 01:04:05 +08:00
|
|
|
|
2015-12-04 14:37:30 +08:00
|
|
|
class MiniSelect extends React.Component {
|
2016-03-29 14:01:10 +08:00
|
|
|
static Option = Select.Option;
|
|
|
|
|
2015-12-04 14:19:06 +08:00
|
|
|
render() {
|
|
|
|
return <Select size="small" {...this.props} />;
|
|
|
|
}
|
2015-12-04 14:37:30 +08:00
|
|
|
}
|
2015-12-04 14:19:06 +08:00
|
|
|
|
2016-03-21 21:16:38 +08:00
|
|
|
export default class Pagination extends React.Component {
|
2016-03-29 14:01:10 +08:00
|
|
|
static defaultProps = {
|
|
|
|
locale: zhCN,
|
|
|
|
className: '',
|
|
|
|
prefixCls: 'ant-pagination',
|
|
|
|
}
|
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
antLocale: React.PropTypes.object,
|
|
|
|
}
|
|
|
|
|
2015-07-13 01:04:05 +08:00
|
|
|
render() {
|
2015-10-22 21:01:52 +08:00
|
|
|
let className = this.props.className;
|
2015-12-05 13:34:55 +08:00
|
|
|
let selectComponentClass = Select;
|
2015-12-04 14:19:06 +08:00
|
|
|
|
2016-03-03 16:28:02 +08:00
|
|
|
let locale;
|
2016-03-05 16:39:27 +08:00
|
|
|
if (this.context.antLocale && this.context.antLocale.Pagination) {
|
|
|
|
locale = this.context.antLocale.Pagination;
|
2016-03-03 16:28:02 +08:00
|
|
|
} else {
|
|
|
|
locale = this.props.locale;
|
|
|
|
}
|
|
|
|
|
2015-10-22 21:01:52 +08:00
|
|
|
if (this.props.size === 'small') {
|
|
|
|
className += ' mini';
|
2015-12-05 13:34:55 +08:00
|
|
|
selectComponentClass = MiniSelect;
|
2015-10-22 21:01:52 +08:00
|
|
|
}
|
2015-12-04 14:19:06 +08:00
|
|
|
|
2016-01-07 14:21:29 +08:00
|
|
|
return (
|
2016-03-21 21:16:38 +08:00
|
|
|
<RcPagination selectComponentClass={selectComponentClass}
|
2016-01-07 17:46:46 +08:00
|
|
|
selectPrefixCls="ant-select"
|
|
|
|
{...this.props}
|
2016-03-03 16:28:02 +08:00
|
|
|
locale={locale}
|
2016-01-07 17:46:46 +08:00
|
|
|
className={className} />
|
2016-01-07 14:21:29 +08:00
|
|
|
);
|
2015-07-13 01:04:05 +08:00
|
|
|
}
|
|
|
|
}
|