Vanessa 2023-10-13 13:55:27 +08:00
parent 1815ec1b39
commit 7a9a85ea32
2 changed files with 36 additions and 9 deletions

View file

@ -1,9 +1,10 @@
import {hasClosestBlock} from "../../util/hasClosest";
import {focusBlock} from "../../util/selection";
export const selectRow = (checkElement: Element, type: "toggle" | "select" | "unselect") => {
export const selectRow = (checkElement: Element, type: "toggle" | "select" | "unselect" | "unselectAll") => {
const rowElement = checkElement.parentElement;
const useElement = checkElement.querySelector("use");
if (rowElement.classList.contains("av__row--header")) {
if (rowElement.classList.contains("av__row--header") || type === "unselectAll") {
if ("#iconCheck" === useElement.getAttribute("xlink:href")) {
rowElement.parentElement.querySelectorAll(".av__firstcol").forEach(item => {
item.querySelector("use").setAttribute("xlink:href", "#iconUncheck");
@ -24,6 +25,7 @@ export const selectRow = (checkElement: Element, type: "toggle" | "select" | "un
useElement.setAttribute("xlink:href", "#iconUncheck");
}
}
focusBlock(hasClosestBlock(rowElement) as HTMLElement);
updateHeader(rowElement);
}