|
28 | 28 | class="w-full"
|
29 | 29 | :options="columnOptions[c.name] || []"
|
30 | 30 | @update:modelValue="onFilterInput[c.name]({ column: c, operator: c.filterOptions.multiselect ? 'in' : 'eq', value: c.filterOptions.multiselect ? ($event.length ? $event : undefined) : $event || undefined })"
|
31 |
| - :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === (c.filterOptions.multiselect ? 'in' : 'eq'))?.value || []" |
| 31 | + :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === (c.filterOptions.multiselect ? 'in' : 'eq'))?.value || (c.filterOptions.multiselect ? [] : '')" |
32 | 32 | />
|
33 | 33 | <Select
|
34 |
| - multiple |
| 34 | + :multiple="c.filterOptions.multiselect" |
35 | 35 | class="w-full"
|
36 | 36 | v-else-if="c.type === 'boolean'"
|
37 | 37 | :options="[
|
|
40 | 40 | // if field is not required, undefined might be there, and user might want to filter by it
|
41 | 41 | ...(c.required ? [] : [ { label: $t('Unset'), value: undefined } ])
|
42 | 42 | ]"
|
43 |
| - @update:modelValue="onFilterInput[c.name]({ column: c, operator: 'in', value: $event.length ? $event : undefined })" |
44 |
| - :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === 'in')?.value || []" |
| 43 | + @update:modelValue="onFilterInput[c.name]({ column: c, operator: c.filterOptions.multiselect ? 'in' : 'eq', value: c.filterOptions.multiselect ? ($event.length ? $event : undefined) : $event })" |
| 44 | + :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === (c.filterOptions.multiselect ? 'in' : 'eq'))?.value !== undefined |
| 45 | + ? filtersStore.filters.find(f => f.field === c.name && f.operator === (c.filterOptions.multiselect ? 'in' : 'eq'))?.value |
| 46 | + : (c.filterOptions.multiselect ? [] : '')" |
45 | 47 | />
|
46 | 48 |
|
47 | 49 | <Select
|
|
50 | 52 | v-else-if="c.enum"
|
51 | 53 | :options="c.enum"
|
52 | 54 | @update:modelValue="onFilterInput[c.name]({ column: c, operator: c.filterOptions.multiselect ? 'in' : 'eq', value: c.filterOptions.multiselect ? ($event.length ? $event : undefined) : $event || undefined })"
|
53 |
| - :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === (c.filterOptions.multiselect ? 'in' : 'eq'))?.value || []" |
| 55 | + :modelValue="filtersStore.filters.find(f => f.field === c.name && f.operator === (c.filterOptions.multiselect ? 'in' : 'eq'))?.value || (c.filterOptions.multiselect ? [] : '')" |
54 | 56 | />
|
55 | 57 |
|
56 | 58 | <Input
|
@@ -165,12 +167,6 @@ const columnOptions = computedAsync(async () => {
|
165 | 167 | },
|
166 | 168 | });
|
167 | 169 | ret[column.name] = list.items;
|
168 |
| - if (!column.filterOptions.multiselect) { |
169 |
| - ret[column.name].push({ |
170 |
| - label: t('Unset'), |
171 |
| - value: '', |
172 |
| - }); |
173 |
| - } |
174 | 170 | }
|
175 | 171 | })
|
176 | 172 | );
|
|
0 commit comments