mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 19:03:14 +01:00
Et2Select: Fix missing option detection when options have optgroups
Was unable to find option in Timezones, resulting in an infinite loop
This commit is contained in:
parent
e1f13eade1
commit
a2c0234401
@ -377,10 +377,21 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
|
|||||||
}
|
}
|
||||||
if(this.searchEnabled)
|
if(this.searchEnabled)
|
||||||
{
|
{
|
||||||
|
let search = function(options, value)
|
||||||
|
{
|
||||||
|
return options.some((option) =>
|
||||||
|
{
|
||||||
|
if(Array.isArray(option.value))
|
||||||
|
{
|
||||||
|
return search(option.value, value);
|
||||||
|
}
|
||||||
|
return option.value == value;
|
||||||
|
});
|
||||||
|
};
|
||||||
// Check to see if value is for an option we do not have
|
// Check to see if value is for an option we do not have
|
||||||
for(const newValueElement of this.getValueAsArray())
|
for(const newValueElement of this.getValueAsArray())
|
||||||
{
|
{
|
||||||
if(this.select_options.some(o => o.value == newValueElement))
|
if(search(this.select_options, newValueElement))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1347,7 +1358,7 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected searchMatch(search, option : SelectOption) : boolean
|
protected searchMatch(search : string, option : SelectOption) : boolean
|
||||||
{
|
{
|
||||||
if(!option || !option.value)
|
if(!option || !option.value)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user