Allow wider search pattern for filterable

This commit is contained in:
Sergio Crisostomo 2018-05-21 10:49:54 +02:00
parent bdb26ef7c8
commit db5110c26a

View file

@ -434,11 +434,15 @@
};
},
validateOption({elm, propsData}){
validateOption({children, elm, propsData}){
if (this.queryStringMatchesSelectedOption) return true;
const value = propsData.value;
const label = propsData.label || '';
const textContent = elm && elm.textContent || '';
const textContent = (elm && elm.textContent) || (children || []).reduce((str, node) => {
const nodeText = node.elm ? node.elm.textContent : node.text;
return `${str} ${nodeText}`;
}, '') || '';
const stringValues = JSON.stringify([value, label, textContent]);
const query = this.query.toLowerCase().trim();
return stringValues.toLowerCase().includes(query);