diff --git a/docs/content-services/components/document-list.component.md b/docs/content-services/components/document-list.component.md index bf538252be3..e6897f3f7ea 100644 --- a/docs/content-services/components/document-list.component.md +++ b/docs/content-services/components/document-list.component.md @@ -99,19 +99,19 @@ Displays the documents from a repository. ### Events -| Name | Type | Description | -| ---- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the API fails to get the Document List data | -| filterSelection | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FilterSearch`](../../../lib/content-services/src/lib/search/models/filter-search.interface.ts)`[]>` | Emitted when a filter value is selected | -| folderChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntryEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the current display folder changes | -| nodeClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntityEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the user clicks a list node | -| nodeDblClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntityEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the user double-clicks a list node | -| nodeSelected | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`[]>` | Emitted when the node selection change | -| preview | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntityEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the user acts upon files with either single or double click (depends on `navigation-mode`). Useful for integration with the [Viewer component](../../core/components/viewer.component.md). | -| ready | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)`>` | Emitted when the Document List has loaded all items and is ready for use | -| columnsVisibilityChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<{ [columnId: string]: boolean } \| undefined>` | Emitted when columns visibility change | Emitted when the Document List has loaded all items and is ready for use | -| columnsWidthChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<{ [columnId: string]: number } \| undefined>` | Emitted when columns width change | Emitted when the Document List has loaded all items and is ready for use | -| columnsOrderChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`< string[] \| undefined>` | Emitted when columns order change | Emitted when the Document List has loaded all items and is ready for use | +| Name | Type | Description | +| ---- | ---- | ----------- | +| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the API fails to get the Document List data | +| filterSelection | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FilterSearch`](../../../lib/content-services/src/lib/search/models/filter-search.interface.ts)`[]>` | Emitted when a filter value is selected | +| folderChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntryEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the current display folder changes | +| nodeClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntityEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the user clicks a list node | +| nodeDblClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntityEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the user double-clicks a list node | +| nodeSelected | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`[]>` | Emitted when the node selection change | +| preview | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodeEntityEvent`](../../../lib/content-services/src/lib/document-list/components/node.event.ts)`>` | Emitted when the user acts upon files with either single or double click (depends on `navigation-mode`). Useful for integration with the [Viewer component](../../core/components/viewer.component.md). | +| ready | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)`>` | Emitted when the Document List has loaded all items and is ready for use | +| columnsVisibilityChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<{ [columnId: string]: boolean } \| undefined>` | Emitted when columns visibility change | +| columnsWidthChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<{ [columnId: string]: number } \| undefined>` | Emitted when columns width change | +| columnsOrderChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`< string[] \| undefined>` | Emitted when columns order change | ## Details diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.html b/lib/content-services/src/lib/document-list/components/document-list.component.html index 63c2d1a543e..77d388818f5 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.html +++ b/lib/content-services/src/lib/document-list/components/document-list.component.html @@ -21,8 +21,8 @@ (showRowContextMenu)="onShowRowContextMenu($event)" (showRowActionsMenu)="onShowRowActionsMenu($event)" (executeRowAction)="onExecuteRowAction($event)" - (columnsWidthChanged)="onColumnsWidthChanged($event)" - (columnOrderChanged)="onColumnOrderChanged($event)" + (columnsWidthChanged)="onColumnsWidthChange($event)" + (columnOrderChanged)="onColumnOrderChange($event)" (rowClick)="onNodeClick($event.value?.node)" (rowDblClick)="onNodeDblClick($event.value?.node)" (row-select)="onNodeSelect($any($event).detail)" diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts index f918c60c346..6e547963496 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts @@ -898,20 +898,20 @@ describe('DocumentList', () => { it('should emit new columns order on columnOrderChanged', () => { const newColumnsOrder = [{key: 'key', type: 'text', id: 'tag'}, {key: 'key1', type: 'text', id: 'name'}]; spyOn(documentList.columnsOrderChanged, 'emit'); - spyOn(documentList, 'onColumnOrderChanged').and.callThrough(); + spyOn(documentList, 'onColumnOrderChange').and.callThrough(); documentList.dataTable.columnOrderChanged.emit(newColumnsOrder as DataColumn[]); - expect(documentList.onColumnOrderChanged).toHaveBeenCalledWith(newColumnsOrder); + expect(documentList.onColumnOrderChange).toHaveBeenCalledWith(newColumnsOrder); expect(documentList.columnsOrderChanged.emit).toHaveBeenCalledWith(['tag', 'name']); }); it('should emit new columns width on columnsWidthChanged', () => { const newColumnWidth = [{key: 'key', type: 'text', id: 'tag', width: 65}, {key: 'key1', type: 'text', id: 'name', width: 77}]; spyOn(documentList.columnsWidthChanged, 'emit'); - spyOn(documentList, 'onColumnsWidthChanged').and.callThrough(); + spyOn(documentList, 'onColumnsWidthChange').and.callThrough(); documentList.dataTable.columnsWidthChanged.emit(newColumnWidth as DataColumn[]); - expect(documentList.onColumnsWidthChanged).toHaveBeenCalledWith(newColumnWidth); + expect(documentList.onColumnsWidthChange).toHaveBeenCalledWith(newColumnWidth); expect(documentList.columnsWidthChanged.emit).toHaveBeenCalledWith({'tag': 65, 'name': 77}); }); diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.ts b/lib/content-services/src/lib/document-list/components/document-list.component.ts index fb814c563cb..18319ec43dc 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.ts @@ -327,7 +327,7 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On /** Sets columns width for DataTableSchema */ @Input() - set setColumnsWidths (columnsWidths: { [columnId: string]: number } | undefined) { + set setColumnsWidths(columnsWidths: { [columnId: string]: number } | undefined) { this.columnsWidths = columnsWidths; } @@ -823,13 +823,13 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On this.columnsVisibilityChanged.emit(this.columnsVisibility); } - onColumnOrderChanged(columnsWithNewOrder: DataColumn[]) { + onColumnOrderChange(columnsWithNewOrder: DataColumn[]) { this.columnsOrder = columnsWithNewOrder.map((column) => column.id); this.createColumns(); this.columnsOrderChanged.emit(this.columnsOrder); } - onColumnsWidthChanged(columns: DataColumn[]) { + onColumnsWidthChange(columns: DataColumn[]) { const newColumnsWidths = columns.reduce((widthsColumnsMap, column) => { if (column.width) { widthsColumnsMap[column.id] = Math.ceil(column.width);