forked from extern/egroupware
Fix option merge unique filter left out some options
This commit is contained in:
parent
f79c57f048
commit
5ee60c0af1
@ -46,18 +46,10 @@ export const Et2StaticSelectMixin = <T extends Constructor<Et2WidgetWithSelect>>
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const options = super.select_options || [];
|
const options = super.select_options || [];
|
||||||
// make sure result is unique
|
// make sure result is unique
|
||||||
if (options.length && this.static_options.length)
|
|
||||||
{
|
return [...new Map([...options, ...(this.static_options || [])].map(item =>
|
||||||
const union = [].concat(options);
|
[item.value, item])).values()];
|
||||||
this.static_options.forEach(option => {
|
|
||||||
if (!union.filter(opt => opt.value == option.value).length)
|
|
||||||
{
|
|
||||||
union.concat(option);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return union;
|
|
||||||
}
|
|
||||||
return [...options, ...(this.static_options || [])];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set select_options(new_options)
|
set select_options(new_options)
|
||||||
|
Loading…
Reference in New Issue
Block a user