@@ -93,53 +93,75 @@ <h1 class="page-title">Source: components/Records/Search/Input/FilterAutocomplet
9393 < pre
9494 class ="sunlight-highlight-javascript linenums "> <template>
9595 <v-expansion-panel
96- v-if="filter.filterName"
97- :id="filter.filterName + 'AutocompleteList'"
96+ v-if="filter.filterName"
97+ :id="filter.filterName + 'AutocompleteList'"
9898 >
9999 <v-expansion-panel-title> {{ filter.filterLabel }}</v-expansion-panel-title>
100100
101101 <v-expansion-panel-text class="pl-5 pr-5">
102102 <v-row no-gutters>
103103 <v-col cols="12">
104104 <div
105- :class="['d-flex', { 'flex-column': $vuetify.display.mdAndDown }]"
105+ :class="['d-flex', { 'flex-column': $vuetify.display.mdAndDown }]"
106106 >
107107 <v-combobox
108- v-model="selectedValues"
109- :item-props="itemProps"
110- :items="getValues"
111- :placeholder="`Search`"
112- chips
113- class="text-capitalize"
114- closable-chips
115- color="primary"
116- density="compact"
117- hide-details="auto"
118- hide-no-data
119- multiple
120- prepend-inner-icon="fas fa-search"
121- variant="solo"
122- @focus="scrollTo(filter.filterName)"
123- @click:clear="reset(filter)"
108+ v-model="selectedValues"
109+ :items="getValues"
110+ :menu-props="{ maxWidth: '50' }"
111+ chips
112+ class="text-capitalize"
113+ clearable
114+ closable-chips
115+ color="primary"
116+ density="compact"
117+ hide-details="auto"
118+ hide-no-data
119+ item-title="key"
120+ item-value="key"
121+ multiple
122+ placeholder="Search"
123+ prepend-inner-icon="fas fa-search"
124+ return-object
125+ variant="solo"
126+ @focus="scrollTo(filter.filterName)"
127+ @click:clear="reset(filter)"
124128 >
125- <!-- <template #selection="data"> -->
126- <!-- <v-chip class="bg-blue text-white mb-1"> -->
127- <!-- <span class="chipsValueName"> -->
128- <!-- {{ cleanString(data.item.raw.key) }}-->
129- <!-- </span> -->
130- <!-- </v-chip> -->
131- <!-- </template> -->
132- <!-- <template #item="data"> -->
133- <!-- <div class="d-flex full-width"> -->
134- <!-- <span class="filterValueName"> {{ cleanString(data.item.raw.key) }}</span> -->
135- <!-- <span class="filterValueCount"> {{ data.item.raw['doc_count'] }}</span> -->
136- <!-- </div> -->
137- <!-- </template> -->
129+ <template #chip="{ props, item }">
130+ <v-chip color="blue" v-bind="props" variant="flat">
131+ {{ item.title.replace(/_/g, " ") }}
132+ <v-tooltip activator="parent" location="bottom">
133+ {{ item.title.replace(/_/g, " ") }}
134+ </v-tooltip>
135+ </v-chip>
136+ </template>
137+
138+ <template #item="{ props, item }">
139+ <v-list-item v-bind="props">
140+ <template #prepend="{ isActive }">
141+ <v-list-item-action start>
142+ <v-checkbox-btn
143+ :model-value="isActive"
144+ readonly
145+ > </v-checkbox-btn>
146+ </v-list-item-action>
147+ </template>
148+
149+ <span v-if="item.raw.key" class="text-capitalize">
150+ {{ item.raw.key.replace(/_/g, " ") }}
151+ </span>
152+
153+ <template #append>
154+ <span class="filterValueCount"> {{
155+ item.raw.doc_count
156+ }}</span>
157+ </template>
158+ </v-list-item>
159+ </template>
138160 </v-combobox>
139161 <v-btn
140- class="ml-lg-2 custom-btn"
141- color="primary"
142- @click="applyFilters(filter)"
162+ class="ml-lg-2 custom-btn"
163+ color="primary"
164+ @click="applyFilters(filter)"
143165 >
144166 Apply
145167 </v-btn>
@@ -151,17 +173,17 @@ <h1 class="page-title">Source: components/Records/Search/Input/FilterAutocomplet
151173</template>
152174
153175<script>
154- import {mapGetters, mapState} from "vuex";
176+ import { mapGetters, mapState } from "vuex";
155177
156178import clearString from "@/utils/stringUtils";
157- import {capitalize} from "lodash";
179+ import { capitalize } from "lodash";
158180
159181export default {
160182 name: "FilterAutocomplete",
161183 mixins: [clearString],
162184 props: {
163- filter: {default: null, type: Object},
164- lastItem: {default: false, type: Boolean},
185+ filter: { default: null, type: Object },
186+ lastItem: { default: false, type: Boolean },
165187 },
166188 data: () => {
167189 return {
@@ -189,11 +211,11 @@ <h1 class="page-title">Source: components/Records/Search/Input/FilterAutocomplet
189211 let filterName = _module.filter.filterName;
190212 let currentParams = JSON.parse(JSON.stringify(_module.$route.query));
191213
192- _module.selectedValues = _module.selectedValues.map(({key}) => key);
214+ _module.selectedValues = _module.selectedValues.map(({ key }) => key);
193215 if (Object.keys(currentParams).indexOf(filterName) === -1) {
194216 if (
195217 _module.selectedValues !== null &&
196- _module.selectedValues.length > 0
218+ _module.selectedValues.length > 0
197219 ) {
198220 if (_module.selectedValues.length === 1) {
199221 currentParams[filterName] = encodeURIComponent(
@@ -217,7 +239,7 @@ <h1 class="page-title">Source: components/Records/Search/Input/FilterAutocomplet
217239 else {
218240 if (
219241 _module.selectedValues === null ||
220- _module.selectedValues.length === 0
242+ _module.selectedValues.length === 0
221243 ) {
222244 delete currentParams[_module.filter.filterName];
223245 currentParams["page"] = 1;
@@ -229,7 +251,7 @@ <h1 class="page-title">Source: components/Records/Search/Input/FilterAutocomplet
229251 else {
230252 let newParams = [];
231253 let existingValues =
232- currentParams[_module.filter.filterName].split(",");
254+ currentParams[_module.filter.filterName].split(",");
233255 _module.selectedValues.forEach(function (selectedValue) {
234256 const filterVal = encodeURIComponent(selectedValue);
235257 if (existingValues.indexOf(filterVal) === -1) {
@@ -274,7 +296,7 @@ <h1 class="page-title">Source: components/Records/Search/Input/FilterAutocomplet
274296};
275297</script>
276298
277- <style scoped>
299+ <style lang="scss" scoped>
278300.filterValueName {
279301 text-overflow: ellipsis;
280302 overflow: hidden;
@@ -298,6 +320,16 @@ <h1 class="page-title">Source: components/Records/Search/Input/FilterAutocomplet
298320.custom-btn {
299321 height: 38px;
300322}
323+
324+ .v-field {
325+ .v-chip {
326+ height: inherit;
327+ }
328+ }
329+
330+ :deep(.v-list-item-title) {
331+ display: none;
332+ }
301333</style>
302334</ pre >
303335 </ article >
0 commit comments