@d-mok/quasar-app-extension-quasar-axe 2.1.52 → 2.1.54

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.52",
3
+ "version": "2.1.54",
4
4
  "description": "A Quasar App Extension",
5
5
  "author": "d-mok <49301824+d-mok@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <q-icon
3
+ :name="val ? 'check_box' : 'check_box_outline_blank'"
4
+ :size="size ?? 'sm'"
5
+ v-bind="$attrs"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ let props = defineProps<{
11
+ val: boolean
12
+ size: string
13
+ }>()
14
+ </script>
@@ -93,12 +93,40 @@ export class SupbaseBucket extends Map<string, string> {
93
93
  this.delete(path)
94
94
  }
95
95
 
96
- async downloadZip() {
96
+ async downloadOne(path: string, filename: string) {
97
+ let url = this.get(path) ?? ''
98
+ if (url === '') throw 'url not found'
99
+ downloadFile(url, filename)
100
+ }
101
+
102
+ async downloadMany(
103
+ paths: string[],
104
+ filenames: string[],
105
+ zipName: string = this.bucketName
106
+ ) {
107
+ let urls = paths.map($ => this.get($) ?? '')
108
+ let zip = await zipCreate(Object.fromEntries(filenames.zip(urls)))
109
+ await zipDownload(zipName, zip)
110
+ }
111
+
112
+ async downloadAll(zipName: string = this.bucketName) {
97
113
  let zip = await zipCreate(Object.fromEntries(this))
98
- await zipDownload(this.bucketName, zip)
114
+ await zipDownload(zipName, zip)
99
115
  }
100
116
 
101
117
  reactive(): this {
102
118
  return reactive(this) as this
103
119
  }
104
120
  }
121
+
122
+ function downloadFile(url: string, filename: string) {
123
+ // Create a link element
124
+ const link = document.createElement('a')
125
+ link.href = url
126
+ link.download = filename
127
+
128
+ // Simulate a click event on the link element
129
+ document.body.appendChild(link)
130
+ link.click()
131
+ document.body.removeChild(link)
132
+ }