Vanessa 2024-03-06 11:00:12 +08:00
parent 8a16755fd8
commit 1848f5aae0
2 changed files with 13 additions and 2 deletions

View file

@ -8,6 +8,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {stickyRow} from "./row";
import {getCalcValue} from "./calc";
import {renderAVAttribute} from "./blockAttr";
import {showMessage} from "../../../dialog/message";
export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, viewID?: string) => {
let avElements: Element[] = [];
@ -301,11 +302,17 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
} else {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
item.removeAttribute("data-render");
const updateRow = item.querySelector('.av__row[data-need-update="true"]');
avRender(item, protyle, () => {
const attrElement = document.querySelector(`.b3-dialog--open[data-key="${Constants.DIALOG_ATTR}"] div[data-av-id="${operation.avID}"]`) as HTMLElement;
if (attrElement) {
// 更新属性面板
renderAVAttribute(attrElement.parentElement, attrElement.dataset.nodeId, protyle);
} else {
if (operation.action === "insertAttrViewBlock" && updateRow && !item.querySelector(`.av__row[data-id="${updateRow.getAttribute("data-id")}"]`)) {
showMessage(window.siyuan.languages.insertRowTip);
document.querySelector(".av__mask")?.remove();
}
}
});
});

View file

@ -112,7 +112,7 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat
});
let html = "";
srcIDs.forEach((id) => {
html += `<div class="av__row" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
html += `<div class="av__row" data-type="ghost" data-id="${id}" data-avid="${avId}" data-previous-id="${previousId}">
${colHTML}
</div>`;
});
@ -128,10 +128,14 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat
let hideTextCell = false;
response.data.filters.find((item: IAVFilter) => {
const headerElement = blockElement.querySelector(`.av__cell--header[data-col-id="${item.column}"]`);
if (headerElement && ["relation", "rollup", "template", "created", "updated"].includes(headerElement.getAttribute("data-dtype"))) {
const filterType = headerElement.getAttribute("data-dtype")
if (headerElement && ["relation", "rollup", "template"].includes(filterType)) {
hideTextCell = true;
return true;
}
if (["created", "updated"].includes(filterType)) {
currentRow.setAttribute("data-need-update", "true");
}
if (sideRow.classList.contains("av__row")) {
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
const cellElement = currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`);