From fd6433027aa0fa780c1c0375d4658900e602163a Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 28 Feb 2017 13:56:48 +0000 Subject: [PATCH 001/113] Update README.md --- ng2-components/ng2-activiti-form/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ng2-components/ng2-activiti-form/README.md b/ng2-components/ng2-activiti-form/README.md index 648fc16f55e..4a377ee56f8 100644 --- a/ng2-components/ng2-activiti-form/README.md +++ b/ng2-components/ng2-activiti-form/README.md @@ -31,6 +31,8 @@

+See it live: [Form Quickstart](https://embed.plnkr.co/YSLXTqb3DtMhVJSqXKkE/) + ## Library Contents ### Components From 3e342863fd4603fc2a394666dd6a2449174c5c70 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 2 Mar 2017 14:48:58 +0000 Subject: [PATCH 002/113] Update tsconfig.json for demo shell (#1684) fixes issues with building for Windows --- demo-shell-ng2/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/demo-shell-ng2/tsconfig.json b/demo-shell-ng2/tsconfig.json index 335fc62939a..7852349ef51 100644 --- a/demo-shell-ng2/tsconfig.json +++ b/demo-shell-ng2/tsconfig.json @@ -8,7 +8,8 @@ "experimentalDecorators": true, "lib": ["es2015", "dom"], "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true + "suppressImplicitAnyIndexErrors": true, + "noResolve": true }, "exclude": [ "node_modules" From 4ca18bc8f9a7b21cb4d3da2545b5381f44096fc0 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 2 Mar 2017 14:49:55 +0000 Subject: [PATCH 003/113] cancellable events for DataTable and DocumentList (#1682) * cancellable events for DataTable and DocumentList * more typed events and code fixes * code fixes --- ...ti-process-instance-variables.component.ts | 15 ++-- .../activiti-processlist.component.spec.ts | 2 +- .../activiti-tasklist.component.spec.ts | 2 +- ng2-components/ng2-alfresco-core/index.ts | 2 + .../src/events/base-ui.event.ts | 25 ++++++ .../src/events/base.event.ts | 32 +++++++ .../ng2-alfresco-datatable/index.ts | 2 + .../components/datatable/data-cell.event.ts | 42 +++++++++ .../datatable/data-row-action.event.ts | 39 ++++++++ .../datatable/datatable.component.ts | 54 +++++------ .../src/data/datatable-adapter.ts | 12 ++- .../ng2-alfresco-documentlist/index.ts | 1 + .../document-list.component.spec.ts | 4 +- .../src/components/document-list.component.ts | 89 +++++++++---------- .../src/components/node.event.ts | 33 +++++++ 15 files changed, 260 insertions(+), 94 deletions(-) create mode 100644 ng2-components/ng2-alfresco-core/src/events/base-ui.event.ts create mode 100644 ng2-components/ng2-alfresco-core/src/events/base.event.ts create mode 100644 ng2-components/ng2-alfresco-datatable/src/components/datatable/data-cell.event.ts create mode 100644 ng2-components/ng2-alfresco-datatable/src/components/datatable/data-row-action.event.ts create mode 100644 ng2-components/ng2-alfresco-documentlist/src/components/node.event.ts diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-variables.component.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-variables.component.ts index bbfda20f432..34c8ae18f41 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-variables.component.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-variables.component.ts @@ -18,7 +18,7 @@ import { Component, DebugElement, EventEmitter, Input, Output, OnInit, ViewChild, OnChanges, SimpleChanges } from '@angular/core'; import { AlfrescoTranslationService } from 'ng2-alfresco-core'; -import { ObjectDataTableAdapter, DataTableAdapter, ObjectDataRow } from 'ng2-alfresco-datatable'; +import { ObjectDataTableAdapter, DataTableAdapter, ObjectDataRow, DataCellEvent } from 'ng2-alfresco-datatable'; import { ProcessInstanceVariable } from './../models/process-instance-variable.model'; import { ActivitiProcessService } from './../services/activiti-process.service'; @@ -265,13 +265,10 @@ export class ActivitiProcessInstanceVariables implements OnInit, OnChanges { } } - onShowRowActionsMenu(event) { - event.args.actions = [{ - id: 'delete', - title: 'Delete' - }, { - id: 'edit', - title: 'Edit' - }]; + onShowRowActionsMenu(event: DataCellEvent) { + event.value.actions = [ + { id: 'delete', title: 'Delete' }, + { id: 'edit', title: 'Edit' } + ]; } } diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-processlist.component.spec.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-processlist.component.spec.ts index a6f71829f08..52343fd9b09 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-processlist.component.spec.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-processlist.component.spec.ts @@ -265,7 +265,7 @@ describe('ActivitiProcessInstanceListComponent', () => { let row = new ObjectDataRow({ id: 999 }); - let rowEvent = {value: row}; + let rowEvent = new DataRowEvent(row, null); component.rowClick.subscribe(taskId => { expect(taskId).toEqual(999); diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.spec.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.spec.ts index 066d699d0dd..836f039fb38 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.spec.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.spec.ts @@ -203,7 +203,7 @@ describe('ActivitiTaskList', () => { let row = new ObjectDataRow({ id: 999 }); - let rowEvent = {value: row}; + let rowEvent = new DataRowEvent(row, null); component.rowClick.subscribe(taskId => { expect(taskId).toEqual(999); diff --git a/ng2-components/ng2-alfresco-core/index.ts b/ng2-components/ng2-alfresco-core/index.ts index 444b9714246..4fcd9cf8f3c 100644 --- a/ng2-components/ng2-alfresco-core/index.ts +++ b/ng2-components/ng2-alfresco-core/index.ts @@ -45,6 +45,8 @@ import { CONTEXT_MENU_PROVIDERS, CONTEXT_MENU_DIRECTIVES } from './src/component export * from './src/services/index'; export * from './src/components/index'; export * from './src/utils/index'; +export * from './src/events/base.event'; +export * from './src/events/base-ui.event'; export const ALFRESCO_CORE_PROVIDERS: any[] = [ NotificationService, diff --git a/ng2-components/ng2-alfresco-core/src/events/base-ui.event.ts b/ng2-components/ng2-alfresco-core/src/events/base-ui.event.ts new file mode 100644 index 00000000000..03da09a15d6 --- /dev/null +++ b/ng2-components/ng2-alfresco-core/src/events/base-ui.event.ts @@ -0,0 +1,25 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseEvent } from './base.event'; + +/** Base container for any event which takes place in the DOM */ +export class BaseUIEvent extends BaseEvent { + + /** Original DOM event */ + event: Event; +} diff --git a/ng2-components/ng2-alfresco-core/src/events/base.event.ts b/ng2-components/ng2-alfresco-core/src/events/base.event.ts new file mode 100644 index 00000000000..0087df973a2 --- /dev/null +++ b/ng2-components/ng2-alfresco-core/src/events/base.event.ts @@ -0,0 +1,32 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** Base cancellable event implementation */ +export class BaseEvent { + + private isDefaultPrevented: boolean = false; + + value: T; + + get defaultPrevented() { + return this.isDefaultPrevented; + } + + preventDefault() { + this.isDefaultPrevented = true; + } +} diff --git a/ng2-components/ng2-alfresco-datatable/index.ts b/ng2-components/ng2-alfresco-datatable/index.ts index f872d2e1172..6e3c4474466 100644 --- a/ng2-components/ng2-alfresco-datatable/index.ts +++ b/ng2-components/ng2-alfresco-datatable/index.ts @@ -21,6 +21,8 @@ import { CoreModule } from 'ng2-alfresco-core'; export * from './src/data/index'; export * from './src/components/index'; export * from './src/components/pagination/index'; +export * from './src/components/datatable/data-cell.event'; +export * from './src/components/datatable/data-row-action.event'; import { DataTableComponent } from './src/components/datatable/datatable.component'; import { NoContentTemplateComponent } from './src/components/datatable/no-content-template.component'; diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/data-cell.event.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/data-cell.event.ts new file mode 100644 index 00000000000..e5070ee48e0 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/data-cell.event.ts @@ -0,0 +1,42 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseEvent } from 'ng2-alfresco-core'; +import { DataColumn, DataRow } from '../../data/datatable-adapter'; + +export class DataCellEvent extends BaseEvent { + + constructor(row: DataRow, col: DataColumn, actions: any[]) { + super(); + this.value = new DataCellEventModel(row, col, actions); + } + +} + +export class DataCellEventModel { + + readonly row: DataRow; + readonly col: DataColumn; + actions: any[]; + + constructor(row: DataRow, col: DataColumn, actions: any[]) { + this.row = row; + this.col = col; + this.actions = actions || []; + } + +} diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/data-row-action.event.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/data-row-action.event.ts new file mode 100644 index 00000000000..2bcd8549e72 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/data-row-action.event.ts @@ -0,0 +1,39 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseEvent } from 'ng2-alfresco-core'; +import { DataRow } from '../../data/datatable-adapter'; + +export class DataRowActionEvent extends BaseEvent { + + constructor(row: DataRow, action: any) { + super(); + this.value = new DataRowActionModel(row, action); + } + +} + +export class DataRowActionModel { + + row: DataRow; + action: any; + + constructor(row: DataRow, action: any) { + this.row = row; + this.action = action; + } +} diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts index 312c817a56b..c4b0ccb95a7 100644 --- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts @@ -16,14 +16,9 @@ */ import { Component, OnInit, Input, Output, EventEmitter, TemplateRef } from '@angular/core'; -import { - DataTableAdapter, - DataRow, - DataColumn, - DataSorting, - DataRowEvent, - ObjectDataTableAdapter -} from '../../data/index'; +import { DataTableAdapter, DataRow, DataColumn, DataSorting, DataRowEvent, ObjectDataTableAdapter } from '../../data/index'; +import { DataCellEvent } from './data-cell.event'; +import { DataRowActionEvent } from './data-row-action.event'; declare var componentHandler; @@ -57,13 +52,13 @@ export class DataTableComponent implements OnInit { rowDblClick: EventEmitter = new EventEmitter(); @Output() - showRowContextMenu: EventEmitter = new EventEmitter(); + showRowContextMenu: EventEmitter = new EventEmitter(); @Output() - showRowActionsMenu: EventEmitter = new EventEmitter(); + showRowActionsMenu: EventEmitter = new EventEmitter(); @Output() - executeRowAction: EventEmitter = new EventEmitter(); + executeRowAction: EventEmitter = new EventEmitter(); noContentTemplate: TemplateRef; isSelectAllChecked: boolean = false; @@ -92,10 +87,7 @@ export class DataTableComponent implements OnInit { this.data.selectedRow = row; } - this.rowClick.emit({ - value: row, - event: e - }); + this.rowClick.emit(new DataRowEvent(row, e)); } onRowDblClick(row: DataRow, e?: Event) { @@ -103,10 +95,7 @@ export class DataTableComponent implements OnInit { e.preventDefault(); } - this.rowDblClick.emit({ - value: row, - event: e - }); + this.rowDblClick.emit(new DataRowEvent(row, e)); } onColumnHeaderClick(column: DataColumn) { @@ -150,7 +139,7 @@ export class DataTableComponent implements OnInit { } } - isIconValue(row: DataRow, col: DataColumn) { + isIconValue(row: DataRow, col: DataColumn): boolean { if (row && col) { let value = row.getValue(col.key); return value && value.startsWith('material-icons://'); @@ -158,7 +147,7 @@ export class DataTableComponent implements OnInit { return false; } - asIconValue(row: DataRow, col: DataColumn) { + asIconValue(row: DataRow, col: DataColumn): string { if (this.isIconValue(row, col)) { let value = row.getValue(col.key) || ''; return value.replace('material-icons://', ''); @@ -166,11 +155,11 @@ export class DataTableComponent implements OnInit { return null; } - iconAltTextKey(value: string) { + iconAltTextKey(value: string): string { return 'ICONS.' + value.substring(value.lastIndexOf('/') + 1).replace(/\.[a-z]+/, ''); } - isColumnSorted(col: DataColumn, direction: string) { + isColumnSorted(col: DataColumn, direction: string): boolean { if (col && direction) { let sorting = this.data.getSorting(); return sorting && sorting.key === col.key && sorting.direction === direction; @@ -178,20 +167,19 @@ export class DataTableComponent implements OnInit { return false; } - getContextMenuActions(row: DataRow, col: DataColumn) { - let args = { row: row, col: col, actions: [] }; - this.showRowContextMenu.emit({ args: args }); - return args.actions; + getContextMenuActions(row: DataRow, col: DataColumn): any[] { + let event = new DataCellEvent(row, col, []); + this.showRowContextMenu.emit(event); + return event.value.actions; } - getRowActions(row: DataRow, col: DataColumn) { - let args = { row: row, col: col, actions: [] }; - this.showRowActionsMenu.emit({ args: args }); - return args.actions; + getRowActions(row: DataRow, col: DataColumn): any[] { + let event = new DataCellEvent(row, col, []); + this.showRowActionsMenu.emit(event); + return event.value.actions; } onExecuteRowAction(row: DataRow, action: any) { - let args = { row: row, action: action }; - this.executeRowAction.emit({ args: args }); + this.executeRowAction.emit(new DataRowActionEvent(row, action)); } } diff --git a/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts b/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts index 704fa028750..bb372c2a933 100644 --- a/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts +++ b/ng2-components/ng2-alfresco-datatable/src/data/datatable-adapter.ts @@ -16,6 +16,7 @@ */ import { TemplateRef } from '@angular/core'; +import { BaseUIEvent } from 'ng2-alfresco-core'; export interface DataTableAdapter { selectedRow: DataRow; @@ -53,7 +54,12 @@ export class DataSorting { } } -export interface DataRowEvent { - value?: DataRow; - event?: Event; +export class DataRowEvent extends BaseUIEvent { + + constructor(value: DataRow, domEvent: Event) { + super(); + this.value = value; + this.event = domEvent; + } + } diff --git a/ng2-components/ng2-alfresco-documentlist/index.ts b/ng2-components/ng2-alfresco-documentlist/index.ts index 81be2a67c88..38a4b261e38 100644 --- a/ng2-components/ng2-alfresco-documentlist/index.ts +++ b/ng2-components/ng2-alfresco-documentlist/index.ts @@ -34,6 +34,7 @@ import { DocumentListService } from './src/services/document-list.service'; // components export * from './src/components/document-list.component'; +export * from './src/components/node.event'; export * from './src/components/content-column/content-column.component'; export * from './src/components/content-column/content-column-list.component'; export * from './src/components/content-action/content-action.component'; diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts index 80fc2da6e14..39467ca3b71 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts @@ -464,7 +464,7 @@ describe('DocumentList', () => { it('should emit [nodeClick] event on row click', () => { let node = new NodeMinimalEntry(); let row = new ShareDataRow(node); - let event = {value: row}; + let event = new DataRowEvent(row, null); spyOn(documentList, 'onNodeClick').and.callThrough(); documentList.onRowClick(event); @@ -474,7 +474,7 @@ describe('DocumentList', () => { it('should emit [nodeDblClick] event on row double-click', () => { let node = new NodeMinimalEntry(); let row = new ShareDataRow(node); - let event = {value: row}; + let event = new DataRowEvent(row, null); spyOn(documentList, 'onNodeDblClick').and.callThrough(); documentList.onRowDblClick(event); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts index c9547828f1a..921e0304319 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts @@ -32,10 +32,11 @@ import { import { Subject } from 'rxjs/Rx'; import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging, Pagination } from 'alfresco-js-api'; import { AlfrescoTranslationService } from 'ng2-alfresco-core'; -import { DataRowEvent, DataTableComponent, ObjectDataColumn } from 'ng2-alfresco-datatable'; +import { DataRowEvent, DataTableComponent, ObjectDataColumn, DataCellEvent, DataRowActionEvent } from 'ng2-alfresco-datatable'; import { DocumentListService } from './../services/document-list.service'; import { ContentActionModel } from './../models/content-action.model'; import { ShareDataTableAdapter, ShareDataRow, RowFilter, ImageResolver } from './../data/share-datatable-adapter'; +import { NodeEntityEvent, NodeEntryEvent } from './node.event'; declare var module: any; @@ -116,16 +117,16 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni node: NodePaging = null; @Output() - nodeClick: EventEmitter = new EventEmitter(); + nodeClick: EventEmitter = new EventEmitter(); @Output() - nodeDblClick: EventEmitter = new EventEmitter(); + nodeDblClick: EventEmitter = new EventEmitter(); @Output() - folderChange: EventEmitter = new EventEmitter(); + folderChange: EventEmitter = new EventEmitter(); @Output() - preview: EventEmitter = new EventEmitter(); + preview: EventEmitter = new EventEmitter(); @Output() success: EventEmitter = new EventEmitter(); @@ -231,7 +232,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni }); } - isEmptyTemplateDefined() { + isEmptyTemplateDefined(): boolean { if (this.dataTable) { if (this.emptyFolderTemplate) { return true; @@ -278,12 +279,10 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni performNavigation(node: MinimalNodeEntity): boolean { if (node && node.entry && node.entry.isFolder) { - this.currentFolderId = node.entry.id; this.folderNode = node.entry; - this.loadFolder(); - this.folderChange.emit({node: node.entry}); + this.folderChange.emit(new NodeEntryEvent(node.entry)); return true; } return false; @@ -365,25 +364,24 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni onPreviewFile(node: MinimalNodeEntity) { if (node) { - this.preview.emit({ - value: node - }); + this.preview.emit(new NodeEntityEvent(node)); } } onNodeClick(node: MinimalNodeEntity) { - this.nodeClick.emit({ - value: node - }); - - if (this.navigate && this.navigationMode === DocumentListComponent.SINGLE_CLICK_NAVIGATION) { - if (node && node.entry) { - if (node.entry.isFile) { - this.onPreviewFile(node); - } - - if (node.entry.isFolder) { - this.performNavigation(node); + let event = new NodeEntityEvent(node); + this.nodeClick.emit(event); + + if (!event.defaultPrevented) { + if (this.navigate && this.navigationMode === DocumentListComponent.SINGLE_CLICK_NAVIGATION) { + if (node && node.entry) { + if (node.entry.isFile) { + this.onPreviewFile(node); + } + + if (node.entry.isFolder) { + this.performNavigation(node); + } } } } @@ -395,18 +393,19 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni } onNodeDblClick(node: MinimalNodeEntity) { - this.nodeDblClick.emit({ - value: node - }); - - if (this.navigate && this.navigationMode === DocumentListComponent.DOUBLE_CLICK_NAVIGATION) { - if (node && node.entry) { - if (node.entry.isFile) { - this.onPreviewFile(node); - } - - if (node.entry.isFolder) { - this.performNavigation(node); + let event = new NodeEntityEvent(node); + this.nodeDblClick.emit(event); + + if (!event.defaultPrevented) { + if (this.navigate && this.navigationMode === DocumentListComponent.DOUBLE_CLICK_NAVIGATION) { + if (node && node.entry) { + if (node.entry.isFile) { + this.onPreviewFile(node); + } + + if (node.entry.isFolder) { + this.performNavigation(node); + } } } } @@ -417,9 +416,9 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni this.onNodeDblClick(item); } - onShowRowContextMenu(event) { + onShowRowContextMenu(event: DataCellEvent) { if (this.contextMenuActions) { - let args = event.args; + let args = event.value; let node = ( args.row).node; if (node) { args.actions = this.getContextActions(node) || []; @@ -427,9 +426,9 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni } } - onShowRowActionsMenu(event) { + onShowRowActionsMenu(event: DataCellEvent) { if (this.contentActions) { - let args = event.args; + let args = event.value; let node = ( args.row).node; if (node) { args.actions = this.getNodeActions(node) || []; @@ -437,9 +436,9 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni } } - onExecuteRowAction(event) { + onExecuteRowAction(event: DataRowActionEvent) { if (this.contentActions) { - let args = event.args; + let args = event.value; let node = ( args.row).node; let action = ( args.action); this.executeContentAction(node, action); @@ -455,17 +454,17 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni this.success.emit(event); } - public onChangePageSize(event: Pagination): void { + onChangePageSize(event: Pagination): void { this.pageSize = event.maxItems; this.reload(); } - public onNextPage(event: Pagination): void { + onNextPage(event: Pagination): void { this.skipCount = event.skipCount; this.reload(); } - public onPrevPage(event: Pagination): void { + onPrevPage(event: Pagination): void { this.skipCount = event.skipCount; this.reload(); } diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/node.event.ts b/ng2-components/ng2-alfresco-documentlist/src/components/node.event.ts new file mode 100644 index 00000000000..fd1f68bb816 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/components/node.event.ts @@ -0,0 +1,33 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BaseEvent } from 'ng2-alfresco-core'; +import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api'; + +export class NodeEntityEvent extends BaseEvent { + constructor(entity: MinimalNodeEntity) { + super(); + this.value = entity; + } +} + +export class NodeEntryEvent extends BaseEvent { + constructor(entity: MinimalNodeEntryEntity) { + super(); + this.value = entity; + } +} From 2e44550d7f590c7608c7be0d95d3bd7158952499 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 3 Mar 2017 09:25:08 +0000 Subject: [PATCH 004/113] support for toggling custom context menu (#1683) * support for toggling custom context menu * fix unit tests --- .../context-menu/context-menu.directive.spec.ts | 1 + .../context-menu/context-menu.directive.ts | 17 +++++++++++------ ng2-components/ng2-alfresco-datatable/README.md | 9 +++------ .../datatable/datatable.component.html | 3 ++- .../components/datatable/datatable.component.ts | 3 +++ .../src/components/document-list.component.html | 1 + .../components/document-list.component.spec.ts | 8 ++++++++ .../src/components/document-list.component.ts | 2 +- 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.spec.ts b/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.spec.ts index 32d9a6902b5..608d622a27c 100644 --- a/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.spec.ts +++ b/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.spec.ts @@ -26,6 +26,7 @@ describe('ContextMenuDirective', () => { beforeEach(() => { contextMenuService = new ContextMenuService(); directive = new ContextMenuDirective(contextMenuService); + directive.enabled = true; }); it('should show menu via service', (done) => { diff --git a/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.ts b/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.ts index 439937397b3..0bcfef10d04 100644 --- a/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.ts +++ b/ng2-components/ng2-alfresco-core/src/components/context-menu/context-menu.directive.ts @@ -25,18 +25,23 @@ export class ContextMenuDirective { @Input('context-menu') links: any[]; + @Input('context-menu-enabled') + enabled: boolean = false; + constructor(private _contextMenuService: ContextMenuService) { } @HostListener('contextmenu', ['$event']) onShowContextMenu(event?: MouseEvent) { - if (event) { - event.preventDefault(); - } + if (this.enabled) { + if (event) { + event.preventDefault(); + } - if (this.links && this.links.length > 0) { - if (this._contextMenuService) { - this._contextMenuService.show.next({event: event, obj: this.links}); + if (this.links && this.links.length > 0) { + if (this._contextMenuService) { + this._contextMenuService.show.next({event: event, obj: this.links}); + } } } } diff --git a/ng2-components/ng2-alfresco-datatable/README.md b/ng2-components/ng2-alfresco-datatable/README.md index d84f27bdbc8..0635c72de86 100644 --- a/ng2-components/ng2-alfresco-datatable/README.md +++ b/ng2-components/ng2-alfresco-datatable/README.md @@ -103,7 +103,6 @@ Usage example of this component : **my.component.ts** ```ts - import { NgModule, Component } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; @@ -155,17 +154,14 @@ export class DataTableDemo { imports: [ BrowserModule, CoreModule.forRoot(), - DataTableModule + DataTableModule.forRoot() ], declarations: [DataTableDemo], bootstrap: [DataTableDemo] }) -export class AppModule { -} +export class AppModule {} platformBrowserDynamic().bootstrapModule(AppModule); - - ``` ![DataTable demo](docs/assets/datatable-demo.png) @@ -179,6 +175,7 @@ platformBrowserDynamic().bootstrapModule(AppModule); | `actions` | boolean | false | Toggles data actions column | | `actionsPosition` | string (left\|right) | right | Position of the actions dropdown menu. | | `fallbackThumbnail` | string | | Fallback image for row ehre thubnail is missing| +| `contextMenu` | boolean | false | Toggles custom context menu for the component | ### Events diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html index be77cc8a4f8..14fdc4b5029 100644 --- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html @@ -67,7 +67,8 @@ class="mdl-data-table__cell--non-numeric non-selectable data-cell {{col.cssClass}}" (click)="onRowClick(row, $event)" (dblclick)="onRowDblClick(row, $event)" - [context-menu]="getContextMenuActions(row, col)"> + [context-menu]="getContextMenuActions(row, col)" + [context-menu-enabled]="contextMenu">
{{asIconValue(row, col)}} diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts index c4b0ccb95a7..dcbb03ba75e 100644 --- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts @@ -45,6 +45,9 @@ export class DataTableComponent implements OnInit { @Input() fallbackThumbnail: string; + @Input() + contextMenu: boolean = false; + @Output() rowClick: EventEmitter = new EventEmitter(); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.html b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.html index 58901295083..e3056806e15 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.html +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.html @@ -10,6 +10,7 @@ [actionsPosition]="contentActionsPosition" [multiselect]="multiselect" [fallbackThumbnail]="fallbackThumbnail" + [contextMenu]="contextMenuActions" (showRowContextMenu)="onShowRowContextMenu($event)" (showRowActionsMenu)="onShowRowActionsMenu($event)" (executeRowAction)="onExecuteRowAction($event)" diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts index 39467ca3b71..017afe52352 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts @@ -217,11 +217,19 @@ describe('DocumentList', () => { }); it('should suppress default context menu', () => { + documentList.contextMenuActions = true; spyOn(eventMock, 'preventDefault').and.stub(); documentList.onShowContextMenu(eventMock); expect(eventMock.preventDefault).toHaveBeenCalled(); }); + it('should not suppress default context menu', () => { + documentList.contextMenuActions = false; + spyOn(eventMock, 'preventDefault').and.stub(); + documentList.onShowContextMenu(eventMock); + expect(eventMock.preventDefault).not.toHaveBeenCalled(); + }); + it('should emit file preview event on single click', (done) => { let file = new FileNode(); documentList.preview.subscribe(e => { diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts index 921e0304319..a0445033092 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts @@ -272,7 +272,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni @HostListener('contextmenu', ['$event']) onShowContextMenu(e?: Event) { - if (e) { + if (e && this.contextMenuActions) { e.preventDefault(); } } From 4d8abee892e96b206b11cfea580367a91ce921b3 Mon Sep 17 00:00:00 2001 From: Vito Date: Fri, 3 Mar 2017 07:32:37 -0800 Subject: [PATCH 005/113] 1454 - fixed spacing in forms (#1687) --- .../src/components/widgets/container/container.widget.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/container/container.widget.html b/ng2-components/ng2-activiti-form/src/components/widgets/container/container.widget.html index a0c807b12f6..c4cb46a1fb8 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/container/container.widget.html +++ b/ng2-components/ng2-activiti-form/src/components/widgets/container/container.widget.html @@ -11,11 +11,13 @@ {{content.name}}
-
+
+
+
From 861393de60bf23a6647eb1c3d6c98d742ba4ef9b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Sat, 4 Mar 2017 17:29:48 +0000 Subject: [PATCH 006/113] more control over task details header (#1688) - toggle task details header - toggle visibility of involve/comments/checklist - readme updates --- .../activiti/activiti-demo.component.html | 10 +-- .../ng2-activiti-tasklist/README.md | 76 ++++++++++--------- ng2-components/ng2-activiti-tasklist/index.ts | 4 +- .../activiti-task-details.component.css | 19 +++++ .../activiti-task-details.component.html | 76 +++++++++++-------- .../activiti-task-details.component.ts | 19 +++++ 6 files changed, 133 insertions(+), 71 deletions(-) diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html index 5a6c2285d32..3dad9954e24 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html @@ -41,11 +41,11 @@ #activititasklist>
-
Task Details
-
- + +
diff --git a/ng2-components/ng2-activiti-tasklist/README.md b/ng2-components/ng2-activiti-tasklist/README.md index a3941d24c30..f8bc2b183e9 100644 --- a/ng2-components/ng2-activiti-tasklist/README.md +++ b/ng2-components/ng2-activiti-tasklist/README.md @@ -117,8 +117,8 @@ This component renders a list containing all the tasks matched by the parameters Usage example of this component : **main.ts** -```ts +```ts import { NgModule, Component } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; @@ -129,34 +129,35 @@ import { ObjectDataTableAdapter, DataSorting } from 'ng2-alfresco-datatable'; @Component({ selector: 'alfresco-app-demo', - template: `` + template: ` + + + ` }) class MyDemoApp { dataTasks: ObjectDataTableAdapter; - appId: string = '1'; - assignment: string = 'assignee'; - state: string = 'open'; - constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { + constructor(private authService: AlfrescoAuthenticationService, + private settingsService: AlfrescoSettingsService) { settingsService.bpmHost = 'http://localhost:9999'; this.authService.login('admin', 'admin').subscribe( - ticket => { - console.log(ticket); - }, - error => { - console.log(error); - }); + ticket => console.log(ticket), + error => console.log(error) + ); this.dataTasks = new ObjectDataTableAdapter([], [ - {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, - {type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true} - ] - ); + {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, + {type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true} + ]); this.dataTasks.setSorting(new DataSorting('started', 'desc')); } } @@ -170,12 +171,9 @@ class MyDemoApp { declarations: [MyDemoApp], bootstrap: [MyDemoApp] }) -export class AppModule { -} +export class AppModule {} platformBrowserDynamic().bootstrapModule(AppModule); - - ``` #### Events @@ -216,6 +214,24 @@ The component shows the details of the task id passed in input ``` +#### Properties + +| Name | Type | Default | Description | +| --- | --- | --- | --- | +| `taskId` | string | | (**required**) The id of the task details that we are asking for. | +| `showNextTask` | boolean | true | Automatically render the next one, when the task is completed. | +| `showFormTitle` | boolean | true | Toggle rendering of the form title. | +| `readOnlyForm` | boolean | false | Toggle readonly state of the form. Enforces all form widgets render readonly if enabled. | +| `showFormRefreshButton` | true | optional | Toggle rendering of the `Refresh` button. | +| `showFormSaveButton` | true | optional | Toggle rendering of the `Save` outcome button. | +| `showFormCompleteButton` | true | optional | Toggle rendering of the Form `Complete` outcome button | +| `peopleIconImageUrl` | string | | Define a custom people icon image | +| `showHeader` | boolean | true | Toggle task details Header component | +| `showHeaderContent` | boolean | true | Toggle collapsed/expanded state of the Header component | +| `showInvolvePeople` | boolean | true | Toggle `Involve People` feature for Header component | +| `showComments` | boolean | true | Toggle `Comments` feature for Header component | +| `showChecklist` | boolean | true | Toggle `Checklist` feature for Header component | + #### Events | Name | Description | @@ -227,25 +243,13 @@ The component shows the details of the task id passed in input | `executeOutcome` | Invoked when any outcome is executed, default behaviour can be prevented via `event.preventDefault()` | | `onError` | Invoked at any error | -#### Options - -| Name | Type | Required | Description | -| --- | --- | --- | --- | -| `taskId` | {string} | required | The id of the task details that we are asking for. | -| `showNextTask` | {boolean} | optional | Automatically render the next one, when the task is completed. | -| `showFormTitle` | {boolean} | optional | Toggle rendering of the form title. | -| `readOnlyForm` | {boolean} | optional | Toggle readonly state of the form. Enforces all form widgets render readonly if enabled. | -| `showFormRefreshButton` | {boolean} | optional | Toggle rendering of the `Refresh` button. | -| `showFormSaveButton` | {boolean} | optional | Toggle rendering of the `Save` outcome button. | -| `showFormCompleteButton` | {boolean} | optional | Toggle rendering of the Form `Complete` outcome button | -| `peopleIconImageUrl` | {string} | optional | Define a custom people icon image | - ### Custom 'empty Activiti Task Details' template By default the Activiti Task Details provides the following message for the empty task details: -'No Tasks' - +``` +No Tasks +``` This can be changed by adding the following custom html template: @@ -260,6 +264,8 @@ This can be changed by adding the following custom html template: ``` +Note that can put any HTML content as part of the template, includuing other Angualr components. + ## Basic usage example Activiti Apps The component shows all the available apps. diff --git a/ng2-components/ng2-activiti-tasklist/index.ts b/ng2-components/ng2-activiti-tasklist/index.ts index a7f9116871a..0d30f02947e 100644 --- a/ng2-components/ng2-activiti-tasklist/index.ts +++ b/ng2-components/ng2-activiti-tasklist/index.ts @@ -21,6 +21,7 @@ import { DataTableModule } from 'ng2-alfresco-datatable'; import { ActivitiFormModule } from 'ng2-activiti-form'; import { ActivitiPeopleService } from './src/services/activiti-people.service'; import { ActivitiTaskListService } from './src/services/activiti-tasklist.service'; +import { MaterialModule } from '@angular/material'; import { ActivitiApps, @@ -63,7 +64,8 @@ export const ACTIVITI_TASKLIST_PROVIDERS: any[] = [ imports: [ CoreModule, DataTableModule, - ActivitiFormModule + ActivitiFormModule, + MaterialModule ], declarations: [ ...ACTIVITI_TASKLIST_DIRECTIVES diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.css b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.css index 67959204ff1..ba63d41ff3c 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.css +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.css @@ -5,3 +5,22 @@ .error-dialog h3 { margin: 16px 0; } + +.activiti-task-details__header { + align-self: flex-end; + display: flex; + font-size: 24px; + font-weight: 300; + line-height: normal; + overflow: hidden; + margin: 0; + cursor: pointer; + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; +} + +.activiti-task-details__action-button { + text-transform: uppercase; +} diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html index 46be6220d51..28c74fdd1b1 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html @@ -1,6 +1,5 @@
- diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts index a0445033092..2d9225523f1 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts @@ -52,10 +52,10 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni static DOUBLE_CLICK_NAVIGATION: string = 'dblclick'; static DEFAULT_PAGE_SIZE: number = 20; - baseComponentPath = module.id.replace('/components/document-list.component.js', ''); + baseComponentPath = module.id.replace('components/document-list.component.js', ''); @Input() - fallbackThumbnail: string = this.baseComponentPath + '/assets/images/ft_ic_miscellaneous.svg'; + fallbackThumbnail: string = this.baseComponentPath + 'assets/images/ft_ic_miscellaneous.svg'; @Input() navigate: boolean = true; @@ -87,6 +87,9 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni @Input() pageSize: number = DocumentListComponent.DEFAULT_PAGE_SIZE; + @Input() + emptyFolderImageUrl: string = this.baseComponentPath + 'assets/images/empty_doc_lib.svg'; + skipCount: number = 0; pagination: Pagination; diff --git a/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.spec.ts index 707305bf92f..8916edaa63c 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.spec.ts @@ -26,7 +26,7 @@ describe('ShareDataTableAdapter', () => { let documentListService: DocumentListServiceMock; beforeEach(() => { - basePath = '/root'; + basePath = '/root/'; documentListService = new DocumentListServiceMock(); }); @@ -219,7 +219,7 @@ describe('ShareDataTableAdapter', () => { let col = { type: 'image', key: '$thumbnail' }; let value = adapter.getValue(row, col); - expect(value).toBe(`${basePath}/assets/images/ft_ic_miscellaneous.svg`); + expect(value).toBe(`${basePath}assets/images/ft_ic_miscellaneous.svg`); }); it('should generate fallback icon for a file thumbnail with missing mime type', () => { @@ -232,7 +232,7 @@ describe('ShareDataTableAdapter', () => { let col = { type: 'image', key: '$thumbnail' }; let value = adapter.getValue(row, col); - expect(value).toBe(`${basePath}/assets/images/ft_ic_miscellaneous.svg`); + expect(value).toBe(`${basePath}assets/images/ft_ic_miscellaneous.svg`); }); it('should generate fallback icon for a file with no content entry', () => { @@ -245,7 +245,7 @@ describe('ShareDataTableAdapter', () => { let col = { type: 'image', key: '$thumbnail' }; let value = adapter.getValue(row, col); - expect(value).toBe(`${basePath}/assets/images/ft_ic_miscellaneous.svg`); + expect(value).toBe(`${basePath}assets/images/ft_ic_miscellaneous.svg`); }); it('should generate fallback icon when document service fails to find one', () => { @@ -257,7 +257,7 @@ describe('ShareDataTableAdapter', () => { let col = { type: 'image', key: '$thumbnail' }; let value = adapter.getValue(row, col); - expect(value).toBe(`${basePath}/assets/images/ft_ic_miscellaneous.svg`); + expect(value).toBe(`${basePath}assets/images/ft_ic_miscellaneous.svg`); }); it('should return image value unmodified', () => { @@ -281,7 +281,7 @@ describe('ShareDataTableAdapter', () => { let col = { type: 'image', key: '$thumbnail' }; let value = adapter.getValue(row, col); - expect(value).toBe(`${basePath}/assets/images/ft_ic_folder.svg`); + expect(value).toBe(`${basePath}assets/images/ft_ic_folder.svg`); }); it('should resolve file thumbnail', () => { @@ -311,7 +311,7 @@ describe('ShareDataTableAdapter', () => { let col = { type: 'image', key: '$thumbnail' }; let value = adapter.getValue(row, col); - expect(value).toBe(`${basePath}/assets/images/ft_ic_miscellaneous.svg`); + expect(value).toBe(`${basePath}assets/images/ft_ic_miscellaneous.svg`); }); it('should require document service to resolve thumbnail', () => { @@ -351,10 +351,10 @@ describe('ShareDataTableAdapter', () => { let row = new ShareDataRow(file); let col = {type: 'image', key: '$thumbnail'}; - let adapter = new ShareDataTableAdapter(documentListService, '/root', null); + let adapter = new ShareDataTableAdapter(documentListService, basePath, null); let value = adapter.getValue(row, col); - expect(value).toBe(`/root/assets/images/${fileName}`); + expect(value).toBe(`${basePath}assets/images/${fileName}`); expect(documentListService.getMimeTypeIcon).toHaveBeenCalled(); }); diff --git a/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts b/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts index 23fd57f9152..19746137891 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts @@ -223,7 +223,7 @@ export class ShareDataTableAdapter implements DataTableAdapter { } getImagePath(id: string): any { - return `${this.basePath}/assets/images/${id}`; + return `${this.basePath}assets/images/${id}`; } } diff --git a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.html b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.html index a6b6011ac93..1407b617e7f 100644 --- a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.html +++ b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.html @@ -1,18 +1,14 @@