mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
2a07997ba2
commit
e4959774e8
2 changed files with 18 additions and 20 deletions
|
@ -206,8 +206,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex,
|
||||||
});
|
});
|
||||||
contentHTML += "<div></div></div>";
|
contentHTML += "<div></div></div>";
|
||||||
});
|
});
|
||||||
return {
|
return `${contentHTML}<div class="av__row--util${data.rowCount > data.rows.length ? " av__readonly--show" : ""}">
|
||||||
contentHTML: contentHTML + `<div class="av__row--util${data.rowCount > data.rows.length ? " av__readonly--show" : ""}">
|
|
||||||
<div class="av__colsticky">
|
<div class="av__colsticky">
|
||||||
<button class="b3-button av__button" data-type="av-add-bottom">
|
<button class="b3-button av__button" data-type="av-add-bottom">
|
||||||
<svg><use xlink:href="#iconAdd"></use></svg>
|
<svg><use xlink:href="#iconAdd"></use></svg>
|
||||||
|
@ -220,9 +219,8 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex,
|
||||||
<svg data-type="set-page-size" data-size="${data.pageSize}"><use xlink:href="#iconMore"></use></svg>
|
<svg data-type="set-page-size" data-size="${data.pageSize}"><use xlink:href="#iconMore"></use></svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>`,
|
</div>
|
||||||
footerHTML: `<div class="av__row--footer${hasCalc ? " av__readonly--show" : ""}">${calcHTML}</div>`
|
<div class="av__row--footer${hasCalc ? " av__readonly--show" : ""}">${calcHTML}</div>`;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderGroupTable = (options: ITableOptions) => {
|
const renderGroupTable = (options: ITableOptions) => {
|
||||||
|
@ -239,7 +237,7 @@ const renderGroupTable = (options: ITableOptions) => {
|
||||||
<svg class="${group.groupFolded ? "" : "av__group-arrow--open"}"><use xlink:href="#iconRight"></use></svg>
|
<svg class="${group.groupFolded ? "" : "av__group-arrow--open"}"><use xlink:href="#iconRight"></use></svg>
|
||||||
</div><span class="fn__space"></span>${group.name}<span class="${group.rows.length === 0 ? "fn__none" : "counter"}">${group.rows.length}</span>
|
</div><span class="fn__space"></span>${group.name}<span class="${group.rows.length === 0 ? "fn__none" : "counter"}">${group.rows.length}</span>
|
||||||
</div>
|
</div>
|
||||||
<div data-group-id="${group.id}" style="float: left" class="av__body${group.groupFolded ? " fn__none" : ""}">${getTableHTMLs(group, options.blockElement).contentHTML}</div>`;
|
<div data-group-id="${group.id}" style="float: left" class="av__body${group.groupFolded ? " fn__none" : ""}">${getTableHTMLs(group, options.blockElement)}</div>`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (options.renderAll) {
|
if (options.renderAll) {
|
||||||
|
@ -485,10 +483,8 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: (data: IAV) =
|
||||||
if (!e.dataset.pageSize) {
|
if (!e.dataset.pageSize) {
|
||||||
e.dataset.pageSize = data.pageSize.toString();
|
e.dataset.pageSize = data.pageSize.toString();
|
||||||
}
|
}
|
||||||
const tableHTMLs = getTableHTMLs(data, e);
|
|
||||||
const avBodyHTML = `<div class="av__body" style="float: left">
|
const avBodyHTML = `<div class="av__body" style="float: left">
|
||||||
${tableHTMLs.contentHTML}
|
${getTableHTMLs(data, e)}
|
||||||
${tableHTMLs.footerHTML}
|
|
||||||
</div>`;
|
</div>`;
|
||||||
if (renderAll) {
|
if (renderAll) {
|
||||||
e.firstElementChild.outerHTML = `<div class="av__container">
|
e.firstElementChild.outerHTML = `<div class="av__container">
|
||||||
|
|
|
@ -288,19 +288,21 @@ export const stickyRow = (blockElement: HTMLElement, elementRect: DOMRect, statu
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const footerElement = blockElement.querySelector(".av__row--footer") as HTMLElement;
|
const footerElements = blockElement.querySelectorAll(".av__row--footer");
|
||||||
if (footerElement && (status === "bottom" || status === "all")) {
|
if (footerElements.length > 0 && (status === "bottom" || status === "all")) {
|
||||||
if (footerElement.querySelector(".av__calc--ashow")) {
|
footerElements.forEach((item: HTMLElement) => {
|
||||||
const bodyRect = footerElement.parentElement.getBoundingClientRect();
|
if (item.querySelector(".av__calc--ashow")) {
|
||||||
const distance = Math.ceil(elementRect.bottom - bodyRect.bottom);
|
const bodyRect = item.parentElement.getBoundingClientRect();
|
||||||
if (distance < 0 && -distance < bodyRect.height) {
|
const distance = Math.ceil(elementRect.bottom - bodyRect.bottom);
|
||||||
footerElement.style.transform = `translateY(${distance}px)`;
|
if (distance < 0 && -distance < bodyRect.height - item.clientHeight) {
|
||||||
|
item.style.transform = `translateY(${distance}px)`;
|
||||||
|
} else {
|
||||||
|
item.style.transform = "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
footerElement.style.transform = "";
|
item.style.transform = "";
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
footerElement.style.transform = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue