mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-23 11:21:42 +02:00
Et2Select: Fix select options were only visible as search results
This commit is contained in:
parent
4f575894a2
commit
6c06a5311f
@ -716,11 +716,12 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect)
|
|||||||
return html`
|
return html`
|
||||||
<sl-option
|
<sl-option
|
||||||
part="option"
|
part="option"
|
||||||
|
exportparts="prefix:tag__prefix, suffix:tag__suffix"
|
||||||
value="${value}"
|
value="${value}"
|
||||||
title="${!option.title || this.noLang ? option.title : this.egw().lang(option.title)}"
|
title="${!option.title || this.noLang ? option.title : this.egw().lang(option.title)}"
|
||||||
class=${classMap({
|
class=${classMap({
|
||||||
"match": option.isMatch,
|
"match": this.searchEnabled && option.isMatch,
|
||||||
"no-match": !option.isMatch,
|
"no-match": this.searchEnabled && !option.isMatch,
|
||||||
...Object.fromEntries((option.class || "").split(" ").map(k => [k, true]))
|
...Object.fromEntries((option.class || "").split(" ").map(k => [k, true]))
|
||||||
})}
|
})}
|
||||||
.option=${option}
|
.option=${option}
|
||||||
|
@ -13,6 +13,7 @@ import {css, html, nothing, TemplateResult} from "@lion/core";
|
|||||||
import {IsEmail} from "../../api/js/etemplate/Validators/IsEmail";
|
import {IsEmail} from "../../api/js/etemplate/Validators/IsEmail";
|
||||||
import {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions";
|
import {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions";
|
||||||
import {Et2StaticSelectMixin} from "../../api/js/etemplate/Et2Select/StaticOptions";
|
import {Et2StaticSelectMixin} from "../../api/js/etemplate/Et2Select/StaticOptions";
|
||||||
|
import {classMap} from "lit/directives/class-map.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select widget customised for calendar owner, which can be a user
|
* Select widget customised for calendar owner, which can be a user
|
||||||
@ -56,16 +57,30 @@ export class CalendarOwner extends Et2StaticSelectMixin(Et2Select)
|
|||||||
*/
|
*/
|
||||||
_optionTemplate(option : SelectOption) : TemplateResult
|
_optionTemplate(option : SelectOption) : TemplateResult
|
||||||
{
|
{
|
||||||
|
// Exclude non-matches when searching
|
||||||
|
// unless they're already selected, in which case removing them removes them from value
|
||||||
|
if(typeof option.isMatch == "boolean" && !option.isMatch && !this.getValueAsArray().includes(option.value))
|
||||||
|
{
|
||||||
|
return html``;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tag used must match this.optionTag, but you can't use the variable directly.
|
||||||
|
// Pass option along so SearchMixin can grab it if needed
|
||||||
const value = (<string>option.value).replaceAll(" ", "___");
|
const value = (<string>option.value).replaceAll(" ", "___");
|
||||||
return html`
|
return html`
|
||||||
<sl-option
|
<sl-option
|
||||||
part="option"
|
part="option"
|
||||||
exportparts="prefix:tag__prefix, suffix:tag__suffix"
|
exportparts="prefix:tag__prefix, suffix:tag__suffix"
|
||||||
value="${option.value}"
|
value="${value}"
|
||||||
title="${!option.title || this.noLang ? option.title : this.egw().lang(option.title)}"
|
title="${!option.title || this.noLang ? option.title : this.egw().lang(option.title)}"
|
||||||
class="${option.class}" .option=${option}
|
class=${classMap({
|
||||||
?disabled=${option.disabled}
|
"match": option.isMatch,
|
||||||
|
"no-match": !option.isMatch,
|
||||||
|
...Object.fromEntries((option.class || "").split(" ").map(k => [k, true]))
|
||||||
|
})}
|
||||||
|
.option=${option}
|
||||||
.selected=${this.getValueAsArray().some(v => v == value)}
|
.selected=${this.getValueAsArray().some(v => v == value)}
|
||||||
|
?disabled=${option.disabled}
|
||||||
>
|
>
|
||||||
${this._iconTemplate(option)}
|
${this._iconTemplate(option)}
|
||||||
${this.noLang ? option.label : this.egw().lang(option.label)}
|
${this.noLang ? option.label : this.egw().lang(option.label)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user