Vanessa 2025-07-25 14:55:27 +08:00
parent f3427dcf5f
commit 8cb40edce3
4 changed files with 30 additions and 2 deletions

View file

@ -169,7 +169,7 @@ export const getGroupsHTML = (columns: IAVColumn[], view: IAVView) => {
groupHTML += `<button class="b3-menu__item" draggable="${disabledDrag ? "false" : "true"}">
${disabledDrag ? "" : '<svg class="b3-menu__icon fn__grab"><use xlink:href="#iconDrag"></use></svg>'}
<div class="b3-menu__label fn__flex">${item.name || ""}</div>
<svg class="b3-menu__action"><use xlink:href="#iconEye${item.groupHidden ? "off" : ""}"></use></svg>
<svg class="b3-menu__action" data-type="hideGroup" data-id="${item.id}"><use xlink:href="#iconEye${item.groupHidden ? "off" : ""}"></use></svg>
</button>`;
});
}

View file

@ -1500,6 +1500,33 @@ export const openMenuPanel = (options: {
event.preventDefault();
event.stopPropagation();
break;
} else if (type === "hideGroup") {
window.siyuan.menus.menu.remove();
const useElement = target.firstElementChild;
const isHide = useElement.getAttribute("xlink:href") !== "#iconEye";
useElement.setAttribute("xlink:href", "#iconEyeoff");
transaction(options.protyle, [{
action: "hideAttrViewGroup",
avID: data.id,
blockID,
id: target.dataset.id,
data: isHide,
}], [{
action: "hideAttrViewGroup",
avID: data.id,
blockID,
id: target.dataset.id,
data: !isHide
}]);
data.view.groups.find((item) => {
if (item.id === target.dataset.id) {
item.groupHidden = isHide;
return true;
}
});
event.preventDefault();
event.stopPropagation();
break;
} else if (type === "removeGroups") {
window.siyuan.menus.menu.remove();
transaction(options.protyle, [{