react-bootstrap-table-ng-toolkit 4.19.0 → 4.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,19 +4,19 @@
4
4
 
5
5
  In the future, this toolkit will support other feature like row delete, insert etc. Right now we only following features:
6
6
 
7
- * Table Search
8
- * Export CSV
9
- * Column Toggle
7
+ - Table Search
8
+ - Export CSV
9
+ - Column Toggle
10
10
 
11
- **[Live Demo For Table Search](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook-static/?path=/docs/table-search--docs)**
11
+ **[Live Demo For Table Search](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/docs/table-search--docs)**
12
12
 
13
- **[Live Demo For Export CSV](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook-static/?path=/docs/export-csv--docs)**
13
+ **[Live Demo For Export CSV](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/docs/export-csv--docs)**
14
14
 
15
- **[Live Demo For Column Toggle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook-static/?path=/docs/column-toggle--docs)**
15
+ **[Live Demo For Column Toggle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/docs/column-toggle--docs)**
16
16
 
17
- **[API&Props Definitation](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html)**
17
+ **[API&Props Definitation](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html)**
18
18
 
19
- -----
19
+ ---
20
20
 
21
21
  ## Install
22
22
 
@@ -28,39 +28,30 @@ $ npm install react-bootstrap-table-ng-toolkit --save
28
28
 
29
29
  ```js
30
30
  // es5
31
- require('react-bootstrap-table-ng-toolkit/dist/react-bootstrap-table-ng-toolkit.min.css');
31
+ require("react-bootstrap-table-ng-toolkit/dist/react-bootstrap-table-ng-toolkit.min.css");
32
32
 
33
33
  // es6
34
- import 'react-bootstrap-table-ng-toolkit/dist/react-bootstrap-table-ng-toolkit.min.css';
34
+ import "react-bootstrap-table-ng-toolkit/dist/react-bootstrap-table-ng-toolkit.min.css";
35
35
  ```
36
36
 
37
37
  ## Table Search
38
38
 
39
39
  ```js
40
- import ToolkitProvider, { Search } from 'react-bootstrap-table-ng-toolkit';
40
+ import ToolkitProvider, { Search } from "react-bootstrap-table-ng-toolkit";
41
41
 
42
42
  const { SearchBar } = Search;
43
43
  //...
44
44
 
45
- <ToolkitProvider
46
- keyField="id"
47
- data={ products }
48
- columns={ columns }
49
- search
50
- >
51
- {
52
- props => (
53
- <div>
54
- <h3>Input something at below input field:</h3>
55
- <SearchBar { ...props.searchProps } />
56
- <hr />
57
- <BootstrapTable
58
- { ...props.baseProps }
59
- />
60
- </div>
61
- )
62
- }
63
- </ToolkitProvider>
45
+ <ToolkitProvider keyField="id" data={products} columns={columns} search>
46
+ {(props) => (
47
+ <div>
48
+ <h3>Input something at below input field:</h3>
49
+ <SearchBar {...props.searchProps} />
50
+ <hr />
51
+ <BootstrapTable {...props.baseProps} />
52
+ </div>
53
+ )}
54
+ </ToolkitProvider>;
64
55
  ```
65
56
 
66
57
  1. You have to enable the search functionality via `search` prop on `ToolkitProvider`.
@@ -70,216 +61,211 @@ const { SearchBar } = Search;
70
61
  3. You should render `SearchBar` with `searchProps` as well. The position of `SearchBar` is depends on you.
71
62
 
72
63
  ### `SearchBar` Props
64
+
73
65
  #### className - [string]
66
+
74
67
  Custom the class on input element.
75
68
 
76
69
  #### placeholder - [string]
70
+
77
71
  Custom the placeholder on input element.
78
72
 
79
73
  #### style - [object]
74
+
80
75
  Custom the style on input element.
81
76
 
82
77
  #### delay = [number]
78
+
83
79
  milionsecond for debounce user input.
84
80
 
85
81
  #### srText = [string]
82
+
86
83
  Customize the screen reader text for the search input. (Default: "Search this table")
87
84
 
88
85
  ### Search Options
89
86
 
90
87
  #### defaultSearch - [string]
88
+
91
89
  Accept a string that will be used for default searching when first time table render.
92
90
 
93
91
  ```js
94
92
  <ToolkitProvider
95
93
  keyField="id"
96
- data={ products }
97
- columns={ columns }
98
- search={ {
99
- defaultSearch: 'search something here'
100
- } }
94
+ data={products}
95
+ columns={columns}
96
+ search={{
97
+ defaultSearch: "search something here",
98
+ }}
101
99
  >
102
100
  // ...
103
101
  </ToolkitProvider>
104
102
  ```
105
103
 
106
104
  #### onColumnMatch - [function]
105
+
107
106
  Acccpt a function which will be called when table try to match every cells when search happening. This function accept an object like below example:
108
107
 
109
108
  ```js
110
- function onColumnMatch({
111
- searchText,
112
- value,
113
- column,
114
- row
115
- }) {
109
+ function onColumnMatch({ searchText, value, column, row }) {
116
110
  // implement your custom match logic on every cell value
117
111
  }
118
112
 
119
113
  <ToolkitProvider
120
114
  keyField="id"
121
- data={ products }
122
- columns={ columns }
123
- search={ {
124
- onColumnMatch
125
- } }
115
+ data={products}
116
+ columns={columns}
117
+ search={{
118
+ onColumnMatch,
119
+ }}
126
120
  >
127
121
  // ...
128
- </ToolkitProvider>
122
+ </ToolkitProvider>;
129
123
  ```
130
124
 
131
125
  > Notes: You have to return `true` when your match logic is positive and vice versa.
132
126
 
133
127
  #### searchFormatted - [bool]
128
+
134
129
  If you want to search on the formatted data, you are supposed to enable this props. `react-bootstrap-table-ng` will check if you define the `column.formatter` when doing search.
135
130
 
136
131
  ```js
137
132
  <ToolkitProvider
138
133
  keyField="id"
139
- data={ products }
140
- columns={ columns }
141
- search={ {
142
- searchFormatted: true
143
- } }
134
+ data={products}
135
+ columns={columns}
136
+ search={{
137
+ searchFormatted: true,
138
+ }}
144
139
  >
145
140
  // ...
146
141
  </ToolkitProvider>
147
142
  ```
148
143
 
149
144
  #### afterSearch - [Function]
145
+
150
146
  After search done, this callback function will be called with newest result.
151
147
 
152
148
  ```js
153
149
  <ToolkitProvider
154
150
  keyField="id"
155
- data={ products }
156
- columns={ columns }
157
- search={ {
158
- afterSearch: (newResult) => console.log(newResult)
159
- } }
151
+ data={products}
152
+ columns={columns}
153
+ search={{
154
+ afterSearch: (newResult) => console.log(newResult),
155
+ }}
160
156
  >
161
157
  // ...
162
158
  </ToolkitProvider>
163
159
  ```
164
160
 
165
161
  ### Clear Search Button
162
+
166
163
  We have a built-in clear search function which allow user clear search status via clicking button:
167
164
 
168
165
  ```js
169
- import ToolkitProvider, { Search } from 'react-bootstrap-table-ng-toolkit';
166
+ import ToolkitProvider, { Search } from "react-bootstrap-table-ng-toolkit";
170
167
 
171
168
  const { SearchBar, ClearSearchButton } = Search;
172
169
 
173
- <ToolkitProvider
174
- keyField="id"
175
- data={ products }
176
- columns={ columns }
177
- search
178
- >
179
- {
180
- props => (
181
- <div>
182
- <SearchBar { ...props.searchProps } />
183
- <ClearSearchButton { ...props.searchProps } />
184
- ....
185
- </div>
186
- )
187
- }
188
- </ToolkitProvider>
170
+ <ToolkitProvider keyField="id" data={products} columns={columns} search>
171
+ {(props) => (
172
+ <div>
173
+ <SearchBar {...props.searchProps} />
174
+ <ClearSearchButton {...props.searchProps} />
175
+ ....
176
+ </div>
177
+ )}
178
+ </ToolkitProvider>;
189
179
  ```
190
180
 
191
- -----
181
+ ---
192
182
 
193
183
  ## Export CSV
184
+
194
185
  There are two steps to enable the export CSV functionality:
195
186
 
196
187
  1. Give `exportCSV` prop as `true` on `ToolkitProvider`.
197
188
  2. Render `ExportCSVButton` with `csvProps`. The position of `ExportCSVButton` is depends on you.
198
189
 
199
190
  ```js
200
- import ToolkitProvider, { CSVExport } from 'react-bootstrap-table-ng-toolkit';
191
+ import ToolkitProvider, { CSVExport } from "react-bootstrap-table-ng-toolkit";
201
192
 
202
193
  const { ExportCSVButton } = CSVExport;
203
194
 
204
- <ToolkitProvider
205
- keyField="id"
206
- data={ products }
207
- columns={ columns }
208
- exportCSV
209
- >
210
- {
211
- props => (
212
- <div>
213
- <ExportCSVButton { ...props.csvProps }>Export CSV!!</ExportCSVButton>
214
- <hr />
215
- <BootstrapTable { ...props.baseProps } />
216
- </div>
217
- )
218
- }
219
- </ToolkitProvider>
195
+ <ToolkitProvider keyField="id" data={products} columns={columns} exportCSV>
196
+ {(props) => (
197
+ <div>
198
+ <ExportCSVButton {...props.csvProps}>Export CSV!!</ExportCSVButton>
199
+ <hr />
200
+ <BootstrapTable {...props.baseProps} />
201
+ </div>
202
+ )}
203
+ </ToolkitProvider>;
220
204
  ```
221
205
 
222
206
  ### Export CSV Options
223
207
 
224
208
  #### fileName - [String]
209
+
225
210
  Custom the csv file name.
226
211
 
227
212
  #### separator - [String]
213
+
228
214
  Custom the csv file separator.
229
215
 
230
216
  #### ignoreHeader - [bool]
217
+
231
218
  Default is `false`. Give true to avoid to attach the csv header.
232
219
 
233
220
  #### ignoreFooter - [bool]
221
+
234
222
  Default is `true`. Give `false` to attach the table footer if enabled.
235
223
 
236
224
  #### noAutoBOM - [bool]
225
+
237
226
  Default is `true`.
238
227
 
239
228
  #### blobType - [string]
229
+
240
230
  Default is `text/plain;charset=utf-8`. Change to update the blob type of the exported file.
241
231
 
242
232
  #### exportAll - [bool]
233
+
243
234
  Default is `true`. `false` will only export current data which display on table.
244
235
 
245
236
  #### onlyExportSelection - [bool]
237
+
246
238
  Default is `false`. `true` will only export the data which is selected.
247
239
 
248
240
  #### onlyExportFiltered - [bool]
241
+
249
242
  Default is `false`. `true` will only export the data which is filtered/searched.
250
243
 
251
- >> When you configure this prop as true, you must turn off `exportAll`.
244
+ > > When you configure this prop as true, you must turn off `exportAll`.
252
245
 
253
- -----
246
+ ---
254
247
 
255
248
  ## Column Toggle
256
249
 
257
250
  Let's see how to render the column toggle in your react component:
258
251
 
259
252
  ```js
260
- import BootstrapTable from 'react-bootstrap-table-ng';
261
- import ToolkitProvider, { ColumnToggle } from 'react-bootstrap-table-ng-toolkit';
262
-
263
- <ToolkitProvider
264
- keyField="id"
265
- data={ products }
266
- columns={ columns }
267
- columnToggle
268
- >
269
- {
270
- props => (
271
- <div>
272
- <ToggleList { ...props.columnToggleProps } />
273
- <hr />
274
- <BootstrapTable
275
- { ...props.baseProps }
276
- />
277
- </div>
278
- )
279
- }
280
- </ToolkitProvider>
253
+ import BootstrapTable from "react-bootstrap-table-ng";
254
+ import ToolkitProvider, {
255
+ ColumnToggle,
256
+ } from "react-bootstrap-table-ng-toolkit";
257
+
258
+ <ToolkitProvider keyField="id" data={products} columns={columns} columnToggle>
259
+ {(props) => (
260
+ <div>
261
+ <ToggleList {...props.columnToggleProps} />
262
+ <hr />
263
+ <BootstrapTable {...props.baseProps} />
264
+ </div>
265
+ )}
266
+ </ToolkitProvider>;
281
267
  ```
282
268
 
283
- > `columnToggleProps` props have enough information to let you custom the toggle list: [demo]([Live Demo For Export CSV](https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Export%20CSV&selectedStory=Custom%20Column%20Toggle))
269
+ > `columnToggleProps` props have enough information to let you custom the toggle list: [demo]([Live Demo For Export CSV](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/story/export-csv--hide-sv-column))
284
270
 
285
- If you want to have default visibility on specified column, you can just give `true` or `false` on `column.hidden`.
271
+ If you want to have default visibility on specified column, you can just give `true` or `false` on `column.hidden`.