This commit is contained in:
parent
7dcdcfb0d3
commit
038cf6c1b2
4 changed files with 46 additions and 3 deletions
|
@ -649,6 +649,38 @@ export const openMenuPanel = (options: {
|
|||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "toggle-view-title") {
|
||||
if (target.firstElementChild.getAttribute("xlink:href") === "#iconEyeoff") {
|
||||
// hide
|
||||
transaction(options.protyle, [{
|
||||
action: "hideAttrViewName",
|
||||
avID,
|
||||
id: data.viewID,
|
||||
data: true
|
||||
}], [{
|
||||
action: "hideAttrViewName",
|
||||
avID,
|
||||
id: data.viewID,
|
||||
data: false
|
||||
}]);
|
||||
} else {
|
||||
transaction(options.protyle, [{
|
||||
action: "hideAttrViewName",
|
||||
avID,
|
||||
id: data.viewID,
|
||||
data: false
|
||||
}], [{
|
||||
action: "hideAttrViewName",
|
||||
avID,
|
||||
id: data.viewID,
|
||||
data: true
|
||||
}]);
|
||||
}
|
||||
options.blockElement.querySelector(".av__title").classList.add("fn__none");
|
||||
avPanelElement.remove();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (type === "duplicate-view") {
|
||||
const id = Lute.NewNodeID();
|
||||
transaction(options.protyle, [{
|
||||
|
@ -1123,7 +1155,7 @@ const getPropertiesHTML = (data: IAVTable) => {
|
|||
${item.icon ? unicode2Emoji(item.icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(item.type)}"></use></svg>`}
|
||||
${item.name}
|
||||
</div>
|
||||
<svg class="b3-menu__action" data-type="showCol"><use xlink:href="#iconEyeoff"></use></svg>
|
||||
<svg class="b3-menu__action" data-type="showCol"><use xlink:href="#iconEye"></use></svg>
|
||||
<svg class="b3-menu__action" data-type="editCol"><use xlink:href="#iconEdit"></use></svg>
|
||||
</button>`;
|
||||
} else {
|
||||
|
@ -1133,7 +1165,7 @@ const getPropertiesHTML = (data: IAVTable) => {
|
|||
${item.icon ? unicode2Emoji(item.icon, "b3-menu__icon", true) : `<svg class="b3-menu__icon"><use xlink:href="#${getColIconByType(item.type)}"></use></svg>`}
|
||||
${item.name}
|
||||
</div>
|
||||
<svg class="b3-menu__action${item.type === "block" ? " fn__none" : ""}" data-type="hideCol"><use xlink:href="#iconEye"></use></svg>
|
||||
<svg class="b3-menu__action${item.type === "block" ? " fn__none" : ""}" data-type="hideCol"><use xlink:href="#iconEyeoff"></use></svg>
|
||||
<svg class="b3-menu__action${item.type === "block" ? " fn__none" : ""}" data-type="editCol"><use xlink:href="#iconEdit"></use></svg>
|
||||
</button>`;
|
||||
}
|
||||
|
|
|
@ -149,11 +149,13 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value)}</div>`;
|
|||
tableHTML += "<div></div></div>";
|
||||
});
|
||||
let tabHTML = "";
|
||||
let viewData: IAVView;
|
||||
response.data.views.forEach((item: IAVView) => {
|
||||
tabHTML += `<div data-id="${item.id}" class="item${item.id === response.data.viewID ? " item--focus" : ""}">
|
||||
${item.icon ? unicode2Emoji(item.icon, "item__graphic", true) : '<svg class="item__graphic"><use xlink:href="#iconTable"></use></svg>'}
|
||||
<span class="item__text">${item.name}</span>
|
||||
</div>`;
|
||||
viewData = item;
|
||||
});
|
||||
e.firstElementChild.outerHTML = `<div class="av__container" style="--av-background:${e.style.backgroundColor || "var(--b3-theme-background)"}">
|
||||
<div class="av__header">
|
||||
|
@ -192,7 +194,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value)}</div>`;
|
|||
${response.data.isMirror ? ` <span class="block__icon block__icon--show ariaLabel" aria-label="${window.siyuan.languages.mirrorTip}">
|
||||
<svg><use xlink:href="#iconSplitLR"></use></svg></span><div class="fn__space"></div>` : ""}
|
||||
</div>
|
||||
<div contenteditable="${protyle.disabled ? "false" : "true"}" spellcheck="${window.siyuan.config.editor.spellcheck.toString()}" class="av__title" data-title="${response.data.name || ""}" data-tip="${window.siyuan.languages.title}">${response.data.name || ""}</div>
|
||||
<div contenteditable="${protyle.disabled ? "false" : "true"}" spellcheck="${window.siyuan.config.editor.spellcheck.toString()}" class="av__title${viewData.hideAttrViewName ? " fn__none" : ""}" data-title="${response.data.name || ""}" data-tip="${window.siyuan.languages.title}">${response.data.name || ""}</div>
|
||||
<div class="av__counter fn__none"></div>
|
||||
</div>
|
||||
<div class="av__scroll">
|
||||
|
|
|
@ -149,6 +149,13 @@ export const getViewHTML = (data: IAVTable) => {
|
|||
<span class="b3-menu__accelerator">${data.pageSize}</span>
|
||||
<svg class="b3-menu__icon b3-menu__icon--small"><use xlink:href="#iconRight"></use></svg>
|
||||
</button>
|
||||
<button class="b3-menu__item">
|
||||
<div class="b3-menu__label fn__flex">
|
||||
<svg class="b3-menu__icon"></svg>
|
||||
<span class="b3-menu__label">${window.siyuan.languages.title}</span>
|
||||
</div>
|
||||
<svg class="b3-menu__action" data-type="toggle-view-title"><use xlink:href="#iconEye${data.hideAttrViewName ? "" : "off"}"></use></svg>
|
||||
</button>
|
||||
<button class="b3-menu__separator"></button>
|
||||
<button class="b3-menu__item" data-type="duplicate-view">
|
||||
<svg class="b3-menu__icon">
|
||||
|
|
2
app/src/types/index.d.ts
vendored
2
app/src/types/index.d.ts
vendored
|
@ -51,6 +51,7 @@ type TOperation =
|
|||
| "setAttrViewPageSize"
|
||||
| "updateAttrViewColRelation"
|
||||
| "updateAttrViewColRollup"
|
||||
| "hideAttrViewName"
|
||||
type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
|
||||
type TCardType = "doc" | "notebook" | "all"
|
||||
type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
|
||||
|
@ -1064,6 +1065,7 @@ interface IAVView {
|
|||
id: string
|
||||
type: string
|
||||
icon: string
|
||||
hideAttrViewName: boolean
|
||||
}
|
||||
|
||||
interface IAVTable extends IAVView {
|
||||
|
|
Loading…
Add table
Reference in a new issue