react-bootstrap-table-ng-paginator 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
@@ -2,11 +2,11 @@
2
2
 
3
3
  `react-bootstrap-table-ng` separate the pagination code base to [`react-bootstrap-table-ng-paginator`](https://github.com/jeff-k-zhou/react-bootstrap-table-ng/tree/main/packages/react-bootstrap-table-ng-paginator), so there's a little bit different when you use pagination. In the following, we are going to show you how to enable and configure the a pagination table
4
4
 
5
- **[Live Demo For Pagination](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook-static/?path=/docs/pagination--docs)**
5
+ **[Live Demo For Pagination](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/docs/pagination--docs)**
6
6
 
7
- **[API&Props Definitation](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html)**
7
+ **[API&Props Definitation](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html)**
8
8
 
9
- -----
9
+ ---
10
10
 
11
11
  ## Install
12
12
 
@@ -18,10 +18,10 @@ $ npm install react-bootstrap-table-ng-paginator --save
18
18
 
19
19
  ```js
20
20
  // es5
21
- require('react-bootstrap-table-ng-paginator/dist/react-bootstrap-table-ng-paginator.min.css');
21
+ require("react-bootstrap-table-ng-paginator/dist/react-bootstrap-table-ng-paginator.min.css");
22
22
 
23
23
  // es6
24
- import 'react-bootstrap-table-ng-paginator/dist/react-bootstrap-table-ng-paginator.min.css';
24
+ import "react-bootstrap-table-ng-paginator/dist/react-bootstrap-table-ng-paginator.min.css";
25
25
  ```
26
26
 
27
27
  ## How
@@ -29,10 +29,15 @@ import 'react-bootstrap-table-ng-paginator/dist/react-bootstrap-table-ng-paginat
29
29
  Let's enable a pagination on your table:
30
30
 
31
31
  ```js
32
- import paginationFactory from 'react-bootstrap-table-ng-paginator';
32
+ import paginationFactory from "react-bootstrap-table-ng-paginator";
33
33
  // omit...
34
34
 
35
- <BootstrapTable keyField='id' data={ products } columns={ columns } pagination={ paginationFactory() } />
35
+ <BootstrapTable
36
+ keyField="id"
37
+ data={products}
38
+ columns={columns}
39
+ pagination={paginationFactory()}
40
+ />;
36
41
  ```
37
42
 
38
43
  ## Customization
@@ -41,49 +46,50 @@ import paginationFactory from 'react-bootstrap-table-ng-paginator';
41
46
 
42
47
  `react-bootstrap-table-ng` give some simple ways to customize something like text, styling etc, following is all the props we support for basic customization:
43
48
 
44
- * [paginationSize](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationpaginationsize-number)
45
- * [sizePerPageList](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationsizeperpagelist-array)
46
- * [withFirstAndLast](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationwithfirstandlast-bool)
47
- * [alwaysShowAllBtns](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationalwaysshowallbtns-bool)
48
- * [firstPageText](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationfirstpagetext-any)
49
- * [prePageText](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationprepagetext-any)
50
- * [nextPageText](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationnextpagetext-any)
51
- * [lastPageText](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationlastpagetext-any)
52
- * [firstPageTitle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationfirstpagetitle-any)
53
- * [prePageTitle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationprepagetitle-any)
54
- * [nextPageTitle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationnextpagetitle-any)
55
- * [lastPageTitle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationlastpagetitle-any)
56
- * [hideSizePerPage](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationhidesizeperpage-bool)
57
- * [hidePageListOnlyOnePage](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationhidepagelistonlyonepage-bool)
58
- * [showTotal](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationshowtotal-bool)
59
- * [disablePageTitle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationdisablepagetitle-bool)
60
-
61
- You can check [this online demo](https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Pagination&selectedStory=Custom%20Pagination&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel) for above props usage.
49
+ - [paginationSize](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationsizeperpage-number)
50
+ - [sizePerPageList](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationsizeperpagelist-array)
51
+ - [withFirstAndLast](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationwithfirstandlast-bool)
52
+ - [alwaysShowAllBtns](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationalwaysshowallbtns-bool)
53
+ - [firstPageText](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationfirstpagetext-any)
54
+ - [prePageText](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationprepagetext-any)
55
+ - [nextPageText](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationnextpagetext-any)
56
+ - [lastPageText](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationlastpagetext-any)
57
+ - [firstPageTitle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationfirstpagetitle-any)
58
+ - [prePageTitle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationprepagetitle-any)
59
+ - [nextPageTitle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationnextpagetitle-any)
60
+ - [lastPageTitle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationlastpagetitle-any)
61
+ - [hideSizePerPage](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationhidesizeperpage-bool)
62
+ - [hidePageListOnlyOnePage](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationhidepagelistonlyonepage-bool)
63
+ - [showTotal](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationshowtotal-bool)
64
+ - [disablePageTitle](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationdisablepagetitle-bool)
65
+
66
+ You can check [this online demo](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/story/pagination--full-custom-pagination) for above props usage.
62
67
 
63
68
  ### Advance Customization
64
69
 
65
70
  Sometime, you may feel above props is not satisfied with your requirement, don't worry, we provide following renderer for each part of pagination:
66
71
 
67
- * [pageListRenderer](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationpagelistrenderer-function)
68
- * [pageButtonRenderer](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationpagebuttonrenderer-function)
69
- * [sizePerPageRenderer](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationsizeperpagerenderer-function)
70
- * [sizePerPageOptionRenderer](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationsizeperpageoptionrenderer-function)
71
- * [paginationTotalRenderer](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationpaginationtotalrenderer-function)
72
+ - [pageListRenderer](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationpagelistrenderer-function)
73
+ - [pageButtonRenderer](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationpagebuttonrenderer-function)
74
+ - [sizePerPageRenderer](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationsizeperpagerenderer-function)
75
+ - [sizePerPageOptionRenderer](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationsizeperpageoptionrenderer-function)
76
+ - [paginationTotalRenderer](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/docs/pagination-props.html#paginationpaginationtotalrenderer-function)
72
77
 
73
78
  ### Fully Customization
74
79
 
75
80
  If you want to customize the pagination component completely, you may get interesting on following solutions:
76
81
 
77
- * Standalone
78
- * Non-standalone
82
+ - Standalone
83
+ - Non-standalone
79
84
 
80
85
  `react-bootstrap-table-ng-paginator` have a `PaginationProvider` which is a react context and that will be easier to customize the pagination components under the scope of `PaginationProvider`. Let's introduce it step by step:
81
86
 
82
87
  #### 1. Import PaginationProvider
83
88
 
84
89
  ```js
85
- import paginationFactory, { PaginationProvider } from 'react-bootstrap-table-ng-paginator';
86
-
90
+ import paginationFactory, {
91
+ PaginationProvider,
92
+ } from "react-bootstrap-table-ng-paginator";
87
93
  ```
88
94
 
89
95
  #### 2. Declare custom and totalSize in pagination option:
@@ -91,7 +97,7 @@ import paginationFactory, { PaginationProvider } from 'react-bootstrap-table-ng-
91
97
  ```js
92
98
  const paginationOption = {
93
99
  custom: true,
94
- totalSize: products.length
100
+ totalSize: products.length,
95
101
  };
96
102
  ```
97
103
 
@@ -114,40 +120,35 @@ const paginationOption = {
114
120
 
115
121
  `PaginationProvider` actually is a wrapper for the concumser of react context, so that now you have to get the props from context provide then render to your compoennt and `BootstrapTable`:
116
122
 
117
- * `paginationProps`: this include everything about pagination, you will use it when you render standalone component or your custom component.
118
- * `paginationTableProps`: you don't need to know about this, but you have to render this as props to `BootstrapTable`.
123
+ - `paginationProps`: this include everything about pagination, you will use it when you render standalone component or your custom component.
124
+ - `paginationTableProps`: you don't need to know about this, but you have to render this as props to `BootstrapTable`.
119
125
 
120
126
  So far, your customization pagination is supposed to look like it:
127
+
121
128
  ```js
122
- <PaginationProvider
123
- pagination={ paginationFactory(options) }
124
- >
125
- {
126
- ({
127
- paginationProps,
128
- paginationTableProps
129
- }) => (
130
- <div>
131
- <BootstrapTable
132
- keyField="id"
133
- data={ products }
134
- columns={ columns }
135
- { ...paginationTableProps }
136
- />
137
- </div>
138
- )
139
- }
129
+ <PaginationProvider pagination={paginationFactory(options)}>
130
+ {({ paginationProps, paginationTableProps }) => (
131
+ <div>
132
+ <BootstrapTable
133
+ keyField="id"
134
+ data={products}
135
+ columns={columns}
136
+ {...paginationTableProps}
137
+ />
138
+ </div>
139
+ )}
140
140
  </PaginationProvider>
141
141
  ```
142
142
 
143
143
  Now, you have to choose which solution you like: standalone or non-standalone ?
144
144
 
145
145
  #### 4.1 Use Standalone Component
146
+
146
147
  `react-bootstrap-table-ng-paginator` provider three standalone components:
147
148
 
148
- * Size Per Page Dropdwn Standalone
149
- * Pagination List Standalone
150
- * Pagination Total Standalone
149
+ - Size Per Page Dropdwn Standalone
150
+ - Pagination List Standalone
151
+ - Pagination Total Standalone
151
152
 
152
153
  When render each standalone, you just need to pass the `paginationProps` props to standalone component:
153
154
 
@@ -156,93 +157,83 @@ import paginationFactory, {
156
157
  PaginationProvider,
157
158
  PaginationListStandalone,
158
159
  SizePerPageDropdownStandalone,
159
- PaginationTotalStandalone
160
- } from 'react-bootstrap-table-ng-paginator';
161
-
162
- <PaginationProvider
163
- pagination={ paginationFactory(options) }
164
- >
165
- {
166
- ({
167
- paginationProps,
168
- paginationTableProps
169
- }) => (
170
- <div>
171
- <SizePerPageDropdownStandalone
172
- { ...paginationProps }
173
- />
174
- <PaginationTotalStandalone
175
- { ...paginationProps }
176
- />
177
- <BootstrapTable
178
- keyField="id"
179
- data={ products }
180
- columns={ columns }
181
- { ...paginationTableProps }
182
- />
183
- <PaginationListStandalone
184
- { ...paginationProps }
185
- />
186
- </div>
187
- )
188
- }
189
- </PaginationProvider>
160
+ PaginationTotalStandalone,
161
+ } from "react-bootstrap-table-ng-paginator";
162
+
163
+ <PaginationProvider pagination={paginationFactory(options)}>
164
+ {({ paginationProps, paginationTableProps }) => (
165
+ <div>
166
+ <SizePerPageDropdownStandalone {...paginationProps} />
167
+ <PaginationTotalStandalone {...paginationProps} />
168
+ <BootstrapTable
169
+ keyField="id"
170
+ data={products}
171
+ columns={columns}
172
+ {...paginationTableProps}
173
+ />
174
+ <PaginationListStandalone {...paginationProps} />
175
+ </div>
176
+ )}
177
+ </PaginationProvider>;
190
178
  ```
191
179
 
192
- That's it!! The benifit for using standalone is you can much easier to render the standalone component in any posistion. In the future, we will implement more featue like applying `style`, `className` etc on standalone components.
180
+ That's it!! The benifit for using standalone is you can much easier to render the standalone component in any posistion. In the future, we will implement more featue like applying `style`, `className` etc on standalone components.
193
181
 
194
182
  ##### Customizable props for `PaginationListStandalone`
195
- * N/A
183
+
184
+ - N/A
196
185
 
197
186
  ##### Customizable props for `SizePerPageDropdownStandalone`
198
- * `open`: `true` to make dropdown show.
199
- * `hidden`: `true` to hide the size per page dropdown.
200
- * `btnContextual`: Set the button contextual
201
- * `variation`: Variation for dropdown, available value is `dropdown` and `dropup`.
202
- * `className`: Custom the class on size per page dropdown
187
+
188
+ - `open`: `true` to make dropdown show.
189
+ - `hidden`: `true` to hide the size per page dropdown.
190
+ - `btnContextual`: Set the button contextual
191
+ - `variation`: Variation for dropdown, available value is `dropdown` and `dropup`.
192
+ - `className`: Custom the class on size per page dropdown
203
193
 
204
194
  ##### Customizable props for `SizePerPageDropdownStandalone`
205
- * N/A
195
+
196
+ - N/A
206
197
 
207
198
  #### 4.2 Customization Everything
208
199
 
209
200
  If you choose to custom the pagination component by yourself, the `paginationProps` will be important for you. Becasue you have to know for example how to change page or what's the current page etc. Hence, following is all the props in `paginationProps` object:
210
201
 
211
202
  ```js
212
- page,
213
- sizePerPage,
214
- pageStartIndex,
215
- hidePageListOnlyOnePage,
216
- hideSizePerPage,
217
- alwaysShowAllBtns,
218
- withFirstAndLast,
219
- dataSize,
220
- sizePerPageList,
221
- paginationSize,
222
- showTotal,
223
- pageListRenderer,
224
- pageButtonRenderer,
225
- sizePerPageRenderer,
226
- paginationTotalRenderer,
227
- sizePerPageOptionRenderer,
228
- firstPageText,
229
- prePageText,
230
- nextPageText,
231
- lastPageText,
232
- prePageTitle,
233
- nextPageTitle,
234
- firstPageTitle,
235
- lastPageTitle,
236
- onPageChange,
237
- onSizePerPageChange,
238
- disablePageTitle
203
+ (page,
204
+ sizePerPage,
205
+ pageStartIndex,
206
+ hidePageListOnlyOnePage,
207
+ hideSizePerPage,
208
+ alwaysShowAllBtns,
209
+ withFirstAndLast,
210
+ dataSize,
211
+ sizePerPageList,
212
+ paginationSize,
213
+ showTotal,
214
+ pageListRenderer,
215
+ pageButtonRenderer,
216
+ sizePerPageRenderer,
217
+ paginationTotalRenderer,
218
+ sizePerPageOptionRenderer,
219
+ firstPageText,
220
+ prePageText,
221
+ nextPageText,
222
+ lastPageText,
223
+ prePageTitle,
224
+ nextPageTitle,
225
+ firstPageTitle,
226
+ lastPageTitle,
227
+ onPageChange,
228
+ onSizePerPageChange,
229
+ disablePageTitle);
239
230
  ```
240
231
 
241
232
  In most of case, `page`, `sizePerPage`, `onPageChange` and `onSizePerPageChange` are most important things for developer.
242
233
 
243
- * `page`: Current page.
244
- * `sizePerPage`: Current size per page.
245
- * `onPageChange`: Call it when you nede to change page. This function accept one number argument which indicate the new page
246
- * `onSizePerPageChange`: Call it when you nede to change size per page. This function accept two number argument which indicate the new sizePerPage and new page
234
+ - `page`: Current page.
235
+ - `sizePerPage`: Current size per page.
236
+ - `onPageChange`: Call it when you nede to change page. This function accept one number argument which indicate the new page
237
+ - `onSizePerPageChange`: Call it when you nede to change size per page. This function accept two number argument which indicate the new sizePerPage and new page
247
238
 
248
- [Here](https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Pagination&selectedStory=Fully%20Custom%20Pagination&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel) is a online example.
239
+ [Here](https://jeff-k-zhou.github.io/react-bootstrap-table-ng/storybook/?path=/story/pagination--full-custom-pagination) is a online example.