lint login and upload

This commit is contained in:
Mario Romano
2016-05-12 19:11:00 +01:00
parent d1858f54ab
commit 6654563469
78 changed files with 1025 additions and 2928 deletions

View File

@@ -1,48 +0,0 @@
/**
* @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';
/**
* <file-uploading-dialog [filesUploadingList]="FileModel[]" ></file-uploading-dialog>
*
* This component is a hideable and minimizable wich contains the list of the uploading
* files contained in the filesUploadingList.
*
* @InputParam {FileModel[]} filesUploadingList - list of the uploading files .
*
*
* @returns {FileUploadingDialogComponent} .
*/
export declare class FileUploadingDialogComponent {
el: ElementRef;
filesUploadingList: FileModel[];
private _isDialogActive;
private _isDialogMinimized;
constructor(el: ElementRef);
/**
* Display and hide the dialog component.
*/
toggleShowDialog($event: any): void;
/**
* Display the dialog if hidden.
*/
showDialog(): void;
/**
* Minimize and expand the dialog component.
*/
toggleDialogMinimize($event: any): void;
}

View File

@@ -4,12 +4,12 @@
{{filesUploadingList.length}} {{'FILE_UPLOAD.MESSAGES.COMPLETED' | translate}}
</div>
<div class="buttons">
<div class="minimize-button" [ngClass]="{active: _isDialogMinimized}" (click)="toggleDialogMinimize($event)">
<div class="minimize-button" [ngClass]="{active: _isDialogMinimized}" (click)="toggleDialogMinimize()">
<i class="material-icons down">keyboard_arrow_down</i>
<i class="material-icons up">keyboard_arrow_up</i>
</div>
<div class="close-button" (click)="toggleShowDialog($event)">
<div class="close-button" (click)="toggleShowDialog()">
<i class="material-icons">clear</i>
</div>
</div>

View File

@@ -1,101 +0,0 @@
/**
* @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', './file-uploading-list.component', 'ng2-translate/ng2-translate'], 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, file_uploading_list_component_1, ng2_translate_1;
var FileUploadingDialogComponent;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
},
function (file_uploading_list_component_1_1) {
file_uploading_list_component_1 = file_uploading_list_component_1_1;
},
function (ng2_translate_1_1) {
ng2_translate_1 = ng2_translate_1_1;
}],
execute: function() {
/**
* <file-uploading-dialog [filesUploadingList]="FileModel[]" ></file-uploading-dialog>
*
* This component is a hideable and minimizable wich contains the list of the uploading
* files contained in the filesUploadingList.
*
* @InputParam {FileModel[]} filesUploadingList - list of the uploading files .
*
*
* @returns {FileUploadingDialogComponent} .
*/
FileUploadingDialogComponent = (function () {
function FileUploadingDialogComponent(el) {
this.el = el;
this._isDialogActive = false;
this._isDialogMinimized = false;
console.log('FileUploadingDialogComponent constructor', el);
}
/**
* Display and hide the dialog component.
*/
FileUploadingDialogComponent.prototype.toggleShowDialog = function ($event) {
this._isDialogActive = !this._isDialogActive;
};
/**
* Display the dialog if hidden.
*/
FileUploadingDialogComponent.prototype.showDialog = function () {
this._isDialogActive = true;
};
/**
* Minimize and expand the dialog component.
*/
FileUploadingDialogComponent.prototype.toggleDialogMinimize = function ($event) {
this._isDialogMinimized = !this._isDialogMinimized;
};
__decorate([
core_1.Input(),
__metadata('design:type', Array)
], FileUploadingDialogComponent.prototype, "filesUploadingList", void 0);
FileUploadingDialogComponent = __decorate([
core_1.Component({
selector: 'file-uploading-dialog',
moduleId: __moduleName,
directives: [file_uploading_list_component_1.FileUploadingListComponent],
templateUrl: './file-uploading-dialog.component.html',
styleUrls: ['./file-uploading-dialog.component.css'],
host: { '[class.dialog-show]': 'toggleShowDialog' },
pipes: [ng2_translate_1.TranslatePipe]
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], FileUploadingDialogComponent);
return FileUploadingDialogComponent;
}());
exports_1("FileUploadingDialogComponent", FileUploadingDialogComponent);
}
}
});
//# sourceMappingURL=file-uploading-dialog.component.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"file-uploading-dialog.component.js","sourceRoot":"","sources":["file-uploading-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUH;;;;;;;;;;eAUG;YAUH;gBASI,sCAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAJzB,oBAAe,GAAY,KAAK,CAAC;oBAEjC,uBAAkB,GAAY,KAAK,CAAC;oBAGxC,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;gBAChE,CAAC;gBAED;;mBAEG;gBACH,uDAAgB,GAAhB,UAAiB,MAAM;oBACnB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;gBACjD,CAAC;gBAED;;mBAEG;gBACH,iDAAU,GAAV;oBACI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAChC,CAAC;gBAED;;mBAEG;gBACH,2DAAoB,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,kBAAkB,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBACvD,CAAC;gBA9BD;oBAAC,YAAK,EAAE;;wFAAA;gBAXZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,uBAAuB;wBACjC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,0DAA0B,CAAC;wBACxC,WAAW,EAAE,wCAAwC;wBACrD,SAAS,EAAE,CAAC,uCAAuC,CAAC;wBACpD,IAAI,EAAE,EAAC,qBAAqB,EAAE,kBAAkB,EAAC;wBACjD,KAAK,EAAE,CAAC,6BAAa,CAAC;qBACzB,CAAC;;gDAAA;gBAkCF,mCAAC;YAAD,CAAC,AAjCD,IAiCC;YAjCD,uEAiCC,CAAA"}

View File

@@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@@ -15,11 +15,10 @@
* limitations under the License.
*/
import {Component, ElementRef, Input} from 'angular2/core';
import {FileModel} from '../models/file.model';
import {FileUploadingListComponent} from './file-uploading-list.component';
import {TranslatePipe} from 'ng2-translate/ng2-translate';
import { Component, ElementRef, Input } from 'angular2/core';
import { FileModel } from '../models/file.model';
import { FileUploadingListComponent } from './file-uploading-list.component';
import { TranslatePipe } from 'ng2-translate/ng2-translate';
declare let __moduleName: string;
@@ -59,7 +58,7 @@ export class FileUploadingDialogComponent {
/**
* Display and hide the dialog component.
*/
toggleShowDialog($event) {
toggleShowDialog() {
this._isDialogActive = !this._isDialogActive;
}
@@ -73,7 +72,7 @@ export class FileUploadingDialogComponent {
/**
* Minimize and expand the dialog component.
*/
toggleDialogMinimize($event) {
toggleDialogMinimize() {
this._isDialogMinimized = !this._isDialogMinimized;
}
}
}

View File

@@ -1,39 +0,0 @@
/**
* @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';
/**
* <alfresco-file-uploading-list [filesUploadingList]="FileModel[]" ></alfresco-file-uploading-list>
*
* This component show a list of the uploading files contained in the filesUploadingList.
*
* @InputParam {FileModel[]} filesUploadingList - list of the uploading files .
*
*
* @returns {FileUploadingListComponent} .
*/
export declare class FileUploadingListComponent {
el: ElementRef;
filesUploadingList: FileModel[];
constructor(el: ElementRef);
/**
* Abort the in progress uploading of a specific file.
*
* @param {string} id - FileModel id of the file to abort.
*/
abort(id: any): void;
}

View File

@@ -1,89 +0,0 @@
/**
* @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', 'ng2-translate/ng2-translate'], 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, ng2_translate_1;
var FileUploadingListComponent;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
},
function (ng2_translate_1_1) {
ng2_translate_1 = ng2_translate_1_1;
}],
execute: function() {
/**
* <alfresco-file-uploading-list [filesUploadingList]="FileModel[]" ></alfresco-file-uploading-list>
*
* This component show a list of the uploading files contained in the filesUploadingList.
*
* @InputParam {FileModel[]} filesUploadingList - list of the uploading files .
*
*
* @returns {FileUploadingListComponent} .
*/
FileUploadingListComponent = (function () {
function FileUploadingListComponent(el) {
this.el = el;
console.log('filesUploadingList constructor', el);
setInterval(function () {
console.log('Check for async update from drag directive');
}, 1000);
}
/**
* Abort the in progress uploading of a specific file.
*
* @param {string} id - FileModel id of the file to abort.
*/
FileUploadingListComponent.prototype.abort = function (id) {
var file = this.filesUploadingList.filter(function (uploadingFileModel) {
return uploadingFileModel.id == id;
});
file[0].setAbort();
};
__decorate([
core_1.Input(),
__metadata('design:type', Array)
], FileUploadingListComponent.prototype, "filesUploadingList", void 0);
FileUploadingListComponent = __decorate([
core_1.Component({
selector: 'alfresco-file-uploading-list',
moduleId: __moduleName,
templateUrl: './file-uploading-list.component.html',
styleUrls: ['./file-uploading-list.component.css'],
pipes: [ng2_translate_1.TranslatePipe]
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], FileUploadingListComponent);
return FileUploadingListComponent;
}());
exports_1("FileUploadingListComponent", FileUploadingListComponent);
}
}
});
//# sourceMappingURL=file-uploading-list.component.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"file-uploading-list.component.js","sourceRoot":"","sources":["file-uploading-list.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YASH;;;;;;;;;eASG;YAQH;gBAKI,oCAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBAC7B,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,EAAE,CAAC,CAAC;oBAElD,WAAW,CAAC;wBACR,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;oBAC9D,CAAC,EAAE,IAAI,CAAC,CAAC;gBACb,CAAC;gBAED;;;;mBAIG;gBACH,0CAAK,GAAL,UAAM,EAAE;oBACJ,IAAI,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,UAAC,kBAAkB;wBACzD,MAAM,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC;oBACvC,CAAC,CAAC,CAAC;oBACH,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACvB,CAAC;gBArBD;oBAAC,YAAK,EAAE;;sFAAA;gBATZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,8BAA8B;wBACxC,QAAQ,EAAE,YAAY;wBACtB,WAAW,EAAE,sCAAsC;wBACnD,SAAS,EAAE,CAAC,qCAAqC,CAAC;wBAClD,KAAK,EAAE,CAAC,6BAAa,CAAC;qBACzB,CAAC;;8CAAA;gBAyBF,iCAAC;YAAD,CAAC,AAxBD,IAwBC;YAxBD,mEAwBC,CAAA"}

View File

@@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@@ -16,9 +16,9 @@
*/
import {Component, ElementRef, Input} from 'angular2/core';
import {FileModel} from '../models/file.model';
import {TranslatePipe} from 'ng2-translate/ng2-translate';
import { Component, ElementRef, Input } from 'angular2/core';
import { FileModel } from '../models/file.model';
import { TranslatePipe } from 'ng2-translate/ng2-translate';
declare let __moduleName: string;
@@ -47,9 +47,7 @@ export class FileUploadingListComponent {
constructor(public el: ElementRef) {
console.log('filesUploadingList constructor', el);
setInterval(() => {
console.log('Check for async update from drag directive');
}, 1000);
setInterval(() => {console.log('Check for async update from drag directive'); }, 1000);
}
/**
@@ -57,9 +55,9 @@ export class FileUploadingListComponent {
*
* @param {string} id - FileModel id of the file to abort.
*/
abort(id): void {
abort(id: string): void {
let file = this.filesUploadingList.filter((uploadingFileModel) => {
return uploadingFileModel.id == id;
return uploadingFileModel.id === id;
});
file[0].setAbort();
}

View File

@@ -1,75 +0,0 @@
/**
* @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';
import { TranslateService } from 'ng2-translate/ng2-translate';
/**
* <alfresco-upload-button [showDialogUpload]="boolean"
* [showUdoNotificationBar]="boolean"
* [uploadFolders]="boolean"
* [multipleFiles]="boolean"
* [acceptedFilesType]="string">
* </alfresco-upload-button>
*
* This component, provide a set of buttons to upload files to alfresco.
*
* @InputParam {boolean} [true] showDialogUpload - hide/show upload dialog.
* @InputParam {boolean} [true] showUdoNotificationBar - hide/show notification bar.
* @InputParam {boolean} [false] uploadFolders - allow/disallow upload folders (only for chrome).
* @InputParam {boolean} [false] multipleFiles - allow/disallow multiple files.
* @InputParam {string} [*] acceptedFilesType - array of allowed file extensions.
*
*
* @returns {UploadDragAreaComponent} .
*/
export declare class UploadButtonComponent {
el: ElementRef;
private _uploaderService;
undoNotificationBar: any;
fileUploadingDialogComponent: FileUploadingDialogComponent;
showUploadDialog: boolean;
showUdoNotificationBar: boolean;
uploadFolders: boolean;
multipleFiles: boolean;
acceptedFilesType: string;
uploaddirectory: string;
filesUploadingList: FileModel[];
translate: TranslateService;
constructor(el: ElementRef, translate: TranslateService);
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
onFilesAdded($event: any): void;
/**
* Show undo notification bar.
*
* @param {FileModel[]} latestFilesAdded - files in the upload queue enriched with status flag and xhr object.
*/
private _showUndoNotificationBar(latestFilesAdded);
/**
* Show the upload dialog.
*/
private _showDialog();
/**
* Initial configuration for Multi language
* @param translate
*/
translationInit(translate: TranslateService): void;
}

View File

@@ -1,194 +0,0 @@
/**
* @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', 'ng2-translate/ng2-translate'], 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, ng2_translate_1;
var UploadButtonComponent;
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 (ng2_translate_1_1) {
ng2_translate_1 = ng2_translate_1_1;
}],
execute: function() {
/**
* <alfresco-upload-button [showDialogUpload]="boolean"
* [showUdoNotificationBar]="boolean"
* [uploadFolders]="boolean"
* [multipleFiles]="boolean"
* [acceptedFilesType]="string">
* </alfresco-upload-button>
*
* This component, provide a set of buttons to upload files to alfresco.
*
* @InputParam {boolean} [true] showDialogUpload - hide/show upload dialog.
* @InputParam {boolean} [true] showUdoNotificationBar - hide/show notification bar.
* @InputParam {boolean} [false] uploadFolders - allow/disallow upload folders (only for chrome).
* @InputParam {boolean} [false] multipleFiles - allow/disallow multiple files.
* @InputParam {string} [*] acceptedFilesType - array of allowed file extensions.
*
*
* @returns {UploadDragAreaComponent} .
*/
UploadButtonComponent = (function () {
function UploadButtonComponent(el, translate) {
this.el = el;
this.showUploadDialog = true;
this.showUdoNotificationBar = true;
this.uploadFolders = false;
this.multipleFiles = false;
this.acceptedFilesType = '*';
this.uploaddirectory = '';
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'
}
});
this.translationInit(translate);
}
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
UploadButtonComponent.prototype.onFilesAdded = function ($event) {
var files = $event.currentTarget.files;
if (files.length) {
var latestFilesAdded = this._uploaderService.addToQueue(files);
this._uploaderService.uploadFilesInTheQueue(this.uploaddirectory);
this.filesUploadingList = this._uploaderService.getQueue();
if (this.showUploadDialog) {
this._showDialog();
}
if (this.showUdoNotificationBar) {
this._showUndoNotificationBar(latestFilesAdded);
}
}
};
/**
* Show undo notification bar.
*
* @param {FileModel[]} latestFilesAdded - files in the upload queue enriched with status flag and xhr object.
*/
UploadButtonComponent.prototype._showUndoNotificationBar = function (latestFilesAdded) {
if (componentHandler) {
componentHandler.upgradeAllRegistered();
}
this.undoNotificationBar.nativeElement.MaterialSnackbar.showSnackbar({
message: this.translate.get('FILE_UPLOAD.MESSAGES.PROGRESS').value,
timeout: 5000,
actionHandler: function () {
latestFilesAdded.forEach(function (uploadingFileModel) {
uploadingFileModel.setAbort();
});
},
actionText: this.translate.get('FILE_UPLOAD.ACTION.UNDO').value
});
};
/**
* Show the upload dialog.
*/
UploadButtonComponent.prototype._showDialog = function () {
this.fileUploadingDialogComponent.showDialog();
};
/**
* Initial configuration for Multi language
* @param translate
*/
UploadButtonComponent.prototype.translationInit = function (translate) {
this.translate = translate;
var userLang = navigator.language.split('-')[0]; // use navigator lang if available
userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
this.translate.setDefaultLang(userLang);
this.translate.use(userLang);
};
__decorate([
core_1.ViewChild('undoNotificationBar'),
__metadata('design:type', Object)
], UploadButtonComponent.prototype, "undoNotificationBar", void 0);
__decorate([
core_1.ViewChild('fileUploadingDialog'),
__metadata('design:type', file_uploading_dialog_component_1.FileUploadingDialogComponent)
], UploadButtonComponent.prototype, "fileUploadingDialogComponent", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', Boolean)
], UploadButtonComponent.prototype, "showUploadDialog", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', Boolean)
], UploadButtonComponent.prototype, "showUdoNotificationBar", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', Boolean)
], UploadButtonComponent.prototype, "uploadFolders", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', Boolean)
], UploadButtonComponent.prototype, "multipleFiles", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], UploadButtonComponent.prototype, "acceptedFilesType", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], UploadButtonComponent.prototype, "uploaddirectory", void 0);
UploadButtonComponent = __decorate([
core_1.Component({
selector: 'alfresco-upload-button',
moduleId: __moduleName,
directives: [file_uploading_dialog_component_1.FileUploadingDialogComponent],
templateUrl: './upload-button.component.html',
styleUrls: ['./upload-button.component.css'],
pipes: [ng2_translate_1.TranslatePipe]
}),
__metadata('design:paramtypes', [core_1.ElementRef, ng2_translate_1.TranslateService])
], UploadButtonComponent);
return UploadButtonComponent;
}());
exports_1("UploadButtonComponent", UploadButtonComponent);
}
}
});
//# sourceMappingURL=upload-button.component.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"upload-button.component.js","sourceRoot":"","sources":["upload-button.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAYH;;;;;;;;;;;;;;;;;;eAkBG;YASH;gBAgCI,+BAAmB,EAAc,EACrB,SAA2B;oBADpB,OAAE,GAAF,EAAE,CAAY;oBArBjC,qBAAgB,GAAY,IAAI,CAAC;oBAGjC,2BAAsB,GAAY,IAAI,CAAC;oBAGvC,kBAAa,GAAY,KAAK,CAAC;oBAG/B,kBAAa,GAAY,KAAK,CAAC;oBAG/B,sBAAiB,GAAW,GAAG,CAAC;oBAGhC,oBAAe,GAAW,EAAE,CAAC;oBAE7B,uBAAkB,GAAiB,EAAE,CAAC;oBAMlC,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;oBAEH,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;gBACpC,CAAC;gBAED;;;;mBAIG;gBACH,4CAAY,GAAZ,UAAa,MAAM;oBACf,IAAI,KAAK,GAAG,MAAM,CAAC,a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, ElementRef, Input} from 'angular2/core';
import {UploadService} from '../services/upload.service';
import {FileModel} from '../models/file.model';
import {FileUploadingDialogComponent} from './file-uploading-dialog.component';
import {TranslateService, TranslatePipe} from 'ng2-translate/ng2-translate';
import { Component, ViewChild, ElementRef, Input } from 'angular2/core';
import { UploadService } from '../services/upload.service';
import { FileModel } from '../models/file.model';
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
import { TranslateService, TranslatePipe } from 'ng2-translate/ng2-translate';
declare let componentHandler;
declare let componentHandler: any;
declare let __moduleName: string;
/**
@@ -54,10 +54,8 @@ declare let __moduleName: string;
})
export class UploadButtonComponent {
private _uploaderService: UploadService;
@ViewChild('undoNotificationBar')
undoNotificationBar;
undoNotificationBar: any;
@ViewChild('fileUploadingDialog')
fileUploadingDialogComponent: FileUploadingDialogComponent;
@@ -84,6 +82,8 @@ export class UploadButtonComponent {
translate: TranslateService;
private _uploaderService: UploadService;
constructor(public el: ElementRef,
translate: TranslateService) {
console.log('UploadComponent constructor', el);
@@ -108,7 +108,7 @@ export class UploadButtonComponent {
*
* @param {File[]} files - files dropped in the drag area.
*/
onFilesAdded($event): void {
onFilesAdded($event: any): void {
let files = $event.currentTarget.files;
if (files.length) {
let latestFilesAdded = this._uploaderService.addToQueue(files);
@@ -123,35 +123,6 @@ export class UploadButtonComponent {
}
}
/**
* Show undo notification bar.
*
* @param {FileModel[]} latestFilesAdded - files in the upload queue enriched with status flag and xhr object.
*/
private _showUndoNotificationBar(latestFilesAdded) {
if (componentHandler) {
componentHandler.upgradeAllRegistered();
}
this.undoNotificationBar.nativeElement.MaterialSnackbar.showSnackbar({
message: this.translate.get('FILE_UPLOAD.MESSAGES.PROGRESS').value,
timeout: 5000,
actionHandler: function () {
latestFilesAdded.forEach((uploadingFileModel) => {
uploadingFileModel.setAbort();
});
},
actionText: this.translate.get('FILE_UPLOAD.ACTION.UNDO').value
});
}
/**
* Show the upload dialog.
*/
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
/**
* Initial configuration for Multi language
* @param translate
@@ -165,4 +136,33 @@ export class UploadButtonComponent {
this.translate.use(userLang);
}
/**
* Show undo notification bar.
*
* @param {FileModel[]} latestFilesAdded - files in the upload queue enriched with status flag and xhr object.
*/
private _showUndoNotificationBar(latestFilesAdded: FileModel[]) {
if (componentHandler) {
componentHandler.upgradeAllRegistered();
}
this.undoNotificationBar.nativeElement.MaterialSnackbar.showSnackbar({
message: this.translate.get('FILE_UPLOAD.MESSAGES.PROGRESS'),
timeout: 5000,
actionHandler: function () {
latestFilesAdded.forEach((uploadingFileModel: FileModel) => {
uploadingFileModel.setAbort();
});
},
actionText: this.translate.get('FILE_UPLOAD.ACTION.UNDO')
});
}
/**
* Show the upload dialog.
*/
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
}

View File

@@ -1,48 +0,0 @@
/**
* @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';
/**
* <alfresco-upload-drag-area [showDialogUpload]="boolean" ></alfresco-upload-drag-area>
*
* This component, provide a drag and drop are to upload files to alfresco.
*
* @InputParam {boolean} [true] showDialogUpload - hide/show upload dialog .
*
*
* @returns {UploadDragAreaComponent} .
*/
export declare class UploadDragAreaComponent {
el: ElementRef;
private _uploaderService;
fileUploadingDialogComponent: FileUploadingDialogComponent;
showUploadDialog: boolean;
filesUploadingList: FileModel[];
uploaddirectory: string;
constructor(el: ElementRef);
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
onFilesDropped(files: any): void;
/**
* Show the upload dialog.
*/
private _showDialog();
}

View File

@@ -1,124 +0,0 @@
/**
* @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() {
/**
* <alfresco-upload-drag-area [showDialogUpload]="boolean" ></alfresco-upload-drag-area>
*
* This component, provide a drag and drop are to upload files to alfresco.
*
* @InputParam {boolean} [true] showDialogUpload - hide/show upload dialog .
*
*
* @returns {UploadDragAreaComponent} .
*/
UploadDragAreaComponent = (function () {
function UploadDragAreaComponent(el) {
this.el = el;
this.showUploadDialog = true;
this.filesUploadingList = [];
this.uploaddirectory = '';
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'
}
});
}
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
UploadDragAreaComponent.prototype.onFilesDropped = function (files) {
if (files.length) {
this._uploaderService.addToQueue(files);
this._uploaderService.uploadFilesInTheQueue(this.uploaddirectory);
this.filesUploadingList = this._uploaderService.getQueue();
if (this.showUploadDialog) {
this._showDialog();
}
}
};
/**
* Show the upload dialog.
*/
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);
__decorate([
core_1.Input(),
__metadata('design:type', Boolean)
], UploadDragAreaComponent.prototype, "showUploadDialog", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], UploadDragAreaComponent.prototype, "uploaddirectory", 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

@@ -1 +0,0 @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AC,UAAU,EAAE,CAAC;gBACnD,CAAC;gBAhDD;oBAAC,gBAAS,CAAC,qBAAqB,CAAC;;6FAAA;gBAGjC;oBAAC,YAAK,EAAE;;iFAAA;gBAKR;oBAAC,YAAK,EAAE;;gFAAA;gBAnBZ;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;gBAsDF,8BAAC;YAAD,CAAC,AArDD,IAqDC;YArDD,6DAqDC,CAAA"}

View File

@@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@@ -15,12 +15,11 @@
* limitations under the License.
*/
import {Component, ViewChild, ElementRef, Input, EventEmitter} 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';
import { Component, ViewChild, ElementRef, Input } 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;
@@ -35,63 +34,63 @@ declare let __moduleName: string;
* @returns {UploadDragAreaComponent} .
*/
@Component({
selector: 'alfresco-upload-drag-area',
moduleId: __moduleName,
directives: [FileDraggableDirective, FileUploadingDialogComponent],
templateUrl: './upload-drag-area.component.html',
styleUrls: ['./upload-drag-area.component.css']
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;
private _uploaderService: UploadService;
@ViewChild('fileUploadingDialog')
fileUploadingDialogComponent: FileUploadingDialogComponent;
@ViewChild('fileUploadingDialog')
fileUploadingDialogComponent: FileUploadingDialogComponent;
@Input()
showUploadDialog: boolean = true;
@Input()
showUploadDialog: boolean = true;
filesUploadingList: FileModel [] = [];
filesUploadingList: FileModel [] = [];
@Input()
uploaddirectory: string = '';
@Input()
uploaddirectory: string = '';
constructor(public el: ElementRef) {
console.log('UploadComponent constructor', el);
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'
}
});
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'
}
});
}
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
onFilesDropped(files: File[]): void {
if (files.length) {
this._uploaderService.addToQueue(files);
this._uploaderService.uploadFilesInTheQueue(this.uploaddirectory);
this.filesUploadingList = this._uploaderService.getQueue();
if (this.showUploadDialog) {
this._showDialog();
}
}
}
/**
* Method called when files are dropped in the drag area.
*
* @param {File[]} files - files dropped in the drag area.
*/
onFilesDropped(files): void {
if (files.length) {
this._uploaderService.addToQueue(files);
this._uploaderService.uploadFilesInTheQueue(this.uploaddirectory);
this.filesUploadingList = this._uploaderService.getQueue();
if (this.showUploadDialog) {
this._showDialog();
}
}
}
/**
* Show the upload dialog.
*/
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
/**
* Show the upload dialog.
*/
private _showDialog(): void {
this.fileUploadingDialogComponent.showDialog();
}
}

View File

@@ -1,65 +0,0 @@
/**
* @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, EventEmitter } from 'angular2/core';
/**
* [file-draggable]
*
* This directive, provide a drag and drop area for files and folders.
*
* @OutputEvent {EventEmitter} onFilesDropped(File)- event fired fot each file dropped
* in the drag and drop area.
*
*
* @returns {FileDraggableDirective} .
*/
export declare class FileDraggableDirective {
el: ElementRef;
onFilesDropped: EventEmitter<any>;
files: File[];
private _inputFocusClass;
constructor(el: ElementRef);
/**
* Method called when files is dropped in the drag and drop area.
*
* @param {$event} $event - DOM $event.
*/
private _onDropFiles($event);
/**
* Travers all the files and folders, and emit an event for each file.
*
* @param {Object} item - can contains files or folders.
*/
private _traverseFileTree(item);
/**
* Change the style of the drag area when a file drag in.
*
* @param {$event} $event - DOM $event.
*/
private _onDragEnter($event);
/**
* Change the style of the drag area when a file drag out.
*
* @param {$event} $event - DOM $event.
*/
private _onDragLeave($event);
/**
* Prevent default and stop propagation of the DOM event.
*
* @param {$event} $event - DOM $event.
*/
private _preventDefault($event);
}

View File

@@ -1,150 +0,0 @@
/**
* @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'], 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;
var FileDraggableDirective;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
}],
execute: function() {
/**
* [file-draggable]
*
* This directive, provide a drag and drop area for files and folders.
*
* @OutputEvent {EventEmitter} onFilesDropped(File)- event fired fot each file dropped
* in the drag and drop area.
*
*
* @returns {FileDraggableDirective} .
*/
FileDraggableDirective = (function () {
function FileDraggableDirective(el) {
this.el = el;
this.onFilesDropped = new core_1.EventEmitter();
this._inputFocusClass = false;
console.log('FileDraggableComponent constructor', el);
}
/**
* Method called when files is dropped in the drag and drop area.
*
* @param {$event} $event - DOM $event.
*/
FileDraggableDirective.prototype._onDropFiles = function ($event) {
this._preventDefault($event);
var items = $event.dataTransfer.items;
for (var i = 0; i < items.length; i++) {
var item = items[i].webkitGetAsEntry();
if (item) {
this._traverseFileTree(item);
}
else {
var dt = $event.dataTransfer;
var files = dt.files;
this.onFilesDropped.emit(files);
}
}
this._inputFocusClass = false;
};
/**
* Travers all the files and folders, and emit an event for each file.
*
* @param {Object} item - can contains files or folders.
*/
FileDraggableDirective.prototype._traverseFileTree = function (item) {
if (item.isFile) {
var self_1 = this;
item.file(function (file) {
self_1.onFilesDropped.emit([file]);
});
}
else {
if (item.isDirectory) {
var self_2 = this;
var dirReader = item.createReader();
dirReader.readEntries(function (entries) {
for (var i = 0; i < entries.length; i++) {
self_2._traverseFileTree(entries[i]);
}
});
}
}
};
/**
* Change the style of the drag area when a file drag in.
*
* @param {$event} $event - DOM $event.
*/
FileDraggableDirective.prototype._onDragEnter = function ($event) {
this._preventDefault($event);
this._inputFocusClass = true;
};
/**
* Change the style of the drag area when a file drag out.
*
* @param {$event} $event - DOM $event.
*/
FileDraggableDirective.prototype._onDragLeave = function ($event) {
this._preventDefault($event);
this._inputFocusClass = false;
};
/**
* Prevent default and stop propagation of the DOM event.
*
* @param {$event} $event - DOM $event.
*/
FileDraggableDirective.prototype._preventDefault = function ($event) {
$event.stopPropagation();
$event.preventDefault();
};
__decorate([
core_1.Output(),
__metadata('design:type', core_1.EventEmitter)
], FileDraggableDirective.prototype, "onFilesDropped", void 0);
FileDraggableDirective = __decorate([
core_1.Directive({
selector: '[file-draggable]',
host: {
'(drop)': '_onDropFiles($event)',
'(dragenter)': '_onDragEnter($event)',
'(dragleave)': '_onDragLeave($event)',
'(dragover)': '_preventDefault($event)',
'[class.input-focus]': '_inputFocusClass'
}
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], FileDraggableDirective);
return FileDraggableDirective;
}());
exports_1("FileDraggableDirective", FileDraggableDirective);
}
}
});
//# sourceMappingURL=file-draggable.directive.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"file-draggable.directive.js","sourceRoot":"","sources":["file-draggable.directive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;YAIH;;;;;;;;;;eAUG;YAWH;gBASI,gCAAmB,EAAc;oBAAd,OAAE,GAAF,EAAE,CAAY;oBANjC,mBAAc,GAAsB,IAAI,mBAAY,EAAE,CAAC;oBAI/C,qBAAgB,GAAY,KAAK,CAAC;oBAGtC,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;gBAC1D,CAAC;gBAED;;;;mBAIG;gBACK,6CAAY,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;oBAE7B,IAAI,KAAK,GAAG,MAAM,CAAC,YA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CAAC;oCACtC,MAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gCACvC,CAAC;4BACL,CAAC,CAAC,CAAC;wBACP,CAAC;oBACL,CAAC;gBACL,CAAC;gBAED;;;;mBAIG;gBACK,6CAAY,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;oBAE7B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;gBACjC,CAAC;gBAED;;;;mBAIG;gBACK,6CAAY,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;oBAE7B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;gBAClC,CAAC;gBAED;;;;mBAIG;gBACK,gDAAe,GAAvB,UAAwB,MAAM;oBAC1B,MAAM,CAAC,eAAe,EAAE,CAAC;oBACzB,MAAM,CAAC,cAAc,EAAE,CAAC;gBAC5B,CAAC;gBAxFD;oBAAC,aAAM,EAAE;;8EAAA;gBAZb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,kBAAkB;wBAC5B,IAAI,EAAE;4BACF,QAAQ,EAAE,sBAAsB;4BAChC,aAAa,EAAE,sBAAsB;4BACrC,aAAa,EAAE,sBAAsB;4BACrC,YAAY,EAAE,yBAAyB;4BACvC,qBAAqB,EAAE,kBAAkB;yBAC5C;qBACJ,CAAC;;0CAAA;gBA4FF,6BAAC;YAAD,CAAC,AA3FD,IA2FC;YA3FD,2DA2FC,CAAA"}

View File

@@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
import {Directive, ElementRef, EventEmitter, Output} from 'angular2/core';
import { Directive, ElementRef, EventEmitter, Output } from 'angular2/core';
/**
* [file-draggable]
@@ -56,12 +56,12 @@ export class FileDraggableDirective {
*
* @param {$event} $event - DOM $event.
*/
private _onDropFiles($event): void {
_onDropFiles($event: any): void {
this._preventDefault($event);
var items = $event.dataTransfer.items;
for (var i = 0; i < items.length; i++) {
var item = items[i].webkitGetAsEntry();
let items = $event.dataTransfer.items;
for (let i = 0; i < items.length; i++) {
let item = items[i].webkitGetAsEntry();
if (item) {
this._traverseFileTree(item);
} else {
@@ -79,18 +79,18 @@ export class FileDraggableDirective {
*
* @param {Object} item - can contains files or folders.
*/
private _traverseFileTree(item): void {
private _traverseFileTree(item: any): void {
if (item.isFile) {
let self = this;
item.file(function (file) {
item.file(function (file: File) {
self.onFilesDropped.emit([file]);
});
} else {
if (item.isDirectory) {
let self = this;
let dirReader = item.createReader();
dirReader.readEntries(function (entries) {
for (var i = 0; i < entries.length; i++) {
dirReader.readEntries(function (entries: any) {
for (let i = 0; i < entries.length; i++) {
self._traverseFileTree(entries[i]);
}
});
@@ -103,7 +103,7 @@ export class FileDraggableDirective {
*
* @param {$event} $event - DOM $event.
*/
private _onDragEnter($event): void {
_onDragEnter($event: Event): void {
this._preventDefault($event);
this._inputFocusClass = true;
@@ -114,7 +114,7 @@ export class FileDraggableDirective {
*
* @param {$event} $event - DOM $event.
*/
private _onDragLeave($event): void {
_onDragLeave($event: Event): void {
this._preventDefault($event);
this._inputFocusClass = false;
@@ -125,8 +125,8 @@ export class FileDraggableDirective {
*
* @param {$event} $event - DOM $event.
*/
private _preventDefault($event): void {
_preventDefault($event: Event): void {
$event.stopPropagation();
$event.preventDefault();
}
}
}

View File

@@ -1,63 +0,0 @@
/**
* @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.
*/
/**
*
* This object represent the status of an uploading file.
*
*
* @returns {FileModel} .
*/
export declare class FileModel {
id: string;
status: number;
statusText: string;
progress: Object;
name: string;
size: string;
response: string;
done: boolean;
error: boolean;
abort: boolean;
uploading: boolean;
file: any;
_xmlHttpRequest: XMLHttpRequest;
constructor(file: any);
setProgres(progress: any): void;
setError(): void;
setUploading(): void;
setXMLHttpRequest(xmlHttpRequest: XMLHttpRequest): void;
/**
* Stop the uploading of the file.
*/
setAbort(): void;
/**
* Update status of the file when upload finish or is ended.
*/
onFinished(status: number, statusText: string, response: string): void;
/**
* Calculate the size of the file in kb,mb and gb.
*
* @param {number} sizeinbytes - size in bytes of the file.
*/
private _getFileSize(sizeinbytes);
/**
* Calculate the size of the file in kb,mb and gb.
*
* @return {string} - return a unique file uploading id.
*/
private _generateId();
}

View File

@@ -1,111 +0,0 @@
/**
* @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([], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var FileModel;
return {
setters:[],
execute: function() {
/**
*
* This object represent the status of an uploading file.
*
*
* @returns {FileModel} .
*/
FileModel = (function () {
function FileModel(file) {
this.done = false;
this.error = false;
this.abort = false;
this.uploading = false;
this.file = file;
this.id = this._generateId();
this.name = file.name;
this.size = this._getFileSize(file.size);
this.progress = {
loaded: 0,
total: 0,
percent: 0
};
}
FileModel.prototype.setProgres = function (progress) {
this.progress = progress;
};
FileModel.prototype.setError = function () {
this.error = true;
};
FileModel.prototype.setUploading = function () {
this.uploading = true;
};
FileModel.prototype.setXMLHttpRequest = function (xmlHttpRequest) {
this._xmlHttpRequest = xmlHttpRequest;
};
/**
* Stop the uploading of the file.
*/
FileModel.prototype.setAbort = function () {
if (!this.done && !this.error) {
this.abort = true;
this.uploading = false;
this._xmlHttpRequest.abort();
}
};
/**
* Update status of the file when upload finish or is ended.
*/
FileModel.prototype.onFinished = function (status, statusText, response) {
this.status = status;
this.statusText = statusText;
this.response = response;
this.done = true;
this.uploading = false;
};
/**
* Calculate the size of the file in kb,mb and gb.
*
* @param {number} sizeinbytes - size in bytes of the file.
*/
FileModel.prototype._getFileSize = function (sizeinbytes) {
var fSExt = new Array('Bytes', 'KB', 'MB', 'GB');
var size = sizeinbytes;
var i = 0;
while (size > 900) {
size /= 1000;
i++;
}
return Math.round((Math.round(size * 100) / 100)) + ' ' + fSExt[i];
};
/**
* Calculate the size of the file in kb,mb and gb.
*
* @return {string} - return a unique file uploading id.
*/
FileModel.prototype._generateId = function () {
return 'uploading-file-' + 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
};
return FileModel;
}());
exports_1("FileModel", FileModel);
}
}
});
//# sourceMappingURL=file.model.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"file.model.js","sourceRoot":"","sources":["file.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;YAEH;;;;;;eAMG;YACH;gBAeI,mBAAY,IAAS;oBAPrB,SAAI,GAAY,KAAK,CAAC;oBACtB,UAAK,GAAY,KAAK,CAAC;oBACvB,UAAK,GAAY,KAAK,CAAC;oBACvB,cAAS,GAAY,KAAK,CAAC;oBAKvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;oBACjB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;oBAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;oBACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAA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;oBACjD,IAAI,IAAI,GAAG,WAAW,CAAC;oBACvB,IAAI,CAAC,GAAG,CAAC,CAAC;oBACV,OAAO,IAAI,GAAG,GAAG,EAAE,CAAC;wBAChB,IAAI,IAAI,IAAI,CAAC;wBACb,CAAC,EAAE,CAAC;oBACR,CAAC;oBACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACvE,CAAC;gBAED;;;;mBAIG;gBACK,+BAAW,GAAnB;oBACI,MAAM,CAAC,iBAAiB,GAAG,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC;wBACtF,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;wBACnE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;oBAC1B,CAAC,CAAC,CAAC;gBACX,CAAC;gBACL,gBAAC;YAAD,CAAC,AA5FD,IA4FC;YA5FD,iCA4FC,CAAA"}

View File

@@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@@ -92,7 +92,7 @@ export class FileModel {
*
* @param {number} sizeinbytes - size in bytes of the file.
*/
private _getFileSize(sizeinbytes): string {
private _getFileSize(sizeinbytes: number): string {
let fSExt = new Array('Bytes', 'KB', 'MB', 'GB');
let size = sizeinbytes;
let i = 0;
@@ -110,7 +110,7 @@ export class FileModel {
*/
private _generateId(): string {
return 'uploading-file-' + 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
let r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}

View File

@@ -1,4 +1,4 @@
/**
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
@@ -16,7 +16,7 @@
*/
import {FileModel} from '../models/file.model';
import { FileModel } from '../models/file.model';
/**
@@ -60,8 +60,8 @@ export class UploadService {
for (let file of files) {
if (this._isFile(file)) {
let uploadingFileModel = new FileModel(file)
latestFilesAdded.push(uploadingFileModel)
let uploadingFileModel = new FileModel(file);
latestFilesAdded.push(uploadingFileModel);
this._queue.push(uploadingFileModel);
}
}
@@ -85,7 +85,7 @@ export class UploadService {
* The method create a new XMLHttpRequest instance if doesn't exist
*/
private _configureXMLHttpRequest(uploadingFileModel: any) {
if (this._xmlHttpRequest == undefined) {
if (this._xmlHttpRequest === undefined) {
this._xmlHttpRequest = new XMLHttpRequest();
this._xmlHttpRequest.upload.onprogress = (e) => {
if (e.lengthComputable) {
@@ -127,7 +127,7 @@ export class UploadService {
uploadFile(uploadingFileModel: any, directory: string): void {
let form = new FormData();
form.append(this._fieldName, uploadingFileModel.file, uploadingFileModel.name);
Object.keys(this._formFields).forEach((key) => {
Object.keys(this._formFields).forEach((key: any) => {
form.append(key, this._formFields[key]);
});