mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 22:08:45 +01:00
SearchMixin: Fix selected remote options got lost if adding a freeEntry
This commit is contained in:
parent
e875b9ddf4
commit
fa2375b1a6
@ -12,6 +12,7 @@ import {css, html, LitElement, render, SlotMixin} from "@lion/core";
|
|||||||
import {cleanSelectOptions, SelectOption} from "./FindSelectOptions";
|
import {cleanSelectOptions, SelectOption} from "./FindSelectOptions";
|
||||||
import {Validator} from "@lion/form-core";
|
import {Validator} from "@lion/form-core";
|
||||||
import {Et2Tag} from "./Tag/Et2Tag";
|
import {Et2Tag} from "./Tag/Et2Tag";
|
||||||
|
import {SlMenuItem} from "@shoelace-style/shoelace";
|
||||||
|
|
||||||
// Otherwise import gets stripped
|
// Otherwise import gets stripped
|
||||||
let keep_import : Et2Tag;
|
let keep_import : Et2Tag;
|
||||||
@ -478,7 +479,7 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
return this.querySelectorAll(this.optionTag + ".freeEntry");
|
return this.querySelectorAll(this.optionTag + ".freeEntry");
|
||||||
}
|
}
|
||||||
|
|
||||||
get search_options() : SelectOption[]
|
get select_options() : SelectOption[]
|
||||||
{
|
{
|
||||||
let options = [];
|
let options = [];
|
||||||
|
|
||||||
@ -490,7 +491,7 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// Any provided options
|
// Any provided options
|
||||||
options = options.concat(this.__search_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);
|
||||||
@ -498,6 +499,12 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set select_options(options : SelectOption[])
|
||||||
|
{
|
||||||
|
this.__select_options = options;
|
||||||
|
this.requestUpdate('select_options');
|
||||||
|
}
|
||||||
|
|
||||||
get value()
|
get value()
|
||||||
{
|
{
|
||||||
return super.value;
|
return super.value;
|
||||||
@ -789,10 +796,11 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
async _handleSearchBlur(event : FocusEvent)
|
async _handleSearchBlur(event : FocusEvent)
|
||||||
{
|
{
|
||||||
clearTimeout(this._searchTimeout);
|
clearTimeout(this._searchTimeout);
|
||||||
if(event.relatedTarget && [this, this.dropdown].indexOf((<Element>event.relatedTarget).parentElement) == -1 ||
|
if(event.relatedTarget && event.relatedTarget instanceof SlMenuItem)
|
||||||
event.relatedTarget === null
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Try any value they had in progress
|
// Try any value they had in progress
|
||||||
if(this._searchInputNode.value && this.allowFreeEntries)
|
if(this._searchInputNode.value && this.allowFreeEntries)
|
||||||
{
|
{
|
||||||
@ -805,7 +813,6 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
|
|||||||
event.relatedTarget.focus();
|
event.relatedTarget.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle keypresses inside the search input
|
* Handle keypresses inside the search input
|
||||||
|
Loading…
Reference in New Issue
Block a user