[ADF-1805] added some peer review changes and documentation changes

This commit is contained in:
VitoAlbano
2017-11-20 11:24:07 +00:00
parent 141bc0f8b4
commit c132ee61ee
5 changed files with 38 additions and 32 deletions

View File

@@ -59,6 +59,10 @@
],
"private": true,
"dependencies": {
"@alfresco/adf-content-services": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"@alfresco/adf-core": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"@alfresco/adf-insights": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"@alfresco/adf-process-services": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"@angular/animations": "5.0.0",
"@angular/cdk": "5.0.0-rc0",
"@angular/common": "5.0.0",
@@ -72,11 +76,7 @@
"@angular/platform-browser-dynamic": "5.0.0",
"@angular/router": "5.0.0",
"@ngx-translate/core": "8.0.0",
"alfresco-js-api": "2.0.0-de41fd8ca9c1c6f6072d2e06415eef0a71330dc0",
"@alfresco/adf-content-services": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"@alfresco/adf-process-services": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"@alfresco/adf-core": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"@alfresco/adf-insights": "2.0.0-303d0166157d305ebfbf1578bf5d1eadcaa631cc",
"alfresco-js-api": "^2.0.0-a5057a6373212ca42e5c29a1a2550cc78dca53ad",
"chart.js": "2.5.0",
"classlist.js": "1.1.20150312",
"core-js": "2.4.1",

View File

@@ -255,6 +255,7 @@
</content-actions>
</adf-document-list>
<adf-pagination
#standardPagination
*ngIf="!infiniteScrolling"
class="adf-documentlist-pagination"
[pagination]="pagination"

View File

@@ -25,7 +25,8 @@ import { MinimalNodeEntity, NodePaging, Pagination } from 'alfresco-js-api';
import {
AlfrescoApiService, ContentService, TranslationService,
FileUploadEvent, FolderCreatedEvent, LogService, NotificationService,
SiteModel, UploadService, DataColumn, DataRow, UserPreferencesService
SiteModel, UploadService, DataColumn, DataRow, UserPreferencesService,
PaginationComponent
} from '@alfresco/adf-core';
import { DocumentListComponent, PermissionStyleModel, DownloadZipDialogComponent } from '@alfresco/adf-content-services';
@@ -116,6 +117,9 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@ViewChild(DocumentListComponent)
documentList: DocumentListComponent;
@ViewChild(PaginationComponent)
standardPagination: PaginationComponent;
permissionsStyle: PermissionStyleModel[] = [];
supportedPages: number[] = [5, 10, 15, 20];
infiniteScrolling: boolean;
@@ -133,9 +137,9 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
private dialog: MatDialog,
private translateService: TranslationService,
private router: Router,
@Optional() private route: ActivatedRoute,
private logService: LogService,
private preference: UserPreferencesService) {
private preference: UserPreferencesService,
@Optional() private route: ActivatedRoute) {
}
showFile(event) {
@@ -254,8 +258,16 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
emitReadyEvent(event: any) {
this.documentListReady.emit(event);
this.pagination = event.list.pagination;
if (this.pageIsEmpty(event)) {
this.standardPagination.goPrevious();
} else {
this.documentListReady.emit(event);
this.pagination = event.list.pagination;
}
}
pageIsEmpty(node: NodePaging) {
return node && node.list && node.list.entries.length === 0;
}
onContentActionError(errors) {

View File

@@ -51,30 +51,30 @@ The properties currentFolderId, folderNode and node are the entry initialization
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| selectionMode | string | 'single' | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. |
| selection | Array<MinimalNodeEntity> | [] | Contains selected nodes |
| rowStyle | string | | The inline style to apply to every row, see [NgStyle](https://angular.io/docs/ts/latest/api/common/index/NgStyle-directive.html) docs for more details and usage examples |
| rowStyleClass | string | | The CSS class to apply to every row |
| currentFolderId | string | null | The ID of the folder node to display or a reserved string alias for special sources (see **Data Sources**) |
| folderNode | [MinimalNodeEntryEntity](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) | null | Currently displayed folder node |
| permissionsStyle | [PermissionStyleModel[]](permissions-style.model.md) | null | Define a set of CSS styles styles to apply depending on the permission of the user on that node. See the [Permission Style model](permissions-style.model.md) page for further details and examples. |
| paginationStrategy | PaginationStrategy | PaginationStrategy.Finite | The pagination type to be shown, can be Finite or Infinite |
| node | [NodePaging](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodePaging.md) | null | Document list will show all the nodes contained in the NodePaging entity |
| locationFormat | string | '/' | The default route for all the location-based columns (if declared). |
| navigate | boolean | true | Toggles navigation to folder content or file preview |
| loading | boolean | false | Toggles the loading state and animated spinners for the component. Used in combination with `navigate=false` to perform custom navigation and loading state indication. |
| navigationMode | string (click,dblclick) | dblclick | User interaction for folder navigation or file preview |
| thumbnails | boolean | false | Show document thumbnails rather than icons |
| selectionMode | string | 'single' | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. |
| multiselect | boolean | false | Toggles multiselect mode |
| contentActions | boolean | false | Toggles content actions for each row |
| contentActionsPosition | string (left\|right) | right | Position of the content actions dropdown menu. |
| contextMenuActions | boolean | false | Toggles context menus for each row |
| enablePagination | boolean | true | Shows pagination |
| rowFilter | `RowFilter` | | Custom row filter, [see more](#custom-row-filter). |
| imageResolver | `ImageResolver` | | Custom image resolver, [see more](#custom-image-resolver). |
| emptyFolderImageUrl | string | assets/images/empty_doc_lib.svg | Custom image for empty folder |
| allowDropFiles | boolean | false | Toggle file drop support for rows (see **ng2-alfresco-core/UploadDirective** for more details) |
| sorting | string[] | | Defines default sorting. The format is an array of 2 strings `[key, direction]` i.e. `['name', 'desc']` or `['name', 'asc']`. Set this value only if you want to override default sorting detected by the component based on columns. |
| locationFormat | string | '/' | The default route for all the location-based columns (if declared). |
| supportedPageSizes | number[] | [5, 10, 15, 20] | Supported page sizes for the pagination component. You can also use application configuration file to set it as a global setting using `document-list.supportedPageSizes` key. |
| rowStyle | string | | The inline style to apply to every row, see [NgStyle](https://angular.io/docs/ts/latest/api/common/index/NgStyle-directive.html) docs for more details and usage examples |
| rowStyleClass | string | | The CSS class to apply to every row |
| loading | boolean | false | Toggles the loading state and animated spinners for the component. Used in combination with `navigate=false` to perform custom navigation and loading state indication. |
| rowFilter | `RowFilter` | | Custom row filter, [see more](#custom-row-filter). |
| imageResolver | `ImageResolver` | | Custom image resolver, [see more](#custom-image-resolver). |
| currentFolderId | string | null | The ID of the folder node to display or a reserved string alias for special sources (see **Data Sources**) |
| folderNode | [MinimalNodeEntryEntity](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) | null | Currently displayed folder node |
| node | [NodePaging](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodePaging.md) | null | Document list will show all the nodes contained in the NodePaging entity |
| maxItems | number | Default value is stored into user preference settings | determine the size of the page for the element into document list |
| skipCount | number | 0 | element to skip over for pagination purpose |
| enableInfiniteScrolling | boolean | true | Enable documentlist to work into infinite scrolling mode |
### Events
@@ -128,13 +128,6 @@ Below is a basic example of handling DOM events in the parent elements.
</div>
```
### Pagination strategy
The Document List by default supports 2 type of pagination, the **finite** and the **infinite** pagination.
- With the **finite** pagination you got a normal pagination ui with information about the result's count, pages, and stepper arrows. On every pagination event the results will replace the previous list.
- With the **infinite** pagination there is only a "Load more" button at the end of your document list, and on every click (pagination event), the new results will be appended to the previous list.
### Data Sources
For the Document List data sources you can use one of the following options:

View File

@@ -155,7 +155,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
preview: EventEmitter<NodeEntityEvent> = new EventEmitter<NodeEntityEvent>();
@Output()
ready: EventEmitter<any> = new EventEmitter();
ready: EventEmitter<NodePaging> = new EventEmitter();
@Output()
error: EventEmitter<any> = new EventEmitter();