Vanessa 2024-05-09 10:37:12 +08:00
parent 6f741b53cf
commit 8b35e7f8bf
2 changed files with 18 additions and 6 deletions

View file

@ -643,7 +643,10 @@
.av {
.b3-chip[data-type="block-more"],
.av__row--util,
.av__row--util:not(.av__readonly--show),
.av__row--footer:not(.av__readonly--show),
.av__row--util .b3-button[data-type="av-add-bottom"],
.av__row--util svg[data-type="set-page-size"],
.av__row--header > .block__icons,
.av__views .fn__space,
.av__views .block__icon:not([data-type="av-search-icon"]),
@ -651,7 +654,7 @@
display: none;
}
.av__row--footer {
.av__row--util:not(.av__readonly--show) + .av__row--footer.av__readonly--show {
border-top-color: transparent;
}
@ -662,5 +665,10 @@
.av__row--footer:hover .av__calc:not(.av__calc--ashow) {
opacity: 0;
}
.av__row--footer .av__calc:hover,
.av__cell--header:hover {
background-color: transparent;
}
}
}

View file

@ -114,6 +114,7 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v
tableHTML = '<div class="av__row av__row--header"><div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>';
calcHTML = '<div class="av__colsticky">';
}
let hasCalc = false;
data.columns.forEach((column: IAVColumn, index: number) => {
if (column.hidden) {
return;
@ -130,13 +131,16 @@ style="width: ${column.width || "200px"};">
tableHTML += "</div>";
}
// lineNumber type 不参与计算操作
if (column.type === "lineNumber") {
calcHTML += `<div data-col-id="${column.id}" data-dtype="${column.type}" style="display: flex; width: ${column.width || "200px"}">&nbsp;</div>`;
// lineNumber type 不参与计算操作
calcHTML += `<div data-col-id="${column.id}" data-dtype="${column.type}" style="width: ${column.width || "200px"}">&nbsp;</div>`;
} else {
calcHTML += `<div class="av__calc${column.calc && column.calc.operator !== "" ? " av__calc--ashow" : ""}" data-col-id="${column.id}" data-dtype="${column.type}" data-operator="${column.calc?.operator || ""}"
style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use xlink:href="#iconDown"></use></svg>' + window.siyuan.languages.calc}</div>`;
}
if (column.calc && column.calc.operator !== "") {
hasCalc = true
}
if (pinIndex === index) {
calcHTML += "</div>";
@ -247,7 +251,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
<div class="av__scroll">
<div class="av__body">
${tableHTML}
<div class="av__row--util">
<div class="av__row--util${data.rowCount > data.rows.length ? " av__readonly--show" : ""}">
<div class="av__colsticky">
<button class="b3-button" data-type="av-add-bottom">
<svg><use xlink:href="#iconAdd"></use></svg>
@ -263,7 +267,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
</button>
</div>
</div>
<div class="av__row--footer">${calcHTML}</div>
<div class="av__row--footer${hasCalc?" av__readonly--show":""}">${calcHTML}</div>
</div>
</div>
<div class="av__cursor" contenteditable="true">${Constants.ZWSP}</div>