#46 intergrate drag and drop in document-list

This commit is contained in:
Mario Romano
2016-05-06 01:12:40 +01:00
parent a92f706c7d
commit e5b54f40b8
42 changed files with 617 additions and 283 deletions

View File

@@ -1,5 +1,7 @@
<br>
<!--upload buttons-->
<form>
@@ -26,7 +28,7 @@
<div file-draggable id='UploadBorder' class="upload-border" (onFilesAdded)="onFilesDragged($event)"
dropzone="" webkitdropzone="copy file:image/png file:image/gif file:image/jpeg" #droparea>
Drop Area
<ng-content></ng-content>
</div>
</form>

View File

@@ -14,15 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { UploadComponent } from './src/components/upload.component';
import { UploadDragAreaComponent } from './src/components/upload-drag-area.component';
import { UploadService } from './src/services/upload.service';
import { FileSelectDirective } from './src/directives/file-select.directive';
import { FileDraggableDirective } from './src/directives/file-draggable.directive';
export * from './src/components/upload.component';
import { UploadButtonComponent } from './src/components/upload-button.component';
export * from './src/components/upload-button.component';
export * from './src/components/upload-drag-area.component';
export * from './src/services/upload.service';
export * from './src/directives/file-select.directive';
export * from './src/directives/file-draggable.directive';
declare var _default: {
component: typeof UploadComponent[];
component: (typeof UploadDragAreaComponent | typeof UploadButtonComponent)[];
directives: (typeof FileSelectDirective | typeof FileDraggableDirective)[];
providers: typeof UploadService[];
};
export default _default;
export declare const ALFRESCO_ULPOAD_COMPONENT: [any];
export declare const ALFRESCO_ULPOAD_PROVAIDERS: [any];

View File

@@ -14,22 +14,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
System.register(['./src/components/upload.component', './src/services/upload.service', './src/directives/file-select.directive', './src/directives/file-draggable.directive'], function(exports_1, context_1) {
System.register(['./src/components/upload-drag-area.component', './src/services/upload.service', './src/directives/file-select.directive', './src/directives/file-draggable.directive', './src/components/upload-button.component'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var upload_component_1, upload_service_1, file_select_directive_1, file_draggable_directive_1;
var upload_drag_area_component_1, upload_service_1, file_select_directive_1, file_draggable_directive_1, upload_button_component_1;
var ALFRESCO_ULPOAD_COMPONENT, ALFRESCO_ULPOAD_PROVAIDERS;
var exportedNames_1 = {
'ALFRESCO_ULPOAD_COMPONENT': true,
'ALFRESCO_ULPOAD_PROVAIDERS': true
};
function exportStar_1(m) {
var exports = {};
for(var n in m) {
if (n !== "default") exports[n] = m[n];
if (n !== "default"&& !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n];
}
exports_1(exports);
}
return {
setters:[
function (upload_component_1_1) {
upload_component_1 = upload_component_1_1;
exportStar_1(upload_component_1_1);
function (upload_drag_area_component_1_1) {
upload_drag_area_component_1 = upload_drag_area_component_1_1;
exportStar_1(upload_drag_area_component_1_1);
},
function (upload_service_1_1) {
upload_service_1 = upload_service_1_1;
@@ -37,16 +42,31 @@ System.register(['./src/components/upload.component', './src/services/upload.ser
},
function (file_select_directive_1_1) {
file_select_directive_1 = file_select_directive_1_1;
exportStar_1(file_select_directive_1_1);
},
function (file_draggable_directive_1_1) {
file_draggable_directive_1 = file_draggable_directive_1_1;
exportStar_1(file_draggable_directive_1_1);
},
function (upload_button_component_1_1) {
upload_button_component_1 = upload_button_component_1_1;
exportStar_1(upload_button_component_1_1);
}],
execute: function() {
exports_1("default",{
component: [upload_component_1.UploadComponent],
component: [upload_drag_area_component_1.UploadDragAreaComponent, upload_button_component_1.UploadButtonComponent],
directives: [file_select_directive_1.FileSelectDirective, file_draggable_directive_1.FileDraggableDirective],
providers: [upload_service_1.UploadService]
});
exports_1("ALFRESCO_ULPOAD_COMPONENT", ALFRESCO_ULPOAD_COMPONENT = [
upload_drag_area_component_1.UploadDragAreaComponent,
upload_button_component_1.UploadButtonComponent,
file_select_directive_1.FileSelectDirective,
file_draggable_directive_1.FileDraggableDirective
]);
exports_1("ALFRESCO_ULPOAD_PROVAIDERS", ALFRESCO_ULPOAD_PROVAIDERS = [
upload_service_1.UploadService
]);
}
}
});

View File

@@ -1 +1 @@
{"version":3,"file":"ng2-alfresco-upload.js","sourceRoot":"","sources":["ng2-alfresco-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUH,oBAAe;gBACX,SAAS,EAAE,CAAC,kCAAe,CAAC;gBAC5B,UAAU,EAAE,CAAC,2CAAmB,EAAE,iDAAsB,CAAC;gBACzD,SAAS,EAAE,CAAC,8BAAa,CAAC;aAC7B,EAAA"}
{"version":3,"file":"ng2-alfresco-upload.js","sourceRoot":"","sources":["ng2-alfresco-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;QAoBU,yBAAyB,EAOzB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAbvC,oBAAe;gBACX,SAAS,EAAE,CAAC,oDAAuB,EAAE,+CAAqB,CAAC;gBAC3D,UAAU,EAAE,CAAC,2CAAmB,EAAE,iDAAsB,CAAC;gBACzD,SAAS,EAAE,CAAC,8BAAa,CAAC;aAC7B,EAAA;YAEY,uCAAA,yBAAyB,GAAU;gBAC5C,oDAAuB;gBACvB,+CAAqB;gBACrB,2CAAmB;gBACnB,iDAAsB;aACzB,CAAA,CAAC;YAEW,wCAAA,0BAA0B,GAAU;gBAC7C,8BAAa;aAChB,CAAA,CAAC"}

View File

@@ -15,16 +15,31 @@
* limitations under the License.
*/
import {UploadComponent} from './src/components/upload.component';
import {UploadDragAreaComponent} from './src/components/upload-drag-area.component';
import {UploadService} from './src/services/upload.service';
import {FileSelectDirective} from './src/directives/file-select.directive';
import {FileDraggableDirective} from './src/directives/file-draggable.directive';
import {UploadButtonComponent} from './src/components/upload-button.component';
export * from './src/components/upload.component';
export * from './src/components/upload-button.component';
export * from './src/components/upload-drag-area.component';
export * from './src/services/upload.service';
export * from './src/directives/file-select.directive';
export * from './src/directives/file-draggable.directive';
export default {
component: [UploadComponent],
component: [UploadDragAreaComponent, UploadButtonComponent],
directives: [FileSelectDirective, FileDraggableDirective],
providers: [UploadService]
}
}
export const ALFRESCO_ULPOAD_COMPONENT: [any] = [
UploadDragAreaComponent,
UploadButtonComponent,
FileSelectDirective,
FileDraggableDirective
];
export const ALFRESCO_ULPOAD_PROVAIDERS: [any] = [
UploadService
];

View File

@@ -17,7 +17,7 @@
max-height: 350px;
overflow: visible;
right: 24px;
position: absolute;
position: fixed;
}
.file-dialog .header {

View File

@@ -16,20 +16,4 @@
.mdl-textfield--file .mdl-button--file {
right: 0;
}
.upload-border {
vertical-align: middle;
color: #555;
padding: 20px;
max-height: 300px;
overflow-y: auto;
display: inline-block;
border: 3px dashed #555;
text-align: center;
}
.input-focus {
color: #2196F3;
border: 3px dashed #2196F3;
}

View File

@@ -17,16 +17,14 @@
import { ElementRef } from 'angular2/core';
import { FileModel } from '../models/file.model';
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
export declare class UploadComponent {
export declare class UploadButtonComponent {
el: ElementRef;
private _uploaderService;
method: string;
undoNotificationBar: any;
fileUploadingDialogComponent: FileUploadingDialogComponent;
filesUploadingList: FileModel[];
constructor(el: ElementRef);
onFilesAdded(files: any): void;
onFilesDragged(files: any): void;
showUndoNotificationBar(latestFilesAdded: any): void;
showDialog(): void;
}

View File

@@ -0,0 +1,46 @@
<br>
<!--upload buttons-->
<form>
<div class="mdl-button mdl-js-button mdl-button--raised mdl-button--file">
<i class="material-icons">file_upload</i> Upload<input file-select type="file" name="uploadFiles" id="uploadFiles"
multiple="multiple"
accept=".jpg,.gif,.png,.svg,.mp4"
(onFilesAdded)="onFilesAdded($event)"
#uploadFiles>
</div>
<br><br>
<div class="mdl-button mdl-js-button mdl-button--raised mdl-button--file">
<i class="material-icons">file_upload</i> Upload Folder<input file-select type="file" name="uploadFiles" id="uploadFolder"
multiple="multiple"
accept=".jpg,.gif,.png,.svg"
(onFilesAdded)="onFilesAdded($event)"
webkitdirectory directory
multiple #uploadFiles>
</div>
</form>
<!--show dialog-->
<br>
<button type="button" (click)="showDialog($event)" class="mdl-button mdl-js-button mdl-button--raised show-modal">Show
Dialog
</button>
<file-uploading-dialog [filesUploadingList]="filesUploadingList" #fileUploadingDialog></file-uploading-dialog>
<!--show snackbar-->
<div id="demo-snackbar-example" class="mdl-js-snackbar mdl-snackbar" #undoNotificationBar>
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>
<br>
<br>

View File

@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
System.register(['angular2/core', '../services/upload.service', './file-uploading-dialog.component', '../directives/file-select.directive', '../directives/file-draggable.directive'], function(exports_1, context_1) {
System.register(['angular2/core', '../services/upload.service', './file-uploading-dialog.component', '../directives/file-select.directive'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -26,8 +26,8 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1, upload_service_1, file_uploading_dialog_component_1, file_select_directive_1, file_draggable_directive_1;
var UploadComponent;
var core_1, upload_service_1, file_uploading_dialog_component_1, file_select_directive_1;
var UploadButtonComponent;
return {
setters:[
function (core_1_1) {
@@ -41,15 +41,11 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
},
function (file_select_directive_1_1) {
file_select_directive_1 = file_select_directive_1_1;
},
function (file_draggable_directive_1_1) {
file_draggable_directive_1 = file_draggable_directive_1_1;
}],
execute: function() {
UploadComponent = (function () {
function UploadComponent(el) {
UploadButtonComponent = (function () {
function UploadButtonComponent(el) {
this.el = el;
this.method = 'GET';
this.filesUploadingList = [];
console.log('UploadComponent constructor', el);
this._uploaderService = new upload_service_1.UploadService({
@@ -64,7 +60,7 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
}
});
}
UploadComponent.prototype.onFilesAdded = function (files) {
UploadButtonComponent.prototype.onFilesAdded = function (files) {
if (files.length) {
var latestFilesAdded = this._uploaderService.addToQueue(files);
this.filesUploadingList = this._uploaderService.getQueue();
@@ -72,14 +68,7 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
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) {
UploadButtonComponent.prototype.showUndoNotificationBar = function (latestFilesAdded) {
if (componentHandler) {
componentHandler.upgradeAllRegistered();
}
@@ -94,35 +83,31 @@ System.register(['angular2/core', '../services/upload.service', './file-uploadin
actionText: 'Undo'
});
};
UploadComponent.prototype.showDialog = function () {
UploadButtonComponent.prototype.showDialog = function () {
this.fileUploadingDialogComponent.showDialog();
};
__decorate([
core_1.Input(),
__metadata('design:type', String)
], UploadComponent.prototype, "method", void 0);
__decorate([
core_1.ViewChild('undoNotificationBar'),
core_1.ViewChild('undoNotificationBar'),
__metadata('design:type', Object)
], UploadComponent.prototype, "undoNotificationBar", void 0);
], UploadButtonComponent.prototype, "undoNotificationBar", void 0);
__decorate([
core_1.ViewChild('fileUploadingDialog'),
core_1.ViewChild('fileUploadingDialog'),
__metadata('design:type', file_uploading_dialog_component_1.FileUploadingDialogComponent)
], UploadComponent.prototype, "fileUploadingDialogComponent", void 0);
UploadComponent = __decorate([
], UploadButtonComponent.prototype, "fileUploadingDialogComponent", void 0);
UploadButtonComponent = __decorate([
core_1.Component({
selector: 'alfresco-upload',
selector: 'alfresco-upload-button',
moduleId: __moduleName,
directives: [file_select_directive_1.FileSelectDirective, file_draggable_directive_1.FileDraggableDirective, file_uploading_dialog_component_1.FileUploadingDialogComponent],
templateUrl: './upload.component.html',
styleUrls: ['./upload.component.css']
}),
directives: [file_select_directive_1.FileSelectDirective, file_uploading_dialog_component_1.FileUploadingDialogComponent],
templateUrl: './upload-button.component.html',
styleUrls: ['./upload-button.component.css']
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], UploadComponent);
return UploadComponent;
], UploadButtonComponent);
return UploadButtonComponent;
}());
exports_1("UploadComponent", UploadComponent);
exports_1("UploadButtonComponent", UploadButtonComponent);
}
}
});
//# sourceMappingURL=upload.component.js.map
//# sourceMappingURL=upload-button.component.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"upload-button.component.js","sourceRoot":"","sources":["upload-button.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoBH;gBAYI,+BAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAFhC,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,4CAAY,GAAZ,UAAa,KAAK;oBACd,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;wBACf,IAAI,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;wBAC/D,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;wBAC3D,IAAI,CAAC,UAAU,EAAE,CAAC;wBAClB,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;oBACnD,CAAC;gBACL,CAAC;gBAED,uDAAuB,GAAvB,UAAwB,gBAAgB;oBACpC,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;wBACnB,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;oBAC5C,CAAC;oBAED,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,gBAAgB,CAAC,YAAY,CAAC;wBACjE,OAAO,EAAE,uBAAuB;wBAChC,OAAO,EAAE,IAAI;wBACb,aAAa,EAAE;4BACX,gBAAgB,CAAC,OAAO,CAAC,UAAC,kBAAkB;gCACxC,kBAAkB,CAAC,QAAQ,EAAE,CAAC;4BAClC,CAAC,CAAC,CAAC;wBACP,CAAC;wBACD,UAAU,EAAE,MAAM;qBACrB,CAAC,CAAC;gBACP,CAAC;gBAED,0CAAU,GAAV;oBACI,IAAI,CAAC,4BAA4B,CAAC,UAAU,EAAE,CAAC;gBACnD,CAAC;gBApDD;oBAAC,gBAAS,CAAC,qBAAqB,CAAC;;kFAAA;gBAGjC;oBAAC,gBAAS,CAAC,qBAAqB,CAAC;;2FAAA;gBAdrC;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,wBAAwB;wBAClC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,2CAAmB,EAAE,8DAA4B,CAAC;wBAC/D,WAAW,EAAE,gCAAgC;wBAC7C,SAAS,EAAE,CAAC,+BAA+B,CAAC;qBAC/C,CAAC;;yCAAA;gBA0DF,4BAAC;YAAD,CAAC,AAzDD,IAyDC;YAzDD,yDAyDC,CAAA"}

View File

@@ -16,7 +16,7 @@
*/
import {Component, Input, ViewChild, ElementRef} from 'angular2/core';
import {Component, ViewChild, ElementRef} from 'angular2/core';
import {UploadService} from '../services/upload.service';
import {FileModel} from '../models/file.model';
import {FileUploadingDialogComponent} from './file-uploading-dialog.component';
@@ -24,23 +24,19 @@ import {FileSelectDirective} from '../directives/file-select.directive';
import {FileDraggableDirective} from '../directives/file-draggable.directive';
declare let componentHandler;
declare let dialogPolyfill;
declare let __moduleName:string;
@Component({
selector: 'alfresco-upload',
selector: 'alfresco-upload-button',
moduleId: __moduleName,
directives: [FileSelectDirective, FileDraggableDirective, FileUploadingDialogComponent],
templateUrl: './upload.component.html',
styleUrls: ['./upload.component.css']
directives: [FileSelectDirective, FileUploadingDialogComponent],
templateUrl: './upload-button.component.html',
styleUrls: ['./upload-button.component.css']
})
export class UploadComponent {
export class UploadButtonComponent {
private _uploaderService:UploadService;
@Input()
method:string = 'GET';
@ViewChild('undoNotificationBar')
undoNotificationBar;
@@ -74,15 +70,7 @@ export class UploadComponent {
}
}
onFilesDragged(files):void {
if (files.length) {
this._uploaderService.addToQueue(files);
this.filesUploadingList = this._uploaderService.getQueue();
this.showDialog();
}
}
showUndoNotificationBar(latestFilesAdded){
showUndoNotificationBar(latestFilesAdded) {
if (componentHandler) {
componentHandler.upgradeAllRegistered();
}

View File

@@ -0,0 +1,13 @@
.upload-border {
vertical-align: middle;
color: #555;
padding: 20px;
overflow-y: auto;
display: inline-block;
text-align: center;
}
.input-focus {
color: #2196F3;
border: 3px dashed #2196F3;
}

View File

@@ -0,0 +1,28 @@
/**
* @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 { ElementRef } from 'angular2/core';
import { FileModel } from '../models/file.model';
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
export declare class UploadDragAreaComponent {
el: ElementRef;
private _uploaderService;
fileUploadingDialogComponent: FileUploadingDialogComponent;
filesUploadingList: FileModel[];
constructor(el: ElementRef);
onFilesDragged(files: any): void;
showDialog(): void;
}

View File

@@ -0,0 +1,6 @@
<div file-draggable id='UploadBorder' class="upload-border" (onFilesAdded)="onFilesDragged($event)"
dropzone="" webkitdropzone="copy file:image/png file:image/gif file:image/jpeg" #droparea>
<ng-content></ng-content>
</div>
<file-uploading-dialog [filesUploadingList]="filesUploadingList" #fileUploadingDialog></file-uploading-dialog>

View File

@@ -0,0 +1,93 @@
/**
* @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.
*/
System.register(['angular2/core', '../services/upload.service', './file-uploading-dialog.component', '../directives/file-draggable.directive'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1, upload_service_1, file_uploading_dialog_component_1, file_draggable_directive_1;
var UploadDragAreaComponent;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
},
function (upload_service_1_1) {
upload_service_1 = upload_service_1_1;
},
function (file_uploading_dialog_component_1_1) {
file_uploading_dialog_component_1 = file_uploading_dialog_component_1_1;
},
function (file_draggable_directive_1_1) {
file_draggable_directive_1 = file_draggable_directive_1_1;
}],
execute: function() {
UploadDragAreaComponent = (function () {
function UploadDragAreaComponent(el) {
this.el = el;
this.filesUploadingList = [];
console.log('UploadComponent constructor', el);
this._uploaderService = new upload_service_1.UploadService({
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
withCredentials: true,
authToken: btoa('admin:admin'),
authTokenPrefix: 'Basic',
fieldName: 'filedata',
formFields: {
siteid: 'swsdp',
containerid: 'documentLibrary'
}
});
}
UploadDragAreaComponent.prototype.onFilesDragged = function (files) {
if (files.length) {
this._uploaderService.addToQueue(files);
this.filesUploadingList = this._uploaderService.getQueue();
this.showDialog();
}
};
UploadDragAreaComponent.prototype.showDialog = function () {
this.fileUploadingDialogComponent.showDialog();
};
__decorate([
core_1.ViewChild('fileUploadingDialog'),
__metadata('design:type', file_uploading_dialog_component_1.FileUploadingDialogComponent)
], UploadDragAreaComponent.prototype, "fileUploadingDialogComponent", void 0);
UploadDragAreaComponent = __decorate([
core_1.Component({
selector: 'alfresco-upload-drag-area',
moduleId: __moduleName,
directives: [file_draggable_directive_1.FileDraggableDirective, file_uploading_dialog_component_1.FileUploadingDialogComponent],
templateUrl: './upload-drag-area.component.html',
styleUrls: ['./upload-drag-area.component.css']
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], UploadDragAreaComponent);
return UploadDragAreaComponent;
}());
exports_1("UploadDragAreaComponent", UploadDragAreaComponent);
}
}
});
//# sourceMappingURL=upload-drag-area.component.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"upload-drag-area.component.js","sourceRoot":"","sources":["upload-drag-area.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkBH;gBASI,iCAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAFhC,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,gDAAc,GAAd,UAAe,KAAK;oBAChB,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;wBACf,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;wBACxC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;wBAC3D,IAAI,CAAC,UAAU,EAAE,CAAC;oBACtB,CAAC;gBACL,CAAC;gBAED,4CAAU,GAAV;oBACI,IAAI,CAAC,4BAA4B,CAAC,UAAU,EAAE,CAAC;gBACnD,CAAC;gBA/BD;oBAAC,gBAAS,CAAC,qBAAqB,CAAC;;6FAAA;gBAXrC;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,2BAA2B;wBACrC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,iDAAsB,EAAE,8DAA4B,CAAC;wBAClE,WAAW,EAAE,mCAAmC;wBAChD,SAAS,EAAE,CAAC,kCAAkC,CAAC;qBAClD,CAAC;;2CAAA;gBAqCF,8BAAC;YAAD,CAAC,AApCD,IAoCC;YApCD,6DAoCC,CAAA"}

View File

@@ -0,0 +1,70 @@
/**
* @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 {Component, ViewChild, ElementRef} from 'angular2/core';
import {UploadService} from '../services/upload.service';
import {FileModel} from '../models/file.model';
import {FileUploadingDialogComponent} from './file-uploading-dialog.component';
import {FileDraggableDirective} from '../directives/file-draggable.directive';
declare let __moduleName:string;
@Component({
selector: 'alfresco-upload-drag-area',
moduleId: __moduleName,
directives: [FileDraggableDirective, FileUploadingDialogComponent],
templateUrl: './upload-drag-area.component.html',
styleUrls: ['./upload-drag-area.component.css']
})
export class UploadDragAreaComponent {
private _uploaderService:UploadService;
@ViewChild('fileUploadingDialog')
fileUploadingDialogComponent:FileUploadingDialogComponent;
filesUploadingList:FileModel [] = [];
constructor(public el:ElementRef) {
console.log('UploadComponent constructor', el);
this._uploaderService = new UploadService({
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
withCredentials: true,
authToken: btoa('admin:admin'),
authTokenPrefix: 'Basic',
fieldName: 'filedata',
formFields: {
siteid: 'swsdp',
containerid: 'documentLibrary'
}
});
}
onFilesDragged(files):void {
if (files.length) {
this._uploaderService.addToQueue(files);
this.filesUploadingList = this._uploaderService.getQueue();
this.showDialog();
}
}
showDialog():void {
this.fileUploadingDialogComponent.showDialog();
}
}

View File

@@ -1 +0,0 @@
{"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,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BACD,UAAU,EAAE,MAAM;qBACrB,CAAC,CAAC;gBACP,CAAC;gBAED,oCAAU,GAAV;oBACI,IAAI,CAAC,4BAA4B,CAAC,UAAU,EAAE,CAAC;gBACnD,CAAC;gBA/DD;oBAAC,YAAK,EAAE;;+DAAA;gBAGR;oBAAC,gBAAS,CAAC,qBAAqB,CAAC;;4EAAA;gBAGjC;oBAAC,gBAAS,CAAC,qBAAqB,CAAC;;qFAAA;gBAjBrC;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,iBAAiB;wBAC3B,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,2CAAmB,EAAE,iDAAsB,EAAE,8DAA4B,CAAC;wBACvF,WAAW,EAAE,yBAAyB;wBACtC,SAAS,EAAE,CAAC,wBAAwB,CAAC;qBACxC,CAAC;;mCAAA;gBAqEF,sBAAC;YAAD,CAAC,AApED,IAoEC;YApED,6CAoEC,CAAA"}

View File

@@ -1,19 +1,3 @@
/**
* @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 { FileModel } from '../models/file.model';
export declare class UploadService {
private _url;
@@ -24,7 +8,7 @@ export declare class UploadService {
private _formFields;
private _withCredentials;
_queue: FileModel[];
constructor(options: any);
constructor();
addToQueue(files: any[]): FileModel[];
private _uploadFilesInTheQueue();
uploadFile(uploadingFileModel: any): void;

View File

@@ -14,32 +14,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
System.register(['../models/file.model'], function(exports_1, context_1) {
System.register(['angular2/core', '../models/file.model'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var file_model_1;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1, file_model_1;
var UploadService;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
},
function (file_model_1_1) {
file_model_1 = file_model_1_1;
}],
execute: function() {
UploadService = (function () {
function UploadService(options) {
function UploadService() {
this._method = 'POST';
this._authTokenPrefix = 'Basic';
this._authToken = undefined;
this._fieldName = 'file';
this._formFields = {};
this._queue = [];
console.log('UploadService constructor');
this._withCredentials = options.withCredentials != null ? options.withCredentials : this._withCredentials;
this._url = options.url != null ? options.url : this._url;
this._authTokenPrefix = options.authTokenPrefix != null ? options.authTokenPrefix : this._authTokenPrefix;
this._authToken = options.authToken != null ? options.authToken : this._authToken;
this._fieldName = options.fieldName != null ? options.fieldName : this._fieldName;
this._formFields = options.formFields != null ? options.formFields : this._formFields;
}
UploadService.prototype.addToQueue = function (files) {
var latestFilesAdded = [];
@@ -108,6 +113,10 @@ System.register(['../models/file.model'], function(exports_1, context_1) {
UploadService.prototype._isFile = function (file) {
return file !== null && (file instanceof Blob || (file.name && file.size));
};
UploadService = __decorate([
core_1.Injectable(),
__metadata('design:paramtypes', [])
], UploadService);
return UploadService;
}());
exports_1("UploadService", UploadService);

View File

@@ -1 +1 @@
{"version":3,"file":"upload.service.js","sourceRoot":"","sources":["upload.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;YAKH;gBAWI,uBAAY,OAAW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vB,CAAC;gBAEO,+BAAO,GAAf,UAAgB,IAAQ;oBACpB,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/E,CAAC;gBAzGL;oBAAC,iBAAU,EAAE;;iCAAA;gBA0Gb,oBAAC;YAAD,CAAC,AAzGD,IAyGC;YAzGD,yCAyGC,CAAA"}

View File

@@ -16,8 +16,11 @@
*/
import {Injectable} from 'angular2/core';
import {FileModel} from '../models/file.model';
@Injectable()
export class UploadService {
private _url:string;
private _method:string = 'POST';
@@ -29,7 +32,9 @@ export class UploadService {
_queue:FileModel[] = [];
constructor(options:any) {
constructor(){}
constructor(private options:any) {
console.log('UploadService constructor');
this._withCredentials = options.withCredentials != null ? options.withCredentials : this._withCredentials;