Skip to content

Commit

Permalink
改变数据库 添加条目 加载更多 按钮的结构 (#13206)
Browse files Browse the repository at this point in the history
* Update render.ts

* Update render.ts

* Update action.ts
  • Loading branch information
TCOTC authored Nov 20, 2024
1 parent 371c64c commit 020f55e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
22 changes: 12 additions & 10 deletions app/src/protyle/render/av/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
if (!blockElement) {
return false;
}
const setPageSizeElement = hasClosestByAttribute(event.target, "data-type", "set-page-size");
if (setPageSizeElement) {
setPageSize({
target: event.target,
protyle,
avID: blockElement.getAttribute("data-av-id"),
nodeElement: blockElement
});
event.preventDefault();
event.stopPropagation();
return true;
}
const loadMoreElement = hasClosestByAttribute(event.target, "data-type", "av-load-more");
if (loadMoreElement) {
(blockElement.querySelector(".av__row--footer") as HTMLElement).style.transform = "";
Expand Down Expand Up @@ -181,16 +193,6 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
event.preventDefault();
event.stopPropagation();
return true;
} else if (type === "set-page-size") {
setPageSize({
target,
protyle,
avID: blockElement.getAttribute("data-av-id"),
nodeElement: blockElement
});
event.preventDefault();
event.stopPropagation();
return true;
} else if (type === "av-add-bottom") {
insertRows(blockElement, protyle, 1, blockElement.querySelector(".av__row--util").previousElementSibling.getAttribute("data-id") || "");
event.preventDefault();
Expand Down
10 changes: 4 additions & 6 deletions app/src/protyle/render/av/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,12 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
<div class="av__colsticky">
<button class="b3-button" data-type="av-add-bottom">
<svg><use xlink:href="#iconAdd"></use></svg>
${window.siyuan.languages.newRow}
<span>${window.siyuan.languages.newRow}</span>
</button>
<span class="fn__space"></span>
<button class="b3-button${data.rowCount > data.rows.length ? "" : " fn__none"}">
<svg data-type="av-load-more"><use xlink:href="#iconArrowDown"></use></svg>
<span data-type="av-load-more">
${window.siyuan.languages.loadMore}
</span>
<button class="b3-button${data.rowCount > data.rows.length ? "" : " fn__none"}" data-type="av-load-more">
<svg><use xlink:href="#iconArrowDown"></use></svg>
<span>${window.siyuan.languages.loadMore}</span>
<svg data-type="set-page-size" data-size="${data.pageSize}"><use xlink:href="#iconMore"></use></svg>
</button>
</div>
Expand Down

0 comments on commit 020f55e

Please sign in to comment.