@d-mok/quasar-app-extension-quasar-axe 2.1.56 → 2.1.58
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.
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
<q-page
|
|
77
77
|
padding
|
|
78
78
|
class="q-mx-auto q-gutter-md"
|
|
79
|
+
:style="{ 'max-width': globalControl.width + 'px' }"
|
|
79
80
|
>
|
|
80
81
|
<component
|
|
81
82
|
:is="Component"
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
|
|
92
93
|
<script lang="ts" setup>
|
|
93
94
|
import { ref } from 'vue'
|
|
94
|
-
|
|
95
|
+
import { globalControl } from '../../../utils'
|
|
95
96
|
type item = {
|
|
96
97
|
title: string
|
|
97
98
|
caption?: string
|
|
@@ -95,28 +95,13 @@ export class SupbaseBucket extends Map<string, string> {
|
|
|
95
95
|
this.delete(path)
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
async
|
|
98
|
+
async save(path: string, filename: string): Promise<File> {
|
|
99
99
|
let url = this.get(path) ?? ''
|
|
100
100
|
if (url === '') throw 'url not found'
|
|
101
101
|
let file = await createFileObjectFromUrl(url, filename)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async downloadMany(
|
|
108
|
-
paths: string[],
|
|
109
|
-
filenames: string[],
|
|
110
|
-
zipName: string = this.bucketName
|
|
111
|
-
) {
|
|
112
|
-
let urls = paths.map($ => this.get($) ?? '')
|
|
113
|
-
let zip = await zipCreate(Object.fromEntries(filenames.zip(urls)))
|
|
114
|
-
await zipDownload(zipName, zip)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
async downloadAll(zipName: string = this.bucketName) {
|
|
118
|
-
let zip = await zipCreate(Object.fromEntries(this))
|
|
119
|
-
await zipDownload(zipName, zip)
|
|
102
|
+
file = renameFileObject(file, filename)
|
|
103
|
+
file = addExtToFileObject(file)
|
|
104
|
+
return file
|
|
120
105
|
}
|
|
121
106
|
|
|
122
107
|
reactive(): this {
|
|
@@ -128,12 +113,18 @@ async function createFileObjectFromUrl(
|
|
|
128
113
|
url: string,
|
|
129
114
|
filename: string
|
|
130
115
|
): Promise<File> {
|
|
131
|
-
// Fetch the data from the URL
|
|
132
116
|
const response = await fetch(url)
|
|
133
117
|
const data = await response.blob()
|
|
134
118
|
const type = response.headers.get('content-type') ?? undefined
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
119
|
+
return new File([data], filename, { type })
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function renameFileObject(file: File, filename: string): File {
|
|
123
|
+
return new File([file], filename, { type: file.type })
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function addExtToFileObject(file: File): File {
|
|
127
|
+
let ext = mime.extension(file.type) || ''
|
|
128
|
+
if (file.name.endsWith(ext)) return file
|
|
129
|
+
return renameFileObject(file, `${file.name}.${ext}`)
|
|
139
130
|
}
|