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

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.20",
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,46 @@
1
+ <template>
2
+ <q-select
3
+ v-model="text"
4
+ :use-input="text === null"
5
+ input-debounce="0"
6
+ :options="options"
7
+ @filter="filterFn"
8
+ new-value-mode="add-unique"
9
+ v-bind="$attrs"
10
+ clearable
11
+ >
12
+ </q-select>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { useVModel } from '@vueuse/core'
17
+ import _ from 'lodash'
18
+ import { ref } from 'vue'
19
+
20
+ const props = defineProps<{
21
+ autocomplete: string[]
22
+ modelValue: any
23
+ }>()
24
+
25
+ const emits = defineEmits(['update:modelValue'])
26
+
27
+ const text = useVModel(props, 'modelValue', emits)
28
+ if (!text.value) text.value = null
29
+
30
+ let options = ref<string[]>(props.autocomplete)
31
+
32
+ function filterFn(val: any, update: any) {
33
+ if (val === '') {
34
+ update(() => {
35
+ options.value = props.autocomplete
36
+ })
37
+ } else {
38
+ update(() => {
39
+ const needle = val.toLowerCase()
40
+ options.value = props.autocomplete.filter(
41
+ v => v.toLowerCase().indexOf(needle) > -1
42
+ )
43
+ })
44
+ }
45
+ }
46
+ </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<{