fix(form_builder): Use locale-aware sorting and search for fieldtypes (#23454)
* fix(form_builder): Use locale-aware string sort and search for DocFields * fix(form_builder): Fix CSS cursor for DocField autocomplete
This commit is contained in:
parent
668b3c0026
commit
6f36c0fa0b
1 changed files with 13 additions and 6 deletions
|
|
@ -19,7 +19,7 @@
|
|||
<div class="combo-box-items">
|
||||
<ComboboxOption
|
||||
as="template"
|
||||
v-for="(field, i) in filteredOptions"
|
||||
v-for="(field, i) in sortedOptions"
|
||||
:key="i"
|
||||
:value="field"
|
||||
v-slot="{ active }"
|
||||
|
|
@ -85,11 +85,16 @@ const selectedValue = computed({
|
|||
});
|
||||
|
||||
const filteredOptions = computed(() => {
|
||||
return query.value
|
||||
? props.options.filter((option) => {
|
||||
return option.label.toLowerCase().includes(query.value.toLowerCase());
|
||||
})
|
||||
: props.options;
|
||||
if (!query.value) return props.options;
|
||||
return props.options.filter((option) => {
|
||||
return option.label.toLocaleLowerCase().includes(query.value.toLocaleLowerCase());
|
||||
});
|
||||
});
|
||||
|
||||
const sortedOptions = computed(() => {
|
||||
return filteredOptions.value.sort((a, b) => {
|
||||
return a.label.localeCompare(b.label);
|
||||
});
|
||||
});
|
||||
|
||||
function clear_search() {
|
||||
|
|
@ -126,6 +131,8 @@ watch(showOptions, (val) => {
|
|||
border-radius: var(--border-radius-sm);
|
||||
padding: 6px 10px;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
|
||||
&:hover,
|
||||
&.active {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue