mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
Get country flags showing again
This commit is contained in:
parent
36f42f77db
commit
a4b0a2a1f0
@ -808,7 +808,7 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<sl-option
|
<sl-option
|
||||||
part="emptyLabel"
|
part="emptyLabel option"
|
||||||
value=""
|
value=""
|
||||||
.selected=${this.getValueAsArray().some(v => v == "")}
|
.selected=${this.getValueAsArray().some(v => v == "")}
|
||||||
>
|
>
|
||||||
|
@ -687,6 +687,8 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.setAttribute("open", "");
|
||||||
|
|
||||||
// Move search (& menu) if there's no value
|
// Move search (& menu) if there's no value
|
||||||
this._activeControls?.classList.toggle("novalue", this.multiple && this.value == '' || !this.multiple);
|
this._activeControls?.classList.toggle("novalue", this.multiple && this.value == '' || !this.multiple);
|
||||||
|
|
||||||
@ -759,6 +761,8 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.removeAttribute("open");
|
||||||
|
|
||||||
this.clearSearch();
|
this.clearSearch();
|
||||||
|
|
||||||
// Reset display
|
// Reset display
|
||||||
|
@ -12,6 +12,7 @@ import {Et2Select} from "../Et2Select";
|
|||||||
import {Et2StaticSelectMixin, StaticOptions as so} from "../StaticOptions";
|
import {Et2StaticSelectMixin, StaticOptions as so} from "../StaticOptions";
|
||||||
import {egw} from "../../../jsapi/egw_global";
|
import {egw} from "../../../jsapi/egw_global";
|
||||||
import {SelectOption} from "../FindSelectOptions";
|
import {SelectOption} from "../FindSelectOptions";
|
||||||
|
import {html} from "lit";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Customised Select widget for countries
|
* Customised Select widget for countries
|
||||||
@ -46,14 +47,51 @@ export class Et2SelectCountry extends Et2StaticSelectMixin(Et2Select)
|
|||||||
connectedCallback()
|
connectedCallback()
|
||||||
{
|
{
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
|
|
||||||
// Add element for current value flag
|
|
||||||
this.querySelector("[slot=prefix].tag_image")?.remove();
|
|
||||||
let image = document.createElement("span");
|
|
||||||
image.slot = "prefix";
|
|
||||||
image.classList.add("tag_image", "flag");
|
|
||||||
this.appendChild(image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the element for the flag
|
||||||
|
*
|
||||||
|
* @param option
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
protected _iconTemplate(option)
|
||||||
|
{
|
||||||
|
return html`
|
||||||
|
<span slot="prefix" part="flag country_${option.value}_flag"
|
||||||
|
style="width: var(--icon-width)">
|
||||||
|
</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to render each option into the select
|
||||||
|
* Override to get flags in
|
||||||
|
*
|
||||||
|
* @param {SelectOption} option
|
||||||
|
* @returns {TemplateResult}
|
||||||
|
*
|
||||||
|
protected _optionTemplate(option : SelectOption) : TemplateResult
|
||||||
|
{
|
||||||
|
// Exclude non-matches when searching
|
||||||
|
if(typeof option.isMatch == "boolean" && !option.isMatch)
|
||||||
|
{
|
||||||
|
return html``;
|
||||||
|
}
|
||||||
|
|
||||||
|
return html`
|
||||||
|
<sl-option
|
||||||
|
part="option"
|
||||||
|
value="${value}"
|
||||||
|
title="${!option.title || this.noLang ? option.title : this.egw().lang(option.title)}"
|
||||||
|
class="${option.class}" .option=${option}
|
||||||
|
.selected=${this.getValueAsArray().some(v => v == value)}
|
||||||
|
?disabled=${option.disabled}
|
||||||
|
>
|
||||||
|
${this._iconTemplate(option)}
|
||||||
|
${this.noLang ? option.label : this.egw().lang(option.label)}
|
||||||
|
</sl-option>`;
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("et2-select-country", Et2SelectCountry);
|
customElements.define("et2-select-country", Et2SelectCountry);
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user