@arsedizioni/ars-utils 19.5.25 → 19.5.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -549,9 +549,10 @@ class SelectPictureDialogComponent {
|
|
|
549
549
|
selectFile(file) {
|
|
550
550
|
const maxSize = this.dialogData.maxSize ?? 0;
|
|
551
551
|
if (maxSize > 0) {
|
|
552
|
-
const size =
|
|
552
|
+
const size = file.size / 1048576;
|
|
553
|
+
console.log("max: " + maxSize + " - file: " + size);
|
|
553
554
|
if (size > maxSize) {
|
|
554
|
-
this.dialogService.error("File troppo grande (massimo " + SystemUtils.formatFileSize(maxSize *
|
|
555
|
+
this.dialogService.error("File troppo grande (massimo " + SystemUtils.formatFileSize(maxSize * 1048576) + ")");
|
|
555
556
|
return;
|
|
556
557
|
}
|
|
557
558
|
}
|
|
@@ -683,9 +684,9 @@ class SelectFileDialogComponent {
|
|
|
683
684
|
selectFile(file) {
|
|
684
685
|
const maxSize = this.dialogData.maxSize ?? 0;
|
|
685
686
|
if (maxSize > 0) {
|
|
686
|
-
const size =
|
|
687
|
+
const size = file.size / 1048576;
|
|
687
688
|
if (size > maxSize) {
|
|
688
|
-
this.dialogService.error("File troppo grande (massimo " + SystemUtils.formatFileSize(maxSize *
|
|
689
|
+
this.dialogService.error("File troppo grande (massimo " + SystemUtils.formatFileSize(maxSize * 1048576) + ")");
|
|
689
690
|
return;
|
|
690
691
|
}
|
|
691
692
|
}
|
|
@@ -1763,15 +1764,16 @@ class FileInputComponent {
|
|
|
1763
1764
|
*/
|
|
1764
1765
|
selectFile(e) {
|
|
1765
1766
|
if (e.target.files) {
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
let fileInfo = new FileInfo();
|
|
1767
|
+
const f = e.target.files[0];
|
|
1768
|
+
const fileInfo = new FileInfo();
|
|
1769
|
+
const fileSize = f.size / 1048576;
|
|
1770
1770
|
fileInfo.file = f;
|
|
1771
1771
|
fileInfo.valid =
|
|
1772
|
-
(!this.maxSizeMb ||
|
|
1773
|
-
(!this.minSizeMb ||
|
|
1772
|
+
(!this.maxSizeMb || fileSize <= this.maxSizeMb()) &&
|
|
1773
|
+
(!this.minSizeMb || fileSize >= this.minSizeMb());
|
|
1774
1774
|
this.writeValue(fileInfo);
|
|
1775
|
+
this.fileName = f.name;
|
|
1776
|
+
this.fileSize = Math.round(fileSize);
|
|
1775
1777
|
}
|
|
1776
1778
|
}
|
|
1777
1779
|
/**
|