From 817fb5c961eb70656921f8b0bba4abf25e3eaead Mon Sep 17 00:00:00 2001 From: Mario Romano Date: Thu, 5 May 2016 18:37:15 +0100 Subject: [PATCH] #46 remove notifications for drag and drop --- .../src/components/upload.component.d.ts | 1 + .../src/components/upload.component.html | 2 +- .../src/components/upload.component.js | 16 +++++++++++----- .../src/components/upload.component.js.map | 2 +- .../src/components/upload.component.ts | 19 +++++++++++++------ 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload.component.d.ts b/ng2-components/ng2-alfresco-upload/src/components/upload.component.d.ts index 84f84fbbd1..4f77f6f2bf 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload.component.d.ts +++ b/ng2-components/ng2-alfresco-upload/src/components/upload.component.d.ts @@ -26,6 +26,7 @@ export declare class UploadComponent { filesUploadingList: FileModel[]; constructor(el: ElementRef); onFilesAdded(files: any): void; + onFilesDragged(files: any): void; showUndoNotificationBar(latestFilesAdded: any): void; showDialog(): void; } diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload.component.html b/ng2-components/ng2-alfresco-upload/src/components/upload.component.html index 45035ed5e6..c25f4959d7 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload.component.html +++ b/ng2-components/ng2-alfresco-upload/src/components/upload.component.html @@ -24,7 +24,7 @@

-
Drop Area
diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload.component.js b/ng2-components/ng2-alfresco-upload/src/components/upload.component.js index 67e0db04d4..e379621948 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload.component.js +++ b/ng2-components/ng2-alfresco-upload/src/components/upload.component.js @@ -65,18 +65,24 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin }); } UploadComponent.prototype.onFilesAdded = function (files) { - var latestFilesAdded = []; - if (componentHandler) { - componentHandler.upgradeAllRegistered(); - } if (files.length) { - latestFilesAdded = this._uploaderService.addToQueue(files); + var latestFilesAdded = this._uploaderService.addToQueue(files); this.filesUploadingList = this._uploaderService.getQueue(); this.showDialog(); this.showUndoNotificationBar(latestFilesAdded); } }; + UploadComponent.prototype.onFilesDragged = function (files) { + if (files.length) { + this._uploaderService.addToQueue(files); + this.filesUploadingList = this._uploaderService.getQueue(); + this.showDialog(); + } + }; UploadComponent.prototype.showUndoNotificationBar = function (latestFilesAdded) { + if (componentHandler) { + componentHandler.upgradeAllRegistered(); + } this.undoNotificationBar.nativeElement.MaterialSnackbar.showSnackbar({ message: 'Upload in progress...', timeout: 5000, diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload.component.js.map b/ng2-components/ng2-alfresco-upload/src/components/upload.component.js.map index 3ace4f8de9..a08f6ac7d6 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload.component.js.map +++ b/ng2-components/ng2-alfresco-upload/src/components/upload.component.js.map @@ -1 +1 @@ -{"version":3,"file":"upload.component.js","sourceRoot":"","sources":["upload.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBH;gBAeI,yBAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAVhC,WAAM,GAAU,KAAK,CAAC;oBAQtB,uBAAkB,GAAgB,EAAE,CAAC;oBAGjC,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;oBAE/C,IAAI,CAAC,gBAAgB,GAAG,IAAI,8BAAa,CAAC;wBACtC,GAAG,EAAE,wDAAwD;wBAC7D,eAAe,EAAE,IAAI;wBACrB,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC;wBAC9B,eAAe,EAAE,OAAO;wBACxB,SAAS,EAAE,UAAU;wBACrB,UAAU,EAAE;4BACR,MAAM,EAAE,OAAO;4BACf,WAAW,EAAE,iBAAiB;yBACjC;qBACJ,CAAC,CAAC;gBACP,CAAC;gBAED,sCAAY,GAAZ,UAAa,KAAK;oBACd,IAAI,gBAAgB,GAAgB,EAAE,CAAC;oBACvC,EA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/ng2-alfresco-upload/src/components/upload.component.ts index 35b1549c56..c27fbe5727 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload.component.ts +++ b/ng2-components/ng2-alfresco-upload/src/components/upload.component.ts @@ -66,20 +66,27 @@ export class UploadComponent { } onFilesAdded(files):void { - let latestFilesAdded:FileModel [] = []; - if (componentHandler) { - componentHandler.upgradeAllRegistered(); - } - if (files.length) { - latestFilesAdded = this._uploaderService.addToQueue(files); + let latestFilesAdded = this._uploaderService.addToQueue(files); this.filesUploadingList = this._uploaderService.getQueue(); this.showDialog(); this.showUndoNotificationBar(latestFilesAdded); } } + onFilesDragged(files):void { + if (files.length) { + this._uploaderService.addToQueue(files); + this.filesUploadingList = this._uploaderService.getQueue(); + this.showDialog(); + } + } + showUndoNotificationBar(latestFilesAdded){ + if (componentHandler) { + componentHandler.upgradeAllRegistered(); + } + this.undoNotificationBar.nativeElement.MaterialSnackbar.showSnackbar({ message: 'Upload in progress...', timeout: 5000,