🎨 database

This commit is contained in:
Vanessa 2023-10-06 10:56:30 +08:00
parent 12f9042eab
commit 42c87d5a9b
2 changed files with 8 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import {openMenuPanel} from "./openMenuPanel";
import {Menu} from "../../../plugin/Menu"; import {Menu} from "../../../plugin/Menu";
import {updateAttrViewCellAnimation} from "./action"; import {updateAttrViewCellAnimation} from "./action";
import {isCtrl} from "../../util/compatibility"; import {isCtrl} from "../../util/compatibility";
import {objEquals} from "../../../util/functions";
export const getCalcValue = (column: IAVColumn) => { export const getCalcValue = (column: IAVColumn) => {
if (!column.calc || !column.calc.result) { if (!column.calc || !column.calc.result) {
@ -438,6 +439,9 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
inputValue.content = parseFloat(inputValue.content as string); inputValue.content = parseFloat(inputValue.content as string);
inputValue.isNotEmpty = !!inputValue.content; inputValue.isNotEmpty = !!inputValue.content;
} }
if (objEquals(inputValue, oldValue)) {
return;
}
doOperations.push({ doOperations.push({
action: "updateAttrViewCell", action: "updateAttrViewCell",
id: cellId, id: cellId,
@ -460,7 +464,9 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
}); });
updateAttrViewCellAnimation(item); updateAttrViewCellAnimation(item);
}); });
if (doOperations.length > 0) {
transaction(protyle, doOperations, undoOperations); transaction(protyle, doOperations, undoOperations);
}
setTimeout(() => { setTimeout(() => {
avMaskElement.remove(); avMaskElement.remove();
}); });

View file

@ -84,7 +84,7 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
text += `<span class="b3-chip b3-chip--info b3-chip--small" data-type="block-ref" data-id="${cell.value.block.id}" data-subtype="s">${window.siyuan.languages.openBy}</span>`; text += `<span class="b3-chip b3-chip--info b3-chip--small" data-type="block-ref" data-id="${cell.value.block.id}" data-subtype="s">${window.siyuan.languages.openBy}</span>`;
} }
} else if (cell.valueType === "number") { } else if (cell.valueType === "number") {
text = `<span class="av__celltext" data-content="${cell.value?.number.content || ""}">${cell.value?.number.formattedContent || ""}</span>`; text = `<span class="av__celltext" data-content="${cell.value?.number.isNotEmpty ? cell.value?.number.content : ""}">${cell.value?.number.formattedContent || ""}</span>`;
} else if (cell.valueType === "mSelect" || cell.valueType === "select") { } else if (cell.valueType === "mSelect" || cell.valueType === "select") {
cell.value?.mSelect?.forEach((item) => { cell.value?.mSelect?.forEach((item) => {
text += `<span class="b3-chip b3-chip--middle" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}</span>`; text += `<span class="b3-chip b3-chip--middle" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}</span>`;