@@ -170,6 +170,15 @@ const props = defineProps({
170170 default: false ,
171171 required: false ,
172172 },
173+ /**
174+ * Indica se a busca deve levar em consideração argumentos compostos.
175+ * Só tem efeito se a prop `searchable` for `true`.
176+ */
177+ deepSearch: {
178+ type: Boolean ,
179+ default: false ,
180+ required: false ,
181+ },
173182 /**
174183 * @deprecated Define a largura do Select. As opções são 'thin', 'default' e 'wide'.
175184 */
@@ -412,13 +421,34 @@ function filterOptions(value) {
412421 }
413422
414423 const sanitizedString = removeAccents (String (value) || ' ' );
415- const regexExp = new RegExp (sanitizedString, ' i' );
424+
425+ if (props .deepSearch ) {
426+ deepOptionSearch (sanitizedString);
427+ } else {
428+ simpleSearch (sanitizedString);
429+ }
430+ }
431+
432+ function simpleSearch (sanitizedSearchValue ) {
433+ const regexExp = new RegExp (sanitizedSearchValue, ' i' );
416434
417435 localOptions .value = pristineOptions .value .filter (
418436 (option ) => removeAccents (option[props .optionsField ]).search (regexExp) >= 0 ,
419437 );
420438}
421439
440+ function deepOptionSearch (sanitizedSearchValue ) {
441+ localOptions .value = pristineOptions .value .filter (
442+ (option ) => {
443+ const searchArray = sanitizedSearchValue .toLowerCase ().split (' ' );
444+
445+ return searchArray .map ((i ) => {
446+ return removeAccents (option[props .optionsField ]).toLowerCase ().includes (i);
447+ }).every ((item ) => item === true );
448+ }
449+ );
450+ }
451+
422452function activeSelection () {
423453 if (props .disabled ) return ;
424454
0 commit comments