mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-31 05:48:49 +01:00
This commit is contained in:
parent
fa1e63302f
commit
5e9c24a409
6 changed files with 35 additions and 15 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"insertRowTip": "新增行已被過濾,可取消過濾進行檢視",
|
||||
"insertPhoto": "拍照並插入",
|
||||
"relativeToToday": "相對於今天",
|
||||
"current": "當前",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"insertRowTip": "新增行已被过滤,可取消过滤进行查看",
|
||||
"insertPhoto": "拍照并插入",
|
||||
"relativeToToday": "相对于今天",
|
||||
"current": "当前",
|
||||
|
|
|
|||
|
|
@ -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") => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue