@d-mok/quasar-app-extension-quasar-axe 2.1.16 → 2.1.18
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
|
@@ -3,6 +3,7 @@ import dialogTextarea from './custom/dialogTextarea.vue'
|
|
|
3
3
|
import dialogTable from './custom/dialogTable.vue'
|
|
4
4
|
import dialogForm from './custom/dialogForm.vue'
|
|
5
5
|
import dialogBtn from './custom/dialogBtn.vue'
|
|
6
|
+
import dialogFile from './custom/dialogFile.vue'
|
|
6
7
|
import { throwError } from './basic'
|
|
7
8
|
import { getLabelFunc } from './tool'
|
|
8
9
|
|
|
@@ -211,3 +212,17 @@ export async function showArray(
|
|
|
211
212
|
cancel: false,
|
|
212
213
|
})
|
|
213
214
|
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Ask to select a file.
|
|
218
|
+
*/
|
|
219
|
+
export async function askFile<T>(
|
|
220
|
+
title: string,
|
|
221
|
+
message: string = ''
|
|
222
|
+
): Promise<T> {
|
|
223
|
+
return await base(dialogFile, {
|
|
224
|
+
title,
|
|
225
|
+
message,
|
|
226
|
+
cancel: true,
|
|
227
|
+
})
|
|
228
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-dialog
|
|
3
|
+
ref="dialogRef"
|
|
4
|
+
@hide="onDialogHide"
|
|
5
|
+
>
|
|
6
|
+
<q-card style="max-width: 500px">
|
|
7
|
+
<q-card-section>
|
|
8
|
+
<p class="text-h6">{{ title }}</p>
|
|
9
|
+
<p>{{ message }}</p>
|
|
10
|
+
<q-file
|
|
11
|
+
v-model="file"
|
|
12
|
+
label="File"
|
|
13
|
+
filled
|
|
14
|
+
counter
|
|
15
|
+
/>
|
|
16
|
+
</q-card-section>
|
|
17
|
+
|
|
18
|
+
<q-card-actions align="right">
|
|
19
|
+
<q-btn
|
|
20
|
+
v-if="cancel"
|
|
21
|
+
label="Cancel"
|
|
22
|
+
flat
|
|
23
|
+
@click="onDialogCancel"
|
|
24
|
+
/>
|
|
25
|
+
<q-btn
|
|
26
|
+
label="OK"
|
|
27
|
+
flat
|
|
28
|
+
@click="onDialogOK(file)"
|
|
29
|
+
:disable="file !== null"
|
|
30
|
+
/>
|
|
31
|
+
</q-card-actions>
|
|
32
|
+
</q-card>
|
|
33
|
+
</q-dialog>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import { useDialogPluginComponent } from 'quasar'
|
|
38
|
+
import { ref } from 'vue'
|
|
39
|
+
|
|
40
|
+
defineEmits([...useDialogPluginComponent.emits])
|
|
41
|
+
|
|
42
|
+
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
|
|
43
|
+
useDialogPluginComponent()
|
|
44
|
+
|
|
45
|
+
let file = ref(null)
|
|
46
|
+
|
|
47
|
+
const props = defineProps<{
|
|
48
|
+
title: string
|
|
49
|
+
message: string
|
|
50
|
+
cancel: boolean
|
|
51
|
+
}>()
|
|
52
|
+
</script>
|
|
@@ -73,7 +73,7 @@ if (SUPABASE_URL !== '' && SUPABASE_KEY !== '')
|
|
|
73
73
|
|
|
74
74
|
export function HANDLE_ERROR<T>(
|
|
75
75
|
data: T[] | T | null,
|
|
76
|
-
error: PostgrestError | null
|
|
76
|
+
error: PostgrestError | Error | null
|
|
77
77
|
): asserts data {
|
|
78
78
|
if (error) {
|
|
79
79
|
if (error.message === 'JWSError JWSInvalidSignature') {
|
|
@@ -84,11 +84,11 @@ export function HANDLE_ERROR<T>(
|
|
|
84
84
|
)
|
|
85
85
|
throw error
|
|
86
86
|
}
|
|
87
|
-
let msg =
|
|
88
|
-
|
|
89
|
-
msg
|
|
90
|
-
|
|
91
|
-
qDialog.error('Database Error!', msg)
|
|
87
|
+
let msg: string[] = []
|
|
88
|
+
// if ('details' in error) msg.push(error.details)
|
|
89
|
+
msg.push(error.message)
|
|
90
|
+
// if ('hint' in error) msg.push(error.hint)
|
|
91
|
+
qDialog.error('Database Error!', msg.join('<br/>'))
|
|
92
92
|
throw error
|
|
93
93
|
}
|
|
94
94
|
if (data === null) {
|