This commit is contained in:
Vanessa 2024-01-08 23:23:59 +08:00
parent 75a8ee13bd
commit 5f44965ef3
12 changed files with 28 additions and 28 deletions

View file

@ -103,12 +103,12 @@ export const updateAssetCell = (options: {
const colId = options.cellElements[0].dataset.colId;
const cellDoOperations: IOperation[] = [];
const cellUndoOperations: IOperation[] = [];
let mAssetValue: IAVCellAssetValue[]
let mAssetValue: IAVCellAssetValue[];
options.cellElements.forEach((item, elementIndex) => {
if (!options.blockElement.contains(item)) {
const rowElement = hasClosestByClassName(item, "av__row");
if (rowElement) {
item = options.cellElements[elementIndex] = options.blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement
item = options.cellElements[elementIndex] = options.blockElement.querySelector(`.av__row[data-id="${rowElement.dataset.id}"] .av__cell[data-col-id="${item.dataset.colId}"]`) as HTMLElement;
}
}
const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);
@ -144,9 +144,9 @@ export const updateAssetCell = (options: {
} else {
cellValue.mAsset = options.replaceValue;
}
mAssetValue = cellValue.mAsset
mAssetValue = cellValue.mAsset;
} else {
cellValue.mAsset = mAssetValue
cellValue.mAsset = mAssetValue;
}
cellDoOperations.push({
action: "updateAttrViewCell",

View file

@ -209,7 +209,7 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Eleme
contentElement.scrollTop = contentElement.scrollTop + cellRect.top - avHeaderRect.bottom;
}
} else {
const footerElement = blockElement.querySelector(".av__row--footer")
const footerElement = blockElement.querySelector(".av__row--footer");
if (footerElement.querySelector(".av__calc--ashow")) {
const avFooterRect = footerElement.getBoundingClientRect();
if (avFooterRect.top < cellRect.bottom) {
@ -557,7 +557,7 @@ export const renderCell = (cellValue: IAVCellValue, wrap: boolean) => {
} else if (cellValue.type === "checkbox") {
text += `<svg class="av__checkbox"><use xlink:href="#icon${cellValue?.checkbox?.checked ? "Check" : "Uncheck"}"></use></svg>`;
} else if (cellValue.type === "rollup") {
cellValue?.rollup?.contents?.forEach((item, index) => {
cellValue?.rollup?.contents?.forEach((item) => {
const rollupText = ["select", "mSelect", "mAsset", "checkbox", "relation"].includes(item.type) ? renderCell(item, wrap) : renderRollup(item);
if (rollupText) {
text += rollupText + ", ";

View file

@ -1,7 +1,7 @@
import {fetchPost} from "../../../util/fetch";
import {getColIconByType} from "./col";
import {Constants} from "../../../constants";
import {popTextCell, renderCell} from "./cell";
import {renderCell} from "./cell";
import {unicode2Emoji} from "../../../emoji";
import {focusBlock} from "../../util/selection";
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
@ -264,7 +264,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, data.colum
const refreshTimeouts: {
[key: string]: number;
} = {};
export const refreshAV = (protyle: IProtyle, operation: IOperation, isUndo: boolean) => {
export const refreshAV = (protyle: IProtyle, operation: IOperation) => {
if (operation.action === "setAttrViewName") {
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-av-id="${operation.id}"]`)).forEach((item: HTMLElement) => {
const titleElement = item.querySelector(".av__title") as HTMLElement;

View file

@ -108,14 +108,14 @@ export const insertAttrViewBlockAnimation = (protyle: IProtyle, blockElement: El
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =
renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");
})
});
response.data.sorts.forEach((item: IAVSort) => {
const sideRowCellElement = sideRow.querySelector(`.av__cell[data-col-id="${item.column}"]`) as HTMLElement;
currentRow.querySelector(`.av__cell[data-col-id="${item.column}"]`).innerHTML =
renderCell(genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement), sideRowCellElement.dataset.wrap === "true");
})
});
popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");
})
});
} else {
popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block");
}