@d-mok/quasar-app-extension-quasar-axe 2.0.13 → 2.0.16

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.13",
3
+ "version": "2.0.16",
4
4
  "description": "A Quasar App Extension",
5
5
  "author": "d-mok <49301824+d-mok@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "jszip": "^3.9.0",
25
25
  "lodash": "^4.17.21",
26
26
  "papaparse": "^5.3.2",
27
- "sapphire-js": "^1.0.67",
27
+ "sapphire-js": "^1.0.69",
28
28
  "vuedraggable": "^4.1.0"
29
29
  },
30
30
  "devDependencies": {
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <q-btn-toggle
3
+ v-model="selected"
4
+ :options="opts"
5
+ v-bind="$attrs"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { computed } from '@vue/reactivity'
11
+ import { useVModel } from '@vueuse/core'
12
+
13
+ const props = withDefaults(
14
+ defineProps<{
15
+ modelValue: any
16
+ options: any[]
17
+ optionLabel?: string | ((_: any) => string)
18
+ }>(),
19
+ {}
20
+ )
21
+ const emits = defineEmits(['update:modelValue'])
22
+
23
+ const selected = useVModel(props, 'modelValue', emits)
24
+
25
+ function getLabelFunc(labeler?: string | ((_: any) => string)) {
26
+ if (typeof labeler === 'string') {
27
+ return ($: any) => String($[labeler])
28
+ }
29
+ if (typeof labeler === 'function') {
30
+ return labeler
31
+ }
32
+ return ($: any) => String($)
33
+ }
34
+
35
+ let opts = computed(() => {
36
+ let f = getLabelFunc(props.optionLabel)
37
+ return props.options.map($ => {
38
+ let str = f($)
39
+ return { label: str, value: str }
40
+ })
41
+ })
42
+ </script>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <q-option-group
3
+ v-model="selected"
4
+ :options="opts"
5
+ v-bind="$attrs"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { computed } from '@vue/reactivity'
11
+ import { useVModel } from '@vueuse/core'
12
+
13
+ const props = withDefaults(
14
+ defineProps<{
15
+ modelValue: any
16
+ options: any[]
17
+ optionLabel?: string | ((_: any) => string)
18
+ }>(),
19
+ {}
20
+ )
21
+ const emits = defineEmits(['update:modelValue'])
22
+
23
+ const selected = useVModel(props, 'modelValue', emits)
24
+
25
+ function getLabelFunc(labeler?: string | ((_: any) => string)) {
26
+ if (typeof labeler === 'string') {
27
+ return ($: any) => String($[labeler])
28
+ }
29
+ if (typeof labeler === 'function') {
30
+ return labeler
31
+ }
32
+ return ($: any) => String($)
33
+ }
34
+
35
+ let opts = computed(() => {
36
+ let f = getLabelFunc(props.optionLabel)
37
+ return props.options.map($ => {
38
+ let str = f($)
39
+ return { label: str, value: str }
40
+ })
41
+ })
42
+ </script>