fix wrong HOC for SortWrapper (#148)

This commit is contained in:
Allen
2017-12-10 15:05:58 +08:00
committed by GitHub
parent 00f1105c8d
commit 4d04b755ad
2 changed files with 8 additions and 6 deletions

View File

@@ -4,7 +4,7 @@
import { Component } from 'react';
import PropTypes from 'prop-types';
import { paginationElement } from '../table-factory';
import { sortableElement } from '../table-factory';
class SortWrapper extends Component {
constructor(props) {
@@ -34,7 +34,7 @@ class SortWrapper extends Component {
}
render() {
return paginationElement({
return sortableElement({
...this.props,
ref: node => this.table = node,
onSort: this.handleSort,

View File

@@ -20,11 +20,13 @@ export const pureTable = props =>
React.createElement(BootstrapTable, { ...props });
export const wrapWithPagination = (props) => {
const { wrapper } = props.pagination;
const PaginationBase = wrapper(pureTable);
return React.createElement(PaginationBase, { ...props });
if (props.pagination) {
const { wrapper } = props.pagination;
const PaginationBase = wrapper(pureTable);
return React.createElement(PaginationBase, { ...props });
}
return pureTable(props);
};
export const paginationElement = props => pureTable(props);
export const sortableElement = props => wrapWithPagination(props);