Vanessa 2024-05-11 17:53:15 +08:00
parent 12f3c5264a
commit 241a350341
2 changed files with 15 additions and 2 deletions

View file

@ -45,6 +45,13 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void, v
const left = e.querySelector(".av__scroll")?.scrollLeft || 0;
const headerTransform = (e.querySelector(".av__row--header") as HTMLElement)?.style.transform;
const footerTransform = (e.querySelector(".av__row--footer") as HTMLElement)?.style.transform;
const selectRowIds: string[] = [];
e.querySelectorAll(".av__row--select").forEach(rowItem => {
const rowId = rowItem.getAttribute("data-id");
if (rowId) {
selectRowIds.push(rowId);
}
})
let selectCellId = "";
const selectCellElement = e.querySelector(".av__cell--select") as HTMLElement;
if (selectCellElement) {
@ -267,7 +274,7 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
</button>
</div>
</div>
<div class="av__row--footer${hasCalc?" av__readonly--show":""}">${calcHTML}</div>
<div class="av__row--footer${hasCalc ? " av__readonly--show" : ""}">${calcHTML}</div>
</div>
</div>
<div class="av__cursor" contenteditable="true">${Constants.ZWSP}</div>
@ -304,6 +311,9 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
focusBlock(e);
}
}
selectRowIds.forEach(selectRowId => {
e.querySelector(`.av__row[data-id="${selectRowId}"]`).classList.add("av__row--select");
});
if (dragFillId) {
addDragFill(e.querySelector(`.av__row[data-id="${dragFillId.split(Constants.ZWSP)[0]}"] .av__cell[data-col-id="${dragFillId.split(Constants.ZWSP)[1]}"]`));
}

View file

@ -363,9 +363,12 @@ export const setPageSize = (options: {
};
export const deleteRow = (blockElement: HTMLElement, protyle: IProtyle) => {
const rowElements = blockElement.querySelectorAll(".av__row--select:not(.av__row--header)");
if (rowElements.length === 0) {
return;
}
const avID = blockElement.getAttribute("data-av-id");
const undoOperations: IOperation[] = [];
const rowElements = blockElement.querySelectorAll(".av__row--select:not(.av__row--header)");
const blockIds: string[] = [];
rowElements.forEach(item => {
blockIds.push(item.querySelector(".av__cell[data-block-id]").getAttribute("data-block-id"));