mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 00:43:20 +01:00
Et2Email: Better handling of blur & showing validation error
This commit is contained in:
parent
7948a64d3c
commit
a0e0d9cefb
@ -491,13 +491,13 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
|
|||||||
/** Hides the listbox. */
|
/** Hides the listbox. */
|
||||||
async hide()
|
async hide()
|
||||||
{
|
{
|
||||||
this.open = false;
|
|
||||||
this.requestUpdate("open");
|
|
||||||
if(!this.open || this.disabled)
|
if(!this.open || this.disabled)
|
||||||
{
|
{
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.open = false;
|
||||||
|
this.requestUpdate("open");
|
||||||
return waitForEvent(this, 'sl-after-hide');
|
return waitForEvent(this, 'sl-after-hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,20 +660,6 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
|
|||||||
const path = event.composedPath();
|
const path = event.composedPath();
|
||||||
if(this && !path.includes(this))
|
if(this && !path.includes(this))
|
||||||
{
|
{
|
||||||
// If they had something OK typed, use it
|
|
||||||
if(this.addAddress(this._search.value.trim()))
|
|
||||||
{
|
|
||||||
this._search.value = "";
|
|
||||||
}
|
|
||||||
else if(this._search.value)
|
|
||||||
{
|
|
||||||
// Invalid input, show message
|
|
||||||
// Can't just call this.validate() since the input is not part of the value
|
|
||||||
let currentValue = this.value;
|
|
||||||
this.value = [this._search.value];
|
|
||||||
this.validate();
|
|
||||||
this.value = currentValue;
|
|
||||||
}
|
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -803,6 +789,9 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
|
|||||||
|
|
||||||
private handleSearchFocus()
|
private handleSearchFocus()
|
||||||
{
|
{
|
||||||
|
// Clear any manual message (errors on invalid search text)
|
||||||
|
this.set_validation_error(false);
|
||||||
|
|
||||||
this.hasFocus = true;
|
this.hasFocus = true;
|
||||||
// Should not be needed, but not firing the update
|
// Should not be needed, but not firing the update
|
||||||
this.requestUpdate("hasFocus");
|
this.requestUpdate("hasFocus");
|
||||||
@ -813,7 +802,7 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
|
|||||||
this._search.setSelectionRange(this._search.value.length, this._search.value.length);
|
this._search.setSelectionRange(this._search.value.length, this._search.value.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleSearchBlur()
|
private handleSearchBlur(event : FocusEvent)
|
||||||
{
|
{
|
||||||
this.hasFocus = false;
|
this.hasFocus = false;
|
||||||
// Should not be needed, but not firing the update
|
// Should not be needed, but not firing the update
|
||||||
@ -1095,6 +1084,11 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
|
|||||||
*/
|
*/
|
||||||
handleSuggestionsMouseUp(event : MouseEvent)
|
handleSuggestionsMouseUp(event : MouseEvent)
|
||||||
{
|
{
|
||||||
|
if(typeof event.target.value == "undefined")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const value = ((<SlOption>event.target).value).replaceAll("___", " ");
|
const value = ((<SlOption>event.target).value).replaceAll("___", " ");
|
||||||
this.addAddress(value);
|
this.addAddress(value);
|
||||||
this._search.value = "";
|
this._search.value = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user