[ADF-1711] The <adf-task-attachment-list component displays drag-and-drop area that is not working (#2658)

* [ADF-1711] The <adf-task-attachment-list component displays drag-and-drop area that is not working

* Made the drag and drop area working in demo shell for task attachment

* Provided a way to pass custom no content template for drag and drop to the user

* Updated the task-attachment README file for the user to know how to use drag and drop component with task-attachment component

* [ADF-1711] The <adf-task-attachment-list component displays drag-and-drop area that is not working

* Made the drag and drop area working in demo shell for task attachment

* Provided a way to pass custom no content template for drag and drop to the user

* Updated the task-attachment README file for the user to know how to use drag and drop component with task-attachment component
This commit is contained in:
madhukar23
2017-11-21 16:03:56 +05:30
committed by Eugenio Romano
parent bf6d0284e0
commit aa8b2a28f3
8 changed files with 167 additions and 76 deletions

View File

@@ -16,17 +16,16 @@
*/
import { ContentService, ThumbnailService } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges } from '@angular/core';
import { AfterViewInit, Component, ElementRef, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core';
import { ProcessContentService } from '@alfresco/adf-core';
declare var require: any;
@Component({
selector: 'adf-task-attachment-list',
styleUrls: ['./task-attachment-list.component.scss'],
templateUrl: './task-attachment-list.component.html'
templateUrl: './task-attachment-list.component.html',
encapsulation: ViewEncapsulation.None
})
export class TaskAttachmentListComponent implements OnChanges {
export class TaskAttachmentListComponent implements OnChanges, AfterViewInit {
@Input()
taskId: string;
@@ -43,8 +42,9 @@ export class TaskAttachmentListComponent implements OnChanges {
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
@Input()
emptyListImageUrl: string = require('../assets/images/empty_doc_lib.svg');
hasCustomTemplate: boolean;
@ViewChild('customEmptyListTemplate') customTemplateRef: ElementRef;
attachments: any[] = [];
isLoading: boolean = true;
@@ -61,6 +61,13 @@ export class TaskAttachmentListComponent implements OnChanges {
}
}
ngAfterViewInit() {
if (this.customTemplateRef && this.customTemplateRef.nativeElement &&
this.customTemplateRef.nativeElement.children && this.customTemplateRef.nativeElement.children.length > 0) {
this.hasCustomTemplate = true;
}
}
reset(): void {
this.attachments = [];
}
@@ -110,7 +117,7 @@ export class TaskAttachmentListComponent implements OnChanges {
}
}
private deleteAttachmentById(contentId: number) {
deleteAttachmentById(contentId: number) {
if (contentId) {
this.activitiContentService.deleteRelatedContent(contentId).subscribe(
(res: any) => {
@@ -128,6 +135,10 @@ export class TaskAttachmentListComponent implements OnChanges {
return this.attachments && this.attachments.length === 0;
}
isCustomTemplateDefined(): boolean {
return this.hasCustomTemplate;
}
onShowRowActionsMenu(event: any) {
let viewAction = {
title: 'ADF_TASK_LIST.MENU_ACTIONS.VIEW_CONTENT',