react-bootstrap-table-ng-filter 4.19.1 → 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
@@ -2,11 +2,11 @@
2
2
 
3
3
  `react-bootstrap-table-ng` separate the filter core code base to [`react-bootstrap-table-ng-filter`](https://github.com/jeff-k-zhou/react-bootstrap-table-ng/tree/main/packages/react-bootstrap-table-ng-filter), so there's a little bit different when you use column filter than `react-bootstrap-table`. In the following, we are going to show you how to enable the column filter:
4
4
 
5
- **[Live Demo For Column Filter](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/index.html?selectedKind=Column%20Filter)**
5
+ **[Live Demo For Column Filter](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/docs/column-filter--docs)**
6
6
 
7
7
  **[API&Props Definitation](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/filter-props.html)**
8
8
 
9
- -----
9
+ ---
10
10
 
11
11
  ## Install
12
12
 
@@ -16,25 +16,26 @@ $ npm install react-bootstrap-table-ng-filter --save
16
16
 
17
17
  You can get all types of filters via import and these filters are a factory function to create a individual filter instance. Currently, we support following filters:
18
18
 
19
- * TextFilter
20
- * SelectFilter
21
- * MultiSelectFilter
22
- * NumberFilter
23
- * DateFilter
24
- * CustomFilter
25
- * **Coming soon!**
19
+ - TextFilter
20
+ - SelectFilter
21
+ - MultiSelectFilter
22
+ - NumberFilter
23
+ - DateFilter
24
+ - CustomFilter
25
+ - **Coming soon!**
26
26
 
27
27
  ## Add CSS
28
28
 
29
29
  ```js
30
30
  // es5
31
- require('react-bootstrap-table-ng-filter/dist/react-bootstrap-table-ng-filter.min.css');
31
+ require("react-bootstrap-table-ng-filter/dist/react-bootstrap-table-ng-filter.min.css");
32
32
 
33
33
  // es6
34
- import 'react-bootstrap-table-ng-filter/dist/react-bootstrap-table-ng-filter.min.css';
34
+ import "react-bootstrap-table-ng-filter/dist/react-bootstrap-table-ng-filter.min.css";
35
35
  ```
36
36
 
37
37
  ## Text Filter
38
+
38
39
  Following is a quick demo for enable the column filter on **Product Price** column!!
39
40
 
40
41
  ```js
@@ -72,6 +73,7 @@ const priceFilter = textFilter({
72
73
  ```
73
74
 
74
75
  ## Select Filter
76
+
75
77
  A quick example:
76
78
 
77
79
  ```js
@@ -137,6 +139,7 @@ const columns = [
137
139
  })
138
140
  }];
139
141
  ```
142
+
140
143
  ### Function as options
141
144
 
142
145
  ```js
@@ -301,12 +304,14 @@ const columns = [..., {
301
304
  ```
302
305
 
303
306
  In custom filter case, you are suppose to finish following two steps:
307
+
304
308
  1. Call `customFilter` and pass to `column.filter`
305
309
  2. Give `column.filterRenderer` as a callback function and return your custom filter element.
306
310
 
307
311
  ### column.filterRenderer
308
312
 
309
313
  This function will pass two argument to you:
314
+
310
315
  1. `onFilter`: call it to trigger filter when you need.
311
316
  2. `column`: Just the column object!
312
317
 
@@ -316,13 +321,12 @@ In the end, please remember to return your custom filter element!
316
321
 
317
322
  `customFilter` function just same as `textFilter`, `selectFilter` etc, it is for customization reason. However, in the custom filter case, there's only one props is valid: `type`
318
323
 
319
-
320
324
  ```js
321
- import filterFactory, { FILTER_TYPES } from 'react-bootstrap-table-ng-filter';
325
+ import filterFactory, { FILTER_TYPES } from "react-bootstrap-table-ng-filter";
322
326
 
323
327
  const customFilter = customFilter({
324
- type: FILTER_TYPES.NUMBER, // default is FILTER_TYPES.TEXT
325
- })
328
+ type: FILTER_TYPES.NUMBER, // default is FILTER_TYPES.TEXT
329
+ });
326
330
  ```
327
331
 
328
332
  `type` is a way to ask `react-bootstrap-table` to filter you data as number, select, date or normal text.
@@ -330,34 +334,37 @@ const customFilter = customFilter({
330
334
  ### FILTER_TYPES
331
335
 
332
336
  Following properties is valid in `FILTER_TYPES`:
333
- * TEXT
334
- * SELECT
335
- * NUMBER
336
- * DATE
337
- * MULTISELECT
337
+
338
+ - TEXT
339
+ - SELECT
340
+ - NUMBER
341
+ - DATE
342
+ - MULTISELECT
338
343
 
339
344
  ### Position
345
+
340
346
  Default filter is rendered inside the table column header, but you can choose to render them as a row by `filterPosition`:
341
347
 
342
348
  #### Render in the top of table body
343
349
 
344
350
  ```js
345
351
  <BootstrapTable
346
- keyField='id'
347
- data={ products }
348
- columns={ columns }
349
- filter={ filterFactory() }
352
+ keyField="id"
353
+ data={products}
354
+ columns={columns}
355
+ filter={filterFactory()}
350
356
  filterPosition="top"
351
357
  />
352
358
  ```
353
359
 
354
360
  #### Render in the bottom of table body
361
+
355
362
  ```js
356
363
  <BootstrapTable
357
- keyField='id'
358
- data={ products }
359
- columns={ columns }
360
- filter={ filterFactory() }
364
+ keyField="id"
365
+ data={products}
366
+ columns={columns}
367
+ filter={filterFactory()}
361
368
  filterPosition="bottom"
362
369
  />
363
370
  ```
@@ -367,6 +374,7 @@ Default filter is rendered inside the table column header, but you can choose to
367
374
  `filterFactory` is a factory function for initializing some internal config. Below is available options for `filterFactory`:
368
375
 
369
376
  ### afterFilter
377
+
370
378
  This hook function will be called with two arguments(new filter result and filter object) when filtering completed.
371
379
 
372
380
  ```js
@@ -379,9 +387,9 @@ export default () => (
379
387
  <div>
380
388
  <BootstrapTable
381
389
  keyField="id"
382
- data={ products }
383
- columns={ columns }
384
- filter={ filterFactory({ afterFilter }) }
390
+ data={products}
391
+ columns={columns}
392
+ filter={filterFactory({ afterFilter })}
385
393
  />
386
394
  </div>
387
395
  );