mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
/* eslint react/prop-types: 0 */
|
|
import React from 'react';
|
|
|
|
import _ from './utils';
|
|
import BootstrapTable from './bootstrap-table';
|
|
import SortWrapper from './sort/wrapper';
|
|
import RowSelectionWrapper from './row-selection/wrapper';
|
|
import CellEditWrapper from './cell-edit/wrapper';
|
|
|
|
|
|
export const wrapWithCellEdit = props =>
|
|
React.createElement(CellEditWrapper, { ...props });
|
|
|
|
export const wrapWithSelection = props =>
|
|
React.createElement(RowSelectionWrapper, { ...props });
|
|
|
|
export const wrapWithSort = props =>
|
|
React.createElement(SortWrapper, { ...props });
|
|
|
|
export const pureTable = props =>
|
|
React.createElement(BootstrapTable, { ...props });
|
|
|
|
export const wrapWithFilter = (props) => {
|
|
if (props.filter) {
|
|
const { wrapper } = props.filter;
|
|
const FilterBase = wrapper(wrapWithSort, _);
|
|
return React.createElement(FilterBase, { ...props });
|
|
}
|
|
return wrapWithSort(props);
|
|
};
|
|
|
|
export const wrapWithPagination = (props) => {
|
|
if (props.pagination) {
|
|
const { PaginationWrapper } = props.pagination;
|
|
return React.createElement(PaginationWrapper, { ...props, baseElement: pureTable });
|
|
}
|
|
return pureTable(props);
|
|
};
|
|
|
|
export const sortableElement = props => wrapWithPagination(props);
|
|
|
|
export const selectionElement = props => wrapWithFilter(props);
|
|
|
|
export const cellEditElement = props => wrapWithSelection(props);
|