Skip to content

Commit b144708

Browse files
authored
Merge pull request #367 from citation-file-format/354-license-improvements
2 parents 703a005 + 54a6fa4 commit b144708

1 file changed

Lines changed: 26 additions & 11 deletions

File tree

src/components/ScreenLicense.vue

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
bg-color="white"
1818
label="license"
1919
clearable
20+
fill-input
21+
hide-selected
22+
input-debounce="0"
2023
outlined
2124
standout
2225
use-input
@@ -26,7 +29,15 @@
2629
v-bind:error-message="''"
2730
v-on:filter="licenseFilterFunction"
2831
v-on:update:model-value="setLicense"
29-
/>
32+
>
33+
<template #no-option>
34+
<q-item>
35+
<q-item-section class="text-grey">
36+
No results
37+
</q-item-section>
38+
</q-item>
39+
</template>
40+
</q-select>
3041
</div>
3142

3243
<div id="form-button-bar">
@@ -38,6 +49,7 @@
3849
<script lang="ts">
3950
import { defineComponent, ref } from 'vue'
4051
import { useCff } from '../store/cff'
52+
import { QSelect } from 'quasar'
4153
import schema from '../schemas/1.2.0/schema.json'
4254
import Stepper from 'components/Stepper.vue'
4355
import StepperActions from 'components/StepperActions.vue'
@@ -58,17 +70,20 @@ export default defineComponent({
5870
licenses,
5971
options,
6072
setLicense,
61-
licenseFilterFunction (val: string, update: (a: unknown) => void) {
62-
if (val === '') {
63-
update(() => {
64-
options.value = licenses
65-
})
66-
return
67-
}
68-
73+
licenseFilterFunction (val: string, update: (a: unknown, b: unknown) => void) {
6974
update(() => {
70-
const needle = val.toLowerCase()
71-
options.value = licenses.filter(v => v.toLowerCase().indexOf(needle) > -1)
75+
if (val === '') {
76+
options.value = licenses
77+
} else {
78+
const needle = val.toLowerCase()
79+
options.value = licenses.filter(v => v.toLowerCase().indexOf(needle) > -1)
80+
}
81+
},
82+
(ref: QSelect) => {
83+
if (val !== '' && ref.options !== undefined && ref.options.length > 0) {
84+
ref.setOptionIndex(-1)
85+
ref.moveOptionSelection(1, true)
86+
}
7287
})
7388
}
7489
}

0 commit comments

Comments
 (0)