@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-mok/quasar-app-extension-quasar-axe",
3
- "version": "2.1.56",
3
+ "version": "2.1.58",
4
4
  "description": "A Quasar App Extension",
5
5
  "author": "d-mok <49301824+d-mok@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -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
@@ -0,0 +1,7 @@
1
+ // global control
2
+
3
+ import { reactive } from 'vue'
4
+
5
+ export let globalControl = reactive({
6
+ width: 2000,
7
+ })
@@ -23,3 +23,5 @@ export type { zipFolder } from './zip'
23
23
  export * as gSheet from './gSheet'
24
24
 
25
25
  export { SupbaseBucket } from './storage'
26
+
27
+ export { globalControl } from './control'
@@ -95,28 +95,13 @@ export class SupbaseBucket extends Map<string, string> {
95
95
  this.delete(path)
96
96
  }
97
97
 
98
- async downloadOne(path: string, filename: string) {
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
- let ext = mime.extension(file.type) ?? ''
103
- if (ext && !filename.endsWith(ext)) filename += `.${ext}`
104
- exportFile(filename, file)
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
- // Create a new File object with the data and filename
136
- const file = new File([data], filename, { type })
137
- // Return the new File object
138
- return file
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
  }