forked from extern/egroupware
Fix duplicate option warning from customfield select filter
This commit is contained in:
parent
323e45caf7
commit
48eb9c1968
@ -147,7 +147,10 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
|
||||
*/
|
||||
let temp_target = document.createElement("div");
|
||||
|
||||
let options = html`${this._emptyLabelTemplate()}${this.select_options.map(this._optionTemplate.bind(this))}`;
|
||||
let options = html`${this._emptyLabelTemplate()}${this.select_options
|
||||
// Filter out empty values if we have empty label to avoid duplicates
|
||||
.filter(o => this.emptyLabel ? o.value !== '' : o)
|
||||
.map(this._optionTemplate.bind(this))}`;
|
||||
|
||||
render(options, temp_target);
|
||||
return Promise.all(([...temp_target.querySelectorAll(":scope > *")].map(item => item.render)))
|
||||
|
@ -4119,9 +4119,10 @@ export class et2_nextmatch_customfields extends et2_customfields_list implements
|
||||
let widget = null;
|
||||
if(field.type == 'select' || field.type == 'select-account')
|
||||
{
|
||||
if(field.values && typeof field.values[''] !== 'undefined')
|
||||
// Remove empty label
|
||||
if(field.values && field.values.findIndex && field.values.findIndex((i) => i.value == '') !== -1)
|
||||
{
|
||||
delete (field.values['']);
|
||||
field.values.splice(field.values.findIndex((i) => i.value == ''), 1);
|
||||
}
|
||||
widget = loadWebComponent(
|
||||
field.type == 'select-account' ? 'et2-nextmatch-header-account' : "et2-nextmatch-header-filter",
|
||||
|
Loading…
Reference in New Issue
Block a user