Vanessa 2023-06-11 09:17:54 +08:00
parent bfacae35fa
commit 1b9e2fe35d
4 changed files with 6 additions and 2 deletions

View file

@ -142,6 +142,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
const checkElement = hasClosestByClassName(event.target, "av__firstcol");
if (checkElement) {
// TODO
event.preventDefault();
event.stopPropagation();
return true;

View file

@ -5,7 +5,7 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
const type = cellElement.parentElement.parentElement.firstElementChild.children[parseInt(cellElement.getAttribute("data-index")) + 1].getAttribute("data-dtype") as TAVCol;
const cellRect = cellElement.getBoundingClientRect();
let html = "";
if (type === "block") {
if (type === "block" || type === "text") {
html = `<textarea style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 200)}px" class="b3-text-field">${cellElement.textContent}</textarea>`;
}
document.body.insertAdjacentHTML("beforeend", `<div class="av__mask">

View file

@ -51,7 +51,7 @@ export const avRender = (element: Element) => {
data.rows.forEach((row: IAVRow) => {
tableHTML += `<div class="av__row" data-id="${row.id}"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
row.cells.forEach((cell, index) => {
tableHTML += `<div class="av__cell" data-index="${index}" style="width: ${data.columns[index].width || 200}px;background-color: ${cell.bgColor || ""};color: ${cell.color || ""}">${cell.value}</div>`;
tableHTML += `<div class="av__cell" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${cell.renderValue?.content || ""}</div>`;
});
tableHTML += "<div></div></div>";
});

View file

@ -825,4 +825,7 @@ interface IAVCell {
color: string,
bgColor: string,
value: string,
renderValue: {
content: string,
}
}