Vanessa 2023-06-10 16:40:44 +08:00
parent 23c6d5d17b
commit 5acd3aae08
4 changed files with 26 additions and 10 deletions

View file

@ -222,3 +222,20 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a
const addRow = () => {
}
const addCol = () => {
}
const removeRow = () => {
}
const removeCol = () => {
}
const updateCel = () => {
}

View file

@ -2,10 +2,7 @@ import {transaction} from "../../wysiwyg/transaction";
import {hasClosestBlock} from "../../util/hasClosest";
export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
const index = parseInt(cellElement.getAttribute("data-index"))
const tableElement = cellElement.parentElement.parentElement
const colCellElement = tableElement.firstElementChild.children[index + 1];
const type = colCellElement.getAttribute("data-dtype") as TAVCol;
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") {

View file

@ -29,14 +29,16 @@ export const avRender = (element: Element) => {
const data = response.data.av;
// header
let tableHTML = '<div class="av__row av__row--header"><div class="av__firstcol"><svg style="height: 42px"><use xlink:href="#iconUncheck"></use></svg></div>';
let index = 0
data.columns.forEach((column: IAVColumn) => {
if (column.hidden) {
return;
}
tableHTML += `<div class="av__cell" data-id="${column.id}" data-dtype="${column.type}" data-wrap="${column.wrap}" style="width: ${column.width || 200}px;">
tableHTML += `<div class="av__cell" data-index="${index}" data-id="${column.id}" data-dtype="${column.type}" data-wrap="${column.wrap}" style="width: ${column.width || 200}px;">
<svg><use xlink:href="#${column.icon || getIconByType(column.type)}"></use></svg>
<span>${column.name}</span>
</div>`;
index++;
});
tableHTML += `<div class="block__icons">
<div class="block__icon block__icon--show" data-type="av-header-add"><svg><use xlink:href="#iconAdd"></use></svg></div>