@d-mok/quasar-app-extension-quasar-axe 2.1.89 → 2.1.91
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.
|
|
3
|
+
"version": "2.1.91",
|
|
4
4
|
"description": "A Quasar App Extension",
|
|
5
5
|
"author": "d-mok <49301824+d-mok@users.noreply.github.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"lodash": "^4.17.21",
|
|
28
28
|
"mime-types": "^2.1.35",
|
|
29
29
|
"papaparse": "^5.4.1",
|
|
30
|
-
"sapphire-js": "^2.1.
|
|
30
|
+
"sapphire-js": "^2.1.8",
|
|
31
31
|
"sortablejs": "^1.15.0",
|
|
32
32
|
"vuedraggable": "^4.1.0"
|
|
33
33
|
},
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-select
|
|
3
|
+
multiple
|
|
4
|
+
v-model="modelValue"
|
|
5
|
+
:options="options"
|
|
6
|
+
:option-label="getLabel"
|
|
7
|
+
:option-value="getValue"
|
|
8
|
+
emit-value
|
|
9
|
+
map-options
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
>
|
|
12
|
+
<template v-slot:option="{ itemProps, opt, selected, toggleOption }">
|
|
13
|
+
<q-item
|
|
14
|
+
v-bind="itemProps"
|
|
15
|
+
dense
|
|
16
|
+
>
|
|
17
|
+
<q-item-section>
|
|
18
|
+
<q-item-label>{{ getLabel(opt) }}</q-item-label>
|
|
19
|
+
</q-item-section>
|
|
20
|
+
<q-item-section side>
|
|
21
|
+
<q-checkbox
|
|
22
|
+
:model-value="selected"
|
|
23
|
+
@update:model-value="toggleOption(opt)"
|
|
24
|
+
></q-checkbox>
|
|
25
|
+
</q-item-section>
|
|
26
|
+
</q-item>
|
|
27
|
+
</template>
|
|
28
|
+
</q-select>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup generic="T,R">
|
|
32
|
+
import { watch } from 'vue'
|
|
33
|
+
import _ from 'lodash'
|
|
34
|
+
|
|
35
|
+
const modelValue = defineModel<R[]>({ required: true })
|
|
36
|
+
|
|
37
|
+
let { options, optionLabel, optionValue } = defineProps<{
|
|
38
|
+
options: T[]
|
|
39
|
+
optionLabel?: (string & keyof T) | ((_: T) => string)
|
|
40
|
+
optionValue?: (string & keyof T) | ((_: T) => R)
|
|
41
|
+
}>()
|
|
42
|
+
|
|
43
|
+
function getLabel(opt: T): string {
|
|
44
|
+
if (optionLabel === undefined) {
|
|
45
|
+
return String(opt)
|
|
46
|
+
} else if (typeof optionLabel === 'string') {
|
|
47
|
+
return String(opt[optionLabel])
|
|
48
|
+
} else {
|
|
49
|
+
return optionLabel(opt)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getValue(opt: T): R {
|
|
54
|
+
if (optionValue === undefined) {
|
|
55
|
+
return opt as any
|
|
56
|
+
} else if (typeof optionValue === 'string') {
|
|
57
|
+
return opt[optionValue] as R
|
|
58
|
+
} else {
|
|
59
|
+
return optionValue(opt)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
watch(
|
|
64
|
+
() => options,
|
|
65
|
+
(now, old) => {
|
|
66
|
+
if (!_.isEqual(now, old)) {
|
|
67
|
+
modelValue.value = modelValue.value.match(now.map(getValue))
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
</script>
|