Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0f7adbb
init react-bootstrap-table2-paginator
AllenFang Oct 31, 2017
d137437
add react-bootstrap-table2-paginator as dependency
AllenFang Oct 31, 2017
cad3e0b
no container
AllenFang Oct 31, 2017
c5a7d0f
handle for wrapping pagination component
AllenFang Oct 31, 2017
21b01f8
add style for paginator addon
AllenFang Nov 4, 2017
bba8190
add story for pagination
AllenFang Nov 4, 2017
33d81cf
implement pagination list
AllenFang Nov 4, 2017
6a2b23a
constants maintain in core package
AllenFang Nov 6, 2017
a5f7182
implement sizePerPage dropdown
AllenFang Nov 7, 2017
475683c
fix unalign for sizePerPage dropdown and pagination list
AllenFang Nov 7, 2017
3ef421d
allow to return array from render(react@16 new feature)
AllenFang Nov 8, 2017
61d96f8
implement pagination hooks
AllenFang Nov 8, 2017
09183a6
add story for pagination hooks
AllenFang Nov 8, 2017
baf49d3
fixed dependencies version and upgrade enzyme
AllenFang Nov 10, 2017
f0cbeef
Shallow renderer no longer calls componentDidMount because DOM refs a…
AllenFang Nov 10, 2017
9f528de
classNames -> className for TextEditor
AllenFang Nov 12, 2017
b992f8f
add tests for pagination
AllenFang Nov 13, 2017
0f1a9d1
fix react-bootstrap-table can't be resolved in other modules
AllenFang Nov 18, 2017
dcd96f6
implement custom page button title
AllenFang Nov 18, 2017
ec5e78a
add test for page button title
AllenFang Nov 18, 2017
bacdc69
fix bug when sizePerPageList is an object array
AllenFang Nov 18, 2017
d567860
add story for custom pagination
AllenFang Nov 18, 2017
e0f8059
remove necessary component extends
AllenFang Nov 18, 2017
9ff38f8
move pagination options to react-bootstrap-table2-paginator
AllenFang Nov 19, 2017
03959e9
refine pagination stories
AllenFang Nov 19, 2017
967293d
implement hideSizePerPage
AllenFang Nov 19, 2017
fb5b005
implement hidePageListOnlyOnePage
AllenFang Nov 19, 2017
8762bff
fix multiple same key warning
AllenFang Nov 19, 2017
3df630b
remove help
AllenFang Nov 19, 2017
648aa7d
support start from react@^16
AllenFang Nov 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions enzyme-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Adapter from 'enzyme-adapter-react-16';
import { configure } from 'enzyme';

const configureEnzyme = () => {
configure({ adapter: new Adapter() });
};

configureEnzyme();
71 changes: 39 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,46 @@
},
"homepage": "https://github.com/react-bootstrap-table/react-bootstrap-table2#readme",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-jest": "^20.0.3",
"babel-loader": "^7.1.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"css-loader": "^0.28.1",
"enzyme": "^2.9.1",
"eslint": "^4.5.0",
"babel-core": "6.25.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.1",
"babel-preset-es2015": "6.24.1",
"babel-preset-react": "6.24.1",
"babel-preset-stage-0": "6.24.1",
"babel-register": "6.24.1",
"css-loader": "0.28.1",
"enzyme": "3.1.1",
"enzyme-adapter-react-16": "1.0.4",
"eslint": "4.5.0",
"eslint-config-airbnb": "15.1.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.7.0",
"eslint-loader": "1.9.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "^7.2.1",
"html-webpack-plugin": "^2.30.1",
"jest": "^20.0.4",
"jsdom": "^11.2.0",
"jsdom-global": "^3.0.2",
"lerna": "^2.0.0",
"node-sass": "^4.5.3",
"react-test-renderer": "^15.6.1",
"sass-loader": "^6.0.6",
"sinon": "^3.2.1",
"style-loader": "^0.17.0",
"webpack": "^3.5.4",
"webpack-dev-server": "^2.7.1"
"eslint-plugin-react": "7.2.1",
"html-webpack-plugin": "2.30.1",
"jest": "20.0.4",
"jsdom": "11.2.0",
"jsdom-global": "3.0.2",
"lerna": "2.0.0",
"node-sass": "4.5.3",
"react-test-renderer": "16.0.0",
"sass-loader": "6.0.6",
"sinon": "3.2.1",
"style-loader": "0.17.0",
"webpack": "3.5.4",
"webpack-dev-server": "2.7.1"
},
"dependencies": {
"classnames": "^2.2.5",
"prop-types": "^15.5.10",
"react": "^15.6.1",
"react-dom": "^15.6.1"
"classnames": "2.2.5",
"prop-types": "15.5.10",
"react": "16.0.0",
"react-dom": "16.0.0"
},
"peerDependencies": {
"prop-types": "^15.0.0",
"react": "^15.0.0",
"react-dom": "^15.0.0"
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"jest": {
"collectCoverageFrom": [
Expand All @@ -71,6 +72,12 @@
"roots": [
"<rootDir>/packages"
],
"setupFiles": [
"<rootDir>/enzyme-setup.js"
],
"modulePaths": [
"<rootDir>/packages/react-bootstrap-table2"
],
"testEnvironment": "node",
"testMatch": [
"**/test/**/*.test.js"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const path = require('path');

const sourcePath = path.join(__dirname, '../../react-bootstrap-table2/src');
const paginationSourcePath = path.join(__dirname, '../../react-bootstrap-table2-paginator/src');
const sourceStylePath = path.join(__dirname, '../../react-bootstrap-table2/style');
const paginationStylePath = path.join(__dirname, '../../react-bootstrap-table2-paginator/style');
const storyPath = path.join(__dirname, '../stories');
const examplesPath = path.join(__dirname, '../examples');
const srcPath = path.join(__dirname, '../src');
Expand All @@ -23,14 +25,14 @@ const loaders = [{
test: /\.js?$/,
use: ['babel-loader'],
exclude: /node_modules/,
include: [sourcePath, storyPath],
include: [sourcePath, paginationSourcePath, storyPath],
}, {
test: /\.css$/,
use: ['style-loader', 'css-loader'],
}, {
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: [storyPath, sourceStylePath],
include: [storyPath, sourceStylePath, paginationStylePath],
}, {
test: /\.(jpg|png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* eslint react/prefer-stateless-function: 0 */
import React from 'react';

import BootstrapTable from 'react-bootstrap-table2';
import paginator from 'react-bootstrap-table2-paginator';
import Code from 'components/common/code-block';
import { productsGenerator } from 'utils/common';

const products = productsGenerator(87);

const columns = [{
dataField: 'id',
text: 'Product ID'
}, {
dataField: 'name',
text: 'Product Name'
}, {
dataField: 'price',
text: 'Product Price'
}];

const sourceCode = `\
import BootstrapTable from 'react-bootstrap-table2';
import paginator from 'react-bootstrap-table2-paginator';
// ...

const options = {
paginationSize: 4,
pageStartIndex: 0,
// alwaysShowAllBtns: true, // Always show next and previous button
// withFirstAndLast: false, // Hide the going to First and Last page button
// hideSizePerPage: true, // Hide the sizePerPage dropdown always
// hidePageListOnlyOnePage: true, // Hide the pagination list when only one page
firstPageText: 'First',
prePageText: 'Back',
nextPageText: 'Next',
lastPageText: 'Last',
nextPageTitle: 'First page',
prePageTitle: 'Pre page',
firstPageTitle: 'Next page',
lastPageTitle: 'Last page',
sizePerPageList: [{
text: '5', value: 5
}, {
text: '10', value: 10
}, {
text: 'All', value: products.length
}] // A numeric array is also available. the purpose of above example is custom the text
};

<BootstrapTable keyField='id' data={ products } columns={ columns } pagination={ paginator(options) } />
`;
const options = {
paginationSize: 4,
pageStartIndex: 0,
// alwaysShowAllBtns: true // Always show next and previous button
// withFirstAndLast: false // Hide the going to First and Last page button
// hideSizePerPage: true, // Hide the sizePerPage dropdown always
// hidePageListOnlyOnePage: true, // Hide the pagination list when only one page
firstPageText: 'First',
prePageText: 'Back',
nextPageText: 'Next',
lastPageText: 'Last',
nextPageTitle: 'First page',
prePageTitle: 'Pre page',
firstPageTitle: 'Next page',
lastPageTitle: 'Last page',
sizePerPageList: [{
text: '5', value: 5
}, {
text: '10', value: 10
}, {
text: 'All', value: products.length
}] // A numeric array is also available. the purpose of above example is custom the text
};

export default () => (
<div>
<BootstrapTable keyField="id" data={ products } columns={ columns } pagination={ paginator(options) } />
<Code>{ sourceCode }</Code>
</div>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* eslint react/prefer-stateless-function: 0 */
import React from 'react';

import BootstrapTable from 'react-bootstrap-table2';
import paginator from 'react-bootstrap-table2-paginator';
import Code from 'components/common/code-block';
import { productsGenerator } from 'utils/common';

const products = productsGenerator(87);

const columns = [{
dataField: 'id',
text: 'Product ID'
}, {
dataField: 'name',
text: 'Product Name'
}, {
dataField: 'price',
text: 'Product Price'
}];

const sourceCode = `\
import BootstrapTable from 'react-bootstrap-table2';
import paginator from 'react-bootstrap-table2-paginator';
// ...
const columns = [{
dataField: 'id',
text: 'Product ID'
}, {
dataField: 'name',
text: 'Product Name'
}, {
dataField: 'price',
text: 'Product Price'
}];

<BootstrapTable keyField='id' data={ products } columns={ columns } pagination={ paginator() } />
`;

export default () => (
<div>
<BootstrapTable keyField="id" data={ products } columns={ columns } pagination={ paginator() } />
<Code>{ sourceCode }</Code>
</div>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* eslint react/prefer-stateless-function: 0 */
/* eslint no-console: 0 */
import React from 'react';

import BootstrapTable from 'react-bootstrap-table2';
import paginator from 'react-bootstrap-table2-paginator';
import Code from 'components/common/code-block';
import { productsGenerator } from 'utils/common';

const products = productsGenerator(87);

const columns = [{
dataField: 'id',
text: 'Product ID'
}, {
dataField: 'name',
text: 'Product Name'
}, {
dataField: 'price',
text: 'Product Price'
}];

const sourceCode = `\
import BootstrapTable from 'react-bootstrap-table2';
import paginator from 'react-bootstrap-table2-paginator';
// ...
const columns = [{
dataField: 'id',
text: 'Product ID'
}, {
dataField: 'name',
text: 'Product Name'
}, {
dataField: 'price',
text: 'Product Price'
}];

const options = {
onSizePerPageChange: (sizePerPage, page) => {
console.log('Size per page change!!!');
console.log('Newest size per page:' + sizePerPage);
console.log('Newest page:' + page);
},
onPageChange: (page, sizePerPage) => {
console.log('Page change!!!');
console.log('Newest size per page:' + sizePerPage);
console.log('Newest page:' + page);
}
};

<BootstrapTable
keyField="id"
data={ products }
columns={ columns }
pagination={ paginator(options) }
/>
`;

const options = {
onSizePerPageChange: (sizePerPage, page) => {
console.log('Size per page change!!!');
console.log(`Newest size per page: ${sizePerPage}`);
console.log(`Newest page: ${page}`);
},
onPageChange: (page, sizePerPage) => {
console.log('Page change!!!');
console.log(`Newest size per page: ${sizePerPage}`);
console.log(`Newest page: ${page}`);
}
};

export default () => (
<div>
<BootstrapTable
keyField="id"
data={ products }
columns={ columns }
pagination={ paginator(options) }
/>
<Code>{ sourceCode }</Code>
</div>
);
3 changes: 2 additions & 1 deletion packages/react-bootstrap-table2-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"dependencies": {
"bootstrap": "^3.3.7",
"react-bootstrap-table2": "0.0.1"
"react-bootstrap-table2": "0.0.1",
"react-bootstrap-table2-paginator": "0.0.1"
},
"devDependencies": {
"@storybook/addon-console": "^1.0.0",
Expand Down
11 changes: 11 additions & 0 deletions packages/react-bootstrap-table2-example/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,17 @@ import SelectionBgColorTable from 'examples/row-selection/selection-bgcolor';
import SelectionHooks from 'examples/row-selection/selection-hooks';
import HideSelectionColumnTable from 'examples/row-selection/hide-selection-column';

// pagination
import PaginationTable from 'examples/pagination';
import PaginationHooksTable from 'examples/pagination/pagination-hooks';
import CustomPaginationTable from 'examples/pagination/custom-pagination';

// css style
import 'bootstrap/dist/css/bootstrap.min.css';
import 'stories/stylesheet/tomorrow.min.css';
import 'stories/stylesheet/storybook.scss';
import 'react-bootstrap-table2/style/react-bootstrap-table.scss';
import 'react-bootstrap-table2-paginator/style/react-bootstrap-table-paginator.scss';

// import { action } from '@storybook/addon-actions';

Expand Down Expand Up @@ -143,3 +149,8 @@ storiesOf('Row Selection', module)
.add('Not Selectabled Rows', () => <NonSelectableRowsTable />)
.add('Selection Hooks', () => <SelectionHooks />)
.add('Hide Selection Column', () => <HideSelectionColumnTable />);

storiesOf('Pagination', module)
.add('Basic Pagination Table', () => <PaginationTable />)
.add('Pagination Hooks', () => <PaginationHooksTable />)
.add('Custom Pagination', () => <CustomPaginationTable />);
11 changes: 11 additions & 0 deletions packages/react-bootstrap-table2-paginator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "react-bootstrap-table2-paginator",
"version": "0.0.1",
"description": "it's the pagination addon for react-bootstrap-table2",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Loading