forked from extern/egroupware
Et2Select: Fix free entries can get doubled if more free entries added
This commit is contained in:
parent
ee84b05d82
commit
c4f3ec9840
@ -97,14 +97,12 @@ export class Et2SelectEmail extends Et2Select
|
|||||||
accept: `.et2-select-draggable`,
|
accept: `.et2-select-draggable`,
|
||||||
ondrop: function(e)
|
ondrop: function(e)
|
||||||
{
|
{
|
||||||
|
// Add in as free entry
|
||||||
e.target.createFreeEntry(e.draggable.target.value);
|
e.target.createFreeEntry(e.draggable.target.value);
|
||||||
e.target.classList.remove('et2_toolbarDropArea');
|
e.target.classList.remove('et2_dropZone');
|
||||||
|
|
||||||
// remove the dragged value from its origin source
|
// remove the dragged value from its origin source
|
||||||
e.draggable.parent_node.value = e.draggable.parent_node.value.filter(_item => {return e.draggable.target.value !== _item;})
|
e.draggable.parent_node.value = e.draggable.parent_node.value.filter(_item => {return e.draggable.target.value !== _item;})
|
||||||
|
|
||||||
// set value for newly dropped target
|
|
||||||
e.target.value.push(e.draggable.target.value);
|
|
||||||
},
|
},
|
||||||
ondragenter: function(e)
|
ondragenter: function(e)
|
||||||
{
|
{
|
||||||
|
@ -511,19 +511,22 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
{
|
{
|
||||||
let options = [];
|
let options = [];
|
||||||
|
|
||||||
if(this.allowFreeEntries)
|
|
||||||
{
|
|
||||||
this.freeEntries.forEach((item) =>
|
|
||||||
{
|
|
||||||
options.push({value: item.value, label: item.textContent, class: item.classList.toString()});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// Any provided options
|
// Any provided options
|
||||||
options = options.concat(this.__select_options);
|
options = options.concat(this.__select_options);
|
||||||
|
|
||||||
// Any kept remote options
|
// Any kept remote options
|
||||||
options = options.concat(this._selected_remote);
|
options = options.concat(this._selected_remote);
|
||||||
|
|
||||||
|
if(this.allowFreeEntries)
|
||||||
|
{
|
||||||
|
this.freeEntries.forEach((item : SlMenuItem) =>
|
||||||
|
{
|
||||||
|
if(!options.some(i => i.value == item.value))
|
||||||
|
{
|
||||||
|
options.push({value: item.value, label: item.textContent, class: item.classList.toString()});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user