web/elements: fix unchecking all elements not unchecking select-all
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
47070261b0
commit
769a3424dc
|
@ -233,6 +233,18 @@ export abstract class Table<T> extends LitElement {
|
||||||
this.selectedElements.splice(index, 1);
|
this.selectedElements.splice(index, 1);
|
||||||
}
|
}
|
||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
|
// Unset select-all if selectedElements is empty
|
||||||
|
if (this.selectedElements.length < 1) {
|
||||||
|
const selectAllCheckbox =
|
||||||
|
this.shadowRoot?.querySelector<HTMLInputElement>(
|
||||||
|
"[name=select-all]",
|
||||||
|
);
|
||||||
|
if (!selectAllCheckbox) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
selectAllCheckbox.checked = false;
|
||||||
|
this.requestUpdate();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</td>`
|
</td>`
|
||||||
|
@ -375,6 +387,7 @@ export abstract class Table<T> extends LitElement {
|
||||||
${this.checkbox
|
${this.checkbox
|
||||||
? html`<td class="pf-c-table__check" role="cell">
|
? html`<td class="pf-c-table__check" role="cell">
|
||||||
<input
|
<input
|
||||||
|
name="select-all"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
aria-label=${t`Select all rows`}
|
aria-label=${t`Select all rows`}
|
||||||
@input=${(ev: InputEvent) => {
|
@input=${(ev: InputEvent) => {
|
||||||
|
|
Reference in a new issue