Merge branch 'taylorludwig-master'
This commit is contained in:
@@ -57,6 +57,10 @@ export class FileItem {
|
||||
return void 0;
|
||||
}
|
||||
|
||||
public onBuildForm(form:any):any {
|
||||
return {form};
|
||||
}
|
||||
|
||||
public onProgress(progress:number):any {
|
||||
return {progress};
|
||||
}
|
||||
@@ -88,6 +92,10 @@ export class FileItem {
|
||||
this.onBeforeUpload();
|
||||
}
|
||||
|
||||
public _onBuildForm(form:any):void {
|
||||
this.onBuildForm(form);
|
||||
}
|
||||
|
||||
public _onProgress(progress:number):void {
|
||||
this._zone.run(() => {
|
||||
this.progress = progress;
|
||||
|
||||
@@ -189,6 +189,10 @@ export class FileUploader {
|
||||
return {fileItems};
|
||||
}
|
||||
|
||||
public onBuildItemForm(fileItem:any, form:any):any {
|
||||
return {fileItem, form};
|
||||
}
|
||||
|
||||
public onAfterAddingFile(fileItem:any):any {
|
||||
return {fileItem};
|
||||
}
|
||||
@@ -283,6 +287,8 @@ export class FileUploader {
|
||||
if (typeof item._file.size !== 'number') {
|
||||
throw new TypeError('The file specified is no longer valid');
|
||||
}
|
||||
this._onBuildItemForm(item, form);
|
||||
|
||||
form.append(item.alias, item._file, item.file.name);
|
||||
xhr.upload.onprogress = (event:any) => {
|
||||
let progress = Math.round(event.lengthComputable ? event.loaded * 100 / event.total : 0);
|
||||
@@ -428,6 +434,11 @@ export class FileUploader {
|
||||
this.onBeforeUploadItem(item);
|
||||
}
|
||||
|
||||
private _onBuildItemForm(item:any, form:any):void {
|
||||
item._onBuildForm(form);
|
||||
this.onBuildItemForm(item, form);
|
||||
}
|
||||
|
||||
private _onProgressItem(item:any, progress:any):void {
|
||||
let total = this._getTotalProgress(progress);
|
||||
this.progress = total;
|
||||
|
||||
Reference in New Issue
Block a user