From 6c06a5311f90dabc35566614e0d64a52095e004f Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 2 Oct 2023 08:04:19 -0600 Subject: [PATCH] Et2Select: Fix select options were only visible as search results --- api/js/etemplate/Et2Select/Et2Select.ts | 5 +++-- calendar/js/CalendarOwner.ts | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/api/js/etemplate/Et2Select/Et2Select.ts b/api/js/etemplate/Et2Select/Et2Select.ts index b2e38c81b7..aea3076480 100644 --- a/api/js/etemplate/Et2Select/Et2Select.ts +++ b/api/js/etemplate/Et2Select/Et2Select.ts @@ -716,11 +716,12 @@ export class Et2Select extends Et2WithSearchMixin(Et2WidgetWithSelect) return html` [k, true])) })} .option=${option} diff --git a/calendar/js/CalendarOwner.ts b/calendar/js/CalendarOwner.ts index 6bf2418b7f..3600370a56 100644 --- a/calendar/js/CalendarOwner.ts +++ b/calendar/js/CalendarOwner.ts @@ -13,6 +13,7 @@ import {css, html, nothing, TemplateResult} from "@lion/core"; import {IsEmail} from "../../api/js/etemplate/Validators/IsEmail"; import {SelectOption} from "../../api/js/etemplate/Et2Select/FindSelectOptions"; 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 @@ -56,16 +57,30 @@ export class CalendarOwner extends Et2StaticSelectMixin(Et2Select) */ _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 = (option.value).replaceAll(" ", "___"); return html` [k, true])) + })} + .option=${option} .selected=${this.getValueAsArray().some(v => v == value)} + ?disabled=${option.disabled} > ${this._iconTemplate(option)} ${this.noLang ? option.label : this.egw().lang(option.label)}