Fix link to did not link

This commit is contained in:
nathan 2023-09-19 08:46:41 -06:00
parent e72671bc20
commit 368c9fae63
3 changed files with 6 additions and 15 deletions

View File

@ -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)

View File

@ -141,7 +141,7 @@ export class Et2LinkTo extends Et2InputWidget(ScopedElementsMixin(FormControlMix
<et2-link-entry .onlyApp="${this.onlyApp}"
.applicationList="${this.applicationList}"
.readonly=${this.readonly}
@sl-select=${this.handleEntrySelected}
@sl-change=${this.handleEntrySelected}
@sl-clear="${this.handleEntryCleared}">
</et2-link-entry>
<et2-button id="link_button" label="Link" class="link" .noSubmit=${true}
@ -405,6 +405,7 @@ export class Et2LinkTo extends Et2InputWidget(ScopedElementsMixin(FormControlMix
if(event.target == this.select._searchNode)
{
this.classList.add("can_link");
this.link_button.focus();
}
}

View File

@ -1023,7 +1023,7 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
// 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 = <HTMLElement>this._searchInputNode.shadowRoot.querySelector(".input__clear")
@ -1077,9 +1077,6 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
{
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(<T extends Constructor<LitElement>
{
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");