diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 7d2759d6f..d2e181e71 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1,4 +1,5 @@ { + "insertRowTip": "New rows have been filtered, you can cancel the filtering to view", "insertPhoto": "Take a photo and insert it", "relativeToToday": "Relative to today", "current": "This", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index e9c8fce4c..78095f253 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1,4 +1,5 @@ { + "insertRowTip": "Se han filtrado nuevas filas, puede cancelar el filtrado para ver", "insertPhoto": "Toma una foto e insértala", "relativeToToday": "Relativa a hoy", "current": "Esto", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 283d0a033..6425ef5bb 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1,4 +1,5 @@ { + "insertRowTip": "De nouvelles lignes ont été filtrées, vous pouvez annuler le filtrage pour afficher", "insertPhoto": "Prendre une photo et l'insérer", "relativeToToday": "Par rapport à aujourd'hui", "current": "Ceci", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 1867b2a5a..4fca46111 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -1,4 +1,5 @@ { + "insertRowTip": "新增行已被過濾,可取消過濾進行檢視", "insertPhoto": "拍照並插入", "relativeToToday": "相對於今天", "current": "當前", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 02014ce2c..6af0a457a 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1,4 +1,5 @@ { + "insertRowTip": "新增行已被过滤,可取消过滤进行查看", "insertPhoto": "拍照并插入", "relativeToToday": "相对于今天", "current": "当前", diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.ts index 17a9be213..14c8dd791 100644 --- a/app/src/protyle/render/av/row.ts +++ b/app/src/protyle/render/av/row.ts @@ -4,6 +4,7 @@ import {Menu} from "../../../plugin/Menu"; import {transaction} from "../../wysiwyg/transaction"; import {genCellValueByElement, getTypeByCellElement, popTextCell, renderCell, renderCellAttr} from "./cell"; import {fetchPost} from "../../../util/fetch"; +import {showMessage} from "../../../dialog/message"; export const selectRow = (checkElement: Element, type: "toggle" | "select" | "unselect" | "unselectAll") => { const rowElement = hasClosestByClassName(checkElement, "av__row"); @@ -71,6 +72,16 @@ export const updateHeader = (rowElement: HTMLElement) => { avHeadElement.style.position = "sticky"; }; +const setPage = (blockElement: Element) => { + const pageSize = parseInt(blockElement.getAttribute("data-page-size")); + if (pageSize) { + const currentCount = blockElement.querySelectorAll(".av__row:not(.av__row--header)").length; + if (pageSize < currentCount) { + blockElement.setAttribute("data-page-size", currentCount.toString()); + } + } +} + /** * 前端插入一假行 * @param protyle @@ -104,28 +115,32 @@ ${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' dat if (avId) { const currentRow = previousElement.nextElementSibling; const sideRow = previousElement.classList.contains("av__row--header") ? currentRow.nextElementSibling : previousElement; - if (sideRow.classList.contains("av__row")) { - fetchPost("/api/av/getAttributeViewFilterSort", {id: avId}, (response) => { - response.data.filters.forEach((item: IAVFilter) => { + fetchPost("/api/av/getAttributeViewFilterSort", {id: avId}, (response) => { + // https://github.com/siyuan-note/siyuan/issues/10517 + let hideTextCell = false; + response.data.filters.find((item: IAVFilter) => { + if (["relation", "rollup", "template", "created", "updated"].includes(item.type)) { + hideTextCell = true; + return 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}"]`); const cellValue = genCellValueByElement(getTypeByCellElement(sideRowCellElement), sideRowCellElement); cellElement.innerHTML = renderCell(cellValue); renderCellAttr(cellElement, cellValue); - }); - popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block"); + } }); - } else { - popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block"); - } - } - const pageSize = parseInt(blockElement.getAttribute("data-page-size")); - if (pageSize) { - const currentCount = blockElement.querySelectorAll(".av__row:not(.av__row--header)").length; - if (pageSize < currentCount) { - blockElement.setAttribute("data-page-size", currentCount.toString()); - } + if (hideTextCell) { + currentRow.remove(); + showMessage(window.siyuan.languages.insertRowTip); + } else { + popTextCell(protyle, [currentRow.querySelector('.av__cell[data-detached="true"]')], "block"); + } + setPage(blockElement); + }); } + setPage(blockElement); }; export const stickyRow = (blockElement: HTMLElement, elementRect: DOMRect, status: "top" | "bottom" | "all") => {