@d-mok/quasar-app-extension-quasar-axe 2.0.19 → 2.0.21

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.19",
3
+ "version": "2.0.21",
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,50 @@
1
+ <template>
2
+ <q-select
3
+ :model-value="text"
4
+ use-input
5
+ hide-selected
6
+ fill-input
7
+ input-debounce="0"
8
+ :options="options"
9
+ @filter="filterFn"
10
+ @input-value="setModel"
11
+ v-bind="$attrs"
12
+ >
13
+ </q-select>
14
+ </template>
15
+
16
+ <script lang="ts" setup>
17
+ import { useVModel } from '@vueuse/core'
18
+ import _ from 'lodash'
19
+ import { ref, watch } from 'vue'
20
+
21
+ const props = defineProps<{
22
+ autocomplete: string[]
23
+ modelValue: any
24
+ }>()
25
+
26
+ const emits = defineEmits(['update:modelValue'])
27
+
28
+ const text = useVModel(props, 'modelValue', emits)
29
+ if (!text.value) text.value = null
30
+
31
+ let options = ref<string[]>([])
32
+
33
+ function filterFn(val: any, update: any) {
34
+ if (!val) val = text.value
35
+ update(() => {
36
+ if (!val) {
37
+ options.value = []
38
+ return
39
+ }
40
+ const needle = val.toLowerCase()
41
+ options.value = props.autocomplete.filter(
42
+ v => v.toLowerCase().indexOf(needle) > -1
43
+ )
44
+ })
45
+ }
46
+
47
+ function setModel(val: string) {
48
+ text.value = val
49
+ }
50
+ </script>
@@ -132,6 +132,7 @@ type FormPrefill = Record<
132
132
  | number
133
133
  | boolean
134
134
  | { type: 'select'; value: string; options: string[] }
135
+ | { type: 'autocomplete'; value: string; options: string[] }
135
136
  >
136
137
 
137
138
  type FormFlat<T extends FormPrefill> = {
@@ -33,6 +33,12 @@
33
33
  :options="(prefill[field] as any).options"
34
34
  :label="field"
35
35
  />
36
+ <qx-input-autocomplete
37
+ v-if="getType(field) === 'autocomplete'"
38
+ v-model="dummy[field]"
39
+ :autocomplete="(prefill[field] as any).options"
40
+ :label="field"
41
+ />
36
42
  </div>
37
43
  <div
38
44
  class="text-red"
@@ -77,6 +83,7 @@ type prefill = Record<
77
83
  | number
78
84
  | boolean
79
85
  | { type: 'select'; value: string; options: string[] }
86
+ | { type: 'autocomplete'; value: string; options: string[] }
80
87
  >
81
88
 
82
89
  const props = defineProps<{