Skip to content

Commit

Permalink
refactor(utils): refactoring file utils class name
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoninoBonanno committed Jan 13, 2024
1 parent 2b22506 commit f32f47d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ViewChild
} from '@angular/core';
import { ItAbstractComponent } from '../../../abstracts/abstract.component';
import { FileUtils } from '../../../utils/file-utils';
import { ItFileUtils } from '../../../utils/file-utils';
import { ProgressDonut } from 'bootstrap-italia';
import { ItIconComponent } from '../../utils/icon/icon.component';
import { NgIf, NgOptimizedImage } from '@angular/common';
Expand Down Expand Up @@ -116,7 +116,7 @@ export class ItUploadDragDropComponent extends ItAbstractComponent implements Af
const splitName = file.name.split('.');
this.filename = splitName[0];
this.extension = splitName[1]?.toUpperCase();
this.fileSize = FileUtils.getFileSizeString(file);
this.fileSize = ItFileUtils.getFileSizeString(file);

this.fileStartUpload.emit(file);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { ItAbstractComponent } from '../../../abstracts/abstract.component';
import { UploadFileListItem } from '../../../interfaces/form';
import { FileUtils } from '../../../utils/file-utils';
import { ItFileUtils } from '../../../utils/file-utils';
import { forkJoin, take, tap } from 'rxjs';
import { NgForOf, NgIf } from '@angular/common';
import { ItIconComponent } from '../../utils/icon/icon.component';
Expand Down Expand Up @@ -72,7 +72,7 @@ export class ItUploadFileListComponent extends ItAbstractComponent implements On

override ngOnChanges(changes: SimpleChanges): void {
if (changes['fileList'] && !!this.images) {
const images$ = this.fileList.map(item => FileUtils.fileToBase64(item.file).pipe(
const images$ = this.fileList.map(item => ItFileUtils.fileToBase64(item.file).pipe(
take(1),
tap(base64 => this.previewImages.set(item.id, base64))
));
Expand Down Expand Up @@ -112,7 +112,7 @@ export class ItUploadFileListComponent extends ItAbstractComponent implements On
* @param file
*/
getFileSize(file: File): string {
return FileUtils.getFileSizeString(file);
return ItFileUtils.getFileSizeString(file);
}

}
4 changes: 2 additions & 2 deletions projects/design-angular-kit/src/lib/utils/file-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Observable } from 'rxjs';

export class FileUtils {
export class ItFileUtils {

/**
* Return the file size string
Expand Down Expand Up @@ -66,7 +66,7 @@ export class FileUtils {
* @param filename the file name
*/
public static base64ToFile(base64: string, mimeType: string, filename: string): File {
const fileBlob = FileUtils.base64ToBlob(base64, mimeType);
const fileBlob = ItFileUtils.base64ToBlob(base64, mimeType);
return new File([fileBlob], filename, { type: mimeType });
}

Expand Down

0 comments on commit f32f47d

Please sign in to comment.