[ADF-994] Integrate SFS enhancements for Pagination component (#2119)

* Add pagination module with pagination component

* Update the old pagination to have the old selector

* Add licence headers to ts files

* Update pagination files

* Rename properties for consistency reasons and remove redundant event emitters

* Add PaginationQueryParams interface to reference the query params used for paginated requests

* Add documentation of pagination (work in progress)

* Add i18n translations to pagination component

* Rename some variables used in pagination template

* Update pagination component to be backwards compatible

* Update pagination component specs

* Update pagination’s documentation

* Remove the old pagination code

* Add old alfresco-pagination tag selector

* Update document list component to include the new pagination

* Add adf-pagination in search component

* Update link to pagination component from main readme file

* Update search component specs

* Add a default pagination object in case it’s not provided

* Assign pagination to default one to default the missing properties (if any)

* Remove unused variables

* Add fail hints from expectancies of pagination tests

* Add default onInit and remove the old defaults
This commit is contained in:
Cristi Socea
2017-08-08 18:37:47 +03:00
committed by Eugenio Romano
parent 5a26bdbb0d
commit 3973303e41
20 changed files with 738 additions and 375 deletions

View File

@@ -0,0 +1,37 @@
# Pagination Component
## Basic example
```html
<adf-pagination
[pagination]="pagination"
[supportedPageSizes]="sizes"
(change)="onChange($event)"
(nextPage)="onNextPage($event)"
(prevPage)="onPreviousPage($event)"
(changePageSize)="onChangePageSize($event)"
(changePageNumber)="onChangePageNumber($event)">
</adf-pagination>
```
Depending on the pagination data, you should see result similar to the following one:
![](../../../docs/pagination/basic.png)
## Properties
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| pagination | Pagination | | Pagination object |
| supportedPageSizes | Array&lt;number&gt; | [ 25, 50, 100 ] | An array of page sizes |
| change | EventEmitter&lt;PaginationQueryParams&gt; | | Triggered for any action in pagination |
| nextPage | EventEmitter&lt;Pagination&gt; | | Triggered on next page action |
| prevPage | EventEmitter&lt;Pagination&gt; | | Triggered on previous page action |
| changePageSize | EventEmitter&lt;Pagination&gt; | | Triggered on page size change action |
| changePageNumber | EventEmitter&lt;Pagination&gt; | | Triggered on page change action |
Each event helps to detect the certain action that user have made using the component.
For `change` event, a [PaginationQueryParams](https://github.com/Alfresco/alfresco-ng2-components/tree/master/ng2-components/ng2-alfresco-core/src/components/pagination/pagination-query-params.ts) (including the query params supported by the REST API, `skipCount` and `maxItems`) is returned.
For all other events, other than `change`, a new [Pagination object](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/Pagination.md) is returned as in the folowing example, with updated properties to be used to query further.