mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-06-29 05:30:05 +00:00
Compare commits
12 Commits
react-boot
...
react-boot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67ed2e6c80 | ||
|
|
794a97956d | ||
|
|
78ca01bb1a | ||
|
|
b79dbc80f6 | ||
|
|
3f21a67620 | ||
|
|
9e3ae385ce | ||
|
|
c6ea19fe8a | ||
|
|
a5b42dca92 | ||
|
|
28f3c33db3 | ||
|
|
2530a70c00 | ||
|
|
569dd61463 | ||
|
|
68264b45ce |
41
README.md
41
README.md
@@ -1,43 +1,56 @@
|
|||||||
# react-bootstrap-table2
|
# react-bootstrap-table2
|
||||||
|
|
||||||
[](https://travis-ci.org/react-bootstrap-table/react-bootstrap-table2)
|
[](https://travis-ci.org/react-bootstrap-table/react-bootstrap-table2)
|
||||||
Rebuilt [react-bootstrap-table](https://github.com/AllenFang/react-bootstrap-table)
|
Rebuilt of [react-bootstrap-table](https://github.com/AllenFang/react-bootstrap-table)
|
||||||
|
|
||||||
> `react-bootstrap-table2`'s npm module name is [**`react-bootstrap-table-next`**](https://www.npmjs.com/package/react-bootstrap-table-next) due to some guys already used it
|
> Note that `react-bootstrap-table2`'s npm module name is [**`react-bootstrap-table-next`**](https://www.npmjs.com/package/react-bootstrap-table-next) due to the name being already taken.
|
||||||
|
|
||||||
`react-bootstrap-table2` separate some functionalities from core modules to other modules like following:
|
`react-bootstrap-table2` separates some functionalities from its core modules to other modules as listed in the following:
|
||||||
|
|
||||||
* [`react-bootstrap-table-next`](https://www.npmjs.com/package/react-bootstrap-table-next)
|
- [`react-bootstrap-table-next`](https://www.npmjs.com/package/react-bootstrap-table-next)
|
||||||
* [`react-bootstrap-table2-filter`](https://www.npmjs.com/package/react-bootstrap-table2-filter)
|
- [`react-bootstrap-table2-filter`](https://www.npmjs.com/package/react-bootstrap-table2-filter)
|
||||||
* [`react-bootstrap-table2-editor`](https://www.npmjs.com/package/react-bootstrap-table2-editor)
|
- [`react-bootstrap-table2-editor`](https://www.npmjs.com/package/react-bootstrap-table2-editor)
|
||||||
* [`react-bootstrap-table2-paginator`](https://www.npmjs.com/package/react-bootstrap-table2-paginator)
|
- [`react-bootstrap-table2-paginator`](https://www.npmjs.com/package/react-bootstrap-table2-paginator)
|
||||||
* [`react-bootstrap-table2-overlay`](https://www.npmjs.com/package/react-bootstrap-table2-overlay)
|
- [`react-bootstrap-table2-overlay`](https://www.npmjs.com/package/react-bootstrap-table2-overlay)
|
||||||
* [`react-bootstrap-table2-toolkit`](https://www.npmjs.com/package/react-bootstrap-table2-toolkit)
|
- [`react-bootstrap-table2-toolkit`](https://www.npmjs.com/package/react-bootstrap-table2-toolkit)
|
||||||
|
|
||||||
This can help your application with less bundled size and also help us have clean design to avoid handling to much logic in kernel module(SRP).
|
Not only does this reduce the bundle size of your apps but also helps us have a cleaner design to avoid handling too much logic in the kernel module(SRP).
|
||||||
|
|
||||||
## Migration
|
## Migration
|
||||||
If you are the user from legacy [`react-bootstrap-table`](https://github.com/AllenFang/react-bootstrap-table/), please have a look on [this](./docs/migration.md).
|
|
||||||
|
If you are coming from the legacy [`react-bootstrap-table`](https://github.com/AllenFang/react-bootstrap-table/), please check out the [migration guide](./docs/migration.md).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
See [getting started](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/getting-started.html).
|
See [getting started](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/getting-started.html).
|
||||||
|
|
||||||
## Online Demo
|
## Online Demo
|
||||||
|
|
||||||
See `react-bootstrap-table2` [storybook](https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html).
|
See `react-bootstrap-table2` [storybook](https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html).
|
||||||
|
|
||||||
## Roadmap
|
## Roadmap
|
||||||
|
|
||||||
See [release plans](https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2018/01/24/release-plan.html).
|
See [release plans](https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2018/01/24/release-plan.html).
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
Please check [development guide](./docs/development.md).
|
|
||||||
|
|
||||||
## How should I run storybook example in my local?
|
Please check the [development guide](./docs/development.md).
|
||||||
|
|
||||||
|
## Running storybook example on your local machine
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
# Clone the repo
|
||||||
$ git clone https://github.com/react-bootstrap-table/react-bootstrap-table2.git
|
$ git clone https://github.com/react-bootstrap-table/react-bootstrap-table2.git
|
||||||
|
|
||||||
|
# change dir to the cloned repo
|
||||||
$ cd react-bootstrap-table2
|
$ cd react-bootstrap-table2
|
||||||
|
|
||||||
|
# Install all dependencies with yarn
|
||||||
$ yarn install
|
$ yarn install
|
||||||
|
|
||||||
|
# Start the stroybook server, then go to localhost:6006
|
||||||
$ yarn storybook
|
$ yarn storybook
|
||||||
$ Go to localhost:6006
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Storybook examples: [`packages/react-bootstrap-table2-example/examples`](https://github.com/react-bootstrap-table/react-bootstrap-table2/tree/master/packages/react-bootstrap-table2-example/examples)**
|
**Storybook examples: [`packages/react-bootstrap-table2-example/examples`](https://github.com/react-bootstrap-table/react-bootstrap-table2/tree/master/packages/react-bootstrap-table2-example/examples)**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-bootstrap-table2-editor",
|
"name": "react-bootstrap-table2-editor",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"description": "it's the editor addon for react-bootstrap-table2",
|
"description": "it's the editor addon for react-bootstrap-table2",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||||||
|
|
||||||
const EditorIndicator = ({ invalidMessage }) =>
|
const EditorIndicator = ({ invalidMessage }) =>
|
||||||
(
|
(
|
||||||
<div className="alert alert-danger fade in">
|
<div className="alert alert-danger in" role="alert">
|
||||||
<strong>{ invalidMessage }</strong>
|
<strong>{ invalidMessage }</strong>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import { productsQualityGenerator } from 'utils/common';
|
|||||||
const products = productsQualityGenerator(6);
|
const products = productsQualityGenerator(6);
|
||||||
|
|
||||||
const selectOptions = [
|
const selectOptions = [
|
||||||
{ label: 0, value: 'good' },
|
{ value: 0, label: 'good' },
|
||||||
{ label: 1, value: 'Bad' },
|
{ value: 1, label: 'Bad' },
|
||||||
{ label: 2, value: 'unknown' }
|
{ value: 2, label: 'unknown' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const columns = [{
|
const columns = [{
|
||||||
@@ -22,7 +22,7 @@ const columns = [{
|
|||||||
}, {
|
}, {
|
||||||
dataField: 'quality',
|
dataField: 'quality',
|
||||||
text: 'Product Quailty',
|
text: 'Product Quailty',
|
||||||
formatter: cell => selectOptions.find(opt => opt.label === cell).value,
|
formatter: cell => selectOptions.find(opt => opt.value === cell).label,
|
||||||
filter: selectFilter({
|
filter: selectFilter({
|
||||||
options: selectOptions
|
options: selectOptions
|
||||||
})
|
})
|
||||||
@@ -33,9 +33,9 @@ import BootstrapTable from 'react-bootstrap-table-next';
|
|||||||
import filterFactory, { selectFilter } from 'react-bootstrap-table2-filter';
|
import filterFactory, { selectFilter } from 'react-bootstrap-table2-filter';
|
||||||
|
|
||||||
const selectOptions = [
|
const selectOptions = [
|
||||||
{ label: 0, value: 'good' },
|
{ value: 0, label: 'good' },
|
||||||
{ label: 1, value: 'Bad' },
|
{ value: 1, label: 'Bad' },
|
||||||
{ label: 2, value: 'unknown' }
|
{ value: 2, label: 'unknown' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const columns = [{
|
const columns = [{
|
||||||
@@ -47,7 +47,7 @@ const columns = [{
|
|||||||
}, {
|
}, {
|
||||||
dataField: 'quality',
|
dataField: 'quality',
|
||||||
text: 'Product Quailty',
|
text: 'Product Quailty',
|
||||||
formatter: cell => selectOptions.find(opt => opt.label === cell).value,
|
formatter: cell => selectOptions.find(opt => opt.value === cell).label,
|
||||||
filter: selectFilter({
|
filter: selectFilter({
|
||||||
options: selectOptions
|
options: selectOptions
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ const expandRow = {
|
|||||||
<p>expandRow.renderer callback will pass the origin row object to you</p>
|
<p>expandRow.renderer callback will pass the origin row object to you</p>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
showExpandColumn: true
|
showExpandColumn: true,
|
||||||
|
expandByColumnOnly: true
|
||||||
};
|
};
|
||||||
|
|
||||||
<BootstrapTable
|
<BootstrapTable
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-bootstrap-table2-example",
|
"name": "react-bootstrap-table2-example",
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@@ -119,15 +119,15 @@ const qualityFilter = selectFilter({
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const selectOptions = [
|
const selectOptions = [
|
||||||
{ label: 0, value: 'good' },
|
{ value: 0, label: 'good' },
|
||||||
{ label: 1, value: 'Bad' },
|
{ value: 1, label: 'Bad' },
|
||||||
{ label: 2, value: 'unknown' }
|
{ value: 2, label: 'unknown' }
|
||||||
];
|
];
|
||||||
const columns = [
|
const columns = [
|
||||||
..., {
|
..., {
|
||||||
dataField: 'quality',
|
dataField: 'quality',
|
||||||
text: 'Product Quailty',
|
text: 'Product Quailty',
|
||||||
formatter: cell => selectOptions.find(opt => opt.label === cell).value,
|
formatter: cell => selectOptions.find(opt => opt.value === cell).label,
|
||||||
filter: selectFilter({
|
filter: selectFilter({
|
||||||
options: selectOptions
|
options: selectOptions
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-bootstrap-table2-filter",
|
"name": "react-bootstrap-table2-filter",
|
||||||
"version": "1.0.2",
|
"version": "1.1.0",
|
||||||
"description": "it's a column filter addon for react-bootstrap-table2",
|
"description": "it's a column filter addon for react-bootstrap-table2",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import { FILTER_TYPE } from '../const';
|
|||||||
function optionsEquals(currOpts, prevOpts) {
|
function optionsEquals(currOpts, prevOpts) {
|
||||||
if (Array.isArray(currOpts)) {
|
if (Array.isArray(currOpts)) {
|
||||||
for (let i = 0; i < currOpts.length; i += 1) {
|
for (let i = 0; i < currOpts.length; i += 1) {
|
||||||
if (currOpts[i].label !== prevOpts[i].label) {
|
if (
|
||||||
|
currOpts[i].value !== prevOpts[i].value ||
|
||||||
|
currOpts[i].label !== prevOpts[i].label
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +89,7 @@ class SelectFilter extends Component {
|
|||||||
}
|
}
|
||||||
if (Array.isArray(options)) {
|
if (Array.isArray(options)) {
|
||||||
options.forEach(({ value, label }) =>
|
options.forEach(({ value, label }) =>
|
||||||
optionTags.push(<option key={ label } value={ label }>{ value }</option>));
|
optionTags.push(<option key={ value } value={ value }>{ label }</option>));
|
||||||
} else {
|
} else {
|
||||||
Object.keys(options).forEach(key =>
|
Object.keys(options).forEach(key =>
|
||||||
optionTags.push(<option key={ key } value={ key }>{ options[key] }</option>)
|
optionTags.push(<option key={ key } value={ key }>{ options[key] }</option>)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-bootstrap-table2-paginator",
|
"name": "react-bootstrap-table2-paginator",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "it's the pagination addon for react-bootstrap-table2",
|
"description": "it's the pagination addon for react-bootstrap-table2",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
|
|
||||||
const PaginationTotal = props => (
|
const PaginationTotal = props => (
|
||||||
<span className="react-bootstrap-table-pagination-total">
|
<span className="react-bootstrap-table-pagination-total">
|
||||||
Showing rows { props.from } to { props.to + 1 } of { props.dataSize }
|
Showing rows { props.from } to { props.to } of { props.dataSize }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-bootstrap-table-next",
|
"name": "react-bootstrap-table-next",
|
||||||
"version": "1.4.0",
|
"version": "1.4.1",
|
||||||
"description": "Next generation of react-bootstrap-table",
|
"description": "Next generation of react-bootstrap-table",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class BootstrapTable extends PropsBaseResolver(Component) {
|
|||||||
tabIndexCell,
|
tabIndexCell,
|
||||||
id,
|
id,
|
||||||
classes,
|
classes,
|
||||||
|
bootstrap4,
|
||||||
striped,
|
striped,
|
||||||
hover,
|
hover,
|
||||||
bordered,
|
bordered,
|
||||||
@@ -66,7 +67,7 @@ class BootstrapTable extends PropsBaseResolver(Component) {
|
|||||||
'table-striped': striped,
|
'table-striped': striped,
|
||||||
'table-hover': hover,
|
'table-hover': hover,
|
||||||
'table-bordered': bordered,
|
'table-bordered': bordered,
|
||||||
'table-condensed': condensed
|
[(bootstrap4 ? 'table-sm' : 'table-condensed')]: condensed
|
||||||
}, classes);
|
}, classes);
|
||||||
|
|
||||||
const tableCaption = (caption && <Caption>{ caption }</Caption>);
|
const tableCaption = (caption && <Caption>{ caption }</Caption>);
|
||||||
|
|||||||
Reference in New Issue
Block a user