Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrate to React@16.3 for Context API #333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
AllenFang merged 55 commits into develop from refactor/context-api
Aug 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0ff0c33
upgrade react and react-dom
AllenFang May 13, 2018
906180a
implement context-based container
AllenFang May 13, 2018
6d08a24
implement selection context
AllenFang May 13, 2018
2525465
implement sort context
AllenFang May 13, 2018
143acde
refactoring remote sort
AllenFang May 19, 2018
5307e58
implement data operator
AllenFang May 19, 2018
216bc10
implement celledit context
AllenFang May 19, 2018
4f6809d
fix custom filter value example broken
AllenFang May 20, 2018
2f7d010
add clear all filter story
AllenFang May 20, 2018
8f4dc99
implement filter context
AllenFang May 20, 2018
1e72c80
construct context dynamically
AllenFang May 20, 2018
6c086c3
implement pagination context
AllenFang May 20, 2018
4ecf243
no more state anti-pattern
AllenFang May 20, 2018
d534c42
change to partial selection when pagination enabled
AllenFang May 20, 2018
b1c086f
fix cache context issue
AllenFang May 20, 2018
400c307
refine remote method
AllenFang May 20, 2018
74bf885
remove useless code
AllenFang May 23, 2018
fc0b99e
patch tests for react-bootstrap-table-next
AllenFang May 28, 2018
167352f
fix selectRow doesnt pass to CellEditContext
AllenFang May 30, 2018
c13b3fa
patch test for editor, filter, pagination
AllenFang Jun 2, 2018
9c677fe
enhance remote all example
AllenFang Jun 15, 2018
78ea630
fix bug for default sort and filter have potential issue when remote ...
AllenFang Jun 15, 2018
77301c2
implement table search
AllenFang Jun 18, 2018
760d459
add example for tble search
AllenFang Jun 18, 2018
0d4d32c
patch for remote cell edit
AllenFang Jun 23, 2018
7b15bf4
patch tests for search
AllenFang Jun 23, 2018
18b785d
update peer dependencies for react react-dom
AllenFang Jun 23, 2018
46f0ce4
prepare builds for react-bootstrap-table2-toolkit
AllenFang Jun 23, 2018
6eaffe1
patch docs for table search
AllenFang Jun 23, 2018
35b1e37
implement expand row sketch
AllenFang Jun 24, 2018
dbd0f89
add stories for expand row
AllenFang Jun 24, 2018
4af5b4f
implement expand indicator
AllenFang Jul 1, 2018
81ddd2c
add stories for expand indicator
AllenFang Jul 1, 2018
c36aa24
fix filter context tests broken due to missing onExternalFilter
AllenFang Jul 1, 2018
a18932e
patch docs for expand row
AllenFang Jul 1, 2018
5a442bf
add missing expandRow props
AllenFang Jul 1, 2018
e6d4a96
data, keyField and columns is necessary value for toolkits context
AllenFang Jul 3, 2018
0ec5b6c
add simple toolkit context wrapper for user
AllenFang Jul 11, 2018
03ece4b
refactoring search
AllenFang Jul 14, 2018
f0e37b1
implement export csv
AllenFang Jul 14, 2018
b792803
add export csv stories
AllenFang Jul 14, 2018
ec77a05
patch docs for export CSV
AllenFang Jul 14, 2018
fadbcda
a workaround for fixing the _ module missing
AllenFang Jul 14, 2018
7919a40
enhance for #402
AllenFang Jul 15, 2018
0d64443
fix sort caret broken on bootstrap4
AllenFang Jul 20, 2018
f7ba8e3
upgrade enzyme
AllenFang Jul 22, 2018
c0416fc
fix selection column broken when bootstrap4
AllenFang Jul 22, 2018
4958757
refine new context API tests
AllenFang Jul 22, 2018
3f957db
fix pagination broken when bootstrap4
AllenFang Jul 22, 2018
62c6949
add bootstrap4 style links
AllenFang Jul 22, 2018
925d3d7
final docs patch
AllenFang Jul 24, 2018
f7406bc
add toolkits styles
AllenFang Jul 28, 2018
2ec55f6
patch for default sort and filter have potential issue when remote
AllenFang Jul 28, 2018
d5d8c54
fix React doesn't allow Date Object as children
AllenFang Jul 28, 2018
cb970cd
fix peerdep
AllenFang Aug 4, 2018
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
1 change: 1 addition & 0 deletions README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Rebuilt [react-bootstrap-table](https://github.com/AllenFang/react-bootstrap-tab
* [`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-overlay`](https://www.npmjs.com/package/react-bootstrap-table2-overlay)
* [`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 kernal module(SRP).

Expand Down
8 changes: 8 additions & 0 deletions docs/README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#### Optional
* [remote](#remote)
* [bootstrap4](#bootstrap4)
* [loading](#loading)
* [caption](#caption)
* [striped](#striped)
Expand All @@ -21,6 +22,7 @@
* [headerClasses](#headerClasses)
* [cellEdit](#cellEdit)
* [selectRow](#selectRow)
* [expandRow](#expandRow)
* [rowStyle](#rowStyle)
* [rowClasses](#rowClasses)
* [rowEvents](#rowEvents)
Expand Down Expand Up @@ -66,6 +68,9 @@ remote={ { pagination: true, filter: false, sort: false } }

There is a special case for remote pagination, even you only specified the pagination need to handle as remote, `react-bootstrap-table2` will handle all the table changes(filter, sort etc) as remote mode, because `react-bootstrap-table2` only know the data of current page, but filtering, searching or sort need to work on overall data.

### <a name='bootstrap4'>bootstrap4 - [Bool]</a>
`true` to indicate your bootstrap version is 4. Default version is 3.

### <a name='loading'>loading - [Bool]</a>
Telling if table is loading or not, for example: waiting data loading, filtering etc. It's **only** valid when [`remote`](#remote) is enabled.
When `loading` is `true`, `react-bootstrap-table2` will attend to render a overlay on table via [`overlay`](#overlay) prop, if [`overlay`](#overlay) prop is not given, `react-bootstrap-table2` will ignore the overlay rendering.
Expand Down Expand Up @@ -122,6 +127,9 @@ Makes table cells editable, please see [cellEdit definition](./cell-edit.md) for
### <a name='selectRow'>selectRow - [Object]</a>
Makes table rows selectable, please see [selectRow definition](./row-selection.md) for more detail.

### <a name='expandRow'>expandRow - [Object]</a>
Makes table rows expandable, please see [expandRow definition](./row-expand.md) for more detail.

### <a name='rowStyle'>rowStyle = [Object | Function]</a>
Custom the style of table rows:

Expand Down
19 changes: 18 additions & 1 deletion docs/columns.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Available properties in a column object:
* [editorRenderer](#editorRenderer)
* [filter](#filter)
* [filterValue](#filterValue)
* [csvType](#csvType)
* [csvFormatter](#csvFormatter)
* [csvText](#csvText)
* [csvExport](#csvExport)

Following is a most simplest and basic usage:

Expand Down Expand Up @@ -685,4 +689,17 @@ A final `String` value you want to be filtered.
filter: textFilter(),
filterValue: (cell, row) => owners[cell]
}
```
```

## <a name='csvType'>column.csvType - [Object]</a>
Default is `String`. Currently, the available value is `String` and `Number`. If `Number` assigned, the cell value will not wrapped with double quote.

## <a name='csvFormatter'>column.csvFormatter - [Function]</a>

This is same as [`column.formatter`](#formatter). But `csvFormatter` only for CSV export and called when export CSV.

## <a name='csvText'>column.csvText - [String]</a>
Custom the CSV header cell, Default is [`column.text`](#text).

## <a name='csvExport'>column.csvExport - [Bool]</a>
Default is `true`, `false` will hide this column when export CSV.
32 changes: 31 additions & 1 deletion docs/migration.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Currently, **I still can't implement all the mainly features in legacy `react-bo
* Pagination Addons
* [`react-bootstrap-table2-overlay`](https://www.npmjs.com/package/react-bootstrap-table2-overlay)
* Overlay/Loading Addons
* [`react-bootstrap-table2-toolkit`](https://www.npmjs.com/package/react-bootstrap-table2-toolkit)
* Table Toolkits, like search, csv etc.

This can help your application with less bundled size and also help `react-bootstrap-table2` have clean design to avoid handling to much logic in kernel module(SRP). Hence, which means you probably need to install above addons when you need specific features.

Expand Down Expand Up @@ -113,6 +115,34 @@ Remember to install [`react-bootstrap-table2-paginator`](https://www.npmjs.com/p

No big changes for pagination, but still can't custom the pagination list, button and sizePerPage dropdown.

## Table Search
The usage of search functionality is a little bit different from legacy search. The mainly different thing is developer have to render the search input field, we do believe it will be very flexible for all the developers who want to custom the search position or search field itself.

- [x] Custom search component and position
- [x] Custom search value
- [ ] Clear search
- [ ] Multiple search
- [ ] Strict search

## Row Expand
- [x] Expand Row Events
- [x] Expand Row Indicator
- [x] Expand Row Management
- [x] Custom Expand Row Indicators
- [ ] Compatiable with Row Selection
- [ ] Expand Column position
- [ ] Expand Column Style/Class

## Export CSV
Export CSV functionality is like search, which is one of functionality in the `react-bootstrap-table2-toolkit`. All of the legacy functions we already implemented.

## Remote

> It's totally different in `react-bootstrap-table2`. Please [see](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-remote.html).
> It's totally different in `react-bootstrap-table2`. Please [see](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/basic-remote.html).


## Row insert/Delete
Not support yet

## Keyboard Navigation
Not support yet
129 changes: 129 additions & 0 deletions docs/row-expand.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

# Row expand
`react-bootstrap-table2` supports the row expand feature. By passing prop `expandRow` to enable this functionality.

> Default is click to expand/collapse a row. In addition, we don't support any way to chagne this mechanism!

## Required
* [renderer (**required**)](#renderer)

## Optional
* [expanded](#expanded)
* [nonExpandable](#nonExpandable)
* [onExpand](#onExpand)
* [onExpandAll](#onExpandAll)
* [showExpandColumn](#showExpandColumn)
* [expandColumnRenderer](#expandColumnRenderer)
* [expandHeaderColumnRenderer](#expandHeaderColumnRenderer)

### <a name="renderer">expandRow.renderer - [Function]</a>

Specify the content of expand row, `react-bootstrap-table2` will pass a row object as argument and expect return a react element.

#### values
* **row**

#### examples

```js
const expandRow = {
renderer: row => (
<div>
<p>{ `This Expand row is belong to rowKey ${row.id}` }</p>
<p>You can render anything here, also you can add additional data on every row object</p>
<p>expandRow.renderer callback will pass the origin row object to you</p>
</div>
)
};

<BootstrapTable
keyField='id'
data={ products }
columns={ columns }
expandRow={ expandRow }
/>
```

### <a name='expanded'>expandRow.expanded - [Array]</a>
`expandRow.expanded` allow you have default row expandations on table.

```js
const expandRow = {
renderer: (row) => ...
expanded: [1, 3] // should be a row keys array
};
```

### <a name='nonExpandable'>expandRow.nonExpandable - [Array]</a>
This prop allow you to restrict some rows which can not be expanded by user. `expandRow.nonExpandable` accept an rowkeys array.

```js
const expandRow = {
renderer: (row) => ...
nonExpandable: [1, 3 ,5]
};
```

### <a name='onExpand'>expandRow.onExpand - [Function]</a>
This callback function will be called when a row is expand/collapse and pass following four arguments:
`row`, `isExpand`, `rowIndex` and `e`.

```js
const expandRow = {
renderer: (row) => ...
onExpand: (row, isExpand, rowIndex, e) => {
// ...
}
};
```

### <a name='onExpandAll'>expandRow.onExpandAll - [Function]</a>
This callback function will be called when expand/collapse all. It only work when you configure [`expandRow.showExpandColumn`](#showExpandColumn) as `true`.

```js
const expandRow = {
renderer: (row) => ...
onExpandAll: (isExpandAll, results, e) => {
// ...
}
};
```

### <a name='expandColumnRenderer'>expandRow.expandColumnRenderer - [Function]</a>
Provide a callback function which allow you to custom the expand indicator. This callback only have one argument which is an object and contain one property `expanded` which indicate if current row is expanded


```js
const expandRow = {
renderer: (row) => ...
expandColumnRenderer: ({ expanded }) => (
// ....
)
};
```

> By default, `react-bootstrap-table2` will help you to handle the click event, it's not necessary to handle again by developer.

### <a name='expandHeaderColumnRenderer'>expandRow.expandHeaderColumnRenderer - [Function]</a>
Provide a callback function which allow you to custom the expand indicator in the expand header column. This callback only have one argument which is an object and contain one property `isAnyExpands` which indicate if there's any rows are expanded:

```js
const expandRow = {
renderer: (row) => ...
expandHeaderColumnRenderer: ({ isAnyExpands }) => (
// ....
)
};
```

> By default, `react-bootstrap-table2` will help you to handle the click event, it's not necessary to handle again by developer.

### <a name='showExpandColumn'>expandRow.showExpandColumn - [Bool]</a>
Default is `false`, if you want to have a expand indicator, give this prop as `true`

```js
const expandRow = {
renderer: (row) => ...
showExpandColumn: true
};
```
9 changes: 6 additions & 3 deletions gulpfile.babel.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ const JS_PKGS = [
'react-bootstrap-table2-editor',
'react-bootstrap-table2-filter',
'react-bootstrap-table2-overlay',
'react-bootstrap-table2-paginator'
'react-bootstrap-table2-paginator',
'react-bootstrap-table2-toolkit'
].reduce((pkg, curr) => `${curr}|${pkg}`, '');

const JS_SKIPS = `+(${TEST}|${LIB}|${DIST}|${NODE_MODULES})`;

const STYLE_PKGS = [
'react-bootstrap-table2',
'react-bootstrap-table2-filter',
'react-bootstrap-table2-paginator'
'react-bootstrap-table2-paginator',
'react-bootstrap-table2-toolkit',
].reduce((pkg, curr) => `${curr}|${pkg}`, '');

const STYLE_SKIPS = `+(${NODE_MODULES})`;
Expand Down Expand Up @@ -78,7 +80,8 @@ function umd(done) {
() => gulp.src('./webpack/editor.umd.babel.js').pipe(shell(['webpack --config <%= file.path %>'])),
() => gulp.src('./webpack/filter.umd.babel.js').pipe(shell(['webpack --config <%= file.path %>'])),
() => gulp.src('./webpack/overlay.umd.babel.js').pipe(shell(['webpack --config <%= file.path %>'])),
() => gulp.src('./webpack/paginator.umd.babel.js').pipe(shell(['webpack --config <%= file.path %>']))
() => gulp.src('./webpack/paginator.umd.babel.js').pipe(shell(['webpack --config <%= file.path %>'])),
() => gulp.src('./webpack/toolkit.umd.babel.js').pipe(shell(['webpack --config <%= file.path %>']))
)();
done();
}
Expand Down
12 changes: 6 additions & 6 deletions package.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"pretest": "yarn lint --cache",
"test": "jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"test:watch": "jest --coverage --watch",
"storybook": "cd ./packages/react-bootstrap-table2-example && yarn storybook",
"gh-pages:clean": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:clean",
"gh-pages:build": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:build",
Expand Down Expand Up @@ -50,8 +50,8 @@
"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",
"enzyme": "3.3.0",
"enzyme-adapter-react-16": "1.1.1",
"eslint": "4.5.0",
"eslint-config-airbnb": "15.1.0",
"eslint-loader": "1.9.0",
Expand Down Expand Up @@ -81,12 +81,12 @@
"dependencies": {
"classnames": "2.2.5",
"prop-types": "15.5.10",
"react": "16.0.0",
"react-dom": "16.0.0"
"react": "16.3.2",
"react-dom": "16.3.2"
},
"jest": {
"collectCoverageFrom": [
"packages/*/src/*.js",
"packages/*/src/**/*.js",
"packages/*/index.js"
],
"roots": [
Expand Down
4 changes: 2 additions & 2 deletions packages/react-bootstrap-table2-editor/index.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import wrapperFactory from './src/wrapper';
import createContext from './src/context';
import editingCellFactory from './src/editing-cell';
import {
EDITTYPE,
Expand All @@ -8,7 +8,7 @@ import {
} from './src/const';

export default (options = {}) => ({
wrapperFactory,
createContext,
editingCellFactory,
CLICK_TO_CELL_EDIT,
DBCLICK_TO_CELL_EDIT,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-bootstrap-table2-editor/package.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
],
"peerDependencies": {
"prop-types": "^15.0.0",
"react": "^16.0.0",
"react-dom": "^16.0.0"
"react": "^16.3.0",
"react-dom": "^16.3.0"
}
}
Loading

AltStyle によって変換されたページ (->オリジナル) /