mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
This commit is contained in:
parent
8a16755fd8
commit
1848f5aae0
2 changed files with 13 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
|
||||||
import {stickyRow} from "./row";
|
import {stickyRow} from "./row";
|
||||||
import {getCalcValue} from "./calc";
|
import {getCalcValue} from "./calc";
|
||||||
import {renderAVAttribute} from "./blockAttr";
|
import {renderAVAttribute} from "./blockAttr";
|
||||||
|
import {showMessage} from "../../../dialog/message";
|
||||||
|
|
||||||
export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, viewID?: string) => {
|
export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, viewID?: string) => {
|
||||||
let avElements: Element[] = [];
|
let avElements: Element[] = [];
|
||||||
|
|
@ -301,11 +302,17 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
|
||||||
} else {
|
} else {
|
||||||
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
|
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.avID}"]`)).forEach((item: HTMLElement) => {
|
||||||
item.removeAttribute("data-render");
|
item.removeAttribute("data-render");
|
||||||
|
const updateRow = item.querySelector('.av__row[data-need-update="true"]');
|
||||||
avRender(item, protyle, () => {
|
avRender(item, protyle, () => {
|
||||||
const attrElement = document.querySelector(`.b3-dialog--open[data-key="${Constants.DIALOG_ATTR}"] div[data-av-id="${operation.avID}"]`) as HTMLElement;
|
const attrElement = document.querySelector(`.b3-dialog--open[data-key="${Constants.DIALOG_ATTR}"] div[data-av-id="${operation.avID}"]`) as HTMLElement;
|
||||||
if (attrElement) {
|
if (attrElement) {
|
||||||
// 更新属性面板
|
// 更新属性面板
|
||||||
renderAVAttribute(attrElement.parentElement, attrElement.dataset.nodeId, protyle);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat
|
||||||
});
|
});
|
||||||
let html = "";
|
let html = "";
|
||||||
srcIDs.forEach((id) => {
|
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}
|
${colHTML}
|
||||||
</div>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
|
|
@ -128,10 +128,14 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat
|
||||||
let hideTextCell = false;
|
let hideTextCell = false;
|
||||||
response.data.filters.find((item: IAVFilter) => {
|
response.data.filters.find((item: IAVFilter) => {
|
||||||
const headerElement = blockElement.querySelector(`.av__cell--header[data-col-id="${item.column}"]`);
|
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;
|
hideTextCell = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (["created", "updated"].includes(filterType)) {
|
||||||
|
currentRow.setAttribute("data-need-update", "true");
|
||||||
|
}
|
||||||
if (sideRow.classList.contains("av__row")) {
|
if (sideRow.classList.contains("av__row")) {
|
||||||
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
|
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
|
||||||
const cellElement = currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`);
|
const cellElement = currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue