@d-mok/quasar-app-extension-quasar-axe 2.0.1 → 2.0.4
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.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "A Quasar App Extension",
|
|
5
5
|
"author": "d-mok <49301824+d-mok@users.noreply.github.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,10 +16,13 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@handsontable/vue3": "^12.1.0",
|
|
18
18
|
"@supabase/supabase-js": "^1.35.4",
|
|
19
|
+
"@types/lodash": "^4.14.182",
|
|
19
20
|
"@types/papaparse": "^5.3.2",
|
|
20
21
|
"@types/webpack-env": "^1.17.0",
|
|
22
|
+
"@vueuse/core": "^9.1.0",
|
|
21
23
|
"handsontable": "^12.1.0",
|
|
22
24
|
"jszip": "^3.9.0",
|
|
25
|
+
"lodash": "^4.17.21",
|
|
23
26
|
"papaparse": "^5.3.2",
|
|
24
27
|
"sapphire-js": "^1.0.67",
|
|
25
28
|
"vuedraggable": "^4.1.0"
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-select
|
|
3
|
-
|
|
4
|
-
@update:model-value="e => emits('update:modelValue', e)"
|
|
3
|
+
v-model="selected"
|
|
5
4
|
:options="options"
|
|
6
5
|
:option-label="optionLabel"
|
|
7
6
|
v-bind="$attrs"
|
|
8
|
-
|
|
9
|
-
</q-select>
|
|
7
|
+
/>
|
|
10
8
|
</template>
|
|
11
9
|
|
|
12
10
|
<script
|
|
@@ -14,6 +12,8 @@
|
|
|
14
12
|
setup
|
|
15
13
|
>
|
|
16
14
|
import { watch } from 'vue'
|
|
15
|
+
import { useVModel } from '@vueuse/core'
|
|
16
|
+
import _ from 'lodash'
|
|
17
17
|
|
|
18
18
|
type Props = {
|
|
19
19
|
options: any[]
|
|
@@ -23,26 +23,25 @@ type Props = {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const props = withDefaults(defineProps<Props>(), { ticker: 0 })
|
|
26
|
-
|
|
27
26
|
const emits = defineEmits(['update:modelValue'])
|
|
28
27
|
|
|
28
|
+
const selected = useVModel(props, 'modelValue', emits)
|
|
29
|
+
|
|
30
|
+
function select(i: number) {
|
|
31
|
+
i = _.clamp(i, 0, props.options.length - 1)
|
|
32
|
+
selected.value = props.options[i]
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
function rePick() {
|
|
30
36
|
if (props.options.length === 0) return
|
|
31
|
-
|
|
32
|
-
if (!props.options.includes(props.modelValue))
|
|
33
|
-
emits('update:modelValue', props.options[0])
|
|
37
|
+
if (!props.options.includes(selected.value)) select(0)
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
rePick()
|
|
37
|
-
watch(
|
|
38
|
-
() => props.options,
|
|
39
|
-
() => {
|
|
40
|
-
rePick()
|
|
41
|
-
}
|
|
42
|
-
)
|
|
41
|
+
watch(() => props.options, rePick)
|
|
43
42
|
|
|
44
43
|
function getCurrentIndex(): number {
|
|
45
|
-
return props.options.findIndex($ => $ ===
|
|
44
|
+
return props.options.findIndex($ => $ === selected.value)
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
watch(
|
|
@@ -50,14 +49,8 @@ watch(
|
|
|
50
49
|
(now, old) => {
|
|
51
50
|
let i = getCurrentIndex()
|
|
52
51
|
if (i === -1) return
|
|
53
|
-
if (now > old)
|
|
54
|
-
|
|
55
|
-
emits('update:modelValue', props.options[j])
|
|
56
|
-
}
|
|
57
|
-
if (now < old) {
|
|
58
|
-
let j = Math.max(i - 1, 0)
|
|
59
|
-
emits('update:modelValue', props.options[j])
|
|
60
|
-
}
|
|
52
|
+
if (now > old) select(i + 1)
|
|
53
|
+
if (now < old) select(i - 1)
|
|
61
54
|
}
|
|
62
55
|
)
|
|
63
56
|
</script>
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-select
|
|
3
|
-
|
|
4
|
-
@update:model-value="e => emits('update:modelValue', e)"
|
|
3
|
+
v-model="selected"
|
|
5
4
|
:options="options"
|
|
6
5
|
v-bind="$attrs"
|
|
7
|
-
|
|
8
|
-
</q-select>
|
|
6
|
+
/>
|
|
9
7
|
</template>
|
|
10
8
|
|
|
11
9
|
<script
|
|
@@ -13,6 +11,7 @@
|
|
|
13
11
|
setup
|
|
14
12
|
>
|
|
15
13
|
import { watch } from 'vue'
|
|
14
|
+
import { useVModel } from '@vueuse/core'
|
|
16
15
|
|
|
17
16
|
const props = defineProps<{
|
|
18
17
|
options: string[]
|
|
@@ -21,18 +20,15 @@ const props = defineProps<{
|
|
|
21
20
|
|
|
22
21
|
const emits = defineEmits(['update:modelValue'])
|
|
23
22
|
|
|
23
|
+
const selected = useVModel(props, 'modelValue', emits)
|
|
24
|
+
|
|
24
25
|
function rePick() {
|
|
25
26
|
if (props.options.length === 0) return
|
|
26
27
|
|
|
27
|
-
if (!props.options.includes(
|
|
28
|
-
|
|
28
|
+
if (!props.options.includes(selected.value))
|
|
29
|
+
selected.value = props.options[0]
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
rePick()
|
|
32
|
-
watch(
|
|
33
|
-
() => props.options,
|
|
34
|
-
() => {
|
|
35
|
-
rePick()
|
|
36
|
-
}
|
|
37
|
-
)
|
|
33
|
+
watch(() => props.options, rePick)
|
|
38
34
|
</script>
|
|
@@ -74,7 +74,8 @@ export async function askFn(
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Ask for an array of objects by table.
|
|
77
|
-
*
|
|
77
|
+
* The first non-empty prefill will be used.
|
|
78
|
+
* The last non-empty prefill will be the spec.
|
|
78
79
|
*/
|
|
79
80
|
export async function askTable<T extends object>(
|
|
80
81
|
title: string,
|
|
@@ -82,15 +83,13 @@ export async function askTable<T extends object>(
|
|
|
82
83
|
prefills: T[][],
|
|
83
84
|
isValid: Predicate<T> = $ => true
|
|
84
85
|
): Promise<T[]> {
|
|
85
|
-
|
|
86
|
-
if (content === undefined) {
|
|
86
|
+
if (prefills.flat().length === 0)
|
|
87
87
|
throwError('Error', 'All prefills are empty array.')
|
|
88
|
-
}
|
|
89
88
|
return await base(dialogTable, {
|
|
90
89
|
title,
|
|
91
90
|
message,
|
|
92
|
-
content,
|
|
93
|
-
sample:
|
|
91
|
+
content: prefills.find($ => $.length > 0),
|
|
92
|
+
sample: [...prefills].reverse().find($ => $.length > 0)![0],
|
|
94
93
|
isValid,
|
|
95
94
|
cancel: true,
|
|
96
95
|
})
|