From 6018f009a86cca196d15e4e72dd5eb41aaeb4bad Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Thu, 16 Feb 2023 12:02:38 +0100 Subject: [PATCH] fix(SelectCustom): handle search on string arrays --- src/runtime/components/forms/SelectCustom.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/components/forms/SelectCustom.vue b/src/runtime/components/forms/SelectCustom.vue index 25f3e45a0a..72f2918e82 100644 --- a/src/runtime/components/forms/SelectCustom.vue +++ b/src/runtime/components/forms/SelectCustom.vue @@ -292,11 +292,11 @@ const iconClass = computed(() => { const filteredOptions = computed(() => query.value === '' ? props.options - : props.options.filter((option: any) => { - return (props.searchAttributes?.length ? props.searchAttributes : [props.textAttribute]).some((searchAttribute: any) => { - return option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, 'i')) !== -1 + : (props.options as any[]).filter((option: any) => { + return (props.searchAttributes?.length ? props.searchAttributes : [props.textAttribute]).some((searchAttribute: any) => { + return typeof option === 'string' ? option.search(new RegExp(query.value, 'i')) !== -1 : (option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, 'i')) !== -1) + }) }) - }) ) const queryOption = computed(() => {