Et2Listbox: Make rows set the height, not the max

This commit is contained in:
nathan 2022-10-07 15:33:43 -06:00
parent 8514792efc
commit 690e89157e

View File

@ -48,7 +48,7 @@ export class Et2Listbox extends RowLimitedMixin(Et2widgetWithSelectMixin(SlMenu)
}
:host([rows])::part(base) {
max-height: calc(var(--rows, 5) * 1.9rem);
height: calc(var(--rows, 5) * 1.9rem);
overflow-y: auto;
}
`
@ -130,13 +130,16 @@ export class Et2Listbox extends RowLimitedMixin(Et2widgetWithSelectMixin(SlMenu)
{
new_value = [new_value]
}
this.requestUpdate("value", oldValue);
this.updateComplete.then(() =>
{
this.getAllItems().forEach((item) => item.checked = false);
for(let i = 0; i < new_value.length; i++)
{
const value = new_value[i];
(<SlMenuItem>this.querySelector("[value='" + value + "']")).checked = true;
}
this.requestUpdate("value", oldValue);
});
}
_optionTemplate(option : SelectOption) : TemplateResult