Process also shallow children and not only nested
This commit is contained in:
parent
523e2c81fd
commit
aa21cdf9c3
1 changed files with 20 additions and 13 deletions
|
@ -107,6 +107,19 @@
|
||||||
return options.concat(findOptionsInVNode(slotEntry));
|
return options.concat(findOptionsInVNode(slotEntry));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const applyProp = (node, propName, value) => {
|
||||||
|
return {
|
||||||
|
...node,
|
||||||
|
componentOptions: {
|
||||||
|
...node.componentOptions,
|
||||||
|
propsData: {
|
||||||
|
...node.componentOptions.propsData,
|
||||||
|
[propName]: value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'iSelect',
|
name: 'iSelect',
|
||||||
mixins: [ Emitter, Locale ],
|
mixins: [ Emitter, Locale ],
|
||||||
|
@ -304,19 +317,13 @@
|
||||||
const autoCompleteOptions = extractOptions(slotOptions);
|
const autoCompleteOptions = extractOptions(slotOptions);
|
||||||
const selectedSlotOption = autoCompleteOptions[currentIndex];
|
const selectedSlotOption = autoCompleteOptions[currentIndex];
|
||||||
|
|
||||||
return slotOptions.map(node => copyChildren(node, (child) => {
|
return slotOptions.map(node => {
|
||||||
if (child !== selectedSlotOption) return child;
|
if (node === selectedSlotOption) return applyProp(node, 'isFocused', true);
|
||||||
return {
|
return copyChildren(node, (child) => {
|
||||||
...child,
|
if (child !== selectedSlotOption) return child;
|
||||||
componentOptions: {
|
return applyProp(child, 'isFocused', true);
|
||||||
...child.componentOptions,
|
});
|
||||||
propsData: {
|
});
|
||||||
...child.componentOptions.propsData,
|
|
||||||
isFocused: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let option of slotOptions) {
|
for (let option of slotOptions) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue