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

Commit d79234e

Browse files
refactoring search
1 parent 8c9480d commit d79234e

File tree

14 files changed

+93
-108
lines changed

14 files changed

+93
-108
lines changed

‎docs/README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,24 +274,22 @@ After installation of `react-bootstrap-table2-toolkit`, you can render search fi
274274
```js
275275
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
276276

277-
const { SearchBar, searchFactory } = Search;
277+
const { SearchBar } = Search;
278278
//...
279279

280-
<ToolkitProvider>
280+
<ToolkitProvider
281+
keyField="id"
282+
data={ products }
283+
columns={ columns }
284+
search
285+
>
281286
{
282287
props => (
283288
<div>
284289
<h3>Input something at below input field:</h3>
285290
<SearchBar { ...props.searchProps } />
286291
<hr />
287-
<BootstrapTable
288-
keyField="id"
289-
data={ products }
290-
columns={ columns }
291-
search={ searchFactory({
292-
...props.searchProps
293-
}) }
294-
/>
292+
<BootstrapTable { ...props.baseProps } />
295293
</div>
296294
)
297295
}

‎packages/react-bootstrap-table2-example/examples/remote/remote-search.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
77
import Code from 'components/common/code-block';
88
import { productsGenerator } from 'utils/common';
99

10-
const { SearchBar, searchFactory } = Search;
10+
const { SearchBar } = Search;
1111
const products = productsGenerator(17);
1212

1313
const columns = [{
@@ -45,6 +45,7 @@ const RemoteFilter = props => (
4545
keyField="id"
4646
data={ props.data }
4747
columns={ columns }
48+
search
4849
>
4950
{
5051
toolkitprops => [
@@ -53,13 +54,11 @@ const RemoteFilter = props => (
5354
{ ...toolkitprops.baseProps }
5455
remote={ { search: true } }
5556
onTableChange={ props.onTableChange }
56-
search={ searchFactory({
57-
...toolkitprops.searchProps
58-
}) }
5957
/>
6058
]
6159
}
6260
</ToolkitProvider>
61+
<Code>{ sourceCode }</Code>
6362
</div>
6463
);
6564
@@ -112,6 +111,7 @@ const RemoteFilter = props => (
112111
keyField="id"
113112
data={ props.data }
114113
columns={ columns }
114+
search
115115
>
116116
{
117117
toolkitprops => [
@@ -120,9 +120,6 @@ const RemoteFilter = props => (
120120
{ ...toolkitprops.baseProps }
121121
remote={ { search: true } }
122122
onTableChange={ props.onTableChange }
123-
search={ searchFactory({
124-
...toolkitprops.searchProps
125-
}) }
126123
/>
127124
]
128125
}

‎packages/react-bootstrap-table2-example/examples/search/custom-search-value.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
77
import Code from 'components/common/code-block';
88
import { jobsGenerator1 } from 'utils/common';
99

10-
const { SearchBar, searchFactory } = Search;
10+
const { SearchBar } = Search;
1111
const products = jobsGenerator1(5);
1212

1313
const owners = ['Allen', 'Bob', 'Cat'];
@@ -34,7 +34,7 @@ const sourceCode = `\
3434
import BootstrapTable from 'react-bootstrap-table-next';
3535
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
3636
37-
const { SearchBar, searchFactory } = Search;
37+
const { SearchBar } = Search;
3838
const owners = ['Allen', 'Bob', 'Cat'];
3939
const types = ['Cloud Service', 'Message Service', 'Add Service', 'Edit Service', 'Money'];
4040
@@ -59,6 +59,7 @@ const columns = [{
5959
keyField="id"
6060
data={ products }
6161
columns={ columns }
62+
search
6263
>
6364
{
6465
props => (
@@ -68,9 +69,6 @@ const columns = [{
6869
<hr />
6970
<BootstrapTable
7071
{ ...props.baseProps }
71-
search={ searchFactory({
72-
...props.searchProps
73-
}) }
7472
/>
7573
</div>
7674
)
@@ -84,6 +82,7 @@ export default () => (
8482
keyField="id"
8583
data={ products }
8684
columns={ columns }
85+
search
8786
>
8887
{
8988
props => (
@@ -93,9 +92,6 @@ export default () => (
9392
<hr />
9493
<BootstrapTable
9594
{ ...props.baseProps }
96-
search={ searchFactory({
97-
...props.searchProps
98-
}) }
9995
/>
10096
</div>
10197
)

‎packages/react-bootstrap-table2-example/examples/search/default-custom-search.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
66
import Code from 'components/common/code-block';
77
import { productsGenerator } from 'utils/common';
88

9-
const { SearchBar, searchFactory } = Search;
9+
const { SearchBar } = Search;
1010
const products = productsGenerator();
1111

1212
const columns = [{
@@ -24,7 +24,7 @@ const sourceCode = `\
2424
import BootstrapTable from 'react-bootstrap-table-next';
2525
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
2626
27-
const { SearchBar, searchFactory } = Search;
27+
const { SearchBar } = Search;
2828
const columns = [{
2929
dataField: 'id',
3030
text: 'Product ID'
@@ -40,6 +40,7 @@ const columns = [{
4040
keyField="id"
4141
data={ products }
4242
columns={ columns }
43+
search
4344
>
4445
{
4546
props => (
@@ -55,9 +56,6 @@ const columns = [{
5556
<hr />
5657
<BootstrapTable
5758
{ ...props.baseProps }
58-
search={ searchFactory({
59-
...props.searchProps
60-
}) }
6159
/>
6260
</div>
6361
)
@@ -71,6 +69,7 @@ export default () => (
7169
keyField="id"
7270
data={ products }
7371
columns={ columns }
72+
search
7473
>
7574
{
7675
props => (
@@ -86,9 +85,6 @@ export default () => (
8685
<hr />
8786
<BootstrapTable
8887
{ ...props.baseProps }
89-
search={ searchFactory({
90-
...props.searchProps
91-
}) }
9288
/>
9389
</div>
9490
)

‎packages/react-bootstrap-table2-example/examples/search/fully-custom-search.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import React from 'react';
44

55
import BootstrapTable from 'react-bootstrap-table-next';
6-
import ToolkitProvider,{Search} from 'react-bootstrap-table2-toolkit';
6+
import ToolkitProvider from 'react-bootstrap-table2-toolkit';
77
import Code from 'components/common/code-block';
88
import { productsGenerator } from 'utils/common';
99

1010
const products = productsGenerator();
11-
const { searchFactory } = Search;
1211

1312
const columns = [{
1413
dataField: 'id',
@@ -23,9 +22,8 @@ const columns = [{
2322

2423
const sourceCode = `\
2524
import BootstrapTable from 'react-bootstrap-table-next';
26-
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
25+
import ToolkitProvider from 'react-bootstrap-table2-toolkit';
2726
28-
const { searchFactory } = Search;
2927
const columns = [{
3028
dataField: 'id',
3129
text: 'Product ID'
@@ -59,15 +57,13 @@ const MySearch = (props) => {
5957
keyField="id"
6058
data={ products }
6159
columns={ columns }
60+
search
6261
>
6362
{
6463
props => (
6564
<div>
6665
<BootstrapTable
6766
{ ...props.baseProps }
68-
search={ searchFactory({
69-
...props.searchProps
70-
}) }
7167
/>
7268
<MySearch { ...props.searchProps } />
7369
<br />
@@ -101,15 +97,13 @@ export default () => (
10197
keyField="id"
10298
data={ products }
10399
columns={ columns }
100+
search
104101
>
105102
{
106103
props => (
107104
<div>
108105
<BootstrapTable
109106
{ ...props.baseProps }
110-
search={ searchFactory({
111-
...props.searchProps
112-
}) }
113107
/>
114108
<MySearch { ...props.searchProps } />
115109
<br />

‎packages/react-bootstrap-table2-example/examples/search/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
66
import Code from 'components/common/code-block';
77
import { productsGenerator } from 'utils/common';
88

9-
const { SearchBar, searchFactory } = Search;
9+
const { SearchBar } = Search;
1010
const products = productsGenerator();
1111

1212
const columns = [{
@@ -24,7 +24,7 @@ const sourceCode = `\
2424
import BootstrapTable from 'react-bootstrap-table-next';
2525
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
2626
27-
const { SearchBar, searchFactory } = Search;
27+
const { SearchBar } = Search;
2828
const columns = [{
2929
dataField: 'id',
3030
text: 'Product ID'
@@ -40,6 +40,7 @@ const columns = [{
4040
keyField="id"
4141
data={ products }
4242
columns={ columns }
43+
search
4344
>
4445
{
4546
props => (
@@ -49,9 +50,6 @@ const columns = [{
4950
<hr />
5051
<BootstrapTable
5152
{ ...props.baseProps }
52-
search={ searchFactory({
53-
...props.searchProps
54-
}) }
5553
/>
5654
</div>
5755
)
@@ -65,6 +63,7 @@ export default () => (
6563
keyField="id"
6664
data={ products }
6765
columns={ columns }
66+
search
6867
>
6968
{
7069
props => (
@@ -74,9 +73,6 @@ export default () => (
7473
<hr />
7574
<BootstrapTable
7675
{ ...props.baseProps }
77-
search={ searchFactory({
78-
...props.searchProps
79-
}) }
8076
/>
8177
</div>
8278
)

‎packages/react-bootstrap-table2-example/examples/search/search-formatted.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
66
import Code from 'components/common/code-block';
77
import { productsGenerator } from 'utils/common';
88

9-
const { SearchBar, searchFactory } = Search;
9+
const { SearchBar } = Search;
1010
const products = productsGenerator();
1111

1212
const columns = [{
@@ -25,7 +25,7 @@ const sourceCode = `\
2525
import BootstrapTable from 'react-bootstrap-table-next';
2626
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';
2727
28-
const { SearchBar, searchFactory } = Search;
28+
const { SearchBar } = Search;
2929
const columns = [{
3030
dataField: 'id',
3131
text: 'Product ID'
@@ -42,6 +42,7 @@ const columns = [{
4242
keyField="id"
4343
data={ products }
4444
columns={ columns }
45+
search={ { searchFormatted: true } }
4546
>
4647
{
4748
props => (
@@ -51,10 +52,6 @@ const columns = [{
5152
<hr />
5253
<BootstrapTable
5354
{ ...props.baseProps }
54-
search={ searchFactory({
55-
...props.searchProps,
56-
searchFormatted: true
57-
}) }
5855
/>
5956
</div>
6057
)
@@ -68,6 +65,7 @@ export default () => (
6865
keyField="id"
6966
data={ products }
7067
columns={ columns }
68+
search={ { searchFormatted: true } }
7169
>
7270
{
7371
props => (
@@ -77,10 +75,6 @@ export default () => (
7775
<hr />
7876
<BootstrapTable
7977
{ ...props.baseProps }
80-
search={ searchFactory({
81-
...props.searchProps,
82-
searchFormatted: true
83-
}) }
8478
/>
8579
</div>
8680
)

0 commit comments

Comments
(0)

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