mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* fix after rebase * new release strategy for ng next Signed-off-by: eromano <eugenioromano16@gmail.com> * peer dep Signed-off-by: eromano <eugenioromano16@gmail.com> * Angular 14 fix unit test and storybook Signed-off-by: eromano <eugenioromano16@gmail.com> fix after rebase Signed-off-by: eromano <eugenioromano16@gmail.com> update pkg.json Signed-off-by: eromano <eugenioromano16@gmail.com> missing dep Signed-off-by: eromano <eugenioromano16@gmail.com> Fix mistake and missing code Dream....build only affected libs Add utility run commands * Use nx command to run affected tests * Fix nx test core fix content tests Run unit with watch false core test fixes reduce test warnings Fix process cloud unit Fix adf unit test Fix lint process cloud Disable lint next line Use right core path Fix insights unit fix linting insights Fix process-services unit fix the extensions test report fix test warnings Fix content unit Fix bunch of content unit * Produce an adf alpha of 14 * hopefully fixing the content * Push back the npm publish * Remove flaky unit * Fix linting * Make the branch as root * Get rid of angualar13 * Remove the travis depth * Fixing version for npm * Enabling cache for unit and build * Fix scss for core and paths Copy i18 and asset by using ng-packager Export the theming alias and fix path Use ng-package to copy assets process-services-cloud Use ng-package to copy assets process-services Use ng-package to copy assets content-services Use ng-package to copy assets insights * feat: fix api secondary entry point * fix storybook rebase * Move dist under dist/libs from lib/dist * Fix the webstyle * Use only necessary nrwl deps and improve lint * Fix unit for libs * Convert lint.sh to targets - improve performance * Use latest of angular * Align alfresco-js-api Signed-off-by: eromano <eugenioromano16@gmail.com> Co-authored-by: eromano <eugenioromano16@gmail.com> Co-authored-by: Mikolaj Serwicki <mikolaj.serwicki@hyland.com> Co-authored-by: Tomasz <tomasz.gnyp@hyland.com>
106 lines
4.7 KiB
Markdown
106 lines
4.7 KiB
Markdown
---
|
|
Title: Pagination Component
|
|
Added: v2.0.0
|
|
Status: Active
|
|
Last reviewed: 2018-11-20
|
|
---
|
|
|
|
# [Pagination Component](lib/core/src/lib/pagination/pagination.component.ts "Defined in pagination.component.ts")
|
|
|
|
Adds pagination to the component it is used with.
|
|
|
|

|
|
|
|
## Contents
|
|
|
|
- [Basic Usage](#basic-usage)
|
|
- [Class members](#class-members)
|
|
- [Properties](#properties)
|
|
- [Events](#events)
|
|
- [Details](#details)
|
|
- [Integrating with the Document List component](#integrating-with-the-document-list-component)
|
|
- [Custom pagination](#custom-pagination)
|
|
- [See also](#see-also)
|
|
|
|
## Basic Usage
|
|
|
|
```html
|
|
<adf-pagination
|
|
[pagination]="pagination"
|
|
[supportedPageSizes]="sizes"
|
|
(change)="onChange($event)"
|
|
(nextPage)="onNextPage($event)"
|
|
(prevPage)="onPreviousPage($event)"
|
|
(changePageSize)="onChangePageSize($event)"
|
|
(changePageNumber)="onChangePageNumber($event)">
|
|
</adf-pagination>
|
|
```
|
|
|
|
## Class members
|
|
|
|
### Properties
|
|
|
|
| Name | Type | Default value | Description |
|
|
| ---- | ---- | ------------- | ----------- |
|
|
| supportedPageSizes | `number[]` | | An array of page sizes. |
|
|
| target | [`PaginatedComponent`](lib/core/src/lib/pagination/paginated-component.interface.ts) | | Component that provides custom pagination support. |
|
|
| pagination | [`PaginationModel`](lib/core/src/lib/models/pagination.model.ts) | | Pagination object. |
|
|
|
|
### Events
|
|
|
|
| Name | Type | Description |
|
|
| ---- | ---- | ----------- |
|
|
| change | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`PaginationModel`](../../../lib/core/models/pagination.model.ts)`>` | Emitted when pagination changes in any way. |
|
|
| changePageNumber | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`PaginationModel`](../../../lib/core/models/pagination.model.ts)`>` | Emitted when the page number changes. |
|
|
| changePageSize | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`PaginationModel`](../../../lib/core/models/pagination.model.ts)`>` | Emitted when the page size changes. |
|
|
| nextPage | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`PaginationModel`](../../../lib/core/models/pagination.model.ts)`>` | Emitted when the next page is requested. |
|
|
| prevPage | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`PaginationModel`](../../../lib/core/models/pagination.model.ts)`>` | Emitted when the previous page is requested. |
|
|
|
|
## Details
|
|
|
|
You can use the [`Pagination`](../../../lib/content-services/document-list/models/document-library.model.ts) component to add pagination features to other components. The Alfresco
|
|
APIs make use of pagination to reduce the amount of data transferred in a single call. The start offset
|
|
and number of items in the page are passed during the call. The items of interest will be
|
|
returned along with a [`Pagination`](../../../lib/content-services/document-list/models/document-library.model.ts) object. You can use this object to set up the [pagination component](pagination.component.md)
|
|
and then subscribe to one of the page change events. This will return updated pagination data that you
|
|
can pass to a subsequent API call.
|
|
|
|
Each event corresponds to a particular action from the user. For the `change` event, a
|
|
PaginationQueryParams object is returned. This contains the query
|
|
parameters supported by the REST API, `skipCount` and `maxItems`.
|
|
|
|
For all events other than `change`, a new [`Pagination`](../../../lib/content-services/document-list/models/document-library.model.ts) object is returned as in the following example. The
|
|
new object contains updated properties that you can use to fetch the next page of information.
|
|
|
|
### Integrating with the Document List component
|
|
|
|
```html
|
|
<adf-document-list #documentList ...></adf-document-list>
|
|
|
|
<adf-pagination [target]="documentList" ...>
|
|
</adf-pagination>
|
|
```
|
|
|
|
### Custom pagination
|
|
|
|
The component also makes it easy to integrate your own implementation of pagination.
|
|
You can supply any component that implements the [`PaginatedComponent`](lib/core/src/lib/pagination/paginated-component.interface.ts) interface as the value of the
|
|
`target` property.
|
|
|
|
```js
|
|
export interface PaginatedComponent {
|
|
|
|
pagination: Subject<Pagination>;
|
|
updatePagination(params: PaginationQueryParams);
|
|
|
|
}
|
|
```
|
|
|
|
Your component must provide a `pagination` subject to allow the [`Pagination`](../../../lib/content-services/document-list/models/document-library.model.ts) component to respond to changes.
|
|
Every time user interacts with the [`Pagination`](../../../lib/content-services/document-list/models/document-library.model.ts) component, it will call the `updatePagination` method
|
|
and pass the updated parameters.
|
|
|
|
## See also
|
|
|
|
- [Infinite Pagination component](infinite-pagination.component.md)
|