This commit is contained in:
purifetchi 2025-01-15 23:16:11 +01:00
parent e2a4487064
commit d7e136a7c3

View file

@ -14,33 +14,19 @@
const totalSize = ref(0);
const totalSizePercent = ref(0);
const files = ref([]);
const visible = ref(false);
const toast = useToast();
const filename = ref<string>("");
const onRemoveTemplatingFile = (file, removeFileCallback, index) => {
const onRemoveTemplatingFile = (file: File, removeFileCallback: (arg0: number) => void, index: number) => {
removeFileCallback(index);
totalSize.value -= parseInt(formatSize(file.size));
totalSizePercent.value = totalSize.value / 10;
};
const onClearTemplatingUpload = (clear) => {
clear();
totalSize.value = 0;
totalSizePercent.value = 0;
};
const onSelectedFiles = (event) => {
files.value = event.files;
files.value.forEach((file) => {
totalSize.value += parseInt(formatSize(file.size));
});
};
const uploadEvent = (callback) => {
const uploadEvent = (callback: () => void) => {
totalSizePercent.value = totalSize.value / 10;
callback();
};
@ -59,7 +45,7 @@
}
};
const formatSize = (bytes) => {
const formatSize = (bytes: number) => {
const k = 1024;
const dm = 3;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];