From 368c9fae631c835df063ae71c917918b7cf3c520 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 19 Sep 2023 08:46:41 -0600 Subject: [PATCH] Fix link to did not link --- api/js/etemplate/Et2Link/Et2LinkSearch.ts | 4 ++-- api/js/etemplate/Et2Link/Et2LinkTo.ts | 3 ++- api/js/etemplate/Et2Select/SearchMixin.ts | 14 ++------------ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/api/js/etemplate/Et2Link/Et2LinkSearch.ts b/api/js/etemplate/Et2Link/Et2LinkSearch.ts index d453f4c354..d5f0fe9c9e 100644 --- a/api/js/etemplate/Et2Link/Et2LinkSearch.ts +++ b/api/js/etemplate/Et2Link/Et2LinkSearch.ts @@ -87,8 +87,8 @@ export class Et2LinkSearch extends Et2Select // Set a value we don't have as an option? That's OK, we'll just add it if(changedProperties.has("value") && this.value && this.value.length > 0 && ( - this.getAllOptions().length == 0 || - this.getAllOptions().filter && this.getAllOptions().filter(item => this.getValueAsArray().includes(item.value)).length == 0 + this.select_options.length == 0 || + this.select_options.filter && this.select_options.filter(item => this.getValueAsArray().includes(item.value)).length == 0 )) { this._missingOption(this.value) diff --git a/api/js/etemplate/Et2Link/Et2LinkTo.ts b/api/js/etemplate/Et2Link/Et2LinkTo.ts index 8a6f6f6308..13a992f2a1 100644 --- a/api/js/etemplate/Et2Link/Et2LinkTo.ts +++ b/api/js/etemplate/Et2Link/Et2LinkTo.ts @@ -141,7 +141,7 @@ export class Et2LinkTo extends Et2InputWidget(ScopedElementsMixin(FormControlMix // Show a spinner let spinner = document.createElement("sl-spinner"); spinner.slot = "expand-icon"; - this.appendChild(spinner); + this.select.appendChild(spinner); // Hide clear button let clear_button = this._searchInputNode.shadowRoot.querySelector(".input__clear") @@ -1077,9 +1077,6 @@ export const Et2WithSearchMixin = dedupeMixin( { let target = this._optionTargetNode || this; - // Remove "no suggestions" - target.querySelector(".no-results")?.remove(); - // Remove any previously selected remote options that aren't used anymore this._selected_remote = this._selected_remote.filter((option) => { @@ -1090,14 +1087,7 @@ export const Et2WithSearchMixin = dedupeMixin( { return prev + ":not([value='" + ('' + current.value).replace(/'/g, "\\\'") + "'])"; }, ""); - target.querySelectorAll(".remote" + keepers).forEach(o => o.remove()); - target.childNodes.forEach((n) => - { - if(n.nodeType == Node.COMMENT_NODE) - { - n.remove(); - } - }) + // Not searching anymore, clear flag this.select_options.map((o) => o.isMatch = null); this.requestUpdate("select_options");