private formSelectedData(selectedFiles : FileInfo, proxy: any): void {
let liEle: HTMLElement = createElement('li', { className: 'file-lists', attrs: { 'data-file-name': selectedFiles.name } });
liEle.appendChild(createElement('span', { className: 'file-name ', innerHTML: selectedFiles.name }));
liEle.appendChild(createElement('span', { className: 'file-size ', innerHTML: this.uploadObj.bytesToSize(selectedFiles.size) }));
if(selectedFiles.statusCode === '1') {
this.progressbarContainer = createElement('span', { className: 'progress-bar-container' });
this.progressbarContainer.appendChild(createElement('progress', { className: 'progress', attrs: { value: '0', max: '100' } }));
liEle.appendChild(this.progressbarContainer);
} else { liEle.querySelector('.file-name').classList.add('upload-fails'); }
let closeIconContainer: HTMLElement = createElement('span', { className: 'e-icons close-icon-container' });
EventHandler.add(closeIconContainer, 'click', this.removeFiles, proxy);
liEle.appendChild(closeIconContainer);
document.querySelector('.ul-element').appendChild(liEle);
this.filesList.push(liEle);
}
private removeFiles(args: any): void {
let status: string = this.filesDetails[this.filesList.indexOf(args.currentTarget.parentElement)].statusCode;
if(status === '2') {
this.uploadObj.remove(this.filesDetails[this.filesList.indexOf(args.currentTarget.parentElement)]);
} else {
detach(args.currentTarget.parentElement);
}
}
|