Skip to content

Commit a72641b

Browse files
authored
feat: Use toggle button for switching any/all mode for search filters (#6833)
1 parent f4ed9d9 commit a72641b

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

frontend/components/Domain/SearchFilter.vue

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,27 @@
3737
:label="$t('search.search')"
3838
clearable
3939
/>
40-
<div class="d-flex py-4 px-1">
41-
<v-switch
40+
<div />
41+
<div class="d-flex py-4 px-1 align-center">
42+
<v-btn-toggle
4243
v-if="requireAll != undefined"
43-
v-model="requireAllValue"
44+
v-model="combinator"
45+
mandatory
4446
density="compact"
45-
hide-details
46-
class="my-auto"
47+
variant="outlined"
4748
color="primary"
48-
:label="requireAllValue ? $t('search.has-all') : $t('search.has-any')"
49-
/>
49+
>
50+
<v-btn value="hasAll">
51+
{{ $t('search.has-all') }}
52+
</v-btn>
53+
<v-btn value="hasAny">
54+
{{ $t('search.has-any') }}
55+
</v-btn>
56+
</v-btn-toggle>
5057
<v-spacer />
5158
<v-btn
5259
size="small"
5360
color="accent"
54-
class="mr-2 my-auto"
5561
@click="clearSelection"
5662
>
5763
{{ $t("search.clear-selection") }}
@@ -174,10 +180,10 @@ export default defineNuxtComponent({
174180
// Use shallowRef for better performance with arrays
175181
const debouncedSearch = shallowRef("");
176182
177-
const requireAllValue = computed({
178-
get: () => props.requireAll,
183+
const combinator = computed({
184+
get: () => (props.requireAll ? "hasAll" : "hasAny"),
179185
set: (value) => {
180-
context.emit("update:requireAll", value);
186+
context.emit("update:requireAll", value === "hasAll");
181187
},
182188
});
183189
@@ -246,7 +252,7 @@ export default defineNuxtComponent({
246252
}
247253
248254
return {
249-
requireAllValue,
255+
combinator,
250256
state,
251257
selected,
252258
selectedRadio,

0 commit comments

Comments
 (0)