DocumentType picker: sets icons

This commit is contained in:
leekelleher
2024-01-15 13:31:59 +00:00
parent 9e47fdfc31
commit e667d8845d

View File

@@ -153,7 +153,7 @@ export class UmbInputDocumentTypeElement extends FormControlMixin(UmbLitElement)
>${repeat(
this._items,
(item) => item.id,
(item) => this._renderItem(item),
(item) => this.#renderItem(item),
)}</uui-ref-list
>
`;
@@ -172,10 +172,11 @@ export class UmbInputDocumentTypeElement extends FormControlMixin(UmbLitElement)
`;
}
private _renderItem(item: DocumentTypeItemResponseModel) {
#renderItem(item: DocumentTypeItemResponseModel) {
if (!item.id) return;
return html`
<uui-ref-node-document-type name=${ifDefined(item.name)}>
${this.#renderIcon(item)}
<uui-action-bar slot="actions">
<uui-button
compact
@@ -194,6 +195,11 @@ export class UmbInputDocumentTypeElement extends FormControlMixin(UmbLitElement)
`;
}
#renderIcon(item: DocumentTypeItemResponseModel) {
if (!item.icon) return;
return html`<uui-icon slot="icon" name=${item.icon}></uui-icon>`;
}
static styles = [
css`
#add-button {