forked from extern/egroupware
convert hierarchical options / optgroups to a flat list and enable search for more than 100 options automatic
fixes timezone selection in preferences
This commit is contained in:
parent
9fe7b22d1f
commit
9f15169ced
@ -154,6 +154,11 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
|
||||
|
||||
this.__select_options = cleanSelectOptions(new_options);
|
||||
|
||||
if (this.__select_options.length > 100)
|
||||
{
|
||||
this.search = true;
|
||||
}
|
||||
|
||||
this.requestUpdate("select_options", old_options);
|
||||
}
|
||||
|
||||
|
@ -232,15 +232,22 @@ export function cleanSelectOptions(options : SelectOption[] | string[] | object)
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure value is a string
|
||||
// make sure value is a string, and label not an object with sub-options
|
||||
options.forEach(option =>
|
||||
{
|
||||
if (typeof option.value !== 'string')
|
||||
{
|
||||
option.value = option.value.toString();
|
||||
}
|
||||
if (typeof option.label !== 'string')
|
||||
{
|
||||
fixed_options.push(...cleanSelectOptions(option.label));
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_options.push(option);
|
||||
}
|
||||
})
|
||||
fixed_options = options;
|
||||
}
|
||||
|
||||
return fixed_options;
|
||||
|
Loading…
Reference in New Issue
Block a user