@d-mok/quasar-app-extension-quasar-axe 2.0.20 → 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.20",
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",
@@ -1,13 +1,14 @@
1
1
  <template>
2
2
  <q-select
3
- v-model="text"
4
- :use-input="text === null"
3
+ :model-value="text"
4
+ use-input
5
+ hide-selected
6
+ fill-input
5
7
  input-debounce="0"
6
8
  :options="options"
7
9
  @filter="filterFn"
8
- new-value-mode="add-unique"
10
+ @input-value="setModel"
9
11
  v-bind="$attrs"
10
- clearable
11
12
  >
12
13
  </q-select>
13
14
  </template>
@@ -15,7 +16,7 @@
15
16
  <script lang="ts" setup>
16
17
  import { useVModel } from '@vueuse/core'
17
18
  import _ from 'lodash'
18
- import { ref } from 'vue'
19
+ import { ref, watch } from 'vue'
19
20
 
20
21
  const props = defineProps<{
21
22
  autocomplete: string[]
@@ -27,20 +28,23 @@ const emits = defineEmits(['update:modelValue'])
27
28
  const text = useVModel(props, 'modelValue', emits)
28
29
  if (!text.value) text.value = null
29
30
 
30
- let options = ref<string[]>(props.autocomplete)
31
+ let options = ref<string[]>([])
31
32
 
32
33
  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
- }
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
45
49
  }
46
50
  </script>