web/elements: fix table select-all checkbox being checked with no elements

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-12-25 14:10:02 +01:00
parent 5132f0f876
commit 0423023d2e
No known key found for this signature in database

View file

@ -158,6 +158,9 @@ export abstract class Table<T> extends AKElement {
PFPagination,
AKGlobal,
css`
.pf-c-table thead .pf-c-table__check {
min-width: 3rem;
}
.pf-c-table tbody .pf-c-table__check input {
margin-top: calc(var(--pf-c-table__check--input--MarginTop) + 1px);
}
@ -453,7 +456,8 @@ export abstract class Table<T> extends AKElement {
type="checkbox"
aria-label=${t`Select all rows`}
.checked=${this.selectedElements.length ===
this.data?.results.length}
this.data?.results.length &&
this.selectedElements.length > 0}
@input=${(ev: InputEvent) => {
if ((ev.target as HTMLInputElement).checked) {
this.selectedElements =