mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
2caa3b657c
commit
739bdc22b9
3 changed files with 76 additions and 13 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"hideCol": "隐藏列",
|
||||||
"hideAll": "隐藏全部",
|
"hideAll": "隐藏全部",
|
||||||
"showAll": "显示全部",
|
"showAll": "显示全部",
|
||||||
|
"showCol": "显示列",
|
||||||
"number": "数字",
|
"number": "数字",
|
||||||
"date": "日期",
|
"date": "日期",
|
||||||
"select": "单选",
|
"select": "单选",
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,17 @@
|
||||||
|
|
||||||
.b3-menu {
|
.b3-menu {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
|
||||||
|
.block__icon {
|
||||||
|
line-height: 20px;
|
||||||
|
padding: 0 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
align-self: center;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.b3-menu__item:not([data-type="title"]):hover {
|
.b3-menu__item:not([data-type="nobg"]):hover {
|
||||||
background-color: var(--b3-list-hover);
|
background-color: var(--b3-list-hover);
|
||||||
|
|
||||||
.b3-menu__action {
|
.b3-menu__action {
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,55 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, type
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
} else if (type === "showAllCol") {
|
} else if (type === "showAllCol") {
|
||||||
// showAllCol(data);
|
const doOperations: IOperation[] = []
|
||||||
avMenuPanel.innerHTML = getPropertiesHTML(data, tabRect);
|
const undoOperations: IOperation[] = []
|
||||||
|
data.columns.forEach((item: IAVColumn) => {
|
||||||
|
if (item.hidden) {
|
||||||
|
doOperations.push({
|
||||||
|
action: "setAttrViewColHidden",
|
||||||
|
id: item.id,
|
||||||
|
parentID: avId,
|
||||||
|
data: false
|
||||||
|
})
|
||||||
|
undoOperations.push({
|
||||||
|
action: "setAttrViewColHidden",
|
||||||
|
id: item.id,
|
||||||
|
parentID: avId,
|
||||||
|
data: true
|
||||||
|
})
|
||||||
|
item.hidden = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (doOperations.length > 0) {
|
||||||
|
transaction(protyle, doOperations, undoOperations);
|
||||||
|
avMenuPanel.innerHTML = getPropertiesHTML(data, tabRect);
|
||||||
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
} else if (type === "hideAllCol") {
|
} else if (type === "hideAllCol") {
|
||||||
|
const doOperations: IOperation[] = []
|
||||||
|
const undoOperations: IOperation[] = []
|
||||||
|
data.columns.forEach((item: IAVColumn) => {
|
||||||
|
if (!item.hidden && item.type !== "block") {
|
||||||
|
doOperations.push({
|
||||||
|
action: "setAttrViewColHidden",
|
||||||
|
id: item.id,
|
||||||
|
parentID: avId,
|
||||||
|
data: true
|
||||||
|
})
|
||||||
|
undoOperations.push({
|
||||||
|
action: "setAttrViewColHidden",
|
||||||
|
id: item.id,
|
||||||
|
parentID: avId,
|
||||||
|
data: false
|
||||||
|
})
|
||||||
|
item.hidden = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (doOperations.length > 0) {
|
||||||
|
transaction(protyle, doOperations, undoOperations);
|
||||||
|
avMenuPanel.innerHTML = getPropertiesHTML(data, tabRect);
|
||||||
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
} else if (type === "hideCol") {
|
} else if (type === "hideCol") {
|
||||||
|
|
@ -103,7 +146,7 @@ export const openMenuPanel = (protyle: IProtyle, blockElement: HTMLElement, type
|
||||||
const getConfigHTML = (data: IAV, tabRect: DOMRect) => {
|
const getConfigHTML = (data: IAV, tabRect: DOMRect) => {
|
||||||
return `<div class="b3-dialog__scrim" data-type="close"></div>
|
return `<div class="b3-dialog__scrim" data-type="close"></div>
|
||||||
<div class="b3-menu" style="right:${window.innerWidth - tabRect.right}px;top:${tabRect.bottom}px">
|
<div class="b3-menu" style="right:${window.innerWidth - tabRect.right}px;top:${tabRect.bottom}px">
|
||||||
<button class="b3-menu__item" data-type="title">
|
<button class="b3-menu__item" data-type="nobg">
|
||||||
<span class="b3-menu__label">${window.siyuan.languages.config}</span>
|
<span class="b3-menu__label">${window.siyuan.languages.config}</span>
|
||||||
<svg class="b3-menu__action" data-type="close" style="opacity: 1"><use xlink:href="#iconCloseRound"></use></svg>
|
<svg class="b3-menu__action" data-type="close" style="opacity: 1"><use xlink:href="#iconCloseRound"></use></svg>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -155,10 +198,15 @@ const getPropertiesHTML = (data: IAV, tabRect: DOMRect) => {
|
||||||
});
|
});
|
||||||
if (hideHTML) {
|
if (hideHTML) {
|
||||||
hideHTML = `<button class="b3-menu__separator"></button>
|
hideHTML = `<button class="b3-menu__separator"></button>
|
||||||
<button class="b3-menu__item" data-type="hideAllCol">
|
<button class="b3-menu__item" data-type="nobg">
|
||||||
<svg class="b3-menu__icon"><use xlink:href="#iconEyeoff"></use></svg>
|
<span class="b3-menu__label">
|
||||||
<span class="b3-menu__label">${window.siyuan.languages.hideAll}</span>
|
${window.siyuan.languages.hideCol}
|
||||||
<span class="b3-menu__accelerator">${data.columns.filter((item: IAVColumn) => item.hidden).length}</span>
|
</span>
|
||||||
|
<span class="block__icon" data-type="showAllCol">
|
||||||
|
${window.siyuan.languages.showAll}
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<svg><use xlink:href="#iconEye"></use></svg>
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
${hideHTML}`;
|
${hideHTML}`;
|
||||||
}
|
}
|
||||||
|
|
@ -170,10 +218,15 @@ ${hideHTML}`;
|
||||||
<svg class="b3-menu__action" data-type="close" style="opacity: 1"><use xlink:href="#iconCloseRound"></use></svg>
|
<svg class="b3-menu__action" data-type="close" style="opacity: 1"><use xlink:href="#iconCloseRound"></use></svg>
|
||||||
</button>
|
</button>
|
||||||
<button class="b3-menu__separator"></button>
|
<button class="b3-menu__separator"></button>
|
||||||
<button class="b3-menu__item" data-type="showAllCol">
|
<button class="b3-menu__item" data-type="nobg">
|
||||||
<svg class="b3-menu__icon"><use xlink:href="#iconEye"></use></svg>
|
<span class="b3-menu__label">
|
||||||
<span class="b3-menu__label">${window.siyuan.languages.showAll}</span>
|
${window.siyuan.languages.showCol}
|
||||||
<span class="b3-menu__accelerator">${data.columns.filter((item: IAVColumn) => !item.hidden).length}</span>
|
</span>
|
||||||
|
<span class="block__icon" data-type="hideAllCol">
|
||||||
|
${window.siyuan.languages.hideAll}
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
<svg><use xlink:href="#iconEyeoff"></use></svg>
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
${showHTML}
|
${showHTML}
|
||||||
${hideHTML}
|
${hideHTML}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue