umb-table fixes issue with icon

The `item.icon` is nullable, which isn't picked up
by the `ifDefined` check, so causes a Typescript error.

Also amends CSS to align the icon with the swappable checkbox.
This commit is contained in:
leekelleher
2024-02-19 13:46:25 +00:00
parent 7da3ea345d
commit 865a7ecc7f

View File

@@ -219,7 +219,7 @@ export class UmbTableElement extends LitElement {
if (this.config.hideIcon && !this.config.allowSelection) return;
return html`<uui-table-cell>
${when(!this.config.hideIcon, () => html`<uui-icon name=${ifDefined(item.icon)}></uui-icon>`)}
${when(!this.config.hideIcon, () => html`<uui-icon name=${ifDefined(item.icon ?? undefined)}></uui-icon>`)}
${when(
this.config.allowSelection,
() =>
@@ -311,6 +311,10 @@ export class UmbTableElement extends LitElement {
justify-content: space-between;
width: 100%;
}
uui-table-cell uui-icon {
vertical-align: top;
}
`,
];
}