Swapped to use umb-ref-item instead of uui-ref-node

as `umb-ref-item` handles the node-name hover link/underline and icon.
This commit is contained in:
leekelleher
2024-08-19 11:36:09 +01:00
parent 4023952a81
commit 881bb1d588
2 changed files with 4 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ export class UmbRefItemElement extends UmbElementMixin(UUIRefElement) {
@click=${this.handleOpenClick}
@keydown=${this.handleOpenKeydown}
?disabled=${this.disabled}>
${when(this.icon, () => html`<span id="icon"><uui-icon name=${this.icon ?? ''}></uui-icon></span>`)}
${when(this.icon, () => html`<span id="icon"><umb-icon name=${this.icon ?? ''}></umb-icon></span>`)}
<div id="info">
<div id="name">${this.name}</div>
<small id="detail">${this.detail}</small>

View File

@@ -41,7 +41,6 @@ export class UmbDefaultPickerSearchResultItemElement extends UmbLitElement {
this.observe(selectionManager.selection, () => {
this._isSelected = selectionManager.isSelected(unique);
console.log(this._isSelected);
});
}
@@ -50,23 +49,18 @@ export class UmbDefaultPickerSearchResultItemElement extends UmbLitElement {
if (!item) return nothing;
return html`
<uui-ref-node
<umb-ref-item
name=${item.name}
id=${item.unique}
icon=${item.icon ?? 'icon-document'}
selectable
@selected=${() => this.#pickerContext?.selection.select(item.unique)}
@deselected=${() => this.#pickerContext?.selection.deselect(item.unique)}
?selected=${this._isSelected}>
${this.#renderIcon()}
</uui-ref-node>
</umb-ref-item>
`;
}
#renderIcon() {
if (!this.item?.icon) return nothing;
return html`<umb-icon slot="icon" name=${this.item.icon}></umb-icon>`;
}
static override readonly styles = [UmbTextStyles];
}