From 83352817872556ffbaba272899fb47bb50348825 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 27 Jul 2023 13:19:43 -0600 Subject: [PATCH] Fix email tags marked as invalid --- api/js/etemplate/Et2Select/SearchMixin.ts | 58 ++++++++++++----------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/api/js/etemplate/Et2Select/SearchMixin.ts b/api/js/etemplate/Et2Select/SearchMixin.ts index 3e37349aa9..f359ac73aa 100644 --- a/api/js/etemplate/Et2Select/SearchMixin.ts +++ b/api/js/etemplate/Et2Select/SearchMixin.ts @@ -351,35 +351,8 @@ export const Et2WithSearchMixin = >(superclass // Decode URL, possibly again. If set in template, it can wind up double-encoded. this.searchUrl = this.egw().decodePath(this.searchUrl); } - } - update(changedProperties) - { - super.update(changedProperties); - - // One of the key properties has changed, need to add the needed nodes - if(changedProperties.has("search") || changedProperties.has("editModeEnabled") || changedProperties.has("allowFreeEntries")) - { - // Missing any of the required attributes? Now we need to take it out. - if(!this.searchEnabled && !this.editModeEnabled && !this.allowFreeEntries || this.readonly) - { - this.querySelector(".search_input")?.remove(); - return; - } - - // Normally this should be handled in render(), but we have to add our nodes in - this._addNodes(); - } - // Update any tags if edit mode changes - if(changedProperties.has("editModeEnabled") || changedProperties.has("readonly")) - { - // Required because we explicitly create tags instead of doing it in render() - this.shadowRoot.querySelectorAll(".select__tags > *").forEach((tag : Et2Tag) => - { - tag.editable = this.editModeEnabled && !this.readonly; - tag.removable = !this.readonly; - }); - } + // Add missing options if search or free entries enabled if(changedProperties.has("value") && this.value) { // Overridden to add options if allowFreeEntries=true @@ -414,6 +387,35 @@ export const Et2WithSearchMixin = >(superclass } } + update(changedProperties) + { + super.update(changedProperties); + + // One of the key properties has changed, need to add the needed nodes + if(changedProperties.has("search") || changedProperties.has("editModeEnabled") || changedProperties.has("allowFreeEntries")) + { + // Missing any of the required attributes? Now we need to take it out. + if(!this.searchEnabled && !this.editModeEnabled && !this.allowFreeEntries || this.readonly) + { + this.querySelector(".search_input")?.remove(); + return; + } + + // Normally this should be handled in render(), but we have to add our nodes in + this._addNodes(); + } + // Update any tags if edit mode changes + if(changedProperties.has("editModeEnabled") || changedProperties.has("readonly")) + { + // Required because we explicitly create tags instead of doing it in render() + this.shadowRoot.querySelectorAll(".select__tags > *").forEach((tag : Et2Tag) => + { + tag.editable = this.editModeEnabled && !this.readonly; + tag.removable = !this.readonly; + }); + } + } + /** * Add the nodes we need to search - adjust parent shadowDOM *