This commit is contained in:
Vanessa 2023-12-29 15:00:36 +08:00
parent c70031ed3a
commit 2e1394a01b
8 changed files with 25 additions and 25 deletions

View file

@ -125,7 +125,7 @@ export const updateAssetCell = (options: {
}
const cellValue = genCellValueByElement(getTypeByCellElement(item) || item.dataset.type as TAVCol, item);
const rowID = (hasClosestByClassName(item, "av__row") as HTMLElement).dataset.id;
const oldValue = JSON.parse(JSON.stringify(cellValue))
const oldValue = JSON.parse(JSON.stringify(cellValue));
if (elementIndex === 0) {
if (options.type === "remove") {
cellValue.mAsset.find((oldItem, index) => {
@ -317,7 +317,7 @@ export const addAssetLink = (protyle: IProtyle, data: IAV, cellElements: HTMLEle
});
};
export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string, blockElement: Element) => {
export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string) => {
const msgId = showMessage(window.siyuan.languages.uploading, 0);
fetchPost("/api/asset/insertLocalAssets", {
assetPaths: files,

View file

@ -56,7 +56,7 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)
});
cellValue.mSelect = mSelect;
} else if (["date", "created", "updated"].includes(colType)) {
cellValue[colType as "date"] = JSON.parse(cellElement.querySelector(".av__celltext").getAttribute("data-value"))
cellValue[colType as "date"] = JSON.parse(cellElement.querySelector(".av__celltext").getAttribute("data-value"));
} else if (colType === "checkbox") {
cellValue.checkbox = {
checked: cellElement.querySelector("use").getAttribute("xlink:href") === "#iconCheck" ? true : false
@ -67,16 +67,16 @@ export const genCellValueByElement = (colType: TAVCol, cellElement: HTMLElement)
contents: Array.from(cellElement.querySelectorAll("span")).map((item: HTMLElement) => item.textContent),
};
} else if (colType === "mAsset") {
const mAsset: IAVCellAssetValue[] = []
const mAsset: IAVCellAssetValue[] = [];
Array.from(cellElement.children).forEach((item) => {
const isImg = item.classList.contains("av__cellassetimg")
const isImg = item.classList.contains("av__cellassetimg");
mAsset.push({
type: isImg ? "image" : "file",
content: isImg ? item.getAttribute("src") : item.getAttribute("data-url"),
name: isImg ? "" : item.textContent
})
})
cellValue.mAsset = mAsset
});
});
cellValue.mAsset = mAsset;
}
if (colType === "block") {
cellValue.isDetached = cellElement.dataset.detached === "true";
@ -313,7 +313,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
event.preventDefault();
event.stopPropagation();
}
})
});
}
inputElement.addEventListener("keydown", (event) => {
if (event.isComposing) {

View file

@ -894,7 +894,7 @@ export const openMenuPanel = (options: {
break;
} else if (type === "removeCol") {
const colId = menuElement.querySelector(".b3-menu__item").getAttribute("data-col-id");
let previousID: string
let previousID: string;
const colData = data.view.columns.find((item: IAVColumn, index) => {
if (item.id === colId) {
previousID = data.view.columns[index - 1]?.id;

View file

@ -13,7 +13,7 @@ const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTM
if (item.id === colId) {
return true;
}
})
});
transaction(protyle, [{
action: "updateAttrViewColRollup",
id: colId,
@ -28,8 +28,8 @@ const updateCol = (protyle: IProtyle, data: IAV, colId: string, itemElement: HTM
// operation.ParentID 汇总列基于的关联列 ID
// operation.KeyID 目标列 ID
// operation.Data 计算方式
}])
}
}]);
};
const genSearchList = (element: Element, keyword: string, avId: string, cb?: () => void) => {
fetchPost("/api/av/searchAttributeViewRelationKey", {
@ -115,8 +115,8 @@ export const goSearchRollupCol = (options: {
export const goSearchRollupTarget = (avId: string, target: HTMLElement) => {
}
};
export const goSearchRollupCalc = (avId: string, target: HTMLElement) => {
}
};

View file

@ -500,7 +500,7 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: H
});
return true;
}
})
});
if (item.classList.contains("custom-attr__avvalue")) {
item.innerHTML = genAVValueHTML(cellValue);
} else {