Skip to content

Commit 96ddba4

Browse files
Merge pull request #8066 from carlobeltrame/checklist-template-search
Make checklist templates searchable
2 parents 3a61744 + 110355e commit 96ddba4

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

frontend/src/components/checklist/ChecklistCreate.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
vee-rules="required"
3030
/>
3131

32-
<e-select
32+
<e-autocomplete
3333
v-model="entityData.copyChecklistSource"
3434
path="copyChecklistSource"
35+
clearable
3536
:items="prototypeChecklists"
3637
/>
3738
</DetailPane>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<ValidationProvider
3+
v-slot="{ errors: veeErrors }"
4+
tag="div"
5+
:name="validationLabel"
6+
:vid="veeId"
7+
:rules="veeRules"
8+
:skip-if-empty="skipIfEmpty"
9+
:required="required"
10+
:immediate="immediateValidation"
11+
class="e-form-container"
12+
>
13+
<v-autocomplete
14+
v-bind="$attrs"
15+
:filled="filled"
16+
:hide-details="hideDetails"
17+
:error-messages="veeErrors.concat(errorMessages)"
18+
:label="labelOrEntityFieldLabel"
19+
:class="[inputClass]"
20+
:readonly="readonly"
21+
:append-icon="readonly ? null : '$dropdown'"
22+
:filter="filter"
23+
v-on="$listeners"
24+
>
25+
<!-- passing through all slots -->
26+
<slot v-for="(_, name) in $slots" :slot="name" :name="name" />
27+
<template v-for="(_, name) in $scopedSlots" :slot="name" slot-scope="slotData">
28+
<slot :name="name" v-bind="slotData" />
29+
</template>
30+
</v-autocomplete>
31+
</ValidationProvider>
32+
</template>
33+
34+
<script>
35+
import { ValidationProvider } from 'vee-validate'
36+
import { formComponentPropsMixin } from '@/mixins/formComponentPropsMixin.js'
37+
import { formComponentMixin } from '@/mixins/formComponentMixin.js'
38+
39+
export default {
40+
name: 'EAutocomplete',
41+
components: { ValidationProvider },
42+
mixins: [formComponentPropsMixin, formComponentMixin],
43+
props: {
44+
immediateValidation: { type: Boolean, default: false },
45+
skipIfEmpty: { type: Boolean, default: true },
46+
readonly: { type: Boolean, default: false },
47+
},
48+
methods: {
49+
filter(item, queryText, itemText) {
50+
return queryText
51+
.toLocaleLowerCase()
52+
.split(/\s+/g)
53+
.every((part) => {
54+
return itemText.toLocaleLowerCase().indexOf(part) > -1
55+
})
56+
},
57+
},
58+
}
59+
</script>
60+
61+
<style scoped>
62+
[required]:deep(label::after) {
63+
content: '\a0*';
64+
font-size: 12px;
65+
color: #d32f2f;
66+
}
67+
[required]:deep(.v-input--is-label-active label::after) {
68+
color: gray;
69+
}
70+
</style>

0 commit comments

Comments
 (0)